Default Allocation Algorithm
7.12.2 General Rules for Output Sections
7-54
An output section can be formed in one of two ways:
Rule 1
As the result of a SECTIONS directive definition.
Rule 2
By combining input sections with the same names into an out-
put section that is not defined in a SECTIONS directive.
If an output section is formed as a result of a SECTIONS directive (rule 1), this
definition completely determines the section's contents. (See Section 7.8, The
SECTIONS Directive , on page 7-32 for examples of how to define an output
section's content.)
An output section can also be formed when input sections are not specified by
a SECTIONS directive (rule 2). In this case, the linker combines all such input
sections that have the same name into an output section with that name. For
example, suppose the files f1.obj and f2.obj both contain named sections
called Vectors and that the SECTIONS directive does not define an output
section for them. The linker combines the two Vectors sections from the input
files into a single output section named Vectors, allocates it into memory, and
includes it in the output file.
After the linker determines the composition of all output sections, it must allo-
cate them into configured memory. The MEMORY directive specifies which
portions of memory are configured; if there is no MEMORY directive, the linker
uses the default configuration.
The linker's allocation algorithm attempts to minimize memory fragmentation.
This allows memory to be used more efficiently and increases the probability
that your program will fit into memory. This is the algorithm:
1) Output sections for which you have supplied a specific binding address
are placed in memory at that address.
2) Output sections that are included in a specific, named memory range or
that have memory attribute restrictions are allocated. Each output section
is placed into the first available space within the named area, considering
alignment where necessary.
Need help?
Do you have a question about the TMS320C54x and is the answer not in the manual?