You copied the Doc URL to your clipboard.

ARM Compiler armlink User Guide : --any_placement=algorithm


Controls the placement of sections that are placed using the .ANY module selector.



where algorithm is one of the following:

Place the section in the execution region that currently has the least free space but is also sufficient to contain the section.
Place the section in the first execution region that has sufficient space. The execution regions are examined in the order they are defined in the scatter file.

Place the section using the following rules:

  • Place in the current execution region if there is sufficient free space.
  • Place in the next execution region only if there is insufficient space in the current region.
  • Never place a section in a previous execution region.
Place the section in the execution region that currently has the most free space.

Use this option with the --scatter option.


The placement algorithms interact with scatter files and --any_contingency as follows:

Interaction with normal scatter-loading rules
Scatter-loading with or without .ANY assigns a section to the most specific selector. All algorithms continue to assign to the most specific selector in preference to .ANY priority or size considerations.
Interaction with .ANY priority

Priority is considered after assignment to the most specific selector in all algorithms.

worst_fit and best_fit consider priority before their individual placement criteria. For example, you might have .ANY1 and .ANY2 selectors, with the .ANY1 region having the most free space. When using worst_fit the section is assigned to .ANY2 because it has higher priority. Only if the priorities are equal does the algorithm come into play.

first_fit considers the most specific selector first, then priority. It does not introduce any more placement rules.

next_fit also does not introduce any more placement rules. If a region is marked full during next_fit, that region cannot be considered again regardless of priority.

Interaction with --any_contingency

The priority of a .ANY selector is reduced to 0 if the region might overflow because of linker-generated content. This is enabled and disabled independently of the sorting and placement algorithms.

armlink calculates a worst-case contingency for each section.

For worst_fit, best_fit, and first_fit, when a region is about to overflow because of the contingency, armlink lowers the priority of the related .ANY selector.

For next_fit, when a possible overflow is detected, armlink marks that section as FULL and does not consider it again. This stays consistent with the rule that when a section is full it can never be revisited.


The default option is worst_fit.