5.8.1 Default rules for placing unassigned sections

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:

  • You might have two equally specific execution regions where one has a size limit of 0x2000 and the other has no limit. In this case, all the sections are assigned to the second unbounded .ANY region.
  • You might have two equally specific execution regions where one has a size limit of 0x2000 and the other has a size limit of 0x3000. In this case, the first sections to be placed are assigned to the second .ANY region of size limit 0x3000. This assignment continues until the remaining size of the second .ANY region is reduced to 0x2000. From this point, sections are assigned alternately between both .ANY execution regions.

You can specify a maximum amount of space to use for unassigned sections with the execution region attribute ANY_SIZE.

Non-ConfidentialPDF file icon PDF versionARM 100748_0607_00_en
Copyright © 2016, 2017 ARM Limited or its affiliates. All rights reserved.