OSDN Git Service

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