By default, the linker places input sections in the following order when generating an image:
By attribute as follows:
By input section name if they have the same attributes. Names are considered to be case-sensitive and are compared in alphabetical order using the ASCII collation sequence for characters.
By their relative positions in the input file if they have the same attributes and section names., except where overridden by
Portions of the image are collected together into a minimum number of contiguous regions.
The sorting order is unaffected by ordering within scatter files or object file names.
These rules mean that the positions of input sections with identical attributes and names included from libraries is not predictable. If you require more precise positioning, specify the individual modules explicitly in a scatter file, and include the modules in the input file list for the armlink command.
The base address of each input section is determined by the sorting order defined by the linker, and is correctly aligned within the output section that contains it.
By default, the linker creates an image consisting of an RO output section, an RW output section, and optionally a ZI output section. The RO output section can be protected at run-time on systems that have memory management hardware. RO sections can also be placed into ROM in the target.
Alternative sorting orders are available with the
option. The linker might change the
minimise the amount of veneers generated if no algorithm is chosen.
The linker might not be able to place some input sections in any execution region. When this happens, the linker generates an error message. This might occur because your current scatter file does not permit all possible module select patterns and input section selectors. How you fix this depends on the importance of placing these sections correctly:
If the sections must be placed at specific locations, then modify your scatter file to include specific module selectors and input section selectors as required.
If the placement of the unassigned sections is not important, you can use one or more
,ANYmodule selectors with optional input section selectors.
When the linker creates an input section for each ELF section in the input objects, it increments a global counter. The value of this counter is stored in the section as the creation index. The creation index is used when placing any unassigned sections that have identical properties.