Node: Switches for gcc, Next: Search Paths and the Run-Time Library (RTL), Previous: Compiling Programs, Up: Compiling Using gcc
gcc
The gcc
command accepts switches that control the
compilation process. These switches are fully described in this section.
First we briefly list all the switches, in alphabetical order, then we
describe the switches in more detail in functionally grouped sections.
-b
target
-B
dir
gnat1
, the Ada compiler)
from dir instead of the default location. Only use this switch
when multiple versions of the GNAT compiler are available. See the
gcc
manual page for further details. You would normally use the
-b
or -V
switch instead.
-c
Note: for some other languages when using gcc
, notably in
the case of C and C++, it is possible to use
use gcc
without a -c
switch to
compile and link in one step. In the case of GNAT, you
cannot use this approach, because the binder must be run
and gcc
cannot be used to run the GNAT binder.
-g
-g
switch if you plan on using the debugger.
-I
dir
-I-
-o
file
gcc
to redirect the generated object file
and its associated ALI file. Beware of this switch with GNAT, because it may
cause the object file and ALI file to have different names which in turn
may confuse the binder and the linker.
-O[
n]
-O
appears
-O
without
an operand.
--RTS=
rts-path
gnatmake
flag (see Switches for gnatmake).
-S
-c
to
cause the assembler source file to be
generated, using .s
as the extension,
instead of the object file.
This may be useful if you need to examine the generated assembly code.
-v
gcc
driver. Normally used only for
debugging purposes or if you need to be sure what version of the
compiler you are executing.
-V
ver
gcc
version, not the GNAT version.
-gnata
Pragma Assert
and pragma Debug
to be
activated.
-gnatA
gnat.adc
. If a gnat.adc file is present, it will be ignored.
-gnatb
stderr
even if verbose mode set.
-gnatc
-gnatC
-gnatD
-gnatec
path
-gnatem
path
-gnatE
-gnatf
-gnatF
-gnatg
-gnatG
-gnati
c
-gnath
stdout
.
-gnatk
n
k
= krunch).
-gnatl
-gnatm
n
-gnatn
inline
is specified.
-gnatN
-fno-inline
-fstack-check
-gnato
-gnatp
-gnatq
-gnatQ
ali
and tree files even if illegalities.
-gnatP
-gnatR[0/1/2/3][s]
-gnats
-gnatt
-gnatT nnn
-gnatu
-gnatU
-gnatv
stdout
.
-gnatV
-gnatwxxx
xxx
-gnatW
e
-gnatx
-gnaty
-gnatz
m
-gnat83
-pass-exit-codes
You may combine a sequence of GNAT switches into a single switch. For example, the combined switch
-gnatofi3
is equivalent to specifying the following sequence of switches:
-gnato -gnatf -gnati3
The following restrictions apply to the combination of switches in this manner:
-gnatc
if combined with other switches must come
first in the string.
-gnats
if combined with other switches must come
first in the string.
-gnaty
switch), then all further characters in the switch are interpreted
as style modifiers (see description of -gnaty
).
-gnatd
switch), then all further characters in the switch are interpreted
as debug flags (see description of -gnatd
).
-gnatw
switch), then all further characters in the switch are interpreted
as warning mode modifiers (see description of -gnatw
).
-gnatV
switch), then all further characters in the switch are interpreted
as validity checking options (see description of -gnatV
).