9.5.5.1 Input Section Description
Input section descriptions tell the linker how to map the input files into
the memory layout and represent the majority of the actions performed by a
SECTION command.
The input section description is the most basic linker script operation and consists of a file name optionally followed by a list of section names in parentheses. The file name and the section name may be wildcard patterns, which are described further below.
.text sections, one would
write:*(.text)* is a wildcard which matches
any file name. To exclude a list of files from matching the file name wildcard, the EXCLUDE_FILE command may be used to match all files except the
ones specified in the EXCLUDE_FILE list. For
example:*(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)will
cause all .ctors sections from all files except crtend.o and otherfile.o to
be included.*(.text .rodata)
*(.text) *(.rodata)The difference between these is the order in which the .text and .rodata input sections will appear in the output section. In the first example, they will be intermingled. In the second example, all .text input sections will appear first, followed by all .rodata input sections.
data.o(.data)data.oWhen a file name is specified which does not contain any wild card
characters, the linker will first see if the file name was also specified on the linker
command line or in an INPUT command. If not, the linker
will attempt to open the file as an input file, as though it appeared on the command line.
This differs from an INPUT command, because the linker
will not search for the file in the archive search path.
