[v3,1/6] Document the ASCIZ command

Message ID 20230213161124.15340-2-binutils@emagii.com
State Accepted
Headers
Series ASCIZ Command for output section |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Ulf Samuelsson Feb. 13, 2023, 4:11 p.m. UTC
  From: Ulf Samuelsson <ulf@emagii.com>

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

Patch

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