OSDN Git Service

O Bring in changes from release branch (egcs_ss_971127).
[pf3gnuchains/gcc-fork.git] / gcc / invoke.texi
1 @c Copyright (C) 1988,89,92,93,94,95,96,1997 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @node Invoking GCC
6 @chapter GNU CC Command Options
7 @cindex GNU CC command options
8 @cindex command options
9 @cindex options, GNU CC command
10
11 When you invoke GNU CC, it normally does preprocessing, compilation,
12 assembly and linking.  The ``overall options'' allow you to stop this
13 process at an intermediate stage.  For example, the @samp{-c} option
14 says not to run the linker.  Then the output consists of object files
15 output by the assembler.
16
17 Other options are passed on to one stage of processing.  Some options
18 control the preprocessor and others the compiler itself.  Yet other
19 options control the assembler and linker; most of these are not
20 documented here, since you rarely need to use any of them.
21
22 @cindex C compilation options
23 Most of the command line options that you can use with GNU CC are useful
24 for C programs; when an option is only useful with another language
25 (usually C++), the explanation says so explicitly.  If the description
26 for a particular option does not mention a source language, you can use
27 that option with all supported languages.
28
29 @cindex C++ compilation options
30 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
31 options for compiling C++ programs.
32
33 @cindex grouping options
34 @cindex options, grouping
35 The @code{gcc} program accepts options and file names as operands.  Many
36 options have multiletter names; therefore multiple single-letter options
37 may @emph{not} be grouped: @samp{-dr} is very different from @w{@samp{-d
38 -r}}.
39
40 @cindex order of options
41 @cindex options, order
42 You can mix options and other arguments.  For the most part, the order
43 you use doesn't matter.  Order does matter when you use several options
44 of the same kind; for example, if you specify @samp{-L} more than once,
45 the directories are searched in the order specified.
46
47 Many options have long names starting with @samp{-f} or with
48 @samp{-W}---for example, @samp{-fforce-mem},
49 @samp{-fstrength-reduce}, @samp{-Wformat} and so on.  Most of
50 these have both positive and negative forms; the negative form of
51 @samp{-ffoo} would be @samp{-fno-foo}.  This manual documents
52 only one of these two forms, whichever one is not the default.
53
54 @menu
55 * Option Summary::      Brief list of all options, without explanations.
56 * Overall Options::     Controlling the kind of output:
57                         an executable, object files, assembler files,
58                         or preprocessed source.
59 * Invoking G++::        Compiling C++ programs.
60 * C Dialect Options::   Controlling the variant of C language compiled.
61 * C++ Dialect Options:: Variations on C++.
62 * Warning Options::     How picky should the compiler be?
63 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
64 * Optimize Options::    How much optimization?
65 * Preprocessor Options:: Controlling header files and macro definitions.
66                          Also, getting dependency information for Make.
67 * Assembler Options::   Passing options to the assembler.
68 * Link Options::        Specifying libraries and so on.
69 * Directory Options::   Where to find header files and libraries.
70                         Where to find the compiler executable files.
71 * Target Options::      Running a cross-compiler, or an old version of GNU CC.
72 * Submodel Options::    Specifying minor hardware or convention variations,
73                         such as 68010 vs 68020.
74 * Code Gen Options::    Specifying conventions for function calls, data layout
75                         and register usage.
76 * Environment Variables:: Env vars that affect GNU CC.
77 * Running Protoize::    Automatically adding or removing function prototypes.
78 @end menu
79
80 @node Option Summary
81 @section Option Summary
82
83 Here is a summary of all the options, grouped by type.  Explanations are
84 in the following sections.
85
86 @table @emph
87 @item Overall Options
88 @xref{Overall Options,,Options Controlling the Kind of Output}.
89 @smallexample
90 -c  -S  -E  -o @var{file}  -pipe  -v  -x @var{language}
91 @end smallexample
92
93 @item C Language Options
94 @xref{C Dialect Options,,Options Controlling C Dialect}.
95 @smallexample
96 -ansi  -fallow-single-precision  -fcond-mismatch  -fno-asm
97 -fno-builtin  -ffreestanding  -fhosted  -fsigned-bitfields  -fsigned-char
98 -funsigned-bitfields  -funsigned-char  -fwritable-strings
99 -traditional  -traditional-cpp  -trigraphs
100 @end smallexample
101
102 @item C++ Language Options
103 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
104 @smallexample
105 -fall-virtual  -fdollars-in-identifiers  -felide-constructors
106 -fenum-int-equiv  -fexternal-templates  -ffor-scope  -fno-for-scope
107 -fhandle-signatures  -fmemoize-lookups  -fname-mangling-version-@var{n}
108 -fno-default-inline  -fno-gnu-keywords -fnonnull-objects -fguiding-decls
109 -foperator-names  -fstrict-prototype  -fthis-is-variable
110 -ftemplate-depth-@var{n}  -nostdinc++  -traditional  +e@var{n}
111 @end smallexample
112
113 @item Warning Options
114 @xref{Warning Options,,Options to Request or Suppress Warnings}.
115 @smallexample
116 -fsyntax-only  -pedantic  -pedantic-errors
117 -w  -W  -Wall  -Waggregate-return  -Wbad-function-cast
118 -Wcast-align  -Wcast-qual  -Wchar-subscript  -Wcomment
119 -Wconversion  -Werror  -Wformat
120 -Wid-clash-@var{len}  -Wimplicit -Wimplicit-int 
121 -Wimplicit-function-declarations -Wimport  -Winline
122 -Wlarger-than-@var{len}  -Wmain  -Wmissing-declarations
123 -Wmissing-prototypes  -Wnested-externs
124 -Wno-import  -Wold-style-cast  -Woverloaded-virtual  -Wparentheses
125 -Wpointer-arith  -Wredundant-decls  -Wreorder  -Wreturn-type  -Wshadow
126 -Wsign-compare  -Wstrict-prototypes  -Wswitch  -Wsynth
127 -Wtemplate-debugging  -Wtraditional  -Wtrigraphs
128 -Wundef  -Wuninitialized  -Wunused  -Wwrite-strings
129 @end smallexample
130
131 @item Debugging Options
132 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
133 @smallexample
134 -a  -ax  -d@var{letters}  -fpretend-float
135 -fprofile-arcs  -ftest-coverage
136 -g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2
137 -ggdb  -gstabs  -gstabs+  -gxcoff  -gxcoff+
138 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name
139 -print-prog-name=@var{program}  -print-search-dirs  -save-temps
140 @end smallexample
141
142 @item Optimization Options
143 @xref{Optimize Options,,Options that Control Optimization}.
144 @smallexample
145 -fbranch-probabilities
146 -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
147 -fdelayed-branch   -fexpensive-optimizations
148 -ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
149 -ffunction-sections  -finline-functions
150 -fkeep-inline-functions  -fno-default-inline
151 -fno-defer-pop  -fno-function-cse
152 -fno-inline  -fno-peephole  -fomit-frame-pointer -fregmove
153 -frerun-cse-after-loop  -frerun-loop-opt -fschedule-insns
154 -fschedule-insns2  -fstrength-reduce  -fthread-jumps
155 -funroll-all-loops  -funroll-loops
156 -fmove-all-movables  -freduce-all-givs
157 -O  -O0  -O1  -O2  -O3
158 @end smallexample
159
160 @item Preprocessor Options
161 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
162 @smallexample
163 -A@var{question}(@var{answer})  -C  -dD  -dM  -dN
164 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H
165 -idirafter @var{dir}
166 -include @var{file}  -imacros @var{file}
167 -iprefix @var{file}  -iwithprefix @var{dir}
168 -iwithprefixbefore @var{dir}  -isystem @var{dir}
169 -M  -MD  -MM  -MMD  -MG  -nostdinc  -P  -trigraphs
170 -undef  -U@var{macro}  -Wp,@var{option}
171 @end smallexample
172
173 @item Assembler Option
174 @xref{Assembler Options,,Passing Options to the Assembler}.
175 @smallexample
176 -Wa,@var{option}
177 @end smallexample
178
179 @item Linker Options
180 @xref{Link Options,,Options for Linking}.
181 @smallexample
182 @var{object-file-name}  -l@var{library}
183 -nostartfiles  -nodefaultlibs  -nostdlib
184 -s  -static  -shared  -symbolic
185 -Wl,@var{option}  -Xlinker @var{option}
186 -u @var{symbol}
187 @end smallexample
188
189 @item Directory Options
190 @xref{Directory Options,,Options for Directory Search}.
191 @smallexample
192 -B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}
193 @end smallexample
194
195 @item Target Options
196 @c I wrote this xref this way to avoid overfull hbox. -- rms
197 @xref{Target Options}.
198 @smallexample
199 -b @var{machine}  -V @var{version}
200 @end smallexample
201
202 @item Machine Dependent Options
203 @xref{Submodel Options,,Hardware Models and Configurations}.
204 @smallexample
205 @emph{M680x0 Options}
206 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
207 -m68060  -m5200  -m68881  -mbitfield  -mc68000  -mc68020  -mfpa
208 -mnobitfield  -mrtd  -mshort  -msoft-float  -malign-int
209
210 @emph{VAX Options}
211 -mg  -mgnu  -munix
212
213 @emph{SPARC Options}
214 -mcpu=@var{cpu type}
215 -mtune=@var{cpu type}
216 -mcmodel=@var{code model}
217 -malign-jumps=@var{num}  -malign-loops=@var{num}
218 -malign-functions=@var{num}
219 -m32  -m64
220 -mapp-regs  -mbroken-saverestore  -mcypress  -mepilogue
221 -mflat  -mfpu  -mhard-float  -mhard-quad-float
222 -mimpure-text  -mlive-g0  -mno-app-regs  -mno-epilogue
223 -mno-flat  -mno-fpu  -mno-impure-text
224 -mno-stack-bias  -mno-unaligned-doubles
225 -msoft-float  -msoft-quad-float  -msparclite  -mstack-bias
226 -msupersparc  -munaligned-doubles  -mv8
227
228 @emph{Convex Options}
229 -mc1  -mc2  -mc32  -mc34  -mc38
230 -margcount  -mnoargcount
231 -mlong32  -mlong64
232 -mvolatile-cache  -mvolatile-nocache
233
234 @emph{AMD29K Options}
235 -m29000  -m29050  -mbw  -mnbw  -mdw  -mndw
236 -mlarge  -mnormal  -msmall
237 -mkernel-registers  -mno-reuse-arg-regs
238 -mno-stack-check  -mno-storem-bug
239 -mreuse-arg-regs  -msoft-float  -mstack-check
240 -mstorem-bug  -muser-registers
241
242 @emph{ARM Options}
243 -mapcs-frame  -mapcs-26  -mapcs-32
244 -mlittle-endian  -mbig-endian  -mwords-little-endian
245 -mshort-load-bytes  -mno-short-load-bytes
246 -msoft-float  -mhard-float
247 -mbsd  -mxopen  -mno-symrename
248
249 @emph{MN10300 Options}
250 -mmult-bug
251 -mno-mult-bug
252
253 @emph{M32R/D Options}
254 -mcode-model=@var{model type}  -msdata=@var{sdata type}
255 -G @var{num}
256
257 @emph{M88K Options}
258 -m88000  -m88100  -m88110  -mbig-pic
259 -mcheck-zero-division  -mhandle-large-shift
260 -midentify-revision  -mno-check-zero-division
261 -mno-ocs-debug-info  -mno-ocs-frame-position
262 -mno-optimize-arg-area  -mno-serialize-volatile
263 -mno-underscores  -mocs-debug-info
264 -mocs-frame-position  -moptimize-arg-area
265 -mserialize-volatile  -mshort-data-@var{num}  -msvr3
266 -msvr4  -mtrap-large-shift  -muse-div-instruction
267 -mversion-03.00  -mwarn-passed-structs
268
269 @emph{RS/6000 and PowerPC Options}
270 -mcpu=@var{cpu type}
271 -mtune=@var{cpu type}
272 -mpower  -mno-power  -mpower2  -mno-power2
273 -mpowerpc  -mno-powerpc
274 -mpowerpc-gpopt  -mno-powerpc-gpopt
275 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
276 -mnew-mnemonics  -mno-new-mnemonics
277 -mfull-toc   -mminimal-toc  -mno-fop-in-toc  -mno-sum-in-toc
278 -mxl-call  -mno-xl-call  -mthreads  -mpe
279 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
280 -mstring  -mno-string  -mupdate  -mno-update
281 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
282 -mstrict-align  -mno-strict-align  -mrelocatable
283 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
284 -mtoc  -mno-toc  -mtraceback  -mno-traceback
285 -mlittle  -mlittle-endian  -mbig  -mbig-endian
286 -mcall-aix  -mcall-sysv  -mprototype  -mno-prototype
287 -msim  -mmvme  -mads  -myellowknife  -memb
288 -msdata  -msdata=@var{opt}  -G @var{num}
289
290 @emph{RT Options}
291 -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs
292 -mfull-fp-blocks  -mhc-struct-return  -min-line-mul
293 -mminimum-fp-blocks  -mnohc-struct-return
294
295 @emph{MIPS Options}
296 -mabicalls  -mcpu=@var{cpu type}  -membedded-data
297 -membedded-pic  -mfp32  -mfp64  -mgas  -mgp32  -mgp64
298 -mgpopt  -mhalf-pic  -mhard-float  -mint64  -mips1
299 -mips2  -mips3  -mlong64  -mlong-calls  -mmemcpy
300 -mmips-as  -mmips-tfile  -mno-abicalls
301 -mno-embedded-data  -mno-embedded-pic
302 -mno-gpopt  -mno-long-calls
303 -mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats
304 -mrnames  -msoft-float
305 -m4650  -msingle-float  -mmad
306 -mstats  -EL  -EB  -G @var{num}  -nocpp
307
308 @emph{i386 Options}
309 -mcpu=@var{cpu type}
310 -march=@var{cpu type}
311 -mieee-fp  -mno-fancy-math-387
312 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib
313 -mno-wide-multiply  -mrtd  -malign-double
314 -mreg-alloc=@var{list}  -mregparm=@var{num}
315 -malign-jumps=@var{num}  -malign-loops=@var{num}
316 -malign-functions=@var{num}
317
318 @emph{HPPA Options}
319 -mbig-switch  -mdisable-fpregs  -mdisable-indexing  -mfast-indirect-calls
320 -mgas  -mjump-in-delay  -mlong-load-store  -mno-big-switch  -mno-disable-fpregs
321 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
322 -mno-jump-in-delay
323 -mno-long-load-store
324 -mno-portable-runtime  -mno-soft-float  -mno-space  -mno-space-regs
325 -msoft-float
326 -mpa-risc-1-0  -mpa-risc-1-1  -mportable-runtime
327 -mschedule=@var{list}  -mspace  -mspace-regs
328
329 @emph{Intel 960 Options}
330 -m@var{cpu type}  -masm-compat  -mclean-linkage
331 -mcode-align  -mcomplex-addr  -mleaf-procedures
332 -mic-compat  -mic2.0-compat  -mic3.0-compat
333 -mintel-asm  -mno-clean-linkage  -mno-code-align
334 -mno-complex-addr  -mno-leaf-procedures
335 -mno-old-align  -mno-strict-align  -mno-tail-call
336 -mnumerics  -mold-align  -msoft-float  -mstrict-align
337 -mtail-call
338
339 @emph{DEC Alpha Options}
340 -mfp-regs  -mno-fp-regs
341 -mno-soft-float  -msoft-float
342 -mieee  -mieee-with-inexact  -mieee-conformant
343 -mfp-trap-mode  -mfp-rounding-mode  -mtrap-precision
344 -mbuild-constants
345
346 @emph{Clipper Options}
347 -mc300  -mc400
348
349 @emph{H8/300 Options}
350 -mrelax  -mh -ms -mint32  -malign-300
351
352 @emph{SH Options}
353 -m1  -m2  -m3  -m3e  -mb  -ml  -mrelax
354
355 @emph{System V Options}
356 -Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}
357
358 @emph{V850 Options}
359 -mlong-calls -mno-long-calls -mep -mno-ep
360 -mprolog-function -mno-prolog-function -mspace
361 -mtda=@var{n} -msda=@var{n} -mzda=@var{n}
362 -mv850 -mbig-switch
363 @end smallexample
364
365 @item Code Generation Options
366 @xref{Code Gen Options,,Options for Code Generation Conventions}.
367 @smallexample
368 -fcall-saved-@var{reg}  -fcall-used-@var{reg}
369 -ffixed-@var{reg}  -finhibit-size-directive
370 -fcheck-memory-usage  -fprefix-function-name
371 -fno-common  -fno-ident  -fno-gnu-linker
372 -fpcc-struct-return  -fpic  -fPIC
373 -freg-struct-return  -fshared-data  -fshort-enums
374 -fshort-double  -fvolatile  -fvolatile-global
375 -fverbose-asm -fpack-struct  -fstack-check  +e0  +e1
376 -fargument-alias  -fargument-noalias
377 -fargument-noalias-global
378 @end smallexample
379 @end table
380
381 @menu
382 * Overall Options::     Controlling the kind of output:
383                         an executable, object files, assembler files,
384                         or preprocessed source.
385 * C Dialect Options::   Controlling the variant of C language compiled.
386 * C++ Dialect Options:: Variations on C++.
387 * Warning Options::     How picky should the compiler be?
388 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
389 * Optimize Options::    How much optimization?
390 * Preprocessor Options:: Controlling header files and macro definitions.
391                          Also, getting dependency information for Make.
392 * Assembler Options::   Passing options to the assembler.
393 * Link Options::        Specifying libraries and so on.
394 * Directory Options::   Where to find header files and libraries.
395                         Where to find the compiler executable files.
396 * Target Options::      Running a cross-compiler, or an old version of GNU CC.
397 @end menu
398
399 @node Overall Options
400 @section Options Controlling the Kind of Output
401
402 Compilation can involve up to four stages: preprocessing, compilation
403 proper, assembly and linking, always in that order.  The first three
404 stages apply to an individual source file, and end by producing an
405 object file; linking combines all the object files (those newly
406 compiled, and those specified as input) into an executable file.
407
408 @cindex file name suffix
409 For any given input file, the file name suffix determines what kind of
410 compilation is done:
411
412 @table @code
413 @item @var{file}.c
414 C source code which must be preprocessed.
415
416 @item @var{file}.i
417 C source code which should not be preprocessed.
418
419 @item @var{file}.ii
420 C++ source code which should not be preprocessed.
421
422 @item @var{file}.m
423 Objective-C source code.  Note that you must link with the library
424 @file{libobjc.a} to make an Objective-C program work.
425
426 @item @var{file}.h
427 C header file (not to be compiled or linked).
428
429 @item @var{file}.cc
430 @itemx @var{file}.cxx
431 @itemx @var{file}.cpp
432 @itemx @var{file}.C
433 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
434 the last two letters must both be literally @samp{x}.  Likewise,
435 @samp{.C} refers to a literal capital C.
436
437 @item @var{file}.s
438 Assembler code.
439
440 @item @var{file}.S
441 Assembler code which must be preprocessed.
442
443 @item @var{other}
444 An object file to be fed straight into linking.
445 Any file name with no recognized suffix is treated this way.
446 @end table
447
448 You can specify the input language explicitly with the @samp{-x} option:
449
450 @table @code
451 @item -x @var{language}
452 Specify explicitly the @var{language} for the following input files
453 (rather than letting the compiler choose a default based on the file
454 name suffix).  This option applies to all following input files until
455 the next @samp{-x} option.  Possible values for @var{language} are:
456 @example
457 c  objective-c  c++
458 c-header  cpp-output  c++-cpp-output
459 assembler  assembler-with-cpp
460 @end example
461
462 @item -x none
463 Turn off any specification of a language, so that subsequent files are
464 handled according to their file name suffixes (as they are if @samp{-x}
465 has not been used at all).
466 @end table
467
468 If you only want some of the stages of compilation, you can use
469 @samp{-x} (or filename suffixes) to tell @code{gcc} where to start, and
470 one of the options @samp{-c}, @samp{-S}, or @samp{-E} to say where
471 @code{gcc} is to stop.  Note that some combinations (for example,
472 @samp{-x cpp-output -E} instruct @code{gcc} to do nothing at all.
473
474 @table @code
475 @item -c
476 Compile or assemble the source files, but do not link.  The linking
477 stage simply is not done.  The ultimate output is in the form of an
478 object file for each source file.
479
480 By default, the object file name for a source file is made by replacing
481 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
482
483 Unrecognized input files, not requiring compilation or assembly, are
484 ignored.
485
486 @item -S
487 Stop after the stage of compilation proper; do not assemble.  The output
488 is in the form of an assembler code file for each non-assembler input
489 file specified.
490
491 By default, the assembler file name for a source file is made by
492 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
493
494 Input files that don't require compilation are ignored.
495
496 @item -E
497 Stop after the preprocessing stage; do not run the compiler proper.  The
498 output is in the form of preprocessed source code, which is sent to the
499 standard output.
500
501 Input files which don't require preprocessing are ignored.
502
503 @cindex output file option
504 @item -o @var{file}
505 Place output in file @var{file}.  This applies regardless to whatever
506 sort of output is being produced, whether it be an executable file,
507 an object file, an assembler file or preprocessed C code.
508
509 Since only one output file can be specified, it does not make sense to
510 use @samp{-o} when compiling more than one input file, unless you are
511 producing an executable file as output.
512
513 If @samp{-o} is not specified, the default is to put an executable file
514 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
515 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
516 all preprocessed C source on standard output.@refill
517
518 @item -v
519 Print (on standard error output) the commands executed to run the stages
520 of compilation.  Also print the version number of the compiler driver
521 program and of the preprocessor and the compiler proper.
522
523 @item -pipe
524 Use pipes rather than temporary files for communication between the
525 various stages of compilation.  This fails to work on some systems where
526 the assembler is unable to read from a pipe; but the GNU assembler has
527 no trouble.
528 @end table
529
530 @node Invoking G++
531 @section Compiling C++ Programs
532
533 @cindex suffixes for C++ source
534 @cindex C++ source file suffixes
535 C++ source files conventionally use one of the suffixes @samp{.C},
536 @samp{.cc}, @samp{cpp}, or @samp{.cxx}; preprocessed C++ files use the
537 suffix @samp{.ii}.  GNU CC recognizes files with these names and
538 compiles them as C++ programs even if you call the compiler the same way
539 as for compiling C programs (usually with the name @code{gcc}).
540
541 @findex g++
542 @findex c++
543 However, C++ programs often require class libraries as well as a
544 compiler that understands the C++ language---and under some
545 circumstances, you might want to compile programs from standard input,
546 or otherwise without a suffix that flags them as C++ programs.
547 @code{g++} is a program that calls GNU CC with the default language
548 set to C++, and automatically specifies linking against the GNU class
549 library libg++.
550 @cindex @code{g++ 1.@var{xx}}
551 @cindex @code{g++}, separate compiler
552 @cindex @code{g++} older version
553 @footnote{Prior to release 2 of the compiler,
554 there was a separate @code{g++} compiler.  That version was based on GNU
555 CC, but not integrated with it.  Versions of @code{g++} with a
556 @samp{1.@var{xx}} version number---for example, @code{g++} version 1.37
557 or 1.42---are much less reliable than the versions integrated with GCC
558 2.  Moreover, combining G++ @samp{1.@var{xx}} with a version 2 GCC will
559 simply not work.} On many systems, the script @code{g++} is also
560 installed with the name @code{c++}.
561
562 @cindex invoking @code{g++}
563 When you compile C++ programs, you may specify many of the same
564 command-line options that you use for compiling programs in any
565 language; or command-line options meaningful for C and related
566 languages; or options that are meaningful only for C++ programs.
567 @xref{C Dialect Options,,Options Controlling C Dialect}, for
568 explanations of options for languages related to C.
569 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
570 explanations of options that are meaningful only for C++ programs.
571
572 @node C Dialect Options
573 @section Options Controlling C Dialect
574 @cindex dialect options
575 @cindex language dialect options
576 @cindex options, dialect
577
578 The following options control the dialect of C (or languages derived
579 from C, such as C++ and Objective C) that the compiler accepts:
580
581 @table @code
582 @cindex ANSI support
583 @item -ansi
584 Support all ANSI standard C programs.
585
586 This turns off certain features of GNU C that are incompatible with ANSI
587 C, such as the @code{asm}, @code{inline} and @code{typeof} keywords, and
588 predefined macros such as @code{unix} and @code{vax} that identify the
589 type of system you are using.  It also enables the undesirable and
590 rarely used ANSI trigraph feature, and it disables recognition of C++
591 style @samp{//} comments.
592
593 The alternate keywords @code{__asm__}, @code{__extension__},
594 @code{__inline__} and @code{__typeof__} continue to work despite
595 @samp{-ansi}.  You would not want to use them in an ANSI C program, of
596 course, but it is useful to put them in header files that might be included
597 in compilations done with @samp{-ansi}.  Alternate predefined macros
598 such as @code{__unix__} and @code{__vax__} are also available, with or
599 without @samp{-ansi}.
600
601 The @samp{-ansi} option does not cause non-ANSI programs to be
602 rejected gratuitously.  For that, @samp{-pedantic} is required in
603 addition to @samp{-ansi}.  @xref{Warning Options}.
604
605 The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
606 option is used.  Some header files may notice this macro and refrain
607 from declaring certain functions or defining certain macros that the
608 ANSI standard doesn't call for; this is to avoid interfering with any
609 programs that might use these names for other things.
610
611 The functions @code{alloca}, @code{abort}, @code{exit}, and
612 @code{_exit} are not builtin functions when @samp{-ansi} is used.
613
614 @item -fno-asm
615 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
616 keyword, so that code can use these words as identifiers.  You can use
617 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
618 instead.  @samp{-ansi} implies @samp{-fno-asm}.
619
620 In C++, this switch only affects the @code{typeof} keyword, since
621 @code{asm} and @code{inline} are standard keywords.  You may want to
622 use the @samp{-fno-gnu-keywords} flag instead, as it also disables the
623 other, C++-specific, extension keywords such as @code{headof}.
624
625 @item -fno-builtin
626 @cindex builtin functions
627 @findex abort
628 @findex abs
629 @findex alloca
630 @findex cos
631 @findex exit
632 @findex fabs
633 @findex ffs
634 @findex labs
635 @findex memcmp
636 @findex memcpy
637 @findex sin
638 @findex sqrt
639 @findex strcmp
640 @findex strcpy
641 @findex strlen
642 Don't recognize builtin functions that do not begin with two leading
643 underscores.  Currently, the functions affected include @code{abort},
644 @code{abs}, @code{alloca}, @code{cos}, @code{exit}, @code{fabs},
645 @code{ffs}, @code{labs}, @code{memcmp}, @code{memcpy}, @code{sin},
646 @code{sqrt}, @code{strcmp}, @code{strcpy}, and @code{strlen}.
647
648 GCC normally generates special code to handle certain builtin functions
649 more efficiently; for instance, calls to @code{alloca} may become single
650 instructions that adjust the stack directly, and calls to @code{memcpy}
651 may become inline copy loops.  The resulting code is often both smaller
652 and faster, but since the function calls no longer appear as such, you
653 cannot set a breakpoint on those calls, nor can you change the behavior
654 of the functions by linking with a different library.
655
656 The @samp{-ansi} option prevents @code{alloca} and @code{ffs} from being
657 builtin functions, since these functions do not have an ANSI standard
658 meaning.
659
660 @item -fhosted
661 @cindex hosted environment
662
663 Assert that compilation takes place in a hosted environment.  This implies
664 @samp{-fbuiltin}.  A hosted environment is one in which the
665 entire standard library is available, and in which @code{main} has a return
666 type of @code{int}.  Examples are nearly everything except a kernel.
667 This is equivalent to @samp{-fno-freestanding}.
668
669 @item -ffreestanding
670 @cindex hosted environment
671
672 Assert that compilation takes place in a freestanding environment.  This
673 implies @samp{-fno-builtin}.  A freestanding environment
674 is one in which the standard library may not exist, and program startup may
675 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
676 This is equivalent to @samp{-fno-hosted}.
677
678 @item -trigraphs
679 Support ANSI C trigraphs.  You don't want to know about this
680 brain-damage.  The @samp{-ansi} option implies @samp{-trigraphs}.
681
682 @cindex traditional C language
683 @cindex C language, traditional
684 @item -traditional
685 Attempt to support some aspects of traditional C compilers.
686 Specifically:
687
688 @itemize @bullet
689 @item
690 All @code{extern} declarations take effect globally even if they
691 are written inside of a function definition.  This includes implicit
692 declarations of functions.
693
694 @item
695 The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
696 and @code{volatile} are not recognized.  (You can still use the
697 alternative keywords such as @code{__typeof__}, @code{__inline__}, and
698 so on.)
699
700 @item
701 Comparisons between pointers and integers are always allowed.
702
703 @item
704 Integer types @code{unsigned short} and @code{unsigned char} promote
705 to @code{unsigned int}.
706
707 @item
708 Out-of-range floating point literals are not an error.
709
710 @item
711 Certain constructs which ANSI regards as a single invalid preprocessing
712 number, such as @samp{0xe-0xd}, are treated as expressions instead.
713
714 @item
715 String ``constants'' are not necessarily constant; they are stored in
716 writable space, and identical looking constants are allocated
717 separately.  (This is the same as the effect of
718 @samp{-fwritable-strings}.)
719
720 @cindex @code{longjmp} and automatic variables
721 @item
722 All automatic variables not declared @code{register} are preserved by
723 @code{longjmp}.  Ordinarily, GNU C follows ANSI C: automatic variables
724 not declared @code{volatile} may be clobbered.
725
726 @item
727 @kindex \x
728 @kindex \a
729 @cindex escape sequences, traditional
730 The character escape sequences @samp{\x} and @samp{\a} evaluate as the
731 literal characters @samp{x} and @samp{a} respectively.  Without
732 @w{@samp{-traditional}}, @samp{\x} is a prefix for the hexadecimal
733 representation of a character, and @samp{\a} produces a bell.
734
735 @item
736 In C++ programs, assignment to @code{this} is permitted with
737 @samp{-traditional}.  (The option @samp{-fthis-is-variable} also has
738 this effect.)
739 @end itemize
740
741 You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
742 if your program uses names that are normally GNU C builtin functions for
743 other purposes of its own.
744
745 You cannot use @samp{-traditional} if you include any header files that
746 rely on ANSI C features.  Some vendors are starting to ship systems with
747 ANSI C header files and you cannot use @samp{-traditional} on such
748 systems to compile files that include any system headers.
749
750 The @samp{-traditional} option also enables the @samp{-traditional-cpp}
751 option, which is described next.
752
753 @item -traditional-cpp
754 Attempt to support some aspects of traditional C preprocessors.
755 Specifically:
756
757 @itemize @bullet
758 @item
759 Comments convert to nothing at all, rather than to a space.  This allows
760 traditional token concatenation.
761
762 @item
763 In a preprocessing directive, the @samp{#} symbol must appear as the first
764 character of a line.
765
766 @item
767 Macro arguments are recognized within string constants in a macro
768 definition (and their values are stringified, though without additional
769 quote marks, when they appear in such a context).  The preprocessor
770 always considers a string constant to end at a newline.
771
772 @item
773 @cindex detecting @w{@samp{-traditional}}
774 The predefined macro @code{__STDC__} is not defined when you use
775 @samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
776 which @code{__GNUC__} indicates are not affected by
777 @samp{-traditional}).  If you need to write header files that work
778 differently depending on whether @samp{-traditional} is in use, by
779 testing both of these predefined macros you can distinguish four
780 situations: GNU C, traditional GNU C, other ANSI C compilers, and other
781 old C compilers.  The predefined macro @code{__STDC_VERSION__} is also
782 not defined when you use @samp{-traditional}.  @xref{Standard
783 Predefined,,Standard Predefined Macros,cpp.info,The C Preprocessor},
784 for more discussion of these and other predefined macros.
785
786 @item
787 @cindex string constants vs newline
788 @cindex newline vs string constants
789 The preprocessor considers a string constant to end at a newline (unless
790 the newline is escaped with @samp{\}).  (Without @w{@samp{-traditional}},
791 string constants can contain the newline character as typed.)
792 @end itemize
793
794 @item -fcond-mismatch
795 Allow conditional expressions with mismatched types in the second and
796 third arguments.  The value of such an expression is void.
797
798 @item -funsigned-char
799 Let the type @code{char} be unsigned, like @code{unsigned char}.
800
801 Each kind of machine has a default for what @code{char} should
802 be.  It is either like @code{unsigned char} by default or like
803 @code{signed char} by default.
804
805 Ideally, a portable program should always use @code{signed char} or
806 @code{unsigned char} when it depends on the signedness of an object.
807 But many programs have been written to use plain @code{char} and
808 expect it to be signed, or expect it to be unsigned, depending on the
809 machines they were written for.  This option, and its inverse, let you
810 make such a program work with the opposite default.
811
812 The type @code{char} is always a distinct type from each of
813 @code{signed char} or @code{unsigned char}, even though its behavior
814 is always just like one of those two.
815
816 @item -fsigned-char
817 Let the type @code{char} be signed, like @code{signed char}.
818
819 Note that this is equivalent to @samp{-fno-unsigned-char}, which is
820 the negative form of @samp{-funsigned-char}.  Likewise, the option
821 @samp{-fno-signed-char} is equivalent to @samp{-funsigned-char}.
822
823 You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
824 if your program uses names that are normally GNU C builtin functions for
825 other purposes of its own.
826
827 You cannot use @samp{-traditional} if you include any header files that
828 rely on ANSI C features.  Some vendors are starting to ship systems with
829 ANSI C header files and you cannot use @samp{-traditional} on such
830 systems to compile files that include any system headers.
831
832 @item -fsigned-bitfields
833 @itemx -funsigned-bitfields
834 @itemx -fno-signed-bitfields
835 @itemx -fno-unsigned-bitfields
836 These options control whether a bitfield is signed or unsigned, when the
837 declaration does not use either @code{signed} or @code{unsigned}.  By
838 default, such a bitfield is signed, because this is consistent: the
839 basic integer types such as @code{int} are signed types.
840
841 However, when @samp{-traditional} is used, bitfields are all unsigned
842 no matter what.
843
844 @item -fwritable-strings
845 Store string constants in the writable data segment and don't uniquize
846 them.  This is for compatibility with old programs which assume they can
847 write into string constants.  The option @samp{-traditional} also has
848 this effect.
849
850 Writing into string constants is a very bad idea; ``constants'' should
851 be constant.
852
853 @item -fallow-single-precision
854 Do not promote single precision math operations to double precision,
855 even when compiling with @samp{-traditional}.
856
857 Traditional K&R C promotes all floating point operations to double
858 precision, regardless of the sizes of the operands.   On the
859 architecture for which you are compiling, single precision may be faster
860 than double precision.   If you must use @samp{-traditional}, but want
861 to use single precision operations when the operands are single
862 precision, use this option.   This option has no effect when compiling
863 with ANSI or GNU C conventions (the default).
864
865 @end table
866
867 @node C++ Dialect Options
868 @section Options Controlling C++ Dialect
869
870 @cindex compiler options, C++
871 @cindex C++ options, command line
872 @cindex options, C++
873 This section describes the command-line options that are only meaningful
874 for C++ programs; but you can also use most of the GNU compiler options
875 regardless of what language your program is in.  For example, you
876 might compile a file @code{firstClass.C} like this:
877
878 @example
879 g++ -g -felide-constructors -O -c firstClass.C
880 @end example
881
882 @noindent
883 In this example, only @samp{-felide-constructors} is an option meant
884 only for C++ programs; you can use the other options with any
885 language supported by GNU CC.
886
887 Here is a list of options that are @emph{only} for compiling C++ programs:
888
889 @table @code
890 @item -fno-access-control
891 Turn off all access checking.  This switch is mainly useful for working
892 around bugs in the access control code.
893
894 @item -fall-virtual
895 Treat all possible member functions as virtual, implicitly.
896 All member functions (except for constructor functions and @code{new} or
897 @code{delete} member operators) are treated as virtual functions of the
898 class where they appear.
899
900 This does not mean that all calls to these member functions will be made
901 through the internal table of virtual functions.  Under some
902 circumstances, the compiler can determine that a call to a given virtual
903 function can be made directly; in these cases the calls are direct in
904 any case.
905
906 @item -fcheck-new
907 Check that the pointer returned by @code{operator new} is non-null
908 before attempting to modify the storage allocated.  The current Working
909 Paper requires that @code{operator new} never return a null pointer, so
910 this check is normally unnecessary.
911
912 @item -fconserve-space
913 Put uninitialized or runtime-initialized global variables into the
914 common segment, as C does.  This saves space in the executable at the
915 cost of not diagnosing duplicate definitions.  If you compile with this
916 flag and your program mysteriously crashes after @code{main()} has
917 completed, you may have an object that is being destroyed twice because
918 two definitions were merged.
919
920 @item -fdollars-in-identifiers
921 Accept @samp{$} in identifiers.  You can also explicitly prohibit use of
922 @samp{$} with the option @samp{-fno-dollars-in-identifiers}.  (GNU C allows
923 @samp{$} by default on most target systems, but there are a few exceptions.)
924 Traditional C allowed the character @samp{$} to form part of
925 identifiers.  However, ANSI C and C++ forbid @samp{$} in identifiers.
926
927 @item -fenum-int-equiv
928 Anachronistically permit implicit conversion of @code{int} to
929 enumeration types.  Current C++ allows conversion of @code{enum} to
930 @code{int}, but not the other way around.
931
932 @item -fexternal-templates
933 Cause template instantiations to obey @samp{#pragma interface} and
934 @samp{implementation}; template instances are emitted or not according
935 to the location of the template definition.  @xref{Template
936 Instantiation}, for more information.
937
938 This option is deprecated.
939
940 @item -falt-external-templates
941 Similar to -fexternal-templates, but template instances are emitted or
942 not according to the place where they are first instantiated.
943 @xref{Template Instantiation}, for more information.
944
945 This option is deprecated.
946
947 @item -ffor-scope
948 @itemx -fno-for-scope
949 If -ffor-scope is specified, the scope of variables declared in
950 a @i{for-init-statement} is limited to the @samp{for} loop itself,
951 as specified by the draft C++ standard.
952 If -fno-for-scope is specified, the scope of variables declared in
953 a @i{for-init-statement} extends to the end of the enclosing scope,
954 as was the case in old versions of gcc, and other (traditional)
955 implementations of C++.
956
957 The default if neither flag is given to follow the standard,
958 but to allow and give a warning for old-style code that would
959 otherwise be invalid, or have different behavior.
960
961 @item -fno-gnu-keywords
962 Do not recognize @code{classof}, @code{headof}, @code{signature},
963 @code{sigof} or @code{typeof} as a keyword, so that code can use these
964 words as identifiers.  You can use the keywords @code{__classof__},
965 @code{__headof__}, @code{__signature__}, @code{__sigof__}, and
966 @code{__typeof__} instead.  @samp{-ansi} implies
967 @samp{-fno-gnu-keywords}.
968
969 @item -fguiding-decls
970 Treat a function declaration with the same type as a potential function
971 template instantiation as though it declares that instantiation, not a
972 normal function.  If a definition is given for the function later in the
973 translation unit (or another translation unit if the target supports
974 weak symbols), that definition will be used; otherwise the template will
975 be instantiated.  This behavior reflects the C++ language prior to
976 September 1996, when guiding declarations were removed.
977
978 This option implies @samp{-fname-mangling-version-0}, and will not work
979 with other name mangling versions.
980
981 @item -fno-implicit-templates
982 Never emit code for templates which are instantiated implicitly (i.e. by
983 use); only emit code for explicit instantiations.  @xref{Template
984 Instantiation}, for more information.
985
986 @item -fhandle-signatures
987 Recognize the @code{signature} and @code{sigof} keywords for specifying
988 abstract types.  The default (@samp{-fno-handle-signatures}) is not to
989 recognize them.  @xref{C++ Signatures, Type Abstraction using
990 Signatures}.
991
992 @item -fhuge-objects
993 Support virtual function calls for objects that exceed the size
994 representable by a @samp{short int}.  Users should not use this flag by
995 default; if you need to use it, the compiler will tell you so.  If you
996 compile any of your code with this flag, you must compile @emph{all} of
997 your code with this flag (including libg++, if you use it).
998
999 This flag is not useful when compiling with -fvtable-thunks.
1000
1001 @item -fno-implement-inlines
1002 To save space, do not emit out-of-line copies of inline functions
1003 controlled by @samp{#pragma implementation}.  This will cause linker
1004 errors if these functions are not inlined everywhere they are called.
1005
1006 @item -fmemoize-lookups
1007 @itemx -fsave-memoized
1008 Use heuristics to compile faster.  These heuristics are not enabled by
1009 default, since they are only effective for certain input files.  Other
1010 input files compile more slowly.
1011
1012 The first time the compiler must build a call to a member function (or
1013 reference to a data member), it must (1) determine whether the class
1014 implements member functions of that name; (2) resolve which member
1015 function to call (which involves figuring out what sorts of type
1016 conversions need to be made); and (3) check the visibility of the member
1017 function to the caller.  All of this adds up to slower compilation.
1018 Normally, the second time a call is made to that member function (or
1019 reference to that data member), it must go through the same lengthy
1020 process again.  This means that code like this:
1021
1022 @smallexample
1023 cout << "This " << p << " has " << n << " legs.\n";
1024 @end smallexample
1025
1026 @noindent
1027 makes six passes through all three steps.  By using a software cache, a
1028 ``hit'' significantly reduces this cost.  Unfortunately, using the cache
1029 introduces another layer of mechanisms which must be implemented, and so
1030 incurs its own overhead.  @samp{-fmemoize-lookups} enables the software
1031 cache.
1032
1033 Because access privileges (visibility) to members and member functions
1034 may differ from one function context to the next, G++ may need to flush
1035 the cache.  With the @samp{-fmemoize-lookups} flag, the cache is flushed
1036 after every function that is compiled.  The @samp{-fsave-memoized} flag
1037 enables the same software cache, but when the compiler determines that
1038 the context of the last function compiled would yield the same access
1039 privileges of the next function to compile, it preserves the cache.
1040 This is most helpful when defining many member functions for the same
1041 class: with the exception of member functions which are friends of other
1042 classes, each member function has exactly the same access privileges as
1043 every other, and the cache need not be flushed.
1044
1045 The code that implements these flags has rotted; you should probably
1046 avoid using them.
1047
1048 @item -fstrict-prototype
1049 Within an @samp{extern "C"} linkage specification, treat a function
1050 declaration with no arguments, such as @samp{int foo ();}, as declaring
1051 the function to take no arguments.  Normally, such a declaration means
1052 that the function @code{foo} can take any combination of arguments, as
1053 in C.  @samp{-pedantic} implies @samp{-fstrict-prototype} unless
1054 overridden with @samp{-fno-strict-prototype}.
1055
1056 This flag no longer affects declarations with C++ linkage.
1057
1058 @item -fname-mangling-version-@var{n}
1059 Control the way in which names are mangled.  Version 0 is compatible
1060 with versions of g++ before 2.8.  Version 1 is the default.  Version 1
1061 will allow correct mangling of function templates.  For example, 
1062 version 0 mangling does not mangle foo<int, double> and foo<int, char>
1063 given this declaration:
1064
1065 @example
1066 template <class T, class U> void foo(T t);
1067 @end example
1068
1069 @item -fno-nonnull-objects
1070 Don't assume that a reference is initialized to refer to a valid object.
1071 Although the current C++ Working Paper prohibits null references, some
1072 old code may rely on them, and you can use @samp{-fno-nonnull-objects}
1073 to turn on checking.
1074
1075 At the moment, the compiler only does this checking for conversions to
1076 virtual base classes.
1077
1078 @item -foperator-names
1079 Recognize the operator name keywords @code{and}, @code{bitand},
1080 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1081 synonyms for the symbols they refer to.  @samp{-ansi} implies
1082 @samp{-foperator-names}.
1083
1084 @item -frepo
1085 Enable automatic template instantiation.  This option also implies
1086 @samp{-fno-implicit-templates}.  @xref{Template Instantiation}, for more
1087 information.
1088
1089 @item -fthis-is-variable
1090 Permit assignment to @code{this}.  The incorporation of user-defined
1091 free store management into C++ has made assignment to @samp{this} an
1092 anachronism.  Therefore, by default it is invalid to assign to
1093 @code{this} within a class member function; that is, GNU C++ treats
1094 @samp{this} in a member function of class @code{X} as a non-lvalue of
1095 type @samp{X *}.  However, for backwards compatibility, you can make it
1096 valid with @samp{-fthis-is-variable}.
1097
1098 @item -fvtable-thunks
1099 Use @samp{thunks} to implement the virtual function dispatch table
1100 (@samp{vtable}).  The traditional (cfront-style) approach to
1101 implementing vtables was to store a pointer to the function and two
1102 offsets for adjusting the @samp{this} pointer at the call site.  Newer
1103 implementations store a single pointer to a @samp{thunk} function which
1104 does any necessary adjustment and then calls the target function.
1105
1106 This option also enables a heuristic for controlling emission of
1107 vtables; if a class has any non-inline virtual functions, the vtable
1108 will be emitted in the translation unit containing the first one of
1109 those.
1110
1111 @item -ftemplate-depth-@var{n}
1112 Set the maximum instantiation depth for template classes to @var{n}.
1113 A limit on the template instantiation depth is needed to detect
1114 endless recursions during template class instantiation. ANSI/ISO C++
1115 conforming programs must not rely on a maximum depth greater than 17.
1116
1117 @item -nostdinc++
1118 Do not search for header files in the standard directories specific to
1119 C++, but do still search the other standard directories.  (This option
1120 is used when building libg++.)
1121
1122 @item -traditional
1123 For C++ programs (in addition to the effects that apply to both C and
1124 C++), this has the same effect as @samp{-fthis-is-variable}.
1125 @xref{C Dialect Options,, Options Controlling C Dialect}.
1126 @end table
1127
1128 In addition, these optimization, warning, and code generation options
1129 have meanings only for C++ programs:
1130
1131 @table @code
1132 @item -fno-default-inline
1133 Do not assume @samp{inline} for functions defined inside a class scope.
1134 @xref{Optimize Options,,Options That Control Optimization}.
1135
1136 @item -Wold-style-cast
1137 @itemx -Woverloaded-virtual
1138 @itemx -Wtemplate-debugging
1139 Warnings that apply only to C++ programs.  @xref{Warning
1140 Options,,Options to Request or Suppress Warnings}.
1141
1142 @item -Weffc++
1143 Warn about violation of some style rules from Effective C++ by Scott Myers.
1144
1145 @item +e@var{n}
1146 Control how virtual function definitions are used, in a fashion
1147 compatible with @code{cfront} 1.x.  @xref{Code Gen Options,,Options for
1148 Code Generation Conventions}.
1149 @end table
1150
1151 @node Warning Options
1152 @section Options to Request or Suppress Warnings
1153 @cindex options to control warnings
1154 @cindex warning messages
1155 @cindex messages, warning
1156 @cindex suppressing warnings
1157
1158 Warnings are diagnostic messages that report constructions which
1159 are not inherently erroneous but which are risky or suggest there
1160 may have been an error.
1161
1162 You can request many specific warnings with options beginning @samp{-W},
1163 for example @samp{-Wimplicit} to request warnings on implicit
1164 declarations.  Each of these specific warning options also has a
1165 negative form beginning @samp{-Wno-} to turn off warnings;
1166 for example, @samp{-Wno-implicit}.  This manual lists only one of the
1167 two forms, whichever is not the default.
1168
1169 These options control the amount and kinds of warnings produced by GNU
1170 CC:
1171
1172 @table @code
1173 @cindex syntax checking
1174 @item -fsyntax-only
1175 Check the code for syntax errors, but don't do anything beyond that.
1176
1177 @item -pedantic
1178 Issue all the warnings demanded by strict ANSI standard C; reject
1179 all programs that use forbidden extensions.
1180
1181 Valid ANSI standard C programs should compile properly with or without
1182 this option (though a rare few will require @samp{-ansi}).  However,
1183 without this option, certain GNU extensions and traditional C features
1184 are supported as well.  With this option, they are rejected.
1185
1186 @samp{-pedantic} does not cause warning messages for use of the
1187 alternate keywords whose names begin and end with @samp{__}.  Pedantic
1188 warnings are also disabled in the expression that follows
1189 @code{__extension__}.  However, only system header files should use
1190 these escape routes; application programs should avoid them.
1191 @xref{Alternate Keywords}.
1192
1193 This option is not intended to be @i{useful}; it exists only to satisfy
1194 pedants who would otherwise claim that GNU CC fails to support the ANSI
1195 standard.
1196
1197 Some users try to use @samp{-pedantic} to check programs for strict ANSI
1198 C conformance.  They soon find that it does not do quite what they want:
1199 it finds some non-ANSI practices, but not all---only those for which
1200 ANSI C @emph{requires} a diagnostic.
1201
1202 A feature to report any failure to conform to ANSI C might be useful in
1203 some instances, but would require considerable additional work and would
1204 be quite different from @samp{-pedantic}.  We recommend, rather, that
1205 users take advantage of the extensions of GNU C and disregard the
1206 limitations of other compilers.  Aside from certain supercomputers and
1207 obsolete small machines, there is less and less reason ever to use any
1208 other C compiler other than for bootstrapping GNU CC.
1209
1210 @item -pedantic-errors
1211 Like @samp{-pedantic}, except that errors are produced rather than
1212 warnings.
1213
1214 @item -w
1215 Inhibit all warning messages.
1216
1217 @item -Wno-import
1218 Inhibit warning messages about the use of @samp{#import}.
1219
1220 @item -Wchar-subscripts
1221 Warn if an array subscript has type @code{char}.  This is a common cause
1222 of error, as programmers often forget that this type is signed on some
1223 machines.
1224
1225 @item -Wcomment
1226 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1227 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1228
1229 @item -Wformat
1230 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1231 the arguments supplied have types appropriate to the format string
1232 specified.
1233
1234 @item -Wimplicit-int
1235 Warn when a declaration does not specify a type.
1236
1237 @item -Wimplicit-function-declarations
1238 Warn whenever a function is used before being declared.
1239
1240 @item -Wimplicit
1241 Same as @samp{-Wimplicit-int} @samp{-Wimplicit-function-declaration}.
1242
1243 @item -Wmain
1244 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
1245 function with external linkage, returning int, taking either zero
1246 arguments, two, or three arguments of appropriate types.
1247   
1248 @item -Wparentheses
1249 Warn if parentheses are omitted in certain contexts, such
1250 as when there is an assignment in a context where a truth value
1251 is expected, or when operators are nested whose precedence people
1252 often get confused about.
1253
1254 Also warn about constructions where there may be confusion to which
1255 @code{if} statement an @code{else} branch belongs.  Here is an example of
1256 such a case:
1257
1258 @smallexample
1259 @{
1260   if (a)
1261     if (b)
1262       foo ();
1263   else
1264     bar ();
1265 @}
1266 @end smallexample
1267
1268 In C, every @code{else} branch belongs to the innermost possible @code{if}
1269 statement, which in this example is @code{if (b)}.  This is often not
1270 what the programmer expected, as illustrated in the above example by
1271 indentation the programmer chose.  When there is the potential for this
1272 confusion, GNU C will issue a warning when this flag is specified.
1273 To eliminate the warning, add explicit braces around the innermost
1274 @code{if} statement so there is no way the @code{else} could belong to
1275 the enclosing @code{if}.  The resulting code would look like this:
1276
1277 @smallexample
1278 @{
1279   if (a)
1280     @{
1281       if (b)
1282         foo ();
1283       else
1284         bar ();
1285     @}
1286 @}
1287 @end smallexample
1288
1289 @item -Wreturn-type
1290 Warn whenever a function is defined with a return-type that defaults
1291 to @code{int}.  Also warn about any @code{return} statement with no
1292 return-value in a function whose return-type is not @code{void}.
1293
1294 @item -Wswitch
1295 Warn whenever a @code{switch} statement has an index of enumeral type
1296 and lacks a @code{case} for one or more of the named codes of that
1297 enumeration.  (The presence of a @code{default} label prevents this
1298 warning.)  @code{case} labels outside the enumeration range also
1299 provoke warnings when this option is used.
1300
1301 @item -Wtrigraphs
1302 Warn if any trigraphs are encountered (assuming they are enabled).
1303
1304 @item -Wunused
1305 Warn whenever a variable is unused aside from its declaration,
1306 whenever a function is declared static but never defined, whenever a
1307 label is declared but not used, and whenever a statement computes a
1308 result that is explicitly not used.
1309
1310 To suppress this warning for an expression, simply cast it to void.  For
1311 unused variables and parameters, use the @samp{unused} attribute
1312 (@pxref{Variable Attributes}).
1313
1314 @item -Wuninitialized
1315 An automatic variable is used without first being initialized.
1316
1317 These warnings are possible only in optimizing compilation,
1318 because they require data flow information that is computed only
1319 when optimizing.  If you don't specify @samp{-O}, you simply won't
1320 get these warnings.
1321
1322 These warnings occur only for variables that are candidates for
1323 register allocation.  Therefore, they do not occur for a variable that
1324 is declared @code{volatile}, or whose address is taken, or whose size
1325 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
1326 structures, unions or arrays, even when they are in registers.
1327
1328 Note that there may be no warning about a variable that is used only
1329 to compute a value that itself is never used, because such
1330 computations may be deleted by data flow analysis before the warnings
1331 are printed.
1332
1333 These warnings are made optional because GNU CC is not smart
1334 enough to see all the reasons why the code might be correct
1335 despite appearing to have an error.  Here is one example of how
1336 this can happen:
1337
1338 @smallexample
1339 @{
1340   int x;
1341   switch (y)
1342     @{
1343     case 1: x = 1;
1344       break;
1345     case 2: x = 4;
1346       break;
1347     case 3: x = 5;
1348     @}
1349   foo (x);
1350 @}
1351 @end smallexample
1352
1353 @noindent
1354 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
1355 always initialized, but GNU CC doesn't know this.  Here is
1356 another common case:
1357
1358 @smallexample
1359 @{
1360   int save_y;
1361   if (change_y) save_y = y, y = new_y;
1362   @dots{}
1363   if (change_y) y = save_y;
1364 @}
1365 @end smallexample
1366
1367 @noindent
1368 This has no bug because @code{save_y} is used only if it is set.
1369
1370 Some spurious warnings can be avoided if you declare all the functions
1371 you use that never return as @code{noreturn}.  @xref{Function
1372 Attributes}.
1373
1374 @item -Wreorder (C++ only)
1375 @cindex reordering, warning
1376 @cindex warning for reordering of member initializers
1377 Warn when the order of member initializers given in the code does not
1378 match the order in which they must be executed.  For instance:
1379
1380 @smallexample
1381 struct A @{
1382   int i;
1383   int j;
1384   A(): j (0), i (1) @{ @}
1385 @};
1386 @end smallexample
1387
1388 Here the compiler will warn that the member initializers for @samp{i}
1389 and @samp{j} will be rearranged to match the declaration order of the
1390 members.
1391
1392 @item -Wtemplate-debugging
1393 @cindex template debugging
1394 When using templates in a C++ program, warn if debugging is not yet
1395 fully available (C++ only).
1396
1397 @item -Wall
1398 All of the above @samp{-W} options combined.  This enables all the
1399 warnings about constructions that some users consider questionable, and
1400 that are easy to avoid (or modify to prevent the warning), even in
1401 conjunction with macros.
1402 @end table
1403
1404 The following @samp{-W@dots{}} options are not implied by @samp{-Wall}.
1405 Some of them warn about constructions that users generally do not
1406 consider questionable, but which occasionally you might wish to check
1407 for; others warn about constructions that are necessary or hard to avoid
1408 in some cases, and there is no simple way to modify the code to suppress
1409 the warning.
1410
1411 @table @code
1412 @item -W
1413 Print extra warning messages for these events:
1414
1415 @itemize @bullet
1416 @cindex @code{longjmp} warnings
1417 @item
1418 A nonvolatile automatic variable might be changed by a call to
1419 @code{longjmp}.  These warnings as well are possible only in
1420 optimizing compilation.
1421
1422 The compiler sees only the calls to @code{setjmp}.  It cannot know
1423 where @code{longjmp} will be called; in fact, a signal handler could
1424 call it at any point in the code.  As a result, you may get a warning
1425 even when there is in fact no problem because @code{longjmp} cannot
1426 in fact be called at the place which would cause a problem.
1427
1428 @item
1429 A function can return either with or without a value.  (Falling
1430 off the end of the function body is considered returning without
1431 a value.)  For example, this function would evoke such a
1432 warning:
1433
1434 @smallexample
1435 @group
1436 foo (a)
1437 @{
1438   if (a > 0)
1439     return a;
1440 @}
1441 @end group
1442 @end smallexample
1443
1444 @item
1445 An expression-statement or the left-hand side of a comma expression
1446 contains no side effects.
1447 To suppress the warning, cast the unused expression to void.
1448 For example, an expression such as @samp{x[i,j]} will cause a warning,
1449 but @samp{x[(void)i,j]} will not.
1450
1451 @item
1452 An unsigned value is compared against zero with @samp{<} or @samp{<=}.
1453
1454 @item
1455 A comparison like @samp{x<=y<=z} appears; this is equivalent to
1456 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
1457 that of ordinary mathematical notation.
1458
1459 @item
1460 Storage-class specifiers like @code{static} are not the first things in
1461 a declaration.  According to the C Standard, this usage is obsolescent.
1462
1463 @item
1464 If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused
1465 arguments.
1466
1467 @item
1468 A comparison between signed and unsigned values could produce an
1469 incorrect result when the signed value is converted to unsigned.
1470 (But do not warn if @samp{-Wno-sign-compare} is also specified.)
1471
1472 @item
1473 An aggregate has a partly bracketed initializer.
1474 For example, the following code would evoke such a warning,
1475 because braces are missing around the initializer for @code{x.h}:
1476
1477 @smallexample
1478 struct s @{ int f, g; @};
1479 struct t @{ struct s h; int i; @};
1480 struct t x = @{ 1, 2, 3 @};
1481 @end smallexample
1482 @end itemize
1483
1484 @item -Wtraditional
1485 Warn about certain constructs that behave differently in traditional and
1486 ANSI C.
1487
1488 @itemize @bullet
1489 @item
1490 Macro arguments occurring within string constants in the macro body.
1491 These would substitute the argument in traditional C, but are part of
1492 the constant in ANSI C.
1493
1494 @item
1495 A function declared external in one block and then used after the end of
1496 the block.
1497
1498 @item
1499 A @code{switch} statement has an operand of type @code{long}.
1500 @end itemize
1501
1502 @item -Wundef
1503 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
1504
1505 @item -Wshadow
1506 Warn whenever a local variable shadows another local variable.
1507
1508 @item -Wid-clash-@var{len}
1509 Warn whenever two distinct identifiers match in the first @var{len}
1510 characters.  This may help you prepare a program that will compile
1511 with certain obsolete, brain-damaged compilers.
1512
1513 @item -Wlarger-than-@var{len}
1514 Warn whenever an object of larger than @var{len} bytes is defined.
1515
1516 @item -Wpointer-arith
1517 Warn about anything that depends on the ``size of'' a function type or
1518 of @code{void}.  GNU C assigns these types a size of 1, for
1519 convenience in calculations with @code{void *} pointers and pointers
1520 to functions.
1521
1522 @item -Wbad-function-cast
1523 Warn whenever a function call is cast to a non-matching type.
1524 For example, warn if @code{int malloc()} is cast to @code{anything *}.
1525
1526 @item -Wcast-qual
1527 Warn whenever a pointer is cast so as to remove a type qualifier from
1528 the target type.  For example, warn if a @code{const char *} is cast
1529 to an ordinary @code{char *}.
1530
1531 @item -Wcast-align
1532 Warn whenever a pointer is cast such that the required alignment of the
1533 target is increased.  For example, warn if a @code{char *} is cast to
1534 an @code{int *} on machines where integers can only be accessed at
1535 two- or four-byte boundaries.
1536
1537 @item -Wwrite-strings
1538 Give string constants the type @code{const char[@var{length}]} so that
1539 copying the address of one into a non-@code{const} @code{char *}
1540 pointer will get a warning.  These warnings will help you find at
1541 compile time code that can try to write into a string constant, but
1542 only if you have been very careful about using @code{const} in
1543 declarations and prototypes.  Otherwise, it will just be a nuisance;
1544 this is why we did not make @samp{-Wall} request these warnings.
1545
1546 @item -Wconversion
1547 Warn if a prototype causes a type conversion that is different from what
1548 would happen to the same argument in the absence of a prototype.  This
1549 includes conversions of fixed point to floating and vice versa, and
1550 conversions changing the width or signedness of a fixed point argument
1551 except when the same as the default promotion.
1552
1553 Also, warn if a negative integer constant expression is implicitly
1554 converted to an unsigned type.  For example, warn about the assignment
1555 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
1556 casts like @code{(unsigned) -1}.
1557
1558 @item -Wsign-compare
1559 @cindex warning for comparison of signed and unsigned values
1560 @cindex comparison of signed and unsigned values, warning
1561 @cindex signed and unsigned values, comparison warning
1562 Warn when a comparison between signed and unsigned values could produce
1563 an incorrect result when the signed value is converted to unsigned.
1564 This warning is also enabled by @samp{-W}; to get the other warnings
1565 of @samp{-W} without this warning, use @samp{-W -Wno-sign-compare}.
1566
1567 @item -Waggregate-return
1568 Warn if any functions that return structures or unions are defined or
1569 called.  (In languages where you can return an array, this also elicits
1570 a warning.)
1571
1572 @item -Wstrict-prototypes
1573 Warn if a function is declared or defined without specifying the
1574 argument types.  (An old-style function definition is permitted without
1575 a warning if preceded by a declaration which specifies the argument
1576 types.)
1577
1578 @item -Wmissing-prototypes
1579 Warn if a global function is defined without a previous prototype
1580 declaration.  This warning is issued even if the definition itself
1581 provides a prototype.  The aim is to detect global functions that fail
1582 to be declared in header files.
1583
1584 @item -Wmissing-declarations
1585 Warn if a global function is defined without a previous declaration.
1586 Do so even if the definition itself provides a prototype.
1587 Use this option to detect global functions that are not declared in
1588 header files.
1589
1590 @item -Wredundant-decls
1591 Warn if anything is declared more than once in the same scope, even in
1592 cases where multiple declaration is valid and changes nothing.
1593
1594 @item -Wnested-externs
1595 Warn if an @code{extern} declaration is encountered within an function.
1596
1597 @item -Winline
1598 Warn if a function can not be inlined, and either it was declared as inline,
1599 or else the @samp{-finline-functions} option was given.
1600
1601 @item -Wold-style-cast
1602 Warn if an old-style (C-style) cast is used within a program.
1603
1604 @item -Woverloaded-virtual
1605 @cindex overloaded virtual fn, warning
1606 @cindex warning for overloaded virtual fn
1607 Warn when a derived class function declaration may be an error in
1608 defining a virtual function (C++ only).  In a derived class, the
1609 definitions of virtual functions must match the type signature of a
1610 virtual function declared in the base class.  With this option, the
1611 compiler warns when you define a function with the same name as a
1612 virtual function, but with a type signature that does not match any
1613 declarations from the base class.
1614
1615 @item -Wsynth (C++ only)
1616 @cindex warning for synthesized methods
1617 @cindex synthesized methods, warning
1618 Warn when g++'s synthesis behavior does not match that of cfront.  For
1619 instance:
1620
1621 @smallexample
1622 struct A @{
1623   operator int ();
1624   A& operator = (int);
1625 @};
1626
1627 main ()
1628 @{
1629   A a,b;
1630   a = b;
1631 @}
1632 @end smallexample
1633
1634 In this example, g++ will synthesize a default @samp{A& operator =
1635 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1636
1637 @item -Werror
1638 Make all warnings into errors.
1639 @end table
1640
1641 @node Debugging Options
1642 @section Options for Debugging Your Program or GNU CC
1643 @cindex options, debugging
1644 @cindex debugging information options
1645
1646 GNU CC has various special options that are used for debugging
1647 either your program or GCC:
1648
1649 @table @code
1650 @item -g
1651 Produce debugging information in the operating system's native format
1652 (stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugging
1653 information.
1654
1655 On most systems that use stabs format, @samp{-g} enables use of extra
1656 debugging information that only GDB can use; this extra information
1657 makes debugging work better in GDB but will probably make other debuggers
1658 crash or
1659 refuse to read the program.  If you want to control for certain whether
1660 to generate the extra information, use @samp{-gstabs+}, @samp{-gstabs},
1661 @samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf-1+}, or @samp{-gdwarf-1}
1662 (see below).
1663
1664 Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
1665 @samp{-O}.  The shortcuts taken by optimized code may occasionally
1666 produce surprising results: some variables you declared may not exist
1667 at all; flow of control may briefly move where you did not expect it;
1668 some statements may not be executed because they compute constant
1669 results or their values were already at hand; some statements may
1670 execute in different places because they were moved out of loops.
1671
1672 Nevertheless it proves possible to debug optimized output.  This makes
1673 it reasonable to use the optimizer for programs that might have bugs.
1674
1675 The following options are useful when GNU CC is generated with the
1676 capability for more than one debugging format.
1677
1678 @item -ggdb
1679 Produce debugging information for use by GDB.  This means to use the
1680 most expressive format available (DWARF 2, stabs, or the native format
1681 if neither of those are supported), including GDB extensions if at all
1682 possible.
1683
1684 @item -gstabs
1685 Produce debugging information in stabs format (if that is supported),
1686 without GDB extensions.  This is the format used by DBX on most BSD
1687 systems.  On MIPS, Alpha and System V Release 4 systems this option
1688 produces stabs debugging output which is not understood by DBX or SDB.
1689 On System V Release 4 systems this option requires the GNU assembler.
1690
1691 @item -gstabs+
1692 Produce debugging information in stabs format (if that is supported),
1693 using GNU extensions understood only by the GNU debugger (GDB).  The
1694 use of these extensions is likely to make other debuggers crash or
1695 refuse to read the program.
1696
1697 @item -gcoff
1698 Produce debugging information in COFF format (if that is supported).
1699 This is the format used by SDB on most System V systems prior to
1700 System V Release 4.
1701
1702 @item -gxcoff
1703 Produce debugging information in XCOFF format (if that is supported).
1704 This is the format used by the DBX debugger on IBM RS/6000 systems.
1705
1706 @item -gxcoff+
1707 Produce debugging information in XCOFF format (if that is supported),
1708 using GNU extensions understood only by the GNU debugger (GDB).  The
1709 use of these extensions is likely to make other debuggers crash or
1710 refuse to read the program, and may cause assemblers other than the GNU
1711 assembler (GAS) to fail with an error.
1712
1713 @item -gdwarf
1714 Produce debugging information in DWARF version 1 format (if that is
1715 supported).  This is the format used by SDB on most System V Release 4
1716 systems.
1717
1718 @item -gdwarf+
1719 Produce debugging information in DWARF version 1 format (if that is
1720 supported), using GNU extensions understood only by the GNU debugger
1721 (GDB).  The use of these extensions is likely to make other debuggers
1722 crash or refuse to read the program.
1723
1724 @item -gdwarf-2
1725 Produce debugging information in DWARF version 2 format (if that is
1726 supported).  This is the format used by DBX on IRIX 6.
1727
1728 @item -g@var{level}
1729 @itemx -ggdb@var{level}
1730 @itemx -gstabs@var{level}
1731 @itemx -gcoff@var{level}
1732 @itemx -gxcoff@var{level}
1733 @itemx -gdwarf@var{level}
1734 @itemx -gdwarf-2@var{level}
1735 Request debugging information and also use @var{level} to specify how
1736 much information.  The default level is 2.
1737
1738 Level 1 produces minimal information, enough for making backtraces in
1739 parts of the program that you don't plan to debug.  This includes
1740 descriptions of functions and external variables, but no information
1741 about local variables and no line numbers.
1742
1743 Level 3 includes extra information, such as all the macro definitions
1744 present in the program.  Some debuggers support macro expansion when
1745 you use @samp{-g3}.
1746
1747 @cindex @code{prof}
1748 @item -p
1749 Generate extra code to write profile information suitable for the
1750 analysis program @code{prof}.  You must use this option when compiling
1751 the source files you want data about, and you must also use it when
1752 linking.
1753
1754 @cindex @code{gprof}
1755 @item -pg
1756 Generate extra code to write profile information suitable for the
1757 analysis program @code{gprof}.  You must use this option when compiling
1758 the source files you want data about, and you must also use it when
1759 linking.
1760
1761 @cindex @code{tcov}
1762 @item -a
1763 Generate extra code to write profile information for basic blocks, which will
1764 record the number of times each basic block is executed, the basic block start
1765 address, and the function name containing the basic block.  If @samp{-g} is
1766 used, the line number and filename of the start of the basic block will also be
1767 recorded.  If not overridden by the machine description, the default action is
1768 to append to the text file @file{bb.out}.
1769
1770 This data could be analyzed by a program like @code{tcov}.  Note,
1771 however, that the format of the data is not what @code{tcov} expects.
1772 Eventually GNU @code{gprof} should be extended to process this data.
1773
1774 @item -ax
1775 Generate extra code to profile basic blocks.  Your executable will
1776 produce output that is a superset of that produced when @samp{-a} is
1777 used.  Additional output is the source and target address of the basic
1778 blocks where a jump takes place, the number of times a jump is executed,
1779 and (optionally) the complete sequence of basic blocks being executed.
1780 The output is appended to file @file{bb.out}.
1781
1782 You can examine different profiling aspects without recompilation.  Your
1783 execuable will read a list of function names from file @file{bb.in}.
1784 Profiling starts when a function on the list is entered and stops when
1785 that invocation is exited.  To exclude a function from profiling, prefix
1786 its name with `-'.  If a function name is not unique, you can
1787 disambiguate it by writing it in the form
1788 @samp{/path/filename.d:functionname}.  Your executable will write the
1789 available paths and filenames in file @file{bb.out}.
1790
1791 Several function names have a special meaning:
1792 @table @code
1793 @item __bb_jumps__
1794 Write source, target and frequency of jumps to file @file{bb.out}.
1795 @item __bb_hidecall__
1796 Exclude function calls from frequency count.
1797 @item __bb_showret__
1798 Include function returns in frequency count.
1799 @item __bb_trace__
1800 Write the sequence of basic blocks executed to file @file{bbtrace.gz}.
1801 The file will be compressed using the program @samp{gzip}, which must
1802 exist in your @code{PATH}.  On systems without the @samp{popen}
1803 function, the file will be named @file{bbtrace} and will not be
1804 compressed.  @strong{Profiling for even a few seconds on these systems
1805 will produce a very large file.}  Note: @code{__bb_hidecall__} and
1806 @code{__bb_showret__} will not affect the sequence written to
1807 @file{bbtrace.gz}.
1808 @end table
1809
1810 Here's a short example using different profiling parameters
1811 in file @file{bb.in}.  Assume function @code{foo} consists of basic blocks
1812 1 and 2 and is called twice from block 3 of function @code{main}.  After
1813 the calls, block 3 transfers control to block 4 of @code{main}.
1814
1815 With @code{__bb_trace__} and @code{main} contained in file @file{bb.in},
1816 the following sequence of blocks is written to file @file{bbtrace.gz}:
1817 0 3 1 2 1 2 4.  The return from block 2 to block 3 is not shown, because
1818 the return is to a point inside the block and not to the top.  The
1819 block address 0 always indicates, that control is transferred
1820 to the trace from somewhere outside the observed functions.  With
1821 @samp{-foo} added to @file{bb.in}, the blocks of function
1822 @code{foo} are removed from the trace, so only 0 3 4 remains.
1823
1824 With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in},
1825 jump frequencies will be written to file @file{bb.out}.  The
1826 frequencies are obtained by constructing a trace of blocks
1827 and incrementing a counter for every neighbouring pair of blocks
1828 in the trace.  The trace 0 3 1 2 1 2 4 displays the following
1829 frequencies:
1830
1831 @example
1832 Jump from block 0x0 to block 0x3 executed 1 time(s)
1833 Jump from block 0x3 to block 0x1 executed 1 time(s)
1834 Jump from block 0x1 to block 0x2 executed 2 time(s)
1835 Jump from block 0x2 to block 0x1 executed 1 time(s)
1836 Jump from block 0x2 to block 0x4 executed 1 time(s)
1837 @end example
1838
1839 With @code{__bb_hidecall__}, control transfer due to call instructions
1840 is removed from the trace, that is the trace is cut into three parts: 0
1841 3 4, 0 1 2 and 0 1 2.  With @code{__bb_showret__}, control transfer due
1842 to return instructions is added to the trace.  The trace becomes: 0 3 1
1843 2 3 1 2 3 4.  Note, that this trace is not the same, as the sequence
1844 written to @file{bbtrace.gz}.  It is solely used for counting jump
1845 frequencies.
1846
1847 @item -fprofile-arcs
1848 Instrument @dfn{arcs} during compilation.  For each function of your
1849 program, GNU CC creates a program flow graph, then finds a spanning tree
1850 for the graph.  Only arcs that are not on the spanning tree have to be
1851 instrumented: the compiler adds code to count the number of times that these
1852 arcs are executed.  When an arc is the only exit or only entrance to a
1853 block, the instrumentation code can be added to the block; otherwise, a
1854 new basic block must be created to hold the instrumentation code.
1855
1856 Since not every arc in the program must be instrumented, programs
1857 compiled with this option run faster than programs compiled with
1858 @samp{-a}, which adds instrumentation code to every basic block in the
1859 program.  The tradeoff: since @code{gcov} does not have
1860 execution counts for all branches, it must start with the execution
1861 counts for the instrumented branches, and then iterate over the program
1862 flow graph until the entire graph has been solved.  Hence, @code{gcov}
1863 runs a little more slowly than a program which uses information from
1864 @samp{-a}.
1865
1866 @samp{-fprofile-arcs} also makes it possible to estimate branch
1867 probabilities, and to calculate basic block execution counts.  In
1868 general, basic block execution counts do not give enough information to
1869 estimate all branch probabilities.  When the compiled program exits, it
1870 saves the arc execution counts to a file called
1871 @file{@var{sourcename}.da}.  Use the compiler option
1872 @samp{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
1873 Control Optimization}) when recompiling, to optimize using estimated
1874 branch probabilities.
1875
1876 @need 2000
1877 @item -ftest-coverage
1878 Create data files for the @code{gcov} code-coverage utility
1879 (@pxref{Gcov,, @code{gcov}: a GNU CC Test Coverage Program}).
1880 The data file names begin with the name of your source file:
1881
1882 @table @code
1883 @item @var{sourcename}.bb
1884 A mapping from basic blocks to line numbers, which @code{gcov} uses to
1885 associate basic block execution counts with line numbers.
1886
1887 @item @var{sourcename}.bbg
1888 A list of all arcs in the program flow graph.  This allows @code{gcov}
1889 to reconstruct the program flow graph, so that it can compute all basic
1890 block and arc execution counts from the information in the
1891 @code{@var{sourcename}.da} file (this last file is the output from
1892 @samp{-fprofile-arcs}).
1893 @end table
1894
1895 @item -d@var{letters}
1896 Says to make debugging dumps during compilation at times specified by
1897 @var{letters}.  This is used for debugging the compiler.  The file names
1898 for most of the dumps are made by appending a word to the source file
1899 name (e.g.  @file{foo.c.rtl} or @file{foo.c.jump}).  Here are the
1900 possible letters for use in @var{letters}, and their meanings:
1901
1902 @table @samp
1903 @item M
1904 Dump all macro definitions, at the end of preprocessing, and write no
1905 output.
1906 @item N
1907 Dump all macro names, at the end of preprocessing.
1908 @item D
1909 Dump all macro definitions, at the end of preprocessing, in addition to
1910 normal output.
1911 @item y
1912 Dump debugging information during parsing, to standard error.
1913 @item r
1914 Dump after RTL generation, to @file{@var{file}.rtl}.
1915 @item x
1916 Just generate RTL for a function instead of compiling it.  Usually used
1917 with @samp{r}.
1918 @item j
1919 Dump after first jump optimization, to @file{@var{file}.jump}.
1920 @item s
1921 Dump after CSE (including the jump optimization that sometimes
1922 follows CSE), to @file{@var{file}.cse}.
1923 @item L
1924 Dump after loop optimization, to @file{@var{file}.loop}.
1925 @item t
1926 Dump after the second CSE pass (including the jump optimization that
1927 sometimes follows CSE), to @file{@var{file}.cse2}.
1928 @item f
1929 Dump after flow analysis, to @file{@var{file}.flow}.
1930 @item c
1931 Dump after instruction combination, to the file
1932 @file{@var{file}.combine}.
1933 @item S
1934 Dump after the first instruction scheduling pass, to
1935 @file{@var{file}.sched}.
1936 @item l
1937 Dump after local register allocation, to
1938 @file{@var{file}.lreg}.
1939 @item g
1940 Dump after global register allocation, to
1941 @file{@var{file}.greg}.
1942 @item R
1943 Dump after the second instruction scheduling pass, to
1944 @file{@var{file}.sched2}.
1945 @item J
1946 Dump after last jump optimization, to @file{@var{file}.jump2}.
1947 @item d
1948 Dump after delayed branch scheduling, to @file{@var{file}.dbr}.
1949 @item k
1950 Dump after conversion from registers to stack, to @file{@var{file}.stack}.
1951 @item a
1952 Produce all the dumps listed above.
1953 @item m
1954 Print statistics on memory usage, at the end of the run, to
1955 standard error.
1956 @item p
1957 Annotate the assembler output with a comment indicating which
1958 pattern and alternative was used.
1959 @item A
1960 Annotate the assembler output with miscellaneous debugging information.
1961 @end table
1962
1963 @item -fpretend-float
1964 When running a cross-compiler, pretend that the target machine uses the
1965 same floating point format as the host machine.  This causes incorrect
1966 output of the actual floating constants, but the actual instruction
1967 sequence will probably be the same as GNU CC would make when running on
1968 the target machine.
1969
1970 @item -save-temps
1971 Store the usual ``temporary'' intermediate files permanently; place them
1972 in the current directory and name them based on the source file.  Thus,
1973 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
1974 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.
1975
1976 @item -print-file-name=@var{library}
1977 Print the full absolute name of the library file @var{library} that
1978 would be used when linking---and don't do anything else.  With this
1979 option, GNU CC does not compile or link anything; it just prints the
1980 file name.
1981
1982 @item -print-prog-name=@var{program}
1983 Like @samp{-print-file-name}, but searches for a program such as @samp{cpp}.
1984
1985 @item -print-libgcc-file-name
1986 Same as @samp{-print-file-name=libgcc.a}.
1987
1988 This is useful when you use @samp{-nostdlib} or @samp{-nodefaultlibs}
1989 but you do want to link with @file{libgcc.a}.  You can do
1990
1991 @example
1992 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
1993 @end example
1994
1995 @item -print-search-dirs
1996 Print the name of the configured installation directory and a list of
1997 program and library directories gcc will search---and don't do anything else.
1998
1999 This is useful when gcc prints the error message
2000 @samp{installation problem, cannot exec cpp: No such file or directory}.
2001 To resolve this you either need to put @file{cpp} and the other compiler
2002 components where gcc expects to find them, or you can set the environment
2003 variable @code{GCC_EXEC_PREFIX} to the directory where you installed them.
2004 Don't forget the trailing '/'.
2005 @xref{Environment Variables}.
2006 @end table
2007
2008 @node Optimize Options
2009 @section Options That Control Optimization
2010 @cindex optimize options
2011 @cindex options, optimization
2012
2013 These options control various sorts of optimizations:
2014
2015 @table @code
2016 @item -O
2017 @itemx -O1
2018 Optimize.  Optimizing compilation takes somewhat more time, and a lot
2019 more memory for a large function.
2020
2021 Without @samp{-O}, the compiler's goal is to reduce the cost of
2022 compilation and to make debugging produce the expected results.
2023 Statements are independent: if you stop the program with a breakpoint
2024 between statements, you can then assign a new value to any variable or
2025 change the program counter to any other statement in the function and
2026 get exactly the results you would expect from the source code.
2027
2028 Without @samp{-O}, the compiler only allocates variables declared
2029 @code{register} in registers.  The resulting compiled code is a little
2030 worse than produced by PCC without @samp{-O}.
2031
2032 With @samp{-O}, the compiler tries to reduce code size and execution
2033 time.
2034
2035 When you specify @samp{-O}, the compiler turns on @samp{-fthread-jumps}
2036 and @samp{-fdefer-pop} on all machines.  The compiler turns on
2037 @samp{-fdelayed-branch} on machines that have delay slots, and
2038 @samp{-fomit-frame-pointer} on machines that can support debugging even
2039 without a frame pointer.  On some machines the compiler also turns
2040 on other flags.@refill
2041
2042 @item -O2
2043 Optimize even more.  GNU CC performs nearly all supported optimizations
2044 that do not involve a space-speed tradeoff.  The compiler does not
2045 perform loop unrolling or function inlining when you specify @samp{-O2}.
2046 As compared to @samp{-O}, this option increases both compilation time
2047 and the performance of the generated code.
2048
2049 @samp{-O2} turns on all optional optimizations except for loop unrolling
2050 and function inlining.  It also turns on the @samp{-fforce-mem} option
2051 on all machines and frame pointer elimination on machines where doing so
2052 does not interfere with debugging.
2053
2054 @item -O3
2055 Optimize yet more.  @samp{-O3} turns on all optimizations specified by
2056 @samp{-O2} and also turns on the @samp{inline-functions} option.
2057
2058 @item -O0
2059 Do not optimize.
2060
2061 If you use multiple @samp{-O} options, with or without level numbers,
2062 the last such option is the one that is effective.
2063 @end table
2064
2065 Options of the form @samp{-f@var{flag}} specify machine-independent
2066 flags.  Most flags have both positive and negative forms; the negative
2067 form of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below,
2068 only one of the forms is listed---the one which is not the default.
2069 You can figure out the other form by either removing @samp{no-} or
2070 adding it.
2071
2072 @table @code
2073 @item -ffloat-store
2074 Do not store floating point variables in registers, and inhibit other
2075 options that might change whether a floating point value is taken from a
2076 register or memory.
2077
2078 @cindex floating point precision
2079 This option prevents undesirable excess precision on machines such as
2080 the 68000 where the floating registers (of the 68881) keep more
2081 precision than a @code{double} is supposed to have.  Similarly for the
2082 x86 architecture.  For most programs, the excess precision does only
2083 good, but a few programs rely on the precise definition of IEEE floating
2084 point.  Use @samp{-ffloat-store} for such programs.
2085
2086 @item -fno-default-inline
2087 Do not make member functions inline by default merely because they are
2088 defined inside the class scope (C++ only).  Otherwise, when you specify
2089 @w{@samp{-O}}, member functions defined inside class scope are compiled
2090 inline by default; i.e., you don't need to add @samp{inline} in front of
2091 the member function name.
2092
2093 @item -fno-defer-pop
2094 Always pop the arguments to each function call as soon as that function
2095 returns.  For machines which must pop arguments after a function call,
2096 the compiler normally lets arguments accumulate on the stack for several
2097 function calls and pops them all at once.
2098
2099 @item -fforce-mem
2100 Force memory operands to be copied into registers before doing
2101 arithmetic on them.  This produces better code by making all memory
2102 references potential common subexpressions.  When they are not common
2103 subexpressions, instruction combination should eliminate the separate
2104 register-load.  The @samp{-O2} option turns on this option.
2105
2106 @item -fforce-addr
2107 Force memory address constants to be copied into registers before
2108 doing arithmetic on them.  This may produce better code just as
2109 @samp{-fforce-mem} may.
2110
2111 @item -fomit-frame-pointer
2112 Don't keep the frame pointer in a register for functions that
2113 don't need one.  This avoids the instructions to save, set up and
2114 restore frame pointers; it also makes an extra register available
2115 in many functions.  @strong{It also makes debugging impossible on
2116 some machines.}
2117
2118 @ifset INTERNALS
2119 On some machines, such as the Vax, this flag has no effect, because
2120 the standard calling sequence automatically handles the frame pointer
2121 and nothing is saved by pretending it doesn't exist.  The
2122 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
2123 whether a target machine supports this flag.  @xref{Registers}.@refill
2124 @end ifset
2125 @ifclear INTERNALS
2126 On some machines, such as the Vax, this flag has no effect, because
2127 the standard calling sequence automatically handles the frame pointer
2128 and nothing is saved by pretending it doesn't exist.  The
2129 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
2130 whether a target machine supports this flag.  @xref{Registers,,Register
2131 Usage, gcc.info, Using and Porting GCC}.@refill
2132 @end ifclear
2133
2134 @item -fno-inline
2135 Don't pay attention to the @code{inline} keyword.  Normally this option
2136 is used to keep the compiler from expanding any functions inline.
2137 Note that if you are not optimizing, no functions can be expanded inline.
2138
2139 @item -finline-functions
2140 Integrate all simple functions into their callers.  The compiler
2141 heuristically decides which functions are simple enough to be worth
2142 integrating in this way.
2143
2144 If all calls to a given function are integrated, and the function is
2145 declared @code{static}, then the function is normally not output as
2146 assembler code in its own right.
2147
2148 @item -fkeep-inline-functions
2149 Even if all calls to a given function are integrated, and the function
2150 is declared @code{static}, nevertheless output a separate run-time
2151 callable version of the function.  This switch does not affect
2152 @code{extern inline} functions.
2153
2154 @item -fkeep-static-consts
2155 Emit variables declared @code{static const} when optimization isn't turned
2156 on, even if the variables aren't referenced.
2157
2158 GNU CC enables this option by default.  If you want to force the compiler to
2159 check if the variable was referenced, regardless of whether or not
2160 optimization is turned on, use the @samp{-fno-keep-static-consts} option.
2161
2162 @item -fno-function-cse
2163 Do not put function addresses in registers; make each instruction that
2164 calls a constant function contain the function's address explicitly.
2165
2166 This option results in less efficient code, but some strange hacks
2167 that alter the assembler output may be confused by the optimizations
2168 performed when this option is not used.
2169
2170 @item -ffast-math
2171 This option allows GCC to violate some ANSI or IEEE rules and/or
2172 specifications in the interest of optimizing code for speed.  For
2173 example, it allows the compiler to assume arguments to the @code{sqrt}
2174 function are non-negative numbers and that no floating-point values
2175 are NaNs.
2176
2177 This option should never be turned on by any @samp{-O} option since
2178 it can result in incorrect output for programs which depend on
2179 an exact implementation of IEEE or ANSI rules/specifications for
2180 math functions.
2181 @end table
2182
2183 @c following causes underfulls.. they don't look great, but we deal.
2184 @c --mew 26jan93
2185 The following options control specific optimizations.  The @samp{-O2}
2186 option turns on all of these optimizations except @samp{-funroll-loops}
2187 and @samp{-funroll-all-loops}.  On most machines, the @samp{-O} option
2188 turns on the @samp{-fthread-jumps} and @samp{-fdelayed-branch} options,
2189 but specific machines may handle it differently.
2190
2191 You can use the following flags in the rare cases when ``fine-tuning''
2192 of optimizations to be performed is desired.
2193
2194 @table @code
2195 @item -fstrength-reduce
2196 Perform the optimizations of loop strength reduction and
2197 elimination of iteration variables.
2198
2199 @item -fthread-jumps
2200 Perform optimizations where we check to see if a jump branches to a
2201 location where another comparison subsumed by the first is found.  If
2202 so, the first branch is redirected to either the destination of the
2203 second branch or a point immediately following it, depending on whether
2204 the condition is known to be true or false.
2205
2206 @item -fcse-follow-jumps
2207 In common subexpression elimination, scan through jump instructions
2208 when the target of the jump is not reached by any other path.  For
2209 example, when CSE encounters an @code{if} statement with an
2210 @code{else} clause, CSE will follow the jump when the condition
2211 tested is false.
2212
2213 @item -fcse-skip-blocks
2214 This is similar to @samp{-fcse-follow-jumps}, but causes CSE to
2215 follow jumps which conditionally skip over blocks.  When CSE
2216 encounters a simple @code{if} statement with no else clause,
2217 @samp{-fcse-skip-blocks} causes CSE to follow the jump around the
2218 body of the @code{if}.
2219
2220 @item -frerun-cse-after-loop
2221 Re-run common subexpression elimination after loop optimizations has been
2222 performed.
2223
2224 @item -frerun-loop-opt
2225 Run the loop optimizer twice.
2226
2227 @item -fexpensive-optimizations
2228 Perform a number of minor optimizations that are relatively expensive.
2229
2230 @item -fdelayed-branch
2231 If supported for the target machine, attempt to reorder instructions
2232 to exploit instruction slots available after delayed branch
2233 instructions.
2234
2235 @item -fschedule-insns
2236 If supported for the target machine, attempt to reorder instructions to
2237 eliminate execution stalls due to required data being unavailable.  This
2238 helps machines that have slow floating point or memory load instructions
2239 by allowing other instructions to be issued until the result of the load
2240 or floating point instruction is required.
2241
2242 @item -fschedule-insns2
2243 Similar to @samp{-fschedule-insns}, but requests an additional pass of
2244 instruction scheduling after register allocation has been done.  This is
2245 especially useful on machines with a relatively small number of
2246 registers and where memory load instructions take more than one cycle.
2247
2248 @item -ffunction-sections
2249 Place each function into its own section in the output file if the
2250 target supports arbitrary sections.  The function's name determines
2251 the section's name in the output file.
2252
2253 Use this option on systems where the linker can perform optimizations
2254 to improve locality of reference in the instruction space.  HPPA
2255 processors running HP-UX and Sparc processors running Solaris 2 have
2256 linkers with such optimizations.  Other systems using the ELF object format
2257 as well as AIX may have these optimizations in the future.
2258
2259 Only use this option when there are significant benefits from doing
2260 so.  When you specify this option, the assembler and linker will
2261 create larger object and executable files and will also be slower.
2262 You will not be able to use @code{gprof} on all systems if you
2263 specify this option and you may have problems with debugging if
2264 you specify both this option and @samp{-g}.
2265
2266 @item -fcaller-saves
2267 Enable values to be allocated in registers that will be clobbered by
2268 function calls, by emitting extra instructions to save and restore the
2269 registers around such calls.  Such allocation is done only when it
2270 seems to result in better code than would otherwise be produced.
2271
2272 This option is enabled by default on certain machines, usually those
2273 which have no call-preserved registers to use instead.
2274
2275 @item -funroll-loops
2276 Perform the optimization of loop unrolling.  This is only done for loops
2277 whose number of iterations can be determined at compile time or run time.
2278 @samp{-funroll-loop} implies both @samp{-fstrength-reduce} and
2279 @samp{-frerun-cse-after-loop}.
2280
2281 @item -funroll-all-loops
2282 Perform the optimization of loop unrolling.  This is done for all loops
2283 and usually makes programs run more slowly.  @samp{-funroll-all-loops}
2284 implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}.
2285
2286 @item -fmove-all-movables
2287 Forces all invariant computations in loops to be moved
2288 outside the loop.
2289
2290 @item -freduce-all-givs
2291 Forces all general-induction variables in loops to be
2292 strength-reduced.
2293
2294 @emph{Note:} When compiling programs written in Fortran,
2295 @samp{-fmove-all-moveables} and @samp{-freduce-all-givs} are enabled
2296 by default when you use the optimizer.
2297
2298 These options may generate better or worse code; results are highly
2299 dependent on the structure of loops within the source code.
2300
2301 These two options are intended to be removed someday, once
2302 they have helped determine the efficacy of various
2303 approaches to improving loop optimizations.
2304
2305 Please let us (@code{egcs@@cygnus.com} and @code{fortran@@gnu.ai.mit.edu})
2306 know how use of these options affects
2307 the performance of your production code.
2308 We're very interested in code that runs @emph{slower}
2309 when these options are @emph{enabled}.
2310
2311 @item -fno-peephole
2312 Disable any machine-specific peephole optimizations.
2313
2314 @item -fbranch-probabilities
2315 After running a program compiled with @samp{-fprofile-arcs}
2316 (@pxref{Debugging Options,, Options for Debugging Your Program or
2317 @code{gcc}}), you can compile it a second time using
2318 @samp{-fbranch-probabilities}, to improve optimizations based on
2319 guessing the path a branch might take.
2320
2321 @ifset INTERNALS
2322 With @samp{-fbranch-probabilities}, GNU CC puts a @samp{REG_EXEC_COUNT}
2323 note on the first instruction of each basic block, and a
2324 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
2325 These can be used to improve optimization.  Currently, they are only
2326 used in one place: in @file{reorg.c}, instead of guessing which path a
2327 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
2328 exactly determine which path is taken more often.
2329 @end ifset
2330
2331 @item -fregmove
2332 Some machines only support 2 operands per instruction.  On such
2333 machines, GNU CC might have to do extra copies.  The @samp{-fregmove}
2334 option overrides the default for the machine to do the copy before
2335 register allocation.
2336 @end table
2337
2338 @node Preprocessor Options
2339 @section Options Controlling the Preprocessor
2340 @cindex preprocessor options
2341 @cindex options, preprocessor
2342
2343 These options control the C preprocessor, which is run on each C source
2344 file before actual compilation.
2345
2346 If you use the @samp{-E} option, nothing is done except preprocessing.
2347 Some of these options make sense only together with @samp{-E} because
2348 they cause the preprocessor output to be unsuitable for actual
2349 compilation.
2350
2351 @table @code
2352 @item -include @var{file}
2353 Process @var{file} as input before processing the regular input file.
2354 In effect, the contents of @var{file} are compiled first.  Any @samp{-D}
2355 and @samp{-U} options on the command line are always processed before
2356 @samp{-include @var{file}}, regardless of the order in which they are
2357 written.  All the @samp{-include} and @samp{-imacros} options are
2358 processed in the order in which they are written.
2359
2360 @item -imacros @var{file}
2361 Process @var{file} as input, discarding the resulting output, before
2362 processing the regular input file.  Because the output generated from
2363 @var{file} is discarded, the only effect of @samp{-imacros @var{file}}
2364 is to make the macros defined in @var{file} available for use in the
2365 main input.
2366
2367 Any @samp{-D} and @samp{-U} options on the command line are always
2368 processed before @samp{-imacros @var{file}}, regardless of the order in
2369 which they are written.  All the @samp{-include} and @samp{-imacros}
2370 options are processed in the order in which they are written.
2371
2372 @item -idirafter @var{dir}
2373 @cindex second include path
2374 Add the directory @var{dir} to the second include path.  The directories
2375 on the second include path are searched when a header file is not found
2376 in any of the directories in the main include path (the one that
2377 @samp{-I} adds to).
2378
2379 @item -iprefix @var{prefix}
2380 Specify @var{prefix} as the prefix for subsequent @samp{-iwithprefix}
2381 options.
2382
2383 @item -iwithprefix @var{dir}
2384 Add a directory to the second include path.  The directory's name is
2385 made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
2386 specified previously with @samp{-iprefix}.  If you have not specified a
2387 prefix yet, the directory containing the installed passes of the
2388 compiler is used as the default.
2389
2390 @item -iwithprefixbefore @var{dir}
2391 Add a directory to the main include path.  The directory's name is made
2392 by concatenating @var{prefix} and @var{dir}, as in the case of
2393 @samp{-iwithprefix}.
2394
2395 @item -isystem @var{dir}
2396 Add a directory to the beginning of the second include path, marking it
2397 as a system directory, so that it gets the same special treatment as
2398 is applied to the standard system directories.
2399
2400 @item -nostdinc
2401 Do not search the standard system directories for header files.  Only
2402 the directories you have specified with @samp{-I} options (and the
2403 current directory, if appropriate) are searched.  @xref{Directory
2404 Options}, for information on @samp{-I}.
2405
2406 By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
2407 search path to only those directories you specify explicitly.
2408
2409 @item -undef
2410 Do not predefine any nonstandard macros.  (Including architecture flags).
2411
2412 @item -E
2413 Run only the C preprocessor.  Preprocess all the C source files
2414 specified and output the results to standard output or to the
2415 specified output file.
2416
2417 @item -C
2418 Tell the preprocessor not to discard comments.  Used with the
2419 @samp{-E} option.
2420
2421 @item -P
2422 Tell the preprocessor not to generate @samp{#line} directives.
2423 Used with the @samp{-E} option.
2424
2425 @cindex make
2426 @cindex dependencies, make
2427 @item -M
2428 Tell the preprocessor to output a rule suitable for @code{make}
2429 describing the dependencies of each object file.  For each source file,
2430 the preprocessor outputs one @code{make}-rule whose target is the object
2431 file name for that source file and whose dependencies are all the
2432 @code{#include} header files it uses.  This rule may be a single line or
2433 may be continued with @samp{\}-newline if it is long.  The list of rules
2434 is printed on standard output instead of the preprocessed C program.
2435
2436 @samp{-M} implies @samp{-E}.
2437
2438 Another way to specify output of a @code{make} rule is by setting
2439 the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
2440 Variables}).
2441
2442 @item -MM
2443 Like @samp{-M} but the output mentions only the user header files
2444 included with @samp{#include "@var{file}"}.  System header files
2445 included with @samp{#include <@var{file}>} are omitted.
2446
2447 @item -MD
2448 Like @samp{-M} but the dependency information is written to a file made by
2449 replacing ".c" with ".d" at the end of the input file names.
2450 This is in addition to compiling the file as specified---@samp{-MD} does
2451 not inhibit ordinary compilation the way @samp{-M} does.
2452
2453 In Mach, you can use the utility @code{md} to merge multiple dependency
2454 files into a single dependency file suitable for using with the @samp{make}
2455 command.
2456
2457 @item -MMD
2458 Like @samp{-MD} except mention only user header files, not system
2459 header files.
2460
2461 @item -MG
2462 Treat missing header files as generated files and assume they live in the
2463 same directory as the source file.  If you specify @samp{-MG}, you
2464 must also specify either @samp{-M} or @samp{-MM}.  @samp{-MG} is not
2465 supported with @samp{-MD} or @samp{-MMD}.
2466
2467 @item -H
2468 Print the name of each header file used, in addition to other normal
2469 activities.
2470
2471 @item -A@var{question}(@var{answer})
2472 Assert the answer @var{answer} for @var{question}, in case it is tested
2473 with a preprocessing conditional such as @samp{#if
2474 #@var{question}(@var{answer})}.  @samp{-A-} disables the standard
2475 assertions that normally describe the target machine.
2476
2477 @item -D@var{macro}
2478 Define macro @var{macro} with the string @samp{1} as its definition.
2479
2480 @item -D@var{macro}=@var{defn}
2481 Define macro @var{macro} as @var{defn}.  All instances of @samp{-D} on
2482 the command line are processed before any @samp{-U} options.
2483
2484 @item -U@var{macro}
2485 Undefine macro @var{macro}.  @samp{-U} options are evaluated after all
2486 @samp{-D} options, but before any @samp{-include} and @samp{-imacros}
2487 options.
2488
2489 @item -dM
2490 Tell the preprocessor to output only a list of the macro definitions
2491 that are in effect at the end of preprocessing.  Used with the @samp{-E}
2492 option.
2493
2494 @item -dD
2495 Tell the preprocessing to pass all macro definitions into the output, in
2496 their proper sequence in the rest of the output.
2497
2498 @item -dN
2499 Like @samp{-dD} except that the macro arguments and contents are omitted.
2500 Only @samp{#define @var{name}} is included in the output.
2501
2502 @item -trigraphs
2503 Support ANSI C trigraphs.  The @samp{-ansi} option also has this effect.
2504
2505 @item -Wp,@var{option}
2506 Pass @var{option} as an option to the preprocessor.  If @var{option}
2507 contains commas, it is split into multiple options at the commas.
2508 @end table
2509
2510 @node Assembler Options
2511 @section Passing Options to the Assembler
2512
2513 @c prevent bad page break with this line
2514 You can pass options to the assembler.
2515
2516 @table @code
2517 @item -Wa,@var{option}
2518 Pass @var{option} as an option to the assembler.  If @var{option}
2519 contains commas, it is split into multiple options at the commas.
2520 @end table
2521
2522 @node Link Options
2523 @section Options for Linking
2524 @cindex link options
2525 @cindex options, linking
2526
2527 These options come into play when the compiler links object files into
2528 an executable output file.  They are meaningless if the compiler is
2529 not doing a link step.
2530
2531 @table @code
2532 @cindex file names
2533 @item @var{object-file-name}
2534 A file name that does not end in a special recognized suffix is
2535 considered to name an object file or library.  (Object files are
2536 distinguished from libraries by the linker according to the file
2537 contents.)  If linking is done, these object files are used as input
2538 to the linker.
2539
2540 @item -c
2541 @itemx -S
2542 @itemx -E
2543 If any of these options is used, then the linker is not run, and
2544 object file names should not be used as arguments.  @xref{Overall
2545 Options}.
2546
2547 @cindex Libraries
2548 @item -l@var{library}
2549 Search the library named @var{library} when linking.
2550
2551 It makes a difference where in the command you write this option; the
2552 linker searches processes libraries and object files in the order they
2553 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
2554 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
2555 to functions in @samp{z}, those functions may not be loaded.
2556
2557 The linker searches a standard list of directories for the library,
2558 which is actually a file named @file{lib@var{library}.a}.  The linker
2559 then uses this file as if it had been specified precisely by name.
2560
2561 The directories searched include several standard system directories
2562 plus any that you specify with @samp{-L}.
2563
2564 Normally the files found this way are library files---archive files
2565 whose members are object files.  The linker handles an archive file by
2566 scanning through it for members which define symbols that have so far
2567 been referenced but not defined.  But if the file that is found is an
2568 ordinary object file, it is linked in the usual fashion.  The only
2569 difference between using an @samp{-l} option and specifying a file name
2570 is that @samp{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
2571 and searches several directories.
2572
2573 @item -lobjc
2574 You need this special case of the @samp{-l} option in order to
2575 link an Objective C program.
2576
2577 @item -nostartfiles
2578 Do not use the standard system startup files when linking.
2579 The standard system libraries are used normally, unless @code{-nostdlib}
2580 or @code{-nodefaultlibs} is used.
2581
2582 @item -nodefaultlibs
2583 Do not use the standard system libraries when linking.
2584 Only the libraries you specify will be passed to the linker.
2585 The standard startup files are used normally, unless @code{-nostartfiles}
2586 is used.
2587
2588 @item -nostdlib
2589 Do not use the standard system startup files or libraries when linking.
2590 No startup files and only the libraries you specify will be passed to
2591 the linker.
2592
2593 @cindex @code{-lgcc}, use with @code{-nostdlib}
2594 @cindex @code{-nostdlib} and unresolved references
2595 @cindex unresolved references and @code{-nostdlib}
2596 @cindex @code{-lgcc}, use with @code{-nodefaultlibs}
2597 @cindex @code{-nodefaultlibs} and unresolved references
2598 @cindex unresolved references and @code{-nodefaultlibs}
2599 One of the standard libraries bypassed by @samp{-nostdlib} and
2600 @samp{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
2601 that GNU CC uses to overcome shortcomings of particular machines, or special
2602 needs for some languages.
2603 @ifset INTERNALS
2604 (@xref{Interface,,Interfacing to GNU CC Output}, for more discussion of
2605 @file{libgcc.a}.)
2606 @end ifset
2607 @ifclear INTERNALS
2608 (@xref{Interface,,Interfacing to GNU CC Output,gcc.info,Porting GNU CC},
2609 for more discussion of @file{libgcc.a}.)
2610 @end ifclear
2611 In most cases, you need @file{libgcc.a} even when you want to avoid
2612 other standard libraries.  In other words, when you specify @samp{-nostdlib}
2613 or @samp{-nodefaultlibs} you should usually specify @samp{-lgcc} as well.
2614 This ensures that you have no unresolved references to internal GNU CC
2615 library subroutines.  (For example, @samp{__main}, used to ensure C++
2616 constructors will be called; @pxref{Collect2,,@code{collect2}}.)
2617
2618 @item -s
2619 Remove all symbol table and relocation information from the executable.
2620
2621 @item -static
2622 On systems that support dynamic linking, this prevents linking with the shared
2623 libraries.  On other systems, this option has no effect.
2624
2625 @item -shared
2626 Produce a shared object which can then be linked with other objects to
2627 form an executable.  Not all systems support this option.  You must
2628 also specify @samp{-fpic} or @samp{-fPIC} on some systems when
2629 you specify this option.
2630
2631 @item -symbolic
2632 Bind references to global symbols when building a shared object.  Warn
2633 about any unresolved references (unless overridden by the link editor
2634 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
2635 this option.
2636
2637 @item -Xlinker @var{option}
2638 Pass @var{option} as an option to the linker.  You can use this to
2639 supply system-specific linker options which GNU CC does not know how to
2640 recognize.
2641
2642 If you want to pass an option that takes an argument, you must use
2643 @samp{-Xlinker} twice, once for the option and once for the argument.
2644 For example, to pass @samp{-assert definitions}, you must write
2645 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
2646 @samp{-Xlinker "-assert definitions"}, because this passes the entire
2647 string as a single argument, which is not what the linker expects.
2648
2649 @item -Wl,@var{option}
2650 Pass @var{option} as an option to the linker.  If @var{option} contains
2651 commas, it is split into multiple options at the commas.
2652
2653 @item -u @var{symbol}
2654 Pretend the symbol @var{symbol} is undefined, to force linking of
2655 library modules to define it.  You can use @samp{-u} multiple times with
2656 different symbols to force loading of additional library modules.
2657 @end table
2658
2659 @node Directory Options
2660 @section Options for Directory Search
2661 @cindex directory options
2662 @cindex options, directory search
2663 @cindex search path
2664
2665 These options specify directories to search for header files, for
2666 libraries and for parts of the compiler:
2667
2668 @table @code
2669 @item -I@var{dir}
2670 Add the directory @var{dir} to the head of the list of directories to be
2671 searched for header files.  This can be used to override a system header
2672 file, substituting your own version, since these directories are
2673 searched before the system header file directories.  If you use more
2674 than one @samp{-I} option, the directories are scanned in left-to-right
2675 order; the standard system directories come after.
2676
2677 @item -I-
2678 Any directories you specify with @samp{-I} options before the @samp{-I-}
2679 option are searched only for the case of @samp{#include "@var{file}"};
2680 they are not searched for @samp{#include <@var{file}>}.
2681
2682 If additional directories are specified with @samp{-I} options after
2683 the @samp{-I-}, these directories are searched for all @samp{#include}
2684 directives.  (Ordinarily @emph{all} @samp{-I} directories are used
2685 this way.)
2686
2687 In addition, the @samp{-I-} option inhibits the use of the current
2688 directory (where the current input file came from) as the first search
2689 directory for @samp{#include "@var{file}"}.  There is no way to
2690 override this effect of @samp{-I-}.  With @samp{-I.} you can specify
2691 searching the directory which was current when the compiler was
2692 invoked.  That is not exactly the same as what the preprocessor does
2693 by default, but it is often satisfactory.
2694
2695 @samp{-I-} does not inhibit the use of the standard system directories
2696 for header files.  Thus, @samp{-I-} and @samp{-nostdinc} are
2697 independent.
2698
2699 @item -L@var{dir}
2700 Add directory @var{dir} to the list of directories to be searched
2701 for @samp{-l}.
2702
2703 @item -B@var{prefix}
2704 This option specifies where to find the executables, libraries,
2705 include files, and data files of the compiler itself.
2706
2707 The compiler driver program runs one or more of the subprograms
2708 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
2709 @var{prefix} as a prefix for each program it tries to run, both with and
2710 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
2711
2712 For each subprogram to be run, the compiler driver first tries the
2713 @samp{-B} prefix, if any.  If that name is not found, or if @samp{-B}
2714 was not specified, the driver tries two standard prefixes, which are
2715 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
2716 those results in a file name that is found, the unmodified program
2717 name is searched for using the directories specified in your
2718 @samp{PATH} environment variable.
2719
2720 @samp{-B} prefixes that effectively specify directory names also apply
2721 to libraries in the linker, because the compiler translates these
2722 options into @samp{-L} options for the linker.  They also apply to
2723 includes files in the preprocessor, because the compiler translates these
2724 options into @samp{-isystem} options for the preprocessor.  In this case,
2725 the compiler appends @samp{include} to the prefix.
2726
2727 The run-time support file @file{libgcc.a} can also be searched for using
2728 the @samp{-B} prefix, if needed.  If it is not found there, the two
2729 standard prefixes above are tried, and that is all.  The file is left
2730 out of the link if it is not found by those means.
2731
2732 Another way to specify a prefix much like the @samp{-B} prefix is to use
2733 the environment variable @code{GCC_EXEC_PREFIX}.  @xref{Environment
2734 Variables}.
2735
2736 @item -specs=@var{file}
2737 Process @var{file} after the compiler reads in the standard @file{specs}
2738 file, in order to override the defaults that the @file{gcc} driver
2739 program uses when determining what switches to pass to @file{cc1},
2740 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
2741 @samp{-specs=}@var{file} can be specified on the command line, and they
2742 are processed in order, from left to right.
2743 @end table
2744
2745 @node Target Options
2746 @section Specifying Target Machine and Compiler Version
2747 @cindex target options
2748 @cindex cross compiling
2749 @cindex specifying machine version
2750 @cindex specifying compiler version and target machine
2751 @cindex compiler version, specifying
2752 @cindex target machine, specifying
2753
2754 By default, GNU CC compiles code for the same type of machine that you
2755 are using.  However, it can also be installed as a cross-compiler, to
2756 compile for some other type of machine.  In fact, several different
2757 configurations of GNU CC, for different target machines, can be
2758 installed side by side.  Then you specify which one to use with the
2759 @samp{-b} option.
2760
2761 In addition, older and newer versions of GNU CC can be installed side
2762 by side.  One of them (probably the newest) will be the default, but
2763 you may sometimes wish to use another.
2764
2765 @table @code
2766 @item -b @var{machine}
2767 The argument @var{machine} specifies the target machine for compilation.
2768 This is useful when you have installed GNU CC as a cross-compiler.
2769
2770 The value to use for @var{machine} is the same as was specified as the
2771 machine type when configuring GNU CC as a cross-compiler.  For
2772 example, if a cross-compiler was configured with @samp{configure
2773 i386v}, meaning to compile for an 80386 running System V, then you
2774 would specify @samp{-b i386v} to run that cross compiler.
2775
2776 When you do not specify @samp{-b}, it normally means to compile for
2777 the same type of machine that you are using.
2778
2779 @item -V @var{version}
2780 The argument @var{version} specifies which version of GNU CC to run.
2781 This is useful when multiple versions are installed.  For example,
2782 @var{version} might be @samp{2.0}, meaning to run GNU CC version 2.0.
2783
2784 The default version, when you do not specify @samp{-V}, is the last
2785 version of GNU CC that you installed.
2786 @end table
2787
2788 The @samp{-b} and @samp{-V} options actually work by controlling part of
2789 the file name used for the executable files and libraries used for
2790 compilation.  A given version of GNU CC, for a given target machine, is
2791 normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
2792
2793 Thus, sites can customize the effect of @samp{-b} or @samp{-V} either by
2794 changing the names of these directories or adding alternate names (or
2795 symbolic links).  If in directory @file{/usr/local/lib/gcc-lib/} the
2796 file @file{80386} is a link to the file @file{i386v}, then @samp{-b
2797 80386} becomes an alias for @samp{-b i386v}.
2798
2799 In one respect, the @samp{-b} or @samp{-V} do not completely change
2800 to a different compiler: the top-level driver program @code{gcc}
2801 that you originally invoked continues to run and invoke the other
2802 executables (preprocessor, compiler per se, assembler and linker)
2803 that do the real work.  However, since no real work is done in the
2804 driver program, it usually does not matter that the driver program
2805 in use is not the one for the specified target and version.
2806
2807 The only way that the driver program depends on the target machine is
2808 in the parsing and handling of special machine-specific options.
2809 However, this is controlled by a file which is found, along with the
2810 other executables, in the directory for the specified version and
2811 target machine.  As a result, a single installed driver program adapts
2812 to any specified target machine and compiler version.
2813
2814 The driver program executable does control one significant thing,
2815 however: the default version and target machine.  Therefore, you can
2816 install different instances of the driver program, compiled for
2817 different targets or versions, under different names.
2818
2819 For example, if the driver for version 2.0 is installed as @code{ogcc}
2820 and that for version 2.1 is installed as @code{gcc}, then the command
2821 @code{gcc} will use version 2.1 by default, while @code{ogcc} will use
2822 2.0 by default.  However, you can choose either version with either
2823 command with the @samp{-V} option.
2824
2825 @node Submodel Options
2826 @section Hardware Models and Configurations
2827 @cindex submodel options
2828 @cindex specifying hardware config
2829 @cindex hardware models and configurations, specifying
2830 @cindex machine dependent options
2831
2832 Earlier we discussed the standard option @samp{-b} which chooses among
2833 different installed compilers for completely different target
2834 machines, such as Vax vs. 68000 vs. 80386.
2835
2836 In addition, each of these target machine types can have its own
2837 special options, starting with @samp{-m}, to choose among various
2838 hardware models or configurations---for example, 68010 vs 68020,
2839 floating coprocessor or none.  A single installed version of the
2840 compiler can compile for any model or configuration, according to the
2841 options specified.
2842
2843 Some configurations of the compiler also support additional special
2844 options, usually for compatibility with other compilers on the same
2845 platform.
2846
2847 @ifset INTERNALS
2848 These options are defined by the macro @code{TARGET_SWITCHES} in the
2849 machine description.  The default for the options is also defined by
2850 that macro, which enables you to change the defaults.
2851 @end ifset
2852
2853 @menu
2854 * M680x0 Options::
2855 * VAX Options::
2856 * SPARC Options::
2857 * Convex Options::
2858 * AMD29K Options::
2859 * ARM Options::
2860 * MN10300 Options::
2861 * M32R/D Options::
2862 * M88K Options::
2863 * RS/6000 and PowerPC Options::
2864 * RT Options::
2865 * MIPS Options::
2866 * i386 Options::
2867 * HPPA Options::
2868 * Intel 960 Options::
2869 * DEC Alpha Options::
2870 * Clipper Options::
2871 * H8/300 Options::
2872 * SH Options::
2873 * System V Options::
2874 * V850 Options::
2875 @end menu
2876
2877 @node M680x0 Options
2878 @subsection M680x0 Options
2879 @cindex M680x0 options
2880
2881 These are the @samp{-m} options defined for the 68000 series.  The default
2882 values for these options depends on which style of 68000 was selected when
2883 the compiler was configured; the defaults for the most common choices are
2884 given below.
2885
2886 @table @code
2887 @item -m68000
2888 @itemx -mc68000
2889 Generate output for a 68000.  This is the default
2890 when the compiler is configured for 68000-based systems.
2891
2892 @item -m68020
2893 @itemx -mc68020
2894 Generate output for a 68020.  This is the default
2895 when the compiler is configured for 68020-based systems.
2896
2897 @item -m68881
2898 Generate output containing 68881 instructions for floating point.
2899 This is the default for most 68020 systems unless @samp{-nfp} was
2900 specified when the compiler was configured.
2901
2902 @item -m68030
2903 Generate output for a 68030.  This is the default when the compiler is
2904 configured for 68030-based systems.
2905
2906 @item -m68040
2907 Generate output for a 68040.  This is the default when the compiler is
2908 configured for 68040-based systems.
2909
2910 This option inhibits the use of 68881/68882 instructions that have to be
2911 emulated by software on the 68040.  If your 68040 does not have code to
2912 emulate those instructions, use @samp{-m68040}.
2913
2914 @item -m68060
2915 Generate output for a 68060.  This is the default when the compiler is
2916 configured for 68060-based systems.
2917
2918 This option inhibits the use of 68020 and 68881/68882 instructions that
2919 have to be emulated by software on the 68060.  If your 68060 does not
2920 have code to emulate those instructions, use @samp{-m68060}.
2921
2922 @item -m5200
2923 Generate output for a 520X "coldfire" family cpu.  This is the default
2924 when the compiler is configured for 520X-based systems.
2925
2926
2927 @item -m68020-40
2928 Generate output for a 68040, without using any of the new instructions.
2929 This results in code which can run relatively efficiently on either a
2930 68020/68881 or a 68030 or a 68040.  The generated code does use the
2931 68881 instructions that are emulated on the 68040.
2932
2933 @item -m68020-60
2934 Generate output for a 68060, without using any of the new instructions.
2935 This results in code which can run relatively efficiently on either a
2936 68020/68881 or a 68030 or a 68040.  The generated code does use the
2937 68881 instructions that are emulated on the 68060.
2938
2939 @item -mfpa
2940 Generate output containing Sun FPA instructions for floating point.
2941
2942 @item -msoft-float
2943 Generate output containing library calls for floating point.
2944 @strong{Warning:} the requisite libraries are not available for all m68k
2945 targets.  Normally the facilities of the machine's usual C compiler are
2946 used, but this can't be done directly in cross-compilation.  You must
2947 make your own arrangements to provide suitable library functions for
2948 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
2949 @samp{m68k-*-coff} do provide software floating point support.
2950
2951 @item -mshort
2952 Consider type @code{int} to be 16 bits wide, like @code{short int}.
2953
2954 @item -mnobitfield
2955 Do not use the bit-field instructions.  The @samp{-m68000} option
2956 implies @w{@samp{-mnobitfield}}.
2957
2958 @item -mbitfield
2959 Do use the bit-field instructions.  The @samp{-m68020} option implies
2960 @samp{-mbitfield}.  This is the default if you use a configuration
2961 designed for a 68020.
2962
2963 @item -mrtd
2964 Use a different function-calling convention, in which functions
2965 that take a fixed number of arguments return with the @code{rtd}
2966 instruction, which pops their arguments while returning.  This
2967 saves one instruction in the caller since there is no need to pop
2968 the arguments there.
2969
2970 This calling convention is incompatible with the one normally
2971 used on Unix, so you cannot use it if you need to call libraries
2972 compiled with the Unix compiler.
2973
2974 Also, you must provide function prototypes for all functions that
2975 take variable numbers of arguments (including @code{printf});
2976 otherwise incorrect code will be generated for calls to those
2977 functions.
2978
2979 In addition, seriously incorrect code will result if you call a
2980 function with too many arguments.  (Normally, extra arguments are
2981 harmlessly ignored.)
2982
2983 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
2984 68040, and 68060 processors, but not by the 68000 or 5200.
2985
2986 @item -malign-int
2987 @itemx -mno-align-int
2988 Control whether GNU CC aligns @code{int}, @code{long}, @code{long long}, 
2989 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
2990 boundary (@samp{-malign-int}) or a 16-bit boundary (@samp{-mno-align-int}).
2991 Aligning variables on 32-bit boundaries produces code that runs somewhat
2992 faster on processors with 32-bit busses at the expense of more memory.
2993
2994 @strong{Warning:} if you use the @samp{-malign-int} switch, GNU CC will
2995 align structures containing the above types  differently than
2996 most published application binary interface specifications for the m68k.
2997
2998 @end table
2999
3000 @node VAX Options
3001 @subsection VAX Options
3002 @cindex VAX options
3003
3004 These @samp{-m} options are defined for the Vax:
3005
3006 @table @code
3007 @item -munix
3008 Do not output certain jump instructions (@code{aobleq} and so on)
3009 that the Unix assembler for the Vax cannot handle across long
3010 ranges.
3011
3012 @item -mgnu
3013 Do output those jump instructions, on the assumption that you
3014 will assemble with the GNU assembler.
3015
3016 @item -mg
3017 Output code for g-format floating point numbers instead of d-format.
3018 @end table
3019
3020 @node SPARC Options
3021 @subsection SPARC Options
3022 @cindex SPARC options
3023
3024 These @samp{-m} switches are supported on the SPARC:
3025
3026 @table @code
3027 @item -mno-app-regs
3028 @itemx -mapp-regs
3029 Specify @samp{-mapp-regs} to generate output using the global registers
3030 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
3031 is the default.
3032
3033 To be fully SVR4 ABI compliant at the cost of some performance loss,
3034 specify @samp{-mno-app-regs}.  You should compile libraries and system
3035 software with this option.
3036
3037 @item -mfpu
3038 @itemx -mhard-float
3039 Generate output containing floating point instructions.  This is the
3040 default.
3041
3042 @item -mno-fpu
3043 @itemx -msoft-float
3044 Generate output containing library calls for floating point.
3045 @strong{Warning:} the requisite libraries are not available for all SPARC
3046 targets.  Normally the facilities of the machine's usual C compiler are
3047 used, but this cannot be done directly in cross-compilation.  You must make
3048 your own arrangements to provide suitable library functions for
3049 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
3050 @samp{sparclite-*-*} do provide software floating point support.
3051
3052 @samp{-msoft-float} changes the calling convention in the output file;
3053 therefore, it is only useful if you compile @emph{all} of a program with
3054 this option.  In particular, you need to compile @file{libgcc.a}, the
3055 library that comes with GNU CC, with @samp{-msoft-float} in order for
3056 this to work.
3057
3058 @item -mhard-quad-float
3059 Generate output containing quad-word (long double) floating point
3060 instructions.
3061
3062 @item -msoft-quad-float
3063 Generate output containing library calls for quad-word (long double)
3064 floating point instructions.  The functions called are those specified
3065 in the SPARC ABI.  This is the default.
3066
3067 As of this writing, there are no sparc implementations that have hardware
3068 support for the quad-word floating point instructions.  They all invoke
3069 a trap handler for one of these instructions, and then the trap handler
3070 emulates the effect of the instruction.  Because of the trap handler overhead,
3071 this is much slower than calling the ABI library routines.  Thus the
3072 @samp{-msoft-quad-float} option is the default.
3073
3074 @item -mno-epilogue
3075 @itemx -mepilogue
3076 With @samp{-mepilogue} (the default), the compiler always emits code for
3077 function exit at the end of each function.  Any function exit in
3078 the middle of the function (such as a return statement in C) will
3079 generate a jump to the exit code at the end of the function.
3080
3081 With @samp{-mno-epilogue}, the compiler tries to emit exit code inline
3082 at every function exit.
3083
3084 @item -mno-flat
3085 @itemx -mflat
3086 With @samp{-mflat}, the compiler does not generate save/restore instructions
3087 and will use a "flat" or single register window calling convention.
3088 This model uses %i7 as the frame pointer and is compatible with the normal
3089 register window model.  Code from either may be intermixed.
3090 The local registers and the input registers (0-5) are still treated as
3091 "call saved" registers and will be saved on the stack as necessary.
3092
3093 With @samp{-mno-flat} (the default), the compiler emits save/restore
3094 instructions (except for leaf functions) and is the normal mode of operation.
3095
3096 @item -mno-unaligned-doubles
3097 @itemx -munaligned-doubles
3098 Assume that doubles have 8 byte alignment.  This is the default.
3099
3100 With @samp{-munaligned-doubles}, GNU CC assumes that doubles have 8 byte
3101 alignment only if they are contained in another type, or if they have an
3102 absolute address.  Otherwise, it assumes they have 4 byte alignment.
3103 Specifying this option avoids some rare compatibility problems with code
3104 generated by other compilers.  It is not the default because it results
3105 in a performance loss, especially for floating point code.
3106
3107 @item -mv8
3108 @itemx -msparclite
3109 These two options select variations on the SPARC architecture.
3110
3111 By default (unless specifically configured for the Fujitsu SPARClite),
3112 GCC generates code for the v7 variant of the SPARC architecture.
3113
3114 @samp{-mv8} will give you SPARC v8 code.  The only difference from v7
3115 code is that the compiler emits the integer multiply and integer
3116 divide instructions which exist in SPARC v8 but not in SPARC v7.
3117
3118 @samp{-msparclite} will give you SPARClite code.  This adds the integer
3119 multiply, integer divide step and scan (@code{ffs}) instructions which
3120 exist in SPARClite but not in SPARC v7.
3121
3122 These options are deprecated and will be deleted in GNU CC 2.9.
3123 They have been replaced with @samp{-mcpu=xxx}.
3124
3125 @item -mcypress
3126 @itemx -msupersparc
3127 These two options select the processor for which the code is optimised.
3128
3129 With @samp{-mcypress} (the default), the compiler optimizes code for the
3130 Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
3131 This is also appropriate for the older SparcStation 1, 2, IPX etc.
3132
3133 With @samp{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
3134 used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
3135 of the full SPARC v8 instruction set.
3136
3137 These options are deprecated and will be deleted in GNU CC 2.9.
3138 They have been replaced with @samp{-mcpu=xxx}.
3139
3140 @item -mcpu=@var{cpu_type}
3141 Set the instruction set, register set, and instruction scheduling parameters
3142 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
3143 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
3144 @samp{f930}, @samp{f934}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, and
3145 @samp{ultrasparc}.
3146
3147 Default instruction scheduling parameters are used for values that select
3148 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
3149 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
3150
3151 Here is a list of each supported architecture and their supported
3152 implementations.
3153
3154 @smallexample
3155     v7:             cypress
3156     v8:             supersparc
3157     sparclite:      f930, f934
3158     sparclet:       tsc701
3159     v9:             ultrasparc
3160 @end smallexample
3161
3162 @item -mtune=@var{cpu_type}
3163 Set the instruction scheduling parameters for machine type
3164 @var{cpu_type}, but do not set the instruction set or register set that the
3165 option @samp{-mcpu=}@var{cpu_type} would.
3166
3167 The same values for @samp{-mcpu=}@var{cpu_type} are used for
3168 @samp{-mtune=}@var{cpu_type}, though the only useful values are those that
3169 select a particular cpu implementation: @samp{cypress}, @samp{supersparc},
3170 @samp{f930}, @samp{f934}, @samp{tsc701}, @samp{ultrasparc}.
3171
3172 @item -malign-loops=@var{num}
3173 Align loops to a 2 raised to a @var{num} byte boundary.  If
3174 @samp{-malign-loops} is not specified, the default is 2.
3175
3176 @item -malign-jumps=@var{num}
3177 Align instructions that are only jumped to to a 2 raised to a @var{num}
3178 byte boundary.  If @samp{-malign-jumps} is not specified, the default is 2.
3179
3180 @item -malign-functions=@var{num}
3181 Align the start of functions to a 2 raised to @var{num} byte boundary.
3182 If @samp{-malign-functions} is not specified, the default is 2 if compiling
3183 for 32 bit sparc, and 5 if compiling for 64 bit sparc.
3184
3185 @end table
3186
3187 These @samp{-m} switches are supported in addition to the above
3188 on the SPARCLET processor.
3189
3190 @table @code
3191 @item -mlittle-endian
3192 Generate code for a processor running in little-endian mode.
3193
3194 @item -mlive-g0
3195 Treat register @code{%g0} as a normal register.
3196 GCC will continue to clobber it as necessary but will not assume
3197 it always reads as 0.
3198
3199 @item -mbroken-saverestore
3200 Generate code that does not use non-trivial forms of the @code{save} and
3201 @code{restore} instructions.  Early versions of the SPARCLET processor do
3202 not correctly handle @code{save} and @code{restore} instructions used with
3203 arguments.  They correctly handle them used without arguments.  A @code{save}
3204 instruction used without arguments increments the current window pointer
3205 but does not allocate a new stack frame.  It is assumed that the window
3206 overflow trap handler will properly handle this case as will interrupt
3207 handlers.
3208 @end table
3209
3210 These @samp{-m} switches are supported in addition to the above
3211 on SPARC V9 processors in 64 bit environments.
3212
3213 @table @code
3214 @item -mlittle-endian
3215 Generate code for a processor running in little-endian mode.
3216
3217 @item -m32
3218 @itemx -m64
3219 Generate code for a 32 bit or 64 bit environment.
3220 The 32 bit environment sets int, long and pointer to 32 bits.
3221 The 64 bit environment sets int to 32 bits and long and pointer
3222 to 64 bits.
3223
3224 @item -mcmodel=medlow
3225 Generate code for the Medium/Low code model: the program must be linked
3226 in the low 32 bits of the address space.  Pointers are 64 bits.
3227 Programs can be statically or dynamically linked.
3228
3229 @item -mcmodel=medmid
3230 Generate code for the Medium/Middle code model: the program must be linked
3231 in the low 44 bits of the address space, the text segment must be less than
3232 2G bytes, and data segment must be within 2G of the text segment.
3233 Pointers are 64 bits.
3234
3235 @item -mcmodel=medany
3236 Generate code for the Medium/Anywhere code model: the program may be linked
3237 anywhere in the address space, the text segment must be less than
3238 2G bytes, and data segment must be within 2G of the text segment.
3239 Pointers are 64 bits.
3240
3241 @item -mcmodel=embmedany
3242 Generate code for the Medium/Anywhere code model for embedded systems:
3243 assume a 32 bit text and a 32 bit data segment, both starting anywhere
3244 (determined at link time).  Register %g4 points to the base of the
3245 data segment.  Pointers still 64 bits.
3246 Programs are statically linked, PIC is not supported.
3247
3248 @item -mstack-bias
3249 @itemx -mno-stack-bias
3250 With @samp{-mstack-bias}, GNU CC assumes that the stack pointer, and
3251 frame pointer if present, are offset by -2047 which must be added back
3252 when making stack frame references.
3253 Otherwise, assume no such offset is present.
3254 @end table
3255
3256 @node Convex Options
3257 @subsection Convex Options
3258 @cindex Convex options
3259
3260 These @samp{-m} options are defined for Convex:
3261
3262 @table @code
3263 @item -mc1
3264 Generate output for C1.  The code will run on any Convex machine.
3265 The preprocessor symbol @code{__convex__c1__} is defined.
3266
3267 @item -mc2
3268 Generate output for C2.  Uses instructions not available on C1.
3269 Scheduling and other optimizations are chosen for max performance on C2.
3270 The preprocessor symbol @code{__convex_c2__} is defined.
3271
3272 @item -mc32
3273 Generate output for C32xx.  Uses instructions not available on C1.
3274 Scheduling and other optimizations are chosen for max performance on C32.
3275 The preprocessor symbol @code{__convex_c32__} is defined.
3276
3277 @item -mc34
3278 Generate output for C34xx.  Uses instructions not available on C1.
3279 Scheduling and other optimizations are chosen for max performance on C34.
3280 The preprocessor symbol @code{__convex_c34__} is defined.
3281
3282 @item -mc38
3283 Generate output for C38xx.  Uses instructions not available on C1.
3284 Scheduling and other optimizations are chosen for max performance on C38.
3285 The preprocessor symbol @code{__convex_c38__} is defined.
3286
3287 @item -margcount
3288 Generate code which puts an argument count in the word preceding each
3289 argument list.  This is compatible with regular CC, and a few programs
3290 may need the argument count word.  GDB and other source-level debuggers
3291 do not need it; this info is in the symbol table.
3292
3293 @item -mnoargcount
3294 Omit the argument count word.  This is the default.
3295
3296 @item -mvolatile-cache
3297 Allow volatile references to be cached.  This is the default.
3298
3299 @item -mvolatile-nocache
3300 Volatile references bypass the data cache, going all the way to memory.
3301 This is only needed for multi-processor code that does not use standard
3302 synchronization instructions.  Making non-volatile references to volatile
3303 locations will not necessarily work.
3304
3305 @item -mlong32
3306 Type long is 32 bits, the same as type int.  This is the default.
3307
3308 @item -mlong64
3309 Type long is 64 bits, the same as type long long.  This option is useless,
3310 because no library support exists for it.
3311 @end table
3312
3313 @node AMD29K Options
3314 @subsection AMD29K Options
3315 @cindex AMD29K options
3316
3317 These @samp{-m} options are defined for the AMD Am29000:
3318
3319 @table @code
3320 @item -mdw
3321 @kindex -mdw
3322 @cindex DW bit (29k)
3323 Generate code that assumes the @code{DW} bit is set, i.e., that byte and
3324 halfword operations are directly supported by the hardware.  This is the
3325 default.
3326
3327 @item -mndw
3328 @kindex -mndw
3329 Generate code that assumes the @code{DW} bit is not set.
3330
3331 @item -mbw
3332 @kindex -mbw
3333 @cindex byte writes (29k)
3334 Generate code that assumes the system supports byte and halfword write
3335 operations.  This is the default.
3336
3337 @item -mnbw
3338 @kindex -mnbw
3339 Generate code that assumes the systems does not support byte and
3340 halfword write operations.  @samp{-mnbw} implies @samp{-mndw}.
3341
3342 @item -msmall
3343 @kindex -msmall
3344 @cindex memory model (29k)
3345 Use a small memory model that assumes that all function addresses are
3346 either within a single 256 KB segment or at an absolute address of less
3347 than 256k.  This allows the @code{call} instruction to be used instead
3348 of a @code{const}, @code{consth}, @code{calli} sequence.
3349
3350 @item -mnormal
3351 @kindex -mnormal
3352 Use the normal memory model: Generate @code{call} instructions only when
3353 calling functions in the same file and @code{calli} instructions
3354 otherwise.  This works if each file occupies less than 256 KB but allows
3355 the entire executable to be larger than 256 KB.  This is the default.
3356
3357 @item -mlarge
3358 Always use @code{calli} instructions.  Specify this option if you expect
3359 a single file to compile into more than 256 KB of code.
3360
3361 @item -m29050
3362 @kindex -m29050
3363 @cindex processor selection (29k)
3364 Generate code for the Am29050.
3365
3366 @item -m29000
3367 @kindex -m29000
3368 Generate code for the Am29000.  This is the default.
3369
3370 @item -mkernel-registers
3371 @kindex -mkernel-registers
3372 @cindex kernel and user registers (29k)
3373 Generate references to registers @code{gr64-gr95} instead of to
3374 registers @code{gr96-gr127}.  This option can be used when compiling
3375 kernel code that wants a set of global registers disjoint from that used
3376 by user-mode code.
3377
3378 Note that when this option is used, register names in @samp{-f} flags
3379 must use the normal, user-mode, names.
3380
3381 @item -muser-registers
3382 @kindex -muser-registers
3383 Use the normal set of global registers, @code{gr96-gr127}.  This is the
3384 default.
3385
3386 @item -mstack-check
3387 @itemx -mno-stack-check
3388 @kindex -mstack-check
3389 @cindex stack checks (29k)
3390 Insert (or do not insert) a call to @code{__msp_check} after each stack
3391 adjustment.  This is often used for kernel code.
3392
3393 @item -mstorem-bug
3394 @itemx -mno-storem-bug
3395 @kindex -mstorem-bug
3396 @cindex storem bug (29k)
3397 @samp{-mstorem-bug} handles 29k processors which cannot handle the
3398 separation of a mtsrim insn and a storem instruction (most 29000 chips
3399 to date, but not the 29050).
3400
3401 @item -mno-reuse-arg-regs
3402 @itemx -mreuse-arg-regs
3403 @kindex -mreuse-arg-regs
3404 @samp{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
3405 registers for copying out arguments.  This helps detect calling a function
3406 with fewer arguments than it was declared with.
3407
3408 @item -mno-impure-text
3409 @itemx -mimpure-text
3410 @kindex -mimpure-text
3411 @samp{-mimpure-text}, used in addition to @samp{-shared}, tells the compiler to
3412 not pass @samp{-assert pure-text} to the linker when linking a shared object.
3413
3414 @item -msoft-float
3415 @kindex -msoft-float
3416 Generate output containing library calls for floating point.
3417 @strong{Warning:} the requisite libraries are not part of GNU CC.
3418 Normally the facilities of the machine's usual C compiler are used, but
3419 this can't be done directly in cross-compilation.  You must make your
3420 own arrangements to provide suitable library functions for
3421 cross-compilation.
3422 @end table
3423
3424 @node ARM Options
3425 @subsection ARM Options
3426 @cindex ARM options
3427
3428 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
3429 architectures:
3430
3431 @table @code
3432 @item -mapcs-frame
3433 @kindex -mapcs-frame
3434 Generate a stack frame that is compliant with the ARM Procedure Call
3435 Standard for all functions, even if this is not strictly necessary for
3436 correct execution of the code.
3437
3438 @item -mapcs-26
3439 @kindex -mapcs-26
3440 Generate code for a processor running with a 26-bit program counter,
3441 and conforming to the function calling standards for the APCS 26-bit
3442 option.  This option replaces the @samp{-m2} and @samp{-m3} options
3443 of previous releases of the compiler.
3444
3445 @item -mapcs-32
3446 @kindex -mapcs-32
3447 Generate code for a processor running with a 32-bit program counter,
3448 and conforming to the function calling standards for the APCS 32-bit
3449 option.  This option replaces the @samp{-m6} option of previous releases
3450 of the compiler.
3451
3452 @item -mhard-float
3453 Generate output containing floating point instructions.  This is the
3454 default.
3455
3456 @item -msoft-float
3457 Generate output containing library calls for floating point.
3458 @strong{Warning:} the requisite libraries are not available for all ARM
3459 targets.  Normally the facilities of the machine's usual C compiler are
3460 used, but this cannot be done directly in cross-compilation.  You must make
3461 your own arrangements to provide suitable library functions for
3462 cross-compilation.
3463
3464 @samp{-msoft-float} changes the calling convention in the output file;
3465 therefore, it is only useful if you compile @emph{all} of a program with
3466 this option.  In particular, you need to compile @file{libgcc.a}, the
3467 library that comes with GNU CC, with @samp{-msoft-float} in order for
3468 this to work.
3469
3470 @item -mlittle-endian
3471 Generate code for a processor running in little-endian mode.  This is
3472 the default for all standard configurations.
3473
3474 @item -mbig-endian
3475 Generate code for a processor running in big-endian mode; the default is
3476 to compile code for a little-endian processor.
3477
3478 @item -mwords-little-endian
3479 This option only applies when generating code for big-endian processors.
3480 Generate code for a little-endian word order but a big-endian byte
3481 order.  That is, a byte order of the form @samp{32107654}.  Note: this
3482 option should only be used if you require compatibility with code for
3483 big-endian ARM processors generated by versions of the compiler prior to
3484 2.8.
3485
3486 @item -mshort-load-bytes
3487 @kindex -mshort-load-bytes
3488 Do not try to load half-words (eg @samp{short}s) by loading a word from
3489 an unaligned address.  For some targets the MMU is configured to trap
3490 unaligned loads; use this option to generate code that is safe in these
3491 environments.
3492
3493 @item -mno-short-load-bytes
3494 @kindex -mno-short-load-bytes
3495 Use unaligned word loads to load half-words (eg @samp{short}s).  This
3496 option produces more efficient code, but the MMU is sometimes configured
3497 to trap these instructions.
3498
3499 @item -mbsd
3500 @kindex -mbsd
3501 This option only applies to RISC iX.  Emulate the native BSD-mode
3502 compiler.  This is the default if @samp{-ansi} is not specified.
3503
3504 @item -mxopen
3505 @kindex -mxopen
3506 This option only applies to RISC iX.  Emulate the native X/Open-mode
3507 compiler.
3508
3509 @item -mno-symrename
3510 @kindex -mno-symrename
3511 This option only applies to RISC iX.  Do not run the assembler
3512 post-processor, @samp{symrename}, after code has been assembled.
3513 Normally it is necessary to modify some of the standard symbols in
3514 preparation for linking with the RISC iX C library; this option
3515 suppresses this pass.  The post-processor is never run when the
3516 compiler is built for cross-compilation.
3517 @end table
3518
3519 @node MN10300 Options
3520 @subsection MN10300 Options
3521 @cindex MN10300 options
3522 These @samp{-m} options are defined for Matsushita MN10300 architectures:
3523
3524 @table @code
3525 @item -mmult-bug
3526 Generate code to avoid bugs in the multiply instructions for the MN10300
3527 processors.  This is the default.
3528
3529 @item -mno-mult-bug
3530 Do not generate code to avoid bugs in the multiply instructions for the
3531 MN10300 processors.
3532 @end table
3533
3534 @node M32R/D Options
3535 @subsection M32R/D Options
3536 @cindex M32R/D options
3537
3538 These @samp{-m} options are defined for Mitsubishi M32R/D architectures:
3539
3540 @table @code
3541 @item -mcode-model=small
3542 Assume all objects live in the lower 16MB of memory (so that their addresses
3543 can be loaded with the @code{ld24} instruction), and assume all subroutines
3544 are reachable with the @code{bl} instruction.
3545 This is the default.
3546
3547 The addressability of a particular object can be set with the
3548 @code{model} attribute.
3549
3550 @item -mcode-model=medium
3551 Assume objects may be anywhere in the 32 bit address space (the compiler
3552 will generate @code{seth/add3} instructions to load their addresses), and
3553 assume all subroutines are reachable with the @code{bl} instruction.
3554
3555 @item -mcode-model=large
3556 Assume objects may be anywhere in the 32 bit address space (the compiler
3557 will generate @code{seth/add3} instructions to load their addresses), and
3558 assume subroutines may not be reachable with the @code{bl} instruction
3559 (the compiler will generate the much slower @code{seth/add3/jl}
3560 instruction sequence).
3561
3562 @item -msdata=none
3563 Disable use of the small data area.  Variables will be put into
3564 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
3565 @code{section} attribute has been specified).
3566 This is the default.
3567
3568 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
3569 Objects may be explicitly put in the small data area with the
3570 @code{section} attribute using one of these sections.
3571
3572 @item -msdata=sdata
3573 Put small global and static data in the small data area, but do not
3574 generate special code to reference them.
3575
3576 @item -msdata=use
3577 Put small global and static data in the small data area, and generate
3578 special instructions to reference them.
3579
3580 @item -G @var{num}
3581 @cindex smaller data references
3582 Put global and static objects less than or equal to @var{num} bytes
3583 into the small data or bss sections instead of the normal data or bss
3584 sections.  The default value of @var{num} is 8.
3585 The @samp{-msdata} option must be set to one of @samp{sdata} or @samp{use}
3586 for this option to have any effect.
3587
3588 All modules should be compiled with the same @samp{-G @var{num}} value.
3589 Compiling with different values of @var{num} may or may not work; if it
3590 doesn't the linker will give an error message - incorrect code will not be
3591 generated.
3592
3593 @end table
3594
3595 @node M88K Options
3596 @subsection M88K Options
3597 @cindex M88k options
3598
3599 These @samp{-m} options are defined for Motorola 88k architectures:
3600
3601 @table @code
3602 @item -m88000
3603 @kindex -m88000
3604 Generate code that works well on both the m88100 and the
3605 m88110.
3606
3607 @item -m88100
3608 @kindex -m88100
3609 Generate code that works best for the m88100, but that also
3610 runs on the m88110.
3611
3612 @item -m88110
3613 @kindex -m88110
3614 Generate code that works best for the m88110, and may not run
3615 on the m88100.
3616
3617 @item -mbig-pic
3618 @kindex -mbig-pic
3619 Obsolete option to be removed from the next revision.
3620 Use @samp{-fPIC}.
3621
3622 @item -midentify-revision
3623 @kindex -midentify-revision
3624 @kindex ident
3625 @cindex identifying source, compiler (88k)
3626 Include an @code{ident} directive in the assembler output recording the
3627 source file name, compiler name and version, timestamp, and compilation
3628 flags used.
3629
3630 @item -mno-underscores
3631 @kindex -mno-underscores
3632 @cindex underscores, avoiding (88k)
3633 In assembler output, emit symbol names without adding an underscore
3634 character at the beginning of each name.  The default is to use an
3635 underscore as prefix on each name.
3636
3637 @item -mocs-debug-info
3638 @itemx -mno-ocs-debug-info
3639 @kindex -mocs-debug-info
3640 @kindex -mno-ocs-debug-info
3641 @cindex OCS (88k)
3642 @cindex debugging, 88k OCS
3643 Include (or omit) additional debugging information (about registers used
3644 in each stack frame) as specified in the 88open Object Compatibility
3645 Standard, ``OCS''.  This extra information allows debugging of code that
3646 has had the frame pointer eliminated.  The default for DG/UX, SVr4, and
3647 Delta 88 SVr3.2 is to include this information; other 88k configurations
3648 omit this information by default.
3649
3650 @item -mocs-frame-position
3651 @kindex -mocs-frame-position
3652 @cindex register positions in frame (88k)
3653 When emitting COFF debugging information for automatic variables and
3654 parameters stored on the stack, use the offset from the canonical frame
3655 address, which is the stack pointer (register 31) on entry to the
3656 function.  The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
3657 @samp{-mocs-frame-position}; other 88k configurations have the default
3658 @samp{-mno-ocs-frame-position}.
3659
3660 @item -mno-ocs-frame-position
3661 @kindex -mno-ocs-frame-position
3662 @cindex register positions in frame (88k)
3663 When emitting COFF debugging information for automatic variables and
3664 parameters stored on the stack, use the offset from the frame pointer
3665 register (register 30).  When this option is in effect, the frame
3666 pointer is not eliminated when debugging information is selected by the
3667 -g switch.
3668
3669 @item -moptimize-arg-area
3670 @itemx -mno-optimize-arg-area
3671 @kindex -moptimize-arg-area
3672 @kindex -mno-optimize-arg-area
3673 @cindex arguments in frame (88k)
3674 Control how function arguments are stored in stack frames.
3675 @samp{-moptimize-arg-area} saves space by optimizing them, but this
3676 conflicts with the 88open specifications.  The opposite alternative,
3677 @samp{-mno-optimize-arg-area}, agrees with 88open standards.  By default
3678 GNU CC does not optimize the argument area.
3679
3680 @item -mshort-data-@var{num}
3681 @kindex -mshort-data-@var{num}
3682 @cindex smaller data references (88k)
3683 @cindex r0-relative references (88k)
3684 Generate smaller data references by making them relative to @code{r0},
3685 which allows loading a value using a single instruction (rather than the
3686 usual two).  You control which data references are affected by
3687 specifying @var{num} with this option.  For example, if you specify
3688 @samp{-mshort-data-512}, then the data references affected are those
3689 involving displacements of less than 512 bytes.
3690 @samp{-mshort-data-@var{num}} is not effective for @var{num} greater
3691 than 64k.
3692
3693 @item -mserialize-volatile
3694 @kindex -mserialize-volatile
3695 @itemx -mno-serialize-volatile
3696 @kindex -mno-serialize-volatile
3697 @cindex sequential consistency on 88k
3698 Do, or don't, generate code to guarantee sequential consistency
3699 of volatile memory references.  By default, consistency is
3700 guaranteed.
3701
3702 The order of memory references made by the MC88110 processor does
3703 not always match the order of the instructions requesting those
3704 references.  In particular, a load instruction may execute before
3705 a preceding store instruction.  Such reordering violates
3706 sequential consistency of volatile memory references, when there
3707 are multiple processors.   When consistency must be guaranteed,
3708 GNU C generates special instructions, as needed, to force
3709 execution in the proper order.
3710
3711 The MC88100 processor does not reorder memory references and so
3712 always provides sequential consistency.  However, by default, GNU
3713 C generates the special instructions to guarantee consistency
3714 even when you use @samp{-m88100}, so that the code may be run on an
3715 MC88110 processor.  If you intend to run your code only on the
3716 MC88100 processor, you may use @samp{-mno-serialize-volatile}.
3717
3718 The extra code generated to guarantee consistency may affect the
3719 performance of your application.  If you know that you can safely
3720 forgo this guarantee, you may use @samp{-mno-serialize-volatile}.
3721
3722 @item -msvr4
3723 @itemx -msvr3
3724 @kindex -msvr4
3725 @kindex -msvr3
3726 @cindex assembler syntax, 88k
3727 @cindex SVr4
3728 Turn on (@samp{-msvr4}) or off (@samp{-msvr3}) compiler extensions
3729 related to System V release 4 (SVr4).  This controls the following:
3730
3731 @enumerate
3732 @item
3733 Which variant of the assembler syntax to emit.
3734 @item
3735 @samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
3736 that is used on System V release 4.
3737 @item
3738 @samp{-msvr4} makes GNU CC issue additional declaration directives used in
3739 SVr4.
3740 @end enumerate
3741
3742 @samp{-msvr4} is the default for the m88k-motorola-sysv4 and
3743 m88k-dg-dgux m88k configurations. @samp{-msvr3} is the default for all
3744 other m88k configurations.
3745
3746 @item -mversion-03.00
3747 @kindex -mversion-03.00
3748 This option is obsolete, and is ignored.
3749 @c ??? which asm syntax better for GAS?  option there too?
3750
3751 @item -mno-check-zero-division
3752 @itemx -mcheck-zero-division
3753 @kindex -mno-check-zero-division
3754 @kindex -mcheck-zero-division
3755 @cindex zero division on 88k
3756 Do, or don't, generate code to guarantee that integer division by
3757 zero will be detected.  By default, detection is guaranteed.
3758
3759 Some models of the MC88100 processor fail to trap upon integer
3760 division by zero under certain conditions.  By default, when
3761 compiling code that might be run on such a processor, GNU C
3762 generates code that explicitly checks for zero-valued divisors
3763 and traps with exception number 503 when one is detected.  Use of
3764 mno-check-zero-division suppresses such checking for code
3765 generated to run on an MC88100 processor.
3766
3767 GNU C assumes that the MC88110 processor correctly detects all
3768 instances of integer division by zero.  When @samp{-m88110} is
3769 specified, both @samp{-mcheck-zero-division} and
3770 @samp{-mno-check-zero-division} are ignored, and no explicit checks for
3771 zero-valued divisors are generated.
3772
3773 @item -muse-div-instruction
3774 @kindex -muse-div-instruction
3775 @cindex divide instruction, 88k
3776 Use the div instruction for signed integer division on the
3777 MC88100 processor.  By default, the div instruction is not used.
3778
3779 On the MC88100 processor the signed integer division instruction
3780 div) traps to the operating system on a negative operand.  The
3781 operating system transparently completes the operation, but at a
3782 large cost in execution time.  By default, when compiling code
3783 that might be run on an MC88100 processor, GNU C emulates signed
3784 integer division using the unsigned integer division instruction
3785 divu), thereby avoiding the large penalty of a trap to the
3786 operating system.  Such emulation has its own, smaller, execution
3787 cost in both time and space.  To the extent that your code's
3788 important signed integer division operations are performed on two
3789 nonnegative operands, it may be desirable to use the div
3790 instruction directly.
3791
3792 On the MC88110 processor the div instruction (also known as the
3793 divs instruction) processes negative operands without trapping to
3794 the operating system.  When @samp{-m88110} is specified,
3795 @samp{-muse-div-instruction} is ignored, and the div instruction is used
3796 for signed integer division.
3797
3798 Note that the result of dividing INT_MIN by -1 is undefined.  In
3799 particular, the behavior of such a division with and without
3800 @samp{-muse-div-instruction}  may differ.
3801
3802 @item -mtrap-large-shift
3803 @itemx -mhandle-large-shift
3804 @kindex -mtrap-large-shift
3805 @kindex -mhandle-large-shift
3806 @cindex bit shift overflow (88k)
3807 @cindex large bit shifts (88k)
3808 Include code to detect bit-shifts of more than 31 bits; respectively,
3809 trap such shifts or emit code to handle them properly.  By default GNU CC
3810 makes no special provision for large bit shifts.
3811
3812 @item -mwarn-passed-structs
3813 @kindex -mwarn-passed-structs
3814 @cindex structure passing (88k)
3815 Warn when a function passes a struct as an argument or result.
3816 Structure-passing conventions have changed during the evolution of the C
3817 language, and are often the source of portability problems.  By default,
3818 GNU CC issues no such warning.
3819 @end table
3820
3821 @node RS/6000 and PowerPC Options
3822 @subsection IBM RS/6000 and PowerPC Options
3823 @cindex RS/6000 and PowerPC Options
3824 @cindex IBM RS/6000 and PowerPC Options
3825
3826 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
3827 @table @code
3828 @item -mpower
3829 @itemx -mno-power
3830 @itemx -mpower2
3831 @itemx -mno-power2
3832 @itemx -mpowerpc
3833 @itemx -mno-powerpc
3834 @itemx -mpowerpc-gpopt
3835 @itemx -mno-powerpc-gpopt
3836 @itemx -mpowerpc-gfxopt
3837 @itemx -mno-powerpc-gfxopt
3838 @kindex -mpower
3839 @kindex -mpower2
3840 @kindex -mpowerpc
3841 @kindex -mpowerpc-gpopt
3842 @kindex -mpowerpc-gfxopt
3843 GNU CC supports two related instruction set architectures for the
3844 RS/6000 and PowerPC.  The @dfn{POWER} instruction set are those
3845 instructions supported by the @samp{rios} chip set used in the original
3846 RS/6000 systems and the @dfn{PowerPC} instruction set is the
3847 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
3848 the IBM 4xx microprocessors.
3849
3850 Neither architecture is a subset of the other.  However there is a
3851 large common subset of instructions supported by both.  An MQ
3852 register is included in processors supporting the POWER architecture.
3853
3854 You use these options to specify which instructions are available on the
3855 processor you are using.  The default value of these options is
3856 determined when configuring GNU CC.  Specifying the
3857 @samp{-mcpu=@var{cpu_type}} overrides the specification of these
3858 options.  We recommend you use the @samp{-mcpu=@var{cpu_type}} option
3859 rather than the options listed above.
3860
3861 The @samp{-mpower} option allows GNU CC to generate instructions that
3862 are found only in the POWER architecture and to use the MQ register.
3863 Specifying @samp{-mpower2} implies @samp{-power} and also allows GNU CC
3864 to generate instructions that are present in the POWER2 architecture but
3865 not the original POWER architecture.
3866
3867 The @samp{-mpowerpc} option allows GNU CC to generate instructions that
3868 are found only in the 32-bit subset of the PowerPC architecture.
3869 Specifying @samp{-mpowerpc-gpopt} implies @samp{-mpowerpc} and also allows
3870 GNU CC to use the optional PowerPC architecture instructions in the
3871 General Purpose group, including floating-point square root.  Specifying
3872 @samp{-mpowerpc-gfxopt} implies @samp{-mpowerpc} and also allows GNU CC to
3873 use the optional PowerPC architecture instructions in the Graphics
3874 group, including floating-point select.
3875
3876 If you specify both @samp{-mno-power} and @samp{-mno-powerpc}, GNU CC
3877 will use only the instructions in the common subset of both
3878 architectures plus some special AIX common-mode calls, and will not use
3879 the MQ register.  Specifying both @samp{-mpower} and @samp{-mpowerpc}
3880 permits GNU CC to use any instruction from either architecture and to
3881 allow use of the MQ register; specify this for the Motorola MPC601.
3882
3883 @item -mnew-mnemonics
3884 @itemx -mold-mnemonics
3885 @kindex -mnew-mnemonics
3886 @kindex -mold-mnemonics
3887 Select which mnemonics to use in the generated assembler code.
3888 @samp{-mnew-mnemonics} requests output that uses the assembler mnemonics
3889 defined for the PowerPC architecture, while @samp{-mold-mnemonics}
3890 requests the assembler mnemonics defined for the POWER architecture.
3891 Instructions defined in only one architecture have only one mnemonic;
3892 GNU CC uses that mnemonic irrespective of which of these options is
3893 specified.
3894
3895 PowerPC assemblers support both the old and new mnemonics, as will later
3896 POWER assemblers.  Current POWER assemblers only support the old
3897 mnemonics.  Specify @samp{-mnew-mnemonics} if you have an assembler that
3898 supports them, otherwise specify @samp{-mold-mnemonics}.
3899
3900 The default value of these options depends on how GNU CC was configured.
3901 Specifying @samp{-mcpu=@var{cpu_type}} sometimes overrides the value of
3902 these option.  Unless you are building a cross-compiler, you should
3903 normally not specify either @samp{-mnew-mnemonics} or
3904 @samp{-mold-mnemonics}, but should instead accept the default.
3905
3906 @item -mcpu=@var{cpu_type}
3907 Set architecture type, register usage, choice of mnemonics, and
3908 instruction scheduling parameters for machine type @var{cpu_type}.
3909 Supported values for @var{cpu_type} are @samp{rs6000}, @samp{rios1},
3910 @samp{rios2}, @samp{rsc}, @samp{601}, @samp{602}, @samp{603},
3911 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{power},
3912 @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, @samp{801},
3913 @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
3914 @samp{-mcpu=power}, @samp{-mcpu=power2}, and @samp{-mcpu=powerpc}
3915 specify generic POWER, POWER2 and pure PowerPC (i.e., not MPC601)
3916 architecture machine types, with an appropriate, generic processor model
3917 assumed for scheduling purposes.@refill
3918
3919 @c overfull hbox here --bob 22 jul96
3920 @c original text between ignore ... end ignore
3921 @ignore
3922 Specifying any of the @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
3923 @samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} options
3924 enables the @samp{-mpower} option and disables the @samp{-mpowerpc}
3925 option; @samp{-mcpu=601} enables both the @samp{-mpower} and
3926 @samp{-mpowerpc} options; all of @samp{-mcpu=602}, @samp{-mcpu=603},
3927 @samp{-mcpu=603e}, @samp{-mcpu=604}, @samp{-mcpu=604e},
3928 @samp{-mcpu=620}, @samp{-mcpu=403}, @samp{-mcpu=505}, @samp{-mcpu=801},
3929 @samp{-mcpu=821}, @samp{-mcpu=823}, @samp{-mcpu=860} and
3930 @samp{-mcpu=powerpc} enable the @samp{-mpowerpc} option and disable the
3931 @samp{-mpower} option; @samp{-mcpu=common} disables both the
3932 @samp{-mpower} and @samp{-mpowerpc} options.@refill
3933 @end ignore
3934 @c            changed paragraph
3935 Specifying any of the following options: 
3936 @samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @samp{-mcpu=rsc},
3937 @samp{-mcpu=power}, or @samp{-mcpu=power2}  
3938 enables the @samp{-mpower} option and disables the @samp{-mpowerpc} option; 
3939 @samp{-mcpu=601} enables both the @samp{-mpower} and @samp{-mpowerpc} options.
3940 All of @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e},
3941 @samp{-mcpu=604}, @samp{-mcpu=620}, 
3942 enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.  
3943 Exactly similarly, all of @samp{-mcpu=403},
3944 @samp{-mcpu=505}, @samp{-mcpu=821}, @samp{-mcpu=860} and @samp{-mcpu=powerpc} 
3945 enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
3946 @samp{-mcpu=common} disables both the 
3947 @samp{-mpower} and @samp{-mpowerpc} options.@refill
3948 @c             end changes to prevent overfull hboxes
3949
3950 AIX versions 4 or greater selects @samp{-mcpu=common} by default, so
3951 that code will operate on all members of the RS/6000 and PowerPC
3952 families.  In that case, GNU CC will use only the instructions in the
3953 common subset of both architectures plus some special AIX common-mode
3954 calls, and will not use the MQ register.  GNU CC assumes a generic
3955 processor model for scheduling purposes.
3956
3957 Specifying any of the options @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
3958 @samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} also
3959 disables the @samp{new-mnemonics} option.  Specifying @samp{-mcpu=601},
3960 @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e}, @samp{-mcpu=604},
3961 @samp{620}, @samp{403}, or @samp{-mcpu=powerpc} also enables the
3962 @samp{new-mnemonics} option.@refill
3963
3964 Specifying @samp{-mcpu=403}, @samp{-mcpu=821}, or @samp{-mcpu=860} also
3965 enables the @samp{-msoft-float} option.
3966
3967 @item -mtune=@var{cpu_type}
3968 Set the instruction scheduling parameters for machine type
3969 @var{cpu_type}, but do not set the architecture type, register usage,
3970 choice of mnemonics like @samp{-mcpu=}@var{cpu_type} would.  The same
3971 values for @var{cpu_type} are used for @samp{-mtune=}@var{cpu_type} as
3972 for @samp{-mcpu=}@var{cpu_type}.  The @samp{-mtune=}@var{cpu_type}
3973 option overrides the @samp{-mcpu=}@var{cpu_type} option in terms of
3974 instruction scheduling parameters.
3975
3976 @item -mfull-toc
3977 @itemx -mno-fp-in-toc
3978 @itemx -mno-sum-in-toc
3979 @itemx -mminimal-toc
3980 Modify generation of the TOC (Table Of Contents), which is created for
3981 every executable file.  The @samp{-mfull-toc} option is selected by
3982 default.  In that case, GNU CC will allocate at least one TOC entry for
3983 each unique non-automatic variable reference in your program.  GNU CC
3984 will also place floating-point constants in the TOC.  However, only
3985 16,384 entries are available in the TOC.
3986
3987 If you receive a linker error message that saying you have overflowed
3988 the available TOC space, you can reduce the amount of TOC space used
3989 with the @samp{-mno-fp-in-toc} and @samp{-mno-sum-in-toc} options.
3990 @samp{-mno-fp-in-toc} prevents GNU CC from putting floating-point
3991 constants in the TOC and @samp{-mno-sum-in-toc} forces GNU CC to
3992 generate code to calculate the sum of an address and a constant at
3993 run-time instead of putting that sum into the TOC.  You may specify one
3994 or both of these options.  Each causes GNU CC to produce very slightly
3995 slower and larger code at the expense of conserving TOC space.
3996
3997 If you still run out of space in the TOC even when you specify both of
3998 these options, specify @samp{-mminimal-toc} instead.  This option causes
3999 GNU CC to make only one TOC entry for every file.  When you specify this
4000 option, GNU CC will produce code that is slower and larger but which
4001 uses extremely little TOC space.  You may wish to use this option
4002 only on files that contain less frequently executed code. @refill
4003
4004 @item -mxl-call
4005 @itemx -mno-xl-call
4006 On AIX, pass floating-point arguments to prototyped functions beyond the
4007 register save area (RSA) on the stack in addition to argument FPRs.  The
4008 AIX calling convention was extended but not initially documented to
4009 handle an obscure K&R C case of calling a function that takes the
4010 address of its arguments with fewer arguments than declared.  AIX XL
4011 compilers assume that floating point arguments which do not fit in the
4012 RSA are on the stack when they compile a subroutine without
4013 optimization.  Because always storing floating-point arguments on the
4014 stack is inefficient and rarely needed, this option is not enabled by
4015 default and only is necessary when calling subroutines compiled by AIX
4016 XL compilers without optimization.
4017
4018 @item -mthreads
4019 Support @dfn{AIX Threads}.  Link an application written to use
4020 @dfn{pthreads} with special libraries and startup code to enable the
4021 application to run.
4022
4023 @item -mpe
4024 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE).  Link an
4025 application written to use message passing with special startup code to
4026 enable the application to run.  The system must have PE installed in the
4027 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
4028 must be overridden with the @samp{-specs=} option to specify the
4029 appropriate directory location.  The Parallel Environment does not
4030 support threads, so the @samp{-mpe} option and the @samp{-mthreads}
4031 option are incompatible.
4032
4033 @item -msoft-float
4034 @itemx -mhard-float
4035 Generate code that does not use (uses) the floating-point register set.
4036 Software floating point emulation is provided if you use the
4037 @samp{-msoft-float} option, and pass the option to GNU CC when linking.
4038
4039 @item -mmultiple
4040 @itemx -mno-multiple
4041 Generate code that uses (does not use) the load multiple word
4042 instructions and the store multiple word instructions.  These
4043 instructions are generated by default on POWER systems, and not
4044 generated on PowerPC systems.  Do not use @samp{-mmultiple} on little
4045 endian PowerPC systems, since those instructions do not work when the
4046 processor is in little endian mode.
4047
4048 @item -mstring
4049 @itemx -mno-string
4050 Generate code that uses (does not use) the load string instructions and the
4051 store string word instructions to save multiple registers and do small block
4052 moves.  These instructions are generated by default on POWER systems, and not
4053 generated on PowerPC systems.  Do not use @samp{-mstring} on little endian
4054 PowerPC systems, since those instructions do not work when the processor is in
4055 little endian mode.
4056
4057 @item -mupdate
4058 @itemx -mno-update
4059 Generate code that uses (does not use) the load or store instructions
4060 that update the base register to the address of the calculated memory
4061 location.  These instructions are generated by default.  If you use
4062 @samp{-mno-update}, there is a small window between the time that the
4063 stack pointer is updated and the address of the previous frame is
4064 stored, which means code that walks the stack frame across interrupts or
4065 signals may get corrupted data.
4066
4067 @item -mfused-madd
4068 @itemx -mno-fused-madd
4069 Generate code that uses (does not use) the floating point multiply and
4070 accumulate instructions.  These instructions are generated by default if
4071 hardware floating is used.
4072
4073 @item -mno-bit-align
4074 @itemx -mbit-align
4075 On System V.4 and embedded PowerPC systems do not (do) force structures
4076 and unions that contain bit fields to be aligned to the base type of the
4077 bit field.
4078
4079 For example, by default a structure containing nothing but 8
4080 @code{unsigned} bitfields of length 1 would be aligned to a 4 byte
4081 boundary and have a size of 4 bytes.  By using @samp{-mno-bit-align},
4082 the structure would be aligned to a 1 byte boundary and be one byte in
4083 size.
4084
4085 @item -mno-strict-align
4086 @itemx -mstrict-align
4087 On System V.4 and embedded PowerPC systems do not (do) assume that
4088 unaligned memory references will be handled by the system.
4089
4090 @item -mrelocatable
4091 @itemx -mno-relocatable
4092 On embedded PowerPC systems generate code that allows (does not allow)
4093 the program to be relocated to a different address at runtime.  If you
4094 use @samp{-mrelocatable} on any module, all objects linked together must
4095 be compiled with @samp{-mrelocatable} or @samp{-mrelocatable-lib}.
4096
4097 @item -mrelocatable-lib
4098 @itemx -mno-relocatable-lib
4099 On embedded PowerPC systems generate code that allows (does not allow)
4100 the program to be relocated to a different address at runtime.  Modules
4101 compiled with @samp{-mreloctable-lib} can be linked with either modules
4102 compiled without @samp{-mrelocatable} and @samp{-mrelocatable-lib} or
4103 with modules compiled with the @samp{-mrelocatable} options.
4104
4105 @item -mno-toc
4106 @itemx -mtoc
4107 On System V.4 and embedded PowerPC systems do not (do) assume that
4108 register 2 contains a pointer to a global area pointing to the addresses
4109 used in the program.
4110
4111 @item -mno-traceback
4112 @itemx -mtraceback
4113 On embedded PowerPC systems do not (do) generate a traceback tag before
4114 the start of the function.  This tag can be used by the debugger to
4115 identify where the start of a function is.
4116
4117 @item -mlittle
4118 @itemx -mlittle-endian
4119 On System V.4 and embedded PowerPC systems compile code for the
4120 processor in little endian mode.  The @samp{-mlittle-endian} option is
4121 the same as @samp{-mlittle}.
4122
4123 @item -mbig
4124 @itemx -mbig-endian
4125 On System V.4 and embedded PowerPC systems compile code for the
4126 processor in big endian mode.  The @samp{-mbig-endian} option is
4127 the same as @samp{-mbig}.
4128
4129 @item -mcall-sysv
4130 On System V.4 and embedded PowerPC systems compile code using calling
4131 conventions that adheres to the March 1995 draft of the System V
4132 Application Binary Interface, PowerPC processor supplement.  This is the
4133 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
4134
4135 @item -mcall-sysv-eabi
4136 Specify both @samp{-mcall-sysv} and @samp{-meabi} options.
4137
4138 @item -mcall-sysv-noeabi
4139 Specify both @samp{-mcall-sysv} and @samp{-mno-eabi} options.
4140
4141 @item -mcall-aix
4142 On System V.4 and embedded PowerPC systems compile code using calling
4143 conventions that are similar to those used on AIX.  This is the
4144 default if you configured GCC using @samp{powerpc-*-eabiaix}.
4145
4146 @item -mcall-solaris
4147 On System V.4 and embedded PowerPC systems compile code for the Solaris
4148 operating system.
4149
4150 @item -mcall-linux
4151 On System V.4 and embedded PowerPC systems compile code for the
4152 Linux-based GNU system.
4153
4154 @item -mprototype
4155 @itemx -mno-prototype
4156 On System V.4 and embedded PowerPC systems assume that all calls to
4157 variable argument functions are properly prototyped.  Otherwise, the
4158 compiler must insert an instruction before every non prototyped call to
4159 set or clear bit 6 of the condition code register (@var{CR}) to
4160 indicate whether floating point values were passed in the floating point
4161 registers in case the function takes a variable arguments.  With
4162 @samp{-mprototype}, only calls to prototyped variable argument functions
4163 will set or clear the bit.
4164
4165 @item -msim
4166 On embedded PowerPC systems, assume that the startup module is called
4167 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
4168 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
4169 configurations.
4170
4171 @item -mmvme
4172 On embedded PowerPC systems, assume that the startup module is called
4173 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
4174 @file{libc.a}.
4175
4176 @item -mads
4177 On embedded PowerPC systems, assume that the startup module is called
4178 @file{crt0.o} and the standard C libraries are @file{libads.a} and
4179 @file{libc.a}.
4180
4181 @item -myellowknife
4182 On embedded PowerPC systems, assume that the startup module is called
4183 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
4184 @file{libc.a}.
4185
4186 @item -memb
4187 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
4188 header to indicate that @samp{eabi} extended relocations are used.
4189
4190 @item -meabi
4191 @itemx -mno-eabi
4192 On System V.4 and embedded PowerPC systems do (do not) adhere to the
4193 Embedded Applications Binary Interface (eabi) which is a set of
4194 modifications to the System V.4 specifications.  Selecting @code{-meabi}
4195 means that the stack is aligned to an 8 byte boundary, a function
4196 @code{__eabi} is called to from @code{main} to set up the eabi
4197 environment, and the @samp{-msdata} option can use both @code{r2} and
4198 @code{r13} to point to two separate small data areas.  Selecting
4199 @code{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
4200 do not call an initialization function from @code{main}, and the
4201 @samp{-msdata} option will only use @code{r13} to point to a single
4202 small data area.  The @samp{-meabi} option is on by default if you
4203 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
4204
4205 @item -msdata=eabi
4206 On System V.4 and embedded PowerPC systems, put small initialized
4207 @code{const} global and static data in the @samp{.sdata2} section, which
4208 is pointed to by register @code{r2}.  Put small initialized
4209 non-@code{const} global and static data in the @samp{.sdata} section,
4210 which is pointed to by register @code{r13}.  Put small uninitialized
4211 global and static data in the @samp{.sbss} section, which is adjacent to
4212 the @samp{.sdata} section.  The @samp{-msdata=eabi} option is
4213 incompatible with the @samp{-mrelocatable} option.  The
4214 @samp{-msdata=eabi} option also sets the @samp{-memb} option.
4215
4216 @item -msdata=sysv
4217 On System V.4 and embedded PowerPC systems, put small global and static
4218 data in the @samp{.sdata} section, which is pointed to by register
4219 @code{r13}.  Put small uninitialized global and static data in the
4220 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
4221 The @samp{-msdata=sysv} option is incompatible with the
4222 @samp{-mrelocatable} option.
4223
4224 @item -msdata=default
4225 @itemx -msdata
4226 On System V.4 and embedded PowerPC systems, if @samp{-meabi} is used,
4227 compile code the same as @samp{-msdata=eabi}, otherwise compile code the
4228 same as @samp{-msdata=sysv}.
4229
4230 @item -msdata-data
4231 On System V.4 and embedded PowerPC systems, put small global and static
4232 data in the @samp{.sdata} section.  Put small uninitialized global and
4233 static data in the @samp{.sbss} section.  Do not use register @code{r13}
4234 to address small data however.  This is the default behavior unless
4235 other @samp{-msdata} options are used.
4236
4237 @item -msdata=none
4238 @itemx -mno-sdata
4239 On embedded PowerPC systems, put all initialized global and static data
4240 in the @samp{.data} section, and all uninitialized data in the
4241 @samp{.bss} section.
4242
4243 @item -G @var{num}
4244 @cindex smaller data references (PowerPC)
4245 @cindex .sdata/.sdata2 references (PowerPC)
4246 On embbeded PowerPC systems, put global and static items less than or
4247 equal to @var{num} bytes into the small data or bss sections instead of
4248 the normal data or bss section.  By default, @var{num} is 8.  The
4249 @samp{-G @var{num}} switch is also passed to the linker.
4250 All modules should be compiled with the same @samp{-G @var{num}} value.
4251
4252 @item -mregnames
4253 @itemx -mno-regnames
4254 On System V.4 and embedded PowerPC systems do (do not) emit register
4255 names in the assembly language output using symbolic forms.
4256 @end table
4257 @node RT Options
4258 @subsection IBM RT Options
4259 @cindex RT options
4260 @cindex IBM RT options
4261
4262 These @samp{-m} options are defined for the IBM RT PC:
4263
4264 @table @code
4265 @item -min-line-mul
4266 Use an in-line code sequence for integer multiplies.  This is the
4267 default.
4268
4269 @item -mcall-lib-mul
4270 Call @code{lmul$$} for integer multiples.
4271
4272 @item -mfull-fp-blocks
4273 Generate full-size floating point data blocks, including the minimum
4274 amount of scratch space recommended by IBM.  This is the default.
4275
4276 @item -mminimum-fp-blocks
4277 Do not include extra scratch space in floating point data blocks.  This
4278 results in smaller code, but slower execution, since scratch space must
4279 be allocated dynamically.
4280
4281 @cindex @file{varargs.h} and RT PC
4282 @cindex @file{stdarg.h} and RT PC
4283 @item -mfp-arg-in-fpregs
4284 Use a calling sequence incompatible with the IBM calling convention in
4285 which floating point arguments are passed in floating point registers.
4286 Note that @code{varargs.h} and @code{stdargs.h} will not work with
4287 floating point operands if this option is specified.
4288
4289 @item -mfp-arg-in-gregs
4290 Use the normal calling convention for floating point arguments.  This is
4291 the default.
4292
4293 @item -mhc-struct-return
4294 Return structures of more than one word in memory, rather than in a
4295 register.  This provides compatibility with the MetaWare HighC (hc)
4296 compiler.  Use the option @samp{-fpcc-struct-return} for compatibility
4297 with the Portable C Compiler (pcc).
4298
4299 @item -mnohc-struct-return
4300 Return some structures of more than one word in registers, when
4301 convenient.  This is the default.  For compatibility with the
4302 IBM-supplied compilers, use the option @samp{-fpcc-struct-return} or the
4303 option @samp{-mhc-struct-return}.
4304 @end table
4305
4306 @node MIPS Options
4307 @subsection MIPS Options
4308 @cindex MIPS options
4309
4310 These @samp{-m} options are defined for the MIPS family of computers:
4311
4312 @table @code
4313 @item -mcpu=@var{cpu type}
4314 Assume the defaults for the machine type @var{cpu type} when scheduling
4315 instructions.  The choices for @var{cpu type} are @samp{r2000}, @samp{r3000},
4316 @samp{r4000}, @samp{r4400}, @samp{r4600}, and @samp{r6000}.  While picking a
4317 specific @var{cpu type} will schedule things appropriately for that
4318 particular chip, the compiler will not generate any code that does not
4319 meet level 1 of the MIPS ISA (instruction set architecture) without
4320 the @samp{-mips2} or @samp{-mips3} switches being used.
4321
4322 @item -mips1
4323 Issue instructions from level 1 of the MIPS ISA.  This is the default.
4324 @samp{r3000} is the default @var{cpu type} at this ISA level.
4325
4326 @item -mips2
4327 Issue instructions from level 2 of the MIPS ISA (branch likely, square
4328 root instructions).  @samp{r6000} is the default @var{cpu type} at this
4329 ISA level.
4330
4331 @item -mips3
4332 Issue instructions from level 3 of the MIPS ISA (64 bit instructions).
4333 @samp{r4000} is the default @var{cpu type} at this ISA level.
4334 This option does not change the sizes of any of the C data types.
4335
4336 @item -mfp32
4337 Assume that 32 32-bit floating point registers are available.  This is
4338 the default.
4339
4340 @item -mfp64
4341 Assume that 32 64-bit floating point registers are available.  This is
4342 the default when the @samp{-mips3} option is used.
4343
4344 @item -mgp32
4345 Assume that 32 32-bit general purpose registers are available.  This is
4346 the default.
4347
4348 @item -mgp64
4349 Assume that 32 64-bit general purpose registers are available.  This is
4350 the default when the @samp{-mips3} option is used.
4351
4352 @item -mint64
4353 Types long, int, and pointer are 64 bits.  This works only if @samp{-mips3}
4354 is also specified.
4355
4356 @item -mlong64
4357 Types long and pointer are 64 bits, and type int is 32 bits.
4358 This works only if @samp{-mips3} is also specified.
4359
4360 @item -mmips-as
4361 Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
4362 add normal debug information.  This is the default for all
4363 platforms except for the OSF/1 reference platform, using the OSF/rose
4364 object format.  If the either of the @samp{-gstabs} or @samp{-gstabs+}
4365 switches are used, the @file{mips-tfile} program will encapsulate the
4366 stabs within MIPS ECOFF.
4367
4368 @item -mgas
4369 Generate code for the GNU assembler.  This is the default on the OSF/1
4370 reference platform, using the OSF/rose object format.  Also, this is
4371 the default if the configure option @samp{--with-gnu-as} is used.
4372
4373 @item -msplit-addresses
4374 @itemx -mno-split-addresses
4375 Generate code to load the high and low parts of address constants separately.
4376 This allows @code{gcc} to optimize away redundant loads of the high order
4377 bits of addresses.  This optimization requires GNU as and GNU ld.
4378 This optimization is enabled by default for some embedded targets where
4379 GNU as and GNU ld are standard.
4380
4381 @item -mrnames
4382 @itemx -mno-rnames
4383 The @samp{-mrnames} switch says to output code using the MIPS software
4384 names for the registers, instead of the hardware names (ie, @var{a0}
4385 instead of @var{$4}).  The only known assembler that supports this option
4386 is the Algorithmics assembler.
4387
4388 @item -mgpopt
4389 @itemx -mno-gpopt
4390 The @samp{-mgpopt} switch says to write all of the data declarations
4391 before the instructions in the text section, this allows the MIPS
4392 assembler to generate one word memory references instead of using two
4393 words for short global or static data items.  This is on by default if
4394 optimization is selected.
4395
4396 @item -mstats
4397 @itemx -mno-stats
4398 For each non-inline function processed, the @samp{-mstats} switch
4399 causes the compiler to emit one line to the standard error file to
4400 print statistics about the program (number of registers saved, stack
4401 size, etc.).
4402
4403 @item -mmemcpy
4404 @itemx -mno-memcpy
4405 The @samp{-mmemcpy} switch makes all block moves call the appropriate
4406 string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
4407 generating inline code.
4408
4409 @item -mmips-tfile
4410 @itemx -mno-mips-tfile
4411 The @samp{-mno-mips-tfile} switch causes the compiler not
4412 postprocess the object file with the @file{mips-tfile} program,
4413 after the MIPS assembler has generated it to add debug support.  If
4414 @file{mips-tfile} is not run, then no local variables will be
4415 available to the debugger.  In addition, @file{stage2} and
4416 @file{stage3} objects will have the temporary file names passed to the
4417 assembler embedded in the object file, which means the objects will
4418 not compare the same.  The @samp{-mno-mips-tfile} switch should only
4419 be used when there are bugs in the @file{mips-tfile} program that
4420 prevents compilation.
4421
4422 @item -msoft-float
4423 Generate output containing library calls for floating point.
4424 @strong{Warning:} the requisite libraries are not part of GNU CC.
4425 Normally the facilities of the machine's usual C compiler are used, but
4426 this can't be done directly in cross-compilation.  You must make your
4427 own arrangements to provide suitable library functions for
4428 cross-compilation.
4429
4430 @item -mhard-float
4431 Generate output containing floating point instructions.  This is the
4432 default if you use the unmodified sources.
4433
4434 @item -mabicalls
4435 @itemx -mno-abicalls
4436 Emit (or do not emit) the pseudo operations @samp{.abicalls},
4437 @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
4438 position independent code.
4439
4440 @item -mlong-calls
4441 @itemx -mno-long-calls
4442 Do all calls with the @samp{JALR} instruction, which requires
4443 loading up a function's address into a register before the call.
4444 You need to use this switch, if you call outside of the current
4445 512 megabyte segment to functions that are not through pointers.
4446
4447 @item -mhalf-pic
4448 @itemx -mno-half-pic
4449 Put pointers to extern references into the data section and load them
4450 up, rather than put the references in the text section.
4451
4452 @item -membedded-pic
4453 @itemx -mno-embedded-pic
4454 Generate PIC code suitable for some embedded systems.  All calls are made
4455 using PC relative address, and all data is addressed using the $gp register.
4456 This requires GNU as and GNU ld which do most of the work.
4457
4458 @item -membedded-data
4459 @itemx -mno-embedded-data
4460 Allocate variables to the read-only data section first if possible, then
4461 next in the small data section if possible, otherwise in data.  This gives
4462 slightly slower code than the default, but reduces the amount of RAM required
4463 when executing, and thus may be preferred for some embedded systems.
4464
4465 @item -msingle-float
4466 @itemx -mdouble-float
4467 The @samp{-msingle-float} switch tells gcc to assume that the floating
4468 point coprocessor only supports single precision operations, as on the
4469 @samp{r4650} chip.  The @samp{-mdouble-float} switch permits gcc to use
4470 double precision operations.  This is the default.
4471
4472 @item -mmad
4473 @itemx -mno-mad
4474 Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
4475 as on the @samp{r4650} chip.
4476
4477 @item -m4650
4478 Turns on @samp{-msingle-float}, @samp{-mmad}, and, at least for now,
4479 @samp{-mcpu=r4650}.
4480
4481 @item -EL
4482 Compile code for the processor in little endian mode.
4483 The requisite libraries are assumed to exist.
4484
4485 @item -EB
4486 Compile code for the processor in big endian mode.
4487 The requisite libraries are assumed to exist.
4488
4489 @item -G @var{num}
4490 @cindex smaller data references (MIPS)
4491 @cindex gp-relative references (MIPS)
4492 Put global and static items less than or equal to @var{num} bytes into
4493 the small data or bss sections instead of the normal data or bss
4494 section.  This allows the assembler to emit one word memory reference
4495 instructions based on the global pointer (@var{gp} or @var{$28}),
4496 instead of the normal two words used.  By default, @var{num} is 8 when
4497 the MIPS assembler is used, and 0 when the GNU assembler is used.  The
4498 @samp{-G @var{num}} switch is also passed to the assembler and linker.
4499 All modules should be compiled with the same @samp{-G @var{num}}
4500 value.
4501
4502 @item -nocpp
4503 Tell the MIPS assembler to not run it's preprocessor over user
4504 assembler files (with a @samp{.s} suffix) when assembling them.
4505 @end table
4506
4507 @ifset INTERNALS
4508 These options are defined by the macro
4509 @code{TARGET_SWITCHES} in the machine description.  The default for the
4510 options is also defined by that macro, which enables you to change the
4511 defaults.
4512 @end ifset
4513
4514 @node i386 Options
4515 @subsection Intel 386 Options
4516 @cindex i386 Options
4517 @cindex Intel 386 Options
4518
4519 These @samp{-m} options are defined for the i386 family of computers:
4520
4521 @table @code
4522 @item -mcpu=@var{cpu type}
4523 Assume the defaults for the machine type @var{cpu type} when scheduling
4524 instructions.  The choices for @var{cpu type} are: @samp{i386},
4525 @samp{i486}, @samp{i586} (@samp{pentium}), @samp{pentium}, @samp{i686}
4526 (@samp{pentiumpro}) and @samp{pentiumpro}. While picking a specific
4527 @var{cpu type} will schedule things appropriately for that particular
4528 chip, the compiler will not generate any code that does not run on the
4529 i386 without the @samp{-march=@var{cpu type}} option being used.
4530
4531 @item -march=@var{cpu type}
4532 Generate instructions for the machine type @var{cpu type}.  The choices
4533 for @var{cpu type} are: @samp{i386}, @samp{i486}, @samp{pentium}, and
4534 @samp{pentiumpro}.  Specifying @samp{-march=@var{cpu type}} implies
4535 @samp{-mcpu=@var{cpu type}}.
4536
4537 @item -m386
4538 @itemx -m486
4539 @itemx -mpentium
4540 @itemx -mpentiumpro
4541 Synonyms for -mcpu=i386, -mcpu=i486, -mcpu=pentium, and -mcpu=pentiumpro
4542 respectively.
4543
4544 @item -mieee-fp
4545 @itemx -mno-ieee-fp
4546 Control whether or not the compiler uses IEEE floating point
4547 comparisons.  These handle correctly the case where the result of a
4548 comparison is unordered.
4549
4550 @item -msoft-float
4551 Generate output containing library calls for floating point.
4552 @strong{Warning:} the requisite libraries are not part of GNU CC.
4553 Normally the facilities of the machine's usual C compiler are used, but
4554 this can't be done directly in cross-compilation.  You must make your
4555 own arrangements to provide suitable library functions for
4556 cross-compilation.
4557
4558 On machines where a function returns floating point results in the 80387
4559 register stack, some floating point opcodes may be emitted even if
4560 @samp{-msoft-float} is used.
4561
4562 @item -mno-fp-ret-in-387
4563 Do not use the FPU registers for return values of functions.
4564
4565 The usual calling convention has functions return values of types
4566 @code{float} and @code{double} in an FPU register, even if there
4567 is no FPU.  The idea is that the operating system should emulate
4568 an FPU.
4569
4570 The option @samp{-mno-fp-ret-in-387} causes such values to be returned
4571 in ordinary CPU registers instead.
4572
4573 @item -mno-fancy-math-387
4574 Some 387 emulators do not support the @code{sin}, @code{cos} and
4575 @code{sqrt} instructions for the 387.  Specify this option to avoid
4576 generating those instructions. This option is the default on FreeBSD.
4577 As of revision 2.6.1, these instructions are not generated unless you
4578 also use the @samp{-ffast-math} switch.
4579
4580 @item -malign-double
4581 @itemx -mno-align-double
4582 Control whether GNU CC aligns @code{double}, @code{long double}, and
4583 @code{long long} variables on a two word boundary or a one word
4584 boundary.  Aligning @code{double} variables on a two word boundary will
4585 produce code that runs somewhat faster on a @samp{Pentium} at the
4586 expense of more memory.
4587
4588 @strong{Warning:} if you use the @samp{-malign-double} switch,
4589 structures containing the above types will be aligned differently than
4590 the published application binary interface specifications for the 386.
4591
4592 @item -msvr3-shlib
4593 @itemx -mno-svr3-shlib
4594 Control whether GNU CC places uninitialized locals into @code{bss} or
4595 @code{data}.  @samp{-msvr3-shlib} places these locals into @code{bss}.
4596 These options are meaningful only on System V Release 3.
4597
4598 @item -mno-wide-multiply
4599 @itemx -mwide-multiply
4600 Control whether GNU CC uses the @code{mul} and @code{imul} that produce
4601 64 bit results in @code{eax:edx} from 32 bit operands to do @code{long
4602 long} multiplies and 32-bit division by constants.
4603
4604 @item -mrtd
4605 Use a different function-calling convention, in which functions that
4606 take a fixed number of arguments return with the @code{ret} @var{num}
4607 instruction, which pops their arguments while returning.  This saves one
4608 instruction in the caller since there is no need to pop the arguments
4609 there.
4610
4611 You can specify that an individual function is called with this calling
4612 sequence with the function attribute @samp{stdcall}.  You can also
4613 override the @samp{-mrtd} option by using the function attribute
4614 @samp{cdecl}. @xref{Function Attributes}
4615
4616 @strong{Warning:} this calling convention is incompatible with the one
4617 normally used on Unix, so you cannot use it if you need to call
4618 libraries compiled with the Unix compiler.
4619
4620 Also, you must provide function prototypes for all functions that
4621 take variable numbers of arguments (including @code{printf});
4622 otherwise incorrect code will be generated for calls to those
4623 functions.
4624
4625 In addition, seriously incorrect code will result if you call a
4626 function with too many arguments.  (Normally, extra arguments are
4627 harmlessly ignored.)
4628
4629 @item -mreg-alloc=@var{regs}
4630 Control the default allocation order of integer registers.  The
4631 string @var{regs} is a series of letters specifying a register.  The
4632 supported letters are: @code{a} allocate EAX; @code{b} allocate EBX;
4633 @code{c} allocate ECX; @code{d} allocate EDX; @code{S} allocate ESI;
4634 @code{D} allocate EDI; @code{B} allocate EBP.
4635
4636 @item -mregparm=@var{num}
4637 Control how many registers are used to pass integer arguments.  By
4638 default, no registers are used to pass arguments, and at most 3
4639 registers can be used.  You can control this behavior for a specific
4640 function by using the function attribute @samp{regparm}.   @xref{Function Attributes}
4641
4642 @strong{Warning:} if you use this switch, and
4643 @var{num} is nonzero, then you must build all modules with the same
4644 value, including any libraries.  This includes the system libraries and
4645 startup modules.
4646
4647 @item -malign-loops=@var{num}
4648 Align loops to a 2 raised to a @var{num} byte boundary.  If
4649 @samp{-malign-loops} is not specified, the default is 2.
4650
4651 @item -malign-jumps=@var{num}
4652 Align instructions that are only jumped to to a 2 raised to a @var{num}
4653 byte boundary.  If @samp{-malign-jumps} is not specified, the default is
4654 2 if optimizing for a 386, and 4 if optimizing for a 486.
4655
4656 @item -malign-functions=@var{num}
4657 Align the start of functions to a 2 raised to @var{num} byte boundary.
4658 If @samp{-malign-functions} is not specified, the default is 2 if optimizing
4659 for a 386, and 4 if optimizing for a 486.
4660 @end table
4661
4662 @node HPPA Options
4663 @subsection HPPA Options
4664 @cindex HPPA Options
4665
4666 These @samp{-m} options are defined for the HPPA family of computers:
4667
4668 @table @code
4669 @item -mpa-risc-1-0
4670 Generate code for a PA 1.0 processor.
4671
4672 @item -mpa-risc-1-1
4673 Generate code for a PA 1.1 processor.
4674
4675 @item -mbig-switch
4676 Generate code suitable for big switch tables.  Use this option only if
4677 the assembler/linker complain about out of range branches within a switch
4678 table.
4679
4680 @item -mjump-in-delay
4681 Fill delay slots of function calls with unconditional jump instructions
4682 by modifying the return pointer for the function call to be the target
4683 of the conditional jump.
4684
4685 @item -mdisable-fpregs
4686 Prevent floating point registers from being used in any manner.  This is
4687 necessary for compiling kernels which perform lazy context switching of
4688 floating point registers.  If you use this option and attempt to perform
4689 floating point operations, the compiler will abort.
4690
4691 @item -mdisable-indexing
4692 Prevent the compiler from using indexing address modes.  This avoids some
4693 rather obscure problems when compiling MIG generated code under MACH.
4694
4695 @item -mno-space-regs
4696 Generate code that assumes the target has no space registers.  This allows
4697 GCC to generate faster indirect calls and use unscaled index address modes.
4698
4699 Such code is suitable for level 0 PA systems and kernels.
4700
4701 @item -mfast-indirect-calls
4702 Generate code that assumes calls never cross space boundaries.  This
4703 allows GCC to emit code which performs faster indirect calls.
4704
4705 This option will not work in the presense of shared libraries or nested
4706 functions.
4707
4708 @item -mspace
4709 Optimize for space rather than execution time.  Currently this only
4710 enables out of line function prologues and epilogues.  This option is
4711 incompatable with PIC code generation and profiling.
4712
4713 @item -mlong-load-store
4714 Generate 3-instruction load and store sequences as sometimes required by
4715 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
4716 the HP compilers.
4717
4718 @item -mportable-runtime
4719 Use the portable calling conventions proposed by HP for ELF systems.
4720
4721 @item -mgas
4722 Enable the use of assembler directives only GAS understands.
4723
4724 @item -mschedule=@var{cpu type}
4725 Schedule code according to the constraints for the machine type
4726 @var{cpu type}.  The choices for @var{cpu type} are @samp{700} for
4727 7@var{n}0 machines, @samp{7100} for 7@var{n}5 machines, and @samp{7100}
4728 for 7@var{n}2 machines.  @samp{7100} is the default for @var{cpu type}.
4729
4730 Note the @samp{7100LC} scheduling information is incomplete and using
4731 @samp{7100LC} often leads to bad schedules.  For now it's probably best
4732 to use @samp{7100} instead of @samp{7100LC} for the 7@var{n}2 machines.
4733
4734 @item -mlinker-opt
4735 Enable the optimization pass in the HPUX linker.  Note this makes symbolic
4736 debugging impossible.  It also triggers a bug in the HPUX 8 and HPUX 9 linkers
4737 in which they give bogus error messages when linking some programs.
4738
4739 @item -msoft-float
4740 Generate output containing library calls for floating point.
4741 @strong{Warning:} the requisite libraries are not available for all HPPA
4742 targets.  Normally the facilities of the machine's usual C compiler are
4743 used, but this cannot be done directly in cross-compilation.  You must make
4744 your own arrangements to provide suitable library functions for
4745 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
4746 does provide software floating point support.
4747
4748 @samp{-msoft-float} changes the calling convention in the output file;
4749 therefore, it is only useful if you compile @emph{all} of a program with
4750 this option.  In particular, you need to compile @file{libgcc.a}, the
4751 library that comes with GNU CC, with @samp{-msoft-float} in order for
4752 this to work.
4753 @end table
4754
4755 @node Intel 960 Options
4756 @subsection Intel 960 Options
4757
4758 These @samp{-m} options are defined for the Intel 960 implementations:
4759
4760 @table @code
4761 @item -m@var{cpu type}
4762 Assume the defaults for the machine type @var{cpu type} for some of
4763 the other options, including instruction scheduling, floating point
4764 support, and addressing modes.  The choices for @var{cpu type} are
4765 @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
4766 @samp{sa}, and @samp{sb}.
4767 The default is
4768 @samp{kb}.
4769
4770 @item -mnumerics
4771 @itemx -msoft-float
4772 The @samp{-mnumerics} option indicates that the processor does support
4773 floating-point instructions.  The @samp{-msoft-float} option indicates
4774 that floating-point support should not be assumed.
4775
4776 @item -mleaf-procedures
4777 @itemx -mno-leaf-procedures
4778 Do (or do not) attempt to alter leaf procedures to be callable with the
4779 @code{bal} instruction as well as @code{call}.  This will result in more
4780 efficient code for explicit calls when the @code{bal} instruction can be
4781 substituted by the assembler or linker, but less efficient code in other
4782 cases, such as calls via function pointers, or using a linker that doesn't
4783 support this optimization.
4784
4785 @item -mtail-call
4786 @itemx -mno-tail-call
4787 Do (or do not) make additional attempts (beyond those of the
4788 machine-independent portions of the compiler) to optimize tail-recursive
4789 calls into branches.  You may not want to do this because the detection of
4790 cases where this is not valid is not totally complete.  The default is
4791 @samp{-mno-tail-call}.
4792
4793 @item -mcomplex-addr
4794 @itemx -mno-complex-addr
4795 Assume (or do not assume) that the use of a complex addressing mode is a
4796 win on this implementation of the i960.  Complex addressing modes may not
4797 be worthwhile on the K-series, but they definitely are on the C-series.
4798 The default is currently @samp{-mcomplex-addr} for all processors except
4799 the CB and CC.
4800
4801 @item -mcode-align
4802 @itemx -mno-code-align
4803 Align code to 8-byte boundaries for faster fetching (or don't bother).
4804 Currently turned on by default for C-series implementations only.
4805
4806 @ignore
4807 @item -mclean-linkage
4808 @itemx -mno-clean-linkage
4809 These options are not fully implemented.
4810 @end ignore
4811
4812 @item -mic-compat
4813 @itemx -mic2.0-compat
4814 @itemx -mic3.0-compat
4815 Enable compatibility with iC960 v2.0 or v3.0.
4816
4817 @item -masm-compat
4818 @itemx -mintel-asm
4819 Enable compatibility with the iC960 assembler.
4820
4821 @item -mstrict-align
4822 @itemx -mno-strict-align
4823 Do not permit (do permit) unaligned accesses.
4824
4825 @item -mold-align
4826 Enable structure-alignment compatibility with Intel's gcc release version
4827 1.3 (based on gcc 1.37).  This option implies @samp{-mstrict-align}.
4828 @end table
4829
4830 @node DEC Alpha Options
4831 @subsection DEC Alpha Options
4832
4833 These @samp{-m} options are defined for the DEC Alpha implementations:
4834
4835 @table @code
4836 @item -mno-soft-float
4837 @itemx -msoft-float
4838 Use (do not use) the hardware floating-point instructions for
4839 floating-point operations.  When @code{-msoft-float} is specified,
4840 functions in @file{libgcc1.c} will be used to perform floating-point
4841 operations.  Unless they are replaced by routines that emulate the
4842 floating-point operations, or compiled in such a way as to call such
4843 emulations routines, these routines will issue floating-point
4844 operations.   If you are compiling for an Alpha without floating-point
4845 operations, you must ensure that the library is built so as not to call
4846 them.
4847
4848 Note that Alpha implementations without floating-point operations are
4849 required to have floating-point registers.
4850
4851 @item -mfp-reg
4852 @itemx -mno-fp-regs
4853 Generate code that uses (does not use) the floating-point register set.
4854 @code{-mno-fp-regs} implies @code{-msoft-float}.  If the floating-point
4855 register set is not used, floating point operands are passed in integer
4856 registers as if they were integers and floating-point results are passed
4857 in $0 instead of $f0.  This is a non-standard calling sequence, so any
4858 function with a floating-point argument or return value called by code
4859 compiled with @code{-mno-fp-regs} must also be compiled with that
4860 option.
4861
4862 A typical use of this option is building a kernel that does not use,
4863 and hence need not save and restore, any floating-point registers.
4864
4865 @item -mieee
4866 The Alpha architecture implements floating-point hardware optimized for
4867 maximum performance.  It is mostly compliant with the IEEE floating
4868 point standard.  However, for full compliance, software assistance is
4869 required.  This option generates code fully IEEE compliant code
4870 @emph{except} that the @var{inexact flag} is not maintained (see below).
4871 If this option is turned on, the CPP macro @code{_IEEE_FP} is defined
4872 during compilation.  The option is a shorthand for: @samp{-D_IEEE_FP
4873 -mfp-trap-mode=su -mtrap-precision=i -mieee-conformant}.  The resulting
4874 code is less efficient but is able to correctly support denormalized
4875 numbers and exceptional IEEE values such as not-a-number and plus/minus
4876 infinity.  Other Alpha compilers call this option
4877 @code{-ieee_with_no_inexact}.
4878
4879 @item -mieee-with-inexact
4880 @c overfull hbox here --bob 22 jul96
4881 @c original text between ignore ... end ignore
4882 @ignore
4883 This is like @samp{-mieee} except the generated code also maintains the
4884 IEEE @var{inexact flag}.  Turning on this option causes the generated
4885 code to implement fully-compliant IEEE math.  The option is a shorthand
4886 for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus @samp{-mieee-conformant},
4887 @samp{-mfp-trap-mode=sui}, and @samp{-mtrap-precision=i}.  On some Alpha
4888 implementations the resulting code may execute significantly slower than
4889 the code generated by default.  Since there is very little code that
4890 depends on the @var{inexact flag}, you should normally not specify this
4891 option.  Other Alpha compilers call this option
4892 @samp{-ieee_with_inexact}.
4893 @end ignore
4894 @c            changed paragraph
4895 This is like @samp{-mieee} except the generated code also maintains the
4896 IEEE @var{inexact flag}.  Turning on this option causes the generated
4897 code to implement fully-compliant IEEE math.  The option is a shorthand
4898 for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus the three following:
4899 @samp{-mieee-conformant},
4900 @samp{-mfp-trap-mode=sui}, 
4901 and @samp{-mtrap-precision=i}.  
4902 On some Alpha implementations the resulting code may execute
4903 significantly slower than the code generated by default.  Since there
4904 is very little code that depends on the @var{inexact flag}, you should
4905 normally not specify this option.  Other Alpha compilers call this
4906 option @samp{-ieee_with_inexact}.
4907 @c             end changes to prevent overfull hboxes
4908
4909 @item -mfp-trap-mode=@var{trap mode}
4910 This option controls what floating-point related traps are enabled.
4911 Other Alpha compilers call this option @samp{-fptm }@var{trap mode}.
4912 The trap mode can be set to one of four values:
4913
4914 @table @samp
4915 @item n
4916 This is the default (normal) setting.  The only traps that are enabled
4917 are the ones that cannot be disabled in software (e.g., division by zero
4918 trap).
4919
4920 @item u
4921 In addition to the traps enabled by @samp{n}, underflow traps are enabled
4922 as well.
4923
4924 @item su
4925 Like @samp{su}, but the instructions are marked to be safe for software
4926 completion (see Alpha architecture manual for details).
4927
4928 @item sui
4929 Like @samp{su}, but inexact traps are enabled as well.
4930 @end table
4931
4932 @item -mfp-rounding-mode=@var{rounding mode}
4933 Selects the IEEE rounding mode.  Other Alpha compilers call this option
4934 @samp{-fprm }@var{rounding mode}.  The @var{rounding mode} can be one
4935 of:
4936
4937 @table @samp
4938 @item n
4939 Normal IEEE rounding mode.  Floating point numbers are rounded towards
4940 the nearest machine number or towards the even machine number in case
4941 of a tie.
4942
4943 @item m
4944 Round towards minus infinity.
4945
4946 @item c
4947 Chopped rounding mode.  Floating point numbers are rounded towards zero.
4948
4949 @item d
4950 Dynamic rounding mode.  A field in the floating point control register
4951 (@var{fpcr}, see Alpha architecture reference manual) controls the
4952 rounding mode in effect.  The C library initializes this register for
4953 rounding towards plus infinity.  Thus, unless your program modifies the
4954 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.@end table
4955
4956 @item -mtrap-precision=@var{trap precision}
4957 In the Alpha architecture, floating point traps are imprecise.  This
4958 means without software assistance it is impossible to recover from a
4959 floating trap and program execution normally needs to be terminated.
4960 GNU CC can generate code that can assist operating system trap handlers
4961 in determining the exact location that caused a floating point trap.
4962 Depending on the requirements of an application, different levels of
4963 precisions can be selected:
4964
4965 @table @samp
4966 @item p
4967 Program precision.  This option is the default and means a trap handler
4968 can only identify which program caused a floating point exception.
4969
4970 @item f
4971 Function precision.  The trap handler can determine the function that
4972 caused a floating point exception.
4973
4974 @item i
4975 Instruction precision.  The trap handler can determine the exact
4976 instruction that caused a floating point exception.
4977 @end table
4978
4979 Other Alpha compilers provide the equivalent options called
4980 @samp{-scope_safe} and @samp{-resumption_safe}.
4981
4982 @item -mieee-conformant
4983 This option marks the generated code as IEEE conformant.  You must not
4984 use this option unless you also specify @samp{-mtrap-precision=i} and either
4985 @samp{-mfp-trap-mode=su} or @samp{-mfp-trap-mode=sui}.  Its only effect
4986 is to emit the line @samp{.eflag 48} in the function prologue of the
4987 generated assembly file.  Under DEC Unix, this has the effect that
4988 IEEE-conformant math library routines will be linked in.
4989
4990 @item -mbuild-constants
4991 Normally GNU CC examines a 32- or 64-bit integer constant to
4992 see if it can construct it from smaller constants in two or three
4993 instructions.  If it cannot, it will output the constant as a literal and
4994 generate code to load it from the data segement at runtime.
4995
4996 Use this option to require GNU CC to construct @emph{all} integer constants
4997 using code, even if it takes more instructions (the maximum is six).
4998
4999 You would typically use this option to build a shared library dynamic
5000 loader.  Itself a shared library, it must relocate itself in memory
5001 before it can find the variables and constants in its own data segment.
5002 @end table
5003
5004 @node Clipper Options
5005 @subsection Clipper Options
5006
5007 These @samp{-m} options are defined for the Clipper implementations:
5008
5009 @table @code
5010 @item -mc300
5011 Produce code for a C300 Clipper processor. This is the default.
5012
5013 @itemx -mc400
5014 Produce code for a C400 Clipper processor i.e. use floating point
5015 registers f8..f15.
5016 @end table
5017
5018 @node H8/300 Options
5019 @subsection H8/300 Options
5020
5021 These @samp{-m} options are defined for the H8/300 implementations:
5022
5023 @table @code
5024 @item -mrelax
5025 Shorten some address references at link time, when possible; uses the
5026 linker option @samp{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
5027 ld.info, Using ld}, for a fuller description.
5028
5029 @item -mh
5030 Generate code for the H8/300H.
5031
5032 @item -ms
5033 Generate code for the H8/S.
5034
5035 @item -mint32
5036 Make @code{int} data 32 bits by default.
5037
5038 @item -malign-300
5039 On the h8/300h, use the same alignment rules as for the h8/300.
5040 The default for the h8/300h is to align longs and floats on 4 byte boundaries.
5041 @samp{-malign-300} causes them to be aligned on 2 byte boundaries.
5042 This option has no effect on the h8/300.
5043 @end table
5044
5045 @node SH Options
5046 @subsection SH Options
5047
5048 These @samp{-m} options are defined for the SH implementations:
5049
5050 @table @code
5051 @item -m1
5052 Generate code for the SH1.
5053
5054 @item -m2
5055 Generate code for the SH2.
5056
5057 @item -m3
5058 Generate code for the SH3.
5059
5060 @item -m3e
5061 Generate code for the SH3e.
5062
5063 @item -mb
5064 Compile code for the processor in big endian mode.
5065
5066 @item -ml
5067 Compile code for the processor in little endian mode.
5068
5069 @item -mrelax
5070 Shorten some address references at link time, when possible; uses the
5071 linker option @samp{-relax}.
5072 @end table
5073
5074 @node System V Options
5075 @subsection Options for System V
5076
5077 These additional options are available on System V Release 4 for
5078 compatibility with other compilers on those systems:
5079
5080 @table @code
5081 @item -G
5082 Create a shared object.
5083 It is recommended that @samp{-symbolic} or @samp{-shared} be used instead.
5084
5085 @item -Qy
5086 Identify the versions of each tool used by the compiler, in a
5087 @code{.ident} assembler directive in the output.
5088
5089 @item -Qn
5090 Refrain from adding @code{.ident} directives to the output file (this is
5091 the default).
5092
5093 @item -YP,@var{dirs}
5094 Search the directories @var{dirs}, and no others, for libraries
5095 specified with @samp{-l}.
5096
5097 @item -Ym,@var{dir}
5098 Look in the directory @var{dir} to find the M4 preprocessor.
5099 The assembler uses this option.
5100 @c This is supposed to go with a -Yd for predefined M4 macro files, but
5101 @c the generic assembler that comes with Solaris takes just -Ym.
5102 @end table
5103
5104 @node V850 Options
5105 @subsection V850 Options
5106 @cindex V850 Options
5107
5108 These @samp{-m} options are defined for V850 implementations:
5109
5110 @table @code
5111 @item -mlong-calls
5112 @itemx -mno-long-calls
5113 Treat all calls as being far away (near).  If calls are assumed to be
5114 far away, the compiler will always load the functions address up into a
5115 register, and call indirect through the pointer.
5116
5117 @item -mno-ep
5118 @item -mep
5119 Do not optimize (do optimize) basic blocks that use the same index
5120 pointer 4 or more times to copy pointer into the @code{ep} register, and
5121 use the shorter @code{sld} and @code{sst} instructions.  The @samp{-mep}
5122 option is on by default if you optimize.
5123
5124 @item -mno-prolog-function
5125 @itemx -mprolog-function
5126 Do not use (do use) external functions to save and restore registers at
5127 the prolog and epilog of a function.  The external functions are slower,
5128 but use less code space if more than one function saves the same number
5129 of registers.  The @samp{-mprolog-function} option is on by default if
5130 you optimize.
5131
5132 @item -mspace
5133 Try to make the code as small as possible.  At present, this just turns
5134 on the @samp{-mep} and @samp{-mprolog-function} options.
5135
5136 @item -mtda=@var{n}
5137 Put static or global variables whose size is @var{n} bytes or less into
5138 the tiny data area that register @code{ep} points to.  The tiny data
5139 area can hold up to 256 bytes in total (128 bytes for byte references).
5140
5141 @item -msda=@var{n}
5142 Put static or global variables whose size is @var{n} bytes or less into
5143 the small data area that register @code{gp} points to.  The small data
5144 area can hold up to 64 kilobytes.
5145
5146 @item -mzda=@var{n}
5147 Put static or global variables whose size is @var{n} bytes or less into
5148 the first 32 kilobytes of memory.
5149  
5150 @item -mv850
5151 Specify that the target processor is the V850.
5152
5153 @item -mbig-switch
5154 Generate code suitable for big switch tables.  Use this option only if
5155 the assembler/linker complain about out of range branches within a switch
5156 table.
5157 @end table
5158
5159 @node Code Gen Options
5160 @section Options for Code Generation Conventions
5161 @cindex code generation conventions
5162 @cindex options, code generation
5163 @cindex run-time options
5164
5165 These machine-independent options control the interface conventions
5166 used in code generation.
5167
5168 Most of them have both positive and negative forms; the negative form
5169 of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below, only
5170 one of the forms is listed---the one which is not the default.  You
5171 can figure out the other form by either removing @samp{no-} or adding
5172 it.
5173
5174 @table @code
5175 @item -fpcc-struct-return
5176 Return ``short'' @code{struct} and @code{union} values in memory like
5177 longer ones, rather than in registers.  This convention is less
5178 efficient, but it has the advantage of allowing intercallability between
5179 GNU CC-compiled files and files compiled with other compilers.
5180
5181 The precise convention for returning structures in memory depends
5182 on the target configuration macros.
5183
5184 Short structures and unions are those whose size and alignment match
5185 that of some integer type.
5186
5187 @item -freg-struct-return
5188 Use the convention that @code{struct} and @code{union} values are
5189 returned in registers when possible.  This is more efficient for small
5190 structures than @samp{-fpcc-struct-return}.
5191
5192 If you specify neither @samp{-fpcc-struct-return} nor its contrary
5193 @samp{-freg-struct-return}, GNU CC defaults to whichever convention is
5194 standard for the target.  If there is no standard convention, GNU CC
5195 defaults to @samp{-fpcc-struct-return}, except on targets where GNU CC
5196 is the principal compiler.  In those cases, we can choose the standard,
5197 and we chose the more efficient register return alternative.
5198
5199 @item -fshort-enums
5200 Allocate to an @code{enum} type only as many bytes as it needs for the
5201 declared range of possible values.  Specifically, the @code{enum} type
5202 will be equivalent to the smallest integer type which has enough room.
5203
5204 @item -fshort-double
5205 Use the same size for @code{double} as for @code{float}.
5206
5207 @item -fshared-data
5208 Requests that the data and non-@code{const} variables of this
5209 compilation be shared data rather than private data.  The distinction
5210 makes sense only on certain operating systems, where shared data is
5211 shared between processes running the same program, while private data
5212 exists in one copy per process.
5213
5214 @item -fno-common
5215 Allocate even uninitialized global variables in the bss section of the
5216 object file, rather than generating them as common blocks.  This has the
5217 effect that if the same variable is declared (without @code{extern}) in
5218 two different compilations, you will get an error when you link them.
5219 The only reason this might be useful is if you wish to verify that the
5220 program will work on other systems which always work this way.
5221
5222 @item -fno-ident
5223 Ignore the @samp{#ident} directive.
5224
5225 @item -fno-gnu-linker
5226 Do not output global initializations (such as C++ constructors and
5227 destructors) in the form used by the GNU linker (on systems where the GNU
5228 linker is the standard method of handling them).  Use this option when
5229 you want to use a non-GNU linker, which also requires using the
5230 @code{collect2} program to make sure the system linker includes
5231 constructors and destructors.  (@code{collect2} is included in the GNU CC
5232 distribution.)  For systems which @emph{must} use @code{collect2}, the
5233 compiler driver @code{gcc} is configured to do this automatically.
5234
5235 @item -finhibit-size-directive
5236 Don't output a @code{.size} assembler directive, or anything else that
5237 would cause trouble if the function is split in the middle, and the
5238 two halves are placed at locations far apart in memory.  This option is
5239 used when compiling @file{crtstuff.c}; you should not need to use it
5240 for anything else.
5241
5242 @item -fverbose-asm
5243 Put extra commentary information in the generated assembly code to
5244 make it more readable.  This option is generally only of use to those
5245 who actually need to read the generated assembly code (perhaps while
5246 debugging the compiler itself).
5247
5248 @samp{-fverbose-asm} is the default.  @samp{-fno-verbose-asm} causes the
5249 extra information to be omitted and is useful when comparing two assembler
5250 files.
5251
5252 @item -fvolatile
5253 Consider all memory references through pointers to be volatile.
5254
5255 @item -fvolatile-global
5256 Consider all memory references to extern and global data items to
5257 be volatile.
5258
5259 @item -fpic
5260 @cindex global offset table
5261 @cindex PIC
5262 Generate position-independent code (PIC) suitable for use in a shared
5263 library, if supported for the target machine.  Such code accesses all
5264 constant addresses through a global offset table (GOT).  The dynamic
5265 loader resolves the GOT entries when the program starts (the dynamic
5266 loader is not part of GNU CC; it is part of the operating system).  If
5267 the GOT size for the linked executable exceeds a machine-specific
5268 maximum size, you get an error message from the linker indicating that
5269 @samp{-fpic} does not work; in that case, recompile with @samp{-fPIC}
5270 instead.  (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
5271 on the m68k and RS/6000.  The 386 has no such limit.)
5272
5273 Position-independent code requires special support, and therefore works
5274 only on certain machines.  For the 386, GNU CC supports PIC for System V
5275 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
5276 position-independent.
5277
5278 @item -fPIC
5279 If supported for the target machine, emit position-independent code,
5280 suitable for dynamic linking and avoiding any limit on the size of the
5281 global offset table.  This option makes a difference on the m68k, m88k,
5282 and the Sparc.
5283
5284 Position-independent code requires special support, and therefore works
5285 only on certain machines.
5286
5287 @item -ffixed-@var{reg}
5288 Treat the register named @var{reg} as a fixed register; generated code
5289 should never refer to it (except perhaps as a stack pointer, frame
5290 pointer or in some other fixed role).
5291
5292 @var{reg} must be the name of a register.  The register names accepted
5293 are machine-specific and are defined in the @code{REGISTER_NAMES}
5294 macro in the machine description macro file.
5295
5296 This flag does not have a negative form, because it specifies a
5297 three-way choice.
5298
5299 @item -fcall-used-@var{reg}
5300 Treat the register named @var{reg} as an allocatable register that is
5301 clobbered by function calls.  It may be allocated for temporaries or
5302 variables that do not live across a call.  Functions compiled this way
5303 will not save and restore the register @var{reg}.
5304
5305 Use of this flag for a register that has a fixed pervasive role in the
5306 machine's execution model, such as the stack pointer or frame pointer,
5307 will produce disastrous results.
5308
5309 This flag does not have a negative form, because it specifies a
5310 three-way choice.
5311
5312 @item -fcall-saved-@var{reg}
5313 Treat the register named @var{reg} as an allocatable register saved by
5314 functions.  It may be allocated even for temporaries or variables that
5315 live across a call.  Functions compiled this way will save and restore
5316 the register @var{reg} if they use it.
5317
5318 Use of this flag for a register that has a fixed pervasive role in the
5319 machine's execution model, such as the stack pointer or frame pointer,
5320 will produce disastrous results.
5321
5322 A different sort of disaster will result from the use of this flag for
5323 a register in which function values may be returned.
5324
5325 This flag does not have a negative form, because it specifies a
5326 three-way choice.
5327
5328 @item -fpack-struct
5329 Pack all structure members together without holes.  Usually you would
5330 not want to use this option, since it makes the code suboptimal, and
5331 the offsets of structure members won't agree with system libraries.
5332
5333 @item -fcheck-memory-usage
5334 Generate extra code to check each memory access.  GNU CC will generate
5335 code that is suitable for a detector of bad memory accesses such as
5336 @file{Checker}.  If you specify this option, you can not use the
5337 @code{asm} or @code{__asm__} keywords.
5338
5339 You must also specify this option when you compile functions you call that
5340 have side effects.  If you do not, you may get erronous messages from
5341 the detector.  Normally,  you should compile all your code with this option.
5342 If you use functions from a library that have side-effects (such as
5343 @code{read}), you may not be able to recompile the library and
5344 specify this option.  In that case, you can enable the
5345 @samp{-fprefix-function-name} option, which requests GNU CC to encapsulate
5346 your code and make other functions look as if they were compiled with
5347 @samp{-fcheck-memory-usage}.  This is done by calling ``stubs'',
5348 which are provided by the detector.  If you cannot find or build
5349 stubs for every function you call, you may have to specify
5350 @samp{-fcheck-memory-usage} without @samp{-fprefix-function-name}.
5351
5352 @item -fprefix-function-name
5353 Request GNU CC to add a prefix to the symbols generated for function names.
5354 GNU CC adds a prefix to the names of functions defined as well as
5355 functions called.  Code compiled with this option and code compiled
5356 without the option can't be linked together, unless or stubs are used.
5357
5358 If you compile the following code with @samp{-fprefix-function-name}
5359 @example
5360 extern void bar (int);
5361 void
5362 foo (int a)
5363 @{
5364   return bar (a + 5);
5365
5366 @}
5367 @end example
5368
5369 @noindent
5370 GNU CC will compile the code as if it was written:
5371 @example
5372 extern void prefix_bar (int);
5373 void
5374 prefix_foo (int a)
5375 @{
5376   return prefix_bar (a + 5);
5377 @}
5378 @end example
5379 This option is designed to be used with @samp{-fcheck-memory-usage}.
5380
5381 @item -fstack-check
5382 Generate code to verify that you do not go beyond the boundary of the
5383 stack.  You should specify this flag if you are running in an
5384 environment with multiple threads, but only rarely need to specify it in
5385 a single-threaded environment since stack overflow is automatically
5386 detected on nearly all systems if there is only one stack.
5387
5388 @item +e0
5389 @itemx +e1
5390 Control whether virtual function definitions in classes are used to
5391 generate code, or only to define interfaces for their callers.  (C++
5392 only).
5393
5394 These options are provided for compatibility with @code{cfront} 1.x
5395 usage; the recommended alternative GNU C++ usage is in flux.  @xref{C++
5396 Interface,,Declarations and Definitions in One Header}.
5397
5398 With @samp{+e0}, virtual function definitions in classes are declared
5399 @code{extern}; the declaration is used only as an interface
5400 specification, not to generate code for the virtual functions (in this
5401 compilation).
5402
5403 With @samp{+e1}, G++ actually generates the code implementing virtual
5404 functions defined in the code, and makes them publicly visible.
5405
5406 @cindex aliasing of parameters
5407 @cindex parameters, aliased
5408 @item -fargument-alias
5409 @item -fargument-noalias
5410 @item -fargument-noalias-global
5411 Specify the possible relationships among parameters and between
5412 parameters and global data.
5413
5414 @samp{-fargument-alias} specifies that arguments (parameters) may
5415 alias each other and may alias global storage.
5416 @samp{-fargument-noalias} specifies that arguments do not alias
5417 each other, but may alias global storage.
5418 @samp{-fargument-noalias-global} specifies that arguments do not
5419 alias each other and do not alias global storage.
5420
5421 Each language will automatically use whatever option is required by
5422 the language standard.  You should not need to use these options yourself.
5423 @end table
5424
5425 @node Environment Variables
5426 @section Environment Variables Affecting GNU CC
5427 @cindex environment variables
5428
5429 This section describes several environment variables that affect how GNU
5430 CC operates.  They work by specifying directories or prefixes to use
5431 when searching for various kinds of files.
5432
5433 @ifclear INTERNALS
5434 Note that you can also specify places to search using options such as
5435 @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
5436 take precedence over places specified using environment variables, which
5437 in turn take precedence over those specified by the configuration of GNU
5438 CC.
5439 @end ifclear
5440 @ifset INTERNALS
5441 Note that you can also specify places to search using options such as
5442 @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
5443 take precedence over places specified using environment variables, which
5444 in turn take precedence over those specified by the configuration of GNU
5445 CC.  @xref{Driver}.
5446 @end ifset
5447
5448 @table @code
5449 @item TMPDIR
5450 @findex TMPDIR
5451 If @code{TMPDIR} is set, it specifies the directory to use for temporary
5452 files.  GNU CC uses temporary files to hold the output of one stage of
5453 compilation which is to be used as input to the next stage: for example,
5454 the output of the preprocessor, which is the input to the compiler
5455 proper.
5456
5457 @item GCC_EXEC_PREFIX
5458 @findex GCC_EXEC_PREFIX
5459 If @code{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
5460 names of the subprograms executed by the compiler.  No slash is added
5461 when this prefix is combined with the name of a subprogram, but you can
5462 specify a prefix that ends with a slash if you wish.
5463
5464 If GNU CC cannot find the subprogram using the specified prefix, it
5465 tries looking in the usual places for the subprogram.
5466
5467 The default value of @code{GCC_EXEC_PREFIX} is
5468 @file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
5469 of @code{prefix} when you ran the @file{configure} script.
5470
5471 Other prefixes specified with @samp{-B} take precedence over this prefix.
5472
5473 This prefix is also used for finding files such as @file{crt0.o} that are
5474 used for linking.
5475
5476 In addition, the prefix is used in an unusual way in finding the
5477 directories to search for header files.  For each of the standard
5478 directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
5479 (more precisely, with the value of @code{GCC_INCLUDE_DIR}), GNU CC tries
5480 replacing that beginning with the specified prefix to produce an
5481 alternate directory name.  Thus, with @samp{-Bfoo/}, GNU CC will search
5482 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
5483 These alternate directories are searched first; the standard directories
5484 come next.
5485
5486 @item COMPILER_PATH
5487 @findex COMPILER_PATH
5488 The value of @code{COMPILER_PATH} is a colon-separated list of
5489 directories, much like @code{PATH}.  GNU CC tries the directories thus
5490 specified when searching for subprograms, if it can't find the
5491 subprograms using @code{GCC_EXEC_PREFIX}.
5492
5493 @item LIBRARY_PATH
5494 @findex LIBRARY_PATH
5495 The value of @code{LIBRARY_PATH} is a colon-separated list of
5496 directories, much like @code{PATH}.  When configured as a native compiler,
5497 GNU CC tries the directories thus specified when searching for special
5498 linker files, if it can't find them using @code{GCC_EXEC_PREFIX}.  Linking
5499 using GNU CC also uses these directories when searching for ordinary
5500 libraries for the @samp{-l} option (but directories specified with
5501 @samp{-L} come first).
5502
5503 @item C_INCLUDE_PATH
5504 @itemx CPLUS_INCLUDE_PATH
5505 @itemx OBJC_INCLUDE_PATH
5506 @findex C_INCLUDE_PATH
5507 @findex CPLUS_INCLUDE_PATH
5508 @findex OBJC_INCLUDE_PATH
5509 @c @itemx OBJCPLUS_INCLUDE_PATH
5510 These environment variables pertain to particular languages.  Each
5511 variable's value is a colon-separated list of directories, much like
5512 @code{PATH}.  When GNU CC searches for header files, it tries the
5513 directories listed in the variable for the language you are using, after
5514 the directories specified with @samp{-I} but before the standard header
5515 file directories.
5516
5517 @item DEPENDENCIES_OUTPUT
5518 @findex DEPENDENCIES_OUTPUT
5519 @cindex dependencies for make as output
5520 If this variable is set, its value specifies how to output dependencies
5521 for Make based on the header files processed by the compiler.  This
5522 output looks much like the output from the @samp{-M} option
5523 (@pxref{Preprocessor Options}), but it goes to a separate file, and is
5524 in addition to the usual results of compilation.
5525
5526 The value of @code{DEPENDENCIES_OUTPUT} can be just a file name, in
5527 which case the Make rules are written to that file, guessing the target
5528 name from the source file name.  Or the value can have the form
5529 @samp{@var{file} @var{target}}, in which case the rules are written to
5530 file @var{file} using @var{target} as the target name.
5531 @end table
5532
5533 @node Running Protoize
5534 @section Running Protoize
5535
5536 The program @code{protoize} is an optional part of GNU C.  You can use
5537 it to add prototypes to a program, thus converting the program to ANSI
5538 C in one respect.  The companion program @code{unprotoize} does the
5539 reverse: it removes argument types from any prototypes that are found.
5540
5541 When you run these programs, you must specify a set of source files as
5542 command line arguments.  The conversion programs start out by compiling
5543 these files to see what functions they define.  The information gathered
5544 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
5545
5546 After scanning comes actual conversion.  The specified files are all
5547 eligible to be converted; any files they include (whether sources or
5548 just headers) are eligible as well.
5549
5550 But not all the eligible files are converted.  By default,
5551 @code{protoize} and @code{unprotoize} convert only source and header
5552 files in the current directory.  You can specify additional directories
5553 whose files should be converted with the @samp{-d @var{directory}}
5554 option.  You can also specify particular files to exclude with the
5555 @samp{-x @var{file}} option.  A file is converted if it is eligible, its
5556 directory name matches one of the specified directory names, and its
5557 name within the directory has not been excluded.
5558
5559 Basic conversion with @code{protoize} consists of rewriting most
5560 function definitions and function declarations to specify the types of
5561 the arguments.  The only ones not rewritten are those for varargs
5562 functions.
5563
5564 @code{protoize} optionally inserts prototype declarations at the
5565 beginning of the source file, to make them available for any calls that
5566 precede the function's definition.  Or it can insert prototype
5567 declarations with block scope in the blocks where undeclared functions
5568 are called.
5569
5570 Basic conversion with @code{unprotoize} consists of rewriting most
5571 function declarations to remove any argument types, and rewriting
5572 function definitions to the old-style pre-ANSI form.
5573
5574 Both conversion programs print a warning for any function declaration or
5575 definition that they can't convert.  You can suppress these warnings
5576 with @samp{-q}.
5577
5578 The output from @code{protoize} or @code{unprotoize} replaces the
5579 original source file.  The original file is renamed to a name ending
5580 with @samp{.save}.  If the @samp{.save} file already exists, then
5581 the source file is simply discarded.
5582
5583 @code{protoize} and @code{unprotoize} both depend on GNU CC itself to
5584 scan the program and collect information about the functions it uses.
5585 So neither of these programs will work until GNU CC is installed.
5586
5587 Here is a table of the options you can use with @code{protoize} and
5588 @code{unprotoize}.  Each option works with both programs unless
5589 otherwise stated.
5590
5591 @table @code
5592 @item -B @var{directory}
5593 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
5594 usual directory (normally @file{/usr/local/lib}).  This file contains
5595 prototype information about standard system functions.  This option
5596 applies only to @code{protoize}.
5597
5598 @item -c @var{compilation-options}
5599 Use  @var{compilation-options} as the options when running @code{gcc} to
5600 produce the @samp{.X} files.  The special option @samp{-aux-info} is
5601 always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
5602
5603 Note that the compilation options must be given as a single argument to
5604 @code{protoize} or @code{unprotoize}.  If you want to specify several
5605 @code{gcc} options, you must quote the entire set of compilation options
5606 to make them a single word in the shell.
5607
5608 There are certain @code{gcc} arguments that you cannot use, because they
5609 would produce the wrong kind of output.  These include @samp{-g},
5610 @samp{-O}, @samp{-c}, @samp{-S}, and @samp{-o} If you include these in
5611 the @var{compilation-options}, they are ignored.
5612
5613 @item -C
5614 Rename files to end in @samp{.C} instead of @samp{.c}.
5615 This is convenient if you are converting a C program to C++.
5616 This option applies only to @code{protoize}.
5617
5618 @item -g
5619 Add explicit global declarations.  This means inserting explicit
5620 declarations at the beginning of each source file for each function
5621 that is called in the file and was not declared.  These declarations
5622 precede the first function definition that contains a call to an
5623 undeclared function.  This option applies only to @code{protoize}.
5624
5625 @item -i @var{string}
5626 Indent old-style parameter declarations with the string @var{string}.
5627 This option applies only to @code{protoize}.
5628
5629 @code{unprotoize} converts prototyped function definitions to old-style
5630 function definitions, where the arguments are declared between the
5631 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
5632 uses five spaces as the indentation.  If you want to indent with just
5633 one space instead, use @samp{-i " "}.
5634
5635 @item -k
5636 Keep the @samp{.X} files.  Normally, they are deleted after conversion
5637 is finished.
5638
5639 @item -l
5640 Add explicit local declarations.  @code{protoize} with @samp{-l} inserts
5641 a prototype declaration for each function in each block which calls the
5642 function without any declaration.  This option applies only to
5643 @code{protoize}.
5644
5645 @item -n
5646 Make no real changes.  This mode just prints information about the conversions
5647 that would have been done without @samp{-n}.
5648
5649 @item -N
5650 Make no @samp{.save} files.  The original files are simply deleted.
5651 Use this option with caution.
5652
5653 @item -p @var{program}
5654 Use the program @var{program} as the compiler.  Normally, the name
5655 @file{gcc} is used.
5656
5657 @item -q
5658 Work quietly.  Most warnings are suppressed.
5659
5660 @item -v
5661 Print the version number, just like @samp{-v} for @code{gcc}.
5662 @end table
5663
5664 If you need special compiler options to compile one of your program's
5665 source files, then you should generate that file's @samp{.X} file
5666 specially, by running @code{gcc} on that source file with the
5667 appropriate options and the option @samp{-aux-info}.  Then run
5668 @code{protoize} on the entire set of files.  @code{protoize} will use
5669 the existing @samp{.X} file because it is newer than the source file.
5670 For example:
5671
5672 @example
5673 gcc -Dfoo=bar file1.c -aux-info
5674 protoize *.c
5675 @end example
5676
5677 @noindent
5678 You need to include the special files along with the rest in the
5679 @code{protoize} command, even though their @samp{.X} files already
5680 exist, because otherwise they won't get converted.
5681
5682 @xref{Protoize Caveats}, for more information on how to use
5683 @code{protoize} successfully.
5684