OSDN Git Service

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