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 : [LOAD (loadAddress)] {contents} > segmentName

sectionName

Name for the output section. Must start with a period.

LOAD

Loads one or several segments at a specific address.

contents

Statements that assign a value to a symbol or specify section placement, including input sections.

segmentName

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

Example

SECTIONS Directive Example is an example sections-segment definition.

Listing 1. SECTIONS Directive Example
SECTIONS {
  .text : { 

            _textSegmentStart = .;

            alpha.c (.text)

            . = ALIGN (0x10);

            beta.c (.text)

            _textSegmentEnd = .;

  }

  .data : { *(.data) }

  .bss  : { *(.bss)

            *(COMMON)

  }

}