You can explicitly specify the input sections that form an output section. Each
input section is identified by its filename and section name:
SECTIONS
{
.text :
{
f1.obj(.text)
f2.obj(sec1)
f3.obj
f4.obj(.text,sec2) /* Link .text and sec2 from f4.obj
}
}
It is not necessary for input sections to have the same name as each other or
as the output section they become part of. If a file is listed with no sections, all
of its sections are included in the output section. If any additional input sections
have the same name as an output section, but are not explicitly specified by
the SECTIONS directive, they are automatically linked in at the end of the
output section. For example, if the linker found more .text sections in the
preceding example, and these .text sections were not specified anywhere in
the SECTIONS directive, the linker would concatenate these extra sections
after f4.obj(sec2).
The specifications in Example 7–5 are actually a shorthand method for the
following:
SECTIONS
{
.text: { *(.text) }
.data: { *(.data) }
.bss:
{ *(.bss)
}
The specification *(.text) means the unallocated .text sections from all the
input files. This format is useful when:
-
You want the output section to contain all input sections that have a
specified name, but the output section name is different than the input
sections' name.
-
You want the linker to allocate the input sections before it processes addi-
tional input sections or commands within the braces.
/* Build .text output section
/* Link .text section from f1.obj
/* Link sec1 section from f2.obj
/* Link ALL sections from f3.obj
}
The SECTIONS Directive
Linker Description
*/
*/
*/
*/
*/
7-39
Need help?
Do you have a question about the TMS320C54x and is the answer not in the manual?