From: binutils@emagii.com
To: binutils@sourceware.org
Cc: nickc@redhat.com, Ulf Samuelsson <ulf@emagii.com>
Subject: [PATCH v0 3/6] Add ASCII to info file
Date: Wed, 15 Feb 2023 12:40:49 +0100 [thread overview]
Message-ID: <20230215114052.28292-4-binutils@emagii.com> (raw)
In-Reply-To: <20230215114052.28292-1-binutils@emagii.com>
From: Ulf Samuelsson <ulf@emagii.com>
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
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
next prev parent reply other threads:[~2023-02-15 11:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 11:40 [RFC v0 0/6] ASCII Command for output section binutils
2023-02-15 11:40 ` [PATCH v0 1/6] Add testsuite for ASCII command binutils
2023-02-15 11:40 ` [PATCH v0 2/6] Add ASCII command info to NEWS binutils
2023-02-15 11:40 ` binutils [this message]
2023-02-15 11:40 ` [PATCH v0 4/6] ldlex.l: add ASCII binutils
2023-02-15 11:44 ` Ulf Samuelsson
2023-02-15 11:40 ` [PATCH v0 5/6] ldgram.y: " binutils
2023-02-15 11:40 ` [PATCH v0 6/6] ldlang.*: parse ASCII command binutils
2023-02-15 17:07 ` [RFC v0 0/6] ASCII Command for output section Nick Clifton
2023-02-15 17:55 ` Ulf Samuelsson
2023-02-15 17:28 ` Nick Clifton
2023-02-15 17:52 ` Ulf Samuelsson
2023-02-15 18:29 ` Ulf Samuelsson
2023-02-16 16:31 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230215114052.28292-4-binutils@emagii.com \
--to=binutils@emagii.com \
--cc=binutils@sourceware.org \
--cc=nickc@redhat.com \
--cc=ulf@emagii.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).