OSDN Git Service

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