ld: Format Commands

1 
1 3.4.3 Commands Dealing with Object File Formats
1 -----------------------------------------------
1 
1 A couple of linker script commands deal with object file formats.
1 
1 'OUTPUT_FORMAT(BFDNAME)'
1 'OUTPUT_FORMAT(DEFAULT, BIG, LITTLE)'
1      The 'OUTPUT_FORMAT' command names the BFD format to use for the
1      output file (⇒BFD).  Using 'OUTPUT_FORMAT(BFDNAME)' is
11      exactly like using '--oformat BFDNAME' on the command line (⇒
      Command Line Options Options.).  If both are used, the command
1      line option takes precedence.
1 
1      You can use 'OUTPUT_FORMAT' with three arguments to use different
1      formats based on the '-EB' and '-EL' command line options.  This
1      permits the linker script to set the output format based on the
1      desired endianness.
1 
1      If neither '-EB' nor '-EL' are used, then the output format will be
1      the first argument, DEFAULT.  If '-EB' is used, the output format
1      will be the second argument, BIG.  If '-EL' is used, the output
1      format will be the third argument, LITTLE.
1 
1      For example, the default linker script for the MIPS ELF target uses
1      this command:
1           OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
1      This says that the default format for the output file is
1      'elf32-bigmips', but if the user uses the '-EL' command line
1      option, the output file will be created in the 'elf32-littlemips'
1      format.
1 
1 'TARGET(BFDNAME)'
1      The 'TARGET' command names the BFD format to use when reading input
1      files.  It affects subsequent 'INPUT' and 'GROUP' commands.  This
11      command is like using '-b BFDNAME' on the command line (⇒
      Command Line Options Options.).  If the 'TARGET' command is used
1      but 'OUTPUT_FORMAT' is not, then the last 'TARGET' command is also
1      used to set the format for the output file.  ⇒BFD.
1