9.5.5 Sections Command
The SECTIONS
command tells the linker how to map input sections into output sections and how to place the output sections in memory.
SECTIONS
command
is: SECTIONS
{
sections-command
sections-command
...
}
SECTIONS
command may be one of the
following:- an
ENTRY
command (see 9.5.6 Other Linker Script Commands) - a symbol assignment (see 9.5.3 Assigning Values to Symbols)
- an output section description
- an overlay description
The ENTRY
command and symbol assignments
are permitted inside the SECTIONS
command where they may
use the location counter (see 9.6.3 The Location Counter). This can also make the linker script easier to understand because
those commands can be used at meaningful points in the layout of the output file.
Output section descriptions and overlay descriptions are described below.
If a SECTIONS
command does not appear in the linker script, the linker will place each input section into an identically named output section in the order that the sections are first encountered in the input files. If all input sections are present in the first file, for example, the order of sections in the output file will match the order in the first input file. The first section will be at address zero.