Node:Format Commands, Next:Miscellaneous Commands, Previous:File Commands, Up:Simple Commands
A couple of linker script commands deal with object file formats.
OUTPUT_FORMAT(default, big, little)
OUTPUT_FORMATcommand names the BFD format to use for the output file (see BFD). Using
OUTPUT_FORMAT(bfdname)is exactly like using
-oformat bfdnameon the command line (see Command Line Options). If both are used, the command line option takes precedence.
You can use
OUTPUT_FORMAT with three arguments to use different
formats based on the
-EL command line options.
This permits the linker script to set the output format based on the
-EL are used, then the output format
will be the first argument, default. If
-EB is used, the
output format will be the second argument, big. If
used, the output format will be the third argument, little.
For example, the default linker script for the MIPS ELF target uses this
OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)This says that the default format for the output file is
elf32-bigmips, but if the user uses the
-ELcommand line option, the output file will be created in the
TARGETcommand names the BFD format to use when reading input files. It affects subsequent
GROUPcommands. This command is like using
-b bfdnameon the command line (see Command Line Options). If the
TARGETcommand is used but
OUTPUT_FORMATis not, then the last
TARGETcommand is also used to set the format for the output file. See BFD.