Output Section Keywords - Red Hat ENTERPRISE LINUX 3 - USING ID Using Instructions

Using ld, the gnu linker
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING ID:
Table of Contents

Advertisement

40
4.6.5. Output Section Data
You can include explicit bytes of data in an output section by using
as an output section command. Each keyword is followed by an expression in parentheses
SQUAD
providing the value to store (refer to Section 4.10 Expressions in Linker Scripts). The value of the
expression is stored at the current value of the location counter.
The
,
,
BYTE
SHORT
LONG
After storing the bytes, the location counter is incremented by the number of bytes stored.
For example, this will store the byte 1 followed by the four byte value of the symbol
BYTE(1)
LONG(addr)
When using a 64 bit host or target,
value. When both host and target are 32 bits, an expression is computed as 32 bits. In this case
stores a 32 bit value zero extended to 64 bits, and
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 true of, for example, S-records, the value will be stored in the endianness of the first input object
file.
Note--these commands only work inside a section description and not between them, so the following
will produce an error from the linker:
SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } }
whereas this will work:
SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } }
You may use the
FILL
expression in parentheses. Any otherwise unspecified regions of memory within the section (for ex-
ample, gaps left due to the required alignment of input sections) are filled with the value of the ex-
pression, repeated as necessary. A
it occurs in the section definition; by including more than one
fill patterns in different parts of an output section.
This example shows how to fill unspecified regions of memory with the value
FILL(0x90909090)
The
command is similar to the
FILL
the section following the
command takes precedence. Refer to Section 4.6.8.5 Output Section Fill for details on the fill expres-
sion.

4.6.6. Output Section Keywords

There are a couple of keywords which can appear as output section commands.
CREATE_OBJECT_SYMBOLS
The command tells the linker to create a symbol for each input file. The name of each symbol
will be the name of the corresponding input file. The section of each symbol will be the output
section in which the
, and
commands store one, two, four, and eight bytes (respectively).
QUAD
and
QUAD
command to set the fill pattern for the current section. It is followed by an
statement covers memory locations after the point at which
FILL
=
fillexp
command, rather than the entire section. If both are used, the
FILL
CREATE_OBJECT_SYMBOLS
are the same; they both store an 8 byte, or 64 bit,
SQUAD
stores a 32 bit value sign extended to 64 bits.
SQUAD
FILL
output section attribute, but it only affects the part of
command appears.
Chapter 4. Linker Scripts
,
,
BYTE
SHORT
LONG
addr
statement, you can have different
:
0x90
,
, or
QUAD
:
QUAD
FILL

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents