By default, GCC compiles code for the same type of machine that you
are using. However, it can also be installed as a cross-compiler, to
compile for some other type of machine. In fact, several different
configurations of GCC, for different target machines, can be
installed side by side. Then you specify which one to use with the
In addition, older and newer versions of GCC can be installed side by side. One of them (probably the newest) will be the default, but you may sometimes wish to use another.
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
i386v, meaning to compile for an 80386 running System V, then you
-b i386v to run that cross compiler.
When you do not specify
-b, it normally means to compile for
the same type of machine that you are using.
2.0, meaning to run GCC version 2.0.
The default version, when you do not specify
-V, is the last
version of GCC that you installed.
-V options actually work by controlling part of
the file name used for the executable files and libraries used for
compilation. A given version of GCC, for a given target machine, is
normally kept in the directory
Thus, sites can customize the effect of
-V either by
changing the names of these directories or adding alternate names (or
symbolic links). If in directory
80386 is a link to the file
80386 becomes an alias for
In one respect, the
-V do not completely change
to a different compiler: the top-level driver program
that you originally invoked continues to run and invoke the other
executables (preprocessor, compiler per se, assembler and linker)
that do the real work. However, since no real work is done in the
driver program, it usually does not matter that the driver program
in use is not the one for the specified target. It is common for the
interface to the other executables to change incompatibly between
compiler versions, so unless the version specified is very close to that
of the driver (for example,
-V 3.0 with a driver program from GCC
version 3.0.1), use of
-V may not work; for example, using
-V 2.95.2 will not work with a driver program from GCC 3.0.
The only way that the driver program depends on the target machine is in the parsing and handling of special machine-specific options. However, this is controlled by a file which is found, along with the other executables, in the directory for the specified version and target machine. As a result, a single installed driver program adapts to any specified target machine, and sufficiently similar compiler versions.
The driver program executable does control one significant thing, however: the default version and target machine. Therefore, you can install different instances of the driver program, compiled for different targets or versions, under different names.
For example, if the driver for version 2.0 is installed as
and that for version 2.1 is installed as
gcc, then the command
gcc will use version 2.1 by default, while
ogcc will use
2.0 by default. However, you can choose either version with either
command with the