10 The GNU linker
in which the options appear. ‘-L’ options do not affect how ld searches for a
linker script unless ‘-T’ option is specified.
If searchdir begins with = or $SYSROOT, then this prefix will be replaced by
the sysroot prefix, controlled by the ‘--sysroot’ option, or specified when the
linker is configured.
The default set of paths searched (without being specified with ‘-L’) depends
on which emulation mode ld is using, and in some cases also on how it was
configured. See Section 2.2 [Environment], page 53.
The paths can also be specified in a link script with the SEARCH_DIR command.
Directories specified this way are searched at the point in which the linker script
appears in the command line.
-m emulation
Emulate the emulation linker. You can list the available emulations with the
‘--verbose’ or ‘-V’ options.
If the ‘-m’ option is not used, the emulation is taken from the LDEMULATION
environment variable, if that is defined.
Otherwise, the default emulation depends upon how the linker was configured.
--remap-inputs=‘pattern’=‘filename’
--remap-inputs-file=‘file’
These options allow the names of input files to be changed before the linker
attempts to open them. The option ‘--remap-inputs=foo.o=bar.o’ will
cause any attempt to load a file called ‘foo.o’ to instead try to load a file
called ‘bar.o’. Wildcard patterns are permitted in the first filename, so
‘--remap-inputs=foo*.o=bar.o’ will rename any input file that matches
‘foo*.o’ to ‘bar.o’.
An alternative form of the option ‘--remap-inputs-file=filename’ allows
the remappings to be read from a file. Each line in the file can contain a single
remapping. Blank lines are ignored. Anything from a hash character (‘#’) to the
end of a line is considered to be a comment and is also ignored. The mapping
pattern can be separated from the filename by whitespace or an equals (‘=’)
character.
The options can be specified multiple times. Their contents accumulate. The
remappings will be processed in the order in which they occur on the command
line, and if they come from a file, in the order in which they occur in the file.
If a match is made, no further checking for that filename will be performed.
If the replacement filename is ‘/dev/null’ or just ‘NUL’ then the remapping will
actually cause the input file to be ignored. This can be a convenient way to
experiment with removing input files from a complicated build environment.
Note that this option is position dependent and only affects filenames that come
after it on the command line. Thus:
ld foo.o --remap-inputs=foo.o=bar.o
Will have no effect, whereas:
ld --remap-inputs=foo.o=bar.o foo.o
Will rename the input file ‘foo.o’ to ‘bar.o’.