SECTIONS

Starts the LCF sections segment, which defines the contents of target-memory sections. Also defines global symbols to be used in the output file.

  SECTIONS { section_spec[, section_spec] }  
Parameters

section_spec

sectionName : [AT (loadAddress)] {contents} > segmentName

sectionName

Name for the output section, such as mysection. Must start with a period.

AT (loadAddress)

Optional specifier for the load address of the section. The default value is the relocation address.

contents

Statements that assign a value to a symbol or specify section placement, including input sections. Subsections Arithmetic, Comment Operators, Specifying Files and Functions, Alignment, and . (location counter) explain possible contents statements.

segmentName

Predefined memory-segment destination for the contents of the section. The two variants are:

Remarks

For more information, see the subsection Sections Segment.

Example

The following listing is an example sections-segment definition.

Listing: SECTIONS Directive Example
SECTIONS {
  .text : { 

            _textSegmentStart = .;

            alpha.c (.text)

            . = ALIGN (0x10);

            beta.c (.text)

            _textSegmentEnd = .;

  }

  .data : { *(.data) }

  .bss  : { *(.bss)

            *(COMMON)

  }

}