--any_placement=algorithm
Controls the placement of sections that are placed using the .ANY
module selector.
Syntax
--any_placement=algorithm
where
is one of the following:algorithm
best_fit
- Place the section in the execution region that currently has the least free space but is also sufficient to contain the section.
first_fit
- 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.
next_fit
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.
worst_fit
- Place the section in the execution region that currently has the most free space.
Use this option with the --scatter
option.
Usage
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
andbest_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 usingworst_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 duringnext_fit
, that region cannot be considered again regardless of priority.- Interaction with
--any_contingency
The priority of a
.ANY
selector is reduced to0
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
, andfirst_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 asFULL
and does not consider it again. This stays consistent with the rule that when a section is full it can never be revisited.
Default
The default option is worst_fit
.