Placement rules when using multiple .ANY selectors
The linker has default rules for placing sections when using multiple .ANY
selectors.
When more than one .ANY
selector is present in a scatter file, the
linker sorts sections in descending size order. It then takes the unassigned section
with the largest size and assigns the section to the most specific
.ANY
execution region that has enough free space. For example,
.ANY(.text)
is judged to be more specific than
.ANY(+RO)
.
If several execution regions are equally specific, then the section is assigned to the execution region with the most available remaining space.
For example:
-
If you have two equally specific execution regions where one has a size limit of
and the other has no limit, then all the sections are assigned to the second unbounded0x2000
.ANY
region. -
If you have two equally specific execution regions where one has a size limit of
and the other has a size limit of0x2000
, then the first sections to be placed are assigned to the second0x3000
.ANY
region of size limit
until the remaining size of the second0x3000
.ANY
is reduced to
. From this point, sections are assigned alternately between both0x2000
.ANY
execution regions.
You can specify a maximum amount of space to use for unassigned sections with
the execution region attribute ANY_SIZE
.