[Previous] [Contents] [Index] [Next]

Appendix: Selecting the Target System

This appendix describes how you can specify targets and architectures for the ELF utilities.


Note: The development tools automatically take care of this -- you'll probably never need to worry about it.

You can specify three aspects of the target system to the utilities that work on ELF files, each in several ways:

In the following summaries, the lists of ways to specify values are in order of decreasing precedence; the ways listed first override those listed later.

Target selection

A target is an object file format. A given target may be supported for multiple architectures (see "Architecture selection"). A target selection may also have variations for different operating systems or architectures.

The command to list valid target values is objdump -i (the first column of output contains the relevant information). Some sample values are: elf32-i386, elf32-littlemips, and elf32-powerpc.

Here's how to specify the target for the ELF utilities:

objdump
  1. -b command-line option
  2. GNUTARGET environment variable
  3. Deduced from the input file.
objcopy, strip
Input target:
  1. -I or -F command-line option
  2. GNUTARGET environment variable
  3. Deduced from the input file.

Output target:

  1. -O or -F command-line option
  2. Input target (see above)
  3. GNUTARGET environment variable
  4. Deduced from the input file.
nm, size, and strings
  1. --target command-line option
  2. GNUTARGET environment variable
  3. Deduced from the input file.
ld
Input target:
  1. -b command-line option
  2. TARGET script command (see "Option Commands" in Using LD in the full online GNU documentation)
  3. GNUTARGET environment variable
  4. Default target of the selected linker emulation (see "Linker emulation selection," below)

Output target:

  1. --oformat command-line option
  2. OUTPUT_FORMAT script command (see "Option Commands" in Using LD in the full online GNU documentation)
  3. Linker input target (see above).

Architecture selection

An architecture is a type of CPU on which an object file is to run. Its name may contain a colon, separating the name of the processor family from the name of the particular CPU.

The command to list valid architecture values is objdump -i. Sample values include powerpc:common and mips.

Here's how to specify the architecture for the GNU utilities:

objdump
  1. -m command-line option
  2. Deduced from the input file.
objcopy, nm, size, strings
Deduced from the input file.
ld
Input architecture is deduced from the input file.

Output architecture:

  1. OUTPUT_ARCH script command (see "Option Commands" in Using LD in the full online GNU documentation)
  2. Default architecture from the linker output target (see "Target selection," above).

Linker emulation selection

A linker emulation is a "personality" of the linker; it gives the linker default values for the other aspects of the target system. In particular, it consists of the linker script, the target, and several "hook" functions that are run at certain stages of the linking process to do special things that some targets require.

The command to list valid linker emulation values is ld -V. Sample values include i386nto, elf32mipnto, and elf32ppcnto.

Ways to specify:

  1. -m command-line option
  2. LDEMULATION environment variable
  3. Compiled-in DEFAULT_EMULATION from Makefile, which comes from EMUL in config/target.mt.

[Previous] [Contents] [Index] [Next]