An Introduction to GCC
for the GNU Compilers gcc and g++
Revised and updated
Brian Gough
Foreword by Richard M. Stallman
(1)
For details see the
license file 'COPYING' distributed with GCC.
(2)
See
https://www.network-theory.co.uk/gcc/intro/
(3)
If the prototype of a function has changed, it is
necessary to modify and recompile all of the other source files which
use it.
(4)
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
details.
(5)
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'.
(6)
The actual
output shown above may differ, depending on the specific platform and
environment.
(7)
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
default.
(8)
In GNU Bash, the shorter form export VARIABLE=VALUE
is also allowed.
(9)
The
current directory can also be specified using an empty path element. For
example, :DIR1:DIR2 is equivalent to
.:DIR1:DIR2 .
(10)
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.
(11)
The -D option for
defining macros will be explained in detail in the next chapter.
(12)
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.
(13)
In recent versions
of GCC the preprocessor is integrated into the compiler, although a
separate cpp command is also provided.
(14)
The terminology dates
back to the time of magnetic core memory.
(15)
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.
(16)
Some systems, such as FreeBSD and Solaris, can also
be configured to write core files in specific directories,
e.g. '/var/coredumps/', using the sysctl or coreadm
commands.
(17)
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.
(18)
https://www.network-theory.co.uk/gcc/intro/
(19)
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.
(20)
In this
case, the definition of the inline function must be made available to
the other files (e.g. in a header file).
(21)
Also referred to as
"targeting" a specific processor.
(22)
In recent versions of GCC this option has been
renamed to -mtune . The older form -mcpu will continue
to work.
(23)
On GNU/Linux systems, the command cat /proc/cpuinfo will display information about the CPU.
(24)
Intel has added support for this instruction set as
the "Intel 64-bit enhancements" on their Xeon CPUs.
(25)
The options
-maix64 and -maix32 are used on AIX.
(26)
Motorola 68k
processors also use extended precision registers, like the x86.
(27)
For quantities held in the x87 extended-precision
registers the relative precision is
5.42*10^-20
and the exponent
range is
10^(+/-4932)
. Standard double precision values have a
relative precision of
2.22*10^-16
and an exponent range of
10^(+/-308)
.
(28)
The operating system saves and restores the
control word when switching between processes, so that each process
maintains its own setting.
(29)
MacOS X (Darwin) on
PowerPC uses signed char , for consistency with other Darwin
architectures.
(30)
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.
(31)
If displayed, character code 255 often appears as ÿ .
(32)
Alternatively, the
appropriate paths can be set up in gdb using the file and
directory commands.
(33)
Note
that ar does not require a prefix '-' for its options.
(34)
American
Mathematical Monthly, Volume 92 (1985), 3--23
(35)
As mentioned
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.
(36)
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).
(37)
POSIX.1 (2003
edition), IEEE Std 1003.1-2003.
(38)
https://www.gnu.org/prep/service.html
(39)
https://www.network-theory.co.uk/gcc/intro/
(40)
https://order.fsf.org/
(41)
https://www.network-theory.co.uk/gcc/intro/
|