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

where:

module_select_pattern

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.

input_section_attr

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.

CAUTION:

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.
input_section_pattern

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.

Note:

If you use more than one input_section_pattern, ensure that there are no duplicate patterns in different execution regions to avoid ambiguity errors.
input_symbol_pattern

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
    {
        *(:gdef:mysym1)
        *(:gdef:mysym2)
    }
                        ; rest of scatter-loading description
}

You can use a quoted global symbol pattern. The :gdef: prefix can be inside or outside the quotes.

Note:

If you use more than one input_symbol_pattern, ensure that there are no duplicate patterns in different execution regions to avoid ambiguity errors.
section_properties

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.

Note:

  • 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 DUI0474M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.