--sort=algorithm
Specifies the sorting algorithm used by the linker to determine the order of sections in an output image.
Syntax
--sort=algorithm
where
is one of the following:algorithm
Alignment
Sorts input sections by ascending order of alignment value.
AlignmentLexical
Sorts input sections by ascending order of alignment value, then sorts lexically.
AvgCallDepth
-
Sorts all T32 code before A32 code and then sorts according to the approximated average call depth of each section in ascending order.
Use this algorithm to minimize the number of long branch veneers.
Note
The approximation of the average call depth depends on the order of input sections. Therefore, this sorting algorithm is more dependent on the order of input sections than using, say,RunningDepth
. BreadthFirstCallTree
This is similar to the
CallTree
algorithm except that it uses a breadth-first traversal when flattening the Call Tree into a list.CallTree
The linker flattens the call tree into a list containing the read-only code sections from all execution regions that have
CallTree
sorting enabled.Sections in this list are copied back into their execution regions, followed by all the non read-only code sections, sorted lexically. Doing this ensures that sections calling each other are placed close together.
Note
This sorting algorithm is less dependent on the order of input sections than using eitherRunningDepth
orAvgCallDepth
.Lexical
Sorts according to the name of the section and then by input order if the names are the same.
LexicalAlignment
Sorts input sections lexically, then according to the name of the section, and then by input order if the names are the same.
LexicalState
-
Sorts T32 code before A32 code, then sorts lexically.
List
Provides a list of the available sorting algorithms. The linker terminates after displaying the list.
ObjectCode
Sorts code sections by tiebreaker. All other sections are sorted lexically. This is most useful when used with
--tiebreaker=cmdline
because it attempts to group all the sections from the same object together in the memory map.RunningDepth
-
Sorts all T32 code before A32 code and then sorts according to the running depth of the section in ascending order. The running depth of a section S is the average call depth of all the sections that call S, weighted by the number of times that they call S.
Use this algorithm to minimize the number of long branch veneers.
Usage
The sorting algorithms conform to the standard rules, placing input sections in ascending order by attributes.
You can also specify sort algorithms in a scatter file for individual execution regions.
Use the SORTTYPE
keyword to do this.
Note
TheSORTTYPE
execution
region attribute overrides any sorting algorithm that you specify with this option.Default
The default algorithm is --sort=Lexical
. In large region mode, the default
algorithm is --sort=AvgCallDepth
.