OSDN Git Service

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