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-3 Input section properties for sections_a.o

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

Table 7-4 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-5 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

With --any_sort_order=descending_size, sections of the same size use the creation index as a tiebreak.

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-6 Sort order for cmdline algorithm

Name Size
seca_1 0x4
seca_2 0x4
seca_3 0x10
seca_4 0x14
secb_1 0x4
secb_2 0x4
secb_3 0x10
secb_4 0x14

That is, the input sections are sorted by command-line index.

Non-ConfidentialPDF file icon PDF versionARM DUI0474M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.