By default, GNU CC 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 GNU CC, for different target machines, can be
installed side by side. Then you specify which one to use with the
`-b
' option.
In addition, older and newer versions of GNU CC can be installed side by side. One of them (probably the newest) will be the default, but you may sometimes wish to use another.
-b machine
The value to use for machine is the same as was specified as the
machine type when configuring GNU CC as a cross-compiler. For
example, if a cross-compiler was configured with `configure i386v
', meaning to compile for an 80386 running System V, then you
would specify `-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.
-V version
2.0
', meaning to run GNU CC version 2.0.
The default version, when you do not specify `-V
', is controlled
by the way GNU CC is installed. Normally, it will be a version that
is recommended for general use.
The `-b
' and `-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 GNU CC, for a given target machine, is
normally kept in the directory `/usr/local/lib/gcc-lib/machine/version
'.
Thus, sites can customize the effect of `-b
' or `-V
' either by
changing the names of these directories or adding alternate names (or
symbolic links). If in directory `/usr/local/lib/gcc-lib/
' the
file `80386
' is a link to the file `i386v
', then `-b 80386
' becomes an alias for `-b i386v
'.
In one respect, the `-b
' or `-V
' do not completely change
to a different compiler: the top-level driver program gcc
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 and version.
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 compiler version.
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 ogcc
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 `-V
' option.