An Introduction to GCC
for the GNU Compilers
Revised and updated
Foreword by Richard M. Stallman
For details see the
license file 'COPYING' distributed with GCC.
If the prototype of a function has changed, it is
necessary to modify and recompile all of the other source files which
This assumes that
there is no file called 'clean' in the current directory--see
the discussion of "phony targets" in the GNU Make manual for
On systems supporting both 64
and 32-bit executables the 64-bit versions of the libraries will often
be stored in '/usr/lib64' and '/lib64', with the 32-bit
versions in '/usr/lib' and '/lib'.
output shown above may differ, depending on the specific platform and
The default search paths may also
include additional system-dependent or site-specific directories, and
directories in the GCC installation itself. For example, on 64-bit
platforms additional 'lib64' directories may also be searched by
In GNU Bash, the shorter form
is also allowed.
current directory can also be specified using an empty path element. For
:DIR1:DIR2 is equivalent to
Note that the directory containing the shared
library can, in principle, be stored ("hard-coded") in the executable
itself using the linker option
-rpath, but this is not usually
done since it creates problems if the library is moved or the executable
is copied to another system.
-D option for
defining macros will be explained in detail in the next chapter.
The traditional form of the C language was described
in the original C reference manual "The C Programming Language
(First Edition)" by Kernighan and Ritchie.
In recent versions
of GCC the preprocessor is integrated into the compiler, although a
cpp command is also provided.
The terminology dates
back to the time of magnetic core memory.
Historically, a null pointer corresponded to memory
location 0, which is typically restricted to the operating system
kernel. In practice this is not always how a null pointer works, but
the result is usually the same.
Some systems, such as FreeBSD and Solaris, can also
be configured to write core files in specific directories,
e.g. '/var/coredumps/', using the
This example uses the
ulimit command in the GNU
Bash shell. On other systems the usage of the
ulimit command may
vary, or have a different name (the
tcsh shell uses the
limit command instead). The size limit for core files can also
be set to a specific value in kilobytes.
Temporary values introduced by the compiler during common
subexpression elimination are only used internally, and do not affect
real variables. The name of the temporary variable 't' shown above
is only used as an illustration.
case, the definition of the inline function must be made available to
the other files (e.g. in a header file).
Also referred to as
"targeting" a specific processor.
In recent versions of GCC this option has been
-mtune. The older form
-mcpu will continue
On GNU/Linux systems, the command
cat /proc/cpuinfo will display information about the CPU.
Intel has added support for this instruction set as
the "Intel 64-bit enhancements" on their Xeon CPUs.
-maix32 are used on AIX.
processors also use extended precision registers, like the x86.
For quantities held in the x87 extended-precision
registers the relative precision is
and the exponent
. Standard double precision values have a
relative precision of
and an exponent range of
The operating system saves and restores the
control word when switching between processes, so that each process
maintains its own setting.
MacOS X (Darwin) on
PowerPC uses signed
char, for consistency with other Darwin
There is also a subtle error even on
platforms with signed
char---the ASCII character 255
is spuriously interpreted as an end of file condition.
If displayed, character code 255 often appears as
appropriate paths can be set up in
gdb using the
ar does not require a prefix '-' for its options.
Mathematical Monthly, Volume 92 (1985), 3--23
earlier, the preprocessor is integrated into the compiler in recent
versions of GCC. Conceptually, the compilation process is the same as
running the preprocessor as separate application.
The MSB and LSB orderings are also known as
big-endian and little-endian respectively (the terms originate from
Jonathan Swift's satire "Gulliver's Travels", 1727).
edition), IEEE Std 1003.1-2003.