SECTIONS Directive Syntax

The SECTIONS directive is specified in a command file by the word SECTIONS (uppercase), followed by a list of output section specifications enclosed in braces.

The general syntax for the SECTIONS directive is:

SECTIONS
{
name : [property [, property] [, property] . . . ]
name : [property [, property] [, property] . . . ]
name : [property [, property] [, property] . . . ]
}

Each section specification, beginning with name, defines an output section. (An output section is a section in the output file.) Section names can refer to sections, subsections, or archive library members. (See Section 12.5.5.4 for information on multi-level subsections.) After the section name is a list of properties that define the section's contents and how the section is allocated. The properties can be separated by optional commas. Possible properties for a section are as follows:

Syntax: load = allocation or
> allocation

  • Run allocation defines where in memory the section is to be run.

Syntax: run = allocation or
run > allocation

  • Input sections defines the input sections (object files) that constitute the output section. See Section 12.5.5.3.

Syntax: { input_sections }

  • Section type defines flags for special section types. See Section 12.5.8.

Syntax: type = COPY or
type = DSECT or

  • Fill value defines the value used to fill uninitialized holes. See Section 12.5.10.

Syntax: fill = value

Example 5 shows a SECTIONS directive in a sample linker command file.