Retired Documents Library Developer
Search

Next: , Previous: Spec Files, Up: Invoking GCC


3.16 Specifying Target Machine and Compiler Version

The usual way to run GCC is to run the executable called gcc, or <machine>-gcc when cross-compiling, or <machine>-gcc-<version> to run a version other than the one that was installed last. Sometimes this is inconvenient, so GCC provides options that will switch to another cross-compiler or version.

-b machine
The argument machine specifies the target machine for compilation.

The value to use for machine is the same as was specified as the machine type when configuring GCC as a cross-compiler. For example, if a cross-compiler was configured with `configure arm-elf', meaning to compile for an arm processor with elf binaries, then you would specify -b arm-elf to run that cross compiler. Because there are other options beginning with -b, the configuration must contain a hyphen.

-V version
The argument version specifies which version of GCC to run. This is useful when multiple versions are installed. For example, version might be `4.0', meaning to run GCC version 4.0.

The -V and -b options work by running the <machine>-gcc-<version> executable, so there's no real reason to use them if you can just run that directly.