ld: Output Section Data

1 
1 3.6.5 Output Section Data
1 -------------------------
1 
1 You can include explicit bytes of data in an output section by using
1 'BYTE', 'SHORT', 'LONG', 'QUAD', or 'SQUAD' as an output section
1 command.  Each keyword is followed by an expression in parentheses
1 providing the value to store (⇒Expressions).  The value of the
1 expression is stored at the current value of the location counter.
1 
1    The 'BYTE', 'SHORT', 'LONG', and 'QUAD' commands store one, two,
1 four, and eight bytes (respectively).  After storing the bytes, the
1 location counter is incremented by the number of bytes stored.
1 
1    For example, this will store the byte 1 followed by the four byte
1 value of the symbol 'addr':
1      BYTE(1)
1      LONG(addr)
1 
1    When using a 64 bit host or target, 'QUAD' and 'SQUAD' are the same;
1 they both store an 8 byte, or 64 bit, value.  When both host and target
1 are 32 bits, an expression is computed as 32 bits.  In this case 'QUAD'
1 stores a 32 bit value zero extended to 64 bits, and 'SQUAD' stores a 32
1 bit value sign extended to 64 bits.
1 
1    If the object file format of the output file has an explicit
1 endianness, which is the normal case, the value will be stored in that
1 endianness.  When the object file format does not have an explicit
1 endianness, as is true of, for example, S-records, the value will be
1 stored in the endianness of the first input object file.
1 
1    Note--these commands only work inside a section description and not
1 between them, so the following will produce an error from the linker:
1      SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } } 
1    whereas this will work:
1      SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } } 
1 
1    You may use the 'FILL' command to set the fill pattern for the
1 current section.  It is followed by an expression in parentheses.  Any
1 otherwise unspecified regions of memory within the section (for example,
1 gaps left due to the required alignment of input sections) are filled
1 with the value of the expression, repeated as necessary.  A 'FILL'
1 statement covers memory locations after the point at which it occurs in
1 the section definition; by including more than one 'FILL' statement, you
1 can have different fill patterns in different parts of an output
1 section.
1 
1    This example shows how to fill unspecified regions of memory with the
1 value '0x90':
1      FILL(0x90909090)
1 
1    The 'FILL' command is similar to the '=FILLEXP' output section
1 attribute, but it only affects the part of the section following the
1 'FILL' command, rather than the entire section.  If both are used, the
1 'FILL' command takes precedence.  ⇒Output Section Fill, for
1 details on the fill expression.
1