[PATCH v1 4/7] ld.texi: Add ASCII to info file

binutils@emagii.com binutils@emagii.com
Fri Jun 28 21:46:24 GMT 2024


From: Ulf Samuelsson <ulf@emagii.com>

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
 ld/ld.texi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/ld/ld.texi b/ld/ld.texi
index 89e3913317a..5e00413f5b3 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -5643,6 +5643,7 @@ C identifiers because they contain a @samp{.} character.
 @cindex section data
 @cindex output section data
 @kindex ASCIZ ``@var{string}''
+@kindex ASCII (@var{expression}) ``@var{string}''
 @kindex BYTE(@var{expression})
 @kindex SHORT(@var{expression})
 @kindex LONG(@var{expression})
@@ -5691,6 +5692,27 @@ For example, this string of 16 characters will create a 17 byte area
   ASCIZ "This is 16 bytes"
 @end smallexample
 
+You can include a fixed size string in an output section by using
+@code{ASCII}.  The keyword is followed by a size enclosed in
+parentheses and then a string.  The string is stored at the current
+value of the location counter and zero bytes are added at the end to
+fill up to the specified size.  Note the fill value is ignored for
+this padding. 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.
+
+If the string is too long, a warning is issued and the string is
+truncated.  The string will still be zero-terminated in this case.
+
+If the expression evaluates to zero then the directive will be treated
+as if it were @code{ASCIZ} instead.
+
+Example: This is string of 16 characters and will create a 32 byte
+area:
+@smallexample
+  ASCII (32) "This is 16 bytes"
+@end smallexample
+
 Note---these commands only work inside a section description and not
 between them, so the following will produce an error from the linker:
 @smallexample
-- 
2.17.1



More information about the Binutils mailing list