OSDN Git Service

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