Output Section Attributes - 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

42

4.6.8. Output Section Attributes

We showed above that the full description of an output section looked like this:
[
] [(
section
address
{
output-section-command
output-section-command
...
} [
] [AT
region
©
We've already described
will describe the remaining section attributes.
4.6.8.1. Output Section Type
Each output section may have a type. The type is a keyword in parentheses. The following types are
defined:
NOLOAD
The section should be marked as not loadable, so that it will not be loaded into memory when
the program is run.
DSECT
COPY
INFO
OVERLAY
These type names are supported for backward compatibility, and are rarely used. They all have
the same effect: the section should be marked as not allocatable, so that no memory is allocated
for the section when the program is run.
The linker normally sets the attributes of an output section based on the input sections which map into
it. You can override this by using the section type. For example, in the script sample below, the
section is addressed at memory location
The contents of the
ROM
SECTIONS {
ROM 0 (NOLOAD) : { ... }
...
}
4.6.8.2. Output Section LMA
Every section has a virtual address (VMA) and a load address (LMA); see Section 4.1 Basic Linker
Script Concepts. The address expression which may appear in an output section description sets the
VMA (refer to Section 4.6.3 Output Section Description).
The linker will normally set the LMA equal to the VMA. You can change that by using the
word. The expression
Alternatively, with
AT
load address. Refer to Section 4.7 MEMORY Command.
This feature is designed to make it easy to build a ROM image. For example, the following linker
script creates three output sections: one called
which is loaded at the end of the
to hold uninitialized data at address
which shows that the location counter holds the VMA value, not the LMA value.
)] : [AT(
type
lma
] [:
lma_region
phdr
©
,
section
address
0
section will appear in the linker output file as usual.
that follows the
lma
expression, you may specify a memory region for the section's
lma_region
©
section even though its VMA is
.text
0x3000
)]
:
...] [=
phdr
, and
output-section-command
and does not need to be loaded when the program is run.
keyword specifies the load address of the section.
AT
, which starts at
.text
. The symbol
_data
Chapter 4. Linker Scripts
]
fillexp
. In this section we
, one called
0x1000
, and one called
0x2000
is defined with the value
ROM
key-
AT
,
.mdata
.bss
,
0x2000

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents