From patchwork Fri Feb 10 17:44:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Samuelsson X-Patchwork-Id: 55505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1090114wrn; Fri, 10 Feb 2023 09:50:10 -0800 (PST) X-Google-Smtp-Source: AK7set9ojv7jOCVPSsSTo6UjH2KtghzJPdzAQAs5f9pagksbkmI4u/HVrVCtwnYndAQDfPilQYfF X-Received: by 2002:a17:906:1653:b0:872:45d3:dcfa with SMTP id n19-20020a170906165300b0087245d3dcfamr17148233ejd.42.1676051410386; Fri, 10 Feb 2023 09:50:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676051410; cv=none; d=google.com; s=arc-20160816; b=YAJTJQPs2rOrr02++9j+7OiZ3EIukVnH2zJzmNNfpeRZ2LAwcausQqy5x9REJWhFnm wlOpVSxI8KJ434KPCGMtZJWi2450v3akSWRK1ok3vp5F7ZaGH82h/PKD/3viOjse53hV 5bRdZHuz6x0hOtcIikzksrAbVNmbSNGyeAyf8SiqpZF8f8wjsVLOBwIsj/lVyNqR6pYz mUL6y3WWNhnRcReiATNmPsOXw2bH3tfQGbof3HC2+xUntmAKRCN0J4YJ5ykPcXFO3c+j uZnOkQ0ARs5c+aQWF9HRmwo3eBEOobXJjoJs9lWv1gUMYUOWb9nx+WdnOBF0Mx73oH5n 1DAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=2I/6ihecE1Xxxg3iISTNLesibFfWulnA5LCUinMGGzI=; b=CdjcwjUprcCiBfOhbZxhq2fGvXAIyckrsQVLaNBHwIWwhTHBhbzGF1yuY0dYuXhulB MiZFgnB8P4kanhVbOdf7XH34ntQjO4mtpkdPjmaKIH4rlTECI9/N0GVmZ5giXqSc+XN9 U1bwszjownvlkOV98F8M0l5+aDovEIG6iN+te71msMEKmkfnQqpGN2MMxBtUCPJEQpSa d5Rru7+62GrauDhn6G8O3TkEr1ePuXKv6CWNQf4IsHdiGQr/2TCehdOWZ4HiNQUqlN9n Ym4Jy5YQ6cqWTWghzubjA1ZSYSrdCBWODYRoDYpWRKF5M4M2EEugOmg0Ak1vrm9t/3/x NXzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mHQvmTZJ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id we21-20020a170907235500b007330c08fe49si5153430ejb.206.2023.02.10.09.50.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 09:50:10 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mHQvmTZJ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C400C3948A4C for ; Fri, 10 Feb 2023 17:46:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C400C3948A4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676051217; bh=2I/6ihecE1Xxxg3iISTNLesibFfWulnA5LCUinMGGzI=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=mHQvmTZJXVHnRaN/nbuGpriKE8usX1C6vnIXISaDl4KyhUzyTzNp45jBdymguN2oV ZDKulCi0WM5jLsWBAuy57IWL6JbmROTYRNwimM40iOuWgrwhTZZzyx8p6+gebHEYTV 33+zpkNYKJGS7QEyL7cVjW5K6aHo0aQ4WBuWjaYk= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 73251385482E for ; Fri, 10 Feb 2023 17:44:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 73251385482E Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id 211601207EF; Fri, 10 Feb 2023 18:44:16 +0100 (CET) Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) To: binutils@sourceware.org Cc: Ulf Samuelsson Subject: [PATCH 4/4] Document the ASCIZ command Date: Fri, 10 Feb 2023 18:44:04 +0100 Message-Id: <20230210174404.3763-5-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230210174404.3763-1-binutils@emagii.com> References: <20230210174404.3763-1-binutils@emagii.com> X-PPP-Message-ID: <167605105641.3627019.506413855262224795@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_FAIL, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ulf Samuelsson via Binutils From: Ulf Samuelsson Reply-To: binutils@emagii.com Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757467283742604876?= X-GMAIL-MSGID: =?utf-8?q?1757467283742604876?= From: Ulf Samuelsson Signed-off-by: Ulf Samuelsson --- ld/ld.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ld/ld.texi b/ld/ld.texi index 36005dc2b0d..0a3d4adfaa0 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -5308,6 +5308,7 @@ C identifiers because they contain a @samp{.} character. @cindex data @cindex section data @cindex output section data +@kindex ASCIZ @var{string} @kindex BYTE(@var{expression}) @kindex SHORT(@var{expression}) @kindex LONG(@var{expression}) @@ -5338,6 +5339,16 @@ target are 32 bits, an expression is computed as 32 bits. In this case @code{QUAD} stores a 32 bit value zero extended to 64 bits, and @code{SQUAD} stores a 32 bit value sign extended to 64 bits. +You can include a zero-terminated string in an output section by using +@code{ASCIZ} as an output section command. The keyword is followed by a string +which is stored at the current value of the location counter adding a zero byte +at the end. + +For example, this string of 16 characters will create a 17 byte area +@smallexample +ASCIZ "This is 16 bytes" +@end smallexample + If the object file format of the output file has an explicit endianness, which is the normal case, the value will be stored in that endianness. When the object file format does not have an explicit endianness, as is