From patchwork Mon Feb 13 16:11:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Samuelsson X-Patchwork-Id: 56363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2430957wrn; Mon, 13 Feb 2023 08:11:45 -0800 (PST) X-Google-Smtp-Source: AK7set9q3CwgLwATAgMR8IGWeRCLMcSGCbC6SGAktk42KxqEArA+mHmOPcpvUJxVgLmz9yrDQ5Fh X-Received: by 2002:a17:906:488e:b0:88f:9f5e:f40 with SMTP id v14-20020a170906488e00b0088f9f5e0f40mr21815585ejq.68.1676304704916; Mon, 13 Feb 2023 08:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676304704; cv=none; d=google.com; s=arc-20160816; b=fcK22iI02Vnuh3QlXdZl7fJxTQQW6g9SEFH9G3e00of5IShhs8nGMK50u+LBESU2Dl YqtVecI7kl1V43bQBtnBYNkZVFQvU5BFb22uuXmFzKWmXXBRWcl1Dwq/uVSknoZMCy5z JjjfgCD2m+sAGWrzjgnKEp9jrMVFvETxCbau29ETnHYe5gPhxU+ukZbGIDwo8c3XAVHU SH/D/1hIaIivJEgvSxZXvgmWxpZcGwaSVNShne/HPbqxWfvPISlDbcUCMqyvtRAmps3K EPYs4UvYBd56dH7hhUNpQW0v7V1wavNfyyFqY84tx5LNyPjYc7HREAcDz6b+0f/0zUIX V18g== 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=nd4sU14LKYNM9tEg3izeJIpd1vhAyaC/ZmCgIeAUqxuLTkApPaOPVaWrDtXSrPP1Vi bVgUqGIijZF1IuaGp31JaJhrEt4+PhhPpGAcRYeZzS9uDQIn78NBJpFaYIRu4AEWKBl+ Lzig8eDsOxf15U6O7r9ZQKVo/ndZqWrKqK66AMFh3PC9Ht8HT8YY/SPDwvGoBsLHVPA2 GeCXMOVkADikXsnn12PpiIrOgujPXTijpxOY1eugi0GNrdQUQVqBeOB6fVlqaqj6vngc Lyr1LEI1DBokri4REExOqasfYjnz4f1bEexnzmRMr62/kxGu/n57n3Y7Wc2zWn1+Ji4Y V+uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VRBsw7y4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id az24-20020a170907905800b008785fab5c6bsi11735448ejc.1007.2023.02.13.08.11.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 08:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VRBsw7y4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 8BFC4385842B for ; Mon, 13 Feb 2023 16:11:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BFC4385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676304701; 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=VRBsw7y4DSyY5RoxkDfl5lmc5Aaw1bqRBdT+Q2y9h03NS2SXzdwM1pZSC9P9Fkseb 17IdsO7sNvsFy0oSHY/dI4kgorb1MbT8GTCN9w5LHJb8WDKeXgef60UfNjTryWYMXi vrB2ejjmP9uF3D8EqrSwTDhqv5G9vp6hBsMrxqlE= 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 06AFA3858436 for ; Mon, 13 Feb 2023 16:11:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 06AFA3858436 Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id AE29F120205; Mon, 13 Feb 2023 17:11:28 +0100 (CET) Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v3 1/6] Document the ASCIZ command Date: Mon, 13 Feb 2023 17:11:19 +0100 Message-Id: <20230213161124.15340-2-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230213161124.15340-1-binutils@emagii.com> References: <20230213161124.15340-1-binutils@emagii.com> X-PPP-Message-ID: <167630468895.3742939.6437333571628308616@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-11.3 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?1757732882241216377?= X-GMAIL-MSGID: =?utf-8?q?1757732882241216377?= 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