OSDN Git Service

* config/darwin.h (SUBTARGET_OPTIONS): Add -mmacosx= option.
[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, 2004 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, 2004 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 @gol
178 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
179 -fno-implicit-templates @gol
180 -fno-implicit-inline-templates @gol
181 -fno-implement-inlines  -fms-extensions @gol
182 -fno-nonansi-builtins  -fno-operator-names @gol
183 -fno-optional-diags  -fpermissive @gol
184 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
185 -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
186 -fno-default-inline  -Wabi  -Wctor-dtor-privacy @gol
187 -Wnon-virtual-dtor  -Wreorder @gol
188 -Weffc++  -Wno-deprecated @gol
189 -Wno-non-template-friend  -Wold-style-cast @gol
190 -Woverloaded-virtual  -Wno-pmf-conversions @gol
191 -Wsign-promo  -Wsynth}
192
193 @item Objective-C Language Options
194 @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
195 @gccoptlist{
196 -fconstant-string-class=@var{class-name} @gol
197 -fgnu-runtime  -fnext-runtime @gol
198 -fno-nil-receivers @gol
199 -fobjc-exceptions @gol
200 -freplace-objc-classes @gol
201 -fzero-link @gol
202 -gen-decls @gol
203 -Wno-protocol  -Wselector -Wundeclared-selector}
204
205 @item Language Independent Options
206 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
207 @gccoptlist{-fmessage-length=@var{n}  @gol
208 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
209
210 @item Warning Options
211 @xref{Warning Options,,Options to Request or Suppress Warnings}.
212 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
213 -w  -Wextra  -Wall  -Waggregate-return @gol
214 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
215 -Wconversion  -Wno-deprecated-declarations @gol
216 -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
217 -Werror  -Werror-implicit-function-declaration @gol
218 -Wfloat-equal  -Wformat  -Wformat=2 @gol
219 -Wno-format-extra-args -Wformat-nonliteral @gol
220 -Wformat-security  -Wformat-y2k @gol
221 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
222 -Wimport  -Wno-import  -Winit-self  -Winline @gol
223 -Wno-invalid-offsetof  -Winvalid-pch @gol
224 -Wlarger-than-@var{len}  -Wlong-long @gol
225 -Wmain  -Wmissing-braces @gol
226 -Wmissing-format-attribute  -Wmissing-noreturn @gol
227 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
228 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
229 -Wreturn-type  -Wsequence-point  -Wshadow @gol
230 -Wsign-compare  -Wstrict-aliasing @gol
231 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
232 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
233 -Wunknown-pragmas  -Wunreachable-code @gol
234 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
235 -Wunused-value  -Wunused-variable  -Wwrite-strings @gol
236 -Wvariadic-macros}
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 -fvar-tracking @gol
256 -g  -g@var{level}  -gcoff -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 -fvpt -fbranch-target-load-optimize @gol
268 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
269 -fcaller-saves  -fcprop-registers @gol
270 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
271 -fdelayed-branch  -fdelete-null-pointer-checks @gol
272 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
273 -fforce-addr  -fforce-mem  -ffunction-sections @gol
274 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -floop-optimize @gol
275 -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
276 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
277 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
278 -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
279 -fno-default-inline  -fno-defer-pop @gol
280 -fno-function-cse  -fno-guess-branch-probability @gol
281 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
282 -funsafe-math-optimizations  -ffinite-math-only @gol
283 -fno-trapping-math  -fno-zero-initialized-in-bss @gol
284 -fomit-frame-pointer  -foptimize-register-move @gol
285 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
286 -fprofile-generate -fprofile-use @gol
287 -freduce-all-givs  -fregmove  -frename-registers @gol
288 -freorder-blocks  -freorder-functions @gol
289 -frerun-cse-after-loop  -frerun-loop-opt @gol
290 -frounding-math -fschedule-insns  -fschedule-insns2 @gol
291 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
292 -fsched-spec-load-dangerous  @gol
293 -fsched-stalled-insns=@var{n} -sched-stalled-insns-dep=@var{n} @gol
294 -fsched2-use-superblocks @gol
295 -fsched2-use-traces  -fsignaling-nans @gol
296 -fsingle-precision-constant  @gol
297 -fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps @gol
298 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
299 -funswitch-loops  -fold-unroll-loops  -fold-unroll-all-loops @gol
300 --param @var{name}=@var{value}
301 -O  -O0  -O1  -O2  -O3  -Os}
302
303 @item Preprocessor Options
304 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
305 @gccoptlist{-A@var{question}=@var{answer} @gol
306 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
307 -C  -dD  -dI  -dM  -dN @gol
308 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
309 -idirafter @var{dir} @gol
310 -include @var{file}  -imacros @var{file} @gol
311 -iprefix @var{file}  -iwithprefix @var{dir} @gol
312 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
313 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
314 -P  -fworking-directory  -remap @gol
315 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
316 -Xpreprocessor @var{option}}
317
318 @item Assembler Option
319 @xref{Assembler Options,,Passing Options to the Assembler}.
320 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
321
322 @item Linker Options
323 @xref{Link Options,,Options for Linking}.
324 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
325 -nostartfiles  -nodefaultlibs  -nostdlib -pie @gol
326 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
327 -Wl,@var{option}  -Xlinker @var{option} @gol
328 -u @var{symbol}}
329
330 @item Directory Options
331 @xref{Directory Options,,Options for Directory Search}.
332 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}}
333
334 @item Target Options
335 @c I wrote this xref this way to avoid overfull hbox. -- rms
336 @xref{Target Options}.
337 @gccoptlist{-V @var{version}  -b @var{machine}}
338
339 @item Machine Dependent Options
340 @xref{Submodel Options,,Hardware Models and Configurations}.
341
342 @emph{M680x0 Options}
343 @gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
344 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
345 -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
346 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
347 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
348
349 @emph{M68hc1x Options}
350 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
351 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
352 -msoft-reg-count=@var{count}}
353
354 @emph{VAX Options}
355 @gccoptlist{-mg  -mgnu  -munix}
356
357 @emph{SPARC Options}
358 @gccoptlist{-mcpu=@var{cpu-type} @gol
359 -mtune=@var{cpu-type} @gol
360 -mcmodel=@var{code-model} @gol
361 -m32  -m64  -mapp-regs  -mno-app-regs @gol
362 -mfaster-structs  -mno-faster-structs @gol
363 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
364 -mhard-quad-float  -msoft-quad-float @gol
365 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
366 -mstack-bias  -mno-stack-bias @gol
367 -munaligned-doubles  -mno-unaligned-doubles @gol
368 -mv8plus  -mno-v8plus  -mvis  -mno-vis}
369
370 @emph{ARM Options}
371 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
372 -mapcs-26  -mapcs-32 @gol
373 -mapcs-stack-check  -mno-apcs-stack-check @gol
374 -mapcs-float  -mno-apcs-float @gol
375 -mapcs-reentrant  -mno-apcs-reentrant @gol
376 -msched-prolog  -mno-sched-prolog @gol
377 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
378 -malignment-traps  -mno-alignment-traps @gol
379 -mfloat-abi=@var{name}  soft-float  -mhard-float  -mfpe @gol
380 -mthumb-interwork  -mno-thumb-interwork @gol
381 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
382 -mstructure-size-boundary=@var{n} @gol
383 -mabort-on-noreturn @gol
384 -mlong-calls  -mno-long-calls @gol
385 -msingle-pic-base  -mno-single-pic-base @gol
386 -mpic-register=@var{reg} @gol
387 -mnop-fun-dllimport @gol
388 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
389 -mpoke-function-name @gol
390 -mthumb  -marm @gol
391 -mtpcs-frame  -mtpcs-leaf-frame @gol
392 -mcaller-super-interworking  -mcallee-super-interworking}
393
394 @emph{MN10300 Options}
395 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
396 -mam33  -mno-am33 @gol
397 -mam33-2  -mno-am33-2 @gol
398 -mno-crt0  -mrelax}
399
400 @emph{M32R/D Options}
401 @gccoptlist{-m32r2 -m32rx -m32r @gol
402 -mdebug @gol
403 -malign-loops -mno-align-loops @gol
404 -missue-rate=@var{number} @gol
405 -mbranch-cost=@var{number} @gol
406 -mmodel=@var{code-size-model-type} @gol
407 -msdata=@var{sdata-type} @gol
408 -mno-flush-func -mflush-func=@var{name} @gol
409 -mno-flush-trap -mflush-trap=@var{number} @gol
410 -G @var{num}}
411
412 @emph{RS/6000 and PowerPC Options}
413 @gccoptlist{-mcpu=@var{cpu-type} @gol
414 -mtune=@var{cpu-type} @gol
415 -mpower  -mno-power  -mpower2  -mno-power2 @gol
416 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
417 -maltivec  -mno-altivec @gol
418 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
419 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
420 -mnew-mnemonics  -mold-mnemonics @gol
421 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
422 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
423 -malign-power  -malign-natural @gol
424 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
425 -mstring  -mno-string  -mupdate  -mno-update @gol
426 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
427 -mstrict-align  -mno-strict-align  -mrelocatable @gol
428 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
429 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
430 -mdynamic-no-pic @gol
431 -mprioritize-restricted-insns=@var{priority} @gol
432 -msched-costly-dep=@var{dependence_type} @gol
433 -minsert-sched-nops=@var{scheme} @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 -mmacosx=@var{ver}}
466
467 @emph{MIPS Options}
468 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
469 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
470 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
471 -mxgot  -mno-xgot  -membedded-pic  -mno-embedded-pic @gol
472 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
473 -msingle-float  -mdouble-float  -mint64  -mlong64  -mlong32 @gol
474 -G@var{num}  -membedded-data  -mno-embedded-data @gol
475 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
476 -msplit-addresses  -mno-split-addresses  @gol
477 -mexplicit-relocs  -mno-explicit-relocs  @gol
478 -mrnames  -mno-rnames @gol
479 -mcheck-zero-division  -mno-check-zero-division @gol
480 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
481 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
482 -mfix-sb1  -mno-fix-sb1  -mflush-func=@var{func} @gol
483 -mno-flush-func  -mbranch-likely  -mno-branch-likely}
484
485 @emph{i386 and x86-64 Options}
486 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
487 -mfpmath=@var{unit} @gol
488 -masm=@var{dialect}  -mno-fancy-math-387 @gol
489 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
490 -mno-wide-multiply  -mrtd  -malign-double @gol
491 -mpreferred-stack-boundary=@var{num} @gol
492 -mmmx  -msse  -msse2 -mpni -m3dnow @gol
493 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
494 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
495 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
496 -mno-red-zone -mno-tls-direct-seg-refs @gol
497 -mcmodel=@var{code-model} @gol
498 -m32  -m64}
499
500 @emph{HPPA Options}
501 @gccoptlist{-march=@var{architecture-type} @gol
502 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
503 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
504 -mjump-in-delay -mlinker-opt -mlong-calls @gol
505 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
506 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
507 -mno-jump-in-delay  -mno-long-load-store @gol
508 -mno-portable-runtime  -mno-soft-float @gol
509 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
510 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
511 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
512 -nolibdld  -static  -threads}
513
514 @emph{DEC Alpha Options}
515 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
516 -mieee  -mieee-with-inexact  -mieee-conformant @gol
517 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
518 -mtrap-precision=@var{mode}  -mbuild-constants @gol
519 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
520 -mbwx  -mmax  -mfix  -mcix @gol
521 -mfloat-vax  -mfloat-ieee @gol
522 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
523 -msmall-text  -mlarge-text @gol
524 -mmemory-latency=@var{time}}
525
526 @emph{DEC Alpha/VMS Options}
527 @gccoptlist{-mvms-return-codes}
528
529 @emph{H8/300 Options}
530 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
531
532 @emph{SH Options}
533 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
534 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
535 -m5-64media  -m5-64media-nofpu @gol
536 -m5-32media  -m5-32media-nofpu @gol
537 -m5-compact  -m5-compact-nofpu @gol
538 -mb  -ml  -mdalign  -mrelax @gol
539 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
540 -mieee  -misize  -mpadstruct  -mspace @gol
541 -mprefergot  -musermode}
542
543 @emph{System V Options}
544 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
545
546 @emph{ARC Options}
547 @gccoptlist{-EB  -EL @gol
548 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
549 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
550
551 @emph{TMS320C3x/C4x Options}
552 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
553 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
554 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
555 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
556
557 @emph{V850 Options}
558 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
559 -mprolog-function  -mno-prolog-function  -mspace @gol
560 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
561 -mapp-regs  -mno-app-regs @gol
562 -mdisable-callt  -mno-disable-callt @gol
563 -mv850e1 @gol
564 -mv850e @gol
565 -mv850  -mbig-switch}
566
567 @emph{NS32K Options}
568 @gccoptlist{-m32032  -m32332  -m32532  -m32081  -m32381 @gol
569 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
570 -mregparam  -mnoregparam  -msb  -mnosb @gol
571 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
572
573 @emph{AVR Options}
574 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
575 -mcall-prologues  -mno-tablejump  -mtiny-stack}
576
577 @emph{MCore Options}
578 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
579 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
580 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
581 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
582 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
583
584 @emph{MMIX Options}
585 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
586 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
587 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
588 -mno-base-addresses  -msingle-exit  -mno-single-exit}
589
590 @emph{IA-64 Options}
591 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
592 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
593 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
594 -minline-float-divide-max-throughput @gol
595 -minline-int-divide-min-latency @gol
596 -minline-int-divide-max-throughput  -mno-dwarf2-asm @gol
597 -mfixed-range=@var{register-range}}
598
599 @emph{S/390 and zSeries Options}
600 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
601 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
602 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
603 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch  -mfused-madd  -mno-fused-madd}
604
605 @emph{CRIS Options}
606 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
607 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
608 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
609 -mstack-align  -mdata-align  -mconst-align @gol
610 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
611 -melf  -maout  -melinux  -mlinux  -sim  -sim2}
612
613 @emph{PDP-11 Options}
614 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
615 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
616 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
617 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
618 -mbranch-expensive  -mbranch-cheap @gol
619 -msplit  -mno-split  -munix-asm  -mdec-asm}
620
621 @emph{Xstormy16 Options}
622 @gccoptlist{-msim}
623
624 @emph{Xtensa Options}
625 @gccoptlist{-mconst16 -mno-const16 @gol
626 -mfused-madd  -mno-fused-madd @gol
627 -mtext-section-literals  -mno-text-section-literals @gol
628 -mtarget-align  -mno-target-align @gol
629 -mlongcalls  -mno-longcalls}
630
631 @emph{FRV Options}
632 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
633 -mhard-float  -msoft-float @gol
634 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
635 -mdouble  -mno-double @gol
636 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
637 -mlibrary-pic  -macc-4 -macc-8 @gol
638 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
639 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
640 -mvliw-branch  -mno-vliw-branch @gol
641 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
642 -mno-nested-cond-exec  -mtomcat-stats @gol
643 -mcpu=@var{cpu}}
644
645 @item Code Generation Options
646 @xref{Code Gen Options,,Options for Code Generation Conventions}.
647 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
648 -ffixed-@var{reg}  -fexceptions @gol
649 -fnon-call-exceptions  -funwind-tables @gol
650 -fasynchronous-unwind-tables @gol
651 -finhibit-size-directive  -finstrument-functions @gol
652 -fno-common  -fno-ident @gol
653 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
654 -freg-struct-return  -fshared-data  -fshort-enums @gol
655 -fshort-double  -fshort-wchar @gol
656 -fverbose-asm  -fpack-struct  -fstack-check @gol
657 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
658 -fargument-alias  -fargument-noalias @gol
659 -fargument-noalias-global  -fleading-underscore @gol
660 -ftls-model=@var{model} @gol
661 -ftrapv  -fwrapv  -fbounds-check}
662 @end table
663
664 @menu
665 * Overall Options::     Controlling the kind of output:
666                         an executable, object files, assembler files,
667                         or preprocessed source.
668 * C Dialect Options::   Controlling the variant of C language compiled.
669 * C++ Dialect Options:: Variations on C++.
670 * Objective-C Dialect Options:: Variations on Objective-C.
671 * Language Independent Options:: Controlling how diagnostics should be
672                         formatted.
673 * Warning Options::     How picky should the compiler be?
674 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
675 * Optimize Options::    How much optimization?
676 * Preprocessor Options:: Controlling header files and macro definitions.
677                          Also, getting dependency information for Make.
678 * Assembler Options::   Passing options to the assembler.
679 * Link Options::        Specifying libraries and so on.
680 * Directory Options::   Where to find header files and libraries.
681                         Where to find the compiler executable files.
682 * Spec Files::          How to pass switches to sub-processes.
683 * Target Options::      Running a cross-compiler, or an old version of GCC.
684 @end menu
685
686 @node Overall Options
687 @section Options Controlling the Kind of Output
688
689 Compilation can involve up to four stages: preprocessing, compilation
690 proper, assembly and linking, always in that order.  GCC is capable of
691 preprocessing and compiling several files either into several
692 assembler input files, or into one assembler input file; then each
693 assembler input file produces an object file, and linking combines all
694 the object files (those newly compiled, and those specified as input)
695 into an executable file.
696
697 @cindex file name suffix
698 For any given input file, the file name suffix determines what kind of
699 compilation is done:
700
701 @table @gcctabopt
702 @item @var{file}.c
703 C source code which must be preprocessed.
704
705 @item @var{file}.i
706 C source code which should not be preprocessed.
707
708 @item @var{file}.ii
709 C++ source code which should not be preprocessed.
710
711 @item @var{file}.m
712 Objective-C source code.  Note that you must link with the library
713 @file{libobjc.a} to make an Objective-C program work.
714
715 @item @var{file}.mi
716 Objective-C source code which should not be preprocessed.
717
718 @item @var{file}.h
719 C or C++ header file to be turned into a precompiled header.
720
721 @item @var{file}.cc
722 @itemx @var{file}.cp
723 @itemx @var{file}.cxx
724 @itemx @var{file}.cpp
725 @itemx @var{file}.CPP
726 @itemx @var{file}.c++
727 @itemx @var{file}.C
728 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
729 the last two letters must both be literally @samp{x}.  Likewise,
730 @samp{.C} refers to a literal capital C@.
731
732 @item @var{file}.hh
733 @itemx @var{file}.H
734 C++ header file to be turned into a precompiled header.
735
736 @item @var{file}.f
737 @itemx @var{file}.for
738 @itemx @var{file}.FOR
739 Fortran source code which should not be preprocessed.
740
741 @item @var{file}.F
742 @itemx @var{file}.fpp
743 @itemx @var{file}.FPP
744 Fortran source code which must be preprocessed (with the traditional
745 preprocessor).
746
747 @item @var{file}.r
748 Fortran source code which must be preprocessed with a RATFOR
749 preprocessor (not included with GCC)@.
750
751 @xref{Overall Options,,Options Controlling the Kind of Output, g77,
752 Using and Porting GNU Fortran}, for more details of the handling of
753 Fortran input files.
754
755 @c FIXME: Descriptions of Java file types.
756 @c @var{file}.java
757 @c @var{file}.class
758 @c @var{file}.zip
759 @c @var{file}.jar
760
761 @item @var{file}.ads
762 Ada source code file which contains a library unit declaration (a
763 declaration of a package, subprogram, or generic, or a generic
764 instantiation), or a library unit renaming declaration (a package,
765 generic, or subprogram renaming declaration).  Such files are also
766 called @dfn{specs}.
767
768 @itemx @var{file}.adb
769 Ada source code file containing a library unit body (a subprogram or
770 package body).  Such files are also called @dfn{bodies}.
771
772 @c GCC also knows about some suffixes for languages not yet included:
773 @c Pascal:
774 @c @var{file}.p
775 @c @var{file}.pas
776
777 @item @var{file}.s
778 Assembler code.
779
780 @item @var{file}.S
781 Assembler code which must be preprocessed.
782
783 @item @var{other}
784 An object file to be fed straight into linking.
785 Any file name with no recognized suffix is treated this way.
786 @end table
787
788 @opindex x
789 You can specify the input language explicitly with the @option{-x} option:
790
791 @table @gcctabopt
792 @item -x @var{language}
793 Specify explicitly the @var{language} for the following input files
794 (rather than letting the compiler choose a default based on the file
795 name suffix).  This option applies to all following input files until
796 the next @option{-x} option.  Possible values for @var{language} are:
797 @smallexample
798 c  c-header  cpp-output
799 c++  c++-header  c++-cpp-output
800 objective-c  objective-c-header  objc-cpp-output
801 assembler  assembler-with-cpp
802 ada
803 f77  f77-cpp-input  ratfor
804 java
805 treelang
806 @end smallexample
807
808 @item -x none
809 Turn off any specification of a language, so that subsequent files are
810 handled according to their file name suffixes (as they are if @option{-x}
811 has not been used at all).
812
813 @item -pass-exit-codes
814 @opindex pass-exit-codes
815 Normally the @command{gcc} program will exit with the code of 1 if any
816 phase of the compiler returns a non-success return code.  If you specify
817 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
818 numerically highest error produced by any phase that returned an error
819 indication.
820 @end table
821
822 If you only want some of the stages of compilation, you can use
823 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
824 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
825 @command{gcc} is to stop.  Note that some combinations (for example,
826 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
827
828 @table @gcctabopt
829 @item -c
830 @opindex c
831 Compile or assemble the source files, but do not link.  The linking
832 stage simply is not done.  The ultimate output is in the form of an
833 object file for each source file.
834
835 By default, the object file name for a source file is made by replacing
836 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
837
838 Unrecognized input files, not requiring compilation or assembly, are
839 ignored.
840
841 @item -S
842 @opindex S
843 Stop after the stage of compilation proper; do not assemble.  The output
844 is in the form of an assembler code file for each non-assembler input
845 file specified.
846
847 By default, the assembler file name for a source file is made by
848 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
849
850 Input files that don't require compilation are ignored.
851
852 @item -E
853 @opindex E
854 Stop after the preprocessing stage; do not run the compiler proper.  The
855 output is in the form of preprocessed source code, which is sent to the
856 standard output.
857
858 Input files which don't require preprocessing are ignored.
859
860 @cindex output file option
861 @item -o @var{file}
862 @opindex o
863 Place output in file @var{file}.  This applies regardless to whatever
864 sort of output is being produced, whether it be an executable file,
865 an object file, an assembler file or preprocessed C code.
866
867 If you specify @option{-o} when compiling more than one input file, or
868 you are producing an executable file as output, all the source files
869 on the command line will be compiled at once.
870
871 If @option{-o} is not specified, the default is to put an executable file
872 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
873 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
874 all preprocessed C source on standard output.
875
876 @item -v
877 @opindex v
878 Print (on standard error output) the commands executed to run the stages
879 of compilation.  Also print the version number of the compiler driver
880 program and of the preprocessor and the compiler proper.
881
882 @item -###
883 @opindex ###
884 Like @option{-v} except the commands are not executed and all command
885 arguments are quoted.  This is useful for shell scripts to capture the
886 driver-generated command lines.
887
888 @item -pipe
889 @opindex pipe
890 Use pipes rather than temporary files for communication between the
891 various stages of compilation.  This fails to work on some systems where
892 the assembler is unable to read from a pipe; but the GNU assembler has
893 no trouble.
894
895 @item --help
896 @opindex help
897 Print (on the standard output) a description of the command line options
898 understood by @command{gcc}.  If the @option{-v} option is also specified
899 then @option{--help} will also be passed on to the various processes
900 invoked by @command{gcc}, so that they can display the command line options
901 they accept.  If the @option{-Wextra} option is also specified then command
902 line options which have no documentation associated with them will also
903 be displayed.
904
905 @item --target-help
906 @opindex target-help
907 Print (on the standard output) a description of target specific command
908 line options for each tool.
909
910 @item --version
911 @opindex version
912 Display the version number and copyrights of the invoked GCC.
913 @end table
914
915 @node Invoking G++
916 @section Compiling C++ Programs
917
918 @cindex suffixes for C++ source
919 @cindex C++ source file suffixes
920 C++ source files conventionally use one of the suffixes @samp{.C},
921 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
922 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
923 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
924 files with these names and compiles them as C++ programs even if you
925 call the compiler the same way as for compiling C programs (usually
926 with the name @command{gcc}).
927
928 @findex g++
929 @findex c++
930 However, C++ programs often require class libraries as well as a
931 compiler that understands the C++ language---and under some
932 circumstances, you might want to compile programs or header files from
933 standard input, or otherwise without a suffix that flags them as C++
934 programs.  You might also like to precompile a C header file with a
935 @samp{.h} extension to be used in C++ compilations.  @command{g++} is a
936 program that calls GCC with the default language set to C++, and
937 automatically specifies linking against the C++ library.  On many
938 systems, @command{g++} is also installed with the name @command{c++}.
939
940 @cindex invoking @command{g++}
941 When you compile C++ programs, you may specify many of the same
942 command-line options that you use for compiling programs in any
943 language; or command-line options meaningful for C and related
944 languages; or options that are meaningful only for C++ programs.
945 @xref{C Dialect Options,,Options Controlling C Dialect}, for
946 explanations of options for languages related to C@.
947 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
948 explanations of options that are meaningful only for C++ programs.
949
950 @node C Dialect Options
951 @section Options Controlling C Dialect
952 @cindex dialect options
953 @cindex language dialect options
954 @cindex options, dialect
955
956 The following options control the dialect of C (or languages derived
957 from C, such as C++ and Objective-C) that the compiler accepts:
958
959 @table @gcctabopt
960 @cindex ANSI support
961 @cindex ISO support
962 @item -ansi
963 @opindex ansi
964 In C mode, support all ISO C90 programs.  In C++ mode,
965 remove GNU extensions that conflict with ISO C++.
966
967 This turns off certain features of GCC that are incompatible with ISO
968 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
969 such as the @code{asm} and @code{typeof} keywords, and
970 predefined macros such as @code{unix} and @code{vax} that identify the
971 type of system you are using.  It also enables the undesirable and
972 rarely used ISO trigraph feature.  For the C compiler,
973 it disables recognition of C++ style @samp{//} comments as well as
974 the @code{inline} keyword.
975
976 The alternate keywords @code{__asm__}, @code{__extension__},
977 @code{__inline__} and @code{__typeof__} continue to work despite
978 @option{-ansi}.  You would not want to use them in an ISO C program, of
979 course, but it is useful to put them in header files that might be included
980 in compilations done with @option{-ansi}.  Alternate predefined macros
981 such as @code{__unix__} and @code{__vax__} are also available, with or
982 without @option{-ansi}.
983
984 The @option{-ansi} option does not cause non-ISO programs to be
985 rejected gratuitously.  For that, @option{-pedantic} is required in
986 addition to @option{-ansi}.  @xref{Warning Options}.
987
988 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
989 option is used.  Some header files may notice this macro and refrain
990 from declaring certain functions or defining certain macros that the
991 ISO standard doesn't call for; this is to avoid interfering with any
992 programs that might use these names for other things.
993
994 Functions which would normally be built in but do not have semantics
995 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
996 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
997 built-in functions provided by GCC}, for details of the functions
998 affected.
999
1000 @item -std=
1001 @opindex std
1002 Determine the language standard.  This option is currently only
1003 supported when compiling C or C++.  A value for this option must be
1004 provided; possible values are
1005
1006 @table @samp
1007 @item c89
1008 @itemx iso9899:1990
1009 ISO C90 (same as @option{-ansi}).
1010
1011 @item iso9899:199409
1012 ISO C90 as modified in amendment 1.
1013
1014 @item c99
1015 @itemx c9x
1016 @itemx iso9899:1999
1017 @itemx iso9899:199x
1018 ISO C99.  Note that this standard is not yet fully supported; see
1019 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1020 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1021
1022 @item gnu89
1023 Default, ISO C90 plus GNU extensions (including some C99 features).
1024
1025 @item gnu99
1026 @itemx gnu9x
1027 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1028 this will become the default.  The name @samp{gnu9x} is deprecated.
1029
1030 @item c++98
1031 The 1998 ISO C++ standard plus amendments.
1032
1033 @item gnu++98
1034 The same as @option{-std=c++98} plus GNU extensions.  This is the
1035 default for C++ code.
1036 @end table
1037
1038 Even when this option is not specified, you can still use some of the
1039 features of newer standards in so far as they do not conflict with
1040 previous C standards.  For example, you may use @code{__restrict__} even
1041 when @option{-std=c99} is not specified.
1042
1043 The @option{-std} options specifying some version of ISO C have the same
1044 effects as @option{-ansi}, except that features that were not in ISO C90
1045 but are in the specified version (for example, @samp{//} comments and
1046 the @code{inline} keyword in ISO C99) are not disabled.
1047
1048 @xref{Standards,,Language Standards Supported by GCC}, for details of
1049 these standard versions.
1050
1051 @item -aux-info @var{filename}
1052 @opindex aux-info
1053 Output to the given filename prototyped declarations for all functions
1054 declared and/or defined in a translation unit, including those in header
1055 files.  This option is silently ignored in any language other than C@.
1056
1057 Besides declarations, the file indicates, in comments, the origin of
1058 each declaration (source file and line), whether the declaration was
1059 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1060 @samp{O} for old, respectively, in the first character after the line
1061 number and the colon), and whether it came from a declaration or a
1062 definition (@samp{C} or @samp{F}, respectively, in the following
1063 character).  In the case of function definitions, a K&R-style list of
1064 arguments followed by their declarations is also provided, inside
1065 comments, after the declaration.
1066
1067 @item -fno-asm
1068 @opindex fno-asm
1069 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1070 keyword, so that code can use these words as identifiers.  You can use
1071 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1072 instead.  @option{-ansi} implies @option{-fno-asm}.
1073
1074 In C++, this switch only affects the @code{typeof} keyword, since
1075 @code{asm} and @code{inline} are standard keywords.  You may want to
1076 use the @option{-fno-gnu-keywords} flag instead, which has the same
1077 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1078 switch only affects the @code{asm} and @code{typeof} keywords, since
1079 @code{inline} is a standard keyword in ISO C99.
1080
1081 @item -fno-builtin
1082 @itemx -fno-builtin-@var{function}
1083 @opindex fno-builtin
1084 @cindex built-in functions
1085 Don't recognize built-in functions that do not begin with
1086 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1087 functions provided by GCC}, for details of the functions affected,
1088 including those which are not built-in functions when @option{-ansi} or
1089 @option{-std} options for strict ISO C conformance are used because they
1090 do not have an ISO standard meaning.
1091
1092 GCC normally generates special code to handle certain built-in functions
1093 more efficiently; for instance, calls to @code{alloca} may become single
1094 instructions that adjust the stack directly, and calls to @code{memcpy}
1095 may become inline copy loops.  The resulting code is often both smaller
1096 and faster, but since the function calls no longer appear as such, you
1097 cannot set a breakpoint on those calls, nor can you change the behavior
1098 of the functions by linking with a different library.
1099
1100 With the @option{-fno-builtin-@var{function}} option
1101 only the built-in function @var{function} is
1102 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1103 function is named this is not built-in in this version of GCC, this
1104 option is ignored.  There is no corresponding
1105 @option{-fbuiltin-@var{function}} option; if you wish to enable
1106 built-in functions selectively when using @option{-fno-builtin} or
1107 @option{-ffreestanding}, you may define macros such as:
1108
1109 @smallexample
1110 #define abs(n)          __builtin_abs ((n))
1111 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1112 @end smallexample
1113
1114 @item -fhosted
1115 @opindex fhosted
1116 @cindex hosted environment
1117
1118 Assert that compilation takes place in a hosted environment.  This implies
1119 @option{-fbuiltin}.  A hosted environment is one in which the
1120 entire standard library is available, and in which @code{main} has a return
1121 type of @code{int}.  Examples are nearly everything except a kernel.
1122 This is equivalent to @option{-fno-freestanding}.
1123
1124 @item -ffreestanding
1125 @opindex ffreestanding
1126 @cindex hosted environment
1127
1128 Assert that compilation takes place in a freestanding environment.  This
1129 implies @option{-fno-builtin}.  A freestanding environment
1130 is one in which the standard library may not exist, and program startup may
1131 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1132 This is equivalent to @option{-fno-hosted}.
1133
1134 @xref{Standards,,Language Standards Supported by GCC}, for details of
1135 freestanding and hosted environments.
1136
1137 @item -fms-extensions
1138 @opindex fms-extensions
1139 Accept some non-standard constructs used in Microsoft header files.
1140
1141 @item -trigraphs
1142 @opindex trigraphs
1143 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1144 options for strict ISO C conformance) implies @option{-trigraphs}.
1145
1146 @item -no-integrated-cpp
1147 @opindex no-integrated-cpp
1148 Performs a compilation in two passes: preprocessing and compiling.  This
1149 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1150 @option{-B} option. The user supplied compilation step can then add in
1151 an additional preprocessing step after normal preprocessing but before
1152 compiling. The default is to use the integrated cpp (internal cpp)
1153
1154 The semantics of this option will change if "cc1", "cc1plus", and
1155 "cc1obj" are merged.
1156
1157 @cindex traditional C language
1158 @cindex C language, traditional
1159 @item -traditional
1160 @itemx -traditional-cpp
1161 @opindex traditional-cpp
1162 @opindex traditional
1163 Formerly, these options caused GCC to attempt to emulate a pre-standard
1164 C compiler.  They are now only supported with the @option{-E} switch.
1165 The preprocessor continues to support a pre-standard mode.  See the GNU
1166 CPP manual for details.
1167
1168 @item -fcond-mismatch
1169 @opindex fcond-mismatch
1170 Allow conditional expressions with mismatched types in the second and
1171 third arguments.  The value of such an expression is void.  This option
1172 is not supported for C++.
1173
1174 @item -funsigned-char
1175 @opindex funsigned-char
1176 Let the type @code{char} be unsigned, like @code{unsigned char}.
1177
1178 Each kind of machine has a default for what @code{char} should
1179 be.  It is either like @code{unsigned char} by default or like
1180 @code{signed char} by default.
1181
1182 Ideally, a portable program should always use @code{signed char} or
1183 @code{unsigned char} when it depends on the signedness of an object.
1184 But many programs have been written to use plain @code{char} and
1185 expect it to be signed, or expect it to be unsigned, depending on the
1186 machines they were written for.  This option, and its inverse, let you
1187 make such a program work with the opposite default.
1188
1189 The type @code{char} is always a distinct type from each of
1190 @code{signed char} or @code{unsigned char}, even though its behavior
1191 is always just like one of those two.
1192
1193 @item -fsigned-char
1194 @opindex fsigned-char
1195 Let the type @code{char} be signed, like @code{signed char}.
1196
1197 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1198 the negative form of @option{-funsigned-char}.  Likewise, the option
1199 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1200
1201 @item -fsigned-bitfields
1202 @itemx -funsigned-bitfields
1203 @itemx -fno-signed-bitfields
1204 @itemx -fno-unsigned-bitfields
1205 @opindex fsigned-bitfields
1206 @opindex funsigned-bitfields
1207 @opindex fno-signed-bitfields
1208 @opindex fno-unsigned-bitfields
1209 These options control whether a bit-field is signed or unsigned, when the
1210 declaration does not use either @code{signed} or @code{unsigned}.  By
1211 default, such a bit-field is signed, because this is consistent: the
1212 basic integer types such as @code{int} are signed types.
1213
1214 @item -fwritable-strings
1215 @opindex fwritable-strings
1216 Store string constants in the writable data segment and don't uniquize
1217 them.  This is for compatibility with old programs which assume they can
1218 write into string constants.
1219
1220 Writing into string constants is a very bad idea; ``constants'' should
1221 be constant.
1222
1223 This option is deprecated.
1224 @end table
1225
1226 @node C++ Dialect Options
1227 @section Options Controlling C++ Dialect
1228
1229 @cindex compiler options, C++
1230 @cindex C++ options, command line
1231 @cindex options, C++
1232 This section describes the command-line options that are only meaningful
1233 for C++ programs; but you can also use most of the GNU compiler options
1234 regardless of what language your program is in.  For example, you
1235 might compile a file @code{firstClass.C} like this:
1236
1237 @smallexample
1238 g++ -g -frepo -O -c firstClass.C
1239 @end smallexample
1240
1241 @noindent
1242 In this example, only @option{-frepo} is an option meant
1243 only for C++ programs; you can use the other options with any
1244 language supported by GCC@.
1245
1246 Here is a list of options that are @emph{only} for compiling C++ programs:
1247
1248 @table @gcctabopt
1249
1250 @item -fabi-version=@var{n}
1251 @opindex fabi-version
1252 Use version @var{n} of the C++ ABI.  Version 2 is the version of the
1253 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1254 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1255 the version that conforms most closely to the C++ ABI specification.
1256 Therefore, the ABI obtained using version 0 will change as ABI bugs
1257 are fixed.
1258
1259 The default is version 2.
1260
1261 @item -fno-access-control
1262 @opindex fno-access-control
1263 Turn off all access checking.  This switch is mainly useful for working
1264 around bugs in the access control code.
1265
1266 @item -fcheck-new
1267 @opindex fcheck-new
1268 Check that the pointer returned by @code{operator new} is non-null
1269 before attempting to modify the storage allocated.  This check is
1270 normally unnecessary because the C++ standard specifies that
1271 @code{operator new} will only return @code{0} if it is declared
1272 @samp{throw()}, in which case the compiler will always check the
1273 return value even without this option.  In all other cases, when
1274 @code{operator new} has a non-empty exception specification, memory
1275 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1276 @samp{new (nothrow)}.
1277
1278 @item -fconserve-space
1279 @opindex fconserve-space
1280 Put uninitialized or runtime-initialized global variables into the
1281 common segment, as C does.  This saves space in the executable at the
1282 cost of not diagnosing duplicate definitions.  If you compile with this
1283 flag and your program mysteriously crashes after @code{main()} has
1284 completed, you may have an object that is being destroyed twice because
1285 two definitions were merged.
1286
1287 This option is no longer useful on most targets, now that support has
1288 been added for putting variables into BSS without making them common.
1289
1290 @item -fno-const-strings
1291 @opindex fno-const-strings
1292 Give string constants type @code{char *} instead of type @code{const
1293 char *}.  By default, G++ uses type @code{const char *} as required by
1294 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1295 actually modify the value of a string constant, unless you also use
1296 @option{-fwritable-strings}.
1297
1298 This option might be removed in a future release of G++.  For maximum
1299 portability, you should structure your code so that it works with
1300 string constants that have type @code{const char *}.
1301
1302 @item -fno-elide-constructors
1303 @opindex fno-elide-constructors
1304 The C++ standard allows an implementation to omit creating a temporary
1305 which is only used to initialize another object of the same type.
1306 Specifying this option disables that optimization, and forces G++ to
1307 call the copy constructor in all cases.
1308
1309 @item -fno-enforce-eh-specs
1310 @opindex fno-enforce-eh-specs
1311 Don't check for violation of exception specifications at runtime.  This
1312 option violates the C++ standard, but may be useful for reducing code
1313 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1314 will still optimize based on the exception specifications.
1315
1316 @item -ffor-scope
1317 @itemx -fno-for-scope
1318 @opindex ffor-scope
1319 @opindex fno-for-scope
1320 If @option{-ffor-scope} is specified, the scope of variables declared in
1321 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1322 as specified by the C++ standard.
1323 If @option{-fno-for-scope} is specified, the scope of variables declared in
1324 a @i{for-init-statement} extends to the end of the enclosing scope,
1325 as was the case in old versions of G++, and other (traditional)
1326 implementations of C++.
1327
1328 The default if neither flag is given to follow the standard,
1329 but to allow and give a warning for old-style code that would
1330 otherwise be invalid, or have different behavior.
1331
1332 @item -fno-gnu-keywords
1333 @opindex fno-gnu-keywords
1334 Do not recognize @code{typeof} as a keyword, so that code can use this
1335 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1336 @option{-ansi} implies @option{-fno-gnu-keywords}.
1337
1338 @item -fno-implicit-templates
1339 @opindex fno-implicit-templates
1340 Never emit code for non-inline templates which are instantiated
1341 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1342 @xref{Template Instantiation}, for more information.
1343
1344 @item -fno-implicit-inline-templates
1345 @opindex fno-implicit-inline-templates
1346 Don't emit code for implicit instantiations of inline templates, either.
1347 The default is to handle inlines differently so that compiles with and
1348 without optimization will need the same set of explicit instantiations.
1349
1350 @item -fno-implement-inlines
1351 @opindex fno-implement-inlines
1352 To save space, do not emit out-of-line copies of inline functions
1353 controlled by @samp{#pragma implementation}.  This will cause linker
1354 errors if these functions are not inlined everywhere they are called.
1355
1356 @item -fms-extensions
1357 @opindex fms-extensions
1358 Disable pedantic warnings about constructs used in MFC, such as implicit
1359 int and getting a pointer to member function via non-standard syntax.
1360
1361 @item -fno-nonansi-builtins
1362 @opindex fno-nonansi-builtins
1363 Disable built-in declarations of functions that are not mandated by
1364 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1365 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1366
1367 @item -fno-operator-names
1368 @opindex fno-operator-names
1369 Do not treat the operator name keywords @code{and}, @code{bitand},
1370 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1371 synonyms as keywords.
1372
1373 @item -fno-optional-diags
1374 @opindex fno-optional-diags
1375 Disable diagnostics that the standard says a compiler does not need to
1376 issue.  Currently, the only such diagnostic issued by G++ is the one for
1377 a name having multiple meanings within a class.
1378
1379 @item -fpermissive
1380 @opindex fpermissive
1381 Downgrade some diagnostics about nonconformant code from errors to
1382 warnings.  Thus, using @option{-fpermissive} will allow some
1383 nonconforming code to compile.
1384
1385 @item -frepo
1386 @opindex frepo
1387 Enable automatic template instantiation at link time.  This option also
1388 implies @option{-fno-implicit-templates}.  @xref{Template
1389 Instantiation}, for more information.
1390
1391 @item -fno-rtti
1392 @opindex fno-rtti
1393 Disable generation of information about every class with virtual
1394 functions for use by the C++ runtime type identification features
1395 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1396 of the language, you can save some space by using this flag.  Note that
1397 exception handling uses the same information, but it will generate it as
1398 needed.
1399
1400 @item -fstats
1401 @opindex fstats
1402 Emit statistics about front-end processing at the end of the compilation.
1403 This information is generally only useful to the G++ development team.
1404
1405 @item -ftemplate-depth-@var{n}
1406 @opindex ftemplate-depth
1407 Set the maximum instantiation depth for template classes to @var{n}.
1408 A limit on the template instantiation depth is needed to detect
1409 endless recursions during template class instantiation.  ANSI/ISO C++
1410 conforming programs must not rely on a maximum depth greater than 17.
1411
1412 @item -fuse-cxa-atexit
1413 @opindex fuse-cxa-atexit
1414 Register destructors for objects with static storage duration with the
1415 @code{__cxa_atexit} function rather than the @code{atexit} function.
1416 This option is required for fully standards-compliant handling of static
1417 destructors, but will only work if your C library supports
1418 @code{__cxa_atexit}.
1419
1420 @item -fno-weak
1421 @opindex fno-weak
1422 Do not use weak symbol support, even if it is provided by the linker.
1423 By default, G++ will use weak symbols if they are available.  This
1424 option exists only for testing, and should not be used by end-users;
1425 it will result in inferior code and has no benefits.  This option may
1426 be removed in a future release of G++.
1427
1428 @item -nostdinc++
1429 @opindex nostdinc++
1430 Do not search for header files in the standard directories specific to
1431 C++, but do still search the other standard directories.  (This option
1432 is used when building the C++ library.)
1433 @end table
1434
1435 In addition, these optimization, warning, and code generation options
1436 have meanings only for C++ programs:
1437
1438 @table @gcctabopt
1439 @item -fno-default-inline
1440 @opindex fno-default-inline
1441 Do not assume @samp{inline} for functions defined inside a class scope.
1442 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1443 functions will have linkage like inline functions; they just won't be
1444 inlined by default.
1445
1446 @item -Wabi @r{(C++ only)}
1447 @opindex Wabi
1448 Warn when G++ generates code that is probably not compatible with the
1449 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1450 all such cases, there are probably some cases that are not warned about,
1451 even though G++ is generating incompatible code.  There may also be
1452 cases where warnings are emitted even though the code that is generated
1453 will be compatible.
1454
1455 You should rewrite your code to avoid these warnings if you are
1456 concerned about the fact that code generated by G++ may not be binary
1457 compatible with code generated by other compilers.
1458
1459 The known incompatibilities at this point include:
1460
1461 @itemize @bullet
1462
1463 @item
1464 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1465 pack data into the same byte as a base class.  For example:
1466
1467 @smallexample
1468 struct A @{ virtual void f(); int f1 : 1; @};
1469 struct B : public A @{ int f2 : 1; @};
1470 @end smallexample
1471
1472 @noindent
1473 In this case, G++ will place @code{B::f2} into the same byte
1474 as@code{A::f1}; other compilers will not.  You can avoid this problem
1475 by explicitly padding @code{A} so that its size is a multiple of the
1476 byte size on your platform; that will cause G++ and other compilers to
1477 layout @code{B} identically.
1478
1479 @item
1480 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1481 tail padding when laying out virtual bases.  For example:
1482
1483 @smallexample
1484 struct A @{ virtual void f(); char c1; @};
1485 struct B @{ B(); char c2; @};
1486 struct C : public A, public virtual B @{@};
1487 @end smallexample
1488
1489 @noindent
1490 In this case, G++ will not place @code{B} into the tail-padding for
1491 @code{A}; other compilers will.  You can avoid this problem by
1492 explicitly padding @code{A} so that its size is a multiple of its
1493 alignment (ignoring virtual base classes); that will cause G++ and other
1494 compilers to layout @code{C} identically.
1495
1496 @item
1497 Incorrect handling of bit-fields with declared widths greater than that
1498 of their underlying types, when the bit-fields appear in a union.  For
1499 example:
1500
1501 @smallexample
1502 union U @{ int i : 4096; @};
1503 @end smallexample
1504
1505 @noindent
1506 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1507 union too small by the number of bits in an @code{int}.
1508
1509 @item
1510 Empty classes can be placed at incorrect offsets.  For example:
1511
1512 @smallexample
1513 struct A @{@};
1514
1515 struct B @{
1516   A a;
1517   virtual void f ();
1518 @};
1519
1520 struct C : public B, public A @{@};
1521 @end smallexample
1522
1523 @noindent
1524 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1525 it should be placed at offset zero.  G++ mistakenly believes that the
1526 @code{A} data member of @code{B} is already at offset zero.
1527
1528 @item
1529 Names of template functions whose types involve @code{typename} or
1530 template template parameters can be mangled incorrectly.
1531
1532 @smallexample
1533 template <typename Q>
1534 void f(typename Q::X) @{@}
1535
1536 template <template <typename> class Q>
1537 void f(typename Q<int>::X) @{@}
1538 @end smallexample
1539
1540 @noindent
1541 Instantiations of these templates may be mangled incorrectly.
1542
1543 @end itemize
1544
1545 @item -Wctor-dtor-privacy @r{(C++ only)}
1546 @opindex Wctor-dtor-privacy
1547 Warn when a class seems unusable because all the constructors or
1548 destructors in that class are private, and it has neither friends nor
1549 public static member functions.
1550
1551 @item -Wnon-virtual-dtor @r{(C++ only)}
1552 @opindex Wnon-virtual-dtor
1553 Warn when a class appears to be polymorphic, thereby requiring a virtual
1554 destructor, yet it declares a non-virtual one.
1555 This warning is enabled by @option{-Wall}.
1556
1557 @item -Wreorder @r{(C++ only)}
1558 @opindex Wreorder
1559 @cindex reordering, warning
1560 @cindex warning for reordering of member initializers
1561 Warn when the order of member initializers given in the code does not
1562 match the order in which they must be executed.  For instance:
1563
1564 @smallexample
1565 struct A @{
1566   int i;
1567   int j;
1568   A(): j (0), i (1) @{ @}
1569 @};
1570 @end smallexample
1571
1572 The compiler will rearrange the member initializers for @samp{i}
1573 and @samp{j} to match the declaration order of the members, emitting
1574 a warning to that effect.  This warning is enabled by @option{-Wall}.
1575 @end table
1576
1577 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1578
1579 @table @gcctabopt
1580 @item -Weffc++ @r{(C++ only)}
1581 @opindex Weffc++
1582 Warn about violations of the following style guidelines from Scott Meyers'
1583 @cite{Effective C++} book:
1584
1585 @itemize @bullet
1586 @item
1587 Item 11:  Define a copy constructor and an assignment operator for classes
1588 with dynamically allocated memory.
1589
1590 @item
1591 Item 12:  Prefer initialization to assignment in constructors.
1592
1593 @item
1594 Item 14:  Make destructors virtual in base classes.
1595
1596 @item
1597 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1598
1599 @item
1600 Item 23:  Don't try to return a reference when you must return an object.
1601
1602 @end itemize
1603
1604 Also warn about violations of the following style guidelines from
1605 Scott Meyers' @cite{More Effective C++} book:
1606
1607 @itemize @bullet
1608 @item
1609 Item 6:  Distinguish between prefix and postfix forms of increment and
1610 decrement operators.
1611
1612 @item
1613 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1614
1615 @end itemize
1616
1617 When selecting this option, be aware that the standard library
1618 headers do not obey all of these guidelines; use @samp{grep -v}
1619 to filter out those warnings.
1620
1621 @item -Wno-deprecated @r{(C++ only)}
1622 @opindex Wno-deprecated
1623 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1624
1625 @item -Wno-non-template-friend @r{(C++ only)}
1626 @opindex Wno-non-template-friend
1627 Disable warnings when non-templatized friend functions are declared
1628 within a template.  Since the advent of explicit template specification
1629 support in G++, if the name of the friend is an unqualified-id (i.e.,
1630 @samp{friend foo(int)}), the C++ language specification demands that the
1631 friend declare or define an ordinary, nontemplate function.  (Section
1632 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1633 could be interpreted as a particular specialization of a templatized
1634 function.  Because this non-conforming behavior is no longer the default
1635 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1636 check existing code for potential trouble spots and is on by default.
1637 This new compiler behavior can be turned off with
1638 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1639 but disables the helpful warning.
1640
1641 @item -Wold-style-cast @r{(C++ only)}
1642 @opindex Wold-style-cast
1643 Warn if an old-style (C-style) cast to a non-void type is used within
1644 a C++ program.  The new-style casts (@samp{static_cast},
1645 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1646 unintended effects and much easier to search for.
1647
1648 @item -Woverloaded-virtual @r{(C++ only)}
1649 @opindex Woverloaded-virtual
1650 @cindex overloaded virtual fn, warning
1651 @cindex warning for overloaded virtual fn
1652 Warn when a function declaration hides virtual functions from a
1653 base class.  For example, in:
1654
1655 @smallexample
1656 struct A @{
1657   virtual void f();
1658 @};
1659
1660 struct B: public A @{
1661   void f(int);
1662 @};
1663 @end smallexample
1664
1665 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1666 like:
1667
1668 @smallexample
1669 B* b;
1670 b->f();
1671 @end smallexample
1672
1673 will fail to compile.
1674
1675 @item -Wno-pmf-conversions @r{(C++ only)}
1676 @opindex Wno-pmf-conversions
1677 Disable the diagnostic for converting a bound pointer to member function
1678 to a plain pointer.
1679
1680 @item -Wsign-promo @r{(C++ only)}
1681 @opindex Wsign-promo
1682 Warn when overload resolution chooses a promotion from unsigned or
1683 enumeral type to a signed type, over a conversion to an unsigned type of
1684 the same size.  Previous versions of G++ would try to preserve
1685 unsignedness, but the standard mandates the current behavior.
1686
1687 @item -Wsynth @r{(C++ only)}
1688 @opindex Wsynth
1689 @cindex warning for synthesized methods
1690 @cindex synthesized methods, warning
1691 Warn when G++'s synthesis behavior does not match that of cfront.  For
1692 instance:
1693
1694 @smallexample
1695 struct A @{
1696   operator int ();
1697   A& operator = (int);
1698 @};
1699
1700 main ()
1701 @{
1702   A a,b;
1703   a = b;
1704 @}
1705 @end smallexample
1706
1707 In this example, G++ will synthesize a default @samp{A& operator =
1708 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1709 @end table
1710
1711 @node Objective-C Dialect Options
1712 @section Options Controlling Objective-C Dialect
1713
1714 @cindex compiler options, Objective-C
1715 @cindex Objective-C options, command line
1716 @cindex options, Objective-C
1717 (NOTE: This manual does not describe the Objective-C language itself.  See
1718 @w{@uref{http://gcc.gnu.org/readings.html}} for references.)
1719
1720 This section describes the command-line options that are only meaningful
1721 for Objective-C programs, but you can also use most of the GNU compiler
1722 options regardless of what language your program is in.  For example,
1723 you might compile a file @code{some_class.m} like this:
1724
1725 @smallexample
1726 gcc -g -fgnu-runtime -O -c some_class.m
1727 @end smallexample
1728
1729 @noindent
1730 In this example, @option{-fgnu-runtime} is an option meant only for
1731 Objective-C programs; you can use the other options with any language
1732 supported by GCC@.
1733
1734 Here is a list of options that are @emph{only} for compiling Objective-C
1735 programs:
1736
1737 @table @gcctabopt
1738 @item -fconstant-string-class=@var{class-name}
1739 @opindex fconstant-string-class
1740 Use @var{class-name} as the name of the class to instantiate for each
1741 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1742 class name is @code{NXConstantString} if the GNU runtime is being used, and
1743 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1744 @option{-fconstant-cfstrings} option, if also present, will override the
1745 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1746 to be laid out as constant CoreFoundation strings.
1747
1748 @item -fgnu-runtime
1749 @opindex fgnu-runtime
1750 Generate object code compatible with the standard GNU Objective-C
1751 runtime.  This is the default for most types of systems.
1752
1753 @item -fnext-runtime
1754 @opindex fnext-runtime
1755 Generate output compatible with the NeXT runtime.  This is the default
1756 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1757 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1758 used.
1759
1760 @item -fno-nil-receivers
1761 @opindex -fno-nil-receivers
1762 Assume that all Objective-C message dispatches (e.g.,
1763 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1764 is not @code{nil}.  This allows for more efficient entry points in the runtime to be
1765 used.  Currently, this option is only available in conjunction with
1766 the NeXT runtime on Mac OS X 10.3 and later.
1767
1768 @item -fobjc-exceptions
1769 @opindex -fobjc-exceptions
1770 Enable syntactic support for structured exception handling in Objective-C,
1771 similar to what is offered by C++ and Java.  Currently, this option is only
1772 available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
1773
1774 @smallexample
1775   @@try @{
1776     @dots{}
1777        @@throw expr;
1778     @dots{}
1779   @}
1780   @@catch (AnObjCClass *exc) @{
1781     @dots{}
1782       @@throw expr;
1783     @dots{}
1784       @@throw;
1785     @dots{}
1786   @}
1787   @@catch (AnotherClass *exc) @{
1788     @dots{}
1789   @}
1790   @@catch (id allOthers) @{
1791     @dots{}
1792   @}
1793   @@finally @{
1794     @dots{}
1795       @@throw expr;
1796     @dots{}
1797   @}
1798 @end smallexample
1799
1800 The @code{@@throw} statement may appear anywhere in an Objective-C or
1801 Objective-C++ program; when used inside of a @code{@@catch} block, the
1802 @code{@@throw} may appear without an argument (as shown above), in which case
1803 the object caught by the @code{@@catch} will be rethrown.
1804
1805 Note that only (pointers to) Objective-C objects may be thrown and
1806 caught using this scheme.  When an object is thrown, it will be caught
1807 by the nearest @code{@@catch} clause capable of handling objects of that type,
1808 analogously to how @code{catch} blocks work in C++ and Java.  A
1809 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
1810 any and all Objective-C exceptions not caught by previous @code{@@catch}
1811 clauses (if any).
1812
1813 The @code{@@finally} clause, if present, will be executed upon exit from the
1814 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1815 regardless of whether any exceptions are thrown, caught or rethrown
1816 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1817 of the @code{finally} clause in Java.
1818
1819 There are several caveats to using the new exception mechanism:
1820
1821 @itemize @bullet
1822 @item
1823 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
1824 idioms provided by the @code{NSException} class, the new
1825 exceptions can only be used on Mac OS X 10.3 (Panther) and later
1826 systems, due to additional functionality needed in the (NeXT) Objective-C
1827 runtime.
1828
1829 @item
1830 As mentioned above, the new exceptions do not support handling
1831 types other than Objective-C objects.   Furthermore, when used from
1832 Objective-C++, the Objective-C exception model does not interoperate with C++
1833 exceptions at this time.  This means you cannot @code{@@throw} an exception
1834 from Objective-C and @code{catch} it in C++, or vice versa
1835 (i.e., @code{throw @dots{} @@catch}).
1836 @end itemize
1837
1838 The @option{-fobjc-exceptions} switch also enables the use of synchronization
1839 blocks for thread-safe execution:
1840
1841 @smallexample
1842   @@synchronized (ObjCClass *guard) @{
1843     @dots{}
1844   @}
1845 @end smallexample
1846
1847 Upon entering the @code{@@synchronized} block, a thread of execution shall
1848 first check whether a lock has been placed on the corresponding @code{guard}
1849 object by another thread.  If it has, the current thread shall wait until
1850 the other thread relinquishes its lock.  Once @code{guard} becomes available,
1851 the current thread will place its own lock on it, execute the code contained in
1852 the @code{@@synchronized} block, and finally relinquish the lock (thereby
1853 making @code{guard} available to other threads).
1854
1855 Unlike Java, Objective-C does not allow for entire methods to be marked
1856 @code{@@synchronized}.  Note that throwing exceptions out of
1857 @code{@@synchronized} blocks is allowed, and will cause the guarding object
1858 to be unlocked properly.
1859
1860 @item -freplace-objc-classes
1861 @opindex -freplace-objc-classes
1862 Emit a special marker instructing @command{ld(1)} not to statically link in
1863 the resulting object file, and allow @command{dyld(1)} to load it in at
1864 run time instead.  This is used in conjunction with the Fix-and-Continue
1865 debugging mode, where the object file in question may be recompiled and
1866 dynamically reloaded in the course of program execution, without the need
1867 to restart the program itself.  Currently, Fix-and-Continue functionality
1868 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
1869 and later.
1870
1871 @item -fzero-link
1872 @opindex -fzero-link
1873 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1874 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1875 compile time) with static class references that get initialized at load time,
1876 which improves run-time performance.  Specifying the @option{-fzero-link} flag
1877 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
1878 to be retained.  This is useful in Zero-Link debugging mode, since it allows
1879 for individual class implementations to be modified during program execution.
1880
1881 @item -gen-decls
1882 @opindex gen-decls
1883 Dump interface declarations for all classes seen in the source file to a
1884 file named @file{@var{sourcename}.decl}.
1885
1886 @item -Wno-protocol
1887 @opindex Wno-protocol
1888 If a class is declared to implement a protocol, a warning is issued for
1889 every method in the protocol that is not implemented by the class.  The
1890 default behavior is to issue a warning for every method not explicitly
1891 implemented in the class, even if a method implementation is inherited
1892 from the superclass.  If you use the @code{-Wno-protocol} option, then
1893 methods inherited from the superclass are considered to be implemented,
1894 and no warning is issued for them.
1895
1896 @item -Wselector
1897 @opindex Wselector
1898 Warn if multiple methods of different types for the same selector are
1899 found during compilation.  The check is performed on the list of methods
1900 in the final stage of compilation.  Additionally, a check is performed
1901 for each selector appearing in a @code{@@selector(@dots{})}
1902 expression, and a corresponding method for that selector has been found
1903 during compilation.  Because these checks scan the method table only at
1904 the end of compilation, these warnings are not produced if the final
1905 stage of compilation is not reached, for example because an error is
1906 found during compilation, or because the @code{-fsyntax-only} option is
1907 being used.
1908
1909 @item -Wundeclared-selector
1910 @opindex Wundeclared-selector
1911 Warn if a @code{@@selector(@dots{})} expression referring to an
1912 undeclared selector is found.  A selector is considered undeclared if no
1913 method with that name has been declared before the
1914 @code{@@selector(@dots{})} expression, either explicitly in an
1915 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
1916 an @code{@@implementation} section.  This option always performs its
1917 checks as soon as a @code{@@selector(@dots{})} expression is found,
1918 while @code{-Wselector} only performs its checks in the final stage of
1919 compilation.  This also enforces the coding style convention
1920 that methods and selectors must be declared before being used.
1921
1922 @item -print-objc-runtime-info
1923 @opindex -print-objc-runtime-info
1924 Generate C header describing the largest structure that is passed by
1925 value, if any.
1926
1927 @end table
1928
1929 @node Language Independent Options
1930 @section Options to Control Diagnostic Messages Formatting
1931 @cindex options to control diagnostics formatting
1932 @cindex diagnostic messages
1933 @cindex message formatting
1934
1935 Traditionally, diagnostic messages have been formatted irrespective of
1936 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1937 below can be used to control the diagnostic messages formatting
1938 algorithm, e.g.@: how many characters per line, how often source location
1939 information should be reported.  Right now, only the C++ front end can
1940 honor these options.  However it is expected, in the near future, that
1941 the remaining front ends would be able to digest them correctly.
1942
1943 @table @gcctabopt
1944 @item -fmessage-length=@var{n}
1945 @opindex fmessage-length
1946 Try to format error messages so that they fit on lines of about @var{n}
1947 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1948 the front ends supported by GCC@.  If @var{n} is zero, then no
1949 line-wrapping will be done; each error message will appear on a single
1950 line.
1951
1952 @opindex fdiagnostics-show-location
1953 @item -fdiagnostics-show-location=once
1954 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1955 reporter to emit @emph{once} source location information; that is, in
1956 case the message is too long to fit on a single physical line and has to
1957 be wrapped, the source location won't be emitted (as prefix) again,
1958 over and over, in subsequent continuation lines.  This is the default
1959 behavior.
1960
1961 @item -fdiagnostics-show-location=every-line
1962 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1963 messages reporter to emit the same source location information (as
1964 prefix) for physical lines that result from the process of breaking
1965 a message which is too long to fit on a single line.
1966
1967 @end table
1968
1969 @node Warning Options
1970 @section Options to Request or Suppress Warnings
1971 @cindex options to control warnings
1972 @cindex warning messages
1973 @cindex messages, warning
1974 @cindex suppressing warnings
1975
1976 Warnings are diagnostic messages that report constructions which
1977 are not inherently erroneous but which are risky or suggest there
1978 may have been an error.
1979
1980 You can request many specific warnings with options beginning @samp{-W},
1981 for example @option{-Wimplicit} to request warnings on implicit
1982 declarations.  Each of these specific warning options also has a
1983 negative form beginning @samp{-Wno-} to turn off warnings;
1984 for example, @option{-Wno-implicit}.  This manual lists only one of the
1985 two forms, whichever is not the default.
1986
1987 The following options control the amount and kinds of warnings produced
1988 by GCC; for further, language-specific options also refer to
1989 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
1990
1991 @table @gcctabopt
1992 @cindex syntax checking
1993 @item -fsyntax-only
1994 @opindex fsyntax-only
1995 Check the code for syntax errors, but don't do anything beyond that.
1996
1997 @item -pedantic
1998 @opindex pedantic
1999 Issue all the warnings demanded by strict ISO C and ISO C++;
2000 reject all programs that use forbidden extensions, and some other
2001 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2002 version of the ISO C standard specified by any @option{-std} option used.
2003
2004 Valid ISO C and ISO C++ programs should compile properly with or without
2005 this option (though a rare few will require @option{-ansi} or a
2006 @option{-std} option specifying the required version of ISO C)@.  However,
2007 without this option, certain GNU extensions and traditional C and C++
2008 features are supported as well.  With this option, they are rejected.
2009
2010 @option{-pedantic} does not cause warning messages for use of the
2011 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2012 warnings are also disabled in the expression that follows
2013 @code{__extension__}.  However, only system header files should use
2014 these escape routes; application programs should avoid them.
2015 @xref{Alternate Keywords}.
2016
2017 Some users try to use @option{-pedantic} to check programs for strict ISO
2018 C conformance.  They soon find that it does not do quite what they want:
2019 it finds some non-ISO practices, but not all---only those for which
2020 ISO C @emph{requires} a diagnostic, and some others for which
2021 diagnostics have been added.
2022
2023 A feature to report any failure to conform to ISO C might be useful in
2024 some instances, but would require considerable additional work and would
2025 be quite different from @option{-pedantic}.  We don't have plans to
2026 support such a feature in the near future.
2027
2028 Where the standard specified with @option{-std} represents a GNU
2029 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2030 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2031 extended dialect is based.  Warnings from @option{-pedantic} are given
2032 where they are required by the base standard.  (It would not make sense
2033 for such warnings to be given only for features not in the specified GNU
2034 C dialect, since by definition the GNU dialects of C include all
2035 features the compiler supports with the given option, and there would be
2036 nothing to warn about.)
2037
2038 @item -pedantic-errors
2039 @opindex pedantic-errors
2040 Like @option{-pedantic}, except that errors are produced rather than
2041 warnings.
2042
2043 @item -w
2044 @opindex w
2045 Inhibit all warning messages.
2046
2047 @item -Wno-import
2048 @opindex Wno-import
2049 Inhibit warning messages about the use of @samp{#import}.
2050
2051 @item -Wchar-subscripts
2052 @opindex Wchar-subscripts
2053 Warn if an array subscript has type @code{char}.  This is a common cause
2054 of error, as programmers often forget that this type is signed on some
2055 machines.
2056
2057 @item -Wcomment
2058 @opindex Wcomment
2059 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2060 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2061
2062 @item -Wformat
2063 @opindex Wformat
2064 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2065 the arguments supplied have types appropriate to the format string
2066 specified, and that the conversions specified in the format string make
2067 sense.  This includes standard functions, and others specified by format
2068 attributes (@pxref{Function Attributes}), in the @code{printf},
2069 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2070 not in the C standard) families.
2071
2072 The formats are checked against the format features supported by GNU
2073 libc version 2.2.  These include all ISO C90 and C99 features, as well
2074 as features from the Single Unix Specification and some BSD and GNU
2075 extensions.  Other library implementations may not support all these
2076 features; GCC does not support warning about features that go beyond a
2077 particular library's limitations.  However, if @option{-pedantic} is used
2078 with @option{-Wformat}, warnings will be given about format features not
2079 in the selected standard version (but not for @code{strfmon} formats,
2080 since those are not in any version of the C standard).  @xref{C Dialect
2081 Options,,Options Controlling C Dialect}.
2082
2083 Since @option{-Wformat} also checks for null format arguments for
2084 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2085
2086 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2087 aspects of format checking, the options @option{-Wformat-y2k},
2088 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2089 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2090 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2091
2092 @item -Wformat-y2k
2093 @opindex Wformat-y2k
2094 If @option{-Wformat} is specified, also warn about @code{strftime}
2095 formats which may yield only a two-digit year.
2096
2097 @item -Wno-format-extra-args
2098 @opindex Wno-format-extra-args
2099 If @option{-Wformat} is specified, do not warn about excess arguments to a
2100 @code{printf} or @code{scanf} format function.  The C standard specifies
2101 that such arguments are ignored.
2102
2103 Where the unused arguments lie between used arguments that are
2104 specified with @samp{$} operand number specifications, normally
2105 warnings are still given, since the implementation could not know what
2106 type to pass to @code{va_arg} to skip the unused arguments.  However,
2107 in the case of @code{scanf} formats, this option will suppress the
2108 warning if the unused arguments are all pointers, since the Single
2109 Unix Specification says that such unused arguments are allowed.
2110
2111 @item -Wno-format-zero-length
2112 @opindex Wno-format-zero-length
2113 If @option{-Wformat} is specified, do not warn about zero-length formats.
2114 The C standard specifies that zero-length formats are allowed.
2115
2116 @item -Wformat-nonliteral
2117 @opindex Wformat-nonliteral
2118 If @option{-Wformat} is specified, also warn if the format string is not a
2119 string literal and so cannot be checked, unless the format function
2120 takes its format arguments as a @code{va_list}.
2121
2122 @item -Wformat-security
2123 @opindex Wformat-security
2124 If @option{-Wformat} is specified, also warn about uses of format
2125 functions that represent possible security problems.  At present, this
2126 warns about calls to @code{printf} and @code{scanf} functions where the
2127 format string is not a string literal and there are no format arguments,
2128 as in @code{printf (foo);}.  This may be a security hole if the format
2129 string came from untrusted input and contains @samp{%n}.  (This is
2130 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2131 in future warnings may be added to @option{-Wformat-security} that are not
2132 included in @option{-Wformat-nonliteral}.)
2133
2134 @item -Wformat=2
2135 @opindex Wformat=2
2136 Enable @option{-Wformat} plus format checks not included in
2137 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2138 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2139
2140 @item -Wnonnull
2141 @opindex Wnonnull
2142 Warn about passing a null pointer for arguments marked as
2143 requiring a non-null value by the @code{nonnull} function attribute.
2144
2145 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2146 can be disabled with the @option{-Wno-nonnull} option.
2147
2148 @item -Winit-self @r{(C, C++, and Objective-C only)}
2149 @opindex Winit-self
2150 Warn about uninitialized variables which are initialized with themselves.
2151 Note this option can only be used with the @option{-Wuninitialized} option,
2152 which in turn only works with @option{-O1} and above.
2153
2154 For example, GCC will warn about @code{i} being uninitialized in the
2155 following snippet only when @option{-Winit-self} has been specified:
2156 @smallexample
2157 @group
2158 int f()
2159 @{
2160   int i = i;
2161   return i;
2162 @}
2163 @end group
2164 @end smallexample
2165
2166 @item -Wimplicit-int
2167 @opindex Wimplicit-int
2168 Warn when a declaration does not specify a type.
2169
2170 @item -Wimplicit-function-declaration
2171 @itemx -Werror-implicit-function-declaration
2172 @opindex Wimplicit-function-declaration
2173 @opindex Werror-implicit-function-declaration
2174 Give a warning (or error) whenever a function is used before being
2175 declared.
2176
2177 @item -Wimplicit
2178 @opindex Wimplicit
2179 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2180
2181 @item -Wmain
2182 @opindex Wmain
2183 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2184 function with external linkage, returning int, taking either zero
2185 arguments, two, or three arguments of appropriate types.
2186
2187 @item -Wmissing-braces
2188 @opindex Wmissing-braces
2189 Warn if an aggregate or union initializer is not fully bracketed.  In
2190 the following example, the initializer for @samp{a} is not fully
2191 bracketed, but that for @samp{b} is fully bracketed.
2192
2193 @smallexample
2194 int a[2][2] = @{ 0, 1, 2, 3 @};
2195 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2196 @end smallexample
2197
2198 @item -Wparentheses
2199 @opindex Wparentheses
2200 Warn if parentheses are omitted in certain contexts, such
2201 as when there is an assignment in a context where a truth value
2202 is expected, or when operators are nested whose precedence people
2203 often get confused about.
2204
2205 Also warn about constructions where there may be confusion to which
2206 @code{if} statement an @code{else} branch belongs.  Here is an example of
2207 such a case:
2208
2209 @smallexample
2210 @group
2211 @{
2212   if (a)
2213     if (b)
2214       foo ();
2215   else
2216     bar ();
2217 @}
2218 @end group
2219 @end smallexample
2220
2221 In C, every @code{else} branch belongs to the innermost possible @code{if}
2222 statement, which in this example is @code{if (b)}.  This is often not
2223 what the programmer expected, as illustrated in the above example by
2224 indentation the programmer chose.  When there is the potential for this
2225 confusion, GCC will issue a warning when this flag is specified.
2226 To eliminate the warning, add explicit braces around the innermost
2227 @code{if} statement so there is no way the @code{else} could belong to
2228 the enclosing @code{if}.  The resulting code would look like this:
2229
2230 @smallexample
2231 @group
2232 @{
2233   if (a)
2234     @{
2235       if (b)
2236         foo ();
2237       else
2238         bar ();
2239     @}
2240 @}
2241 @end group
2242 @end smallexample
2243
2244 @item -Wsequence-point
2245 @opindex Wsequence-point
2246 Warn about code that may have undefined semantics because of violations
2247 of sequence point rules in the C standard.
2248
2249 The C standard defines the order in which expressions in a C program are
2250 evaluated in terms of @dfn{sequence points}, which represent a partial
2251 ordering between the execution of parts of the program: those executed
2252 before the sequence point, and those executed after it.  These occur
2253 after the evaluation of a full expression (one which is not part of a
2254 larger expression), after the evaluation of the first operand of a
2255 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2256 function is called (but after the evaluation of its arguments and the
2257 expression denoting the called function), and in certain other places.
2258 Other than as expressed by the sequence point rules, the order of
2259 evaluation of subexpressions of an expression is not specified.  All
2260 these rules describe only a partial order rather than a total order,
2261 since, for example, if two functions are called within one expression
2262 with no sequence point between them, the order in which the functions
2263 are called is not specified.  However, the standards committee have
2264 ruled that function calls do not overlap.
2265
2266 It is not specified when between sequence points modifications to the
2267 values of objects take effect.  Programs whose behavior depends on this
2268 have undefined behavior; the C standard specifies that ``Between the
2269 previous and next sequence point an object shall have its stored value
2270 modified at most once by the evaluation of an expression.  Furthermore,
2271 the prior value shall be read only to determine the value to be
2272 stored.''.  If a program breaks these rules, the results on any
2273 particular implementation are entirely unpredictable.
2274
2275 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2276 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2277 diagnosed by this option, and it may give an occasional false positive
2278 result, but in general it has been found fairly effective at detecting
2279 this sort of problem in programs.
2280
2281 The present implementation of this option only works for C programs.  A
2282 future implementation may also work for C++ programs.
2283
2284 The C standard is worded confusingly, therefore there is some debate
2285 over the precise meaning of the sequence point rules in subtle cases.
2286 Links to discussions of the problem, including proposed formal
2287 definitions, may be found on our readings page, at
2288 @w{@uref{http://gcc.gnu.org/readings.html}}.
2289
2290 @item -Wreturn-type
2291 @opindex Wreturn-type
2292 Warn whenever a function is defined with a return-type that defaults to
2293 @code{int}.  Also warn about any @code{return} statement with no
2294 return-value in a function whose return-type is not @code{void}.
2295
2296 For C++, a function without return type always produces a diagnostic
2297 message, even when @option{-Wno-return-type} is specified.  The only
2298 exceptions are @samp{main} and functions defined in system headers.
2299
2300 @item -Wswitch
2301 @opindex Wswitch
2302 Warn whenever a @code{switch} statement has an index of enumeral type
2303 and lacks a @code{case} for one or more of the named codes of that
2304 enumeration.  (The presence of a @code{default} label prevents this
2305 warning.)  @code{case} labels outside the enumeration range also
2306 provoke warnings when this option is used.
2307
2308 @item -Wswitch-default
2309 @opindex Wswitch-switch
2310 Warn whenever a @code{switch} statement does not have a @code{default}
2311 case.
2312
2313 @item -Wswitch-enum
2314 @opindex Wswitch-enum
2315 Warn whenever a @code{switch} statement has an index of enumeral type
2316 and lacks a @code{case} for one or more of the named codes of that
2317 enumeration.  @code{case} labels outside the enumeration range also
2318 provoke warnings when this option is used.
2319
2320 @item -Wtrigraphs
2321 @opindex Wtrigraphs
2322 Warn if any trigraphs are encountered that might change the meaning of
2323 the program (trigraphs within comments are not warned about).
2324
2325 @item -Wunused-function
2326 @opindex Wunused-function
2327 Warn whenever a static function is declared but not defined or a
2328 non\-inline static function is unused.
2329
2330 @item -Wunused-label
2331 @opindex Wunused-label
2332 Warn whenever a label is declared but not used.
2333
2334 To suppress this warning use the @samp{unused} attribute
2335 (@pxref{Variable Attributes}).
2336
2337 @item -Wunused-parameter
2338 @opindex Wunused-parameter
2339 Warn whenever a function parameter is unused aside from its declaration.
2340
2341 To suppress this warning use the @samp{unused} attribute
2342 (@pxref{Variable Attributes}).
2343
2344 @item -Wunused-variable
2345 @opindex Wunused-variable
2346 Warn whenever a local variable or non-constant static variable is unused
2347 aside from its declaration
2348
2349 To suppress this warning use the @samp{unused} attribute
2350 (@pxref{Variable Attributes}).
2351
2352 @item -Wunused-value
2353 @opindex Wunused-value
2354 Warn whenever a statement computes a result that is explicitly not used.
2355
2356 To suppress this warning cast the expression to @samp{void}.
2357
2358 @item -Wunused
2359 @opindex Wunused
2360 All the above @option{-Wunused} options combined.
2361
2362 In order to get a warning about an unused function parameter, you must
2363 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2364 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2365
2366 @item -Wuninitialized
2367 @opindex Wuninitialized
2368 Warn if an automatic variable is used without first being initialized or
2369 if a variable may be clobbered by a @code{setjmp} call.
2370
2371 These warnings are possible only in optimizing compilation,
2372 because they require data flow information that is computed only
2373 when optimizing.  If you don't specify @option{-O}, you simply won't
2374 get these warnings.
2375
2376 If you want to warn about code which uses the uninitialized value of the
2377 variable in its own initializer, use the @option{-Winit-self} option.
2378
2379 These warnings occur only for variables that are candidates for
2380 register allocation.  Therefore, they do not occur for a variable that
2381 is declared @code{volatile}, or whose address is taken, or whose size
2382 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2383 structures, unions or arrays, even when they are in registers.
2384
2385 Note that there may be no warning about a variable that is used only
2386 to compute a value that itself is never used, because such
2387 computations may be deleted by data flow analysis before the warnings
2388 are printed.
2389
2390 These warnings are made optional because GCC is not smart
2391 enough to see all the reasons why the code might be correct
2392 despite appearing to have an error.  Here is one example of how
2393 this can happen:
2394
2395 @smallexample
2396 @group
2397 @{
2398   int x;
2399   switch (y)
2400     @{
2401     case 1: x = 1;
2402       break;
2403     case 2: x = 4;
2404       break;
2405     case 3: x = 5;
2406     @}
2407   foo (x);
2408 @}
2409 @end group
2410 @end smallexample
2411
2412 @noindent
2413 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2414 always initialized, but GCC doesn't know this.  Here is
2415 another common case:
2416
2417 @smallexample
2418 @{
2419   int save_y;
2420   if (change_y) save_y = y, y = new_y;
2421   @dots{}
2422   if (change_y) y = save_y;
2423 @}
2424 @end smallexample
2425
2426 @noindent
2427 This has no bug because @code{save_y} is used only if it is set.
2428
2429 @cindex @code{longjmp} warnings
2430 This option also warns when a non-volatile automatic variable might be
2431 changed by a call to @code{longjmp}.  These warnings as well are possible
2432 only in optimizing compilation.
2433
2434 The compiler sees only the calls to @code{setjmp}.  It cannot know
2435 where @code{longjmp} will be called; in fact, a signal handler could
2436 call it at any point in the code.  As a result, you may get a warning
2437 even when there is in fact no problem because @code{longjmp} cannot
2438 in fact be called at the place which would cause a problem.
2439
2440 Some spurious warnings can be avoided if you declare all the functions
2441 you use that never return as @code{noreturn}.  @xref{Function
2442 Attributes}.
2443
2444 @item -Wunknown-pragmas
2445 @opindex Wunknown-pragmas
2446 @cindex warning for unknown pragmas
2447 @cindex unknown pragmas, warning
2448 @cindex pragmas, warning of unknown
2449 Warn when a #pragma directive is encountered which is not understood by
2450 GCC@.  If this command line option is used, warnings will even be issued
2451 for unknown pragmas in system header files.  This is not the case if
2452 the warnings were only enabled by the @option{-Wall} command line option.
2453
2454 @item -Wstrict-aliasing
2455 @opindex Wstrict-aliasing
2456 This option is only active when @option{-fstrict-aliasing} is active.
2457 It warns about code which might break the strict aliasing rules that the
2458 compiler is using for optimization. The warning does not catch all
2459 cases, but does attempt to catch the more common pitfalls. It is
2460 included in @option{-Wall}.
2461
2462 @item -Wall
2463 @opindex Wall
2464 All of the above @samp{-W} options combined.  This enables all the
2465 warnings about constructions that some users consider questionable, and
2466 that are easy to avoid (or modify to prevent the warning), even in
2467 conjunction with macros.  This also enables some language-specific
2468 warnings described in @ref{C++ Dialect Options} and
2469 @ref{Objective-C Dialect Options}.
2470 @end table
2471
2472 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2473 Some of them warn about constructions that users generally do not
2474 consider questionable, but which occasionally you might wish to check
2475 for; others warn about constructions that are necessary or hard to avoid
2476 in some cases, and there is no simple way to modify the code to suppress
2477 the warning.
2478
2479 @table @gcctabopt
2480 @item -Wextra
2481 @opindex W
2482 @opindex Wextra
2483 (This option used to be called @option{-W}.  The older name is still
2484 supported, but the newer name is more descriptive.)  Print extra warning
2485 messages for these events:
2486
2487 @itemize @bullet
2488 @item
2489 A function can return either with or without a value.  (Falling
2490 off the end of the function body is considered returning without
2491 a value.)  For example, this function would evoke such a
2492 warning:
2493
2494 @smallexample
2495 @group
2496 foo (a)
2497 @{
2498   if (a > 0)
2499     return a;
2500 @}
2501 @end group
2502 @end smallexample
2503
2504 @item
2505 An expression-statement or the left-hand side of a comma expression
2506 contains no side effects.
2507 To suppress the warning, cast the unused expression to void.
2508 For example, an expression such as @samp{x[i,j]} will cause a warning,
2509 but @samp{x[(void)i,j]} will not.
2510
2511 @item
2512 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2513
2514 @item
2515 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2516 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2517 that of ordinary mathematical notation.
2518
2519 @item
2520 Storage-class specifiers like @code{static} are not the first things in
2521 a declaration.  According to the C Standard, this usage is obsolescent.
2522
2523 @item
2524 The return type of a function has a type qualifier such as @code{const}.
2525 Such a type qualifier has no effect, since the value returned by a
2526 function is not an lvalue.  (But don't warn about the GNU extension of
2527 @code{volatile void} return types.  That extension will be warned about
2528 if @option{-pedantic} is specified.)
2529
2530 @item
2531 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2532 arguments.
2533
2534 @item
2535 A comparison between signed and unsigned values could produce an
2536 incorrect result when the signed value is converted to unsigned.
2537 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2538
2539 @item
2540 An aggregate has an initializer which does not initialize all members.
2541 For example, the following code would cause such a warning, because
2542 @code{x.h} would be implicitly initialized to zero:
2543
2544 @smallexample
2545 struct s @{ int f, g, h; @};
2546 struct s x = @{ 3, 4 @};
2547 @end smallexample
2548
2549 @item
2550 A function parameter is declared without a type specifier in K&R-style
2551 functions:
2552
2553 @smallexample
2554 void foo(bar) @{ @}
2555 @end smallexample
2556
2557 @item
2558 An empty body occurs in an @samp{if} or @samp{else} statement.
2559
2560 @item
2561 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2562 @samp{>}, or @samp{>=}.
2563
2564 @item
2565 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2566
2567 @item
2568 Any of several floating-point events that often indicate errors, such as
2569 overflow, underflow, loss of precision, etc.
2570
2571 @item @r{(C++ only)}
2572 An enumerator and a non-enumerator both appear in a conditional expression.
2573
2574 @item @r{(C++ only)}
2575 A non-static reference or non-static @samp{const} member appears in a
2576 class without constructors.
2577
2578 @item @r{(C++ only)}
2579 Ambiguous virtual bases.
2580
2581 @item @r{(C++ only)}
2582 Subscripting an array which has been declared @samp{register}.
2583
2584 @item @r{(C++ only)}
2585 Taking the address of a variable which has been declared @samp{register}.
2586
2587 @item @r{(C++ only)}
2588 A base class is not initialized in a derived class' copy constructor.
2589 @end itemize
2590
2591 @item -Wno-div-by-zero
2592 @opindex Wno-div-by-zero
2593 @opindex Wdiv-by-zero
2594 Do not warn about compile-time integer division by zero.  Floating point
2595 division by zero is not warned about, as it can be a legitimate way of
2596 obtaining infinities and NaNs.
2597
2598 @item -Wsystem-headers
2599 @opindex Wsystem-headers
2600 @cindex warnings from system headers
2601 @cindex system headers, warnings from
2602 Print warning messages for constructs found in system header files.
2603 Warnings from system headers are normally suppressed, on the assumption
2604 that they usually do not indicate real problems and would only make the
2605 compiler output harder to read.  Using this command line option tells
2606 GCC to emit warnings from system headers as if they occurred in user
2607 code.  However, note that using @option{-Wall} in conjunction with this
2608 option will @emph{not} warn about unknown pragmas in system
2609 headers---for that, @option{-Wunknown-pragmas} must also be used.
2610
2611 @item -Wfloat-equal
2612 @opindex Wfloat-equal
2613 Warn if floating point values are used in equality comparisons.
2614
2615 The idea behind this is that sometimes it is convenient (for the
2616 programmer) to consider floating-point values as approximations to
2617 infinitely precise real numbers.  If you are doing this, then you need
2618 to compute (by analyzing the code, or in some other way) the maximum or
2619 likely maximum error that the computation introduces, and allow for it
2620 when performing comparisons (and when producing output, but that's a
2621 different problem).  In particular, instead of testing for equality, you
2622 would check to see whether the two values have ranges that overlap; and
2623 this is done with the relational operators, so equality comparisons are
2624 probably mistaken.
2625
2626 @item -Wtraditional @r{(C only)}
2627 @opindex Wtraditional
2628 Warn about certain constructs that behave differently in traditional and
2629 ISO C@.  Also warn about ISO C constructs that have no traditional C
2630 equivalent, and/or problematic constructs which should be avoided.
2631
2632 @itemize @bullet
2633 @item
2634 Macro parameters that appear within string literals in the macro body.
2635 In traditional C macro replacement takes place within string literals,
2636 but does not in ISO C@.
2637
2638 @item
2639 In traditional C, some preprocessor directives did not exist.
2640 Traditional preprocessors would only consider a line to be a directive
2641 if the @samp{#} appeared in column 1 on the line.  Therefore
2642 @option{-Wtraditional} warns about directives that traditional C
2643 understands but would ignore because the @samp{#} does not appear as the
2644 first character on the line.  It also suggests you hide directives like
2645 @samp{#pragma} not understood by traditional C by indenting them.  Some
2646 traditional implementations would not recognize @samp{#elif}, so it
2647 suggests avoiding it altogether.
2648
2649 @item
2650 A function-like macro that appears without arguments.
2651
2652 @item
2653 The unary plus operator.
2654
2655 @item
2656 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2657 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2658 constants.)  Note, these suffixes appear in macros defined in the system
2659 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2660 Use of these macros in user code might normally lead to spurious
2661 warnings, however gcc's integrated preprocessor has enough context to
2662 avoid warning in these cases.
2663
2664 @item
2665 A function declared external in one block and then used after the end of
2666 the block.
2667
2668 @item
2669 A @code{switch} statement has an operand of type @code{long}.
2670
2671 @item
2672 A non-@code{static} function declaration follows a @code{static} one.
2673 This construct is not accepted by some traditional C compilers.
2674
2675 @item
2676 The ISO type of an integer constant has a different width or
2677 signedness from its traditional type.  This warning is only issued if
2678 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2679 typically represent bit patterns, are not warned about.
2680
2681 @item
2682 Usage of ISO string concatenation is detected.
2683
2684 @item
2685 Initialization of automatic aggregates.
2686
2687 @item
2688 Identifier conflicts with labels.  Traditional C lacks a separate
2689 namespace for labels.
2690
2691 @item
2692 Initialization of unions.  If the initializer is zero, the warning is
2693 omitted.  This is done under the assumption that the zero initializer in
2694 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2695 initializer warnings and relies on default initialization to zero in the
2696 traditional C case.
2697
2698 @item
2699 Conversions by prototypes between fixed/floating point values and vice
2700 versa.  The absence of these prototypes when compiling with traditional
2701 C would cause serious problems.  This is a subset of the possible
2702 conversion warnings, for the full set use @option{-Wconversion}.
2703
2704 @item
2705 Use of ISO C style function definitions.  This warning intentionally is
2706 @emph{not} issued for prototype declarations or variadic functions
2707 because these ISO C features will appear in your code when using
2708 libiberty's traditional C compatibility macros, @code{PARAMS} and
2709 @code{VPARAMS}.  This warning is also bypassed for nested functions
2710 because that feature is already a gcc extension and thus not relevant to
2711 traditional C compatibility.
2712 @end itemize
2713
2714 @item -Wdeclaration-after-statement @r{(C only)}
2715 @opindex Wdeclaration-after-statement
2716 Warn when a declaration is found after a statement in a block.  This
2717 construct, known from C++, was introduced with ISO C99 and is by default
2718 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2719 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2720
2721 @item -Wundef
2722 @opindex Wundef
2723 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2724
2725 @item -Wendif-labels
2726 @opindex Wendif-labels
2727 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2728
2729 @item -Wshadow
2730 @opindex Wshadow
2731 Warn whenever a local variable shadows another local variable, parameter or
2732 global variable or whenever a built-in function is shadowed.
2733
2734 @item -Wlarger-than-@var{len}
2735 @opindex Wlarger-than
2736 Warn whenever an object of larger than @var{len} bytes is defined.
2737
2738 @item -Wpointer-arith
2739 @opindex Wpointer-arith
2740 Warn about anything that depends on the ``size of'' a function type or
2741 of @code{void}.  GNU C assigns these types a size of 1, for
2742 convenience in calculations with @code{void *} pointers and pointers
2743 to functions.
2744
2745 @item -Wbad-function-cast @r{(C only)}
2746 @opindex Wbad-function-cast
2747 Warn whenever a function call is cast to a non-matching type.
2748 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2749
2750 @item -Wcast-qual
2751 @opindex Wcast-qual
2752 Warn whenever a pointer is cast so as to remove a type qualifier from
2753 the target type.  For example, warn if a @code{const char *} is cast
2754 to an ordinary @code{char *}.
2755
2756 @item -Wcast-align
2757 @opindex Wcast-align
2758 Warn whenever a pointer is cast such that the required alignment of the
2759 target is increased.  For example, warn if a @code{char *} is cast to
2760 an @code{int *} on machines where integers can only be accessed at
2761 two- or four-byte boundaries.
2762
2763 @item -Wwrite-strings
2764 @opindex Wwrite-strings
2765 When compiling C, give string constants the type @code{const
2766 char[@var{length}]} so that
2767 copying the address of one into a non-@code{const} @code{char *}
2768 pointer will get a warning; when compiling C++, warn about the
2769 deprecated conversion from string constants to @code{char *}.
2770 These warnings will help you find at
2771 compile time code that can try to write into a string constant, but
2772 only if you have been very careful about using @code{const} in
2773 declarations and prototypes.  Otherwise, it will just be a nuisance;
2774 this is why we did not make @option{-Wall} request these warnings.
2775
2776 @item -Wconversion
2777 @opindex Wconversion
2778 Warn if a prototype causes a type conversion that is different from what
2779 would happen to the same argument in the absence of a prototype.  This
2780 includes conversions of fixed point to floating and vice versa, and
2781 conversions changing the width or signedness of a fixed point argument
2782 except when the same as the default promotion.
2783
2784 Also, warn if a negative integer constant expression is implicitly
2785 converted to an unsigned type.  For example, warn about the assignment
2786 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2787 casts like @code{(unsigned) -1}.
2788
2789 @item -Wsign-compare
2790 @opindex Wsign-compare
2791 @cindex warning for comparison of signed and unsigned values
2792 @cindex comparison of signed and unsigned values, warning
2793 @cindex signed and unsigned values, comparison warning
2794 Warn when a comparison between signed and unsigned values could produce
2795 an incorrect result when the signed value is converted to unsigned.
2796 This warning is also enabled by @option{-Wextra}; to get the other warnings
2797 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2798
2799 @item -Waggregate-return
2800 @opindex Waggregate-return
2801 Warn if any functions that return structures or unions are defined or
2802 called.  (In languages where you can return an array, this also elicits
2803 a warning.)
2804
2805 @item -Wstrict-prototypes @r{(C only)}
2806 @opindex Wstrict-prototypes
2807 Warn if a function is declared or defined without specifying the
2808 argument types.  (An old-style function definition is permitted without
2809 a warning if preceded by a declaration which specifies the argument
2810 types.)
2811
2812 @item -Wold-style-definition @r{(C only)}
2813 @opindex Wold-style-definition
2814 Warn if an old-style function definition is used.  A warning is given
2815 even if there is a previous prototype.
2816
2817 @item -Wmissing-prototypes @r{(C only)}
2818 @opindex Wmissing-prototypes
2819 Warn if a global function is defined without a previous prototype
2820 declaration.  This warning is issued even if the definition itself
2821 provides a prototype.  The aim is to detect global functions that fail
2822 to be declared in header files.
2823
2824 @item -Wmissing-declarations @r{(C only)}
2825 @opindex Wmissing-declarations
2826 Warn if a global function is defined without a previous declaration.
2827 Do so even if the definition itself provides a prototype.
2828 Use this option to detect global functions that are not declared in
2829 header files.
2830
2831 @item -Wmissing-noreturn
2832 @opindex Wmissing-noreturn
2833 Warn about functions which might be candidates for attribute @code{noreturn}.
2834 Note these are only possible candidates, not absolute ones.  Care should
2835 be taken to manually verify functions actually do not ever return before
2836 adding the @code{noreturn} attribute, otherwise subtle code generation
2837 bugs could be introduced.  You will not get a warning for @code{main} in
2838 hosted C environments.
2839
2840 @item -Wmissing-format-attribute
2841 @opindex Wmissing-format-attribute
2842 @opindex Wformat
2843 If @option{-Wformat} is enabled, also warn about functions which might be
2844 candidates for @code{format} attributes.  Note these are only possible
2845 candidates, not absolute ones.  GCC will guess that @code{format}
2846 attributes might be appropriate for any function that calls a function
2847 like @code{vprintf} or @code{vscanf}, but this might not always be the
2848 case, and some functions for which @code{format} attributes are
2849 appropriate may not be detected.  This option has no effect unless
2850 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2851
2852 @item -Wno-multichar
2853 @opindex Wno-multichar
2854 @opindex Wmultichar
2855 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2856 Usually they indicate a typo in the user's code, as they have
2857 implementation-defined values, and should not be used in portable code.
2858
2859 @item -Wno-deprecated-declarations
2860 @opindex Wno-deprecated-declarations
2861 Do not warn about uses of functions, variables, and types marked as
2862 deprecated by using the @code{deprecated} attribute.
2863 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2864 @pxref{Type Attributes}.)
2865
2866 @item -Wpacked
2867 @opindex Wpacked
2868 Warn if a structure is given the packed attribute, but the packed
2869 attribute has no effect on the layout or size of the structure.
2870 Such structures may be mis-aligned for little benefit.  For
2871 instance, in this code, the variable @code{f.x} in @code{struct bar}
2872 will be misaligned even though @code{struct bar} does not itself
2873 have the packed attribute:
2874
2875 @smallexample
2876 @group
2877 struct foo @{
2878   int x;
2879   char a, b, c, d;
2880 @} __attribute__((packed));
2881 struct bar @{
2882   char z;
2883   struct foo f;
2884 @};
2885 @end group
2886 @end smallexample
2887
2888 @item -Wpadded
2889 @opindex Wpadded
2890 Warn if padding is included in a structure, either to align an element
2891 of the structure or to align the whole structure.  Sometimes when this
2892 happens it is possible to rearrange the fields of the structure to
2893 reduce the padding and so make the structure smaller.
2894
2895 @item -Wredundant-decls
2896 @opindex Wredundant-decls
2897 Warn if anything is declared more than once in the same scope, even in
2898 cases where multiple declaration is valid and changes nothing.
2899
2900 @item -Wnested-externs @r{(C only)}
2901 @opindex Wnested-externs
2902 Warn if an @code{extern} declaration is encountered within a function.
2903
2904 @item -Wunreachable-code
2905 @opindex Wunreachable-code
2906 Warn if the compiler detects that code will never be executed.
2907
2908 This option is intended to warn when the compiler detects that at
2909 least a whole line of source code will never be executed, because
2910 some condition is never satisfied or because it is after a
2911 procedure that never returns.
2912
2913 It is possible for this option to produce a warning even though there
2914 are circumstances under which part of the affected line can be executed,
2915 so care should be taken when removing apparently-unreachable code.
2916
2917 For instance, when a function is inlined, a warning may mean that the
2918 line is unreachable in only one inlined copy of the function.
2919
2920 This option is not made part of @option{-Wall} because in a debugging
2921 version of a program there is often substantial code which checks
2922 correct functioning of the program and is, hopefully, unreachable
2923 because the program does work.  Another common use of unreachable
2924 code is to provide behavior which is selectable at compile-time.
2925
2926 @item -Winline
2927 @opindex Winline
2928 Warn if a function can not be inlined and it was declared as inline.
2929 Even with this option, the compiler will not warn about failures to
2930 inline functions declared in system headers.
2931
2932 The compiler uses a variety of heuristics to determine whether or not
2933 to inline a function.  For example, the compiler takes into account
2934 the size of the function being inlined and the the amount of inlining
2935 that has already been done in the current function.  Therefore,
2936 seemingly insignificant changes in the source program can cause the
2937 warnings produced by @option{-Winline} to appear or disappear.
2938
2939 @item -Wno-invalid-offsetof @r{(C++ only)}
2940 @opindex Wno-invalid-offsetof
2941 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
2942 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
2943 to a non-POD type is undefined.  In existing C++ implementations,
2944 however, @samp{offsetof} typically gives meaningful results even when
2945 applied to certain kinds of non-POD types. (Such as a simple
2946 @samp{struct} that fails to be a POD type only by virtue of having a
2947 constructor.)  This flag is for users who are aware that they are
2948 writing nonportable code and who have deliberately chosen to ignore the
2949 warning about it.
2950
2951 The restrictions on @samp{offsetof} may be relaxed in a future version
2952 of the C++ standard.
2953
2954 @item -Winvalid-pch
2955 @opindex Winvalid-pch
2956 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
2957 the search path but can't be used.
2958
2959 @item -Wlong-long
2960 @opindex Wlong-long
2961 @opindex Wno-long-long
2962 Warn if @samp{long long} type is used.  This is default.  To inhibit
2963 the warning messages, use @option{-Wno-long-long}.  Flags
2964 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2965 only when @option{-pedantic} flag is used.
2966
2967 @item -Wvariadic-macros
2968 @opindex Wvariadic-macros
2969 @opindex Wno-variadic-macros
2970 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
2971 alternate syntax when in pedantic ISO C99 mode.  This is default.
2972 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
2973
2974 @item -Wdisabled-optimization
2975 @opindex Wdisabled-optimization
2976 Warn if a requested optimization pass is disabled.  This warning does
2977 not generally indicate that there is anything wrong with your code; it
2978 merely indicates that GCC's optimizers were unable to handle the code
2979 effectively.  Often, the problem is that your code is too big or too
2980 complex; GCC will refuse to optimize programs when the optimization
2981 itself is likely to take inordinate amounts of time.
2982
2983 @item -Werror
2984 @opindex Werror
2985 Make all warnings into errors.
2986 @end table
2987
2988 @node Debugging Options
2989 @section Options for Debugging Your Program or GCC
2990 @cindex options, debugging
2991 @cindex debugging information options
2992
2993 GCC has various special options that are used for debugging
2994 either your program or GCC:
2995
2996 @table @gcctabopt
2997 @item -g
2998 @opindex g
2999 Produce debugging information in the operating system's native format
3000 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
3001 information.
3002
3003 On most systems that use stabs format, @option{-g} enables use of extra
3004 debugging information that only GDB can use; this extra information
3005 makes debugging work better in GDB but will probably make other debuggers
3006 crash or
3007 refuse to read the program.  If you want to control for certain whether
3008 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3009 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3010
3011 Unlike most other C compilers, GCC allows you to use @option{-g} with
3012 @option{-O}.  The shortcuts taken by optimized code may occasionally
3013 produce surprising results: some variables you declared may not exist
3014 at all; flow of control may briefly move where you did not expect it;
3015 some statements may not be executed because they compute constant
3016 results or their values were already at hand; some statements may
3017 execute in different places because they were moved out of loops.
3018
3019 Nevertheless it proves possible to debug optimized output.  This makes
3020 it reasonable to use the optimizer for programs that might have bugs.
3021
3022 The following options are useful when GCC is generated with the
3023 capability for more than one debugging format.
3024
3025 @item -ggdb
3026 @opindex ggdb
3027 Produce debugging information for use by GDB@.  This means to use the
3028 most expressive format available (DWARF 2, stabs, or the native format
3029 if neither of those are supported), including GDB extensions if at all
3030 possible.
3031
3032 @item -gstabs
3033 @opindex gstabs
3034 Produce debugging information in stabs format (if that is supported),
3035 without GDB extensions.  This is the format used by DBX on most BSD
3036 systems.  On MIPS, Alpha and System V Release 4 systems this option
3037 produces stabs debugging output which is not understood by DBX or SDB@.
3038 On System V Release 4 systems this option requires the GNU assembler.
3039
3040 @item -feliminate-unused-debug-symbols
3041 @opindex feliminate-unused-debug-symbols
3042 Produce debugging information in stabs format (if that is supported),
3043 for only symbols that are actually used.
3044
3045 @item -gstabs+
3046 @opindex gstabs+
3047 Produce debugging information in stabs format (if that is supported),
3048 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3049 use of these extensions is likely to make other debuggers crash or
3050 refuse to read the program.
3051
3052 @item -gcoff
3053 @opindex gcoff
3054 Produce debugging information in COFF format (if that is supported).
3055 This is the format used by SDB on most System V systems prior to
3056 System V Release 4.
3057
3058 @item -gxcoff
3059 @opindex gxcoff
3060 Produce debugging information in XCOFF format (if that is supported).
3061 This is the format used by the DBX debugger on IBM RS/6000 systems.
3062
3063 @item -gxcoff+
3064 @opindex gxcoff+
3065 Produce debugging information in XCOFF format (if that is supported),
3066 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3067 use of these extensions is likely to make other debuggers crash or
3068 refuse to read the program, and may cause assemblers other than the GNU
3069 assembler (GAS) to fail with an error.
3070
3071 @item -gdwarf-2
3072 @opindex gdwarf-2
3073 Produce debugging information in DWARF version 2 format (if that is
3074 supported).  This is the format used by DBX on IRIX 6.
3075
3076 @item -gvms
3077 @opindex gvms
3078 Produce debugging information in VMS debug format (if that is
3079 supported).  This is the format used by DEBUG on VMS systems.
3080
3081 @item -g@var{level}
3082 @itemx -ggdb@var{level}
3083 @itemx -gstabs@var{level}
3084 @itemx -gcoff@var{level}
3085 @itemx -gxcoff@var{level}
3086 @itemx -gvms@var{level}
3087 Request debugging information and also use @var{level} to specify how
3088 much information.  The default level is 2.
3089
3090 Level 1 produces minimal information, enough for making backtraces in
3091 parts of the program that you don't plan to debug.  This includes
3092 descriptions of functions and external variables, but no information
3093 about local variables and no line numbers.
3094
3095 Level 3 includes extra information, such as all the macro definitions
3096 present in the program.  Some debuggers support macro expansion when
3097 you use @option{-g3}.
3098
3099 Note that in order to avoid confusion between DWARF1 debug level 2,
3100 and DWARF2 @option{-gdwarf-2} does not accept a concatenated debug
3101 level.  Instead use an additional @option{-g@var{level}} option to
3102 change the debug level for DWARF2.
3103
3104 @item -feliminate-dwarf2-dups
3105 @opindex feliminate-dwarf2-dups
3106 Compress DWARF2 debugging information by eliminating duplicated
3107 information about each symbol.  This option only makes sense when
3108 generating DWARF2 debugging information with @option{-gdwarf-2}.
3109
3110 @cindex @command{prof}
3111 @item -p
3112 @opindex p
3113 Generate extra code to write profile information suitable for the
3114 analysis program @command{prof}.  You must use this option when compiling
3115 the source files you want data about, and you must also use it when
3116 linking.
3117
3118 @cindex @command{gprof}
3119 @item -pg
3120 @opindex pg
3121 Generate extra code to write profile information suitable for the
3122 analysis program @command{gprof}.  You must use this option when compiling
3123 the source files you want data about, and you must also use it when
3124 linking.
3125
3126 @item -Q
3127 @opindex Q
3128 Makes the compiler print out each function name as it is compiled, and
3129 print some statistics about each pass when it finishes.
3130
3131 @item -ftime-report
3132 @opindex ftime-report
3133 Makes the compiler print some statistics about the time consumed by each
3134 pass when it finishes.
3135
3136 @item -fmem-report
3137 @opindex fmem-report
3138 Makes the compiler print some statistics about permanent memory
3139 allocation when it finishes.
3140
3141 @item -fprofile-arcs
3142 @opindex fprofile-arcs
3143 Add code so that program flow @dfn{arcs} are instrumented.  During
3144 execution the program records how many times each branch and call is
3145 executed and how many times it is taken or returns.  When the compiled
3146 program exits it saves this data to a file called
3147 @file{@var{auxname}.gcda} for each source file. The data may be used for
3148 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3149 test coverage analysis (@option{-ftest-coverage}). Each object file's
3150 @var{auxname} is generated from the name of the output file, if
3151 explicitly specified and it is not the final executable, otherwise it is
3152 the basename of the source file. In both cases any suffix is removed
3153 (e.g.  @file{foo.gcda} for input file @file{dir/foo.c}, or
3154 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3155
3156 @itemize
3157
3158 @item
3159 Compile the source files with @option{-fprofile-arcs} plus optimization
3160 and code generation options. For test coverage analysis, use the
3161 additional @option{-ftest-coverage} option. You do not need to profile
3162 every source file in a program.
3163
3164 @item
3165 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3166 (the latter implies the former).
3167
3168 @item
3169 Run the program on a representative workload to generate the arc profile
3170 information. This may be repeated any number of times. You can run
3171 concurrent instances of your program, and provided that the file system
3172 supports locking, the data files will be correctly updated. Also
3173 @code{fork} calls are detected and correctly handled (double counting
3174 will not happen).
3175
3176 @item
3177 For profile-directed optimizations, compile the source files again with
3178 the same optimization and code generation options plus
3179 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3180 Control Optimization}).
3181
3182 @item
3183 For test coverage analysis, use @command{gcov} to produce human readable
3184 information from the @file{.gcno} and @file{.gcda} files. Refer to the
3185 @command{gcov} documentation for further information.
3186
3187 @end itemize
3188
3189 With @option{-fprofile-arcs}, for each function of your program GCC
3190 creates a program flow graph, then finds a spanning tree for the graph.
3191 Only arcs that are not on the spanning tree have to be instrumented: the
3192 compiler adds code to count the number of times that these arcs are
3193 executed.  When an arc is the only exit or only entrance to a block, the
3194 instrumentation code can be added to the block; otherwise, a new basic
3195 block must be created to hold the instrumentation code.
3196
3197 @need 2000
3198 @item -ftest-coverage
3199 @opindex ftest-coverage
3200 Produce a notes file that the @command{gcov} code-coverage utility
3201 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3202 show program coverage. Each source file's note file is called
3203 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
3204 above for a description of @var{auxname} and instructions on how to
3205 generate test coverage data. Coverage data will match the source files
3206 more closely, if you do not optimize.
3207
3208 @item -d@var{letters}
3209 @opindex d
3210 Says to make debugging dumps during compilation at times specified by
3211 @var{letters}.  This is used for debugging the compiler.  The file names
3212 for most of the dumps are made by appending a pass number and a word to
3213 the @var{dumpname}. @var{dumpname} is generated from the name of the
3214 output file, if explicitly specified and it is not an executable,
3215 otherwise it is the basename of the source file. In both cases any
3216 suffix is removed (e.g.  @file{foo.01.rtl} or @file{foo.02.sibling}).
3217 Here are the possible letters for use in @var{letters}, and their
3218 meanings:
3219
3220 @table @samp
3221 @item A
3222 @opindex dA
3223 Annotate the assembler output with miscellaneous debugging information.
3224 @item b
3225 @opindex db
3226 Dump after computing branch probabilities, to @file{@var{file}.12.bp}.
3227 @item B
3228 @opindex dB
3229 Dump after block reordering, to @file{@var{file}.31.bbro}.
3230 @item c
3231 @opindex dc
3232 Dump after instruction combination, to the file @file{@var{file}.20.combine}.
3233 @item C
3234 @opindex dC
3235 Dump after the first if conversion, to the file @file{@var{file}.14.ce1}.
3236 Also dump after the second if conversion, to the file @file{@var{file}.21.ce2}.
3237 @item d
3238 @opindex dd
3239 Dump after branch target load optimization, to to @file{@var{file}.32.btl}.
3240 Also dump after delayed branch scheduling, to @file{@var{file}.36.dbr}.
3241 @item D
3242 @opindex dD
3243 Dump all macro definitions, at the end of preprocessing, in addition to
3244 normal output.
3245 @item E
3246 @opindex dE
3247 Dump after the third if conversion, to @file{@var{file}.30.ce3}.
3248 @item f
3249 @opindex df
3250 Dump after control and data flow analysis, to @file{@var{file}.11.cfg}.
3251 Also dump after life analysis, to @file{@var{file}.19.life}.
3252 @item F
3253 @opindex dF
3254 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.07.addressof}.
3255 @item g
3256 @opindex dg
3257 Dump after global register allocation, to @file{@var{file}.25.greg}.
3258 @item G
3259 @opindex dG
3260 Dump after GCSE, to @file{@var{file}.08.gcse}.
3261 Also dump after jump bypassing and control flow optimizations, to
3262 @file{@var{file}.10.bypass}.
3263 @item h
3264 @opindex dh
3265 Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
3266 @item i
3267 @opindex di
3268 Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
3269 @item j
3270 @opindex dj
3271 Dump after the first jump optimization, to @file{@var{file}.04.jump}.
3272 @item k
3273 @opindex dk
3274 Dump after conversion from registers to stack, to @file{@var{file}.34.stack}.
3275 @item l
3276 @opindex dl
3277 Dump after local register allocation, to @file{@var{file}.24.lreg}.
3278 @item L
3279 @opindex dL
3280 Dump after loop optimization passes, to @file{@var{file}.09.loop} and
3281 @file{@var{file}.16.loop2}.
3282 @item M
3283 @opindex dM
3284 Dump after performing the machine dependent reorganization pass, to
3285 @file{@var{file}.35.mach}.
3286 @item n
3287 @opindex dn
3288 Dump after register renumbering, to @file{@var{file}.29.rnreg}.
3289 @item N
3290 @opindex dN
3291 Dump after the register move pass, to @file{@var{file}.22.regmove}.
3292 @item o
3293 @opindex do
3294 Dump after post-reload optimizations, to @file{@var{file}.26.postreload}.
3295 @item r
3296 @opindex dr
3297 Dump after RTL generation, to @file{@var{file}.01.rtl}.
3298 @item R
3299 @opindex dR
3300 Dump after the second scheduling pass, to @file{@var{file}.33.sched2}.
3301 @item s
3302 @opindex ds
3303 Dump after CSE (including the jump optimization that sometimes follows
3304 CSE), to @file{@var{file}.06.cse}.
3305 @item S
3306 @opindex dS
3307 Dump after the first scheduling pass, to @file{@var{file}.23.sched}.
3308 @item t
3309 @opindex dt
3310 Dump after the second CSE pass (including the jump optimization that
3311 sometimes follows CSE), to @file{@var{file}.18.cse2}.
3312 @item T
3313 @opindex dT
3314 Dump after running tracer, to @file{@var{file}.15.tracer}.
3315 @item u
3316 @opindex du
3317 Dump after null pointer elimination pass to @file{@var{file}.05.null}.
3318 @item U
3319 @opindex dU
3320 Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
3321 @item V
3322 @opindex dV
3323 Dump after the value profile transformations, to @file{@var{file}.13.vpt}.
3324 Also dump after variable tracking, to @file{@var{file}.35.vartrack}.
3325 @item w
3326 @opindex dw
3327 Dump after the second flow pass, to @file{@var{file}.27.flow2}.
3328 @item z
3329 @opindex dz
3330 Dump after the peephole pass, to @file{@var{file}.28.peephole2}.
3331 @item Z
3332 @opindex dZ
3333 Dump after constructing the web, to @file{@var{file}.17.web}.
3334 @item a
3335 @opindex da
3336 Produce all the dumps listed above.
3337 @item H
3338 @opindex dH
3339 Produce a core dump whenever an error occurs.
3340 @item m
3341 @opindex dm
3342 Print statistics on memory usage, at the end of the run, to
3343 standard error.
3344 @item p
3345 @opindex dp
3346 Annotate the assembler output with a comment indicating which
3347 pattern and alternative was used.  The length of each instruction is
3348 also printed.
3349 @item P
3350 @opindex dP
3351 Dump the RTL in the assembler output as a comment before each instruction.
3352 Also turns on @option{-dp} annotation.
3353 @item v
3354 @opindex dv
3355 For each of the other indicated dump files (except for
3356 @file{@var{file}.01.rtl}), dump a representation of the control flow graph
3357 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3358 @item x
3359 @opindex dx
3360 Just generate RTL for a function instead of compiling it.  Usually used
3361 with @samp{r}.
3362 @item y
3363 @opindex dy
3364 Dump debugging information during parsing, to standard error.
3365 @end table
3366
3367 @item -fdump-unnumbered
3368 @opindex fdump-unnumbered
3369 When doing debugging dumps (see @option{-d} option above), suppress instruction
3370 numbers and line number note output.  This makes it more feasible to
3371 use diff on debugging dumps for compiler invocations with different
3372 options, in particular with and without @option{-g}.
3373
3374 @item -fdump-translation-unit @r{(C and C++ only)}
3375 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3376 @opindex fdump-translation-unit
3377 Dump a representation of the tree structure for the entire translation
3378 unit to a file.  The file name is made by appending @file{.tu} to the
3379 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3380 controls the details of the dump as described for the
3381 @option{-fdump-tree} options.
3382
3383 @item -fdump-class-hierarchy @r{(C++ only)}
3384 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3385 @opindex fdump-class-hierarchy
3386 Dump a representation of each class's hierarchy and virtual function
3387 table layout to a file.  The file name is made by appending @file{.class}
3388 to the source file name.  If the @samp{-@var{options}} form is used,
3389 @var{options} controls the details of the dump as described for the
3390 @option{-fdump-tree} options.
3391
3392 @item -fdump-tree-@var{switch} @r{(C++ only)}
3393 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3394 @opindex fdump-tree
3395 Control the dumping at various stages of processing the intermediate
3396 language tree to a file.  The file name is generated by appending a switch
3397 specific suffix to the source file name.  If the @samp{-@var{options}}
3398 form is used, @var{options} is a list of @samp{-} separated options that
3399 control the details of the dump. Not all options are applicable to all
3400 dumps, those which are not meaningful will be ignored. The following
3401 options are available
3402
3403 @table @samp
3404 @item address
3405 Print the address of each node.  Usually this is not meaningful as it
3406 changes according to the environment and source file. Its primary use
3407 is for tying up a dump file with a debug environment.
3408 @item slim
3409 Inhibit dumping of members of a scope or body of a function merely
3410 because that scope has been reached. Only dump such items when they
3411 are directly reachable by some other path.
3412 @item all
3413 Turn on all options.
3414 @end table
3415
3416 The following tree dumps are possible:
3417 @table @samp
3418 @item original
3419 Dump before any tree based optimization, to @file{@var{file}.original}.
3420 @item optimized
3421 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3422 @item inlined
3423 Dump after function inlining, to @file{@var{file}.inlined}.
3424 @end table
3425
3426 @item -frandom-seed=@var{string}
3427 @opindex frandom-string
3428 This option provides a seed that GCC uses when it would otherwise use
3429 random numbers.  It is used to generate certain symbol names
3430 that have to be different in every compiled file. It is also used to
3431 place unique stamps in coverage data files and the object files that
3432 produce them. You can use the @option{-frandom-seed} option to produce
3433 reproducibly identical object files.
3434
3435 The @var{string} should be different for every file you compile.
3436
3437 @item -fsched-verbose=@var{n}
3438 @opindex fsched-verbose
3439 On targets that use instruction scheduling, this option controls the
3440 amount of debugging output the scheduler prints.  This information is
3441 written to standard error, unless @option{-dS} or @option{-dR} is
3442 specified, in which case it is output to the usual dump
3443 listing file, @file{.sched} or @file{.sched2} respectively.  However
3444 for @var{n} greater than nine, the output is always printed to standard
3445 error.
3446
3447 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3448 same information as @option{-dRS}.  For @var{n} greater than one, it
3449 also output basic block probabilities, detailed ready list information
3450 and unit/insn info.  For @var{n} greater than two, it includes RTL
3451 at abort point, control-flow and regions info.  And for @var{n} over
3452 four, @option{-fsched-verbose} also includes dependence info.
3453
3454 @item -save-temps
3455 @opindex save-temps
3456 Store the usual ``temporary'' intermediate files permanently; place them
3457 in the current directory and name them based on the source file.  Thus,
3458 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3459 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3460 preprocessed @file{foo.i} output file even though the compiler now
3461 normally uses an integrated preprocessor.
3462
3463 @item -time
3464 @opindex time
3465 Report the CPU time taken by each subprocess in the compilation
3466 sequence.  For C source files, this is the compiler proper and assembler
3467 (plus the linker if linking is done).  The output looks like this:
3468
3469 @smallexample
3470 # cc1 0.12 0.01
3471 # as 0.00 0.01
3472 @end smallexample
3473
3474 The first number on each line is the ``user time,'' that is time spent
3475 executing the program itself.  The second number is ``system time,''
3476 time spent executing operating system routines on behalf of the program.
3477 Both numbers are in seconds.
3478
3479 @item -fvar-tracking
3480 @opindex fvar-tracking
3481 Run variable tracking pass. It computes where variables are stored at each
3482 position in code. Better debugging information is then generated
3483 (if the debugging information format supports this information).
3484
3485 It is enabled by default when compiling with optimization (@option{-Os},
3486 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
3487 the debug info format supports it.
3488
3489 @item -print-file-name=@var{library}
3490 @opindex print-file-name
3491 Print the full absolute name of the library file @var{library} that
3492 would be used when linking---and don't do anything else.  With this
3493 option, GCC does not compile or link anything; it just prints the
3494 file name.
3495
3496 @item -print-multi-directory
3497 @opindex print-multi-directory
3498 Print the directory name corresponding to the multilib selected by any
3499 other switches present in the command line.  This directory is supposed
3500 to exist in @env{GCC_EXEC_PREFIX}.
3501
3502 @item -print-multi-lib
3503 @opindex print-multi-lib
3504 Print the mapping from multilib directory names to compiler switches
3505 that enable them.  The directory name is separated from the switches by
3506 @samp{;}, and each switch starts with an @samp{@@} instead of the
3507 @samp{-}, without spaces between multiple switches.  This is supposed to
3508 ease shell-processing.
3509
3510 @item -print-prog-name=@var{program}
3511 @opindex print-prog-name
3512 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3513
3514 @item -print-libgcc-file-name
3515 @opindex print-libgcc-file-name
3516 Same as @option{-print-file-name=libgcc.a}.
3517
3518 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3519 but you do want to link with @file{libgcc.a}.  You can do
3520
3521 @smallexample
3522 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3523 @end smallexample
3524
3525 @item -print-search-dirs
3526 @opindex print-search-dirs
3527 Print the name of the configured installation directory and a list of
3528 program and library directories gcc will search---and don't do anything else.
3529
3530 This is useful when gcc prints the error message
3531 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3532 To resolve this you either need to put @file{cpp0} and the other compiler
3533 components where gcc expects to find them, or you can set the environment
3534 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3535 Don't forget the trailing '/'.
3536 @xref{Environment Variables}.
3537
3538 @item -dumpmachine
3539 @opindex dumpmachine
3540 Print the compiler's target machine (for example,
3541 @samp{i686-pc-linux-gnu})---and don't do anything else.
3542
3543 @item -dumpversion
3544 @opindex dumpversion
3545 Print the compiler version (for example, @samp{3.0})---and don't do
3546 anything else.
3547
3548 @item -dumpspecs
3549 @opindex dumpspecs
3550 Print the compiler's built-in specs---and don't do anything else.  (This
3551 is used when GCC itself is being built.)  @xref{Spec Files}.
3552
3553 @item -feliminate-unused-debug-types
3554 @opindex feliminate-unused-debug-types
3555 Normally, when producing DWARF2 output, GCC will emit debugging
3556 information for all types declared in a compilation
3557 unit, regardless of whether or not they are actually used
3558 in that compilation unit.  Sometimes this is useful, such as
3559 if, in the debugger, you want to cast a value to a type that is
3560 not actually used in your program (but is declared).  More often,
3561 however, this results in a significant amount of wasted space.
3562 With this option, GCC will avoid producing debug symbol output
3563 for types that are nowhere used in the source file being compiled.
3564 @end table
3565
3566 @node Optimize Options
3567 @section Options That Control Optimization
3568 @cindex optimize options
3569 @cindex options, optimization
3570
3571 These options control various sorts of optimizations.
3572
3573 Without any optimization option, the compiler's goal is to reduce the
3574 cost of compilation and to make debugging produce the expected
3575 results.  Statements are independent: if you stop the program with a
3576 breakpoint between statements, you can then assign a new value to any
3577 variable or change the program counter to any other statement in the
3578 function and get exactly the results you would expect from the source
3579 code.
3580
3581 Turning on optimization flags makes the compiler attempt to improve
3582 the performance and/or code size at the expense of compilation time
3583 and possibly the ability to debug the program.
3584
3585 The compiler performs optimization based on the knowledge it has of
3586 the program.  Using the @option{-funit-at-a-time} flag will allow the
3587 compiler to consider information gained from later functions in the
3588 file when compiling a function.  Compiling multiple files at once to a
3589 single output file (and using @option{-funit-at-a-time}) will allow
3590 the compiler to use information gained from all of the files when
3591 compiling each of them.
3592
3593 Not all optimizations are controlled directly by a flag.  Only
3594 optimizations that have a flag are listed.
3595
3596 @table @gcctabopt
3597 @item -O
3598 @itemx -O1
3599 @opindex O
3600 @opindex O1
3601 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3602 more memory for a large function.
3603
3604 With @option{-O}, the compiler tries to reduce code size and execution
3605 time, without performing any optimizations that take a great deal of
3606 compilation time.
3607
3608 @option{-O} turns on the following optimization flags:
3609 @gccoptlist{-fdefer-pop @gol
3610 -fmerge-constants @gol
3611 -fthread-jumps @gol
3612 -floop-optimize @gol
3613 -fif-conversion @gol
3614 -fif-conversion2 @gol
3615 -fdelayed-branch @gol
3616 -fguess-branch-probability @gol
3617 -fcprop-registers}
3618
3619 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
3620 where doing so does not interfere with debugging.
3621
3622 @item -O2
3623 @opindex O2
3624 Optimize even more.  GCC performs nearly all supported optimizations
3625 that do not involve a space-speed tradeoff.  The compiler does not
3626 perform loop unrolling or function inlining when you specify @option{-O2}.
3627 As compared to @option{-O}, this option increases both compilation time
3628 and the performance of the generated code.
3629
3630 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
3631 also turns on the following optimization flags:
3632 @gccoptlist{-fforce-mem @gol
3633 -foptimize-sibling-calls @gol
3634 -fstrength-reduce @gol
3635 -fcse-follow-jumps  -fcse-skip-blocks @gol
3636 -frerun-cse-after-loop  -frerun-loop-opt @gol
3637 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las @gol
3638 -fdelete-null-pointer-checks @gol
3639 -fexpensive-optimizations @gol
3640 -fregmove @gol
3641 -fschedule-insns  -fschedule-insns2 @gol
3642 -fsched-interblock  -fsched-spec @gol
3643 -fcaller-saves @gol
3644 -fpeephole2 @gol
3645 -freorder-blocks  -freorder-functions @gol
3646 -fstrict-aliasing @gol
3647 -funit-at-a-time @gol
3648 -falign-functions  -falign-jumps @gol
3649 -falign-loops  -falign-labels @gol
3650 -fcrossjumping}
3651
3652 Please note the warning under @option{-fgcse} about
3653 invoking @option{-O2} on programs that use computed gotos.
3654
3655 @item -O3
3656 @opindex O3
3657 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3658 @option{-O2} and also turns on the @option{-finline-functions},
3659 @option{-fweb} and @option{-frename-registers} options.
3660
3661 @item -O0
3662 @opindex O0
3663 Do not optimize.  This is the default.
3664
3665 @item -Os
3666 @opindex Os
3667 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3668 do not typically increase code size.  It also performs further
3669 optimizations designed to reduce code size.
3670
3671 @option{-Os} disables the following optimization flags:
3672 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3673 -falign-labels  -freorder-blocks  -fprefetch-loop-arrays}
3674
3675 If you use multiple @option{-O} options, with or without level numbers,
3676 the last such option is the one that is effective.
3677 @end table
3678
3679 Options of the form @option{-f@var{flag}} specify machine-independent
3680 flags.  Most flags have both positive and negative forms; the negative
3681 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3682 below, only one of the forms is listed---the one you typically will
3683 use.  You can figure out the other form by either removing @samp{no-}
3684 or adding it.
3685
3686 The following options control specific optimizations.  They are either
3687 activated by @option{-O} options or are related to ones that are.  You
3688 can use the following flags in the rare cases when ``fine-tuning'' of
3689 optimizations to be performed is desired.
3690
3691 @table @gcctabopt
3692 @item -fno-default-inline
3693 @opindex fno-default-inline
3694 Do not make member functions inline by default merely because they are
3695 defined inside the class scope (C++ only).  Otherwise, when you specify
3696 @w{@option{-O}}, member functions defined inside class scope are compiled
3697 inline by default; i.e., you don't need to add @samp{inline} in front of
3698 the member function name.
3699
3700 @item -fno-defer-pop
3701 @opindex fno-defer-pop
3702 Always pop the arguments to each function call as soon as that function
3703 returns.  For machines which must pop arguments after a function call,
3704 the compiler normally lets arguments accumulate on the stack for several
3705 function calls and pops them all at once.
3706
3707 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3708
3709 @item -fforce-mem
3710 @opindex fforce-mem
3711 Force memory operands to be copied into registers before doing
3712 arithmetic on them.  This produces better code by making all memory
3713 references potential common subexpressions.  When they are not common
3714 subexpressions, instruction combination should eliminate the separate
3715 register-load.
3716
3717 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3718
3719 @item -fforce-addr
3720 @opindex fforce-addr
3721 Force memory address constants to be copied into registers before
3722 doing arithmetic on them.  This may produce better code just as
3723 @option{-fforce-mem} may.
3724
3725 @item -fomit-frame-pointer
3726 @opindex fomit-frame-pointer
3727 Don't keep the frame pointer in a register for functions that
3728 don't need one.  This avoids the instructions to save, set up and
3729 restore frame pointers; it also makes an extra register available
3730 in many functions.  @strong{It also makes debugging impossible on
3731 some machines.}
3732
3733 On some machines, such as the VAX, this flag has no effect, because
3734 the standard calling sequence automatically handles the frame pointer
3735 and nothing is saved by pretending it doesn't exist.  The
3736 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3737 whether a target machine supports this flag.  @xref{Registers,,Register
3738 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3739
3740 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3741
3742 @item -foptimize-sibling-calls
3743 @opindex foptimize-sibling-calls
3744 Optimize sibling and tail recursive calls.
3745
3746 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3747
3748 @item -fno-inline
3749 @opindex fno-inline
3750 Don't pay attention to the @code{inline} keyword.  Normally this option
3751 is used to keep the compiler from expanding any functions inline.
3752 Note that if you are not optimizing, no functions can be expanded inline.
3753
3754 @item -finline-functions
3755 @opindex finline-functions
3756 Integrate all simple functions into their callers.  The compiler
3757 heuristically decides which functions are simple enough to be worth
3758 integrating in this way.
3759
3760 If all calls to a given function are integrated, and the function is
3761 declared @code{static}, then the function is normally not output as
3762 assembler code in its own right.
3763
3764 Enabled at level @option{-O3}.
3765
3766 @item -finline-limit=@var{n}
3767 @opindex finline-limit
3768 By default, gcc limits the size of functions that can be inlined.  This flag
3769 allows the control of this limit for functions that are explicitly marked as
3770 inline (i.e., marked with the inline keyword or defined within the class
3771 definition in c++).  @var{n} is the size of functions that can be inlined in
3772 number of pseudo instructions (not counting parameter handling).  The default
3773 value of @var{n} is 600.
3774 Increasing this value can result in more inlined code at
3775 the cost of compilation time and memory consumption.  Decreasing usually makes
3776 the compilation faster and less code will be inlined (which presumably
3777 means slower programs).  This option is particularly useful for programs that
3778 use inlining heavily such as those based on recursive templates with C++.
3779
3780 Inlining is actually controlled by a number of parameters, which may be
3781 specified individually by using @option{--param @var{name}=@var{value}}.
3782 The @option{-finline-limit=@var{n}} option sets some of these parameters
3783 as follows:
3784
3785 @table @gcctabopt
3786  @item max-inline-insns-single
3787   is set to @var{n}/2.
3788  @item max-inline-insns-auto
3789   is set to @var{n}/2.
3790  @item min-inline-insns
3791   is set to 130 or @var{n}/4, whichever is smaller.
3792  @item max-inline-insns-rtl
3793   is set to @var{n}.
3794 @end table
3795
3796 See below for a documentation of the individual
3797 parameters controlling inlining.
3798
3799 @emph{Note:} pseudo instruction represents, in this particular context, an
3800 abstract measurement of function's size.  In no way, it represents a count
3801 of assembly instructions and as such its exact meaning might change from one
3802 release to an another.
3803
3804 @item -fkeep-inline-functions
3805 @opindex fkeep-inline-functions
3806 Even if all calls to a given function are integrated, and the function
3807 is declared @code{static}, nevertheless output a separate run-time
3808 callable version of the function.  This switch does not affect
3809 @code{extern inline} functions.
3810
3811 @item -fkeep-static-consts
3812 @opindex fkeep-static-consts
3813 Emit variables declared @code{static const} when optimization isn't turned
3814 on, even if the variables aren't referenced.
3815
3816 GCC enables this option by default.  If you want to force the compiler to
3817 check if the variable was referenced, regardless of whether or not
3818 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3819
3820 @item -fmerge-constants
3821 Attempt to merge identical constants (string constants and floating point
3822 constants) across compilation units.
3823
3824 This option is the default for optimized compilation if the assembler and
3825 linker support it.  Use @option{-fno-merge-constants} to inhibit this
3826 behavior.
3827
3828 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3829
3830 @item -fmerge-all-constants
3831 Attempt to merge identical constants and identical variables.
3832
3833 This option implies @option{-fmerge-constants}.  In addition to
3834 @option{-fmerge-constants} this considers e.g. even constant initialized
3835 arrays or initialized constant variables with integral or floating point
3836 types.  Languages like C or C++ require each non-automatic variable to
3837 have distinct location, so using this option will result in non-conforming
3838 behavior.
3839
3840 @item -fnew-ra
3841 @opindex fnew-ra
3842 Use a graph coloring register allocator.  Currently this option is meant
3843 for testing, so we are interested to hear about miscompilations with
3844 @option{-fnew-ra}.
3845
3846 @item -fno-branch-count-reg
3847 @opindex fno-branch-count-reg
3848 Do not use ``decrement and branch'' instructions on a count register,
3849 but instead generate a sequence of instructions that decrement a
3850 register, compare it against zero, then branch based upon the result.
3851 This option is only meaningful on architectures that support such
3852 instructions, which include x86, PowerPC, IA-64 and S/390.
3853
3854 The default is @option{-fbranch-count-reg}, enabled when
3855 @option{-fstrength-reduce} is enabled.
3856
3857 @item -fno-function-cse
3858 @opindex fno-function-cse
3859 Do not put function addresses in registers; make each instruction that
3860 calls a constant function contain the function's address explicitly.
3861
3862 This option results in less efficient code, but some strange hacks
3863 that alter the assembler output may be confused by the optimizations
3864 performed when this option is not used.
3865
3866 The default is @option{-ffunction-cse}
3867
3868 @item -fno-zero-initialized-in-bss
3869 @opindex fno-zero-initialized-in-bss
3870 If the target supports a BSS section, GCC by default puts variables that
3871 are initialized to zero into BSS@.  This can save space in the resulting
3872 code.
3873
3874 This option turns off this behavior because some programs explicitly
3875 rely on variables going to the data section.  E.g., so that the
3876 resulting executable can find the beginning of that section and/or make
3877 assumptions based on that.
3878
3879 The default is @option{-fzero-initialized-in-bss}.
3880
3881 @item -fstrength-reduce
3882 @opindex fstrength-reduce
3883 Perform the optimizations of loop strength reduction and
3884 elimination of iteration variables.
3885
3886 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3887
3888 @item -fthread-jumps
3889 @opindex fthread-jumps
3890 Perform optimizations where we check to see if a jump branches to a
3891 location where another comparison subsumed by the first is found.  If
3892 so, the first branch is redirected to either the destination of the
3893 second branch or a point immediately following it, depending on whether
3894 the condition is known to be true or false.
3895
3896 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3897
3898 @item -fcse-follow-jumps
3899 @opindex fcse-follow-jumps
3900 In common subexpression elimination, scan through jump instructions
3901 when the target of the jump is not reached by any other path.  For
3902 example, when CSE encounters an @code{if} statement with an
3903 @code{else} clause, CSE will follow the jump when the condition
3904 tested is false.
3905
3906 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3907
3908 @item -fcse-skip-blocks
3909 @opindex fcse-skip-blocks
3910 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3911 follow jumps which conditionally skip over blocks.  When CSE
3912 encounters a simple @code{if} statement with no else clause,
3913 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3914 body of the @code{if}.
3915
3916 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3917
3918 @item -frerun-cse-after-loop
3919 @opindex frerun-cse-after-loop
3920 Re-run common subexpression elimination after loop optimizations has been
3921 performed.
3922
3923 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3924
3925 @item -frerun-loop-opt
3926 @opindex frerun-loop-opt
3927 Run the loop optimizer twice.
3928
3929 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3930
3931 @item -fgcse
3932 @opindex fgcse
3933 Perform a global common subexpression elimination pass.
3934 This pass also performs global constant and copy propagation.
3935
3936 @emph{Note:} When compiling a program using computed gotos, a GCC
3937 extension, you may get better runtime performance if you disable
3938 the global common subexpression elimination pass by adding
3939 @option{-fno-gcse} to the command line.
3940
3941 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3942
3943 @item -fgcse-lm
3944 @opindex fgcse-lm
3945 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3946 attempt to move loads which are only killed by stores into themselves.  This
3947 allows a loop containing a load/store sequence to be changed to a load outside
3948 the loop, and a copy/store within the loop.
3949
3950 Enabled by default when gcse is enabled.
3951
3952 @item -fgcse-sm
3953 @opindex fgcse-sm
3954 When @option{-fgcse-sm} is enabled, a store motion pass is run after
3955 global common subexpression elimination.  This pass will attempt to move
3956 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
3957 loops containing a load/store sequence can be changed to a load before
3958 the loop and a store after the loop.
3959
3960 Enabled by default when gcse is enabled.
3961
3962 @item -fgcse-las
3963 @opindex fgcse-las
3964 When @option{-fgcse-las} is enabled, the global common subexpression
3965 elimination pass eliminates redundant loads that come after stores to the
3966 same memory location (both partial and full redundancies).
3967
3968 Enabled by default when gcse is enabled.
3969
3970 @item -floop-optimize
3971 @opindex floop-optimize
3972 Perform loop optimizations: move constant expressions out of loops, simplify
3973 exit test conditions and optionally do strength-reduction and loop unrolling as
3974 well.
3975
3976 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3977
3978 @item -fcrossjumping
3979 @opindex crossjumping
3980 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
3981 resulting code may or may not perform better than without cross-jumping.
3982
3983 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3984
3985 @item -fif-conversion
3986 @opindex if-conversion
3987 Attempt to transform conditional jumps into branch-less equivalents.  This
3988 include use of conditional moves, min, max, set flags and abs instructions, and
3989 some tricks doable by standard arithmetics.  The use of conditional execution
3990 on chips where it is available is controlled by @code{if-conversion2}.
3991
3992 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3993
3994 @item -fif-conversion2
3995 @opindex if-conversion2
3996 Use conditional execution (where available) to transform conditional jumps into
3997 branch-less equivalents.
3998
3999 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4000
4001 @item -fdelete-null-pointer-checks
4002 @opindex fdelete-null-pointer-checks
4003 Use global dataflow analysis to identify and eliminate useless checks
4004 for null pointers.  The compiler assumes that dereferencing a null
4005 pointer would have halted the program.  If a pointer is checked after
4006 it has already been dereferenced, it cannot be null.
4007
4008 In some environments, this assumption is not true, and programs can
4009 safely dereference null pointers.  Use
4010 @option{-fno-delete-null-pointer-checks} to disable this optimization
4011 for programs which depend on that behavior.
4012
4013 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4014
4015 @item -fexpensive-optimizations
4016 @opindex fexpensive-optimizations
4017 Perform a number of minor optimizations that are relatively expensive.
4018
4019 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4020
4021 @item -foptimize-register-move
4022 @itemx -fregmove
4023 @opindex foptimize-register-move
4024 @opindex fregmove
4025 Attempt to reassign register numbers in move instructions and as
4026 operands of other simple instructions in order to maximize the amount of
4027 register tying.  This is especially helpful on machines with two-operand
4028 instructions.
4029
4030 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4031 optimization.
4032
4033 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4034
4035 @item -fdelayed-branch
4036 @opindex fdelayed-branch
4037 If supported for the target machine, attempt to reorder instructions
4038 to exploit instruction slots available after delayed branch
4039 instructions.
4040
4041 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4042
4043 @item -fschedule-insns
4044 @opindex fschedule-insns
4045 If supported for the target machine, attempt to reorder instructions to
4046 eliminate execution stalls due to required data being unavailable.  This
4047 helps machines that have slow floating point or memory load instructions
4048 by allowing other instructions to be issued until the result of the load
4049 or floating point instruction is required.
4050
4051 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4052
4053 @item -fschedule-insns2
4054 @opindex fschedule-insns2
4055 Similar to @option{-fschedule-insns}, but requests an additional pass of
4056 instruction scheduling after register allocation has been done.  This is
4057 especially useful on machines with a relatively small number of
4058 registers and where memory load instructions take more than one cycle.
4059
4060 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4061
4062 @item -fno-sched-interblock
4063 @opindex fno-sched-interblock
4064 Don't schedule instructions across basic blocks.  This is normally
4065 enabled by default when scheduling before register allocation, i.e.@:
4066 with @option{-fschedule-insns} or at @option{-O2} or higher.
4067
4068 @item -fno-sched-spec
4069 @opindex fno-sched-spec
4070 Don't allow speculative motion of non-load instructions.  This is normally
4071 enabled by default when scheduling before register allocation, i.e.@:
4072 with @option{-fschedule-insns} or at @option{-O2} or higher.
4073
4074 @item -fsched-spec-load
4075 @opindex fsched-spec-load
4076 Allow speculative motion of some load instructions.  This only makes
4077 sense when scheduling before register allocation, i.e.@: with
4078 @option{-fschedule-insns} or at @option{-O2} or higher.
4079
4080 @item -fsched-spec-load-dangerous
4081 @opindex fsched-spec-load-dangerous
4082 Allow speculative motion of more load instructions.  This only makes
4083 sense when scheduling before register allocation, i.e.@: with
4084 @option{-fschedule-insns} or at @option{-O2} or higher.
4085
4086 @item -fsched-stalled-insns=@var{n}
4087 @opindex fsched-stalled-insns
4088 Define how many insns (if any) can be moved prematurely from the queue
4089 of stalled insns into the ready list, during the second scheduling pass.
4090
4091 @item -fsched-stalled-insns-dep=@var{n}
4092 @opindex fsched-stalled-insns-dep
4093 Define how many insn groups (cycles) will be examined for a dependency
4094 on a stalled insn that is candidate for premature removal from the queue
4095 of stalled insns.  Has an effect only during the second scheduling pass,
4096 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4097
4098 @item -fsched2-use-superblocks
4099 @opindex fsched2-use-superblocks
4100 When scheduling after register allocation, do use superblock scheduling
4101 algorithm.  Superblock scheduling allows motion across basic block boundaries
4102 resulting on faster schedules.  This option is experimental, as not all machine
4103 descriptions used by GCC model the CPU closely enough to avoid unreliable
4104 results from the algorithm.
4105
4106 This only makes sense when scheduling after register allocation, i.e.@: with
4107 @option{-fschedule-insns2} or at @option{-O2} or higher.
4108
4109 @item -fsched2-use-traces
4110 @opindex fsched2-use-traces
4111 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4112 allocation and additionally perform code duplication in order to increase the
4113 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4114 trace formation.
4115
4116 This mode should produce faster but significantly longer programs.  Also
4117 without @code{-fbranch-probabilities} the traces constructed may not match the
4118 reality and hurt the performance.  This only makes
4119 sense when scheduling after register allocation, i.e.@: with
4120 @option{-fschedule-insns2} or at @option{-O2} or higher.
4121
4122 @item -fcaller-saves
4123 @opindex fcaller-saves
4124 Enable values to be allocated in registers that will be clobbered by
4125 function calls, by emitting extra instructions to save and restore the
4126 registers around such calls.  Such allocation is done only when it
4127 seems to result in better code than would otherwise be produced.
4128
4129 This option is always enabled by default on certain machines, usually
4130 those which have no call-preserved registers to use instead.
4131
4132 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4133
4134 @item -fmove-all-movables
4135 @opindex fmove-all-movables
4136 Forces all invariant computations in loops to be moved
4137 outside the loop.
4138
4139 @item -freduce-all-givs
4140 @opindex freduce-all-givs
4141 Forces all general-induction variables in loops to be
4142 strength-reduced.
4143
4144 @emph{Note:} When compiling programs written in Fortran,
4145 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
4146 by default when you use the optimizer.
4147
4148 These options may generate better or worse code; results are highly
4149 dependent on the structure of loops within the source code.
4150
4151 These two options are intended to be removed someday, once
4152 they have helped determine the efficacy of various
4153 approaches to improving loop optimizations.
4154
4155 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
4156 know how use of these options affects
4157 the performance of your production code.
4158 We're very interested in code that runs @emph{slower}
4159 when these options are @emph{enabled}.
4160
4161 @item -fno-peephole
4162 @itemx -fno-peephole2
4163 @opindex fno-peephole
4164 @opindex fno-peephole2
4165 Disable any machine-specific peephole optimizations.  The difference
4166 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
4167 are implemented in the compiler; some targets use one, some use the
4168 other, a few use both.
4169
4170 @option{-fpeephole} is enabled by default.
4171 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4172
4173 @item -fno-guess-branch-probability
4174 @opindex fno-guess-branch-probability
4175 Do not guess branch probabilities using a randomized model.
4176
4177 Sometimes gcc will opt to use a randomized model to guess branch
4178 probabilities, when none are available from either profiling feedback
4179 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
4180 different runs of the compiler on the same program may produce different
4181 object code.
4182
4183 In a hard real-time system, people don't want different runs of the
4184 compiler to produce code that has different behavior; minimizing
4185 non-determinism is of paramount import.  This switch allows users to
4186 reduce non-determinism, possibly at the expense of inferior
4187 optimization.
4188
4189 The default is @option{-fguess-branch-probability} at levels
4190 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4191
4192 @item -freorder-blocks
4193 @opindex freorder-blocks
4194 Reorder basic blocks in the compiled function in order to reduce number of
4195 taken branches and improve code locality.
4196
4197 Enabled at levels @option{-O2}, @option{-O3}.
4198
4199 @item -freorder-functions
4200 @opindex freorder-functions
4201 Reorder basic blocks in the compiled function in order to reduce number of
4202 taken branches and improve code locality. This is implemented by using special
4203 subsections @code{text.hot} for most frequently executed functions and
4204 @code{text.unlikely} for unlikely executed functions.  Reordering is done by
4205 the linker so object file format must support named sections and linker must
4206 place them in a reasonable way.
4207
4208 Also profile feedback must be available in to make this option effective.  See
4209 @option{-fprofile-arcs} for details.
4210
4211 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4212
4213 @item -fstrict-aliasing
4214 @opindex fstrict-aliasing
4215 Allows the compiler to assume the strictest aliasing rules applicable to
4216 the language being compiled.  For C (and C++), this activates
4217 optimizations based on the type of expressions.  In particular, an
4218 object of one type is assumed never to reside at the same address as an
4219 object of a different type, unless the types are almost the same.  For
4220 example, an @code{unsigned int} can alias an @code{int}, but not a
4221 @code{void*} or a @code{double}.  A character type may alias any other
4222 type.
4223
4224 Pay special attention to code like this:
4225 @smallexample
4226 union a_union @{
4227   int i;
4228   double d;
4229 @};
4230
4231 int f() @{
4232   a_union t;
4233   t.d = 3.0;
4234   return t.i;
4235 @}
4236 @end smallexample
4237 The practice of reading from a different union member than the one most
4238 recently written to (called ``type-punning'') is common.  Even with
4239 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4240 is accessed through the union type.  So, the code above will work as
4241 expected.  However, this code might not:
4242 @smallexample
4243 int f() @{
4244   a_union t;
4245   int* ip;
4246   t.d = 3.0;
4247   ip = &t.i;
4248   return *ip;
4249 @}
4250 @end smallexample
4251
4252 Every language that wishes to perform language-specific alias analysis
4253 should define a function that computes, given an @code{tree}
4254 node, an alias set for the node.  Nodes in different alias sets are not
4255 allowed to alias.  For an example, see the C front-end function
4256 @code{c_get_alias_set}.
4257
4258 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4259
4260 @item -falign-functions
4261 @itemx -falign-functions=@var{n}
4262 @opindex falign-functions
4263 Align the start of functions to the next power-of-two greater than
4264 @var{n}, skipping up to @var{n} bytes.  For instance,
4265 @option{-falign-functions=32} aligns functions to the next 32-byte
4266 boundary, but @option{-falign-functions=24} would align to the next
4267 32-byte boundary only if this can be done by skipping 23 bytes or less.
4268
4269 @option{-fno-align-functions} and @option{-falign-functions=1} are
4270 equivalent and mean that functions will not be aligned.
4271
4272 Some assemblers only support this flag when @var{n} is a power of two;
4273 in that case, it is rounded up.
4274
4275 If @var{n} is not specified or is zero, use a machine-dependent default.
4276
4277 Enabled at levels @option{-O2}, @option{-O3}.
4278
4279 @item -falign-labels
4280 @itemx -falign-labels=@var{n}
4281 @opindex falign-labels
4282 Align all branch targets to a power-of-two boundary, skipping up to
4283 @var{n} bytes like @option{-falign-functions}.  This option can easily
4284 make code slower, because it must insert dummy operations for when the
4285 branch target is reached in the usual flow of the code.
4286
4287 @option{-fno-align-labels} and @option{-falign-labels=1} are
4288 equivalent and mean that labels will not be aligned.
4289
4290 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4291 are greater than this value, then their values are used instead.
4292
4293 If @var{n} is not specified or is zero, use a machine-dependent default
4294 which is very likely to be @samp{1}, meaning no alignment.
4295
4296 Enabled at levels @option{-O2}, @option{-O3}.
4297
4298 @item -falign-loops
4299 @itemx -falign-loops=@var{n}
4300 @opindex falign-loops
4301 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4302 like @option{-falign-functions}.  The hope is that the loop will be
4303 executed many times, which will make up for any execution of the dummy
4304 operations.
4305
4306 @option{-fno-align-loops} and @option{-falign-loops=1} are
4307 equivalent and mean that loops will not be aligned.
4308
4309 If @var{n} is not specified or is zero, use a machine-dependent default.
4310
4311 Enabled at levels @option{-O2}, @option{-O3}.
4312
4313 @item -falign-jumps
4314 @itemx -falign-jumps=@var{n}
4315 @opindex falign-jumps
4316 Align branch targets to a power-of-two boundary, for branch targets
4317 where the targets can only be reached by jumping, skipping up to @var{n}
4318 bytes like @option{-falign-functions}.  In this case, no dummy operations
4319 need be executed.
4320
4321 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
4322 equivalent and mean that loops will not be aligned.
4323
4324 If @var{n} is not specified or is zero, use a machine-dependent default.
4325
4326 Enabled at levels @option{-O2}, @option{-O3}.
4327
4328 @item -frename-registers
4329 @opindex frename-registers
4330 Attempt to avoid false dependencies in scheduled code by making use
4331 of registers left over after register allocation.  This optimization
4332 will most benefit processors with lots of registers.  It can, however,
4333 make debugging impossible, since variables will no longer stay in
4334 a ``home register''.
4335
4336 @item -fweb
4337 @opindex fweb
4338 Constructs webs as commonly used for register allocation purposes and assign
4339 each web individual pseudo register.  This allows our register allocation pass
4340 to operate on pseudos directly, but also strengthens several other optimization
4341 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
4342 however, make debugging impossible, since variables will no longer stay in a
4343 ``home register''.
4344
4345 Enabled at levels @option{-O3}.
4346
4347 @item -fno-cprop-registers
4348 @opindex fno-cprop-registers
4349 After register allocation and post-register allocation instruction splitting,
4350 we perform a copy-propagation pass to try to reduce scheduling dependencies
4351 and occasionally eliminate the copy.
4352
4353 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4354
4355 @item -fprofile-generate
4356 @opindex fprofile-generate
4357 Enable options usually used for instrumenting application to produce profile usefull
4358 for later recompilation profile feedback based optimization.
4359
4360 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}
4361
4362 @item -fprofile-use
4363 @opindex fprofile-use
4364 Enable profile feedback directed optimizations, and optimizations
4365 generally profitable only with profile feedback available.
4366
4367 The following options are enabled: @code{-fbranch-probabilities},
4368 @code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
4369
4370 @end table
4371
4372 The following options control compiler behavior regarding floating
4373 point arithmetic.  These options trade off between speed and
4374 correctness.  All must be specifically enabled.
4375
4376 @table @gcctabopt
4377 @item -ffloat-store
4378 @opindex ffloat-store
4379 Do not store floating point variables in registers, and inhibit other
4380 options that might change whether a floating point value is taken from a
4381 register or memory.
4382
4383 @cindex floating point precision
4384 This option prevents undesirable excess precision on machines such as
4385 the 68000 where the floating registers (of the 68881) keep more
4386 precision than a @code{double} is supposed to have.  Similarly for the
4387 x86 architecture.  For most programs, the excess precision does only
4388 good, but a few programs rely on the precise definition of IEEE floating
4389 point.  Use @option{-ffloat-store} for such programs, after modifying
4390 them to store all pertinent intermediate computations into variables.
4391
4392 @item -ffast-math
4393 @opindex ffast-math
4394 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4395 @option{-fno-trapping-math}, @option{-ffinite-math-only},
4396 @option{-fno-rounding-math} and @option{-fno-signaling-nans}.
4397
4398 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4399
4400 This option should never be turned on by any @option{-O} option since
4401 it can result in incorrect output for programs which depend on
4402 an exact implementation of IEEE or ISO rules/specifications for
4403 math functions.
4404
4405 @item -fno-math-errno
4406 @opindex fno-math-errno
4407 Do not set ERRNO after calling math functions that are executed
4408 with a single instruction, e.g., sqrt.  A program that relies on
4409 IEEE exceptions for math error handling may want to use this flag
4410 for speed while maintaining IEEE arithmetic compatibility.
4411
4412 This option should never be turned on by any @option{-O} option since
4413 it can result in incorrect output for programs which depend on
4414 an exact implementation of IEEE or ISO rules/specifications for
4415 math functions.
4416
4417 The default is @option{-fmath-errno}.
4418
4419 @item -funsafe-math-optimizations
4420 @opindex funsafe-math-optimizations
4421 Allow optimizations for floating-point arithmetic that (a) assume
4422 that arguments and results are valid and (b) may violate IEEE or
4423 ANSI standards.  When used at link-time, it may include libraries
4424 or startup files that change the default FPU control word or other
4425 similar optimizations.
4426
4427 This option should never be turned on by any @option{-O} option since
4428 it can result in incorrect output for programs which depend on
4429 an exact implementation of IEEE or ISO rules/specifications for
4430 math functions.
4431
4432 The default is @option{-fno-unsafe-math-optimizations}.
4433
4434 @item -ffinite-math-only
4435 @opindex ffinite-math-only
4436 Allow optimizations for floating-point arithmetic that assume
4437 that arguments and results are not NaNs or +-Infs.
4438
4439 This option should never be turned on by any @option{-O} option since
4440 it can result in incorrect output for programs which depend on
4441 an exact implementation of IEEE or ISO rules/specifications.
4442
4443 The default is @option{-fno-finite-math-only}.
4444
4445 @item -fno-trapping-math
4446 @opindex fno-trapping-math
4447 Compile code assuming that floating-point operations cannot generate
4448 user-visible traps.  These traps include division by zero, overflow,
4449 underflow, inexact result and invalid operation.  This option implies
4450 @option{-fno-signaling-nans}.  Setting this option may allow faster
4451 code if one relies on ``non-stop'' IEEE arithmetic, for example.
4452
4453 This option should never be turned on by any @option{-O} option since
4454 it can result in incorrect output for programs which depend on
4455 an exact implementation of IEEE or ISO rules/specifications for
4456 math functions.
4457
4458 The default is @option{-ftrapping-math}.
4459
4460 @item -frounding-math
4461 @opindex frounding-math
4462 Disable transformations and optimizations that assume default floating
4463 point rounding behavior.  This is round-to-zero for all floating point
4464 to integer conversions, and round-to-nearest for all other arithmetic
4465 truncations.  This option should be specified for programs that change
4466 the FP rounding mode dynamically, or that may be executed with a
4467 non-default rounding mode.  This option disables constant folding of
4468 floating point expressions at compile-time (which may be affected by
4469 rounding mode) and arithmetic transformations that are unsafe in the
4470 presence of sign-dependent rounding modes.
4471
4472 The default is @option{-fno-rounding-math}.
4473
4474 This option is experimental and does not currently guarantee to
4475 disable all GCC optimizations that are affected by rounding mode.
4476 Future versions of gcc may provide finer control of this setting
4477 using C99's @code{FENV_ACCESS} pragma.  This command line option
4478 will be used to specify the default state for @code{FENV_ACCESS}.
4479
4480 @item -fsignaling-nans
4481 @opindex fsignaling-nans
4482 Compile code assuming that IEEE signaling NaNs may generate user-visible
4483 traps during floating-point operations.  Setting this option disables
4484 optimizations that may change the number of exceptions visible with
4485 signaling NaNs.  This option implies @option{-ftrapping-math}.
4486
4487 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4488 be defined.
4489
4490 The default is @option{-fno-signaling-nans}.
4491
4492 This option is experimental and does not currently guarantee to
4493 disable all GCC optimizations that affect signaling NaN behavior.
4494
4495 @item -fsingle-precision-constant
4496 @opindex fsingle-precision-constant
4497 Treat floating point constant as single precision constant instead of
4498 implicitly converting it to double precision constant.
4499
4500
4501 @end table
4502
4503 The following options control optimizations that may improve
4504 performance, but are not enabled by any @option{-O} options.  This
4505 section includes experimental options that may produce broken code.
4506
4507 @table @gcctabopt
4508 @item -fbranch-probabilities
4509 @opindex fbranch-probabilities
4510 After running a program compiled with @option{-fprofile-arcs}
4511 (@pxref{Debugging Options,, Options for Debugging Your Program or
4512 @command{gcc}}), you can compile it a second time using
4513 @option{-fbranch-probabilities}, to improve optimizations based on
4514 the number of times each branch was taken.  When the program
4515 compiled with @option{-fprofile-arcs} exits it saves arc execution
4516 counts to a file called @file{@var{sourcename}.gcda} for each source
4517 file  The information in this data file is very dependent on the
4518 structure of the generated code, so you must use the same source code
4519 and the same optimization options for both compilations.
4520
4521 With @option{-fbranch-probabilities}, GCC puts a
4522 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4523 These can be used to improve optimization.  Currently, they are only
4524 used in one place: in @file{reorg.c}, instead of guessing which path a
4525 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4526 exactly determine which path is taken more often.
4527
4528 @item -fprofile-values
4529 @opindex fprofile-values
4530 If combined with @option{-fprofile-arcs}, it adds code so that some
4531 data about values of expressions in the program is gathered.
4532
4533 With @option{-fbranch-probabilities}, it reads back the data gathered
4534 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4535 notes to instructions for their later usage in optimizations.
4536
4537 @item -fvpt
4538 @opindex fvpt
4539 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
4540 a code to gather information about values of expressions.
4541
4542 With @option{-fbranch-probabilities}, it reads back the data gathered
4543 and actually performs the optimizations based on them.
4544 Currently the optimizations include specialization of division operation
4545 using the knowledge about the value of the denominator.
4546
4547 @item -fnew-ra
4548 @opindex fnew-ra
4549 Use a graph coloring register allocator.  Currently this option is meant
4550 for testing, so we are interested to hear about miscompilations with
4551 @option{-fnew-ra}.
4552
4553 @item -ftracer
4554 @opindex ftracer
4555 Perform tail duplication to enlarge superblock size. This transformation
4556 simplifies the control flow of the function allowing other optimizations to do
4557 better job.
4558
4559 @item -funit-at-a-time
4560 @opindex funit-at-a-time
4561 Parse the whole compilation unit before starting to produce code.
4562 This allows some extra optimizations to take place but consumes more
4563 memory.
4564
4565 @item -funroll-loops
4566 @opindex funroll-loops
4567 Unroll loops whose number of iterations can be determined at compile time or
4568 upon entry to the loop.  @option{-funroll-loops} implies
4569 @option{-frerun-cse-after-loop}.  It also turns on complete loop peeling
4570 (i.e. complete removal of loops with small constant number of iterations).
4571 This option makes code larger, and may or may not make it run faster.
4572
4573 @item -funroll-all-loops
4574 @opindex funroll-all-loops
4575 Unroll all loops, even if their number of iterations is uncertain when
4576 the loop is entered.  This usually makes programs run more slowly.
4577 @option{-funroll-all-loops} implies the same options as
4578 @option{-funroll-loops}.
4579
4580 @item -fpeel-loops
4581 @opindex fpeel-loops
4582 Peels the loops for that there is enough information that they do not
4583 roll much (from profile feedback).  It also turns on complete loop peeling
4584 (i.e. complete removal of loops with small constant number of iterations).
4585
4586 @item -funswitch-loops
4587 @opindex funswitch-loops
4588 Move branches with loop invariant conditions out of the loop, with duplicates
4589 of the loop on both branches (modified according to result of the condition).
4590
4591 @item -fold-unroll-loops
4592 @opindex fold-unroll-loops
4593 Unroll loops whose number of iterations can be determined at compile
4594 time or upon entry to the loop, using the old loop unroller whose loop
4595 recognition is based on notes from frontend.  @option{-fold-unroll-loops} implies
4596 both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4597 option makes code larger, and may or may not make it run faster.
4598
4599 @item -fold-unroll-all-loops
4600 @opindex fold-unroll-all-loops
4601 Unroll all loops, even if their number of iterations is uncertain when
4602 the loop is entered. This is done using the old loop unroller whose loop
4603 recognition is based on notes from frontend.  This usually makes programs run more slowly.
4604 @option{-fold-unroll-all-loops} implies the same options as
4605 @option{-fold-unroll-loops}.
4606
4607 @item -funswitch-loops
4608 @opindex funswitch-loops
4609 Move branches with loop invariant conditions out of the loop, with duplicates
4610 of the loop on both branches (modified according to result of the condition).
4611
4612 @item -funswitch-loops
4613 @opindex funswitch-loops
4614 Move branches with loop invariant conditions out of the loop, with duplicates
4615 of the loop on both branches (modified according to result of the condition).
4616
4617 @item -fprefetch-loop-arrays
4618 @opindex fprefetch-loop-arrays
4619 If supported by the target machine, generate instructions to prefetch
4620 memory to improve the performance of loops that access large arrays.
4621
4622 Disabled at level @option{-Os}.
4623
4624 @item -ffunction-sections
4625 @itemx -fdata-sections
4626 @opindex ffunction-sections
4627 @opindex fdata-sections
4628 Place each function or data item into its own section in the output
4629 file if the target supports arbitrary sections.  The name of the
4630 function or the name of the data item determines the section's name
4631 in the output file.
4632
4633 Use these options on systems where the linker can perform optimizations
4634 to improve locality of reference in the instruction space.  Most systems
4635 using the ELF object format and SPARC processors running Solaris 2 have
4636 linkers with such optimizations.  AIX may have these optimizations in
4637 the future.
4638
4639 Only use these options when there are significant benefits from doing
4640 so.  When you specify these options, the assembler and linker will
4641 create larger object and executable files and will also be slower.
4642 You will not be able to use @code{gprof} on all systems if you
4643 specify this option and you may have problems with debugging if
4644 you specify both this option and @option{-g}.
4645
4646 @item -fbranch-target-load-optimize
4647 @opindex fbranch-target-load-optimize
4648 Perform branch target register load optimization before prologue / epilogue
4649 threading.
4650 The use of target registers can typically be exposed only during reload,
4651 thus hoisting loads out of loops and doing inter-block scheduling needs
4652 a separate optimization pass.
4653
4654 @item -fbranch-target-load-optimize2
4655 @opindex fbranch-target-load-optimize2
4656 Perform branch target register load optimization after prologue / epilogue
4657 threading.
4658
4659 @item -fbtr-bb-exclusive
4660 @opindex fbtr-bb-exclusive
4661 WHen performing branch target register load optimization, don't reuse
4662 branch target registers in within any basic block.
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 The names of specific parameters, and the meaning of the values, are
4673 tied to the internals of the compiler, and are subject to change
4674 without notice in future releases.
4675
4676 In each case, the @var{value} is an integer.  The allowable choices for
4677 @var{name} are given in the following table:
4678
4679 @table @gcctabopt
4680 @item max-crossjump-edges
4681 The maximum number of incoming edges to consider for crossjumping.
4682 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
4683 the number of edges incoming to each block.  Increasing values mean
4684 more aggressive optimization, making the compile time increase with
4685 probably small improvement in executable size.
4686
4687 @item max-delay-slot-insn-search
4688 The maximum number of instructions to consider when looking for an
4689 instruction to fill a delay slot.  If more than this arbitrary number of
4690 instructions is searched, the time savings from filling the delay slot
4691 will be minimal so stop searching.  Increasing values mean more
4692 aggressive optimization, making the compile time increase with probably
4693 small improvement in executable run time.
4694
4695 @item max-delay-slot-live-search
4696 When trying to fill delay slots, the maximum number of instructions to
4697 consider when searching for a block with valid live register
4698 information.  Increasing this arbitrarily chosen value means more
4699 aggressive optimization, increasing the compile time.  This parameter
4700 should be removed when the delay slot code is rewritten to maintain the
4701 control-flow graph.
4702
4703 @item max-gcse-memory
4704 The approximate maximum amount of memory that will be allocated in
4705 order to perform the global common subexpression elimination
4706 optimization.  If more memory than specified is required, the
4707 optimization will not be done.
4708
4709 @item max-gcse-passes
4710 The maximum number of passes of GCSE to run.
4711
4712 @item max-pending-list-length
4713 The maximum number of pending dependencies scheduling will allow
4714 before flushing the current state and starting over.  Large functions
4715 with few branches or calls can create excessively large lists which
4716 needlessly consume memory and resources.
4717
4718 @item max-inline-insns-single
4719 Several parameters control the tree inliner used in gcc.
4720 This number sets the maximum number of instructions (counted in gcc's
4721 internal representation) in a single function that the tree inliner
4722 will consider for inlining.  This only affects functions declared
4723 inline and methods implemented in a class declaration (C++).
4724 The default value is 500.
4725
4726 @item max-inline-insns-auto
4727 When you use @option{-finline-functions} (included in @option{-O3}),
4728 a lot of functions that would otherwise not be considered for inlining
4729 by the compiler will be investigated.  To those functions, a different
4730 (more restrictive) limit compared to functions declared inline can
4731 be applied.
4732 The default value is 120.
4733
4734 @item large-function-insns
4735 The limit specifying really large functions.  For functions greater than this
4736 limit inlining is constrained by @option{--param large-function-growth}.
4737 This parameter is useful primarily to avoid extreme compilation time caused by non-linear
4738 algorithms used by the backend.
4739 This parameter is ignored when @option{-funit-at-a-time} is not used.
4740 The default value is 3000.
4741
4742 @item large-function-growth
4743 Specifies maximal growth of large function caused by inlining in percents.
4744 This parameter is ignored when @option{-funit-at-a-time} is not used.
4745 The default value is 200.
4746
4747 @item inline-unit-growth
4748 Specifies maximal overall growth of the compilation unit caused by inlining.
4749 This parameter is ignored when @option{-funit-at-a-time} is not used.
4750 The default value is 150.
4751
4752 @item max-inline-insns-rtl
4753 For languages that use the RTL inliner (this happens at a later stage
4754 than tree inlining), you can set the maximum allowable size (counted
4755 in RTL instructions) for the RTL inliner with this parameter.
4756 The default value is 600.
4757
4758 @item max-unrolled-insns
4759 The maximum number of instructions that a loop should have if that loop
4760 is unrolled, and if the loop is unrolled, it determines how many times
4761 the loop code is unrolled.
4762
4763 @item max-average-unrolled-insns
4764 The maximum number of instructions biased by probabilities of their execution
4765 that a loop should have if that loop is unrolled, and if the loop is unrolled,
4766 it determines how many times the loop code is unrolled.
4767
4768 @item max-unroll-times
4769 The maximum number of unrollings of a single loop.
4770
4771 @item max-peeled-insns
4772 The maximum number of instructions that a loop should have if that loop
4773 is peeled, and if the loop is peeled, it determines how many times
4774 the loop code is peeled.
4775
4776 @item max-peel-times
4777 The maximum number of peelings of a single loop.
4778
4779 @item max-completely-peeled-insns
4780 The maximum number of insns of a completely peeled loop.
4781
4782 @item max-completely-peel-times
4783 The maximum number of iterations of a loop to be suitable for complete peeling.
4784
4785 @item max-unswitch-insns
4786 The maximum number of insns of an unswitched loop.
4787
4788 @item max-unswitch-level
4789 The maximum number of branches unswitched in a single loop.
4790
4791 @item hot-bb-count-fraction
4792 Select fraction of the maximal count of repetitions of basic block in program
4793 given basic block needs to have to be considered hot.
4794
4795 @item hot-bb-frequency-fraction
4796 Select fraction of the maximal frequency of executions of basic block in
4797 function given basic block needs to have to be considered hot
4798
4799 @item tracer-dynamic-coverage
4800 @itemx tracer-dynamic-coverage-feedback
4801
4802 This value is used to limit superblock formation once the given percentage of
4803 executed instructions is covered.  This limits unnecessary code size
4804 expansion.
4805
4806 The @option{tracer-dynamic-coverage-feedback} is used only when profile
4807 feedback is available.  The real profiles (as opposed to statically estimated
4808 ones) are much less balanced allowing the threshold to be larger value.
4809
4810 @item tracer-max-code-growth
4811 Stop tail duplication once code growth has reached given percentage.  This is
4812 rather hokey argument, as most of the duplicates will be eliminated later in
4813 cross jumping, so it may be set to much higher values than is the desired code
4814 growth.
4815
4816 @item tracer-min-branch-ratio
4817
4818 Stop reverse growth when the reverse probability of best edge is less than this
4819 threshold (in percent).
4820
4821 @item tracer-min-branch-ratio
4822 @itemx tracer-min-branch-ratio-feedback
4823
4824 Stop forward growth if the best edge do have probability lower than this
4825 threshold.
4826
4827 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
4828 compilation for profile feedback and one for compilation without.  The value
4829 for compilation with profile feedback needs to be more conservative (higher) in
4830 order to make tracer effective.
4831
4832 @item max-cse-path-length
4833
4834 Maximum number of basic blocks on path that cse considers.
4835
4836 @item ggc-min-expand
4837
4838 GCC uses a garbage collector to manage its own memory allocation.  This
4839 parameter specifies the minimum percentage by which the garbage
4840 collector's heap should be allowed to expand between collections.
4841 Tuning this may improve compilation speed; it has no effect on code
4842 generation.
4843
4844 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
4845 RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
4846 the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
4847 GCC is not able to calculate RAM on a particular platform, the lower
4848 bound of 30% is used.  Setting this parameter and
4849 @option{ggc-min-heapsize} to zero causes a full collection to occur at
4850 every opportunity.  This is extremely slow, but can be useful for
4851 debugging.
4852
4853 @item ggc-min-heapsize
4854
4855 Minimum size of the garbage collector's heap before it begins bothering
4856 to collect garbage.  The first collection occurs after the heap expands
4857 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
4858 tuning this may improve compilation speed, and has no effect on code
4859 generation.
4860
4861 The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
4862 upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
4863 available, the notion of "RAM" is the smallest of actual RAM,
4864 RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
4865 RAM on a particular platform, the lower bound is used.  Setting this
4866 parameter very large effectively disables garbage collection.  Setting
4867 this parameter and @option{ggc-min-expand} to zero causes a full
4868 collection to occur at every opportunity.
4869
4870 @item max-reload-search-insns
4871 The maximum number of instruction reload should look backward for equivalent
4872 register.  Increasing values mean more aggressive optimization, making the
4873 compile time increase with probably slightly better performance.  The default
4874 value is 100.
4875
4876 @item max-cselib-memory-location
4877 The maximum number of memory locations cselib should take into acount.
4878 Increasing values mean more aggressive optimization, making the compile time
4879 increase with probably slightly better performance.  The default value is 500.
4880
4881 @item reorder-blocks-duplicate
4882 @itemx reorder-blocks-duplicate-feedback
4883
4884 Used by basic block reordering pass to decide whether to use unconditional
4885 branch or duplicate the code on its destination.  Code is duplicated when its
4886 estimated size is smaller than this value multiplied by the estimated size of
4887 unconditional jump in the hot spots of the program.
4888
4889 The @option{reorder-block-duplicate-feedback} is used only when profile
4890 feedback is available and may be set to higher values than
4891 @option{reorder-block-duplicate} since information about the hot spots is more
4892 accurate.
4893 @end table
4894 @end table
4895
4896 @node Preprocessor Options
4897 @section Options Controlling the Preprocessor
4898 @cindex preprocessor options
4899 @cindex options, preprocessor
4900
4901 These options control the C preprocessor, which is run on each C source
4902 file before actual compilation.
4903
4904 If you use the @option{-E} option, nothing is done except preprocessing.
4905 Some of these options make sense only together with @option{-E} because
4906 they cause the preprocessor output to be unsuitable for actual
4907 compilation.
4908
4909 @table @gcctabopt
4910 @opindex Wp
4911 You can use @option{-Wp,@var{option}} to bypass the compiler driver
4912 and pass @var{option} directly through to the preprocessor.  If
4913 @var{option} contains commas, it is split into multiple options at the
4914 commas.  However, many options are modified, translated or interpreted
4915 by the compiler driver before being passed to the preprocessor, and
4916 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4917 interface is undocumented and subject to change, so whenever possible
4918 you should avoid using @option{-Wp} and let the driver handle the
4919 options instead.
4920
4921 @item -Xpreprocessor @var{option}
4922 @opindex preprocessor
4923 Pass @var{option} as an option to the preprocessor.  You can use this to
4924 supply system-specific preprocessor options which GCC does not know how to
4925 recognize.
4926
4927 If you want to pass an option that takes an argument, you must use
4928 @option{-Xpreprocessor} twice, once for the option and once for the argument.
4929 @end table
4930
4931 @include cppopts.texi
4932
4933 @node Assembler Options
4934 @section Passing Options to the Assembler
4935
4936 @c prevent bad page break with this line
4937 You can pass options to the assembler.
4938
4939 @table @gcctabopt
4940 @item -Wa,@var{option}
4941 @opindex Wa
4942 Pass @var{option} as an option to the assembler.  If @var{option}
4943 contains commas, it is split into multiple options at the commas.
4944
4945 @item -Xassembler @var{option}
4946 @opindex Xassembler
4947 Pass @var{option} as an option to the assembler.  You can use this to
4948 supply system-specific assembler options which GCC does not know how to
4949 recognize.
4950
4951 If you want to pass an option that takes an argument, you must use
4952 @option{-Xassembler} twice, once for the option and once for the argument.
4953
4954 @end table
4955
4956 @node Link Options
4957 @section Options for Linking
4958 @cindex link options
4959 @cindex options, linking
4960
4961 These options come into play when the compiler links object files into
4962 an executable output file.  They are meaningless if the compiler is
4963 not doing a link step.
4964
4965 @table @gcctabopt
4966 @cindex file names
4967 @item @var{object-file-name}
4968 A file name that does not end in a special recognized suffix is
4969 considered to name an object file or library.  (Object files are
4970 distinguished from libraries by the linker according to the file
4971 contents.)  If linking is done, these object files are used as input
4972 to the linker.
4973
4974 @item -c
4975 @itemx -S
4976 @itemx -E
4977 @opindex c
4978 @opindex S
4979 @opindex E
4980 If any of these options is used, then the linker is not run, and
4981 object file names should not be used as arguments.  @xref{Overall
4982 Options}.
4983
4984 @cindex Libraries
4985 @item -l@var{library}
4986 @itemx -l @var{library}
4987 @opindex l
4988 Search the library named @var{library} when linking.  (The second
4989 alternative with the library as a separate argument is only for
4990 POSIX compliance and is not recommended.)
4991
4992 It makes a difference where in the command you write this option; the
4993 linker searches and processes libraries and object files in the order they
4994 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4995 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
4996 to functions in @samp{z}, those functions may not be loaded.
4997
4998 The linker searches a standard list of directories for the library,
4999 which is actually a file named @file{lib@var{library}.a}.  The linker
5000 then uses this file as if it had been specified precisely by name.
5001
5002 The directories searched include several standard system directories
5003 plus any that you specify with @option{-L}.
5004
5005 Normally the files found this way are library files---archive files
5006 whose members are object files.  The linker handles an archive file by
5007 scanning through it for members which define symbols that have so far
5008 been referenced but not defined.  But if the file that is found is an
5009 ordinary object file, it is linked in the usual fashion.  The only
5010 difference between using an @option{-l} option and specifying a file name
5011 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
5012 and searches several directories.
5013
5014 @item -lobjc
5015 @opindex lobjc
5016 You need this special case of the @option{-l} option in order to
5017 link an Objective-C program.
5018
5019 @item -nostartfiles
5020 @opindex nostartfiles
5021 Do not use the standard system startup files when linking.
5022 The standard system libraries are used normally, unless @option{-nostdlib}
5023 or @option{-nodefaultlibs} is used.
5024
5025 @item -nodefaultlibs
5026 @opindex nodefaultlibs
5027 Do not use the standard system libraries when linking.
5028 Only the libraries you specify will be passed to the linker.
5029 The standard startup files are used normally, unless @option{-nostartfiles}
5030 is used.  The compiler may generate calls to memcmp, memset, and memcpy
5031 for System V (and ISO C) environments or to bcopy and bzero for
5032 BSD environments.  These entries are usually resolved by entries in
5033 libc.  These entry points should be supplied through some other
5034 mechanism when this option is specified.
5035
5036 @item -nostdlib
5037 @opindex nostdlib
5038 Do not use the standard system startup files or libraries when linking.
5039 No startup files and only the libraries you specify will be passed to
5040 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
5041 for System V (and ISO C) environments or to bcopy and bzero for
5042 BSD environments.  These entries are usually resolved by entries in
5043 libc.  These entry points should be supplied through some other
5044 mechanism when this option is specified.
5045
5046 @cindex @option{-lgcc}, use with @option{-nostdlib}
5047 @cindex @option{-nostdlib} and unresolved references
5048 @cindex unresolved references and @option{-nostdlib}
5049 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5050 @cindex @option{-nodefaultlibs} and unresolved references
5051 @cindex unresolved references and @option{-nodefaultlibs}
5052 One of the standard libraries bypassed by @option{-nostdlib} and
5053 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
5054 that GCC uses to overcome shortcomings of particular machines, or special
5055 needs for some languages.
5056 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5057 Collection (GCC) Internals},
5058 for more discussion of @file{libgcc.a}.)
5059 In most cases, you need @file{libgcc.a} even when you want to avoid
5060 other standard libraries.  In other words, when you specify @option{-nostdlib}
5061 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
5062 This ensures that you have no unresolved references to internal GCC
5063 library subroutines.  (For example, @samp{__main}, used to ensure C++
5064 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5065 GNU Compiler Collection (GCC) Internals}.)
5066
5067 @item -pie
5068 @opindex pie
5069 Produce a position independent executable on targets which support it.
5070 For predictable results, you must also specify the same set of options
5071 that were used to generate code (@option{-fpie}, @option{-fPIE},
5072 or model suboptions) when you specify this option.
5073
5074 @item -s
5075 @opindex s
5076 Remove all symbol table and relocation information from the executable.
5077
5078 @item -static
5079 @opindex static
5080 On systems that support dynamic linking, this prevents linking with the shared
5081 libraries.  On other systems, this option has no effect.
5082
5083 @item -shared
5084 @opindex shared
5085 Produce a shared object which can then be linked with other objects to
5086 form an executable.  Not all systems support this option.  For predictable
5087 results, you must also specify the same set of options that were used to
5088 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
5089 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
5090 needs to build supplementary stub code for constructors to work.  On
5091 multi-libbed systems, @samp{gcc -shared} must select the correct support
5092 libraries to link against.  Failing to supply the correct flags may lead
5093 to subtle defects.  Supplying them in cases where they are not necessary
5094 is innocuous.}
5095
5096 @item -shared-libgcc
5097 @itemx -static-libgcc
5098 @opindex shared-libgcc
5099 @opindex static-libgcc
5100 On systems that provide @file{libgcc} as a shared library, these options
5101 force the use of either the shared or static version respectively.
5102 If no shared version of @file{libgcc} was built when the compiler was
5103 configured, these options have no effect.
5104
5105 There are several situations in which an application should use the
5106 shared @file{libgcc} instead of the static version.  The most common
5107 of these is when the application wishes to throw and catch exceptions
5108 across different shared libraries.  In that case, each of the libraries
5109 as well as the application itself should use the shared @file{libgcc}.
5110
5111 Therefore, the G++ and GCJ drivers automatically add
5112 @option{-shared-libgcc} whenever you build a shared library or a main
5113 executable, because C++ and Java programs typically use exceptions, so
5114 this is the right thing to do.
5115
5116 If, instead, you use the GCC driver to create shared libraries, you may
5117 find that they will not always be linked with the shared @file{libgcc}.
5118 If GCC finds, at its configuration time, that you have a GNU linker that
5119 does not support option @option{--eh-frame-hdr}, it will link the shared
5120 version of @file{libgcc} into shared libraries by default.  Otherwise,
5121 it will take advantage of the linker and optimize away the linking with
5122 the shared version of @file{libgcc}, linking with the static version of
5123 libgcc by default.  This allows exceptions to propagate through such
5124 shared libraries, without incurring relocation costs at library load
5125 time.
5126
5127 However, if a library or main executable is supposed to throw or catch
5128 exceptions, you must link it using the G++ or GCJ driver, as appropriate
5129 for the languages used in the program, or using the option
5130 @option{-shared-libgcc}, such that it is linked with the shared
5131 @file{libgcc}.
5132
5133 @item -symbolic
5134 @opindex symbolic
5135 Bind references to global symbols when building a shared object.  Warn
5136 about any unresolved references (unless overridden by the link editor
5137 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
5138 this option.
5139
5140 @item -Xlinker @var{option}
5141 @opindex Xlinker
5142 Pass @var{option} as an option to the linker.  You can use this to
5143 supply system-specific linker options which GCC does not know how to
5144 recognize.
5145
5146 If you want to pass an option that takes an argument, you must use
5147 @option{-Xlinker} twice, once for the option and once for the argument.
5148 For example, to pass @option{-assert definitions}, you must write
5149 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
5150 @option{-Xlinker "-assert definitions"}, because this passes the entire
5151 string as a single argument, which is not what the linker expects.
5152
5153 @item -Wl,@var{option}
5154 @opindex Wl
5155 Pass @var{option} as an option to the linker.  If @var{option} contains
5156 commas, it is split into multiple options at the commas.
5157
5158 @item -u @var{symbol}
5159 @opindex u
5160 Pretend the symbol @var{symbol} is undefined, to force linking of
5161 library modules to define it.  You can use @option{-u} multiple times with
5162 different symbols to force loading of additional library modules.
5163 @end table
5164
5165 @node Directory Options
5166 @section Options for Directory Search
5167 @cindex directory options
5168 @cindex options, directory search
5169 @cindex search path
5170
5171 These options specify directories to search for header files, for
5172 libraries and for parts of the compiler:
5173
5174 @table @gcctabopt
5175 @item -I@var{dir}
5176 @opindex I
5177 Add the directory @var{dir} to the head of the list of directories to be
5178 searched for header files.  This can be used to override a system header
5179 file, substituting your own version, since these directories are
5180 searched before the system header file directories.  However, you should
5181 not use this option to add directories that contain vendor-supplied
5182 system header files (use @option{-isystem} for that).  If you use more than
5183 one @option{-I} option, the directories are scanned in left-to-right
5184 order; the standard system directories come after.
5185
5186 If a standard system include directory, or a directory specified with
5187 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
5188 option will be ignored.  The directory will still be searched but as a
5189 system directory at its normal position in the system include chain.
5190 This is to ensure that GCC's procedure to fix buggy system headers and
5191 the ordering for the include_next directive are not inadvertently changed.
5192 If you really need to change the search order for system directories,
5193 use the @option{-nostdinc} and/or @option{-isystem} options.
5194
5195 @item -I-
5196 @opindex I-
5197 Any directories you specify with @option{-I} options before the @option{-I-}
5198 option are searched only for the case of @samp{#include "@var{file}"};
5199 they are not searched for @samp{#include <@var{file}>}.
5200
5201 If additional directories are specified with @option{-I} options after
5202 the @option{-I-}, these directories are searched for all @samp{#include}
5203 directives.  (Ordinarily @emph{all} @option{-I} directories are used
5204 this way.)
5205
5206 In addition, the @option{-I-} option inhibits the use of the current
5207 directory (where the current input file came from) as the first search
5208 directory for @samp{#include "@var{file}"}.  There is no way to
5209 override this effect of @option{-I-}.  With @option{-I.} you can specify
5210 searching the directory which was current when the compiler was
5211 invoked.  That is not exactly the same as what the preprocessor does
5212 by default, but it is often satisfactory.
5213
5214 @option{-I-} does not inhibit the use of the standard system directories
5215 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
5216 independent.
5217
5218 @item -L@var{dir}
5219 @opindex L
5220 Add directory @var{dir} to the list of directories to be searched
5221 for @option{-l}.
5222
5223 @item -B@var{prefix}
5224 @opindex B
5225 This option specifies where to find the executables, libraries,
5226 include files, and data files of the compiler itself.
5227
5228 The compiler driver program runs one or more of the subprograms
5229 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
5230 @var{prefix} as a prefix for each program it tries to run, both with and
5231 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5232
5233 For each subprogram to be run, the compiler driver first tries the
5234 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
5235 was not specified, the driver tries two standard prefixes, which are
5236 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
5237 those results in a file name that is found, the unmodified program
5238 name is searched for using the directories specified in your
5239 @env{PATH} environment variable.
5240
5241 The compiler will check to see if the path provided by the @option{-B}
5242 refers to a directory, and if necessary it will add a directory
5243 separator character at the end of the path.
5244
5245 @option{-B} prefixes that effectively specify directory names also apply
5246 to libraries in the linker, because the compiler translates these
5247 options into @option{-L} options for the linker.  They also apply to
5248 includes files in the preprocessor, because the compiler translates these
5249 options into @option{-isystem} options for the preprocessor.  In this case,
5250 the compiler appends @samp{include} to the prefix.
5251
5252 The run-time support file @file{libgcc.a} can also be searched for using
5253 the @option{-B} prefix, if needed.  If it is not found there, the two
5254 standard prefixes above are tried, and that is all.  The file is left
5255 out of the link if it is not found by those means.
5256
5257 Another way to specify a prefix much like the @option{-B} prefix is to use
5258 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
5259 Variables}.
5260
5261 As a special kludge, if the path provided by @option{-B} is
5262 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
5263 9, then it will be replaced by @file{[dir/]include}.  This is to help
5264 with boot-strapping the compiler.
5265
5266 @item -specs=@var{file}
5267 @opindex specs
5268 Process @var{file} after the compiler reads in the standard @file{specs}
5269 file, in order to override the defaults that the @file{gcc} driver
5270 program uses when determining what switches to pass to @file{cc1},
5271 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
5272 @option{-specs=@var{file}} can be specified on the command line, and they
5273 are processed in order, from left to right.
5274 @end table
5275
5276 @c man end
5277
5278 @node Spec Files
5279 @section Specifying subprocesses and the switches to pass to them
5280 @cindex Spec Files
5281
5282 @command{gcc} is a driver program.  It performs its job by invoking a
5283 sequence of other programs to do the work of compiling, assembling and
5284 linking.  GCC interprets its command-line parameters and uses these to
5285 deduce which programs it should invoke, and which command-line options
5286 it ought to place on their command lines.  This behavior is controlled
5287 by @dfn{spec strings}.  In most cases there is one spec string for each
5288 program that GCC can invoke, but a few programs have multiple spec
5289 strings to control their behavior.  The spec strings built into GCC can
5290 be overridden by using the @option{-specs=} command-line switch to specify
5291 a spec file.
5292
5293 @dfn{Spec files} are plaintext files that are used to construct spec
5294 strings.  They consist of a sequence of directives separated by blank
5295 lines.  The type of directive is determined by the first non-whitespace
5296 character on the line and it can be one of the following:
5297
5298 @table @code
5299 @item %@var{command}
5300 Issues a @var{command} to the spec file processor.  The commands that can
5301 appear here are:
5302
5303 @table @code
5304 @item %include <@var{file}>
5305 @cindex %include
5306 Search for @var{file} and insert its text at the current point in the
5307 specs file.
5308
5309 @item %include_noerr <@var{file}>
5310 @cindex %include_noerr
5311 Just like @samp{%include}, but do not generate an error message if the include
5312 file cannot be found.
5313
5314 @item %rename @var{old_name} @var{new_name}
5315 @cindex %rename
5316 Rename the spec string @var{old_name} to @var{new_name}.
5317
5318 @end table
5319
5320 @item *[@var{spec_name}]:
5321 This tells the compiler to create, override or delete the named spec
5322 string.  All lines after this directive up to the next directive or
5323 blank line are considered to be the text for the spec string.  If this
5324 results in an empty string then the spec will be deleted.  (Or, if the
5325 spec did not exist, then nothing will happened.)  Otherwise, if the spec
5326 does not currently exist a new spec will be created.  If the spec does
5327 exist then its contents will be overridden by the text of this
5328 directive, unless the first character of that text is the @samp{+}
5329 character, in which case the text will be appended to the spec.
5330
5331 @item [@var{suffix}]:
5332 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
5333 and up to the next directive or blank line are considered to make up the
5334 spec string for the indicated suffix.  When the compiler encounters an
5335 input file with the named suffix, it will processes the spec string in
5336 order to work out how to compile that file.  For example:
5337
5338 @smallexample
5339 .ZZ:
5340 z-compile -input %i
5341 @end smallexample
5342
5343 This says that any input file whose name ends in @samp{.ZZ} should be
5344 passed to the program @samp{z-compile}, which should be invoked with the
5345 command-line switch @option{-input} and with the result of performing the
5346 @samp{%i} substitution.  (See below.)
5347
5348 As an alternative to providing a spec string, the text that follows a
5349 suffix directive can be one of the following:
5350
5351 @table @code
5352 @item @@@var{language}
5353 This says that the suffix is an alias for a known @var{language}.  This is
5354 similar to using the @option{-x} command-line switch to GCC to specify a
5355 language explicitly.  For example:
5356
5357 @smallexample
5358 .ZZ:
5359 @@c++
5360 @end smallexample
5361
5362 Says that .ZZ files are, in fact, C++ source files.
5363
5364 @item #@var{name}
5365 This causes an error messages saying:
5366
5367 @smallexample
5368 @var{name} compiler not installed on this system.
5369 @end smallexample
5370 @end table
5371
5372 GCC already has an extensive list of suffixes built into it.
5373 This directive will add an entry to the end of the list of suffixes, but
5374 since the list is searched from the end backwards, it is effectively
5375 possible to override earlier entries using this technique.
5376
5377 @end table
5378
5379 GCC has the following spec strings built into it.  Spec files can
5380 override these strings or create their own.  Note that individual
5381 targets can also add their own spec strings to this list.
5382
5383 @smallexample
5384 asm          Options to pass to the assembler
5385 asm_final    Options to pass to the assembler post-processor
5386 cpp          Options to pass to the C preprocessor
5387 cc1          Options to pass to the C compiler
5388 cc1plus      Options to pass to the C++ compiler
5389 endfile      Object files to include at the end of the link
5390 link         Options to pass to the linker
5391 lib          Libraries to include on the command line to the linker
5392 libgcc       Decides which GCC support library to pass to the linker
5393 linker       Sets the name of the linker
5394 predefines   Defines to be passed to the C preprocessor
5395 signed_char  Defines to pass to CPP to say whether @code{char} is signed
5396              by default
5397 startfile    Object files to include at the start of the link
5398 @end smallexample
5399
5400 Here is a small example of a spec file:
5401
5402 @smallexample
5403 %rename lib                 old_lib
5404
5405 *lib:
5406 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
5407 @end smallexample
5408
5409 This example renames the spec called @samp{lib} to @samp{old_lib} and
5410 then overrides the previous definition of @samp{lib} with a new one.
5411 The new definition adds in some extra command-line options before
5412 including the text of the old definition.
5413
5414 @dfn{Spec strings} are a list of command-line options to be passed to their
5415 corresponding program.  In addition, the spec strings can contain
5416 @samp{%}-prefixed sequences to substitute variable text or to
5417 conditionally insert text into the command line.  Using these constructs
5418 it is possible to generate quite complex command lines.
5419
5420 Here is a table of all defined @samp{%}-sequences for spec
5421 strings.  Note that spaces are not generated automatically around the
5422 results of expanding these sequences.  Therefore you can concatenate them
5423 together or combine them with constant text in a single argument.
5424
5425 @table @code
5426 @item %%
5427 Substitute one @samp{%} into the program name or argument.
5428
5429 @item %i
5430 Substitute the name of the input file being processed.
5431
5432 @item %b
5433 Substitute the basename of the input file being processed.
5434 This is the substring up to (and not including) the last period
5435 and not including the directory.
5436
5437 @item %B
5438 This is the same as @samp{%b}, but include the file suffix (text after
5439 the last period).
5440
5441 @item %d
5442 Marks the argument containing or following the @samp{%d} as a
5443 temporary file name, so that that file will be deleted if GCC exits
5444 successfully.  Unlike @samp{%g}, this contributes no text to the
5445 argument.
5446
5447 @item %g@var{suffix}
5448 Substitute a file name that has suffix @var{suffix} and is chosen
5449 once per compilation, and mark the argument in the same way as
5450 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5451 name is now chosen in a way that is hard to predict even when previously
5452 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5453 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5454 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5455 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5456 was simply substituted with a file name chosen once per compilation,
5457 without regard to any appended suffix (which was therefore treated
5458 just like ordinary text), making such attacks more likely to succeed.
5459
5460 @item %u@var{suffix}
5461 Like @samp{%g}, but generates a new temporary file name even if
5462 @samp{%u@var{suffix}} was already seen.
5463
5464 @item %U@var{suffix}
5465 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5466 new one if there is no such last file name.  In the absence of any
5467 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5468 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5469 would involve the generation of two distinct file names, one
5470 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5471 simply substituted with a file name chosen for the previous @samp{%u},
5472 without regard to any appended suffix.
5473
5474 @item %j@var{suffix}
5475 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5476 writable, and if save-temps is off; otherwise, substitute the name
5477 of a temporary file, just like @samp{%u}.  This temporary file is not
5478 meant for communication between processes, but rather as a junk
5479 disposal mechanism.
5480
5481 @item %|@var{suffix}
5482 @itemx %m@var{suffix}
5483 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
5484 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
5485 all.  These are the two most common ways to instruct a program that it
5486 should read from standard input or write to standard output.  If you
5487 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
5488 construct: see for example @file{f/lang-specs.h}.
5489
5490 @item %.@var{SUFFIX}
5491 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5492 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5493 terminated by the next space or %.
5494
5495 @item %w
5496 Marks the argument containing or following the @samp{%w} as the
5497 designated output file of this compilation.  This puts the argument
5498 into the sequence of arguments that @samp{%o} will substitute later.
5499
5500 @item %o
5501 Substitutes the names of all the output files, with spaces
5502 automatically placed around them.  You should write spaces
5503 around the @samp{%o} as well or the results are undefined.
5504 @samp{%o} is for use in the specs for running the linker.
5505 Input files whose names have no recognized suffix are not compiled
5506 at all, but they are included among the output files, so they will
5507 be linked.
5508
5509 @item %O
5510 Substitutes the suffix for object files.  Note that this is
5511 handled specially when it immediately follows @samp{%g, %u, or %U},
5512 because of the need for those to form complete file names.  The
5513 handling is such that @samp{%O} is treated exactly as if it had already
5514 been substituted, except that @samp{%g, %u, and %U} do not currently
5515 support additional @var{suffix} characters following @samp{%O} as they would
5516 following, for example, @samp{.o}.
5517
5518 @item %p
5519 Substitutes the standard macro predefinitions for the
5520 current target machine.  Use this when running @code{cpp}.
5521
5522 @item %P
5523 Like @samp{%p}, but puts @samp{__} before and after the name of each
5524 predefined macro, except for macros that start with @samp{__} or with
5525 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5526 C@.
5527
5528 @item %I
5529 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5530 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5531 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5532 as necessary.
5533
5534 @item %s
5535 Current argument is the name of a library or startup file of some sort.
5536 Search for that file in a standard list of directories and substitute
5537 the full name found.
5538
5539 @item %e@var{str}
5540 Print @var{str} as an error message.  @var{str} is terminated by a newline.
5541 Use this when inconsistent options are detected.
5542
5543 @item %(@var{name})
5544 Substitute the contents of spec string @var{name} at this point.
5545
5546 @item %[@var{name}]
5547 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
5548
5549 @item %x@{@var{option}@}
5550 Accumulate an option for @samp{%X}.
5551
5552 @item %X
5553 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
5554 spec string.
5555
5556 @item %Y
5557 Output the accumulated assembler options specified by @option{-Wa}.
5558
5559 @item %Z
5560 Output the accumulated preprocessor options specified by @option{-Wp}.
5561
5562 @item %a
5563 Process the @code{asm} spec.  This is used to compute the
5564 switches to be passed to the assembler.
5565
5566 @item %A
5567 Process the @code{asm_final} spec.  This is a spec string for
5568 passing switches to an assembler post-processor, if such a program is
5569 needed.
5570
5571 @item %l
5572 Process the @code{link} spec.  This is the spec for computing the
5573 command line passed to the linker.  Typically it will make use of the
5574 @samp{%L %G %S %D and %E} sequences.
5575
5576 @item %D
5577 Dump out a @option{-L} option for each directory that GCC believes might
5578 contain startup files.  If the target supports multilibs then the
5579 current multilib directory will be prepended to each of these paths.
5580
5581 @item %M
5582 Output the multilib directory with directory separators replaced with
5583 @samp{_}.  If multilib directories are not set, or the multilib directory is
5584 @file{.} then this option emits nothing.
5585
5586 @item %L
5587 Process the @code{lib} spec.  This is a spec string for deciding which
5588 libraries should be included on the command line to the linker.
5589
5590 @item %G
5591 Process the @code{libgcc} spec.  This is a spec string for deciding
5592 which GCC support library should be included on the command line to the linker.
5593
5594 @item %S
5595 Process the @code{startfile} spec.  This is a spec for deciding which
5596 object files should be the first ones passed to the linker.  Typically
5597 this might be a file named @file{crt0.o}.
5598
5599 @item %E
5600 Process the @code{endfile} spec.  This is a spec string that specifies
5601 the last object files that will be passed to the linker.
5602
5603 @item %C
5604 Process the @code{cpp} spec.  This is used to construct the arguments
5605 to be passed to the C preprocessor.
5606
5607 @item %c
5608 Process the @code{signed_char} spec.  This is intended to be used
5609 to tell cpp whether a char is signed.  It typically has the definition:
5610 @smallexample
5611 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
5612 @end smallexample
5613
5614 @item %1
5615 Process the @code{cc1} spec.  This is used to construct the options to be
5616 passed to the actual C compiler (@samp{cc1}).
5617
5618 @item %2
5619 Process the @code{cc1plus} spec.  This is used to construct the options to be
5620 passed to the actual C++ compiler (@samp{cc1plus}).
5621
5622 @item %*
5623 Substitute the variable part of a matched option.  See below.
5624 Note that each comma in the substituted string is replaced by
5625 a single space.
5626
5627 @item %<@code{S}
5628 Remove all occurrences of @code{-S} from the command line.  Note---this
5629 command is position dependent.  @samp{%} commands in the spec string
5630 before this one will see @code{-S}, @samp{%} commands in the spec string
5631 after this one will not.
5632
5633 @item %:@var{function}(@var{args})
5634 Call the named function @var{function}, passing it @var{args}.
5635 @var{args} is first processed as a nested spec string, then split
5636 into an argument vector in the usual fashion.  The function returns
5637 a string which is processed as if it had appeared literally as part
5638 of the current spec.
5639
5640 The following built-in spec functions are provided:
5641
5642 @table @code
5643 @item @code{if-exists}
5644 The @code{if-exists} spec function takes one argument, an absolute
5645 pathname to a file.  If the file exists, @code{if-exists} returns the
5646 pathname.  Here is a small example of its usage:
5647
5648 @smallexample
5649 *startfile:
5650 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
5651 @end smallexample
5652
5653 @item @code{if-exists-else}
5654 The @code{if-exists-else} spec function is similar to the @code{if-exists}
5655 spec function, except that it takes two arguments.  The first argument is
5656 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
5657 returns the pathname.  If it does not exist, it returns the second argument.
5658 This way, @code{if-exists-else} can be used to select one file or another,
5659 based on the existence of the first.  Here is a small example of its usage:
5660
5661 @smallexample
5662 *startfile:
5663 crt0%O%s %:if-exists(crti%O%s) \
5664 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
5665 @end smallexample
5666 @end table
5667
5668 @item %@{@code{S}@}
5669 Substitutes the @code{-S} switch, if that switch was given to GCC@.
5670 If that switch was not specified, this substitutes nothing.  Note that
5671 the leading dash is omitted when specifying this option, and it is
5672 automatically inserted if the substitution is performed.  Thus the spec
5673 string @samp{%@{foo@}} would match the command-line option @option{-foo}
5674 and would output the command line option @option{-foo}.
5675
5676 @item %W@{@code{S}@}
5677 Like %@{@code{S}@} but mark last argument supplied within as a file to be
5678 deleted on failure.
5679
5680 @item %@{@code{S}*@}
5681 Substitutes all the switches specified to GCC whose names start
5682 with @code{-S}, but which also take an argument.  This is used for
5683 switches like @option{-o}, @option{-D}, @option{-I}, etc.
5684 GCC considers @option{-o foo} as being
5685 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
5686 text, including the space.  Thus two arguments would be generated.
5687
5688 @item %@{@code{S}*&@code{T}*@}
5689 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
5690 (the order of @code{S} and @code{T} in the spec is not significant).
5691 There can be any number of ampersand-separated variables; for each the
5692 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
5693
5694 @item %@{@code{S}:@code{X}@}
5695 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
5696
5697 @item %@{!@code{S}:@code{X}@}
5698 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
5699
5700 @item %@{@code{S}*:@code{X}@}
5701 Substitutes @code{X} if one or more switches whose names start with
5702 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
5703 once, no matter how many such switches appeared.  However, if @code{%*}
5704 appears somewhere in @code{X}, then @code{X} will be substituted once
5705 for each matching switch, with the @code{%*} replaced by the part of
5706 that switch that matched the @code{*}.
5707
5708 @item %@{.@code{S}:@code{X}@}
5709 Substitutes @code{X}, if processing a file with suffix @code{S}.
5710
5711 @item %@{!.@code{S}:@code{X}@}
5712 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
5713
5714 @item %@{@code{S}|@code{P}:@code{X}@}
5715 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
5716 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
5717 although they have a stronger binding than the @samp{|}.  If @code{%*}
5718 appears in @code{X}, all of the alternatives must be starred, and only
5719 the first matching alternative is substituted.
5720
5721 For example, a spec string like this:
5722
5723 @smallexample
5724 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5725 @end smallexample
5726
5727 will output the following command-line options from the following input
5728 command-line options:
5729
5730 @smallexample
5731 fred.c        -foo -baz
5732 jim.d         -bar -boggle
5733 -d fred.c     -foo -baz -boggle
5734 -d jim.d      -bar -baz -boggle
5735 @end smallexample
5736
5737 @item %@{S:X; T:Y; :D@}
5738
5739 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
5740 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
5741 be as many clauses as you need.  This may be combined with @code{.},
5742 @code{!}, @code{|}, and @code{*} as needed.
5743
5744
5745 @end table
5746
5747 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
5748 construct may contain other nested @samp{%} constructs or spaces, or
5749 even newlines.  They are processed as usual, as described above.
5750 Trailing white space in @code{X} is ignored.  White space may also
5751 appear anywhere on the left side of the colon in these constructs,
5752 except between @code{.} or @code{*} and the corresponding word.
5753
5754 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
5755 handled specifically in these constructs.  If another value of
5756 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5757 @option{-W} switch is found later in the command line, the earlier
5758 switch value is ignored, except with @{@code{S}*@} where @code{S} is
5759 just one letter, which passes all matching options.
5760
5761 The character @samp{|} at the beginning of the predicate text is used to
5762 indicate that a command should be piped to the following command, but
5763 only if @option{-pipe} is specified.
5764
5765 It is built into GCC which switches take arguments and which do not.
5766 (You might think it would be useful to generalize this to allow each
5767 compiler's spec to say which switches take arguments.  But this cannot
5768 be done in a consistent fashion.  GCC cannot even decide which input
5769 files have been specified without knowing which switches take arguments,
5770 and it must know which input files to compile in order to tell which
5771 compilers to run).
5772
5773 GCC also knows implicitly that arguments starting in @option{-l} are to be
5774 treated as compiler output files, and passed to the linker in their
5775 proper position among the other output files.
5776
5777 @c man begin OPTIONS
5778
5779 @node Target Options
5780 @section Specifying Target Machine and Compiler Version
5781 @cindex target options
5782 @cindex cross compiling
5783 @cindex specifying machine version
5784 @cindex specifying compiler version and target machine
5785 @cindex compiler version, specifying
5786 @cindex target machine, specifying
5787
5788 The usual way to run GCC is to run the executable called @file{gcc}, or
5789 @file{<machine>-gcc} when cross-compiling, or
5790 @file{<machine>-gcc-<version>} to run a version other than the one that
5791 was installed last.  Sometimes this is inconvenient, so GCC provides
5792 options that will switch to another cross-compiler or version.
5793
5794 @table @gcctabopt
5795 @item -b @var{machine}
5796 @opindex b
5797 The argument @var{machine} specifies the target machine for compilation.
5798
5799 The value to use for @var{machine} is the same as was specified as the
5800 machine type when configuring GCC as a cross-compiler.  For
5801 example, if a cross-compiler was configured with @samp{configure
5802 i386v}, meaning to compile for an 80386 running System V, then you
5803 would specify @option{-b i386v} to run that cross compiler.
5804
5805 @item -V @var{version}
5806 @opindex V
5807 The argument @var{version} specifies which version of GCC to run.
5808 This is useful when multiple versions are installed.  For example,
5809 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5810 @end table
5811
5812 The @option{-V} and @option{-b} options work by running the
5813 @file{<machine>-gcc-<version>} executable, so there's no real reason to
5814 use them if you can just run that directly.
5815
5816 @node Submodel Options
5817 @section Hardware Models and Configurations
5818 @cindex submodel options
5819 @cindex specifying hardware config
5820 @cindex hardware models and configurations, specifying
5821 @cindex machine dependent options
5822
5823 Earlier we discussed the standard option @option{-b} which chooses among
5824 different installed compilers for completely different target
5825 machines, such as VAX vs.@: 68000 vs.@: 80386.
5826
5827 In addition, each of these target machine types can have its own
5828 special options, starting with @samp{-m}, to choose among various
5829 hardware models or configurations---for example, 68010 vs 68020,
5830 floating coprocessor or none.  A single installed version of the
5831 compiler can compile for any model or configuration, according to the
5832 options specified.
5833
5834 Some configurations of the compiler also support additional special
5835 options, usually for compatibility with other compilers on the same
5836 platform.
5837
5838 These options are defined by the macro @code{TARGET_SWITCHES} in the
5839 machine description.  The default for the options is also defined by
5840 that macro, which enables you to change the defaults.
5841
5842 @menu
5843 * M680x0 Options::
5844 * M68hc1x Options::
5845 * VAX Options::
5846 * SPARC Options::
5847 * ARM Options::
5848 * MN10300 Options::
5849 * M32R/D Options::
5850 * RS/6000 and PowerPC Options::
5851 * Darwin Options::
5852 * MIPS Options::
5853 * i386 and x86-64 Options::
5854 * HPPA Options::
5855 * DEC Alpha Options::
5856 * DEC Alpha/VMS Options::
5857 * H8/300 Options::
5858 * SH Options::
5859 * System V Options::
5860 * TMS320C3x/C4x Options::
5861 * V850 Options::
5862 * ARC Options::
5863 * NS32K Options::
5864 * AVR Options::
5865 * MCore Options::
5866 * IA-64 Options::
5867 * S/390 and zSeries Options::
5868 * CRIS Options::
5869 * MMIX Options::
5870 * PDP-11 Options::
5871 * Xstormy16 Options::
5872 * Xtensa Options::
5873 * FRV Options::
5874 @end menu
5875
5876 @node M680x0 Options
5877 @subsection M680x0 Options
5878 @cindex M680x0 options
5879
5880 These are the @samp{-m} options defined for the 68000 series.  The default
5881 values for these options depends on which style of 68000 was selected when
5882 the compiler was configured; the defaults for the most common choices are
5883 given below.
5884
5885 @table @gcctabopt
5886 @item -m68000
5887 @itemx -mc68000
5888 @opindex m68000
5889 @opindex mc68000
5890 Generate output for a 68000.  This is the default
5891 when the compiler is configured for 68000-based systems.
5892
5893 Use this option for microcontrollers with a 68000 or EC000 core,
5894 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5895
5896 @item -m68020
5897 @itemx -mc68020
5898 @opindex m68020
5899 @opindex mc68020
5900 Generate output for a 68020.  This is the default
5901 when the compiler is configured for 68020-based systems.
5902
5903 @item -m68881
5904 @opindex m68881
5905 Generate output containing 68881 instructions for floating point.
5906 This is the default for most 68020 systems unless @option{--nfp} was
5907 specified when the compiler was configured.
5908
5909 @item -m68030
5910 @opindex m68030
5911 Generate output for a 68030.  This is the default when the compiler is
5912 configured for 68030-based systems.
5913
5914 @item -m68040
5915 @opindex m68040
5916 Generate output for a 68040.  This is the default when the compiler is
5917 configured for 68040-based systems.
5918
5919 This option inhibits the use of 68881/68882 instructions that have to be
5920 emulated by software on the 68040.  Use this option if your 68040 does not
5921 have code to emulate those instructions.
5922
5923 @item -m68060
5924 @opindex m68060
5925 Generate output for a 68060.  This is the default when the compiler is
5926 configured for 68060-based systems.
5927
5928 This option inhibits the use of 68020 and 68881/68882 instructions that
5929 have to be emulated by software on the 68060.  Use this option if your 68060
5930 does not have code to emulate those instructions.
5931
5932 @item -mcpu32
5933 @opindex mcpu32
5934 Generate output for a CPU32.  This is the default
5935 when the compiler is configured for CPU32-based systems.
5936
5937 Use this option for microcontrollers with a
5938 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5939 68336, 68340, 68341, 68349 and 68360.
5940
5941 @item -m5200
5942 @opindex m5200
5943 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5944 when the compiler is configured for 520X-based systems.
5945
5946 Use this option for microcontroller with a 5200 core, including
5947 the MCF5202, MCF5203, MCF5204 and MCF5202.
5948
5949
5950 @item -m68020-40
5951 @opindex m68020-40
5952 Generate output for a 68040, without using any of the new instructions.
5953 This results in code which can run relatively efficiently on either a
5954 68020/68881 or a 68030 or a 68040.  The generated code does use the
5955 68881 instructions that are emulated on the 68040.
5956
5957 @item -m68020-60
5958 @opindex m68020-60
5959 Generate output for a 68060, without using any of the new instructions.
5960 This results in code which can run relatively efficiently on either a
5961 68020/68881 or a 68030 or a 68040.  The generated code does use the
5962 68881 instructions that are emulated on the 68060.
5963
5964 @item -msoft-float
5965 @opindex msoft-float
5966 Generate output containing library calls for floating point.
5967 @strong{Warning:} the requisite libraries are not available for all m68k
5968 targets.  Normally the facilities of the machine's usual C compiler are
5969 used, but this can't be done directly in cross-compilation.  You must
5970 make your own arrangements to provide suitable library functions for
5971 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5972 @samp{m68k-*-coff} do provide software floating point support.
5973
5974 @item -mshort
5975 @opindex mshort
5976 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5977
5978 @item -mnobitfield
5979 @opindex mnobitfield
5980 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5981 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
5982
5983 @item -mbitfield
5984 @opindex mbitfield
5985 Do use the bit-field instructions.  The @option{-m68020} option implies
5986 @option{-mbitfield}.  This is the default if you use a configuration
5987 designed for a 68020.
5988
5989 @item -mrtd
5990 @opindex mrtd
5991 Use a different function-calling convention, in which functions
5992 that take a fixed number of arguments return with the @code{rtd}
5993 instruction, which pops their arguments while returning.  This
5994 saves one instruction in the caller since there is no need to pop
5995 the arguments there.
5996
5997 This calling convention is incompatible with the one normally
5998 used on Unix, so you cannot use it if you need to call libraries
5999 compiled with the Unix compiler.
6000
6001 Also, you must provide function prototypes for all functions that
6002 take variable numbers of arguments (including @code{printf});
6003 otherwise incorrect code will be generated for calls to those
6004 functions.
6005
6006 In addition, seriously incorrect code will result if you call a
6007 function with too many arguments.  (Normally, extra arguments are
6008 harmlessly ignored.)
6009
6010 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
6011 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
6012
6013 @item -malign-int
6014 @itemx -mno-align-int
6015 @opindex malign-int
6016 @opindex mno-align-int
6017 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
6018 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
6019 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
6020 Aligning variables on 32-bit boundaries produces code that runs somewhat
6021 faster on processors with 32-bit busses at the expense of more memory.
6022
6023 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
6024 align structures containing the above types  differently than
6025 most published application binary interface specifications for the m68k.
6026
6027 @item -mpcrel
6028 @opindex mpcrel
6029 Use the pc-relative addressing mode of the 68000 directly, instead of
6030 using a global offset table.  At present, this option implies @option{-fpic},
6031 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
6032 not presently supported with @option{-mpcrel}, though this could be supported for
6033 68020 and higher processors.
6034
6035 @item -mno-strict-align
6036 @itemx -mstrict-align
6037 @opindex mno-strict-align
6038 @opindex mstrict-align
6039 Do not (do) assume that unaligned memory references will be handled by
6040 the system.
6041
6042 @item -msep-data
6043 Generate code that allows the data segment to be located in a different
6044 area of memory from the text segment.  This allows for execute in place in
6045 an environment without virtual memory management.  This option implies -fPIC.
6046
6047 @item -mno-sep-data
6048 Generate code that assumes that the data segment follows the text segment.
6049 This is the default.
6050
6051 @item -mid-shared-library
6052 Generate code that supports shared libraries via the library ID method.
6053 This allows for execute in place and shared libraries in an environment
6054 without virtual memory management.  This option implies -fPIC.
6055
6056 @item -mno-id-shared-library
6057 Generate code that doesn't assume ID based shared libraries are being used.
6058 This is the default.
6059
6060 @item -mshared-library-id=n
6061 Specified the identification number of the ID based shared library being
6062 compiled.  Specifying a value of 0 will generate more compact code, specifying
6063 other values will force the allocation of that number to the current
6064 library but is no more space or time efficient than omitting this option.
6065
6066 @end table
6067
6068 @node M68hc1x Options
6069 @subsection M68hc1x Options
6070 @cindex M68hc1x options
6071
6072 These are the @samp{-m} options defined for the 68hc11 and 68hc12
6073 microcontrollers.  The default values for these options depends on
6074 which style of microcontroller was selected when the compiler was configured;
6075 the defaults for the most common choices are given below.
6076
6077 @table @gcctabopt
6078 @item -m6811
6079 @itemx -m68hc11
6080 @opindex m6811
6081 @opindex m68hc11
6082 Generate output for a 68HC11.  This is the default
6083 when the compiler is configured for 68HC11-based systems.
6084
6085 @item -m6812
6086 @itemx -m68hc12
6087 @opindex m6812
6088 @opindex m68hc12
6089 Generate output for a 68HC12.  This is the default
6090 when the compiler is configured for 68HC12-based systems.
6091
6092 @item -m68S12
6093 @itemx -m68hcs12
6094 @opindex m68S12
6095 @opindex m68hcs12
6096 Generate output for a 68HCS12.
6097
6098 @item -mauto-incdec
6099 @opindex mauto-incdec
6100 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
6101 addressing modes.
6102
6103 @item -minmax
6104 @itemx -nominmax
6105 @opindex minmax
6106 @opindex mnominmax
6107 Enable the use of 68HC12 min and max instructions.
6108
6109 @item -mlong-calls
6110 @itemx -mno-long-calls
6111 @opindex mlong-calls
6112 @opindex mno-long-calls
6113 Treat all calls as being far away (near).  If calls are assumed to be
6114 far away, the compiler will use the @code{call} instruction to
6115 call a function and the @code{rtc} instruction for returning.
6116
6117 @item -mshort
6118 @opindex mshort
6119 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6120
6121 @item -msoft-reg-count=@var{count}
6122 @opindex msoft-reg-count
6123 Specify the number of pseudo-soft registers which are used for the
6124 code generation.  The maximum number is 32.  Using more pseudo-soft
6125 register may or may not result in better code depending on the program.
6126 The default is 4 for 68HC11 and 2 for 68HC12.
6127
6128 @end table
6129
6130 @node VAX Options
6131 @subsection VAX Options
6132 @cindex VAX options
6133
6134 These @samp{-m} options are defined for the VAX:
6135
6136 @table @gcctabopt
6137 @item -munix
6138 @opindex munix
6139 Do not output certain jump instructions (@code{aobleq} and so on)
6140 that the Unix assembler for the VAX cannot handle across long
6141 ranges.
6142
6143 @item -mgnu
6144 @opindex mgnu
6145 Do output those jump instructions, on the assumption that you
6146 will assemble with the GNU assembler.
6147
6148 @item -mg
6149 @opindex mg
6150 Output code for g-format floating point numbers instead of d-format.
6151 @end table
6152
6153 @node SPARC Options
6154 @subsection SPARC Options
6155 @cindex SPARC options
6156
6157 These @samp{-m} options are supported on the SPARC:
6158
6159 @table @gcctabopt
6160 @item -mno-app-regs
6161 @itemx -mapp-regs
6162 @opindex mno-app-regs
6163 @opindex mapp-regs
6164 Specify @option{-mapp-regs} to generate output using the global registers
6165 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
6166 is the default.
6167
6168 To be fully SVR4 ABI compliant at the cost of some performance loss,
6169 specify @option{-mno-app-regs}.  You should compile libraries and system
6170 software with this option.
6171
6172 @item -mfpu
6173 @itemx -mhard-float
6174 @opindex mfpu
6175 @opindex mhard-float
6176 Generate output containing floating point instructions.  This is the
6177 default.
6178
6179 @item -mno-fpu
6180 @itemx -msoft-float
6181 @opindex mno-fpu
6182 @opindex msoft-float
6183 Generate output containing library calls for floating point.
6184 @strong{Warning:} the requisite libraries are not available for all SPARC
6185 targets.  Normally the facilities of the machine's usual C compiler are
6186 used, but this cannot be done directly in cross-compilation.  You must make
6187 your own arrangements to provide suitable library functions for
6188 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
6189 @samp{sparclite-*-*} do provide software floating point support.
6190
6191 @option{-msoft-float} changes the calling convention in the output file;
6192 therefore, it is only useful if you compile @emph{all} of a program with
6193 this option.  In particular, you need to compile @file{libgcc.a}, the
6194 library that comes with GCC, with @option{-msoft-float} in order for
6195 this to work.
6196
6197 @item -mhard-quad-float
6198 @opindex mhard-quad-float
6199 Generate output containing quad-word (long double) floating point
6200 instructions.
6201
6202 @item -msoft-quad-float
6203 @opindex msoft-quad-float
6204 Generate output containing library calls for quad-word (long double)
6205 floating point instructions.  The functions called are those specified
6206 in the SPARC ABI@.  This is the default.
6207
6208 As of this writing, there are no SPARC implementations that have hardware
6209 support for the quad-word floating point instructions.  They all invoke
6210 a trap handler for one of these instructions, and then the trap handler
6211 emulates the effect of the instruction.  Because of the trap handler overhead,
6212 this is much slower than calling the ABI library routines.  Thus the
6213 @option{-msoft-quad-float} option is the default.
6214
6215 @item -mno-unaligned-doubles
6216 @itemx -munaligned-doubles
6217 @opindex mno-unaligned-doubles
6218 @opindex munaligned-doubles
6219 Assume that doubles have 8 byte alignment.  This is the default.
6220
6221 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
6222 alignment only if they are contained in another type, or if they have an
6223 absolute address.  Otherwise, it assumes they have 4 byte alignment.
6224 Specifying this option avoids some rare compatibility problems with code
6225 generated by other compilers.  It is not the default because it results
6226 in a performance loss, especially for floating point code.
6227
6228 @item -mno-faster-structs
6229 @itemx -mfaster-structs
6230 @opindex mno-faster-structs
6231 @opindex mfaster-structs
6232 With @option{-mfaster-structs}, the compiler assumes that structures
6233 should have 8 byte alignment.  This enables the use of pairs of
6234 @code{ldd} and @code{std} instructions for copies in structure
6235 assignment, in place of twice as many @code{ld} and @code{st} pairs.
6236 However, the use of this changed alignment directly violates the SPARC
6237 ABI@.  Thus, it's intended only for use on targets where the developer
6238 acknowledges that their resulting code will not be directly in line with
6239 the rules of the ABI@.
6240
6241 @item -mimpure-text
6242 @opindex mimpure-text
6243 @option{-mimpure-text}, used in addition to @option{-shared}, tells
6244 the compiler to not pass @option{-z text} to the linker when linking a
6245 shared object.  Using this option, you can link position-dependent
6246 code into a shared object.
6247
6248 @option{-mimpure-text} suppresses the ``relocations remain against
6249 allocatable but non-writable sections'' linker error message.
6250 However, the necessary relocations will trigger copy-on-write, and the
6251 shared object is not actually shared across processes.  Instead of
6252 using @option{-mimpure-text}, you should compile all source code with
6253 @option{-fpic} or @option{-fPIC}.
6254
6255 This option is only available on SunOS and Solaris.
6256
6257 @item -mcpu=@var{cpu_type}
6258 @opindex mcpu
6259 Set the instruction set, register set, and instruction scheduling parameters
6260 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
6261 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
6262 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
6263 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
6264 @samp{ultrasparc3}.
6265
6266 Default instruction scheduling parameters are used for values that select
6267 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
6268 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
6269
6270 Here is a list of each supported architecture and their supported
6271 implementations.
6272
6273 @smallexample
6274     v7:             cypress
6275     v8:             supersparc, hypersparc
6276     sparclite:      f930, f934, sparclite86x
6277     sparclet:       tsc701
6278     v9:             ultrasparc, ultrasparc3
6279 @end smallexample
6280
6281 By default (unless configured otherwise), GCC generates code for the V7
6282 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
6283 additionally optimizes it for the Cypress CY7C602 chip, as used in the
6284 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
6285 SPARCStation 1, 2, IPX etc.
6286
6287 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
6288 architecture.  The only difference from V7 code is that the compiler emits
6289 the integer multiply and integer divide instructions which exist in SPARC-V8
6290 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
6291 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
6292 2000 series.
6293
6294 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
6295 the SPARC architecture.  This adds the integer multiply, integer divide step
6296 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
6297 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
6298 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU.  With
6299 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
6300 MB86934 chip, which is the more recent SPARClite with FPU.
6301
6302 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
6303 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
6304 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
6305 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
6306 optimizes it for the TEMIC SPARClet chip.
6307
6308 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
6309 architecture.  This adds 64-bit integer and floating-point move instructions,
6310 3 additional floating-point condition code registers and conditional move
6311 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
6312 optimizes it for the Sun UltraSPARC I/II chips.  With
6313 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
6314 Sun UltraSPARC III chip.
6315
6316 @item -mtune=@var{cpu_type}
6317 @opindex mtune
6318 Set the instruction scheduling parameters for machine type
6319 @var{cpu_type}, but do not set the instruction set or register set that the
6320 option @option{-mcpu=@var{cpu_type}} would.
6321
6322 The same values for @option{-mcpu=@var{cpu_type}} can be used for
6323 @option{-mtune=@var{cpu_type}}, but the only useful values are those
6324 that select a particular cpu implementation.  Those are @samp{cypress},
6325 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
6326 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
6327 @samp{ultrasparc3}.
6328
6329 @item -mv8plus
6330 @itemx -mno-v8plus
6331 @opindex -mv8plus
6332 @opindex -mno-v8plus
6333 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI.  The
6334 difference from the V8 ABI is that the global and out registers are
6335 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
6336 mode for all SPARC-V9 processors.
6337
6338 @item -mvis
6339 @itemx -mno-vis
6340 @opindex -mvis
6341 @opindex -mno-vis
6342 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
6343 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
6344 @end table
6345
6346 These @samp{-m} options are supported in addition to the above
6347 on SPARC-V9 processors in 64-bit environments:
6348
6349 @table @gcctabopt
6350 @item -mlittle-endian
6351 @opindex mlittle-endian
6352 Generate code for a processor running in little-endian mode. It is only
6353 available for a few configurations and most notably not on Solaris.
6354
6355 @item -m32
6356 @itemx -m64
6357 @opindex m32
6358 @opindex m64
6359 Generate code for a 32-bit or 64-bit environment.
6360 The 32-bit environment sets int, long and pointer to 32 bits.
6361 The 64-bit environment sets int to 32 bits and long and pointer
6362 to 64 bits.
6363
6364 @item -mcmodel=medlow
6365 @opindex mcmodel=medlow
6366 Generate code for the Medium/Low code model: the program must be linked
6367 in the low 32 bits of the address space.  Pointers are 64 bits.
6368 Programs can be statically or dynamically linked.
6369
6370 @item -mcmodel=medmid
6371 @opindex mcmodel=medmid
6372 Generate code for the Medium/Middle code model: the program must be linked
6373 in the low 44 bits of the address space, the text segment must be less than
6374 2G bytes, and data segment must be within 2G of the text segment.
6375 Pointers are 64 bits.
6376
6377 @item -mcmodel=medany
6378 @opindex mcmodel=medany
6379 Generate code for the Medium/Anywhere code model: the program may be linked
6380 anywhere in the address space, the text segment must be less than
6381 2G bytes, and data segment must be within 2G of the text segment.
6382 Pointers are 64 bits.
6383
6384 @item -mcmodel=embmedany
6385 @opindex mcmodel=embmedany
6386 Generate code for the Medium/Anywhere code model for embedded systems:
6387 assume a 32-bit text and a 32-bit data segment, both starting anywhere
6388 (determined at link time).  Register %g4 points to the base of the
6389 data segment.  Pointers are still 64 bits.
6390 Programs are statically linked, PIC is not supported.
6391
6392 @item -mstack-bias
6393 @itemx -mno-stack-bias
6394 @opindex mstack-bias
6395 @opindex mno-stack-bias
6396 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
6397 frame pointer if present, are offset by @minus{}2047 which must be added back
6398 when making stack frame references.  This is the default in 64-bit mode.
6399 Otherwise, assume no such offset is present.
6400 @end table
6401
6402 @node ARM Options
6403 @subsection ARM Options
6404 @cindex ARM options
6405
6406 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6407 architectures:
6408
6409 @table @gcctabopt
6410 @item -mapcs-frame
6411 @opindex mapcs-frame
6412 Generate a stack frame that is compliant with the ARM Procedure Call
6413 Standard for all functions, even if this is not strictly necessary for
6414 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
6415 with this option will cause the stack frames not to be generated for
6416 leaf functions.  The default is @option{-mno-apcs-frame}.
6417
6418 @item -mapcs
6419 @opindex mapcs
6420 This is a synonym for @option{-mapcs-frame}.
6421
6422 @item -mapcs-26
6423 @opindex mapcs-26
6424 Generate code for a processor running with a 26-bit program counter,
6425 and conforming to the function calling standards for the APCS 26-bit
6426 option.  This option replaces the @option{-m2} and @option{-m3} options
6427 of previous releases of the compiler.
6428
6429 @item -mapcs-32
6430 @opindex mapcs-32
6431 Generate code for a processor running with a 32-bit program counter,
6432 and conforming to the function calling standards for the APCS 32-bit
6433 option.  This option replaces the @option{-m6} option of previous releases
6434 of the compiler.
6435
6436 @ignore
6437 @c not currently implemented
6438 @item -mapcs-stack-check
6439 @opindex mapcs-stack-check
6440 Generate code to check the amount of stack space available upon entry to
6441 every function (that actually uses some stack space).  If there is
6442 insufficient space available then either the function
6443 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6444 called, depending upon the amount of stack space required.  The run time
6445 system is required to provide these functions.  The default is
6446 @option{-mno-apcs-stack-check}, since this produces smaller code.
6447
6448 @c not currently implemented
6449 @item -mapcs-float
6450 @opindex mapcs-float
6451 Pass floating point arguments using the float point registers.  This is
6452 one of the variants of the APCS@.  This option is recommended if the
6453 target hardware has a floating point unit or if a lot of floating point
6454 arithmetic is going to be performed by the code.  The default is
6455 @option{-mno-apcs-float}, since integer only code is slightly increased in
6456 size if @option{-mapcs-float} is used.
6457
6458 @c not currently implemented
6459 @item -mapcs-reentrant
6460 @opindex mapcs-reentrant
6461 Generate reentrant, position independent code.  The default is
6462 @option{-mno-apcs-reentrant}.
6463 @end ignore
6464
6465 @item -mthumb-interwork
6466 @opindex mthumb-interwork
6467 Generate code which supports calling between the ARM and Thumb
6468 instruction sets.  Without this option the two instruction sets cannot
6469 be reliably used inside one program.  The default is
6470 @option{-mno-thumb-interwork}, since slightly larger code is generated
6471 when @option{-mthumb-interwork} is specified.
6472
6473 @item -mno-sched-prolog
6474 @opindex mno-sched-prolog
6475 Prevent the reordering of instructions in the function prolog, or the
6476 merging of those instruction with the instructions in the function's
6477 body.  This means that all functions will start with a recognizable set
6478 of instructions (or in fact one of a choice from a small set of
6479 different function prologues), and this information can be used to
6480 locate the start if functions inside an executable piece of code.  The
6481 default is @option{-msched-prolog}.
6482
6483 @item -mhard-float
6484 @opindex mhard-float
6485 Generate output containing floating point instructions.  This is the
6486 default.
6487
6488 @item -msoft-float
6489 @opindex msoft-float
6490 Generate output containing library calls for floating point.
6491 @strong{Warning:} the requisite libraries are not available for all ARM
6492 targets.  Normally the facilities of the machine's usual C compiler are
6493 used, but this cannot be done directly in cross-compilation.  You must make
6494 your own arrangements to provide suitable library functions for
6495 cross-compilation.
6496
6497 @option{-msoft-float} changes the calling convention in the output file;
6498 therefore, it is only useful if you compile @emph{all} of a program with
6499 this option.  In particular, you need to compile @file{libgcc.a}, the
6500 library that comes with GCC, with @option{-msoft-float} in order for
6501 this to work.
6502
6503 @item -mfloat-abi=@var{name}
6504 @opindex mfloat-abi
6505 Specifies which ABI to use for floating point values.  Permissible values
6506 are: @samp{soft}, @samp{softfp} and @samp{hard}.
6507
6508 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
6509 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
6510 of floating point instructions, but still uses the soft-float calling
6511 conventions.
6512
6513 @item -mlittle-endian
6514 @opindex mlittle-endian
6515 Generate code for a processor running in little-endian mode.  This is
6516 the default for all standard configurations.
6517
6518 @item -mbig-endian
6519 @opindex mbig-endian
6520 Generate code for a processor running in big-endian mode; the default is
6521 to compile code for a little-endian processor.
6522
6523 @item -mwords-little-endian
6524 @opindex mwords-little-endian
6525 This option only applies when generating code for big-endian processors.
6526 Generate code for a little-endian word order but a big-endian byte
6527 order.  That is, a byte order of the form @samp{32107654}.  Note: this
6528 option should only be used if you require compatibility with code for
6529 big-endian ARM processors generated by versions of the compiler prior to
6530 2.8.
6531
6532 @item -malignment-traps
6533 @opindex malignment-traps
6534 Generate code that will not trap if the MMU has alignment traps enabled.
6535 On ARM architectures prior to ARMv4, there were no instructions to
6536 access half-word objects stored in memory.  However, when reading from
6537 memory a feature of the ARM architecture allows a word load to be used,
6538 even if the address is unaligned, and the processor core will rotate the
6539 data as it is being loaded.  This option tells the compiler that such
6540 misaligned accesses will cause a MMU trap and that it should instead
6541 synthesize the access as a series of byte accesses.  The compiler can
6542 still use word accesses to load half-word data if it knows that the
6543 address is aligned to a word boundary.
6544
6545 This option is ignored when compiling for ARM architecture 4 or later,
6546 since these processors have instructions to directly access half-word
6547 objects in memory.
6548
6549 @item -mno-alignment-traps
6550 @opindex mno-alignment-traps
6551 Generate code that assumes that the MMU will not trap unaligned
6552 accesses.  This produces better code when the target instruction set
6553 does not have half-word memory operations (i.e.@: implementations prior to
6554 ARMv4).
6555
6556 Note that you cannot use this option to access unaligned word objects,
6557 since the processor will only fetch one 32-bit aligned object from
6558 memory.
6559
6560 The default setting for most targets is @option{-mno-alignment-traps}, since
6561 this produces better code when there are no half-word memory
6562 instructions available.
6563
6564 @item -mshort-load-bytes
6565 @itemx -mno-short-load-words
6566 @opindex mshort-load-bytes
6567 @opindex mno-short-load-words
6568 These are deprecated aliases for @option{-malignment-traps}.
6569
6570 @item -mno-short-load-bytes
6571 @itemx -mshort-load-words
6572 @opindex mno-short-load-bytes
6573 @opindex mshort-load-words
6574 This are deprecated aliases for @option{-mno-alignment-traps}.
6575
6576 @item -mcpu=@var{name}
6577 @opindex mcpu
6578 This specifies the name of the target ARM processor.  GCC uses this name
6579 to determine what kind of instructions it can emit when generating
6580 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6581 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6582 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6583 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6584 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6585 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6586 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6587 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6588 @samp{arm920t}, @samp{arm926ejs}, @samp{arm940t}, @samp{arm9tdmi},
6589 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ejs},
6590 @samp{arm1136js}, @samp{arm1136jfs} ,@samp{xscale}, @samp{iwmmxt},
6591 @samp{ep9312}.
6592
6593 @itemx -mtune=@var{name}
6594 @opindex mtune
6595 This option is very similar to the @option{-mcpu=} option, except that
6596 instead of specifying the actual target processor type, and hence
6597 restricting which instructions can be used, it specifies that GCC should
6598 tune the performance of the code as if the target were of the type
6599 specified in this option, but still choosing the instructions that it
6600 will generate based on the cpu specified by a @option{-mcpu=} option.
6601 For some ARM implementations better performance can be obtained by using
6602 this option.
6603
6604 @item -march=@var{name}
6605 @opindex march
6606 This specifies the name of the target ARM architecture.  GCC uses this
6607 name to determine what kind of instructions it can emit when generating
6608 assembly code.  This option can be used in conjunction with or instead
6609 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6610 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6611 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
6612 @samp{iwmmxt}, @samp{ep9312}.
6613
6614 @item -mfpu=@var{name}
6615 @itemx -mfpe=@var{number}
6616 @itemx -mfp=@var{number}
6617 @opindex mfpu
6618 @opindex mfpe
6619 @opindex mfp
6620 This specifies what floating point hardware (or hardware emulation) is
6621 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
6622 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
6623 are synonyms for @option{-mpfu}=@samp{fpe}@var{number}, for compatibility
6624 with older versions of GCC@.
6625
6626 If @option{-msoft-float} is specified this specifies the format of
6627 floating point values.
6628
6629 @item -mstructure-size-boundary=@var{n}
6630 @opindex mstructure-size-boundary
6631 The size of all structures and unions will be rounded up to a multiple
6632 of the number of bits set by this option.  Permissible values are 8 and
6633 32.  The default value varies for different toolchains.  For the COFF
6634 targeted toolchain the default value is 8.  Specifying the larger number
6635 can produce faster, more efficient code, but can also increase the size
6636 of the program.  The two values are potentially incompatible.  Code
6637 compiled with one value cannot necessarily expect to work with code or
6638 libraries compiled with the other value, if they exchange information
6639 using structures or unions.
6640
6641 @item -mabort-on-noreturn
6642 @opindex mabort-on-noreturn
6643 Generate a call to the function @code{abort} at the end of a
6644 @code{noreturn} function.  It will be executed if the function tries to
6645 return.
6646
6647 @item -mlong-calls
6648 @itemx -mno-long-calls
6649 @opindex mlong-calls
6650 @opindex mno-long-calls
6651 Tells the compiler to perform function calls by first loading the
6652 address of the function into a register and then performing a subroutine
6653 call on this register.  This switch is needed if the target function
6654 will lie outside of the 64 megabyte addressing range of the offset based
6655 version of subroutine call instruction.
6656
6657 Even if this switch is enabled, not all function calls will be turned
6658 into long calls.  The heuristic is that static functions, functions
6659 which have the @samp{short-call} attribute, functions that are inside
6660 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6661 definitions have already been compiled within the current compilation
6662 unit, will not be turned into long calls.  The exception to this rule is
6663 that weak function definitions, functions with the @samp{long-call}
6664 attribute or the @samp{section} attribute, and functions that are within
6665 the scope of a @samp{#pragma long_calls} directive, will always be
6666 turned into long calls.
6667
6668 This feature is not enabled by default.  Specifying
6669 @option{-mno-long-calls} will restore the default behavior, as will
6670 placing the function calls within the scope of a @samp{#pragma
6671 long_calls_off} directive.  Note these switches have no effect on how
6672 the compiler generates code to handle function calls via function
6673 pointers.
6674
6675 @item -mnop-fun-dllimport
6676 @opindex mnop-fun-dllimport
6677 Disable support for the @code{dllimport} attribute.
6678
6679 @item -msingle-pic-base
6680 @opindex msingle-pic-base
6681 Treat the register used for PIC addressing as read-only, rather than
6682 loading it in the prologue for each function.  The run-time system is
6683 responsible for initializing this register with an appropriate value
6684 before execution begins.
6685
6686 @item -mpic-register=@var{reg}
6687 @opindex mpic-register
6688 Specify the register to be used for PIC addressing.  The default is R10
6689 unless stack-checking is enabled, when R9 is used.
6690
6691 @item -mcirrus-fix-invalid-insns
6692 @opindex mcirrus-fix-invalid-insns
6693 @opindex mno-cirrus-fix-invalid-insns
6694 Insert NOPs into the instruction stream to in order to work around
6695 problems with invalid Maverick instruction combinations.  This option
6696 is only valid if the @option{-mcpu=ep9312} option has been used to
6697 enable generation of instructions for the Cirrus Maverick floating
6698 point co-processor.  This option is not enabled by default, since the
6699 problem is only present in older Maverick implementations.  The default
6700 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
6701 switch.
6702
6703 @item -mpoke-function-name
6704 @opindex mpoke-function-name
6705 Write the name of each function into the text section, directly
6706 preceding the function prologue.  The generated code is similar to this:
6707
6708 @smallexample
6709      t0
6710          .ascii "arm_poke_function_name", 0
6711          .align
6712      t1
6713          .word 0xff000000 + (t1 - t0)
6714      arm_poke_function_name
6715          mov     ip, sp
6716          stmfd   sp!, @{fp, ip, lr, pc@}
6717          sub     fp, ip, #4
6718 @end smallexample
6719
6720 When performing a stack backtrace, code can inspect the value of
6721 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6722 location @code{pc - 12} and the top 8 bits are set, then we know that
6723 there is a function name embedded immediately preceding this location
6724 and has length @code{((pc[-3]) & 0xff000000)}.
6725
6726 @item -mthumb
6727 @opindex mthumb
6728 Generate code for the 16-bit Thumb instruction set.  The default is to
6729 use the 32-bit ARM instruction set.
6730
6731 @item -mtpcs-frame
6732 @opindex mtpcs-frame
6733 Generate a stack frame that is compliant with the Thumb Procedure Call
6734 Standard for all non-leaf functions.  (A leaf function is one that does
6735 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6736
6737 @item -mtpcs-leaf-frame
6738 @opindex mtpcs-leaf-frame
6739 Generate a stack frame that is compliant with the Thumb Procedure Call
6740 Standard for all leaf functions.  (A leaf function is one that does
6741 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6742
6743 @item -mcallee-super-interworking
6744 @opindex mcallee-super-interworking
6745 Gives all externally visible functions in the file being compiled an ARM
6746 instruction set header which switches to Thumb mode before executing the
6747 rest of the function.  This allows these functions to be called from
6748 non-interworking code.
6749
6750 @item -mcaller-super-interworking
6751 @opindex mcaller-super-interworking
6752 Allows calls via function pointers (including virtual functions) to
6753 execute correctly regardless of whether the target code has been
6754 compiled for interworking or not.  There is a small overhead in the cost
6755 of executing a function pointer if this option is enabled.
6756
6757 @end table
6758
6759 @node MN10300 Options
6760 @subsection MN10300 Options
6761 @cindex MN10300 options
6762
6763 These @option{-m} options are defined for Matsushita MN10300 architectures:
6764
6765 @table @gcctabopt
6766 @item -mmult-bug
6767 @opindex mmult-bug
6768 Generate code to avoid bugs in the multiply instructions for the MN10300
6769 processors.  This is the default.
6770
6771 @item -mno-mult-bug
6772 @opindex mno-mult-bug
6773 Do not generate code to avoid bugs in the multiply instructions for the
6774 MN10300 processors.
6775
6776 @item -mam33
6777 @opindex mam33
6778 Generate code which uses features specific to the AM33 processor.
6779
6780 @item -mno-am33
6781 @opindex mno-am33
6782 Do not generate code which uses features specific to the AM33 processor.  This
6783 is the default.
6784
6785 @item -mno-crt0
6786 @opindex mno-crt0
6787 Do not link in the C run-time initialization object file.
6788
6789 @item -mrelax
6790 @opindex mrelax
6791 Indicate to the linker that it should perform a relaxation optimization pass
6792 to shorten branches, calls and absolute memory addresses.  This option only
6793 has an effect when used on the command line for the final link step.
6794
6795 This option makes symbolic debugging impossible.
6796 @end table
6797
6798
6799 @node M32R/D Options
6800 @subsection M32R/D Options
6801 @cindex M32R/D options
6802
6803 These @option{-m} options are defined for Renesas M32R/D architectures:
6804
6805 @table @gcctabopt
6806 @item -m32r2
6807 @opindex m32r2
6808 Generate code for the M32R/2@.
6809
6810 @item -m32rx
6811 @opindex m32rx
6812 Generate code for the M32R/X@.
6813
6814 @item -m32r
6815 @opindex m32r
6816 Generate code for the M32R@.  This is the default.
6817
6818 @item -mmodel=small
6819 @opindex mmodel=small
6820 Assume all objects live in the lower 16MB of memory (so that their addresses
6821 can be loaded with the @code{ld24} instruction), and assume all subroutines
6822 are reachable with the @code{bl} instruction.
6823 This is the default.
6824
6825 The addressability of a particular object can be set with the
6826 @code{model} attribute.
6827
6828 @item -mmodel=medium
6829 @opindex mmodel=medium
6830 Assume objects may be anywhere in the 32-bit address space (the compiler
6831 will generate @code{seth/add3} instructions to load their addresses), and
6832 assume all subroutines are reachable with the @code{bl} instruction.
6833
6834 @item -mmodel=large
6835 @opindex mmodel=large
6836 Assume objects may be anywhere in the 32-bit address space (the compiler
6837 will generate @code{seth/add3} instructions to load their addresses), and
6838 assume subroutines may not be reachable with the @code{bl} instruction
6839 (the compiler will generate the much slower @code{seth/add3/jl}
6840 instruction sequence).
6841
6842 @item -msdata=none
6843 @opindex msdata=none
6844 Disable use of the small data area.  Variables will be put into
6845 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6846 @code{section} attribute has been specified).
6847 This is the default.
6848
6849 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6850 Objects may be explicitly put in the small data area with the
6851 @code{section} attribute using one of these sections.
6852
6853 @item -msdata=sdata
6854 @opindex msdata=sdata
6855 Put small global and static data in the small data area, but do not
6856 generate special code to reference them.
6857
6858 @item -msdata=use
6859 @opindex msdata=use
6860 Put small global and static data in the small data area, and generate
6861 special instructions to reference them.
6862
6863 @item -G @var{num}
6864 @opindex G
6865 @cindex smaller data references
6866 Put global and static objects less than or equal to @var{num} bytes
6867 into the small data or bss sections instead of the normal data or bss
6868 sections.  The default value of @var{num} is 8.
6869 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6870 for this option to have any effect.
6871
6872 All modules should be compiled with the same @option{-G @var{num}} value.
6873 Compiling with different values of @var{num} may or may not work; if it
6874 doesn't the linker will give an error message---incorrect code will not be
6875 generated.
6876
6877 @item -mdebug
6878 @opindex -mdebug
6879 Makes the M32R specific code in the compiler display some statistics
6880 that might help in debugging programs.
6881
6882 @item -malign-loops
6883 @opindex malign-loops
6884 Align all loops to a 32-byte boundary.
6885
6886 @item -mno-align-loops
6887 @opindex mno-align-loops
6888 Do not enforce a 32-byte alignment for loops.  This is the default.
6889
6890 @item -missue-rate=@var{number}
6891 @opindex missue-rate=@var{number}
6892 Issue @var{number} instructions per cycle.  @var{number} can only be 1
6893 or 2.
6894
6895 @item -mbranch-cost=@var{number}
6896 @opindex mbranch-cost=@var{number}
6897 @var{number} can only be 1 or 2.  If it is 1 then branches will be
6898 preferred over conditional code, if it is 2, then the opposite will
6899 apply.
6900
6901 @item -mflush-trap=@var{number}
6902 @opindex mflush-trap=@var{number}
6903 Specifies the trap number to use to flush the cache.  The default is
6904 12.  Valid numbers are between 0 and 15 inclusive.
6905
6906 @item -mno-flush-trap
6907 @opindex mno-flush-trap
6908 Specifies that the cache cannot be flushed by using a trap.
6909
6910 @item -mflush-func=@var{name}
6911 @opindex mflush-func=@var{name}
6912 Specifies the name of the operating system function to call to flush
6913 the cache.  The default is @emph{_flush_cache}, but a function call
6914 will only be used if a trap is not available.
6915
6916 @item -mno-flush-func
6917 @opindex mno-flush-func
6918 Indicates that there is no OS function for flushing the cache.
6919
6920 @end table
6921
6922 @node RS/6000 and PowerPC Options
6923 @subsection IBM RS/6000 and PowerPC Options
6924 @cindex RS/6000 and PowerPC Options
6925 @cindex IBM RS/6000 and PowerPC Options
6926
6927 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6928 @table @gcctabopt
6929 @item -mpower
6930 @itemx -mno-power
6931 @itemx -mpower2
6932 @itemx -mno-power2
6933 @itemx -mpowerpc
6934 @itemx -mno-powerpc
6935 @itemx -mpowerpc-gpopt
6936 @itemx -mno-powerpc-gpopt
6937 @itemx -mpowerpc-gfxopt
6938 @itemx -mno-powerpc-gfxopt
6939 @itemx -mpowerpc64
6940 @itemx -mno-powerpc64
6941 @opindex mpower
6942 @opindex mno-power
6943 @opindex mpower2
6944 @opindex mno-power2
6945 @opindex mpowerpc
6946 @opindex mno-powerpc
6947 @opindex mpowerpc-gpopt
6948 @opindex mno-powerpc-gpopt
6949 @opindex mpowerpc-gfxopt
6950 @opindex mno-powerpc-gfxopt
6951 @opindex mpowerpc64
6952 @opindex mno-powerpc64
6953 GCC supports two related instruction set architectures for the
6954 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
6955 instructions supported by the @samp{rios} chip set used in the original
6956 RS/6000 systems and the @dfn{PowerPC} instruction set is the
6957 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
6958 the IBM 4xx microprocessors.
6959
6960 Neither architecture is a subset of the other.  However there is a
6961 large common subset of instructions supported by both.  An MQ
6962 register is included in processors supporting the POWER architecture.
6963
6964 You use these options to specify which instructions are available on the
6965 processor you are using.  The default value of these options is
6966 determined when configuring GCC@.  Specifying the
6967 @option{-mcpu=@var{cpu_type}} overrides the specification of these
6968 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
6969 rather than the options listed above.
6970
6971 The @option{-mpower} option allows GCC to generate instructions that
6972 are found only in the POWER architecture and to use the MQ register.
6973 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
6974 to generate instructions that are present in the POWER2 architecture but
6975 not the original POWER architecture.
6976
6977 The @option{-mpowerpc} option allows GCC to generate instructions that
6978 are found only in the 32-bit subset of the PowerPC architecture.
6979 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
6980 GCC to use the optional PowerPC architecture instructions in the
6981 General Purpose group, including floating-point square root.  Specifying
6982 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
6983 use the optional PowerPC architecture instructions in the Graphics
6984 group, including floating-point select.
6985
6986 The @option{-mpowerpc64} option allows GCC to generate the additional
6987 64-bit instructions that are found in the full PowerPC64 architecture
6988 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
6989 @option{-mno-powerpc64}.
6990
6991 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
6992 will use only the instructions in the common subset of both
6993 architectures plus some special AIX common-mode calls, and will not use
6994 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
6995 permits GCC to use any instruction from either architecture and to
6996 allow use of the MQ register; specify this for the Motorola MPC601.
6997
6998 @item -mnew-mnemonics
6999 @itemx -mold-mnemonics
7000 @opindex mnew-mnemonics
7001 @opindex mold-mnemonics
7002 Select which mnemonics to use in the generated assembler code.  With
7003 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
7004 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
7005 assembler mnemonics defined for the POWER architecture.  Instructions
7006 defined in only one architecture have only one mnemonic; GCC uses that
7007 mnemonic irrespective of which of these options is specified.
7008
7009 GCC defaults to the mnemonics appropriate for the architecture in
7010 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
7011 value of these option.  Unless you are building a cross-compiler, you
7012 should normally not specify either @option{-mnew-mnemonics} or
7013 @option{-mold-mnemonics}, but should instead accept the default.
7014
7015 @item -mcpu=@var{cpu_type}
7016 @opindex mcpu
7017 Set architecture type, register usage, choice of mnemonics, and
7018 instruction scheduling parameters for machine type @var{cpu_type}.
7019 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
7020 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
7021 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
7022 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
7023 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
7024 @samp{860}, @samp{970}, @samp{common}, @samp{ec603e}, @samp{G3},
7025 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
7026 @samp{power4}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
7027 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64a}.
7028
7029 @option{-mcpu=common} selects a completely generic processor.  Code
7030 generated under this option will run on any POWER or PowerPC processor.
7031 GCC will use only the instructions in the common subset of both
7032 architectures, and will not use the MQ register.  GCC assumes a generic
7033 processor model for scheduling purposes.
7034
7035 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
7036 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
7037 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
7038 types, with an appropriate, generic processor model assumed for
7039 scheduling purposes.
7040
7041 The other options specify a specific processor.  Code generated under
7042 those options will run best on that processor, and may not run at all on
7043 others.
7044
7045 The @option{-mcpu} options automatically enable or disable the
7046 following options: @option{-maltivec}, @option{-mhard-float},
7047 @option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
7048 @option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
7049 @option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
7050 @option{-mstring}.  The particular options set for any particular CPU
7051 will vary between compiler versions, depending on what setting seems
7052 to produce optimal code for that CPU; it doesn't necessarily reflect
7053 the actual hardware's capabilities.  If you wish to set an individual
7054 option to a particular value, you may specify it after the
7055 @option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
7056
7057 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
7058 not enabled or disabled by the @option{-mcpu} option at present, since
7059 AIX does not have full support for these options.  You may still
7060 enable or disable them individually if you're sure it'll work in your
7061 environment.
7062
7063 @item -mtune=@var{cpu_type}
7064 @opindex mtune
7065 Set the instruction scheduling parameters for machine type
7066 @var{cpu_type}, but do not set the architecture type, register usage, or
7067 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
7068 values for @var{cpu_type} are used for @option{-mtune} as for
7069 @option{-mcpu}.  If both are specified, the code generated will use the
7070 architecture, registers, and mnemonics set by @option{-mcpu}, but the
7071 scheduling parameters set by @option{-mtune}.
7072
7073 @item -maltivec
7074 @itemx -mno-altivec
7075 @opindex maltivec
7076 @opindex mno-altivec
7077 These switches enable or disable the use of built-in functions that
7078 allow access to the AltiVec instruction set.  You may also need to set
7079 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
7080 enhancements.
7081
7082 @item -mabi=spe
7083 @opindex mabi=spe
7084 Extend the current ABI with SPE ABI extensions.  This does not change
7085 the default ABI, instead it adds the SPE ABI extensions to the current
7086 ABI@.
7087
7088 @item -mabi=no-spe
7089 @opindex mabi=no-spe
7090 Disable Booke SPE ABI extensions for the current ABI.
7091
7092 @item -misel=@var{yes/no}
7093 @itemx -misel
7094 @opindex misel
7095 This switch enables or disables the generation of ISEL instructions.
7096
7097 @item -mspe=@var{yes/no}
7098 @itemx -mspe
7099 @opindex mspe
7100 This switch enables or disables the generation of SPE simd
7101 instructions.
7102
7103 @item -mfloat-gprs=@var{yes/no}
7104 @itemx -mfloat-gprs
7105 @opindex mfloat-gprs
7106 This switch enables or disables the generation of floating point
7107 operations on the general purpose registers for architectures that
7108 support it.  This option is currently only available on the MPC8540.
7109
7110 @item -mfull-toc
7111 @itemx -mno-fp-in-toc
7112 @itemx -mno-sum-in-toc
7113 @itemx -mminimal-toc
7114 @opindex mfull-toc
7115 @opindex mno-fp-in-toc
7116 @opindex mno-sum-in-toc
7117 @opindex mminimal-toc
7118 Modify generation of the TOC (Table Of Contents), which is created for
7119 every executable file.  The @option{-mfull-toc} option is selected by
7120 default.  In that case, GCC will allocate at least one TOC entry for
7121 each unique non-automatic variable reference in your program.  GCC
7122 will also place floating-point constants in the TOC@.  However, only
7123 16,384 entries are available in the TOC@.
7124
7125 If you receive a linker error message that saying you have overflowed
7126 the available TOC space, you can reduce the amount of TOC space used
7127 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
7128 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
7129 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
7130 generate code to calculate the sum of an address and a constant at
7131 run-time instead of putting that sum into the TOC@.  You may specify one
7132 or both of these options.  Each causes GCC to produce very slightly
7133 slower and larger code at the expense of conserving TOC space.
7134
7135 If you still run out of space in the TOC even when you specify both of
7136 these options, specify @option{-mminimal-toc} instead.  This option causes
7137 GCC to make only one TOC entry for every file.  When you specify this
7138 option, GCC will produce code that is slower and larger but which
7139 uses extremely little TOC space.  You may wish to use this option
7140 only on files that contain less frequently executed code.
7141
7142 @item -maix64
7143 @itemx -maix32
7144 @opindex maix64
7145 @opindex maix32
7146 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7147 @code{long} type, and the infrastructure needed to support them.
7148 Specifying @option{-maix64} implies @option{-mpowerpc64} and
7149 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
7150 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
7151
7152 @item -mxl-call
7153 @itemx -mno-xl-call
7154 @opindex mxl-call
7155 @opindex mno-xl-call
7156 On AIX, pass floating-point arguments to prototyped functions beyond the
7157 register save area (RSA) on the stack in addition to argument FPRs.  The
7158 AIX calling convention was extended but not initially documented to
7159 handle an obscure K&R C case of calling a function that takes the
7160 address of its arguments with fewer arguments than declared.  AIX XL
7161 compilers access floating point arguments which do not fit in the
7162 RSA from the stack when a subroutine is compiled without
7163 optimization.  Because always storing floating-point arguments on the
7164 stack is inefficient and rarely needed, this option is not enabled by
7165 default and only is necessary when calling subroutines compiled by AIX
7166 XL compilers without optimization.
7167
7168 @item -mpe
7169 @opindex mpe
7170 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
7171 application written to use message passing with special startup code to
7172 enable the application to run.  The system must have PE installed in the
7173 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
7174 must be overridden with the @option{-specs=} option to specify the
7175 appropriate directory location.  The Parallel Environment does not
7176 support threads, so the @option{-mpe} option and the @option{-pthread}
7177 option are incompatible.
7178
7179 @item -malign-natural
7180 @itemx -malign-power
7181 @opindex malign-natural
7182 @opindex malign-power
7183 On AIX, Darwin, and 64-bit PowerPC GNU/Linux, the option
7184 @option{-malign-natural} overrides the ABI-defined alignment of larger
7185 types, such as floating-point doubles, on their natural size-based boundary.
7186 The option @option{-malign-power} instructs GCC to follow the ABI-specified
7187 alignment rules.  GCC defaults to the standard alignment defined in the ABI.
7188
7189 @item -msoft-float
7190 @itemx -mhard-float
7191 @opindex msoft-float
7192 @opindex mhard-float
7193 Generate code that does not use (uses) the floating-point register set.
7194 Software floating point emulation is provided if you use the
7195 @option{-msoft-float} option, and pass the option to GCC when linking.
7196
7197 @item -mmultiple
7198 @itemx -mno-multiple
7199 @opindex mmultiple
7200 @opindex mno-multiple
7201 Generate code that uses (does not use) the load multiple word
7202 instructions and the store multiple word instructions.  These
7203 instructions are generated by default on POWER systems, and not
7204 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
7205 endian PowerPC systems, since those instructions do not work when the
7206 processor is in little endian mode.  The exceptions are PPC740 and
7207 PPC750 which permit the instructions usage in little endian mode.
7208
7209 @item -mstring
7210 @itemx -mno-string
7211 @opindex mstring
7212 @opindex mno-string
7213 Generate code that uses (does not use) the load string instructions
7214 and the store string word instructions to save multiple registers and
7215 do small block moves.  These instructions are generated by default on
7216 POWER systems, and not generated on PowerPC systems.  Do not use
7217 @option{-mstring} on little endian PowerPC systems, since those
7218 instructions do not work when the processor is in little endian mode.
7219 The exceptions are PPC740 and PPC750 which permit the instructions
7220 usage in little endian mode.
7221
7222 @item -mupdate
7223 @itemx -mno-update
7224 @opindex mupdate
7225 @opindex mno-update
7226 Generate code that uses (does not use) the load or store instructions
7227 that update the base register to the address of the calculated memory
7228 location.  These instructions are generated by default.  If you use
7229 @option{-mno-update}, there is a small window between the time that the
7230 stack pointer is updated and the address of the previous frame is
7231 stored, which means code that walks the stack frame across interrupts or
7232 signals may get corrupted data.
7233
7234 @item -mfused-madd
7235 @itemx -mno-fused-madd
7236 @opindex mfused-madd
7237 @opindex mno-fused-madd
7238 Generate code that uses (does not use) the floating point multiply and
7239 accumulate instructions.  These instructions are generated by default if
7240 hardware floating is used.
7241
7242 @item -mno-bit-align
7243 @itemx -mbit-align
7244 @opindex mno-bit-align
7245 @opindex mbit-align
7246 On System V.4 and embedded PowerPC systems do not (do) force structures
7247 and unions that contain bit-fields to be aligned to the base type of the
7248 bit-field.
7249
7250 For example, by default a structure containing nothing but 8
7251 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
7252 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
7253 the structure would be aligned to a 1 byte boundary and be one byte in
7254 size.
7255
7256 @item -mno-strict-align
7257 @itemx -mstrict-align
7258 @opindex mno-strict-align
7259 @opindex mstrict-align
7260 On System V.4 and embedded PowerPC systems do not (do) assume that
7261 unaligned memory references will be handled by the system.
7262
7263 @item -mrelocatable
7264 @itemx -mno-relocatable
7265 @opindex mrelocatable
7266 @opindex mno-relocatable
7267 On embedded PowerPC systems generate code that allows (does not allow)
7268 the program to be relocated to a different address at runtime.  If you
7269 use @option{-mrelocatable} on any module, all objects linked together must
7270 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
7271
7272 @item -mrelocatable-lib
7273 @itemx -mno-relocatable-lib
7274 @opindex mrelocatable-lib
7275 @opindex mno-relocatable-lib
7276 On embedded PowerPC systems generate code that allows (does not allow)
7277 the program to be relocated to a different address at runtime.  Modules
7278 compiled with @option{-mrelocatable-lib} can be linked with either modules
7279 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
7280 with modules compiled with the @option{-mrelocatable} options.
7281
7282 @item -mno-toc
7283 @itemx -mtoc
7284 @opindex mno-toc
7285 @opindex mtoc
7286 On System V.4 and embedded PowerPC systems do not (do) assume that
7287 register 2 contains a pointer to a global area pointing to the addresses
7288 used in the program.
7289
7290 @item -mlittle
7291 @itemx -mlittle-endian
7292 @opindex mlittle
7293 @opindex mlittle-endian
7294 On System V.4 and embedded PowerPC systems compile code for the
7295 processor in little endian mode.  The @option{-mlittle-endian} option is
7296 the same as @option{-mlittle}.
7297
7298 @item -mbig
7299 @itemx -mbig-endian
7300 @opindex mbig
7301 @opindex mbig-endian
7302 On System V.4 and embedded PowerPC systems compile code for the
7303 processor in big endian mode.  The @option{-mbig-endian} option is
7304 the same as @option{-mbig}.
7305
7306 @item -mdynamic-no-pic
7307 @opindex mdynamic-no-pic
7308 On Darwin and Mac OS X systems, compile code so that it is not
7309 relocatable, but that its external references are relocatable.  The
7310 resulting code is suitable for applications, but not shared
7311 libraries.
7312
7313 @item -mprioritize-restricted-insns=@var{priority}
7314 @opindex mprioritize-restricted-insns
7315 This option controls the priority that is assigned to
7316 dispatch-slot restricted instructions during the second scheduling
7317 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
7318 @var{no/highest/second-highest} priority to dispatch slot restricted
7319 instructions.
7320
7321 @item -msched-costly-dep=@var{dependence_type}
7322 @opindex msched-costly-dep
7323 This option controls which dependences are considered costly
7324 by the target during instruction scheduling.  The argument
7325 @var{dependence_type} takes one of the following values:
7326 @var{no}: no dependence is costly,
7327 @var{all}: all dependences are costly,
7328 @var{true_store_to_load}: a true dependence from store to load is costly,
7329 @var{store_to_load}: any dependence from store to load is costly,
7330 @var{number}: any dependence which latency >= @var{number} is costly.
7331
7332 @item -minsert-sched-nops=@var{scheme}
7333 @opindex minsert-sched-nops
7334 This option controls which nop insertion scheme will be used during
7335 the second scheduling pass. The argument @var{scheme} takes one of the
7336 following values:
7337 @var{no}: Don't insert nops.
7338 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
7339 according to the scheduler's grouping.
7340 @var{regroup_exact}: Insert nops to force costly dependent insns into
7341 separate groups.  Insert exactly as many nops as needed to force an insn
7342 to a new group, according to the estimated processor grouping.
7343 @var{number}: Insert nops to force costly dependent insns into
7344 separate groups.  Insert @var{number} nops to force an insn to a new group.
7345
7346 @item -mcall-sysv
7347 @opindex mcall-sysv
7348 On System V.4 and embedded PowerPC systems compile code using calling
7349 conventions that adheres to the March 1995 draft of the System V
7350 Application Binary Interface, PowerPC processor supplement.  This is the
7351 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
7352
7353 @item -mcall-sysv-eabi
7354 @opindex mcall-sysv-eabi
7355 Specify both @option{-mcall-sysv} and @option{-meabi} options.
7356
7357 @item -mcall-sysv-noeabi
7358 @opindex mcall-sysv-noeabi
7359 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
7360
7361 @item -mcall-solaris
7362 @opindex mcall-solaris
7363 On System V.4 and embedded PowerPC systems compile code for the Solaris
7364 operating system.
7365
7366 @item -mcall-linux
7367 @opindex mcall-linux
7368 On System V.4 and embedded PowerPC systems compile code for the
7369 Linux-based GNU system.
7370
7371 @item -mcall-gnu
7372 @opindex mcall-gnu
7373 On System V.4 and embedded PowerPC systems compile code for the
7374 Hurd-based GNU system.
7375
7376 @item -mcall-netbsd
7377 @opindex mcall-netbsd
7378 On System V.4 and embedded PowerPC systems compile code for the
7379 NetBSD operating system.
7380
7381 @item -maix-struct-return
7382 @opindex maix-struct-return
7383 Return all structures in memory (as specified by the AIX ABI)@.
7384
7385 @item -msvr4-struct-return
7386 @opindex msvr4-struct-return
7387 Return structures smaller than 8 bytes in registers (as specified by the
7388 SVR4 ABI)@.
7389
7390 @item -mabi=altivec
7391 @opindex mabi=altivec
7392 Extend the current ABI with AltiVec ABI extensions.  This does not
7393 change the default ABI, instead it adds the AltiVec ABI extensions to
7394 the current ABI@.
7395
7396 @item -mabi=no-altivec
7397 @opindex mabi=no-altivec
7398 Disable AltiVec ABI extensions for the current ABI.
7399
7400 @item -mprototype
7401 @itemx -mno-prototype
7402 @opindex mprototype
7403 @opindex mno-prototype
7404 On System V.4 and embedded PowerPC systems assume that all calls to
7405 variable argument functions are properly prototyped.  Otherwise, the
7406 compiler must insert an instruction before every non prototyped call to
7407 set or clear bit 6 of the condition code register (@var{CR}) to
7408 indicate whether floating point values were passed in the floating point
7409 registers in case the function takes a variable arguments.  With
7410 @option{-mprototype}, only calls to prototyped variable argument functions
7411 will set or clear the bit.
7412
7413 @item -msim
7414 @opindex msim
7415 On embedded PowerPC systems, assume that the startup module is called
7416 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7417 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7418 configurations.
7419
7420 @item -mmvme
7421 @opindex mmvme
7422 On embedded PowerPC systems, assume that the startup module is called
7423 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7424 @file{libc.a}.
7425
7426 @item -mads
7427 @opindex mads
7428 On embedded PowerPC systems, assume that the startup module is called
7429 @file{crt0.o} and the standard C libraries are @file{libads.a} and
7430 @file{libc.a}.
7431
7432 @item -myellowknife
7433 @opindex myellowknife
7434 On embedded PowerPC systems, assume that the startup module is called
7435 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
7436 @file{libc.a}.
7437
7438 @item -mvxworks
7439 @opindex mvxworks
7440 On System V.4 and embedded PowerPC systems, specify that you are
7441 compiling for a VxWorks system.
7442
7443 @item -mwindiss
7444 @opindex mwindiss
7445 Specify that you are compiling for the WindISS simulation environment.
7446
7447 @item -memb
7448 @opindex memb
7449 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7450 header to indicate that @samp{eabi} extended relocations are used.
7451
7452 @item -meabi
7453 @itemx -mno-eabi
7454 @opindex meabi
7455 @opindex mno-eabi
7456 On System V.4 and embedded PowerPC systems do (do not) adhere to the
7457 Embedded Applications Binary Interface (eabi) which is a set of
7458 modifications to the System V.4 specifications.  Selecting @option{-meabi}
7459 means that the stack is aligned to an 8 byte boundary, a function
7460 @code{__eabi} is called to from @code{main} to set up the eabi
7461 environment, and the @option{-msdata} option can use both @code{r2} and
7462 @code{r13} to point to two separate small data areas.  Selecting
7463 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7464 do not call an initialization function from @code{main}, and the
7465 @option{-msdata} option will only use @code{r13} to point to a single
7466 small data area.  The @option{-meabi} option is on by default if you
7467 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7468
7469 @item -msdata=eabi
7470 @opindex msdata=eabi
7471 On System V.4 and embedded PowerPC systems, put small initialized
7472 @code{const} global and static data in the @samp{.sdata2} section, which
7473 is pointed to by register @code{r2}.  Put small initialized
7474 non-@code{const} global and static data in the @samp{.sdata} section,
7475 which is pointed to by register @code{r13}.  Put small uninitialized
7476 global and static data in the @samp{.sbss} section, which is adjacent to
7477 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7478 incompatible with the @option{-mrelocatable} option.  The
7479 @option{-msdata=eabi} option also sets the @option{-memb} option.
7480
7481 @item -msdata=sysv
7482 @opindex msdata=sysv
7483 On System V.4 and embedded PowerPC systems, put small global and static
7484 data in the @samp{.sdata} section, which is pointed to by register
7485 @code{r13}.  Put small uninitialized global and static data in the
7486 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7487 The @option{-msdata=sysv} option is incompatible with the
7488 @option{-mrelocatable} option.
7489
7490 @item -msdata=default
7491 @itemx -msdata
7492 @opindex msdata=default
7493 @opindex msdata
7494 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7495 compile code the same as @option{-msdata=eabi}, otherwise compile code the
7496 same as @option{-msdata=sysv}.
7497
7498 @item -msdata-data
7499 @opindex msdata-data
7500 On System V.4 and embedded PowerPC systems, put small global and static
7501 data in the @samp{.sdata} section.  Put small uninitialized global and
7502 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7503 to address small data however.  This is the default behavior unless
7504 other @option{-msdata} options are used.
7505
7506 @item -msdata=none
7507 @itemx -mno-sdata
7508 @opindex msdata=none
7509 @opindex mno-sdata
7510 On embedded PowerPC systems, put all initialized global and static data
7511 in the @samp{.data} section, and all uninitialized data in the
7512 @samp{.bss} section.
7513
7514 @item -G @var{num}
7515 @opindex G
7516 @cindex smaller data references (PowerPC)
7517 @cindex .sdata/.sdata2 references (PowerPC)
7518 On embedded PowerPC systems, put global and static items less than or
7519 equal to @var{num} bytes into the small data or bss sections instead of
7520 the normal data or bss section.  By default, @var{num} is 8.  The
7521 @option{-G @var{num}} switch is also passed to the linker.
7522 All modules should be compiled with the same @option{-G @var{num}} value.
7523
7524 @item -mregnames
7525 @itemx -mno-regnames
7526 @opindex mregnames
7527 @opindex mno-regnames
7528 On System V.4 and embedded PowerPC systems do (do not) emit register
7529 names in the assembly language output using symbolic forms.
7530
7531 @item -mlongcall
7532 @itemx -mno-longcall
7533 @opindex mlongcall
7534 @opindex mno-longcall
7535 Default to making all function calls via pointers, so that functions
7536 which reside further than 64 megabytes (67,108,864 bytes) from the
7537 current location can be called.  This setting can be overridden by the
7538 @code{shortcall} function attribute, or by @code{#pragma longcall(0)}.
7539
7540 Some linkers are capable of detecting out-of-range calls and generating
7541 glue code on the fly.  On these systems, long calls are unnecessary and
7542 generate slower code.  As of this writing, the AIX linker can do this,
7543 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7544 to the GNU linker for 32-bit PowerPC systems as well.
7545
7546 On Mach-O (Darwin) systems, this option directs the compiler emit to
7547 the glue for every direct call, and the Darwin linker decides whether
7548 to use or discard it.
7549
7550 In the future, we may cause GCC to ignore all longcall specifications
7551 when the linker is known to generate glue.
7552
7553 @item -pthread
7554 @opindex pthread
7555 Adds support for multithreading with the @dfn{pthreads} library.
7556 This option sets flags for both the preprocessor and linker.
7557
7558 @end table
7559
7560 @node Darwin Options
7561 @subsection Darwin Options
7562 @cindex Darwin options
7563
7564 These options are defined for all architectures running the Darwin operating
7565 system.  They are useful for compatibility with other Mac OS compilers.
7566
7567 @table @gcctabopt
7568 @item -all_load
7569 @opindex all_load
7570 Loads all members of static archive libraries.
7571 See man ld(1) for more information.
7572
7573 @item -arch_errors_fatal
7574 @opindex arch_errors_fatal
7575 Cause the errors having to do with files that have the wrong architecture
7576 to be fatal.
7577
7578 @item -bind_at_load
7579 @opindex bind_at_load
7580 Causes the output file to be marked such that the dynamic linker will
7581 bind all undefined references when the file is loaded or launched.
7582
7583 @item -bundle
7584 @opindex bundle
7585 Produce a Mach-o bundle format file.
7586 See man ld(1) for more information.
7587
7588 @item -bundle_loader @var{executable}
7589 @opindex bundle_loader
7590 This specifies the @var{executable} that will be loading the build
7591 output file being linked. See man ld(1) for more information.
7592
7593 @item -mmacosx=@var{ver}
7594 @opindex mmacosx
7595 This specifies the earliest version of Mac OS for which code should
7596 be generated.  Specifying @code{-mmacosx=10.2}, for example, allows
7597 the compiler to use features that were first made available in that
7598 version of the operating system.
7599
7600 @item -allowable_client  @var{client_name}
7601 @itemx -arch_only
7602
7603 @itemx -client_name
7604 @itemx -compatibility_version
7605 @itemx -current_version
7606 @itemx -dependency-file
7607 @itemx -dylib_file
7608 @itemx -dylinker_install_name
7609 @itemx -dynamic
7610 @itemx -dynamiclib
7611 @itemx -exported_symbols_list
7612 @itemx -filelist
7613 @itemx -flat_namespace
7614 @itemx -force_cpusubtype_ALL
7615 @itemx -force_flat_namespace
7616 @itemx -headerpad_max_install_names
7617 @itemx -image_base
7618 @itemx -init
7619 @itemx -install_name
7620 @itemx -keep_private_externs
7621 @itemx -multi_module
7622 @itemx -multiply_defined
7623 @itemx -multiply_defined_unused
7624 @itemx -noall_load
7625 @itemx -nofixprebinding
7626 @itemx -nomultidefs
7627 @itemx -noprebind
7628 @itemx -noseglinkedit
7629 @itemx -pagezero_size
7630 @itemx -prebind
7631 @itemx -prebind_all_twolevel_modules
7632 @itemx -private_bundle
7633 @itemx -read_only_relocs
7634 @itemx -sectalign
7635 @itemx -sectobjectsymbols
7636 @itemx -whyload
7637 @itemx -seg1addr
7638 @itemx -sectcreate
7639 @itemx -sectobjectsymbols
7640 @itemx -sectorder
7641 @itemx -seg_addr_table
7642 @itemx -seg_addr_table_filename
7643 @itemx -seglinkedit
7644 @itemx -segprot
7645 @itemx -segs_read_only_addr
7646 @itemx -segs_read_write_addr
7647 @itemx -single_module
7648 @itemx -static
7649 @itemx -sub_library
7650 @itemx -sub_umbrella
7651 @itemx -twolevel_namespace
7652 @itemx -umbrella
7653 @itemx -undefined
7654 @itemx -unexported_symbols_list
7655 @itemx -weak_reference_mismatches
7656 @itemx -whatsloaded
7657
7658 @opindex allowable_client
7659 @opindex arch_only
7660 @opindex client_name
7661 @opindex compatibility_version
7662 @opindex current_version
7663 @opindex dependency-file
7664 @opindex dylib_file
7665 @opindex dylinker_install_name
7666 @opindex dynamic
7667 @opindex dynamiclib
7668 @opindex exported_symbols_list
7669 @opindex filelist
7670 @opindex flat_namespace
7671 @opindex force_cpusubtype_ALL
7672 @opindex force_flat_namespace
7673 @opindex headerpad_max_install_names
7674 @opindex image_base
7675 @opindex init
7676 @opindex install_name
7677 @opindex keep_private_externs
7678 @opindex multi_module
7679 @opindex multiply_defined
7680 @opindex multiply_defined_unused
7681 @opindex noall_load
7682 @opindex nofixprebinding
7683 @opindex nomultidefs
7684 @opindex noprebind
7685 @opindex noseglinkedit
7686 @opindex pagezero_size
7687 @opindex prebind
7688 @opindex prebind_all_twolevel_modules
7689 @opindex private_bundle
7690 @opindex read_only_relocs
7691 @opindex sectalign
7692 @opindex sectobjectsymbols
7693 @opindex whyload
7694 @opindex seg1addr
7695 @opindex sectcreate
7696 @opindex sectobjectsymbols
7697 @opindex sectorder
7698 @opindex seg_addr_table
7699 @opindex seg_addr_table_filename
7700 @opindex seglinkedit
7701 @opindex segprot
7702 @opindex segs_read_only_addr
7703 @opindex segs_read_write_addr
7704 @opindex single_module
7705 @opindex static
7706 @opindex sub_library
7707 @opindex sub_umbrella
7708 @opindex twolevel_namespace
7709 @opindex umbrella
7710 @opindex undefined
7711 @opindex unexported_symbols_list
7712 @opindex weak_reference_mismatches
7713 @opindex whatsloaded
7714
7715 These options are available for Darwin linker. Darwin linker man page
7716 describes them in detail.
7717 @end table
7718
7719
7720 @node MIPS Options
7721 @subsection MIPS Options
7722 @cindex MIPS options
7723
7724 @table @gcctabopt
7725
7726 @item -EB
7727 @opindex EB
7728 Generate big-endian code.
7729
7730 @item -EL
7731 @opindex EL
7732 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
7733 configurations.
7734
7735 @item -march=@var{arch}
7736 @opindex march
7737 Generate code that will run on @var{arch}, which can be the name of a
7738 generic MIPS ISA, or the name of a particular processor.
7739 The ISA names are:
7740 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
7741 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
7742 The processor names are:
7743 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7744 @samp{m4k},
7745 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
7746 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
7747 @samp{rm9000},
7748 @samp{orion},
7749 @samp{sb1},
7750 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4300},
7751 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
7752 The special value @samp{from-abi} selects the
7753 most compatible architecture for the selected ABI (that is,
7754 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7755
7756 In processor names, a final @samp{000} can be abbreviated as @samp{k}
7757 (for example, @samp{-march=r2k}).  Prefixes are optional, and
7758 @samp{vr} may be written @samp{r}.
7759
7760 GCC defines two macros based on the value of this option.  The first
7761 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7762 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7763 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
7764 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7765 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7766
7767 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7768 above.  In other words, it will have the full prefix and will not
7769 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7770 the macro names the resolved architecture (either @samp{"mips1"} or
7771 @samp{"mips3"}).  It names the default architecture when no
7772 @option{-march} option is given.
7773
7774 @item -mtune=@var{arch}
7775 @opindex mtune
7776 Optimize for @var{arch}.  Among other things, this option controls
7777 the way instructions are scheduled, and the perceived cost of arithmetic
7778 operations.  The list of @var{arch} values is the same as for
7779 @option{-march}.
7780
7781 When this option is not used, GCC will optimize for the processor
7782 specified by @option{-march}.  By using @option{-march} and
7783 @option{-mtune} together, it is possible to generate code that will
7784 run on a family of processors, but optimize the code for one
7785 particular member of that family.
7786
7787 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
7788 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
7789 @samp{-march} ones described above.
7790
7791 @item -mips1
7792 @opindex mips1
7793 Equivalent to @samp{-march=mips1}.
7794
7795 @item -mips2
7796 @opindex mips2
7797 Equivalent to @samp{-march=mips2}.
7798
7799 @item -mips3
7800 @opindex mips3
7801 Equivalent to @samp{-march=mips3}.
7802
7803 @item -mips4
7804 @opindex mips4
7805 Equivalent to @samp{-march=mips4}.
7806
7807 @item -mips32
7808 @opindex mips32
7809 Equivalent to @samp{-march=mips32}.
7810
7811 @item -mips32r2
7812 @opindex mips32r2
7813 Equivalent to @samp{-march=mips32r2}.
7814
7815 @item -mips64
7816 @opindex mips64
7817 Equivalent to @samp{-march=mips64}.
7818
7819 @item -mips16
7820 @itemx -mno-mips16
7821 @opindex mips16
7822 @opindex mno-mips16
7823 Use (do not use) the MIPS16 ISA.
7824
7825 @item -mabi=32
7826 @itemx -mabi=o64
7827 @itemx -mabi=n32
7828 @itemx -mabi=64
7829 @itemx -mabi=eabi
7830 @opindex mabi=32
7831 @opindex mabi=o64
7832 @opindex mabi=n32
7833 @opindex mabi=64
7834 @opindex mabi=eabi
7835 Generate code for the given ABI@.
7836
7837 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
7838 generates 64-bit code when you select a 64-bit architecture, but you
7839 can use @option{-mgp32} to get 32-bit code instead.
7840
7841 @item -mabicalls
7842 @itemx -mno-abicalls
7843 @opindex mabicalls
7844 @opindex mno-abicalls
7845 Generate (do not generate) SVR4-style position-independent code.
7846 @option{-mabicalls} is the default for SVR4-based systems.
7847
7848 @item -mxgot
7849 @itemx -mno-xgot
7850 @opindex mxgot
7851 @opindex mno-xgot
7852 Lift (do not lift) the usual restrictions on the size of the global
7853 offset table.
7854
7855 GCC normally uses a single instruction to load values from the GOT.
7856 While this is relatively efficient, it will only work if the GOT
7857 is smaller than about 64k.  Anything larger will cause the linker
7858 to report an error such as:
7859
7860 @cindex relocation truncated to fit (MIPS)
7861 @smallexample
7862 relocation truncated to fit: R_MIPS_GOT16 foobar
7863 @end smallexample
7864
7865 If this happens, you should recompile your code with @option{-mxgot}.
7866 It should then work with very large GOTs, although it will also be
7867 less efficient, since it will take three instructions to fetch the
7868 value of a global symbol.
7869
7870 Note that some linkers can create multiple GOTs.  If you have such a
7871 linker, you should only need to use @option{-mxgot} when a single object
7872 file accesses more than 64k's worth of GOT entries.  Very few do.
7873
7874 These options have no effect unless GCC is generating position
7875 independent code.
7876
7877 @item -membedded-pic
7878 @itemx -mno-embedded-pic
7879 @opindex membedded-pic
7880 @opindex mno-embedded-pic
7881 Generate (do not generate) position-independent code suitable for some
7882 embedded systems.  All calls are made using PC relative addresses, and
7883 all data is addressed using the $gp register.  No more than 65536
7884 bytes of global data may be used.  This requires GNU as and GNU ld,
7885 which do most of the work.
7886
7887 @item -mgp32
7888 @opindex mgp32
7889 Assume that general-purpose registers are 32 bits wide.
7890
7891 @item -mgp64
7892 @opindex mgp64
7893 Assume that general-purpose registers are 64 bits wide.
7894
7895 @item -mfp32
7896 @opindex mfp32
7897 Assume that floating-point registers are 32 bits wide.
7898
7899 @item -mfp64
7900 @opindex mfp64
7901 Assume that floating-point registers are 64 bits wide.
7902
7903 @item -mhard-float
7904 @opindex mhard-float
7905 Use floating-point coprocessor instructions.
7906
7907 @item -msoft-float
7908 @opindex msoft-float
7909 Do not use floating-point coprocessor instructions.  Implement
7910 floating-point calculations using library calls instead.
7911
7912 @item -msingle-float
7913 @opindex msingle-float
7914 Assume that the floating-point coprocessor only supports single-precision
7915 operations.
7916
7917 @itemx -mdouble-float
7918 @opindex mdouble-float
7919 Assume that the floating-point coprocessor supports double-precision
7920 operations.  This is the default.
7921
7922 @item -mint64
7923 @opindex mint64
7924 Force @code{int} and @code{long} types to be 64 bits wide.  See
7925 @option{-mlong32} for an explanation of the default and the way
7926 that the pointer size is determined.
7927
7928 @item -mlong64
7929 @opindex mlong64
7930 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
7931 an explanation of the default and the way that the pointer size is
7932 determined.
7933
7934 @item -mlong32
7935 @opindex mlong32
7936 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
7937
7938 The default size of @code{int}s, @code{long}s and pointers depends on
7939 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
7940 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
7941 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
7942 or the same size as integer registers, whichever is smaller.
7943
7944 @item -G @var{num}
7945 @opindex G
7946 @cindex smaller data references (MIPS)
7947 @cindex gp-relative references (MIPS)
7948 Put global and static items less than or equal to @var{num} bytes into
7949 the small data or bss section instead of the normal data or bss section.
7950 This allows the data to be accessed using a single instruction.
7951
7952 All modules should be compiled with the same @option{-G @var{num}}
7953 value.
7954
7955 @item -membedded-data
7956 @itemx -mno-embedded-data
7957 @opindex membedded-data
7958 @opindex mno-embedded-data
7959 Allocate variables to the read-only data section first if possible, then
7960 next in the small data section if possible, otherwise in data.  This gives
7961 slightly slower code than the default, but reduces the amount of RAM required
7962 when executing, and thus may be preferred for some embedded systems.
7963
7964 @item -muninit-const-in-rodata
7965 @itemx -mno-uninit-const-in-rodata
7966 @opindex muninit-const-in-rodata
7967 @opindex mno-uninit-const-in-rodata
7968 Put uninitialized @code{const} variables in the read-only data section.
7969 This option is only meaningful in conjunction with @option{-membedded-data}.
7970
7971 @item -msplit-addresses
7972 @itemx -mno-split-addresses
7973 @opindex msplit-addresses
7974 @opindex mno-split-addresses
7975 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
7976 relocation operators.  This option has been superceded by
7977 @option{-mexplicit-relocs} but is retained for backwards compatibility.
7978
7979 @item -mexplicit-relocs
7980 @itemx -mno-explicit-relocs
7981 @opindex mexplicit-relocs
7982 @opindex mno-explicit-relocs
7983 Use (do not use) assembler relocation operators when dealing with symbolic
7984 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
7985 is to use assembler macros instead.
7986
7987 @option{-mexplicit-relocs} is usually the default if GCC was
7988 configured to use an assembler that supports relocation operators.
7989 However, there are two exceptions:
7990
7991 @itemize @bullet
7992 @item
7993 GCC is not yet able to generate explicit relocations for the combination
7994 of @option{-mabi=64} and @option{-mno-abicalls}.  This will be addressed
7995 in a future release.
7996
7997 @item
7998 The combination of @option{-mabicalls} and @option{-fno-unit-at-a-time}
7999 implies @option{-mno-explicit-relocs} unless explicitly overridden.
8000 This is because, when generating abicalls, the choice of relocation
8001 depends on whether a symbol is local or global.  In some rare cases,
8002 GCC will not be able to decide this until the whole compilation unit
8003 has been read.
8004 @end itemize
8005
8006 @item -mrnames
8007 @itemx -mno-rnames
8008 @opindex mrnames
8009 @opindex mno-rnames
8010 Generate (do not generate) code that refers to registers using their
8011 software names.  The default is @option{-mno-rnames}, which tells GCC
8012 to use hardware names like @samp{$4} instead of software names like
8013 @samp{a0}.  The only assembler known to support @option{-rnames} is
8014 the Algorithmics assembler.
8015
8016 @item -mcheck-zero-division
8017 @itemx -mno-check-zero-division
8018 @opindex mcheck-zero-division
8019 @opindex mno-check-zero-division
8020 Trap (do not trap) on integer division by zero.  The default is
8021 @option{-mcheck-zero-division}.
8022
8023 @item -mmemcpy
8024 @itemx -mno-memcpy
8025 @opindex mmemcpy
8026 @opindex mno-memcpy
8027 Force (do not force) the use of @code{memcpy()} for non-trivial block
8028 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
8029 most constant-sized copies.
8030
8031 @item -mlong-calls
8032 @itemx -mno-long-calls
8033 @opindex mlong-calls
8034 @opindex mno-long-calls
8035 Disable (do not disable) use of the @code{jal} instruction.  Calling
8036 functions using @code{jal} is more efficient but requires the caller
8037 and callee to be in the same 256 megabyte segment.
8038
8039 This option has no effect on abicalls code.  The default is
8040 @option{-mno-long-calls}.
8041
8042 @item -mmad
8043 @itemx -mno-mad
8044 @opindex mmad
8045 @opindex mno-mad
8046 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
8047 instructions, as provided by the R4650 ISA.
8048
8049 @item -mfused-madd
8050 @itemx -mno-fused-madd
8051 @opindex mfused-madd
8052 @opindex mno-fused-madd
8053 Enable (disable) use of the floating point multiply-accumulate
8054 instructions, when they are available.  The default is
8055 @option{-mfused-madd}.
8056
8057 When multiply-accumulate instructions are used, the intermediate
8058 product is calculated to infinite precision and is not subject to
8059 the FCSR Flush to Zero bit.  This may be undesirable in some
8060 circumstances.
8061
8062 @item -nocpp
8063 @opindex nocpp
8064 Tell the MIPS assembler to not run its preprocessor over user
8065 assembler files (with a @samp{.s} suffix) when assembling them.
8066
8067 @item -mfix-sb1
8068 @itemx -mno-fix-sb1
8069 @opindex mfix-sb1
8070 Work around certain SB-1 CPU core errata.
8071 (This flag currently works around the SB-1 revision 2
8072 ``F1'' and ``F2'' floating point errata.)
8073
8074 @item -mflush-func=@var{func}
8075 @itemx -mno-flush-func
8076 @opindex mflush-func
8077 Specifies the function to call to flush the I and D caches, or to not
8078 call any such function.  If called, the function must take the same
8079 arguments as the common @code{_flush_func()}, that is, the address of the
8080 memory range for which the cache is being flushed, the size of the
8081 memory range, and the number 3 (to flush both caches).  The default
8082 depends on the target gcc was configured for, but commonly is either
8083 @samp{_flush_func} or @samp{__cpu_flush}.
8084
8085 @item -mbranch-likely
8086 @itemx -mno-branch-likely
8087 @opindex mbranch-likely
8088 @opindex mno-branch-likely
8089 Enable or disable use of Branch Likely instructions, regardless of the
8090 default for the selected architecture.  By default, Branch Likely
8091 instructions may be generated if they are supported by the selected
8092 architecture.  An exception is for the MIPS32 and MIPS64 architectures
8093 and processors which implement those architectures; for those, Branch
8094 Likely instructions will not be generated by default because the MIPS32
8095 and MIPS64 architectures specifically deprecate their use.
8096 @end table
8097
8098 @node i386 and x86-64 Options
8099 @subsection Intel 386 and AMD x86-64 Options
8100 @cindex i386 Options
8101 @cindex x86-64 Options
8102 @cindex Intel 386 Options
8103 @cindex AMD x86-64 Options
8104
8105 These @samp{-m} options are defined for the i386 and x86-64 family of
8106 computers:
8107
8108 @table @gcctabopt
8109 @item -mtune=@var{cpu-type}
8110 @opindex mtune
8111 Tune to @var{cpu-type} everything applicable about the generated code, except
8112 for the ABI and the set of available instructions.  The choices for
8113 @var{cpu-type} are:
8114 @table @emph
8115 @item i386
8116 Original Intel's i386 CPU.
8117 @item i486
8118 Intel's i486 CPU.  (No scheduling is implemented for this chip.)
8119 @item i586, pentium
8120 Intel Pentium CPU with no MMX support.
8121 @item pentium-mmx
8122 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
8123 @item i686, pentiumpro
8124 Intel PentiumPro CPU.
8125 @item pentium2
8126 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
8127 @item pentium3
8128 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
8129 support.
8130 @item pentium4
8131 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
8132 @item k6
8133 AMD K6 CPU with MMX instruction set support.
8134 @item k6-2, k6-3
8135 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
8136 @item athlon, athlon-tbird
8137 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
8138 support.
8139 @item athlon-4, athlon-xp, athlon-mp
8140 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
8141 instruction set support.
8142 @item k8, opteron, athlon64, athlon-fx
8143 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
8144 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
8145 @item winchip-c6
8146 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
8147 set support.
8148 @item winchip2
8149 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
8150 instruction set support.
8151 @item c3
8152 Via C3 CPU with MMX and 3dNOW!  instruction set support.  (No scheduling is
8153 implemented for this chip.)
8154 @item c3-2
8155 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
8156 implemented for this chip.)
8157 @end table
8158
8159 While picking a specific @var{cpu-type} will schedule things appropriately
8160 for that particular chip, the compiler will not generate any code that
8161 does not run on the i386 without the @option{-march=@var{cpu-type}} option
8162 being used.
8163
8164 @item -march=@var{cpu-type}
8165 @opindex march
8166 Generate instructions for the machine type @var{cpu-type}.  The choices
8167 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8168 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8169
8170 @item -mcpu=@var{cpu-type}
8171 @opindex mcpu
8172 A deprecated synonym for @option{-mtune}.
8173
8174 @item -m386
8175 @itemx -m486
8176 @itemx -mpentium
8177 @itemx -mpentiumpro
8178 @opindex m386
8179 @opindex m486
8180 @opindex mpentium
8181 @opindex mpentiumpro
8182 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8183 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8184 These synonyms are deprecated.
8185
8186 @item -mfpmath=@var{unit}
8187 @opindex march
8188 Generate floating point arithmetics for selected unit @var{unit}.  The choices
8189 for @var{unit} are:
8190
8191 @table @samp
8192 @item 387
8193 Use the standard 387 floating point coprocessor present majority of chips and
8194 emulated otherwise.  Code compiled with this option will run almost everywhere.
8195 The temporary results are computed in 80bit precision instead of precision
8196 specified by the type resulting in slightly different results compared to most
8197 of other chips. See @option{-ffloat-store} for more detailed description.
8198
8199 This is the default choice for i386 compiler.
8200
8201 @item sse
8202 Use scalar floating point instructions present in the SSE instruction set.
8203 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8204 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8205 instruction set supports only single precision arithmetics, thus the double and
8206 extended precision arithmetics is still done using 387.  Later version, present
8207 only in Pentium4 and the future AMD x86-64 chips supports double precision
8208 arithmetics too.
8209
8210 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8211 @option{-msse2} switches to enable SSE extensions and make this option
8212 effective.  For x86-64 compiler, these extensions are enabled by default.
8213
8214 The resulting code should be considerably faster in the majority of cases and avoid
8215 the numerical instability problems of 387 code, but may break some existing
8216 code that expects temporaries to be 80bit.
8217
8218 This is the default choice for the x86-64 compiler.
8219
8220 @item sse,387
8221 Attempt to utilize both instruction sets at once.  This effectively double the
8222 amount of available registers and on chips with separate execution units for
8223 387 and SSE the execution resources too.  Use this option with care, as it is
8224 still experimental, because the gcc register allocator does not model separate
8225 functional units well resulting in instable performance.
8226 @end table
8227
8228 @item -masm=@var{dialect}
8229 @opindex masm=@var{dialect}
8230 Output asm instructions using selected @var{dialect}. Supported choices are
8231 @samp{intel} or @samp{att} (the default one).
8232
8233 @item -mieee-fp
8234 @itemx -mno-ieee-fp
8235 @opindex mieee-fp
8236 @opindex mno-ieee-fp
8237 Control whether or not the compiler uses IEEE floating point
8238 comparisons.  These handle correctly the case where the result of a
8239 comparison is unordered.
8240
8241 @item -msoft-float
8242 @opindex msoft-float
8243 Generate output containing library calls for floating point.
8244 @strong{Warning:} the requisite libraries are not part of GCC@.
8245 Normally the facilities of the machine's usual C compiler are used, but
8246 this can't be done directly in cross-compilation.  You must make your
8247 own arrangements to provide suitable library functions for
8248 cross-compilation.
8249
8250 On machines where a function returns floating point results in the 80387
8251 register stack, some floating point opcodes may be emitted even if
8252 @option{-msoft-float} is used.
8253
8254 @item -mno-fp-ret-in-387
8255 @opindex mno-fp-ret-in-387
8256 Do not use the FPU registers for return values of functions.
8257
8258 The usual calling convention has functions return values of types
8259 @code{float} and @code{double} in an FPU register, even if there
8260 is no FPU@.  The idea is that the operating system should emulate
8261 an FPU@.
8262
8263 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8264 in ordinary CPU registers instead.
8265
8266 @item -mno-fancy-math-387
8267 @opindex mno-fancy-math-387
8268 Some 387 emulators do not support the @code{sin}, @code{cos} and
8269 @code{sqrt} instructions for the 387.  Specify this option to avoid
8270 generating those instructions.  This option is the default on FreeBSD,
8271 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8272 indicates that the target cpu will always have an FPU and so the
8273 instruction will not need emulation.  As of revision 2.6.1, these
8274 instructions are not generated unless you also use the
8275 @option{-funsafe-math-optimizations} switch.
8276
8277 @item -malign-double
8278 @itemx -mno-align-double
8279 @opindex malign-double
8280 @opindex mno-align-double
8281 Control whether GCC aligns @code{double}, @code{long double}, and
8282 @code{long long} variables on a two word boundary or a one word
8283 boundary.  Aligning @code{double} variables on a two word boundary will
8284 produce code that runs somewhat faster on a @samp{Pentium} at the
8285 expense of more memory.
8286
8287 @strong{Warning:} if you use the @option{-malign-double} switch,
8288 structures containing the above types will be aligned differently than
8289 the published application binary interface specifications for the 386
8290 and will not be binary compatible with structures in code compiled
8291 without that switch.
8292
8293 @item -m96bit-long-double
8294 @itemx -m128bit-long-double
8295 @opindex m96bit-long-double
8296 @opindex m128bit-long-double
8297 These switches control the size of @code{long double} type. The i386
8298 application binary interface specifies the size to be 96 bits,
8299 so @option{-m96bit-long-double} is the default in 32 bit mode.
8300
8301 Modern architectures (Pentium and newer) would prefer @code{long double}
8302 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
8303 conforming to the ABI, this would not be possible.  So specifying a
8304 @option{-m128bit-long-double} will align @code{long double}
8305 to a 16 byte boundary by padding the @code{long double} with an additional
8306 32 bit zero.
8307
8308 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8309 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
8310
8311 Notice that neither of these options enable any extra precision over the x87
8312 standard of 80 bits for a @code{long double}.
8313
8314 @strong{Warning:} if you override the default value for your target ABI, the
8315 structures and arrays containing @code{long double} variables will change
8316 their size as well as function calling convention for function taking
8317 @code{long double} will be modified.  Hence they will not be binary
8318 compatible with arrays or structures in code compiled without that switch.
8319
8320
8321 @item -msvr3-shlib
8322 @itemx -mno-svr3-shlib
8323 @opindex msvr3-shlib
8324 @opindex mno-svr3-shlib
8325 Control whether GCC places uninitialized local variables into the
8326 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
8327 into @code{bss}.  These options are meaningful only on System V Release 3.
8328
8329 @item -mrtd
8330 @opindex mrtd
8331 Use a different function-calling convention, in which functions that
8332 take a fixed number of arguments return with the @code{ret} @var{num}
8333 instruction, which pops their arguments while returning.  This saves one
8334 instruction in the caller since there is no need to pop the arguments
8335 there.
8336
8337 You can specify that an individual function is called with this calling
8338 sequence with the function attribute @samp{stdcall}.  You can also
8339 override the @option{-mrtd} option by using the function attribute
8340 @samp{cdecl}.  @xref{Function Attributes}.
8341
8342 @strong{Warning:} this calling convention is incompatible with the one
8343 normally used on Unix, so you cannot use it if you need to call
8344 libraries compiled with the Unix compiler.
8345
8346 Also, you must provide function prototypes for all functions that
8347 take variable numbers of arguments (including @code{printf});
8348 otherwise incorrect code will be generated for calls to those
8349 functions.
8350
8351 In addition, seriously incorrect code will result if you call a
8352 function with too many arguments.  (Normally, extra arguments are
8353 harmlessly ignored.)
8354
8355 @item -mregparm=@var{num}
8356 @opindex mregparm
8357 Control how many registers are used to pass integer arguments.  By
8358 default, no registers are used to pass arguments, and at most 3
8359 registers can be used.  You can control this behavior for a specific
8360 function by using the function attribute @samp{regparm}.
8361 @xref{Function Attributes}.
8362
8363 @strong{Warning:} if you use this switch, and
8364 @var{num} is nonzero, then you must build all modules with the same
8365 value, including any libraries.  This includes the system libraries and
8366 startup modules.
8367
8368 @item -mpreferred-stack-boundary=@var{num}
8369 @opindex mpreferred-stack-boundary
8370 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8371 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
8372 the default is 4 (16 bytes or 128 bits), except when optimizing for code
8373 size (@option{-Os}), in which case the default is the minimum correct
8374 alignment (4 bytes for x86, and 8 bytes for x86-64).
8375
8376 On Pentium and PentiumPro, @code{double} and @code{long double} values
8377 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8378 suffer significant run time performance penalties.  On Pentium III, the
8379 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8380 penalties if it is not 16 byte aligned.
8381
8382 To ensure proper alignment of this values on the stack, the stack boundary
8383 must be as aligned as that required by any value stored on the stack.
8384 Further, every function must be generated such that it keeps the stack
8385 aligned.  Thus calling a function compiled with a higher preferred
8386 stack boundary from a function compiled with a lower preferred stack
8387 boundary will most likely misalign the stack.  It is recommended that
8388 libraries that use callbacks always use the default setting.
8389
8390 This extra alignment does consume extra stack space, and generally
8391 increases code size.  Code that is sensitive to stack space usage, such
8392 as embedded systems and operating system kernels, may want to reduce the
8393 preferred alignment to @option{-mpreferred-stack-boundary=2}.
8394
8395 @item -mmmx
8396 @itemx -mno-mmx
8397 @item -msse
8398 @itemx -mno-sse
8399 @item -msse2
8400 @itemx -mno-sse2
8401 @item -mpni
8402 @itemx -mno-pni
8403 @item -m3dnow
8404 @itemx -mno-3dnow
8405 @opindex mmmx
8406 @opindex mno-mmx
8407 @opindex msse
8408 @opindex mno-sse
8409 @opindex m3dnow
8410 @opindex mno-3dnow
8411 These switches enable or disable the use of built-in functions that allow
8412 direct access to the MMX, SSE, SSE2, PNI and 3Dnow extensions of the
8413 instruction set.
8414
8415 @xref{X86 Built-in Functions}, for details of the functions enabled
8416 and disabled by these switches.
8417
8418 To have SSE/SSE2 instructions generated automatically from floating-point
8419 code, see @option{-mfpmath=sse}.
8420
8421 @item -mpush-args
8422 @itemx -mno-push-args
8423 @opindex mpush-args
8424 @opindex mno-push-args
8425 Use PUSH operations to store outgoing parameters.  This method is shorter
8426 and usually equally fast as method using SUB/MOV operations and is enabled
8427 by default.  In some cases disabling it may improve performance because of
8428 improved scheduling and reduced dependencies.
8429
8430 @item -maccumulate-outgoing-args
8431 @opindex maccumulate-outgoing-args
8432 If enabled, the maximum amount of space required for outgoing arguments will be
8433 computed in the function prologue.  This is faster on most modern CPUs
8434 because of reduced dependencies, improved scheduling and reduced stack usage
8435 when preferred stack boundary is not equal to 2.  The drawback is a notable
8436 increase in code size.  This switch implies @option{-mno-push-args}.
8437
8438 @item -mthreads
8439 @opindex mthreads
8440 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8441 on thread-safe exception handling must compile and link all code with the
8442 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
8443 @option{-D_MT}; when linking, it links in a special thread helper library
8444 @option{-lmingwthrd} which cleans up per thread exception handling data.
8445
8446 @item -mno-align-stringops
8447 @opindex mno-align-stringops
8448 Do not align destination of inlined string operations.  This switch reduces
8449 code size and improves performance in case the destination is already aligned,
8450 but gcc don't know about it.
8451
8452 @item -minline-all-stringops
8453 @opindex minline-all-stringops
8454 By default GCC inlines string operations only when destination is known to be
8455 aligned at least to 4 byte boundary.  This enables more inlining, increase code
8456 size, but may improve performance of code that depends on fast memcpy, strlen
8457 and memset for short lengths.
8458
8459 @item -momit-leaf-frame-pointer
8460 @opindex momit-leaf-frame-pointer
8461 Don't keep the frame pointer in a register for leaf functions.  This
8462 avoids the instructions to save, set up and restore frame pointers and
8463 makes an extra register available in leaf functions.  The option
8464 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8465 which might make debugging harder.
8466
8467 @item -mtls-direct-seg-refs
8468 @itemx -mno-tls-direct-seg-refs
8469 @opindex mtls-direct-seg-refs
8470 Controls whether TLS variables may be accessed with offsets from the
8471 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8472 or whether the thread base pointer must be added.  Whether or not this
8473 is legal depends on the operating system, and whether it maps the
8474 segment to cover the entire TLS area.
8475
8476 For systems that use GNU libc, the default is on.
8477 @end table
8478
8479 These @samp{-m} switches are supported in addition to the above
8480 on AMD x86-64 processors in 64-bit environments.
8481
8482 @table @gcctabopt
8483 @item -m32
8484 @itemx -m64
8485 @opindex m32
8486 @opindex m64
8487 Generate code for a 32-bit or 64-bit environment.
8488 The 32-bit environment sets int, long and pointer to 32 bits and
8489 generates code that runs on any i386 system.
8490 The 64-bit environment sets int to 32 bits and long and pointer
8491 to 64 bits and generates code for AMD's x86-64 architecture.
8492
8493 @item -mno-red-zone
8494 @opindex no-red-zone
8495 Do not use a so called red zone for x86-64 code.  The red zone is mandated
8496 by the x86-64 ABI, it is a 128-byte area beyond the location of the
8497 stack pointer that will not be modified by signal or interrupt handlers
8498 and therefore can be used for temporary data without adjusting the stack
8499 pointer.  The flag @option{-mno-red-zone} disables this red zone.
8500
8501 @item -mcmodel=small
8502 @opindex mcmodel=small
8503 Generate code for the small code model: the program and its symbols must
8504 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8505 Programs can be statically or dynamically linked.  This is the default
8506 code model.
8507
8508 @item -mcmodel=kernel
8509 @opindex mcmodel=kernel
8510 Generate code for the kernel code model.  The kernel runs in the
8511 negative 2 GB of the address space.
8512 This model has to be used for Linux kernel code.
8513
8514 @item -mcmodel=medium
8515 @opindex mcmodel=medium
8516 Generate code for the medium model: The program is linked in the lower 2
8517 GB of the address space but symbols can be located anywhere in the
8518 address space.  Programs can be statically or dynamically linked, but
8519 building of shared libraries are not supported with the medium model.
8520
8521 @item -mcmodel=large
8522 @opindex mcmodel=large
8523 Generate code for the large model: This model makes no assumptions
8524 about addresses and sizes of sections.  Currently GCC does not implement
8525 this model.
8526 @end table
8527
8528 @node HPPA Options
8529 @subsection HPPA Options
8530 @cindex HPPA Options
8531
8532 These @samp{-m} options are defined for the HPPA family of computers:
8533
8534 @table @gcctabopt
8535 @item -march=@var{architecture-type}
8536 @opindex march
8537 Generate code for the specified architecture.  The choices for
8538 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8539 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8540 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8541 architecture option for your machine.  Code compiled for lower numbered
8542 architectures will run on higher numbered architectures, but not the
8543 other way around.
8544
8545 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
8546 next release of binutils (current is 2.9.1) will probably contain PA 2.0
8547 support.
8548
8549 @item -mpa-risc-1-0
8550 @itemx -mpa-risc-1-1
8551 @itemx -mpa-risc-2-0
8552 @opindex mpa-risc-1-0
8553 @opindex mpa-risc-1-1
8554 @opindex mpa-risc-2-0
8555 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8556
8557 @item -mbig-switch
8558 @opindex mbig-switch
8559 Generate code suitable for big switch tables.  Use this option only if
8560 the assembler/linker complain about out of range branches within a switch
8561 table.
8562
8563 @item -mjump-in-delay
8564 @opindex mjump-in-delay
8565 Fill delay slots of function calls with unconditional jump instructions
8566 by modifying the return pointer for the function call to be the target
8567 of the conditional jump.
8568
8569 @item -mdisable-fpregs
8570 @opindex mdisable-fpregs
8571 Prevent floating point registers from being used in any manner.  This is
8572 necessary for compiling kernels which perform lazy context switching of
8573 floating point registers.  If you use this option and attempt to perform
8574 floating point operations, the compiler will abort.
8575
8576 @item -mdisable-indexing
8577 @opindex mdisable-indexing
8578 Prevent the compiler from using indexing address modes.  This avoids some
8579 rather obscure problems when compiling MIG generated code under MACH@.
8580
8581 @item -mno-space-regs
8582 @opindex mno-space-regs
8583 Generate code that assumes the target has no space registers.  This allows
8584 GCC to generate faster indirect calls and use unscaled index address modes.
8585
8586 Such code is suitable for level 0 PA systems and kernels.
8587
8588 @item -mfast-indirect-calls
8589 @opindex mfast-indirect-calls
8590 Generate code that assumes calls never cross space boundaries.  This
8591 allows GCC to emit code which performs faster indirect calls.
8592
8593 This option will not work in the presence of shared libraries or nested
8594 functions.
8595
8596 @item -mlong-load-store
8597 @opindex mlong-load-store
8598 Generate 3-instruction load and store sequences as sometimes required by
8599 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8600 the HP compilers.
8601
8602 @item -mportable-runtime
8603 @opindex mportable-runtime
8604 Use the portable calling conventions proposed by HP for ELF systems.
8605
8606 @item -mgas
8607 @opindex mgas
8608 Enable the use of assembler directives only GAS understands.
8609
8610 @item -mschedule=@var{cpu-type}
8611 @opindex mschedule
8612 Schedule code according to the constraints for the machine type
8613 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8614 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8615 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8616 proper scheduling option for your machine.  The default scheduling is
8617 @samp{8000}.
8618
8619 @item -mlinker-opt
8620 @opindex mlinker-opt
8621 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8622 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8623 linkers in which they give bogus error messages when linking some programs.
8624
8625 @item -msoft-float
8626 @opindex msoft-float
8627 Generate output containing library calls for floating point.
8628 @strong{Warning:} the requisite libraries are not available for all HPPA
8629 targets.  Normally the facilities of the machine's usual C compiler are
8630 used, but this cannot be done directly in cross-compilation.  You must make
8631 your own arrangements to provide suitable library functions for
8632 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8633 does provide software floating point support.
8634
8635 @option{-msoft-float} changes the calling convention in the output file;
8636 therefore, it is only useful if you compile @emph{all} of a program with
8637 this option.  In particular, you need to compile @file{libgcc.a}, the
8638 library that comes with GCC, with @option{-msoft-float} in order for
8639 this to work.
8640
8641 @item -msio
8642 @opindex msio
8643 Generate the predefine, @code{_SIO}, for server IO.  The default is
8644 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8645 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8646 options are available under HP-UX and HI-UX.
8647
8648 @item -mgnu-ld
8649 @opindex gnu-ld
8650 Use GNU ld specific options.  This passes @option{-shared} to ld when
8651 building a shared library.  It is the default when GCC is configured,
8652 explicitly or implicitly, with the GNU linker.  This option does not
8653 have any affect on which ld is called, it only changes what parameters
8654 are passed to that ld.  The ld that is called is determined by the
8655 @option{--with-ld} configure option, gcc's program search path, and
8656 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8657 using @samp{which `gcc -print-prog-name=ld`}.
8658
8659 @item -mhp-ld
8660 @opindex hp-ld
8661 Use HP ld specific options.  This passes @option{-b} to ld when building
8662 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8663 links.  It is the default when GCC is configured, explicitly or
8664 implicitly, with the HP linker.  This option does not have any affect on
8665 which ld is called, it only changes what parameters are passed to that
8666 ld.  The ld that is called is determined by the @option{--with-ld}
8667 configure option, gcc's program search path, and finally by the user's
8668 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8669 `gcc -print-prog-name=ld`}.
8670
8671 @item -mlong-calls
8672 @opindex mno-long-calls
8673 Generate code that uses long call sequences.  This ensures that a call
8674 is always able to reach linker generated stubs.  The default is to generate
8675 long calls only when the distance from the call site to the beginning
8676 of the function or translation unit, as the case may be, exceeds a
8677 predefined limit set by the branch type being used.  The limits for
8678 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8679 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8680 240,000 bytes.
8681
8682 Distances are measured from the beginning of functions when using the
8683 @option{-ffunction-sections} option, or when using the @option{-mgas}
8684 and @option{-mno-portable-runtime} options together under HP-UX with
8685 the SOM linker.
8686
8687 It is normally not desirable to use this option as it will degrade
8688 performance.  However, it may be useful in large applications,
8689 particularly when partial linking is used to build the application.
8690
8691 The types of long calls used depends on the capabilities of the
8692 assembler and linker, and the type of code being generated.  The
8693 impact on systems that support long absolute calls, and long pic
8694 symbol-difference or pc-relative calls should be relatively small.
8695 However, an indirect call is used on 32-bit ELF systems in pic code
8696 and it is quite long.
8697
8698 @item -nolibdld
8699 @opindex nolibdld
8700 Suppress the generation of link options to search libdld.sl when the
8701 @option{-static} option is specified on HP-UX 10 and later.
8702
8703 @item -static
8704 @opindex static
8705 The HP-UX implementation of setlocale in libc has a dependency on
8706 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8707 when the @option{-static} option is specified, special link options
8708 are needed to resolve this dependency.
8709
8710 On HP-UX 10 and later, the GCC driver adds the necessary options to
8711 link with libdld.sl when the @option{-static} option is specified.
8712 This causes the resulting binary to be dynamic.  On the 64-bit port,
8713 the linkers generate dynamic binaries by default in any case.  The
8714 @option{-nolibdld} option can be used to prevent the GCC driver from
8715 adding these link options.
8716
8717 @item -threads
8718 @opindex threads
8719 Add support for multithreading with the @dfn{dce thread} library
8720 under HP-UX.  This option sets flags for both the preprocessor and
8721 linker.
8722 @end table
8723
8724 @node DEC Alpha Options
8725 @subsection DEC Alpha Options
8726
8727 These @samp{-m} options are defined for the DEC Alpha implementations:
8728
8729 @table @gcctabopt
8730 @item -mno-soft-float
8731 @itemx -msoft-float
8732 @opindex mno-soft-float
8733 @opindex msoft-float
8734 Use (do not use) the hardware floating-point instructions for
8735 floating-point operations.  When @option{-msoft-float} is specified,
8736 functions in @file{libgcc.a} will be used to perform floating-point
8737 operations.  Unless they are replaced by routines that emulate the
8738 floating-point operations, or compiled in such a way as to call such
8739 emulations routines, these routines will issue floating-point
8740 operations.   If you are compiling for an Alpha without floating-point
8741 operations, you must ensure that the library is built so as not to call
8742 them.
8743
8744 Note that Alpha implementations without floating-point operations are
8745 required to have floating-point registers.
8746
8747 @item -mfp-reg
8748 @itemx -mno-fp-regs
8749 @opindex mfp-reg
8750 @opindex mno-fp-regs
8751 Generate code that uses (does not use) the floating-point register set.
8752 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8753 register set is not used, floating point operands are passed in integer
8754 registers as if they were integers and floating-point results are passed
8755 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8756 so any function with a floating-point argument or return value called by code
8757 compiled with @option{-mno-fp-regs} must also be compiled with that
8758 option.
8759
8760 A typical use of this option is building a kernel that does not use,
8761 and hence need not save and restore, any floating-point registers.
8762
8763 @item -mieee
8764 @opindex mieee
8765 The Alpha architecture implements floating-point hardware optimized for
8766 maximum performance.  It is mostly compliant with the IEEE floating
8767 point standard.  However, for full compliance, software assistance is
8768 required.  This option generates code fully IEEE compliant code
8769 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8770 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8771 defined during compilation.  The resulting code is less efficient but is
8772 able to correctly support denormalized numbers and exceptional IEEE
8773 values such as not-a-number and plus/minus infinity.  Other Alpha
8774 compilers call this option @option{-ieee_with_no_inexact}.
8775
8776 @item -mieee-with-inexact
8777 @opindex mieee-with-inexact
8778 This is like @option{-mieee} except the generated code also maintains
8779 the IEEE @var{inexact-flag}.  Turning on this option causes the
8780 generated code to implement fully-compliant IEEE math.  In addition to
8781 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8782 macro.  On some Alpha implementations the resulting code may execute
8783 significantly slower than the code generated by default.  Since there is
8784 very little code that depends on the @var{inexact-flag}, you should
8785 normally not specify this option.  Other Alpha compilers call this
8786 option @option{-ieee_with_inexact}.
8787
8788 @item -mfp-trap-mode=@var{trap-mode}
8789 @opindex mfp-trap-mode
8790 This option controls what floating-point related traps are enabled.
8791 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8792 The trap mode can be set to one of four values:
8793
8794 @table @samp
8795 @item n
8796 This is the default (normal) setting.  The only traps that are enabled
8797 are the ones that cannot be disabled in software (e.g., division by zero
8798 trap).
8799
8800 @item u
8801 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8802 as well.
8803
8804 @item su
8805 Like @samp{su}, but the instructions are marked to be safe for software
8806 completion (see Alpha architecture manual for details).
8807
8808 @item sui
8809 Like @samp{su}, but inexact traps are enabled as well.
8810 @end table
8811
8812 @item -mfp-rounding-mode=@var{rounding-mode}
8813 @opindex mfp-rounding-mode
8814 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8815 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8816 of:
8817
8818 @table @samp
8819 @item n
8820 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8821 the nearest machine number or towards the even machine number in case
8822 of a tie.
8823
8824 @item m
8825 Round towards minus infinity.
8826
8827 @item c
8828 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8829
8830 @item d
8831 Dynamic rounding mode.  A field in the floating point control register
8832 (@var{fpcr}, see Alpha architecture reference manual) controls the
8833 rounding mode in effect.  The C library initializes this register for
8834 rounding towards plus infinity.  Thus, unless your program modifies the
8835 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8836 @end table
8837
8838 @item -mtrap-precision=@var{trap-precision}
8839 @opindex mtrap-precision
8840 In the Alpha architecture, floating point traps are imprecise.  This
8841 means without software assistance it is impossible to recover from a
8842 floating trap and program execution normally needs to be terminated.
8843 GCC can generate code that can assist operating system trap handlers
8844 in determining the exact location that caused a floating point trap.
8845 Depending on the requirements of an application, different levels of
8846 precisions can be selected:
8847
8848 @table @samp
8849 @item p
8850 Program precision.  This option is the default and means a trap handler
8851 can only identify which program caused a floating point exception.
8852
8853 @item f
8854 Function precision.  The trap handler can determine the function that
8855 caused a floating point exception.
8856
8857 @item i
8858 Instruction precision.  The trap handler can determine the exact
8859 instruction that caused a floating point exception.
8860 @end table
8861
8862 Other Alpha compilers provide the equivalent options called
8863 @option{-scope_safe} and @option{-resumption_safe}.
8864
8865 @item -mieee-conformant
8866 @opindex mieee-conformant
8867 This option marks the generated code as IEEE conformant.  You must not
8868 use this option unless you also specify @option{-mtrap-precision=i} and either
8869 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8870 is to emit the line @samp{.eflag 48} in the function prologue of the
8871 generated assembly file.  Under DEC Unix, this has the effect that
8872 IEEE-conformant math library routines will be linked in.
8873
8874 @item -mbuild-constants
8875 @opindex mbuild-constants
8876 Normally GCC examines a 32- or 64-bit integer constant to
8877 see if it can construct it from smaller constants in two or three
8878 instructions.  If it cannot, it will output the constant as a literal and
8879 generate code to load it from the data segment at runtime.
8880
8881 Use this option to require GCC to construct @emph{all} integer constants
8882 using code, even if it takes more instructions (the maximum is six).
8883
8884 You would typically use this option to build a shared library dynamic
8885 loader.  Itself a shared library, it must relocate itself in memory
8886 before it can find the variables and constants in its own data segment.
8887
8888 @item -malpha-as
8889 @itemx -mgas
8890 @opindex malpha-as
8891 @opindex mgas
8892 Select whether to generate code to be assembled by the vendor-supplied
8893 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8894
8895 @item -mbwx
8896 @itemx -mno-bwx
8897 @itemx -mcix
8898 @itemx -mno-cix
8899 @itemx -mfix
8900 @itemx -mno-fix
8901 @itemx -mmax
8902 @itemx -mno-max
8903 @opindex mbwx
8904 @opindex mno-bwx
8905 @opindex mcix
8906 @opindex mno-cix
8907 @opindex mfix
8908 @opindex mno-fix
8909 @opindex mmax
8910 @opindex mno-max
8911 Indicate whether GCC should generate code to use the optional BWX,
8912 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8913 sets supported by the CPU type specified via @option{-mcpu=} option or that
8914 of the CPU on which GCC was built if none was specified.
8915
8916 @item -mfloat-vax
8917 @itemx -mfloat-ieee
8918 @opindex mfloat-vax
8919 @opindex mfloat-ieee
8920 Generate code that uses (does not use) VAX F and G floating point
8921 arithmetic instead of IEEE single and double precision.
8922
8923 @item -mexplicit-relocs
8924 @itemx -mno-explicit-relocs
8925 @opindex mexplicit-relocs
8926 @opindex mno-explicit-relocs
8927 Older Alpha assemblers provided no way to generate symbol relocations
8928 except via assembler macros.  Use of these macros does not allow
8929 optimal instruction scheduling.  GNU binutils as of version 2.12
8930 supports a new syntax that allows the compiler to explicitly mark
8931 which relocations should apply to which instructions.  This option
8932 is mostly useful for debugging, as GCC detects the capabilities of
8933 the assembler when it is built and sets the default accordingly.
8934
8935 @item -msmall-data
8936 @itemx -mlarge-data
8937 @opindex msmall-data
8938 @opindex mlarge-data
8939 When @option{-mexplicit-relocs} is in effect, static data is
8940 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8941 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8942 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8943 16-bit relocations off of the @code{$gp} register.  This limits the
8944 size of the small data area to 64KB, but allows the variables to be
8945 directly accessed via a single instruction.
8946
8947 The default is @option{-mlarge-data}.  With this option the data area
8948 is limited to just below 2GB.  Programs that require more than 2GB of
8949 data must use @code{malloc} or @code{mmap} to allocate the data in the
8950 heap instead of in the program's data segment.
8951
8952 When generating code for shared libraries, @option{-fpic} implies
8953 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8954
8955 @item -msmall-text
8956 @itemx -mlarge-text
8957 @opindex msmall-text
8958 @opindex mlarge-text
8959 When @option{-msmall-text} is used, the compiler assumes that the
8960 code of the entire program (or shared library) fits in 4MB, and is
8961 thus reachable with a branch instruction.  When @option{-msmall-data}
8962 is used, the compiler can assume that all local symbols share the
8963 same @code{$gp} value, and thus reduce the number of instructions
8964 required for a function call from 4 to 1.
8965
8966 The default is @option{-mlarge-text}.
8967
8968 @item -mcpu=@var{cpu_type}
8969 @opindex mcpu
8970 Set the instruction set and instruction scheduling parameters for
8971 machine type @var{cpu_type}.  You can specify either the @samp{EV}
8972 style name or the corresponding chip number.  GCC supports scheduling
8973 parameters for the EV4, EV5 and EV6 family of processors and will
8974 choose the default values for the instruction set from the processor
8975 you specify.  If you do not specify a processor type, GCC will default
8976 to the processor on which the compiler was built.
8977
8978 Supported values for @var{cpu_type} are
8979
8980 @table @samp
8981 @item ev4
8982 @itemx ev45
8983 @itemx 21064
8984 Schedules as an EV4 and has no instruction set extensions.
8985
8986 @item ev5
8987 @itemx 21164
8988 Schedules as an EV5 and has no instruction set extensions.
8989
8990 @item ev56
8991 @itemx 21164a
8992 Schedules as an EV5 and supports the BWX extension.
8993
8994 @item pca56
8995 @itemx 21164pc
8996 @itemx 21164PC
8997 Schedules as an EV5 and supports the BWX and MAX extensions.
8998
8999 @item ev6
9000 @itemx 21264
9001 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
9002
9003 @item ev67
9004 @itemx 21264a
9005 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
9006 @end table
9007
9008 @item -mtune=@var{cpu_type}
9009 @opindex mtune
9010 Set only the instruction scheduling parameters for machine type
9011 @var{cpu_type}.  The instruction set is not changed.
9012
9013 @item -mmemory-latency=@var{time}
9014 @opindex mmemory-latency
9015 Sets the latency the scheduler should assume for typical memory
9016 references as seen by the application.  This number is highly
9017 dependent on the memory access patterns used by the application
9018 and the size of the external cache on the machine.
9019
9020 Valid options for @var{time} are
9021
9022 @table @samp
9023 @item @var{number}
9024 A decimal number representing clock cycles.
9025
9026 @item L1
9027 @itemx L2
9028 @itemx L3
9029 @itemx main
9030 The compiler contains estimates of the number of clock cycles for
9031 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9032 (also called Dcache, Scache, and Bcache), as well as to main memory.
9033 Note that L3 is only valid for EV5.
9034
9035 @end table
9036 @end table
9037
9038 @node DEC Alpha/VMS Options
9039 @subsection DEC Alpha/VMS Options
9040
9041 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9042
9043 @table @gcctabopt
9044 @item -mvms-return-codes
9045 @opindex mvms-return-codes
9046 Return VMS condition codes from main.  The default is to return POSIX
9047 style condition (e.g.@ error) codes.
9048 @end table
9049
9050 @node H8/300 Options
9051 @subsection H8/300 Options
9052
9053 These @samp{-m} options are defined for the H8/300 implementations:
9054
9055 @table @gcctabopt
9056 @item -mrelax
9057 @opindex mrelax
9058 Shorten some address references at link time, when possible; uses the
9059 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
9060 ld, Using ld}, for a fuller description.
9061
9062 @item -mh
9063 @opindex mh
9064 Generate code for the H8/300H@.
9065
9066 @item -ms
9067 @opindex ms
9068 Generate code for the H8S@.
9069
9070 @item -mn
9071 @opindex mn
9072 Generate code for the H8S and H8/300H in the normal mode.  This switch
9073 must be used either with -mh or -ms.
9074
9075 @item -ms2600
9076 @opindex ms2600
9077 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
9078
9079 @item -mint32
9080 @opindex mint32
9081 Make @code{int} data 32 bits by default.
9082
9083 @item -malign-300
9084 @opindex malign-300
9085 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9086 The default for the H8/300H and H8S is to align longs and floats on 4
9087 byte boundaries.
9088 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9089 This option has no effect on the H8/300.
9090 @end table
9091
9092 @node SH Options
9093 @subsection SH Options
9094
9095 These @samp{-m} options are defined for the SH implementations:
9096
9097 @table @gcctabopt
9098 @item -m1
9099 @opindex m1
9100 Generate code for the SH1.
9101
9102 @item -m2
9103 @opindex m2
9104 Generate code for the SH2.
9105
9106 @item -m2e
9107 Generate code for the SH2e.
9108
9109 @item -m3
9110 @opindex m3
9111 Generate code for the SH3.
9112
9113 @item -m3e
9114 @opindex m3e
9115 Generate code for the SH3e.
9116
9117 @item -m4-nofpu
9118 @opindex m4-nofpu
9119 Generate code for the SH4 without a floating-point unit.
9120
9121 @item -m4-single-only
9122 @opindex m4-single-only
9123 Generate code for the SH4 with a floating-point unit that only
9124 supports single-precision arithmetic.
9125
9126 @item -m4-single
9127 @opindex m4-single
9128 Generate code for the SH4 assuming the floating-point unit is in
9129 single-precision mode by default.
9130
9131 @item -m4
9132 @opindex m4
9133 Generate code for the SH4.
9134
9135 @item -mb
9136 @opindex mb
9137 Compile code for the processor in big endian mode.
9138
9139 @item -ml
9140 @opindex ml
9141 Compile code for the processor in little endian mode.
9142
9143 @item -mdalign
9144 @opindex mdalign
9145 Align doubles at 64-bit boundaries.  Note that this changes the calling
9146 conventions, and thus some functions from the standard C library will
9147 not work unless you recompile it first with @option{-mdalign}.
9148
9149 @item -mrelax
9150 @opindex mrelax
9151 Shorten some address references at link time, when possible; uses the
9152 linker option @option{-relax}.
9153
9154 @item -mbigtable
9155 @opindex mbigtable
9156 Use 32-bit offsets in @code{switch} tables.  The default is to use
9157 16-bit offsets.
9158
9159 @item -mfmovd
9160 @opindex mfmovd
9161 Enable the use of the instruction @code{fmovd}.
9162
9163 @item -mhitachi
9164 @opindex mhitachi
9165 Comply with the calling conventions defined by Renesas.
9166
9167 @item -mnomacsave
9168 @opindex mnomacsave
9169 Mark the @code{MAC} register as call-clobbered, even if
9170 @option{-mhitachi} is given.
9171
9172 @item -mieee
9173 @opindex mieee
9174 Increase IEEE-compliance of floating-point code.
9175
9176 @item -misize
9177 @opindex misize
9178 Dump instruction size and location in the assembly code.
9179
9180 @item -mpadstruct
9181 @opindex mpadstruct
9182 This option is deprecated.  It pads structures to multiple of 4 bytes,
9183 which is incompatible with the SH ABI@.
9184
9185 @item -mspace
9186 @opindex mspace
9187 Optimize for space instead of speed.  Implied by @option{-Os}.
9188
9189 @item -mprefergot
9190 @opindex mprefergot
9191 When generating position-independent code, emit function calls using
9192 the Global Offset Table instead of the Procedure Linkage Table.
9193
9194 @item -musermode
9195 @opindex musermode
9196 Generate a library function call to invalidate instruction cache
9197 entries, after fixing up a trampoline.  This library function call
9198 doesn't assume it can write to the whole memory address space.  This
9199 is the default when the target is @code{sh-*-linux*}.
9200 @end table
9201
9202 @node System V Options
9203 @subsection Options for System V
9204
9205 These additional options are available on System V Release 4 for
9206 compatibility with other compilers on those systems:
9207
9208 @table @gcctabopt
9209 @item -G
9210 @opindex G
9211 Create a shared object.
9212 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
9213
9214 @item -Qy
9215 @opindex Qy
9216 Identify the versions of each tool used by the compiler, in a
9217 @code{.ident} assembler directive in the output.
9218
9219 @item -Qn
9220 @opindex Qn
9221 Refrain from adding @code{.ident} directives to the output file (this is
9222 the default).
9223
9224 @item -YP,@var{dirs}
9225 @opindex YP
9226 Search the directories @var{dirs}, and no others, for libraries
9227 specified with @option{-l}.
9228
9229 @item -Ym,@var{dir}
9230 @opindex Ym
9231 Look in the directory @var{dir} to find the M4 preprocessor.
9232 The assembler uses this option.
9233 @c This is supposed to go with a -Yd for predefined M4 macro files, but
9234 @c the generic assembler that comes with Solaris takes just -Ym.
9235 @end table
9236
9237 @node TMS320C3x/C4x Options
9238 @subsection TMS320C3x/C4x Options
9239 @cindex TMS320C3x/C4x Options
9240
9241 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
9242
9243 @table @gcctabopt
9244
9245 @item -mcpu=@var{cpu_type}
9246 @opindex mcpu
9247 Set the instruction set, register set, and instruction scheduling
9248 parameters for machine type @var{cpu_type}.  Supported values for
9249 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
9250 @samp{c44}.  The default is @samp{c40} to generate code for the
9251 TMS320C40.
9252
9253 @item -mbig-memory
9254 @itemx -mbig
9255 @itemx -msmall-memory
9256 @itemx -msmall
9257 @opindex mbig-memory
9258 @opindex mbig
9259 @opindex msmall-memory
9260 @opindex msmall
9261 Generates code for the big or small memory model.  The small memory
9262 model assumed that all data fits into one 64K word page.  At run-time
9263 the data page (DP) register must be set to point to the 64K page
9264 containing the .bss and .data program sections.  The big memory model is
9265 the default and requires reloading of the DP register for every direct
9266 memory access.
9267
9268 @item -mbk
9269 @itemx -mno-bk
9270 @opindex mbk
9271 @opindex mno-bk
9272 Allow (disallow) allocation of general integer operands into the block
9273 count register BK@.
9274
9275 @item -mdb
9276 @itemx -mno-db
9277 @opindex mdb
9278 @opindex mno-db
9279 Enable (disable) generation of code using decrement and branch,
9280 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
9281 on the safe side, this is disabled for the C3x, since the maximum
9282 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
9283 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
9284 that it can utilize the decrement and branch instruction, but will give
9285 up if there is more than one memory reference in the loop.  Thus a loop
9286 where the loop counter is decremented can generate slightly more
9287 efficient code, in cases where the RPTB instruction cannot be utilized.
9288
9289 @item -mdp-isr-reload
9290 @itemx -mparanoid
9291 @opindex mdp-isr-reload
9292 @opindex mparanoid
9293 Force the DP register to be saved on entry to an interrupt service
9294 routine (ISR), reloaded to point to the data section, and restored on
9295 exit from the ISR@.  This should not be required unless someone has
9296 violated the small memory model by modifying the DP register, say within
9297 an object library.
9298
9299 @item -mmpyi
9300 @itemx -mno-mpyi
9301 @opindex mmpyi
9302 @opindex mno-mpyi
9303 For the C3x use the 24-bit MPYI instruction for integer multiplies
9304 instead of a library call to guarantee 32-bit results.  Note that if one
9305 of the operands is a constant, then the multiplication will be performed
9306 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
9307 then squaring operations are performed inline instead of a library call.
9308
9309 @item -mfast-fix
9310 @itemx -mno-fast-fix
9311 @opindex mfast-fix
9312 @opindex mno-fast-fix
9313 The C3x/C4x FIX instruction to convert a floating point value to an
9314 integer value chooses the nearest integer less than or equal to the
9315 floating point value rather than to the nearest integer.  Thus if the
9316 floating point number is negative, the result will be incorrectly
9317 truncated an additional code is necessary to detect and correct this
9318 case.  This option can be used to disable generation of the additional
9319 code required to correct the result.
9320
9321 @item -mrptb
9322 @itemx -mno-rptb
9323 @opindex mrptb
9324 @opindex mno-rptb
9325 Enable (disable) generation of repeat block sequences using the RPTB
9326 instruction for zero overhead looping.  The RPTB construct is only used
9327 for innermost loops that do not call functions or jump across the loop
9328 boundaries.  There is no advantage having nested RPTB loops due to the
9329 overhead required to save and restore the RC, RS, and RE registers.
9330 This is enabled by default with @option{-O2}.
9331
9332 @item -mrpts=@var{count}
9333 @itemx -mno-rpts
9334 @opindex mrpts
9335 @opindex mno-rpts
9336 Enable (disable) the use of the single instruction repeat instruction
9337 RPTS@.  If a repeat block contains a single instruction, and the loop
9338 count can be guaranteed to be less than the value @var{count}, GCC will
9339 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
9340 then a RPTS will be emitted even if the loop count cannot be determined
9341 at compile time.  Note that the repeated instruction following RPTS does
9342 not have to be reloaded from memory each iteration, thus freeing up the
9343 CPU buses for operands.  However, since interrupts are blocked by this
9344 instruction, it is disabled by default.
9345
9346 @item -mloop-unsigned
9347 @itemx -mno-loop-unsigned
9348 @opindex mloop-unsigned
9349 @opindex mno-loop-unsigned
9350 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
9351 is @math{2^{31} + 1} since these instructions test if the iteration count is
9352 negative to terminate the loop.  If the iteration count is unsigned
9353 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
9354 exceeded.  This switch allows an unsigned iteration count.
9355
9356 @item -mti
9357 @opindex mti
9358 Try to emit an assembler syntax that the TI assembler (asm30) is happy
9359 with.  This also enforces compatibility with the API employed by the TI
9360 C3x C compiler.  For example, long doubles are passed as structures
9361 rather than in floating point registers.
9362
9363 @item -mregparm
9364 @itemx -mmemparm
9365 @opindex mregparm
9366 @opindex mmemparm
9367 Generate code that uses registers (stack) for passing arguments to functions.
9368 By default, arguments are passed in registers where possible rather
9369 than by pushing arguments on to the stack.
9370
9371 @item -mparallel-insns
9372 @itemx -mno-parallel-insns
9373 @opindex mparallel-insns
9374 @opindex mno-parallel-insns
9375 Allow the generation of parallel instructions.  This is enabled by
9376 default with @option{-O2}.
9377
9378 @item -mparallel-mpy
9379 @itemx -mno-parallel-mpy
9380 @opindex mparallel-mpy
9381 @opindex mno-parallel-mpy
9382 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
9383 provided @option{-mparallel-insns} is also specified.  These instructions have
9384 tight register constraints which can pessimize the code generation
9385 of large functions.
9386
9387 @end table
9388
9389 @node V850 Options
9390 @subsection V850 Options
9391 @cindex V850 Options
9392
9393 These @samp{-m} options are defined for V850 implementations:
9394
9395 @table @gcctabopt
9396 @item -mlong-calls
9397 @itemx -mno-long-calls
9398 @opindex mlong-calls
9399 @opindex mno-long-calls
9400 Treat all calls as being far away (near).  If calls are assumed to be
9401 far away, the compiler will always load the functions address up into a
9402 register, and call indirect through the pointer.
9403
9404 @item -mno-ep
9405 @itemx -mep
9406 @opindex mno-ep
9407 @opindex mep
9408 Do not optimize (do optimize) basic blocks that use the same index
9409 pointer 4 or more times to copy pointer into the @code{ep} register, and
9410 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
9411 option is on by default if you optimize.
9412
9413 @item -mno-prolog-function
9414 @itemx -mprolog-function
9415 @opindex mno-prolog-function
9416 @opindex mprolog-function
9417 Do not use (do use) external functions to save and restore registers
9418 at the prologue and epilogue of a function.  The external functions
9419 are slower, but use less code space if more than one function saves
9420 the same number of registers.  The @option{-mprolog-function} option
9421 is on by default if you optimize.
9422
9423 @item -mspace
9424 @opindex mspace
9425 Try to make the code as small as possible.  At present, this just turns
9426 on the @option{-mep} and @option{-mprolog-function} options.
9427
9428 @item -mtda=@var{n}
9429 @opindex mtda
9430 Put static or global variables whose size is @var{n} bytes or less into
9431 the tiny data area that register @code{ep} points to.  The tiny data
9432 area can hold up to 256 bytes in total (128 bytes for byte references).
9433
9434 @item -msda=@var{n}
9435 @opindex msda
9436 Put static or global variables whose size is @var{n} bytes or less into
9437 the small data area that register @code{gp} points to.  The small data
9438 area can hold up to 64 kilobytes.
9439
9440 @item -mzda=@var{n}
9441 @opindex mzda
9442 Put static or global variables whose size is @var{n} bytes or less into
9443 the first 32 kilobytes of memory.
9444
9445 @item -mv850
9446 @opindex mv850
9447 Specify that the target processor is the V850.
9448
9449 @item -mbig-switch
9450 @opindex mbig-switch
9451 Generate code suitable for big switch tables.  Use this option only if
9452 the assembler/linker complain about out of range branches within a switch
9453 table.
9454
9455 @item -mapp-regs
9456 @opindex mapp-regs
9457 This option will cause r2 and r5 to be used in the code generated by
9458 the compiler.  This setting is the default.
9459
9460 @item -mno-app-regs
9461 @opindex mno-app-regs
9462 This option will cause r2 and r5 to be treated as fixed registers.
9463
9464 @item -mv850e1
9465 @opindex mv850e1
9466 Specify that the target processor is the V850E1.  The preprocessor
9467 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
9468 this option is used.
9469
9470 @item -mv850e
9471 @opindex mv850e
9472 Specify that the target processor is the V850E.  The preprocessor
9473 constant @samp{__v850e__} will be defined if this option is used.
9474
9475 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
9476 are defined then a default target processor will be chosen and the
9477 relevant @samp{__v850*__} preprocessor constant will be defined.
9478
9479 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9480 defined, regardless of which processor variant is the target.
9481
9482 @item -mdisable-callt
9483 @opindex mdisable-callt
9484 This option will suppress generation of the CALLT instruction for the
9485 v850e and v850e1 flavors of the v850 architecture.  The default is
9486 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
9487
9488 @end table
9489
9490 @node ARC Options
9491 @subsection ARC Options
9492 @cindex ARC Options
9493
9494 These options are defined for ARC implementations:
9495
9496 @table @gcctabopt
9497 @item -EL
9498 @opindex EL
9499 Compile code for little endian mode.  This is the default.
9500
9501 @item -EB
9502 @opindex EB
9503 Compile code for big endian mode.
9504
9505 @item -mmangle-cpu
9506 @opindex mmangle-cpu
9507 Prepend the name of the cpu to all public symbol names.
9508 In multiple-processor systems, there are many ARC variants with different
9509 instruction and register set characteristics.  This flag prevents code
9510 compiled for one cpu to be linked with code compiled for another.
9511 No facility exists for handling variants that are ``almost identical''.
9512 This is an all or nothing option.
9513
9514 @item -mcpu=@var{cpu}
9515 @opindex mcpu
9516 Compile code for ARC variant @var{cpu}.
9517 Which variants are supported depend on the configuration.
9518 All variants support @option{-mcpu=base}, this is the default.
9519
9520 @item -mtext=@var{text-section}
9521 @itemx -mdata=@var{data-section}
9522 @itemx -mrodata=@var{readonly-data-section}
9523 @opindex mtext
9524 @opindex mdata
9525 @opindex mrodata
9526 Put functions, data, and readonly data in @var{text-section},
9527 @var{data-section}, and @var{readonly-data-section} respectively
9528 by default.  This can be overridden with the @code{section} attribute.
9529 @xref{Variable Attributes}.
9530
9531 @end table
9532
9533 @node NS32K Options
9534 @subsection NS32K Options
9535 @cindex NS32K options
9536
9537 These are the @samp{-m} options defined for the 32000 series.  The default
9538 values for these options depends on which style of 32000 was selected when
9539 the compiler was configured; the defaults for the most common choices are
9540 given below.
9541
9542 @table @gcctabopt
9543 @item -m32032
9544 @itemx -m32032
9545 @opindex m32032
9546 @opindex m32032
9547 Generate output for a 32032.  This is the default
9548 when the compiler is configured for 32032 and 32016 based systems.
9549
9550 @item -m32332
9551 @itemx -m32332
9552 @opindex m32332
9553 @opindex m32332
9554 Generate output for a 32332.  This is the default
9555 when the compiler is configured for 32332-based systems.
9556
9557 @item -m32532
9558 @itemx -m32532
9559 @opindex m32532
9560 @opindex m32532
9561 Generate output for a 32532.  This is the default
9562 when the compiler is configured for 32532-based systems.
9563
9564 @item -m32081
9565 @opindex m32081
9566 Generate output containing 32081 instructions for floating point.
9567 This is the default for all systems.
9568
9569 @item -m32381
9570 @opindex m32381
9571 Generate output containing 32381 instructions for floating point.  This
9572 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9573 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9574
9575 @item -mmulti-add
9576 @opindex mmulti-add
9577 Try and generate multiply-add floating point instructions @code{polyF}
9578 and @code{dotF}.  This option is only available if the @option{-m32381}
9579 option is in effect.  Using these instructions requires changes to
9580 register allocation which generally has a negative impact on
9581 performance.  This option should only be enabled when compiling code
9582 particularly likely to make heavy use of multiply-add instructions.
9583
9584 @item -mnomulti-add
9585 @opindex mnomulti-add
9586 Do not try and generate multiply-add floating point instructions
9587 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9588
9589 @item -msoft-float
9590 @opindex msoft-float
9591 Generate output containing library calls for floating point.
9592 @strong{Warning:} the requisite libraries may not be available.
9593
9594 @item -mieee-compare
9595 @itemx -mno-ieee-compare
9596 @opindex mieee-compare
9597 @opindex mno-ieee-compare
9598 Control whether or not the compiler uses IEEE floating point
9599 comparisons.  These handle correctly the case where the result of a
9600 comparison is unordered.
9601 @strong{Warning:} the requisite kernel support may not be available.
9602
9603 @item -mnobitfield
9604 @opindex mnobitfield
9605 Do not use the bit-field instructions.  On some machines it is faster to
9606 use shifting and masking operations.  This is the default for the pc532.
9607
9608 @item -mbitfield
9609 @opindex mbitfield
9610 Do use the bit-field instructions.  This is the default for all platforms
9611 except the pc532.
9612
9613 @item -mrtd
9614 @opindex mrtd
9615 Use a different function-calling convention, in which functions
9616 that take a fixed number of arguments return pop their
9617 arguments on return with the @code{ret} instruction.
9618
9619 This calling convention is incompatible with the one normally
9620 used on Unix, so you cannot use it if you need to call libraries
9621 compiled with the Unix compiler.
9622
9623 Also, you must provide function prototypes for all functions that
9624 take variable numbers of arguments (including @code{printf});
9625 otherwise incorrect code will be generated for calls to those
9626 functions.
9627
9628 In addition, seriously incorrect code will result if you call a
9629 function with too many arguments.  (Normally, extra arguments are
9630 harmlessly ignored.)
9631
9632 This option takes its name from the 680x0 @code{rtd} instruction.
9633
9634
9635 @item -mregparam
9636 @opindex mregparam
9637 Use a different function-calling convention where the first two arguments
9638 are passed in registers.
9639
9640 This calling convention is incompatible with the one normally
9641 used on Unix, so you cannot use it if you need to call libraries
9642 compiled with the Unix compiler.
9643
9644 @item -mnoregparam
9645 @opindex mnoregparam
9646 Do not pass any arguments in registers.  This is the default for all
9647 targets.
9648
9649 @item -msb
9650 @opindex msb
9651 It is OK to use the sb as an index register which is always loaded with
9652 zero.  This is the default for the pc532-netbsd target.
9653
9654 @item -mnosb
9655 @opindex mnosb
9656 The sb register is not available for use or has not been initialized to
9657 zero by the run time system.  This is the default for all targets except
9658 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9659 @option{-fpic} is set.
9660
9661 @item -mhimem
9662 @opindex mhimem
9663 Many ns32000 series addressing modes use displacements of up to 512MB@.
9664 If an address is above 512MB then displacements from zero can not be used.
9665 This option causes code to be generated which can be loaded above 512MB@.
9666 This may be useful for operating systems or ROM code.
9667
9668 @item -mnohimem
9669 @opindex mnohimem
9670 Assume code will be loaded in the first 512MB of virtual address space.
9671 This is the default for all platforms.
9672
9673
9674 @end table
9675
9676 @node AVR Options
9677 @subsection AVR Options
9678 @cindex AVR Options
9679
9680 These options are defined for AVR implementations:
9681
9682 @table @gcctabopt
9683 @item -mmcu=@var{mcu}
9684 @opindex mmcu
9685 Specify ATMEL AVR instruction set or MCU type.
9686
9687 Instruction set avr1 is for the minimal AVR core, not supported by the C
9688 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9689 attiny11, attiny12, attiny15, attiny28).
9690
9691 Instruction set avr2 (default) is for the classic AVR core with up to
9692 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9693 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9694 at90c8534, at90s8535).
9695
9696 Instruction set avr3 is for the classic AVR core with up to 128K program
9697 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9698
9699 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9700 memory space (MCU types: atmega8, atmega83, atmega85).
9701
9702 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9703 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9704 atmega64, atmega128, at43usb355, at94k).
9705
9706 @item -msize
9707 @opindex msize
9708 Output instruction sizes to the asm file.
9709
9710 @item -minit-stack=@var{N}
9711 @opindex minit-stack
9712 Specify the initial stack address, which may be a symbol or numeric value,
9713 @samp{__stack} is the default.
9714
9715 @item -mno-interrupts
9716 @opindex mno-interrupts
9717 Generated code is not compatible with hardware interrupts.
9718 Code size will be smaller.
9719
9720 @item -mcall-prologues
9721 @opindex mcall-prologues
9722 Functions prologues/epilogues expanded as call to appropriate
9723 subroutines.  Code size will be smaller.
9724
9725 @item -mno-tablejump
9726 @opindex mno-tablejump
9727 Do not generate tablejump insns which sometimes increase code size.
9728
9729 @item -mtiny-stack
9730 @opindex mtiny-stack
9731 Change only the low 8 bits of the stack pointer.
9732 @end table
9733
9734 @node MCore Options
9735 @subsection MCore Options
9736 @cindex MCore options
9737
9738 These are the @samp{-m} options defined for the Motorola M*Core
9739 processors.
9740
9741 @table @gcctabopt
9742
9743 @item -mhardlit
9744 @itemx -mno-hardlit
9745 @opindex mhardlit
9746 @opindex mno-hardlit
9747 Inline constants into the code stream if it can be done in two
9748 instructions or less.
9749
9750 @item -mdiv
9751 @itemx -mno-div
9752 @opindex mdiv
9753 @opindex mno-div
9754 Use the divide instruction.  (Enabled by default).
9755
9756 @item -mrelax-immediate
9757 @itemx -mno-relax-immediate
9758 @opindex mrelax-immediate
9759 @opindex mno-relax-immediate
9760 Allow arbitrary sized immediates in bit operations.
9761
9762 @item -mwide-bitfields
9763 @itemx -mno-wide-bitfields
9764 @opindex mwide-bitfields
9765 @opindex mno-wide-bitfields
9766 Always treat bit-fields as int-sized.
9767
9768 @item -m4byte-functions
9769 @itemx -mno-4byte-functions
9770 @opindex m4byte-functions
9771 @opindex mno-4byte-functions
9772 Force all functions to be aligned to a four byte boundary.
9773
9774 @item -mcallgraph-data
9775 @itemx -mno-callgraph-data
9776 @opindex mcallgraph-data
9777 @opindex mno-callgraph-data
9778 Emit callgraph information.
9779
9780 @item -mslow-bytes
9781 @itemx -mno-slow-bytes
9782 @opindex mslow-bytes
9783 @opindex mno-slow-bytes
9784 Prefer word access when reading byte quantities.
9785
9786 @item -mlittle-endian
9787 @itemx -mbig-endian
9788 @opindex mlittle-endian
9789 @opindex mbig-endian
9790 Generate code for a little endian target.
9791
9792 @item -m210
9793 @itemx -m340
9794 @opindex m210
9795 @opindex m340
9796 Generate code for the 210 processor.
9797 @end table
9798
9799 @node IA-64 Options
9800 @subsection IA-64 Options
9801 @cindex IA-64 Options
9802
9803 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9804
9805 @table @gcctabopt
9806 @item -mbig-endian
9807 @opindex mbig-endian
9808 Generate code for a big endian target.  This is the default for HP-UX@.
9809
9810 @item -mlittle-endian
9811 @opindex mlittle-endian
9812 Generate code for a little endian target.  This is the default for AIX5
9813 and GNU/Linux.
9814
9815 @item -mgnu-as
9816 @itemx -mno-gnu-as
9817 @opindex mgnu-as
9818 @opindex mno-gnu-as
9819 Generate (or don't) code for the GNU assembler.  This is the default.
9820 @c Also, this is the default if the configure option @option{--with-gnu-as}
9821 @c is used.
9822
9823 @item -mgnu-ld
9824 @itemx -mno-gnu-ld
9825 @opindex mgnu-ld
9826 @opindex mno-gnu-ld
9827 Generate (or don't) code for the GNU linker.  This is the default.
9828 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9829 @c is used.
9830
9831 @item -mno-pic
9832 @opindex mno-pic
9833 Generate code that does not use a global pointer register.  The result
9834 is not position independent code, and violates the IA-64 ABI@.
9835
9836 @item -mvolatile-asm-stop
9837 @itemx -mno-volatile-asm-stop
9838 @opindex mvolatile-asm-stop
9839 @opindex mno-volatile-asm-stop
9840 Generate (or don't) a stop bit immediately before and after volatile asm
9841 statements.
9842
9843 @item -mb-step
9844 @opindex mb-step
9845 Generate code that works around Itanium B step errata.
9846
9847 @item -mregister-names
9848 @itemx -mno-register-names
9849 @opindex mregister-names
9850 @opindex mno-register-names
9851 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9852 the stacked registers.  This may make assembler output more readable.
9853
9854 @item -mno-sdata
9855 @itemx -msdata
9856 @opindex mno-sdata
9857 @opindex msdata
9858 Disable (or enable) optimizations that use the small data section.  This may
9859 be useful for working around optimizer bugs.
9860
9861 @item -mconstant-gp
9862 @opindex mconstant-gp
9863 Generate code that uses a single constant global pointer value.  This is
9864 useful when compiling kernel code.
9865
9866 @item -mauto-pic
9867 @opindex mauto-pic
9868 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9869 This is useful when compiling firmware code.
9870
9871 @item -minline-float-divide-min-latency
9872 @opindex minline-float-divide-min-latency
9873 Generate code for inline divides of floating point values
9874 using the minimum latency algorithm.
9875
9876 @item -minline-float-divide-max-throughput
9877 @opindex minline-float-divide-max-throughput
9878 Generate code for inline divides of floating point values
9879 using the maximum throughput algorithm.
9880
9881 @item -minline-int-divide-min-latency
9882 @opindex minline-int-divide-min-latency
9883 Generate code for inline divides of integer values
9884 using the minimum latency algorithm.
9885
9886 @item -minline-int-divide-max-throughput
9887 @opindex minline-int-divide-max-throughput
9888 Generate code for inline divides of integer values
9889 using the maximum throughput algorithm.
9890
9891 @item -mno-dwarf2-asm
9892 @itemx -mdwarf2-asm
9893 @opindex mno-dwarf2-asm
9894 @opindex mdwarf2-asm
9895 Don't (or do) generate assembler code for the DWARF2 line number debugging
9896 info.  This may be useful when not using the GNU assembler.
9897
9898 @item -mfixed-range=@var{register-range}
9899 @opindex mfixed-range
9900 Generate code treating the given register range as fixed registers.
9901 A fixed register is one that the register allocator can not use.  This is
9902 useful when compiling kernel code.  A register range is specified as
9903 two registers separated by a dash.  Multiple register ranges can be
9904 specified separated by a comma.
9905
9906 @item -mearly-stop-bits
9907 @itemx -mno-early-stop-bits
9908 @opindex mearly-stop-bits
9909 @opindex mno-early-stop-bits
9910 Allow stop bits to be placed earlier than immediately preceding the
9911 instruction that triggered the stop bit.  This can improve instruction
9912 scheduling, but does not always do so.
9913 @end table
9914
9915 @node S/390 and zSeries Options
9916 @subsection S/390 and zSeries Options
9917 @cindex S/390 and zSeries Options
9918
9919 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9920
9921 @table @gcctabopt
9922 @item -mhard-float
9923 @itemx -msoft-float
9924 @opindex mhard-float
9925 @opindex msoft-float
9926 Use (do not use) the hardware floating-point instructions and registers
9927 for floating-point operations.  When @option{-msoft-float} is specified,
9928 functions in @file{libgcc.a} will be used to perform floating-point
9929 operations.  When @option{-mhard-float} is specified, the compiler
9930 generates IEEE floating-point instructions.  This is the default.
9931
9932 @item -mbackchain
9933 @itemx -mno-backchain
9934 @opindex mbackchain
9935 @opindex mno-backchain
9936 Generate (or do not generate) code which maintains an explicit
9937 backchain within the stack frame that points to the caller's frame.
9938 This may be needed to allow debugging using tools that do not understand
9939 DWARF-2 call frame information.  The default is not to generate the
9940 backchain.
9941
9942 @item -msmall-exec
9943 @itemx -mno-small-exec
9944 @opindex msmall-exec
9945 @opindex mno-small-exec
9946 Generate (or do not generate) code using the @code{bras} instruction
9947 to do subroutine calls.
9948 This only works reliably if the total executable size does not
9949 exceed 64k.  The default is to use the @code{basr} instruction instead,
9950 which does not have this limitation.
9951
9952 @item -m64
9953 @itemx -m31
9954 @opindex m64
9955 @opindex m31
9956 When @option{-m31} is specified, generate code compliant to the
9957 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
9958 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
9959 particular to generate 64-bit instructions.  For the @samp{s390}
9960 targets, the default is @option{-m31}, while the @samp{s390x}
9961 targets default to @option{-m64}.
9962
9963 @item -mzarch
9964 @itemx -mesa
9965 @opindex mzarch
9966 @opindex mesa
9967 When @option{-mzarch} is specified, generate code using the
9968 instructions available on z/Architecture.
9969 When @option{-mesa} is specified, generate code using the
9970 instructions available on ESA/390. Note that @option{-mesa} is
9971 not possible with @option{-m64}.
9972 When generating code compliant to the GNU/Linux for S/390 ABI,
9973 the default is @option{-mesa}.  When generating code compliant
9974 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
9975
9976 @item -mmvcle
9977 @itemx -mno-mvcle
9978 @opindex mmvcle
9979 @opindex mno-mvcle
9980 Generate (or do not generate) code using the @code{mvcle} instruction
9981 to perform block moves.  When @option{-mno-mvcle} is specified,
9982 use a @code{mvc} loop instead.  This is the default.
9983
9984 @item -mdebug
9985 @itemx -mno-debug
9986 @opindex mdebug
9987 @opindex mno-debug
9988 Print (or do not print) additional debug information when compiling.
9989 The default is to not print debug information.
9990
9991 @item -march=@var{cpu-type}
9992 @opindex march
9993 Generate code that will run on @var{cpu-type}, which is the name of a system
9994 representing a certain processor type. Possible values for
9995 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
9996 When generating code using the instructions available on z/Architecture,
9997 the default is @option{-march=z900}.  Otherwise, the default is
9998 @option{-march=g5}.
9999
10000 @item -mtune=@var{cpu-type}
10001 @opindex mtune
10002 Tune to @var{cpu-type} everything applicable about the generated code,
10003 except for the ABI and the set of available instructions.
10004 The list of @var{cpu-type} values is the same as for @option{-march}.
10005 The default is the value used for @option{-march}.
10006
10007 @item -mfused-madd
10008 @itemx -mno-fused-madd
10009 @opindex mfused-madd
10010 @opindex mno-fused-madd
10011 Generate code that uses (does not use) the floating point multiply and
10012 accumulate instructions.  These instructions are generated by default if
10013 hardware floating point is used.
10014 @end table
10015
10016 @node CRIS Options
10017 @subsection CRIS Options
10018 @cindex CRIS Options
10019
10020 These options are defined specifically for the CRIS ports.
10021
10022 @table @gcctabopt
10023 @item -march=@var{architecture-type}
10024 @itemx -mcpu=@var{architecture-type}
10025 @opindex march
10026 @opindex mcpu
10027 Generate code for the specified architecture.  The choices for
10028 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10029 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
10030 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10031 @samp{v10}.
10032
10033 @item -mtune=@var{architecture-type}
10034 @opindex mtune
10035 Tune to @var{architecture-type} everything applicable about the generated
10036 code, except for the ABI and the set of available instructions.  The
10037 choices for @var{architecture-type} are the same as for
10038 @option{-march=@var{architecture-type}}.
10039
10040 @item -mmax-stack-frame=@var{n}
10041 @opindex mmax-stack-frame
10042 Warn when the stack frame of a function exceeds @var{n} bytes.
10043
10044 @item -melinux-stacksize=@var{n}
10045 @opindex melinux-stacksize
10046 Only available with the @samp{cris-axis-aout} target.  Arranges for
10047 indications in the program to the kernel loader that the stack of the
10048 program should be set to @var{n} bytes.
10049
10050 @item -metrax4
10051 @itemx -metrax100
10052 @opindex metrax4
10053 @opindex metrax100
10054 The options @option{-metrax4} and @option{-metrax100} are synonyms for
10055 @option{-march=v3} and @option{-march=v8} respectively.
10056
10057 @item -mpdebug
10058 @opindex mpdebug
10059 Enable CRIS-specific verbose debug-related information in the assembly
10060 code.  This option also has the effect to turn off the @samp{#NO_APP}
10061 formatted-code indicator to the assembler at the beginning of the
10062 assembly file.
10063
10064 @item -mcc-init
10065 @opindex mcc-init
10066 Do not use condition-code results from previous instruction; always emit
10067 compare and test instructions before use of condition codes.
10068
10069 @item -mno-side-effects
10070 @opindex mno-side-effects
10071 Do not emit instructions with side-effects in addressing modes other than
10072 post-increment.
10073
10074 @item -mstack-align
10075 @itemx -mno-stack-align
10076 @itemx -mdata-align
10077 @itemx -mno-data-align
10078 @itemx -mconst-align
10079 @itemx -mno-const-align
10080 @opindex mstack-align
10081 @opindex mno-stack-align
10082 @opindex mdata-align
10083 @opindex mno-data-align
10084 @opindex mconst-align
10085 @opindex mno-const-align
10086 These options (no-options) arranges (eliminate arrangements) for the
10087 stack-frame, individual data and constants to be aligned for the maximum
10088 single data access size for the chosen CPU model.  The default is to
10089 arrange for 32-bit alignment.  ABI details such as structure layout are
10090 not affected by these options.
10091
10092 @item -m32-bit
10093 @itemx -m16-bit
10094 @itemx -m8-bit
10095 @opindex m32-bit
10096 @opindex m16-bit
10097 @opindex m8-bit
10098 Similar to the stack- data- and const-align options above, these options
10099 arrange for stack-frame, writable data and constants to all be 32-bit,
10100 16-bit or 8-bit aligned.  The default is 32-bit alignment.
10101
10102 @item -mno-prologue-epilogue
10103 @itemx -mprologue-epilogue
10104 @opindex mno-prologue-epilogue
10105 @opindex mprologue-epilogue
10106 With @option{-mno-prologue-epilogue}, the normal function prologue and
10107 epilogue that sets up the stack-frame are omitted and no return
10108 instructions or return sequences are generated in the code.  Use this
10109 option only together with visual inspection of the compiled code: no
10110 warnings or errors are generated when call-saved registers must be saved,
10111 or storage for local variable needs to be allocated.
10112
10113 @item -mno-gotplt
10114 @itemx -mgotplt
10115 @opindex mno-gotplt
10116 @opindex mgotplt
10117 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10118 instruction sequences that load addresses for functions from the PLT part
10119 of the GOT rather than (traditional on other architectures) calls to the
10120 PLT.  The default is @option{-mgotplt}.
10121
10122 @item -maout
10123 @opindex maout
10124 Legacy no-op option only recognized with the cris-axis-aout target.
10125
10126 @item -melf
10127 @opindex melf
10128 Legacy no-op option only recognized with the cris-axis-elf and
10129 cris-axis-linux-gnu targets.
10130
10131 @item -melinux
10132 @opindex melinux
10133 Only recognized with the cris-axis-aout target, where it selects a
10134 GNU/linux-like multilib, include files and instruction set for
10135 @option{-march=v8}.
10136
10137 @item -mlinux
10138 @opindex mlinux
10139 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10140
10141 @item -sim
10142 @opindex sim
10143 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
10144 to link with input-output functions from a simulator library.  Code,
10145 initialized data and zero-initialized data are allocated consecutively.
10146
10147 @item -sim2
10148 @opindex sim2
10149 Like @option{-sim}, but pass linker options to locate initialized data at
10150 0x40000000 and zero-initialized data at 0x80000000.
10151 @end table
10152
10153 @node MMIX Options
10154 @subsection MMIX Options
10155 @cindex MMIX Options
10156
10157 These options are defined for the MMIX:
10158
10159 @table @gcctabopt
10160 @item -mlibfuncs
10161 @itemx -mno-libfuncs
10162 @opindex mlibfuncs
10163 @opindex mno-libfuncs
10164 Specify that intrinsic library functions are being compiled, passing all
10165 values in registers, no matter the size.
10166
10167 @item -mepsilon
10168 @itemx -mno-epsilon
10169 @opindex mepsilon
10170 @opindex mno-epsilon
10171 Generate floating-point comparison instructions that compare with respect
10172 to the @code{rE} epsilon register.
10173
10174 @item -mabi=mmixware
10175 @itemx -mabi=gnu
10176 @opindex mabi-mmixware
10177 @opindex mabi=gnu
10178 Generate code that passes function parameters and return values that (in
10179 the called function) are seen as registers @code{$0} and up, as opposed to
10180 the GNU ABI which uses global registers @code{$231} and up.
10181
10182 @item -mzero-extend
10183 @itemx -mno-zero-extend
10184 @opindex mzero-extend
10185 @opindex mno-zero-extend
10186 When reading data from memory in sizes shorter than 64 bits, use (do not
10187 use) zero-extending load instructions by default, rather than
10188 sign-extending ones.
10189
10190 @item -mknuthdiv
10191 @itemx -mno-knuthdiv
10192 @opindex mknuthdiv
10193 @opindex mno-knuthdiv
10194 Make the result of a division yielding a remainder have the same sign as
10195 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10196 remainder follows the sign of the dividend.  Both methods are
10197 arithmetically valid, the latter being almost exclusively used.
10198
10199 @item -mtoplevel-symbols
10200 @itemx -mno-toplevel-symbols
10201 @opindex mtoplevel-symbols
10202 @opindex mno-toplevel-symbols
10203 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10204 code can be used with the @code{PREFIX} assembly directive.
10205
10206 @item -melf
10207 @opindex melf
10208 Generate an executable in the ELF format, rather than the default
10209 @samp{mmo} format used by the @command{mmix} simulator.
10210
10211 @item -mbranch-predict
10212 @itemx -mno-branch-predict
10213 @opindex mbranch-predict
10214 @opindex mno-branch-predict
10215 Use (do not use) the probable-branch instructions, when static branch
10216 prediction indicates a probable branch.
10217
10218 @item -mbase-addresses
10219 @itemx -mno-base-addresses
10220 @opindex mbase-addresses
10221 @opindex mno-base-addresses
10222 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10223 base address automatically generates a request (handled by the assembler
10224 and the linker) for a constant to be set up in a global register.  The
10225 register is used for one or more base address requests within the range 0
10226 to 255 from the value held in the register.  The generally leads to short
10227 and fast code, but the number of different data items that can be
10228 addressed is limited.  This means that a program that uses lots of static
10229 data may require @option{-mno-base-addresses}.
10230
10231 @item -msingle-exit
10232 @itemx -mno-single-exit
10233 @opindex msingle-exit
10234 @opindex mno-single-exit
10235 Force (do not force) generated code to have a single exit point in each
10236 function.
10237 @end table
10238
10239 @node PDP-11 Options
10240 @subsection PDP-11 Options
10241 @cindex PDP-11 Options
10242
10243 These options are defined for the PDP-11:
10244
10245 @table @gcctabopt
10246 @item -mfpu
10247 @opindex mfpu
10248 Use hardware FPP floating point.  This is the default.  (FIS floating
10249 point on the PDP-11/40 is not supported.)
10250
10251 @item -msoft-float
10252 @opindex msoft-float
10253 Do not use hardware floating point.
10254
10255 @item -mac0
10256 @opindex mac0
10257 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10258
10259 @item -mno-ac0
10260 @opindex mno-ac0
10261 Return floating-point results in memory.  This is the default.
10262
10263 @item -m40
10264 @opindex m40
10265 Generate code for a PDP-11/40.
10266
10267 @item -m45
10268 @opindex m45
10269 Generate code for a PDP-11/45.  This is the default.
10270
10271 @item -m10
10272 @opindex m10
10273 Generate code for a PDP-11/10.
10274
10275 @item -mbcopy-builtin
10276 @opindex bcopy-builtin
10277 Use inline @code{movstrhi} patterns for copying memory.  This is the
10278 default.
10279
10280 @item -mbcopy
10281 @opindex mbcopy
10282 Do not use inline @code{movstrhi} patterns for copying memory.
10283
10284 @item -mint16
10285 @itemx -mno-int32
10286 @opindex mint16
10287 @opindex mno-int32
10288 Use 16-bit @code{int}.  This is the default.
10289
10290 @item -mint32
10291 @itemx -mno-int16
10292 @opindex mint32
10293 @opindex mno-int16
10294 Use 32-bit @code{int}.
10295
10296 @item -mfloat64
10297 @itemx -mno-float32
10298 @opindex mfloat64
10299 @opindex mno-float32
10300 Use 64-bit @code{float}.  This is the default.
10301
10302 @item -mfloat32
10303 @itemx -mno-float64
10304 @opindex mfloat32
10305 @opindex mno-float64
10306 Use 32-bit @code{float}.
10307
10308 @item -mabshi
10309 @opindex mabshi
10310 Use @code{abshi2} pattern.  This is the default.
10311
10312 @item -mno-abshi
10313 @opindex mno-abshi
10314 Do not use @code{abshi2} pattern.
10315
10316 @item -mbranch-expensive
10317 @opindex mbranch-expensive
10318 Pretend that branches are expensive.  This is for experimenting with
10319 code generation only.
10320
10321 @item -mbranch-cheap
10322 @opindex mbranch-cheap
10323 Do not pretend that branches are expensive.  This is the default.
10324
10325 @item -msplit
10326 @opindex msplit
10327 Generate code for a system with split I&D.
10328
10329 @item -mno-split
10330 @opindex mno-split
10331 Generate code for a system without split I&D.  This is the default.
10332
10333 @item -munix-asm
10334 @opindex munix-asm
10335 Use Unix assembler syntax.  This is the default when configured for
10336 @samp{pdp11-*-bsd}.
10337
10338 @item -mdec-asm
10339 @opindex mdec-asm
10340 Use DEC assembler syntax.  This is the default when configured for any
10341 PDP-11 target other than @samp{pdp11-*-bsd}.
10342 @end table
10343
10344 @node Xstormy16 Options
10345 @subsection Xstormy16 Options
10346 @cindex Xstormy16 Options
10347
10348 These options are defined for Xstormy16:
10349
10350 @table @gcctabopt
10351 @item -msim
10352 @opindex msim
10353 Choose startup files and linker script suitable for the simulator.
10354 @end table
10355
10356 @node FRV Options
10357 @subsection FRV Options
10358 @cindex FRV Options
10359
10360 @table @gcctabopt
10361 @item -mgpr-32
10362 @opindex mgpr-32
10363
10364 Only use the first 32 general purpose registers.
10365
10366 @item -mgpr-64
10367 @opindex mgpr-64
10368
10369 Use all 64 general purpose registers.
10370
10371 @item -mfpr-32
10372 @opindex mfpr-32
10373
10374 Use only the first 32 floating point registers.
10375
10376 @item -mfpr-64
10377 @opindex mfpr-64
10378
10379 Use all 64 floating point registers
10380
10381 @item -mhard-float
10382 @opindex mhard-float
10383
10384 Use hardware instructions for floating point operations.
10385
10386 @item -msoft-float
10387 @opindex msoft-float
10388
10389 Use library routines for floating point operations.
10390
10391 @item -malloc-cc
10392 @opindex malloc-cc
10393
10394 Dynamically allocate condition code registers.
10395
10396 @item -mfixed-cc
10397 @opindex mfixed-cc
10398
10399 Do not try to dynamically allocate condition code registers, only
10400 use @code{icc0} and @code{fcc0}.
10401
10402 @item -mdword
10403 @opindex mdword
10404
10405 Change ABI to use double word insns.
10406
10407 @item -mno-dword
10408 @opindex mno-dword
10409
10410 Do not use double word instructions.
10411
10412 @item -mdouble
10413 @opindex mdouble
10414
10415 Use floating point double instructions.
10416
10417 @item -mno-double
10418 @opindex mno-double
10419
10420 Do not use floating point double instructions.
10421
10422 @item -mmedia
10423 @opindex mmedia
10424
10425 Use media instructions.
10426
10427 @item -mno-media
10428 @opindex mno-media
10429
10430 Do not use media instructions.
10431
10432 @item -mmuladd
10433 @opindex mmuladd
10434
10435 Use multiply and add/subtract instructions.
10436
10437 @item -mno-muladd
10438 @opindex mno-muladd
10439
10440 Do not use multiply and add/subtract instructions.
10441
10442 @item -mlibrary-pic
10443 @opindex mlibrary-pic
10444
10445 Enable PIC support for building libraries
10446
10447 @item -macc-4
10448 @opindex macc-4
10449
10450 Use only the first four media accumulator registers.
10451
10452 @item -macc-8
10453 @opindex macc-8
10454
10455 Use all eight media accumulator registers.
10456
10457 @item -mpack
10458 @opindex mpack
10459
10460 Pack VLIW instructions.
10461
10462 @item -mno-pack
10463 @opindex mno-pack
10464
10465 Do not pack VLIW instructions.
10466
10467 @item -mno-eflags
10468 @opindex mno-eflags
10469
10470 Do not mark ABI switches in e_flags.
10471
10472 @item -mcond-move
10473 @opindex mcond-move
10474
10475 Enable the use of conditional-move instructions (default).
10476
10477 This switch is mainly for debugging the compiler and will likely be removed
10478 in a future version.
10479
10480 @item -mno-cond-move
10481 @opindex mno-cond-move
10482
10483 Disable the use of conditional-move instructions.
10484
10485 This switch is mainly for debugging the compiler and will likely be removed
10486 in a future version.
10487
10488 @item -mscc
10489 @opindex mscc
10490
10491 Enable the use of conditional set instructions (default).
10492
10493 This switch is mainly for debugging the compiler and will likely be removed
10494 in a future version.
10495
10496 @item -mno-scc
10497 @opindex mno-scc
10498
10499 Disable the use of conditional set instructions.
10500
10501 This switch is mainly for debugging the compiler and will likely be removed
10502 in a future version.
10503
10504 @item -mcond-exec
10505 @opindex mcond-exec
10506
10507 Enable the use of conditional execution (default).
10508
10509 This switch is mainly for debugging the compiler and will likely be removed
10510 in a future version.
10511
10512 @item -mno-cond-exec
10513 @opindex mno-cond-exec
10514
10515 Disable the use of conditional execution.
10516
10517 This switch is mainly for debugging the compiler and will likely be removed
10518 in a future version.
10519
10520 @item -mvliw-branch
10521 @opindex mvliw-branch
10522
10523 Run a pass to pack branches into VLIW instructions (default).
10524
10525 This switch is mainly for debugging the compiler and will likely be removed
10526 in a future version.
10527
10528 @item -mno-vliw-branch
10529 @opindex mno-vliw-branch
10530
10531 Do not run a pass to pack branches into VLIW instructions.
10532
10533 This switch is mainly for debugging the compiler and will likely be removed
10534 in a future version.
10535
10536 @item -mmulti-cond-exec
10537 @opindex mmulti-cond-exec
10538
10539 Enable optimization of @code{&&} and @code{||} in conditional execution
10540 (default).
10541
10542 This switch is mainly for debugging the compiler and will likely be removed
10543 in a future version.
10544
10545 @item -mno-multi-cond-exec
10546 @opindex mno-multi-cond-exec
10547
10548 Disable optimization of @code{&&} and @code{||} in conditional execution.
10549
10550 This switch is mainly for debugging the compiler and will likely be removed
10551 in a future version.
10552
10553 @item -mnested-cond-exec
10554 @opindex mnested-cond-exec
10555
10556 Enable nested conditional execution optimizations (default).
10557
10558 This switch is mainly for debugging the compiler and will likely be removed
10559 in a future version.
10560
10561 @item -mno-nested-cond-exec
10562 @opindex mno-nested-cond-exec
10563
10564 Disable nested conditional execution optimizations.
10565
10566 This switch is mainly for debugging the compiler and will likely be removed
10567 in a future version.
10568
10569 @item -mtomcat-stats
10570 @opindex mtomcat-stats
10571
10572 Cause gas to print out tomcat statistics.
10573
10574 @item -mcpu=@var{cpu}
10575 @opindex mcpu
10576
10577 Select the processor type for which to generate code.  Possible values are
10578 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
10579 @samp{frv}.
10580
10581 @end table
10582
10583 @node Xtensa Options
10584 @subsection Xtensa Options
10585 @cindex Xtensa Options
10586
10587 These options are supported for Xtensa targets:
10588
10589 @table @gcctabopt
10590 @item -mconst16
10591 @itemx -mno-const16
10592 @opindex mconst16
10593 @opindex mno-const16
10594 Enable or disable use of @code{CONST16} instructions for loading
10595 constant values.  The @code{CONST16} instruction is currently not a
10596 standard option from Tensilica.  When enabled, @code{CONST16}
10597 instructions are always used in place of the standard @code{L32R}
10598 instructions.  The use of @code{CONST16} is enabled by default only if
10599 the @code{L32R} instruction is not available.
10600
10601 @item -mfused-madd
10602 @itemx -mno-fused-madd
10603 @opindex mfused-madd
10604 @opindex mno-fused-madd
10605 Enable or disable use of fused multiply/add and multiply/subtract
10606 instructions in the floating-point option.  This has no effect if the
10607 floating-point option is not also enabled.  Disabling fused multiply/add
10608 and multiply/subtract instructions forces the compiler to use separate
10609 instructions for the multiply and add/subtract operations.  This may be
10610 desirable in some cases where strict IEEE 754-compliant results are
10611 required: the fused multiply add/subtract instructions do not round the
10612 intermediate result, thereby producing results with @emph{more} bits of
10613 precision than specified by the IEEE standard.  Disabling fused multiply
10614 add/subtract instructions also ensures that the program output is not
10615 sensitive to the compiler's ability to combine multiply and add/subtract
10616 operations.
10617
10618 @item -mtext-section-literals
10619 @itemx -mno-text-section-literals
10620 @opindex mtext-section-literals
10621 @opindex mno-text-section-literals
10622 Control the treatment of literal pools.  The default is
10623 @option{-mno-text-section-literals}, which places literals in a separate
10624 section in the output file.  This allows the literal pool to be placed
10625 in a data RAM/ROM, and it also allows the linker to combine literal
10626 pools from separate object files to remove redundant literals and
10627 improve code size.  With @option{-mtext-section-literals}, the literals
10628 are interspersed in the text section in order to keep them as close as
10629 possible to their references.  This may be necessary for large assembly
10630 files.
10631
10632 @item -mtarget-align
10633 @itemx -mno-target-align
10634 @opindex mtarget-align
10635 @opindex mno-target-align
10636 When this option is enabled, GCC instructs the assembler to
10637 automatically align instructions to reduce branch penalties at the
10638 expense of some code density.  The assembler attempts to widen density
10639 instructions to align branch targets and the instructions following call
10640 instructions.  If there are not enough preceding safe density
10641 instructions to align a target, no widening will be performed.  The
10642 default is @option{-mtarget-align}.  These options do not affect the
10643 treatment of auto-aligned instructions like @code{LOOP}, which the
10644 assembler will always align, either by widening density instructions or
10645 by inserting no-op instructions.
10646
10647 @item -mlongcalls
10648 @itemx -mno-longcalls
10649 @opindex mlongcalls
10650 @opindex mno-longcalls
10651 When this option is enabled, GCC instructs the assembler to translate
10652 direct calls to indirect calls unless it can determine that the target
10653 of a direct call is in the range allowed by the call instruction.  This
10654 translation typically occurs for calls to functions in other source
10655 files.  Specifically, the assembler translates a direct @code{CALL}
10656 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
10657 The default is @option{-mno-longcalls}.  This option should be used in
10658 programs where the call target can potentially be out of range.  This
10659 option is implemented in the assembler, not the compiler, so the
10660 assembly code generated by GCC will still show direct call
10661 instructions---look at the disassembled object code to see the actual
10662 instructions.  Note that the assembler will use an indirect call for
10663 every cross-file call, not just those that really will be out of range.
10664 @end table
10665
10666 @node Code Gen Options
10667 @section Options for Code Generation Conventions
10668 @cindex code generation conventions
10669 @cindex options, code generation
10670 @cindex run-time options
10671
10672 These machine-independent options control the interface conventions
10673 used in code generation.
10674
10675 Most of them have both positive and negative forms; the negative form
10676 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
10677 one of the forms is listed---the one which is not the default.  You
10678 can figure out the other form by either removing @samp{no-} or adding
10679 it.
10680
10681 @table @gcctabopt
10682 @item -fbounds-check
10683 @opindex fbounds-check
10684 For front-ends that support it, generate additional code to check that
10685 indices used to access arrays are within the declared range.  This is
10686 currently only supported by the Java and Fortran 77 front-ends, where
10687 this option defaults to true and false respectively.
10688
10689 @item -ftrapv
10690 @opindex ftrapv
10691 This option generates traps for signed overflow on addition, subtraction,
10692 multiplication operations.
10693
10694 @item -fwrapv
10695 @opindex fwrapv
10696 This option instructs the compiler to assume that signed arithmetic
10697 overflow of addition, subtraction and multiplication wraps around
10698 using twos-complement representation.  This flag enables some optimizations
10699 and disables other.  This option is enabled by default for the Java
10700 front-end, as required by the Java language specification.
10701
10702 @item -fexceptions
10703 @opindex fexceptions
10704 Enable exception handling.  Generates extra code needed to propagate
10705 exceptions.  For some targets, this implies GCC will generate frame
10706 unwind information for all functions, which can produce significant data
10707 size overhead, although it does not affect execution.  If you do not
10708 specify this option, GCC will enable it by default for languages like
10709 C++ which normally require exception handling, and disable it for
10710 languages like C that do not normally require it.  However, you may need
10711 to enable this option when compiling C code that needs to interoperate
10712 properly with exception handlers written in C++.  You may also wish to
10713 disable this option if you are compiling older C++ programs that don't
10714 use exception handling.
10715
10716 @item -fnon-call-exceptions
10717 @opindex fnon-call-exceptions
10718 Generate code that allows trapping instructions to throw exceptions.
10719 Note that this requires platform-specific runtime support that does
10720 not exist everywhere.  Moreover, it only allows @emph{trapping}
10721 instructions to throw exceptions, i.e.@: memory references or floating
10722 point instructions.  It does not allow exceptions to be thrown from
10723 arbitrary signal handlers such as @code{SIGALRM}.
10724
10725 @item -funwind-tables
10726 @opindex funwind-tables
10727 Similar to @option{-fexceptions}, except that it will just generate any needed
10728 static data, but will not affect the generated code in any other way.
10729 You will normally not enable this option; instead, a language processor
10730 that needs this handling would enable it on your behalf.
10731
10732 @item -fasynchronous-unwind-tables
10733 @opindex funwind-tables
10734 Generate unwind table in dwarf2 format, if supported by target machine.  The
10735 table is exact at each instruction boundary, so it can be used for stack
10736 unwinding from asynchronous events (such as debugger or garbage collector).
10737
10738 @item -fpcc-struct-return
10739 @opindex fpcc-struct-return
10740 Return ``short'' @code{struct} and @code{union} values in memory like
10741 longer ones, rather than in registers.  This convention is less
10742 efficient, but it has the advantage of allowing intercallability between
10743 GCC-compiled files and files compiled with other compilers, particularly
10744 the Portable C Compiler (pcc).
10745
10746 The precise convention for returning structures in memory depends
10747 on the target configuration macros.
10748
10749 Short structures and unions are those whose size and alignment match
10750 that of some integer type.
10751
10752 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
10753 switch is not binary compatible with code compiled with the
10754 @option{-freg-struct-return} switch.
10755 Use it to conform to a non-default application binary interface.
10756
10757 @item -freg-struct-return
10758 @opindex freg-struct-return
10759 Return @code{struct} and @code{union} values in registers when possible.
10760 This is more efficient for small structures than
10761 @option{-fpcc-struct-return}.
10762
10763 If you specify neither @option{-fpcc-struct-return} nor
10764 @option{-freg-struct-return}, GCC defaults to whichever convention is
10765 standard for the target.  If there is no standard convention, GCC
10766 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
10767 the principal compiler.  In those cases, we can choose the standard, and
10768 we chose the more efficient register return alternative.
10769
10770 @strong{Warning:} code compiled with the @option{-freg-struct-return}
10771 switch is not binary compatible with code compiled with the
10772 @option{-fpcc-struct-return} switch.
10773 Use it to conform to a non-default application binary interface.
10774
10775 @item -fshort-enums
10776 @opindex fshort-enums
10777 Allocate to an @code{enum} type only as many bytes as it needs for the
10778 declared range of possible values.  Specifically, the @code{enum} type
10779 will be equivalent to the smallest integer type which has enough room.
10780
10781 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
10782 code that is not binary compatible with code generated without that switch.
10783 Use it to conform to a non-default application binary interface.
10784
10785 @item -fshort-double
10786 @opindex fshort-double
10787 Use the same size for @code{double} as for @code{float}.
10788
10789 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
10790 code that is not binary compatible with code generated without that switch.
10791 Use it to conform to a non-default application binary interface.
10792
10793 @item -fshort-wchar
10794 @opindex fshort-wchar
10795 Override the underlying type for @samp{wchar_t} to be @samp{short
10796 unsigned int} instead of the default for the target.  This option is
10797 useful for building programs to run under WINE@.
10798
10799 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
10800 code that is not binary compatible with code generated without that switch.
10801 Use it to conform to a non-default application binary interface.
10802
10803 @item -fshared-data
10804 @opindex fshared-data
10805 Requests that the data and non-@code{const} variables of this
10806 compilation be shared data rather than private data.  The distinction
10807 makes sense only on certain operating systems, where shared data is
10808 shared between processes running the same program, while private data
10809 exists in one copy per process.
10810
10811 @item -fno-common
10812 @opindex fno-common
10813 In C, allocate even uninitialized global variables in the data section of the
10814 object file, rather than generating them as common blocks.  This has the
10815 effect that if the same variable is declared (without @code{extern}) in
10816 two different compilations, you will get an error when you link them.
10817 The only reason this might be useful is if you wish to verify that the
10818 program will work on other systems which always work this way.
10819
10820 @item -fno-ident
10821 @opindex fno-ident
10822 Ignore the @samp{#ident} directive.
10823
10824 @item -finhibit-size-directive
10825 @opindex finhibit-size-directive
10826 Don't output a @code{.size} assembler directive, or anything else that
10827 would cause trouble if the function is split in the middle, and the
10828 two halves are placed at locations far apart in memory.  This option is
10829 used when compiling @file{crtstuff.c}; you should not need to use it
10830 for anything else.
10831
10832 @item -fverbose-asm
10833 @opindex fverbose-asm
10834 Put extra commentary information in the generated assembly code to
10835 make it more readable.  This option is generally only of use to those
10836 who actually need to read the generated assembly code (perhaps while
10837 debugging the compiler itself).
10838
10839 @option{-fno-verbose-asm}, the default, causes the
10840 extra information to be omitted and is useful when comparing two assembler
10841 files.
10842
10843 @item -fpic
10844 @opindex fpic
10845 @cindex global offset table
10846 @cindex PIC
10847 Generate position-independent code (PIC) suitable for use in a shared
10848 library, if supported for the target machine.  Such code accesses all
10849 constant addresses through a global offset table (GOT)@.  The dynamic
10850 loader resolves the GOT entries when the program starts (the dynamic
10851 loader is not part of GCC; it is part of the operating system).  If
10852 the GOT size for the linked executable exceeds a machine-specific
10853 maximum size, you get an error message from the linker indicating that
10854 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
10855 instead.  (These maximums are 8k on the SPARC and 32k
10856 on the m68k and RS/6000.  The 386 has no such limit.)
10857
10858 Position-independent code requires special support, and therefore works
10859 only on certain machines.  For the 386, GCC supports PIC for System V
10860 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
10861 position-independent.
10862
10863 @item -fPIC
10864 @opindex fPIC
10865 If supported for the target machine, emit position-independent code,
10866 suitable for dynamic linking and avoiding any limit on the size of the
10867 global offset table.  This option makes a difference on the m68k
10868 and the SPARC.
10869
10870 Position-independent code requires special support, and therefore works
10871 only on certain machines.
10872
10873 @item -fpie
10874 @itemx -fPIE
10875 @opindex fpie
10876 @opindex fPIE
10877 These options are similar to @option{-fpic} and @option{-fPIC}, but
10878 generated position independent code can be only linked into executables.
10879 Usually these options are used when @option{-pie} GCC option will be
10880 used during linking.
10881
10882 @item -ffixed-@var{reg}
10883 @opindex ffixed
10884 Treat the register named @var{reg} as a fixed register; generated code
10885 should never refer to it (except perhaps as a stack pointer, frame
10886 pointer or in some other fixed role).
10887
10888 @var{reg} must be the name of a register.  The register names accepted
10889 are machine-specific and are defined in the @code{REGISTER_NAMES}
10890 macro in the machine description macro file.
10891
10892 This flag does not have a negative form, because it specifies a
10893 three-way choice.
10894
10895 @item -fcall-used-@var{reg}
10896 @opindex fcall-used
10897 Treat the register named @var{reg} as an allocable register that is
10898 clobbered by function calls.  It may be allocated for temporaries or
10899 variables that do not live across a call.  Functions compiled this way
10900 will not save and restore the register @var{reg}.
10901
10902 It is an error to used this flag with the frame pointer or stack pointer.
10903 Use of this flag for other registers that have fixed pervasive roles in
10904 the machine's execution model will produce disastrous results.
10905
10906 This flag does not have a negative form, because it specifies a
10907 three-way choice.
10908
10909 @item -fcall-saved-@var{reg}
10910 @opindex fcall-saved
10911 Treat the register named @var{reg} as an allocable register saved by
10912 functions.  It may be allocated even for temporaries or variables that
10913 live across a call.  Functions compiled this way will save and restore
10914 the register @var{reg} if they use it.
10915
10916 It is an error to used this flag with the frame pointer or stack pointer.
10917 Use of this flag for other registers that have fixed pervasive roles in
10918 the machine's execution model will produce disastrous results.
10919
10920 A different sort of disaster will result from the use of this flag for
10921 a register in which function values may be returned.
10922
10923 This flag does not have a negative form, because it specifies a
10924 three-way choice.
10925
10926 @item -fpack-struct
10927 @opindex fpack-struct
10928 Pack all structure members together without holes.
10929
10930 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
10931 code that is not binary compatible with code generated without that switch.
10932 Additionally, it makes the code suboptimal.
10933 Use it to conform to a non-default application binary interface.
10934
10935 @item -finstrument-functions
10936 @opindex finstrument-functions
10937 Generate instrumentation calls for entry and exit to functions.  Just
10938 after function entry and just before function exit, the following
10939 profiling functions will be called with the address of the current
10940 function and its call site.  (On some platforms,
10941 @code{__builtin_return_address} does not work beyond the current
10942 function, so the call site information may not be available to the
10943 profiling functions otherwise.)
10944
10945 @smallexample
10946 void __cyg_profile_func_enter (void *this_fn,
10947                                void *call_site);
10948 void __cyg_profile_func_exit  (void *this_fn,
10949                                void *call_site);
10950 @end smallexample
10951
10952 The first argument is the address of the start of the current function,
10953 which may be looked up exactly in the symbol table.
10954
10955 This instrumentation is also done for functions expanded inline in other
10956 functions.  The profiling calls will indicate where, conceptually, the
10957 inline function is entered and exited.  This means that addressable
10958 versions of such functions must be available.  If all your uses of a
10959 function are expanded inline, this may mean an additional expansion of
10960 code size.  If you use @samp{extern inline} in your C code, an
10961 addressable version of such functions must be provided.  (This is
10962 normally the case anyways, but if you get lucky and the optimizer always
10963 expands the functions inline, you might have gotten away without
10964 providing static copies.)
10965
10966 A function may be given the attribute @code{no_instrument_function}, in
10967 which case this instrumentation will not be done.  This can be used, for
10968 example, for the profiling functions listed above, high-priority
10969 interrupt routines, and any functions from which the profiling functions
10970 cannot safely be called (perhaps signal handlers, if the profiling
10971 routines generate output or allocate memory).
10972
10973 @item -fstack-check
10974 @opindex fstack-check
10975 Generate code to verify that you do not go beyond the boundary of the
10976 stack.  You should specify this flag if you are running in an
10977 environment with multiple threads, but only rarely need to specify it in
10978 a single-threaded environment since stack overflow is automatically
10979 detected on nearly all systems if there is only one stack.
10980
10981 Note that this switch does not actually cause checking to be done; the
10982 operating system must do that.  The switch causes generation of code
10983 to ensure that the operating system sees the stack being extended.
10984
10985 @item -fstack-limit-register=@var{reg}
10986 @itemx -fstack-limit-symbol=@var{sym}
10987 @itemx -fno-stack-limit
10988 @opindex fstack-limit-register
10989 @opindex fstack-limit-symbol
10990 @opindex fno-stack-limit
10991 Generate code to ensure that the stack does not grow beyond a certain value,
10992 either the value of a register or the address of a symbol.  If the stack
10993 would grow beyond the value, a signal is raised.  For most targets,
10994 the signal is raised before the stack overruns the boundary, so
10995 it is possible to catch the signal without taking special precautions.
10996
10997 For instance, if the stack starts at absolute address @samp{0x80000000}
10998 and grows downwards, you can use the flags
10999 @option{-fstack-limit-symbol=__stack_limit} and
11000 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11001 of 128KB@.  Note that this may only work with the GNU linker.
11002
11003 @cindex aliasing of parameters
11004 @cindex parameters, aliased
11005 @item -fargument-alias
11006 @itemx -fargument-noalias
11007 @itemx -fargument-noalias-global
11008 @opindex fargument-alias
11009 @opindex fargument-noalias
11010 @opindex fargument-noalias-global
11011 Specify the possible relationships among parameters and between
11012 parameters and global data.
11013
11014 @option{-fargument-alias} specifies that arguments (parameters) may
11015 alias each other and may alias global storage.@*
11016 @option{-fargument-noalias} specifies that arguments do not alias
11017 each other, but may alias global storage.@*
11018 @option{-fargument-noalias-global} specifies that arguments do not
11019 alias each other and do not alias global storage.
11020
11021 Each language will automatically use whatever option is required by
11022 the language standard.  You should not need to use these options yourself.
11023
11024 @item -fleading-underscore
11025 @opindex fleading-underscore
11026 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11027 change the way C symbols are represented in the object file.  One use
11028 is to help link with legacy assembly code.
11029
11030 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11031 generate code that is not binary compatible with code generated without that
11032 switch.  Use it to conform to a non-default application binary interface.
11033 Not all targets provide complete support for this switch.
11034
11035 @item -ftls-model=@var{model}
11036 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11037 The @var{model} argument should be one of @code{global-dynamic},
11038 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11039
11040 The default without @option{-fpic} is @code{initial-exec}; with
11041 @option{-fpic} the default is @code{global-dynamic}.
11042 @end table
11043
11044 @c man end
11045
11046 @node Environment Variables
11047 @section Environment Variables Affecting GCC
11048 @cindex environment variables
11049
11050 @c man begin ENVIRONMENT
11051 This section describes several environment variables that affect how GCC
11052 operates.  Some of them work by specifying directories or prefixes to use
11053 when searching for various kinds of files.  Some are used to specify other
11054 aspects of the compilation environment.
11055
11056 Note that you can also specify places to search using options such as
11057 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
11058 take precedence over places specified using environment variables, which
11059 in turn take precedence over those specified by the configuration of GCC@.
11060 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11061 GNU Compiler Collection (GCC) Internals}.
11062
11063 @table @env
11064 @item LANG
11065 @itemx LC_CTYPE
11066 @c @itemx LC_COLLATE
11067 @itemx LC_MESSAGES
11068 @c @itemx LC_MONETARY
11069 @c @itemx LC_NUMERIC
11070 @c @itemx LC_TIME
11071 @itemx LC_ALL
11072 @findex LANG
11073 @findex LC_CTYPE
11074 @c @findex LC_COLLATE
11075 @findex LC_MESSAGES
11076 @c @findex LC_MONETARY
11077 @c @findex LC_NUMERIC
11078 @c @findex LC_TIME
11079 @findex LC_ALL
11080 @cindex locale
11081 These environment variables control the way that GCC uses
11082 localization information that allow GCC to work with different
11083 national conventions.  GCC inspects the locale categories
11084 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
11085 so.  These locale categories can be set to any value supported by your
11086 installation.  A typical value is @samp{en_UK} for English in the United
11087 Kingdom.
11088
11089 The @env{LC_CTYPE} environment variable specifies character
11090 classification.  GCC uses it to determine the character boundaries in
11091 a string; this is needed for some multibyte encodings that contain quote
11092 and escape characters that would otherwise be interpreted as a string
11093 end or escape.
11094
11095 The @env{LC_MESSAGES} environment variable specifies the language to
11096 use in diagnostic messages.
11097
11098 If the @env{LC_ALL} environment variable is set, it overrides the value
11099 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11100 and @env{LC_MESSAGES} default to the value of the @env{LANG}
11101 environment variable.  If none of these variables are set, GCC
11102 defaults to traditional C English behavior.
11103
11104 @item TMPDIR
11105 @findex TMPDIR
11106 If @env{TMPDIR} is set, it specifies the directory to use for temporary
11107 files.  GCC uses temporary files to hold the output of one stage of
11108 compilation which is to be used as input to the next stage: for example,
11109 the output of the preprocessor, which is the input to the compiler
11110 proper.
11111
11112 @item GCC_EXEC_PREFIX
11113 @findex GCC_EXEC_PREFIX
11114 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
11115 names of the subprograms executed by the compiler.  No slash is added
11116 when this prefix is combined with the name of a subprogram, but you can
11117 specify a prefix that ends with a slash if you wish.
11118
11119 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
11120 an appropriate prefix to use based on the pathname it was invoked with.
11121
11122 If GCC cannot find the subprogram using the specified prefix, it
11123 tries looking in the usual places for the subprogram.
11124
11125 The default value of @env{GCC_EXEC_PREFIX} is
11126 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
11127 of @code{prefix} when you ran the @file{configure} script.
11128
11129 Other prefixes specified with @option{-B} take precedence over this prefix.
11130
11131 This prefix is also used for finding files such as @file{crt0.o} that are
11132 used for linking.
11133
11134 In addition, the prefix is used in an unusual way in finding the
11135 directories to search for header files.  For each of the standard
11136 directories whose name normally begins with @samp{/usr/local/lib/gcc}
11137 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
11138 replacing that beginning with the specified prefix to produce an
11139 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
11140 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
11141 These alternate directories are searched first; the standard directories
11142 come next.
11143
11144 @item COMPILER_PATH
11145 @findex COMPILER_PATH
11146 The value of @env{COMPILER_PATH} is a colon-separated list of
11147 directories, much like @env{PATH}.  GCC tries the directories thus
11148 specified when searching for subprograms, if it can't find the
11149 subprograms using @env{GCC_EXEC_PREFIX}.
11150
11151 @item LIBRARY_PATH
11152 @findex LIBRARY_PATH
11153 The value of @env{LIBRARY_PATH} is a colon-separated list of
11154 directories, much like @env{PATH}.  When configured as a native compiler,
11155 GCC tries the directories thus specified when searching for special
11156 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
11157 using GCC also uses these directories when searching for ordinary
11158 libraries for the @option{-l} option (but directories specified with
11159 @option{-L} come first).
11160
11161 @item LANG
11162 @findex LANG
11163 @cindex locale definition
11164 This variable is used to pass locale information to the compiler.  One way in
11165 which this information is used is to determine the character set to be used
11166 when character literals, string literals and comments are parsed in C and C++.
11167 When the compiler is configured to allow multibyte characters,
11168 the following values for @env{LANG} are recognized:
11169
11170 @table @samp
11171 @item C-JIS
11172 Recognize JIS characters.
11173 @item C-SJIS
11174 Recognize SJIS characters.
11175 @item C-EUCJP
11176 Recognize EUCJP characters.
11177 @end table
11178
11179 If @env{LANG} is not defined, or if it has some other value, then the
11180 compiler will use mblen and mbtowc as defined by the default locale to
11181 recognize and translate multibyte characters.
11182 @end table
11183
11184 @noindent
11185 Some additional environments variables affect the behavior of the
11186 preprocessor.
11187
11188 @include cppenv.texi
11189
11190 @c man end
11191
11192 @node Precompiled Headers
11193 @section Using Precompiled Headers
11194 @cindex precompiled headers
11195 @cindex speed of compilation
11196
11197 Often large projects have many header files that are included in every
11198 source file.  The time the compiler takes to process these header files
11199 over and over again can account for nearly all of the time required to
11200 build the project.  To make builds faster, GCC allows users to
11201 `precompile' a header file; then, if builds can use the precompiled
11202 header file they will be much faster.
11203
11204 To create a precompiled header file, simply compile it as you would any
11205 other file, if necessary using the @option{-x} option to make the driver
11206 treat it as a C or C++ header file.  You will probably want to use a
11207 tool like @command{make} to keep the precompiled header up-to-date when
11208 the headers it contains change.
11209
11210 A precompiled header file will be searched for when @code{#include} is
11211 seen in the compilation.  As it searches for the included file
11212 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
11213 compiler looks for a precompiled header in each directory just before it
11214 looks for the include file in that directory.  The name searched for is
11215 the name specified in the @code{#include} with @samp{.gch} appended.  If
11216 the precompiled header file can't be used, it is ignored.
11217
11218 For instance, if you have @code{#include "all.h"}, and you have
11219 @file{all.h.gch} in the same directory as @file{all.h}, then the
11220 precompiled header file will be used if possible, and the original
11221 header will be used otherwise.
11222
11223 Alternatively, you might decide to put the precompiled header file in a
11224 directory and use @option{-I} to ensure that directory is searched
11225 before (or instead of) the directory containing the original header.
11226 Then, if you want to check that the precompiled header file is always
11227 used, you can put a file of the same name as the original header in this
11228 directory containing an @code{#error} command.
11229
11230 This also works with @option{-include}.  So yet another way to use
11231 precompiled headers, good for projects not designed with precompiled
11232 header files in mind, is to simply take most of the header files used by
11233 a project, include them from another header file, precompile that header
11234 file, and @option{-include} the precompiled header.  If the header files
11235 have guards against multiple inclusion, they will be skipped because
11236 they've already been included (in the precompiled header).
11237
11238 If you need to precompile the same header file for different
11239 languages, targets, or compiler options, you can instead make a
11240 @emph{directory} named like @file{all.h.gch}, and put each precompiled
11241 header in the directory.  (It doesn't matter what you call the files
11242 in the directory, every precompiled header in the directory will be
11243 considered.)  The first precompiled header encountered in the
11244 directory that is valid for this compilation will be used; they're
11245 searched in no particular order.
11246
11247 There are many other possibilities, limited only by your imagination,
11248 good sense, and the constraints of your build system.
11249
11250 A precompiled header file can be used only when these conditions apply:
11251
11252 @itemize
11253 @item
11254 Only one precompiled header can be used in a particular compilation.
11255 @item
11256 A precompiled header can't be used once the first C token is seen.  You
11257 can have preprocessor directives before a precompiled header; you can
11258 even include a precompiled header from inside another header, so long as
11259 there are no C tokens before the @code{#include}.
11260 @item
11261 The precompiled header file must be produced for the same language as
11262 the current compilation.  You can't use a C precompiled header for a C++
11263 compilation.
11264 @item
11265 The precompiled header file must be produced by the same compiler
11266 version and configuration as the current compilation is using.
11267 The easiest way to guarantee this is to use the same compiler binary
11268 for creating and using precompiled headers.
11269 @item
11270 Any macros defined before the precompiled header (including with
11271 @option{-D}) must either be defined in the same way as when the
11272 precompiled header was generated, or must not affect the precompiled
11273 header, which usually means that the they don't appear in the
11274 precompiled header at all.
11275 @item
11276 Certain command-line options must be defined in the same way as when the
11277 precompiled header was generated.  At present, it's not clear which
11278 options are safe to change and which are not; the safest choice is to
11279 use exactly the same options when generating and using the precompiled
11280 header.
11281 @end itemize
11282
11283 For all of these but the last, the compiler will automatically ignore
11284 the precompiled header if the conditions aren't met.  For the last item,
11285 some option changes will cause the precompiled header to be rejected,
11286 but not all incompatible option combinations have yet been found.  If
11287 you find a new incompatible combination, please consider filing a bug
11288 report, see @ref{Bugs}.
11289
11290 @node Running Protoize
11291 @section Running Protoize
11292
11293 The program @code{protoize} is an optional part of GCC@.  You can use
11294 it to add prototypes to a program, thus converting the program to ISO
11295 C in one respect.  The companion program @code{unprotoize} does the
11296 reverse: it removes argument types from any prototypes that are found.
11297
11298 When you run these programs, you must specify a set of source files as
11299 command line arguments.  The conversion programs start out by compiling
11300 these files to see what functions they define.  The information gathered
11301 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
11302
11303 After scanning comes actual conversion.  The specified files are all
11304 eligible to be converted; any files they include (whether sources or
11305 just headers) are eligible as well.
11306
11307 But not all the eligible files are converted.  By default,
11308 @code{protoize} and @code{unprotoize} convert only source and header
11309 files in the current directory.  You can specify additional directories
11310 whose files should be converted with the @option{-d @var{directory}}
11311 option.  You can also specify particular files to exclude with the
11312 @option{-x @var{file}} option.  A file is converted if it is eligible, its
11313 directory name matches one of the specified directory names, and its
11314 name within the directory has not been excluded.
11315
11316 Basic conversion with @code{protoize} consists of rewriting most
11317 function definitions and function declarations to specify the types of
11318 the arguments.  The only ones not rewritten are those for varargs
11319 functions.
11320
11321 @code{protoize} optionally inserts prototype declarations at the
11322 beginning of the source file, to make them available for any calls that
11323 precede the function's definition.  Or it can insert prototype
11324 declarations with block scope in the blocks where undeclared functions
11325 are called.
11326
11327 Basic conversion with @code{unprotoize} consists of rewriting most
11328 function declarations to remove any argument types, and rewriting
11329 function definitions to the old-style pre-ISO form.
11330
11331 Both conversion programs print a warning for any function declaration or
11332 definition that they can't convert.  You can suppress these warnings
11333 with @option{-q}.
11334
11335 The output from @code{protoize} or @code{unprotoize} replaces the
11336 original source file.  The original file is renamed to a name ending
11337 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
11338 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
11339 for DOS) file already exists, then the source file is simply discarded.
11340
11341 @code{protoize} and @code{unprotoize} both depend on GCC itself to
11342 scan the program and collect information about the functions it uses.
11343 So neither of these programs will work until GCC is installed.
11344
11345 Here is a table of the options you can use with @code{protoize} and
11346 @code{unprotoize}.  Each option works with both programs unless
11347 otherwise stated.
11348
11349 @table @code
11350 @item -B @var{directory}
11351 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
11352 usual directory (normally @file{/usr/local/lib}).  This file contains
11353 prototype information about standard system functions.  This option
11354 applies only to @code{protoize}.
11355
11356 @item -c @var{compilation-options}
11357 Use @var{compilation-options} as the options when running @command{gcc} to
11358 produce the @samp{.X} files.  The special option @option{-aux-info} is
11359 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
11360
11361 Note that the compilation options must be given as a single argument to
11362 @code{protoize} or @code{unprotoize}.  If you want to specify several
11363 @command{gcc} options, you must quote the entire set of compilation options
11364 to make them a single word in the shell.
11365
11366 There are certain @command{gcc} arguments that you cannot use, because they
11367 would produce the wrong kind of output.  These include @option{-g},
11368 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
11369 the @var{compilation-options}, they are ignored.
11370
11371 @item -C
11372 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
11373 systems) instead of @samp{.c}.  This is convenient if you are converting
11374 a C program to C++.  This option applies only to @code{protoize}.
11375
11376 @item -g
11377 Add explicit global declarations.  This means inserting explicit
11378 declarations at the beginning of each source file for each function
11379 that is called in the file and was not declared.  These declarations
11380 precede the first function definition that contains a call to an
11381 undeclared function.  This option applies only to @code{protoize}.
11382
11383 @item -i @var{string}
11384 Indent old-style parameter declarations with the string @var{string}.
11385 This option applies only to @code{protoize}.
11386
11387 @code{unprotoize} converts prototyped function definitions to old-style
11388 function definitions, where the arguments are declared between the
11389 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
11390 uses five spaces as the indentation.  If you want to indent with just
11391 one space instead, use @option{-i " "}.
11392
11393 @item -k
11394 Keep the @samp{.X} files.  Normally, they are deleted after conversion
11395 is finished.
11396
11397 @item -l
11398 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
11399 a prototype declaration for each function in each block which calls the
11400 function without any declaration.  This option applies only to
11401 @code{protoize}.
11402
11403 @item -n
11404 Make no real changes.  This mode just prints information about the conversions
11405 that would have been done without @option{-n}.
11406
11407 @item -N
11408 Make no @samp{.save} files.  The original files are simply deleted.
11409 Use this option with caution.
11410
11411 @item -p @var{program}
11412 Use the program @var{program} as the compiler.  Normally, the name
11413 @file{gcc} is used.
11414
11415 @item -q
11416 Work quietly.  Most warnings are suppressed.
11417
11418 @item -v
11419 Print the version number, just like @option{-v} for @command{gcc}.
11420 @end table
11421
11422 If you need special compiler options to compile one of your program's
11423 source files, then you should generate that file's @samp{.X} file
11424 specially, by running @command{gcc} on that source file with the
11425 appropriate options and the option @option{-aux-info}.  Then run
11426 @code{protoize} on the entire set of files.  @code{protoize} will use
11427 the existing @samp{.X} file because it is newer than the source file.
11428 For example:
11429
11430 @smallexample
11431 gcc -Dfoo=bar file1.c -aux-info file1.X
11432 protoize *.c
11433 @end smallexample
11434
11435 @noindent
11436 You need to include the special files along with the rest in the
11437 @code{protoize} command, even though their @samp{.X} files already
11438 exist, because otherwise they won't get converted.
11439
11440 @xref{Protoize Caveats}, for more information on how to use
11441 @code{protoize} successfully.