OSDN Git Service

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