From patchwork Mon Feb 13 12:22:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Samuelsson X-Patchwork-Id: 56264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2312720wrn; Mon, 13 Feb 2023 04:24:58 -0800 (PST) X-Google-Smtp-Source: AK7set9wxVoPfgbVWmWN0AqHobIIMGlAsK1gS4wDwXlRoNSd3KcdcGVqnov5XkHAS68S4iLkau53 X-Received: by 2002:a17:906:1252:b0:889:7781:f62e with SMTP id u18-20020a170906125200b008897781f62emr25080689eja.22.1676291098254; Mon, 13 Feb 2023 04:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676291098; cv=none; d=google.com; s=arc-20160816; b=Be/rQE8eANz+pRJ8ZfnvS2LfqlaLoU8r7cyjXRajAUc9FJryeuqLI9FoDv+Ct0u+jp oBJJqOaaT7DqcxWiR6mAmtphLQCJgY6BwID7HWPmiscE0s1UY4b84L1vsNozG7I4NBpI SCRy9pf0SSiSLM5dbKSibhe/z/pmwOagcROiOX1CDcj3D3hJttf4VE27GvupOZ9TrzkA 05/EvkO2ARadb8gsSsrPyceQNbTwh5Ybpcl3Gxas6ChCxdlx65KqsCxx5JS5d4hzNnR5 9hVzSNsqsIMBg2eN4IwOgDeso9sVcAowFCTnLdi1qGzeWNoT1e5mDxgfhJ0qjBnVH+71 lZ0Q== 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=gLxfMRx2S/w0hOQHGkTh+xxkeu5OEQTqGw8CNjbY+mAlvpUQ8ch0hNBTd8bmnbPx1b O4wvsx5DdMflR0+OVpMKkzH7mOYQPbOEsIqQvSTWEkwRLBZ1gXZBRw5CGUyTu7YoxOHi ziW7rcIQppf6tBNZBrwAtwQXOypSap7AT4/M7yBjPMlc74tO28eTlSJBAIBlsItqXs8q PbAEz7TPKSXf3e0JjH8nFOZP+1ijTywYsrFEpucw0XOROeXMTUFdm41u1MBHktZVTP9w 5Dmtin9bvpeFSp08Y2pDWZx9Duk2RCSFnZz35oG82RDeXUDnRM7FnFghjhYCorAcTRUX ovAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=lIFqHism; 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 mq24-20020a170907831800b0089418f65531si13676168ejc.89.2023.02.13.04.24.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 04:24:58 -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=lIFqHism; 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 CDD963881D34 for ; Mon, 13 Feb 2023 12:24:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDD963881D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676291050; 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=lIFqHismQeevZtVJcriFeCMNN89VNGSDx3z+VgCFjLQEH4Zf+J1CoBzgPlPP1+YT2 i9/LPZ0gVrPI4XvnavGn64v7SwUkKokoQUxbL9dYj+wl5Zs8y8+7Axqjv6LfGL2Mj2 iIsZGeKFOw9ITi8S+xYRej4y7hiMjta7nlmi7fE0= 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 3F25C3864807 for ; Mon, 13 Feb 2023 12:22:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F25C3864807 Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id CE7B4120259; Mon, 13 Feb 2023 13:22:57 +0100 (CET) Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v2 4/5] Document the ASCIZ command Date: Mon, 13 Feb 2023 13:22:40 +0100 Message-Id: <20230213122241.6144-5-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230213122241.6144-1-binutils@emagii.com> References: <20230213122241.6144-1-binutils@emagii.com> X-PPP-Message-ID: <167629097814.3735126.2305802162748224978@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-11.8 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?1757718614636164705?= X-GMAIL-MSGID: =?utf-8?q?1757718614636164705?= 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