| |||
| Home > Linker command-line options > --sort=algorithm | |||
This option specifies the sorting algorithm used to determine the order of sections in an output image. The sorting algorithms conform to the standard rules placing input section in ascending order by attributes.
Sort algorithms can also be specified in a scatter file for
individual execution regions using the SORTTYPE keyword.
--sort=algorithm
Where is
one of the following:algorithm
AlignmentSorts input sections by ascending order of alignment value.
AlignmentLexicalSorts input sections by ascending order of alignment value, then sorts lexically.
AvgCallDepthSorts all Thumb code before ARM 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.
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.
BreadthFirstCallTreeThis is similar to the CallTree algorithm
except that it uses a breadth-first traversal when flattening the
Call Tree into a list.
CallTreeThe
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.
This sorting algorithm is less dependent on the order of input
sections than using either RunningDepth or AvgCallDepth.
LexicalSorts according to the name of the section and then by input order if the names are the same.
LexicalAlignmentSorts input sections lexically, then according to the name of the section, and then by input order if the names are the same.
LexicalStateSorts Thumb code before ARM code, then sorts lexically.
ListProvides a list of the available sorting algorithms. The linker terminates after displaying the list.
ObjectCodeSorts
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.
RunningDepthSorts all Thumb code before ARM 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.
The default algorithm is --sort=Lexical.
In large-region mode, the default algorithm is --sort=AvgCallDepth.