You copied the Doc URL to your clipboard.

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

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-6 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.

Was this page helpful? Yes No