OSDN Git Service

2003-09-24 Ziemowit Laski <zlaski@apple.com>
[pf3gnuchains/gcc-fork.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
9 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
10
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.2 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being ``GNU General Public License'' and ``Funding
15 Free Software'', the Front-Cover texts being (a) (see below), and with
16 the Back-Cover Texts being (b) (see below).  A copy of the license is
17 included in the gfdl(7) man page.
18
19 (a) The FSF's Front-Cover Text is:
20
21      A GNU Manual
22
23 (b) The FSF's Back-Cover Text is:
24
25      You have freedom to copy and modify this GNU Manual, like GNU
26      software.  Copies published by the Free Software Foundation raise
27      funds for GNU development.
28 @c man end
29 @c Set file name and title for the man page.
30 @setfilename gcc
31 @settitle GNU project C and C++ compiler
32 @c man begin SYNOPSIS
33 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39     [@option{-o} @var{outfile}] @var{infile}@dots{}
40
41 Only the most useful options are listed here; see below for the
42 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
43 @c man end
44 @c man begin SEEALSO
45 gpl(7), gfdl(7), fsf-funding(7),
46 cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47 and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
48 @file{ld}, @file{binutils} and @file{gdb}.
49 @c man end
50 @c man begin BUGS
51 For instructions on reporting bugs, see
52 @w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
53 script to report bugs is recommended.
54 @c man end
55 @c man begin AUTHOR
56 See the Info entry for @command{gcc}, or
57 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58 for contributors to GCC@.
59 @c man end
60 @end ignore
61
62 @node Invoking GCC
63 @chapter GCC Command Options
64 @cindex GCC command options
65 @cindex command options
66 @cindex options, GCC command
67
68 @c man begin DESCRIPTION
69 When you invoke GCC, it normally does preprocessing, compilation,
70 assembly and linking.  The ``overall options'' allow you to stop this
71 process at an intermediate stage.  For example, the @option{-c} option
72 says not to run the linker.  Then the output consists of object files
73 output by the assembler.
74
75 Other options are passed on to one stage of processing.  Some options
76 control the preprocessor and others the compiler itself.  Yet other
77 options control the assembler and linker; most of these are not
78 documented here, since you rarely need to use any of them.
79
80 @cindex C compilation options
81 Most of the command line options that you can use with GCC are useful
82 for C programs; when an option is only useful with another language
83 (usually C++), the explanation says so explicitly.  If the description
84 for a particular option does not mention a source language, you can use
85 that option with all supported languages.
86
87 @cindex C++ compilation options
88 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
89 options for compiling C++ programs.
90
91 @cindex grouping options
92 @cindex options, grouping
93 The @command{gcc} program accepts options and file names as operands.  Many
94 options have multi-letter names; therefore multiple single-letter options
95 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
96 -r}}.
97
98 @cindex order of options
99 @cindex options, order
100 You can mix options and other arguments.  For the most part, the order
101 you use doesn't matter.  Order does matter when you use several options
102 of the same kind; for example, if you specify @option{-L} more than once,
103 the directories are searched in the order specified.
104
105 Many options have long names starting with @samp{-f} or with
106 @samp{-W}---for example, @option{-fforce-mem},
107 @option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
108 these have both positive and negative forms; the negative form of
109 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
110 only one of these two forms, whichever one is not the default.
111
112 @c man end
113
114 @xref{Option Index}, for an index to GCC's options.
115
116 @menu
117 * Option Summary::      Brief list of all options, without explanations.
118 * Overall Options::     Controlling the kind of output:
119                         an executable, object files, assembler files,
120                         or preprocessed source.
121 * Invoking G++::        Compiling C++ programs.
122 * C Dialect Options::   Controlling the variant of C language compiled.
123 * C++ Dialect Options:: Variations on C++.
124 * Objective-C Dialect Options:: Variations on Objective-C.
125 * Language Independent Options:: Controlling how diagnostics should be
126                         formatted.
127 * Warning Options::     How picky should the compiler be?
128 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
129 * Optimize Options::    How much optimization?
130 * Preprocessor Options:: Controlling header files and macro definitions.
131                          Also, getting dependency information for Make.
132 * Assembler Options::   Passing options to the assembler.
133 * Link Options::        Specifying libraries and so on.
134 * Directory Options::   Where to find header files and libraries.
135                         Where to find the compiler executable files.
136 * Spec Files::          How to pass switches to sub-processes.
137 * Target Options::      Running a cross-compiler, or an old version of GCC.
138 * Submodel Options::    Specifying minor hardware or convention variations,
139                         such as 68010 vs 68020.
140 * Code Gen Options::    Specifying conventions for function calls, data layout
141                         and register usage.
142 * Environment Variables:: Env vars that affect GCC.
143 * Precompiled Headers:: Compiling a header once, and using it many times.
144 * Running Protoize::    Automatically adding or removing function prototypes.
145 @end menu
146
147 @c man begin OPTIONS
148
149 @node Option Summary
150 @section Option Summary
151
152 Here is a summary of all the options, grouped by type.  Explanations are
153 in the following sections.
154
155 @table @emph
156 @item Overall Options
157 @xref{Overall Options,,Options Controlling the Kind of Output}.
158 @gccoptlist{-c  -S  -E  -o @var{file}  -pipe  -pass-exit-codes  @gol
159 -x @var{language}  -v  -###  --help  --target-help  --version}
160
161 @item C Language Options
162 @xref{C Dialect Options,,Options Controlling C Dialect}.
163 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
164 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
165 -fhosted  -ffreestanding  -fms-extensions @gol
166 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
167 -fallow-single-precision  -fcond-mismatch @gol
168 -fsigned-bitfields  -fsigned-char @gol
169 -funsigned-bitfields  -funsigned-char @gol
170 -fwritable-strings}
171
172 @item C++ Language Options
173 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
174 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
175 -fconserve-space  -fno-const-strings @gol
176 -fno-elide-constructors @gol
177 -fno-enforce-eh-specs  -fexternal-templates @gol
178 -falt-external-templates @gol
179 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
180 -fno-implicit-templates @gol
181 -fno-implicit-inline-templates @gol
182 -fno-implement-inlines  -fms-extensions @gol
183 -fno-nonansi-builtins  -fno-operator-names @gol
184 -fno-optional-diags  -fpermissive @gol
185 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
186 -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
187 -fno-default-inline  -Wabi  -Wctor-dtor-privacy @gol
188 -Wnon-virtual-dtor  -Wreorder @gol
189 -Weffc++  -Wno-deprecated @gol
190 -Wno-non-template-friend  -Wold-style-cast @gol
191 -Woverloaded-virtual  -Wno-pmf-conversions @gol
192 -Wsign-promo  -Wsynth}
193
194 @item Objective-C Language Options
195 @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
196 @gccoptlist{
197 -fconstant-string-class=@var{class-name} @gol
198 -fgnu-runtime  -fnext-runtime @gol
199 -fno-nil-receivers @gol
200 -fobjc-exceptions @gol
201 -freplace-objc-classes @gol
202 -fzero-link @gol
203 -gen-decls @gol
204 -Wno-protocol  -Wselector -Wundeclared-selector}
205
206 @item Language Independent Options
207 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
208 @gccoptlist{-fmessage-length=@var{n}  @gol
209 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
210
211 @item Warning Options
212 @xref{Warning Options,,Options to Request or Suppress Warnings}.
213 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
214 -w  -Wextra  -Wall  -Waggregate-return @gol
215 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
216 -Wconversion  -Wno-deprecated-declarations @gol
217 -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
218 -Werror  -Werror-implicit-function-declaration @gol
219 -Wfloat-equal  -Wformat  -Wformat=2 @gol
220 -Wno-format-extra-args -Wformat-nonliteral @gol
221 -Wformat-security  -Wno-format-y2k @gol
222 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
223 -Wimport  -Wno-import  -Winit-self  -Winline @gol
224 -Wno-invalid-offsetof  -Winvalid-pch @gol
225 -Wlarger-than-@var{len}  -Wlong-long @gol
226 -Wmain  -Wmissing-braces @gol
227 -Wmissing-format-attribute  -Wmissing-noreturn @gol
228 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
229 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
230 -Wreturn-type  -Wsequence-point  -Wshadow @gol
231 -Wsign-compare  -Wstrict-aliasing @gol
232 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
233 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
234 -Wunknown-pragmas  -Wunreachable-code @gol
235 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
236 -Wunused-value  -Wunused-variable  -Wwrite-strings}
237
238 @item C-only Warning Options
239 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
240 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
241 -Wstrict-prototypes  -Wtraditional @gol
242 -Wdeclaration-after-statement}
243
244 @item Debugging Options
245 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
246 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
247 -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
248 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
249 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
250 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
251 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
252 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
253 -feliminate-unused-debug-symbols -fmem-report -fprofile-arcs @gol
254 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
255 -ftest-coverage  -ftime-report @gol
256 -g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2 @gol
257 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
258 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
259 -print-multi-directory  -print-multi-lib @gol
260 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
261 -save-temps  -time}
262
263 @item Optimization Options
264 @xref{Optimize Options,,Options that Control Optimization}.
265 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
266 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
267 -fbranch-probabilities -fprofile-values -fbranch-target-load-optimize @gol
268 -fbranch-target-load-optimize2 -fcaller-saves  -fcprop-registers @gol
269 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
270 -fdelayed-branch  -fdelete-null-pointer-checks @gol
271 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
272 -fforce-addr  -fforce-mem  -ffunction-sections @gol
273 -fgcse  -fgcse-lm  -fgcse-sm  -floop-optimize  -fcrossjumping @gol
274 -fif-conversion  -fif-conversion2 @gol
275 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
276 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
277 -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
278 -fno-default-inline  -fno-defer-pop @gol
279 -fno-function-cse  -fno-guess-branch-probability @gol
280 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
281 -funsafe-math-optimizations  -ffinite-math-only @gol
282 -fno-trapping-math  -fno-zero-initialized-in-bss @gol
283 -fomit-frame-pointer  -foptimize-register-move @gol
284 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
285 -freduce-all-givs  -fregmove  -frename-registers @gol
286 -freorder-blocks  -freorder-functions @gol
287 -frerun-cse-after-loop  -frerun-loop-opt @gol
288 -frounding-math -fschedule-insns  -fschedule-insns2 @gol
289 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
290 -fsched-spec-load-dangerous  -fsched2-use-superblocks @gol
291 -fsched2-use-traces  -fsignaling-nans @gol
292 -fsingle-precision-constant  -fssa  -fssa-ccp  -fssa-dce @gol
293 -fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps @gol
294 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
295 -funswitch-loops  -fold-unroll-loops  -fold-unroll-all-loops @gol
296 --param @var{name}=@var{value}
297 -O  -O0  -O1  -O2  -O3  -Os}
298
299 @item Preprocessor Options
300 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
301 @gccoptlist{-A@var{question}=@var{answer} @gol
302 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
303 -C  -dD  -dI  -dM  -dN @gol
304 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
305 -idirafter @var{dir} @gol
306 -include @var{file}  -imacros @var{file} @gol
307 -iprefix @var{file}  -iwithprefix @var{dir} @gol
308 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
309 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
310 -P  -fworking-directory  -remap @gol
311 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
312 -Xpreprocessor @var{option}}
313
314 @item Assembler Option
315 @xref{Assembler Options,,Passing Options to the Assembler}.
316 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
317
318 @item Linker Options
319 @xref{Link Options,,Options for Linking}.
320 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
321 -nostartfiles  -nodefaultlibs  -nostdlib -pie @gol
322 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
323 -Wl,@var{option}  -Xlinker @var{option} @gol
324 -u @var{symbol}}
325
326 @item Directory Options
327 @xref{Directory Options,,Options for Directory Search}.
328 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}}
329
330 @item Target Options
331 @c I wrote this xref this way to avoid overfull hbox. -- rms
332 @xref{Target Options}.
333 @gccoptlist{-V @var{version}  -b @var{machine}}
334
335 @item Machine Dependent Options
336 @xref{Submodel Options,,Hardware Models and Configurations}.
337
338 @emph{M680x0 Options}
339 @gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
340 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
341 -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
342 -malign-int  -mstrict-align}
343
344 @emph{M68hc1x Options}
345 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
346 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
347 -msoft-reg-count=@var{count}}
348
349 @emph{VAX Options}
350 @gccoptlist{-mg  -mgnu  -munix}
351
352 @emph{SPARC Options}
353 @gccoptlist{-mcpu=@var{cpu-type} @gol
354 -mtune=@var{cpu-type} @gol
355 -mcmodel=@var{code-model} @gol
356 -m32  -m64 @gol
357 -mapp-regs  -mbroken-saverestore  -mcypress @gol
358 -mfaster-structs  -mflat @gol
359 -mfpu  -mhard-float  -mhard-quad-float @gol
360 -mimpure-text  -mlittle-endian  -mlive-g0  -mno-app-regs @gol
361 -mno-faster-structs  -mno-flat  -mno-fpu @gol
362 -mno-impure-text  -mno-stack-bias  -mno-unaligned-doubles @gol
363 -msoft-float  -msoft-quad-float  -msparclite  -mstack-bias @gol
364 -msupersparc  -munaligned-doubles  -mv8}
365
366 @emph{ARM Options}
367 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
368 -mapcs-26  -mapcs-32 @gol
369 -mapcs-stack-check  -mno-apcs-stack-check @gol
370 -mapcs-float  -mno-apcs-float @gol
371 -mapcs-reentrant  -mno-apcs-reentrant @gol
372 -msched-prolog  -mno-sched-prolog @gol
373 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
374 -malignment-traps  -mno-alignment-traps @gol
375 -msoft-float  -mhard-float  -mfpe @gol
376 -mthumb-interwork  -mno-thumb-interwork @gol
377 -mcpu=@var{name}  -march=@var{name}  -mfpe=@var{name}  @gol
378 -mstructure-size-boundary=@var{n} @gol
379 -mabort-on-noreturn @gol
380 -mlong-calls  -mno-long-calls @gol
381 -msingle-pic-base  -mno-single-pic-base @gol
382 -mpic-register=@var{reg} @gol
383 -mnop-fun-dllimport @gol
384 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
385 -mpoke-function-name @gol
386 -mthumb  -marm @gol
387 -mtpcs-frame  -mtpcs-leaf-frame @gol
388 -mcaller-super-interworking  -mcallee-super-interworking}
389
390 @emph{MN10200 Options}
391 @gccoptlist{-mrelax}
392
393 @emph{MN10300 Options}
394 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
395 -mam33  -mno-am33 @gol
396 -mam33-2  -mno-am33-2 @gol
397 -mno-crt0  -mrelax}
398
399 @emph{M32R/D Options}
400 @gccoptlist{-m32rx  -m32r  -mcode-model=@var{model-type} @gol
401 -msdata=@var{sdata-type}  -G @var{num}}
402
403 @emph{M88K Options}
404 @gccoptlist{-m88000  -m88100  -m88110  -mbig-pic @gol
405 -mcheck-zero-division  -mhandle-large-shift @gol
406 -midentify-revision  -mno-check-zero-division @gol
407 -mno-ocs-debug-info  -mno-ocs-frame-position @gol
408 -mno-optimize-arg-area  -mno-serialize-volatile @gol
409 -mno-underscores  -mocs-debug-info @gol
410 -mocs-frame-position  -moptimize-arg-area @gol
411 -mserialize-volatile  -mshort-data-@var{num}  -msvr3 @gol
412 -msvr4  -mtrap-large-shift  -muse-div-instruction @gol
413 -mversion-03.00  -mwarn-passed-structs}
414
415 @emph{RS/6000 and PowerPC Options}
416 @gccoptlist{-mcpu=@var{cpu-type} @gol
417 -mtune=@var{cpu-type} @gol
418 -mpower  -mno-power  -mpower2  -mno-power2 @gol
419 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
420 -maltivec  -mno-altivec @gol
421 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
422 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
423 -mnew-mnemonics  -mold-mnemonics @gol
424 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
425 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
426 -malign-power  -malign-natural @gol
427 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
428 -mstring  -mno-string  -mupdate  -mno-update @gol
429 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
430 -mstrict-align  -mno-strict-align  -mrelocatable @gol
431 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
432 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
433 -mdynamic-no-pic @gol
434 -mcall-sysv  -mcall-netbsd @gol
435 -maix-struct-return  -msvr4-struct-return @gol
436 -mabi=altivec  -mabi=no-altivec @gol
437 -mabi=spe  -mabi=no-spe @gol
438 -misel=yes  -misel=no @gol
439 -mspe=yes  -mspe=no @gol
440 -mfloat-gprs=yes  -mfloat-gprs=no @gol
441 -mprototype  -mno-prototype @gol
442 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
443 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
444
445 @emph{Darwin Options}
446 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
447 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
448 -client_name  -compatibility_version  -current_version @gol
449 -dependency-file  -dylib_file  -dylinker_install_name @gol
450 -dynamic  -dynamiclib  -exported_symbols_list @gol
451 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
452 -force_flat_namespace  -headerpad_max_install_names @gol
453 -image_base  -init  -install_name  -keep_private_externs @gol
454 -multi_module  -multiply_defined  -multiply_defined_unused @gol
455 -noall_load  -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
456 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
457 -private_bundle  -read_only_relocs  -sectalign @gol
458 -sectobjectsymbols  -whyload  -seg1addr @gol
459 -sectcreate  -sectobjectsymbols  -sectorder @gol
460 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
461 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
462 -single_module  -static  -sub_library  -sub_umbrella @gol
463 -twolevel_namespace  -umbrella  -undefined @gol
464 -unexported_symbols_list  -weak_reference_mismatches @gol
465 -whatsloaded}
466
467 @emph{RT Options}
468 @gccoptlist{-mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs @gol
469 -mfull-fp-blocks  -mhc-struct-return  -min-line-mul @gol
470 -mminimum-fp-blocks  -mnohc-struct-return}
471
472 @emph{MIPS Options}
473 @gccoptlist{-mabicalls  -march=@var{cpu-type}  -mtune=@var{cpu=type} @gol
474 -mcpu=@var{cpu-type}  -membedded-data  -muninit-const-in-rodata @gol
475 -membedded-pic  -mfp32  -mfp64  -mfused-madd  -mno-fused-madd @gol
476 -mgas  -mgp32  -mgp64  -mhard-float  -mint64  -mips1 @gol
477 -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
478 -mlong64  -mlong32  -mlong-calls  -mmemcpy @gol
479 -mmips-as  -mmips-tfile  -mno-abicalls  -mxgot @gol
480 -mno-embedded-data  -mno-uninit-const-in-rodata @gol
481 -mno-embedded-pic  -mno-long-calls @gol
482 -mno-memcpy  -mno-mips-tfile  -mno-rnames @gol
483 -mrnames  -msoft-float @gol
484 -m4650  -msingle-float  -mmad @gol
485 -EL  -EB  -G @var{num}  -nocpp @gol
486 -mabi=32  -mabi=n32  -mabi=64  -mabi=eabi  -mabi-fake-default @gol
487 -mfix7000  -mfix-sb1  -mno-fix-sb1 @gol
488 -mno-crt0 -mflush-func=@var{func} -mno-flush-func @gol
489 -mbranch-likely -mno-branch-likely}
490
491 @emph{i386 and x86-64 Options}
492 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
493 -mfpmath=@var{unit} @gol
494 -masm=@var{dialect}  -mno-fancy-math-387 @gol
495 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
496 -mno-wide-multiply  -mrtd  -malign-double @gol
497 -mpreferred-stack-boundary=@var{num} @gol
498 -mmmx  -msse  -msse2 -mpni -m3dnow @gol
499 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
500 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
501 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
502 -mno-red-zone -mno-tls-direct-seg-refs @gol
503 -mcmodel=@var{code-model} @gol
504 -m32  -m64}
505
506 @emph{HPPA Options}
507 @gccoptlist{-march=@var{architecture-type} @gol
508 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
509 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
510 -mjump-in-delay -mlinker-opt -mlong-calls @gol
511 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
512 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
513 -mno-jump-in-delay  -mno-long-load-store @gol
514 -mno-portable-runtime  -mno-soft-float @gol
515 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
516 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
517 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
518 -nolibdld  -static  -threads}
519
520 @emph{Intel 960 Options}
521 @gccoptlist{-m@var{cpu-type}  -masm-compat  -mclean-linkage @gol
522 -mcode-align  -mcomplex-addr  -mleaf-procedures @gol
523 -mic-compat  -mic2.0-compat  -mic3.0-compat @gol
524 -mintel-asm  -mno-clean-linkage  -mno-code-align @gol
525 -mno-complex-addr  -mno-leaf-procedures @gol
526 -mno-old-align  -mno-strict-align  -mno-tail-call @gol
527 -mnumerics  -mold-align  -msoft-float  -mstrict-align @gol
528 -mtail-call}
529
530 @emph{DEC Alpha Options}
531 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
532 -mieee  -mieee-with-inexact  -mieee-conformant @gol
533 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
534 -mtrap-precision=@var{mode}  -mbuild-constants @gol
535 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
536 -mbwx  -mmax  -mfix  -mcix @gol
537 -mfloat-vax  -mfloat-ieee @gol
538 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
539 -msmall-text  -mlarge-text @gol
540 -mmemory-latency=@var{time}}
541
542 @emph{DEC Alpha/VMS Options}
543 @gccoptlist{-mvms-return-codes}
544
545 @emph{H8/300 Options}
546 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
547
548 @emph{SH Options}
549 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
550 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
551 -m5-64media  -m5-64media-nofpu @gol
552 -m5-32media  -m5-32media-nofpu @gol
553 -m5-compact  -m5-compact-nofpu @gol
554 -mb  -ml  -mdalign  -mrelax @gol
555 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
556 -mieee  -misize  -mpadstruct  -mspace @gol
557 -mprefergot  -musermode}
558
559 @emph{System V Options}
560 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
561
562 @emph{ARC Options}
563 @gccoptlist{-EB  -EL @gol
564 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
565 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
566
567 @emph{TMS320C3x/C4x Options}
568 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
569 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
570 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
571 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
572
573 @emph{V850 Options}
574 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
575 -mprolog-function  -mno-prolog-function  -mspace @gol
576 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
577 -mapp-regs  -mno-app-regs @gol
578 -mdisable-callt  -mno-disable-callt @gol
579 -mv850e1 @gol
580 -mv850e @gol
581 -mv850  -mbig-switch}
582
583 @emph{NS32K Options}
584 @gccoptlist{-m32032  -m32332  -m32532  -m32081  -m32381 @gol
585 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
586 -mregparam  -mnoregparam  -msb  -mnosb @gol
587 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
588
589 @emph{AVR Options}
590 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
591 -mcall-prologues  -mno-tablejump  -mtiny-stack}
592
593 @emph{MCore Options}
594 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
595 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
596 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
597 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
598 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
599
600 @emph{MMIX Options}
601 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
602 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
603 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
604 -mno-base-addresses  -msingle-exit  -mno-single-exit}
605
606 @emph{IA-64 Options}
607 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
608 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
609 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
610 -minline-float-divide-max-throughput @gol
611 -minline-int-divide-min-latency @gol
612 -minline-int-divide-max-throughput  -mno-dwarf2-asm @gol
613 -mfixed-range=@var{register-range}}
614
615 @emph{D30V Options}
616 @gccoptlist{-mextmem  -mextmemory  -monchip  -mno-asm-optimize @gol
617 -masm-optimize  -mbranch-cost=@var{n}  -mcond-exec=@var{n}}
618
619 @emph{S/390 and zSeries Options}
620 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
621 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
622 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
623 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch}
624
625 @emph{CRIS Options}
626 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
627 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
628 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
629 -mstack-align  -mdata-align  -mconst-align @gol
630 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
631 -melf  -maout  -melinux  -mlinux  -sim  -sim2}
632
633 @emph{PDP-11 Options}
634 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
635 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
636 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
637 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
638 -mbranch-expensive  -mbranch-cheap @gol
639 -msplit  -mno-split  -munix-asm  -mdec-asm}
640
641 @emph{Xstormy16 Options}
642 @gccoptlist{-msim}
643
644 @emph{Xtensa Options}
645 @gccoptlist{-mconst16 -mno-const16 @gol
646 -mfused-madd  -mno-fused-madd @gol
647 -mtext-section-literals  -mno-text-section-literals @gol
648 -mtarget-align  -mno-target-align @gol
649 -mlongcalls  -mno-longcalls}
650
651 @emph{FRV Options}
652 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
653 -mhard-float  -msoft-float @gol
654 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
655 -mdouble  -mno-double @gol
656 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
657 -mlibrary-pic  -macc-4 -macc-8 @gol
658 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
659 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
660 -mvliw-branch  -mno-vliw-branch @gol
661 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
662 -mno-nested-cond-exec  -mtomcat-stats @gol
663 -mcpu=@var{cpu}}
664
665 @item Code Generation Options
666 @xref{Code Gen Options,,Options for Code Generation Conventions}.
667 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
668 -ffixed-@var{reg}  -fexceptions @gol
669 -fnon-call-exceptions  -funwind-tables @gol
670 -fasynchronous-unwind-tables @gol
671 -finhibit-size-directive  -finstrument-functions @gol
672 -fno-common  -fno-ident  -fno-gnu-linker @gol
673 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
674 -freg-struct-return  -fshared-data  -fshort-enums @gol
675 -fshort-double  -fshort-wchar @gol
676 -fverbose-asm  -fpack-struct  -fstack-check @gol
677 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
678 -fargument-alias  -fargument-noalias @gol
679 -fargument-noalias-global  -fleading-underscore @gol
680 -ftls-model=@var{model} @gol
681 -ftrapv  -fwrapv  -fbounds-check}
682 @end table
683
684 @menu
685 * Overall Options::     Controlling the kind of output:
686                         an executable, object files, assembler files,
687                         or preprocessed source.
688 * C Dialect Options::   Controlling the variant of C language compiled.
689 * C++ Dialect Options:: Variations on C++.
690 * Objective-C Dialect Options:: Variations on Objective-C.
691 * Language Independent Options:: Controlling how diagnostics should be
692                         formatted.
693 * Warning Options::     How picky should the compiler be?
694 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
695 * Optimize Options::    How much optimization?
696 * Preprocessor Options:: Controlling header files and macro definitions.
697                          Also, getting dependency information for Make.
698 * Assembler Options::   Passing options to the assembler.
699 * Link Options::        Specifying libraries and so on.
700 * Directory Options::   Where to find header files and libraries.
701                         Where to find the compiler executable files.
702 * Spec Files::          How to pass switches to sub-processes.
703 * Target Options::      Running a cross-compiler, or an old version of GCC.
704 @end menu
705
706 @node Overall Options
707 @section Options Controlling the Kind of Output
708
709 Compilation can involve up to four stages: preprocessing, compilation
710 proper, assembly and linking, always in that order.  GCC is capable of
711 preprocessing and compiling several files either into several
712 assembler input files, or into one assembler input file; then each
713 assembler input file produces an object file, and linking combines all
714 the object files (those newly compiled, and those specified as input)
715 into an executable file.
716
717 @cindex file name suffix
718 For any given input file, the file name suffix determines what kind of
719 compilation is done:
720
721 @table @gcctabopt
722 @item @var{file}.c
723 C source code which must be preprocessed.
724
725 @item @var{file}.i
726 C source code which should not be preprocessed.
727
728 @item @var{file}.ii
729 C++ source code which should not be preprocessed.
730
731 @item @var{file}.m
732 Objective-C source code.  Note that you must link with the library
733 @file{libobjc.a} to make an Objective-C program work.
734
735 @item @var{file}.mi
736 Objective-C source code which should not be preprocessed.
737
738 @item @var{file}.h
739 C or C++ header file to be turned into a precompiled header.
740
741 @item @var{file}.cc
742 @itemx @var{file}.cp
743 @itemx @var{file}.cxx
744 @itemx @var{file}.cpp
745 @itemx @var{file}.CPP
746 @itemx @var{file}.c++
747 @itemx @var{file}.C
748 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
749 the last two letters must both be literally @samp{x}.  Likewise,
750 @samp{.C} refers to a literal capital C@.
751
752 @item @var{file}.hh
753 @itemx @var{file}.H
754 C++ header file to be turned into a precompiled header.
755
756 @item @var{file}.f
757 @itemx @var{file}.for
758 @itemx @var{file}.FOR
759 Fortran source code which should not be preprocessed.
760
761 @item @var{file}.F
762 @itemx @var{file}.fpp
763 @itemx @var{file}.FPP
764 Fortran source code which must be preprocessed (with the traditional
765 preprocessor).
766
767 @item @var{file}.r
768 Fortran source code which must be preprocessed with a RATFOR
769 preprocessor (not included with GCC)@.
770
771 @xref{Overall Options,,Options Controlling the Kind of Output, g77,
772 Using and Porting GNU Fortran}, for more details of the handling of
773 Fortran input files.
774
775 @c FIXME: Descriptions of Java file types.
776 @c @var{file}.java
777 @c @var{file}.class
778 @c @var{file}.zip
779 @c @var{file}.jar
780
781 @item @var{file}.ads
782 Ada source code file which contains a library unit declaration (a
783 declaration of a package, subprogram, or generic, or a generic
784 instantiation), or a library unit renaming declaration (a package,
785 generic, or subprogram renaming declaration).  Such files are also
786 called @dfn{specs}.
787
788 @itemx @var{file}.adb
789 Ada source code file containing a library unit body (a subprogram or
790 package body).  Such files are also called @dfn{bodies}.
791
792 @c GCC also knows about some suffixes for languages not yet included:
793 @c Pascal:
794 @c @var{file}.p
795 @c @var{file}.pas
796
797 @item @var{file}.s
798 Assembler code.
799
800 @item @var{file}.S
801 Assembler code which must be preprocessed.
802
803 @item @var{other}
804 An object file to be fed straight into linking.
805 Any file name with no recognized suffix is treated this way.
806 @end table
807
808 @opindex x
809 You can specify the input language explicitly with the @option{-x} option:
810
811 @table @gcctabopt
812 @item -x @var{language}
813 Specify explicitly the @var{language} for the following input files
814 (rather than letting the compiler choose a default based on the file
815 name suffix).  This option applies to all following input files until
816 the next @option{-x} option.  Possible values for @var{language} are:
817 @example
818 c  c-header  cpp-output
819 c++  c++-header  c++-cpp-output
820 objective-c  objective-c-header  objc-cpp-output
821 assembler  assembler-with-cpp
822 ada
823 f77  f77-cpp-input  ratfor
824 java
825 treelang
826 @end example
827
828 @item -x none
829 Turn off any specification of a language, so that subsequent files are
830 handled according to their file name suffixes (as they are if @option{-x}
831 has not been used at all).
832
833 @item -pass-exit-codes
834 @opindex pass-exit-codes
835 Normally the @command{gcc} program will exit with the code of 1 if any
836 phase of the compiler returns a non-success return code.  If you specify
837 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
838 numerically highest error produced by any phase that returned an error
839 indication.
840 @end table
841
842 If you only want some of the stages of compilation, you can use
843 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
844 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
845 @command{gcc} is to stop.  Note that some combinations (for example,
846 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
847
848 @table @gcctabopt
849 @item -c
850 @opindex c
851 Compile or assemble the source files, but do not link.  The linking
852 stage simply is not done.  The ultimate output is in the form of an
853 object file for each source file.
854
855 By default, the object file name for a source file is made by replacing
856 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
857
858 Unrecognized input files, not requiring compilation or assembly, are
859 ignored.
860
861 @item -S
862 @opindex S
863 Stop after the stage of compilation proper; do not assemble.  The output
864 is in the form of an assembler code file for each non-assembler input
865 file specified.
866
867 By default, the assembler file name for a source file is made by
868 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
869
870 Input files that don't require compilation are ignored.
871
872 @item -E
873 @opindex E
874 Stop after the preprocessing stage; do not run the compiler proper.  The
875 output is in the form of preprocessed source code, which is sent to the
876 standard output.
877
878 Input files which don't require preprocessing are ignored.
879
880 @cindex output file option
881 @item -o @var{file}
882 @opindex o
883 Place output in file @var{file}.  This applies regardless to whatever
884 sort of output is being produced, whether it be an executable file,
885 an object file, an assembler file or preprocessed C code.
886
887 If you specify @option{-o} when compiling more than one input file, or
888 you are producing an executable file as output, all the source files
889 on the command line will be compiled at once.
890
891 If @option{-o} is not specified, the default is to put an executable file
892 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
893 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
894 all preprocessed C source on standard output.
895
896 @item -v
897 @opindex v
898 Print (on standard error output) the commands executed to run the stages
899 of compilation.  Also print the version number of the compiler driver
900 program and of the preprocessor and the compiler proper.
901
902 @item -###
903 @opindex ###
904 Like @option{-v} except the commands are not executed and all command
905 arguments are quoted.  This is useful for shell scripts to capture the
906 driver-generated command lines.
907
908 @item -pipe
909 @opindex pipe
910 Use pipes rather than temporary files for communication between the
911 various stages of compilation.  This fails to work on some systems where
912 the assembler is unable to read from a pipe; but the GNU assembler has
913 no trouble.
914
915 @item --help
916 @opindex help
917 Print (on the standard output) a description of the command line options
918 understood by @command{gcc}.  If the @option{-v} option is also specified
919 then @option{--help} will also be passed on to the various processes
920 invoked by @command{gcc}, so that they can display the command line options
921 they accept.  If the @option{-Wextra} option is also specified then command
922 line options which have no documentation associated with them will also
923 be displayed.
924
925 @item --target-help
926 @opindex target-help
927 Print (on the standard output) a description of target specific command
928 line options for each tool.
929
930 @item --version
931 @opindex version
932 Display the version number and copyrights of the invoked GCC.
933 @end table
934
935 @node Invoking G++
936 @section Compiling C++ Programs
937
938 @cindex suffixes for C++ source
939 @cindex C++ source file suffixes
940 C++ source files conventionally use one of the suffixes @samp{.C},
941 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
942 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
943 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
944 files with these names and compiles them as C++ programs even if you
945 call the compiler the same way as for compiling C programs (usually
946 with the name @command{gcc}).
947
948 @findex g++
949 @findex c++
950 However, C++ programs often require class libraries as well as a
951 compiler that understands the C++ language---and under some
952 circumstances, you might want to compile programs or header files from
953 standard input, or otherwise without a suffix that flags them as C++
954 programs.  You might also like to precompile a C header file with a
955 @samp{.h} extension to be used in C++ compilations.  @command{g++} is a
956 program that calls GCC with the default language set to C++, and
957 automatically specifies linking against the C++ library.  On many
958 systems, @command{g++} is also installed with the name @command{c++}.
959
960 @cindex invoking @command{g++}
961 When you compile C++ programs, you may specify many of the same
962 command-line options that you use for compiling programs in any
963 language; or command-line options meaningful for C and related
964 languages; or options that are meaningful only for C++ programs.
965 @xref{C Dialect Options,,Options Controlling C Dialect}, for
966 explanations of options for languages related to C@.
967 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
968 explanations of options that are meaningful only for C++ programs.
969
970 @node C Dialect Options
971 @section Options Controlling C Dialect
972 @cindex dialect options
973 @cindex language dialect options
974 @cindex options, dialect
975
976 The following options control the dialect of C (or languages derived
977 from C, such as C++ and Objective-C) that the compiler accepts:
978
979 @table @gcctabopt
980 @cindex ANSI support
981 @cindex ISO support
982 @item -ansi
983 @opindex ansi
984 In C mode, support all ISO C90 programs.  In C++ mode,
985 remove GNU extensions that conflict with ISO C++.
986
987 This turns off certain features of GCC that are incompatible with ISO
988 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
989 such as the @code{asm} and @code{typeof} keywords, and
990 predefined macros such as @code{unix} and @code{vax} that identify the
991 type of system you are using.  It also enables the undesirable and
992 rarely used ISO trigraph feature.  For the C compiler,
993 it disables recognition of C++ style @samp{//} comments as well as
994 the @code{inline} keyword.
995
996 The alternate keywords @code{__asm__}, @code{__extension__},
997 @code{__inline__} and @code{__typeof__} continue to work despite
998 @option{-ansi}.  You would not want to use them in an ISO C program, of
999 course, but it is useful to put them in header files that might be included
1000 in compilations done with @option{-ansi}.  Alternate predefined macros
1001 such as @code{__unix__} and @code{__vax__} are also available, with or
1002 without @option{-ansi}.
1003
1004 The @option{-ansi} option does not cause non-ISO programs to be
1005 rejected gratuitously.  For that, @option{-pedantic} is required in
1006 addition to @option{-ansi}.  @xref{Warning Options}.
1007
1008 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1009 option is used.  Some header files may notice this macro and refrain
1010 from declaring certain functions or defining certain macros that the
1011 ISO standard doesn't call for; this is to avoid interfering with any
1012 programs that might use these names for other things.
1013
1014 Functions which would normally be built in but do not have semantics
1015 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1016 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1017 built-in functions provided by GCC}, for details of the functions
1018 affected.
1019
1020 @item -std=
1021 @opindex std
1022 Determine the language standard.  This option is currently only
1023 supported when compiling C or C++.  A value for this option must be
1024 provided; possible values are
1025
1026 @table @samp
1027 @item c89
1028 @itemx iso9899:1990
1029 ISO C90 (same as @option{-ansi}).
1030
1031 @item iso9899:199409
1032 ISO C90 as modified in amendment 1.
1033
1034 @item c99
1035 @itemx c9x
1036 @itemx iso9899:1999
1037 @itemx iso9899:199x
1038 ISO C99.  Note that this standard is not yet fully supported; see
1039 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1040 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1041
1042 @item gnu89
1043 Default, ISO C90 plus GNU extensions (including some C99 features).
1044
1045 @item gnu99
1046 @item gnu9x
1047 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1048 this will become the default.  The name @samp{gnu9x} is deprecated.
1049
1050 @item c++98
1051 The 1998 ISO C++ standard plus amendments.
1052
1053 @item gnu++98
1054 The same as @option{-std=c++98} plus GNU extensions.  This is the
1055 default for C++ code.
1056 @end table
1057
1058 Even when this option is not specified, you can still use some of the
1059 features of newer standards in so far as they do not conflict with
1060 previous C standards.  For example, you may use @code{__restrict__} even
1061 when @option{-std=c99} is not specified.
1062
1063 The @option{-std} options specifying some version of ISO C have the same
1064 effects as @option{-ansi}, except that features that were not in ISO C90
1065 but are in the specified version (for example, @samp{//} comments and
1066 the @code{inline} keyword in ISO C99) are not disabled.
1067
1068 @xref{Standards,,Language Standards Supported by GCC}, for details of
1069 these standard versions.
1070
1071 @item -aux-info @var{filename}
1072 @opindex aux-info
1073 Output to the given filename prototyped declarations for all functions
1074 declared and/or defined in a translation unit, including those in header
1075 files.  This option is silently ignored in any language other than C@.
1076
1077 Besides declarations, the file indicates, in comments, the origin of
1078 each declaration (source file and line), whether the declaration was
1079 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1080 @samp{O} for old, respectively, in the first character after the line
1081 number and the colon), and whether it came from a declaration or a
1082 definition (@samp{C} or @samp{F}, respectively, in the following
1083 character).  In the case of function definitions, a K&R-style list of
1084 arguments followed by their declarations is also provided, inside
1085 comments, after the declaration.
1086
1087 @item -fno-asm
1088 @opindex fno-asm
1089 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1090 keyword, so that code can use these words as identifiers.  You can use
1091 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1092 instead.  @option{-ansi} implies @option{-fno-asm}.
1093
1094 In C++, this switch only affects the @code{typeof} keyword, since
1095 @code{asm} and @code{inline} are standard keywords.  You may want to
1096 use the @option{-fno-gnu-keywords} flag instead, which has the same
1097 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1098 switch only affects the @code{asm} and @code{typeof} keywords, since
1099 @code{inline} is a standard keyword in ISO C99.
1100
1101 @item -fno-builtin
1102 @itemx -fno-builtin-@var{function}
1103 @opindex fno-builtin
1104 @cindex built-in functions
1105 Don't recognize built-in functions that do not begin with
1106 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1107 functions provided by GCC}, for details of the functions affected,
1108 including those which are not built-in functions when @option{-ansi} or
1109 @option{-std} options for strict ISO C conformance are used because they
1110 do not have an ISO standard meaning.
1111
1112 GCC normally generates special code to handle certain built-in functions
1113 more efficiently; for instance, calls to @code{alloca} may become single
1114 instructions that adjust the stack directly, and calls to @code{memcpy}
1115 may become inline copy loops.  The resulting code is often both smaller
1116 and faster, but since the function calls no longer appear as such, you
1117 cannot set a breakpoint on those calls, nor can you change the behavior
1118 of the functions by linking with a different library.
1119
1120 With the @option{-fno-builtin-@var{function}} option
1121 only the built-in function @var{function} is
1122 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1123 function is named this is not built-in in this version of GCC, this
1124 option is ignored.  There is no corresponding
1125 @option{-fbuiltin-@var{function}} option; if you wish to enable
1126 built-in functions selectively when using @option{-fno-builtin} or
1127 @option{-ffreestanding}, you may define macros such as:
1128
1129 @smallexample
1130 #define abs(n)          __builtin_abs ((n))
1131 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1132 @end smallexample
1133
1134 @item -fhosted
1135 @opindex fhosted
1136 @cindex hosted environment
1137
1138 Assert that compilation takes place in a hosted environment.  This implies
1139 @option{-fbuiltin}.  A hosted environment is one in which the
1140 entire standard library is available, and in which @code{main} has a return
1141 type of @code{int}.  Examples are nearly everything except a kernel.
1142 This is equivalent to @option{-fno-freestanding}.
1143
1144 @item -ffreestanding
1145 @opindex ffreestanding
1146 @cindex hosted environment
1147
1148 Assert that compilation takes place in a freestanding environment.  This
1149 implies @option{-fno-builtin}.  A freestanding environment
1150 is one in which the standard library may not exist, and program startup may
1151 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1152 This is equivalent to @option{-fno-hosted}.
1153
1154 @xref{Standards,,Language Standards Supported by GCC}, for details of
1155 freestanding and hosted environments.
1156
1157 @item -fms-extensions
1158 @opindex fms-extensions
1159 Accept some non-standard constructs used in Microsoft header files.
1160
1161 @item -trigraphs
1162 @opindex trigraphs
1163 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1164 options for strict ISO C conformance) implies @option{-trigraphs}.
1165
1166 @item -no-integrated-cpp
1167 @opindex no-integrated-cpp
1168 Performs a compilation in two passes: preprocessing and compiling.  This
1169 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1170 @option{-B} option. The user supplied compilation step can then add in
1171 an additional preprocessing step after normal preprocessing but before
1172 compiling. The default is to use the integrated cpp (internal cpp)
1173
1174 The semantics of this option will change if "cc1", "cc1plus", and
1175 "cc1obj" are merged.
1176
1177 @cindex traditional C language
1178 @cindex C language, traditional
1179 @item -traditional
1180 @itemx -traditional-cpp
1181 @opindex traditional-cpp
1182 @opindex traditional
1183 Formerly, these options caused GCC to attempt to emulate a pre-standard
1184 C compiler.  They are now only supported with the @option{-E} switch.
1185 The preprocessor continues to support a pre-standard mode.  See the GNU
1186 CPP manual for details.
1187
1188 @item -fcond-mismatch
1189 @opindex fcond-mismatch
1190 Allow conditional expressions with mismatched types in the second and
1191 third arguments.  The value of such an expression is void.  This option
1192 is not supported for C++.
1193
1194 @item -funsigned-char
1195 @opindex funsigned-char
1196 Let the type @code{char} be unsigned, like @code{unsigned char}.
1197
1198 Each kind of machine has a default for what @code{char} should
1199 be.  It is either like @code{unsigned char} by default or like
1200 @code{signed char} by default.
1201
1202 Ideally, a portable program should always use @code{signed char} or
1203 @code{unsigned char} when it depends on the signedness of an object.
1204 But many programs have been written to use plain @code{char} and
1205 expect it to be signed, or expect it to be unsigned, depending on the
1206 machines they were written for.  This option, and its inverse, let you
1207 make such a program work with the opposite default.
1208
1209 The type @code{char} is always a distinct type from each of
1210 @code{signed char} or @code{unsigned char}, even though its behavior
1211 is always just like one of those two.
1212
1213 @item -fsigned-char
1214 @opindex fsigned-char
1215 Let the type @code{char} be signed, like @code{signed char}.
1216
1217 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1218 the negative form of @option{-funsigned-char}.  Likewise, the option
1219 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1220
1221 @item -fsigned-bitfields
1222 @itemx -funsigned-bitfields
1223 @itemx -fno-signed-bitfields
1224 @itemx -fno-unsigned-bitfields
1225 @opindex fsigned-bitfields
1226 @opindex funsigned-bitfields
1227 @opindex fno-signed-bitfields
1228 @opindex fno-unsigned-bitfields
1229 These options control whether a bit-field is signed or unsigned, when the
1230 declaration does not use either @code{signed} or @code{unsigned}.  By
1231 default, such a bit-field is signed, because this is consistent: the
1232 basic integer types such as @code{int} are signed types.
1233
1234 @item -fwritable-strings
1235 @opindex fwritable-strings
1236 Store string constants in the writable data segment and don't uniquize
1237 them.  This is for compatibility with old programs which assume they can
1238 write into string constants.
1239
1240 Writing into string constants is a very bad idea; ``constants'' should
1241 be constant.
1242 @end table
1243
1244 @node C++ Dialect Options
1245 @section Options Controlling C++ Dialect
1246
1247 @cindex compiler options, C++
1248 @cindex C++ options, command line
1249 @cindex options, C++
1250 This section describes the command-line options that are only meaningful
1251 for C++ programs; but you can also use most of the GNU compiler options
1252 regardless of what language your program is in.  For example, you
1253 might compile a file @code{firstClass.C} like this:
1254
1255 @example
1256 g++ -g -frepo -O -c firstClass.C
1257 @end example
1258
1259 @noindent
1260 In this example, only @option{-frepo} is an option meant
1261 only for C++ programs; you can use the other options with any
1262 language supported by GCC@.
1263
1264 Here is a list of options that are @emph{only} for compiling C++ programs:
1265
1266 @table @gcctabopt
1267
1268 @item -fabi-version=@var{n}
1269 @opindex fabi-version
1270 Use version @var{n} of the C++ ABI.  Version 1 is the version of the C++
1271 ABI that first appeared in G++ 3.2.  Version 0 will always be the
1272 version that conforms most closely to the C++ ABI specification.
1273 Therefore, the ABI obtained using version 0 will change as ABI bugs are
1274 fixed.
1275
1276 The default is version 1.
1277
1278 @item -fno-access-control
1279 @opindex fno-access-control
1280 Turn off all access checking.  This switch is mainly useful for working
1281 around bugs in the access control code.
1282
1283 @item -fcheck-new
1284 @opindex fcheck-new
1285 Check that the pointer returned by @code{operator new} is non-null
1286 before attempting to modify the storage allocated.  This check is
1287 normally unnecessary because the C++ standard specifies that
1288 @code{operator new} will only return @code{0} if it is declared
1289 @samp{throw()}, in which case the compiler will always check the
1290 return value even without this option.  In all other cases, when
1291 @code{operator new} has a non-empty exception specification, memory
1292 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1293 @samp{new (nothrow)}.
1294
1295 @item -fconserve-space
1296 @opindex fconserve-space
1297 Put uninitialized or runtime-initialized global variables into the
1298 common segment, as C does.  This saves space in the executable at the
1299 cost of not diagnosing duplicate definitions.  If you compile with this
1300 flag and your program mysteriously crashes after @code{main()} has
1301 completed, you may have an object that is being destroyed twice because
1302 two definitions were merged.
1303
1304 This option is no longer useful on most targets, now that support has
1305 been added for putting variables into BSS without making them common.
1306
1307 @item -fno-const-strings
1308 @opindex fno-const-strings
1309 Give string constants type @code{char *} instead of type @code{const
1310 char *}.  By default, G++ uses type @code{const char *} as required by
1311 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1312 actually modify the value of a string constant, unless you also use
1313 @option{-fwritable-strings}.
1314
1315 This option might be removed in a future release of G++.  For maximum
1316 portability, you should structure your code so that it works with
1317 string constants that have type @code{const char *}.
1318
1319 @item -fno-elide-constructors
1320 @opindex fno-elide-constructors
1321 The C++ standard allows an implementation to omit creating a temporary
1322 which is only used to initialize another object of the same type.
1323 Specifying this option disables that optimization, and forces G++ to
1324 call the copy constructor in all cases.
1325
1326 @item -fno-enforce-eh-specs
1327 @opindex fno-enforce-eh-specs
1328 Don't check for violation of exception specifications at runtime.  This
1329 option violates the C++ standard, but may be useful for reducing code
1330 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1331 will still optimize based on the exception specifications.
1332
1333 @item -fexternal-templates
1334 @opindex fexternal-templates
1335
1336 Cause @samp{#pragma interface} and @samp{implementation} to apply to
1337 template instantiation; template instances are emitted or not according
1338 to the location of the template definition.  @xref{Template
1339 Instantiation}, for more information.
1340
1341 This option is deprecated.
1342
1343 @item -falt-external-templates
1344 @opindex falt-external-templates
1345 Similar to @option{-fexternal-templates}, but template instances are
1346 emitted or not according to the place where they are first instantiated.
1347 @xref{Template Instantiation}, for more information.
1348
1349 This option is deprecated.
1350
1351 @item -ffor-scope
1352 @itemx -fno-for-scope
1353 @opindex ffor-scope
1354 @opindex fno-for-scope
1355 If @option{-ffor-scope} is specified, the scope of variables declared in
1356 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1357 as specified by the C++ standard.
1358 If @option{-fno-for-scope} is specified, the scope of variables declared in
1359 a @i{for-init-statement} extends to the end of the enclosing scope,
1360 as was the case in old versions of G++, and other (traditional)
1361 implementations of C++.
1362
1363 The default if neither flag is given to follow the standard,
1364 but to allow and give a warning for old-style code that would
1365 otherwise be invalid, or have different behavior.
1366
1367 @item -fno-gnu-keywords
1368 @opindex fno-gnu-keywords
1369 Do not recognize @code{typeof} as a keyword, so that code can use this
1370 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1371 @option{-ansi} implies @option{-fno-gnu-keywords}.
1372
1373 @item -fno-implicit-templates
1374 @opindex fno-implicit-templates
1375 Never emit code for non-inline templates which are instantiated
1376 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1377 @xref{Template Instantiation}, for more information.
1378
1379 @item -fno-implicit-inline-templates
1380 @opindex fno-implicit-inline-templates
1381 Don't emit code for implicit instantiations of inline templates, either.
1382 The default is to handle inlines differently so that compiles with and
1383 without optimization will need the same set of explicit instantiations.
1384
1385 @item -fno-implement-inlines
1386 @opindex fno-implement-inlines
1387 To save space, do not emit out-of-line copies of inline functions
1388 controlled by @samp{#pragma implementation}.  This will cause linker
1389 errors if these functions are not inlined everywhere they are called.
1390
1391 @item -fms-extensions
1392 @opindex fms-extensions
1393 Disable pedantic warnings about constructs used in MFC, such as implicit
1394 int and getting a pointer to member function via non-standard syntax.
1395
1396 @item -fno-nonansi-builtins
1397 @opindex fno-nonansi-builtins
1398 Disable built-in declarations of functions that are not mandated by
1399 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1400 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1401
1402 @item -fno-operator-names
1403 @opindex fno-operator-names
1404 Do not treat the operator name keywords @code{and}, @code{bitand},
1405 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1406 synonyms as keywords.
1407
1408 @item -fno-optional-diags
1409 @opindex fno-optional-diags
1410 Disable diagnostics that the standard says a compiler does not need to
1411 issue.  Currently, the only such diagnostic issued by G++ is the one for
1412 a name having multiple meanings within a class.
1413
1414 @item -fpermissive
1415 @opindex fpermissive
1416 Downgrade some diagnostics about nonconformant code from errors to
1417 warnings.  Thus, using @option{-fpermissive} will allow some
1418 nonconforming code to compile.
1419
1420 @item -frepo
1421 @opindex frepo
1422 Enable automatic template instantiation at link time.  This option also
1423 implies @option{-fno-implicit-templates}.  @xref{Template
1424 Instantiation}, for more information.
1425
1426 @item -fno-rtti
1427 @opindex fno-rtti
1428 Disable generation of information about every class with virtual
1429 functions for use by the C++ runtime type identification features
1430 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1431 of the language, you can save some space by using this flag.  Note that
1432 exception handling uses the same information, but it will generate it as
1433 needed.
1434
1435 @item -fstats
1436 @opindex fstats
1437 Emit statistics about front-end processing at the end of the compilation.
1438 This information is generally only useful to the G++ development team.
1439
1440 @item -ftemplate-depth-@var{n}
1441 @opindex ftemplate-depth
1442 Set the maximum instantiation depth for template classes to @var{n}.
1443 A limit on the template instantiation depth is needed to detect
1444 endless recursions during template class instantiation.  ANSI/ISO C++
1445 conforming programs must not rely on a maximum depth greater than 17.
1446
1447 @item -fuse-cxa-atexit
1448 @opindex fuse-cxa-atexit
1449 Register destructors for objects with static storage duration with the
1450 @code{__cxa_atexit} function rather than the @code{atexit} function.
1451 This option is required for fully standards-compliant handling of static
1452 destructors, but will only work if your C library supports
1453 @code{__cxa_atexit}.
1454
1455 @item -fno-weak
1456 @opindex fno-weak
1457 Do not use weak symbol support, even if it is provided by the linker.
1458 By default, G++ will use weak symbols if they are available.  This
1459 option exists only for testing, and should not be used by end-users;
1460 it will result in inferior code and has no benefits.  This option may
1461 be removed in a future release of G++.
1462
1463 @item -nostdinc++
1464 @opindex nostdinc++
1465 Do not search for header files in the standard directories specific to
1466 C++, but do still search the other standard directories.  (This option
1467 is used when building the C++ library.)
1468 @end table
1469
1470 In addition, these optimization, warning, and code generation options
1471 have meanings only for C++ programs:
1472
1473 @table @gcctabopt
1474 @item -fno-default-inline
1475 @opindex fno-default-inline
1476 Do not assume @samp{inline} for functions defined inside a class scope.
1477 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1478 functions will have linkage like inline functions; they just won't be
1479 inlined by default.
1480
1481 @item -Wabi @r{(C++ only)}
1482 @opindex Wabi
1483 Warn when G++ generates code that is probably not compatible with the
1484 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1485 all such cases, there are probably some cases that are not warned about, 
1486 even though G++ is generating incompatible code.  There may also be
1487 cases where warnings are emitted even though the code that is generated
1488 will be compatible.
1489
1490 You should rewrite your code to avoid these warnings if you are
1491 concerned about the fact that code generated by G++ may not be binary
1492 compatible with code generated by other compilers.
1493
1494 The known incompatibilities at this point include:
1495
1496 @itemize @bullet
1497
1498 @item
1499 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1500 pack data into the same byte as a base class.  For example:
1501
1502 @smallexample
1503 struct A @{ virtual void f(); int f1 : 1; @};
1504 struct B : public A @{ int f2 : 1; @};
1505 @end smallexample
1506
1507 @noindent
1508 In this case, G++ will place @code{B::f2} into the same byte
1509 as@code{A::f1}; other compilers will not.  You can avoid this problem 
1510 by explicitly padding @code{A} so that its size is a multiple of the
1511 byte size on your platform; that will cause G++ and other compilers to
1512 layout @code{B} identically.
1513
1514 @item
1515 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1516 tail padding when laying out virtual bases.  For example:
1517
1518 @smallexample
1519 struct A @{ virtual void f(); char c1; @};
1520 struct B @{ B(); char c2; @};
1521 struct C : public A, public virtual B @{@};
1522 @end smallexample
1523
1524 @noindent
1525 In this case, G++ will not place @code{B} into the tail-padding for
1526 @code{A}; other compilers will.  You can avoid this problem by
1527 explicitly padding @code{A} so that its size is a multiple of its
1528 alignment (ignoring virtual base classes); that will cause G++ and other
1529 compilers to layout @code{C} identically.
1530
1531 @item
1532 Incorrect handling of bit-fields with declared widths greater than that
1533 of their underlying types, when the bit-fields appear in a union.  For
1534 example:
1535
1536 @smallexample
1537 union U @{ int i : 4096; @};
1538 @end smallexample
1539
1540 @noindent
1541 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1542 union too small by the number of bits in an @code{int}.
1543
1544 @item
1545 Empty classes can be placed at incorrect offsets.  For example:
1546  
1547 @smallexample
1548 struct A @{@};
1549
1550 struct B @{
1551   A a;
1552   virtual void f ();
1553 @};
1554
1555 struct C : public B, public A @{@};
1556 @end smallexample
1557
1558 @noindent
1559 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1560 it should be placed at offset zero.  G++ mistakenly believes that the
1561 @code{A} data member of @code{B} is already at offset zero.
1562
1563 @item
1564 Names of template functions whose types involve @code{typename} or
1565 template template parameters can be mangled incorrectly.
1566
1567 @smallexample
1568 template <typename Q>
1569 void f(typename Q::X) @{@}
1570
1571 template <template <typename> class Q>
1572 void f(typename Q<int>::X) @{@}
1573 @end smallexample
1574
1575 @noindent
1576 Instantiations of these templates may be mangled incorrectly.
1577
1578 @end itemize
1579
1580 @item -Wctor-dtor-privacy @r{(C++ only)}
1581 @opindex Wctor-dtor-privacy
1582 Warn when a class seems unusable because all the constructors or
1583 destructors in that class are private, and it has neither friends nor
1584 public static member functions.
1585
1586 @item -Wnon-virtual-dtor @r{(C++ only)}
1587 @opindex Wnon-virtual-dtor
1588 Warn when a class appears to be polymorphic, thereby requiring a virtual
1589 destructor, yet it declares a non-virtual one.
1590 This warning is enabled by @option{-Wall}.
1591
1592 @item -Wreorder @r{(C++ only)}
1593 @opindex Wreorder
1594 @cindex reordering, warning
1595 @cindex warning for reordering of member initializers
1596 Warn when the order of member initializers given in the code does not
1597 match the order in which they must be executed.  For instance:
1598
1599 @smallexample
1600 struct A @{
1601   int i;
1602   int j;
1603   A(): j (0), i (1) @{ @}
1604 @};
1605 @end smallexample
1606
1607 The compiler will rearrange the member initializers for @samp{i}
1608 and @samp{j} to match the declaration order of the members, emitting
1609 a warning to that effect.  This warning is enabled by @option{-Wall}.
1610 @end table
1611
1612 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1613
1614 @table @gcctabopt
1615 @item -Weffc++ @r{(C++ only)}
1616 @opindex Weffc++
1617 Warn about violations of the following style guidelines from Scott Meyers'
1618 @cite{Effective C++} book:
1619
1620 @itemize @bullet
1621 @item
1622 Item 11:  Define a copy constructor and an assignment operator for classes
1623 with dynamically allocated memory.
1624
1625 @item
1626 Item 12:  Prefer initialization to assignment in constructors.
1627
1628 @item
1629 Item 14:  Make destructors virtual in base classes.
1630
1631 @item
1632 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1633
1634 @item
1635 Item 23:  Don't try to return a reference when you must return an object.
1636
1637 @end itemize
1638
1639 Also warn about violations of the following style guidelines from 
1640 Scott Meyers' @cite{More Effective C++} book:
1641
1642 @itemize @bullet
1643 @item
1644 Item 6:  Distinguish between prefix and postfix forms of increment and
1645 decrement operators.
1646
1647 @item
1648 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1649
1650 @end itemize
1651
1652 When selecting this option, be aware that the standard library
1653 headers do not obey all of these guidelines; use @samp{grep -v}
1654 to filter out those warnings.
1655
1656 @item -Wno-deprecated @r{(C++ only)}
1657 @opindex Wno-deprecated
1658 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1659
1660 @item -Wno-non-template-friend @r{(C++ only)}
1661 @opindex Wno-non-template-friend
1662 Disable warnings when non-templatized friend functions are declared
1663 within a template.  Since the advent of explicit template specification
1664 support in G++, if the name of the friend is an unqualified-id (i.e.,
1665 @samp{friend foo(int)}), the C++ language specification demands that the
1666 friend declare or define an ordinary, nontemplate function.  (Section
1667 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1668 could be interpreted as a particular specialization of a templatized
1669 function.  Because this non-conforming behavior is no longer the default
1670 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1671 check existing code for potential trouble spots and is on by default.
1672 This new compiler behavior can be turned off with
1673 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1674 but disables the helpful warning.
1675
1676 @item -Wold-style-cast @r{(C++ only)}
1677 @opindex Wold-style-cast
1678 Warn if an old-style (C-style) cast to a non-void type is used within
1679 a C++ program.  The new-style casts (@samp{static_cast},
1680 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1681 unintended effects and much easier to search for.
1682
1683 @item -Woverloaded-virtual @r{(C++ only)}
1684 @opindex Woverloaded-virtual
1685 @cindex overloaded virtual fn, warning
1686 @cindex warning for overloaded virtual fn
1687 Warn when a function declaration hides virtual functions from a
1688 base class.  For example, in:
1689
1690 @smallexample
1691 struct A @{
1692   virtual void f();
1693 @};
1694
1695 struct B: public A @{
1696   void f(int);
1697 @};
1698 @end smallexample
1699
1700 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1701 like:
1702
1703 @smallexample
1704 B* b;
1705 b->f();
1706 @end smallexample
1707
1708 will fail to compile.
1709
1710 @item -Wno-pmf-conversions @r{(C++ only)}
1711 @opindex Wno-pmf-conversions
1712 Disable the diagnostic for converting a bound pointer to member function
1713 to a plain pointer.
1714
1715 @item -Wsign-promo @r{(C++ only)}
1716 @opindex Wsign-promo
1717 Warn when overload resolution chooses a promotion from unsigned or
1718 enumeral type to a signed type, over a conversion to an unsigned type of
1719 the same size.  Previous versions of G++ would try to preserve
1720 unsignedness, but the standard mandates the current behavior.
1721
1722 @item -Wsynth @r{(C++ only)}
1723 @opindex Wsynth
1724 @cindex warning for synthesized methods
1725 @cindex synthesized methods, warning
1726 Warn when G++'s synthesis behavior does not match that of cfront.  For
1727 instance:
1728
1729 @smallexample
1730 struct A @{
1731   operator int ();
1732   A& operator = (int);
1733 @};
1734
1735 main ()
1736 @{
1737   A a,b;
1738   a = b;
1739 @}
1740 @end smallexample
1741
1742 In this example, G++ will synthesize a default @samp{A& operator =
1743 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1744 @end table
1745
1746 @node Objective-C Dialect Options
1747 @section Options Controlling Objective-C Dialect
1748
1749 @cindex compiler options, Objective-C
1750 @cindex Objective-C options, command line
1751 @cindex options, Objective-C
1752 (NOTE: This manual does not describe the Objective-C language itself.  See
1753 @w{@uref{http://gcc.gnu.org/readings.html}} for references.)
1754
1755 This section describes the command-line options that are only meaningful
1756 for Objective-C programs, but you can also use most of the GNU compiler
1757 options regardless of what language your program is in.  For example,
1758 you might compile a file @code{some_class.m} like this:
1759
1760 @example
1761 gcc -g -fgnu-runtime -O -c some_class.m
1762 @end example
1763
1764 @noindent
1765 In this example, @option{-fgnu-runtime} is an option meant only for
1766 Objective-C programs; you can use the other options with any language
1767 supported by GCC@.
1768
1769 Here is a list of options that are @emph{only} for compiling Objective-C
1770 programs:
1771
1772 @table @gcctabopt
1773 @item -fconstant-string-class=@var{class-name}
1774 @opindex fconstant-string-class
1775 Use @var{class-name} as the name of the class to instantiate for each
1776 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1777 class name is @code{NXConstantString} if the GNU runtime is being used, and
1778 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1779 @option{-fconstant-cfstrings} option, if also present, will override the
1780 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1781 to be laid out as constant CoreFoundation strings.
1782
1783 @item -fgnu-runtime
1784 @opindex fgnu-runtime
1785 Generate object code compatible with the standard GNU Objective-C
1786 runtime.  This is the default for most types of systems.
1787
1788 @item -fnext-runtime
1789 @opindex fnext-runtime
1790 Generate output compatible with the NeXT runtime.  This is the default
1791 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1792 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1793 used.
1794
1795 @item -fno-nil-receivers
1796 @opindex -fno-nil-receivers
1797 Assume that all Objective-C message dispatches (e.g., 
1798 @code{[receiver message:arg]}) in this translation unit ensure that the receiver 
1799 is not @code{nil}.  This allows for more efficient entry points in the runtime to be 
1800 used.  Currently, this option is only available in conjunciton with 
1801 the NeXT runtime on Mac OS X 10.3 and later.
1802
1803 @item -fobjc-exceptions
1804 @opindex -fobjc-exceptions
1805 Enable syntactic support for structured exception handling in Objective-C, 
1806 similar to what is offered by C++ and Java.  Currently, this option is only 
1807 available in conjunciton with the NeXT runtime on Mac OS X 10.3 and later. 
1808
1809 @smallexample
1810   @@try @{
1811     @dots{}
1812        @@throw expr;
1813     @dots{}
1814   @}
1815   @@catch (AnObjCClass *exc) @{
1816     @dots{}
1817       @@throw expr;
1818     @dots{}
1819       @@throw;
1820     @dots{}
1821   @}
1822   @@catch (AnotherClass *exc) @{
1823     @dots{}
1824   @}
1825   @@catch (id allOthers) @{
1826     @dots{}
1827   @}
1828   @@finally @{
1829     @dots{}
1830       @@throw expr;
1831     @dots{}
1832   @}
1833 @end smallexample
1834
1835 The @code{@@throw} statement may appear anywhere in an Objective-C or
1836 Objective-C++ program; when used inside of a @code{@@catch} block, the 
1837 @code{@@throw} may appear without an argument (as shown above), in which case 
1838 the object caught by the @code{@@catch} will be rethrown.
1839
1840 Note that only (pointers to) Objective-C objects may be thrown and
1841 caught using this scheme.  When an object is thrown, it will be caught
1842 by the nearest @code{@@catch} clause capable of handling objects of that type,
1843 analogously to how @code{catch} blocks work in C++ and Java.  A 
1844 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch 
1845 any and all Objective-C exceptions not caught by previous @code{@@catch}
1846 clauses (if any).
1847
1848 The @code{@@finally} clause, if present, will be executed upon exit from the
1849 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1850 regardless of whether any exceptions are thrown, caught or rethrown
1851 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1852 of the @code{finally} clause in Java.
1853
1854 There are several caveats to using the new exception mechanism:
1855
1856 @itemize @bullet
1857 @item
1858 Although currently designed to be binary compatible with @code{NS_HANDLER}-style 
1859 idioms provided by the @code{NSException} class, the new
1860 exceptions can only be used on Mac OS X 10.3 (Panther) and later
1861 systems, due to additional functionality needed in the (NeXT) Objective-C
1862 runtime.
1863
1864 @item
1865 As mentioned above, the new exceptions do not support handling
1866 types other than Objective-C objects.   Furthermore, when used from 
1867 Objective-C++, the Objective-C exception model does not interoperate with C++
1868 exceptions at this time.  This means you cannot @code{@@throw} an exception
1869 from Objective-C and @code{catch} it in C++, or vice versa 
1870 (i.e., @code{throw @dots{} @@catch}).
1871 @end itemize
1872  
1873 The @option{-fobjc-exceptions} switch also enables the use of synchronization
1874 blocks for thread-safe execution:
1875
1876 @smallexample
1877   @@synchronized (ObjCClass *guard) @{
1878     @dots{}
1879   @}
1880 @end smallexample
1881
1882 Upon entering the @code{@@synchronized} block, a thread of execution shall
1883 first check whether a lock has been placed on the corresponding @code{guard}
1884 object by another thread.  If it has, the current thread shall wait until
1885 the other thread relinquishes its lock.  Once @code{guard} becomes available, 
1886 the current thread will place its own lock on it, execute the code contained in
1887 the @code{@@synchronized} block, and finally relinquish the lock (thereby
1888 making @code{guard} available to other threads).
1889
1890 Unlike Java, Objective-C does not allow for entire methods to be marked
1891 @code{@@synchronized}.  Note that throwing exceptions out of
1892 @code{@@synchronized} blocks is allowed, and will cause the guarding object
1893 to be unlocked properly.
1894
1895 @item -freplace-objc-classes
1896 @opindex -freplace-objc-classes
1897 Emit a special marker instructing @command{ld(1)} not to statically link in
1898 the resulting object file, and allow @command{dyld(1)} to load it in at
1899 run time instead.  This is used in conjunction with the Fix-and-Continue
1900 debugging mode, where the object file in question may be recompiled and 
1901 dynamically reloaded in the course of program execution, without the need
1902 to restart the program itself.  Currently, Fix-and-Continue functionality
1903 is only available in conjunciton withthe NeXT runtime on Mac OS X 10.3 
1904 and later.
1905
1906 @item -fzero-link
1907 @opindex -fzero-link
1908 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1909 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1910 compile time) with static class references that get initialized at load time,
1911 which improves run-time performance.  Specifying the @option{-fzero-link} flag
1912 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
1913 to be retained.  This is useful in Zero-Link debugging mode, since it allows 
1914 for individual class implementations to be modified during program execution.
1915
1916 @item -gen-decls
1917 @opindex gen-decls
1918 Dump interface declarations for all classes seen in the source file to a
1919 file named @file{@var{sourcename}.decl}.
1920
1921 @item -Wno-protocol
1922 @opindex Wno-protocol
1923 If a class is declared to implement a protocol, a warning is issued for
1924 every method in the protocol that is not implemented by the class.  The
1925 default behavior is to issue a warning for every method not explicitly
1926 implemented in the class, even if a method implementation is inherited
1927 from the superclass.  If you use the @code{-Wno-protocol} option, then
1928 methods inherited from the superclass are considered to be implemented,
1929 and no warning is issued for them.
1930
1931 @item -Wselector
1932 @opindex Wselector
1933 Warn if multiple methods of different types for the same selector are
1934 found during compilation.  The check is performed on the list of methods
1935 in the final stage of compilation.  Additionally, a check is performed
1936 for each selector appearing in a @code{@@selector(@dots{})}
1937 expression, and a corresponding method for that selector has been found
1938 during compilation.  Because these checks scan the method table only at
1939 the end of compilation, these warnings are not produced if the final
1940 stage of compilation is not reached, for example because an error is
1941 found during compilation, or because the @code{-fsyntax-only} option is
1942 being used.
1943
1944 @item -Wundeclared-selector
1945 @opindex Wundeclared-selector
1946 Warn if a @code{@@selector(@dots{})} expression referring to an
1947 undeclared selector is found.  A selector is considered undeclared if no
1948 method with that name has been declared before the 
1949 @code{@@selector(@dots{})} expression, either explicitly in an
1950 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
1951 an @code{@@implementation} section.  This option always performs its
1952 checks as soon as a @code{@@selector(@dots{})} expression is found,
1953 while @code{-Wselector} only performs its checks in the final stage of
1954 compilation.  This also enforces the coding style convention
1955 that methods and selectors must be declared before being used.
1956
1957 @c not documented because only avail via -Wp
1958 @c @item -print-objc-runtime-info
1959
1960 @end table
1961
1962 @node Language Independent Options
1963 @section Options to Control Diagnostic Messages Formatting
1964 @cindex options to control diagnostics formatting
1965 @cindex diagnostic messages
1966 @cindex message formatting
1967
1968 Traditionally, diagnostic messages have been formatted irrespective of
1969 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1970 below can be used to control the diagnostic messages formatting
1971 algorithm, e.g.@: how many characters per line, how often source location
1972 information should be reported.  Right now, only the C++ front end can
1973 honor these options.  However it is expected, in the near future, that
1974 the remaining front ends would be able to digest them correctly.
1975
1976 @table @gcctabopt
1977 @item -fmessage-length=@var{n}
1978 @opindex fmessage-length
1979 Try to format error messages so that they fit on lines of about @var{n}
1980 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1981 the front ends supported by GCC@.  If @var{n} is zero, then no
1982 line-wrapping will be done; each error message will appear on a single
1983 line.
1984
1985 @opindex fdiagnostics-show-location
1986 @item -fdiagnostics-show-location=once
1987 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1988 reporter to emit @emph{once} source location information; that is, in
1989 case the message is too long to fit on a single physical line and has to
1990 be wrapped, the source location won't be emitted (as prefix) again,
1991 over and over, in subsequent continuation lines.  This is the default
1992 behavior.
1993
1994 @item -fdiagnostics-show-location=every-line
1995 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1996 messages reporter to emit the same source location information (as
1997 prefix) for physical lines that result from the process of breaking
1998 a message which is too long to fit on a single line.
1999
2000 @end table
2001
2002 @node Warning Options
2003 @section Options to Request or Suppress Warnings
2004 @cindex options to control warnings
2005 @cindex warning messages
2006 @cindex messages, warning
2007 @cindex suppressing warnings
2008
2009 Warnings are diagnostic messages that report constructions which
2010 are not inherently erroneous but which are risky or suggest there
2011 may have been an error.
2012
2013 You can request many specific warnings with options beginning @samp{-W},
2014 for example @option{-Wimplicit} to request warnings on implicit
2015 declarations.  Each of these specific warning options also has a
2016 negative form beginning @samp{-Wno-} to turn off warnings;
2017 for example, @option{-Wno-implicit}.  This manual lists only one of the
2018 two forms, whichever is not the default.
2019
2020 The following options control the amount and kinds of warnings produced
2021 by GCC; for further, language-specific options also refer to
2022 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
2023
2024 @table @gcctabopt
2025 @cindex syntax checking
2026 @item -fsyntax-only
2027 @opindex fsyntax-only
2028 Check the code for syntax errors, but don't do anything beyond that.
2029
2030 @item -pedantic
2031 @opindex pedantic
2032 Issue all the warnings demanded by strict ISO C and ISO C++;
2033 reject all programs that use forbidden extensions, and some other
2034 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2035 version of the ISO C standard specified by any @option{-std} option used.
2036
2037 Valid ISO C and ISO C++ programs should compile properly with or without
2038 this option (though a rare few will require @option{-ansi} or a
2039 @option{-std} option specifying the required version of ISO C)@.  However,
2040 without this option, certain GNU extensions and traditional C and C++
2041 features are supported as well.  With this option, they are rejected.
2042
2043 @option{-pedantic} does not cause warning messages for use of the
2044 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2045 warnings are also disabled in the expression that follows
2046 @code{__extension__}.  However, only system header files should use
2047 these escape routes; application programs should avoid them.
2048 @xref{Alternate Keywords}.
2049
2050 Some users try to use @option{-pedantic} to check programs for strict ISO
2051 C conformance.  They soon find that it does not do quite what they want:
2052 it finds some non-ISO practices, but not all---only those for which
2053 ISO C @emph{requires} a diagnostic, and some others for which
2054 diagnostics have been added.
2055
2056 A feature to report any failure to conform to ISO C might be useful in
2057 some instances, but would require considerable additional work and would
2058 be quite different from @option{-pedantic}.  We don't have plans to
2059 support such a feature in the near future.
2060
2061 Where the standard specified with @option{-std} represents a GNU
2062 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2063 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2064 extended dialect is based.  Warnings from @option{-pedantic} are given
2065 where they are required by the base standard.  (It would not make sense
2066 for such warnings to be given only for features not in the specified GNU
2067 C dialect, since by definition the GNU dialects of C include all
2068 features the compiler supports with the given option, and there would be
2069 nothing to warn about.)
2070
2071 @item -pedantic-errors
2072 @opindex pedantic-errors
2073 Like @option{-pedantic}, except that errors are produced rather than
2074 warnings.
2075
2076 @item -w
2077 @opindex w
2078 Inhibit all warning messages.
2079
2080 @item -Wno-import
2081 @opindex Wno-import
2082 Inhibit warning messages about the use of @samp{#import}.
2083
2084 @item -Wchar-subscripts
2085 @opindex Wchar-subscripts
2086 Warn if an array subscript has type @code{char}.  This is a common cause
2087 of error, as programmers often forget that this type is signed on some
2088 machines.
2089
2090 @item -Wcomment
2091 @opindex Wcomment
2092 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2093 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2094
2095 @item -Wformat
2096 @opindex Wformat
2097 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2098 the arguments supplied have types appropriate to the format string
2099 specified, and that the conversions specified in the format string make
2100 sense.  This includes standard functions, and others specified by format
2101 attributes (@pxref{Function Attributes}), in the @code{printf},
2102 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2103 not in the C standard) families.
2104
2105 The formats are checked against the format features supported by GNU
2106 libc version 2.2.  These include all ISO C90 and C99 features, as well
2107 as features from the Single Unix Specification and some BSD and GNU
2108 extensions.  Other library implementations may not support all these
2109 features; GCC does not support warning about features that go beyond a
2110 particular library's limitations.  However, if @option{-pedantic} is used
2111 with @option{-Wformat}, warnings will be given about format features not
2112 in the selected standard version (but not for @code{strfmon} formats,
2113 since those are not in any version of the C standard).  @xref{C Dialect
2114 Options,,Options Controlling C Dialect}.
2115
2116 Since @option{-Wformat} also checks for null format arguments for
2117 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2118
2119 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2120 aspects of format checking, the options @option{-Wno-format-y2k},
2121 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2122 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2123 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2124
2125 @item -Wno-format-y2k
2126 @opindex Wno-format-y2k
2127 If @option{-Wformat} is specified, do not warn about @code{strftime}
2128 formats which may yield only a two-digit year.
2129
2130 @item -Wno-format-extra-args
2131 @opindex Wno-format-extra-args
2132 If @option{-Wformat} is specified, do not warn about excess arguments to a
2133 @code{printf} or @code{scanf} format function.  The C standard specifies
2134 that such arguments are ignored.
2135
2136 Where the unused arguments lie between used arguments that are
2137 specified with @samp{$} operand number specifications, normally
2138 warnings are still given, since the implementation could not know what
2139 type to pass to @code{va_arg} to skip the unused arguments.  However,
2140 in the case of @code{scanf} formats, this option will suppress the
2141 warning if the unused arguments are all pointers, since the Single
2142 Unix Specification says that such unused arguments are allowed.
2143
2144 @item -Wno-format-zero-length
2145 @opindex Wno-format-zero-length
2146 If @option{-Wformat} is specified, do not warn about zero-length formats.
2147 The C standard specifies that zero-length formats are allowed.
2148
2149 @item -Wformat-nonliteral
2150 @opindex Wformat-nonliteral
2151 If @option{-Wformat} is specified, also warn if the format string is not a
2152 string literal and so cannot be checked, unless the format function
2153 takes its format arguments as a @code{va_list}.
2154
2155 @item -Wformat-security
2156 @opindex Wformat-security
2157 If @option{-Wformat} is specified, also warn about uses of format
2158 functions that represent possible security problems.  At present, this
2159 warns about calls to @code{printf} and @code{scanf} functions where the
2160 format string is not a string literal and there are no format arguments,
2161 as in @code{printf (foo);}.  This may be a security hole if the format
2162 string came from untrusted input and contains @samp{%n}.  (This is
2163 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2164 in future warnings may be added to @option{-Wformat-security} that are not
2165 included in @option{-Wformat-nonliteral}.)
2166
2167 @item -Wformat=2
2168 @opindex Wformat=2
2169 Enable @option{-Wformat} plus format checks not included in
2170 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2171 -Wformat-nonliteral -Wformat-security}.
2172
2173 @item -Wnonnull
2174 @opindex Wnonnull
2175 Enable warning about passing a null pointer for arguments marked as
2176 requiring a non-null value by the @code{nonnull} function attribute.
2177
2178 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2179 can be disabled with the @option{-Wno-nonnull} option.
2180
2181 @item -Winit-self @r{(C, C++, and Objective-C only)} 
2182 @opindex Winit-self
2183 Enable warning about uninitialized variables which are initalized with themselves.
2184 Note this option can only be used with the @option{-Wuninitialized} option and 
2185 that only works with @option{-O}.
2186
2187 For an example, the following code will not warn about i being uninitialized 
2188 without this option:
2189 @smallexample
2190 @group
2191 int f()
2192 @{
2193   int i = i;
2194   return i;
2195 @}
2196 @end group
2197 @end smallexample
2198
2199 @item -Wimplicit-int
2200 @opindex Wimplicit-int
2201 Warn when a declaration does not specify a type.
2202
2203 @item -Wimplicit-function-declaration
2204 @itemx -Werror-implicit-function-declaration
2205 @opindex Wimplicit-function-declaration
2206 @opindex Werror-implicit-function-declaration
2207 Give a warning (or error) whenever a function is used before being
2208 declared.
2209
2210 @item -Wimplicit
2211 @opindex Wimplicit
2212 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2213
2214 @item -Wmain
2215 @opindex Wmain
2216 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2217 function with external linkage, returning int, taking either zero
2218 arguments, two, or three arguments of appropriate types.
2219
2220 @item -Wmissing-braces
2221 @opindex Wmissing-braces
2222 Warn if an aggregate or union initializer is not fully bracketed.  In
2223 the following example, the initializer for @samp{a} is not fully
2224 bracketed, but that for @samp{b} is fully bracketed.
2225
2226 @smallexample
2227 int a[2][2] = @{ 0, 1, 2, 3 @};
2228 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2229 @end smallexample
2230
2231 @item -Wparentheses
2232 @opindex Wparentheses
2233 Warn if parentheses are omitted in certain contexts, such
2234 as when there is an assignment in a context where a truth value
2235 is expected, or when operators are nested whose precedence people
2236 often get confused about.
2237
2238 Also warn about constructions where there may be confusion to which
2239 @code{if} statement an @code{else} branch belongs.  Here is an example of
2240 such a case:
2241
2242 @smallexample
2243 @group
2244 @{
2245   if (a)
2246     if (b)
2247       foo ();
2248   else
2249     bar ();
2250 @}
2251 @end group
2252 @end smallexample
2253
2254 In C, every @code{else} branch belongs to the innermost possible @code{if}
2255 statement, which in this example is @code{if (b)}.  This is often not
2256 what the programmer expected, as illustrated in the above example by
2257 indentation the programmer chose.  When there is the potential for this
2258 confusion, GCC will issue a warning when this flag is specified.
2259 To eliminate the warning, add explicit braces around the innermost
2260 @code{if} statement so there is no way the @code{else} could belong to
2261 the enclosing @code{if}.  The resulting code would look like this:
2262
2263 @smallexample
2264 @group
2265 @{
2266   if (a)
2267     @{
2268       if (b)
2269         foo ();
2270       else
2271         bar ();
2272     @}
2273 @}
2274 @end group
2275 @end smallexample
2276
2277 @item -Wsequence-point
2278 @opindex Wsequence-point
2279 Warn about code that may have undefined semantics because of violations
2280 of sequence point rules in the C standard.
2281
2282 The C standard defines the order in which expressions in a C program are
2283 evaluated in terms of @dfn{sequence points}, which represent a partial
2284 ordering between the execution of parts of the program: those executed
2285 before the sequence point, and those executed after it.  These occur
2286 after the evaluation of a full expression (one which is not part of a
2287 larger expression), after the evaluation of the first operand of a
2288 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2289 function is called (but after the evaluation of its arguments and the
2290 expression denoting the called function), and in certain other places.
2291 Other than as expressed by the sequence point rules, the order of
2292 evaluation of subexpressions of an expression is not specified.  All
2293 these rules describe only a partial order rather than a total order,
2294 since, for example, if two functions are called within one expression
2295 with no sequence point between them, the order in which the functions
2296 are called is not specified.  However, the standards committee have
2297 ruled that function calls do not overlap.
2298
2299 It is not specified when between sequence points modifications to the
2300 values of objects take effect.  Programs whose behavior depends on this
2301 have undefined behavior; the C standard specifies that ``Between the
2302 previous and next sequence point an object shall have its stored value
2303 modified at most once by the evaluation of an expression.  Furthermore,
2304 the prior value shall be read only to determine the value to be
2305 stored.''.  If a program breaks these rules, the results on any
2306 particular implementation are entirely unpredictable.
2307
2308 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2309 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2310 diagnosed by this option, and it may give an occasional false positive
2311 result, but in general it has been found fairly effective at detecting
2312 this sort of problem in programs.
2313
2314 The present implementation of this option only works for C programs.  A
2315 future implementation may also work for C++ programs.
2316
2317 The C standard is worded confusingly, therefore there is some debate
2318 over the precise meaning of the sequence point rules in subtle cases.
2319 Links to discussions of the problem, including proposed formal
2320 definitions, may be found on our readings page, at
2321 @w{@uref{http://gcc.gnu.org/readings.html}}.
2322
2323 @item -Wreturn-type
2324 @opindex Wreturn-type
2325 Warn whenever a function is defined with a return-type that defaults to
2326 @code{int}.  Also warn about any @code{return} statement with no
2327 return-value in a function whose return-type is not @code{void}.
2328
2329 For C++, a function without return type always produces a diagnostic
2330 message, even when @option{-Wno-return-type} is specified.  The only
2331 exceptions are @samp{main} and functions defined in system headers.
2332
2333 @item -Wswitch
2334 @opindex Wswitch
2335 Warn whenever a @code{switch} statement has an index of enumeral type
2336 and lacks a @code{case} for one or more of the named codes of that
2337 enumeration.  (The presence of a @code{default} label prevents this
2338 warning.)  @code{case} labels outside the enumeration range also
2339 provoke warnings when this option is used.
2340
2341 @item -Wswitch-default
2342 @opindex Wswitch-switch
2343 Warn whenever a @code{switch} statement does not have a @code{default}
2344 case.
2345
2346 @item -Wswitch-enum
2347 @opindex Wswitch-enum
2348 Warn whenever a @code{switch} statement has an index of enumeral type
2349 and lacks a @code{case} for one or more of the named codes of that
2350 enumeration.  @code{case} labels outside the enumeration range also
2351 provoke warnings when this option is used.
2352
2353 @item -Wtrigraphs
2354 @opindex Wtrigraphs
2355 Warn if any trigraphs are encountered that might change the meaning of
2356 the program (trigraphs within comments are not warned about).
2357
2358 @item -Wunused-function
2359 @opindex Wunused-function
2360 Warn whenever a static function is declared but not defined or a
2361 non\-inline static function is unused.
2362
2363 @item -Wunused-label
2364 @opindex Wunused-label
2365 Warn whenever a label is declared but not used.
2366
2367 To suppress this warning use the @samp{unused} attribute
2368 (@pxref{Variable Attributes}).
2369
2370 @item -Wunused-parameter
2371 @opindex Wunused-parameter
2372 Warn whenever a function parameter is unused aside from its declaration.
2373
2374 To suppress this warning use the @samp{unused} attribute
2375 (@pxref{Variable Attributes}).
2376
2377 @item -Wunused-variable
2378 @opindex Wunused-variable
2379 Warn whenever a local variable or non-constant static variable is unused
2380 aside from its declaration
2381
2382 To suppress this warning use the @samp{unused} attribute
2383 (@pxref{Variable Attributes}).
2384
2385 @item -Wunused-value
2386 @opindex Wunused-value
2387 Warn whenever a statement computes a result that is explicitly not used.
2388
2389 To suppress this warning cast the expression to @samp{void}.
2390
2391 @item -Wunused
2392 @opindex Wunused
2393 All the above @option{-Wunused} options combined.
2394
2395 In order to get a warning about an unused function parameter, you must
2396 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2397 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2398
2399 @item -Wuninitialized
2400 @opindex Wuninitialized
2401 Warn if an automatic variable is used without first being initialized or
2402 if a variable may be clobbered by a @code{setjmp} call.
2403
2404 These warnings are possible only in optimizing compilation,
2405 because they require data flow information that is computed only
2406 when optimizing.  If you don't specify @option{-O}, you simply won't
2407 get these warnings.
2408
2409 If you want to warn about code which uses the uninitialized value of the
2410 variable in its own initializer, use the @option{-Winit-self} option.
2411
2412 These warnings occur only for variables that are candidates for
2413 register allocation.  Therefore, they do not occur for a variable that
2414 is declared @code{volatile}, or whose address is taken, or whose size
2415 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2416 structures, unions or arrays, even when they are in registers.
2417
2418 Note that there may be no warning about a variable that is used only
2419 to compute a value that itself is never used, because such
2420 computations may be deleted by data flow analysis before the warnings
2421 are printed.
2422
2423 These warnings are made optional because GCC is not smart
2424 enough to see all the reasons why the code might be correct
2425 despite appearing to have an error.  Here is one example of how
2426 this can happen:
2427
2428 @smallexample
2429 @group
2430 @{
2431   int x;
2432   switch (y)
2433     @{
2434     case 1: x = 1;
2435       break;
2436     case 2: x = 4;
2437       break;
2438     case 3: x = 5;
2439     @}
2440   foo (x);
2441 @}
2442 @end group
2443 @end smallexample
2444
2445 @noindent
2446 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2447 always initialized, but GCC doesn't know this.  Here is
2448 another common case:
2449
2450 @smallexample
2451 @{
2452   int save_y;
2453   if (change_y) save_y = y, y = new_y;
2454   @dots{}
2455   if (change_y) y = save_y;
2456 @}
2457 @end smallexample
2458
2459 @noindent
2460 This has no bug because @code{save_y} is used only if it is set.
2461
2462 @cindex @code{longjmp} warnings
2463 This option also warns when a non-volatile automatic variable might be
2464 changed by a call to @code{longjmp}.  These warnings as well are possible
2465 only in optimizing compilation.
2466
2467 The compiler sees only the calls to @code{setjmp}.  It cannot know
2468 where @code{longjmp} will be called; in fact, a signal handler could
2469 call it at any point in the code.  As a result, you may get a warning
2470 even when there is in fact no problem because @code{longjmp} cannot
2471 in fact be called at the place which would cause a problem.
2472
2473 Some spurious warnings can be avoided if you declare all the functions
2474 you use that never return as @code{noreturn}.  @xref{Function
2475 Attributes}.
2476
2477 @item -Wunknown-pragmas
2478 @opindex Wunknown-pragmas
2479 @cindex warning for unknown pragmas
2480 @cindex unknown pragmas, warning
2481 @cindex pragmas, warning of unknown
2482 Warn when a #pragma directive is encountered which is not understood by
2483 GCC@.  If this command line option is used, warnings will even be issued
2484 for unknown pragmas in system header files.  This is not the case if
2485 the warnings were only enabled by the @option{-Wall} command line option.
2486
2487 @item -Wstrict-aliasing
2488 @opindex Wstrict-aliasing
2489 This option is only active when @option{-fstrict-aliasing} is active.
2490 It warns about code which might break the strict aliasing rules that the
2491 compiler is using for optimization. The warning does not catch all
2492 cases, but does attempt to catch the more common pitfalls. It is
2493 included in @option{-Wall}.
2494
2495 @item -Wall
2496 @opindex Wall
2497 All of the above @samp{-W} options combined.  This enables all the
2498 warnings about constructions that some users consider questionable, and
2499 that are easy to avoid (or modify to prevent the warning), even in
2500 conjunction with macros.  This also enables some language-specific
2501 warnings described in @ref{C++ Dialect Options} and
2502 @ref{Objective-C Dialect Options}.
2503 @end table
2504
2505 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2506 Some of them warn about constructions that users generally do not
2507 consider questionable, but which occasionally you might wish to check
2508 for; others warn about constructions that are necessary or hard to avoid
2509 in some cases, and there is no simple way to modify the code to suppress
2510 the warning.
2511
2512 @table @gcctabopt
2513 @item -Wextra
2514 @opindex W
2515 @opindex Wextra
2516 (This option used to be called @option{-W}.  The older name is still
2517 supported, but the newer name is more descriptive.)  Print extra warning
2518 messages for these events:
2519
2520 @itemize @bullet
2521 @item
2522 A function can return either with or without a value.  (Falling
2523 off the end of the function body is considered returning without
2524 a value.)  For example, this function would evoke such a
2525 warning:
2526
2527 @smallexample
2528 @group
2529 foo (a)
2530 @{
2531   if (a > 0)
2532     return a;
2533 @}
2534 @end group
2535 @end smallexample
2536
2537 @item
2538 An expression-statement or the left-hand side of a comma expression
2539 contains no side effects.
2540 To suppress the warning, cast the unused expression to void.
2541 For example, an expression such as @samp{x[i,j]} will cause a warning,
2542 but @samp{x[(void)i,j]} will not.
2543
2544 @item
2545 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2546
2547 @item
2548 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2549 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2550 that of ordinary mathematical notation.
2551
2552 @item
2553 Storage-class specifiers like @code{static} are not the first things in
2554 a declaration.  According to the C Standard, this usage is obsolescent.
2555
2556 @item
2557 The return type of a function has a type qualifier such as @code{const}.
2558 Such a type qualifier has no effect, since the value returned by a
2559 function is not an lvalue.  (But don't warn about the GNU extension of
2560 @code{volatile void} return types.  That extension will be warned about
2561 if @option{-pedantic} is specified.)
2562
2563 @item
2564 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2565 arguments.
2566
2567 @item
2568 A comparison between signed and unsigned values could produce an
2569 incorrect result when the signed value is converted to unsigned.
2570 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2571
2572 @item
2573 An aggregate has an initializer which does not initialize all members.
2574 For example, the following code would cause such a warning, because
2575 @code{x.h} would be implicitly initialized to zero:
2576
2577 @smallexample
2578 struct s @{ int f, g, h; @};
2579 struct s x = @{ 3, 4 @};
2580 @end smallexample
2581
2582 @item
2583 A function parameter is declared without a type specifier in K&R-style
2584 functions:
2585
2586 @smallexample
2587 void foo(bar) @{ @}
2588 @end smallexample
2589
2590 @item
2591 An empty body occurs in an @samp{if} or @samp{else} statement.
2592
2593 @item
2594 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2595 @samp{>}, or @samp{>=}.
2596
2597 @item
2598 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2599
2600 @item
2601 Any of several floating-point events that often indicate errors, such as
2602 overflow, underflow, loss of precision, etc.
2603
2604 @item @r{(C++ only)}
2605 An enumerator and a non-enumerator both appear in a conditional expression.
2606
2607 @item @r{(C++ only)}
2608 A non-static reference or non-static @samp{const} member appears in a
2609 class without constructors.
2610
2611 @item @r{(C++ only)}
2612 Ambiguous virtual bases.
2613
2614 @item @r{(C++ only)}
2615 Subscripting an array which has been declared @samp{register}.
2616
2617 @item @r{(C++ only)}
2618 Taking the address of a variable which has been declared @samp{register}.
2619
2620 @item @r{(C++ only)}
2621 A base class is not initialized in a derived class' copy constructor.
2622 @end itemize
2623
2624 @item -Wno-div-by-zero
2625 @opindex Wno-div-by-zero
2626 @opindex Wdiv-by-zero
2627 Do not warn about compile-time integer division by zero.  Floating point
2628 division by zero is not warned about, as it can be a legitimate way of
2629 obtaining infinities and NaNs.
2630
2631 @item -Wsystem-headers
2632 @opindex Wsystem-headers
2633 @cindex warnings from system headers
2634 @cindex system headers, warnings from
2635 Print warning messages for constructs found in system header files.
2636 Warnings from system headers are normally suppressed, on the assumption
2637 that they usually do not indicate real problems and would only make the
2638 compiler output harder to read.  Using this command line option tells
2639 GCC to emit warnings from system headers as if they occurred in user
2640 code.  However, note that using @option{-Wall} in conjunction with this
2641 option will @emph{not} warn about unknown pragmas in system
2642 headers---for that, @option{-Wunknown-pragmas} must also be used.
2643
2644 @item -Wfloat-equal
2645 @opindex Wfloat-equal
2646 Warn if floating point values are used in equality comparisons.
2647
2648 The idea behind this is that sometimes it is convenient (for the
2649 programmer) to consider floating-point values as approximations to
2650 infinitely precise real numbers.  If you are doing this, then you need
2651 to compute (by analyzing the code, or in some other way) the maximum or
2652 likely maximum error that the computation introduces, and allow for it
2653 when performing comparisons (and when producing output, but that's a
2654 different problem).  In particular, instead of testing for equality, you
2655 would check to see whether the two values have ranges that overlap; and
2656 this is done with the relational operators, so equality comparisons are
2657 probably mistaken.
2658
2659 @item -Wtraditional @r{(C only)}
2660 @opindex Wtraditional
2661 Warn about certain constructs that behave differently in traditional and
2662 ISO C@.  Also warn about ISO C constructs that have no traditional C
2663 equivalent, and/or problematic constructs which should be avoided.
2664
2665 @itemize @bullet
2666 @item
2667 Macro parameters that appear within string literals in the macro body.
2668 In traditional C macro replacement takes place within string literals,
2669 but does not in ISO C@.
2670
2671 @item
2672 In traditional C, some preprocessor directives did not exist.
2673 Traditional preprocessors would only consider a line to be a directive
2674 if the @samp{#} appeared in column 1 on the line.  Therefore
2675 @option{-Wtraditional} warns about directives that traditional C
2676 understands but would ignore because the @samp{#} does not appear as the
2677 first character on the line.  It also suggests you hide directives like
2678 @samp{#pragma} not understood by traditional C by indenting them.  Some
2679 traditional implementations would not recognize @samp{#elif}, so it
2680 suggests avoiding it altogether.
2681
2682 @item
2683 A function-like macro that appears without arguments.
2684
2685 @item
2686 The unary plus operator.
2687
2688 @item
2689 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2690 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2691 constants.)  Note, these suffixes appear in macros defined in the system
2692 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2693 Use of these macros in user code might normally lead to spurious
2694 warnings, however gcc's integrated preprocessor has enough context to
2695 avoid warning in these cases.
2696
2697 @item
2698 A function declared external in one block and then used after the end of
2699 the block.
2700
2701 @item
2702 A @code{switch} statement has an operand of type @code{long}.
2703
2704 @item
2705 A non-@code{static} function declaration follows a @code{static} one.
2706 This construct is not accepted by some traditional C compilers.
2707
2708 @item
2709 The ISO type of an integer constant has a different width or
2710 signedness from its traditional type.  This warning is only issued if
2711 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2712 typically represent bit patterns, are not warned about.
2713
2714 @item
2715 Usage of ISO string concatenation is detected.
2716
2717 @item
2718 Initialization of automatic aggregates.
2719
2720 @item
2721 Identifier conflicts with labels.  Traditional C lacks a separate
2722 namespace for labels.
2723
2724 @item
2725 Initialization of unions.  If the initializer is zero, the warning is
2726 omitted.  This is done under the assumption that the zero initializer in
2727 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2728 initializer warnings and relies on default initialization to zero in the
2729 traditional C case.
2730
2731 @item
2732 Conversions by prototypes between fixed/floating point values and vice
2733 versa.  The absence of these prototypes when compiling with traditional
2734 C would cause serious problems.  This is a subset of the possible
2735 conversion warnings, for the full set use @option{-Wconversion}.
2736
2737 @item
2738 Use of ISO C style function definitions.  This warning intentionally is
2739 @emph{not} issued for prototype declarations or variadic functions
2740 because these ISO C features will appear in your code when using
2741 libiberty's traditional C compatibility macros, @code{PARAMS} and
2742 @code{VPARAMS}.  This warning is also bypassed for nested functions
2743 because that feature is already a gcc extension and thus not relevant to
2744 traditional C compatibility.
2745 @end itemize
2746
2747 @item -Wdeclaration-after-statement @r{(C only)}
2748 @opindex Wdeclaration-after-statement
2749 Warn when a declaration is found after a statement in a block.  This
2750 construct, known from C++, was introduced with ISO C99 and is by default
2751 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2752 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2753
2754 @item -Wundef
2755 @opindex Wundef
2756 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2757
2758 @item -Wendif-labels
2759 @opindex Wendif-labels
2760 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2761
2762 @item -Wshadow
2763 @opindex Wshadow
2764 Warn whenever a local variable shadows another local variable, parameter or
2765 global variable or whenever a built-in function is shadowed.
2766
2767 @item -Wlarger-than-@var{len}
2768 @opindex Wlarger-than
2769 Warn whenever an object of larger than @var{len} bytes is defined.
2770
2771 @item -Wpointer-arith
2772 @opindex Wpointer-arith
2773 Warn about anything that depends on the ``size of'' a function type or
2774 of @code{void}.  GNU C assigns these types a size of 1, for
2775 convenience in calculations with @code{void *} pointers and pointers
2776 to functions.
2777
2778 @item -Wbad-function-cast @r{(C only)}
2779 @opindex Wbad-function-cast
2780 Warn whenever a function call is cast to a non-matching type.
2781 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2782
2783 @item -Wcast-qual
2784 @opindex Wcast-qual
2785 Warn whenever a pointer is cast so as to remove a type qualifier from
2786 the target type.  For example, warn if a @code{const char *} is cast
2787 to an ordinary @code{char *}.
2788
2789 @item -Wcast-align
2790 @opindex Wcast-align
2791 Warn whenever a pointer is cast such that the required alignment of the
2792 target is increased.  For example, warn if a @code{char *} is cast to
2793 an @code{int *} on machines where integers can only be accessed at
2794 two- or four-byte boundaries.
2795
2796 @item -Wwrite-strings
2797 @opindex Wwrite-strings
2798 When compiling C, give string constants the type @code{const
2799 char[@var{length}]} so that
2800 copying the address of one into a non-@code{const} @code{char *}
2801 pointer will get a warning; when compiling C++, warn about the
2802 deprecated conversion from string constants to @code{char *}.
2803 These warnings will help you find at
2804 compile time code that can try to write into a string constant, but
2805 only if you have been very careful about using @code{const} in
2806 declarations and prototypes.  Otherwise, it will just be a nuisance;
2807 this is why we did not make @option{-Wall} request these warnings.
2808
2809 @item -Wconversion
2810 @opindex Wconversion
2811 Warn if a prototype causes a type conversion that is different from what
2812 would happen to the same argument in the absence of a prototype.  This
2813 includes conversions of fixed point to floating and vice versa, and
2814 conversions changing the width or signedness of a fixed point argument
2815 except when the same as the default promotion.
2816
2817 Also, warn if a negative integer constant expression is implicitly
2818 converted to an unsigned type.  For example, warn about the assignment
2819 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2820 casts like @code{(unsigned) -1}.
2821
2822 @item -Wsign-compare
2823 @opindex Wsign-compare
2824 @cindex warning for comparison of signed and unsigned values
2825 @cindex comparison of signed and unsigned values, warning
2826 @cindex signed and unsigned values, comparison warning
2827 Warn when a comparison between signed and unsigned values could produce
2828 an incorrect result when the signed value is converted to unsigned.
2829 This warning is also enabled by @option{-Wextra}; to get the other warnings
2830 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2831
2832 @item -Waggregate-return
2833 @opindex Waggregate-return
2834 Warn if any functions that return structures or unions are defined or
2835 called.  (In languages where you can return an array, this also elicits
2836 a warning.)
2837
2838 @item -Wstrict-prototypes @r{(C only)}
2839 @opindex Wstrict-prototypes
2840 Warn if a function is declared or defined without specifying the
2841 argument types.  (An old-style function definition is permitted without
2842 a warning if preceded by a declaration which specifies the argument
2843 types.)
2844
2845 @item -Wold-style-definition @r{(C only)}
2846 @opindex Wold-style-definition
2847 Warn if an old-style function definition is used.  A warning is given
2848 even if there is a previous prototype.
2849
2850 @item -Wmissing-prototypes @r{(C only)}
2851 @opindex Wmissing-prototypes
2852 Warn if a global function is defined without a previous prototype
2853 declaration.  This warning is issued even if the definition itself
2854 provides a prototype.  The aim is to detect global functions that fail
2855 to be declared in header files.
2856
2857 @item -Wmissing-declarations @r{(C only)}
2858 @opindex Wmissing-declarations
2859 Warn if a global function is defined without a previous declaration.
2860 Do so even if the definition itself provides a prototype.
2861 Use this option to detect global functions that are not declared in
2862 header files.
2863
2864 @item -Wmissing-noreturn
2865 @opindex Wmissing-noreturn
2866 Warn about functions which might be candidates for attribute @code{noreturn}.
2867 Note these are only possible candidates, not absolute ones.  Care should
2868 be taken to manually verify functions actually do not ever return before
2869 adding the @code{noreturn} attribute, otherwise subtle code generation
2870 bugs could be introduced.  You will not get a warning for @code{main} in
2871 hosted C environments.
2872
2873 @item -Wmissing-format-attribute
2874 @opindex Wmissing-format-attribute
2875 @opindex Wformat
2876 If @option{-Wformat} is enabled, also warn about functions which might be
2877 candidates for @code{format} attributes.  Note these are only possible
2878 candidates, not absolute ones.  GCC will guess that @code{format}
2879 attributes might be appropriate for any function that calls a function
2880 like @code{vprintf} or @code{vscanf}, but this might not always be the
2881 case, and some functions for which @code{format} attributes are
2882 appropriate may not be detected.  This option has no effect unless
2883 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2884
2885 @item -Wno-multichar
2886 @opindex Wno-multichar
2887 @opindex Wmultichar
2888 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2889 Usually they indicate a typo in the user's code, as they have
2890 implementation-defined values, and should not be used in portable code.
2891
2892 @item -Wno-deprecated-declarations
2893 @opindex Wno-deprecated-declarations
2894 Do not warn about uses of functions, variables, and types marked as
2895 deprecated by using the @code{deprecated} attribute.
2896 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2897 @pxref{Type Attributes}.)
2898
2899 @item -Wpacked
2900 @opindex Wpacked
2901 Warn if a structure is given the packed attribute, but the packed
2902 attribute has no effect on the layout or size of the structure.
2903 Such structures may be mis-aligned for little benefit.  For
2904 instance, in this code, the variable @code{f.x} in @code{struct bar}
2905 will be misaligned even though @code{struct bar} does not itself
2906 have the packed attribute:
2907
2908 @smallexample
2909 @group
2910 struct foo @{
2911   int x;
2912   char a, b, c, d;
2913 @} __attribute__((packed));
2914 struct bar @{
2915   char z;
2916   struct foo f;
2917 @};
2918 @end group
2919 @end smallexample
2920
2921 @item -Wpadded
2922 @opindex Wpadded
2923 Warn if padding is included in a structure, either to align an element
2924 of the structure or to align the whole structure.  Sometimes when this
2925 happens it is possible to rearrange the fields of the structure to
2926 reduce the padding and so make the structure smaller.
2927
2928 @item -Wredundant-decls
2929 @opindex Wredundant-decls
2930 Warn if anything is declared more than once in the same scope, even in
2931 cases where multiple declaration is valid and changes nothing.
2932
2933 @item -Wnested-externs @r{(C only)}
2934 @opindex Wnested-externs
2935 Warn if an @code{extern} declaration is encountered within a function.
2936
2937 @item -Wunreachable-code
2938 @opindex Wunreachable-code
2939 Warn if the compiler detects that code will never be executed.
2940
2941 This option is intended to warn when the compiler detects that at
2942 least a whole line of source code will never be executed, because
2943 some condition is never satisfied or because it is after a
2944 procedure that never returns.
2945
2946 It is possible for this option to produce a warning even though there
2947 are circumstances under which part of the affected line can be executed,
2948 so care should be taken when removing apparently-unreachable code.
2949
2950 For instance, when a function is inlined, a warning may mean that the
2951 line is unreachable in only one inlined copy of the function.
2952
2953 This option is not made part of @option{-Wall} because in a debugging
2954 version of a program there is often substantial code which checks
2955 correct functioning of the program and is, hopefully, unreachable
2956 because the program does work.  Another common use of unreachable
2957 code is to provide behavior which is selectable at compile-time.
2958
2959 @item -Winline
2960 @opindex Winline
2961 Warn if a function can not be inlined and it was declared as inline.
2962 Even with this option, the compiler will not warn about failures to
2963 inline functions declared in system headers.  
2964
2965 The compiler uses a variety of heuristics to determine whether or not
2966 to inline a function.  For example, the compiler takes into account
2967 the size of the function being inlined and the the amount of inlining
2968 that has already been done in the current function.  Therefore,
2969 seemingly insignificant changes in the source program can cause the
2970 warnings produced by @option{-Winline} to appear or disappear.
2971
2972 @item -Wno-invalid-offsetof @r{(C++ only)}
2973 @opindex Wno-invalid-offsetof
2974 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
2975 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
2976 to a non-POD type is undefined.  In existing C++ implementations,
2977 however, @samp{offsetof} typically gives meaningful results even when
2978 applied to certain kinds of non-POD types. (Such as a simple
2979 @samp{struct} that fails to be a POD type only by virtue of having a
2980 constructor.)  This flag is for users who are aware that they are
2981 writing nonportable code and who have deliberately chosen to ignore the
2982 warning about it.
2983
2984 The restrictions on @samp{offsetof} may be relaxed in a future version
2985 of the C++ standard.
2986
2987 @item -Winvalid-pch
2988 @opindex Winvalid-pch
2989 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
2990 the search path but can't be used.
2991
2992 @item -Wlong-long
2993 @opindex Wlong-long
2994 @opindex Wno-long-long
2995 Warn if @samp{long long} type is used.  This is default.  To inhibit
2996 the warning messages, use @option{-Wno-long-long}.  Flags
2997 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2998 only when @option{-pedantic} flag is used.
2999
3000 @item -Wdisabled-optimization
3001 @opindex Wdisabled-optimization
3002 Warn if a requested optimization pass is disabled.  This warning does
3003 not generally indicate that there is anything wrong with your code; it
3004 merely indicates that GCC's optimizers were unable to handle the code
3005 effectively.  Often, the problem is that your code is too big or too
3006 complex; GCC will refuse to optimize programs when the optimization
3007 itself is likely to take inordinate amounts of time.
3008
3009 @item -Werror
3010 @opindex Werror
3011 Make all warnings into errors.
3012 @end table
3013
3014 @node Debugging Options
3015 @section Options for Debugging Your Program or GCC
3016 @cindex options, debugging
3017 @cindex debugging information options
3018
3019 GCC has various special options that are used for debugging
3020 either your program or GCC:
3021
3022 @table @gcctabopt
3023 @item -g
3024 @opindex g
3025 Produce debugging information in the operating system's native format
3026 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
3027 information.
3028
3029 On most systems that use stabs format, @option{-g} enables use of extra
3030 debugging information that only GDB can use; this extra information
3031 makes debugging work better in GDB but will probably make other debuggers
3032 crash or
3033 refuse to read the program.  If you want to control for certain whether
3034 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3035 @option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1},
3036 or @option{-gvms} (see below).
3037
3038 Unlike most other C compilers, GCC allows you to use @option{-g} with
3039 @option{-O}.  The shortcuts taken by optimized code may occasionally
3040 produce surprising results: some variables you declared may not exist
3041 at all; flow of control may briefly move where you did not expect it;
3042 some statements may not be executed because they compute constant
3043 results or their values were already at hand; some statements may
3044 execute in different places because they were moved out of loops.
3045
3046 Nevertheless it proves possible to debug optimized output.  This makes
3047 it reasonable to use the optimizer for programs that might have bugs.
3048
3049 The following options are useful when GCC is generated with the
3050 capability for more than one debugging format.
3051
3052 @item -ggdb
3053 @opindex ggdb
3054 Produce debugging information for use by GDB@.  This means to use the
3055 most expressive format available (DWARF 2, stabs, or the native format
3056 if neither of those are supported), including GDB extensions if at all
3057 possible.
3058
3059 @item -gstabs
3060 @opindex gstabs
3061 Produce debugging information in stabs format (if that is supported),
3062 without GDB extensions.  This is the format used by DBX on most BSD
3063 systems.  On MIPS, Alpha and System V Release 4 systems this option
3064 produces stabs debugging output which is not understood by DBX or SDB@.
3065 On System V Release 4 systems this option requires the GNU assembler.
3066
3067 @item -feliminate-unused-debug-symbols
3068 @opindex feliminate-unused-debug-symbols
3069 Produce debugging information in stabs format (if that is supported),
3070 for only symbols that are actually used.
3071
3072 @item -gstabs+
3073 @opindex gstabs+
3074 Produce debugging information in stabs format (if that is supported),
3075 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3076 use of these extensions is likely to make other debuggers crash or
3077 refuse to read the program.
3078
3079 @item -gcoff
3080 @opindex gcoff
3081 Produce debugging information in COFF format (if that is supported).
3082 This is the format used by SDB on most System V systems prior to
3083 System V Release 4.
3084
3085 @item -gxcoff
3086 @opindex gxcoff
3087 Produce debugging information in XCOFF format (if that is supported).
3088 This is the format used by the DBX debugger on IBM RS/6000 systems.
3089
3090 @item -gxcoff+
3091 @opindex gxcoff+
3092 Produce debugging information in XCOFF format (if that is supported),
3093 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3094 use of these extensions is likely to make other debuggers crash or
3095 refuse to read the program, and may cause assemblers other than the GNU
3096 assembler (GAS) to fail with an error.
3097
3098 @item -gdwarf
3099 @opindex gdwarf
3100 Produce debugging information in DWARF version 1 format (if that is
3101 supported).  This is the format used by SDB on most System V Release 4
3102 systems.
3103
3104 This option is deprecated.
3105
3106 @item -gdwarf+
3107 @opindex gdwarf+
3108 Produce debugging information in DWARF version 1 format (if that is
3109 supported), using GNU extensions understood only by the GNU debugger
3110 (GDB)@.  The use of these extensions is likely to make other debuggers
3111 crash or refuse to read the program.
3112
3113 This option is deprecated.
3114
3115 @item -gdwarf-2
3116 @opindex gdwarf-2
3117 Produce debugging information in DWARF version 2 format (if that is
3118 supported).  This is the format used by DBX on IRIX 6.
3119
3120 @item -gvms
3121 @opindex gvms
3122 Produce debugging information in VMS debug format (if that is
3123 supported).  This is the format used by DEBUG on VMS systems.
3124
3125 @item -g@var{level}
3126 @itemx -ggdb@var{level}
3127 @itemx -gstabs@var{level}
3128 @itemx -gcoff@var{level}
3129 @itemx -gxcoff@var{level}
3130 @itemx -gvms@var{level}
3131 Request debugging information and also use @var{level} to specify how
3132 much information.  The default level is 2.
3133
3134 Level 1 produces minimal information, enough for making backtraces in
3135 parts of the program that you don't plan to debug.  This includes
3136 descriptions of functions and external variables, but no information
3137 about local variables and no line numbers.
3138
3139 Level 3 includes extra information, such as all the macro definitions
3140 present in the program.  Some debuggers support macro expansion when
3141 you use @option{-g3}.
3142
3143 Note that in order to avoid confusion between DWARF1 debug level 2,
3144 and DWARF2, neither @option{-gdwarf} nor @option{-gdwarf-2} accept
3145 a concatenated debug level.  Instead use an additional @option{-g@var{level}}
3146 option to change the debug level for DWARF1 or DWARF2.
3147
3148 @item -feliminate-dwarf2-dups
3149 @opindex feliminate-dwarf2-dups
3150 Compress DWARF2 debugging information by eliminating duplicated
3151 information about each symbol.  This option only makes sense when
3152 generating DWARF2 debugging information with @option{-gdwarf-2}.
3153
3154 @cindex @command{prof}
3155 @item -p
3156 @opindex p
3157 Generate extra code to write profile information suitable for the
3158 analysis program @command{prof}.  You must use this option when compiling
3159 the source files you want data about, and you must also use it when
3160 linking.
3161
3162 @cindex @command{gprof}
3163 @item -pg
3164 @opindex pg
3165 Generate extra code to write profile information suitable for the
3166 analysis program @command{gprof}.  You must use this option when compiling
3167 the source files you want data about, and you must also use it when
3168 linking.
3169
3170 @item -Q
3171 @opindex Q
3172 Makes the compiler print out each function name as it is compiled, and
3173 print some statistics about each pass when it finishes.
3174
3175 @item -ftime-report
3176 @opindex ftime-report
3177 Makes the compiler print some statistics about the time consumed by each
3178 pass when it finishes.
3179
3180 @item -fmem-report
3181 @opindex fmem-report
3182 Makes the compiler print some statistics about permanent memory
3183 allocation when it finishes.
3184
3185 @item -fprofile-arcs
3186 @opindex fprofile-arcs
3187 Add code so that program flow @dfn{arcs} are instrumented.  During
3188 execution the program records how many times each branch and call is
3189 executed and how many times it is taken or returns.  When the compiled
3190 program exits it saves this data to a file called
3191 @file{@var{auxname}.gcda} for each source file. The data may be used for
3192 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3193 test coverage analysis (@option{-ftest-coverage}). Each object file's
3194 @var{auxname} is generated from the name of the output file, if
3195 explicitly specified and it is not the final executable, otherwise it is
3196 the basename of the source file. In both cases any suffix is removed
3197 (e.g.  @file{foo.gcda} for input file @file{dir/foo.c}, or
3198 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3199
3200 @itemize
3201
3202 @item
3203 Compile the source files with @option{-fprofile-arcs} plus optimization
3204 and code generation options. For test coverage analysis, use the
3205 additional @option{-ftest-coverage} option. You do not need to profile
3206 every source file in a program.
3207
3208 @item
3209 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3210 (the latter implies the former).
3211
3212 @item
3213 Run the program on a representative workload to generate the arc profile
3214 information. This may be repeated any number of times. You can run
3215 concurrent instances of your program, and provided that the file system
3216 supports locking, the data files will be correctly updated. Also
3217 @code{fork} calls are detected and correctly handled (double counting
3218 will not happen).
3219
3220 @item
3221 For profile-directed optimizations, compile the source files again with
3222 the same optimization and code generation options plus
3223 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3224 Control Optimization}).
3225
3226 @item
3227 For test coverage analysis, use @command{gcov} to produce human readable
3228 information from the @file{.gcno} and @file{.gcda} files. Refer to the
3229 @command{gcov} documentation for further information.
3230
3231 @end itemize
3232
3233 With @option{-fprofile-arcs}, for each function of your program GCC
3234 creates a program flow graph, then finds a spanning tree for the graph.
3235 Only arcs that are not on the spanning tree have to be instrumented: the
3236 compiler adds code to count the number of times that these arcs are
3237 executed.  When an arc is the only exit or only entrance to a block, the
3238 instrumentation code can be added to the block; otherwise, a new basic
3239 block must be created to hold the instrumentation code.
3240
3241 @need 2000
3242 @item -ftest-coverage
3243 @opindex ftest-coverage
3244 Produce a notes file that the @command{gcov} code-coverage utility
3245 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3246 show program coverage. Each source file's note file is called
3247 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
3248 above for a description of @var{auxname} and instructions on how to
3249 generate test coverage data. Coverage data will match the source files
3250 more closely, if you do not optimize.
3251
3252 @item -d@var{letters}
3253 @opindex d
3254 Says to make debugging dumps during compilation at times specified by
3255 @var{letters}.  This is used for debugging the compiler.  The file names
3256 for most of the dumps are made by appending a pass number and a word to
3257 the @var{dumpname}. @var{dumpname} is generated from the name of the
3258 output file, if explicitly specified and it is not an executable,
3259 otherwise it is the basename of the source file. In both cases any
3260 suffix is removed (e.g.  @file{foo.00.rtl} or @file{foo.01.sibling}).
3261 Here are the possible letters for use in @var{letters}, and their
3262 meanings:
3263
3264 @table @samp
3265 @item A
3266 @opindex dA
3267 Annotate the assembler output with miscellaneous debugging information.
3268 @item b
3269 @opindex db
3270 Dump after computing branch probabilities, to @file{@var{file}.16.bp}.
3271 @item B
3272 @opindex dB
3273 Dump after block reordering, to @file{@var{file}.32.bbro}.
3274 @item c
3275 @opindex dc
3276 Dump after instruction combination, to the file @file{@var{file}.22.combine}.
3277 @item C
3278 @opindex dC
3279 Dump after the first if conversion, to the file @file{@var{file}.17.ce1}.
3280 Also dump after the second if conversion, to the file @file{@var{file}.23.ce2}.
3281 @item d
3282 @opindex dd
3283 Dump after branch target load optimization, to to @file{@var{file}.34.btl}.
3284 Also dump after delayed branch scheduling, to @file{@var{file}.37.dbr}.
3285 @item D
3286 @opindex dD
3287 Dump all macro definitions, at the end of preprocessing, in addition to
3288 normal output.
3289 @item e
3290 @opindex de
3291 Dump after SSA optimizations, to @file{@var{file}.05.ssa} and
3292 @file{@var{file}.010.ussa}.
3293 @item E
3294 @opindex dE
3295 Dump after the second if conversion, to @file{@var{file}.33.ce3}.
3296 @item f
3297 @opindex df
3298 Dump after control and data flow analysis, to @file{@var{file}.15.cfg}.
3299 Also dump after life analysis, to @file{@var{file}.21.life}.
3300 @item F
3301 @opindex dF
3302 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.11.addressof}.
3303 @item g
3304 @opindex dg
3305 Dump after global register allocation, to @file{@var{file}.27.greg}.
3306 @item G
3307 @opindex dG
3308 Dump after GCSE, to @file{@var{file}.12.gcse}.
3309 Also dump after jump bypassing and control flow optimizations, to
3310 @file{@var{file}.14.bypass}.
3311 @item h
3312 @opindex dh
3313 Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
3314 @item i
3315 @opindex di
3316 Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
3317 @item j
3318 @opindex dj
3319 Dump after the first jump optimization, to @file{@var{file}.04.jump}.
3320 @item k
3321 @opindex dk
3322 Dump after conversion from registers to stack, to @file{@var{file}.36.stack}.
3323 @item l
3324 @opindex dl
3325 Dump after local register allocation, to @file{@var{file}.26.lreg}.
3326 @item L
3327 @opindex dL
3328 Dump after loop optimization passes, to @file{@var{file}.13.loop} and
3329 @file{@var{file}.19.loop2}.
3330 @item M
3331 @opindex dM
3332 Dump after performing the machine dependent reorganization pass, to
3333 @file{@var{file}.37.mach}.
3334 @item n
3335 @opindex dn
3336 Dump after register renumbering, to @file{@var{file}.31.rnreg}.
3337 @item N
3338 @opindex dN
3339 Dump after the register move pass, to @file{@var{file}.24.regmove}.
3340 @item o
3341 @opindex do
3342 Dump after post-reload optimizations, to @file{@var{file}.28.postreload}.
3343 @item r
3344 @opindex dr
3345 Dump after RTL generation, to @file{@var{file}.01.rtl}.
3346 @item R
3347 @opindex dR
3348 Dump after the second scheduling pass, to @file{@var{file}.35.sched2}.
3349 @item s
3350 @opindex ds
3351 Dump after CSE (including the jump optimization that sometimes follows
3352 CSE), to @file{@var{file}.019.cse}.
3353 @item S
3354 @opindex dS
3355 Dump after the first scheduling pass, to @file{@var{file}.25.sched}.
3356 @item t
3357 @opindex dt
3358 Dump after the second CSE pass (including the jump optimization that
3359 sometimes follows CSE), to @file{@var{file}.20.cse2}.
3360 @item T
3361 @opindex dT
3362 Dump after running tracer, to @file{@var{file}.18.tracer}.
3363 @item u
3364 @opindex du
3365 Dump after null pointer elimination pass to @file{@var{file}.018.null}.
3366 @item U
3367 @opindex dU
3368 Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
3369 @item w
3370 @opindex dw
3371 Dump after the second flow pass, to @file{@var{file}.29.flow2}.
3372 @item W
3373 @opindex dW
3374 Dump after SSA conditional constant propagation, to
3375 @file{@var{file}.06.ssaccp}.
3376 @item X
3377 @opindex dX
3378 Dump after SSA dead code elimination, to @file{@var{file}.07.ssadce}.
3379 @item z
3380 @opindex dz
3381 Dump after the peephole pass, to @file{@var{file}.30.peephole2}.
3382 @item a
3383 @opindex da
3384 Produce all the dumps listed above.
3385 @item H
3386 @opindex dH
3387 Produce a core dump whenever an error occurs.
3388 @item m
3389 @opindex dm
3390 Print statistics on memory usage, at the end of the run, to
3391 standard error.
3392 @item p
3393 @opindex dp
3394 Annotate the assembler output with a comment indicating which
3395 pattern and alternative was used.  The length of each instruction is
3396 also printed.
3397 @item P
3398 @opindex dP
3399 Dump the RTL in the assembler output as a comment before each instruction.
3400 Also turns on @option{-dp} annotation.
3401 @item v
3402 @opindex dv
3403 For each of the other indicated dump files (except for
3404 @file{@var{file}.01.rtl}), dump a representation of the control flow graph
3405 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3406 @item x
3407 @opindex dx
3408 Just generate RTL for a function instead of compiling it.  Usually used
3409 with @samp{r}.
3410 @item y
3411 @opindex dy
3412 Dump debugging information during parsing, to standard error.
3413 @end table
3414
3415 @item -fdump-unnumbered
3416 @opindex fdump-unnumbered
3417 When doing debugging dumps (see @option{-d} option above), suppress instruction
3418 numbers and line number note output.  This makes it more feasible to
3419 use diff on debugging dumps for compiler invocations with different
3420 options, in particular with and without @option{-g}.
3421
3422 @item -fdump-translation-unit @r{(C and C++ only)}
3423 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3424 @opindex fdump-translation-unit
3425 Dump a representation of the tree structure for the entire translation
3426 unit to a file.  The file name is made by appending @file{.tu} to the
3427 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3428 controls the details of the dump as described for the
3429 @option{-fdump-tree} options.
3430
3431 @item -fdump-class-hierarchy @r{(C++ only)}
3432 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3433 @opindex fdump-class-hierarchy
3434 Dump a representation of each class's hierarchy and virtual function
3435 table layout to a file.  The file name is made by appending @file{.class}
3436 to the source file name.  If the @samp{-@var{options}} form is used,
3437 @var{options} controls the details of the dump as described for the
3438 @option{-fdump-tree} options.
3439
3440 @item -fdump-tree-@var{switch} @r{(C++ only)}
3441 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3442 @opindex fdump-tree
3443 Control the dumping at various stages of processing the intermediate
3444 language tree to a file.  The file name is generated by appending a switch
3445 specific suffix to the source file name.  If the @samp{-@var{options}}
3446 form is used, @var{options} is a list of @samp{-} separated options that
3447 control the details of the dump. Not all options are applicable to all
3448 dumps, those which are not meaningful will be ignored. The following
3449 options are available
3450
3451 @table @samp
3452 @item address
3453 Print the address of each node.  Usually this is not meaningful as it
3454 changes according to the environment and source file. Its primary use
3455 is for tying up a dump file with a debug environment.
3456 @item slim
3457 Inhibit dumping of members of a scope or body of a function merely
3458 because that scope has been reached. Only dump such items when they
3459 are directly reachable by some other path.
3460 @item all
3461 Turn on all options.
3462 @end table
3463
3464 The following tree dumps are possible:
3465 @table @samp
3466 @item original
3467 Dump before any tree based optimization, to @file{@var{file}.original}.
3468 @item optimized
3469 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3470 @item inlined
3471 Dump after function inlining, to @file{@var{file}.inlined}.
3472 @end table
3473
3474 @item -frandom-seed=@var{string}
3475 @opindex frandom-string
3476 This option provides a seed that GCC uses when it would otherwise use
3477 random numbers.  It is used to generate certain symbol names
3478 that have to be different in every compiled file. It is also used to
3479 place unique stamps in coverage data files and the object files that
3480 produce them. You can use the @option{-frandom-seed} option to produce
3481 reproducibly identical object files.
3482
3483 The @var{string} should be different for every file you compile.
3484
3485 @item -fsched-verbose=@var{n}
3486 @opindex fsched-verbose
3487 On targets that use instruction scheduling, this option controls the
3488 amount of debugging output the scheduler prints.  This information is
3489 written to standard error, unless @option{-dS} or @option{-dR} is
3490 specified, in which case it is output to the usual dump
3491 listing file, @file{.sched} or @file{.sched2} respectively.  However
3492 for @var{n} greater than nine, the output is always printed to standard
3493 error.
3494
3495 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3496 same information as @option{-dRS}.  For @var{n} greater than one, it
3497 also output basic block probabilities, detailed ready list information
3498 and unit/insn info.  For @var{n} greater than two, it includes RTL
3499 at abort point, control-flow and regions info.  And for @var{n} over
3500 four, @option{-fsched-verbose} also includes dependence info.
3501
3502 @item -save-temps
3503 @opindex save-temps
3504 Store the usual ``temporary'' intermediate files permanently; place them
3505 in the current directory and name them based on the source file.  Thus,
3506 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3507 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3508 preprocessed @file{foo.i} output file even though the compiler now
3509 normally uses an integrated preprocessor.
3510
3511 @item -time
3512 @opindex time
3513 Report the CPU time taken by each subprocess in the compilation
3514 sequence.  For C source files, this is the compiler proper and assembler
3515 (plus the linker if linking is done).  The output looks like this:
3516
3517 @smallexample
3518 # cc1 0.12 0.01
3519 # as 0.00 0.01
3520 @end smallexample
3521
3522 The first number on each line is the ``user time,'' that is time spent
3523 executing the program itself.  The second number is ``system time,''
3524 time spent executing operating system routines on behalf of the program.
3525 Both numbers are in seconds.
3526
3527 @item -print-file-name=@var{library}
3528 @opindex print-file-name
3529 Print the full absolute name of the library file @var{library} that
3530 would be used when linking---and don't do anything else.  With this
3531 option, GCC does not compile or link anything; it just prints the
3532 file name.
3533
3534 @item -print-multi-directory
3535 @opindex print-multi-directory
3536 Print the directory name corresponding to the multilib selected by any
3537 other switches present in the command line.  This directory is supposed
3538 to exist in @env{GCC_EXEC_PREFIX}.
3539
3540 @item -print-multi-lib
3541 @opindex print-multi-lib
3542 Print the mapping from multilib directory names to compiler switches
3543 that enable them.  The directory name is separated from the switches by
3544 @samp{;}, and each switch starts with an @samp{@@} instead of the
3545 @samp{-}, without spaces between multiple switches.  This is supposed to
3546 ease shell-processing.
3547
3548 @item -print-prog-name=@var{program}
3549 @opindex print-prog-name
3550 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3551
3552 @item -print-libgcc-file-name
3553 @opindex print-libgcc-file-name
3554 Same as @option{-print-file-name=libgcc.a}.
3555
3556 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3557 but you do want to link with @file{libgcc.a}.  You can do
3558
3559 @example
3560 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3561 @end example
3562
3563 @item -print-search-dirs
3564 @opindex print-search-dirs
3565 Print the name of the configured installation directory and a list of
3566 program and library directories gcc will search---and don't do anything else.
3567
3568 This is useful when gcc prints the error message
3569 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3570 To resolve this you either need to put @file{cpp0} and the other compiler
3571 components where gcc expects to find them, or you can set the environment
3572 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3573 Don't forget the trailing '/'.
3574 @xref{Environment Variables}.
3575
3576 @item -dumpmachine
3577 @opindex dumpmachine
3578 Print the compiler's target machine (for example,
3579 @samp{i686-pc-linux-gnu})---and don't do anything else.
3580
3581 @item -dumpversion
3582 @opindex dumpversion
3583 Print the compiler version (for example, @samp{3.0})---and don't do
3584 anything else.
3585
3586 @item -dumpspecs
3587 @opindex dumpspecs
3588 Print the compiler's built-in specs---and don't do anything else.  (This
3589 is used when GCC itself is being built.)  @xref{Spec Files}.
3590
3591 @item -feliminate-unused-debug-types
3592 @opindex feliminate-unused-debug-types
3593 Normally, when producing DWARF2 output, GCC will emit debugging
3594 information for all types declared in a compilation
3595 unit, regardless of whether or not they are actually used
3596 in that compilation unit.  Sometimes this is useful, such as
3597 if, in the debugger, you want to cast a value to a type that is
3598 not actually used in your program (but is declared).  More often,
3599 however, this results in a significant amount of wasted space.
3600 With this option, GCC will avoid producing debug symbol output
3601 for types that are nowhere used in the source file being compiled.
3602 @end table
3603
3604 @node Optimize Options
3605 @section Options That Control Optimization
3606 @cindex optimize options
3607 @cindex options, optimization
3608
3609 These options control various sorts of optimizations.
3610
3611 Without any optimization option, the compiler's goal is to reduce the
3612 cost of compilation and to make debugging produce the expected
3613 results.  Statements are independent: if you stop the program with a
3614 breakpoint between statements, you can then assign a new value to any
3615 variable or change the program counter to any other statement in the
3616 function and get exactly the results you would expect from the source
3617 code.
3618
3619 Turning on optimization flags makes the compiler attempt to improve
3620 the performance and/or code size at the expense of compilation time
3621 and possibly the ability to debug the program.
3622
3623 The compiler performs optimisation based on the knowledge it has of
3624 the program.  Using the @option{-funit-at-a-time} flag will allow the
3625 compiler to consider information gained from later functions in the
3626 file when compiling a function.  Compiling multiple files at once to a
3627 single output file (and using @option{-funit-at-a-time}) will allow
3628 the compiler to use information gained from all of the files when
3629 compiling each of them.
3630
3631 Not all optimizations are controlled directly by a flag.  Only
3632 optimizations that have a flag are listed.
3633
3634 @table @gcctabopt
3635 @item -O
3636 @itemx -O1
3637 @opindex O
3638 @opindex O1
3639 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3640 more memory for a large function.
3641
3642 With @option{-O}, the compiler tries to reduce code size and execution
3643 time, without performing any optimizations that take a great deal of
3644 compilation time.
3645
3646 @option{-O} turns on the following optimization flags: 
3647 @gccoptlist{-fdefer-pop @gol
3648 -fmerge-constants @gol
3649 -fthread-jumps @gol
3650 -floop-optimize @gol
3651 -fcrossjumping @gol
3652 -fif-conversion @gol
3653 -fif-conversion2 @gol
3654 -fdelayed-branch @gol
3655 -fguess-branch-probability @gol
3656 -fcprop-registers}
3657
3658 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
3659 where doing so does not interfere with debugging.
3660
3661 @item -O2
3662 @opindex O2
3663 Optimize even more.  GCC performs nearly all supported optimizations
3664 that do not involve a space-speed tradeoff.  The compiler does not
3665 perform loop unrolling or function inlining when you specify @option{-O2}.
3666 As compared to @option{-O}, this option increases both compilation time
3667 and the performance of the generated code.
3668
3669 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
3670 also turns on the following optimization flags:
3671 @gccoptlist{-fforce-mem @gol
3672 -foptimize-sibling-calls @gol
3673 -fstrength-reduce @gol
3674 -fcse-follow-jumps  -fcse-skip-blocks @gol
3675 -frerun-cse-after-loop  -frerun-loop-opt @gol
3676 -fgcse   -fgcse-lm   -fgcse-sm @gol
3677 -fdelete-null-pointer-checks @gol
3678 -fexpensive-optimizations @gol
3679 -fregmove @gol
3680 -fschedule-insns  -fschedule-insns2 @gol
3681 -fsched-interblock  -fsched-spec @gol
3682 -fcaller-saves @gol
3683 -fpeephole2 @gol
3684 -freorder-blocks  -freorder-functions @gol
3685 -fstrict-aliasing @gol
3686 -falign-functions  -falign-jumps @gol
3687 -falign-loops  -falign-labels}
3688
3689 Please note the warning under @option{-fgcse} about
3690 invoking @option{-O2} on programs that use computed gotos.
3691
3692 @item -O3
3693 @opindex O3
3694 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3695 @option{-O2} and also turns on the @option{-finline-functions},
3696 @option{-funit-at-a-time} and @option{-frename-registers} options.
3697
3698 @item -O0
3699 @opindex O0
3700 Do not optimize.  This is the default.
3701
3702 @item -Os
3703 @opindex Os
3704 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3705 do not typically increase code size.  It also performs further
3706 optimizations designed to reduce code size.
3707
3708 @option{-Os} disables the following optimization flags:
3709 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3710 -falign-labels  -freorder-blocks  -fprefetch-loop-arrays}
3711
3712 If you use multiple @option{-O} options, with or without level numbers,
3713 the last such option is the one that is effective.
3714 @end table
3715
3716 Options of the form @option{-f@var{flag}} specify machine-independent
3717 flags.  Most flags have both positive and negative forms; the negative
3718 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3719 below, only one of the forms is listed---the one you typically will
3720 use.  You can figure out the other form by either removing @samp{no-}
3721 or adding it.
3722
3723 The following options control specific optimizations.  They are either
3724 activated by @option{-O} options or are related to ones that are.  You
3725 can use the following flags in the rare cases when ``fine-tuning'' of
3726 optimizations to be performed is desired.
3727
3728 @table @gcctabopt
3729 @item -fno-default-inline
3730 @opindex fno-default-inline
3731 Do not make member functions inline by default merely because they are
3732 defined inside the class scope (C++ only).  Otherwise, when you specify
3733 @w{@option{-O}}, member functions defined inside class scope are compiled
3734 inline by default; i.e., you don't need to add @samp{inline} in front of
3735 the member function name.
3736
3737 @item -fno-defer-pop
3738 @opindex fno-defer-pop
3739 Always pop the arguments to each function call as soon as that function
3740 returns.  For machines which must pop arguments after a function call,
3741 the compiler normally lets arguments accumulate on the stack for several
3742 function calls and pops them all at once.
3743
3744 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3745
3746 @item -fforce-mem
3747 @opindex fforce-mem
3748 Force memory operands to be copied into registers before doing
3749 arithmetic on them.  This produces better code by making all memory
3750 references potential common subexpressions.  When they are not common
3751 subexpressions, instruction combination should eliminate the separate
3752 register-load.
3753
3754 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3755
3756 @item -fforce-addr
3757 @opindex fforce-addr
3758 Force memory address constants to be copied into registers before
3759 doing arithmetic on them.  This may produce better code just as
3760 @option{-fforce-mem} may.
3761
3762 @item -fomit-frame-pointer
3763 @opindex fomit-frame-pointer
3764 Don't keep the frame pointer in a register for functions that
3765 don't need one.  This avoids the instructions to save, set up and
3766 restore frame pointers; it also makes an extra register available
3767 in many functions.  @strong{It also makes debugging impossible on
3768 some machines.}
3769
3770 On some machines, such as the VAX, this flag has no effect, because
3771 the standard calling sequence automatically handles the frame pointer
3772 and nothing is saved by pretending it doesn't exist.  The
3773 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3774 whether a target machine supports this flag.  @xref{Registers,,Register
3775 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3776
3777 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3778
3779 @item -foptimize-sibling-calls
3780 @opindex foptimize-sibling-calls
3781 Optimize sibling and tail recursive calls.
3782
3783 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3784
3785 @item -fno-inline
3786 @opindex fno-inline
3787 Don't pay attention to the @code{inline} keyword.  Normally this option
3788 is used to keep the compiler from expanding any functions inline.
3789 Note that if you are not optimizing, no functions can be expanded inline.
3790
3791 @item -finline-functions
3792 @opindex finline-functions
3793 Integrate all simple functions into their callers.  The compiler
3794 heuristically decides which functions are simple enough to be worth
3795 integrating in this way.
3796
3797 If all calls to a given function are integrated, and the function is
3798 declared @code{static}, then the function is normally not output as
3799 assembler code in its own right.
3800
3801 Enabled at level @option{-O3}.
3802
3803 @item -finline-limit=@var{n}
3804 @opindex finline-limit
3805 By default, gcc limits the size of functions that can be inlined.  This flag
3806 allows the control of this limit for functions that are explicitly marked as
3807 inline (i.e., marked with the inline keyword or defined within the class
3808 definition in c++).  @var{n} is the size of functions that can be inlined in
3809 number of pseudo instructions (not counting parameter handling).  The default
3810 value of @var{n} is 600.
3811 Increasing this value can result in more inlined code at
3812 the cost of compilation time and memory consumption.  Decreasing usually makes
3813 the compilation faster and less code will be inlined (which presumably
3814 means slower programs).  This option is particularly useful for programs that
3815 use inlining heavily such as those based on recursive templates with C++.
3816
3817 Inlining is actually controlled by a number of parameters, which may be
3818 specified individually by using @option{--param @var{name}=@var{value}}.
3819 The @option{-finline-limit=@var{n}} option sets some of these parameters 
3820 as follows:
3821
3822 @table @gcctabopt
3823  @item max-inline-insns
3824   is set to @var{n}.
3825  @item max-inline-insns-single
3826   is set to @var{n}/2.
3827  @item max-inline-insns-auto
3828   is set to @var{n}/2.
3829  @item min-inline-insns
3830   is set to 130 or @var{n}/4, whichever is smaller.
3831  @item max-inline-insns-rtl
3832   is set to @var{n}.
3833 @end table
3834
3835 Using @option{-finline-limit=600} thus results in the default settings
3836 for these parameters.  See below for a documentation of the individual
3837 parameters controlling inlining.
3838
3839 @emph{Note:} pseudo instruction represents, in this particular context, an
3840 abstract measurement of function's size.  In no way, it represents a count
3841 of assembly instructions and as such its exact meaning might change from one
3842 release to an another.
3843
3844 @item -fkeep-inline-functions
3845 @opindex fkeep-inline-functions
3846 Even if all calls to a given function are integrated, and the function
3847 is declared @code{static}, nevertheless output a separate run-time
3848 callable version of the function.  This switch does not affect
3849 @code{extern inline} functions.
3850
3851 @item -fkeep-static-consts
3852 @opindex fkeep-static-consts
3853 Emit variables declared @code{static const} when optimization isn't turned
3854 on, even if the variables aren't referenced.
3855
3856 GCC enables this option by default.  If you want to force the compiler to
3857 check if the variable was referenced, regardless of whether or not
3858 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3859
3860 @item -fmerge-constants
3861 Attempt to merge identical constants (string constants and floating point
3862 constants) across compilation units.
3863
3864 This option is the default for optimized compilation if the assembler and
3865 linker support it.  Use @option{-fno-merge-constants} to inhibit this
3866 behavior.
3867
3868 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3869
3870 @item -fmerge-all-constants
3871 Attempt to merge identical constants and identical variables.
3872
3873 This option implies @option{-fmerge-constants}.  In addition to
3874 @option{-fmerge-constants} this considers e.g. even constant initialized
3875 arrays or initialized constant variables with integral or floating point
3876 types.  Languages like C or C++ require each non-automatic variable to
3877 have distinct location, so using this option will result in non-conforming
3878 behavior.
3879
3880 @item -fnew-ra
3881 @opindex fnew-ra
3882 Use a graph coloring register allocator.  Currently this option is meant
3883 for testing, so we are interested to hear about miscompilations with
3884 @option{-fnew-ra}.
3885
3886 @item -fno-branch-count-reg
3887 @opindex fno-branch-count-reg
3888 Do not use ``decrement and branch'' instructions on a count register,
3889 but instead generate a sequence of instructions that decrement a
3890 register, compare it against zero, then branch based upon the result.
3891 This option is only meaningful on architectures that support such
3892 instructions, which include x86, PowerPC, IA-64 and S/390.
3893
3894 The default is @option{-fbranch-count-reg}, enabled when
3895 @option{-fstrength-reduce} is enabled.
3896
3897 @item -fno-function-cse
3898 @opindex fno-function-cse
3899 Do not put function addresses in registers; make each instruction that
3900 calls a constant function contain the function's address explicitly.
3901
3902 This option results in less efficient code, but some strange hacks
3903 that alter the assembler output may be confused by the optimizations
3904 performed when this option is not used.
3905
3906 The default is @option{-ffunction-cse}
3907
3908 @item -fno-zero-initialized-in-bss
3909 @opindex fno-zero-initialized-in-bss
3910 If the target supports a BSS section, GCC by default puts variables that
3911 are initialized to zero into BSS@.  This can save space in the resulting
3912 code.
3913
3914 This option turns off this behavior because some programs explicitly
3915 rely on variables going to the data section.  E.g., so that the
3916 resulting executable can find the beginning of that section and/or make
3917 assumptions based on that.
3918
3919 The default is @option{-fzero-initialized-in-bss}.
3920
3921 @item -fstrength-reduce
3922 @opindex fstrength-reduce
3923 Perform the optimizations of loop strength reduction and
3924 elimination of iteration variables.
3925
3926 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3927
3928 @item -fthread-jumps
3929 @opindex fthread-jumps
3930 Perform optimizations where we check to see if a jump branches to a
3931 location where another comparison subsumed by the first is found.  If
3932 so, the first branch is redirected to either the destination of the
3933 second branch or a point immediately following it, depending on whether
3934 the condition is known to be true or false.
3935
3936 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3937
3938 @item -fcse-follow-jumps
3939 @opindex fcse-follow-jumps
3940 In common subexpression elimination, scan through jump instructions
3941 when the target of the jump is not reached by any other path.  For
3942 example, when CSE encounters an @code{if} statement with an
3943 @code{else} clause, CSE will follow the jump when the condition
3944 tested is false.
3945
3946 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3947
3948 @item -fcse-skip-blocks
3949 @opindex fcse-skip-blocks
3950 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3951 follow jumps which conditionally skip over blocks.  When CSE
3952 encounters a simple @code{if} statement with no else clause,
3953 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3954 body of the @code{if}.
3955
3956 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3957
3958 @item -frerun-cse-after-loop
3959 @opindex frerun-cse-after-loop
3960 Re-run common subexpression elimination after loop optimizations has been
3961 performed.
3962
3963 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3964
3965 @item -frerun-loop-opt
3966 @opindex frerun-loop-opt
3967 Run the loop optimizer twice.
3968
3969 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3970
3971 @item -fgcse
3972 @opindex fgcse
3973 Perform a global common subexpression elimination pass.
3974 This pass also performs global constant and copy propagation.
3975
3976 @emph{Note:} When compiling a program using computed gotos, a GCC
3977 extension, you may get better runtime performance if you disable
3978 the global common subexpression elimination pass by adding
3979 @option{-fno-gcse} to the command line.
3980
3981 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3982
3983 @item -fgcse-lm
3984 @opindex fgcse-lm
3985 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3986 attempt to move loads which are only killed by stores into themselves.  This
3987 allows a loop containing a load/store sequence to be changed to a load outside
3988 the loop, and a copy/store within the loop.
3989
3990 Enabled by default when gcse is enabled.
3991
3992 @item -fgcse-sm
3993 @opindex fgcse-sm
3994 When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
3995 subexpression elimination.  This pass will attempt to move stores out of loops.
3996 When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
3997 can be changed to a load before the loop and a store after the loop.
3998
3999 Enabled by default when gcse is enabled.
4000
4001 @item -floop-optimize
4002 @opindex floop-optimize
4003 Perform loop optimizations: move constant expressions out of loops, simplify
4004 exit test conditions and optionally do strength-reduction and loop unrolling as
4005 well.
4006
4007 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4008
4009 @item -fcrossjumping
4010 @opindex crossjumping
4011 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
4012 resulting code may or may not perform better than without cross-jumping.
4013
4014 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4015
4016 @item -fif-conversion
4017 @opindex if-conversion
4018 Attempt to transform conditional jumps into branch-less equivalents.  This
4019 include use of conditional moves, min, max, set flags and abs instructions, and
4020 some tricks doable by standard arithmetics.  The use of conditional execution
4021 on chips where it is available is controlled by @code{if-conversion2}.
4022
4023 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4024
4025 @item -fif-conversion2
4026 @opindex if-conversion2
4027 Use conditional execution (where available) to transform conditional jumps into
4028 branch-less equivalents.
4029
4030 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4031
4032 @item -fdelete-null-pointer-checks
4033 @opindex fdelete-null-pointer-checks
4034 Use global dataflow analysis to identify and eliminate useless checks
4035 for null pointers.  The compiler assumes that dereferencing a null
4036 pointer would have halted the program.  If a pointer is checked after
4037 it has already been dereferenced, it cannot be null.
4038
4039 In some environments, this assumption is not true, and programs can
4040 safely dereference null pointers.  Use
4041 @option{-fno-delete-null-pointer-checks} to disable this optimization
4042 for programs which depend on that behavior.
4043
4044 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4045
4046 @item -fexpensive-optimizations
4047 @opindex fexpensive-optimizations
4048 Perform a number of minor optimizations that are relatively expensive.
4049
4050 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4051
4052 @item -foptimize-register-move
4053 @itemx -fregmove
4054 @opindex foptimize-register-move
4055 @opindex fregmove
4056 Attempt to reassign register numbers in move instructions and as
4057 operands of other simple instructions in order to maximize the amount of
4058 register tying.  This is especially helpful on machines with two-operand
4059 instructions.
4060
4061 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4062 optimization.
4063
4064 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4065
4066 @item -fdelayed-branch
4067 @opindex fdelayed-branch
4068 If supported for the target machine, attempt to reorder instructions
4069 to exploit instruction slots available after delayed branch
4070 instructions.
4071
4072 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4073
4074 @item -fschedule-insns
4075 @opindex fschedule-insns
4076 If supported for the target machine, attempt to reorder instructions to
4077 eliminate execution stalls due to required data being unavailable.  This
4078 helps machines that have slow floating point or memory load instructions
4079 by allowing other instructions to be issued until the result of the load
4080 or floating point instruction is required.
4081
4082 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4083
4084 @item -fschedule-insns2
4085 @opindex fschedule-insns2
4086 Similar to @option{-fschedule-insns}, but requests an additional pass of
4087 instruction scheduling after register allocation has been done.  This is
4088 especially useful on machines with a relatively small number of
4089 registers and where memory load instructions take more than one cycle.
4090
4091 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4092
4093 @item -fno-sched-interblock
4094 @opindex fno-sched-interblock
4095 Don't schedule instructions across basic blocks.  This is normally
4096 enabled by default when scheduling before register allocation, i.e.@:
4097 with @option{-fschedule-insns} or at @option{-O2} or higher.
4098
4099 @item -fno-sched-spec
4100 @opindex fno-sched-spec
4101 Don't allow speculative motion of non-load instructions.  This is normally
4102 enabled by default when scheduling before register allocation, i.e.@:
4103 with @option{-fschedule-insns} or at @option{-O2} or higher.
4104
4105 @item -fsched-spec-load
4106 @opindex fsched-spec-load
4107 Allow speculative motion of some load instructions.  This only makes
4108 sense when scheduling before register allocation, i.e.@: with
4109 @option{-fschedule-insns} or at @option{-O2} or higher.
4110
4111 @item -fsched-spec-load-dangerous
4112 @opindex fsched-spec-load-dangerous
4113 Allow speculative motion of more load instructions.  This only makes
4114 sense when scheduling before register allocation, i.e.@: with
4115 @option{-fschedule-insns} or at @option{-O2} or higher.
4116
4117 @item -fsched2-use-superblocks
4118 @opindex fsched2-use-superblocks
4119 When scheduling after register allocation, do use superblock scheduling
4120 algorithm.  Superblock scheduling allows motion across basic block boundaries
4121 resulting on faster schedules.  This option is experimental, as not all machine
4122 descriptions used by GCC model the CPU closely enough to avoid unreliable
4123 results from the algorithm. 
4124
4125 This only makes sense when scheduling after register allocation, i.e.@: with
4126 @option{-fschedule-insns2} or at @option{-O2} or higher.
4127
4128 @item -fsched2-use-traces
4129 @opindex fsched2-use-traces
4130 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4131 allocation and additionally perform code duplication in order to increase the
4132 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4133 trace formation.
4134
4135 This mode should produce faster but significantly longer programs.  Also
4136 without @code{-fbranch-probabilities} the traces constructed may not match the
4137 reality and hurt the performance.  This only makes
4138 sense when scheduling after register allocation, i.e.@: with
4139 @option{-fschedule-insns2} or at @option{-O2} or higher.
4140
4141 @item -fcaller-saves
4142 @opindex fcaller-saves
4143 Enable values to be allocated in registers that will be clobbered by
4144 function calls, by emitting extra instructions to save and restore the
4145 registers around such calls.  Such allocation is done only when it
4146 seems to result in better code than would otherwise be produced.
4147
4148 This option is always enabled by default on certain machines, usually
4149 those which have no call-preserved registers to use instead.
4150
4151 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4152
4153 @item -fmove-all-movables
4154 @opindex fmove-all-movables
4155 Forces all invariant computations in loops to be moved
4156 outside the loop.
4157
4158 @item -freduce-all-givs
4159 @opindex freduce-all-givs
4160 Forces all general-induction variables in loops to be
4161 strength-reduced.
4162
4163 @emph{Note:} When compiling programs written in Fortran,
4164 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
4165 by default when you use the optimizer.
4166
4167 These options may generate better or worse code; results are highly
4168 dependent on the structure of loops within the source code.
4169
4170 These two options are intended to be removed someday, once
4171 they have helped determine the efficacy of various
4172 approaches to improving loop optimizations.
4173
4174 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
4175 know how use of these options affects
4176 the performance of your production code.
4177 We're very interested in code that runs @emph{slower}
4178 when these options are @emph{enabled}.
4179
4180 @item -fno-peephole
4181 @itemx -fno-peephole2
4182 @opindex fno-peephole
4183 @opindex fno-peephole2
4184 Disable any machine-specific peephole optimizations.  The difference
4185 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
4186 are implemented in the compiler; some targets use one, some use the
4187 other, a few use both.
4188
4189 @option{-fpeephole} is enabled by default.
4190 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4191
4192 @item -fno-guess-branch-probability
4193 @opindex fno-guess-branch-probability
4194 Do not guess branch probabilities using a randomized model.
4195
4196 Sometimes gcc will opt to use a randomized model to guess branch
4197 probabilities, when none are available from either profiling feedback
4198 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
4199 different runs of the compiler on the same program may produce different
4200 object code.
4201
4202 In a hard real-time system, people don't want different runs of the
4203 compiler to produce code that has different behavior; minimizing
4204 non-determinism is of paramount import.  This switch allows users to
4205 reduce non-determinism, possibly at the expense of inferior
4206 optimization.
4207
4208 The default is @option{-fguess-branch-probability} at levels
4209 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4210
4211 @item -freorder-blocks
4212 @opindex freorder-blocks
4213 Reorder basic blocks in the compiled function in order to reduce number of
4214 taken branches and improve code locality.
4215
4216 Enabled at levels @option{-O2}, @option{-O3}.
4217
4218 @item -freorder-functions
4219 @opindex freorder-functions
4220 Reorder basic blocks in the compiled function in order to reduce number of
4221 taken branches and improve code locality. This is implemented by using special
4222 subsections @code{text.hot} for most frequently executed functions and
4223 @code{text.unlikely} for unlikely executed functions.  Reordering is done by
4224 the linker so object file format must support named sections and linker must
4225 place them in a reasonable way.
4226
4227 Also profile feedback must be available in to make this option effective.  See
4228 @option{-fprofile-arcs} for details.
4229
4230 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4231
4232 @item -fstrict-aliasing
4233 @opindex fstrict-aliasing
4234 Allows the compiler to assume the strictest aliasing rules applicable to
4235 the language being compiled.  For C (and C++), this activates
4236 optimizations based on the type of expressions.  In particular, an
4237 object of one type is assumed never to reside at the same address as an
4238 object of a different type, unless the types are almost the same.  For
4239 example, an @code{unsigned int} can alias an @code{int}, but not a
4240 @code{void*} or a @code{double}.  A character type may alias any other
4241 type.
4242
4243 Pay special attention to code like this:
4244 @example
4245 union a_union @{
4246   int i;
4247   double d;
4248 @};
4249
4250 int f() @{
4251   a_union t;
4252   t.d = 3.0;
4253   return t.i;
4254 @}
4255 @end example
4256 The practice of reading from a different union member than the one most
4257 recently written to (called ``type-punning'') is common.  Even with
4258 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4259 is accessed through the union type.  So, the code above will work as
4260 expected.  However, this code might not:
4261 @example
4262 int f() @{
4263   a_union t;
4264   int* ip;
4265   t.d = 3.0;
4266   ip = &t.i;
4267   return *ip;
4268 @}
4269 @end example
4270
4271 Every language that wishes to perform language-specific alias analysis
4272 should define a function that computes, given an @code{tree}
4273 node, an alias set for the node.  Nodes in different alias sets are not
4274 allowed to alias.  For an example, see the C front-end function
4275 @code{c_get_alias_set}.
4276
4277 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4278
4279 @item -falign-functions
4280 @itemx -falign-functions=@var{n}
4281 @opindex falign-functions
4282 Align the start of functions to the next power-of-two greater than
4283 @var{n}, skipping up to @var{n} bytes.  For instance,
4284 @option{-falign-functions=32} aligns functions to the next 32-byte
4285 boundary, but @option{-falign-functions=24} would align to the next
4286 32-byte boundary only if this can be done by skipping 23 bytes or less.
4287
4288 @option{-fno-align-functions} and @option{-falign-functions=1} are
4289 equivalent and mean that functions will not be aligned.
4290
4291 Some assemblers only support this flag when @var{n} is a power of two;
4292 in that case, it is rounded up.
4293
4294 If @var{n} is not specified or is zero, use a machine-dependent default.
4295
4296 Enabled at levels @option{-O2}, @option{-O3}.
4297
4298 @item -falign-labels
4299 @itemx -falign-labels=@var{n}
4300 @opindex falign-labels
4301 Align all branch targets to a power-of-two boundary, skipping up to
4302 @var{n} bytes like @option{-falign-functions}.  This option can easily
4303 make code slower, because it must insert dummy operations for when the
4304 branch target is reached in the usual flow of the code.
4305
4306 @option{-fno-align-labels} and @option{-falign-labels=1} are
4307 equivalent and mean that labels will not be aligned.
4308
4309 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4310 are greater than this value, then their values are used instead.
4311
4312 If @var{n} is not specified or is zero, use a machine-dependent default
4313 which is very likely to be @samp{1}, meaning no alignment.
4314
4315 Enabled at levels @option{-O2}, @option{-O3}.
4316
4317 @item -falign-loops
4318 @itemx -falign-loops=@var{n}
4319 @opindex falign-loops
4320 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4321 like @option{-falign-functions}.  The hope is that the loop will be
4322 executed many times, which will make up for any execution of the dummy
4323 operations.
4324
4325 @option{-fno-align-loops} and @option{-falign-loops=1} are
4326 equivalent and mean that loops will not be aligned.
4327
4328 If @var{n} is not specified or is zero, use a machine-dependent default.
4329
4330 Enabled at levels @option{-O2}, @option{-O3}.
4331
4332 @item -falign-jumps
4333 @itemx -falign-jumps=@var{n}
4334 @opindex falign-jumps
4335 Align branch targets to a power-of-two boundary, for branch targets
4336 where the targets can only be reached by jumping, skipping up to @var{n}
4337 bytes like @option{-falign-functions}.  In this case, no dummy operations
4338 need be executed.
4339
4340 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
4341 equivalent and mean that loops will not be aligned.
4342
4343 If @var{n} is not specified or is zero, use a machine-dependent default.
4344
4345 Enabled at levels @option{-O2}, @option{-O3}.
4346
4347 @item -frename-registers
4348 @opindex frename-registers
4349 Attempt to avoid false dependencies in scheduled code by making use
4350 of registers left over after register allocation.  This optimization
4351 will most benefit processors with lots of registers.  It can, however,
4352 make debugging impossible, since variables will no longer stay in
4353 a ``home register''.
4354
4355 Enabled at levels @option{-O3}.
4356
4357 @item -fno-cprop-registers
4358 @opindex fno-cprop-registers
4359 After register allocation and post-register allocation instruction splitting,
4360 we perform a copy-propagation pass to try to reduce scheduling dependencies
4361 and occasionally eliminate the copy.
4362
4363 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4364
4365 @end table
4366
4367 The following options control compiler behavior regarding floating
4368 point arithmetic.  These options trade off between speed and
4369 correctness.  All must be specifically enabled.
4370
4371 @table @gcctabopt
4372 @item -ffloat-store
4373 @opindex ffloat-store
4374 Do not store floating point variables in registers, and inhibit other
4375 options that might change whether a floating point value is taken from a
4376 register or memory.
4377
4378 @cindex floating point precision
4379 This option prevents undesirable excess precision on machines such as
4380 the 68000 where the floating registers (of the 68881) keep more
4381 precision than a @code{double} is supposed to have.  Similarly for the
4382 x86 architecture.  For most programs, the excess precision does only
4383 good, but a few programs rely on the precise definition of IEEE floating
4384 point.  Use @option{-ffloat-store} for such programs, after modifying
4385 them to store all pertinent intermediate computations into variables.
4386
4387 @item -ffast-math
4388 @opindex ffast-math
4389 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4390 @option{-fno-trapping-math}, @option{-ffinite-math-only},
4391 @option{-fno-rounding-math} and @option{-fno-signaling-nans}.
4392
4393 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4394
4395 This option should never be turned on by any @option{-O} option since
4396 it can result in incorrect output for programs which depend on
4397 an exact implementation of IEEE or ISO rules/specifications for
4398 math functions.
4399
4400 @item -fno-math-errno
4401 @opindex fno-math-errno
4402 Do not set ERRNO after calling math functions that are executed
4403 with a single instruction, e.g., sqrt.  A program that relies on
4404 IEEE exceptions for math error handling may want to use this flag
4405 for speed while maintaining IEEE arithmetic compatibility.
4406
4407 This option should never be turned on by any @option{-O} option since
4408 it can result in incorrect output for programs which depend on
4409 an exact implementation of IEEE or ISO rules/specifications for
4410 math functions.
4411
4412 The default is @option{-fmath-errno}.
4413
4414 @item -funsafe-math-optimizations
4415 @opindex funsafe-math-optimizations
4416 Allow optimizations for floating-point arithmetic that (a) assume
4417 that arguments and results are valid and (b) may violate IEEE or
4418 ANSI standards.  When used at link-time, it may include libraries
4419 or startup files that change the default FPU control word or other
4420 similar optimizations.
4421
4422 This option should never be turned on by any @option{-O} option since
4423 it can result in incorrect output for programs which depend on
4424 an exact implementation of IEEE or ISO rules/specifications for
4425 math functions.
4426
4427 The default is @option{-fno-unsafe-math-optimizations}.
4428
4429 @item -ffinite-math-only
4430 @opindex ffinite-math-only
4431 Allow optimizations for floating-point arithmetic that assume
4432 that arguments and results are not NaNs or +-Infs.
4433
4434 This option should never be turned on by any @option{-O} option since
4435 it can result in incorrect output for programs which depend on
4436 an exact implementation of IEEE or ISO rules/specifications.
4437
4438 The default is @option{-fno-finite-math-only}.
4439
4440 @item -fno-trapping-math
4441 @opindex fno-trapping-math
4442 Compile code assuming that floating-point operations cannot generate
4443 user-visible traps.  These traps include division by zero, overflow,
4444 underflow, inexact result and invalid operation.  This option implies
4445 @option{-fno-signaling-nans}.  Setting this option may allow faster
4446 code if one relies on ``non-stop'' IEEE arithmetic, for example.
4447
4448 This option should never be turned on by any @option{-O} option since
4449 it can result in incorrect output for programs which depend on
4450 an exact implementation of IEEE or ISO rules/specifications for
4451 math functions.
4452
4453 The default is @option{-ftrapping-math}.
4454
4455 @item -frounding-math
4456 @opindex frounding-math
4457 Disable transformations and optimizations that assume default floating
4458 point rounding behavior.  This is round-to-zero for all floating point
4459 to integer conversions, and round-to-nearest for all other arithmetic
4460 truncations.  This option should be specified for programs that change
4461 the FP rounding mode dynamically, or that may be executed with a
4462 non-default rounding mode.  This option disables constant folding of
4463 floating point expressions at compile-time (which may be affected by
4464 rounding mode) and arithmetic transformations that are unsafe in the
4465 presence of sign-dependent rounding modes.
4466
4467 The default is @option{-fno-rounding-math}.
4468
4469 This option is experimental and does not currently guarantee to
4470 disable all GCC optimizations that are affected by rounding mode.
4471 Future versions of gcc may provide finer control of this setting
4472 using C99's @code{FENV_ACCESS} pragma.  This command line option
4473 will be used to specify the default state for @code{FENV_ACCESS}.
4474
4475 @item -fsignaling-nans
4476 @opindex fsignaling-nans
4477 Compile code assuming that IEEE signaling NaNs may generate user-visible
4478 traps during floating-point operations.  Setting this option disables
4479 optimizations that may change the number of exceptions visible with
4480 signaling NaNs.  This option implies @option{-ftrapping-math}.
4481
4482 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4483 be defined.
4484
4485 The default is @option{-fno-signaling-nans}.
4486
4487 This option is experimental and does not currently guarantee to
4488 disable all GCC optimizations that affect signaling NaN behavior.
4489
4490 @item -fsingle-precision-constant
4491 @opindex fsingle-precision-constant
4492 Treat floating point constant as single precision constant instead of
4493 implicitly converting it to double precision constant.
4494
4495
4496 @end table
4497
4498 The following options control optimizations that may improve
4499 performance, but are not enabled by any @option{-O} options.  This
4500 section includes experimental options that may produce broken code.
4501
4502 @table @gcctabopt
4503 @item -fbranch-probabilities
4504 @opindex fbranch-probabilities
4505 After running a program compiled with @option{-fprofile-arcs}
4506 (@pxref{Debugging Options,, Options for Debugging Your Program or
4507 @command{gcc}}), you can compile it a second time using
4508 @option{-fbranch-probabilities}, to improve optimizations based on
4509 the number of times each branch was taken.  When the program
4510 compiled with @option{-fprofile-arcs} exits it saves arc execution
4511 counts to a file called @file{@var{sourcename}.gcda} for each source
4512 file  The information in this data file is very dependent on the
4513 structure of the generated code, so you must use the same source code
4514 and the same optimization options for both compilations.
4515
4516 With @option{-fbranch-probabilities}, GCC puts a 
4517 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4518 These can be used to improve optimization.  Currently, they are only
4519 used in one place: in @file{reorg.c}, instead of guessing which path a
4520 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4521 exactly determine which path is taken more often.
4522
4523 @item -fprofile-values
4524 @opindex fprofile-values
4525 If combined with @option{-fprofile-arcs}, it adds code so that some
4526 data about values of expressions in the program is gathered.
4527
4528 With @option{-fbranch-probabilities}, it reads back the data gathered
4529 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4530 notes to instructions for their later usage in optimizations.
4531
4532 @item -fnew-ra
4533 @opindex fnew-ra
4534 Use a graph coloring register allocator.  Currently this option is meant
4535 for testing, so we are interested to hear about miscompilations with
4536 @option{-fnew-ra}.
4537
4538 @item -ftracer
4539 @opindex ftracer
4540 Perform tail duplication to enlarge superblock size. This transformation
4541 simplifies the control flow of the function allowing other optimizations to do
4542 better job.
4543
4544 @item -funit-at-a-time
4545 @opindex funit-at-a-time
4546 Parse the whole compilation unit before starting to produce code.
4547 This allows some extra optimizations to take place but consumes more
4548 memory.
4549
4550 @item -funroll-loops
4551 @opindex funroll-loops
4552 Unroll loops whose number of iterations can be determined at compile time or
4553 upon entry to the loop.  @option{-funroll-loops} implies
4554 @option{-frerun-cse-after-loop}.  It also turns on complete loop peeling
4555 (i.e. complete removal of loops with small constant number of iterations).
4556 This option makes code larger, and may or may not make it run faster.
4557
4558 @item -funroll-all-loops
4559 @opindex funroll-all-loops
4560 Unroll all loops, even if their number of iterations is uncertain when
4561 the loop is entered.  This usually makes programs run more slowly.
4562 @option{-funroll-all-loops} implies the same options as
4563 @option{-funroll-loops}.
4564
4565 @item -fpeel-loops
4566 @opindex fpeel-loops
4567 Peels the loops for that there is enough information that they do not
4568 roll much (from profile feedback).  It also turns on complete loop peeling
4569 (i.e. complete removal of loops with small constant number of iterations).
4570
4571 @item -funswitch-loops
4572 @opindex funswitch-loops
4573 Move branches with loop invariant conditions out of the loop, with duplicates
4574 of the loop on both branches (modified according to result of the condition).
4575
4576 @item -fold-unroll-loops
4577 @opindex fold-unroll-loops
4578 Unroll loops whose number of iterations can be determined at compile
4579 time or upon entry to the loop, using the old loop unroller whose loop
4580 recognition is based on notes from frontend.  @option{-fold-unroll-loops} implies
4581 both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4582 option makes code larger, and may or may not make it run faster.
4583
4584 @item -fold-unroll-all-loops
4585 @opindex fold-unroll-all-loops
4586 Unroll all loops, even if their number of iterations is uncertain when
4587 the loop is entered. This is done using the old loop unroller whose loop
4588 recognition is based on notes from frontend.  This usually makes programs run more slowly.
4589 @option{-fold-unroll-all-loops} implies the same options as
4590 @option{-fold-unroll-loops}.
4591  
4592 @item -funswitch-loops
4593 @opindex funswitch-loops
4594 Move branches with loop invariant conditions out of the loop, with duplicates
4595 of the loop on both branches (modified according to result of the condition).
4596
4597 @item -funswitch-loops
4598 @opindex funswitch-loops
4599 Move branches with loop invariant conditions out of the loop, with duplicates
4600 of the loop on both branches (modified according to result of the condition).
4601
4602 @item -fprefetch-loop-arrays
4603 @opindex fprefetch-loop-arrays
4604 If supported by the target machine, generate instructions to prefetch
4605 memory to improve the performance of loops that access large arrays.
4606
4607 Disabled at level @option{-Os}.
4608
4609 @item -ffunction-sections
4610 @itemx -fdata-sections
4611 @opindex ffunction-sections
4612 @opindex fdata-sections
4613 Place each function or data item into its own section in the output
4614 file if the target supports arbitrary sections.  The name of the
4615 function or the name of the data item determines the section's name
4616 in the output file.
4617
4618 Use these options on systems where the linker can perform optimizations
4619 to improve locality of reference in the instruction space.  Most systems
4620 using the ELF object format and SPARC processors running Solaris 2 have
4621 linkers with such optimizations.  AIX may have these optimizations in
4622 the future.
4623
4624 Only use these options when there are significant benefits from doing
4625 so.  When you specify these options, the assembler and linker will
4626 create larger object and executable files and will also be slower.
4627 You will not be able to use @code{gprof} on all systems if you
4628 specify this option and you may have problems with debugging if
4629 you specify both this option and @option{-g}.
4630
4631 @item -fssa
4632 @opindex fssa
4633 Perform optimizations in static single assignment form.  Each function's
4634 flow graph is translated into SSA form, optimizations are performed, and
4635 the flow graph is translated back from SSA form.  Users should not
4636 specify this option, since it is not yet ready for production use.
4637
4638 @item -fssa-ccp
4639 @opindex fssa-ccp
4640 Perform Sparse Conditional Constant Propagation in SSA form.  Requires
4641 @option{-fssa}.  Like @option{-fssa}, this is an experimental feature.
4642
4643 @item -fssa-dce
4644 @opindex fssa-dce
4645 Perform aggressive dead-code elimination in SSA form.  Requires @option{-fssa}.
4646 Like @option{-fssa}, this is an experimental feature.
4647
4648 @item -fbranch-target-load-optimize
4649 @opindex fbranch-target-load-optimize
4650 Perform branch target register load optimization before prologue / epilogue
4651 threading.
4652 The use of target registers can typically be exposed only during reload,
4653 thus hoisting loads out of loops and doing inter-block scheduling needs
4654 a separate optimization pass.
4655
4656 @item -fbranch-target-load-optimize2
4657 @opindex fbranch-target-load-optimize2
4658 Perform branch target register load optimization after prologue / epilogue
4659 threading.
4660
4661
4662
4663
4664 @item --param @var{name}=@var{value}
4665 @opindex param
4666 In some places, GCC uses various constants to control the amount of
4667 optimization that is done.  For example, GCC will not inline functions
4668 that contain more that a certain number of instructions.  You can
4669 control some of these constants on the command-line using the
4670 @option{--param} option.
4671
4672 In each case, the @var{value} is an integer.  The allowable choices for
4673 @var{name} are given in the following table:
4674
4675 @table @gcctabopt
4676 @item max-crossjump-edges
4677 The maximum number of incoming edges to consider for crossjumping.
4678 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
4679 the number of edges incoming to each block.  Increasing values mean
4680 more aggressive optimization, making the compile time increase with
4681 probably small improvement in executable size.
4682
4683 @item max-delay-slot-insn-search
4684 The maximum number of instructions to consider when looking for an
4685 instruction to fill a delay slot.  If more than this arbitrary number of
4686 instructions is searched, the time savings from filling the delay slot
4687 will be minimal so stop searching.  Increasing values mean more
4688 aggressive optimization, making the compile time increase with probably
4689 small improvement in executable run time.
4690
4691 @item max-delay-slot-live-search
4692 When trying to fill delay slots, the maximum number of instructions to
4693 consider when searching for a block with valid live register
4694 information.  Increasing this arbitrarily chosen value means more
4695 aggressive optimization, increasing the compile time.  This parameter
4696 should be removed when the delay slot code is rewritten to maintain the
4697 control-flow graph.
4698
4699 @item max-gcse-memory
4700 The approximate maximum amount of memory that will be allocated in
4701 order to perform the global common subexpression elimination
4702 optimization.  If more memory than specified is required, the
4703 optimization will not be done.
4704
4705 @item max-gcse-passes
4706 The maximum number of passes of GCSE to run.
4707
4708 @item max-pending-list-length
4709 The maximum number of pending dependencies scheduling will allow
4710 before flushing the current state and starting over.  Large functions
4711 with few branches or calls can create excessively large lists which
4712 needlessly consume memory and resources.
4713
4714 @item max-inline-insns-single
4715 Several parameters control the tree inliner used in gcc.
4716 This number sets the maximum number of instructions (counted in gcc's
4717 internal representation) in a single function that the tree inliner 
4718 will consider for inlining.  This only affects functions declared
4719 inline and methods implemented in a class declaration (C++).
4720 The default value is 500.
4721
4722 @item max-inline-insns-auto
4723 When you use @option{-finline-functions} (included in @option{-O3}),
4724 a lot of functions that would otherwise not be considered for inlining
4725 by the compiler will be investigated.  To those functions, a different
4726 (more restrictive) limit compared to functions declared inline can
4727 be applied.
4728 The default value is 150.
4729
4730 @item max-inline-insns
4731 The tree inliner does decrease the allowable size for single functions 
4732 to be inlined after we already inlined the number of instructions
4733 given here by repeated inlining.  This number should be a factor of 
4734 two or more larger than the single function limit.
4735 Higher numbers result in better runtime performance, but incur higher
4736 compile-time resource (CPU time, memory) requirements and result in
4737 larger binaries.  Very high values are not advisable, as too large
4738 binaries may adversely affect runtime performance.
4739 The default value is 200.
4740
4741 @item max-inline-slope
4742 After exceeding the maximum number of inlined instructions by repeated
4743 inlining, a linear function is used to decrease the allowable size
4744 for single functions.  The slope of that function is the negative
4745 reciprocal of the number specified here.
4746 This parameter is ignored when @option{-funit-at-a-time} is used.
4747 The default value is 32.
4748
4749 @item min-inline-insns
4750 The repeated inlining is throttled more and more by the linear function
4751 after exceeding the limit.  To avoid too much throttling, a minimum for
4752 this function is specified here to allow repeated inlining for very small
4753 functions even when a lot of repeated inlining already has been done.
4754 This parameter is ignored when @option{-funit-at-a-time} is used.
4755 The default value is 10.
4756
4757 @item large-function-insns
4758 The limit specifying really large functions.  For functions greater than this
4759 limit inlining is constrained by @option{--param large-function-growth}.
4760 This parameter is usefull primarily to avoid extreme compilation time caused by non-linear
4761 algorithms used by the backend.
4762 This parameter is ignored when @option{-funit-at-a-time} is not used.
4763 The default value is 30000.
4764
4765 @item large-function-growth
4766 Specifies maximal growth of large functtion caused by inlining in percents.
4767 This parameter is ignored when @option{-funit-at-a-time} is not used.
4768 The default value is 200.
4769
4770 @item inline-unit-growth
4771 Specifies maximal overall growth of the compilation unit caused by inlining.
4772 This parameter is ignored when @option{-funit-at-a-time} is not used.
4773 The default value is 150.
4774
4775 @item max-inline-insns-rtl
4776 For languages that use the RTL inliner (this happens at a later stage
4777 than tree inlining), you can set the maximum allowable size (counted 
4778 in RTL instructions) for the RTL inliner with this parameter.
4779 The default value is 600.
4780
4781
4782 @item max-unrolled-insns
4783 The maximum number of instructions that a loop should have if that loop
4784 is unrolled, and if the loop is unrolled, it determines how many times
4785 the loop code is unrolled.
4786
4787 @item max-average-unrolled-insns
4788 The maximum number of instructions biased by probabilities of their execution
4789 that a loop should have if that loop is unrolled, and if the loop is unrolled,
4790 it determines how many times the loop code is unrolled.
4791
4792 @item max-unroll-times
4793 The maximum number of unrollings of a single loop.
4794
4795 @item max-peeled-insns
4796 The maximum number of instructions that a loop should have if that loop
4797 is peeled, and if the loop is peeled, it determines how many times
4798 the loop code is peeled.
4799
4800 @item max-peel-times
4801 The maximum number of peelings of a single loop.
4802
4803 @item max-completely-peeled-insns
4804 The maximum number of insns of a completely peeled loop.
4805
4806 @item max-completely-peel-times
4807 The maximum number of iterations of a loop to be suitable for complete peeling.
4808
4809 @item max-unswitch-insns
4810 The maximum number of insns of an unswitched loop.
4811
4812 @item max-unswitch-level
4813 The maximum number of branches unswitched in a single loop.
4814
4815 @item hot-bb-count-fraction
4816 Select fraction of the maximal count of repetitions of basic block in program
4817 given basic block needs to have to be considered hot.
4818
4819 @item hot-bb-frequency-fraction
4820 Select fraction of the maximal frequency of executions of basic block in
4821 function given basic block needs to have to be considered hot
4822
4823 @item tracer-dynamic-coverage
4824 @itemx tracer-dynamic-coverage-feedback
4825
4826 This value is used to limit superblock formation once the given percentage of
4827 executed instructions is covered.  This limits unnecessary code size
4828 expansion.
4829
4830 The @option{tracer-dynamic-coverage-feedback} is used only when profile
4831 feedback is available.  The real profiles (as opposed to statically estimated
4832 ones) are much less balanced allowing the threshold to be larger value.
4833
4834 @item tracer-max-code-growth
4835 Stop tail duplication once code growth has reached given percentage.  This is
4836 rather hokey argument, as most of the duplicates will be eliminated later in
4837 cross jumping, so it may be set to much higher values than is the desired code
4838 growth.
4839
4840 @item tracer-min-branch-ratio
4841
4842 Stop reverse growth when the reverse probability of best edge is less than this
4843 threshold (in percent).
4844
4845 @item tracer-min-branch-ratio
4846 @itemx tracer-min-branch-ratio-feedback
4847
4848 Stop forward growth if the best edge do have probability lower than this
4849 threshold.
4850
4851 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
4852 compilation for profile feedback and one for compilation without.  The value
4853 for compilation with profile feedback needs to be more conservative (higher) in
4854 order to make tracer effective.
4855
4856 @item max-cse-path-length
4857
4858 Maximum number of basic blocks on path that cse considers.
4859
4860 @item ggc-min-expand
4861
4862 GCC uses a garbage collector to manage its own memory allocation.  This
4863 parameter specifies the minimum percentage by which the garbage
4864 collector's heap should be allowed to expand between collections.
4865 Tuning this may improve compilation speed; it has no effect on code
4866 generation.
4867
4868 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
4869 RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
4870 the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
4871 GCC is not able to calculate RAM on a particular platform, the lower
4872 bound of 30% is used.  Setting this parameter and
4873 @option{ggc-min-heapsize} to zero causes a full collection to occur at
4874 every opportunity.  This is extremely slow, but can be useful for
4875 debugging.
4876
4877 @item ggc-min-heapsize
4878
4879 Minimum size of the garbage collector's heap before it begins bothering
4880 to collect garbage.  The first collection occurs after the heap expands
4881 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
4882 tuning this may improve compilation speed, and has no effect on code
4883 generation.
4884
4885 The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
4886 upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
4887 available, the notion of "RAM" is the smallest of actual RAM,
4888 RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
4889 RAM on a particular platform, the lower bound is used.  Setting this
4890 parameter very large effectively disables garbage collection.  Setting
4891 this parameter and @option{ggc-min-expand} to zero causes a full
4892 collection to occur at every opportunity.
4893
4894 @item reorder-blocks-duplicate
4895 @itemx reorder-blocks-duplicate-feedback
4896
4897 Used by basic block reordering pass to decide whether to use unconditional
4898 branch or duplicate the code on its destination.  Code is duplicated when its
4899 estimated size is smaller than this value multiplied by the estimated size of
4900 unconditional jump in the hot spots of the program.
4901
4902 The @option{reorder-block-duplicate-feedback} is used only when profile
4903 feedback is available and may be set to higher values than
4904 @option{reorder-block-duplicate} since information about the hot spots is more
4905 accurate.
4906 @end table
4907 @end table
4908
4909 @node Preprocessor Options
4910 @section Options Controlling the Preprocessor
4911 @cindex preprocessor options
4912 @cindex options, preprocessor
4913
4914 These options control the C preprocessor, which is run on each C source
4915 file before actual compilation.
4916
4917 If you use the @option{-E} option, nothing is done except preprocessing.
4918 Some of these options make sense only together with @option{-E} because
4919 they cause the preprocessor output to be unsuitable for actual
4920 compilation.
4921
4922 @table @gcctabopt
4923 @opindex Wp
4924 You can use @option{-Wp,@var{option}} to bypass the compiler driver
4925 and pass @var{option} directly through to the preprocessor.  If
4926 @var{option} contains commas, it is split into multiple options at the
4927 commas.  However, many options are modified, translated or interpreted
4928 by the compiler driver before being passed to the preprocessor, and
4929 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4930 interface is undocumented and subject to change, so whenever possible
4931 you should avoid using @option{-Wp} and let the driver handle the
4932 options instead.
4933
4934 @item -Xpreprocessor @var{option}
4935 @opindex preprocessor
4936 Pass @var{option} as an option to the preprocessor.  You can use this to
4937 supply system-specific preprocessor options which GCC does not know how to
4938 recognize.
4939
4940 If you want to pass an option that takes an argument, you must use
4941 @option{-Xpreprocessor} twice, once for the option and once for the argument.
4942 @end table
4943
4944 @include cppopts.texi
4945
4946 @node Assembler Options
4947 @section Passing Options to the Assembler
4948
4949 @c prevent bad page break with this line
4950 You can pass options to the assembler.
4951
4952 @table @gcctabopt
4953 @item -Wa,@var{option}
4954 @opindex Wa
4955 Pass @var{option} as an option to the assembler.  If @var{option}
4956 contains commas, it is split into multiple options at the commas.
4957
4958 @item -Xassembler @var{option}
4959 @opindex Xassembler
4960 Pass @var{option} as an option to the assembler.  You can use this to
4961 supply system-specific assembler options which GCC does not know how to
4962 recognize.
4963
4964 If you want to pass an option that takes an argument, you must use
4965 @option{-Xassembler} twice, once for the option and once for the argument.
4966
4967 @end table
4968
4969 @node Link Options
4970 @section Options for Linking
4971 @cindex link options
4972 @cindex options, linking
4973
4974 These options come into play when the compiler links object files into
4975 an executable output file.  They are meaningless if the compiler is
4976 not doing a link step.
4977
4978 @table @gcctabopt
4979 @cindex file names
4980 @item @var{object-file-name}
4981 A file name that does not end in a special recognized suffix is
4982 considered to name an object file or library.  (Object files are
4983 distinguished from libraries by the linker according to the file
4984 contents.)  If linking is done, these object files are used as input
4985 to the linker.
4986
4987 @item -c
4988 @itemx -S
4989 @itemx -E
4990 @opindex c
4991 @opindex S
4992 @opindex E
4993 If any of these options is used, then the linker is not run, and
4994 object file names should not be used as arguments.  @xref{Overall
4995 Options}.
4996
4997 @cindex Libraries
4998 @item -l@var{library}
4999 @itemx -l @var{library}
5000 @opindex l
5001 Search the library named @var{library} when linking.  (The second
5002 alternative with the library as a separate argument is only for
5003 POSIX compliance and is not recommended.)
5004
5005 It makes a difference where in the command you write this option; the
5006 linker searches and processes libraries and object files in the order they
5007 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
5008 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
5009 to functions in @samp{z}, those functions may not be loaded.
5010
5011 The linker searches a standard list of directories for the library,
5012 which is actually a file named @file{lib@var{library}.a}.  The linker
5013 then uses this file as if it had been specified precisely by name.
5014
5015 The directories searched include several standard system directories
5016 plus any that you specify with @option{-L}.
5017
5018 Normally the files found this way are library files---archive files
5019 whose members are object files.  The linker handles an archive file by
5020 scanning through it for members which define symbols that have so far
5021 been referenced but not defined.  But if the file that is found is an
5022 ordinary object file, it is linked in the usual fashion.  The only
5023 difference between using an @option{-l} option and specifying a file name
5024 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
5025 and searches several directories.
5026
5027 @item -lobjc
5028 @opindex lobjc
5029 You need this special case of the @option{-l} option in order to
5030 link an Objective-C program.
5031
5032 @item -nostartfiles
5033 @opindex nostartfiles
5034 Do not use the standard system startup files when linking.
5035 The standard system libraries are used normally, unless @option{-nostdlib}
5036 or @option{-nodefaultlibs} is used.
5037
5038 @item -nodefaultlibs
5039 @opindex nodefaultlibs
5040 Do not use the standard system libraries when linking.
5041 Only the libraries you specify will be passed to the linker.
5042 The standard startup files are used normally, unless @option{-nostartfiles}
5043 is used.  The compiler may generate calls to memcmp, memset, and memcpy
5044 for System V (and ISO C) environments or to bcopy and bzero for
5045 BSD environments.  These entries are usually resolved by entries in
5046 libc.  These entry points should be supplied through some other
5047 mechanism when this option is specified.
5048
5049 @item -nostdlib
5050 @opindex nostdlib
5051 Do not use the standard system startup files or libraries when linking.
5052 No startup files and only the libraries you specify will be passed to
5053 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
5054 for System V (and ISO C) environments or to bcopy and bzero for
5055 BSD environments.  These entries are usually resolved by entries in
5056 libc.  These entry points should be supplied through some other
5057 mechanism when this option is specified.
5058
5059 @cindex @option{-lgcc}, use with @option{-nostdlib}
5060 @cindex @option{-nostdlib} and unresolved references
5061 @cindex unresolved references and @option{-nostdlib}
5062 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5063 @cindex @option{-nodefaultlibs} and unresolved references
5064 @cindex unresolved references and @option{-nodefaultlibs}
5065 One of the standard libraries bypassed by @option{-nostdlib} and
5066 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
5067 that GCC uses to overcome shortcomings of particular machines, or special
5068 needs for some languages.
5069 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5070 Collection (GCC) Internals},
5071 for more discussion of @file{libgcc.a}.)
5072 In most cases, you need @file{libgcc.a} even when you want to avoid
5073 other standard libraries.  In other words, when you specify @option{-nostdlib}
5074 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
5075 This ensures that you have no unresolved references to internal GCC
5076 library subroutines.  (For example, @samp{__main}, used to ensure C++
5077 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5078 GNU Compiler Collection (GCC) Internals}.)
5079
5080 @item -pie
5081 @opindex pie
5082 Produce a position independent executable on targets which support it.
5083 For predictable results, you must also specify the same set of options
5084 that were used to generate code (@option{-fpie}, @option{-fPIE},
5085 or model suboptions) when you specify this option.
5086
5087 @item -s
5088 @opindex s
5089 Remove all symbol table and relocation information from the executable.
5090
5091 @item -static
5092 @opindex static
5093 On systems that support dynamic linking, this prevents linking with the shared
5094 libraries.  On other systems, this option has no effect.
5095
5096 @item -shared
5097 @opindex shared
5098 Produce a shared object which can then be linked with other objects to
5099 form an executable.  Not all systems support this option.  For predictable
5100 results, you must also specify the same set of options that were used to
5101 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
5102 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
5103 needs to build supplementary stub code for constructors to work.  On
5104 multi-libbed systems, @samp{gcc -shared} must select the correct support
5105 libraries to link against.  Failing to supply the correct flags may lead
5106 to subtle defects.  Supplying them in cases where they are not necessary
5107 is innocuous.}
5108
5109 @item -shared-libgcc
5110 @itemx -static-libgcc
5111 @opindex shared-libgcc
5112 @opindex static-libgcc
5113 On systems that provide @file{libgcc} as a shared library, these options
5114 force the use of either the shared or static version respectively.
5115 If no shared version of @file{libgcc} was built when the compiler was
5116 configured, these options have no effect.
5117
5118 There are several situations in which an application should use the
5119 shared @file{libgcc} instead of the static version.  The most common
5120 of these is when the application wishes to throw and catch exceptions
5121 across different shared libraries.  In that case, each of the libraries
5122 as well as the application itself should use the shared @file{libgcc}.
5123
5124 Therefore, the G++ and GCJ drivers automatically add
5125 @option{-shared-libgcc} whenever you build a shared library or a main
5126 executable, because C++ and Java programs typically use exceptions, so
5127 this is the right thing to do.
5128
5129 If, instead, you use the GCC driver to create shared libraries, you may
5130 find that they will not always be linked with the shared @file{libgcc}.
5131 If GCC finds, at its configuration time, that you have a GNU linker that
5132 does not support option @option{--eh-frame-hdr}, it will link the shared
5133 version of @file{libgcc} into shared libraries by default.  Otherwise,
5134 it will take advantage of the linker and optimize away the linking with
5135 the shared version of @file{libgcc}, linking with the static version of
5136 libgcc by default.  This allows exceptions to propagate through such
5137 shared libraries, without incurring relocation costs at library load
5138 time.
5139
5140 However, if a library or main executable is supposed to throw or catch
5141 exceptions, you must link it using the G++ or GCJ driver, as appropriate
5142 for the languages used in the program, or using the option
5143 @option{-shared-libgcc}, such that it is linked with the shared
5144 @file{libgcc}.
5145
5146 @item -symbolic
5147 @opindex symbolic
5148 Bind references to global symbols when building a shared object.  Warn
5149 about any unresolved references (unless overridden by the link editor
5150 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
5151 this option.
5152
5153 @item -Xlinker @var{option}
5154 @opindex Xlinker
5155 Pass @var{option} as an option to the linker.  You can use this to
5156 supply system-specific linker options which GCC does not know how to
5157 recognize.
5158
5159 If you want to pass an option that takes an argument, you must use
5160 @option{-Xlinker} twice, once for the option and once for the argument.
5161 For example, to pass @option{-assert definitions}, you must write
5162 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
5163 @option{-Xlinker "-assert definitions"}, because this passes the entire
5164 string as a single argument, which is not what the linker expects.
5165
5166 @item -Wl,@var{option}
5167 @opindex Wl
5168 Pass @var{option} as an option to the linker.  If @var{option} contains
5169 commas, it is split into multiple options at the commas.
5170
5171 @item -u @var{symbol}
5172 @opindex u
5173 Pretend the symbol @var{symbol} is undefined, to force linking of
5174 library modules to define it.  You can use @option{-u} multiple times with
5175 different symbols to force loading of additional library modules.
5176 @end table
5177
5178 @node Directory Options
5179 @section Options for Directory Search
5180 @cindex directory options
5181 @cindex options, directory search
5182 @cindex search path
5183
5184 These options specify directories to search for header files, for
5185 libraries and for parts of the compiler:
5186
5187 @table @gcctabopt
5188 @item -I@var{dir}
5189 @opindex I
5190 Add the directory @var{dir} to the head of the list of directories to be
5191 searched for header files.  This can be used to override a system header
5192 file, substituting your own version, since these directories are
5193 searched before the system header file directories.  However, you should
5194 not use this option to add directories that contain vendor-supplied
5195 system header files (use @option{-isystem} for that).  If you use more than
5196 one @option{-I} option, the directories are scanned in left-to-right
5197 order; the standard system directories come after.
5198
5199 If a standard system include directory, or a directory specified with
5200 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
5201 option will be ignored.  The directory will still be searched but as a
5202 system directory at its normal position in the system include chain.
5203 This is to ensure that GCC's procedure to fix buggy system headers and
5204 the ordering for the include_next directive are not inadvertently changed.
5205 If you really need to change the search order for system directories,
5206 use the @option{-nostdinc} and/or @option{-isystem} options.
5207
5208 @item -I-
5209 @opindex I-
5210 Any directories you specify with @option{-I} options before the @option{-I-}
5211 option are searched only for the case of @samp{#include "@var{file}"};
5212 they are not searched for @samp{#include <@var{file}>}.
5213
5214 If additional directories are specified with @option{-I} options after
5215 the @option{-I-}, these directories are searched for all @samp{#include}
5216 directives.  (Ordinarily @emph{all} @option{-I} directories are used
5217 this way.)
5218
5219 In addition, the @option{-I-} option inhibits the use of the current
5220 directory (where the current input file came from) as the first search
5221 directory for @samp{#include "@var{file}"}.  There is no way to
5222 override this effect of @option{-I-}.  With @option{-I.} you can specify
5223 searching the directory which was current when the compiler was
5224 invoked.  That is not exactly the same as what the preprocessor does
5225 by default, but it is often satisfactory.
5226
5227 @option{-I-} does not inhibit the use of the standard system directories
5228 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
5229 independent.
5230
5231 @item -L@var{dir}
5232 @opindex L
5233 Add directory @var{dir} to the list of directories to be searched
5234 for @option{-l}.
5235
5236 @item -B@var{prefix}
5237 @opindex B
5238 This option specifies where to find the executables, libraries,
5239 include files, and data files of the compiler itself.
5240
5241 The compiler driver program runs one or more of the subprograms
5242 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
5243 @var{prefix} as a prefix for each program it tries to run, both with and
5244 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5245
5246 For each subprogram to be run, the compiler driver first tries the
5247 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
5248 was not specified, the driver tries two standard prefixes, which are
5249 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
5250 those results in a file name that is found, the unmodified program
5251 name is searched for using the directories specified in your
5252 @env{PATH} environment variable.
5253
5254 The compiler will check to see if the path provided by the @option{-B}
5255 refers to a directory, and if necessary it will add a directory
5256 separator character at the end of the path.
5257
5258 @option{-B} prefixes that effectively specify directory names also apply
5259 to libraries in the linker, because the compiler translates these
5260 options into @option{-L} options for the linker.  They also apply to
5261 includes files in the preprocessor, because the compiler translates these
5262 options into @option{-isystem} options for the preprocessor.  In this case,
5263 the compiler appends @samp{include} to the prefix.
5264
5265 The run-time support file @file{libgcc.a} can also be searched for using
5266 the @option{-B} prefix, if needed.  If it is not found there, the two
5267 standard prefixes above are tried, and that is all.  The file is left
5268 out of the link if it is not found by those means.
5269
5270 Another way to specify a prefix much like the @option{-B} prefix is to use
5271 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
5272 Variables}.
5273
5274 As a special kludge, if the path provided by @option{-B} is
5275 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
5276 9, then it will be replaced by @file{[dir/]include}.  This is to help
5277 with boot-strapping the compiler.
5278
5279 @item -specs=@var{file}
5280 @opindex specs
5281 Process @var{file} after the compiler reads in the standard @file{specs}
5282 file, in order to override the defaults that the @file{gcc} driver
5283 program uses when determining what switches to pass to @file{cc1},
5284 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
5285 @option{-specs=@var{file}} can be specified on the command line, and they
5286 are processed in order, from left to right.
5287 @end table
5288
5289 @c man end
5290
5291 @node Spec Files
5292 @section Specifying subprocesses and the switches to pass to them
5293 @cindex Spec Files
5294
5295 @command{gcc} is a driver program.  It performs its job by invoking a
5296 sequence of other programs to do the work of compiling, assembling and
5297 linking.  GCC interprets its command-line parameters and uses these to
5298 deduce which programs it should invoke, and which command-line options
5299 it ought to place on their command lines.  This behavior is controlled
5300 by @dfn{spec strings}.  In most cases there is one spec string for each
5301 program that GCC can invoke, but a few programs have multiple spec
5302 strings to control their behavior.  The spec strings built into GCC can
5303 be overridden by using the @option{-specs=} command-line switch to specify
5304 a spec file.
5305
5306 @dfn{Spec files} are plaintext files that are used to construct spec
5307 strings.  They consist of a sequence of directives separated by blank
5308 lines.  The type of directive is determined by the first non-whitespace
5309 character on the line and it can be one of the following:
5310
5311 @table @code
5312 @item %@var{command}
5313 Issues a @var{command} to the spec file processor.  The commands that can
5314 appear here are:
5315
5316 @table @code
5317 @item %include <@var{file}>
5318 @cindex %include
5319 Search for @var{file} and insert its text at the current point in the
5320 specs file.
5321
5322 @item %include_noerr <@var{file}>
5323 @cindex %include_noerr
5324 Just like @samp{%include}, but do not generate an error message if the include
5325 file cannot be found.
5326
5327 @item %rename @var{old_name} @var{new_name}
5328 @cindex %rename
5329 Rename the spec string @var{old_name} to @var{new_name}.
5330
5331 @end table
5332
5333 @item *[@var{spec_name}]:
5334 This tells the compiler to create, override or delete the named spec
5335 string.  All lines after this directive up to the next directive or
5336 blank line are considered to be the text for the spec string.  If this
5337 results in an empty string then the spec will be deleted.  (Or, if the
5338 spec did not exist, then nothing will happened.)  Otherwise, if the spec
5339 does not currently exist a new spec will be created.  If the spec does
5340 exist then its contents will be overridden by the text of this
5341 directive, unless the first character of that text is the @samp{+}
5342 character, in which case the text will be appended to the spec.
5343
5344 @item [@var{suffix}]:
5345 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
5346 and up to the next directive or blank line are considered to make up the
5347 spec string for the indicated suffix.  When the compiler encounters an
5348 input file with the named suffix, it will processes the spec string in
5349 order to work out how to compile that file.  For example:
5350
5351 @smallexample
5352 .ZZ:
5353 z-compile -input %i
5354 @end smallexample
5355
5356 This says that any input file whose name ends in @samp{.ZZ} should be
5357 passed to the program @samp{z-compile}, which should be invoked with the
5358 command-line switch @option{-input} and with the result of performing the
5359 @samp{%i} substitution.  (See below.)
5360
5361 As an alternative to providing a spec string, the text that follows a
5362 suffix directive can be one of the following:
5363
5364 @table @code
5365 @item @@@var{language}
5366 This says that the suffix is an alias for a known @var{language}.  This is
5367 similar to using the @option{-x} command-line switch to GCC to specify a
5368 language explicitly.  For example:
5369
5370 @smallexample
5371 .ZZ:
5372 @@c++
5373 @end smallexample
5374
5375 Says that .ZZ files are, in fact, C++ source files.
5376
5377 @item #@var{name}
5378 This causes an error messages saying:
5379
5380 @smallexample
5381 @var{name} compiler not installed on this system.
5382 @end smallexample
5383 @end table
5384
5385 GCC already has an extensive list of suffixes built into it.
5386 This directive will add an entry to the end of the list of suffixes, but
5387 since the list is searched from the end backwards, it is effectively
5388 possible to override earlier entries using this technique.
5389
5390 @end table
5391
5392 GCC has the following spec strings built into it.  Spec files can
5393 override these strings or create their own.  Note that individual
5394 targets can also add their own spec strings to this list.
5395
5396 @smallexample
5397 asm          Options to pass to the assembler
5398 asm_final    Options to pass to the assembler post-processor
5399 cpp          Options to pass to the C preprocessor
5400 cc1          Options to pass to the C compiler
5401 cc1plus      Options to pass to the C++ compiler
5402 endfile      Object files to include at the end of the link
5403 link         Options to pass to the linker
5404 lib          Libraries to include on the command line to the linker
5405 libgcc       Decides which GCC support library to pass to the linker
5406 linker       Sets the name of the linker
5407 predefines   Defines to be passed to the C preprocessor
5408 signed_char  Defines to pass to CPP to say whether @code{char} is signed
5409              by default
5410 startfile    Object files to include at the start of the link
5411 @end smallexample
5412
5413 Here is a small example of a spec file:
5414
5415 @smallexample
5416 %rename lib                 old_lib
5417
5418 *lib:
5419 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
5420 @end smallexample
5421
5422 This example renames the spec called @samp{lib} to @samp{old_lib} and
5423 then overrides the previous definition of @samp{lib} with a new one.
5424 The new definition adds in some extra command-line options before
5425 including the text of the old definition.
5426
5427 @dfn{Spec strings} are a list of command-line options to be passed to their
5428 corresponding program.  In addition, the spec strings can contain
5429 @samp{%}-prefixed sequences to substitute variable text or to
5430 conditionally insert text into the command line.  Using these constructs
5431 it is possible to generate quite complex command lines.
5432
5433 Here is a table of all defined @samp{%}-sequences for spec
5434 strings.  Note that spaces are not generated automatically around the
5435 results of expanding these sequences.  Therefore you can concatenate them
5436 together or combine them with constant text in a single argument.
5437
5438 @table @code
5439 @item %%
5440 Substitute one @samp{%} into the program name or argument.
5441
5442 @item %i
5443 Substitute the name of the input file being processed.
5444
5445 @item %b
5446 Substitute the basename of the input file being processed.
5447 This is the substring up to (and not including) the last period
5448 and not including the directory.
5449
5450 @item %B
5451 This is the same as @samp{%b}, but include the file suffix (text after
5452 the last period).
5453
5454 @item %d
5455 Marks the argument containing or following the @samp{%d} as a
5456 temporary file name, so that that file will be deleted if GCC exits
5457 successfully.  Unlike @samp{%g}, this contributes no text to the
5458 argument.
5459
5460 @item %g@var{suffix}
5461 Substitute a file name that has suffix @var{suffix} and is chosen
5462 once per compilation, and mark the argument in the same way as
5463 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5464 name is now chosen in a way that is hard to predict even when previously
5465 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5466 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5467 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5468 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5469 was simply substituted with a file name chosen once per compilation,
5470 without regard to any appended suffix (which was therefore treated
5471 just like ordinary text), making such attacks more likely to succeed.
5472
5473 @item %u@var{suffix}
5474 Like @samp{%g}, but generates a new temporary file name even if
5475 @samp{%u@var{suffix}} was already seen.
5476
5477 @item %U@var{suffix}
5478 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5479 new one if there is no such last file name.  In the absence of any
5480 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5481 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5482 would involve the generation of two distinct file names, one
5483 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5484 simply substituted with a file name chosen for the previous @samp{%u},
5485 without regard to any appended suffix.
5486
5487 @item %j@var{suffix}
5488 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5489 writable, and if save-temps is off; otherwise, substitute the name
5490 of a temporary file, just like @samp{%u}.  This temporary file is not
5491 meant for communication between processes, but rather as a junk
5492 disposal mechanism.
5493
5494 @item %|@var{suffix}
5495 @itemx %m@var{suffix}
5496 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
5497 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
5498 all.  These are the two most common ways to instruct a program that it
5499 should read from standard input or write to standard output.  If you
5500 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
5501 construct: see for example @file{f/lang-specs.h}.
5502
5503 @item %.@var{SUFFIX}
5504 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5505 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5506 terminated by the next space or %.
5507
5508 @item %w
5509 Marks the argument containing or following the @samp{%w} as the
5510 designated output file of this compilation.  This puts the argument
5511 into the sequence of arguments that @samp{%o} will substitute later.
5512
5513 @item %o
5514 Substitutes the names of all the output files, with spaces
5515 automatically placed around them.  You should write spaces
5516 around the @samp{%o} as well or the results are undefined.
5517 @samp{%o} is for use in the specs for running the linker.
5518 Input files whose names have no recognized suffix are not compiled
5519 at all, but they are included among the output files, so they will
5520 be linked.
5521
5522 @item %O
5523 Substitutes the suffix for object files.  Note that this is
5524 handled specially when it immediately follows @samp{%g, %u, or %U},
5525 because of the need for those to form complete file names.  The
5526 handling is such that @samp{%O} is treated exactly as if it had already
5527 been substituted, except that @samp{%g, %u, and %U} do not currently
5528 support additional @var{suffix} characters following @samp{%O} as they would
5529 following, for example, @samp{.o}.
5530
5531 @item %p
5532 Substitutes the standard macro predefinitions for the
5533 current target machine.  Use this when running @code{cpp}.
5534
5535 @item %P
5536 Like @samp{%p}, but puts @samp{__} before and after the name of each
5537 predefined macro, except for macros that start with @samp{__} or with
5538 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5539 C@.
5540
5541 @item %I
5542 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5543 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5544 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5545 as necessary.
5546
5547 @item %s
5548 Current argument is the name of a library or startup file of some sort.
5549 Search for that file in a standard list of directories and substitute
5550 the full name found.
5551
5552 @item %e@var{str}
5553 Print @var{str} as an error message.  @var{str} is terminated by a newline.
5554 Use this when inconsistent options are detected.
5555
5556 @item %(@var{name})
5557 Substitute the contents of spec string @var{name} at this point.
5558
5559 @item %[@var{name}]
5560 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
5561
5562 @item %x@{@var{option}@}
5563 Accumulate an option for @samp{%X}.
5564
5565 @item %X
5566 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
5567 spec string.
5568
5569 @item %Y
5570 Output the accumulated assembler options specified by @option{-Wa}.
5571
5572 @item %Z
5573 Output the accumulated preprocessor options specified by @option{-Wp}.
5574
5575 @item %a
5576 Process the @code{asm} spec.  This is used to compute the
5577 switches to be passed to the assembler.
5578
5579 @item %A
5580 Process the @code{asm_final} spec.  This is a spec string for
5581 passing switches to an assembler post-processor, if such a program is
5582 needed.
5583
5584 @item %l
5585 Process the @code{link} spec.  This is the spec for computing the
5586 command line passed to the linker.  Typically it will make use of the
5587 @samp{%L %G %S %D and %E} sequences.
5588
5589 @item %D
5590 Dump out a @option{-L} option for each directory that GCC believes might
5591 contain startup files.  If the target supports multilibs then the
5592 current multilib directory will be prepended to each of these paths.
5593
5594 @item %M
5595 Output the multilib directory with directory separators replaced with
5596 @samp{_}.  If multilib directories are not set, or the multilib directory is
5597 @file{.} then this option emits nothing.
5598
5599 @item %L
5600 Process the @code{lib} spec.  This is a spec string for deciding which
5601 libraries should be included on the command line to the linker.
5602
5603 @item %G
5604 Process the @code{libgcc} spec.  This is a spec string for deciding
5605 which GCC support library should be included on the command line to the linker.
5606
5607 @item %S
5608 Process the @code{startfile} spec.  This is a spec for deciding which
5609 object files should be the first ones passed to the linker.  Typically
5610 this might be a file named @file{crt0.o}.
5611
5612 @item %E
5613 Process the @code{endfile} spec.  This is a spec string that specifies
5614 the last object files that will be passed to the linker.
5615
5616 @item %C
5617 Process the @code{cpp} spec.  This is used to construct the arguments
5618 to be passed to the C preprocessor.
5619
5620 @item %c
5621 Process the @code{signed_char} spec.  This is intended to be used
5622 to tell cpp whether a char is signed.  It typically has the definition:
5623 @smallexample
5624 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
5625 @end smallexample
5626
5627 @item %1
5628 Process the @code{cc1} spec.  This is used to construct the options to be
5629 passed to the actual C compiler (@samp{cc1}).
5630
5631 @item %2
5632 Process the @code{cc1plus} spec.  This is used to construct the options to be
5633 passed to the actual C++ compiler (@samp{cc1plus}).
5634
5635 @item %*
5636 Substitute the variable part of a matched option.  See below.
5637 Note that each comma in the substituted string is replaced by
5638 a single space.
5639
5640 @item %<@code{S}
5641 Remove all occurrences of @code{-S} from the command line.  Note---this
5642 command is position dependent.  @samp{%} commands in the spec string
5643 before this one will see @code{-S}, @samp{%} commands in the spec string
5644 after this one will not.
5645
5646 @item %:@var{function}(@var{args})
5647 Call the named function @var{function}, passing it @var{args}.
5648 @var{args} is first processed as a nested spec string, then split
5649 into an argument vector in the usual fashion.  The function returns
5650 a string which is processed as if it had appeared literally as part
5651 of the current spec.
5652
5653 The following built-in spec functions are provided:
5654
5655 @table @code
5656 @item @code{if-exists}
5657 The @code{if-exists} spec function takes one argument, an absolute
5658 pathname to a file.  If the file exists, @code{if-exists} returns the
5659 pathname.  Here is a small example of its usage:
5660
5661 @smallexample
5662 *startfile:
5663 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
5664 @end smallexample
5665
5666 @item @code{if-exists-else}
5667 The @code{if-exists-else} spec function is similar to the @code{if-exists}
5668 spec function, except that it takes two arguments.  The first argument is
5669 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
5670 returns the pathname.  If it does not exist, it returns the second argument.
5671 This way, @code{if-exists-else} can be used to select one file or another,
5672 based on the existence of the first.  Here is a small example of its usage:
5673
5674 @smallexample 
5675 *startfile:
5676 crt0%O%s %:if-exists(crti%O%s) \
5677 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
5678 @end smallexample
5679 @end table 
5680
5681 @item %@{@code{S}@}
5682 Substitutes the @code{-S} switch, if that switch was given to GCC@.
5683 If that switch was not specified, this substitutes nothing.  Note that
5684 the leading dash is omitted when specifying this option, and it is
5685 automatically inserted if the substitution is performed.  Thus the spec
5686 string @samp{%@{foo@}} would match the command-line option @option{-foo}
5687 and would output the command line option @option{-foo}.
5688
5689 @item %W@{@code{S}@}
5690 Like %@{@code{S}@} but mark last argument supplied within as a file to be
5691 deleted on failure.
5692
5693 @item %@{@code{S}*@}
5694 Substitutes all the switches specified to GCC whose names start
5695 with @code{-S}, but which also take an argument.  This is used for
5696 switches like @option{-o}, @option{-D}, @option{-I}, etc.
5697 GCC considers @option{-o foo} as being
5698 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
5699 text, including the space.  Thus two arguments would be generated.
5700
5701 @item %@{@code{S}*&@code{T}*@}
5702 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
5703 (the order of @code{S} and @code{T} in the spec is not significant).
5704 There can be any number of ampersand-separated variables; for each the
5705 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
5706
5707 @item %@{@code{S}:@code{X}@}
5708 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
5709
5710 @item %@{!@code{S}:@code{X}@}
5711 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
5712
5713 @item %@{@code{S}*:@code{X}@}
5714 Substitutes @code{X} if one or more switches whose names start with
5715 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
5716 once, no matter how many such switches appeared.  However, if @code{%*}
5717 appears somewhere in @code{X}, then @code{X} will be substituted once
5718 for each matching switch, with the @code{%*} replaced by the part of
5719 that switch that matched the @code{*}.
5720
5721 @item %@{.@code{S}:@code{X}@}
5722 Substitutes @code{X}, if processing a file with suffix @code{S}.
5723
5724 @item %@{!.@code{S}:@code{X}@}
5725 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
5726
5727 @item %@{@code{S}|@code{P}:@code{X}@}
5728 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
5729 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
5730 although they have a stronger binding than the @samp{|}.  If @code{%*}
5731 appears in @code{X}, all of the alternatives must be starred, and only
5732 the first matching alternative is substituted.
5733
5734 For example, a spec string like this:
5735
5736 @smallexample
5737 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5738 @end smallexample
5739
5740 will output the following command-line options from the following input
5741 command-line options:
5742
5743 @smallexample
5744 fred.c        -foo -baz
5745 jim.d         -bar -boggle
5746 -d fred.c     -foo -baz -boggle
5747 -d jim.d      -bar -baz -boggle
5748 @end smallexample
5749
5750 @item %@{S:X; T:Y; :D@}
5751
5752 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
5753 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
5754 be as many clauses as you need.  This may be combined with @code{.}, 
5755 @code{!}, @code{|}, and @code{*} as needed.
5756
5757
5758 @end table
5759
5760 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
5761 construct may contain other nested @samp{%} constructs or spaces, or
5762 even newlines.  They are processed as usual, as described above.
5763 Trailing white space in @code{X} is ignored.  White space may also
5764 appear anywhere on the left side of the colon in these constructs,
5765 except between @code{.} or @code{*} and the corresponding word.
5766
5767 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
5768 handled specifically in these constructs.  If another value of
5769 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5770 @option{-W} switch is found later in the command line, the earlier
5771 switch value is ignored, except with @{@code{S}*@} where @code{S} is
5772 just one letter, which passes all matching options.
5773
5774 The character @samp{|} at the beginning of the predicate text is used to
5775 indicate that a command should be piped to the following command, but
5776 only if @option{-pipe} is specified.
5777
5778 It is built into GCC which switches take arguments and which do not.
5779 (You might think it would be useful to generalize this to allow each
5780 compiler's spec to say which switches take arguments.  But this cannot
5781 be done in a consistent fashion.  GCC cannot even decide which input
5782 files have been specified without knowing which switches take arguments,
5783 and it must know which input files to compile in order to tell which
5784 compilers to run).
5785
5786 GCC also knows implicitly that arguments starting in @option{-l} are to be
5787 treated as compiler output files, and passed to the linker in their
5788 proper position among the other output files.
5789
5790 @c man begin OPTIONS
5791
5792 @node Target Options
5793 @section Specifying Target Machine and Compiler Version
5794 @cindex target options
5795 @cindex cross compiling
5796 @cindex specifying machine version
5797 @cindex specifying compiler version and target machine
5798 @cindex compiler version, specifying
5799 @cindex target machine, specifying
5800
5801 The usual way to run GCC is to run the executable called @file{gcc}, or
5802 @file{<machine>-gcc} when cross-compiling, or
5803 @file{<machine>-gcc-<version>} to run a version other than the one that
5804 was installed last.  Sometimes this is inconvenient, so GCC provides
5805 options that will switch to another cross-compiler or version.
5806
5807 @table @gcctabopt
5808 @item -b @var{machine}
5809 @opindex b
5810 The argument @var{machine} specifies the target machine for compilation.
5811
5812 The value to use for @var{machine} is the same as was specified as the
5813 machine type when configuring GCC as a cross-compiler.  For
5814 example, if a cross-compiler was configured with @samp{configure
5815 i386v}, meaning to compile for an 80386 running System V, then you
5816 would specify @option{-b i386v} to run that cross compiler.
5817
5818 @item -V @var{version}
5819 @opindex V
5820 The argument @var{version} specifies which version of GCC to run.
5821 This is useful when multiple versions are installed.  For example,
5822 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5823 @end table
5824
5825 The @option{-V} and @option{-b} options work by running the
5826 @file{<machine>-gcc-<version>} executable, so there's no real reason to
5827 use them if you can just run that directly.
5828
5829 @node Submodel Options
5830 @section Hardware Models and Configurations
5831 @cindex submodel options
5832 @cindex specifying hardware config
5833 @cindex hardware models and configurations, specifying
5834 @cindex machine dependent options
5835
5836 Earlier we discussed the standard option @option{-b} which chooses among
5837 different installed compilers for completely different target
5838 machines, such as VAX vs.@: 68000 vs.@: 80386.
5839
5840 In addition, each of these target machine types can have its own
5841 special options, starting with @samp{-m}, to choose among various
5842 hardware models or configurations---for example, 68010 vs 68020,
5843 floating coprocessor or none.  A single installed version of the
5844 compiler can compile for any model or configuration, according to the
5845 options specified.
5846
5847 Some configurations of the compiler also support additional special
5848 options, usually for compatibility with other compilers on the same
5849 platform.
5850
5851 These options are defined by the macro @code{TARGET_SWITCHES} in the
5852 machine description.  The default for the options is also defined by
5853 that macro, which enables you to change the defaults.
5854
5855 @menu
5856 * M680x0 Options::
5857 * M68hc1x Options::
5858 * VAX Options::
5859 * SPARC Options::
5860 * ARM Options::
5861 * MN10200 Options::
5862 * MN10300 Options::
5863 * M32R/D Options::
5864 * M88K Options::
5865 * RS/6000 and PowerPC Options::
5866 * Darwin Options::
5867 * RT Options::
5868 * MIPS Options::
5869 * i386 and x86-64 Options::
5870 * HPPA Options::
5871 * Intel 960 Options::
5872 * DEC Alpha Options::
5873 * DEC Alpha/VMS Options::
5874 * H8/300 Options::
5875 * SH Options::
5876 * System V Options::
5877 * TMS320C3x/C4x Options::
5878 * V850 Options::
5879 * ARC Options::
5880 * NS32K Options::
5881 * AVR Options::
5882 * MCore Options::
5883 * IA-64 Options::
5884 * D30V Options::
5885 * S/390 and zSeries Options::
5886 * CRIS Options::
5887 * MMIX Options::
5888 * PDP-11 Options::
5889 * Xstormy16 Options::
5890 * Xtensa Options::
5891 * FRV Options::
5892 @end menu
5893
5894 @node M680x0 Options
5895 @subsection M680x0 Options
5896 @cindex M680x0 options
5897
5898 These are the @samp{-m} options defined for the 68000 series.  The default
5899 values for these options depends on which style of 68000 was selected when
5900 the compiler was configured; the defaults for the most common choices are
5901 given below.
5902
5903 @table @gcctabopt
5904 @item -m68000
5905 @itemx -mc68000
5906 @opindex m68000
5907 @opindex mc68000
5908 Generate output for a 68000.  This is the default
5909 when the compiler is configured for 68000-based systems.
5910
5911 Use this option for microcontrollers with a 68000 or EC000 core,
5912 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5913
5914 @item -m68020
5915 @itemx -mc68020
5916 @opindex m68020
5917 @opindex mc68020
5918 Generate output for a 68020.  This is the default
5919 when the compiler is configured for 68020-based systems.
5920
5921 @item -m68881
5922 @opindex m68881
5923 Generate output containing 68881 instructions for floating point.
5924 This is the default for most 68020 systems unless @option{--nfp} was
5925 specified when the compiler was configured.
5926
5927 @item -m68030
5928 @opindex m68030
5929 Generate output for a 68030.  This is the default when the compiler is
5930 configured for 68030-based systems.
5931
5932 @item -m68040
5933 @opindex m68040
5934 Generate output for a 68040.  This is the default when the compiler is
5935 configured for 68040-based systems.
5936
5937 This option inhibits the use of 68881/68882 instructions that have to be
5938 emulated by software on the 68040.  Use this option if your 68040 does not
5939 have code to emulate those instructions.
5940
5941 @item -m68060
5942 @opindex m68060
5943 Generate output for a 68060.  This is the default when the compiler is
5944 configured for 68060-based systems.
5945
5946 This option inhibits the use of 68020 and 68881/68882 instructions that
5947 have to be emulated by software on the 68060.  Use this option if your 68060
5948 does not have code to emulate those instructions.
5949
5950 @item -mcpu32
5951 @opindex mcpu32
5952 Generate output for a CPU32.  This is the default
5953 when the compiler is configured for CPU32-based systems.
5954
5955 Use this option for microcontrollers with a
5956 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5957 68336, 68340, 68341, 68349 and 68360.
5958
5959 @item -m5200
5960 @opindex m5200
5961 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5962 when the compiler is configured for 520X-based systems.
5963
5964 Use this option for microcontroller with a 5200 core, including
5965 the MCF5202, MCF5203, MCF5204 and MCF5202.
5966
5967
5968 @item -m68020-40
5969 @opindex m68020-40
5970 Generate output for a 68040, without using any of the new instructions.
5971 This results in code which can run relatively efficiently on either a
5972 68020/68881 or a 68030 or a 68040.  The generated code does use the
5973 68881 instructions that are emulated on the 68040.
5974
5975 @item -m68020-60
5976 @opindex m68020-60
5977 Generate output for a 68060, without using any of the new instructions.
5978 This results in code which can run relatively efficiently on either a
5979 68020/68881 or a 68030 or a 68040.  The generated code does use the
5980 68881 instructions that are emulated on the 68060.
5981
5982 @item -msoft-float
5983 @opindex msoft-float
5984 Generate output containing library calls for floating point.
5985 @strong{Warning:} the requisite libraries are not available for all m68k
5986 targets.  Normally the facilities of the machine's usual C compiler are
5987 used, but this can't be done directly in cross-compilation.  You must
5988 make your own arrangements to provide suitable library functions for
5989 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5990 @samp{m68k-*-coff} do provide software floating point support.
5991
5992 @item -mshort
5993 @opindex mshort
5994 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5995
5996 @item -mnobitfield
5997 @opindex mnobitfield
5998 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5999 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
6000
6001 @item -mbitfield
6002 @opindex mbitfield
6003 Do use the bit-field instructions.  The @option{-m68020} option implies
6004 @option{-mbitfield}.  This is the default if you use a configuration
6005 designed for a 68020.
6006
6007 @item -mrtd
6008 @opindex mrtd
6009 Use a different function-calling convention, in which functions
6010 that take a fixed number of arguments return with the @code{rtd}
6011 instruction, which pops their arguments while returning.  This
6012 saves one instruction in the caller since there is no need to pop
6013 the arguments there.
6014
6015 This calling convention is incompatible with the one normally
6016 used on Unix, so you cannot use it if you need to call libraries
6017 compiled with the Unix compiler.
6018
6019 Also, you must provide function prototypes for all functions that
6020 take variable numbers of arguments (including @code{printf});
6021 otherwise incorrect code will be generated for calls to those
6022 functions.
6023
6024 In addition, seriously incorrect code will result if you call a
6025 function with too many arguments.  (Normally, extra arguments are
6026 harmlessly ignored.)
6027
6028 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
6029 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
6030
6031 @item -malign-int
6032 @itemx -mno-align-int
6033 @opindex malign-int
6034 @opindex mno-align-int
6035 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
6036 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
6037 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
6038 Aligning variables on 32-bit boundaries produces code that runs somewhat
6039 faster on processors with 32-bit busses at the expense of more memory.
6040
6041 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
6042 align structures containing the above types  differently than
6043 most published application binary interface specifications for the m68k.
6044
6045 @item -mpcrel
6046 @opindex mpcrel
6047 Use the pc-relative addressing mode of the 68000 directly, instead of
6048 using a global offset table.  At present, this option implies @option{-fpic},
6049 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
6050 not presently supported with @option{-mpcrel}, though this could be supported for
6051 68020 and higher processors.
6052
6053 @item -mno-strict-align
6054 @itemx -mstrict-align
6055 @opindex mno-strict-align
6056 @opindex mstrict-align
6057 Do not (do) assume that unaligned memory references will be handled by
6058 the system.
6059
6060 @end table
6061
6062 @node M68hc1x Options
6063 @subsection M68hc1x Options
6064 @cindex M68hc1x options
6065
6066 These are the @samp{-m} options defined for the 68hc11 and 68hc12
6067 microcontrollers.  The default values for these options depends on
6068 which style of microcontroller was selected when the compiler was configured;
6069 the defaults for the most common choices are given below.
6070
6071 @table @gcctabopt
6072 @item -m6811
6073 @itemx -m68hc11
6074 @opindex m6811
6075 @opindex m68hc11
6076 Generate output for a 68HC11.  This is the default
6077 when the compiler is configured for 68HC11-based systems.
6078
6079 @item -m6812
6080 @itemx -m68hc12
6081 @opindex m6812
6082 @opindex m68hc12
6083 Generate output for a 68HC12.  This is the default
6084 when the compiler is configured for 68HC12-based systems.
6085
6086 @item -m68S12
6087 @itemx -m68hcs12
6088 @opindex m68S12
6089 @opindex m68hcs12
6090 Generate output for a 68HCS12.  
6091
6092 @item -mauto-incdec
6093 @opindex mauto-incdec
6094 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
6095 addressing modes.
6096
6097 @item -minmax
6098 @itemx -nominmax
6099 @opindex minmax
6100 @opindex mnominmax
6101 Enable the use of 68HC12 min and max instructions.
6102
6103 @item -mlong-calls
6104 @itemx -mno-long-calls
6105 @opindex mlong-calls
6106 @opindex mno-long-calls
6107 Treat all calls as being far away (near).  If calls are assumed to be
6108 far away, the compiler will use the @code{call} instruction to
6109 call a function and the @code{rtc} instruction for returning.
6110
6111 @item -mshort
6112 @opindex mshort
6113 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6114
6115 @item -msoft-reg-count=@var{count}
6116 @opindex msoft-reg-count
6117 Specify the number of pseudo-soft registers which are used for the
6118 code generation.  The maximum number is 32.  Using more pseudo-soft
6119 register may or may not result in better code depending on the program.
6120 The default is 4 for 68HC11 and 2 for 68HC12.
6121
6122 @end table
6123
6124 @node VAX Options
6125 @subsection VAX Options
6126 @cindex VAX options
6127
6128 These @samp{-m} options are defined for the VAX:
6129
6130 @table @gcctabopt
6131 @item -munix
6132 @opindex munix
6133 Do not output certain jump instructions (@code{aobleq} and so on)
6134 that the Unix assembler for the VAX cannot handle across long
6135 ranges.
6136
6137 @item -mgnu
6138 @opindex mgnu
6139 Do output those jump instructions, on the assumption that you
6140 will assemble with the GNU assembler.
6141
6142 @item -mg
6143 @opindex mg
6144 Output code for g-format floating point numbers instead of d-format.
6145 @end table
6146
6147 @node SPARC Options
6148 @subsection SPARC Options
6149 @cindex SPARC options
6150
6151 These @samp{-m} switches are supported on the SPARC:
6152
6153 @table @gcctabopt
6154 @item -mno-app-regs
6155 @itemx -mapp-regs
6156 @opindex mno-app-regs
6157 @opindex mapp-regs
6158 Specify @option{-mapp-regs} to generate output using the global registers
6159 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
6160 is the default.
6161
6162 To be fully SVR4 ABI compliant at the cost of some performance loss,
6163 specify @option{-mno-app-regs}.  You should compile libraries and system
6164 software with this option.
6165
6166 @item -mfpu
6167 @itemx -mhard-float
6168 @opindex mfpu
6169 @opindex mhard-float
6170 Generate output containing floating point instructions.  This is the
6171 default.
6172
6173 @item -mno-fpu
6174 @itemx -msoft-float
6175 @opindex mno-fpu
6176 @opindex msoft-float
6177 Generate output containing library calls for floating point.
6178 @strong{Warning:} the requisite libraries are not available for all SPARC
6179 targets.  Normally the facilities of the machine's usual C compiler are
6180 used, but this cannot be done directly in cross-compilation.  You must make
6181 your own arrangements to provide suitable library functions for
6182 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
6183 @samp{sparclite-*-*} do provide software floating point support.
6184
6185 @option{-msoft-float} changes the calling convention in the output file;
6186 therefore, it is only useful if you compile @emph{all} of a program with
6187 this option.  In particular, you need to compile @file{libgcc.a}, the
6188 library that comes with GCC, with @option{-msoft-float} in order for
6189 this to work.
6190
6191 @item -mhard-quad-float
6192 @opindex mhard-quad-float
6193 Generate output containing quad-word (long double) floating point
6194 instructions.
6195
6196 @item -msoft-quad-float
6197 @opindex msoft-quad-float
6198 Generate output containing library calls for quad-word (long double)
6199 floating point instructions.  The functions called are those specified
6200 in the SPARC ABI@.  This is the default.
6201
6202 As of this writing, there are no sparc implementations that have hardware
6203 support for the quad-word floating point instructions.  They all invoke
6204 a trap handler for one of these instructions, and then the trap handler
6205 emulates the effect of the instruction.  Because of the trap handler overhead,
6206 this is much slower than calling the ABI library routines.  Thus the
6207 @option{-msoft-quad-float} option is the default.
6208
6209 @item -mno-flat
6210 @itemx -mflat
6211 @opindex mno-flat
6212 @opindex mflat
6213 With @option{-mflat}, the compiler does not generate save/restore instructions
6214 and will use a ``flat'' or single register window calling convention.
6215 This model uses %i7 as the frame pointer and is compatible with the normal
6216 register window model.  Code from either may be intermixed.
6217 The local registers and the input registers (0--5) are still treated as
6218 ``call saved'' registers and will be saved on the stack as necessary.
6219
6220 With @option{-mno-flat} (the default), the compiler emits save/restore
6221 instructions (except for leaf functions) and is the normal mode of operation.
6222
6223 @item -mno-unaligned-doubles
6224 @itemx -munaligned-doubles
6225 @opindex mno-unaligned-doubles
6226 @opindex munaligned-doubles
6227 Assume that doubles have 8 byte alignment.  This is the default.
6228
6229 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
6230 alignment only if they are contained in another type, or if they have an
6231 absolute address.  Otherwise, it assumes they have 4 byte alignment.
6232 Specifying this option avoids some rare compatibility problems with code
6233 generated by other compilers.  It is not the default because it results
6234 in a performance loss, especially for floating point code.
6235
6236 @item -mno-faster-structs
6237 @itemx -mfaster-structs
6238 @opindex mno-faster-structs
6239 @opindex mfaster-structs
6240 With @option{-mfaster-structs}, the compiler assumes that structures
6241 should have 8 byte alignment.  This enables the use of pairs of
6242 @code{ldd} and @code{std} instructions for copies in structure
6243 assignment, in place of twice as many @code{ld} and @code{st} pairs.
6244 However, the use of this changed alignment directly violates the SPARC
6245 ABI@.  Thus, it's intended only for use on targets where the developer
6246 acknowledges that their resulting code will not be directly in line with
6247 the rules of the ABI@.
6248
6249 @item -mimpure-text
6250 @opindex mimpure-text
6251 @option{-mimpure-text}, used in addition to @option{-shared}, tells
6252 the compiler to not pass @option{-z text} to the linker when linking a
6253 shared object.  Using this option, you can link position-dependent
6254 code into a shared object.  
6255
6256 @option{-mimpure-text} suppresses the ``relocations remain against
6257 allocatable but non-writable sections'' linker error message.
6258 However, the necessary relocations will trigger copy-on-write, and the
6259 shared object is not actually shared across processes.  Instead of
6260 using @option{-mimpure-text}, you should compile all source code with
6261 @option{-fpic} or @option{-fPIC}.
6262
6263 This option is only available on SunOS and Solaris.
6264
6265 @item -mv8
6266 @itemx -msparclite
6267 @opindex mv8
6268 @opindex msparclite
6269 These two options select variations on the SPARC architecture.
6270
6271 By default (unless specifically configured for the Fujitsu SPARClite),
6272 GCC generates code for the v7 variant of the SPARC architecture.
6273
6274 @option{-mv8} will give you SPARC v8 code.  The only difference from v7
6275 code is that the compiler emits the integer multiply and integer
6276 divide instructions which exist in SPARC v8 but not in SPARC v7.
6277
6278 @option{-msparclite} will give you SPARClite code.  This adds the integer
6279 multiply, integer divide step and scan (@code{ffs}) instructions which
6280 exist in SPARClite but not in SPARC v7.
6281
6282 These options are deprecated and will be deleted in a future GCC release.
6283 They have been replaced with @option{-mcpu=xxx}.
6284
6285 @item -mcypress
6286 @itemx -msupersparc
6287 @opindex mcypress
6288 @opindex msupersparc
6289 These two options select the processor for which the code is optimized.
6290
6291 With @option{-mcypress} (the default), the compiler optimizes code for the
6292 Cypress CY7C602 chip, as used in the SPARCStation/SPARCServer 3xx series.
6293 This is also appropriate for the older SPARCStation 1, 2, IPX etc.
6294
6295 With @option{-msupersparc} the compiler optimizes code for the SuperSPARC cpu, as
6296 used in the SPARCStation 10, 1000 and 2000 series.  This flag also enables use
6297 of the full SPARC v8 instruction set.
6298
6299 These options are deprecated and will be deleted in a future GCC release.
6300 They have been replaced with @option{-mcpu=xxx}.
6301
6302 @item -mcpu=@var{cpu_type}
6303 @opindex mcpu
6304 Set the instruction set, register set, and instruction scheduling parameters
6305 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
6306 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
6307 @samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
6308 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
6309 @samp{ultrasparc3}.
6310
6311 Default instruction scheduling parameters are used for values that select
6312 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
6313 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
6314
6315 Here is a list of each supported architecture and their supported
6316 implementations.
6317
6318 @smallexample
6319     v7:             cypress
6320     v8:             supersparc, hypersparc
6321     sparclite:      f930, f934, sparclite86x
6322     sparclet:       tsc701
6323     v9:             ultrasparc, ultrasparc3
6324 @end smallexample
6325
6326 @item -mtune=@var{cpu_type}
6327 @opindex mtune
6328 Set the instruction scheduling parameters for machine type
6329 @var{cpu_type}, but do not set the instruction set or register set that the
6330 option @option{-mcpu=@var{cpu_type}} would.
6331
6332 The same values for @option{-mcpu=@var{cpu_type}} can be used for
6333 @option{-mtune=@var{cpu_type}}, but the only useful values are those
6334 that select a particular cpu implementation.  Those are @samp{cypress},
6335 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
6336 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
6337 @samp{ultrasparc3}.
6338
6339 @end table
6340
6341 These @samp{-m} switches are supported in addition to the above
6342 on the SPARCLET processor.
6343
6344 @table @gcctabopt
6345 @item -mlittle-endian
6346 @opindex mlittle-endian
6347 Generate code for a processor running in little-endian mode.
6348
6349 @item -mlive-g0
6350 @opindex mlive-g0
6351 Treat register @code{%g0} as a normal register.
6352 GCC will continue to clobber it as necessary but will not assume
6353 it always reads as 0.
6354
6355 @item -mbroken-saverestore
6356 @opindex mbroken-saverestore
6357 Generate code that does not use non-trivial forms of the @code{save} and
6358 @code{restore} instructions.  Early versions of the SPARCLET processor do
6359 not correctly handle @code{save} and @code{restore} instructions used with
6360 arguments.  They correctly handle them used without arguments.  A @code{save}
6361 instruction used without arguments increments the current window pointer
6362 but does not allocate a new stack frame.  It is assumed that the window
6363 overflow trap handler will properly handle this case as will interrupt
6364 handlers.
6365 @end table
6366
6367 These @samp{-m} switches are supported in addition to the above
6368 on SPARC V9 processors in 64-bit environments.
6369
6370 @table @gcctabopt
6371 @item -mlittle-endian
6372 @opindex mlittle-endian
6373 Generate code for a processor running in little-endian mode. It is only
6374 available for a few configurations and most notably not on Solaris.
6375
6376 @item -m32
6377 @itemx -m64
6378 @opindex m32
6379 @opindex m64
6380 Generate code for a 32-bit or 64-bit environment.
6381 The 32-bit environment sets int, long and pointer to 32 bits.
6382 The 64-bit environment sets int to 32 bits and long and pointer
6383 to 64 bits.
6384
6385 @item -mcmodel=medlow
6386 @opindex mcmodel=medlow
6387 Generate code for the Medium/Low code model: the program must be linked
6388 in the low 32 bits of the address space.  Pointers are 64 bits.
6389 Programs can be statically or dynamically linked.
6390
6391 @item -mcmodel=medmid
6392 @opindex mcmodel=medmid
6393 Generate code for the Medium/Middle code model: the program must be linked
6394 in the low 44 bits of the address space, the text segment must be less than
6395 2G bytes, and data segment must be within 2G of the text segment.
6396 Pointers are 64 bits.
6397
6398 @item -mcmodel=medany
6399 @opindex mcmodel=medany
6400 Generate code for the Medium/Anywhere code model: the program may be linked
6401 anywhere in the address space, the text segment must be less than
6402 2G bytes, and data segment must be within 2G of the text segment.
6403 Pointers are 64 bits.
6404
6405 @item -mcmodel=embmedany
6406 @opindex mcmodel=embmedany
6407 Generate code for the Medium/Anywhere code model for embedded systems:
6408 assume a 32-bit text and a 32-bit data segment, both starting anywhere
6409 (determined at link time).  Register %g4 points to the base of the
6410 data segment.  Pointers are still 64 bits.
6411 Programs are statically linked, PIC is not supported.
6412
6413 @item -mstack-bias
6414 @itemx -mno-stack-bias
6415 @opindex mstack-bias
6416 @opindex mno-stack-bias
6417 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
6418 frame pointer if present, are offset by @minus{}2047 which must be added back
6419 when making stack frame references.
6420 Otherwise, assume no such offset is present.
6421 @end table
6422
6423 @node ARM Options
6424 @subsection ARM Options
6425 @cindex ARM options
6426
6427 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6428 architectures:
6429
6430 @table @gcctabopt
6431 @item -mapcs-frame
6432 @opindex mapcs-frame
6433 Generate a stack frame that is compliant with the ARM Procedure Call
6434 Standard for all functions, even if this is not strictly necessary for
6435 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
6436 with this option will cause the stack frames not to be generated for
6437 leaf functions.  The default is @option{-mno-apcs-frame}.
6438
6439 @item -mapcs
6440 @opindex mapcs
6441 This is a synonym for @option{-mapcs-frame}.
6442
6443 @item -mapcs-26
6444 @opindex mapcs-26
6445 Generate code for a processor running with a 26-bit program counter,
6446 and conforming to the function calling standards for the APCS 26-bit
6447 option.  This option replaces the @option{-m2} and @option{-m3} options
6448 of previous releases of the compiler.
6449
6450 @item -mapcs-32
6451 @opindex mapcs-32
6452 Generate code for a processor running with a 32-bit program counter,
6453 and conforming to the function calling standards for the APCS 32-bit
6454 option.  This option replaces the @option{-m6} option of previous releases
6455 of the compiler.
6456
6457 @ignore
6458 @c not currently implemented
6459 @item -mapcs-stack-check
6460 @opindex mapcs-stack-check
6461 Generate code to check the amount of stack space available upon entry to
6462 every function (that actually uses some stack space).  If there is
6463 insufficient space available then either the function
6464 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6465 called, depending upon the amount of stack space required.  The run time
6466 system is required to provide these functions.  The default is
6467 @option{-mno-apcs-stack-check}, since this produces smaller code.
6468
6469 @c not currently implemented
6470 @item -mapcs-float
6471 @opindex mapcs-float
6472 Pass floating point arguments using the float point registers.  This is
6473 one of the variants of the APCS@.  This option is recommended if the
6474 target hardware has a floating point unit or if a lot of floating point
6475 arithmetic is going to be performed by the code.  The default is
6476 @option{-mno-apcs-float}, since integer only code is slightly increased in
6477 size if @option{-mapcs-float} is used.
6478
6479 @c not currently implemented
6480 @item -mapcs-reentrant
6481 @opindex mapcs-reentrant
6482 Generate reentrant, position independent code.  The default is
6483 @option{-mno-apcs-reentrant}.
6484 @end ignore
6485
6486 @item -mthumb-interwork
6487 @opindex mthumb-interwork
6488 Generate code which supports calling between the ARM and Thumb
6489 instruction sets.  Without this option the two instruction sets cannot
6490 be reliably used inside one program.  The default is
6491 @option{-mno-thumb-interwork}, since slightly larger code is generated
6492 when @option{-mthumb-interwork} is specified.
6493
6494 @item -mno-sched-prolog
6495 @opindex mno-sched-prolog
6496 Prevent the reordering of instructions in the function prolog, or the
6497 merging of those instruction with the instructions in the function's
6498 body.  This means that all functions will start with a recognizable set
6499 of instructions (or in fact one of a choice from a small set of
6500 different function prologues), and this information can be used to
6501 locate the start if functions inside an executable piece of code.  The
6502 default is @option{-msched-prolog}.
6503
6504 @item -mhard-float
6505 @opindex mhard-float
6506 Generate output containing floating point instructions.  This is the
6507 default.
6508
6509 @item -msoft-float
6510 @opindex msoft-float
6511 Generate output containing library calls for floating point.
6512 @strong{Warning:} the requisite libraries are not available for all ARM
6513 targets.  Normally the facilities of the machine's usual C compiler are
6514 used, but this cannot be done directly in cross-compilation.  You must make
6515 your own arrangements to provide suitable library functions for
6516 cross-compilation.
6517
6518 @option{-msoft-float} changes the calling convention in the output file;
6519 therefore, it is only useful if you compile @emph{all} of a program with
6520 this option.  In particular, you need to compile @file{libgcc.a}, the
6521 library that comes with GCC, with @option{-msoft-float} in order for
6522 this to work.
6523
6524 @item -mlittle-endian
6525 @opindex mlittle-endian
6526 Generate code for a processor running in little-endian mode.  This is
6527 the default for all standard configurations.
6528
6529 @item -mbig-endian
6530 @opindex mbig-endian
6531 Generate code for a processor running in big-endian mode; the default is
6532 to compile code for a little-endian processor.
6533
6534 @item -mwords-little-endian
6535 @opindex mwords-little-endian
6536 This option only applies when generating code for big-endian processors.
6537 Generate code for a little-endian word order but a big-endian byte
6538 order.  That is, a byte order of the form @samp{32107654}.  Note: this
6539 option should only be used if you require compatibility with code for
6540 big-endian ARM processors generated by versions of the compiler prior to
6541 2.8.
6542
6543 @item -malignment-traps
6544 @opindex malignment-traps
6545 Generate code that will not trap if the MMU has alignment traps enabled.
6546 On ARM architectures prior to ARMv4, there were no instructions to
6547 access half-word objects stored in memory.  However, when reading from
6548 memory a feature of the ARM architecture allows a word load to be used,
6549 even if the address is unaligned, and the processor core will rotate the
6550 data as it is being loaded.  This option tells the compiler that such
6551 misaligned accesses will cause a MMU trap and that it should instead
6552 synthesize the access as a series of byte accesses.  The compiler can
6553 still use word accesses to load half-word data if it knows that the
6554 address is aligned to a word boundary.
6555
6556 This option is ignored when compiling for ARM architecture 4 or later,
6557 since these processors have instructions to directly access half-word
6558 objects in memory.
6559
6560 @item -mno-alignment-traps
6561 @opindex mno-alignment-traps
6562 Generate code that assumes that the MMU will not trap unaligned
6563 accesses.  This produces better code when the target instruction set
6564 does not have half-word memory operations (i.e.@: implementations prior to
6565 ARMv4).
6566
6567 Note that you cannot use this option to access unaligned word objects,
6568 since the processor will only fetch one 32-bit aligned object from
6569 memory.
6570
6571 The default setting for most targets is @option{-mno-alignment-traps}, since
6572 this produces better code when there are no half-word memory
6573 instructions available.
6574
6575 @item -mshort-load-bytes
6576 @itemx -mno-short-load-words
6577 @opindex mshort-load-bytes
6578 @opindex mno-short-load-words
6579 These are deprecated aliases for @option{-malignment-traps}.
6580
6581 @item -mno-short-load-bytes
6582 @itemx -mshort-load-words
6583 @opindex mno-short-load-bytes
6584 @opindex mshort-load-words
6585 This are deprecated aliases for @option{-mno-alignment-traps}.
6586
6587 @item -mcpu=@var{name}
6588 @opindex mcpu
6589 This specifies the name of the target ARM processor.  GCC uses this name
6590 to determine what kind of instructions it can emit when generating
6591 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6592 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6593 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6594 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6595 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6596 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6597 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6598 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6599 @samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi},
6600 @samp{arm1020t}, @samp{xscale}, @samp{iwmmxt}, @samp{ep9312}.
6601
6602 @itemx -mtune=@var{name}
6603 @opindex mtune
6604 This option is very similar to the @option{-mcpu=} option, except that
6605 instead of specifying the actual target processor type, and hence
6606 restricting which instructions can be used, it specifies that GCC should
6607 tune the performance of the code as if the target were of the type
6608 specified in this option, but still choosing the instructions that it
6609 will generate based on the cpu specified by a @option{-mcpu=} option.
6610 For some ARM implementations better performance can be obtained by using
6611 this option.
6612
6613 @item -march=@var{name}
6614 @opindex march
6615 This specifies the name of the target ARM architecture.  GCC uses this
6616 name to determine what kind of instructions it can emit when generating
6617 assembly code.  This option can be used in conjunction with or instead
6618 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6619 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6620 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{iwmmxt}, @samp{ep9312}.
6621
6622 @item -mfpe=@var{number}
6623 @itemx -mfp=@var{number}
6624 @opindex mfpe
6625 @opindex mfp
6626 This specifies the version of the floating point emulation available on
6627 the target.  Permissible values are 2 and 3.  @option{-mfp=} is a synonym
6628 for @option{-mfpe=}, for compatibility with older versions of GCC@.
6629
6630 @item -mstructure-size-boundary=@var{n}
6631 @opindex mstructure-size-boundary
6632 The size of all structures and unions will be rounded up to a multiple
6633 of the number of bits set by this option.  Permissible values are 8 and
6634 32.  The default value varies for different toolchains.  For the COFF
6635 targeted toolchain the default value is 8.  Specifying the larger number
6636 can produce faster, more efficient code, but can also increase the size
6637 of the program.  The two values are potentially incompatible.  Code
6638 compiled with one value cannot necessarily expect to work with code or
6639 libraries compiled with the other value, if they exchange information
6640 using structures or unions.
6641
6642 @item -mabort-on-noreturn
6643 @opindex mabort-on-noreturn
6644 Generate a call to the function @code{abort} at the end of a
6645 @code{noreturn} function.  It will be executed if the function tries to
6646 return.
6647
6648 @item -mlong-calls
6649 @itemx -mno-long-calls
6650 @opindex mlong-calls
6651 @opindex mno-long-calls
6652 Tells the compiler to perform function calls by first loading the
6653 address of the function into a register and then performing a subroutine
6654 call on this register.  This switch is needed if the target function
6655 will lie outside of the 64 megabyte addressing range of the offset based
6656 version of subroutine call instruction.
6657
6658 Even if this switch is enabled, not all function calls will be turned
6659 into long calls.  The heuristic is that static functions, functions
6660 which have the @samp{short-call} attribute, functions that are inside
6661 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6662 definitions have already been compiled within the current compilation
6663 unit, will not be turned into long calls.  The exception to this rule is
6664 that weak function definitions, functions with the @samp{long-call}
6665 attribute or the @samp{section} attribute, and functions that are within
6666 the scope of a @samp{#pragma long_calls} directive, will always be
6667 turned into long calls.
6668
6669 This feature is not enabled by default.  Specifying
6670 @option{-mno-long-calls} will restore the default behavior, as will
6671 placing the function calls within the scope of a @samp{#pragma
6672 long_calls_off} directive.  Note these switches have no effect on how
6673 the compiler generates code to handle function calls via function
6674 pointers.
6675
6676 @item -mnop-fun-dllimport
6677 @opindex mnop-fun-dllimport
6678 Disable support for the @code{dllimport} attribute.
6679
6680 @item -msingle-pic-base
6681 @opindex msingle-pic-base
6682 Treat the register used for PIC addressing as read-only, rather than
6683 loading it in the prologue for each function.  The run-time system is
6684 responsible for initializing this register with an appropriate value
6685 before execution begins.
6686
6687 @item -mpic-register=@var{reg}
6688 @opindex mpic-register
6689 Specify the register to be used for PIC addressing.  The default is R10
6690 unless stack-checking is enabled, when R9 is used.
6691
6692 @item -mcirrus-fix-invalid-insns
6693 @opindex mcirrus-fix-invalid-insns
6694 @opindex mno-cirrus-fix-invalid-insns
6695 Insert NOPs into the instruction stream to in order to work around
6696 problems with invalid Maverick instruction combinations.  This option
6697 is only valid if the @option{-mcpu=ep9312} option has been used to
6698 enable generation of instructions for the Cirrus Maverick floating
6699 point co-processor.  This option is not enabled by default, since the
6700 problem is only present in older Maverick implementations.  The default
6701 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
6702 switch.
6703
6704 @item -mpoke-function-name
6705 @opindex mpoke-function-name
6706 Write the name of each function into the text section, directly
6707 preceding the function prologue.  The generated code is similar to this:
6708
6709 @smallexample
6710      t0
6711          .ascii "arm_poke_function_name", 0
6712          .align
6713      t1
6714          .word 0xff000000 + (t1 - t0)
6715      arm_poke_function_name
6716          mov     ip, sp
6717          stmfd   sp!, @{fp, ip, lr, pc@}
6718          sub     fp, ip, #4
6719 @end smallexample
6720
6721 When performing a stack backtrace, code can inspect the value of
6722 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6723 location @code{pc - 12} and the top 8 bits are set, then we know that
6724 there is a function name embedded immediately preceding this location
6725 and has length @code{((pc[-3]) & 0xff000000)}.
6726
6727 @item -mthumb
6728 @opindex mthumb
6729 Generate code for the 16-bit Thumb instruction set.  The default is to
6730 use the 32-bit ARM instruction set.
6731
6732 @item -mtpcs-frame
6733 @opindex mtpcs-frame
6734 Generate a stack frame that is compliant with the Thumb Procedure Call
6735 Standard for all non-leaf functions.  (A leaf function is one that does
6736 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6737
6738 @item -mtpcs-leaf-frame
6739 @opindex mtpcs-leaf-frame
6740 Generate a stack frame that is compliant with the Thumb Procedure Call
6741 Standard for all leaf functions.  (A leaf function is one that does
6742 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6743
6744 @item -mcallee-super-interworking
6745 @opindex mcallee-super-interworking
6746 Gives all externally visible functions in the file being compiled an ARM
6747 instruction set header which switches to Thumb mode before executing the
6748 rest of the function.  This allows these functions to be called from
6749 non-interworking code.
6750
6751 @item -mcaller-super-interworking
6752 @opindex mcaller-super-interworking
6753 Allows calls via function pointers (including virtual functions) to
6754 execute correctly regardless of whether the target code has been
6755 compiled for interworking or not.  There is a small overhead in the cost
6756 of executing a function pointer if this option is enabled.
6757
6758 @end table
6759
6760 @node MN10200 Options
6761 @subsection MN10200 Options
6762 @cindex MN10200 options
6763
6764 These @option{-m} options are defined for Matsushita MN10200 architectures:
6765 @table @gcctabopt
6766
6767 @item -mrelax
6768 @opindex mrelax
6769 Indicate to the linker that it should perform a relaxation optimization pass
6770 to shorten branches, calls and absolute memory addresses.  This option only
6771 has an effect when used on the command line for the final link step.
6772
6773 This option makes symbolic debugging impossible.
6774 @end table
6775
6776 @node MN10300 Options
6777 @subsection MN10300 Options
6778 @cindex MN10300 options
6779
6780 These @option{-m} options are defined for Matsushita MN10300 architectures:
6781
6782 @table @gcctabopt
6783 @item -mmult-bug
6784 @opindex mmult-bug
6785 Generate code to avoid bugs in the multiply instructions for the MN10300
6786 processors.  This is the default.
6787
6788 @item -mno-mult-bug
6789 @opindex mno-mult-bug
6790 Do not generate code to avoid bugs in the multiply instructions for the
6791 MN10300 processors.
6792
6793 @item -mam33
6794 @opindex mam33
6795 Generate code which uses features specific to the AM33 processor.
6796
6797 @item -mno-am33
6798 @opindex mno-am33
6799 Do not generate code which uses features specific to the AM33 processor.  This
6800 is the default.
6801
6802 @item -mno-crt0
6803 @opindex mno-crt0
6804 Do not link in the C run-time initialization object file.
6805
6806 @item -mrelax
6807 @opindex mrelax
6808 Indicate to the linker that it should perform a relaxation optimization pass
6809 to shorten branches, calls and absolute memory addresses.  This option only
6810 has an effect when used on the command line for the final link step.
6811
6812 This option makes symbolic debugging impossible.
6813 @end table
6814
6815
6816 @node M32R/D Options
6817 @subsection M32R/D Options
6818 @cindex M32R/D options
6819
6820 These @option{-m} options are defined for Mitsubishi M32R/D architectures:
6821
6822 @table @gcctabopt
6823 @item -m32rx
6824 @opindex m32rx
6825 Generate code for the M32R/X@.
6826
6827 @item -m32r
6828 @opindex m32r
6829 Generate code for the M32R@.  This is the default.
6830
6831 @item -mcode-model=small
6832 @opindex mcode-model=small
6833 Assume all objects live in the lower 16MB of memory (so that their addresses
6834 can be loaded with the @code{ld24} instruction), and assume all subroutines
6835 are reachable with the @code{bl} instruction.
6836 This is the default.
6837
6838 The addressability of a particular object can be set with the
6839 @code{model} attribute.
6840
6841 @item -mcode-model=medium
6842 @opindex mcode-model=medium
6843 Assume objects may be anywhere in the 32-bit address space (the compiler
6844 will generate @code{seth/add3} instructions to load their addresses), and
6845 assume all subroutines are reachable with the @code{bl} instruction.
6846
6847 @item -mcode-model=large
6848 @opindex mcode-model=large
6849 Assume objects may be anywhere in the 32-bit address space (the compiler
6850 will generate @code{seth/add3} instructions to load their addresses), and
6851 assume subroutines may not be reachable with the @code{bl} instruction
6852 (the compiler will generate the much slower @code{seth/add3/jl}
6853 instruction sequence).
6854
6855 @item -msdata=none
6856 @opindex msdata=none
6857 Disable use of the small data area.  Variables will be put into
6858 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6859 @code{section} attribute has been specified).
6860 This is the default.
6861
6862 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6863 Objects may be explicitly put in the small data area with the
6864 @code{section} attribute using one of these sections.
6865
6866 @item -msdata=sdata
6867 @opindex msdata=sdata
6868 Put small global and static data in the small data area, but do not
6869 generate special code to reference them.
6870
6871 @item -msdata=use
6872 @opindex msdata=use
6873 Put small global and static data in the small data area, and generate
6874 special instructions to reference them.
6875
6876 @item -G @var{num}
6877 @opindex G
6878 @cindex smaller data references
6879 Put global and static objects less than or equal to @var{num} bytes
6880 into the small data or bss sections instead of the normal data or bss
6881 sections.  The default value of @var{num} is 8.
6882 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6883 for this option to have any effect.
6884
6885 All modules should be compiled with the same @option{-G @var{num}} value.
6886 Compiling with different values of @var{num} may or may not work; if it
6887 doesn't the linker will give an error message---incorrect code will not be
6888 generated.
6889
6890 @end table
6891
6892 @node M88K Options
6893 @subsection M88K Options
6894 @cindex M88k options
6895
6896 These @samp{-m} options are defined for Motorola 88k architectures:
6897
6898 @table @gcctabopt
6899 @item -m88000
6900 @opindex m88000
6901 Generate code that works well on both the m88100 and the
6902 m88110.
6903
6904 @item -m88100
6905 @opindex m88100
6906 Generate code that works best for the m88100, but that also
6907 runs on the m88110.
6908
6909 @item -m88110
6910 @opindex m88110
6911 Generate code that works best for the m88110, and may not run
6912 on the m88100.
6913
6914 @item -mbig-pic
6915 @opindex mbig-pic
6916 Obsolete option to be removed from the next revision.
6917 Use @option{-fPIC}.
6918
6919 @item -midentify-revision
6920 @opindex midentify-revision
6921 @cindex identifying source, compiler (88k)
6922 Include an @code{ident} directive in the assembler output recording the
6923 source file name, compiler name and version, timestamp, and compilation
6924 flags used.
6925
6926 @item -mno-underscores
6927 @opindex mno-underscores
6928 @cindex underscores, avoiding (88k)
6929 In assembler output, emit symbol names without adding an underscore
6930 character at the beginning of each name.  The default is to use an
6931 underscore as prefix on each name.
6932
6933 @item -mocs-debug-info
6934 @itemx -mno-ocs-debug-info
6935 @opindex mocs-debug-info
6936 @opindex mno-ocs-debug-info
6937 @cindex OCS (88k)
6938 @cindex debugging, 88k OCS
6939 Include (or omit) additional debugging information (about registers used
6940 in each stack frame) as specified in the 88open Object Compatibility
6941 Standard, ``OCS''@.  This extra information allows debugging of code that
6942 has had the frame pointer eliminated.  The default for SVr4 and Delta 88
6943 SVr3.2 is to include this information; other 88k configurations omit this
6944 information by default.
6945
6946 @item -mocs-frame-position
6947 @opindex mocs-frame-position
6948 @cindex register positions in frame (88k)
6949 When emitting COFF debugging information for automatic variables and
6950 parameters stored on the stack, use the offset from the canonical frame
6951 address, which is the stack pointer (register 31) on entry to the
6952 function.  The SVr4 and Delta88 SVr3.2, and BCS configurations use
6953 @option{-mocs-frame-position}; other 88k configurations have the default
6954 @option{-mno-ocs-frame-position}.
6955
6956 @item -mno-ocs-frame-position
6957 @opindex mno-ocs-frame-position
6958 @cindex register positions in frame (88k)
6959 When emitting COFF debugging information for automatic variables and
6960 parameters stored on the stack, use the offset from the frame pointer
6961 register (register 30).  When this option is in effect, the frame
6962 pointer is not eliminated when debugging information is selected by the
6963 -g switch.
6964
6965 @item -moptimize-arg-area
6966 @opindex moptimize-arg-area
6967 @cindex arguments in frame (88k)
6968 Save space by reorganizing the stack frame.  This option generates code
6969 that does not agree with the 88open specifications, but uses less
6970 memory.
6971
6972 @itemx -mno-optimize-arg-area
6973 @opindex mno-optimize-arg-area
6974 Do not reorganize the stack frame to save space.  This is the default.
6975 The generated conforms to the specification, but uses more memory.
6976
6977 @item -mshort-data-@var{num}
6978 @opindex mshort-data
6979 @cindex smaller data references (88k)
6980 @cindex r0-relative references (88k)
6981 Generate smaller data references by making them relative to @code{r0},
6982 which allows loading a value using a single instruction (rather than the
6983 usual two).  You control which data references are affected by
6984 specifying @var{num} with this option.  For example, if you specify
6985 @option{-mshort-data-512}, then the data references affected are those
6986 involving displacements of less than 512 bytes.
6987 @option{-mshort-data-@var{num}} is not effective for @var{num} greater
6988 than 64k.
6989
6990 @item -mserialize-volatile
6991 @opindex mserialize-volatile
6992 @itemx -mno-serialize-volatile
6993 @opindex mno-serialize-volatile
6994 @cindex sequential consistency on 88k
6995 Do, or don't, generate code to guarantee sequential consistency
6996 of volatile memory references.  By default, consistency is
6997 guaranteed.
6998
6999 The order of memory references made by the MC88110 processor does
7000 not always match the order of the instructions requesting those
7001 references.  In particular, a load instruction may execute before
7002 a preceding store instruction.  Such reordering violates
7003 sequential consistency of volatile memory references, when there
7004 are multiple processors.   When consistency must be guaranteed,
7005 GCC generates special instructions, as needed, to force
7006 execution in the proper order.
7007
7008 The MC88100 processor does not reorder memory references and so
7009 always provides sequential consistency.  However, by default, GCC
7010 generates the special instructions to guarantee consistency
7011 even when you use @option{-m88100}, so that the code may be run on an
7012 MC88110 processor.  If you intend to run your code only on the
7013 MC88100 processor, you may use @option{-mno-serialize-volatile}.
7014
7015 The extra code generated to guarantee consistency may affect the
7016 performance of your application.  If you know that you can safely
7017 forgo this guarantee, you may use @option{-mno-serialize-volatile}.
7018
7019 @item -msvr4
7020 @itemx -msvr3
7021 @opindex msvr4
7022 @opindex msvr3
7023 @cindex assembler syntax, 88k
7024 @cindex SVr4
7025 Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions
7026 related to System V release 4 (SVr4).  This controls the following:
7027
7028 @enumerate
7029 @item
7030 Which variant of the assembler syntax to emit.
7031 @item
7032 @option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
7033 that is used on System V release 4.
7034 @item
7035 @option{-msvr4} makes GCC issue additional declaration directives used in
7036 SVr4.
7037 @end enumerate
7038
7039 @option{-msvr4} is the default for the m88k-motorola-sysv4 configuration.
7040 @option{-msvr3} is the default for all other m88k configurations.
7041
7042 @item -mversion-03.00
7043 @opindex mversion-03.00
7044 This option is obsolete, and is ignored.
7045 @c ??? which asm syntax better for GAS?  option there too?
7046
7047 @item -mno-check-zero-division
7048 @itemx -mcheck-zero-division
7049 @opindex mno-check-zero-division
7050 @opindex mcheck-zero-division
7051 @cindex zero division on 88k
7052 Do, or don't, generate code to guarantee that integer division by
7053 zero will be detected.  By default, detection is guaranteed.
7054
7055 Some models of the MC88100 processor fail to trap upon integer
7056 division by zero under certain conditions.  By default, when
7057 compiling code that might be run on such a processor, GCC
7058 generates code that explicitly checks for zero-valued divisors
7059 and traps with exception number 503 when one is detected.  Use of
7060 @option{-mno-check-zero-division} suppresses such checking for code
7061 generated to run on an MC88100 processor.
7062
7063 GCC assumes that the MC88110 processor correctly detects all instances
7064 of integer division by zero.  When @option{-m88110} is specified, no
7065 explicit checks for zero-valued divisors are generated, and both
7066 @option{-mcheck-zero-division} and @option{-mno-check-zero-division} are
7067 ignored.
7068
7069 @item -muse-div-instruction
7070 @opindex muse-div-instruction
7071 @cindex divide instruction, 88k
7072 Use the div instruction for signed integer division on the
7073 MC88100 processor.  By default, the div instruction is not used.
7074
7075 On the MC88100 processor the signed integer division instruction
7076 div) traps to the operating system on a negative operand.  The
7077 operating system transparently completes the operation, but at a
7078 large cost in execution time.  By default, when compiling code
7079 that might be run on an MC88100 processor, GCC emulates signed
7080 integer division using the unsigned integer division instruction
7081 divu), thereby avoiding the large penalty of a trap to the
7082 operating system.  Such emulation has its own, smaller, execution
7083 cost in both time and space.  To the extent that your code's
7084 important signed integer division operations are performed on two
7085 nonnegative operands, it may be desirable to use the div
7086 instruction directly.
7087
7088 On the MC88110 processor the div instruction (also known as the
7089 divs instruction) processes negative operands without trapping to
7090 the operating system.  When @option{-m88110} is specified,
7091 @option{-muse-div-instruction} is ignored, and the div instruction is used
7092 for signed integer division.
7093
7094 Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined.  In
7095 particular, the behavior of such a division with and without
7096 @option{-muse-div-instruction} may differ.
7097
7098 @item -mtrap-large-shift
7099 @itemx -mhandle-large-shift
7100 @opindex mtrap-large-shift
7101 @opindex mhandle-large-shift
7102 @cindex bit shift overflow (88k)
7103 @cindex large bit shifts (88k)
7104 Include code to detect bit-shifts of more than 31 bits; respectively,
7105 trap such shifts or emit code to handle them properly.  By default GCC
7106 makes no special provision for large bit shifts.
7107
7108 @item -mwarn-passed-structs
7109 @opindex mwarn-passed-structs
7110 @cindex structure passing (88k)
7111 Warn when a function passes a struct as an argument or result.
7112 Structure-passing conventions have changed during the evolution of the C
7113 language, and are often the source of portability problems.  By default,
7114 GCC issues no such warning.
7115 @end table
7116
7117 @c break page here to avoid unsightly interparagraph stretch.
7118 @c -zw, 2001-8-17
7119 @page
7120
7121 @node RS/6000 and PowerPC Options
7122 @subsection IBM RS/6000 and PowerPC Options
7123 @cindex RS/6000 and PowerPC Options
7124 @cindex IBM RS/6000 and PowerPC Options
7125
7126 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
7127 @table @gcctabopt
7128 @item -mpower
7129 @itemx -mno-power
7130 @itemx -mpower2
7131 @itemx -mno-power2
7132 @itemx -mpowerpc
7133 @itemx -mno-powerpc
7134 @itemx -mpowerpc-gpopt
7135 @itemx -mno-powerpc-gpopt
7136 @itemx -mpowerpc-gfxopt
7137 @itemx -mno-powerpc-gfxopt
7138 @itemx -mpowerpc64
7139 @itemx -mno-powerpc64
7140 @opindex mpower
7141 @opindex mno-power
7142 @opindex mpower2
7143 @opindex mno-power2
7144 @opindex mpowerpc
7145 @opindex mno-powerpc
7146 @opindex mpowerpc-gpopt
7147 @opindex mno-powerpc-gpopt
7148 @opindex mpowerpc-gfxopt
7149 @opindex mno-powerpc-gfxopt
7150 @opindex mpowerpc64
7151 @opindex mno-powerpc64
7152 GCC supports two related instruction set architectures for the
7153 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
7154 instructions supported by the @samp{rios} chip set used in the original
7155 RS/6000 systems and the @dfn{PowerPC} instruction set is the
7156 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
7157 the IBM 4xx microprocessors.
7158
7159 Neither architecture is a subset of the other.  However there is a
7160 large common subset of instructions supported by both.  An MQ
7161 register is included in processors supporting the POWER architecture.
7162
7163 You use these options to specify which instructions are available on the
7164 processor you are using.  The default value of these options is
7165 determined when configuring GCC@.  Specifying the
7166 @option{-mcpu=@var{cpu_type}} overrides the specification of these
7167 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
7168 rather than the options listed above.
7169
7170 The @option{-mpower} option allows GCC to generate instructions that
7171 are found only in the POWER architecture and to use the MQ register.
7172 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
7173 to generate instructions that are present in the POWER2 architecture but
7174 not the original POWER architecture.
7175
7176 The @option{-mpowerpc} option allows GCC to generate instructions that
7177 are found only in the 32-bit subset of the PowerPC architecture.
7178 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
7179 GCC to use the optional PowerPC architecture instructions in the
7180 General Purpose group, including floating-point square root.  Specifying
7181 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
7182 use the optional PowerPC architecture instructions in the Graphics
7183 group, including floating-point select.
7184
7185 The @option{-mpowerpc64} option allows GCC to generate the additional
7186 64-bit instructions that are found in the full PowerPC64 architecture
7187 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
7188 @option{-mno-powerpc64}.
7189
7190 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
7191 will use only the instructions in the common subset of both
7192 architectures plus some special AIX common-mode calls, and will not use
7193 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
7194 permits GCC to use any instruction from either architecture and to
7195 allow use of the MQ register; specify this for the Motorola MPC601.
7196
7197 @item -mnew-mnemonics
7198 @itemx -mold-mnemonics
7199 @opindex mnew-mnemonics
7200 @opindex mold-mnemonics
7201 Select which mnemonics to use in the generated assembler code.  With
7202 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
7203 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
7204 assembler mnemonics defined for the POWER architecture.  Instructions
7205 defined in only one architecture have only one mnemonic; GCC uses that
7206 mnemonic irrespective of which of these options is specified.
7207
7208 GCC defaults to the mnemonics appropriate for the architecture in
7209 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
7210 value of these option.  Unless you are building a cross-compiler, you
7211 should normally not specify either @option{-mnew-mnemonics} or
7212 @option{-mold-mnemonics}, but should instead accept the default.
7213
7214 @item -mcpu=@var{cpu_type}
7215 @opindex mcpu
7216 Set architecture type, register usage, choice of mnemonics, and
7217 instruction scheduling parameters for machine type @var{cpu_type}.
7218 Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
7219 @samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
7220 @samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
7221 @samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750},
7222 @samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505},
7223 @samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
7224
7225 @option{-mcpu=common} selects a completely generic processor.  Code
7226 generated under this option will run on any POWER or PowerPC processor.
7227 GCC will use only the instructions in the common subset of both
7228 architectures, and will not use the MQ register.  GCC assumes a generic
7229 processor model for scheduling purposes.
7230
7231 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
7232 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
7233 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
7234 types, with an appropriate, generic processor model assumed for
7235 scheduling purposes.
7236
7237 The other options specify a specific processor.  Code generated under
7238 those options will run best on that processor, and may not run at all on
7239 others.
7240
7241 The @option{-mcpu} options automatically enable or disable other
7242 @option{-m} options as follows:
7243
7244 @table @samp
7245 @item common
7246 @option{-mno-power}, @option{-mno-powerpc}
7247
7248 @item power
7249 @itemx power2
7250 @itemx rios1
7251 @itemx rios2
7252 @itemx rsc
7253 @option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics}
7254
7255 @item powerpc
7256 @itemx rs64a
7257 @itemx 602
7258 @itemx 603
7259 @itemx 603e
7260 @itemx 604
7261 @itemx 620
7262 @itemx 630
7263 @itemx 740
7264 @itemx 7400
7265 @itemx 7450
7266 @itemx 750
7267 @itemx 505
7268 @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}
7269
7270 @item 601
7271 @option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics}
7272
7273 @item 403
7274 @itemx 821
7275 @itemx 860
7276 @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float}
7277 @end table
7278
7279 @item -mtune=@var{cpu_type}
7280 @opindex mtune
7281 Set the instruction scheduling parameters for machine type
7282 @var{cpu_type}, but do not set the architecture type, register usage, or
7283 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
7284 values for @var{cpu_type} are used for @option{-mtune} as for
7285 @option{-mcpu}.  If both are specified, the code generated will use the
7286 architecture, registers, and mnemonics set by @option{-mcpu}, but the
7287 scheduling parameters set by @option{-mtune}.
7288
7289 @item -maltivec
7290 @itemx -mno-altivec
7291 @opindex maltivec
7292 @opindex mno-altivec
7293 These switches enable or disable the use of built-in functions that
7294 allow access to the AltiVec instruction set.  You may also need to set
7295 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
7296 enhancements.
7297
7298 @item -mabi=spe
7299 @opindex mabi=spe
7300 Extend the current ABI with SPE ABI extensions.  This does not change
7301 the default ABI, instead it adds the SPE ABI extensions to the current
7302 ABI@.
7303
7304 @item -mabi=no-spe
7305 @opindex mabi=no-spe
7306 Disable Booke SPE ABI extensions for the current ABI.
7307
7308 @item -misel=@var{yes/no}
7309 @itemx -misel
7310 @opindex misel
7311 This switch enables or disables the generation of ISEL instructions.
7312
7313 @item -mspe=@var{yes/no}
7314 @itemx -mspe
7315 @opindex mspe
7316 This switch enables or disables the generation of SPE simd
7317 instructions.
7318
7319 @item -mfloat-gprs=@var{yes/no}
7320 @itemx -mfloat-gprs
7321 @opindex mfloat-gprs
7322 This switch enables or disables the generation of floating point
7323 operations on the general purpose registers for architectures that
7324 support it.  This option is currently only available on the MPC8540.
7325
7326 @item -mfull-toc
7327 @itemx -mno-fp-in-toc
7328 @itemx -mno-sum-in-toc
7329 @itemx -mminimal-toc
7330 @opindex mfull-toc
7331 @opindex mno-fp-in-toc
7332 @opindex mno-sum-in-toc
7333 @opindex mminimal-toc
7334 Modify generation of the TOC (Table Of Contents), which is created for
7335 every executable file.  The @option{-mfull-toc} option is selected by
7336 default.  In that case, GCC will allocate at least one TOC entry for
7337 each unique non-automatic variable reference in your program.  GCC
7338 will also place floating-point constants in the TOC@.  However, only
7339 16,384 entries are available in the TOC@.
7340
7341 If you receive a linker error message that saying you have overflowed
7342 the available TOC space, you can reduce the amount of TOC space used
7343 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
7344 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
7345 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
7346 generate code to calculate the sum of an address and a constant at
7347 run-time instead of putting that sum into the TOC@.  You may specify one
7348 or both of these options.  Each causes GCC to produce very slightly
7349 slower and larger code at the expense of conserving TOC space.
7350
7351 If you still run out of space in the TOC even when you specify both of
7352 these options, specify @option{-mminimal-toc} instead.  This option causes
7353 GCC to make only one TOC entry for every file.  When you specify this
7354 option, GCC will produce code that is slower and larger but which
7355 uses extremely little TOC space.  You may wish to use this option
7356 only on files that contain less frequently executed code.
7357
7358 @item -maix64
7359 @itemx -maix32
7360 @opindex maix64
7361 @opindex maix32
7362 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7363 @code{long} type, and the infrastructure needed to support them.
7364 Specifying @option{-maix64} implies @option{-mpowerpc64} and
7365 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
7366 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
7367
7368 @item -mxl-call
7369 @itemx -mno-xl-call
7370 @opindex mxl-call
7371 @opindex mno-xl-call
7372 On AIX, pass floating-point arguments to prototyped functions beyond the
7373 register save area (RSA) on the stack in addition to argument FPRs.  The
7374 AIX calling convention was extended but not initially documented to
7375 handle an obscure K&R C case of calling a function that takes the
7376 address of its arguments with fewer arguments than declared.  AIX XL
7377 compilers access floating point arguments which do not fit in the
7378 RSA from the stack when a subroutine is compiled without
7379 optimization.  Because always storing floating-point arguments on the
7380 stack is inefficient and rarely needed, this option is not enabled by
7381 default and only is necessary when calling subroutines compiled by AIX
7382 XL compilers without optimization.
7383
7384 @item -mpe
7385 @opindex mpe
7386 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
7387 application written to use message passing with special startup code to
7388 enable the application to run.  The system must have PE installed in the
7389 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
7390 must be overridden with the @option{-specs=} option to specify the
7391 appropriate directory location.  The Parallel Environment does not
7392 support threads, so the @option{-mpe} option and the @option{-pthread}
7393 option are incompatible.
7394
7395 @item -malign-natural
7396 @itemx -malign-power
7397 @opindex malign-natural
7398 @opindex malign-power
7399 On AIX, Darwin, and 64-bit PowerPC Linux, the option
7400 @option{-malign-natural} overrides the ABI-defined alignment of larger
7401 types, such as floating-point doubles, on their natural size-based boundary.
7402 The option @option{-malign-power} instructs GCC to follow the ABI-specified
7403 alignment rules.  GCC defaults to the standard alignment defined in the ABI.
7404
7405 @item -msoft-float
7406 @itemx -mhard-float
7407 @opindex msoft-float
7408 @opindex mhard-float
7409 Generate code that does not use (uses) the floating-point register set.
7410 Software floating point emulation is provided if you use the
7411 @option{-msoft-float} option, and pass the option to GCC when linking.
7412
7413 @item -mmultiple
7414 @itemx -mno-multiple
7415 @opindex mmultiple
7416 @opindex mno-multiple
7417 Generate code that uses (does not use) the load multiple word
7418 instructions and the store multiple word instructions.  These
7419 instructions are generated by default on POWER systems, and not
7420 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
7421 endian PowerPC systems, since those instructions do not work when the
7422 processor is in little endian mode.  The exceptions are PPC740 and
7423 PPC750 which permit the instructions usage in little endian mode.
7424
7425 @item -mstring
7426 @itemx -mno-string
7427 @opindex mstring
7428 @opindex mno-string
7429 Generate code that uses (does not use) the load string instructions
7430 and the store string word instructions to save multiple registers and
7431 do small block moves.  These instructions are generated by default on
7432 POWER systems, and not generated on PowerPC systems.  Do not use
7433 @option{-mstring} on little endian PowerPC systems, since those
7434 instructions do not work when the processor is in little endian mode.
7435 The exceptions are PPC740 and PPC750 which permit the instructions
7436 usage in little endian mode.
7437
7438 @item -mupdate
7439 @itemx -mno-update
7440 @opindex mupdate
7441 @opindex mno-update
7442 Generate code that uses (does not use) the load or store instructions
7443 that update the base register to the address of the calculated memory
7444 location.  These instructions are generated by default.  If you use
7445 @option{-mno-update}, there is a small window between the time that the
7446 stack pointer is updated and the address of the previous frame is
7447 stored, which means code that walks the stack frame across interrupts or
7448 signals may get corrupted data.
7449
7450 @item -mfused-madd
7451 @itemx -mno-fused-madd
7452 @opindex mfused-madd
7453 @opindex mno-fused-madd
7454 Generate code that uses (does not use) the floating point multiply and
7455 accumulate instructions.  These instructions are generated by default if
7456 hardware floating is used.
7457
7458 @item -mno-bit-align
7459 @itemx -mbit-align
7460 @opindex mno-bit-align
7461 @opindex mbit-align
7462 On System V.4 and embedded PowerPC systems do not (do) force structures
7463 and unions that contain bit-fields to be aligned to the base type of the
7464 bit-field.
7465
7466 For example, by default a structure containing nothing but 8
7467 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
7468 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
7469 the structure would be aligned to a 1 byte boundary and be one byte in
7470 size.
7471
7472 @item -mno-strict-align
7473 @itemx -mstrict-align
7474 @opindex mno-strict-align
7475 @opindex mstrict-align
7476 On System V.4 and embedded PowerPC systems do not (do) assume that
7477 unaligned memory references will be handled by the system.
7478
7479 @item -mrelocatable
7480 @itemx -mno-relocatable
7481 @opindex mrelocatable
7482 @opindex mno-relocatable
7483 On embedded PowerPC systems generate code that allows (does not allow)
7484 the program to be relocated to a different address at runtime.  If you
7485 use @option{-mrelocatable} on any module, all objects linked together must
7486 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
7487
7488 @item -mrelocatable-lib
7489 @itemx -mno-relocatable-lib
7490 @opindex mrelocatable-lib
7491 @opindex mno-relocatable-lib
7492 On embedded PowerPC systems generate code that allows (does not allow)
7493 the program to be relocated to a different address at runtime.  Modules
7494 compiled with @option{-mrelocatable-lib} can be linked with either modules
7495 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
7496 with modules compiled with the @option{-mrelocatable} options.
7497
7498 @item -mno-toc
7499 @itemx -mtoc
7500 @opindex mno-toc
7501 @opindex mtoc
7502 On System V.4 and embedded PowerPC systems do not (do) assume that
7503 register 2 contains a pointer to a global area pointing to the addresses
7504 used in the program.
7505
7506 @item -mlittle
7507 @itemx -mlittle-endian
7508 @opindex mlittle
7509 @opindex mlittle-endian
7510 On System V.4 and embedded PowerPC systems compile code for the
7511 processor in little endian mode.  The @option{-mlittle-endian} option is
7512 the same as @option{-mlittle}.
7513
7514 @item -mbig
7515 @itemx -mbig-endian
7516 @opindex mbig
7517 @opindex mbig-endian
7518 On System V.4 and embedded PowerPC systems compile code for the
7519 processor in big endian mode.  The @option{-mbig-endian} option is
7520 the same as @option{-mbig}.
7521
7522 @item -mdynamic-no-pic
7523 @opindex mdynamic-no-pic
7524 On Darwin and Mac OS X systems, compile code so that it is not
7525 relocatable, but that its external references are relocatable.  The
7526 resulting code is suitable for applications, but not shared
7527 libraries.
7528
7529 @item -mcall-sysv
7530 @opindex mcall-sysv
7531 On System V.4 and embedded PowerPC systems compile code using calling
7532 conventions that adheres to the March 1995 draft of the System V
7533 Application Binary Interface, PowerPC processor supplement.  This is the
7534 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
7535
7536 @item -mcall-sysv-eabi
7537 @opindex mcall-sysv-eabi
7538 Specify both @option{-mcall-sysv} and @option{-meabi} options.
7539
7540 @item -mcall-sysv-noeabi
7541 @opindex mcall-sysv-noeabi
7542 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
7543
7544 @item -mcall-solaris
7545 @opindex mcall-solaris
7546 On System V.4 and embedded PowerPC systems compile code for the Solaris
7547 operating system.
7548
7549 @item -mcall-linux
7550 @opindex mcall-linux
7551 On System V.4 and embedded PowerPC systems compile code for the
7552 Linux-based GNU system.
7553
7554 @item -mcall-gnu
7555 @opindex mcall-gnu
7556 On System V.4 and embedded PowerPC systems compile code for the
7557 Hurd-based GNU system.
7558
7559 @item -mcall-netbsd
7560 @opindex mcall-netbsd
7561 On System V.4 and embedded PowerPC systems compile code for the
7562 NetBSD operating system.
7563
7564 @item -maix-struct-return
7565 @opindex maix-struct-return
7566 Return all structures in memory (as specified by the AIX ABI)@.
7567
7568 @item -msvr4-struct-return
7569 @opindex msvr4-struct-return
7570 Return structures smaller than 8 bytes in registers (as specified by the
7571 SVR4 ABI)@.
7572
7573 @item -mabi=altivec
7574 @opindex mabi=altivec
7575 Extend the current ABI with AltiVec ABI extensions.  This does not
7576 change the default ABI, instead it adds the AltiVec ABI extensions to
7577 the current ABI@.
7578
7579 @item -mabi=no-altivec
7580 @opindex mabi=no-altivec
7581 Disable AltiVec ABI extensions for the current ABI.
7582
7583 @item -mprototype
7584 @itemx -mno-prototype
7585 @opindex mprototype
7586 @opindex mno-prototype
7587 On System V.4 and embedded PowerPC systems assume that all calls to
7588 variable argument functions are properly prototyped.  Otherwise, the
7589 compiler must insert an instruction before every non prototyped call to
7590 set or clear bit 6 of the condition code register (@var{CR}) to
7591 indicate whether floating point values were passed in the floating point
7592 registers in case the function takes a variable arguments.  With
7593 @option{-mprototype}, only calls to prototyped variable argument functions
7594 will set or clear the bit.
7595
7596 @item -msim
7597 @opindex msim
7598 On embedded PowerPC systems, assume that the startup module is called
7599 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7600 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7601 configurations.
7602
7603 @item -mmvme
7604 @opindex mmvme
7605 On embedded PowerPC systems, assume that the startup module is called
7606 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7607 @file{libc.a}.
7608
7609 @item -mads
7610 @opindex mads
7611 On embedded PowerPC systems, assume that the startup module is called
7612 @file{crt0.o} and the standard C libraries are @file{libads.a} and
7613 @file{libc.a}.
7614
7615 @item -myellowknife
7616 @opindex myellowknife
7617 On embedded PowerPC systems, assume that the startup module is called
7618 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
7619 @file{libc.a}.
7620
7621 @item -mvxworks
7622 @opindex mvxworks
7623 On System V.4 and embedded PowerPC systems, specify that you are
7624 compiling for a VxWorks system.
7625
7626 @item -mwindiss
7627 @opindex mwindiss
7628 Specify that you are compiling for the WindISS simulation environment.
7629
7630 @item -memb
7631 @opindex memb
7632 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7633 header to indicate that @samp{eabi} extended relocations are used.
7634
7635 @item -meabi
7636 @itemx -mno-eabi
7637 @opindex meabi
7638 @opindex mno-eabi
7639 On System V.4 and embedded PowerPC systems do (do not) adhere to the
7640 Embedded Applications Binary Interface (eabi) which is a set of
7641 modifications to the System V.4 specifications.  Selecting @option{-meabi}
7642 means that the stack is aligned to an 8 byte boundary, a function
7643 @code{__eabi} is called to from @code{main} to set up the eabi
7644 environment, and the @option{-msdata} option can use both @code{r2} and
7645 @code{r13} to point to two separate small data areas.  Selecting
7646 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7647 do not call an initialization function from @code{main}, and the
7648 @option{-msdata} option will only use @code{r13} to point to a single
7649 small data area.  The @option{-meabi} option is on by default if you
7650 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7651
7652 @item -msdata=eabi
7653 @opindex msdata=eabi
7654 On System V.4 and embedded PowerPC systems, put small initialized
7655 @code{const} global and static data in the @samp{.sdata2} section, which
7656 is pointed to by register @code{r2}.  Put small initialized
7657 non-@code{const} global and static data in the @samp{.sdata} section,
7658 which is pointed to by register @code{r13}.  Put small uninitialized
7659 global and static data in the @samp{.sbss} section, which is adjacent to
7660 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7661 incompatible with the @option{-mrelocatable} option.  The
7662 @option{-msdata=eabi} option also sets the @option{-memb} option.
7663
7664 @item -msdata=sysv
7665 @opindex msdata=sysv
7666 On System V.4 and embedded PowerPC systems, put small global and static
7667 data in the @samp{.sdata} section, which is pointed to by register
7668 @code{r13}.  Put small uninitialized global and static data in the
7669 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7670 The @option{-msdata=sysv} option is incompatible with the
7671 @option{-mrelocatable} option.
7672
7673 @item -msdata=default
7674 @itemx -msdata
7675 @opindex msdata=default
7676 @opindex msdata
7677 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7678 compile code the same as @option{-msdata=eabi}, otherwise compile code the
7679 same as @option{-msdata=sysv}.
7680
7681 @item -msdata-data
7682 @opindex msdata-data
7683 On System V.4 and embedded PowerPC systems, put small global and static
7684 data in the @samp{.sdata} section.  Put small uninitialized global and
7685 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7686 to address small data however.  This is the default behavior unless
7687 other @option{-msdata} options are used.
7688
7689 @item -msdata=none
7690 @itemx -mno-sdata
7691 @opindex msdata=none
7692 @opindex mno-sdata
7693 On embedded PowerPC systems, put all initialized global and static data
7694 in the @samp{.data} section, and all uninitialized data in the
7695 @samp{.bss} section.
7696
7697 @item -G @var{num}
7698 @opindex G
7699 @cindex smaller data references (PowerPC)
7700 @cindex .sdata/.sdata2 references (PowerPC)
7701 On embedded PowerPC systems, put global and static items less than or
7702 equal to @var{num} bytes into the small data or bss sections instead of
7703 the normal data or bss section.  By default, @var{num} is 8.  The
7704 @option{-G @var{num}} switch is also passed to the linker.
7705 All modules should be compiled with the same @option{-G @var{num}} value.
7706
7707 @item -mregnames
7708 @itemx -mno-regnames
7709 @opindex mregnames
7710 @opindex mno-regnames
7711 On System V.4 and embedded PowerPC systems do (do not) emit register
7712 names in the assembly language output using symbolic forms.
7713
7714 @item -mlongcall
7715 @itemx -mno-longcall
7716 @opindex mlongcall
7717 @opindex mno-longcall
7718 Default to making all function calls via pointers, so that functions
7719 which reside further than 64 megabytes (67,108,864 bytes) from the
7720 current location can be called.  This setting can be overridden by the
7721 @code{shortcall} function attribute, or by @code{#pragma longcall(0)}.
7722
7723 Some linkers are capable of detecting out-of-range calls and generating
7724 glue code on the fly.  On these systems, long calls are unnecessary and
7725 generate slower code.  As of this writing, the AIX linker can do this,
7726 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7727 to the GNU linker for 32-bit PowerPC systems as well.
7728
7729 In the future, we may cause GCC to ignore all longcall specifications
7730 when the linker is known to generate glue.
7731
7732 @item -pthread
7733 @opindex pthread
7734 Adds support for multithreading with the @dfn{pthreads} library.
7735 This option sets flags for both the preprocessor and linker.
7736
7737 @end table
7738
7739 @node Darwin Options
7740 @subsection Darwin Options
7741 @cindex Darwin options
7742
7743 These options are defined for all architectures running the Darwin operating
7744 system.  They are useful for compatibility with other Mac OS compilers.
7745
7746 @table @gcctabopt
7747 @item -all_load    
7748 @opindex all_load   
7749 Loads all members of static archive libraries.
7750 See man ld(1) for more information.
7751
7752 @item -arch_errors_fatal
7753 @opindex arch_errors_fatal
7754 Cause the errors having to do with files that have the wrong architecture
7755 to be fatal.
7756
7757 @item -bind_at_load
7758 @opindex bind_at_load
7759 Causes the output file to be marked such that the dynamic linker will
7760 bind all undefined references when the file is loaded or launched.
7761
7762 @item -bundle     
7763 @opindex bundle
7764 Produce a Mach-o bundle format file.
7765 See man ld(1) for more information.
7766
7767 @item -bundle_loader @var{executable}
7768 @opindex bundle_loader
7769 This specifies the @var{executable} that will be loading the build
7770 output file being linked. See man ld(1) for more information.
7771
7772 @item -allowable_client  @var{client_name}
7773 @item -arch_only
7774
7775 @item -client_name       
7776 @item -compatibility_version
7777 @item -current_version    
7778 @item -dependency-file
7779 @item -dylib_file    
7780 @item -dylinker_install_name
7781 @item -dynamic
7782 @item -dynamiclib   
7783 @item -exported_symbols_list  
7784 @item -filelist
7785 @item -flat_namespace   
7786 @item -force_cpusubtype_ALL
7787 @item -force_flat_namespace   
7788 @item -headerpad_max_install_names
7789 @item -image_base  
7790 @item -init
7791 @item -install_name
7792 @item -keep_private_externs
7793 @item -multi_module
7794 @item -multiply_defined      
7795 @item -multiply_defined_unused      
7796 @item -noall_load  
7797 @item -nofixprebinding
7798 @item -nomultidefs
7799 @item -noprebind     
7800 @item -noseglinkedit
7801 @item -pagezero_size    
7802 @item -prebind
7803 @item -prebind_all_twolevel_modules
7804 @item -private_bundle
7805 @item -read_only_relocs
7806 @item -sectalign  
7807 @item -sectobjectsymbols    
7808 @item -whyload
7809 @item -seg1addr 
7810 @item -sectcreate
7811 @item -sectobjectsymbols
7812 @item -sectorder
7813 @item -seg_addr_table
7814 @item -seg_addr_table_filename
7815 @item -seglinkedit
7816 @item -segprot   
7817 @item -segs_read_only_addr
7818 @item -segs_read_write_addr
7819 @item -single_module   
7820 @item -static
7821 @item -sub_library
7822 @item -sub_umbrella 
7823 @item -twolevel_namespace
7824 @item -umbrella
7825 @item -undefined
7826 @item -unexported_symbols_list
7827 @item -weak_reference_mismatches
7828 @item -whatsloaded  
7829
7830 @opindex allowable_client
7831 @opindex arch_only    
7832 @opindex client_name
7833 @opindex compatibility_version
7834 @opindex current_version
7835 @opindex dependency-file
7836 @opindex dylib_file
7837 @opindex dylinker_install_name
7838 @opindex dynamic
7839 @opindex dynamiclib
7840 @opindex exported_symbols_list
7841 @opindex filelist  
7842 @opindex flat_namespace    
7843 @opindex force_cpusubtype_ALL
7844 @opindex force_flat_namespace
7845 @opindex headerpad_max_install_names
7846 @opindex image_base
7847 @opindex init     
7848 @opindex install_name
7849 @opindex keep_private_externs
7850 @opindex multi_module   
7851 @opindex multiply_defined
7852 @opindex multiply_defined_unused   
7853 @opindex noall_load  
7854 @opindex nofixprebinding
7855 @opindex nomultidefs   
7856 @opindex noprebind
7857 @opindex noseglinkedit      
7858 @opindex pagezero_size
7859 @opindex prebind
7860 @opindex prebind_all_twolevel_modules
7861 @opindex private_bundle 
7862 @opindex read_only_relocs
7863 @opindex sectalign   
7864 @opindex sectobjectsymbols    
7865 @opindex whyload  
7866 @opindex seg1addr
7867 @opindex sectcreate       
7868 @opindex sectobjectsymbols 
7869 @opindex sectorder     
7870 @opindex seg_addr_table
7871 @opindex seg_addr_table_filename
7872 @opindex seglinkedit
7873 @opindex segprot
7874 @opindex segs_read_only_addr
7875 @opindex segs_read_write_addr
7876 @opindex single_module
7877 @opindex static
7878 @opindex sub_library
7879 @opindex sub_umbrella
7880 @opindex twolevel_namespace
7881 @opindex umbrella
7882 @opindex undefined
7883 @opindex unexported_symbols_list
7884 @opindex weak_reference_mismatches
7885 @opindex whatsloaded
7886
7887 This options are available for Darwin linker. Darwin linker man page
7888 describes them in detail.
7889 @end table
7890
7891
7892 @node RT Options
7893 @subsection IBM RT Options
7894 @cindex RT options
7895 @cindex IBM RT options
7896
7897 These @samp{-m} options are defined for the IBM RT PC:
7898
7899 @table @gcctabopt
7900 @item -min-line-mul
7901 @opindex min-line-mul
7902 Use an in-line code sequence for integer multiplies.  This is the
7903 default.
7904
7905 @item -mcall-lib-mul
7906 @opindex mcall-lib-mul
7907 Call @code{lmul$$} for integer multiples.
7908
7909 @item -mfull-fp-blocks
7910 @opindex mfull-fp-blocks
7911 Generate full-size floating point data blocks, including the minimum
7912 amount of scratch space recommended by IBM@.  This is the default.
7913
7914 @item -mminimum-fp-blocks
7915 @opindex mminimum-fp-blocks
7916 Do not include extra scratch space in floating point data blocks.  This
7917 results in smaller code, but slower execution, since scratch space must
7918 be allocated dynamically.
7919
7920 @cindex @file{stdarg.h} and RT PC
7921 @item -mfp-arg-in-fpregs
7922 @opindex mfp-arg-in-fpregs
7923 Use a calling sequence incompatible with the IBM calling convention in
7924 which floating point arguments are passed in floating point registers.
7925 Note that @code{stdarg.h} will not work with floating point operands
7926 if this option is specified.
7927
7928 @item -mfp-arg-in-gregs
7929 @opindex mfp-arg-in-gregs
7930 Use the normal calling convention for floating point arguments.  This is
7931 the default.
7932
7933 @item -mhc-struct-return
7934 @opindex mhc-struct-return
7935 Return structures of more than one word in memory, rather than in a
7936 register.  This provides compatibility with the MetaWare HighC (hc)
7937 compiler.  Use the option @option{-fpcc-struct-return} for compatibility
7938 with the Portable C Compiler (pcc).
7939
7940 @item -mnohc-struct-return
7941 @opindex mnohc-struct-return
7942 Return some structures of more than one word in registers, when
7943 convenient.  This is the default.  For compatibility with the
7944 IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
7945 option @option{-mhc-struct-return}.
7946 @end table
7947
7948 @node MIPS Options
7949 @subsection MIPS Options
7950 @cindex MIPS options
7951
7952 These @samp{-m} options are defined for the MIPS family of computers:
7953
7954 @table @gcctabopt
7955
7956 @item -march=@var{arch}
7957 @opindex march
7958 Generate code that will run on @var{arch}, which can be the name of a
7959 generic MIPS ISA, or the name of a particular processor.
7960 The ISA names are:
7961 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
7962 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
7963 The processor names are:
7964 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7965 @samp{m4k},
7966 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
7967 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
7968 @samp{rm9000},
7969 @samp{orion},
7970 @samp{sb1},
7971 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4300},
7972 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
7973 The special value @samp{from-abi} selects the
7974 most compatible architecture for the selected ABI (that is,
7975 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7976
7977 In processor names, a final @samp{000} can be abbreviated as @samp{k}
7978 (for example, @samp{-march=r2k}).  Prefixes are optional, and
7979 @samp{vr} may be written @samp{r}.
7980
7981 GCC defines two macros based on the value of this option.  The first
7982 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7983 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7984 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
7985 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7986 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7987
7988 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7989 above.  In other words, it will have the full prefix and will not
7990 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7991 the macro names the resolved architecture (either @samp{"mips1"} or
7992 @samp{"mips3"}).  It names the default architecture when no
7993 @option{-march} option is given.
7994
7995 @item -mtune=@var{arch}
7996 @opindex mtune
7997 Optimize for @var{arch}.  Among other things, this option controls
7998 the way instructions are scheduled, and the perceived cost of arithmetic
7999 operations.  The list of @var{arch} values is the same as for
8000 @option{-march}.
8001
8002 When this option is not used, GCC will optimize for the processor
8003 specified by @option{-march}.  By using @option{-march} and
8004 @option{-mtune} together, it is possible to generate code that will
8005 run on a family of processors, but optimize the code for one
8006 particular member of that family.
8007
8008 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
8009 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
8010 @samp{-march} ones described above.
8011
8012 @item -mips1
8013 @opindex mips1
8014 Equivalent to @samp{-march=mips1}.
8015
8016 @item -mips2
8017 @opindex mips2
8018 Equivalent to @samp{-march=mips2}.
8019
8020 @item -mips3
8021 @opindex mips3
8022 Equivalent to @samp{-march=mips3}.
8023
8024 @item -mips4
8025 @opindex mips4
8026 Equivalent to @samp{-march=mips4}.
8027
8028 @item -mips32
8029 @opindex mips32
8030 Equivalent to @samp{-march=mips32}.
8031
8032 @item -mips32r2
8033 @opindex mips32r2
8034 Equivalent to @samp{-march=mips32r2}.
8035
8036 @item -mips64
8037 @opindex mips64
8038 Equivalent to @samp{-march=mips64}.
8039
8040 @item -mfused-madd
8041 @itemx -mno-fused-madd
8042 @opindex mfused-madd
8043 @opindex mno-fused-madd
8044 Generate code that uses (does not use) the floating point multiply and
8045 accumulate instructions, when they are available.  These instructions
8046 are generated by default if they are available, but this may be
8047 undesirable if the extra precision causes problems or on certain chips
8048 in the mode where denormals are rounded to zero where denormals
8049 generated by multiply and accumulate instructions cause exceptions
8050 anyway.
8051
8052 @item -mfp32
8053 @opindex mfp32
8054 Assume that floating point registers are 32 bits wide.
8055
8056 @item -mfp64
8057 @opindex mfp64
8058 Assume that floating point registers are 64 bits wide.
8059
8060 @item -mgp32
8061 @opindex mgp32
8062 Assume that general purpose registers are 32 bits wide.
8063
8064 @item -mgp64
8065 @opindex mgp64
8066 Assume that general purpose registers are 64 bits wide.
8067
8068 @item -mint64
8069 @opindex mint64
8070 Force int and long types to be 64 bits wide.  See @option{-mlong32} for an
8071 explanation of the default, and the width of pointers.
8072
8073 @item -mlong64
8074 @opindex mlong64
8075 Force long types to be 64 bits wide.  See @option{-mlong32} for an
8076 explanation of the default, and the width of pointers.
8077
8078 @item -mlong32
8079 @opindex mlong32
8080 Force long, int, and pointer types to be 32 bits wide.
8081
8082 The default size of ints, longs and pointers depends on the ABI@.  All
8083 the supported ABIs use 32-bit ints.  The n64 ABI uses 64-bit longs, as
8084 does the 64-bit Cygnus EABI; the others use 32-bit longs.  Pointers
8085 are the same size as longs, or the same size as integer registers,
8086 whichever is smaller.
8087
8088 @item -mabi=32
8089 @itemx -mabi=o64
8090 @itemx -mabi=n32
8091 @itemx -mabi=64
8092 @itemx -mabi=eabi
8093 @itemx -mabi=meabi
8094 @opindex mabi=32
8095 @opindex mabi=o64
8096 @opindex mabi=n32
8097 @opindex mabi=64
8098 @opindex mabi=eabi
8099 @opindex mabi=meabi
8100 Generate code for the given ABI@.
8101
8102 Note that there are two embedded ABIs: @option{-mabi=eabi}
8103 selects the one defined by Cygnus while @option{-meabi=meabi}
8104 selects the one defined by MIPS@.  Both these ABIs have
8105 32-bit and 64-bit variants.  Normally, GCC will generate
8106 64-bit code when you select a 64-bit architecture, but you
8107 can use @option{-mgp32} to get 32-bit code instead.
8108
8109 @item -mabi-fake-default
8110 @opindex mabi-fake-default
8111 You don't want to know what this option does.  No, really.  I mean
8112 it.  Move on to the next option.
8113
8114 What?  You're still here?  Oh, well@enddots{}  Ok, here's the deal.  GCC
8115 wants the default set of options to get the root of the multilib tree,
8116 and the shared library SONAMEs without any multilib-indicating
8117 suffixes.  This is not convenience for @samp{mips64-linux-gnu}, since
8118 we want to default to the N32 ABI, while still being binary-compatible
8119 with @samp{mips-linux-gnu} if you stick to the O32 ABI@.  Being
8120 binary-compatible means shared libraries should have the same SONAMEs,
8121 and libraries should live in the same location.  Having O32 libraries
8122 in a sub-directory named say @file{o32} is not acceptable.
8123
8124 So we trick GCC into believing that O32 is the default ABI, except
8125 that we override the default with some internal command-line
8126 processing magic.  Problem is, if we stopped at that, and you then
8127 created a multilib-aware package that used the output of @command{gcc
8128 -print-multi-lib} to decide which multilibs to build, and how, and
8129 you'd find yourself in an awkward situation when you found out that
8130 some of the options listed ended up mapping to the same multilib, and
8131 none of your libraries was actually built for the multilib that
8132 @option{-print-multi-lib} claims to be the default.  So we added this
8133 option that disables the default switcher, falling back to GCC's
8134 original notion of the default library.  Confused yet?
8135
8136 For short: don't ever use this option, unless you find it in the list
8137 of additional options to be used when building for multilibs, in the
8138 output of @option{gcc -print-multi-lib}.
8139
8140 @item -mmips-as
8141 @opindex mmips-as
8142 Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
8143 add normal debug information.  This is the default for all
8144 platforms except for the OSF/1 reference platform, using the OSF/rose
8145 object format.  If the either of the @option{-gstabs} or @option{-gstabs+}
8146 switches are used, the @file{mips-tfile} program will encapsulate the
8147 stabs within MIPS ECOFF@.
8148
8149 @item -mgas
8150 @opindex mgas
8151 Generate code for the GNU assembler.  This is the default on the OSF/1
8152 reference platform, using the OSF/rose object format.  Also, this is
8153 the default if the configure option @option{--with-gnu-as} is used.
8154
8155 @item -msplit-addresses
8156 @itemx -mno-split-addresses
8157 @opindex msplit-addresses
8158 @opindex mno-split-addresses
8159 Generate code to load the high and low parts of address constants separately.
8160 This allows GCC to optimize away redundant loads of the high order
8161 bits of addresses.  This optimization requires GNU as and GNU ld.
8162 This optimization is enabled by default for some embedded targets where
8163 GNU as and GNU ld are standard.
8164
8165 @item -mrnames
8166 @itemx -mno-rnames
8167 @opindex mrnames
8168 @opindex mno-rnames
8169 The @option{-mrnames} switch says to output code using the MIPS software
8170 names for the registers, instead of the hardware names (ie, @var{a0}
8171 instead of @var{$4}).  The only known assembler that supports this option
8172 is the Algorithmics assembler.
8173
8174 @item -mmemcpy
8175 @itemx -mno-memcpy
8176 @opindex mmemcpy
8177 @opindex mno-memcpy
8178 The @option{-mmemcpy} switch makes all block moves call the appropriate
8179 string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
8180 generating inline code.
8181
8182 @item -mmips-tfile
8183 @itemx -mno-mips-tfile
8184 @opindex mmips-tfile
8185 @opindex mno-mips-tfile
8186 The @option{-mno-mips-tfile} switch causes the compiler not
8187 postprocess the object file with the @file{mips-tfile} program,
8188 after the MIPS assembler has generated it to add debug support.  If
8189 @file{mips-tfile} is not run, then no local variables will be
8190 available to the debugger.  In addition, @file{stage2} and
8191 @file{stage3} objects will have the temporary file names passed to the
8192 assembler embedded in the object file, which means the objects will
8193 not compare the same.  The @option{-mno-mips-tfile} switch should only
8194 be used when there are bugs in the @file{mips-tfile} program that
8195 prevents compilation.
8196
8197 @item -msoft-float
8198 @opindex msoft-float
8199 Generate output containing library calls for floating point.
8200 @strong{Warning:} the requisite libraries are not part of GCC@.
8201 Normally the facilities of the machine's usual C compiler are used, but
8202 this can't be done directly in cross-compilation.  You must make your
8203 own arrangements to provide suitable library functions for
8204 cross-compilation.
8205
8206 @item -mhard-float
8207 @opindex mhard-float
8208 Generate output containing floating point instructions.  This is the
8209 default if you use the unmodified sources.
8210
8211 @item -mabicalls
8212 @itemx -mno-abicalls
8213 @opindex mabicalls
8214 @opindex mno-abicalls
8215 Emit (or do not emit) the pseudo operations @samp{.abicalls},
8216 @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
8217 position independent code.
8218
8219 @item -mxgot
8220 @itemx -mno-xgot
8221 @opindex mxgot
8222 @opindex mno-xgot
8223 Lift (or do not lift) the usual restrictions on the size of the global
8224 offset table.
8225
8226 GCC normally uses a single instruction to load values from the GOT.
8227 While this is relatively efficient, it will only work if the GOT
8228 is smaller than about 64k.  Anything larger will cause the linker
8229 to report an error such as:
8230
8231 @cindex relocation truncated to fit (MIPS)
8232 @smallexample
8233 relocation truncated to fit: R_MIPS_GOT16 foobar
8234 @end smallexample
8235
8236 If this happens, you should recompile your code with @option{-mxgot}.
8237 It should then work with very large GOTs, although it will also be
8238 less efficient, since it will take three instructions to fetch the
8239 value of a global symbol.
8240
8241 Note that some linkers can create multiple GOTs.  If you have such a
8242 linker, you should only need to use @option{-mxgot} when a single object
8243 file accesses more than 64k's worth of GOT entries.  Very few do.
8244
8245 These options have no effect unless GCC is generating position
8246 independent code.
8247
8248 @item -mlong-calls
8249 @itemx -mno-long-calls
8250 @opindex mlong-calls
8251 @opindex mno-long-calls
8252 Do all calls with the @samp{JALR} instruction, which requires
8253 loading up a function's address into a register before the call.
8254 You need to use this switch, if you call outside of the current
8255 512 megabyte segment to functions that are not through pointers.
8256
8257 @item -membedded-pic
8258 @itemx -mno-embedded-pic
8259 @opindex membedded-pic
8260 @opindex mno-embedded-pic
8261 Generate PIC code suitable for some embedded systems.  All calls are
8262 made using PC relative address, and all data is addressed using the $gp
8263 register.  No more than 65536 bytes of global data may be used.  This
8264 requires GNU as and GNU ld which do most of the work.  This currently
8265 only works on targets which use ECOFF; it does not work with ELF@.
8266
8267 @item -membedded-data
8268 @itemx -mno-embedded-data
8269 @opindex membedded-data
8270 @opindex mno-embedded-data
8271 Allocate variables to the read-only data section first if possible, then
8272 next in the small data section if possible, otherwise in data.  This gives
8273 slightly slower code than the default, but reduces the amount of RAM required
8274 when executing, and thus may be preferred for some embedded systems.
8275
8276 @item -muninit-const-in-rodata
8277 @itemx -mno-uninit-const-in-rodata
8278 @opindex muninit-const-in-rodata
8279 @opindex mno-uninit-const-in-rodata
8280 When used together with @option{-membedded-data}, it will always store uninitialized
8281 const variables in the read-only data section.
8282
8283 @item -msingle-float
8284 @itemx -mdouble-float
8285 @opindex msingle-float
8286 @opindex mdouble-float
8287 The @option{-msingle-float} switch tells gcc to assume that the floating
8288 point coprocessor only supports single precision operations, as on the
8289 @samp{r4650} chip.  The @option{-mdouble-float} switch permits gcc to use
8290 double precision operations.  This is the default.
8291
8292 @item -mmad
8293 @itemx -mno-mad
8294 @opindex mmad
8295 @opindex mno-mad
8296 Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
8297 as on the @samp{r4650} chip.
8298
8299 @item -m4650
8300 @opindex m4650
8301 Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
8302 @option{-mcpu=r4650}.
8303
8304 @item -mips16
8305 @itemx -mno-mips16
8306 @opindex mips16
8307 @opindex mno-mips16
8308 Enable 16-bit instructions.
8309
8310 @item -mentry
8311 @opindex mentry
8312 Use the entry and exit pseudo ops.  This option can only be used with
8313 @option{-mips16}.
8314
8315 @item -EL
8316 @opindex EL
8317 Compile code for the processor in little endian mode.
8318 The requisite libraries are assumed to exist.
8319
8320 @item -EB
8321 @opindex EB
8322 Compile code for the processor in big endian mode.
8323 The requisite libraries are assumed to exist.
8324
8325 @item -G @var{num}
8326 @opindex G
8327 @cindex smaller data references (MIPS)
8328 @cindex gp-relative references (MIPS)
8329 Put global and static items less than or equal to @var{num} bytes into
8330 the small data or bss sections instead of the normal data or bss
8331 section.  This allows the assembler to emit one word memory reference
8332 instructions based on the global pointer (@var{gp} or @var{$28}),
8333 instead of the normal two words used.  By default, @var{num} is 8 when
8334 the MIPS assembler is used, and 0 when the GNU assembler is used.  The
8335 @option{-G @var{num}} switch is also passed to the assembler and linker.
8336 All modules should be compiled with the same @option{-G @var{num}}
8337 value.
8338
8339 @item -nocpp
8340 @opindex nocpp
8341 Tell the MIPS assembler to not run its preprocessor over user
8342 assembler files (with a @samp{.s} suffix) when assembling them.
8343
8344 @item -mfix7000
8345 @opindex mfix7000
8346 Pass an option to gas which will cause nops to be inserted if
8347 the read of the destination register of an mfhi or mflo instruction
8348 occurs in the following two instructions.
8349
8350 @item -mfix-sb1
8351 @itemx -mno-fix-sb1
8352 @opindex mfix-sb1
8353 Work around certain SB-1 CPU core errata.
8354 (This flag currently works around the SB-1 revision 2
8355 ``F1'' and ``F2'' floating point errata.)
8356
8357 @item -no-crt0
8358 @opindex no-crt0
8359 Do not include the default crt0.
8360
8361 @item -mflush-func=@var{func}
8362 @itemx -mno-flush-func
8363 @opindex mflush-func
8364 Specifies the function to call to flush the I and D caches, or to not
8365 call any such function.  If called, the function must take the same
8366 arguments as the common @code{_flush_func()}, that is, the address of the
8367 memory range for which the cache is being flushed, the size of the
8368 memory range, and the number 3 (to flush both caches).  The default
8369 depends on the target gcc was configured for, but commonly is either
8370 @samp{_flush_func} or @samp{__cpu_flush}.
8371
8372 @item -mbranch-likely
8373 @itemx -mno-branch-likely
8374 @opindex mbranch-likely
8375 @opindex mno-branch-likely
8376 Enable or disable use of Branch Likely instructions, regardless of the
8377 default for the selected architecture.  By default, Branch Likely
8378 instructions may be generated if they are supported by the selected
8379 architecture.  An exception is for the MIPS32 and MIPS64 architectures
8380 and processors which implement those architectures; for those, Branch
8381 Likely instructions will not be generated by default because the MIPS32
8382 and MIPS64 architectures specifically deprecate their use.
8383 @end table
8384
8385 @node i386 and x86-64 Options
8386 @subsection Intel 386 and AMD x86-64 Options
8387 @cindex i386 Options
8388 @cindex x86-64 Options
8389 @cindex Intel 386 Options
8390 @cindex AMD x86-64 Options
8391
8392 These @samp{-m} options are defined for the i386 and x86-64 family of
8393 computers:
8394
8395 @table @gcctabopt
8396 @item -mtune=@var{cpu-type}
8397 @opindex mtune
8398 Tune to @var{cpu-type} everything applicable about the generated code, except
8399 for the ABI and the set of available instructions.  The choices for
8400 @var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686},
8401 @samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2},
8402 @samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3},
8403 @samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp},
8404 @samp{athlon-mp}, @samp{winchip-c6}, @samp{winchip2}, @samp{k8}, @samp{c3}
8405 and @samp{c3-2}.
8406
8407 While picking a specific @var{cpu-type} will schedule things appropriately
8408 for that particular chip, the compiler will not generate any code that
8409 does not run on the i386 without the @option{-march=@var{cpu-type}} option
8410 being used.  @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
8411 is equivalent to @samp{pentiumpro}.  @samp{k6} and @samp{athlon} are the
8412 AMD chips as opposed to the Intel ones.
8413
8414 @item -march=@var{cpu-type}
8415 @opindex march
8416 Generate instructions for the machine type @var{cpu-type}.  The choices
8417 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8418 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8419
8420 @item -mcpu=@var{cpu-type}
8421 @opindex mcpu
8422 A deprecated synonym for @option{-mtune}.
8423
8424 @item -m386
8425 @itemx -m486
8426 @itemx -mpentium
8427 @itemx -mpentiumpro
8428 @opindex m386
8429 @opindex m486
8430 @opindex mpentium
8431 @opindex mpentiumpro
8432 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8433 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8434 These synonyms are deprecated.
8435
8436 @item -mfpmath=@var{unit}
8437 @opindex march
8438 generate floating point arithmetics for selected unit @var{unit}.  the choices
8439 for @var{unit} are:
8440
8441 @table @samp
8442 @item 387
8443 Use the standard 387 floating point coprocessor present majority of chips and
8444 emulated otherwise.  Code compiled with this option will run almost everywhere.
8445 The temporary results are computed in 80bit precision instead of precision
8446 specified by the type resulting in slightly different results compared to most
8447 of other chips. See @option{-ffloat-store} for more detailed description.
8448
8449 This is the default choice for i386 compiler.
8450
8451 @item sse
8452 Use scalar floating point instructions present in the SSE instruction set.
8453 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8454 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8455 instruction set supports only single precision arithmetics, thus the double and
8456 extended precision arithmetics is still done using 387.  Later version, present
8457 only in Pentium4 and the future AMD x86-64 chips supports double precision
8458 arithmetics too.
8459
8460 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8461 @option{-msse2} switches to enable SSE extensions and make this option
8462 effective.  For x86-64 compiler, these extensions are enabled by default.
8463
8464 The resulting code should be considerably faster in majority of cases and avoid
8465 the numerical instability problems of 387 code, but may break some existing
8466 code that expects temporaries to be 80bit.
8467
8468 This is the default choice for x86-64 compiler.
8469
8470 @item pni
8471 Use all SSE extensions enabled by @option{-msse2} as well as the new
8472 SSE extensions in Prescott New Instructions. @option{-mpni} also
8473 enables 2 builtin functions, @code{__builtin_ia32_monitor} and
8474 @code{__builtin_ia32_mwait}, for new instructions @code{monitor} and
8475 @code{mwait}. 
8476
8477 @item sse,387
8478 Attempt to utilize both instruction sets at once.  This effectively double the
8479 amount of available registers and on chips with separate execution units for
8480 387 and SSE the execution resources too.  Use this option with care, as it is
8481 still experimental, because gcc register allocator does not model separate
8482 functional units well resulting in instable performance.
8483 @end table
8484
8485 @item -masm=@var{dialect}
8486 @opindex masm=@var{dialect}
8487 Output asm instructions using selected @var{dialect}. Supported choices are
8488 @samp{intel} or @samp{att} (the default one).
8489
8490 @item -mieee-fp
8491 @itemx -mno-ieee-fp
8492 @opindex mieee-fp
8493 @opindex mno-ieee-fp
8494 Control whether or not the compiler uses IEEE floating point
8495 comparisons.  These handle correctly the case where the result of a
8496 comparison is unordered.
8497
8498 @item -msoft-float
8499 @opindex msoft-float
8500 Generate output containing library calls for floating point.
8501 @strong{Warning:} the requisite libraries are not part of GCC@.
8502 Normally the facilities of the machine's usual C compiler are used, but
8503 this can't be done directly in cross-compilation.  You must make your
8504 own arrangements to provide suitable library functions for
8505 cross-compilation.
8506
8507 On machines where a function returns floating point results in the 80387
8508 register stack, some floating point opcodes may be emitted even if
8509 @option{-msoft-float} is used.
8510
8511 @item -mno-fp-ret-in-387
8512 @opindex mno-fp-ret-in-387
8513 Do not use the FPU registers for return values of functions.
8514
8515 The usual calling convention has functions return values of types
8516 @code{float} and @code{double} in an FPU register, even if there
8517 is no FPU@.  The idea is that the operating system should emulate
8518 an FPU@.
8519
8520 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8521 in ordinary CPU registers instead.
8522
8523 @item -mno-fancy-math-387
8524 @opindex mno-fancy-math-387
8525 Some 387 emulators do not support the @code{sin}, @code{cos} and
8526 @code{sqrt} instructions for the 387.  Specify this option to avoid
8527 generating those instructions.  This option is the default on FreeBSD,
8528 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8529 indicates that the target cpu will always have an FPU and so the
8530 instruction will not need emulation.  As of revision 2.6.1, these
8531 instructions are not generated unless you also use the
8532 @option{-funsafe-math-optimizations} switch.
8533
8534 @item -malign-double
8535 @itemx -mno-align-double
8536 @opindex malign-double
8537 @opindex mno-align-double
8538 Control whether GCC aligns @code{double}, @code{long double}, and
8539 @code{long long} variables on a two word boundary or a one word
8540 boundary.  Aligning @code{double} variables on a two word boundary will
8541 produce code that runs somewhat faster on a @samp{Pentium} at the
8542 expense of more memory.
8543
8544 @strong{Warning:} if you use the @option{-malign-double} switch,
8545 structures containing the above types will be aligned differently than
8546 the published application binary interface specifications for the 386
8547 and will not be binary compatible with structures in code compiled
8548 without that switch.
8549
8550 @item -m96bit-long-double
8551 @item -m128bit-long-double
8552 @opindex m96bit-long-double
8553 @opindex m128bit-long-double
8554 These switches control the size of @code{long double} type. The i386 
8555 application binary interface specifies the size to be 96 bits, 
8556 so @option{-m96bit-long-double} is the default in 32 bit mode.
8557
8558 Modern architectures (Pentium and newer) would prefer @code{long double}
8559 to be aligned to an 8 or 16 byte boundary.  In arrays or structures 
8560 conforming to the ABI, this would not be possible.  So specifying a 
8561 @option{-m128bit-long-double} will align @code{long double}
8562 to a 16 byte boundary by padding the @code{long double} with an additional
8563 32 bit zero. 
8564
8565 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8566 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
8567  
8568 Notice that neither of these options enable any extra precision over the x87
8569 standard of 80 bits for a @code{long double}. 
8570
8571 @strong{Warning:} if you override the default value for your target ABI, the
8572 structures and arrays containing @code{long double} will change their size as
8573 well as function calling convention for function taking @code{long double}
8574 will be modified.  Hence they will not be binary compatible with arrays or
8575 structures in code compiled without that switch.
8576
8577
8578 @item -msvr3-shlib
8579 @itemx -mno-svr3-shlib
8580 @opindex msvr3-shlib
8581 @opindex mno-svr3-shlib
8582 Control whether GCC places uninitialized local variables into the
8583 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
8584 into @code{bss}.  These options are meaningful only on System V Release 3.
8585
8586 @item -mrtd
8587 @opindex mrtd
8588 Use a different function-calling convention, in which functions that
8589 take a fixed number of arguments return with the @code{ret} @var{num}
8590 instruction, which pops their arguments while returning.  This saves one
8591 instruction in the caller since there is no need to pop the arguments
8592 there.
8593
8594 You can specify that an individual function is called with this calling
8595 sequence with the function attribute @samp{stdcall}.  You can also
8596 override the @option{-mrtd} option by using the function attribute
8597 @samp{cdecl}.  @xref{Function Attributes}.
8598
8599 @strong{Warning:} this calling convention is incompatible with the one
8600 normally used on Unix, so you cannot use it if you need to call
8601 libraries compiled with the Unix compiler.
8602
8603 Also, you must provide function prototypes for all functions that
8604 take variable numbers of arguments (including @code{printf});
8605 otherwise incorrect code will be generated for calls to those
8606 functions.
8607
8608 In addition, seriously incorrect code will result if you call a
8609 function with too many arguments.  (Normally, extra arguments are
8610 harmlessly ignored.)
8611
8612 @item -mregparm=@var{num}
8613 @opindex mregparm
8614 Control how many registers are used to pass integer arguments.  By
8615 default, no registers are used to pass arguments, and at most 3
8616 registers can be used.  You can control this behavior for a specific
8617 function by using the function attribute @samp{regparm}.
8618 @xref{Function Attributes}.
8619
8620 @strong{Warning:} if you use this switch, and
8621 @var{num} is nonzero, then you must build all modules with the same
8622 value, including any libraries.  This includes the system libraries and
8623 startup modules.
8624
8625 @item -mpreferred-stack-boundary=@var{num}
8626 @opindex mpreferred-stack-boundary
8627 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8628 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
8629 the default is 4 (16 bytes or 128 bits), except when optimizing for code
8630 size (@option{-Os}), in which case the default is the minimum correct
8631 alignment (4 bytes for x86, and 8 bytes for x86-64).
8632
8633 On Pentium and PentiumPro, @code{double} and @code{long double} values
8634 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8635 suffer significant run time performance penalties.  On Pentium III, the
8636 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8637 penalties if it is not 16 byte aligned.
8638
8639 To ensure proper alignment of this values on the stack, the stack boundary
8640 must be as aligned as that required by any value stored on the stack.
8641 Further, every function must be generated such that it keeps the stack
8642 aligned.  Thus calling a function compiled with a higher preferred
8643 stack boundary from a function compiled with a lower preferred stack
8644 boundary will most likely misalign the stack.  It is recommended that
8645 libraries that use callbacks always use the default setting.
8646
8647 This extra alignment does consume extra stack space, and generally
8648 increases code size.  Code that is sensitive to stack space usage, such
8649 as embedded systems and operating system kernels, may want to reduce the
8650 preferred alignment to @option{-mpreferred-stack-boundary=2}.
8651
8652 @item -mmmx
8653 @itemx -mno-mmx
8654 @item -msse
8655 @itemx -mno-sse
8656 @item -msse2
8657 @itemx -mno-sse2
8658 @item -mpni
8659 @itemx -mno-pni
8660 @item -m3dnow
8661 @itemx -mno-3dnow
8662 @opindex mmmx
8663 @opindex mno-mmx
8664 @opindex msse
8665 @opindex mno-sse
8666 @opindex m3dnow
8667 @opindex mno-3dnow
8668 These switches enable or disable the use of built-in functions that allow
8669 direct access to the MMX, SSE and 3Dnow extensions of the instruction set.
8670
8671 @xref{X86 Built-in Functions}, for details of the functions enabled
8672 and disabled by these switches.
8673
8674 To have SSE/SSE2 instructions generated automatically from floating-point
8675 code, see @option{-mfpmath=sse}.
8676
8677 @item -mpush-args
8678 @itemx -mno-push-args
8679 @opindex mpush-args
8680 @opindex mno-push-args
8681 Use PUSH operations to store outgoing parameters.  This method is shorter
8682 and usually equally fast as method using SUB/MOV operations and is enabled
8683 by default.  In some cases disabling it may improve performance because of
8684 improved scheduling and reduced dependencies.
8685
8686 @item -maccumulate-outgoing-args
8687 @opindex maccumulate-outgoing-args
8688 If enabled, the maximum amount of space required for outgoing arguments will be
8689 computed in the function prologue.  This is faster on most modern CPUs
8690 because of reduced dependencies, improved scheduling and reduced stack usage
8691 when preferred stack boundary is not equal to 2.  The drawback is a notable
8692 increase in code size.  This switch implies @option{-mno-push-args}.
8693
8694 @item -mthreads
8695 @opindex mthreads
8696 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8697 on thread-safe exception handling must compile and link all code with the
8698 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
8699 @option{-D_MT}; when linking, it links in a special thread helper library
8700 @option{-lmingwthrd} which cleans up per thread exception handling data.
8701
8702 @item -mno-align-stringops
8703 @opindex mno-align-stringops
8704 Do not align destination of inlined string operations.  This switch reduces
8705 code size and improves performance in case the destination is already aligned,
8706 but gcc don't know about it.
8707
8708 @item -minline-all-stringops
8709 @opindex minline-all-stringops
8710 By default GCC inlines string operations only when destination is known to be
8711 aligned at least to 4 byte boundary.  This enables more inlining, increase code
8712 size, but may improve performance of code that depends on fast memcpy, strlen
8713 and memset for short lengths.
8714
8715 @item -momit-leaf-frame-pointer
8716 @opindex momit-leaf-frame-pointer
8717 Don't keep the frame pointer in a register for leaf functions.  This
8718 avoids the instructions to save, set up and restore frame pointers and
8719 makes an extra register available in leaf functions.  The option
8720 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8721 which might make debugging harder.
8722
8723 @item -mtls-direct-seg-refs
8724 @itemx -mno-tls-direct-seg-refs
8725 @opindex mtls-direct-seg-refs
8726 Controls whether TLS variables may be accessed with offsets from the
8727 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8728 or whether the thread base pointer must be added.  Whether or not this
8729 is legal depends on the operating system, and whether it maps the
8730 segment to cover the entire TLS area.
8731
8732 For systems that use GNU libc, the default is on.
8733 @end table
8734
8735 These @samp{-m} switches are supported in addition to the above
8736 on AMD x86-64 processors in 64-bit environments.
8737
8738 @table @gcctabopt
8739 @item -m32
8740 @itemx -m64
8741 @opindex m32
8742 @opindex m64
8743 Generate code for a 32-bit or 64-bit environment.
8744 The 32-bit environment sets int, long and pointer to 32 bits and
8745 generates code that runs on any i386 system.
8746 The 64-bit environment sets int to 32 bits and long and pointer
8747 to 64 bits and generates code for AMD's x86-64 architecture.
8748
8749 @item -mno-red-zone
8750 @opindex no-red-zone
8751 Do not use a so called red zone for x86-64 code.  The red zone is mandated
8752 by the x86-64 ABI, it is a 128-byte area beyond the location of the
8753 stack pointer that will not be modified by signal or interrupt handlers
8754 and therefore can be used for temporary data without adjusting the stack
8755 pointer.  The flag @option{-mno-red-zone} disables this red zone.
8756
8757 @item -mcmodel=small
8758 @opindex mcmodel=small
8759 Generate code for the small code model: the program and its symbols must
8760 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8761 Programs can be statically or dynamically linked.  This is the default
8762 code model.
8763
8764 @item -mcmodel=kernel
8765 @opindex mcmodel=kernel
8766 Generate code for the kernel code model.  The kernel runs in the
8767 negative 2 GB of the address space.
8768 This model has to be used for Linux kernel code.
8769
8770 @item -mcmodel=medium
8771 @opindex mcmodel=medium
8772 Generate code for the medium model: The program is linked in the lower 2
8773 GB of the address space but symbols can be located anywhere in the
8774 address space.  Programs can be statically or dynamically linked, but
8775 building of shared libraries are not supported with the medium model.
8776
8777 @item -mcmodel=large
8778 @opindex mcmodel=large
8779 Generate code for the large model: This model makes no assumptions
8780 about addresses and sizes of sections.  Currently GCC does not implement
8781 this model.
8782 @end table
8783
8784 @node HPPA Options
8785 @subsection HPPA Options
8786 @cindex HPPA Options
8787
8788 These @samp{-m} options are defined for the HPPA family of computers:
8789
8790 @table @gcctabopt
8791 @item -march=@var{architecture-type}
8792 @opindex march
8793 Generate code for the specified architecture.  The choices for
8794 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8795 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8796 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8797 architecture option for your machine.  Code compiled for lower numbered
8798 architectures will run on higher numbered architectures, but not the
8799 other way around.
8800
8801 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
8802 next release of binutils (current is 2.9.1) will probably contain PA 2.0
8803 support.
8804
8805 @item -mpa-risc-1-0
8806 @itemx -mpa-risc-1-1
8807 @itemx -mpa-risc-2-0
8808 @opindex mpa-risc-1-0
8809 @opindex mpa-risc-1-1
8810 @opindex mpa-risc-2-0
8811 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8812
8813 @item -mbig-switch
8814 @opindex mbig-switch
8815 Generate code suitable for big switch tables.  Use this option only if
8816 the assembler/linker complain about out of range branches within a switch
8817 table.
8818
8819 @item -mjump-in-delay
8820 @opindex mjump-in-delay
8821 Fill delay slots of function calls with unconditional jump instructions
8822 by modifying the return pointer for the function call to be the target
8823 of the conditional jump.
8824
8825 @item -mdisable-fpregs
8826 @opindex mdisable-fpregs
8827 Prevent floating point registers from being used in any manner.  This is
8828 necessary for compiling kernels which perform lazy context switching of
8829 floating point registers.  If you use this option and attempt to perform
8830 floating point operations, the compiler will abort.
8831
8832 @item -mdisable-indexing
8833 @opindex mdisable-indexing
8834 Prevent the compiler from using indexing address modes.  This avoids some
8835 rather obscure problems when compiling MIG generated code under MACH@.
8836
8837 @item -mno-space-regs
8838 @opindex mno-space-regs
8839 Generate code that assumes the target has no space registers.  This allows
8840 GCC to generate faster indirect calls and use unscaled index address modes.
8841
8842 Such code is suitable for level 0 PA systems and kernels.
8843
8844 @item -mfast-indirect-calls
8845 @opindex mfast-indirect-calls
8846 Generate code that assumes calls never cross space boundaries.  This
8847 allows GCC to emit code which performs faster indirect calls.
8848
8849 This option will not work in the presence of shared libraries or nested
8850 functions.
8851
8852 @item -mlong-load-store
8853 @opindex mlong-load-store
8854 Generate 3-instruction load and store sequences as sometimes required by
8855 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8856 the HP compilers.
8857
8858 @item -mportable-runtime
8859 @opindex mportable-runtime
8860 Use the portable calling conventions proposed by HP for ELF systems.
8861
8862 @item -mgas
8863 @opindex mgas
8864 Enable the use of assembler directives only GAS understands.
8865
8866 @item -mschedule=@var{cpu-type}
8867 @opindex mschedule
8868 Schedule code according to the constraints for the machine type
8869 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8870 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8871 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8872 proper scheduling option for your machine.  The default scheduling is
8873 @samp{8000}.
8874
8875 @item -mlinker-opt
8876 @opindex mlinker-opt
8877 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8878 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8879 linkers in which they give bogus error messages when linking some programs.
8880
8881 @item -msoft-float
8882 @opindex msoft-float
8883 Generate output containing library calls for floating point.
8884 @strong{Warning:} the requisite libraries are not available for all HPPA
8885 targets.  Normally the facilities of the machine's usual C compiler are
8886 used, but this cannot be done directly in cross-compilation.  You must make
8887 your own arrangements to provide suitable library functions for
8888 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8889 does provide software floating point support.
8890
8891 @option{-msoft-float} changes the calling convention in the output file;
8892 therefore, it is only useful if you compile @emph{all} of a program with
8893 this option.  In particular, you need to compile @file{libgcc.a}, the
8894 library that comes with GCC, with @option{-msoft-float} in order for
8895 this to work.
8896
8897 @item -msio
8898 @opindex msio
8899 Generate the predefine, @code{_SIO}, for server IO.  The default is
8900 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8901 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8902 options are available under HP-UX and HI-UX.
8903
8904 @item -mgnu-ld
8905 @opindex gnu-ld
8906 Use GNU ld specific options.  This passes @option{-shared} to ld when
8907 building a shared library.  It is the default when GCC is configured,
8908 explicitly or implicitly, with the GNU linker.  This option does not
8909 have any affect on which ld is called, it only changes what parameters
8910 are passed to that ld.  The ld that is called is determined by the
8911 @option{--with-ld} configure option, gcc's program search path, and
8912 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8913 using @samp{which `gcc -print-prog-name=ld`}.
8914
8915 @item -mhp-ld
8916 @opindex hp-ld
8917 Use HP ld specific options.  This passes @option{-b} to ld when building
8918 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8919 links.  It is the default when GCC is configured, explicitly or
8920 implicitly, with the HP linker.  This option does not have any affect on
8921 which ld is called, it only changes what parameters are passed to that
8922 ld.  The ld that is called is determined by the @option{--with-ld}
8923 configure option, gcc's program search path, and finally by the user's
8924 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8925 `gcc -print-prog-name=ld`}.
8926
8927 @item -mlong-calls
8928 @opindex mno-long-calls
8929 Generate code that uses long call sequences.  This ensures that a call
8930 is always able to reach linker generated stubs.  The default is to generate
8931 long calls only when the distance from the call site to the beginning
8932 of the function or translation unit, as the case may be, exceeds a
8933 predefined limit set by the branch type being used.  The limits for
8934 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8935 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8936 240,000 bytes.
8937
8938 Distances are measured from the beginning of functions when using the
8939 @option{-ffunction-sections} option, or when using the @option{-mgas}
8940 and @option{-mno-portable-runtime} options together under HP-UX with
8941 the SOM linker.
8942
8943 It is normally not desirable to use this option as it will degrade
8944 performance.  However, it may be useful in large applications,
8945 particularly when partial linking is used to build the application.
8946
8947 The types of long calls used depends on the capabilities of the
8948 assembler and linker, and the type of code being generated.  The
8949 impact on systems that support long absolute calls, and long pic
8950 symbol-difference or pc-relative calls should be relatively small.
8951 However, an indirect call is used on 32-bit ELF systems in pic code
8952 and it is quite long.
8953
8954 @item -nolibdld
8955 @opindex nolibdld
8956 Suppress the generation of link options to search libdld.sl when the
8957 @option{-static} option is specified on HP-UX 10 and later.
8958
8959 @item -static
8960 @opindex static
8961 The HP-UX implementation of setlocale in libc has a dependency on
8962 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8963 when the @option{-static} option is specified, special link options
8964 are needed to resolve this dependency.
8965
8966 On HP-UX 10 and later, the GCC driver adds the necessary options to
8967 link with libdld.sl when the @option{-static} option is specified.
8968 This causes the resulting binary to be dynamic.  On the 64-bit port,
8969 the linkers generate dynamic binaries by default in any case.  The
8970 @option{-nolibdld} option can be used to prevent the GCC driver from
8971 adding these link options.
8972
8973 @item -threads
8974 @opindex threads
8975 Add support for multithreading with the @dfn{dce thread} library
8976 under HP-UX.  This option sets flags for both the preprocessor and
8977 linker.
8978 @end table
8979
8980 @node Intel 960 Options
8981 @subsection Intel 960 Options
8982
8983 These @samp{-m} options are defined for the Intel 960 implementations:
8984
8985 @table @gcctabopt
8986 @item -m@var{cpu-type}
8987 @opindex mka
8988 @opindex mkb
8989 @opindex mmc
8990 @opindex mca
8991 @opindex mcf
8992 @opindex msa
8993 @opindex msb
8994 Assume the defaults for the machine type @var{cpu-type} for some of
8995 the other options, including instruction scheduling, floating point
8996 support, and addressing modes.  The choices for @var{cpu-type} are
8997 @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
8998 @samp{sa}, and @samp{sb}.
8999 The default is
9000 @samp{kb}.
9001
9002 @item -mnumerics
9003 @itemx -msoft-float
9004 @opindex mnumerics
9005 @opindex msoft-float
9006 The @option{-mnumerics} option indicates that the processor does support
9007 floating-point instructions.  The @option{-msoft-float} option indicates
9008 that floating-point support should not be assumed.
9009
9010 @item -mleaf-procedures
9011 @itemx -mno-leaf-procedures
9012 @opindex mleaf-procedures
9013 @opindex mno-leaf-procedures
9014 Do (or do not) attempt to alter leaf procedures to be callable with the
9015 @code{bal} instruction as well as @code{call}.  This will result in more
9016 efficient code for explicit calls when the @code{bal} instruction can be
9017 substituted by the assembler or linker, but less efficient code in other
9018 cases, such as calls via function pointers, or using a linker that doesn't
9019 support this optimization.
9020
9021 @item -mtail-call
9022 @itemx -mno-tail-call
9023 @opindex mtail-call
9024 @opindex mno-tail-call
9025 Do (or do not) make additional attempts (beyond those of the
9026 machine-independent portions of the compiler) to optimize tail-recursive
9027 calls into branches.  You may not want to do this because the detection of
9028 cases where this is not valid is not totally complete.  The default is
9029 @option{-mno-tail-call}.
9030
9031 @item -mcomplex-addr
9032 @itemx -mno-complex-addr
9033 @opindex mcomplex-addr
9034 @opindex mno-complex-addr
9035 Assume (or do not assume) that the use of a complex addressing mode is a
9036 win on this implementation of the i960.  Complex addressing modes may not
9037 be worthwhile on the K-series, but they definitely are on the C-series.
9038 The default is currently @option{-mcomplex-addr} for all processors except
9039 the CB and CC@.
9040
9041 @item -mcode-align
9042 @itemx -mno-code-align
9043 @opindex mcode-align
9044 @opindex mno-code-align
9045 Align code to 8-byte boundaries for faster fetching (or don't bother).
9046 Currently turned on by default for C-series implementations only.
9047
9048 @ignore
9049 @item -mclean-linkage
9050 @itemx -mno-clean-linkage
9051 @opindex mclean-linkage
9052 @opindex mno-clean-linkage
9053 These options are not fully implemented.
9054 @end ignore
9055
9056 @item -mic-compat
9057 @itemx -mic2.0-compat
9058 @itemx -mic3.0-compat
9059 @opindex mic-compat
9060 @opindex mic2.0-compat
9061 @opindex mic3.0-compat
9062 Enable compatibility with iC960 v2.0 or v3.0.
9063
9064 @item -masm-compat
9065 @itemx -mintel-asm
9066 @opindex masm-compat
9067 @opindex mintel-asm
9068 Enable compatibility with the iC960 assembler.
9069
9070 @item -mstrict-align
9071 @itemx -mno-strict-align
9072 @opindex mstrict-align
9073 @opindex mno-strict-align
9074 Do not permit (do permit) unaligned accesses.
9075
9076 @item -mold-align
9077 @opindex mold-align
9078 Enable structure-alignment compatibility with Intel's gcc release version
9079 1.3 (based on gcc 1.37).  This option implies @option{-mstrict-align}.
9080
9081 @item -mlong-double-64
9082 @opindex mlong-double-64
9083 Implement type @samp{long double} as 64-bit floating point numbers.
9084 Without the option @samp{long double} is implemented by 80-bit
9085 floating point numbers.  The only reason we have it because there is
9086 no 128-bit @samp{long double} support in @samp{fp-bit.c} yet.  So it
9087 is only useful for people using soft-float targets.  Otherwise, we
9088 should recommend against use of it.
9089
9090 @end table
9091
9092 @node DEC Alpha Options
9093 @subsection DEC Alpha Options
9094
9095 These @samp{-m} options are defined for the DEC Alpha implementations:
9096
9097 @table @gcctabopt
9098 @item -mno-soft-float
9099 @itemx -msoft-float
9100 @opindex mno-soft-float
9101 @opindex msoft-float
9102 Use (do not use) the hardware floating-point instructions for
9103 floating-point operations.  When @option{-msoft-float} is specified,
9104 functions in @file{libgcc.a} will be used to perform floating-point
9105 operations.  Unless they are replaced by routines that emulate the
9106 floating-point operations, or compiled in such a way as to call such
9107 emulations routines, these routines will issue floating-point
9108 operations.   If you are compiling for an Alpha without floating-point
9109 operations, you must ensure that the library is built so as not to call
9110 them.
9111
9112 Note that Alpha implementations without floating-point operations are
9113 required to have floating-point registers.
9114
9115 @item -mfp-reg
9116 @itemx -mno-fp-regs
9117 @opindex mfp-reg
9118 @opindex mno-fp-regs
9119 Generate code that uses (does not use) the floating-point register set.
9120 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
9121 register set is not used, floating point operands are passed in integer
9122 registers as if they were integers and floating-point results are passed
9123 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
9124 so any function with a floating-point argument or return value called by code
9125 compiled with @option{-mno-fp-regs} must also be compiled with that
9126 option.
9127
9128 A typical use of this option is building a kernel that does not use,
9129 and hence need not save and restore, any floating-point registers.
9130
9131 @item -mieee
9132 @opindex mieee
9133 The Alpha architecture implements floating-point hardware optimized for
9134 maximum performance.  It is mostly compliant with the IEEE floating
9135 point standard.  However, for full compliance, software assistance is
9136 required.  This option generates code fully IEEE compliant code
9137 @emph{except} that the @var{inexact-flag} is not maintained (see below).
9138 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
9139 defined during compilation.  The resulting code is less efficient but is
9140 able to correctly support denormalized numbers and exceptional IEEE
9141 values such as not-a-number and plus/minus infinity.  Other Alpha
9142 compilers call this option @option{-ieee_with_no_inexact}.
9143
9144 @item -mieee-with-inexact
9145 @opindex mieee-with-inexact
9146 This is like @option{-mieee} except the generated code also maintains
9147 the IEEE @var{inexact-flag}.  Turning on this option causes the
9148 generated code to implement fully-compliant IEEE math.  In addition to
9149 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
9150 macro.  On some Alpha implementations the resulting code may execute
9151 significantly slower than the code generated by default.  Since there is
9152 very little code that depends on the @var{inexact-flag}, you should
9153 normally not specify this option.  Other Alpha compilers call this
9154 option @option{-ieee_with_inexact}.
9155
9156 @item -mfp-trap-mode=@var{trap-mode}
9157 @opindex mfp-trap-mode
9158 This option controls what floating-point related traps are enabled.
9159 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
9160 The trap mode can be set to one of four values:
9161
9162 @table @samp
9163 @item n
9164 This is the default (normal) setting.  The only traps that are enabled
9165 are the ones that cannot be disabled in software (e.g., division by zero
9166 trap).
9167
9168 @item u
9169 In addition to the traps enabled by @samp{n}, underflow traps are enabled
9170 as well.
9171
9172 @item su
9173 Like @samp{su}, but the instructions are marked to be safe for software
9174 completion (see Alpha architecture manual for details).
9175
9176 @item sui
9177 Like @samp{su}, but inexact traps are enabled as well.
9178 @end table
9179
9180 @item -mfp-rounding-mode=@var{rounding-mode}
9181 @opindex mfp-rounding-mode
9182 Selects the IEEE rounding mode.  Other Alpha compilers call this option
9183 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
9184 of:
9185
9186 @table @samp
9187 @item n
9188 Normal IEEE rounding mode.  Floating point numbers are rounded towards
9189 the nearest machine number or towards the even machine number in case
9190 of a tie.
9191
9192 @item m
9193 Round towards minus infinity.
9194
9195 @item c
9196 Chopped rounding mode.  Floating point numbers are rounded towards zero.
9197
9198 @item d
9199 Dynamic rounding mode.  A field in the floating point control register
9200 (@var{fpcr}, see Alpha architecture reference manual) controls the
9201 rounding mode in effect.  The C library initializes this register for
9202 rounding towards plus infinity.  Thus, unless your program modifies the
9203 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
9204 @end table
9205
9206 @item -mtrap-precision=@var{trap-precision}
9207 @opindex mtrap-precision
9208 In the Alpha architecture, floating point traps are imprecise.  This
9209 means without software assistance it is impossible to recover from a
9210 floating trap and program execution normally needs to be terminated.
9211 GCC can generate code that can assist operating system trap handlers
9212 in determining the exact location that caused a floating point trap.
9213 Depending on the requirements of an application, different levels of
9214 precisions can be selected:
9215
9216 @table @samp
9217 @item p
9218 Program precision.  This option is the default and means a trap handler
9219 can only identify which program caused a floating point exception.
9220
9221 @item f
9222 Function precision.  The trap handler can determine the function that
9223 caused a floating point exception.
9224
9225 @item i
9226 Instruction precision.  The trap handler can determine the exact
9227 instruction that caused a floating point exception.
9228 @end table
9229
9230 Other Alpha compilers provide the equivalent options called
9231 @option{-scope_safe} and @option{-resumption_safe}.
9232
9233 @item -mieee-conformant
9234 @opindex mieee-conformant
9235 This option marks the generated code as IEEE conformant.  You must not
9236 use this option unless you also specify @option{-mtrap-precision=i} and either
9237 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
9238 is to emit the line @samp{.eflag 48} in the function prologue of the
9239 generated assembly file.  Under DEC Unix, this has the effect that
9240 IEEE-conformant math library routines will be linked in.
9241
9242 @item -mbuild-constants
9243 @opindex mbuild-constants
9244 Normally GCC examines a 32- or 64-bit integer constant to
9245 see if it can construct it from smaller constants in two or three
9246 instructions.  If it cannot, it will output the constant as a literal and
9247 generate code to load it from the data segment at runtime.
9248
9249 Use this option to require GCC to construct @emph{all} integer constants
9250 using code, even if it takes more instructions (the maximum is six).
9251
9252 You would typically use this option to build a shared library dynamic
9253 loader.  Itself a shared library, it must relocate itself in memory
9254 before it can find the variables and constants in its own data segment.
9255
9256 @item -malpha-as
9257 @itemx -mgas
9258 @opindex malpha-as
9259 @opindex mgas
9260 Select whether to generate code to be assembled by the vendor-supplied
9261 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
9262
9263 @item -mbwx
9264 @itemx -mno-bwx
9265 @itemx -mcix
9266 @itemx -mno-cix
9267 @itemx -mfix
9268 @itemx -mno-fix
9269 @itemx -mmax
9270 @itemx -mno-max
9271 @opindex mbwx
9272 @opindex mno-bwx
9273 @opindex mcix
9274 @opindex mno-cix
9275 @opindex mfix
9276 @opindex mno-fix
9277 @opindex mmax
9278 @opindex mno-max
9279 Indicate whether GCC should generate code to use the optional BWX,
9280 CIX, FIX and MAX instruction sets.  The default is to use the instruction
9281 sets supported by the CPU type specified via @option{-mcpu=} option or that
9282 of the CPU on which GCC was built if none was specified.
9283
9284 @item -mfloat-vax
9285 @itemx -mfloat-ieee
9286 @opindex mfloat-vax
9287 @opindex mfloat-ieee
9288 Generate code that uses (does not use) VAX F and G floating point
9289 arithmetic instead of IEEE single and double precision.
9290
9291 @item -mexplicit-relocs
9292 @itemx -mno-explicit-relocs
9293 @opindex mexplicit-relocs
9294 @opindex mno-explicit-relocs
9295 Older Alpha assemblers provided no way to generate symbol relocations
9296 except via assembler macros.  Use of these macros does not allow
9297 optimal instruction scheduling.  GNU binutils as of version 2.12
9298 supports a new syntax that allows the compiler to explicitly mark
9299 which relocations should apply to which instructions.  This option
9300 is mostly useful for debugging, as GCC detects the capabilities of
9301 the assembler when it is built and sets the default accordingly.
9302
9303 @item -msmall-data
9304 @itemx -mlarge-data
9305 @opindex msmall-data
9306 @opindex mlarge-data
9307 When @option{-mexplicit-relocs} is in effect, static data is
9308 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
9309 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
9310 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
9311 16-bit relocations off of the @code{$gp} register.  This limits the
9312 size of the small data area to 64KB, but allows the variables to be
9313 directly accessed via a single instruction.
9314
9315 The default is @option{-mlarge-data}.  With this option the data area
9316 is limited to just below 2GB.  Programs that require more than 2GB of
9317 data must use @code{malloc} or @code{mmap} to allocate the data in the
9318 heap instead of in the program's data segment.
9319
9320 When generating code for shared libraries, @option{-fpic} implies
9321 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
9322
9323 @item -msmall-text
9324 @itemx -mlarge-text
9325 @opindex msmall-text
9326 @opindex mlarge-text
9327 When @option{-msmall-text} is used, the compiler assumes that the
9328 code of the entire program (or shared library) fits in 4MB, and is
9329 thus reachable with a branch instruction.  When @option{-msmall-data}
9330 is used, the compiler can assume that all local symbols share the
9331 same @code{$gp} value, and thus reduce the number of instructions
9332 required for a function call from 4 to 1.
9333
9334 The default is @option{-mlarge-text}.
9335
9336 @item -mcpu=@var{cpu_type}
9337 @opindex mcpu
9338 Set the instruction set and instruction scheduling parameters for
9339 machine type @var{cpu_type}.  You can specify either the @samp{EV}
9340 style name or the corresponding chip number.  GCC supports scheduling
9341 parameters for the EV4, EV5 and EV6 family of processors and will
9342 choose the default values for the instruction set from the processor
9343 you specify.  If you do not specify a processor type, GCC will default
9344 to the processor on which the compiler was built.
9345
9346 Supported values for @var{cpu_type} are
9347
9348 @table @samp
9349 @item ev4
9350 @item ev45
9351 @itemx 21064
9352 Schedules as an EV4 and has no instruction set extensions.
9353
9354 @item ev5
9355 @itemx 21164
9356 Schedules as an EV5 and has no instruction set extensions.
9357
9358 @item ev56
9359 @itemx 21164a
9360 Schedules as an EV5 and supports the BWX extension.
9361
9362 @item pca56
9363 @itemx 21164pc
9364 @itemx 21164PC
9365 Schedules as an EV5 and supports the BWX and MAX extensions.
9366
9367 @item ev6
9368 @itemx 21264
9369 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
9370
9371 @item ev67
9372 @item 21264a
9373 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
9374 @end table
9375
9376 @item -mtune=@var{cpu_type}
9377 @opindex mtune
9378 Set only the instruction scheduling parameters for machine type
9379 @var{cpu_type}.  The instruction set is not changed.
9380
9381 @item -mmemory-latency=@var{time}
9382 @opindex mmemory-latency
9383 Sets the latency the scheduler should assume for typical memory
9384 references as seen by the application.  This number is highly
9385 dependent on the memory access patterns used by the application
9386 and the size of the external cache on the machine.
9387
9388 Valid options for @var{time} are
9389
9390 @table @samp
9391 @item @var{number}
9392 A decimal number representing clock cycles.
9393
9394 @item L1
9395 @itemx L2
9396 @itemx L3
9397 @itemx main
9398 The compiler contains estimates of the number of clock cycles for
9399 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9400 (also called Dcache, Scache, and Bcache), as well as to main memory.
9401 Note that L3 is only valid for EV5.
9402
9403 @end table
9404 @end table
9405
9406 @node DEC Alpha/VMS Options
9407 @subsection DEC Alpha/VMS Options
9408
9409 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9410
9411 @table @gcctabopt
9412 @item -mvms-return-codes
9413 @opindex mvms-return-codes
9414 Return VMS condition codes from main.  The default is to return POSIX
9415 style condition (e.g.@ error) codes.
9416 @end table
9417
9418 @node H8/300 Options
9419 @subsection H8/300 Options
9420
9421 These @samp{-m} options are defined for the H8/300 implementations:
9422
9423 @table @gcctabopt
9424 @item -mrelax
9425 @opindex mrelax
9426 Shorten some address references at link time, when possible; uses the
9427 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
9428 ld.info, Using ld}, for a fuller description.
9429
9430 @item -mh
9431 @opindex mh
9432 Generate code for the H8/300H@.
9433
9434 @item -ms
9435 @opindex ms
9436 Generate code for the H8S@.
9437
9438 @item -mn
9439 @opindex mn
9440 Generate code for the H8S and H8/300H in the normal mode.  This switch
9441 must be used either with -mh or -ms.
9442
9443 @item -ms2600
9444 @opindex ms2600
9445 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
9446
9447 @item -mint32
9448 @opindex mint32
9449 Make @code{int} data 32 bits by default.
9450
9451 @item -malign-300
9452 @opindex malign-300
9453 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9454 The default for the H8/300H and H8S is to align longs and floats on 4
9455 byte boundaries.
9456 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9457 This option has no effect on the H8/300.
9458 @end table
9459
9460 @node SH Options
9461 @subsection SH Options
9462
9463 These @samp{-m} options are defined for the SH implementations:
9464
9465 @table @gcctabopt
9466 @item -m1
9467 @opindex m1
9468 Generate code for the SH1.
9469
9470 @item -m2
9471 @opindex m2
9472 Generate code for the SH2.
9473
9474 @item -m2e
9475 Generate code for the SH2e.
9476
9477 @item -m3
9478 @opindex m3
9479 Generate code for the SH3.
9480
9481 @item -m3e
9482 @opindex m3e
9483 Generate code for the SH3e.
9484
9485 @item -m4-nofpu
9486 @opindex m4-nofpu
9487 Generate code for the SH4 without a floating-point unit.
9488
9489 @item -m4-single-only
9490 @opindex m4-single-only
9491 Generate code for the SH4 with a floating-point unit that only
9492 supports single-precision arithmetic.
9493
9494 @item -m4-single
9495 @opindex m4-single
9496 Generate code for the SH4 assuming the floating-point unit is in
9497 single-precision mode by default.
9498
9499 @item -m4
9500 @opindex m4
9501 Generate code for the SH4.
9502
9503 @item -mb
9504 @opindex mb
9505 Compile code for the processor in big endian mode.
9506
9507 @item -ml
9508 @opindex ml
9509 Compile code for the processor in little endian mode.
9510
9511 @item -mdalign
9512 @opindex mdalign
9513 Align doubles at 64-bit boundaries.  Note that this changes the calling
9514 conventions, and thus some functions from the standard C library will
9515 not work unless you recompile it first with @option{-mdalign}.
9516
9517 @item -mrelax
9518 @opindex mrelax
9519 Shorten some address references at link time, when possible; uses the
9520 linker option @option{-relax}.
9521
9522 @item -mbigtable
9523 @opindex mbigtable
9524 Use 32-bit offsets in @code{switch} tables.  The default is to use
9525 16-bit offsets.
9526
9527 @item -mfmovd
9528 @opindex mfmovd
9529 Enable the use of the instruction @code{fmovd}.
9530
9531 @item -mhitachi
9532 @opindex mhitachi
9533 Comply with the calling conventions defined by Renesas.
9534
9535 @item -mnomacsave
9536 @opindex mnomacsave
9537 Mark the @code{MAC} register as call-clobbered, even if
9538 @option{-mhitachi} is given.
9539
9540 @item -mieee
9541 @opindex mieee
9542 Increase IEEE-compliance of floating-point code.
9543
9544 @item -misize
9545 @opindex misize
9546 Dump instruction size and location in the assembly code.
9547
9548 @item -mpadstruct
9549 @opindex mpadstruct
9550 This option is deprecated.  It pads structures to multiple of 4 bytes,
9551 which is incompatible with the SH ABI@.
9552
9553 @item -mspace
9554 @opindex mspace
9555 Optimize for space instead of speed.  Implied by @option{-Os}.
9556
9557 @item -mprefergot
9558 @opindex mprefergot
9559 When generating position-independent code, emit function calls using
9560 the Global Offset Table instead of the Procedure Linkage Table.
9561
9562 @item -musermode
9563 @opindex musermode
9564 Generate a library function call to invalidate instruction cache
9565 entries, after fixing up a trampoline.  This library function call
9566 doesn't assume it can write to the whole memory address space.  This
9567 is the default when the target is @code{sh-*-linux*}.
9568 @end table
9569
9570 @node System V Options
9571 @subsection Options for System V
9572
9573 These additional options are available on System V Release 4 for
9574 compatibility with other compilers on those systems:
9575
9576 @table @gcctabopt
9577 @item -G
9578 @opindex G
9579 Create a shared object.
9580 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
9581
9582 @item -Qy
9583 @opindex Qy
9584 Identify the versions of each tool used by the compiler, in a
9585 @code{.ident} assembler directive in the output.
9586
9587 @item -Qn
9588 @opindex Qn
9589 Refrain from adding @code{.ident} directives to the output file (this is
9590 the default).
9591
9592 @item -YP,@var{dirs}
9593 @opindex YP
9594 Search the directories @var{dirs}, and no others, for libraries
9595 specified with @option{-l}.
9596
9597 @item -Ym,@var{dir}
9598 @opindex Ym
9599 Look in the directory @var{dir} to find the M4 preprocessor.
9600 The assembler uses this option.
9601 @c This is supposed to go with a -Yd for predefined M4 macro files, but
9602 @c the generic assembler that comes with Solaris takes just -Ym.
9603 @end table
9604
9605 @node TMS320C3x/C4x Options
9606 @subsection TMS320C3x/C4x Options
9607 @cindex TMS320C3x/C4x Options
9608
9609 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
9610
9611 @table @gcctabopt
9612
9613 @item -mcpu=@var{cpu_type}
9614 @opindex mcpu
9615 Set the instruction set, register set, and instruction scheduling
9616 parameters for machine type @var{cpu_type}.  Supported values for
9617 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
9618 @samp{c44}.  The default is @samp{c40} to generate code for the
9619 TMS320C40.
9620
9621 @item -mbig-memory
9622 @item -mbig
9623 @itemx -msmall-memory
9624 @itemx -msmall
9625 @opindex mbig-memory
9626 @opindex mbig
9627 @opindex msmall-memory
9628 @opindex msmall
9629 Generates code for the big or small memory model.  The small memory
9630 model assumed that all data fits into one 64K word page.  At run-time
9631 the data page (DP) register must be set to point to the 64K page
9632 containing the .bss and .data program sections.  The big memory model is
9633 the default and requires reloading of the DP register for every direct
9634 memory access.
9635
9636 @item -mbk
9637 @itemx -mno-bk
9638 @opindex mbk
9639 @opindex mno-bk
9640 Allow (disallow) allocation of general integer operands into the block
9641 count register BK@.
9642
9643 @item -mdb
9644 @itemx -mno-db
9645 @opindex mdb
9646 @opindex mno-db
9647 Enable (disable) generation of code using decrement and branch,
9648 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
9649 on the safe side, this is disabled for the C3x, since the maximum
9650 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
9651 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
9652 that it can utilize the decrement and branch instruction, but will give
9653 up if there is more than one memory reference in the loop.  Thus a loop
9654 where the loop counter is decremented can generate slightly more
9655 efficient code, in cases where the RPTB instruction cannot be utilized.
9656
9657 @item -mdp-isr-reload
9658 @itemx -mparanoid
9659 @opindex mdp-isr-reload
9660 @opindex mparanoid
9661 Force the DP register to be saved on entry to an interrupt service
9662 routine (ISR), reloaded to point to the data section, and restored on
9663 exit from the ISR@.  This should not be required unless someone has
9664 violated the small memory model by modifying the DP register, say within
9665 an object library.
9666
9667 @item -mmpyi
9668 @itemx -mno-mpyi
9669 @opindex mmpyi
9670 @opindex mno-mpyi
9671 For the C3x use the 24-bit MPYI instruction for integer multiplies
9672 instead of a library call to guarantee 32-bit results.  Note that if one
9673 of the operands is a constant, then the multiplication will be performed
9674 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
9675 then squaring operations are performed inline instead of a library call.
9676
9677 @item -mfast-fix
9678 @itemx -mno-fast-fix
9679 @opindex mfast-fix
9680 @opindex mno-fast-fix
9681 The C3x/C4x FIX instruction to convert a floating point value to an
9682 integer value chooses the nearest integer less than or equal to the
9683 floating point value rather than to the nearest integer.  Thus if the
9684 floating point number is negative, the result will be incorrectly
9685 truncated an additional code is necessary to detect and correct this
9686 case.  This option can be used to disable generation of the additional
9687 code required to correct the result.
9688
9689 @item -mrptb
9690 @itemx -mno-rptb
9691 @opindex mrptb
9692 @opindex mno-rptb
9693 Enable (disable) generation of repeat block sequences using the RPTB
9694 instruction for zero overhead looping.  The RPTB construct is only used
9695 for innermost loops that do not call functions or jump across the loop
9696 boundaries.  There is no advantage having nested RPTB loops due to the
9697 overhead required to save and restore the RC, RS, and RE registers.
9698 This is enabled by default with @option{-O2}.
9699
9700 @item -mrpts=@var{count}
9701 @itemx -mno-rpts
9702 @opindex mrpts
9703 @opindex mno-rpts
9704 Enable (disable) the use of the single instruction repeat instruction
9705 RPTS@.  If a repeat block contains a single instruction, and the loop
9706 count can be guaranteed to be less than the value @var{count}, GCC will
9707 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
9708 then a RPTS will be emitted even if the loop count cannot be determined
9709 at compile time.  Note that the repeated instruction following RPTS does
9710 not have to be reloaded from memory each iteration, thus freeing up the
9711 CPU buses for operands.  However, since interrupts are blocked by this
9712 instruction, it is disabled by default.
9713
9714 @item -mloop-unsigned
9715 @itemx -mno-loop-unsigned
9716 @opindex mloop-unsigned
9717 @opindex mno-loop-unsigned
9718 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
9719 is @math{2^{31} + 1} since these instructions test if the iteration count is
9720 negative to terminate the loop.  If the iteration count is unsigned
9721 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
9722 exceeded.  This switch allows an unsigned iteration count.
9723
9724 @item -mti
9725 @opindex mti
9726 Try to emit an assembler syntax that the TI assembler (asm30) is happy
9727 with.  This also enforces compatibility with the API employed by the TI
9728 C3x C compiler.  For example, long doubles are passed as structures
9729 rather than in floating point registers.
9730
9731 @item -mregparm
9732 @itemx -mmemparm
9733 @opindex mregparm
9734 @opindex mmemparm
9735 Generate code that uses registers (stack) for passing arguments to functions.
9736 By default, arguments are passed in registers where possible rather
9737 than by pushing arguments on to the stack.
9738
9739 @item -mparallel-insns
9740 @itemx -mno-parallel-insns
9741 @opindex mparallel-insns
9742 @opindex mno-parallel-insns
9743 Allow the generation of parallel instructions.  This is enabled by
9744 default with @option{-O2}.
9745
9746 @item -mparallel-mpy
9747 @itemx -mno-parallel-mpy
9748 @opindex mparallel-mpy
9749 @opindex mno-parallel-mpy
9750 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
9751 provided @option{-mparallel-insns} is also specified.  These instructions have
9752 tight register constraints which can pessimize the code generation
9753 of large functions.
9754
9755 @end table
9756
9757 @node V850 Options
9758 @subsection V850 Options
9759 @cindex V850 Options
9760
9761 These @samp{-m} options are defined for V850 implementations:
9762
9763 @table @gcctabopt
9764 @item -mlong-calls
9765 @itemx -mno-long-calls
9766 @opindex mlong-calls
9767 @opindex mno-long-calls
9768 Treat all calls as being far away (near).  If calls are assumed to be
9769 far away, the compiler will always load the functions address up into a
9770 register, and call indirect through the pointer.
9771
9772 @item -mno-ep
9773 @itemx -mep
9774 @opindex mno-ep
9775 @opindex mep
9776 Do not optimize (do optimize) basic blocks that use the same index
9777 pointer 4 or more times to copy pointer into the @code{ep} register, and
9778 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
9779 option is on by default if you optimize.
9780
9781 @item -mno-prolog-function
9782 @itemx -mprolog-function
9783 @opindex mno-prolog-function
9784 @opindex mprolog-function
9785 Do not use (do use) external functions to save and restore registers
9786 at the prologue and epilogue of a function.  The external functions
9787 are slower, but use less code space if more than one function saves
9788 the same number of registers.  The @option{-mprolog-function} option
9789 is on by default if you optimize.
9790
9791 @item -mspace
9792 @opindex mspace
9793 Try to make the code as small as possible.  At present, this just turns
9794 on the @option{-mep} and @option{-mprolog-function} options.
9795
9796 @item -mtda=@var{n}
9797 @opindex mtda
9798 Put static or global variables whose size is @var{n} bytes or less into
9799 the tiny data area that register @code{ep} points to.  The tiny data
9800 area can hold up to 256 bytes in total (128 bytes for byte references).
9801
9802 @item -msda=@var{n}
9803 @opindex msda
9804 Put static or global variables whose size is @var{n} bytes or less into
9805 the small data area that register @code{gp} points to.  The small data
9806 area can hold up to 64 kilobytes.
9807
9808 @item -mzda=@var{n}
9809 @opindex mzda
9810 Put static or global variables whose size is @var{n} bytes or less into
9811 the first 32 kilobytes of memory.
9812
9813 @item -mv850
9814 @opindex mv850
9815 Specify that the target processor is the V850.
9816
9817 @item -mbig-switch
9818 @opindex mbig-switch
9819 Generate code suitable for big switch tables.  Use this option only if
9820 the assembler/linker complain about out of range branches within a switch
9821 table.
9822
9823 @item -mapp-regs
9824 @opindex mapp-regs
9825 This option will cause r2 and r5 to be used in the code generated by
9826 the compiler.  This setting is the default.
9827
9828 @item -mno-app-regs
9829 @opindex mno-app-regs
9830 This option will cause r2 and r5 to be treated as fixed registers.
9831   
9832 @item -mv850e1
9833 @opindex mv850e1
9834 Specify that the target processor is the V850E1.  The preprocessor
9835 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
9836 this option is used.
9837
9838 @item -mv850e
9839 @opindex mv850e
9840 Specify that the target processor is the V850E.  The preprocessor
9841 constant @samp{__v850e__} will be defined if this option is used.
9842
9843 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
9844 are defined then a default target processor will be chosen and the
9845 relevant @samp{__v850*__} preprocessor constant will be defined.
9846
9847 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9848 defined, regardless of which processor variant is the target.
9849
9850 @item -mdisable-callt
9851 @opindex mdisable-callt
9852 This option will suppress generation of the CALLT instruction for the
9853 v850e and v850e1 flavors of the v850 architecture.  The default is
9854 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
9855
9856 @end table
9857
9858 @node ARC Options
9859 @subsection ARC Options
9860 @cindex ARC Options
9861
9862 These options are defined for ARC implementations:
9863
9864 @table @gcctabopt
9865 @item -EL
9866 @opindex EL
9867 Compile code for little endian mode.  This is the default.
9868
9869 @item -EB
9870 @opindex EB
9871 Compile code for big endian mode.
9872
9873 @item -mmangle-cpu
9874 @opindex mmangle-cpu
9875 Prepend the name of the cpu to all public symbol names.
9876 In multiple-processor systems, there are many ARC variants with different
9877 instruction and register set characteristics.  This flag prevents code
9878 compiled for one cpu to be linked with code compiled for another.
9879 No facility exists for handling variants that are ``almost identical''.
9880 This is an all or nothing option.
9881
9882 @item -mcpu=@var{cpu}
9883 @opindex mcpu
9884 Compile code for ARC variant @var{cpu}.
9885 Which variants are supported depend on the configuration.
9886 All variants support @option{-mcpu=base}, this is the default.
9887
9888 @item -mtext=@var{text-section}
9889 @itemx -mdata=@var{data-section}
9890 @itemx -mrodata=@var{readonly-data-section}
9891 @opindex mtext
9892 @opindex mdata
9893 @opindex mrodata
9894 Put functions, data, and readonly data in @var{text-section},
9895 @var{data-section}, and @var{readonly-data-section} respectively
9896 by default.  This can be overridden with the @code{section} attribute.
9897 @xref{Variable Attributes}.
9898
9899 @end table
9900
9901 @node NS32K Options
9902 @subsection NS32K Options
9903 @cindex NS32K options
9904
9905 These are the @samp{-m} options defined for the 32000 series.  The default
9906 values for these options depends on which style of 32000 was selected when
9907 the compiler was configured; the defaults for the most common choices are
9908 given below.
9909
9910 @table @gcctabopt
9911 @item -m32032
9912 @itemx -m32032
9913 @opindex m32032
9914 @opindex m32032
9915 Generate output for a 32032.  This is the default
9916 when the compiler is configured for 32032 and 32016 based systems.
9917
9918 @item -m32332
9919 @itemx -m32332
9920 @opindex m32332
9921 @opindex m32332
9922 Generate output for a 32332.  This is the default
9923 when the compiler is configured for 32332-based systems.
9924
9925 @item -m32532
9926 @itemx -m32532
9927 @opindex m32532
9928 @opindex m32532
9929 Generate output for a 32532.  This is the default
9930 when the compiler is configured for 32532-based systems.
9931
9932 @item -m32081
9933 @opindex m32081
9934 Generate output containing 32081 instructions for floating point.
9935 This is the default for all systems.
9936
9937 @item -m32381
9938 @opindex m32381
9939 Generate output containing 32381 instructions for floating point.  This
9940 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9941 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9942
9943 @item -mmulti-add
9944 @opindex mmulti-add
9945 Try and generate multiply-add floating point instructions @code{polyF}
9946 and @code{dotF}.  This option is only available if the @option{-m32381}
9947 option is in effect.  Using these instructions requires changes to
9948 register allocation which generally has a negative impact on
9949 performance.  This option should only be enabled when compiling code
9950 particularly likely to make heavy use of multiply-add instructions.
9951
9952 @item -mnomulti-add
9953 @opindex mnomulti-add
9954 Do not try and generate multiply-add floating point instructions
9955 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9956
9957 @item -msoft-float
9958 @opindex msoft-float
9959 Generate output containing library calls for floating point.
9960 @strong{Warning:} the requisite libraries may not be available.
9961
9962 @item -mieee-compare
9963 @itemx -mno-ieee-compare
9964 @opindex mieee-compare
9965 @opindex mno-ieee-compare
9966 Control whether or not the compiler uses IEEE floating point
9967 comparisons.  These handle correctly the case where the result of a
9968 comparison is unordered.
9969 @strong{Warning:} the requisite kernel support may not be available.
9970
9971 @item -mnobitfield
9972 @opindex mnobitfield
9973 Do not use the bit-field instructions.  On some machines it is faster to
9974 use shifting and masking operations.  This is the default for the pc532.
9975
9976 @item -mbitfield
9977 @opindex mbitfield
9978 Do use the bit-field instructions.  This is the default for all platforms
9979 except the pc532.
9980
9981 @item -mrtd
9982 @opindex mrtd
9983 Use a different function-calling convention, in which functions
9984 that take a fixed number of arguments return pop their
9985 arguments on return with the @code{ret} instruction.
9986
9987 This calling convention is incompatible with the one normally
9988 used on Unix, so you cannot use it if you need to call libraries
9989 compiled with the Unix compiler.
9990
9991 Also, you must provide function prototypes for all functions that
9992 take variable numbers of arguments (including @code{printf});
9993 otherwise incorrect code will be generated for calls to those
9994 functions.
9995
9996 In addition, seriously incorrect code will result if you call a
9997 function with too many arguments.  (Normally, extra arguments are
9998 harmlessly ignored.)
9999
10000 This option takes its name from the 680x0 @code{rtd} instruction.
10001
10002
10003 @item -mregparam
10004 @opindex mregparam
10005 Use a different function-calling convention where the first two arguments
10006 are passed in registers.
10007
10008 This calling convention is incompatible with the one normally
10009 used on Unix, so you cannot use it if you need to call libraries
10010 compiled with the Unix compiler.
10011
10012 @item -mnoregparam
10013 @opindex mnoregparam
10014 Do not pass any arguments in registers.  This is the default for all
10015 targets.
10016
10017 @item -msb
10018 @opindex msb
10019 It is OK to use the sb as an index register which is always loaded with
10020 zero.  This is the default for the pc532-netbsd target.
10021
10022 @item -mnosb
10023 @opindex mnosb
10024 The sb register is not available for use or has not been initialized to
10025 zero by the run time system.  This is the default for all targets except
10026 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
10027 @option{-fpic} is set.
10028
10029 @item -mhimem
10030 @opindex mhimem
10031 Many ns32000 series addressing modes use displacements of up to 512MB@.
10032 If an address is above 512MB then displacements from zero can not be used.
10033 This option causes code to be generated which can be loaded above 512MB@.
10034 This may be useful for operating systems or ROM code.
10035
10036 @item -mnohimem
10037 @opindex mnohimem
10038 Assume code will be loaded in the first 512MB of virtual address space.
10039 This is the default for all platforms.
10040
10041
10042 @end table
10043
10044 @node AVR Options
10045 @subsection AVR Options
10046 @cindex AVR Options
10047
10048 These options are defined for AVR implementations:
10049
10050 @table @gcctabopt
10051 @item -mmcu=@var{mcu}
10052 @opindex mmcu
10053 Specify ATMEL AVR instruction set or MCU type.
10054
10055 Instruction set avr1 is for the minimal AVR core, not supported by the C
10056 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
10057 attiny11, attiny12, attiny15, attiny28).
10058
10059 Instruction set avr2 (default) is for the classic AVR core with up to
10060 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
10061 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
10062 at90c8534, at90s8535).
10063
10064 Instruction set avr3 is for the classic AVR core with up to 128K program
10065 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
10066
10067 Instruction set avr4 is for the enhanced AVR core with up to 8K program
10068 memory space (MCU types: atmega8, atmega83, atmega85).
10069
10070 Instruction set avr5 is for the enhanced AVR core with up to 128K program
10071 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
10072 atmega64, atmega128, at43usb355, at94k).
10073
10074 @item -msize
10075 @opindex msize
10076 Output instruction sizes to the asm file.
10077
10078 @item -minit-stack=@var{N}
10079 @opindex minit-stack
10080 Specify the initial stack address, which may be a symbol or numeric value,
10081 @samp{__stack} is the default.
10082
10083 @item -mno-interrupts
10084 @opindex mno-interrupts
10085 Generated code is not compatible with hardware interrupts.
10086 Code size will be smaller.
10087
10088 @item -mcall-prologues
10089 @opindex mcall-prologues
10090 Functions prologues/epilogues expanded as call to appropriate
10091 subroutines.  Code size will be smaller.
10092
10093 @item -mno-tablejump
10094 @opindex mno-tablejump
10095 Do not generate tablejump insns which sometimes increase code size.
10096
10097 @item -mtiny-stack
10098 @opindex mtiny-stack
10099 Change only the low 8 bits of the stack pointer.
10100 @end table
10101
10102 @node MCore Options
10103 @subsection MCore Options
10104 @cindex MCore options
10105
10106 These are the @samp{-m} options defined for the Motorola M*Core
10107 processors.
10108
10109 @table @gcctabopt
10110
10111 @item -mhardlit
10112 @itemx -mno-hardlit
10113 @opindex mhardlit
10114 @opindex mno-hardlit
10115 Inline constants into the code stream if it can be done in two
10116 instructions or less.
10117
10118 @item -mdiv
10119 @itemx -mno-div
10120 @opindex mdiv
10121 @opindex mno-div
10122 Use the divide instruction.  (Enabled by default).
10123
10124 @item -mrelax-immediate
10125 @itemx -mno-relax-immediate
10126 @opindex mrelax-immediate
10127 @opindex mno-relax-immediate
10128 Allow arbitrary sized immediates in bit operations.
10129
10130 @item -mwide-bitfields
10131 @itemx -mno-wide-bitfields
10132 @opindex mwide-bitfields
10133 @opindex mno-wide-bitfields
10134 Always treat bit-fields as int-sized.
10135
10136 @item -m4byte-functions
10137 @itemx -mno-4byte-functions
10138 @opindex m4byte-functions
10139 @opindex mno-4byte-functions
10140 Force all functions to be aligned to a four byte boundary.
10141
10142 @item -mcallgraph-data
10143 @itemx -mno-callgraph-data
10144 @opindex mcallgraph-data
10145 @opindex mno-callgraph-data
10146 Emit callgraph information.
10147
10148 @item -mslow-bytes
10149 @itemx -mno-slow-bytes
10150 @opindex mslow-bytes
10151 @opindex mno-slow-bytes
10152 Prefer word access when reading byte quantities.
10153
10154 @item -mlittle-endian
10155 @itemx -mbig-endian
10156 @opindex mlittle-endian
10157 @opindex mbig-endian
10158 Generate code for a little endian target.
10159
10160 @item -m210
10161 @itemx -m340
10162 @opindex m210
10163 @opindex m340
10164 Generate code for the 210 processor.
10165 @end table
10166
10167 @node IA-64 Options
10168 @subsection IA-64 Options
10169 @cindex IA-64 Options
10170
10171 These are the @samp{-m} options defined for the Intel IA-64 architecture.
10172
10173 @table @gcctabopt
10174 @item -mbig-endian
10175 @opindex mbig-endian
10176 Generate code for a big endian target.  This is the default for HP-UX@.
10177
10178 @item -mlittle-endian
10179 @opindex mlittle-endian
10180 Generate code for a little endian target.  This is the default for AIX5
10181 and Linux.
10182
10183 @item -mgnu-as
10184 @itemx -mno-gnu-as
10185 @opindex mgnu-as
10186 @opindex mno-gnu-as
10187 Generate (or don't) code for the GNU assembler.  This is the default.
10188 @c Also, this is the default if the configure option @option{--with-gnu-as}
10189 @c is used.
10190
10191 @item -mgnu-ld
10192 @itemx -mno-gnu-ld
10193 @opindex mgnu-ld
10194 @opindex mno-gnu-ld
10195 Generate (or don't) code for the GNU linker.  This is the default.
10196 @c Also, this is the default if the configure option @option{--with-gnu-ld}
10197 @c is used.
10198
10199 @item -mno-pic
10200 @opindex mno-pic
10201 Generate code that does not use a global pointer register.  The result
10202 is not position independent code, and violates the IA-64 ABI@.
10203
10204 @item -mvolatile-asm-stop
10205 @itemx -mno-volatile-asm-stop
10206 @opindex mvolatile-asm-stop
10207 @opindex mno-volatile-asm-stop
10208 Generate (or don't) a stop bit immediately before and after volatile asm
10209 statements.
10210
10211 @item -mb-step
10212 @opindex mb-step
10213 Generate code that works around Itanium B step errata.
10214
10215 @item -mregister-names
10216 @itemx -mno-register-names
10217 @opindex mregister-names
10218 @opindex mno-register-names
10219 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
10220 the stacked registers.  This may make assembler output more readable.
10221
10222 @item -mno-sdata
10223 @itemx -msdata
10224 @opindex mno-sdata
10225 @opindex msdata
10226 Disable (or enable) optimizations that use the small data section.  This may
10227 be useful for working around optimizer bugs.
10228
10229 @item -mconstant-gp
10230 @opindex mconstant-gp
10231 Generate code that uses a single constant global pointer value.  This is
10232 useful when compiling kernel code.
10233
10234 @item -mauto-pic
10235 @opindex mauto-pic
10236 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
10237 This is useful when compiling firmware code.
10238
10239 @item -minline-float-divide-min-latency
10240 @opindex minline-float-divide-min-latency
10241 Generate code for inline divides of floating point values
10242 using the minimum latency algorithm.
10243
10244 @item -minline-float-divide-max-throughput
10245 @opindex minline-float-divide-max-throughput
10246 Generate code for inline divides of floating point values
10247 using the maximum throughput algorithm.
10248
10249 @item -minline-int-divide-min-latency
10250 @opindex minline-int-divide-min-latency
10251 Generate code for inline divides of integer values
10252 using the minimum latency algorithm.
10253
10254 @item -minline-int-divide-max-throughput
10255 @opindex minline-int-divide-max-throughput
10256 Generate code for inline divides of integer values
10257 using the maximum throughput algorithm.
10258
10259 @item -mno-dwarf2-asm
10260 @itemx -mdwarf2-asm
10261 @opindex mno-dwarf2-asm
10262 @opindex mdwarf2-asm
10263 Don't (or do) generate assembler code for the DWARF2 line number debugging
10264 info.  This may be useful when not using the GNU assembler.
10265
10266 @item -mfixed-range=@var{register-range}
10267 @opindex mfixed-range
10268 Generate code treating the given register range as fixed registers.
10269 A fixed register is one that the register allocator can not use.  This is
10270 useful when compiling kernel code.  A register range is specified as
10271 two registers separated by a dash.  Multiple register ranges can be
10272 specified separated by a comma.
10273
10274 @item -mearly-stop-bits
10275 @itemx -mno-early-stop-bits
10276 @opindex mearly-stop-bits
10277 @opindex mno-early-stop-bits
10278 Allow stop bits to be placed earlier than immediately preceding the
10279 instruction that triggered the stop bit.  This can improve instruction
10280 scheduling, but does not always do so.
10281 @end table
10282
10283 @node D30V Options
10284 @subsection D30V Options
10285 @cindex D30V Options
10286
10287 These @samp{-m} options are defined for D30V implementations:
10288
10289 @table @gcctabopt
10290 @item -mextmem
10291 @opindex mextmem
10292 Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
10293 @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
10294 memory, which starts at location @code{0x80000000}.
10295
10296 @item -mextmemory
10297 @opindex mextmemory
10298 Same as the @option{-mextmem} switch.
10299
10300 @item -monchip
10301 @opindex monchip
10302 Link the @samp{.text} section into onchip text memory, which starts at
10303 location @code{0x0}.  Also link @samp{.data}, @samp{.bss},
10304 @samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
10305 into onchip data memory, which starts at location @code{0x20000000}.
10306
10307 @item -mno-asm-optimize
10308 @itemx -masm-optimize
10309 @opindex mno-asm-optimize
10310 @opindex masm-optimize
10311 Disable (enable) passing @option{-O} to the assembler when optimizing.
10312 The assembler uses the @option{-O} option to automatically parallelize
10313 adjacent short instructions where possible.
10314
10315 @item -mbranch-cost=@var{n}
10316 @opindex mbranch-cost
10317 Increase the internal costs of branches to @var{n}.  Higher costs means
10318 that the compiler will issue more instructions to avoid doing a branch.
10319 The default is 2.
10320
10321 @item -mcond-exec=@var{n}
10322 @opindex mcond-exec
10323 Specify the maximum number of conditionally executed instructions that
10324 replace a branch.  The default is 4.
10325 @end table
10326
10327 @node S/390 and zSeries Options
10328 @subsection S/390 and zSeries Options
10329 @cindex S/390 and zSeries Options
10330
10331 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
10332
10333 @table @gcctabopt
10334 @item -mhard-float
10335 @itemx -msoft-float
10336 @opindex mhard-float
10337 @opindex msoft-float
10338 Use (do not use) the hardware floating-point instructions and registers
10339 for floating-point operations.  When @option{-msoft-float} is specified,
10340 functions in @file{libgcc.a} will be used to perform floating-point
10341 operations.  When @option{-mhard-float} is specified, the compiler
10342 generates IEEE floating-point instructions.  This is the default.
10343
10344 @item -mbackchain
10345 @itemx -mno-backchain
10346 @opindex mbackchain
10347 @opindex mno-backchain
10348 Generate (or do not generate) code which maintains an explicit
10349 backchain within the stack frame that points to the caller's frame.
10350 This is currently needed to allow debugging.  The default is to
10351 generate the backchain.
10352
10353 @item -msmall-exec
10354 @itemx -mno-small-exec
10355 @opindex msmall-exec
10356 @opindex mno-small-exec
10357 Generate (or do not generate) code using the @code{bras} instruction
10358 to do subroutine calls.
10359 This only works reliably if the total executable size does not
10360 exceed 64k.  The default is to use the @code{basr} instruction instead,
10361 which does not have this limitation.
10362
10363 @item -m64
10364 @itemx -m31
10365 @opindex m64
10366 @opindex m31
10367 When @option{-m31} is specified, generate code compliant to the
10368 Linux for S/390 ABI@.  When @option{-m64} is specified, generate
10369 code compliant to the Linux for zSeries ABI@.  This allows GCC in
10370 particular to generate 64-bit instructions.  For the @samp{s390}
10371 targets, the default is @option{-m31}, while the @samp{s390x}
10372 targets default to @option{-m64}.
10373
10374 @item -mzarch
10375 @itemx -mesa
10376 @opindex mzarch
10377 @opindex mesa
10378 When @option{-mzarch} is specified, generate code using the 
10379 instructions available on z/Architecture. 
10380 When @option{-mesa} is specified, generate code using the 
10381 instructions available on ESA/390. Note that @option{-mesa} is
10382 not possible with @option{-m64}.
10383 When generating code compliant to the Linux for S/390 ABI,
10384 the default is @option{-mesa}.  When generating code compliant
10385 to the Linux for zSeries ABI, the default is @option{-mzarch}.
10386
10387 @item -mmvcle
10388 @itemx -mno-mvcle
10389 @opindex mmvcle
10390 @opindex mno-mvcle
10391 Generate (or do not generate) code using the @code{mvcle} instruction
10392 to perform block moves.  When @option{-mno-mvcle} is specified,
10393 use a @code{mvc} loop instead.  This is the default.
10394
10395 @item -mdebug
10396 @itemx -mno-debug
10397 @opindex mdebug
10398 @opindex mno-debug
10399 Print (or do not print) additional debug information when compiling.
10400 The default is to not print debug information.
10401
10402 @item -march=@var{cpu-type}
10403 @opindex march
10404 Generate code that will run on @var{cpu-type}, which is the name of a system
10405 representing a certain processor type. Possible values for
10406 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
10407 When generating code using the instructions available on z/Architecture,
10408 the default is @option{-march=z900}.  Otherwise, the default is
10409 @option{-march=g5}.
10410
10411 @item -mtune=@var{cpu-type}
10412 @opindex mtune
10413 Tune to @var{cpu-type} everything applicable about the generated code,
10414 except for the ABI and the set of available instructions.
10415 The list of @var{cpu-type} values is the same as for @option{-march}.
10416 The default is the value used for @option{-march}.
10417
10418 @end table
10419
10420 @node CRIS Options
10421 @subsection CRIS Options
10422 @cindex CRIS Options
10423
10424 These options are defined specifically for the CRIS ports.
10425
10426 @table @gcctabopt
10427 @item -march=@var{architecture-type}
10428 @itemx -mcpu=@var{architecture-type}
10429 @opindex march
10430 @opindex mcpu
10431 Generate code for the specified architecture.  The choices for
10432 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10433 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
10434 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10435 @samp{v10}.
10436
10437 @item -mtune=@var{architecture-type}
10438 @opindex mtune
10439 Tune to @var{architecture-type} everything applicable about the generated
10440 code, except for the ABI and the set of available instructions.  The
10441 choices for @var{architecture-type} are the same as for
10442 @option{-march=@var{architecture-type}}.
10443
10444 @item -mmax-stack-frame=@var{n}
10445 @opindex mmax-stack-frame
10446 Warn when the stack frame of a function exceeds @var{n} bytes.
10447
10448 @item -melinux-stacksize=@var{n}
10449 @opindex melinux-stacksize
10450 Only available with the @samp{cris-axis-aout} target.  Arranges for
10451 indications in the program to the kernel loader that the stack of the
10452 program should be set to @var{n} bytes.
10453
10454 @item -metrax4
10455 @itemx -metrax100
10456 @opindex metrax4
10457 @opindex metrax100
10458 The options @option{-metrax4} and @option{-metrax100} are synonyms for
10459 @option{-march=v3} and @option{-march=v8} respectively.
10460
10461 @item -mpdebug
10462 @opindex mpdebug
10463 Enable CRIS-specific verbose debug-related information in the assembly
10464 code.  This option also has the effect to turn off the @samp{#NO_APP}
10465 formatted-code indicator to the assembler at the beginning of the
10466 assembly file.
10467
10468 @item -mcc-init
10469 @opindex mcc-init
10470 Do not use condition-code results from previous instruction; always emit
10471 compare and test instructions before use of condition codes.
10472
10473 @item -mno-side-effects
10474 @opindex mno-side-effects
10475 Do not emit instructions with side-effects in addressing modes other than
10476 post-increment.
10477
10478 @item -mstack-align
10479 @itemx -mno-stack-align
10480 @itemx -mdata-align
10481 @itemx -mno-data-align
10482 @itemx -mconst-align
10483 @itemx -mno-const-align
10484 @opindex mstack-align
10485 @opindex mno-stack-align
10486 @opindex mdata-align
10487 @opindex mno-data-align
10488 @opindex mconst-align
10489 @opindex mno-const-align
10490 These options (no-options) arranges (eliminate arrangements) for the
10491 stack-frame, individual data and constants to be aligned for the maximum
10492 single data access size for the chosen CPU model.  The default is to
10493 arrange for 32-bit alignment.  ABI details such as structure layout are
10494 not affected by these options.
10495
10496 @item -m32-bit
10497 @itemx -m16-bit
10498 @itemx -m8-bit
10499 @opindex m32-bit
10500 @opindex m16-bit
10501 @opindex m8-bit
10502 Similar to the stack- data- and const-align options above, these options
10503 arrange for stack-frame, writable data and constants to all be 32-bit,
10504 16-bit or 8-bit aligned.  The default is 32-bit alignment.
10505
10506 @item -mno-prologue-epilogue
10507 @itemx -mprologue-epilogue
10508 @opindex mno-prologue-epilogue
10509 @opindex mprologue-epilogue
10510 With @option{-mno-prologue-epilogue}, the normal function prologue and
10511 epilogue that sets up the stack-frame are omitted and no return
10512 instructions or return sequences are generated in the code.  Use this
10513 option only together with visual inspection of the compiled code: no
10514 warnings or errors are generated when call-saved registers must be saved,
10515 or storage for local variable needs to be allocated.
10516
10517 @item -mno-gotplt
10518 @itemx -mgotplt
10519 @opindex mno-gotplt
10520 @opindex mgotplt
10521 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10522 instruction sequences that load addresses for functions from the PLT part
10523 of the GOT rather than (traditional on other architectures) calls to the
10524 PLT.  The default is @option{-mgotplt}.
10525
10526 @item -maout
10527 @opindex maout
10528 Legacy no-op option only recognized with the cris-axis-aout target.
10529
10530 @item -melf
10531 @opindex melf
10532 Legacy no-op option only recognized with the cris-axis-elf and
10533 cris-axis-linux-gnu targets.
10534
10535 @item -melinux
10536 @opindex melinux
10537 Only recognized with the cris-axis-aout target, where it selects a
10538 GNU/linux-like multilib, include files and instruction set for
10539 @option{-march=v8}.
10540
10541 @item -mlinux
10542 @opindex mlinux
10543 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10544
10545 @item -sim
10546 @opindex sim
10547 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
10548 to link with input-output functions from a simulator library.  Code,
10549 initialized data and zero-initialized data are allocated consecutively.
10550
10551 @item -sim2
10552 @opindex sim2
10553 Like @option{-sim}, but pass linker options to locate initialized data at
10554 0x40000000 and zero-initialized data at 0x80000000.
10555 @end table
10556
10557 @node MMIX Options
10558 @subsection MMIX Options
10559 @cindex MMIX Options
10560
10561 These options are defined for the MMIX:
10562
10563 @table @gcctabopt
10564 @item -mlibfuncs
10565 @itemx -mno-libfuncs
10566 @opindex mlibfuncs
10567 @opindex mno-libfuncs
10568 Specify that intrinsic library functions are being compiled, passing all
10569 values in registers, no matter the size.
10570
10571 @item -mepsilon
10572 @itemx -mno-epsilon
10573 @opindex mepsilon
10574 @opindex mno-epsilon
10575 Generate floating-point comparison instructions that compare with respect
10576 to the @code{rE} epsilon register.
10577
10578 @item -mabi=mmixware
10579 @itemx -mabi=gnu
10580 @opindex mabi-mmixware
10581 @opindex mabi=gnu
10582 Generate code that passes function parameters and return values that (in
10583 the called function) are seen as registers @code{$0} and up, as opposed to
10584 the GNU ABI which uses global registers @code{$231} and up.
10585
10586 @item -mzero-extend
10587 @itemx -mno-zero-extend
10588 @opindex mzero-extend
10589 @opindex mno-zero-extend
10590 When reading data from memory in sizes shorter than 64 bits, use (do not
10591 use) zero-extending load instructions by default, rather than
10592 sign-extending ones.
10593
10594 @item -mknuthdiv
10595 @itemx -mno-knuthdiv
10596 @opindex mknuthdiv
10597 @opindex mno-knuthdiv
10598 Make the result of a division yielding a remainder have the same sign as
10599 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10600 remainder follows the sign of the dividend.  Both methods are
10601 arithmetically valid, the latter being almost exclusively used.
10602
10603 @item -mtoplevel-symbols
10604 @itemx -mno-toplevel-symbols
10605 @opindex mtoplevel-symbols
10606 @opindex mno-toplevel-symbols
10607 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10608 code can be used with the @code{PREFIX} assembly directive.
10609
10610 @item -melf
10611 @opindex melf
10612 Generate an executable in the ELF format, rather than the default
10613 @samp{mmo} format used by the @command{mmix} simulator.
10614
10615 @item -mbranch-predict
10616 @itemx -mno-branch-predict
10617 @opindex mbranch-predict
10618 @opindex mno-branch-predict
10619 Use (do not use) the probable-branch instructions, when static branch
10620 prediction indicates a probable branch.
10621
10622 @item -mbase-addresses
10623 @itemx -mno-base-addresses
10624 @opindex mbase-addresses
10625 @opindex mno-base-addresses
10626 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10627 base address automatically generates a request (handled by the assembler
10628 and the linker) for a constant to be set up in a global register.  The
10629 register is used for one or more base address requests within the range 0
10630 to 255 from the value held in the register.  The generally leads to short
10631 and fast code, but the number of different data items that can be
10632 addressed is limited.  This means that a program that uses lots of static
10633 data may require @option{-mno-base-addresses}.
10634
10635 @item -msingle-exit
10636 @itemx -mno-single-exit
10637 @opindex msingle-exit
10638 @opindex mno-single-exit
10639 Force (do not force) generated code to have a single exit point in each
10640 function.
10641 @end table
10642
10643 @node PDP-11 Options
10644 @subsection PDP-11 Options
10645 @cindex PDP-11 Options
10646
10647 These options are defined for the PDP-11:
10648
10649 @table @gcctabopt
10650 @item -mfpu
10651 @opindex mfpu
10652 Use hardware FPP floating point.  This is the default.  (FIS floating
10653 point on the PDP-11/40 is not supported.)
10654
10655 @item -msoft-float
10656 @opindex msoft-float
10657 Do not use hardware floating point.
10658
10659 @item -mac0
10660 @opindex mac0
10661 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10662
10663 @item -mno-ac0
10664 @opindex mno-ac0
10665 Return floating-point results in memory.  This is the default.
10666
10667 @item -m40
10668 @opindex m40
10669 Generate code for a PDP-11/40.
10670
10671 @item -m45
10672 @opindex m45
10673 Generate code for a PDP-11/45.  This is the default.
10674
10675 @item -m10
10676 @opindex m10
10677 Generate code for a PDP-11/10.
10678
10679 @item -mbcopy-builtin
10680 @opindex bcopy-builtin
10681 Use inline @code{movstrhi} patterns for copying memory.  This is the
10682 default.
10683
10684 @item -mbcopy
10685 @opindex mbcopy
10686 Do not use inline @code{movstrhi} patterns for copying memory.
10687
10688 @item -mint16
10689 @itemx -mno-int32
10690 @opindex mint16
10691 @opindex mno-int32
10692 Use 16-bit @code{int}.  This is the default.
10693
10694 @item -mint32
10695 @itemx -mno-int16
10696 @opindex mint32
10697 @opindex mno-int16
10698 Use 32-bit @code{int}.
10699
10700 @item -mfloat64
10701 @itemx -mno-float32
10702 @opindex mfloat64
10703 @opindex mno-float32
10704 Use 64-bit @code{float}.  This is the default.
10705
10706 @item -mfloat32
10707 @item -mno-float64
10708 @opindex mfloat32
10709 @opindex mno-float64
10710 Use 32-bit @code{float}.
10711
10712 @item -mabshi
10713 @opindex mabshi
10714 Use @code{abshi2} pattern.  This is the default.
10715
10716 @item -mno-abshi
10717 @opindex mno-abshi
10718 Do not use @code{abshi2} pattern.
10719
10720 @item -mbranch-expensive
10721 @opindex mbranch-expensive
10722 Pretend that branches are expensive.  This is for experimenting with
10723 code generation only.
10724
10725 @item -mbranch-cheap
10726 @opindex mbranch-cheap
10727 Do not pretend that branches are expensive.  This is the default.
10728
10729 @item -msplit
10730 @opindex msplit
10731 Generate code for a system with split I&D.
10732
10733 @item -mno-split
10734 @opindex mno-split
10735 Generate code for a system without split I&D.  This is the default.
10736
10737 @item -munix-asm
10738 @opindex munix-asm
10739 Use Unix assembler syntax.  This is the default when configured for
10740 @samp{pdp11-*-bsd}.
10741
10742 @item -mdec-asm
10743 @opindex mdec-asm
10744 Use DEC assembler syntax.  This is the default when configured for any
10745 PDP-11 target other than @samp{pdp11-*-bsd}.
10746 @end table
10747
10748 @node Xstormy16 Options
10749 @subsection Xstormy16 Options
10750 @cindex Xstormy16 Options
10751
10752 These options are defined for Xstormy16:
10753
10754 @table @gcctabopt
10755 @item -msim
10756 @opindex msim
10757 Choose startup files and linker script suitable for the simulator.
10758 @end table
10759
10760 @node FRV Options
10761 @subsection FRV Options
10762 @cindex FRV Options
10763
10764 @table @gcctabopt
10765 @item -mgpr-32
10766 @opindex mgpr-32
10767
10768 Only use the first 32 general purpose registers.
10769
10770 @item -mgpr-64
10771 @opindex mgpr-64
10772
10773 Use all 64 general purpose registers.
10774
10775 @item -mfpr-32
10776 @opindex mfpr-32
10777
10778 Use only the first 32 floating point registers.
10779
10780 @item -mfpr-64
10781 @opindex mfpr-64
10782
10783 Use all 64 floating point registers
10784
10785 @item -mhard-float
10786 @opindex mhard-float
10787
10788 Use hardware instructions for floating point operations.
10789
10790 @item -msoft-float
10791 @opindex msoft-float
10792
10793 Use library routines for floating point operations.
10794
10795 @item -malloc-cc
10796 @opindex malloc-cc
10797
10798 Dynamically allocate condition code registers.
10799
10800 @item -mfixed-cc
10801 @opindex mfixed-cc
10802
10803 Do not try to dynamically allocate condition code registers, only
10804 use @code{icc0} and @code{fcc0}.
10805
10806 @item -mdword
10807 @opindex mdword
10808
10809 Change ABI to use double word insns.
10810
10811 @item -mno-dword
10812 @opindex mno-dword
10813
10814 Do not use double word instructions.
10815
10816 @item -mdouble
10817 @opindex mdouble
10818
10819 Use floating point double instructions.
10820
10821 @item -mno-double
10822 @opindex mno-double
10823
10824 Do not use floating point double instructions.
10825
10826 @item -mmedia
10827 @opindex mmedia
10828
10829 Use media instructions.
10830
10831 @item -mno-media
10832 @opindex mno-media
10833
10834 Do not use media instructions.
10835
10836 @item -mmuladd
10837 @opindex mmuladd
10838
10839 Use multiply and add/subtract instructions.
10840
10841 @item -mno-muladd
10842 @opindex mno-muladd
10843
10844 Do not use multiply and add/subtract instructions.
10845
10846 @item -mlibrary-pic
10847 @opindex mlibrary-pic
10848
10849 Enable PIC support for building libraries
10850
10851 @item -macc-4
10852 @opindex macc-4
10853
10854 Use only the first four media accumulator registers.
10855
10856 @item -macc-8
10857 @opindex macc-8
10858
10859 Use all eight media accumulator registers.
10860
10861 @item -mpack
10862 @opindex mpack
10863
10864 Pack VLIW instructions.
10865
10866 @item -mno-pack
10867 @opindex mno-pack
10868
10869 Do not pack VLIW instructions.
10870
10871 @item -mno-eflags
10872 @opindex mno-eflags
10873
10874 Do not mark ABI switches in e_flags.
10875
10876 @item -mcond-move
10877 @opindex mcond-move
10878
10879 Enable the use of conditional-move instructions (default).
10880
10881 This switch is mainly for debugging the compiler and will likely be removed
10882 in a future version.
10883
10884 @item -mno-cond-move
10885 @opindex mno-cond-move
10886
10887 Disable the use of conditional-move instructions.
10888
10889 This switch is mainly for debugging the compiler and will likely be removed
10890 in a future version.
10891
10892 @item -mscc
10893 @opindex mscc
10894
10895 Enable the use of conditional set instructions (default).
10896
10897 This switch is mainly for debugging the compiler and will likely be removed
10898 in a future version.
10899
10900 @item -mno-scc
10901 @opindex mno-scc
10902
10903 Disable the use of conditional set instructions.
10904
10905 This switch is mainly for debugging the compiler and will likely be removed
10906 in a future version.
10907
10908 @item -mcond-exec
10909 @opindex mcond-exec
10910
10911 Enable the use of conditional execution (default).
10912
10913 This switch is mainly for debugging the compiler and will likely be removed
10914 in a future version.
10915
10916 @item -mno-cond-exec
10917 @opindex mno-cond-exec
10918
10919 Disable the use of conditional execution.
10920
10921 This switch is mainly for debugging the compiler and will likely be removed
10922 in a future version.
10923
10924 @item -mvliw-branch
10925 @opindex mvliw-branch
10926
10927 Run a pass to pack branches into VLIW instructions (default).
10928
10929 This switch is mainly for debugging the compiler and will likely be removed
10930 in a future version.
10931
10932 @item -mno-vliw-branch
10933 @opindex mno-vliw-branch
10934
10935 Do not run a pass to pack branches into VLIW instructions.
10936
10937 This switch is mainly for debugging the compiler and will likely be removed
10938 in a future version.
10939
10940 @item -mmulti-cond-exec
10941 @opindex mmulti-cond-exec
10942
10943 Enable optimization of @code{&&} and @code{||} in conditional execution
10944 (default).
10945
10946 This switch is mainly for debugging the compiler and will likely be removed
10947 in a future version.
10948
10949 @item -mno-multi-cond-exec
10950 @opindex mno-multi-cond-exec
10951
10952 Disable optimization of @code{&&} and @code{||} in conditional execution.
10953
10954 This switch is mainly for debugging the compiler and will likely be removed
10955 in a future version.
10956
10957 @item -mnested-cond-exec
10958 @opindex mnested-cond-exec
10959
10960 Enable nested conditional execution optimizations (default).
10961
10962 This switch is mainly for debugging the compiler and will likely be removed
10963 in a future version.
10964
10965 @item -mno-nested-cond-exec
10966 @opindex mno-nested-cond-exec
10967
10968 Disable nested conditional execution optimizations.
10969
10970 This switch is mainly for debugging the compiler and will likely be removed
10971 in a future version.
10972
10973 @item -mtomcat-stats
10974 @opindex mtomcat-stats
10975
10976 Cause gas to print out tomcat statistics.
10977
10978 @item -mcpu=@var{cpu}
10979 @opindex mcpu
10980
10981 Select the processor type for which to generate code.  Possible values are
10982 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
10983 @samp{frv}.
10984
10985 @end table
10986
10987 @node Xtensa Options
10988 @subsection Xtensa Options
10989 @cindex Xtensa Options
10990
10991 These options are supported for Xtensa targets:
10992
10993 @table @gcctabopt
10994 @item -mconst16
10995 @itemx -mno-const16
10996 @opindex mconst16
10997 @opindex mno-const16
10998 Enable or disable use of @code{CONST16} instructions for loading
10999 constant values.  The @code{CONST16} instruction is currently not a
11000 standard option from Tensilica.  When enabled, @code{CONST16}
11001 instructions are always used in place of the standard @code{L32R}
11002 instructions.  The use of @code{CONST16} is enabled by default only if
11003 the @code{L32R} instruction is not available.
11004
11005 @item -mfused-madd
11006 @itemx -mno-fused-madd
11007 @opindex mfused-madd
11008 @opindex mno-fused-madd
11009 Enable or disable use of fused multiply/add and multiply/subtract
11010 instructions in the floating-point option.  This has no effect if the
11011 floating-point option is not also enabled.  Disabling fused multiply/add
11012 and multiply/subtract instructions forces the compiler to use separate
11013 instructions for the multiply and add/subtract operations.  This may be
11014 desirable in some cases where strict IEEE 754-compliant results are
11015 required: the fused multiply add/subtract instructions do not round the
11016 intermediate result, thereby producing results with @emph{more} bits of
11017 precision than specified by the IEEE standard.  Disabling fused multiply
11018 add/subtract instructions also ensures that the program output is not
11019 sensitive to the compiler's ability to combine multiply and add/subtract
11020 operations.
11021
11022 @item -mtext-section-literals
11023 @itemx -mno-text-section-literals
11024 @opindex mtext-section-literals
11025 @opindex mno-text-section-literals
11026 Control the treatment of literal pools.  The default is
11027 @option{-mno-text-section-literals}, which places literals in a separate
11028 section in the output file.  This allows the literal pool to be placed
11029 in a data RAM/ROM, and it also allows the linker to combine literal
11030 pools from separate object files to remove redundant literals and
11031 improve code size.  With @option{-mtext-section-literals}, the literals
11032 are interspersed in the text section in order to keep them as close as
11033 possible to their references.  This may be necessary for large assembly
11034 files.
11035
11036 @item -mtarget-align
11037 @itemx -mno-target-align
11038 @opindex mtarget-align
11039 @opindex mno-target-align
11040 When this option is enabled, GCC instructs the assembler to
11041 automatically align instructions to reduce branch penalties at the
11042 expense of some code density.  The assembler attempts to widen density
11043 instructions to align branch targets and the instructions following call
11044 instructions.  If there are not enough preceding safe density
11045 instructions to align a target, no widening will be performed.  The
11046 default is @option{-mtarget-align}.  These options do not affect the
11047 treatment of auto-aligned instructions like @code{LOOP}, which the
11048 assembler will always align, either by widening density instructions or
11049 by inserting no-op instructions.
11050
11051 @item -mlongcalls
11052 @itemx -mno-longcalls
11053 @opindex mlongcalls
11054 @opindex mno-longcalls
11055 When this option is enabled, GCC instructs the assembler to translate
11056 direct calls to indirect calls unless it can determine that the target
11057 of a direct call is in the range allowed by the call instruction.  This
11058 translation typically occurs for calls to functions in other source
11059 files.  Specifically, the assembler translates a direct @code{CALL}
11060 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
11061 The default is @option{-mno-longcalls}.  This option should be used in
11062 programs where the call target can potentially be out of range.  This
11063 option is implemented in the assembler, not the compiler, so the
11064 assembly code generated by GCC will still show direct call
11065 instructions---look at the disassembled object code to see the actual
11066 instructions.  Note that the assembler will use an indirect call for
11067 every cross-file call, not just those that really will be out of range.
11068 @end table
11069
11070 @node Code Gen Options
11071 @section Options for Code Generation Conventions
11072 @cindex code generation conventions
11073 @cindex options, code generation
11074 @cindex run-time options
11075
11076 These machine-independent options control the interface conventions
11077 used in code generation.
11078
11079 Most of them have both positive and negative forms; the negative form
11080 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
11081 one of the forms is listed---the one which is not the default.  You
11082 can figure out the other form by either removing @samp{no-} or adding
11083 it.
11084
11085 @table @gcctabopt
11086 @item -fbounds-check
11087 @opindex fbounds-check
11088 For front-ends that support it, generate additional code to check that
11089 indices used to access arrays are within the declared range.  This is
11090 currently only supported by the Java and Fortran 77 front-ends, where
11091 this option defaults to true and false respectively.
11092
11093 @item -ftrapv
11094 @opindex ftrapv
11095 This option generates traps for signed overflow on addition, subtraction,
11096 multiplication operations.
11097
11098 @item -fwrapv
11099 @opindex fwrapv
11100 This option instructs the compiler to assume that signed arithmetic
11101 overflow of addition, subtraction and multiplication wraps around
11102 using twos-complement representation.  This flag enables some optimizations
11103 and disables other.  This option is enabled by default for the Java
11104 front-end, as required by the Java language specification.
11105
11106 @item -fexceptions
11107 @opindex fexceptions
11108 Enable exception handling.  Generates extra code needed to propagate
11109 exceptions.  For some targets, this implies GCC will generate frame
11110 unwind information for all functions, which can produce significant data
11111 size overhead, although it does not affect execution.  If you do not
11112 specify this option, GCC will enable it by default for languages like
11113 C++ which normally require exception handling, and disable it for
11114 languages like C that do not normally require it.  However, you may need
11115 to enable this option when compiling C code that needs to interoperate
11116 properly with exception handlers written in C++.  You may also wish to
11117 disable this option if you are compiling older C++ programs that don't
11118 use exception handling.
11119
11120 @item -fnon-call-exceptions
11121 @opindex fnon-call-exceptions
11122 Generate code that allows trapping instructions to throw exceptions.
11123 Note that this requires platform-specific runtime support that does
11124 not exist everywhere.  Moreover, it only allows @emph{trapping}
11125 instructions to throw exceptions, i.e.@: memory references or floating
11126 point instructions.  It does not allow exceptions to be thrown from
11127 arbitrary signal handlers such as @code{SIGALRM}.
11128
11129 @item -funwind-tables
11130 @opindex funwind-tables
11131 Similar to @option{-fexceptions}, except that it will just generate any needed
11132 static data, but will not affect the generated code in any other way.
11133 You will normally not enable this option; instead, a language processor
11134 that needs this handling would enable it on your behalf.
11135
11136 @item -fasynchronous-unwind-tables
11137 @opindex funwind-tables
11138 Generate unwind table in dwarf2 format, if supported by target machine.  The
11139 table is exact at each instruction boundary, so it can be used for stack
11140 unwinding from asynchronous events (such as debugger or garbage collector).
11141
11142 @item -fpcc-struct-return
11143 @opindex fpcc-struct-return
11144 Return ``short'' @code{struct} and @code{union} values in memory like
11145 longer ones, rather than in registers.  This convention is less
11146 efficient, but it has the advantage of allowing intercallability between
11147 GCC-compiled files and files compiled with other compilers, particularly
11148 the Portable C Compiler (pcc).
11149
11150 The precise convention for returning structures in memory depends
11151 on the target configuration macros.
11152
11153 Short structures and unions are those whose size and alignment match
11154 that of some integer type.
11155
11156 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11157 switch is not binary compatible with code compiled with the
11158 @option{-freg-struct-return} switch.
11159 Use it to conform to a non-default application binary interface.
11160
11161 @item -freg-struct-return
11162 @opindex freg-struct-return
11163 Return @code{struct} and @code{union} values in registers when possible.
11164 This is more efficient for small structures than
11165 @option{-fpcc-struct-return}.
11166
11167 If you specify neither @option{-fpcc-struct-return} nor
11168 @option{-freg-struct-return}, GCC defaults to whichever convention is
11169 standard for the target.  If there is no standard convention, GCC
11170 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11171 the principal compiler.  In those cases, we can choose the standard, and
11172 we chose the more efficient register return alternative.
11173
11174 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11175 switch is not binary compatible with code compiled with the
11176 @option{-fpcc-struct-return} switch.
11177 Use it to conform to a non-default application binary interface.
11178
11179 @item -fshort-enums
11180 @opindex fshort-enums
11181 Allocate to an @code{enum} type only as many bytes as it needs for the
11182 declared range of possible values.  Specifically, the @code{enum} type
11183 will be equivalent to the smallest integer type which has enough room.
11184
11185 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11186 code that is not binary compatible with code generated without that switch.
11187 Use it to conform to a non-default application binary interface.
11188
11189 @item -fshort-double
11190 @opindex fshort-double
11191 Use the same size for @code{double} as for @code{float}.
11192
11193 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
11194 code that is not binary compatible with code generated without that switch.
11195 Use it to conform to a non-default application binary interface.
11196
11197 @item -fshort-wchar
11198 @opindex fshort-wchar
11199 Override the underlying type for @samp{wchar_t} to be @samp{short
11200 unsigned int} instead of the default for the target.  This option is
11201 useful for building programs to run under WINE@.
11202
11203 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11204 code that is not binary compatible with code generated without that switch.
11205 Use it to conform to a non-default application binary interface.
11206
11207 @item -fshared-data
11208 @opindex fshared-data
11209 Requests that the data and non-@code{const} variables of this
11210 compilation be shared data rather than private data.  The distinction
11211 makes sense only on certain operating systems, where shared data is
11212 shared between processes running the same program, while private data
11213 exists in one copy per process.
11214
11215 @item -fno-common
11216 @opindex fno-common
11217 In C, allocate even uninitialized global variables in the data section of the
11218 object file, rather than generating them as common blocks.  This has the
11219 effect that if the same variable is declared (without @code{extern}) in
11220 two different compilations, you will get an error when you link them.
11221 The only reason this might be useful is if you wish to verify that the
11222 program will work on other systems which always work this way.
11223
11224 @item -fno-ident
11225 @opindex fno-ident
11226 Ignore the @samp{#ident} directive.
11227
11228 @item -fno-gnu-linker
11229 @opindex fno-gnu-linker
11230 Do not output global initializations (such as C++ constructors and
11231 destructors) in the form used by the GNU linker (on systems where the GNU
11232 linker is the standard method of handling them).  Use this option when
11233 you want to use a non-GNU linker, which also requires using the
11234 @command{collect2} program to make sure the system linker includes
11235 constructors and destructors.  (@command{collect2} is included in the GCC
11236 distribution.)  For systems which @emph{must} use @command{collect2}, the
11237 compiler driver @command{gcc} is configured to do this automatically.
11238
11239 @item -finhibit-size-directive
11240 @opindex finhibit-size-directive
11241 Don't output a @code{.size} assembler directive, or anything else that
11242 would cause trouble if the function is split in the middle, and the
11243 two halves are placed at locations far apart in memory.  This option is
11244 used when compiling @file{crtstuff.c}; you should not need to use it
11245 for anything else.
11246
11247 @item -fverbose-asm
11248 @opindex fverbose-asm
11249 Put extra commentary information in the generated assembly code to
11250 make it more readable.  This option is generally only of use to those
11251 who actually need to read the generated assembly code (perhaps while
11252 debugging the compiler itself).
11253
11254 @option{-fno-verbose-asm}, the default, causes the
11255 extra information to be omitted and is useful when comparing two assembler
11256 files.
11257
11258 @item -fpic
11259 @opindex fpic
11260 @cindex global offset table
11261 @cindex PIC
11262 Generate position-independent code (PIC) suitable for use in a shared
11263 library, if supported for the target machine.  Such code accesses all
11264 constant addresses through a global offset table (GOT)@.  The dynamic
11265 loader resolves the GOT entries when the program starts (the dynamic
11266 loader is not part of GCC; it is part of the operating system).  If
11267 the GOT size for the linked executable exceeds a machine-specific
11268 maximum size, you get an error message from the linker indicating that
11269 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11270 instead.  (These maximums are 16k on the m88k, 8k on the SPARC, and 32k
11271 on the m68k and RS/6000.  The 386 has no such limit.)
11272
11273 Position-independent code requires special support, and therefore works
11274 only on certain machines.  For the 386, GCC supports PIC for System V
11275 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
11276 position-independent.
11277
11278 @item -fPIC
11279 @opindex fPIC
11280 If supported for the target machine, emit position-independent code,
11281 suitable for dynamic linking and avoiding any limit on the size of the
11282 global offset table.  This option makes a difference on the m68k, m88k,
11283 and the SPARC.
11284
11285 Position-independent code requires special support, and therefore works
11286 only on certain machines.
11287
11288 @item -fpie
11289 @itemx -fPIE
11290 @opindex fpie
11291 @opindex fPIE
11292 These options are similar to @option{-fpic} and @option{-fPIC}, but
11293 generated position independent code can be only linked into executables.
11294 Usually these options are used when @option{-pie} GCC option will be
11295 used during linking.
11296
11297 @item -ffixed-@var{reg}
11298 @opindex ffixed
11299 Treat the register named @var{reg} as a fixed register; generated code
11300 should never refer to it (except perhaps as a stack pointer, frame
11301 pointer or in some other fixed role).
11302
11303 @var{reg} must be the name of a register.  The register names accepted
11304 are machine-specific and are defined in the @code{REGISTER_NAMES}
11305 macro in the machine description macro file.
11306
11307 This flag does not have a negative form, because it specifies a
11308 three-way choice.
11309
11310 @item -fcall-used-@var{reg}
11311 @opindex fcall-used
11312 Treat the register named @var{reg} as an allocable register that is
11313 clobbered by function calls.  It may be allocated for temporaries or
11314 variables that do not live across a call.  Functions compiled this way
11315 will not save and restore the register @var{reg}.
11316
11317 It is an error to used this flag with the frame pointer or stack pointer.
11318 Use of this flag for other registers that have fixed pervasive roles in
11319 the machine's execution model will produce disastrous results.
11320
11321 This flag does not have a negative form, because it specifies a
11322 three-way choice.
11323
11324 @item -fcall-saved-@var{reg}
11325 @opindex fcall-saved
11326 Treat the register named @var{reg} as an allocable register saved by
11327 functions.  It may be allocated even for temporaries or variables that
11328 live across a call.  Functions compiled this way will save and restore
11329 the register @var{reg} if they use it.
11330
11331 It is an error to used this flag with the frame pointer or stack pointer.
11332 Use of this flag for other registers that have fixed pervasive roles in
11333 the machine's execution model will produce disastrous results.
11334
11335 A different sort of disaster will result from the use of this flag for
11336 a register in which function values may be returned.
11337
11338 This flag does not have a negative form, because it specifies a
11339 three-way choice.
11340
11341 @item -fpack-struct
11342 @opindex fpack-struct
11343 Pack all structure members together without holes.
11344
11345 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11346 code that is not binary compatible with code generated without that switch.
11347 Additionally, it makes the code suboptimal.
11348 Use it to conform to a non-default application binary interface.
11349
11350 @item -finstrument-functions
11351 @opindex finstrument-functions
11352 Generate instrumentation calls for entry and exit to functions.  Just
11353 after function entry and just before function exit, the following
11354 profiling functions will be called with the address of the current
11355 function and its call site.  (On some platforms,
11356 @code{__builtin_return_address} does not work beyond the current
11357 function, so the call site information may not be available to the
11358 profiling functions otherwise.)
11359
11360 @example
11361 void __cyg_profile_func_enter (void *this_fn,
11362                                void *call_site);
11363 void __cyg_profile_func_exit  (void *this_fn,
11364                                void *call_site);
11365 @end example
11366
11367 The first argument is the address of the start of the current function,
11368 which may be looked up exactly in the symbol table.
11369
11370 This instrumentation is also done for functions expanded inline in other
11371 functions.  The profiling calls will indicate where, conceptually, the
11372 inline function is entered and exited.  This means that addressable
11373 versions of such functions must be available.  If all your uses of a
11374 function are expanded inline, this may mean an additional expansion of
11375 code size.  If you use @samp{extern inline} in your C code, an
11376 addressable version of such functions must be provided.  (This is
11377 normally the case anyways, but if you get lucky and the optimizer always
11378 expands the functions inline, you might have gotten away without
11379 providing static copies.)
11380
11381 A function may be given the attribute @code{no_instrument_function}, in
11382 which case this instrumentation will not be done.  This can be used, for
11383 example, for the profiling functions listed above, high-priority
11384 interrupt routines, and any functions from which the profiling functions
11385 cannot safely be called (perhaps signal handlers, if the profiling
11386 routines generate output or allocate memory).
11387
11388 @item -fstack-check
11389 @opindex fstack-check
11390 Generate code to verify that you do not go beyond the boundary of the
11391 stack.  You should specify this flag if you are running in an
11392 environment with multiple threads, but only rarely need to specify it in
11393 a single-threaded environment since stack overflow is automatically
11394 detected on nearly all systems if there is only one stack.
11395
11396 Note that this switch does not actually cause checking to be done; the
11397 operating system must do that.  The switch causes generation of code
11398 to ensure that the operating system sees the stack being extended.
11399
11400 @item -fstack-limit-register=@var{reg}
11401 @itemx -fstack-limit-symbol=@var{sym}
11402 @itemx -fno-stack-limit
11403 @opindex fstack-limit-register
11404 @opindex fstack-limit-symbol
11405 @opindex fno-stack-limit
11406 Generate code to ensure that the stack does not grow beyond a certain value,
11407 either the value of a register or the address of a symbol.  If the stack
11408 would grow beyond the value, a signal is raised.  For most targets,
11409 the signal is raised before the stack overruns the boundary, so
11410 it is possible to catch the signal without taking special precautions.
11411
11412 For instance, if the stack starts at absolute address @samp{0x80000000}
11413 and grows downwards, you can use the flags
11414 @option{-fstack-limit-symbol=__stack_limit} and
11415 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11416 of 128KB@.  Note that this may only work with the GNU linker.
11417
11418 @cindex aliasing of parameters
11419 @cindex parameters, aliased
11420 @item -fargument-alias
11421 @itemx -fargument-noalias
11422 @itemx -fargument-noalias-global
11423 @opindex fargument-alias
11424 @opindex fargument-noalias
11425 @opindex fargument-noalias-global
11426 Specify the possible relationships among parameters and between
11427 parameters and global data.
11428
11429 @option{-fargument-alias} specifies that arguments (parameters) may
11430 alias each other and may alias global storage.@*
11431 @option{-fargument-noalias} specifies that arguments do not alias
11432 each other, but may alias global storage.@*
11433 @option{-fargument-noalias-global} specifies that arguments do not
11434 alias each other and do not alias global storage.
11435
11436 Each language will automatically use whatever option is required by
11437 the language standard.  You should not need to use these options yourself.
11438
11439 @item -fleading-underscore
11440 @opindex fleading-underscore
11441 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11442 change the way C symbols are represented in the object file.  One use
11443 is to help link with legacy assembly code.
11444
11445 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11446 generate code that is not binary compatible with code generated without that
11447 switch.  Use it to conform to a non-default application binary interface.
11448 Not all targets provide complete support for this switch.
11449
11450 @item -ftls-model=@var{model}
11451 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11452 The @var{model} argument should be one of @code{global-dynamic},
11453 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11454
11455 The default without @option{-fpic} is @code{initial-exec}; with
11456 @option{-fpic} the default is @code{global-dynamic}.
11457 @end table
11458
11459 @c man end
11460
11461 @node Environment Variables
11462 @section Environment Variables Affecting GCC
11463 @cindex environment variables
11464
11465 @c man begin ENVIRONMENT
11466 This section describes several environment variables that affect how GCC
11467 operates.  Some of them work by specifying directories or prefixes to use
11468 when searching for various kinds of files.  Some are used to specify other
11469 aspects of the compilation environment.
11470
11471 Note that you can also specify places to search using options such as
11472 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
11473 take precedence over places specified using environment variables, which
11474 in turn take precedence over those specified by the configuration of GCC@.
11475 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11476 GNU Compiler Collection (GCC) Internals}.
11477
11478 @table @env
11479 @item LANG
11480 @itemx LC_CTYPE
11481 @c @itemx LC_COLLATE
11482 @itemx LC_MESSAGES
11483 @c @itemx LC_MONETARY
11484 @c @itemx LC_NUMERIC
11485 @c @itemx LC_TIME
11486 @itemx LC_ALL
11487 @findex LANG
11488 @findex LC_CTYPE
11489 @c @findex LC_COLLATE
11490 @findex LC_MESSAGES
11491 @c @findex LC_MONETARY
11492 @c @findex LC_NUMERIC
11493 @c @findex LC_TIME
11494 @findex LC_ALL
11495 @cindex locale
11496 These environment variables control the way that GCC uses
11497 localization information that allow GCC to work with different
11498 national conventions.  GCC inspects the locale categories
11499 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
11500 so.  These locale categories can be set to any value supported by your
11501 installation.  A typical value is @samp{en_UK} for English in the United
11502 Kingdom.
11503
11504 The @env{LC_CTYPE} environment variable specifies character
11505 classification.  GCC uses it to determine the character boundaries in
11506 a string; this is needed for some multibyte encodings that contain quote
11507 and escape characters that would otherwise be interpreted as a string
11508 end or escape.
11509
11510 The @env{LC_MESSAGES} environment variable specifies the language to
11511 use in diagnostic messages.
11512
11513 If the @env{LC_ALL} environment variable is set, it overrides the value
11514 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11515 and @env{LC_MESSAGES} default to the value of the @env{LANG}
11516 environment variable.  If none of these variables are set, GCC
11517 defaults to traditional C English behavior.
11518
11519 @item TMPDIR
11520 @findex TMPDIR
11521 If @env{TMPDIR} is set, it specifies the directory to use for temporary
11522 files.  GCC uses temporary files to hold the output of one stage of
11523 compilation which is to be used as input to the next stage: for example,
11524 the output of the preprocessor, which is the input to the compiler
11525 proper.
11526
11527 @item GCC_EXEC_PREFIX
11528 @findex GCC_EXEC_PREFIX
11529 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
11530 names of the subprograms executed by the compiler.  No slash is added
11531 when this prefix is combined with the name of a subprogram, but you can
11532 specify a prefix that ends with a slash if you wish.
11533
11534 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
11535 an appropriate prefix to use based on the pathname it was invoked with.
11536
11537 If GCC cannot find the subprogram using the specified prefix, it
11538 tries looking in the usual places for the subprogram.
11539
11540 The default value of @env{GCC_EXEC_PREFIX} is
11541 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
11542 of @code{prefix} when you ran the @file{configure} script.
11543
11544 Other prefixes specified with @option{-B} take precedence over this prefix.
11545
11546 This prefix is also used for finding files such as @file{crt0.o} that are
11547 used for linking.
11548
11549 In addition, the prefix is used in an unusual way in finding the
11550 directories to search for header files.  For each of the standard
11551 directories whose name normally begins with @samp{/usr/local/lib/gcc}
11552 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
11553 replacing that beginning with the specified prefix to produce an
11554 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
11555 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
11556 These alternate directories are searched first; the standard directories
11557 come next.
11558
11559 @item COMPILER_PATH
11560 @findex COMPILER_PATH
11561 The value of @env{COMPILER_PATH} is a colon-separated list of
11562 directories, much like @env{PATH}.  GCC tries the directories thus
11563 specified when searching for subprograms, if it can't find the
11564 subprograms using @env{GCC_EXEC_PREFIX}.
11565
11566 @item LIBRARY_PATH
11567 @findex LIBRARY_PATH
11568 The value of @env{LIBRARY_PATH} is a colon-separated list of
11569 directories, much like @env{PATH}.  When configured as a native compiler,
11570 GCC tries the directories thus specified when searching for special
11571 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
11572 using GCC also uses these directories when searching for ordinary
11573 libraries for the @option{-l} option (but directories specified with
11574 @option{-L} come first).
11575
11576 @item LANG
11577 @findex LANG
11578 @cindex locale definition
11579 This variable is used to pass locale information to the compiler.  One way in
11580 which this information is used is to determine the character set to be used
11581 when character literals, string literals and comments are parsed in C and C++.
11582 When the compiler is configured to allow multibyte characters,
11583 the following values for @env{LANG} are recognized:
11584
11585 @table @samp
11586 @item C-JIS
11587 Recognize JIS characters.
11588 @item C-SJIS
11589 Recognize SJIS characters.
11590 @item C-EUCJP
11591 Recognize EUCJP characters.
11592 @end table
11593
11594 If @env{LANG} is not defined, or if it has some other value, then the
11595 compiler will use mblen and mbtowc as defined by the default locale to
11596 recognize and translate multibyte characters.
11597 @end table
11598
11599 @noindent
11600 Some additional environments variables affect the behavior of the
11601 preprocessor.
11602
11603 @include cppenv.texi
11604
11605 @c man end
11606
11607 @node Precompiled Headers
11608 @section Using Precompiled Headers
11609 @cindex precompiled headers
11610 @cindex speed of compilation
11611
11612 Often large projects have many header files that are included in every
11613 source file.  The time the compiler takes to process these header files
11614 over and over again can account for nearly all of the time required to
11615 build the project.  To make builds faster, GCC allows users to
11616 `precompile' a header file; then, if builds can use the precompiled
11617 header file they will be much faster.
11618
11619 To create a precompiled header file, simply compile it as you would any
11620 other file, if necessary using the @option{-x} option to make the driver
11621 treat it as a C or C++ header file.  You will probably want to use a
11622 tool like @command{make} to keep the precompiled header up-to-date when
11623 the headers it contains change.
11624
11625 A precompiled header file will be searched for when @code{#include} is
11626 seen in the compilation.  As it searches for the included file
11627 (@pxref{Search Path,,Search Path,cpp.info,The C Preprocessor}) the
11628 compiler looks for a precompiled header in each directory just before it
11629 looks for the include file in that directory.  The name searched for is
11630 the name specified in the @code{#include} with @samp{.gch} appended.  If
11631 the precompiled header file can't be used, it is ignored.
11632
11633 For instance, if you have @code{#include "all.h"}, and you have
11634 @file{all.h.gch} in the same directory as @file{all.h}, then the
11635 precompiled header file will be used if possible, and the original
11636 header will be used otherwise.
11637
11638 Alternatively, you might decide to put the precompiled header file in a
11639 directory and use @option{-I} to ensure that directory is searched
11640 before (or instead of) the directory containing the original header.
11641 Then, if you want to check that the precompiled header file is always
11642 used, you can put a file of the same name as the original header in this
11643 directory containing an @code{#error} command.
11644
11645 This also works with @option{-include}.  So yet another way to use
11646 precompiled headers, good for projects not designed with precompiled
11647 header files in mind, is to simply take most of the header files used by
11648 a project, include them from another header file, precompile that header
11649 file, and @option{-include} the precompiled header.  If the header files
11650 have guards against multiple inclusion, they will be skipped because
11651 they've already been included (in the precompiled header).
11652
11653 If you need to precompile the same header file for different
11654 languages, targets, or compiler options, you can instead make a
11655 @emph{directory} named like @file{all.h.gch}, and put each precompiled
11656 header in the directory.  (It doesn't matter what you call the files
11657 in the directory, every precompiled header in the directory will be
11658 considered.)  The first precompiled header encountered in the
11659 directory that is valid for this compilation will be used; they're
11660 searched in no particular order.
11661
11662 There are many other possibilities, limited only by your imagination,
11663 good sense, and the constraints of your build system.
11664
11665 A precompiled header file can be used only when these conditions apply:
11666
11667 @itemize
11668 @item
11669 Only one precompiled header can be used in a particular compilation.
11670 @item
11671 A precompiled header can't be used once the first C token is seen.  You
11672 can have preprocessor directives before a precompiled header; you can
11673 even include a precompiled header from inside another header, so long as
11674 there are no C tokens before the @code{#include}.
11675 @item
11676 The precompiled header file must be produced for the same language as
11677 the current compilation.  You can't use a C precompiled header for a C++
11678 compilation.
11679 @item
11680 The precompiled header file must be produced by the same compiler
11681 version and configuration as the current compilation is using.
11682 The easiest way to guarantee this is to use the same compiler binary
11683 for creating and using precompiled headers.
11684 @item
11685 Any macros defined before the precompiled header (including with
11686 @option{-D}) must either be defined in the same way as when the
11687 precompiled header was generated, or must not affect the precompiled
11688 header, which usually means that the they don't appear in the
11689 precompiled header at all.
11690 @item
11691 Certain command-line options must be defined in the same way as when the
11692 precompiled header was generated.  At present, it's not clear which
11693 options are safe to change and which are not; the safest choice is to
11694 use exactly the same options when generating and using the precompiled
11695 header.
11696 @end itemize
11697
11698 For all of these but the last, the compiler will automatically ignore
11699 the precompiled header if the conditions aren't met.  For the last item,
11700 some option changes will cause the precompiled header to be rejected,
11701 but not all incompatible option combinations have yet been found.  If
11702 you find a new incompatible combination, please consider filing a bug
11703 report, see @ref{Bugs}.
11704
11705 @node Running Protoize
11706 @section Running Protoize
11707
11708 The program @code{protoize} is an optional part of GCC@.  You can use
11709 it to add prototypes to a program, thus converting the program to ISO
11710 C in one respect.  The companion program @code{unprotoize} does the
11711 reverse: it removes argument types from any prototypes that are found.
11712
11713 When you run these programs, you must specify a set of source files as
11714 command line arguments.  The conversion programs start out by compiling
11715 these files to see what functions they define.  The information gathered
11716 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
11717
11718 After scanning comes actual conversion.  The specified files are all
11719 eligible to be converted; any files they include (whether sources or
11720 just headers) are eligible as well.
11721
11722 But not all the eligible files are converted.  By default,
11723 @code{protoize} and @code{unprotoize} convert only source and header
11724 files in the current directory.  You can specify additional directories
11725 whose files should be converted with the @option{-d @var{directory}}
11726 option.  You can also specify particular files to exclude with the
11727 @option{-x @var{file}} option.  A file is converted if it is eligible, its
11728 directory name matches one of the specified directory names, and its
11729 name within the directory has not been excluded.
11730
11731 Basic conversion with @code{protoize} consists of rewriting most
11732 function definitions and function declarations to specify the types of
11733 the arguments.  The only ones not rewritten are those for varargs
11734 functions.
11735
11736 @code{protoize} optionally inserts prototype declarations at the
11737 beginning of the source file, to make them available for any calls that
11738 precede the function's definition.  Or it can insert prototype
11739 declarations with block scope in the blocks where undeclared functions
11740 are called.
11741
11742 Basic conversion with @code{unprotoize} consists of rewriting most
11743 function declarations to remove any argument types, and rewriting
11744 function definitions to the old-style pre-ISO form.
11745
11746 Both conversion programs print a warning for any function declaration or
11747 definition that they can't convert.  You can suppress these warnings
11748 with @option{-q}.
11749
11750 The output from @code{protoize} or @code{unprotoize} replaces the
11751 original source file.  The original file is renamed to a name ending
11752 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
11753 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
11754 for DOS) file already exists, then the source file is simply discarded.
11755
11756 @code{protoize} and @code{unprotoize} both depend on GCC itself to
11757 scan the program and collect information about the functions it uses.
11758 So neither of these programs will work until GCC is installed.
11759
11760 Here is a table of the options you can use with @code{protoize} and
11761 @code{unprotoize}.  Each option works with both programs unless
11762 otherwise stated.
11763
11764 @table @code
11765 @item -B @var{directory}
11766 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
11767 usual directory (normally @file{/usr/local/lib}).  This file contains
11768 prototype information about standard system functions.  This option
11769 applies only to @code{protoize}.
11770
11771 @item -c @var{compilation-options}
11772 Use @var{compilation-options} as the options when running @command{gcc} to
11773 produce the @samp{.X} files.  The special option @option{-aux-info} is
11774 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
11775
11776 Note that the compilation options must be given as a single argument to
11777 @code{protoize} or @code{unprotoize}.  If you want to specify several
11778 @command{gcc} options, you must quote the entire set of compilation options
11779 to make them a single word in the shell.
11780
11781 There are certain @command{gcc} arguments that you cannot use, because they
11782 would produce the wrong kind of output.  These include @option{-g},
11783 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
11784 the @var{compilation-options}, they are ignored.
11785
11786 @item -C
11787 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
11788 systems) instead of @samp{.c}.  This is convenient if you are converting
11789 a C program to C++.  This option applies only to @code{protoize}.
11790
11791 @item -g
11792 Add explicit global declarations.  This means inserting explicit
11793 declarations at the beginning of each source file for each function
11794 that is called in the file and was not declared.  These declarations
11795 precede the first function definition that contains a call to an
11796 undeclared function.  This option applies only to @code{protoize}.
11797
11798 @item -i @var{string}
11799 Indent old-style parameter declarations with the string @var{string}.
11800 This option applies only to @code{protoize}.
11801
11802 @code{unprotoize} converts prototyped function definitions to old-style
11803 function definitions, where the arguments are declared between the
11804 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
11805 uses five spaces as the indentation.  If you want to indent with just
11806 one space instead, use @option{-i " "}.
11807
11808 @item -k
11809 Keep the @samp{.X} files.  Normally, they are deleted after conversion
11810 is finished.
11811
11812 @item -l
11813 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
11814 a prototype declaration for each function in each block which calls the
11815 function without any declaration.  This option applies only to
11816 @code{protoize}.
11817
11818 @item -n
11819 Make no real changes.  This mode just prints information about the conversions
11820 that would have been done without @option{-n}.
11821
11822 @item -N
11823 Make no @samp{.save} files.  The original files are simply deleted.
11824 Use this option with caution.
11825
11826 @item -p @var{program}
11827 Use the program @var{program} as the compiler.  Normally, the name
11828 @file{gcc} is used.
11829
11830 @item -q
11831 Work quietly.  Most warnings are suppressed.
11832
11833 @item -v
11834 Print the version number, just like @option{-v} for @command{gcc}.
11835 @end table
11836
11837 If you need special compiler options to compile one of your program's
11838 source files, then you should generate that file's @samp{.X} file
11839 specially, by running @command{gcc} on that source file with the
11840 appropriate options and the option @option{-aux-info}.  Then run
11841 @code{protoize} on the entire set of files.  @code{protoize} will use
11842 the existing @samp{.X} file because it is newer than the source file.
11843 For example:
11844
11845 @example
11846 gcc -Dfoo=bar file1.c -aux-info file1.X
11847 protoize *.c
11848 @end example
11849
11850 @noindent
11851 You need to include the special files along with the rest in the
11852 @code{protoize} command, even though their @samp{.X} files already
11853 exist, because otherwise they won't get converted.
11854
11855 @xref{Protoize Caveats}, for more information on how to use
11856 @code{protoize} successfully.