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