7.4.7 Examples of using sorting algorithms for .ANY sections

These examples show the operation of the sorting algorithms for RO-CODE sections in sections_a.o and sections_b.o.

The input section properties and ordering are shown in the following tables:

Table 7-4 Input section properties for sections_a.o

Name Size
seca_1 0x4
seca_2 0x4
seca_3 0x10
seca_4 0x14

Table 7-5 Input section properties for sections_b.o

Name Size
secb_1 0x4
secb_2 0x4
secb_3 0x10
secb_4 0x14

Descending size example

The following linker command-line options are used for this example:
--any_sort_order=descending_size sections_a.o sections_b.o --scatter scatter.txt
The order that the sections are processed by the .ANY assignment algorithm is:

Table 7-6 Sort order for descending_size algorithm

Name Size
seca_4 0x14
secb_4 0x14
seca_3 0x10
secb_3 0x10
seca_1 0x4
seca_2 0x4
secb_1 0x4
secb_2 0x4
Sections of the same size use the tiebreak specified by --tiebreaker.

Command-line example

The following linker command-line options are used for this example:
--any_sort_order=cmdline sections_a.o sections_b.o --scatter scatter.txt
The order that the sections are processed by the .ANY assignment algorithm is:

Table 7-7 Sort order for cmdline algorithm

Name Size
seca_1 0x4
secb_1 0x4
seca_2 0x4
secb_2 0x4
seca_3 0x10
secb_3 0x10
seca_4 0x14
secb_4 0x14
Sections with the same command-line index use the tiebreak specified by --tiebreaker.
Related concepts
7.4.3 Prioritization of .ANY sections
7.4.2 Command-line options for controlling the placement of input sections for multiple .ANY selectors
7.4.4 Specify the maximum region size permitted for placing unassigned sections
Related reference
9.3 --any_sort_order=order
9.102 --scatter=filename
9.123 --tiebreaker=option
Non-ConfidentialPDF file icon PDF versionARM DUI0377G
Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved.