From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 6426F3858C66 for ; Wed, 15 Feb 2023 11:41:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6426F3858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emagii.com Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id 6A16812026F; Wed, 15 Feb 2023 12:41:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emagii.com; s=default; t=1676461267; bh=oswSAnleyg9djCvke8dp45maHOfMD8u0iqEYNcaTnjg=; h=From:To:Subject; b=m89vRmjPZU3idb+CSlsfgUJD5/6B8FjABQxQ6sDAqg+vKWwBVHxD5KDYprvqp5R69 Igrqa4p9imqJ6v+CTDrdLyQ30KT6wEjoDolDFxxqqhYuEqiAEyYVvDVWNeRzJEJA8Y 04EyFTMVW1EbFYWedtfg3Xh02mddJ3Vwzz+IJQlY= Authentication-Results: emagii.beebytevps.io; spf=pass (sender IP is 84.55.68.216) smtp.mailfrom=binutils@emagii.com smtp.helo=valinor.ownit.se Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) From: binutils@emagii.com To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v0 3/6] Add ASCII to info file Date: Wed, 15 Feb 2023 12:40:49 +0100 Message-Id: <20230215114052.28292-4-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230215114052.28292-1-binutils@emagii.com> References: <20230215114052.28292-1-binutils@emagii.com> X-PPP-Message-ID: <167646126777.3837053.1057680699963332730@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 List-Id: From: Ulf Samuelsson Signed-off-by: Ulf Samuelsson --- ld/ld.texi | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ld/ld.texi b/ld/ld.texi index 335886d4e6b..e309eebfa43 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 ASCII (@var{expression}) ``@var{string}'' @kindex ASCIZ ``@var{string}'' @kindex BYTE(@var{expression}) @kindex SHORT(@var{expression}) @@ -5345,14 +5346,27 @@ When the object file format does not have an explicit endianness, as is true of, for example, S-records, the value will be stored in the endianness of the first input object file. +You can include a fixed size string in an output section by using @code{ASCII}. +The keyword is followed by a size and a string which is stored at +the current value of the location counter adding zero bytes at the end. + You can include a zero-terminated string in an output section by using @code{ASCIZ}. 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. If the string includes spaces it must be enclosed in double -quotes. The string may contain '\n', '\r', '\t' and octal numbers. -Hex numbers are not supported. +the current value of the location counter adding a zero byte at the end. + +If the string in an @code{ASCIZ} or @code{ASCIZ} command includes spaces +it must be enclosed in double quotes. +If the string is too long, a warning is issued and the string is truncated. +The string can have C escape characters like '\n', '\r', '\t' and octal numbers. +The '\"' escape is not supported. + +Example 1: This is string of 16 characters and will create a 32 byte area +@smallexample + ASCII 32, "This is 16 bytes" + ASCII (32) "This is 16 bytes" +@end smallexample -For example, this string of 16 characters will create a 17 byte area +Example 2: This is a string of 16 characters and will create a 17 byte area @smallexample ASCIZ "This is 16 bytes" @end smallexample -- 2.17.1