Section Placement
If you wish to specify a list of input-file sections inside the parentheses,
you may separate the section names by either commas or whitespace.
If you have already explicitly included some files by name, ‘
Because some operating systems (VMS) allow brackets in file names, that
notation is no longer supported.
Both are special cases of the general mechanisms for specifying where to place
input-file sections.
For example, the following command script arranges the output file into three
consecutive sections, named
You may simply name a particular input file to be placed in the current output
section; all sections from that file are placed in the current section definition. If the
file name has already been mentioned in another section definition, with an
explicit section name list, then only those sections which have not yet been
allocated are used. To specify a list of particular files by name, use the following
example.
filename( section, section, ...)
filename( section section ...)
You can name one or more sections from your input files, for insertion in the
current output section.
*(section, section, ...)
*(section section ...)
Instead of explicitly naming particular input files in a link control script,
you can refer to all files from the ld command line: use ‘*’ instead of a particular file name before the parenthesized input-file
section list.
.text :{
*("1" "2" "3" "4")
}
.data :{
*("13" "14")
}
}
*( COMMON )
Specify where in your output file to place uninitialized data with this
notation. *(COMMON) by itself refers to all uninitialized data from all input files (so far as it
is not yet allocated); filename(COMMON) refers to uninitialized data from a particular file.
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) *(COMMON) }
}
outputa 0x10000 :
{
all.o
foo.o (.input1)
}
outputb :
{
foo.o (.input2)
foo1.o (.input1)
}
outputc :
{
*(.input1)
*(.input2)
}
}