Keil Logo

Technical Support

On-Line Manuals

Linker User Guide

Preface Overview of the Linker Linking Models Supported by armlink Image Structure and Generation Linker Optimization Features Getting Image Details Accessing and Managing Symbols with armlink Scatter-loading Features Scatter File Syntax BNF notation used in scatter-loading description s Syntax of a scatter file Load region descriptions Components of a load region description Syntax of a load region description Load region attributes Inheritance rules for load region address attribut Inheritance rules for the RELOC address attribute Considerations when using a relative address +offs Execution region descriptions Components of an execution region description Syntax of an execution region description Execution region attributes Inheritance rules for execution region address att Considerations when using a relative address +offs Input section descriptions Components of an input section description Syntax of an input section description Examples of module and input section specification Expression evaluation in scatter files Expression usage in scatter files Expression rules in scatter files Execution address built-in functions for use in sc ScatterAssert function and load address related fu Symbol related function in a scatter file AlignExpr(expr, align) function GetPageSize() function SizeOfHeaders() function Example of aligning a base address in execution sp Scatter files containing relative base address loa Linker Command-line Options Linker Steering File Command Reference Via File Syntax

Syntax of an input section description

8.5.2 Syntax of an input section description

An input section description specifies what input sections are loaded into the parent execution region.

The syntax of an input section description, in Backus-Naur Form (BNF), is:
input_section_description ::= 
  module_select_pattern [ "(" input_section_selector ( "," input_section_selector )* ")" ]
input_section_selector ::= "+" input_section_attr
        | input_section_pattern
        | input_symbol_pattern
        | section_properties
A pattern constructed from literal text. An input section matches a module selector pattern when module_select_pattern matches one of the following:
  • The name of the object file containing the section.
  • The name of the library member (without leading path name).
  • The full name of the library (including path name) the section is extracted from. If the names contain spaces, use wild characters to simplify searching. For example, use *libname.lib to match C:\lib dir\libname.lib.
The wildcard character * matches zero or more characters and ? matches any single character.
Matching is not case-sensitive, even on hosts with case-sensitive file naming.
Use *.o to match all objects. Use * to match all object files and libraries.
You can use quoted filenames, for example "file one.o".
You cannot have two * selectors in a scatter file. You can, however, use two modified selectors, for example *A and *B, and you can use a .ANY selector together with a * module selector. The * module selector has higher precedence than .ANY. If the portion of the file containing the * selector is removed, the .ANY selector then becomes active.
An attribute selector matched against the input section attributes. Each input_section_attr follows a +.
The selectors are not case-sensitive. The following selectors are recognized:
  • RO-CODE.
  • RO-DATA.
  • RO, selects both RO-CODE and RO-DATA.
  • RW-DATA.
  • RW-CODE.
  • RW, selects both RW-CODE and RW-DATA.
  • XO.
  • ZI.
  • ENTRY, that is, a section containing an ENTRY point.
The following synonyms are recognized:
  • CODE for RO-CODE.
  • CONST for RO-DATA.
  • TEXT for RO.
  • DATA for RW.
  • BSS for ZI.
The following pseudo-attributes are recognized:
  • FIRST.
  • LAST.
Use FIRST and LAST to mark the first and last sections in an execution region if the placement order is important. For example, if a specific input section must be first in the region and an input section containing a checksum must be last.


FIRST and LAST must not violate the basic attribute sorting order. For example, FIRST RW is placed after any read-only code or read-only data.
There can be only one FIRST or one LAST attribute for an execution region, and it must follow a single input_section_selector. For example:
*(section, +FIRST)
This pattern is correct.
*(+FIRST, section)
This pattern is incorrect and produces an error message.
A pattern that is matched, without case sensitivity, against the input section name. It is constructed from literal text. The wildcard character * matches 0 or more characters, and ? matches any single character. You can use a quoted input section name.


If you use more than one input_section_pattern, ensure that there are no duplicate patterns in different execution regions to avoid ambiguity errors.
You can select the input section by the name of a global symbol that the section defines. This enables you to choose individual sections with the same name from partially linked objects.
The :gdef: prefix distinguishes a global symbol pattern from a section pattern. For example, use :gdef:mysym to select the section that defines mysym. The following example shows a scatter file in which ExecReg1 contains the section that defines global symbol mysym1, and the section that contains global symbol mysym2:
LoadRegion 0x8000
    ExecReg1 +0
                        ; rest of scatter-loading description
You can use a quoted global symbol pattern. The :gdef: prefix can be inside or outside the quotes.


If you use more than one input_symbol_pattern, ensure that there are no duplicate patterns in different execution regions to avoid ambiguity errors.
A section property can be +FIRST, +LAST, and OVERALIGN value.
The value for OVERALIGN must be a positive power of 2 and must be greater than or equal to 4.


  • The order of input section descriptors is not significant.
  • Only input sections that match both module_select_pattern and at least one input_section_attr or input_section_pattern are included in the execution region.
    If you omit (+ input_section_attr) and (input_section_pattern), the default is +RO.
  • Do not rely on input section names generated by the compiler, or used by ARM library code. These can change between compilations if, for example, different compiler options are used. In addition, section naming conventions used by the compiler are not guaranteed to remain constant between releases.
  • The BNF definitions contain additional line returns and spaces to improve readability. They are not required in scatter-loading descriptions and are ignored if present in a scatter file.
Non-ConfidentialPDF file icon PDF versionARM DUI0377H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.