OSDN Git Service

* config.gcc: Add support for nocoma/prescott/pentium-m/pentium3m
[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}
170
171 @item C++ Language Options
172 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
173 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
174 -fconserve-space  -fno-const-strings @gol
175 -fno-elide-constructors @gol
176 -fno-enforce-eh-specs @gol
177 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
178 -fno-implicit-templates @gol
179 -fno-implicit-inline-templates @gol
180 -fno-implement-inlines  -fms-extensions @gol
181 -fno-nonansi-builtins  -fno-operator-names @gol
182 -fno-optional-diags  -fpermissive @gol
183 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
184 -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
185 -fno-default-inline  -Wabi  -Wctor-dtor-privacy @gol
186 -Wnon-virtual-dtor  -Wreorder @gol
187 -Weffc++  -Wno-deprecated @gol
188 -Wno-non-template-friend  -Wold-style-cast @gol
189 -Woverloaded-virtual  -Wno-pmf-conversions @gol
190 -Wsign-promo  -Wsynth}
191
192 @item Objective-C Language Options
193 @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
194 @gccoptlist{
195 -fconstant-string-class=@var{class-name} @gol
196 -fgnu-runtime  -fnext-runtime @gol
197 -fno-nil-receivers @gol
198 -fobjc-exceptions @gol
199 -freplace-objc-classes @gol
200 -fzero-link @gol
201 -gen-decls @gol
202 -Wno-protocol  -Wselector -Wundeclared-selector}
203
204 @item Language Independent Options
205 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
206 @gccoptlist{-fmessage-length=@var{n}  @gol
207 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
208
209 @item Warning Options
210 @xref{Warning Options,,Options to Request or Suppress Warnings}.
211 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
212 -w  -Wextra  -Wall  -Waggregate-return @gol
213 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
214 -Wconversion  -Wno-deprecated-declarations @gol
215 -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
216 -Werror  -Werror-implicit-function-declaration @gol
217 -Wfloat-equal  -Wformat  -Wformat=2 @gol
218 -Wno-format-extra-args -Wformat-nonliteral @gol
219 -Wformat-security  -Wformat-y2k @gol
220 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
221 -Wimport  -Wno-import  -Winit-self  -Winline @gol
222 -Wno-invalid-offsetof  -Winvalid-pch @gol
223 -Wlarger-than-@var{len}  -Wlong-long @gol
224 -Wmain  -Wmissing-braces @gol
225 -Wmissing-format-attribute  -Wmissing-noreturn @gol
226 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
227 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
228 -Wreturn-type  -Wsequence-point  -Wshadow @gol
229 -Wsign-compare  -Wstrict-aliasing @gol
230 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
231 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
232 -Wunknown-pragmas  -Wunreachable-code @gol
233 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
234 -Wunused-value  -Wunused-variable  -Wwrite-strings @gol
235 -Wvariadic-macros}
236
237 @item C-only Warning Options
238 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
239 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
240 -Wstrict-prototypes  -Wtraditional @gol
241 -Wdeclaration-after-statement}
242
243 @item Debugging Options
244 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
245 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
246 -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
247 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
248 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
249 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
250 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
251 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
252 -feliminate-unused-debug-symbols -fmem-report -fprofile-arcs @gol
253 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
254 -ftest-coverage  -ftime-report -fvar-tracking @gol
255 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
256 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
257 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
258 -print-multi-directory  -print-multi-lib @gol
259 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
260 -save-temps  -time}
261
262 @item Optimization Options
263 @xref{Optimize Options,,Options that Control Optimization}.
264 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
265 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
266 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
267 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
268 -fcaller-saves  -fcprop-registers @gol
269 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
270 -fdelayed-branch  -fdelete-null-pointer-checks @gol
271 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
272 -fforce-addr  -fforce-mem  -ffunction-sections @gol
273 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -floop-optimize @gol
274 -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
275 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
276 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
277 -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
278 -fno-default-inline  -fno-defer-pop @gol
279 -fno-function-cse  -fno-guess-branch-probability @gol
280 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
281 -funsafe-math-optimizations  -ffinite-math-only @gol
282 -fno-trapping-math  -fno-zero-initialized-in-bss @gol
283 -fomit-frame-pointer  -foptimize-register-move @gol
284 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
285 -fprofile-generate -fprofile-use @gol
286 -freduce-all-givs  -fregmove  -frename-registers @gol
287 -freorder-blocks  -freorder-functions @gol
288 -frerun-cse-after-loop  -frerun-loop-opt @gol
289 -frounding-math -fschedule-insns  -fschedule-insns2 @gol
290 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
291 -fsched-spec-load-dangerous  @gol
292 -fsched-stalled-insns=@var{n} -sched-stalled-insns-dep=@var{n} @gol
293 -fsched2-use-superblocks @gol
294 -fsched2-use-traces  -fsignaling-nans @gol
295 -fsingle-precision-constant  @gol
296 -fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps @gol
297 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
298 -funswitch-loops  -fold-unroll-loops  -fold-unroll-all-loops @gol
299 --param @var{name}=@var{value}
300 -O  -O0  -O1  -O2  -O3  -Os}
301
302 @item Preprocessor Options
303 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
304 @gccoptlist{-A@var{question}=@var{answer} @gol
305 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
306 -C  -dD  -dI  -dM  -dN @gol
307 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
308 -idirafter @var{dir} @gol
309 -include @var{file}  -imacros @var{file} @gol
310 -iprefix @var{file}  -iwithprefix @var{dir} @gol
311 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
312 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
313 -P  -fworking-directory  -remap @gol
314 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
315 -Xpreprocessor @var{option}}
316
317 @item Assembler Option
318 @xref{Assembler Options,,Passing Options to the Assembler}.
319 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
320
321 @item Linker Options
322 @xref{Link Options,,Options for Linking}.
323 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
324 -nostartfiles  -nodefaultlibs  -nostdlib -pie @gol
325 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
326 -Wl,@var{option}  -Xlinker @var{option} @gol
327 -u @var{symbol}}
328
329 @item Directory Options
330 @xref{Directory Options,,Options for Directory Search}.
331 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}}
332
333 @item Target Options
334 @c I wrote this xref this way to avoid overfull hbox. -- rms
335 @xref{Target Options}.
336 @gccoptlist{-V @var{version}  -b @var{machine}}
337
338 @item Machine Dependent Options
339 @xref{Submodel Options,,Hardware Models and Configurations}.
340
341 @emph{M680x0 Options}
342 @gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
343 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
344 -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
345 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
346 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
347
348 @emph{M68hc1x Options}
349 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
350 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
351 -msoft-reg-count=@var{count}}
352
353 @emph{VAX Options}
354 @gccoptlist{-mg  -mgnu  -munix}
355
356 @emph{SPARC Options}
357 @gccoptlist{-mcpu=@var{cpu-type} @gol
358 -mtune=@var{cpu-type} @gol
359 -mcmodel=@var{code-model} @gol
360 -m32  -m64  -mapp-regs  -mno-app-regs @gol
361 -mfaster-structs  -mno-faster-structs @gol
362 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
363 -mhard-quad-float  -msoft-quad-float @gol
364 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
365 -mstack-bias  -mno-stack-bias @gol
366 -munaligned-doubles  -mno-unaligned-doubles @gol
367 -mv8plus  -mno-v8plus  -mvis  -mno-vis}
368
369 @emph{ARM Options}
370 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
371 -mapcs-26  -mapcs-32 @gol
372 -mapcs-stack-check  -mno-apcs-stack-check @gol
373 -mapcs-float  -mno-apcs-float @gol
374 -mapcs-reentrant  -mno-apcs-reentrant @gol
375 -msched-prolog  -mno-sched-prolog @gol
376 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
377 -malignment-traps  -mno-alignment-traps @gol
378 -mfloat-abi=@var{name}  soft-float  -mhard-float  -mfpe @gol
379 -mthumb-interwork  -mno-thumb-interwork @gol
380 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
381 -mstructure-size-boundary=@var{n} @gol
382 -mabort-on-noreturn @gol
383 -mlong-calls  -mno-long-calls @gol
384 -msingle-pic-base  -mno-single-pic-base @gol
385 -mpic-register=@var{reg} @gol
386 -mnop-fun-dllimport @gol
387 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
388 -mpoke-function-name @gol
389 -mthumb  -marm @gol
390 -mtpcs-frame  -mtpcs-leaf-frame @gol
391 -mcaller-super-interworking  -mcallee-super-interworking}
392
393 @emph{MN10300 Options}
394 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
395 -mam33  -mno-am33 @gol
396 -mam33-2  -mno-am33-2 @gol
397 -mno-crt0  -mrelax}
398
399 @emph{M32R/D Options}
400 @gccoptlist{-m32r2 -m32rx -m32r @gol
401 -mdebug @gol
402 -malign-loops -mno-align-loops @gol
403 -missue-rate=@var{number} @gol
404 -mbranch-cost=@var{number} @gol
405 -mmodel=@var{code-size-model-type} @gol
406 -msdata=@var{sdata-type} @gol
407 -mno-flush-func -mflush-func=@var{name} @gol
408 -mno-flush-trap -mflush-trap=@var{number} @gol
409 -G @var{num}}
410
411 @emph{RS/6000 and PowerPC Options}
412 @gccoptlist{-mcpu=@var{cpu-type} @gol
413 -mtune=@var{cpu-type} @gol
414 -mpower  -mno-power  -mpower2  -mno-power2 @gol
415 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
416 -maltivec  -mno-altivec @gol
417 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
418 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
419 -mnew-mnemonics  -mold-mnemonics @gol
420 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
421 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
422 -malign-power  -malign-natural @gol
423 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
424 -mstring  -mno-string  -mupdate  -mno-update @gol
425 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
426 -mstrict-align  -mno-strict-align  -mrelocatable @gol
427 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
428 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
429 -mdynamic-no-pic @gol
430 -mprioritize-restricted-insns=@var{priority} @gol
431 -msched-costly-dep=@var{dependence_type} @gol
432 -minsert-sched-nops=@var{scheme} @gol
433 -mcall-sysv  -mcall-netbsd @gol
434 -maix-struct-return  -msvr4-struct-return @gol
435 -mabi=altivec  -mabi=no-altivec @gol
436 -mabi=spe  -mabi=no-spe @gol
437 -misel=yes  -misel=no @gol
438 -mspe=yes  -mspe=no @gol
439 -mfloat-gprs=yes  -mfloat-gprs=no @gol
440 -mprototype  -mno-prototype @gol
441 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
442 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
443
444 @emph{Darwin Options}
445 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
446 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
447 -client_name  -compatibility_version  -current_version @gol
448 -dependency-file  -dylib_file  -dylinker_install_name @gol
449 -dynamic  -dynamiclib  -exported_symbols_list @gol
450 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
451 -force_flat_namespace  -headerpad_max_install_names @gol
452 -image_base  -init  -install_name  -keep_private_externs @gol
453 -multi_module  -multiply_defined  -multiply_defined_unused @gol
454 -noall_load  -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
455 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
456 -private_bundle  -read_only_relocs  -sectalign @gol
457 -sectobjectsymbols  -whyload  -seg1addr @gol
458 -sectcreate  -sectobjectsymbols  -sectorder @gol
459 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
460 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
461 -single_module  -static  -sub_library  -sub_umbrella @gol
462 -twolevel_namespace  -umbrella  -undefined @gol
463 -unexported_symbols_list  -weak_reference_mismatches @gol
464 -whatsloaded}
465
466 @emph{MIPS Options}
467 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
468 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
469 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
470 -mxgot  -mno-xgot  -membedded-pic  -mno-embedded-pic @gol
471 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
472 -msingle-float  -mdouble-float  -mint64  -mlong64  -mlong32 @gol
473 -G@var{num}  -membedded-data  -mno-embedded-data @gol
474 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
475 -msplit-addresses  -mno-split-addresses  @gol
476 -mexplicit-relocs  -mno-explicit-relocs  @gol
477 -mrnames  -mno-rnames @gol
478 -mcheck-zero-division  -mno-check-zero-division @gol
479 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
480 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
481 -mfix-sb1  -mno-fix-sb1  -mflush-func=@var{func} @gol
482 -mno-flush-func  -mbranch-likely  -mno-branch-likely}
483
484 @emph{i386 and x86-64 Options}
485 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
486 -mfpmath=@var{unit} @gol
487 -masm=@var{dialect}  -mno-fancy-math-387 @gol
488 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
489 -mno-wide-multiply  -mrtd  -malign-double @gol
490 -mpreferred-stack-boundary=@var{num} @gol
491 -mmmx  -msse  -msse2 -msse3 -m3dnow @gol
492 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
493 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
494 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
495 -mno-red-zone -mno-tls-direct-seg-refs @gol
496 -mcmodel=@var{code-model} @gol
497 -m32  -m64}
498
499 @emph{HPPA Options}
500 @gccoptlist{-march=@var{architecture-type} @gol
501 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
502 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
503 -mjump-in-delay -mlinker-opt -mlong-calls @gol
504 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
505 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
506 -mno-jump-in-delay  -mno-long-load-store @gol
507 -mno-portable-runtime  -mno-soft-float @gol
508 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
509 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
510 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
511 -nolibdld  -static  -threads}
512
513 @emph{DEC Alpha Options}
514 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
515 -mieee  -mieee-with-inexact  -mieee-conformant @gol
516 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
517 -mtrap-precision=@var{mode}  -mbuild-constants @gol
518 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
519 -mbwx  -mmax  -mfix  -mcix @gol
520 -mfloat-vax  -mfloat-ieee @gol
521 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
522 -msmall-text  -mlarge-text @gol
523 -mmemory-latency=@var{time}}
524
525 @emph{DEC Alpha/VMS Options}
526 @gccoptlist{-mvms-return-codes}
527
528 @emph{H8/300 Options}
529 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
530
531 @emph{SH Options}
532 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
533 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
534 -m5-64media  -m5-64media-nofpu @gol
535 -m5-32media  -m5-32media-nofpu @gol
536 -m5-compact  -m5-compact-nofpu @gol
537 -mb  -ml  -mdalign  -mrelax @gol
538 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
539 -mieee  -misize  -mpadstruct  -mspace @gol
540 -mprefergot  -musermode}
541
542 @emph{System V Options}
543 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
544
545 @emph{ARC Options}
546 @gccoptlist{-EB  -EL @gol
547 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
548 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
549
550 @emph{TMS320C3x/C4x Options}
551 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
552 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
553 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
554 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
555
556 @emph{V850 Options}
557 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
558 -mprolog-function  -mno-prolog-function  -mspace @gol
559 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
560 -mapp-regs  -mno-app-regs @gol
561 -mdisable-callt  -mno-disable-callt @gol
562 -mv850e1 @gol
563 -mv850e @gol
564 -mv850  -mbig-switch}
565
566 @emph{NS32K Options}
567 @gccoptlist{-m32032  -m32332  -m32532  -m32081  -m32381 @gol
568 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
569 -mregparam  -mnoregparam  -msb  -mnosb @gol
570 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
571
572 @emph{AVR Options}
573 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
574 -mcall-prologues  -mno-tablejump  -mtiny-stack}
575
576 @emph{MCore Options}
577 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
578 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
579 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
580 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
581 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
582
583 @emph{MMIX Options}
584 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
585 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
586 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
587 -mno-base-addresses  -msingle-exit  -mno-single-exit}
588
589 @emph{IA-64 Options}
590 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
591 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
592 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
593 -minline-float-divide-max-throughput @gol
594 -minline-int-divide-min-latency @gol
595 -minline-int-divide-max-throughput  -mno-dwarf2-asm @gol
596 -mfixed-range=@var{register-range}}
597
598 @emph{S/390 and zSeries Options}
599 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
600 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
601 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
602 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch  -mfused-madd  -mno-fused-madd}
603
604 @emph{CRIS Options}
605 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
606 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
607 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
608 -mstack-align  -mdata-align  -mconst-align @gol
609 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
610 -melf  -maout  -melinux  -mlinux  -sim  -sim2}
611
612 @emph{PDP-11 Options}
613 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
614 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
615 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
616 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
617 -mbranch-expensive  -mbranch-cheap @gol
618 -msplit  -mno-split  -munix-asm  -mdec-asm}
619
620 @emph{Xstormy16 Options}
621 @gccoptlist{-msim}
622
623 @emph{Xtensa Options}
624 @gccoptlist{-mconst16 -mno-const16 @gol
625 -mfused-madd  -mno-fused-madd @gol
626 -mtext-section-literals  -mno-text-section-literals @gol
627 -mtarget-align  -mno-target-align @gol
628 -mlongcalls  -mno-longcalls}
629
630 @emph{FRV Options}
631 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
632 -mhard-float  -msoft-float @gol
633 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
634 -mdouble  -mno-double @gol
635 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
636 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp @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 @end table
1214
1215 @node C++ Dialect Options
1216 @section Options Controlling C++ Dialect
1217
1218 @cindex compiler options, C++
1219 @cindex C++ options, command line
1220 @cindex options, C++
1221 This section describes the command-line options that are only meaningful
1222 for C++ programs; but you can also use most of the GNU compiler options
1223 regardless of what language your program is in.  For example, you
1224 might compile a file @code{firstClass.C} like this:
1225
1226 @smallexample
1227 g++ -g -frepo -O -c firstClass.C
1228 @end smallexample
1229
1230 @noindent
1231 In this example, only @option{-frepo} is an option meant
1232 only for C++ programs; you can use the other options with any
1233 language supported by GCC@.
1234
1235 Here is a list of options that are @emph{only} for compiling C++ programs:
1236
1237 @table @gcctabopt
1238
1239 @item -fabi-version=@var{n}
1240 @opindex fabi-version
1241 Use version @var{n} of the C++ ABI.  Version 2 is the version of the
1242 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1243 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1244 the version that conforms most closely to the C++ ABI specification.
1245 Therefore, the ABI obtained using version 0 will change as ABI bugs
1246 are fixed.
1247
1248 The default is version 2.
1249
1250 @item -fno-access-control
1251 @opindex fno-access-control
1252 Turn off all access checking.  This switch is mainly useful for working
1253 around bugs in the access control code.
1254
1255 @item -fcheck-new
1256 @opindex fcheck-new
1257 Check that the pointer returned by @code{operator new} is non-null
1258 before attempting to modify the storage allocated.  This check is
1259 normally unnecessary because the C++ standard specifies that
1260 @code{operator new} will only return @code{0} if it is declared
1261 @samp{throw()}, in which case the compiler will always check the
1262 return value even without this option.  In all other cases, when
1263 @code{operator new} has a non-empty exception specification, memory
1264 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1265 @samp{new (nothrow)}.
1266
1267 @item -fconserve-space
1268 @opindex fconserve-space
1269 Put uninitialized or runtime-initialized global variables into the
1270 common segment, as C does.  This saves space in the executable at the
1271 cost of not diagnosing duplicate definitions.  If you compile with this
1272 flag and your program mysteriously crashes after @code{main()} has
1273 completed, you may have an object that is being destroyed twice because
1274 two definitions were merged.
1275
1276 This option is no longer useful on most targets, now that support has
1277 been added for putting variables into BSS without making them common.
1278
1279 @item -fno-const-strings
1280 @opindex fno-const-strings
1281 Give string constants type @code{char *} instead of type @code{const
1282 char *}.  By default, G++ uses type @code{const char *} as required by
1283 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1284 actually modify the value of a string constant.
1285
1286 This option might be removed in a future release of G++.  For maximum
1287 portability, you should structure your code so that it works with
1288 string constants that have type @code{const char *}.
1289
1290 @item -fno-elide-constructors
1291 @opindex fno-elide-constructors
1292 The C++ standard allows an implementation to omit creating a temporary
1293 which is only used to initialize another object of the same type.
1294 Specifying this option disables that optimization, and forces G++ to
1295 call the copy constructor in all cases.
1296
1297 @item -fno-enforce-eh-specs
1298 @opindex fno-enforce-eh-specs
1299 Don't check for violation of exception specifications at runtime.  This
1300 option violates the C++ standard, but may be useful for reducing code
1301 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1302 will still optimize based on the exception specifications.
1303
1304 @item -ffor-scope
1305 @itemx -fno-for-scope
1306 @opindex ffor-scope
1307 @opindex fno-for-scope
1308 If @option{-ffor-scope} is specified, the scope of variables declared in
1309 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1310 as specified by the C++ standard.
1311 If @option{-fno-for-scope} is specified, the scope of variables declared in
1312 a @i{for-init-statement} extends to the end of the enclosing scope,
1313 as was the case in old versions of G++, and other (traditional)
1314 implementations of C++.
1315
1316 The default if neither flag is given to follow the standard,
1317 but to allow and give a warning for old-style code that would
1318 otherwise be invalid, or have different behavior.
1319
1320 @item -fno-gnu-keywords
1321 @opindex fno-gnu-keywords
1322 Do not recognize @code{typeof} as a keyword, so that code can use this
1323 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1324 @option{-ansi} implies @option{-fno-gnu-keywords}.
1325
1326 @item -fno-implicit-templates
1327 @opindex fno-implicit-templates
1328 Never emit code for non-inline templates which are instantiated
1329 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1330 @xref{Template Instantiation}, for more information.
1331
1332 @item -fno-implicit-inline-templates
1333 @opindex fno-implicit-inline-templates
1334 Don't emit code for implicit instantiations of inline templates, either.
1335 The default is to handle inlines differently so that compiles with and
1336 without optimization will need the same set of explicit instantiations.
1337
1338 @item -fno-implement-inlines
1339 @opindex fno-implement-inlines
1340 To save space, do not emit out-of-line copies of inline functions
1341 controlled by @samp{#pragma implementation}.  This will cause linker
1342 errors if these functions are not inlined everywhere they are called.
1343
1344 @item -fms-extensions
1345 @opindex fms-extensions
1346 Disable pedantic warnings about constructs used in MFC, such as implicit
1347 int and getting a pointer to member function via non-standard syntax.
1348
1349 @item -fno-nonansi-builtins
1350 @opindex fno-nonansi-builtins
1351 Disable built-in declarations of functions that are not mandated by
1352 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1353 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1354
1355 @item -fno-operator-names
1356 @opindex fno-operator-names
1357 Do not treat the operator name keywords @code{and}, @code{bitand},
1358 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1359 synonyms as keywords.
1360
1361 @item -fno-optional-diags
1362 @opindex fno-optional-diags
1363 Disable diagnostics that the standard says a compiler does not need to
1364 issue.  Currently, the only such diagnostic issued by G++ is the one for
1365 a name having multiple meanings within a class.
1366
1367 @item -fpermissive
1368 @opindex fpermissive
1369 Downgrade some diagnostics about nonconformant code from errors to
1370 warnings.  Thus, using @option{-fpermissive} will allow some
1371 nonconforming code to compile.
1372
1373 @item -frepo
1374 @opindex frepo
1375 Enable automatic template instantiation at link time.  This option also
1376 implies @option{-fno-implicit-templates}.  @xref{Template
1377 Instantiation}, for more information.
1378
1379 @item -fno-rtti
1380 @opindex fno-rtti
1381 Disable generation of information about every class with virtual
1382 functions for use by the C++ runtime type identification features
1383 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1384 of the language, you can save some space by using this flag.  Note that
1385 exception handling uses the same information, but it will generate it as
1386 needed.
1387
1388 @item -fstats
1389 @opindex fstats
1390 Emit statistics about front-end processing at the end of the compilation.
1391 This information is generally only useful to the G++ development team.
1392
1393 @item -ftemplate-depth-@var{n}
1394 @opindex ftemplate-depth
1395 Set the maximum instantiation depth for template classes to @var{n}.
1396 A limit on the template instantiation depth is needed to detect
1397 endless recursions during template class instantiation.  ANSI/ISO C++
1398 conforming programs must not rely on a maximum depth greater than 17.
1399
1400 @item -fuse-cxa-atexit
1401 @opindex fuse-cxa-atexit
1402 Register destructors for objects with static storage duration with the
1403 @code{__cxa_atexit} function rather than the @code{atexit} function.
1404 This option is required for fully standards-compliant handling of static
1405 destructors, but will only work if your C library supports
1406 @code{__cxa_atexit}.
1407
1408 @item -fno-weak
1409 @opindex fno-weak
1410 Do not use weak symbol support, even if it is provided by the linker.
1411 By default, G++ will use weak symbols if they are available.  This
1412 option exists only for testing, and should not be used by end-users;
1413 it will result in inferior code and has no benefits.  This option may
1414 be removed in a future release of G++.
1415
1416 @item -nostdinc++
1417 @opindex nostdinc++
1418 Do not search for header files in the standard directories specific to
1419 C++, but do still search the other standard directories.  (This option
1420 is used when building the C++ library.)
1421 @end table
1422
1423 In addition, these optimization, warning, and code generation options
1424 have meanings only for C++ programs:
1425
1426 @table @gcctabopt
1427 @item -fno-default-inline
1428 @opindex fno-default-inline
1429 Do not assume @samp{inline} for functions defined inside a class scope.
1430 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1431 functions will have linkage like inline functions; they just won't be
1432 inlined by default.
1433
1434 @item -Wabi @r{(C++ only)}
1435 @opindex Wabi
1436 Warn when G++ generates code that is probably not compatible with the
1437 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1438 all such cases, there are probably some cases that are not warned about,
1439 even though G++ is generating incompatible code.  There may also be
1440 cases where warnings are emitted even though the code that is generated
1441 will be compatible.
1442
1443 You should rewrite your code to avoid these warnings if you are
1444 concerned about the fact that code generated by G++ may not be binary
1445 compatible with code generated by other compilers.
1446
1447 The known incompatibilities at this point include:
1448
1449 @itemize @bullet
1450
1451 @item
1452 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1453 pack data into the same byte as a base class.  For example:
1454
1455 @smallexample
1456 struct A @{ virtual void f(); int f1 : 1; @};
1457 struct B : public A @{ int f2 : 1; @};
1458 @end smallexample
1459
1460 @noindent
1461 In this case, G++ will place @code{B::f2} into the same byte
1462 as@code{A::f1}; other compilers will not.  You can avoid this problem
1463 by explicitly padding @code{A} so that its size is a multiple of the
1464 byte size on your platform; that will cause G++ and other compilers to
1465 layout @code{B} identically.
1466
1467 @item
1468 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1469 tail padding when laying out virtual bases.  For example:
1470
1471 @smallexample
1472 struct A @{ virtual void f(); char c1; @};
1473 struct B @{ B(); char c2; @};
1474 struct C : public A, public virtual B @{@};
1475 @end smallexample
1476
1477 @noindent
1478 In this case, G++ will not place @code{B} into the tail-padding for
1479 @code{A}; other compilers will.  You can avoid this problem by
1480 explicitly padding @code{A} so that its size is a multiple of its
1481 alignment (ignoring virtual base classes); that will cause G++ and other
1482 compilers to layout @code{C} identically.
1483
1484 @item
1485 Incorrect handling of bit-fields with declared widths greater than that
1486 of their underlying types, when the bit-fields appear in a union.  For
1487 example:
1488
1489 @smallexample
1490 union U @{ int i : 4096; @};
1491 @end smallexample
1492
1493 @noindent
1494 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1495 union too small by the number of bits in an @code{int}.
1496
1497 @item
1498 Empty classes can be placed at incorrect offsets.  For example:
1499
1500 @smallexample
1501 struct A @{@};
1502
1503 struct B @{
1504   A a;
1505   virtual void f ();
1506 @};
1507
1508 struct C : public B, public A @{@};
1509 @end smallexample
1510
1511 @noindent
1512 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1513 it should be placed at offset zero.  G++ mistakenly believes that the
1514 @code{A} data member of @code{B} is already at offset zero.
1515
1516 @item
1517 Names of template functions whose types involve @code{typename} or
1518 template template parameters can be mangled incorrectly.
1519
1520 @smallexample
1521 template <typename Q>
1522 void f(typename Q::X) @{@}
1523
1524 template <template <typename> class Q>
1525 void f(typename Q<int>::X) @{@}
1526 @end smallexample
1527
1528 @noindent
1529 Instantiations of these templates may be mangled incorrectly.
1530
1531 @end itemize
1532
1533 @item -Wctor-dtor-privacy @r{(C++ only)}
1534 @opindex Wctor-dtor-privacy
1535 Warn when a class seems unusable because all the constructors or
1536 destructors in that class are private, and it has neither friends nor
1537 public static member functions.
1538
1539 @item -Wnon-virtual-dtor @r{(C++ only)}
1540 @opindex Wnon-virtual-dtor
1541 Warn when a class appears to be polymorphic, thereby requiring a virtual
1542 destructor, yet it declares a non-virtual one.
1543 This warning is enabled by @option{-Wall}.
1544
1545 @item -Wreorder @r{(C++ only)}
1546 @opindex Wreorder
1547 @cindex reordering, warning
1548 @cindex warning for reordering of member initializers
1549 Warn when the order of member initializers given in the code does not
1550 match the order in which they must be executed.  For instance:
1551
1552 @smallexample
1553 struct A @{
1554   int i;
1555   int j;
1556   A(): j (0), i (1) @{ @}
1557 @};
1558 @end smallexample
1559
1560 The compiler will rearrange the member initializers for @samp{i}
1561 and @samp{j} to match the declaration order of the members, emitting
1562 a warning to that effect.  This warning is enabled by @option{-Wall}.
1563 @end table
1564
1565 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1566
1567 @table @gcctabopt
1568 @item -Weffc++ @r{(C++ only)}
1569 @opindex Weffc++
1570 Warn about violations of the following style guidelines from Scott Meyers'
1571 @cite{Effective C++} book:
1572
1573 @itemize @bullet
1574 @item
1575 Item 11:  Define a copy constructor and an assignment operator for classes
1576 with dynamically allocated memory.
1577
1578 @item
1579 Item 12:  Prefer initialization to assignment in constructors.
1580
1581 @item
1582 Item 14:  Make destructors virtual in base classes.
1583
1584 @item
1585 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1586
1587 @item
1588 Item 23:  Don't try to return a reference when you must return an object.
1589
1590 @end itemize
1591
1592 Also warn about violations of the following style guidelines from
1593 Scott Meyers' @cite{More Effective C++} book:
1594
1595 @itemize @bullet
1596 @item
1597 Item 6:  Distinguish between prefix and postfix forms of increment and
1598 decrement operators.
1599
1600 @item
1601 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1602
1603 @end itemize
1604
1605 When selecting this option, be aware that the standard library
1606 headers do not obey all of these guidelines; use @samp{grep -v}
1607 to filter out those warnings.
1608
1609 @item -Wno-deprecated @r{(C++ only)}
1610 @opindex Wno-deprecated
1611 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1612
1613 @item -Wno-non-template-friend @r{(C++ only)}
1614 @opindex Wno-non-template-friend
1615 Disable warnings when non-templatized friend functions are declared
1616 within a template.  Since the advent of explicit template specification
1617 support in G++, if the name of the friend is an unqualified-id (i.e.,
1618 @samp{friend foo(int)}), the C++ language specification demands that the
1619 friend declare or define an ordinary, nontemplate function.  (Section
1620 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1621 could be interpreted as a particular specialization of a templatized
1622 function.  Because this non-conforming behavior is no longer the default
1623 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1624 check existing code for potential trouble spots and is on by default.
1625 This new compiler behavior can be turned off with
1626 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1627 but disables the helpful warning.
1628
1629 @item -Wold-style-cast @r{(C++ only)}
1630 @opindex Wold-style-cast
1631 Warn if an old-style (C-style) cast to a non-void type is used within
1632 a C++ program.  The new-style casts (@samp{static_cast},
1633 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1634 unintended effects and much easier to search for.
1635
1636 @item -Woverloaded-virtual @r{(C++ only)}
1637 @opindex Woverloaded-virtual
1638 @cindex overloaded virtual fn, warning
1639 @cindex warning for overloaded virtual fn
1640 Warn when a function declaration hides virtual functions from a
1641 base class.  For example, in:
1642
1643 @smallexample
1644 struct A @{
1645   virtual void f();
1646 @};
1647
1648 struct B: public A @{
1649   void f(int);
1650 @};
1651 @end smallexample
1652
1653 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1654 like:
1655
1656 @smallexample
1657 B* b;
1658 b->f();
1659 @end smallexample
1660
1661 will fail to compile.
1662
1663 @item -Wno-pmf-conversions @r{(C++ only)}
1664 @opindex Wno-pmf-conversions
1665 Disable the diagnostic for converting a bound pointer to member function
1666 to a plain pointer.
1667
1668 @item -Wsign-promo @r{(C++ only)}
1669 @opindex Wsign-promo
1670 Warn when overload resolution chooses a promotion from unsigned or
1671 enumeral type to a signed type, over a conversion to an unsigned type of
1672 the same size.  Previous versions of G++ would try to preserve
1673 unsignedness, but the standard mandates the current behavior.
1674
1675 @item -Wsynth @r{(C++ only)}
1676 @opindex Wsynth
1677 @cindex warning for synthesized methods
1678 @cindex synthesized methods, warning
1679 Warn when G++'s synthesis behavior does not match that of cfront.  For
1680 instance:
1681
1682 @smallexample
1683 struct A @{
1684   operator int ();
1685   A& operator = (int);
1686 @};
1687
1688 main ()
1689 @{
1690   A a,b;
1691   a = b;
1692 @}
1693 @end smallexample
1694
1695 In this example, G++ will synthesize a default @samp{A& operator =
1696 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1697 @end table
1698
1699 @node Objective-C Dialect Options
1700 @section Options Controlling Objective-C Dialect
1701
1702 @cindex compiler options, Objective-C
1703 @cindex Objective-C options, command line
1704 @cindex options, Objective-C
1705 (NOTE: This manual does not describe the Objective-C language itself.  See
1706 @w{@uref{http://gcc.gnu.org/readings.html}} for references.)
1707
1708 This section describes the command-line options that are only meaningful
1709 for Objective-C programs, but you can also use most of the GNU compiler
1710 options regardless of what language your program is in.  For example,
1711 you might compile a file @code{some_class.m} like this:
1712
1713 @smallexample
1714 gcc -g -fgnu-runtime -O -c some_class.m
1715 @end smallexample
1716
1717 @noindent
1718 In this example, @option{-fgnu-runtime} is an option meant only for
1719 Objective-C programs; you can use the other options with any language
1720 supported by GCC@.
1721
1722 Here is a list of options that are @emph{only} for compiling Objective-C
1723 programs:
1724
1725 @table @gcctabopt
1726 @item -fconstant-string-class=@var{class-name}
1727 @opindex fconstant-string-class
1728 Use @var{class-name} as the name of the class to instantiate for each
1729 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1730 class name is @code{NXConstantString} if the GNU runtime is being used, and
1731 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1732 @option{-fconstant-cfstrings} option, if also present, will override the
1733 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1734 to be laid out as constant CoreFoundation strings.
1735
1736 @item -fgnu-runtime
1737 @opindex fgnu-runtime
1738 Generate object code compatible with the standard GNU Objective-C
1739 runtime.  This is the default for most types of systems.
1740
1741 @item -fnext-runtime
1742 @opindex fnext-runtime
1743 Generate output compatible with the NeXT runtime.  This is the default
1744 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1745 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1746 used.
1747
1748 @item -fno-nil-receivers
1749 @opindex -fno-nil-receivers
1750 Assume that all Objective-C message dispatches (e.g.,
1751 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1752 is not @code{nil}.  This allows for more efficient entry points in the runtime to be
1753 used.  Currently, this option is only available in conjunction with
1754 the NeXT runtime on Mac OS X 10.3 and later.
1755
1756 @item -fobjc-exceptions
1757 @opindex -fobjc-exceptions
1758 Enable syntactic support for structured exception handling in Objective-C,
1759 similar to what is offered by C++ and Java.  Currently, this option is only
1760 available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
1761
1762 @smallexample
1763   @@try @{
1764     @dots{}
1765        @@throw expr;
1766     @dots{}
1767   @}
1768   @@catch (AnObjCClass *exc) @{
1769     @dots{}
1770       @@throw expr;
1771     @dots{}
1772       @@throw;
1773     @dots{}
1774   @}
1775   @@catch (AnotherClass *exc) @{
1776     @dots{}
1777   @}
1778   @@catch (id allOthers) @{
1779     @dots{}
1780   @}
1781   @@finally @{
1782     @dots{}
1783       @@throw expr;
1784     @dots{}
1785   @}
1786 @end smallexample
1787
1788 The @code{@@throw} statement may appear anywhere in an Objective-C or
1789 Objective-C++ program; when used inside of a @code{@@catch} block, the
1790 @code{@@throw} may appear without an argument (as shown above), in which case
1791 the object caught by the @code{@@catch} will be rethrown.
1792
1793 Note that only (pointers to) Objective-C objects may be thrown and
1794 caught using this scheme.  When an object is thrown, it will be caught
1795 by the nearest @code{@@catch} clause capable of handling objects of that type,
1796 analogously to how @code{catch} blocks work in C++ and Java.  A
1797 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
1798 any and all Objective-C exceptions not caught by previous @code{@@catch}
1799 clauses (if any).
1800
1801 The @code{@@finally} clause, if present, will be executed upon exit from the
1802 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1803 regardless of whether any exceptions are thrown, caught or rethrown
1804 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1805 of the @code{finally} clause in Java.
1806
1807 There are several caveats to using the new exception mechanism:
1808
1809 @itemize @bullet
1810 @item
1811 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
1812 idioms provided by the @code{NSException} class, the new
1813 exceptions can only be used on Mac OS X 10.3 (Panther) and later
1814 systems, due to additional functionality needed in the (NeXT) Objective-C
1815 runtime.
1816
1817 @item
1818 As mentioned above, the new exceptions do not support handling
1819 types other than Objective-C objects.   Furthermore, when used from
1820 Objective-C++, the Objective-C exception model does not interoperate with C++
1821 exceptions at this time.  This means you cannot @code{@@throw} an exception
1822 from Objective-C and @code{catch} it in C++, or vice versa
1823 (i.e., @code{throw @dots{} @@catch}).
1824 @end itemize
1825
1826 The @option{-fobjc-exceptions} switch also enables the use of synchronization
1827 blocks for thread-safe execution:
1828
1829 @smallexample
1830   @@synchronized (ObjCClass *guard) @{
1831     @dots{}
1832   @}
1833 @end smallexample
1834
1835 Upon entering the @code{@@synchronized} block, a thread of execution shall
1836 first check whether a lock has been placed on the corresponding @code{guard}
1837 object by another thread.  If it has, the current thread shall wait until
1838 the other thread relinquishes its lock.  Once @code{guard} becomes available,
1839 the current thread will place its own lock on it, execute the code contained in
1840 the @code{@@synchronized} block, and finally relinquish the lock (thereby
1841 making @code{guard} available to other threads).
1842
1843 Unlike Java, Objective-C does not allow for entire methods to be marked
1844 @code{@@synchronized}.  Note that throwing exceptions out of
1845 @code{@@synchronized} blocks is allowed, and will cause the guarding object
1846 to be unlocked properly.
1847
1848 @item -freplace-objc-classes
1849 @opindex -freplace-objc-classes
1850 Emit a special marker instructing @command{ld(1)} not to statically link in
1851 the resulting object file, and allow @command{dyld(1)} to load it in at
1852 run time instead.  This is used in conjunction with the Fix-and-Continue
1853 debugging mode, where the object file in question may be recompiled and
1854 dynamically reloaded in the course of program execution, without the need
1855 to restart the program itself.  Currently, Fix-and-Continue functionality
1856 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
1857 and later.
1858
1859 @item -fzero-link
1860 @opindex -fzero-link
1861 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1862 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1863 compile time) with static class references that get initialized at load time,
1864 which improves run-time performance.  Specifying the @option{-fzero-link} flag
1865 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
1866 to be retained.  This is useful in Zero-Link debugging mode, since it allows
1867 for individual class implementations to be modified during program execution.
1868
1869 @item -gen-decls
1870 @opindex gen-decls
1871 Dump interface declarations for all classes seen in the source file to a
1872 file named @file{@var{sourcename}.decl}.
1873
1874 @item -Wno-protocol
1875 @opindex Wno-protocol
1876 If a class is declared to implement a protocol, a warning is issued for
1877 every method in the protocol that is not implemented by the class.  The
1878 default behavior is to issue a warning for every method not explicitly
1879 implemented in the class, even if a method implementation is inherited
1880 from the superclass.  If you use the @code{-Wno-protocol} option, then
1881 methods inherited from the superclass are considered to be implemented,
1882 and no warning is issued for them.
1883
1884 @item -Wselector
1885 @opindex Wselector
1886 Warn if multiple methods of different types for the same selector are
1887 found during compilation.  The check is performed on the list of methods
1888 in the final stage of compilation.  Additionally, a check is performed
1889 for each selector appearing in a @code{@@selector(@dots{})}
1890 expression, and a corresponding method for that selector has been found
1891 during compilation.  Because these checks scan the method table only at
1892 the end of compilation, these warnings are not produced if the final
1893 stage of compilation is not reached, for example because an error is
1894 found during compilation, or because the @code{-fsyntax-only} option is
1895 being used.
1896
1897 @item -Wundeclared-selector
1898 @opindex Wundeclared-selector
1899 Warn if a @code{@@selector(@dots{})} expression referring to an
1900 undeclared selector is found.  A selector is considered undeclared if no
1901 method with that name has been declared before the
1902 @code{@@selector(@dots{})} expression, either explicitly in an
1903 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
1904 an @code{@@implementation} section.  This option always performs its
1905 checks as soon as a @code{@@selector(@dots{})} expression is found,
1906 while @code{-Wselector} only performs its checks in the final stage of
1907 compilation.  This also enforces the coding style convention
1908 that methods and selectors must be declared before being used.
1909
1910 @item -print-objc-runtime-info
1911 @opindex -print-objc-runtime-info
1912 Generate C header describing the largest structure that is passed by
1913 value, if any.
1914
1915 @end table
1916
1917 @node Language Independent Options
1918 @section Options to Control Diagnostic Messages Formatting
1919 @cindex options to control diagnostics formatting
1920 @cindex diagnostic messages
1921 @cindex message formatting
1922
1923 Traditionally, diagnostic messages have been formatted irrespective of
1924 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1925 below can be used to control the diagnostic messages formatting
1926 algorithm, e.g.@: how many characters per line, how often source location
1927 information should be reported.  Right now, only the C++ front end can
1928 honor these options.  However it is expected, in the near future, that
1929 the remaining front ends would be able to digest them correctly.
1930
1931 @table @gcctabopt
1932 @item -fmessage-length=@var{n}
1933 @opindex fmessage-length
1934 Try to format error messages so that they fit on lines of about @var{n}
1935 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1936 the front ends supported by GCC@.  If @var{n} is zero, then no
1937 line-wrapping will be done; each error message will appear on a single
1938 line.
1939
1940 @opindex fdiagnostics-show-location
1941 @item -fdiagnostics-show-location=once
1942 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1943 reporter to emit @emph{once} source location information; that is, in
1944 case the message is too long to fit on a single physical line and has to
1945 be wrapped, the source location won't be emitted (as prefix) again,
1946 over and over, in subsequent continuation lines.  This is the default
1947 behavior.
1948
1949 @item -fdiagnostics-show-location=every-line
1950 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1951 messages reporter to emit the same source location information (as
1952 prefix) for physical lines that result from the process of breaking
1953 a message which is too long to fit on a single line.
1954
1955 @end table
1956
1957 @node Warning Options
1958 @section Options to Request or Suppress Warnings
1959 @cindex options to control warnings
1960 @cindex warning messages
1961 @cindex messages, warning
1962 @cindex suppressing warnings
1963
1964 Warnings are diagnostic messages that report constructions which
1965 are not inherently erroneous but which are risky or suggest there
1966 may have been an error.
1967
1968 You can request many specific warnings with options beginning @samp{-W},
1969 for example @option{-Wimplicit} to request warnings on implicit
1970 declarations.  Each of these specific warning options also has a
1971 negative form beginning @samp{-Wno-} to turn off warnings;
1972 for example, @option{-Wno-implicit}.  This manual lists only one of the
1973 two forms, whichever is not the default.
1974
1975 The following options control the amount and kinds of warnings produced
1976 by GCC; for further, language-specific options also refer to
1977 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
1978
1979 @table @gcctabopt
1980 @cindex syntax checking
1981 @item -fsyntax-only
1982 @opindex fsyntax-only
1983 Check the code for syntax errors, but don't do anything beyond that.
1984
1985 @item -pedantic
1986 @opindex pedantic
1987 Issue all the warnings demanded by strict ISO C and ISO C++;
1988 reject all programs that use forbidden extensions, and some other
1989 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
1990 version of the ISO C standard specified by any @option{-std} option used.
1991
1992 Valid ISO C and ISO C++ programs should compile properly with or without
1993 this option (though a rare few will require @option{-ansi} or a
1994 @option{-std} option specifying the required version of ISO C)@.  However,
1995 without this option, certain GNU extensions and traditional C and C++
1996 features are supported as well.  With this option, they are rejected.
1997
1998 @option{-pedantic} does not cause warning messages for use of the
1999 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2000 warnings are also disabled in the expression that follows
2001 @code{__extension__}.  However, only system header files should use
2002 these escape routes; application programs should avoid them.
2003 @xref{Alternate Keywords}.
2004
2005 Some users try to use @option{-pedantic} to check programs for strict ISO
2006 C conformance.  They soon find that it does not do quite what they want:
2007 it finds some non-ISO practices, but not all---only those for which
2008 ISO C @emph{requires} a diagnostic, and some others for which
2009 diagnostics have been added.
2010
2011 A feature to report any failure to conform to ISO C might be useful in
2012 some instances, but would require considerable additional work and would
2013 be quite different from @option{-pedantic}.  We don't have plans to
2014 support such a feature in the near future.
2015
2016 Where the standard specified with @option{-std} represents a GNU
2017 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2018 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2019 extended dialect is based.  Warnings from @option{-pedantic} are given
2020 where they are required by the base standard.  (It would not make sense
2021 for such warnings to be given only for features not in the specified GNU
2022 C dialect, since by definition the GNU dialects of C include all
2023 features the compiler supports with the given option, and there would be
2024 nothing to warn about.)
2025
2026 @item -pedantic-errors
2027 @opindex pedantic-errors
2028 Like @option{-pedantic}, except that errors are produced rather than
2029 warnings.
2030
2031 @item -w
2032 @opindex w
2033 Inhibit all warning messages.
2034
2035 @item -Wno-import
2036 @opindex Wno-import
2037 Inhibit warning messages about the use of @samp{#import}.
2038
2039 @item -Wchar-subscripts
2040 @opindex Wchar-subscripts
2041 Warn if an array subscript has type @code{char}.  This is a common cause
2042 of error, as programmers often forget that this type is signed on some
2043 machines.
2044
2045 @item -Wcomment
2046 @opindex Wcomment
2047 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2048 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2049
2050 @item -Wformat
2051 @opindex Wformat
2052 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2053 the arguments supplied have types appropriate to the format string
2054 specified, and that the conversions specified in the format string make
2055 sense.  This includes standard functions, and others specified by format
2056 attributes (@pxref{Function Attributes}), in the @code{printf},
2057 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2058 not in the C standard) families.
2059
2060 The formats are checked against the format features supported by GNU
2061 libc version 2.2.  These include all ISO C90 and C99 features, as well
2062 as features from the Single Unix Specification and some BSD and GNU
2063 extensions.  Other library implementations may not support all these
2064 features; GCC does not support warning about features that go beyond a
2065 particular library's limitations.  However, if @option{-pedantic} is used
2066 with @option{-Wformat}, warnings will be given about format features not
2067 in the selected standard version (but not for @code{strfmon} formats,
2068 since those are not in any version of the C standard).  @xref{C Dialect
2069 Options,,Options Controlling C Dialect}.
2070
2071 Since @option{-Wformat} also checks for null format arguments for
2072 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2073
2074 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2075 aspects of format checking, the options @option{-Wformat-y2k},
2076 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2077 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2078 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2079
2080 @item -Wformat-y2k
2081 @opindex Wformat-y2k
2082 If @option{-Wformat} is specified, also warn about @code{strftime}
2083 formats which may yield only a two-digit year.
2084
2085 @item -Wno-format-extra-args
2086 @opindex Wno-format-extra-args
2087 If @option{-Wformat} is specified, do not warn about excess arguments to a
2088 @code{printf} or @code{scanf} format function.  The C standard specifies
2089 that such arguments are ignored.
2090
2091 Where the unused arguments lie between used arguments that are
2092 specified with @samp{$} operand number specifications, normally
2093 warnings are still given, since the implementation could not know what
2094 type to pass to @code{va_arg} to skip the unused arguments.  However,
2095 in the case of @code{scanf} formats, this option will suppress the
2096 warning if the unused arguments are all pointers, since the Single
2097 Unix Specification says that such unused arguments are allowed.
2098
2099 @item -Wno-format-zero-length
2100 @opindex Wno-format-zero-length
2101 If @option{-Wformat} is specified, do not warn about zero-length formats.
2102 The C standard specifies that zero-length formats are allowed.
2103
2104 @item -Wformat-nonliteral
2105 @opindex Wformat-nonliteral
2106 If @option{-Wformat} is specified, also warn if the format string is not a
2107 string literal and so cannot be checked, unless the format function
2108 takes its format arguments as a @code{va_list}.
2109
2110 @item -Wformat-security
2111 @opindex Wformat-security
2112 If @option{-Wformat} is specified, also warn about uses of format
2113 functions that represent possible security problems.  At present, this
2114 warns about calls to @code{printf} and @code{scanf} functions where the
2115 format string is not a string literal and there are no format arguments,
2116 as in @code{printf (foo);}.  This may be a security hole if the format
2117 string came from untrusted input and contains @samp{%n}.  (This is
2118 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2119 in future warnings may be added to @option{-Wformat-security} that are not
2120 included in @option{-Wformat-nonliteral}.)
2121
2122 @item -Wformat=2
2123 @opindex Wformat=2
2124 Enable @option{-Wformat} plus format checks not included in
2125 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2126 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2127
2128 @item -Wnonnull
2129 @opindex Wnonnull
2130 Warn about passing a null pointer for arguments marked as
2131 requiring a non-null value by the @code{nonnull} function attribute.
2132
2133 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2134 can be disabled with the @option{-Wno-nonnull} option.
2135
2136 @item -Winit-self @r{(C, C++, and Objective-C only)}
2137 @opindex Winit-self
2138 Warn about uninitialized variables which are initialized with themselves.
2139 Note this option can only be used with the @option{-Wuninitialized} option,
2140 which in turn only works with @option{-O1} and above.
2141
2142 For example, GCC will warn about @code{i} being uninitialized in the
2143 following snippet only when @option{-Winit-self} has been specified:
2144 @smallexample
2145 @group
2146 int f()
2147 @{
2148   int i = i;
2149   return i;
2150 @}
2151 @end group
2152 @end smallexample
2153
2154 @item -Wimplicit-int
2155 @opindex Wimplicit-int
2156 Warn when a declaration does not specify a type.
2157
2158 @item -Wimplicit-function-declaration
2159 @itemx -Werror-implicit-function-declaration
2160 @opindex Wimplicit-function-declaration
2161 @opindex Werror-implicit-function-declaration
2162 Give a warning (or error) whenever a function is used before being
2163 declared.
2164
2165 @item -Wimplicit
2166 @opindex Wimplicit
2167 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2168
2169 @item -Wmain
2170 @opindex Wmain
2171 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2172 function with external linkage, returning int, taking either zero
2173 arguments, two, or three arguments of appropriate types.
2174
2175 @item -Wmissing-braces
2176 @opindex Wmissing-braces
2177 Warn if an aggregate or union initializer is not fully bracketed.  In
2178 the following example, the initializer for @samp{a} is not fully
2179 bracketed, but that for @samp{b} is fully bracketed.
2180
2181 @smallexample
2182 int a[2][2] = @{ 0, 1, 2, 3 @};
2183 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2184 @end smallexample
2185
2186 @item -Wparentheses
2187 @opindex Wparentheses
2188 Warn if parentheses are omitted in certain contexts, such
2189 as when there is an assignment in a context where a truth value
2190 is expected, or when operators are nested whose precedence people
2191 often get confused about.
2192
2193 Also warn about constructions where there may be confusion to which
2194 @code{if} statement an @code{else} branch belongs.  Here is an example of
2195 such a case:
2196
2197 @smallexample
2198 @group
2199 @{
2200   if (a)
2201     if (b)
2202       foo ();
2203   else
2204     bar ();
2205 @}
2206 @end group
2207 @end smallexample
2208
2209 In C, every @code{else} branch belongs to the innermost possible @code{if}
2210 statement, which in this example is @code{if (b)}.  This is often not
2211 what the programmer expected, as illustrated in the above example by
2212 indentation the programmer chose.  When there is the potential for this
2213 confusion, GCC will issue a warning when this flag is specified.
2214 To eliminate the warning, add explicit braces around the innermost
2215 @code{if} statement so there is no way the @code{else} could belong to
2216 the enclosing @code{if}.  The resulting code would look like this:
2217
2218 @smallexample
2219 @group
2220 @{
2221   if (a)
2222     @{
2223       if (b)
2224         foo ();
2225       else
2226         bar ();
2227     @}
2228 @}
2229 @end group
2230 @end smallexample
2231
2232 @item -Wsequence-point
2233 @opindex Wsequence-point
2234 Warn about code that may have undefined semantics because of violations
2235 of sequence point rules in the C standard.
2236
2237 The C standard defines the order in which expressions in a C program are
2238 evaluated in terms of @dfn{sequence points}, which represent a partial
2239 ordering between the execution of parts of the program: those executed
2240 before the sequence point, and those executed after it.  These occur
2241 after the evaluation of a full expression (one which is not part of a
2242 larger expression), after the evaluation of the first operand of a
2243 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2244 function is called (but after the evaluation of its arguments and the
2245 expression denoting the called function), and in certain other places.
2246 Other than as expressed by the sequence point rules, the order of
2247 evaluation of subexpressions of an expression is not specified.  All
2248 these rules describe only a partial order rather than a total order,
2249 since, for example, if two functions are called within one expression
2250 with no sequence point between them, the order in which the functions
2251 are called is not specified.  However, the standards committee have
2252 ruled that function calls do not overlap.
2253
2254 It is not specified when between sequence points modifications to the
2255 values of objects take effect.  Programs whose behavior depends on this
2256 have undefined behavior; the C standard specifies that ``Between the
2257 previous and next sequence point an object shall have its stored value
2258 modified at most once by the evaluation of an expression.  Furthermore,
2259 the prior value shall be read only to determine the value to be
2260 stored.''.  If a program breaks these rules, the results on any
2261 particular implementation are entirely unpredictable.
2262
2263 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2264 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2265 diagnosed by this option, and it may give an occasional false positive
2266 result, but in general it has been found fairly effective at detecting
2267 this sort of problem in programs.
2268
2269 The present implementation of this option only works for C programs.  A
2270 future implementation may also work for C++ programs.
2271
2272 The C standard is worded confusingly, therefore there is some debate
2273 over the precise meaning of the sequence point rules in subtle cases.
2274 Links to discussions of the problem, including proposed formal
2275 definitions, may be found on our readings page, at
2276 @w{@uref{http://gcc.gnu.org/readings.html}}.
2277
2278 @item -Wreturn-type
2279 @opindex Wreturn-type
2280 Warn whenever a function is defined with a return-type that defaults to
2281 @code{int}.  Also warn about any @code{return} statement with no
2282 return-value in a function whose return-type is not @code{void}.
2283
2284 For C++, a function without return type always produces a diagnostic
2285 message, even when @option{-Wno-return-type} is specified.  The only
2286 exceptions are @samp{main} and functions defined in system headers.
2287
2288 @item -Wswitch
2289 @opindex Wswitch
2290 Warn whenever a @code{switch} statement has an index of enumeral type
2291 and lacks a @code{case} for one or more of the named codes of that
2292 enumeration.  (The presence of a @code{default} label prevents this
2293 warning.)  @code{case} labels outside the enumeration range also
2294 provoke warnings when this option is used.
2295
2296 @item -Wswitch-default
2297 @opindex Wswitch-switch
2298 Warn whenever a @code{switch} statement does not have a @code{default}
2299 case.
2300
2301 @item -Wswitch-enum
2302 @opindex Wswitch-enum
2303 Warn whenever a @code{switch} statement has an index of enumeral type
2304 and lacks a @code{case} for one or more of the named codes of that
2305 enumeration.  @code{case} labels outside the enumeration range also
2306 provoke warnings when this option is used.
2307
2308 @item -Wtrigraphs
2309 @opindex Wtrigraphs
2310 Warn if any trigraphs are encountered that might change the meaning of
2311 the program (trigraphs within comments are not warned about).
2312
2313 @item -Wunused-function
2314 @opindex Wunused-function
2315 Warn whenever a static function is declared but not defined or a
2316 non\-inline static function is unused.
2317
2318 @item -Wunused-label
2319 @opindex Wunused-label
2320 Warn whenever a label is declared but not used.
2321
2322 To suppress this warning use the @samp{unused} attribute
2323 (@pxref{Variable Attributes}).
2324
2325 @item -Wunused-parameter
2326 @opindex Wunused-parameter
2327 Warn whenever a function parameter is unused aside from its declaration.
2328
2329 To suppress this warning use the @samp{unused} attribute
2330 (@pxref{Variable Attributes}).
2331
2332 @item -Wunused-variable
2333 @opindex Wunused-variable
2334 Warn whenever a local variable or non-constant static variable is unused
2335 aside from its declaration
2336
2337 To suppress this warning use the @samp{unused} attribute
2338 (@pxref{Variable Attributes}).
2339
2340 @item -Wunused-value
2341 @opindex Wunused-value
2342 Warn whenever a statement computes a result that is explicitly not used.
2343
2344 To suppress this warning cast the expression to @samp{void}.
2345
2346 @item -Wunused
2347 @opindex Wunused
2348 All the above @option{-Wunused} options combined.
2349
2350 In order to get a warning about an unused function parameter, you must
2351 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2352 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2353
2354 @item -Wuninitialized
2355 @opindex Wuninitialized
2356 Warn if an automatic variable is used without first being initialized or
2357 if a variable may be clobbered by a @code{setjmp} call.
2358
2359 These warnings are possible only in optimizing compilation,
2360 because they require data flow information that is computed only
2361 when optimizing.  If you don't specify @option{-O}, you simply won't
2362 get these warnings.
2363
2364 If you want to warn about code which uses the uninitialized value of the
2365 variable in its own initializer, use the @option{-Winit-self} option.
2366
2367 These warnings occur only for variables that are candidates for
2368 register allocation.  Therefore, they do not occur for a variable that
2369 is declared @code{volatile}, or whose address is taken, or whose size
2370 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2371 structures, unions or arrays, even when they are in registers.
2372
2373 Note that there may be no warning about a variable that is used only
2374 to compute a value that itself is never used, because such
2375 computations may be deleted by data flow analysis before the warnings
2376 are printed.
2377
2378 These warnings are made optional because GCC is not smart
2379 enough to see all the reasons why the code might be correct
2380 despite appearing to have an error.  Here is one example of how
2381 this can happen:
2382
2383 @smallexample
2384 @group
2385 @{
2386   int x;
2387   switch (y)
2388     @{
2389     case 1: x = 1;
2390       break;
2391     case 2: x = 4;
2392       break;
2393     case 3: x = 5;
2394     @}
2395   foo (x);
2396 @}
2397 @end group
2398 @end smallexample
2399
2400 @noindent
2401 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2402 always initialized, but GCC doesn't know this.  Here is
2403 another common case:
2404
2405 @smallexample
2406 @{
2407   int save_y;
2408   if (change_y) save_y = y, y = new_y;
2409   @dots{}
2410   if (change_y) y = save_y;
2411 @}
2412 @end smallexample
2413
2414 @noindent
2415 This has no bug because @code{save_y} is used only if it is set.
2416
2417 @cindex @code{longjmp} warnings
2418 This option also warns when a non-volatile automatic variable might be
2419 changed by a call to @code{longjmp}.  These warnings as well are possible
2420 only in optimizing compilation.
2421
2422 The compiler sees only the calls to @code{setjmp}.  It cannot know
2423 where @code{longjmp} will be called; in fact, a signal handler could
2424 call it at any point in the code.  As a result, you may get a warning
2425 even when there is in fact no problem because @code{longjmp} cannot
2426 in fact be called at the place which would cause a problem.
2427
2428 Some spurious warnings can be avoided if you declare all the functions
2429 you use that never return as @code{noreturn}.  @xref{Function
2430 Attributes}.
2431
2432 @item -Wunknown-pragmas
2433 @opindex Wunknown-pragmas
2434 @cindex warning for unknown pragmas
2435 @cindex unknown pragmas, warning
2436 @cindex pragmas, warning of unknown
2437 Warn when a #pragma directive is encountered which is not understood by
2438 GCC@.  If this command line option is used, warnings will even be issued
2439 for unknown pragmas in system header files.  This is not the case if
2440 the warnings were only enabled by the @option{-Wall} command line option.
2441
2442 @item -Wstrict-aliasing
2443 @opindex Wstrict-aliasing
2444 This option is only active when @option{-fstrict-aliasing} is active.
2445 It warns about code which might break the strict aliasing rules that the
2446 compiler is using for optimization. The warning does not catch all
2447 cases, but does attempt to catch the more common pitfalls. It is
2448 included in @option{-Wall}.
2449
2450 @item -Wall
2451 @opindex Wall
2452 All of the above @samp{-W} options combined.  This enables all the
2453 warnings about constructions that some users consider questionable, and
2454 that are easy to avoid (or modify to prevent the warning), even in
2455 conjunction with macros.  This also enables some language-specific
2456 warnings described in @ref{C++ Dialect Options} and
2457 @ref{Objective-C Dialect Options}.
2458 @end table
2459
2460 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2461 Some of them warn about constructions that users generally do not
2462 consider questionable, but which occasionally you might wish to check
2463 for; others warn about constructions that are necessary or hard to avoid
2464 in some cases, and there is no simple way to modify the code to suppress
2465 the warning.
2466
2467 @table @gcctabopt
2468 @item -Wextra
2469 @opindex W
2470 @opindex Wextra
2471 (This option used to be called @option{-W}.  The older name is still
2472 supported, but the newer name is more descriptive.)  Print extra warning
2473 messages for these events:
2474
2475 @itemize @bullet
2476 @item
2477 A function can return either with or without a value.  (Falling
2478 off the end of the function body is considered returning without
2479 a value.)  For example, this function would evoke such a
2480 warning:
2481
2482 @smallexample
2483 @group
2484 foo (a)
2485 @{
2486   if (a > 0)
2487     return a;
2488 @}
2489 @end group
2490 @end smallexample
2491
2492 @item
2493 An expression-statement or the left-hand side of a comma expression
2494 contains no side effects.
2495 To suppress the warning, cast the unused expression to void.
2496 For example, an expression such as @samp{x[i,j]} will cause a warning,
2497 but @samp{x[(void)i,j]} will not.
2498
2499 @item
2500 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2501
2502 @item
2503 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2504 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2505 that of ordinary mathematical notation.
2506
2507 @item
2508 Storage-class specifiers like @code{static} are not the first things in
2509 a declaration.  According to the C Standard, this usage is obsolescent.
2510
2511 @item
2512 The return type of a function has a type qualifier such as @code{const}.
2513 Such a type qualifier has no effect, since the value returned by a
2514 function is not an lvalue.  (But don't warn about the GNU extension of
2515 @code{volatile void} return types.  That extension will be warned about
2516 if @option{-pedantic} is specified.)
2517
2518 @item
2519 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2520 arguments.
2521
2522 @item
2523 A comparison between signed and unsigned values could produce an
2524 incorrect result when the signed value is converted to unsigned.
2525 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2526
2527 @item
2528 An aggregate has an initializer which does not initialize all members.
2529 For example, the following code would cause such a warning, because
2530 @code{x.h} would be implicitly initialized to zero:
2531
2532 @smallexample
2533 struct s @{ int f, g, h; @};
2534 struct s x = @{ 3, 4 @};
2535 @end smallexample
2536
2537 @item
2538 A function parameter is declared without a type specifier in K&R-style
2539 functions:
2540
2541 @smallexample
2542 void foo(bar) @{ @}
2543 @end smallexample
2544
2545 @item
2546 An empty body occurs in an @samp{if} or @samp{else} statement.
2547
2548 @item
2549 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2550 @samp{>}, or @samp{>=}.
2551
2552 @item
2553 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2554
2555 @item
2556 Any of several floating-point events that often indicate errors, such as
2557 overflow, underflow, loss of precision, etc.
2558
2559 @item @r{(C++ only)}
2560 An enumerator and a non-enumerator both appear in a conditional expression.
2561
2562 @item @r{(C++ only)}
2563 A non-static reference or non-static @samp{const} member appears in a
2564 class without constructors.
2565
2566 @item @r{(C++ only)}
2567 Ambiguous virtual bases.
2568
2569 @item @r{(C++ only)}
2570 Subscripting an array which has been declared @samp{register}.
2571
2572 @item @r{(C++ only)}
2573 Taking the address of a variable which has been declared @samp{register}.
2574
2575 @item @r{(C++ only)}
2576 A base class is not initialized in a derived class' copy constructor.
2577 @end itemize
2578
2579 @item -Wno-div-by-zero
2580 @opindex Wno-div-by-zero
2581 @opindex Wdiv-by-zero
2582 Do not warn about compile-time integer division by zero.  Floating point
2583 division by zero is not warned about, as it can be a legitimate way of
2584 obtaining infinities and NaNs.
2585
2586 @item -Wsystem-headers
2587 @opindex Wsystem-headers
2588 @cindex warnings from system headers
2589 @cindex system headers, warnings from
2590 Print warning messages for constructs found in system header files.
2591 Warnings from system headers are normally suppressed, on the assumption
2592 that they usually do not indicate real problems and would only make the
2593 compiler output harder to read.  Using this command line option tells
2594 GCC to emit warnings from system headers as if they occurred in user
2595 code.  However, note that using @option{-Wall} in conjunction with this
2596 option will @emph{not} warn about unknown pragmas in system
2597 headers---for that, @option{-Wunknown-pragmas} must also be used.
2598
2599 @item -Wfloat-equal
2600 @opindex Wfloat-equal
2601 Warn if floating point values are used in equality comparisons.
2602
2603 The idea behind this is that sometimes it is convenient (for the
2604 programmer) to consider floating-point values as approximations to
2605 infinitely precise real numbers.  If you are doing this, then you need
2606 to compute (by analyzing the code, or in some other way) the maximum or
2607 likely maximum error that the computation introduces, and allow for it
2608 when performing comparisons (and when producing output, but that's a
2609 different problem).  In particular, instead of testing for equality, you
2610 would check to see whether the two values have ranges that overlap; and
2611 this is done with the relational operators, so equality comparisons are
2612 probably mistaken.
2613
2614 @item -Wtraditional @r{(C only)}
2615 @opindex Wtraditional
2616 Warn about certain constructs that behave differently in traditional and
2617 ISO C@.  Also warn about ISO C constructs that have no traditional C
2618 equivalent, and/or problematic constructs which should be avoided.
2619
2620 @itemize @bullet
2621 @item
2622 Macro parameters that appear within string literals in the macro body.
2623 In traditional C macro replacement takes place within string literals,
2624 but does not in ISO C@.
2625
2626 @item
2627 In traditional C, some preprocessor directives did not exist.
2628 Traditional preprocessors would only consider a line to be a directive
2629 if the @samp{#} appeared in column 1 on the line.  Therefore
2630 @option{-Wtraditional} warns about directives that traditional C
2631 understands but would ignore because the @samp{#} does not appear as the
2632 first character on the line.  It also suggests you hide directives like
2633 @samp{#pragma} not understood by traditional C by indenting them.  Some
2634 traditional implementations would not recognize @samp{#elif}, so it
2635 suggests avoiding it altogether.
2636
2637 @item
2638 A function-like macro that appears without arguments.
2639
2640 @item
2641 The unary plus operator.
2642
2643 @item
2644 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2645 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2646 constants.)  Note, these suffixes appear in macros defined in the system
2647 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2648 Use of these macros in user code might normally lead to spurious
2649 warnings, however gcc's integrated preprocessor has enough context to
2650 avoid warning in these cases.
2651
2652 @item
2653 A function declared external in one block and then used after the end of
2654 the block.
2655
2656 @item
2657 A @code{switch} statement has an operand of type @code{long}.
2658
2659 @item
2660 A non-@code{static} function declaration follows a @code{static} one.
2661 This construct is not accepted by some traditional C compilers.
2662
2663 @item
2664 The ISO type of an integer constant has a different width or
2665 signedness from its traditional type.  This warning is only issued if
2666 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2667 typically represent bit patterns, are not warned about.
2668
2669 @item
2670 Usage of ISO string concatenation is detected.
2671
2672 @item
2673 Initialization of automatic aggregates.
2674
2675 @item
2676 Identifier conflicts with labels.  Traditional C lacks a separate
2677 namespace for labels.
2678
2679 @item
2680 Initialization of unions.  If the initializer is zero, the warning is
2681 omitted.  This is done under the assumption that the zero initializer in
2682 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2683 initializer warnings and relies on default initialization to zero in the
2684 traditional C case.
2685
2686 @item
2687 Conversions by prototypes between fixed/floating point values and vice
2688 versa.  The absence of these prototypes when compiling with traditional
2689 C would cause serious problems.  This is a subset of the possible
2690 conversion warnings, for the full set use @option{-Wconversion}.
2691
2692 @item
2693 Use of ISO C style function definitions.  This warning intentionally is
2694 @emph{not} issued for prototype declarations or variadic functions
2695 because these ISO C features will appear in your code when using
2696 libiberty's traditional C compatibility macros, @code{PARAMS} and
2697 @code{VPARAMS}.  This warning is also bypassed for nested functions
2698 because that feature is already a gcc extension and thus not relevant to
2699 traditional C compatibility.
2700 @end itemize
2701
2702 @item -Wdeclaration-after-statement @r{(C only)}
2703 @opindex Wdeclaration-after-statement
2704 Warn when a declaration is found after a statement in a block.  This
2705 construct, known from C++, was introduced with ISO C99 and is by default
2706 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2707 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2708
2709 @item -Wundef
2710 @opindex Wundef
2711 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2712
2713 @item -Wendif-labels
2714 @opindex Wendif-labels
2715 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2716
2717 @item -Wshadow
2718 @opindex Wshadow
2719 Warn whenever a local variable shadows another local variable, parameter or
2720 global variable or whenever a built-in function is shadowed.
2721
2722 @item -Wlarger-than-@var{len}
2723 @opindex Wlarger-than
2724 Warn whenever an object of larger than @var{len} bytes is defined.
2725
2726 @item -Wpointer-arith
2727 @opindex Wpointer-arith
2728 Warn about anything that depends on the ``size of'' a function type or
2729 of @code{void}.  GNU C assigns these types a size of 1, for
2730 convenience in calculations with @code{void *} pointers and pointers
2731 to functions.
2732
2733 @item -Wbad-function-cast @r{(C only)}
2734 @opindex Wbad-function-cast
2735 Warn whenever a function call is cast to a non-matching type.
2736 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2737
2738 @item -Wcast-qual
2739 @opindex Wcast-qual
2740 Warn whenever a pointer is cast so as to remove a type qualifier from
2741 the target type.  For example, warn if a @code{const char *} is cast
2742 to an ordinary @code{char *}.
2743
2744 @item -Wcast-align
2745 @opindex Wcast-align
2746 Warn whenever a pointer is cast such that the required alignment of the
2747 target is increased.  For example, warn if a @code{char *} is cast to
2748 an @code{int *} on machines where integers can only be accessed at
2749 two- or four-byte boundaries.
2750
2751 @item -Wwrite-strings
2752 @opindex Wwrite-strings
2753 When compiling C, give string constants the type @code{const
2754 char[@var{length}]} so that
2755 copying the address of one into a non-@code{const} @code{char *}
2756 pointer will get a warning; when compiling C++, warn about the
2757 deprecated conversion from string constants to @code{char *}.
2758 These warnings will help you find at
2759 compile time code that can try to write into a string constant, but
2760 only if you have been very careful about using @code{const} in
2761 declarations and prototypes.  Otherwise, it will just be a nuisance;
2762 this is why we did not make @option{-Wall} request these warnings.
2763
2764 @item -Wconversion
2765 @opindex Wconversion
2766 Warn if a prototype causes a type conversion that is different from what
2767 would happen to the same argument in the absence of a prototype.  This
2768 includes conversions of fixed point to floating and vice versa, and
2769 conversions changing the width or signedness of a fixed point argument
2770 except when the same as the default promotion.
2771
2772 Also, warn if a negative integer constant expression is implicitly
2773 converted to an unsigned type.  For example, warn about the assignment
2774 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2775 casts like @code{(unsigned) -1}.
2776
2777 @item -Wsign-compare
2778 @opindex Wsign-compare
2779 @cindex warning for comparison of signed and unsigned values
2780 @cindex comparison of signed and unsigned values, warning
2781 @cindex signed and unsigned values, comparison warning
2782 Warn when a comparison between signed and unsigned values could produce
2783 an incorrect result when the signed value is converted to unsigned.
2784 This warning is also enabled by @option{-Wextra}; to get the other warnings
2785 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2786
2787 @item -Waggregate-return
2788 @opindex Waggregate-return
2789 Warn if any functions that return structures or unions are defined or
2790 called.  (In languages where you can return an array, this also elicits
2791 a warning.)
2792
2793 @item -Wstrict-prototypes @r{(C only)}
2794 @opindex Wstrict-prototypes
2795 Warn if a function is declared or defined without specifying the
2796 argument types.  (An old-style function definition is permitted without
2797 a warning if preceded by a declaration which specifies the argument
2798 types.)
2799
2800 @item -Wold-style-definition @r{(C only)}
2801 @opindex Wold-style-definition
2802 Warn if an old-style function definition is used.  A warning is given
2803 even if there is a previous prototype.
2804
2805 @item -Wmissing-prototypes @r{(C only)}
2806 @opindex Wmissing-prototypes
2807 Warn if a global function is defined without a previous prototype
2808 declaration.  This warning is issued even if the definition itself
2809 provides a prototype.  The aim is to detect global functions that fail
2810 to be declared in header files.
2811
2812 @item -Wmissing-declarations @r{(C only)}
2813 @opindex Wmissing-declarations
2814 Warn if a global function is defined without a previous declaration.
2815 Do so even if the definition itself provides a prototype.
2816 Use this option to detect global functions that are not declared in
2817 header files.
2818
2819 @item -Wmissing-noreturn
2820 @opindex Wmissing-noreturn
2821 Warn about functions which might be candidates for attribute @code{noreturn}.
2822 Note these are only possible candidates, not absolute ones.  Care should
2823 be taken to manually verify functions actually do not ever return before
2824 adding the @code{noreturn} attribute, otherwise subtle code generation
2825 bugs could be introduced.  You will not get a warning for @code{main} in
2826 hosted C environments.
2827
2828 @item -Wmissing-format-attribute
2829 @opindex Wmissing-format-attribute
2830 @opindex Wformat
2831 If @option{-Wformat} is enabled, also warn about functions which might be
2832 candidates for @code{format} attributes.  Note these are only possible
2833 candidates, not absolute ones.  GCC will guess that @code{format}
2834 attributes might be appropriate for any function that calls a function
2835 like @code{vprintf} or @code{vscanf}, but this might not always be the
2836 case, and some functions for which @code{format} attributes are
2837 appropriate may not be detected.  This option has no effect unless
2838 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2839
2840 @item -Wno-multichar
2841 @opindex Wno-multichar
2842 @opindex Wmultichar
2843 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2844 Usually they indicate a typo in the user's code, as they have
2845 implementation-defined values, and should not be used in portable code.
2846
2847 @item -Wno-deprecated-declarations
2848 @opindex Wno-deprecated-declarations
2849 Do not warn about uses of functions, variables, and types marked as
2850 deprecated by using the @code{deprecated} attribute.
2851 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2852 @pxref{Type Attributes}.)
2853
2854 @item -Wpacked
2855 @opindex Wpacked
2856 Warn if a structure is given the packed attribute, but the packed
2857 attribute has no effect on the layout or size of the structure.
2858 Such structures may be mis-aligned for little benefit.  For
2859 instance, in this code, the variable @code{f.x} in @code{struct bar}
2860 will be misaligned even though @code{struct bar} does not itself
2861 have the packed attribute:
2862
2863 @smallexample
2864 @group
2865 struct foo @{
2866   int x;
2867   char a, b, c, d;
2868 @} __attribute__((packed));
2869 struct bar @{
2870   char z;
2871   struct foo f;
2872 @};
2873 @end group
2874 @end smallexample
2875
2876 @item -Wpadded
2877 @opindex Wpadded
2878 Warn if padding is included in a structure, either to align an element
2879 of the structure or to align the whole structure.  Sometimes when this
2880 happens it is possible to rearrange the fields of the structure to
2881 reduce the padding and so make the structure smaller.
2882
2883 @item -Wredundant-decls
2884 @opindex Wredundant-decls
2885 Warn if anything is declared more than once in the same scope, even in
2886 cases where multiple declaration is valid and changes nothing.
2887
2888 @item -Wnested-externs @r{(C only)}
2889 @opindex Wnested-externs
2890 Warn if an @code{extern} declaration is encountered within a function.
2891
2892 @item -Wunreachable-code
2893 @opindex Wunreachable-code
2894 Warn if the compiler detects that code will never be executed.
2895
2896 This option is intended to warn when the compiler detects that at
2897 least a whole line of source code will never be executed, because
2898 some condition is never satisfied or because it is after a
2899 procedure that never returns.
2900
2901 It is possible for this option to produce a warning even though there
2902 are circumstances under which part of the affected line can be executed,
2903 so care should be taken when removing apparently-unreachable code.
2904
2905 For instance, when a function is inlined, a warning may mean that the
2906 line is unreachable in only one inlined copy of the function.
2907
2908 This option is not made part of @option{-Wall} because in a debugging
2909 version of a program there is often substantial code which checks
2910 correct functioning of the program and is, hopefully, unreachable
2911 because the program does work.  Another common use of unreachable
2912 code is to provide behavior which is selectable at compile-time.
2913
2914 @item -Winline
2915 @opindex Winline
2916 Warn if a function can not be inlined and it was declared as inline.
2917 Even with this option, the compiler will not warn about failures to
2918 inline functions declared in system headers.
2919
2920 The compiler uses a variety of heuristics to determine whether or not
2921 to inline a function.  For example, the compiler takes into account
2922 the size of the function being inlined and the the amount of inlining
2923 that has already been done in the current function.  Therefore,
2924 seemingly insignificant changes in the source program can cause the
2925 warnings produced by @option{-Winline} to appear or disappear.
2926
2927 @item -Wno-invalid-offsetof @r{(C++ only)}
2928 @opindex Wno-invalid-offsetof
2929 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
2930 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
2931 to a non-POD type is undefined.  In existing C++ implementations,
2932 however, @samp{offsetof} typically gives meaningful results even when
2933 applied to certain kinds of non-POD types. (Such as a simple
2934 @samp{struct} that fails to be a POD type only by virtue of having a
2935 constructor.)  This flag is for users who are aware that they are
2936 writing nonportable code and who have deliberately chosen to ignore the
2937 warning about it.
2938
2939 The restrictions on @samp{offsetof} may be relaxed in a future version
2940 of the C++ standard.
2941
2942 @item -Winvalid-pch
2943 @opindex Winvalid-pch
2944 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
2945 the search path but can't be used.
2946
2947 @item -Wlong-long
2948 @opindex Wlong-long
2949 @opindex Wno-long-long
2950 Warn if @samp{long long} type is used.  This is default.  To inhibit
2951 the warning messages, use @option{-Wno-long-long}.  Flags
2952 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2953 only when @option{-pedantic} flag is used.
2954
2955 @item -Wvariadic-macros
2956 @opindex Wvariadic-macros
2957 @opindex Wno-variadic-macros
2958 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
2959 alternate syntax when in pedantic ISO C99 mode.  This is default.
2960 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
2961
2962 @item -Wdisabled-optimization
2963 @opindex Wdisabled-optimization
2964 Warn if a requested optimization pass is disabled.  This warning does
2965 not generally indicate that there is anything wrong with your code; it
2966 merely indicates that GCC's optimizers were unable to handle the code
2967 effectively.  Often, the problem is that your code is too big or too
2968 complex; GCC will refuse to optimize programs when the optimization
2969 itself is likely to take inordinate amounts of time.
2970
2971 @item -Werror
2972 @opindex Werror
2973 Make all warnings into errors.
2974 @end table
2975
2976 @node Debugging Options
2977 @section Options for Debugging Your Program or GCC
2978 @cindex options, debugging
2979 @cindex debugging information options
2980
2981 GCC has various special options that are used for debugging
2982 either your program or GCC:
2983
2984 @table @gcctabopt
2985 @item -g
2986 @opindex g
2987 Produce debugging information in the operating system's native format
2988 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
2989 information.
2990
2991 On most systems that use stabs format, @option{-g} enables use of extra
2992 debugging information that only GDB can use; this extra information
2993 makes debugging work better in GDB but will probably make other debuggers
2994 crash or
2995 refuse to read the program.  If you want to control for certain whether
2996 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
2997 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
2998
2999 Unlike most other C compilers, GCC allows you to use @option{-g} with
3000 @option{-O}.  The shortcuts taken by optimized code may occasionally
3001 produce surprising results: some variables you declared may not exist
3002 at all; flow of control may briefly move where you did not expect it;
3003 some statements may not be executed because they compute constant
3004 results or their values were already at hand; some statements may
3005 execute in different places because they were moved out of loops.
3006
3007 Nevertheless it proves possible to debug optimized output.  This makes
3008 it reasonable to use the optimizer for programs that might have bugs.
3009
3010 The following options are useful when GCC is generated with the
3011 capability for more than one debugging format.
3012
3013 @item -ggdb
3014 @opindex ggdb
3015 Produce debugging information for use by GDB@.  This means to use the
3016 most expressive format available (DWARF 2, stabs, or the native format
3017 if neither of those are supported), including GDB extensions if at all
3018 possible.
3019
3020 @item -gstabs
3021 @opindex gstabs
3022 Produce debugging information in stabs format (if that is supported),
3023 without GDB extensions.  This is the format used by DBX on most BSD
3024 systems.  On MIPS, Alpha and System V Release 4 systems this option
3025 produces stabs debugging output which is not understood by DBX or SDB@.
3026 On System V Release 4 systems this option requires the GNU assembler.
3027
3028 @item -feliminate-unused-debug-symbols
3029 @opindex feliminate-unused-debug-symbols
3030 Produce debugging information in stabs format (if that is supported),
3031 for only symbols that are actually used.
3032
3033 @item -gstabs+
3034 @opindex gstabs+
3035 Produce debugging information in stabs format (if that is supported),
3036 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3037 use of these extensions is likely to make other debuggers crash or
3038 refuse to read the program.
3039
3040 @item -gcoff
3041 @opindex gcoff
3042 Produce debugging information in COFF format (if that is supported).
3043 This is the format used by SDB on most System V systems prior to
3044 System V Release 4.
3045
3046 @item -gxcoff
3047 @opindex gxcoff
3048 Produce debugging information in XCOFF format (if that is supported).
3049 This is the format used by the DBX debugger on IBM RS/6000 systems.
3050
3051 @item -gxcoff+
3052 @opindex gxcoff+
3053 Produce debugging information in XCOFF format (if that is supported),
3054 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3055 use of these extensions is likely to make other debuggers crash or
3056 refuse to read the program, and may cause assemblers other than the GNU
3057 assembler (GAS) to fail with an error.
3058
3059 @item -gdwarf-2
3060 @opindex gdwarf-2
3061 Produce debugging information in DWARF version 2 format (if that is
3062 supported).  This is the format used by DBX on IRIX 6.
3063
3064 @item -gvms
3065 @opindex gvms
3066 Produce debugging information in VMS debug format (if that is
3067 supported).  This is the format used by DEBUG on VMS systems.
3068
3069 @item -g@var{level}
3070 @itemx -ggdb@var{level}
3071 @itemx -gstabs@var{level}
3072 @itemx -gcoff@var{level}
3073 @itemx -gxcoff@var{level}
3074 @itemx -gvms@var{level}
3075 Request debugging information and also use @var{level} to specify how
3076 much information.  The default level is 2.
3077
3078 Level 1 produces minimal information, enough for making backtraces in
3079 parts of the program that you don't plan to debug.  This includes
3080 descriptions of functions and external variables, but no information
3081 about local variables and no line numbers.
3082
3083 Level 3 includes extra information, such as all the macro definitions
3084 present in the program.  Some debuggers support macro expansion when
3085 you use @option{-g3}.
3086
3087 Note that in order to avoid confusion between DWARF1 debug level 2,
3088 and DWARF2 @option{-gdwarf-2} does not accept a concatenated debug
3089 level.  Instead use an additional @option{-g@var{level}} option to
3090 change the debug level for DWARF2.
3091
3092 @item -feliminate-dwarf2-dups
3093 @opindex feliminate-dwarf2-dups
3094 Compress DWARF2 debugging information by eliminating duplicated
3095 information about each symbol.  This option only makes sense when
3096 generating DWARF2 debugging information with @option{-gdwarf-2}.
3097
3098 @cindex @command{prof}
3099 @item -p
3100 @opindex p
3101 Generate extra code to write profile information suitable for the
3102 analysis program @command{prof}.  You must use this option when compiling
3103 the source files you want data about, and you must also use it when
3104 linking.
3105
3106 @cindex @command{gprof}
3107 @item -pg
3108 @opindex pg
3109 Generate extra code to write profile information suitable for the
3110 analysis program @command{gprof}.  You must use this option when compiling
3111 the source files you want data about, and you must also use it when
3112 linking.
3113
3114 @item -Q
3115 @opindex Q
3116 Makes the compiler print out each function name as it is compiled, and
3117 print some statistics about each pass when it finishes.
3118
3119 @item -ftime-report
3120 @opindex ftime-report
3121 Makes the compiler print some statistics about the time consumed by each
3122 pass when it finishes.
3123
3124 @item -fmem-report
3125 @opindex fmem-report
3126 Makes the compiler print some statistics about permanent memory
3127 allocation when it finishes.
3128
3129 @item -fprofile-arcs
3130 @opindex fprofile-arcs
3131 Add code so that program flow @dfn{arcs} are instrumented.  During
3132 execution the program records how many times each branch and call is
3133 executed and how many times it is taken or returns.  When the compiled
3134 program exits it saves this data to a file called
3135 @file{@var{auxname}.gcda} for each source file. The data may be used for
3136 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3137 test coverage analysis (@option{-ftest-coverage}). Each object file's
3138 @var{auxname} is generated from the name of the output file, if
3139 explicitly specified and it is not the final executable, otherwise it is
3140 the basename of the source file. In both cases any suffix is removed
3141 (e.g.  @file{foo.gcda} for input file @file{dir/foo.c}, or
3142 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3143
3144 @itemize
3145
3146 @item
3147 Compile the source files with @option{-fprofile-arcs} plus optimization
3148 and code generation options. For test coverage analysis, use the
3149 additional @option{-ftest-coverage} option. You do not need to profile
3150 every source file in a program.
3151
3152 @item
3153 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3154 (the latter implies the former).
3155
3156 @item
3157 Run the program on a representative workload to generate the arc profile
3158 information. This may be repeated any number of times. You can run
3159 concurrent instances of your program, and provided that the file system
3160 supports locking, the data files will be correctly updated. Also
3161 @code{fork} calls are detected and correctly handled (double counting
3162 will not happen).
3163
3164 @item
3165 For profile-directed optimizations, compile the source files again with
3166 the same optimization and code generation options plus
3167 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3168 Control Optimization}).
3169
3170 @item
3171 For test coverage analysis, use @command{gcov} to produce human readable
3172 information from the @file{.gcno} and @file{.gcda} files. Refer to the
3173 @command{gcov} documentation for further information.
3174
3175 @end itemize
3176
3177 With @option{-fprofile-arcs}, for each function of your program GCC
3178 creates a program flow graph, then finds a spanning tree for the graph.
3179 Only arcs that are not on the spanning tree have to be instrumented: the
3180 compiler adds code to count the number of times that these arcs are
3181 executed.  When an arc is the only exit or only entrance to a block, the
3182 instrumentation code can be added to the block; otherwise, a new basic
3183 block must be created to hold the instrumentation code.
3184
3185 @need 2000
3186 @item -ftest-coverage
3187 @opindex ftest-coverage
3188 Produce a notes file that the @command{gcov} code-coverage utility
3189 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3190 show program coverage. Each source file's note file is called
3191 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
3192 above for a description of @var{auxname} and instructions on how to
3193 generate test coverage data. Coverage data will match the source files
3194 more closely, if you do not optimize.
3195
3196 @item -d@var{letters}
3197 @opindex d
3198 Says to make debugging dumps during compilation at times specified by
3199 @var{letters}.  This is used for debugging the compiler.  The file names
3200 for most of the dumps are made by appending a pass number and a word to
3201 the @var{dumpname}. @var{dumpname} is generated from the name of the
3202 output file, if explicitly specified and it is not an executable,
3203 otherwise it is the basename of the source file. In both cases any
3204 suffix is removed (e.g.  @file{foo.01.rtl} or @file{foo.02.sibling}).
3205 Here are the possible letters for use in @var{letters}, and their
3206 meanings:
3207
3208 @table @samp
3209 @item A
3210 @opindex dA
3211 Annotate the assembler output with miscellaneous debugging information.
3212 @item b
3213 @opindex db
3214 Dump after computing branch probabilities, to @file{@var{file}.12.bp}.
3215 @item B
3216 @opindex dB
3217 Dump after block reordering, to @file{@var{file}.31.bbro}.
3218 @item c
3219 @opindex dc
3220 Dump after instruction combination, to the file @file{@var{file}.20.combine}.
3221 @item C
3222 @opindex dC
3223 Dump after the first if conversion, to the file @file{@var{file}.14.ce1}.
3224 Also dump after the second if conversion, to the file @file{@var{file}.21.ce2}.
3225 @item d
3226 @opindex dd
3227 Dump after branch target load optimization, to to @file{@var{file}.32.btl}.
3228 Also dump after delayed branch scheduling, to @file{@var{file}.36.dbr}.
3229 @item D
3230 @opindex dD
3231 Dump all macro definitions, at the end of preprocessing, in addition to
3232 normal output.
3233 @item E
3234 @opindex dE
3235 Dump after the third if conversion, to @file{@var{file}.30.ce3}.
3236 @item f
3237 @opindex df
3238 Dump after control and data flow analysis, to @file{@var{file}.11.cfg}.
3239 Also dump after life analysis, to @file{@var{file}.19.life}.
3240 @item F
3241 @opindex dF
3242 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.07.addressof}.
3243 @item g
3244 @opindex dg
3245 Dump after global register allocation, to @file{@var{file}.25.greg}.
3246 @item G
3247 @opindex dG
3248 Dump after GCSE, to @file{@var{file}.08.gcse}.
3249 Also dump after jump bypassing and control flow optimizations, to
3250 @file{@var{file}.10.bypass}.
3251 @item h
3252 @opindex dh
3253 Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
3254 @item i
3255 @opindex di
3256 Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
3257 @item j
3258 @opindex dj
3259 Dump after the first jump optimization, to @file{@var{file}.04.jump}.
3260 @item k
3261 @opindex dk
3262 Dump after conversion from registers to stack, to @file{@var{file}.34.stack}.
3263 @item l
3264 @opindex dl
3265 Dump after local register allocation, to @file{@var{file}.24.lreg}.
3266 @item L
3267 @opindex dL
3268 Dump after loop optimization passes, to @file{@var{file}.09.loop} and
3269 @file{@var{file}.16.loop2}.
3270 @item M
3271 @opindex dM
3272 Dump after performing the machine dependent reorganization pass, to
3273 @file{@var{file}.35.mach}.
3274 @item n
3275 @opindex dn
3276 Dump after register renumbering, to @file{@var{file}.29.rnreg}.
3277 @item N
3278 @opindex dN
3279 Dump after the register move pass, to @file{@var{file}.22.regmove}.
3280 @item o
3281 @opindex do
3282 Dump after post-reload optimizations, to @file{@var{file}.26.postreload}.
3283 @item r
3284 @opindex dr
3285 Dump after RTL generation, to @file{@var{file}.01.rtl}.
3286 @item R
3287 @opindex dR
3288 Dump after the second scheduling pass, to @file{@var{file}.33.sched2}.
3289 @item s
3290 @opindex ds
3291 Dump after CSE (including the jump optimization that sometimes follows
3292 CSE), to @file{@var{file}.06.cse}.
3293 @item S
3294 @opindex dS
3295 Dump after the first scheduling pass, to @file{@var{file}.23.sched}.
3296 @item t
3297 @opindex dt
3298 Dump after the second CSE pass (including the jump optimization that
3299 sometimes follows CSE), to @file{@var{file}.18.cse2}.
3300 @item T
3301 @opindex dT
3302 Dump after running tracer, to @file{@var{file}.15.tracer}.
3303 @item u
3304 @opindex du
3305 Dump after null pointer elimination pass to @file{@var{file}.05.null}.
3306 @item U
3307 @opindex dU
3308 Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
3309 @item V
3310 @opindex dV
3311 Dump after the value profile transformations, to @file{@var{file}.13.vpt}.
3312 Also dump after variable tracking, to @file{@var{file}.35.vartrack}.
3313 @item w
3314 @opindex dw
3315 Dump after the second flow pass, to @file{@var{file}.27.flow2}.
3316 @item z
3317 @opindex dz
3318 Dump after the peephole pass, to @file{@var{file}.28.peephole2}.
3319 @item Z
3320 @opindex dZ
3321 Dump after constructing the web, to @file{@var{file}.17.web}.
3322 @item a
3323 @opindex da
3324 Produce all the dumps listed above.
3325 @item H
3326 @opindex dH
3327 Produce a core dump whenever an error occurs.
3328 @item m
3329 @opindex dm
3330 Print statistics on memory usage, at the end of the run, to
3331 standard error.
3332 @item p
3333 @opindex dp
3334 Annotate the assembler output with a comment indicating which
3335 pattern and alternative was used.  The length of each instruction is
3336 also printed.
3337 @item P
3338 @opindex dP
3339 Dump the RTL in the assembler output as a comment before each instruction.
3340 Also turns on @option{-dp} annotation.
3341 @item v
3342 @opindex dv
3343 For each of the other indicated dump files (except for
3344 @file{@var{file}.01.rtl}), dump a representation of the control flow graph
3345 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3346 @item x
3347 @opindex dx
3348 Just generate RTL for a function instead of compiling it.  Usually used
3349 with @samp{r}.
3350 @item y
3351 @opindex dy
3352 Dump debugging information during parsing, to standard error.
3353 @end table
3354
3355 @item -fdump-unnumbered
3356 @opindex fdump-unnumbered
3357 When doing debugging dumps (see @option{-d} option above), suppress instruction
3358 numbers and line number note output.  This makes it more feasible to
3359 use diff on debugging dumps for compiler invocations with different
3360 options, in particular with and without @option{-g}.
3361
3362 @item -fdump-translation-unit @r{(C and C++ only)}
3363 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3364 @opindex fdump-translation-unit
3365 Dump a representation of the tree structure for the entire translation
3366 unit to a file.  The file name is made by appending @file{.tu} to the
3367 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3368 controls the details of the dump as described for the
3369 @option{-fdump-tree} options.
3370
3371 @item -fdump-class-hierarchy @r{(C++ only)}
3372 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3373 @opindex fdump-class-hierarchy
3374 Dump a representation of each class's hierarchy and virtual function
3375 table layout to a file.  The file name is made by appending @file{.class}
3376 to the source file name.  If the @samp{-@var{options}} form is used,
3377 @var{options} controls the details of the dump as described for the
3378 @option{-fdump-tree} options.
3379
3380 @item -fdump-tree-@var{switch} @r{(C++ only)}
3381 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3382 @opindex fdump-tree
3383 Control the dumping at various stages of processing the intermediate
3384 language tree to a file.  The file name is generated by appending a switch
3385 specific suffix to the source file name.  If the @samp{-@var{options}}
3386 form is used, @var{options} is a list of @samp{-} separated options that
3387 control the details of the dump. Not all options are applicable to all
3388 dumps, those which are not meaningful will be ignored. The following
3389 options are available
3390
3391 @table @samp
3392 @item address
3393 Print the address of each node.  Usually this is not meaningful as it
3394 changes according to the environment and source file. Its primary use
3395 is for tying up a dump file with a debug environment.
3396 @item slim
3397 Inhibit dumping of members of a scope or body of a function merely
3398 because that scope has been reached. Only dump such items when they
3399 are directly reachable by some other path.
3400 @item all
3401 Turn on all options.
3402 @end table
3403
3404 The following tree dumps are possible:
3405 @table @samp
3406 @item original
3407 Dump before any tree based optimization, to @file{@var{file}.original}.
3408 @item optimized
3409 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3410 @item inlined
3411 Dump after function inlining, to @file{@var{file}.inlined}.
3412 @end table
3413
3414 @item -frandom-seed=@var{string}
3415 @opindex frandom-string
3416 This option provides a seed that GCC uses when it would otherwise use
3417 random numbers.  It is used to generate certain symbol names
3418 that have to be different in every compiled file. It is also used to
3419 place unique stamps in coverage data files and the object files that
3420 produce them. You can use the @option{-frandom-seed} option to produce
3421 reproducibly identical object files.
3422
3423 The @var{string} should be different for every file you compile.
3424
3425 @item -fsched-verbose=@var{n}
3426 @opindex fsched-verbose
3427 On targets that use instruction scheduling, this option controls the
3428 amount of debugging output the scheduler prints.  This information is
3429 written to standard error, unless @option{-dS} or @option{-dR} is
3430 specified, in which case it is output to the usual dump
3431 listing file, @file{.sched} or @file{.sched2} respectively.  However
3432 for @var{n} greater than nine, the output is always printed to standard
3433 error.
3434
3435 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3436 same information as @option{-dRS}.  For @var{n} greater than one, it
3437 also output basic block probabilities, detailed ready list information
3438 and unit/insn info.  For @var{n} greater than two, it includes RTL
3439 at abort point, control-flow and regions info.  And for @var{n} over
3440 four, @option{-fsched-verbose} also includes dependence info.
3441
3442 @item -save-temps
3443 @opindex save-temps
3444 Store the usual ``temporary'' intermediate files permanently; place them
3445 in the current directory and name them based on the source file.  Thus,
3446 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3447 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3448 preprocessed @file{foo.i} output file even though the compiler now
3449 normally uses an integrated preprocessor.
3450
3451 @item -time
3452 @opindex time
3453 Report the CPU time taken by each subprocess in the compilation
3454 sequence.  For C source files, this is the compiler proper and assembler
3455 (plus the linker if linking is done).  The output looks like this:
3456
3457 @smallexample
3458 # cc1 0.12 0.01
3459 # as 0.00 0.01
3460 @end smallexample
3461
3462 The first number on each line is the ``user time,'' that is time spent
3463 executing the program itself.  The second number is ``system time,''
3464 time spent executing operating system routines on behalf of the program.
3465 Both numbers are in seconds.
3466
3467 @item -fvar-tracking
3468 @opindex fvar-tracking
3469 Run variable tracking pass. It computes where variables are stored at each
3470 position in code. Better debugging information is then generated
3471 (if the debugging information format supports this information).
3472
3473 It is enabled by default when compiling with optimization (@option{-Os},
3474 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
3475 the debug info format supports it.
3476
3477 @item -print-file-name=@var{library}
3478 @opindex print-file-name
3479 Print the full absolute name of the library file @var{library} that
3480 would be used when linking---and don't do anything else.  With this
3481 option, GCC does not compile or link anything; it just prints the
3482 file name.
3483
3484 @item -print-multi-directory
3485 @opindex print-multi-directory
3486 Print the directory name corresponding to the multilib selected by any
3487 other switches present in the command line.  This directory is supposed
3488 to exist in @env{GCC_EXEC_PREFIX}.
3489
3490 @item -print-multi-lib
3491 @opindex print-multi-lib
3492 Print the mapping from multilib directory names to compiler switches
3493 that enable them.  The directory name is separated from the switches by
3494 @samp{;}, and each switch starts with an @samp{@@} instead of the
3495 @samp{-}, without spaces between multiple switches.  This is supposed to
3496 ease shell-processing.
3497
3498 @item -print-prog-name=@var{program}
3499 @opindex print-prog-name
3500 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3501
3502 @item -print-libgcc-file-name
3503 @opindex print-libgcc-file-name
3504 Same as @option{-print-file-name=libgcc.a}.
3505
3506 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3507 but you do want to link with @file{libgcc.a}.  You can do
3508
3509 @smallexample
3510 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3511 @end smallexample
3512
3513 @item -print-search-dirs
3514 @opindex print-search-dirs
3515 Print the name of the configured installation directory and a list of
3516 program and library directories gcc will search---and don't do anything else.
3517
3518 This is useful when gcc prints the error message
3519 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3520 To resolve this you either need to put @file{cpp0} and the other compiler
3521 components where gcc expects to find them, or you can set the environment
3522 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3523 Don't forget the trailing '/'.
3524 @xref{Environment Variables}.
3525
3526 @item -dumpmachine
3527 @opindex dumpmachine
3528 Print the compiler's target machine (for example,
3529 @samp{i686-pc-linux-gnu})---and don't do anything else.
3530
3531 @item -dumpversion
3532 @opindex dumpversion
3533 Print the compiler version (for example, @samp{3.0})---and don't do
3534 anything else.
3535
3536 @item -dumpspecs
3537 @opindex dumpspecs
3538 Print the compiler's built-in specs---and don't do anything else.  (This
3539 is used when GCC itself is being built.)  @xref{Spec Files}.
3540
3541 @item -feliminate-unused-debug-types
3542 @opindex feliminate-unused-debug-types
3543 Normally, when producing DWARF2 output, GCC will emit debugging
3544 information for all types declared in a compilation
3545 unit, regardless of whether or not they are actually used
3546 in that compilation unit.  Sometimes this is useful, such as
3547 if, in the debugger, you want to cast a value to a type that is
3548 not actually used in your program (but is declared).  More often,
3549 however, this results in a significant amount of wasted space.
3550 With this option, GCC will avoid producing debug symbol output
3551 for types that are nowhere used in the source file being compiled.
3552 @end table
3553
3554 @node Optimize Options
3555 @section Options That Control Optimization
3556 @cindex optimize options
3557 @cindex options, optimization
3558
3559 These options control various sorts of optimizations.
3560
3561 Without any optimization option, the compiler's goal is to reduce the
3562 cost of compilation and to make debugging produce the expected
3563 results.  Statements are independent: if you stop the program with a
3564 breakpoint between statements, you can then assign a new value to any
3565 variable or change the program counter to any other statement in the
3566 function and get exactly the results you would expect from the source
3567 code.
3568
3569 Turning on optimization flags makes the compiler attempt to improve
3570 the performance and/or code size at the expense of compilation time
3571 and possibly the ability to debug the program.
3572
3573 The compiler performs optimization based on the knowledge it has of
3574 the program.  Using the @option{-funit-at-a-time} flag will allow the
3575 compiler to consider information gained from later functions in the
3576 file when compiling a function.  Compiling multiple files at once to a
3577 single output file (and using @option{-funit-at-a-time}) will allow
3578 the compiler to use information gained from all of the files when
3579 compiling each of them.
3580
3581 Not all optimizations are controlled directly by a flag.  Only
3582 optimizations that have a flag are listed.
3583
3584 @table @gcctabopt
3585 @item -O
3586 @itemx -O1
3587 @opindex O
3588 @opindex O1
3589 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3590 more memory for a large function.
3591
3592 With @option{-O}, the compiler tries to reduce code size and execution
3593 time, without performing any optimizations that take a great deal of
3594 compilation time.
3595
3596 @option{-O} turns on the following optimization flags:
3597 @gccoptlist{-fdefer-pop @gol
3598 -fmerge-constants @gol
3599 -fthread-jumps @gol
3600 -floop-optimize @gol
3601 -fif-conversion @gol
3602 -fif-conversion2 @gol
3603 -fdelayed-branch @gol
3604 -fguess-branch-probability @gol
3605 -fcprop-registers}
3606
3607 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
3608 where doing so does not interfere with debugging.
3609
3610 @item -O2
3611 @opindex O2
3612 Optimize even more.  GCC performs nearly all supported optimizations
3613 that do not involve a space-speed tradeoff.  The compiler does not
3614 perform loop unrolling or function inlining when you specify @option{-O2}.
3615 As compared to @option{-O}, this option increases both compilation time
3616 and the performance of the generated code.
3617
3618 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
3619 also turns on the following optimization flags:
3620 @gccoptlist{-fforce-mem @gol
3621 -foptimize-sibling-calls @gol
3622 -fstrength-reduce @gol
3623 -fcse-follow-jumps  -fcse-skip-blocks @gol
3624 -frerun-cse-after-loop  -frerun-loop-opt @gol
3625 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las @gol
3626 -fdelete-null-pointer-checks @gol
3627 -fexpensive-optimizations @gol
3628 -fregmove @gol
3629 -fschedule-insns  -fschedule-insns2 @gol
3630 -fsched-interblock  -fsched-spec @gol
3631 -fcaller-saves @gol
3632 -fpeephole2 @gol
3633 -freorder-blocks  -freorder-functions @gol
3634 -fstrict-aliasing @gol
3635 -funit-at-a-time @gol
3636 -falign-functions  -falign-jumps @gol
3637 -falign-loops  -falign-labels @gol
3638 -fcrossjumping}
3639
3640 Please note the warning under @option{-fgcse} about
3641 invoking @option{-O2} on programs that use computed gotos.
3642
3643 @item -O3
3644 @opindex O3
3645 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3646 @option{-O2} and also turns on the @option{-finline-functions},
3647 @option{-fweb} and @option{-frename-registers} options.
3648
3649 @item -O0
3650 @opindex O0
3651 Do not optimize.  This is the default.
3652
3653 @item -Os
3654 @opindex Os
3655 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3656 do not typically increase code size.  It also performs further
3657 optimizations designed to reduce code size.
3658
3659 @option{-Os} disables the following optimization flags:
3660 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3661 -falign-labels  -freorder-blocks  -fprefetch-loop-arrays}
3662
3663 If you use multiple @option{-O} options, with or without level numbers,
3664 the last such option is the one that is effective.
3665 @end table
3666
3667 Options of the form @option{-f@var{flag}} specify machine-independent
3668 flags.  Most flags have both positive and negative forms; the negative
3669 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3670 below, only one of the forms is listed---the one you typically will
3671 use.  You can figure out the other form by either removing @samp{no-}
3672 or adding it.
3673
3674 The following options control specific optimizations.  They are either
3675 activated by @option{-O} options or are related to ones that are.  You
3676 can use the following flags in the rare cases when ``fine-tuning'' of
3677 optimizations to be performed is desired.
3678
3679 @table @gcctabopt
3680 @item -fno-default-inline
3681 @opindex fno-default-inline
3682 Do not make member functions inline by default merely because they are
3683 defined inside the class scope (C++ only).  Otherwise, when you specify
3684 @w{@option{-O}}, member functions defined inside class scope are compiled
3685 inline by default; i.e., you don't need to add @samp{inline} in front of
3686 the member function name.
3687
3688 @item -fno-defer-pop
3689 @opindex fno-defer-pop
3690 Always pop the arguments to each function call as soon as that function
3691 returns.  For machines which must pop arguments after a function call,
3692 the compiler normally lets arguments accumulate on the stack for several
3693 function calls and pops them all at once.
3694
3695 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3696
3697 @item -fforce-mem
3698 @opindex fforce-mem
3699 Force memory operands to be copied into registers before doing
3700 arithmetic on them.  This produces better code by making all memory
3701 references potential common subexpressions.  When they are not common
3702 subexpressions, instruction combination should eliminate the separate
3703 register-load.
3704
3705 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3706
3707 @item -fforce-addr
3708 @opindex fforce-addr
3709 Force memory address constants to be copied into registers before
3710 doing arithmetic on them.  This may produce better code just as
3711 @option{-fforce-mem} may.
3712
3713 @item -fomit-frame-pointer
3714 @opindex fomit-frame-pointer
3715 Don't keep the frame pointer in a register for functions that
3716 don't need one.  This avoids the instructions to save, set up and
3717 restore frame pointers; it also makes an extra register available
3718 in many functions.  @strong{It also makes debugging impossible on
3719 some machines.}
3720
3721 On some machines, such as the VAX, this flag has no effect, because
3722 the standard calling sequence automatically handles the frame pointer
3723 and nothing is saved by pretending it doesn't exist.  The
3724 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3725 whether a target machine supports this flag.  @xref{Registers,,Register
3726 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3727
3728 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3729
3730 @item -foptimize-sibling-calls
3731 @opindex foptimize-sibling-calls
3732 Optimize sibling and tail recursive calls.
3733
3734 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3735
3736 @item -fno-inline
3737 @opindex fno-inline
3738 Don't pay attention to the @code{inline} keyword.  Normally this option
3739 is used to keep the compiler from expanding any functions inline.
3740 Note that if you are not optimizing, no functions can be expanded inline.
3741
3742 @item -finline-functions
3743 @opindex finline-functions
3744 Integrate all simple functions into their callers.  The compiler
3745 heuristically decides which functions are simple enough to be worth
3746 integrating in this way.
3747
3748 If all calls to a given function are integrated, and the function is
3749 declared @code{static}, then the function is normally not output as
3750 assembler code in its own right.
3751
3752 Enabled at level @option{-O3}.
3753
3754 @item -finline-limit=@var{n}
3755 @opindex finline-limit
3756 By default, gcc limits the size of functions that can be inlined.  This flag
3757 allows the control of this limit for functions that are explicitly marked as
3758 inline (i.e., marked with the inline keyword or defined within the class
3759 definition in c++).  @var{n} is the size of functions that can be inlined in
3760 number of pseudo instructions (not counting parameter handling).  The default
3761 value of @var{n} is 600.
3762 Increasing this value can result in more inlined code at
3763 the cost of compilation time and memory consumption.  Decreasing usually makes
3764 the compilation faster and less code will be inlined (which presumably
3765 means slower programs).  This option is particularly useful for programs that
3766 use inlining heavily such as those based on recursive templates with C++.
3767
3768 Inlining is actually controlled by a number of parameters, which may be
3769 specified individually by using @option{--param @var{name}=@var{value}}.
3770 The @option{-finline-limit=@var{n}} option sets some of these parameters
3771 as follows:
3772
3773 @table @gcctabopt
3774  @item max-inline-insns-single
3775   is set to @var{n}/2.
3776  @item max-inline-insns-auto
3777   is set to @var{n}/2.
3778  @item min-inline-insns
3779   is set to 130 or @var{n}/4, whichever is smaller.
3780  @item max-inline-insns-rtl
3781   is set to @var{n}.
3782 @end table
3783
3784 See below for a documentation of the individual
3785 parameters controlling inlining.
3786
3787 @emph{Note:} pseudo instruction represents, in this particular context, an
3788 abstract measurement of function's size.  In no way, it represents a count
3789 of assembly instructions and as such its exact meaning might change from one
3790 release to an another.
3791
3792 @item -fkeep-inline-functions
3793 @opindex fkeep-inline-functions
3794 Even if all calls to a given function are integrated, and the function
3795 is declared @code{static}, nevertheless output a separate run-time
3796 callable version of the function.  This switch does not affect
3797 @code{extern inline} functions.
3798
3799 @item -fkeep-static-consts
3800 @opindex fkeep-static-consts
3801 Emit variables declared @code{static const} when optimization isn't turned
3802 on, even if the variables aren't referenced.
3803
3804 GCC enables this option by default.  If you want to force the compiler to
3805 check if the variable was referenced, regardless of whether or not
3806 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3807
3808 @item -fmerge-constants
3809 Attempt to merge identical constants (string constants and floating point
3810 constants) across compilation units.
3811
3812 This option is the default for optimized compilation if the assembler and
3813 linker support it.  Use @option{-fno-merge-constants} to inhibit this
3814 behavior.
3815
3816 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3817
3818 @item -fmerge-all-constants
3819 Attempt to merge identical constants and identical variables.
3820
3821 This option implies @option{-fmerge-constants}.  In addition to
3822 @option{-fmerge-constants} this considers e.g. even constant initialized
3823 arrays or initialized constant variables with integral or floating point
3824 types.  Languages like C or C++ require each non-automatic variable to
3825 have distinct location, so using this option will result in non-conforming
3826 behavior.
3827
3828 @item -fnew-ra
3829 @opindex fnew-ra
3830 Use a graph coloring register allocator.  Currently this option is meant
3831 for testing, so we are interested to hear about miscompilations with
3832 @option{-fnew-ra}.
3833
3834 @item -fno-branch-count-reg
3835 @opindex fno-branch-count-reg
3836 Do not use ``decrement and branch'' instructions on a count register,
3837 but instead generate a sequence of instructions that decrement a
3838 register, compare it against zero, then branch based upon the result.
3839 This option is only meaningful on architectures that support such
3840 instructions, which include x86, PowerPC, IA-64 and S/390.
3841
3842 The default is @option{-fbranch-count-reg}, enabled when
3843 @option{-fstrength-reduce} is enabled.
3844
3845 @item -fno-function-cse
3846 @opindex fno-function-cse
3847 Do not put function addresses in registers; make each instruction that
3848 calls a constant function contain the function's address explicitly.
3849
3850 This option results in less efficient code, but some strange hacks
3851 that alter the assembler output may be confused by the optimizations
3852 performed when this option is not used.
3853
3854 The default is @option{-ffunction-cse}
3855
3856 @item -fno-zero-initialized-in-bss
3857 @opindex fno-zero-initialized-in-bss
3858 If the target supports a BSS section, GCC by default puts variables that
3859 are initialized to zero into BSS@.  This can save space in the resulting
3860 code.
3861
3862 This option turns off this behavior because some programs explicitly
3863 rely on variables going to the data section.  E.g., so that the
3864 resulting executable can find the beginning of that section and/or make
3865 assumptions based on that.
3866
3867 The default is @option{-fzero-initialized-in-bss}.
3868
3869 @item -fstrength-reduce
3870 @opindex fstrength-reduce
3871 Perform the optimizations of loop strength reduction and
3872 elimination of iteration variables.
3873
3874 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3875
3876 @item -fthread-jumps
3877 @opindex fthread-jumps
3878 Perform optimizations where we check to see if a jump branches to a
3879 location where another comparison subsumed by the first is found.  If
3880 so, the first branch is redirected to either the destination of the
3881 second branch or a point immediately following it, depending on whether
3882 the condition is known to be true or false.
3883
3884 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3885
3886 @item -fcse-follow-jumps
3887 @opindex fcse-follow-jumps
3888 In common subexpression elimination, scan through jump instructions
3889 when the target of the jump is not reached by any other path.  For
3890 example, when CSE encounters an @code{if} statement with an
3891 @code{else} clause, CSE will follow the jump when the condition
3892 tested is false.
3893
3894 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3895
3896 @item -fcse-skip-blocks
3897 @opindex fcse-skip-blocks
3898 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3899 follow jumps which conditionally skip over blocks.  When CSE
3900 encounters a simple @code{if} statement with no else clause,
3901 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3902 body of the @code{if}.
3903
3904 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3905
3906 @item -frerun-cse-after-loop
3907 @opindex frerun-cse-after-loop
3908 Re-run common subexpression elimination after loop optimizations has been
3909 performed.
3910
3911 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3912
3913 @item -frerun-loop-opt
3914 @opindex frerun-loop-opt
3915 Run the loop optimizer twice.
3916
3917 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3918
3919 @item -fgcse
3920 @opindex fgcse
3921 Perform a global common subexpression elimination pass.
3922 This pass also performs global constant and copy propagation.
3923
3924 @emph{Note:} When compiling a program using computed gotos, a GCC
3925 extension, you may get better runtime performance if you disable
3926 the global common subexpression elimination pass by adding
3927 @option{-fno-gcse} to the command line.
3928
3929 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3930
3931 @item -fgcse-lm
3932 @opindex fgcse-lm
3933 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3934 attempt to move loads which are only killed by stores into themselves.  This
3935 allows a loop containing a load/store sequence to be changed to a load outside
3936 the loop, and a copy/store within the loop.
3937
3938 Enabled by default when gcse is enabled.
3939
3940 @item -fgcse-sm
3941 @opindex fgcse-sm
3942 When @option{-fgcse-sm} is enabled, a store motion pass is run after
3943 global common subexpression elimination.  This pass will attempt to move
3944 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
3945 loops containing a load/store sequence can be changed to a load before
3946 the loop and a store after the loop.
3947
3948 Enabled by default when gcse is enabled.
3949
3950 @item -fgcse-las
3951 @opindex fgcse-las
3952 When @option{-fgcse-las} is enabled, the global common subexpression
3953 elimination pass eliminates redundant loads that come after stores to the
3954 same memory location (both partial and full redundancies).
3955
3956 Enabled by default when gcse is enabled.
3957
3958 @item -floop-optimize
3959 @opindex floop-optimize
3960 Perform loop optimizations: move constant expressions out of loops, simplify
3961 exit test conditions and optionally do strength-reduction and loop unrolling as
3962 well.
3963
3964 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3965
3966 @item -fcrossjumping
3967 @opindex crossjumping
3968 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
3969 resulting code may or may not perform better than without cross-jumping.
3970
3971 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3972
3973 @item -fif-conversion
3974 @opindex if-conversion
3975 Attempt to transform conditional jumps into branch-less equivalents.  This
3976 include use of conditional moves, min, max, set flags and abs instructions, and
3977 some tricks doable by standard arithmetics.  The use of conditional execution
3978 on chips where it is available is controlled by @code{if-conversion2}.
3979
3980 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3981
3982 @item -fif-conversion2
3983 @opindex if-conversion2
3984 Use conditional execution (where available) to transform conditional jumps into
3985 branch-less equivalents.
3986
3987 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3988
3989 @item -fdelete-null-pointer-checks
3990 @opindex fdelete-null-pointer-checks
3991 Use global dataflow analysis to identify and eliminate useless checks
3992 for null pointers.  The compiler assumes that dereferencing a null
3993 pointer would have halted the program.  If a pointer is checked after
3994 it has already been dereferenced, it cannot be null.
3995
3996 In some environments, this assumption is not true, and programs can
3997 safely dereference null pointers.  Use
3998 @option{-fno-delete-null-pointer-checks} to disable this optimization
3999 for programs which depend on that behavior.
4000
4001 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4002
4003 @item -fexpensive-optimizations
4004 @opindex fexpensive-optimizations
4005 Perform a number of minor optimizations that are relatively expensive.
4006
4007 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4008
4009 @item -foptimize-register-move
4010 @itemx -fregmove
4011 @opindex foptimize-register-move
4012 @opindex fregmove
4013 Attempt to reassign register numbers in move instructions and as
4014 operands of other simple instructions in order to maximize the amount of
4015 register tying.  This is especially helpful on machines with two-operand
4016 instructions.
4017
4018 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4019 optimization.
4020
4021 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4022
4023 @item -fdelayed-branch
4024 @opindex fdelayed-branch
4025 If supported for the target machine, attempt to reorder instructions
4026 to exploit instruction slots available after delayed branch
4027 instructions.
4028
4029 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4030
4031 @item -fschedule-insns
4032 @opindex fschedule-insns
4033 If supported for the target machine, attempt to reorder instructions to
4034 eliminate execution stalls due to required data being unavailable.  This
4035 helps machines that have slow floating point or memory load instructions
4036 by allowing other instructions to be issued until the result of the load
4037 or floating point instruction is required.
4038
4039 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4040
4041 @item -fschedule-insns2
4042 @opindex fschedule-insns2
4043 Similar to @option{-fschedule-insns}, but requests an additional pass of
4044 instruction scheduling after register allocation has been done.  This is
4045 especially useful on machines with a relatively small number of
4046 registers and where memory load instructions take more than one cycle.
4047
4048 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4049
4050 @item -fno-sched-interblock
4051 @opindex fno-sched-interblock
4052 Don't schedule instructions across basic blocks.  This is normally
4053 enabled by default when scheduling before register allocation, i.e.@:
4054 with @option{-fschedule-insns} or at @option{-O2} or higher.
4055
4056 @item -fno-sched-spec
4057 @opindex fno-sched-spec
4058 Don't allow speculative motion of non-load instructions.  This is normally
4059 enabled by default when scheduling before register allocation, i.e.@:
4060 with @option{-fschedule-insns} or at @option{-O2} or higher.
4061
4062 @item -fsched-spec-load
4063 @opindex fsched-spec-load
4064 Allow speculative motion of some load instructions.  This only makes
4065 sense when scheduling before register allocation, i.e.@: with
4066 @option{-fschedule-insns} or at @option{-O2} or higher.
4067
4068 @item -fsched-spec-load-dangerous
4069 @opindex fsched-spec-load-dangerous
4070 Allow speculative motion of more load instructions.  This only makes
4071 sense when scheduling before register allocation, i.e.@: with
4072 @option{-fschedule-insns} or at @option{-O2} or higher.
4073
4074 @item -fsched-stalled-insns=@var{n}
4075 @opindex fsched-stalled-insns
4076 Define how many insns (if any) can be moved prematurely from the queue
4077 of stalled insns into the ready list, during the second scheduling pass.
4078
4079 @item -fsched-stalled-insns-dep=@var{n}
4080 @opindex fsched-stalled-insns-dep
4081 Define how many insn groups (cycles) will be examined for a dependency
4082 on a stalled insn that is candidate for premature removal from the queue
4083 of stalled insns.  Has an effect only during the second scheduling pass,
4084 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4085
4086 @item -fsched2-use-superblocks
4087 @opindex fsched2-use-superblocks
4088 When scheduling after register allocation, do use superblock scheduling
4089 algorithm.  Superblock scheduling allows motion across basic block boundaries
4090 resulting on faster schedules.  This option is experimental, as not all machine
4091 descriptions used by GCC model the CPU closely enough to avoid unreliable
4092 results from the algorithm.
4093
4094 This only makes sense when scheduling after register allocation, i.e.@: with
4095 @option{-fschedule-insns2} or at @option{-O2} or higher.
4096
4097 @item -fsched2-use-traces
4098 @opindex fsched2-use-traces
4099 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4100 allocation and additionally perform code duplication in order to increase the
4101 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4102 trace formation.
4103
4104 This mode should produce faster but significantly longer programs.  Also
4105 without @code{-fbranch-probabilities} the traces constructed may not match the
4106 reality and hurt the performance.  This only makes
4107 sense when scheduling after register allocation, i.e.@: with
4108 @option{-fschedule-insns2} or at @option{-O2} or higher.
4109
4110 @item -fcaller-saves
4111 @opindex fcaller-saves
4112 Enable values to be allocated in registers that will be clobbered by
4113 function calls, by emitting extra instructions to save and restore the
4114 registers around such calls.  Such allocation is done only when it
4115 seems to result in better code than would otherwise be produced.
4116
4117 This option is always enabled by default on certain machines, usually
4118 those which have no call-preserved registers to use instead.
4119
4120 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4121
4122 @item -fmove-all-movables
4123 @opindex fmove-all-movables
4124 Forces all invariant computations in loops to be moved
4125 outside the loop.
4126
4127 @item -freduce-all-givs
4128 @opindex freduce-all-givs
4129 Forces all general-induction variables in loops to be
4130 strength-reduced.
4131
4132 @emph{Note:} When compiling programs written in Fortran,
4133 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
4134 by default when you use the optimizer.
4135
4136 These options may generate better or worse code; results are highly
4137 dependent on the structure of loops within the source code.
4138
4139 These two options are intended to be removed someday, once
4140 they have helped determine the efficacy of various
4141 approaches to improving loop optimizations.
4142
4143 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
4144 know how use of these options affects
4145 the performance of your production code.
4146 We're very interested in code that runs @emph{slower}
4147 when these options are @emph{enabled}.
4148
4149 @item -fno-peephole
4150 @itemx -fno-peephole2
4151 @opindex fno-peephole
4152 @opindex fno-peephole2
4153 Disable any machine-specific peephole optimizations.  The difference
4154 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
4155 are implemented in the compiler; some targets use one, some use the
4156 other, a few use both.
4157
4158 @option{-fpeephole} is enabled by default.
4159 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4160
4161 @item -fno-guess-branch-probability
4162 @opindex fno-guess-branch-probability
4163 Do not guess branch probabilities using a randomized model.
4164
4165 Sometimes gcc will opt to use a randomized model to guess branch
4166 probabilities, when none are available from either profiling feedback
4167 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
4168 different runs of the compiler on the same program may produce different
4169 object code.
4170
4171 In a hard real-time system, people don't want different runs of the
4172 compiler to produce code that has different behavior; minimizing
4173 non-determinism is of paramount import.  This switch allows users to
4174 reduce non-determinism, possibly at the expense of inferior
4175 optimization.
4176
4177 The default is @option{-fguess-branch-probability} at levels
4178 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4179
4180 @item -freorder-blocks
4181 @opindex freorder-blocks
4182 Reorder basic blocks in the compiled function in order to reduce number of
4183 taken branches and improve code locality.
4184
4185 Enabled at levels @option{-O2}, @option{-O3}.
4186
4187 @item -freorder-functions
4188 @opindex freorder-functions
4189 Reorder basic blocks in the compiled function in order to reduce number of
4190 taken branches and improve code locality. This is implemented by using special
4191 subsections @code{text.hot} for most frequently executed functions and
4192 @code{text.unlikely} for unlikely executed functions.  Reordering is done by
4193 the linker so object file format must support named sections and linker must
4194 place them in a reasonable way.
4195
4196 Also profile feedback must be available in to make this option effective.  See
4197 @option{-fprofile-arcs} for details.
4198
4199 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4200
4201 @item -fstrict-aliasing
4202 @opindex fstrict-aliasing
4203 Allows the compiler to assume the strictest aliasing rules applicable to
4204 the language being compiled.  For C (and C++), this activates
4205 optimizations based on the type of expressions.  In particular, an
4206 object of one type is assumed never to reside at the same address as an
4207 object of a different type, unless the types are almost the same.  For
4208 example, an @code{unsigned int} can alias an @code{int}, but not a
4209 @code{void*} or a @code{double}.  A character type may alias any other
4210 type.
4211
4212 Pay special attention to code like this:
4213 @smallexample
4214 union a_union @{
4215   int i;
4216   double d;
4217 @};
4218
4219 int f() @{
4220   a_union t;
4221   t.d = 3.0;
4222   return t.i;
4223 @}
4224 @end smallexample
4225 The practice of reading from a different union member than the one most
4226 recently written to (called ``type-punning'') is common.  Even with
4227 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4228 is accessed through the union type.  So, the code above will work as
4229 expected.  However, this code might not:
4230 @smallexample
4231 int f() @{
4232   a_union t;
4233   int* ip;
4234   t.d = 3.0;
4235   ip = &t.i;
4236   return *ip;
4237 @}
4238 @end smallexample
4239
4240 Every language that wishes to perform language-specific alias analysis
4241 should define a function that computes, given an @code{tree}
4242 node, an alias set for the node.  Nodes in different alias sets are not
4243 allowed to alias.  For an example, see the C front-end function
4244 @code{c_get_alias_set}.
4245
4246 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4247
4248 @item -falign-functions
4249 @itemx -falign-functions=@var{n}
4250 @opindex falign-functions
4251 Align the start of functions to the next power-of-two greater than
4252 @var{n}, skipping up to @var{n} bytes.  For instance,
4253 @option{-falign-functions=32} aligns functions to the next 32-byte
4254 boundary, but @option{-falign-functions=24} would align to the next
4255 32-byte boundary only if this can be done by skipping 23 bytes or less.
4256
4257 @option{-fno-align-functions} and @option{-falign-functions=1} are
4258 equivalent and mean that functions will not be aligned.
4259
4260 Some assemblers only support this flag when @var{n} is a power of two;
4261 in that case, it is rounded up.
4262
4263 If @var{n} is not specified or is zero, use a machine-dependent default.
4264
4265 Enabled at levels @option{-O2}, @option{-O3}.
4266
4267 @item -falign-labels
4268 @itemx -falign-labels=@var{n}
4269 @opindex falign-labels
4270 Align all branch targets to a power-of-two boundary, skipping up to
4271 @var{n} bytes like @option{-falign-functions}.  This option can easily
4272 make code slower, because it must insert dummy operations for when the
4273 branch target is reached in the usual flow of the code.
4274
4275 @option{-fno-align-labels} and @option{-falign-labels=1} are
4276 equivalent and mean that labels will not be aligned.
4277
4278 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4279 are greater than this value, then their values are used instead.
4280
4281 If @var{n} is not specified or is zero, use a machine-dependent default
4282 which is very likely to be @samp{1}, meaning no alignment.
4283
4284 Enabled at levels @option{-O2}, @option{-O3}.
4285
4286 @item -falign-loops
4287 @itemx -falign-loops=@var{n}
4288 @opindex falign-loops
4289 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4290 like @option{-falign-functions}.  The hope is that the loop will be
4291 executed many times, which will make up for any execution of the dummy
4292 operations.
4293
4294 @option{-fno-align-loops} and @option{-falign-loops=1} are
4295 equivalent and mean that loops will not be aligned.
4296
4297 If @var{n} is not specified or is zero, use a machine-dependent default.
4298
4299 Enabled at levels @option{-O2}, @option{-O3}.
4300
4301 @item -falign-jumps
4302 @itemx -falign-jumps=@var{n}
4303 @opindex falign-jumps
4304 Align branch targets to a power-of-two boundary, for branch targets
4305 where the targets can only be reached by jumping, skipping up to @var{n}
4306 bytes like @option{-falign-functions}.  In this case, no dummy operations
4307 need be executed.
4308
4309 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
4310 equivalent and mean that loops will not be aligned.
4311
4312 If @var{n} is not specified or is zero, use a machine-dependent default.
4313
4314 Enabled at levels @option{-O2}, @option{-O3}.
4315
4316 @item -frename-registers
4317 @opindex frename-registers
4318 Attempt to avoid false dependencies in scheduled code by making use
4319 of registers left over after register allocation.  This optimization
4320 will most benefit processors with lots of registers.  It can, however,
4321 make debugging impossible, since variables will no longer stay in
4322 a ``home register''.
4323
4324 @item -fweb
4325 @opindex fweb
4326 Constructs webs as commonly used for register allocation purposes and assign
4327 each web individual pseudo register.  This allows our register allocation pass
4328 to operate on pseudos directly, but also strengthens several other optimization
4329 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
4330 however, make debugging impossible, since variables will no longer stay in a
4331 ``home register''.
4332
4333 Enabled at levels @option{-O3}.
4334
4335 @item -fno-cprop-registers
4336 @opindex fno-cprop-registers
4337 After register allocation and post-register allocation instruction splitting,
4338 we perform a copy-propagation pass to try to reduce scheduling dependencies
4339 and occasionally eliminate the copy.
4340
4341 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4342
4343 @item -fprofile-generate
4344 @opindex fprofile-generate
4345 Enable options usually used for instrumenting application to produce profile usefull
4346 for later recompilation profile feedback based optimization.
4347
4348 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}
4349
4350 @item -fprofile-use
4351 @opindex fprofile-use
4352 Enable profile feedback directed optimizations, and optimizations
4353 generally profitable only with profile feedback available.
4354
4355 The following options are enabled: @code{-fbranch-probabilities},
4356 @code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
4357
4358 @end table
4359
4360 The following options control compiler behavior regarding floating
4361 point arithmetic.  These options trade off between speed and
4362 correctness.  All must be specifically enabled.
4363
4364 @table @gcctabopt
4365 @item -ffloat-store
4366 @opindex ffloat-store
4367 Do not store floating point variables in registers, and inhibit other
4368 options that might change whether a floating point value is taken from a
4369 register or memory.
4370
4371 @cindex floating point precision
4372 This option prevents undesirable excess precision on machines such as
4373 the 68000 where the floating registers (of the 68881) keep more
4374 precision than a @code{double} is supposed to have.  Similarly for the
4375 x86 architecture.  For most programs, the excess precision does only
4376 good, but a few programs rely on the precise definition of IEEE floating
4377 point.  Use @option{-ffloat-store} for such programs, after modifying
4378 them to store all pertinent intermediate computations into variables.
4379
4380 @item -ffast-math
4381 @opindex ffast-math
4382 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4383 @option{-fno-trapping-math}, @option{-ffinite-math-only},
4384 @option{-fno-rounding-math} and @option{-fno-signaling-nans}.
4385
4386 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4387
4388 This option should never be turned on by any @option{-O} option since
4389 it can result in incorrect output for programs which depend on
4390 an exact implementation of IEEE or ISO rules/specifications for
4391 math functions.
4392
4393 @item -fno-math-errno
4394 @opindex fno-math-errno
4395 Do not set ERRNO after calling math functions that are executed
4396 with a single instruction, e.g., sqrt.  A program that relies on
4397 IEEE exceptions for math error handling may want to use this flag
4398 for speed while maintaining IEEE arithmetic compatibility.
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 The default is @option{-fmath-errno}.
4406
4407 @item -funsafe-math-optimizations
4408 @opindex funsafe-math-optimizations
4409 Allow optimizations for floating-point arithmetic that (a) assume
4410 that arguments and results are valid and (b) may violate IEEE or
4411 ANSI standards.  When used at link-time, it may include libraries
4412 or startup files that change the default FPU control word or other
4413 similar optimizations.
4414
4415 This option should never be turned on by any @option{-O} option since
4416 it can result in incorrect output for programs which depend on
4417 an exact implementation of IEEE or ISO rules/specifications for
4418 math functions.
4419
4420 The default is @option{-fno-unsafe-math-optimizations}.
4421
4422 @item -ffinite-math-only
4423 @opindex ffinite-math-only
4424 Allow optimizations for floating-point arithmetic that assume
4425 that arguments and results are not NaNs or +-Infs.
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.
4430
4431 The default is @option{-fno-finite-math-only}.
4432
4433 @item -fno-trapping-math
4434 @opindex fno-trapping-math
4435 Compile code assuming that floating-point operations cannot generate
4436 user-visible traps.  These traps include division by zero, overflow,
4437 underflow, inexact result and invalid operation.  This option implies
4438 @option{-fno-signaling-nans}.  Setting this option may allow faster
4439 code if one relies on ``non-stop'' IEEE arithmetic, for example.
4440
4441 This option should never be turned on by any @option{-O} option since
4442 it can result in incorrect output for programs which depend on
4443 an exact implementation of IEEE or ISO rules/specifications for
4444 math functions.
4445
4446 The default is @option{-ftrapping-math}.
4447
4448 @item -frounding-math
4449 @opindex frounding-math
4450 Disable transformations and optimizations that assume default floating
4451 point rounding behavior.  This is round-to-zero for all floating point
4452 to integer conversions, and round-to-nearest for all other arithmetic
4453 truncations.  This option should be specified for programs that change
4454 the FP rounding mode dynamically, or that may be executed with a
4455 non-default rounding mode.  This option disables constant folding of
4456 floating point expressions at compile-time (which may be affected by
4457 rounding mode) and arithmetic transformations that are unsafe in the
4458 presence of sign-dependent rounding modes.
4459
4460 The default is @option{-fno-rounding-math}.
4461
4462 This option is experimental and does not currently guarantee to
4463 disable all GCC optimizations that are affected by rounding mode.
4464 Future versions of gcc may provide finer control of this setting
4465 using C99's @code{FENV_ACCESS} pragma.  This command line option
4466 will be used to specify the default state for @code{FENV_ACCESS}.
4467
4468 @item -fsignaling-nans
4469 @opindex fsignaling-nans
4470 Compile code assuming that IEEE signaling NaNs may generate user-visible
4471 traps during floating-point operations.  Setting this option disables
4472 optimizations that may change the number of exceptions visible with
4473 signaling NaNs.  This option implies @option{-ftrapping-math}.
4474
4475 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4476 be defined.
4477
4478 The default is @option{-fno-signaling-nans}.
4479
4480 This option is experimental and does not currently guarantee to
4481 disable all GCC optimizations that affect signaling NaN behavior.
4482
4483 @item -fsingle-precision-constant
4484 @opindex fsingle-precision-constant
4485 Treat floating point constant as single precision constant instead of
4486 implicitly converting it to double precision constant.
4487
4488
4489 @end table
4490
4491 The following options control optimizations that may improve
4492 performance, but are not enabled by any @option{-O} options.  This
4493 section includes experimental options that may produce broken code.
4494
4495 @table @gcctabopt
4496 @item -fbranch-probabilities
4497 @opindex fbranch-probabilities
4498 After running a program compiled with @option{-fprofile-arcs}
4499 (@pxref{Debugging Options,, Options for Debugging Your Program or
4500 @command{gcc}}), you can compile it a second time using
4501 @option{-fbranch-probabilities}, to improve optimizations based on
4502 the number of times each branch was taken.  When the program
4503 compiled with @option{-fprofile-arcs} exits it saves arc execution
4504 counts to a file called @file{@var{sourcename}.gcda} for each source
4505 file  The information in this data file is very dependent on the
4506 structure of the generated code, so you must use the same source code
4507 and the same optimization options for both compilations.
4508
4509 With @option{-fbranch-probabilities}, GCC puts a
4510 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4511 These can be used to improve optimization.  Currently, they are only
4512 used in one place: in @file{reorg.c}, instead of guessing which path a
4513 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4514 exactly determine which path is taken more often.
4515
4516 @item -fprofile-values
4517 @opindex fprofile-values
4518 If combined with @option{-fprofile-arcs}, it adds code so that some
4519 data about values of expressions in the program is gathered.
4520
4521 With @option{-fbranch-probabilities}, it reads back the data gathered
4522 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4523 notes to instructions for their later usage in optimizations.
4524
4525 @item -fvpt
4526 @opindex fvpt
4527 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
4528 a code to gather information about values of expressions.
4529
4530 With @option{-fbranch-probabilities}, it reads back the data gathered
4531 and actually performs the optimizations based on them.
4532 Currently the optimizations include specialization of division operation
4533 using the knowledge about the value of the denominator.
4534
4535 @item -fnew-ra
4536 @opindex fnew-ra
4537 Use a graph coloring register allocator.  Currently this option is meant
4538 for testing, so we are interested to hear about miscompilations with
4539 @option{-fnew-ra}.
4540
4541 @item -ftracer
4542 @opindex ftracer
4543 Perform tail duplication to enlarge superblock size. This transformation
4544 simplifies the control flow of the function allowing other optimizations to do
4545 better job.
4546
4547 @item -funit-at-a-time
4548 @opindex funit-at-a-time
4549 Parse the whole compilation unit before starting to produce code.
4550 This allows some extra optimizations to take place but consumes more
4551 memory.
4552
4553 @item -funroll-loops
4554 @opindex funroll-loops
4555 Unroll loops whose number of iterations can be determined at compile time or
4556 upon entry to the loop.  @option{-funroll-loops} implies
4557 @option{-frerun-cse-after-loop}.  It also turns on complete loop peeling
4558 (i.e. complete removal of loops with small constant number of iterations).
4559 This option makes code larger, and may or may not make it run faster.
4560
4561 @item -funroll-all-loops
4562 @opindex funroll-all-loops
4563 Unroll all loops, even if their number of iterations is uncertain when
4564 the loop is entered.  This usually makes programs run more slowly.
4565 @option{-funroll-all-loops} implies the same options as
4566 @option{-funroll-loops}.
4567
4568 @item -fpeel-loops
4569 @opindex fpeel-loops
4570 Peels the loops for that there is enough information that they do not
4571 roll much (from profile feedback).  It also turns on complete loop peeling
4572 (i.e. complete removal of loops with small constant number of iterations).
4573
4574 @item -funswitch-loops
4575 @opindex funswitch-loops
4576 Move branches with loop invariant conditions out of the loop, with duplicates
4577 of the loop on both branches (modified according to result of the condition).
4578
4579 @item -fold-unroll-loops
4580 @opindex fold-unroll-loops
4581 Unroll loops whose number of iterations can be determined at compile
4582 time or upon entry to the loop, using the old loop unroller whose loop
4583 recognition is based on notes from frontend.  @option{-fold-unroll-loops} implies
4584 both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4585 option makes code larger, and may or may not make it run faster.
4586
4587 @item -fold-unroll-all-loops
4588 @opindex fold-unroll-all-loops
4589 Unroll all loops, even if their number of iterations is uncertain when
4590 the loop is entered. This is done using the old loop unroller whose loop
4591 recognition is based on notes from frontend.  This usually makes programs run more slowly.
4592 @option{-fold-unroll-all-loops} implies the same options as
4593 @option{-fold-unroll-loops}.
4594
4595 @item -funswitch-loops
4596 @opindex funswitch-loops
4597 Move branches with loop invariant conditions out of the loop, with duplicates
4598 of the loop on both branches (modified according to result of the condition).
4599
4600 @item -funswitch-loops
4601 @opindex funswitch-loops
4602 Move branches with loop invariant conditions out of the loop, with duplicates
4603 of the loop on both branches (modified according to result of the condition).
4604
4605 @item -fprefetch-loop-arrays
4606 @opindex fprefetch-loop-arrays
4607 If supported by the target machine, generate instructions to prefetch
4608 memory to improve the performance of loops that access large arrays.
4609
4610 Disabled at level @option{-Os}.
4611
4612 @item -ffunction-sections
4613 @itemx -fdata-sections
4614 @opindex ffunction-sections
4615 @opindex fdata-sections
4616 Place each function or data item into its own section in the output
4617 file if the target supports arbitrary sections.  The name of the
4618 function or the name of the data item determines the section's name
4619 in the output file.
4620
4621 Use these options on systems where the linker can perform optimizations
4622 to improve locality of reference in the instruction space.  Most systems
4623 using the ELF object format and SPARC processors running Solaris 2 have
4624 linkers with such optimizations.  AIX may have these optimizations in
4625 the future.
4626
4627 Only use these options when there are significant benefits from doing
4628 so.  When you specify these options, the assembler and linker will
4629 create larger object and executable files and will also be slower.
4630 You will not be able to use @code{gprof} on all systems if you
4631 specify this option and you may have problems with debugging if
4632 you specify both this option and @option{-g}.
4633
4634 @item -fbranch-target-load-optimize
4635 @opindex fbranch-target-load-optimize
4636 Perform branch target register load optimization before prologue / epilogue
4637 threading.
4638 The use of target registers can typically be exposed only during reload,
4639 thus hoisting loads out of loops and doing inter-block scheduling needs
4640 a separate optimization pass.
4641
4642 @item -fbranch-target-load-optimize2
4643 @opindex fbranch-target-load-optimize2
4644 Perform branch target register load optimization after prologue / epilogue
4645 threading.
4646
4647 @item -fbtr-bb-exclusive
4648 @opindex fbtr-bb-exclusive
4649 WHen performing branch target register load optimization, don't reuse
4650 branch target registers in within any basic block.
4651
4652 @item --param @var{name}=@var{value}
4653 @opindex param
4654 In some places, GCC uses various constants to control the amount of
4655 optimization that is done.  For example, GCC will not inline functions
4656 that contain more that a certain number of instructions.  You can
4657 control some of these constants on the command-line using the
4658 @option{--param} option.
4659
4660 The names of specific parameters, and the meaning of the values, are
4661 tied to the internals of the compiler, and are subject to change
4662 without notice in future releases.
4663
4664 In each case, the @var{value} is an integer.  The allowable choices for
4665 @var{name} are given in the following table:
4666
4667 @table @gcctabopt
4668 @item max-crossjump-edges
4669 The maximum number of incoming edges to consider for crossjumping.
4670 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
4671 the number of edges incoming to each block.  Increasing values mean
4672 more aggressive optimization, making the compile time increase with
4673 probably small improvement in executable size.
4674
4675 @item max-delay-slot-insn-search
4676 The maximum number of instructions to consider when looking for an
4677 instruction to fill a delay slot.  If more than this arbitrary number of
4678 instructions is searched, the time savings from filling the delay slot
4679 will be minimal so stop searching.  Increasing values mean more
4680 aggressive optimization, making the compile time increase with probably
4681 small improvement in executable run time.
4682
4683 @item max-delay-slot-live-search
4684 When trying to fill delay slots, the maximum number of instructions to
4685 consider when searching for a block with valid live register
4686 information.  Increasing this arbitrarily chosen value means more
4687 aggressive optimization, increasing the compile time.  This parameter
4688 should be removed when the delay slot code is rewritten to maintain the
4689 control-flow graph.
4690
4691 @item max-gcse-memory
4692 The approximate maximum amount of memory that will be allocated in
4693 order to perform the global common subexpression elimination
4694 optimization.  If more memory than specified is required, the
4695 optimization will not be done.
4696
4697 @item max-gcse-passes
4698 The maximum number of passes of GCSE to run.
4699
4700 @item max-pending-list-length
4701 The maximum number of pending dependencies scheduling will allow
4702 before flushing the current state and starting over.  Large functions
4703 with few branches or calls can create excessively large lists which
4704 needlessly consume memory and resources.
4705
4706 @item max-inline-insns-single
4707 Several parameters control the tree inliner used in gcc.
4708 This number sets the maximum number of instructions (counted in gcc's
4709 internal representation) in a single function that the tree inliner
4710 will consider for inlining.  This only affects functions declared
4711 inline and methods implemented in a class declaration (C++).
4712 The default value is 500.
4713
4714 @item max-inline-insns-auto
4715 When you use @option{-finline-functions} (included in @option{-O3}),
4716 a lot of functions that would otherwise not be considered for inlining
4717 by the compiler will be investigated.  To those functions, a different
4718 (more restrictive) limit compared to functions declared inline can
4719 be applied.
4720 The default value is 120.
4721
4722 @item large-function-insns
4723 The limit specifying really large functions.  For functions greater than this
4724 limit inlining is constrained by @option{--param large-function-growth}.
4725 This parameter is useful primarily to avoid extreme compilation time caused by non-linear
4726 algorithms used by the backend.
4727 This parameter is ignored when @option{-funit-at-a-time} is not used.
4728 The default value is 3000.
4729
4730 @item large-function-growth
4731 Specifies maximal growth of large function caused by inlining in percents.
4732 This parameter is ignored when @option{-funit-at-a-time} is not used.
4733 The default value is 200.
4734
4735 @item inline-unit-growth
4736 Specifies maximal overall growth of the compilation unit caused by inlining.
4737 This parameter is ignored when @option{-funit-at-a-time} is not used.
4738 The default value is 150.
4739
4740 @item max-inline-insns-rtl
4741 For languages that use the RTL inliner (this happens at a later stage
4742 than tree inlining), you can set the maximum allowable size (counted
4743 in RTL instructions) for the RTL inliner with this parameter.
4744 The default value is 600.
4745
4746 @item max-unrolled-insns
4747 The maximum number of instructions that a loop should have if that loop
4748 is unrolled, and if the loop is unrolled, it determines how many times
4749 the loop code is unrolled.
4750
4751 @item max-average-unrolled-insns
4752 The maximum number of instructions biased by probabilities of their execution
4753 that a loop should have if that loop is unrolled, and if the loop is unrolled,
4754 it determines how many times the loop code is unrolled.
4755
4756 @item max-unroll-times
4757 The maximum number of unrollings of a single loop.
4758
4759 @item max-peeled-insns
4760 The maximum number of instructions that a loop should have if that loop
4761 is peeled, and if the loop is peeled, it determines how many times
4762 the loop code is peeled.
4763
4764 @item max-peel-times
4765 The maximum number of peelings of a single loop.
4766
4767 @item max-completely-peeled-insns
4768 The maximum number of insns of a completely peeled loop.
4769
4770 @item max-completely-peel-times
4771 The maximum number of iterations of a loop to be suitable for complete peeling.
4772
4773 @item max-unswitch-insns
4774 The maximum number of insns of an unswitched loop.
4775
4776 @item max-unswitch-level
4777 The maximum number of branches unswitched in a single loop.
4778
4779 @item hot-bb-count-fraction
4780 Select fraction of the maximal count of repetitions of basic block in program
4781 given basic block needs to have to be considered hot.
4782
4783 @item hot-bb-frequency-fraction
4784 Select fraction of the maximal frequency of executions of basic block in
4785 function given basic block needs to have to be considered hot
4786
4787 @item tracer-dynamic-coverage
4788 @itemx tracer-dynamic-coverage-feedback
4789
4790 This value is used to limit superblock formation once the given percentage of
4791 executed instructions is covered.  This limits unnecessary code size
4792 expansion.
4793
4794 The @option{tracer-dynamic-coverage-feedback} is used only when profile
4795 feedback is available.  The real profiles (as opposed to statically estimated
4796 ones) are much less balanced allowing the threshold to be larger value.
4797
4798 @item tracer-max-code-growth
4799 Stop tail duplication once code growth has reached given percentage.  This is
4800 rather hokey argument, as most of the duplicates will be eliminated later in
4801 cross jumping, so it may be set to much higher values than is the desired code
4802 growth.
4803
4804 @item tracer-min-branch-ratio
4805
4806 Stop reverse growth when the reverse probability of best edge is less than this
4807 threshold (in percent).
4808
4809 @item tracer-min-branch-ratio
4810 @itemx tracer-min-branch-ratio-feedback
4811
4812 Stop forward growth if the best edge do have probability lower than this
4813 threshold.
4814
4815 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
4816 compilation for profile feedback and one for compilation without.  The value
4817 for compilation with profile feedback needs to be more conservative (higher) in
4818 order to make tracer effective.
4819
4820 @item max-cse-path-length
4821
4822 Maximum number of basic blocks on path that cse considers.
4823
4824 @item ggc-min-expand
4825
4826 GCC uses a garbage collector to manage its own memory allocation.  This
4827 parameter specifies the minimum percentage by which the garbage
4828 collector's heap should be allowed to expand between collections.
4829 Tuning this may improve compilation speed; it has no effect on code
4830 generation.
4831
4832 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
4833 RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
4834 the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
4835 GCC is not able to calculate RAM on a particular platform, the lower
4836 bound of 30% is used.  Setting this parameter and
4837 @option{ggc-min-heapsize} to zero causes a full collection to occur at
4838 every opportunity.  This is extremely slow, but can be useful for
4839 debugging.
4840
4841 @item ggc-min-heapsize
4842
4843 Minimum size of the garbage collector's heap before it begins bothering
4844 to collect garbage.  The first collection occurs after the heap expands
4845 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
4846 tuning this may improve compilation speed, and has no effect on code
4847 generation.
4848
4849 The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
4850 upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
4851 available, the notion of "RAM" is the smallest of actual RAM,
4852 RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
4853 RAM on a particular platform, the lower bound is used.  Setting this
4854 parameter very large effectively disables garbage collection.  Setting
4855 this parameter and @option{ggc-min-expand} to zero causes a full
4856 collection to occur at every opportunity.
4857
4858 @item max-reload-search-insns
4859 The maximum number of instruction reload should look backward for equivalent
4860 register.  Increasing values mean more aggressive optimization, making the
4861 compile time increase with probably slightly better performance.  The default
4862 value is 100.
4863
4864 @item max-cselib-memory-location
4865 The maximum number of memory locations cselib should take into acount.
4866 Increasing values mean more aggressive optimization, making the compile time
4867 increase with probably slightly better performance.  The default value is 500.
4868
4869 @item reorder-blocks-duplicate
4870 @itemx reorder-blocks-duplicate-feedback
4871
4872 Used by basic block reordering pass to decide whether to use unconditional
4873 branch or duplicate the code on its destination.  Code is duplicated when its
4874 estimated size is smaller than this value multiplied by the estimated size of
4875 unconditional jump in the hot spots of the program.
4876
4877 The @option{reorder-block-duplicate-feedback} is used only when profile
4878 feedback is available and may be set to higher values than
4879 @option{reorder-block-duplicate} since information about the hot spots is more
4880 accurate.
4881 @end table
4882 @end table
4883
4884 @node Preprocessor Options
4885 @section Options Controlling the Preprocessor
4886 @cindex preprocessor options
4887 @cindex options, preprocessor
4888
4889 These options control the C preprocessor, which is run on each C source
4890 file before actual compilation.
4891
4892 If you use the @option{-E} option, nothing is done except preprocessing.
4893 Some of these options make sense only together with @option{-E} because
4894 they cause the preprocessor output to be unsuitable for actual
4895 compilation.
4896
4897 @table @gcctabopt
4898 @opindex Wp
4899 You can use @option{-Wp,@var{option}} to bypass the compiler driver
4900 and pass @var{option} directly through to the preprocessor.  If
4901 @var{option} contains commas, it is split into multiple options at the
4902 commas.  However, many options are modified, translated or interpreted
4903 by the compiler driver before being passed to the preprocessor, and
4904 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4905 interface is undocumented and subject to change, so whenever possible
4906 you should avoid using @option{-Wp} and let the driver handle the
4907 options instead.
4908
4909 @item -Xpreprocessor @var{option}
4910 @opindex preprocessor
4911 Pass @var{option} as an option to the preprocessor.  You can use this to
4912 supply system-specific preprocessor options which GCC does not know how to
4913 recognize.
4914
4915 If you want to pass an option that takes an argument, you must use
4916 @option{-Xpreprocessor} twice, once for the option and once for the argument.
4917 @end table
4918
4919 @include cppopts.texi
4920
4921 @node Assembler Options
4922 @section Passing Options to the Assembler
4923
4924 @c prevent bad page break with this line
4925 You can pass options to the assembler.
4926
4927 @table @gcctabopt
4928 @item -Wa,@var{option}
4929 @opindex Wa
4930 Pass @var{option} as an option to the assembler.  If @var{option}
4931 contains commas, it is split into multiple options at the commas.
4932
4933 @item -Xassembler @var{option}
4934 @opindex Xassembler
4935 Pass @var{option} as an option to the assembler.  You can use this to
4936 supply system-specific assembler options which GCC does not know how to
4937 recognize.
4938
4939 If you want to pass an option that takes an argument, you must use
4940 @option{-Xassembler} twice, once for the option and once for the argument.
4941
4942 @end table
4943
4944 @node Link Options
4945 @section Options for Linking
4946 @cindex link options
4947 @cindex options, linking
4948
4949 These options come into play when the compiler links object files into
4950 an executable output file.  They are meaningless if the compiler is
4951 not doing a link step.
4952
4953 @table @gcctabopt
4954 @cindex file names
4955 @item @var{object-file-name}
4956 A file name that does not end in a special recognized suffix is
4957 considered to name an object file or library.  (Object files are
4958 distinguished from libraries by the linker according to the file
4959 contents.)  If linking is done, these object files are used as input
4960 to the linker.
4961
4962 @item -c
4963 @itemx -S
4964 @itemx -E
4965 @opindex c
4966 @opindex S
4967 @opindex E
4968 If any of these options is used, then the linker is not run, and
4969 object file names should not be used as arguments.  @xref{Overall
4970 Options}.
4971
4972 @cindex Libraries
4973 @item -l@var{library}
4974 @itemx -l @var{library}
4975 @opindex l
4976 Search the library named @var{library} when linking.  (The second
4977 alternative with the library as a separate argument is only for
4978 POSIX compliance and is not recommended.)
4979
4980 It makes a difference where in the command you write this option; the
4981 linker searches and processes libraries and object files in the order they
4982 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4983 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
4984 to functions in @samp{z}, those functions may not be loaded.
4985
4986 The linker searches a standard list of directories for the library,
4987 which is actually a file named @file{lib@var{library}.a}.  The linker
4988 then uses this file as if it had been specified precisely by name.
4989
4990 The directories searched include several standard system directories
4991 plus any that you specify with @option{-L}.
4992
4993 Normally the files found this way are library files---archive files
4994 whose members are object files.  The linker handles an archive file by
4995 scanning through it for members which define symbols that have so far
4996 been referenced but not defined.  But if the file that is found is an
4997 ordinary object file, it is linked in the usual fashion.  The only
4998 difference between using an @option{-l} option and specifying a file name
4999 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
5000 and searches several directories.
5001
5002 @item -lobjc
5003 @opindex lobjc
5004 You need this special case of the @option{-l} option in order to
5005 link an Objective-C program.
5006
5007 @item -nostartfiles
5008 @opindex nostartfiles
5009 Do not use the standard system startup files when linking.
5010 The standard system libraries are used normally, unless @option{-nostdlib}
5011 or @option{-nodefaultlibs} is used.
5012
5013 @item -nodefaultlibs
5014 @opindex nodefaultlibs
5015 Do not use the standard system libraries when linking.
5016 Only the libraries you specify will be passed to the linker.
5017 The standard startup files are used normally, unless @option{-nostartfiles}
5018 is used.  The compiler may generate calls to memcmp, memset, and memcpy
5019 for System V (and ISO C) environments or to bcopy and bzero for
5020 BSD environments.  These entries are usually resolved by entries in
5021 libc.  These entry points should be supplied through some other
5022 mechanism when this option is specified.
5023
5024 @item -nostdlib
5025 @opindex nostdlib
5026 Do not use the standard system startup files or libraries when linking.
5027 No startup files and only the libraries you specify will be passed to
5028 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
5029 for System V (and ISO C) environments or to bcopy and bzero for
5030 BSD environments.  These entries are usually resolved by entries in
5031 libc.  These entry points should be supplied through some other
5032 mechanism when this option is specified.
5033
5034 @cindex @option{-lgcc}, use with @option{-nostdlib}
5035 @cindex @option{-nostdlib} and unresolved references
5036 @cindex unresolved references and @option{-nostdlib}
5037 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5038 @cindex @option{-nodefaultlibs} and unresolved references
5039 @cindex unresolved references and @option{-nodefaultlibs}
5040 One of the standard libraries bypassed by @option{-nostdlib} and
5041 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
5042 that GCC uses to overcome shortcomings of particular machines, or special
5043 needs for some languages.
5044 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5045 Collection (GCC) Internals},
5046 for more discussion of @file{libgcc.a}.)
5047 In most cases, you need @file{libgcc.a} even when you want to avoid
5048 other standard libraries.  In other words, when you specify @option{-nostdlib}
5049 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
5050 This ensures that you have no unresolved references to internal GCC
5051 library subroutines.  (For example, @samp{__main}, used to ensure C++
5052 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5053 GNU Compiler Collection (GCC) Internals}.)
5054
5055 @item -pie
5056 @opindex pie
5057 Produce a position independent executable on targets which support it.
5058 For predictable results, you must also specify the same set of options
5059 that were used to generate code (@option{-fpie}, @option{-fPIE},
5060 or model suboptions) when you specify this option.
5061
5062 @item -s
5063 @opindex s
5064 Remove all symbol table and relocation information from the executable.
5065
5066 @item -static
5067 @opindex static
5068 On systems that support dynamic linking, this prevents linking with the shared
5069 libraries.  On other systems, this option has no effect.
5070
5071 @item -shared
5072 @opindex shared
5073 Produce a shared object which can then be linked with other objects to
5074 form an executable.  Not all systems support this option.  For predictable
5075 results, you must also specify the same set of options that were used to
5076 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
5077 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
5078 needs to build supplementary stub code for constructors to work.  On
5079 multi-libbed systems, @samp{gcc -shared} must select the correct support
5080 libraries to link against.  Failing to supply the correct flags may lead
5081 to subtle defects.  Supplying them in cases where they are not necessary
5082 is innocuous.}
5083
5084 @item -shared-libgcc
5085 @itemx -static-libgcc
5086 @opindex shared-libgcc
5087 @opindex static-libgcc
5088 On systems that provide @file{libgcc} as a shared library, these options
5089 force the use of either the shared or static version respectively.
5090 If no shared version of @file{libgcc} was built when the compiler was
5091 configured, these options have no effect.
5092
5093 There are several situations in which an application should use the
5094 shared @file{libgcc} instead of the static version.  The most common
5095 of these is when the application wishes to throw and catch exceptions
5096 across different shared libraries.  In that case, each of the libraries
5097 as well as the application itself should use the shared @file{libgcc}.
5098
5099 Therefore, the G++ and GCJ drivers automatically add
5100 @option{-shared-libgcc} whenever you build a shared library or a main
5101 executable, because C++ and Java programs typically use exceptions, so
5102 this is the right thing to do.
5103
5104 If, instead, you use the GCC driver to create shared libraries, you may
5105 find that they will not always be linked with the shared @file{libgcc}.
5106 If GCC finds, at its configuration time, that you have a GNU linker that
5107 does not support option @option{--eh-frame-hdr}, it will link the shared
5108 version of @file{libgcc} into shared libraries by default.  Otherwise,
5109 it will take advantage of the linker and optimize away the linking with
5110 the shared version of @file{libgcc}, linking with the static version of
5111 libgcc by default.  This allows exceptions to propagate through such
5112 shared libraries, without incurring relocation costs at library load
5113 time.
5114
5115 However, if a library or main executable is supposed to throw or catch
5116 exceptions, you must link it using the G++ or GCJ driver, as appropriate
5117 for the languages used in the program, or using the option
5118 @option{-shared-libgcc}, such that it is linked with the shared
5119 @file{libgcc}.
5120
5121 @item -symbolic
5122 @opindex symbolic
5123 Bind references to global symbols when building a shared object.  Warn
5124 about any unresolved references (unless overridden by the link editor
5125 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
5126 this option.
5127
5128 @item -Xlinker @var{option}
5129 @opindex Xlinker
5130 Pass @var{option} as an option to the linker.  You can use this to
5131 supply system-specific linker options which GCC does not know how to
5132 recognize.
5133
5134 If you want to pass an option that takes an argument, you must use
5135 @option{-Xlinker} twice, once for the option and once for the argument.
5136 For example, to pass @option{-assert definitions}, you must write
5137 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
5138 @option{-Xlinker "-assert definitions"}, because this passes the entire
5139 string as a single argument, which is not what the linker expects.
5140
5141 @item -Wl,@var{option}
5142 @opindex Wl
5143 Pass @var{option} as an option to the linker.  If @var{option} contains
5144 commas, it is split into multiple options at the commas.
5145
5146 @item -u @var{symbol}
5147 @opindex u
5148 Pretend the symbol @var{symbol} is undefined, to force linking of
5149 library modules to define it.  You can use @option{-u} multiple times with
5150 different symbols to force loading of additional library modules.
5151 @end table
5152
5153 @node Directory Options
5154 @section Options for Directory Search
5155 @cindex directory options
5156 @cindex options, directory search
5157 @cindex search path
5158
5159 These options specify directories to search for header files, for
5160 libraries and for parts of the compiler:
5161
5162 @table @gcctabopt
5163 @item -I@var{dir}
5164 @opindex I
5165 Add the directory @var{dir} to the head of the list of directories to be
5166 searched for header files.  This can be used to override a system header
5167 file, substituting your own version, since these directories are
5168 searched before the system header file directories.  However, you should
5169 not use this option to add directories that contain vendor-supplied
5170 system header files (use @option{-isystem} for that).  If you use more than
5171 one @option{-I} option, the directories are scanned in left-to-right
5172 order; the standard system directories come after.
5173
5174 If a standard system include directory, or a directory specified with
5175 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
5176 option will be ignored.  The directory will still be searched but as a
5177 system directory at its normal position in the system include chain.
5178 This is to ensure that GCC's procedure to fix buggy system headers and
5179 the ordering for the include_next directive are not inadvertently changed.
5180 If you really need to change the search order for system directories,
5181 use the @option{-nostdinc} and/or @option{-isystem} options.
5182
5183 @item -I-
5184 @opindex I-
5185 Any directories you specify with @option{-I} options before the @option{-I-}
5186 option are searched only for the case of @samp{#include "@var{file}"};
5187 they are not searched for @samp{#include <@var{file}>}.
5188
5189 If additional directories are specified with @option{-I} options after
5190 the @option{-I-}, these directories are searched for all @samp{#include}
5191 directives.  (Ordinarily @emph{all} @option{-I} directories are used
5192 this way.)
5193
5194 In addition, the @option{-I-} option inhibits the use of the current
5195 directory (where the current input file came from) as the first search
5196 directory for @samp{#include "@var{file}"}.  There is no way to
5197 override this effect of @option{-I-}.  With @option{-I.} you can specify
5198 searching the directory which was current when the compiler was
5199 invoked.  That is not exactly the same as what the preprocessor does
5200 by default, but it is often satisfactory.
5201
5202 @option{-I-} does not inhibit the use of the standard system directories
5203 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
5204 independent.
5205
5206 @item -L@var{dir}
5207 @opindex L
5208 Add directory @var{dir} to the list of directories to be searched
5209 for @option{-l}.
5210
5211 @item -B@var{prefix}
5212 @opindex B
5213 This option specifies where to find the executables, libraries,
5214 include files, and data files of the compiler itself.
5215
5216 The compiler driver program runs one or more of the subprograms
5217 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
5218 @var{prefix} as a prefix for each program it tries to run, both with and
5219 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5220
5221 For each subprogram to be run, the compiler driver first tries the
5222 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
5223 was not specified, the driver tries two standard prefixes, which are
5224 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
5225 those results in a file name that is found, the unmodified program
5226 name is searched for using the directories specified in your
5227 @env{PATH} environment variable.
5228
5229 The compiler will check to see if the path provided by the @option{-B}
5230 refers to a directory, and if necessary it will add a directory
5231 separator character at the end of the path.
5232
5233 @option{-B} prefixes that effectively specify directory names also apply
5234 to libraries in the linker, because the compiler translates these
5235 options into @option{-L} options for the linker.  They also apply to
5236 includes files in the preprocessor, because the compiler translates these
5237 options into @option{-isystem} options for the preprocessor.  In this case,
5238 the compiler appends @samp{include} to the prefix.
5239
5240 The run-time support file @file{libgcc.a} can also be searched for using
5241 the @option{-B} prefix, if needed.  If it is not found there, the two
5242 standard prefixes above are tried, and that is all.  The file is left
5243 out of the link if it is not found by those means.
5244
5245 Another way to specify a prefix much like the @option{-B} prefix is to use
5246 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
5247 Variables}.
5248
5249 As a special kludge, if the path provided by @option{-B} is
5250 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
5251 9, then it will be replaced by @file{[dir/]include}.  This is to help
5252 with boot-strapping the compiler.
5253
5254 @item -specs=@var{file}
5255 @opindex specs
5256 Process @var{file} after the compiler reads in the standard @file{specs}
5257 file, in order to override the defaults that the @file{gcc} driver
5258 program uses when determining what switches to pass to @file{cc1},
5259 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
5260 @option{-specs=@var{file}} can be specified on the command line, and they
5261 are processed in order, from left to right.
5262 @end table
5263
5264 @c man end
5265
5266 @node Spec Files
5267 @section Specifying subprocesses and the switches to pass to them
5268 @cindex Spec Files
5269
5270 @command{gcc} is a driver program.  It performs its job by invoking a
5271 sequence of other programs to do the work of compiling, assembling and
5272 linking.  GCC interprets its command-line parameters and uses these to
5273 deduce which programs it should invoke, and which command-line options
5274 it ought to place on their command lines.  This behavior is controlled
5275 by @dfn{spec strings}.  In most cases there is one spec string for each
5276 program that GCC can invoke, but a few programs have multiple spec
5277 strings to control their behavior.  The spec strings built into GCC can
5278 be overridden by using the @option{-specs=} command-line switch to specify
5279 a spec file.
5280
5281 @dfn{Spec files} are plaintext files that are used to construct spec
5282 strings.  They consist of a sequence of directives separated by blank
5283 lines.  The type of directive is determined by the first non-whitespace
5284 character on the line and it can be one of the following:
5285
5286 @table @code
5287 @item %@var{command}
5288 Issues a @var{command} to the spec file processor.  The commands that can
5289 appear here are:
5290
5291 @table @code
5292 @item %include <@var{file}>
5293 @cindex %include
5294 Search for @var{file} and insert its text at the current point in the
5295 specs file.
5296
5297 @item %include_noerr <@var{file}>
5298 @cindex %include_noerr
5299 Just like @samp{%include}, but do not generate an error message if the include
5300 file cannot be found.
5301
5302 @item %rename @var{old_name} @var{new_name}
5303 @cindex %rename
5304 Rename the spec string @var{old_name} to @var{new_name}.
5305
5306 @end table
5307
5308 @item *[@var{spec_name}]:
5309 This tells the compiler to create, override or delete the named spec
5310 string.  All lines after this directive up to the next directive or
5311 blank line are considered to be the text for the spec string.  If this
5312 results in an empty string then the spec will be deleted.  (Or, if the
5313 spec did not exist, then nothing will happened.)  Otherwise, if the spec
5314 does not currently exist a new spec will be created.  If the spec does
5315 exist then its contents will be overridden by the text of this
5316 directive, unless the first character of that text is the @samp{+}
5317 character, in which case the text will be appended to the spec.
5318
5319 @item [@var{suffix}]:
5320 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
5321 and up to the next directive or blank line are considered to make up the
5322 spec string for the indicated suffix.  When the compiler encounters an
5323 input file with the named suffix, it will processes the spec string in
5324 order to work out how to compile that file.  For example:
5325
5326 @smallexample
5327 .ZZ:
5328 z-compile -input %i
5329 @end smallexample
5330
5331 This says that any input file whose name ends in @samp{.ZZ} should be
5332 passed to the program @samp{z-compile}, which should be invoked with the
5333 command-line switch @option{-input} and with the result of performing the
5334 @samp{%i} substitution.  (See below.)
5335
5336 As an alternative to providing a spec string, the text that follows a
5337 suffix directive can be one of the following:
5338
5339 @table @code
5340 @item @@@var{language}
5341 This says that the suffix is an alias for a known @var{language}.  This is
5342 similar to using the @option{-x} command-line switch to GCC to specify a
5343 language explicitly.  For example:
5344
5345 @smallexample
5346 .ZZ:
5347 @@c++
5348 @end smallexample
5349
5350 Says that .ZZ files are, in fact, C++ source files.
5351
5352 @item #@var{name}
5353 This causes an error messages saying:
5354
5355 @smallexample
5356 @var{name} compiler not installed on this system.
5357 @end smallexample
5358 @end table
5359
5360 GCC already has an extensive list of suffixes built into it.
5361 This directive will add an entry to the end of the list of suffixes, but
5362 since the list is searched from the end backwards, it is effectively
5363 possible to override earlier entries using this technique.
5364
5365 @end table
5366
5367 GCC has the following spec strings built into it.  Spec files can
5368 override these strings or create their own.  Note that individual
5369 targets can also add their own spec strings to this list.
5370
5371 @smallexample
5372 asm          Options to pass to the assembler
5373 asm_final    Options to pass to the assembler post-processor
5374 cpp          Options to pass to the C preprocessor
5375 cc1          Options to pass to the C compiler
5376 cc1plus      Options to pass to the C++ compiler
5377 endfile      Object files to include at the end of the link
5378 link         Options to pass to the linker
5379 lib          Libraries to include on the command line to the linker
5380 libgcc       Decides which GCC support library to pass to the linker
5381 linker       Sets the name of the linker
5382 predefines   Defines to be passed to the C preprocessor
5383 signed_char  Defines to pass to CPP to say whether @code{char} is signed
5384              by default
5385 startfile    Object files to include at the start of the link
5386 @end smallexample
5387
5388 Here is a small example of a spec file:
5389
5390 @smallexample
5391 %rename lib                 old_lib
5392
5393 *lib:
5394 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
5395 @end smallexample
5396
5397 This example renames the spec called @samp{lib} to @samp{old_lib} and
5398 then overrides the previous definition of @samp{lib} with a new one.
5399 The new definition adds in some extra command-line options before
5400 including the text of the old definition.
5401
5402 @dfn{Spec strings} are a list of command-line options to be passed to their
5403 corresponding program.  In addition, the spec strings can contain
5404 @samp{%}-prefixed sequences to substitute variable text or to
5405 conditionally insert text into the command line.  Using these constructs
5406 it is possible to generate quite complex command lines.
5407
5408 Here is a table of all defined @samp{%}-sequences for spec
5409 strings.  Note that spaces are not generated automatically around the
5410 results of expanding these sequences.  Therefore you can concatenate them
5411 together or combine them with constant text in a single argument.
5412
5413 @table @code
5414 @item %%
5415 Substitute one @samp{%} into the program name or argument.
5416
5417 @item %i
5418 Substitute the name of the input file being processed.
5419
5420 @item %b
5421 Substitute the basename of the input file being processed.
5422 This is the substring up to (and not including) the last period
5423 and not including the directory.
5424
5425 @item %B
5426 This is the same as @samp{%b}, but include the file suffix (text after
5427 the last period).
5428
5429 @item %d
5430 Marks the argument containing or following the @samp{%d} as a
5431 temporary file name, so that that file will be deleted if GCC exits
5432 successfully.  Unlike @samp{%g}, this contributes no text to the
5433 argument.
5434
5435 @item %g@var{suffix}
5436 Substitute a file name that has suffix @var{suffix} and is chosen
5437 once per compilation, and mark the argument in the same way as
5438 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5439 name is now chosen in a way that is hard to predict even when previously
5440 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5441 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5442 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5443 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5444 was simply substituted with a file name chosen once per compilation,
5445 without regard to any appended suffix (which was therefore treated
5446 just like ordinary text), making such attacks more likely to succeed.
5447
5448 @item %u@var{suffix}
5449 Like @samp{%g}, but generates a new temporary file name even if
5450 @samp{%u@var{suffix}} was already seen.
5451
5452 @item %U@var{suffix}
5453 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5454 new one if there is no such last file name.  In the absence of any
5455 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5456 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5457 would involve the generation of two distinct file names, one
5458 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5459 simply substituted with a file name chosen for the previous @samp{%u},
5460 without regard to any appended suffix.
5461
5462 @item %j@var{suffix}
5463 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5464 writable, and if save-temps is off; otherwise, substitute the name
5465 of a temporary file, just like @samp{%u}.  This temporary file is not
5466 meant for communication between processes, but rather as a junk
5467 disposal mechanism.
5468
5469 @item %|@var{suffix}
5470 @itemx %m@var{suffix}
5471 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
5472 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
5473 all.  These are the two most common ways to instruct a program that it
5474 should read from standard input or write to standard output.  If you
5475 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
5476 construct: see for example @file{f/lang-specs.h}.
5477
5478 @item %.@var{SUFFIX}
5479 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5480 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5481 terminated by the next space or %.
5482
5483 @item %w
5484 Marks the argument containing or following the @samp{%w} as the
5485 designated output file of this compilation.  This puts the argument
5486 into the sequence of arguments that @samp{%o} will substitute later.
5487
5488 @item %o
5489 Substitutes the names of all the output files, with spaces
5490 automatically placed around them.  You should write spaces
5491 around the @samp{%o} as well or the results are undefined.
5492 @samp{%o} is for use in the specs for running the linker.
5493 Input files whose names have no recognized suffix are not compiled
5494 at all, but they are included among the output files, so they will
5495 be linked.
5496
5497 @item %O
5498 Substitutes the suffix for object files.  Note that this is
5499 handled specially when it immediately follows @samp{%g, %u, or %U},
5500 because of the need for those to form complete file names.  The
5501 handling is such that @samp{%O} is treated exactly as if it had already
5502 been substituted, except that @samp{%g, %u, and %U} do not currently
5503 support additional @var{suffix} characters following @samp{%O} as they would
5504 following, for example, @samp{.o}.
5505
5506 @item %p
5507 Substitutes the standard macro predefinitions for the
5508 current target machine.  Use this when running @code{cpp}.
5509
5510 @item %P
5511 Like @samp{%p}, but puts @samp{__} before and after the name of each
5512 predefined macro, except for macros that start with @samp{__} or with
5513 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5514 C@.
5515
5516 @item %I
5517 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5518 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5519 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5520 as necessary.
5521
5522 @item %s
5523 Current argument is the name of a library or startup file of some sort.
5524 Search for that file in a standard list of directories and substitute
5525 the full name found.
5526
5527 @item %e@var{str}
5528 Print @var{str} as an error message.  @var{str} is terminated by a newline.
5529 Use this when inconsistent options are detected.
5530
5531 @item %(@var{name})
5532 Substitute the contents of spec string @var{name} at this point.
5533
5534 @item %[@var{name}]
5535 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
5536
5537 @item %x@{@var{option}@}
5538 Accumulate an option for @samp{%X}.
5539
5540 @item %X
5541 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
5542 spec string.
5543
5544 @item %Y
5545 Output the accumulated assembler options specified by @option{-Wa}.
5546
5547 @item %Z
5548 Output the accumulated preprocessor options specified by @option{-Wp}.
5549
5550 @item %a
5551 Process the @code{asm} spec.  This is used to compute the
5552 switches to be passed to the assembler.
5553
5554 @item %A
5555 Process the @code{asm_final} spec.  This is a spec string for
5556 passing switches to an assembler post-processor, if such a program is
5557 needed.
5558
5559 @item %l
5560 Process the @code{link} spec.  This is the spec for computing the
5561 command line passed to the linker.  Typically it will make use of the
5562 @samp{%L %G %S %D and %E} sequences.
5563
5564 @item %D
5565 Dump out a @option{-L} option for each directory that GCC believes might
5566 contain startup files.  If the target supports multilibs then the
5567 current multilib directory will be prepended to each of these paths.
5568
5569 @item %M
5570 Output the multilib directory with directory separators replaced with
5571 @samp{_}.  If multilib directories are not set, or the multilib directory is
5572 @file{.} then this option emits nothing.
5573
5574 @item %L
5575 Process the @code{lib} spec.  This is a spec string for deciding which
5576 libraries should be included on the command line to the linker.
5577
5578 @item %G
5579 Process the @code{libgcc} spec.  This is a spec string for deciding
5580 which GCC support library should be included on the command line to the linker.
5581
5582 @item %S
5583 Process the @code{startfile} spec.  This is a spec for deciding which
5584 object files should be the first ones passed to the linker.  Typically
5585 this might be a file named @file{crt0.o}.
5586
5587 @item %E
5588 Process the @code{endfile} spec.  This is a spec string that specifies
5589 the last object files that will be passed to the linker.
5590
5591 @item %C
5592 Process the @code{cpp} spec.  This is used to construct the arguments
5593 to be passed to the C preprocessor.
5594
5595 @item %c
5596 Process the @code{signed_char} spec.  This is intended to be used
5597 to tell cpp whether a char is signed.  It typically has the definition:
5598 @smallexample
5599 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
5600 @end smallexample
5601
5602 @item %1
5603 Process the @code{cc1} spec.  This is used to construct the options to be
5604 passed to the actual C compiler (@samp{cc1}).
5605
5606 @item %2
5607 Process the @code{cc1plus} spec.  This is used to construct the options to be
5608 passed to the actual C++ compiler (@samp{cc1plus}).
5609
5610 @item %*
5611 Substitute the variable part of a matched option.  See below.
5612 Note that each comma in the substituted string is replaced by
5613 a single space.
5614
5615 @item %<@code{S}
5616 Remove all occurrences of @code{-S} from the command line.  Note---this
5617 command is position dependent.  @samp{%} commands in the spec string
5618 before this one will see @code{-S}, @samp{%} commands in the spec string
5619 after this one will not.
5620
5621 @item %:@var{function}(@var{args})
5622 Call the named function @var{function}, passing it @var{args}.
5623 @var{args} is first processed as a nested spec string, then split
5624 into an argument vector in the usual fashion.  The function returns
5625 a string which is processed as if it had appeared literally as part
5626 of the current spec.
5627
5628 The following built-in spec functions are provided:
5629
5630 @table @code
5631 @item @code{if-exists}
5632 The @code{if-exists} spec function takes one argument, an absolute
5633 pathname to a file.  If the file exists, @code{if-exists} returns the
5634 pathname.  Here is a small example of its usage:
5635
5636 @smallexample
5637 *startfile:
5638 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
5639 @end smallexample
5640
5641 @item @code{if-exists-else}
5642 The @code{if-exists-else} spec function is similar to the @code{if-exists}
5643 spec function, except that it takes two arguments.  The first argument is
5644 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
5645 returns the pathname.  If it does not exist, it returns the second argument.
5646 This way, @code{if-exists-else} can be used to select one file or another,
5647 based on the existence of the first.  Here is a small example of its usage:
5648
5649 @smallexample
5650 *startfile:
5651 crt0%O%s %:if-exists(crti%O%s) \
5652 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
5653 @end smallexample
5654 @end table
5655
5656 @item %@{@code{S}@}
5657 Substitutes the @code{-S} switch, if that switch was given to GCC@.
5658 If that switch was not specified, this substitutes nothing.  Note that
5659 the leading dash is omitted when specifying this option, and it is
5660 automatically inserted if the substitution is performed.  Thus the spec
5661 string @samp{%@{foo@}} would match the command-line option @option{-foo}
5662 and would output the command line option @option{-foo}.
5663
5664 @item %W@{@code{S}@}
5665 Like %@{@code{S}@} but mark last argument supplied within as a file to be
5666 deleted on failure.
5667
5668 @item %@{@code{S}*@}
5669 Substitutes all the switches specified to GCC whose names start
5670 with @code{-S}, but which also take an argument.  This is used for
5671 switches like @option{-o}, @option{-D}, @option{-I}, etc.
5672 GCC considers @option{-o foo} as being
5673 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
5674 text, including the space.  Thus two arguments would be generated.
5675
5676 @item %@{@code{S}*&@code{T}*@}
5677 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
5678 (the order of @code{S} and @code{T} in the spec is not significant).
5679 There can be any number of ampersand-separated variables; for each the
5680 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
5681
5682 @item %@{@code{S}:@code{X}@}
5683 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
5684
5685 @item %@{!@code{S}:@code{X}@}
5686 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
5687
5688 @item %@{@code{S}*:@code{X}@}
5689 Substitutes @code{X} if one or more switches whose names start with
5690 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
5691 once, no matter how many such switches appeared.  However, if @code{%*}
5692 appears somewhere in @code{X}, then @code{X} will be substituted once
5693 for each matching switch, with the @code{%*} replaced by the part of
5694 that switch that matched the @code{*}.
5695
5696 @item %@{.@code{S}:@code{X}@}
5697 Substitutes @code{X}, if processing a file with suffix @code{S}.
5698
5699 @item %@{!.@code{S}:@code{X}@}
5700 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
5701
5702 @item %@{@code{S}|@code{P}:@code{X}@}
5703 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
5704 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
5705 although they have a stronger binding than the @samp{|}.  If @code{%*}
5706 appears in @code{X}, all of the alternatives must be starred, and only
5707 the first matching alternative is substituted.
5708
5709 For example, a spec string like this:
5710
5711 @smallexample
5712 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5713 @end smallexample
5714
5715 will output the following command-line options from the following input
5716 command-line options:
5717
5718 @smallexample
5719 fred.c        -foo -baz
5720 jim.d         -bar -boggle
5721 -d fred.c     -foo -baz -boggle
5722 -d jim.d      -bar -baz -boggle
5723 @end smallexample
5724
5725 @item %@{S:X; T:Y; :D@}
5726
5727 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
5728 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
5729 be as many clauses as you need.  This may be combined with @code{.},
5730 @code{!}, @code{|}, and @code{*} as needed.
5731
5732
5733 @end table
5734
5735 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
5736 construct may contain other nested @samp{%} constructs or spaces, or
5737 even newlines.  They are processed as usual, as described above.
5738 Trailing white space in @code{X} is ignored.  White space may also
5739 appear anywhere on the left side of the colon in these constructs,
5740 except between @code{.} or @code{*} and the corresponding word.
5741
5742 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
5743 handled specifically in these constructs.  If another value of
5744 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5745 @option{-W} switch is found later in the command line, the earlier
5746 switch value is ignored, except with @{@code{S}*@} where @code{S} is
5747 just one letter, which passes all matching options.
5748
5749 The character @samp{|} at the beginning of the predicate text is used to
5750 indicate that a command should be piped to the following command, but
5751 only if @option{-pipe} is specified.
5752
5753 It is built into GCC which switches take arguments and which do not.
5754 (You might think it would be useful to generalize this to allow each
5755 compiler's spec to say which switches take arguments.  But this cannot
5756 be done in a consistent fashion.  GCC cannot even decide which input
5757 files have been specified without knowing which switches take arguments,
5758 and it must know which input files to compile in order to tell which
5759 compilers to run).
5760
5761 GCC also knows implicitly that arguments starting in @option{-l} are to be
5762 treated as compiler output files, and passed to the linker in their
5763 proper position among the other output files.
5764
5765 @c man begin OPTIONS
5766
5767 @node Target Options
5768 @section Specifying Target Machine and Compiler Version
5769 @cindex target options
5770 @cindex cross compiling
5771 @cindex specifying machine version
5772 @cindex specifying compiler version and target machine
5773 @cindex compiler version, specifying
5774 @cindex target machine, specifying
5775
5776 The usual way to run GCC is to run the executable called @file{gcc}, or
5777 @file{<machine>-gcc} when cross-compiling, or
5778 @file{<machine>-gcc-<version>} to run a version other than the one that
5779 was installed last.  Sometimes this is inconvenient, so GCC provides
5780 options that will switch to another cross-compiler or version.
5781
5782 @table @gcctabopt
5783 @item -b @var{machine}
5784 @opindex b
5785 The argument @var{machine} specifies the target machine for compilation.
5786
5787 The value to use for @var{machine} is the same as was specified as the
5788 machine type when configuring GCC as a cross-compiler.  For
5789 example, if a cross-compiler was configured with @samp{configure
5790 i386v}, meaning to compile for an 80386 running System V, then you
5791 would specify @option{-b i386v} to run that cross compiler.
5792
5793 @item -V @var{version}
5794 @opindex V
5795 The argument @var{version} specifies which version of GCC to run.
5796 This is useful when multiple versions are installed.  For example,
5797 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5798 @end table
5799
5800 The @option{-V} and @option{-b} options work by running the
5801 @file{<machine>-gcc-<version>} executable, so there's no real reason to
5802 use them if you can just run that directly.
5803
5804 @node Submodel Options
5805 @section Hardware Models and Configurations
5806 @cindex submodel options
5807 @cindex specifying hardware config
5808 @cindex hardware models and configurations, specifying
5809 @cindex machine dependent options
5810
5811 Earlier we discussed the standard option @option{-b} which chooses among
5812 different installed compilers for completely different target
5813 machines, such as VAX vs.@: 68000 vs.@: 80386.
5814
5815 In addition, each of these target machine types can have its own
5816 special options, starting with @samp{-m}, to choose among various
5817 hardware models or configurations---for example, 68010 vs 68020,
5818 floating coprocessor or none.  A single installed version of the
5819 compiler can compile for any model or configuration, according to the
5820 options specified.
5821
5822 Some configurations of the compiler also support additional special
5823 options, usually for compatibility with other compilers on the same
5824 platform.
5825
5826 These options are defined by the macro @code{TARGET_SWITCHES} in the
5827 machine description.  The default for the options is also defined by
5828 that macro, which enables you to change the defaults.
5829
5830 @menu
5831 * M680x0 Options::
5832 * M68hc1x Options::
5833 * VAX Options::
5834 * SPARC Options::
5835 * ARM Options::
5836 * MN10300 Options::
5837 * M32R/D Options::
5838 * RS/6000 and PowerPC Options::
5839 * Darwin Options::
5840 * MIPS Options::
5841 * i386 and x86-64 Options::
5842 * HPPA Options::
5843 * DEC Alpha Options::
5844 * DEC Alpha/VMS Options::
5845 * H8/300 Options::
5846 * SH Options::
5847 * System V Options::
5848 * TMS320C3x/C4x Options::
5849 * V850 Options::
5850 * ARC Options::
5851 * NS32K Options::
5852 * AVR Options::
5853 * MCore Options::
5854 * IA-64 Options::
5855 * S/390 and zSeries Options::
5856 * CRIS Options::
5857 * MMIX Options::
5858 * PDP-11 Options::
5859 * Xstormy16 Options::
5860 * Xtensa Options::
5861 * FRV Options::
5862 @end menu
5863
5864 @node M680x0 Options
5865 @subsection M680x0 Options
5866 @cindex M680x0 options
5867
5868 These are the @samp{-m} options defined for the 68000 series.  The default
5869 values for these options depends on which style of 68000 was selected when
5870 the compiler was configured; the defaults for the most common choices are
5871 given below.
5872
5873 @table @gcctabopt
5874 @item -m68000
5875 @itemx -mc68000
5876 @opindex m68000
5877 @opindex mc68000
5878 Generate output for a 68000.  This is the default
5879 when the compiler is configured for 68000-based systems.
5880
5881 Use this option for microcontrollers with a 68000 or EC000 core,
5882 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5883
5884 @item -m68020
5885 @itemx -mc68020
5886 @opindex m68020
5887 @opindex mc68020
5888 Generate output for a 68020.  This is the default
5889 when the compiler is configured for 68020-based systems.
5890
5891 @item -m68881
5892 @opindex m68881
5893 Generate output containing 68881 instructions for floating point.
5894 This is the default for most 68020 systems unless @option{--nfp} was
5895 specified when the compiler was configured.
5896
5897 @item -m68030
5898 @opindex m68030
5899 Generate output for a 68030.  This is the default when the compiler is
5900 configured for 68030-based systems.
5901
5902 @item -m68040
5903 @opindex m68040
5904 Generate output for a 68040.  This is the default when the compiler is
5905 configured for 68040-based systems.
5906
5907 This option inhibits the use of 68881/68882 instructions that have to be
5908 emulated by software on the 68040.  Use this option if your 68040 does not
5909 have code to emulate those instructions.
5910
5911 @item -m68060
5912 @opindex m68060
5913 Generate output for a 68060.  This is the default when the compiler is
5914 configured for 68060-based systems.
5915
5916 This option inhibits the use of 68020 and 68881/68882 instructions that
5917 have to be emulated by software on the 68060.  Use this option if your 68060
5918 does not have code to emulate those instructions.
5919
5920 @item -mcpu32
5921 @opindex mcpu32
5922 Generate output for a CPU32.  This is the default
5923 when the compiler is configured for CPU32-based systems.
5924
5925 Use this option for microcontrollers with a
5926 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5927 68336, 68340, 68341, 68349 and 68360.
5928
5929 @item -m5200
5930 @opindex m5200
5931 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5932 when the compiler is configured for 520X-based systems.
5933
5934 Use this option for microcontroller with a 5200 core, including
5935 the MCF5202, MCF5203, MCF5204 and MCF5202.
5936
5937
5938 @item -m68020-40
5939 @opindex m68020-40
5940 Generate output for a 68040, without using any of the new instructions.
5941 This results in code which can run relatively efficiently on either a
5942 68020/68881 or a 68030 or a 68040.  The generated code does use the
5943 68881 instructions that are emulated on the 68040.
5944
5945 @item -m68020-60
5946 @opindex m68020-60
5947 Generate output for a 68060, without using any of the new instructions.
5948 This results in code which can run relatively efficiently on either a
5949 68020/68881 or a 68030 or a 68040.  The generated code does use the
5950 68881 instructions that are emulated on the 68060.
5951
5952 @item -msoft-float
5953 @opindex msoft-float
5954 Generate output containing library calls for floating point.
5955 @strong{Warning:} the requisite libraries are not available for all m68k
5956 targets.  Normally the facilities of the machine's usual C compiler are
5957 used, but this can't be done directly in cross-compilation.  You must
5958 make your own arrangements to provide suitable library functions for
5959 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5960 @samp{m68k-*-coff} do provide software floating point support.
5961
5962 @item -mshort
5963 @opindex mshort
5964 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5965
5966 @item -mnobitfield
5967 @opindex mnobitfield
5968 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5969 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
5970
5971 @item -mbitfield
5972 @opindex mbitfield
5973 Do use the bit-field instructions.  The @option{-m68020} option implies
5974 @option{-mbitfield}.  This is the default if you use a configuration
5975 designed for a 68020.
5976
5977 @item -mrtd
5978 @opindex mrtd
5979 Use a different function-calling convention, in which functions
5980 that take a fixed number of arguments return with the @code{rtd}
5981 instruction, which pops their arguments while returning.  This
5982 saves one instruction in the caller since there is no need to pop
5983 the arguments there.
5984
5985 This calling convention is incompatible with the one normally
5986 used on Unix, so you cannot use it if you need to call libraries
5987 compiled with the Unix compiler.
5988
5989 Also, you must provide function prototypes for all functions that
5990 take variable numbers of arguments (including @code{printf});
5991 otherwise incorrect code will be generated for calls to those
5992 functions.
5993
5994 In addition, seriously incorrect code will result if you call a
5995 function with too many arguments.  (Normally, extra arguments are
5996 harmlessly ignored.)
5997
5998 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
5999 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
6000
6001 @item -malign-int
6002 @itemx -mno-align-int
6003 @opindex malign-int
6004 @opindex mno-align-int
6005 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
6006 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
6007 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
6008 Aligning variables on 32-bit boundaries produces code that runs somewhat
6009 faster on processors with 32-bit busses at the expense of more memory.
6010
6011 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
6012 align structures containing the above types  differently than
6013 most published application binary interface specifications for the m68k.
6014
6015 @item -mpcrel
6016 @opindex mpcrel
6017 Use the pc-relative addressing mode of the 68000 directly, instead of
6018 using a global offset table.  At present, this option implies @option{-fpic},
6019 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
6020 not presently supported with @option{-mpcrel}, though this could be supported for
6021 68020 and higher processors.
6022
6023 @item -mno-strict-align
6024 @itemx -mstrict-align
6025 @opindex mno-strict-align
6026 @opindex mstrict-align
6027 Do not (do) assume that unaligned memory references will be handled by
6028 the system.
6029
6030 @item -msep-data
6031 Generate code that allows the data segment to be located in a different
6032 area of memory from the text segment.  This allows for execute in place in
6033 an environment without virtual memory management.  This option implies -fPIC.
6034
6035 @item -mno-sep-data
6036 Generate code that assumes that the data segment follows the text segment.
6037 This is the default.
6038
6039 @item -mid-shared-library
6040 Generate code that supports shared libraries via the library ID method.
6041 This allows for execute in place and shared libraries in an environment
6042 without virtual memory management.  This option implies -fPIC.
6043
6044 @item -mno-id-shared-library
6045 Generate code that doesn't assume ID based shared libraries are being used.
6046 This is the default.
6047
6048 @item -mshared-library-id=n
6049 Specified the identification number of the ID based shared library being
6050 compiled.  Specifying a value of 0 will generate more compact code, specifying
6051 other values will force the allocation of that number to the current
6052 library but is no more space or time efficient than omitting this option.
6053
6054 @end table
6055
6056 @node M68hc1x Options
6057 @subsection M68hc1x Options
6058 @cindex M68hc1x options
6059
6060 These are the @samp{-m} options defined for the 68hc11 and 68hc12
6061 microcontrollers.  The default values for these options depends on
6062 which style of microcontroller was selected when the compiler was configured;
6063 the defaults for the most common choices are given below.
6064
6065 @table @gcctabopt
6066 @item -m6811
6067 @itemx -m68hc11
6068 @opindex m6811
6069 @opindex m68hc11
6070 Generate output for a 68HC11.  This is the default
6071 when the compiler is configured for 68HC11-based systems.
6072
6073 @item -m6812
6074 @itemx -m68hc12
6075 @opindex m6812
6076 @opindex m68hc12
6077 Generate output for a 68HC12.  This is the default
6078 when the compiler is configured for 68HC12-based systems.
6079
6080 @item -m68S12
6081 @itemx -m68hcs12
6082 @opindex m68S12
6083 @opindex m68hcs12
6084 Generate output for a 68HCS12.
6085
6086 @item -mauto-incdec
6087 @opindex mauto-incdec
6088 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
6089 addressing modes.
6090
6091 @item -minmax
6092 @itemx -nominmax
6093 @opindex minmax
6094 @opindex mnominmax
6095 Enable the use of 68HC12 min and max instructions.
6096
6097 @item -mlong-calls
6098 @itemx -mno-long-calls
6099 @opindex mlong-calls
6100 @opindex mno-long-calls
6101 Treat all calls as being far away (near).  If calls are assumed to be
6102 far away, the compiler will use the @code{call} instruction to
6103 call a function and the @code{rtc} instruction for returning.
6104
6105 @item -mshort
6106 @opindex mshort
6107 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6108
6109 @item -msoft-reg-count=@var{count}
6110 @opindex msoft-reg-count
6111 Specify the number of pseudo-soft registers which are used for the
6112 code generation.  The maximum number is 32.  Using more pseudo-soft
6113 register may or may not result in better code depending on the program.
6114 The default is 4 for 68HC11 and 2 for 68HC12.
6115
6116 @end table
6117
6118 @node VAX Options
6119 @subsection VAX Options
6120 @cindex VAX options
6121
6122 These @samp{-m} options are defined for the VAX:
6123
6124 @table @gcctabopt
6125 @item -munix
6126 @opindex munix
6127 Do not output certain jump instructions (@code{aobleq} and so on)
6128 that the Unix assembler for the VAX cannot handle across long
6129 ranges.
6130
6131 @item -mgnu
6132 @opindex mgnu
6133 Do output those jump instructions, on the assumption that you
6134 will assemble with the GNU assembler.
6135
6136 @item -mg
6137 @opindex mg
6138 Output code for g-format floating point numbers instead of d-format.
6139 @end table
6140
6141 @node SPARC Options
6142 @subsection SPARC Options
6143 @cindex SPARC options
6144
6145 These @samp{-m} options are supported on the SPARC:
6146
6147 @table @gcctabopt
6148 @item -mno-app-regs
6149 @itemx -mapp-regs
6150 @opindex mno-app-regs
6151 @opindex mapp-regs
6152 Specify @option{-mapp-regs} to generate output using the global registers
6153 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
6154 is the default.
6155
6156 To be fully SVR4 ABI compliant at the cost of some performance loss,
6157 specify @option{-mno-app-regs}.  You should compile libraries and system
6158 software with this option.
6159
6160 @item -mfpu
6161 @itemx -mhard-float
6162 @opindex mfpu
6163 @opindex mhard-float
6164 Generate output containing floating point instructions.  This is the
6165 default.
6166
6167 @item -mno-fpu
6168 @itemx -msoft-float
6169 @opindex mno-fpu
6170 @opindex msoft-float
6171 Generate output containing library calls for floating point.
6172 @strong{Warning:} the requisite libraries are not available for all SPARC
6173 targets.  Normally the facilities of the machine's usual C compiler are
6174 used, but this cannot be done directly in cross-compilation.  You must make
6175 your own arrangements to provide suitable library functions for
6176 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
6177 @samp{sparclite-*-*} do provide software floating point support.
6178
6179 @option{-msoft-float} changes the calling convention in the output file;
6180 therefore, it is only useful if you compile @emph{all} of a program with
6181 this option.  In particular, you need to compile @file{libgcc.a}, the
6182 library that comes with GCC, with @option{-msoft-float} in order for
6183 this to work.
6184
6185 @item -mhard-quad-float
6186 @opindex mhard-quad-float
6187 Generate output containing quad-word (long double) floating point
6188 instructions.
6189
6190 @item -msoft-quad-float
6191 @opindex msoft-quad-float
6192 Generate output containing library calls for quad-word (long double)
6193 floating point instructions.  The functions called are those specified
6194 in the SPARC ABI@.  This is the default.
6195
6196 As of this writing, there are no SPARC implementations that have hardware
6197 support for the quad-word floating point instructions.  They all invoke
6198 a trap handler for one of these instructions, and then the trap handler
6199 emulates the effect of the instruction.  Because of the trap handler overhead,
6200 this is much slower than calling the ABI library routines.  Thus the
6201 @option{-msoft-quad-float} option is the default.
6202
6203 @item -mno-unaligned-doubles
6204 @itemx -munaligned-doubles
6205 @opindex mno-unaligned-doubles
6206 @opindex munaligned-doubles
6207 Assume that doubles have 8 byte alignment.  This is the default.
6208
6209 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
6210 alignment only if they are contained in another type, or if they have an
6211 absolute address.  Otherwise, it assumes they have 4 byte alignment.
6212 Specifying this option avoids some rare compatibility problems with code
6213 generated by other compilers.  It is not the default because it results
6214 in a performance loss, especially for floating point code.
6215
6216 @item -mno-faster-structs
6217 @itemx -mfaster-structs
6218 @opindex mno-faster-structs
6219 @opindex mfaster-structs
6220 With @option{-mfaster-structs}, the compiler assumes that structures
6221 should have 8 byte alignment.  This enables the use of pairs of
6222 @code{ldd} and @code{std} instructions for copies in structure
6223 assignment, in place of twice as many @code{ld} and @code{st} pairs.
6224 However, the use of this changed alignment directly violates the SPARC
6225 ABI@.  Thus, it's intended only for use on targets where the developer
6226 acknowledges that their resulting code will not be directly in line with
6227 the rules of the ABI@.
6228
6229 @item -mimpure-text
6230 @opindex mimpure-text
6231 @option{-mimpure-text}, used in addition to @option{-shared}, tells
6232 the compiler to not pass @option{-z text} to the linker when linking a
6233 shared object.  Using this option, you can link position-dependent
6234 code into a shared object.
6235
6236 @option{-mimpure-text} suppresses the ``relocations remain against
6237 allocatable but non-writable sections'' linker error message.
6238 However, the necessary relocations will trigger copy-on-write, and the
6239 shared object is not actually shared across processes.  Instead of
6240 using @option{-mimpure-text}, you should compile all source code with
6241 @option{-fpic} or @option{-fPIC}.
6242
6243 This option is only available on SunOS and Solaris.
6244
6245 @item -mcpu=@var{cpu_type}
6246 @opindex mcpu
6247 Set the instruction set, register set, and instruction scheduling parameters
6248 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
6249 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
6250 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
6251 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
6252 @samp{ultrasparc3}.
6253
6254 Default instruction scheduling parameters are used for values that select
6255 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
6256 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
6257
6258 Here is a list of each supported architecture and their supported
6259 implementations.
6260
6261 @smallexample
6262     v7:             cypress
6263     v8:             supersparc, hypersparc
6264     sparclite:      f930, f934, sparclite86x
6265     sparclet:       tsc701
6266     v9:             ultrasparc, ultrasparc3
6267 @end smallexample
6268
6269 By default (unless configured otherwise), GCC generates code for the V7
6270 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
6271 additionally optimizes it for the Cypress CY7C602 chip, as used in the
6272 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
6273 SPARCStation 1, 2, IPX etc.
6274
6275 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
6276 architecture.  The only difference from V7 code is that the compiler emits
6277 the integer multiply and integer divide instructions which exist in SPARC-V8
6278 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
6279 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
6280 2000 series.
6281
6282 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
6283 the SPARC architecture.  This adds the integer multiply, integer divide step
6284 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
6285 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
6286 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU.  With
6287 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
6288 MB86934 chip, which is the more recent SPARClite with FPU.
6289
6290 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
6291 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
6292 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
6293 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
6294 optimizes it for the TEMIC SPARClet chip.
6295
6296 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
6297 architecture.  This adds 64-bit integer and floating-point move instructions,
6298 3 additional floating-point condition code registers and conditional move
6299 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
6300 optimizes it for the Sun UltraSPARC I/II chips.  With
6301 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
6302 Sun UltraSPARC III chip.
6303
6304 @item -mtune=@var{cpu_type}
6305 @opindex mtune
6306 Set the instruction scheduling parameters for machine type
6307 @var{cpu_type}, but do not set the instruction set or register set that the
6308 option @option{-mcpu=@var{cpu_type}} would.
6309
6310 The same values for @option{-mcpu=@var{cpu_type}} can be used for
6311 @option{-mtune=@var{cpu_type}}, but the only useful values are those
6312 that select a particular cpu implementation.  Those are @samp{cypress},
6313 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
6314 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
6315 @samp{ultrasparc3}.
6316
6317 @item -mv8plus
6318 @itemx -mno-v8plus
6319 @opindex -mv8plus
6320 @opindex -mno-v8plus
6321 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI.  The
6322 difference from the V8 ABI is that the global and out registers are
6323 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
6324 mode for all SPARC-V9 processors.
6325
6326 @item -mvis
6327 @itemx -mno-vis
6328 @opindex -mvis
6329 @opindex -mno-vis
6330 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
6331 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
6332 @end table
6333
6334 These @samp{-m} options are supported in addition to the above
6335 on SPARC-V9 processors in 64-bit environments:
6336
6337 @table @gcctabopt
6338 @item -mlittle-endian
6339 @opindex mlittle-endian
6340 Generate code for a processor running in little-endian mode. It is only
6341 available for a few configurations and most notably not on Solaris.
6342
6343 @item -m32
6344 @itemx -m64
6345 @opindex m32
6346 @opindex m64
6347 Generate code for a 32-bit or 64-bit environment.
6348 The 32-bit environment sets int, long and pointer to 32 bits.
6349 The 64-bit environment sets int to 32 bits and long and pointer
6350 to 64 bits.
6351
6352 @item -mcmodel=medlow
6353 @opindex mcmodel=medlow
6354 Generate code for the Medium/Low code model: the program must be linked
6355 in the low 32 bits of the address space.  Pointers are 64 bits.
6356 Programs can be statically or dynamically linked.
6357
6358 @item -mcmodel=medmid
6359 @opindex mcmodel=medmid
6360 Generate code for the Medium/Middle code model: the program must be linked
6361 in the low 44 bits of the address space, the text segment must be less than
6362 2G bytes, and data segment must be within 2G of the text segment.
6363 Pointers are 64 bits.
6364
6365 @item -mcmodel=medany
6366 @opindex mcmodel=medany
6367 Generate code for the Medium/Anywhere code model: the program may be linked
6368 anywhere in the address space, the text segment must be less than
6369 2G bytes, and data segment must be within 2G of the text segment.
6370 Pointers are 64 bits.
6371
6372 @item -mcmodel=embmedany
6373 @opindex mcmodel=embmedany
6374 Generate code for the Medium/Anywhere code model for embedded systems:
6375 assume a 32-bit text and a 32-bit data segment, both starting anywhere
6376 (determined at link time).  Register %g4 points to the base of the
6377 data segment.  Pointers are still 64 bits.
6378 Programs are statically linked, PIC is not supported.
6379
6380 @item -mstack-bias
6381 @itemx -mno-stack-bias
6382 @opindex mstack-bias
6383 @opindex mno-stack-bias
6384 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
6385 frame pointer if present, are offset by @minus{}2047 which must be added back
6386 when making stack frame references.  This is the default in 64-bit mode.
6387 Otherwise, assume no such offset is present.
6388 @end table
6389
6390 @node ARM Options
6391 @subsection ARM Options
6392 @cindex ARM options
6393
6394 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6395 architectures:
6396
6397 @table @gcctabopt
6398 @item -mapcs-frame
6399 @opindex mapcs-frame
6400 Generate a stack frame that is compliant with the ARM Procedure Call
6401 Standard for all functions, even if this is not strictly necessary for
6402 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
6403 with this option will cause the stack frames not to be generated for
6404 leaf functions.  The default is @option{-mno-apcs-frame}.
6405
6406 @item -mapcs
6407 @opindex mapcs
6408 This is a synonym for @option{-mapcs-frame}.
6409
6410 @item -mapcs-26
6411 @opindex mapcs-26
6412 Generate code for a processor running with a 26-bit program counter,
6413 and conforming to the function calling standards for the APCS 26-bit
6414 option.  This option replaces the @option{-m2} and @option{-m3} options
6415 of previous releases of the compiler.
6416
6417 @item -mapcs-32
6418 @opindex mapcs-32
6419 Generate code for a processor running with a 32-bit program counter,
6420 and conforming to the function calling standards for the APCS 32-bit
6421 option.  This option replaces the @option{-m6} option of previous releases
6422 of the compiler.
6423
6424 @ignore
6425 @c not currently implemented
6426 @item -mapcs-stack-check
6427 @opindex mapcs-stack-check
6428 Generate code to check the amount of stack space available upon entry to
6429 every function (that actually uses some stack space).  If there is
6430 insufficient space available then either the function
6431 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6432 called, depending upon the amount of stack space required.  The run time
6433 system is required to provide these functions.  The default is
6434 @option{-mno-apcs-stack-check}, since this produces smaller code.
6435
6436 @c not currently implemented
6437 @item -mapcs-float
6438 @opindex mapcs-float
6439 Pass floating point arguments using the float point registers.  This is
6440 one of the variants of the APCS@.  This option is recommended if the
6441 target hardware has a floating point unit or if a lot of floating point
6442 arithmetic is going to be performed by the code.  The default is
6443 @option{-mno-apcs-float}, since integer only code is slightly increased in
6444 size if @option{-mapcs-float} is used.
6445
6446 @c not currently implemented
6447 @item -mapcs-reentrant
6448 @opindex mapcs-reentrant
6449 Generate reentrant, position independent code.  The default is
6450 @option{-mno-apcs-reentrant}.
6451 @end ignore
6452
6453 @item -mthumb-interwork
6454 @opindex mthumb-interwork
6455 Generate code which supports calling between the ARM and Thumb
6456 instruction sets.  Without this option the two instruction sets cannot
6457 be reliably used inside one program.  The default is
6458 @option{-mno-thumb-interwork}, since slightly larger code is generated
6459 when @option{-mthumb-interwork} is specified.
6460
6461 @item -mno-sched-prolog
6462 @opindex mno-sched-prolog
6463 Prevent the reordering of instructions in the function prolog, or the
6464 merging of those instruction with the instructions in the function's
6465 body.  This means that all functions will start with a recognizable set
6466 of instructions (or in fact one of a choice from a small set of
6467 different function prologues), and this information can be used to
6468 locate the start if functions inside an executable piece of code.  The
6469 default is @option{-msched-prolog}.
6470
6471 @item -mhard-float
6472 @opindex mhard-float
6473 Generate output containing floating point instructions.  This is the
6474 default.
6475
6476 @item -msoft-float
6477 @opindex msoft-float
6478 Generate output containing library calls for floating point.
6479 @strong{Warning:} the requisite libraries are not available for all ARM
6480 targets.  Normally the facilities of the machine's usual C compiler are
6481 used, but this cannot be done directly in cross-compilation.  You must make
6482 your own arrangements to provide suitable library functions for
6483 cross-compilation.
6484
6485 @option{-msoft-float} changes the calling convention in the output file;
6486 therefore, it is only useful if you compile @emph{all} of a program with
6487 this option.  In particular, you need to compile @file{libgcc.a}, the
6488 library that comes with GCC, with @option{-msoft-float} in order for
6489 this to work.
6490
6491 @item -mfloat-abi=@var{name}
6492 @opindex mfloat-abi
6493 Specifies which ABI to use for floating point values.  Permissible values
6494 are: @samp{soft}, @samp{softfp} and @samp{hard}.
6495
6496 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
6497 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
6498 of floating point instructions, but still uses the soft-float calling
6499 conventions.
6500
6501 @item -mlittle-endian
6502 @opindex mlittle-endian
6503 Generate code for a processor running in little-endian mode.  This is
6504 the default for all standard configurations.
6505
6506 @item -mbig-endian
6507 @opindex mbig-endian
6508 Generate code for a processor running in big-endian mode; the default is
6509 to compile code for a little-endian processor.
6510
6511 @item -mwords-little-endian
6512 @opindex mwords-little-endian
6513 This option only applies when generating code for big-endian processors.
6514 Generate code for a little-endian word order but a big-endian byte
6515 order.  That is, a byte order of the form @samp{32107654}.  Note: this
6516 option should only be used if you require compatibility with code for
6517 big-endian ARM processors generated by versions of the compiler prior to
6518 2.8.
6519
6520 @item -malignment-traps
6521 @opindex malignment-traps
6522 Generate code that will not trap if the MMU has alignment traps enabled.
6523 On ARM architectures prior to ARMv4, there were no instructions to
6524 access half-word objects stored in memory.  However, when reading from
6525 memory a feature of the ARM architecture allows a word load to be used,
6526 even if the address is unaligned, and the processor core will rotate the
6527 data as it is being loaded.  This option tells the compiler that such
6528 misaligned accesses will cause a MMU trap and that it should instead
6529 synthesize the access as a series of byte accesses.  The compiler can
6530 still use word accesses to load half-word data if it knows that the
6531 address is aligned to a word boundary.
6532
6533 This option is ignored when compiling for ARM architecture 4 or later,
6534 since these processors have instructions to directly access half-word
6535 objects in memory.
6536
6537 @item -mno-alignment-traps
6538 @opindex mno-alignment-traps
6539 Generate code that assumes that the MMU will not trap unaligned
6540 accesses.  This produces better code when the target instruction set
6541 does not have half-word memory operations (i.e.@: implementations prior to
6542 ARMv4).
6543
6544 Note that you cannot use this option to access unaligned word objects,
6545 since the processor will only fetch one 32-bit aligned object from
6546 memory.
6547
6548 The default setting for most targets is @option{-mno-alignment-traps}, since
6549 this produces better code when there are no half-word memory
6550 instructions available.
6551
6552 @item -mshort-load-bytes
6553 @itemx -mno-short-load-words
6554 @opindex mshort-load-bytes
6555 @opindex mno-short-load-words
6556 These are deprecated aliases for @option{-malignment-traps}.
6557
6558 @item -mno-short-load-bytes
6559 @itemx -mshort-load-words
6560 @opindex mno-short-load-bytes
6561 @opindex mshort-load-words
6562 This are deprecated aliases for @option{-mno-alignment-traps}.
6563
6564 @item -mcpu=@var{name}
6565 @opindex mcpu
6566 This specifies the name of the target ARM processor.  GCC uses this name
6567 to determine what kind of instructions it can emit when generating
6568 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6569 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6570 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6571 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6572 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6573 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6574 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6575 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6576 @samp{arm920t}, @samp{arm926ejs}, @samp{arm940t}, @samp{arm9tdmi},
6577 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ejs},
6578 @samp{arm1136js}, @samp{arm1136jfs} ,@samp{xscale}, @samp{iwmmxt},
6579 @samp{ep9312}.
6580
6581 @itemx -mtune=@var{name}
6582 @opindex mtune
6583 This option is very similar to the @option{-mcpu=} option, except that
6584 instead of specifying the actual target processor type, and hence
6585 restricting which instructions can be used, it specifies that GCC should
6586 tune the performance of the code as if the target were of the type
6587 specified in this option, but still choosing the instructions that it
6588 will generate based on the cpu specified by a @option{-mcpu=} option.
6589 For some ARM implementations better performance can be obtained by using
6590 this option.
6591
6592 @item -march=@var{name}
6593 @opindex march
6594 This specifies the name of the target ARM architecture.  GCC uses this
6595 name to determine what kind of instructions it can emit when generating
6596 assembly code.  This option can be used in conjunction with or instead
6597 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6598 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6599 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
6600 @samp{iwmmxt}, @samp{ep9312}.
6601
6602 @item -mfpu=@var{name}
6603 @itemx -mfpe=@var{number}
6604 @itemx -mfp=@var{number}
6605 @opindex mfpu
6606 @opindex mfpe
6607 @opindex mfp
6608 This specifies what floating point hardware (or hardware emulation) is
6609 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
6610 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
6611 are synonyms for @option{-mpfu}=@samp{fpe}@var{number}, for compatibility
6612 with older versions of GCC@.
6613
6614 If @option{-msoft-float} is specified this specifies the format of
6615 floating point values.
6616
6617 @item -mstructure-size-boundary=@var{n}
6618 @opindex mstructure-size-boundary
6619 The size of all structures and unions will be rounded up to a multiple
6620 of the number of bits set by this option.  Permissible values are 8 and
6621 32.  The default value varies for different toolchains.  For the COFF
6622 targeted toolchain the default value is 8.  Specifying the larger number
6623 can produce faster, more efficient code, but can also increase the size
6624 of the program.  The two values are potentially incompatible.  Code
6625 compiled with one value cannot necessarily expect to work with code or
6626 libraries compiled with the other value, if they exchange information
6627 using structures or unions.
6628
6629 @item -mabort-on-noreturn
6630 @opindex mabort-on-noreturn
6631 Generate a call to the function @code{abort} at the end of a
6632 @code{noreturn} function.  It will be executed if the function tries to
6633 return.
6634
6635 @item -mlong-calls
6636 @itemx -mno-long-calls
6637 @opindex mlong-calls
6638 @opindex mno-long-calls
6639 Tells the compiler to perform function calls by first loading the
6640 address of the function into a register and then performing a subroutine
6641 call on this register.  This switch is needed if the target function
6642 will lie outside of the 64 megabyte addressing range of the offset based
6643 version of subroutine call instruction.
6644
6645 Even if this switch is enabled, not all function calls will be turned
6646 into long calls.  The heuristic is that static functions, functions
6647 which have the @samp{short-call} attribute, functions that are inside
6648 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6649 definitions have already been compiled within the current compilation
6650 unit, will not be turned into long calls.  The exception to this rule is
6651 that weak function definitions, functions with the @samp{long-call}
6652 attribute or the @samp{section} attribute, and functions that are within
6653 the scope of a @samp{#pragma long_calls} directive, will always be
6654 turned into long calls.
6655
6656 This feature is not enabled by default.  Specifying
6657 @option{-mno-long-calls} will restore the default behavior, as will
6658 placing the function calls within the scope of a @samp{#pragma
6659 long_calls_off} directive.  Note these switches have no effect on how
6660 the compiler generates code to handle function calls via function
6661 pointers.
6662
6663 @item -mnop-fun-dllimport
6664 @opindex mnop-fun-dllimport
6665 Disable support for the @code{dllimport} attribute.
6666
6667 @item -msingle-pic-base
6668 @opindex msingle-pic-base
6669 Treat the register used for PIC addressing as read-only, rather than
6670 loading it in the prologue for each function.  The run-time system is
6671 responsible for initializing this register with an appropriate value
6672 before execution begins.
6673
6674 @item -mpic-register=@var{reg}
6675 @opindex mpic-register
6676 Specify the register to be used for PIC addressing.  The default is R10
6677 unless stack-checking is enabled, when R9 is used.
6678
6679 @item -mcirrus-fix-invalid-insns
6680 @opindex mcirrus-fix-invalid-insns
6681 @opindex mno-cirrus-fix-invalid-insns
6682 Insert NOPs into the instruction stream to in order to work around
6683 problems with invalid Maverick instruction combinations.  This option
6684 is only valid if the @option{-mcpu=ep9312} option has been used to
6685 enable generation of instructions for the Cirrus Maverick floating
6686 point co-processor.  This option is not enabled by default, since the
6687 problem is only present in older Maverick implementations.  The default
6688 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
6689 switch.
6690
6691 @item -mpoke-function-name
6692 @opindex mpoke-function-name
6693 Write the name of each function into the text section, directly
6694 preceding the function prologue.  The generated code is similar to this:
6695
6696 @smallexample
6697      t0
6698          .ascii "arm_poke_function_name", 0
6699          .align
6700      t1
6701          .word 0xff000000 + (t1 - t0)
6702      arm_poke_function_name
6703          mov     ip, sp
6704          stmfd   sp!, @{fp, ip, lr, pc@}
6705          sub     fp, ip, #4
6706 @end smallexample
6707
6708 When performing a stack backtrace, code can inspect the value of
6709 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6710 location @code{pc - 12} and the top 8 bits are set, then we know that
6711 there is a function name embedded immediately preceding this location
6712 and has length @code{((pc[-3]) & 0xff000000)}.
6713
6714 @item -mthumb
6715 @opindex mthumb
6716 Generate code for the 16-bit Thumb instruction set.  The default is to
6717 use the 32-bit ARM instruction set.
6718
6719 @item -mtpcs-frame
6720 @opindex mtpcs-frame
6721 Generate a stack frame that is compliant with the Thumb Procedure Call
6722 Standard for all non-leaf functions.  (A leaf function is one that does
6723 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6724
6725 @item -mtpcs-leaf-frame
6726 @opindex mtpcs-leaf-frame
6727 Generate a stack frame that is compliant with the Thumb Procedure Call
6728 Standard for all leaf functions.  (A leaf function is one that does
6729 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6730
6731 @item -mcallee-super-interworking
6732 @opindex mcallee-super-interworking
6733 Gives all externally visible functions in the file being compiled an ARM
6734 instruction set header which switches to Thumb mode before executing the
6735 rest of the function.  This allows these functions to be called from
6736 non-interworking code.
6737
6738 @item -mcaller-super-interworking
6739 @opindex mcaller-super-interworking
6740 Allows calls via function pointers (including virtual functions) to
6741 execute correctly regardless of whether the target code has been
6742 compiled for interworking or not.  There is a small overhead in the cost
6743 of executing a function pointer if this option is enabled.
6744
6745 @end table
6746
6747 @node MN10300 Options
6748 @subsection MN10300 Options
6749 @cindex MN10300 options
6750
6751 These @option{-m} options are defined for Matsushita MN10300 architectures:
6752
6753 @table @gcctabopt
6754 @item -mmult-bug
6755 @opindex mmult-bug
6756 Generate code to avoid bugs in the multiply instructions for the MN10300
6757 processors.  This is the default.
6758
6759 @item -mno-mult-bug
6760 @opindex mno-mult-bug
6761 Do not generate code to avoid bugs in the multiply instructions for the
6762 MN10300 processors.
6763
6764 @item -mam33
6765 @opindex mam33
6766 Generate code which uses features specific to the AM33 processor.
6767
6768 @item -mno-am33
6769 @opindex mno-am33
6770 Do not generate code which uses features specific to the AM33 processor.  This
6771 is the default.
6772
6773 @item -mno-crt0
6774 @opindex mno-crt0
6775 Do not link in the C run-time initialization object file.
6776
6777 @item -mrelax
6778 @opindex mrelax
6779 Indicate to the linker that it should perform a relaxation optimization pass
6780 to shorten branches, calls and absolute memory addresses.  This option only
6781 has an effect when used on the command line for the final link step.
6782
6783 This option makes symbolic debugging impossible.
6784 @end table
6785
6786
6787 @node M32R/D Options
6788 @subsection M32R/D Options
6789 @cindex M32R/D options
6790
6791 These @option{-m} options are defined for Renesas M32R/D architectures:
6792
6793 @table @gcctabopt
6794 @item -m32r2
6795 @opindex m32r2
6796 Generate code for the M32R/2@.
6797
6798 @item -m32rx
6799 @opindex m32rx
6800 Generate code for the M32R/X@.
6801
6802 @item -m32r
6803 @opindex m32r
6804 Generate code for the M32R@.  This is the default.
6805
6806 @item -mmodel=small
6807 @opindex mmodel=small
6808 Assume all objects live in the lower 16MB of memory (so that their addresses
6809 can be loaded with the @code{ld24} instruction), and assume all subroutines
6810 are reachable with the @code{bl} instruction.
6811 This is the default.
6812
6813 The addressability of a particular object can be set with the
6814 @code{model} attribute.
6815
6816 @item -mmodel=medium
6817 @opindex mmodel=medium
6818 Assume objects may be anywhere in the 32-bit address space (the compiler
6819 will generate @code{seth/add3} instructions to load their addresses), and
6820 assume all subroutines are reachable with the @code{bl} instruction.
6821
6822 @item -mmodel=large
6823 @opindex mmodel=large
6824 Assume objects may be anywhere in the 32-bit address space (the compiler
6825 will generate @code{seth/add3} instructions to load their addresses), and
6826 assume subroutines may not be reachable with the @code{bl} instruction
6827 (the compiler will generate the much slower @code{seth/add3/jl}
6828 instruction sequence).
6829
6830 @item -msdata=none
6831 @opindex msdata=none
6832 Disable use of the small data area.  Variables will be put into
6833 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6834 @code{section} attribute has been specified).
6835 This is the default.
6836
6837 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6838 Objects may be explicitly put in the small data area with the
6839 @code{section} attribute using one of these sections.
6840
6841 @item -msdata=sdata
6842 @opindex msdata=sdata
6843 Put small global and static data in the small data area, but do not
6844 generate special code to reference them.
6845
6846 @item -msdata=use
6847 @opindex msdata=use
6848 Put small global and static data in the small data area, and generate
6849 special instructions to reference them.
6850
6851 @item -G @var{num}
6852 @opindex G
6853 @cindex smaller data references
6854 Put global and static objects less than or equal to @var{num} bytes
6855 into the small data or bss sections instead of the normal data or bss
6856 sections.  The default value of @var{num} is 8.
6857 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6858 for this option to have any effect.
6859
6860 All modules should be compiled with the same @option{-G @var{num}} value.
6861 Compiling with different values of @var{num} may or may not work; if it
6862 doesn't the linker will give an error message---incorrect code will not be
6863 generated.
6864
6865 @item -mdebug
6866 @opindex -mdebug
6867 Makes the M32R specific code in the compiler display some statistics
6868 that might help in debugging programs.
6869
6870 @item -malign-loops
6871 @opindex malign-loops
6872 Align all loops to a 32-byte boundary.
6873
6874 @item -mno-align-loops
6875 @opindex mno-align-loops
6876 Do not enforce a 32-byte alignment for loops.  This is the default.
6877
6878 @item -missue-rate=@var{number}
6879 @opindex missue-rate=@var{number}
6880 Issue @var{number} instructions per cycle.  @var{number} can only be 1
6881 or 2.
6882
6883 @item -mbranch-cost=@var{number}
6884 @opindex mbranch-cost=@var{number}
6885 @var{number} can only be 1 or 2.  If it is 1 then branches will be
6886 preferred over conditional code, if it is 2, then the opposite will
6887 apply.
6888
6889 @item -mflush-trap=@var{number}
6890 @opindex mflush-trap=@var{number}
6891 Specifies the trap number to use to flush the cache.  The default is
6892 12.  Valid numbers are between 0 and 15 inclusive.
6893
6894 @item -mno-flush-trap
6895 @opindex mno-flush-trap
6896 Specifies that the cache cannot be flushed by using a trap.
6897
6898 @item -mflush-func=@var{name}
6899 @opindex mflush-func=@var{name}
6900 Specifies the name of the operating system function to call to flush
6901 the cache.  The default is @emph{_flush_cache}, but a function call
6902 will only be used if a trap is not available.
6903
6904 @item -mno-flush-func
6905 @opindex mno-flush-func
6906 Indicates that there is no OS function for flushing the cache.
6907
6908 @end table
6909
6910 @node RS/6000 and PowerPC Options
6911 @subsection IBM RS/6000 and PowerPC Options
6912 @cindex RS/6000 and PowerPC Options
6913 @cindex IBM RS/6000 and PowerPC Options
6914
6915 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6916 @table @gcctabopt
6917 @item -mpower
6918 @itemx -mno-power
6919 @itemx -mpower2
6920 @itemx -mno-power2
6921 @itemx -mpowerpc
6922 @itemx -mno-powerpc
6923 @itemx -mpowerpc-gpopt
6924 @itemx -mno-powerpc-gpopt
6925 @itemx -mpowerpc-gfxopt
6926 @itemx -mno-powerpc-gfxopt
6927 @itemx -mpowerpc64
6928 @itemx -mno-powerpc64
6929 @opindex mpower
6930 @opindex mno-power
6931 @opindex mpower2
6932 @opindex mno-power2
6933 @opindex mpowerpc
6934 @opindex mno-powerpc
6935 @opindex mpowerpc-gpopt
6936 @opindex mno-powerpc-gpopt
6937 @opindex mpowerpc-gfxopt
6938 @opindex mno-powerpc-gfxopt
6939 @opindex mpowerpc64
6940 @opindex mno-powerpc64
6941 GCC supports two related instruction set architectures for the
6942 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
6943 instructions supported by the @samp{rios} chip set used in the original
6944 RS/6000 systems and the @dfn{PowerPC} instruction set is the
6945 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
6946 the IBM 4xx microprocessors.
6947
6948 Neither architecture is a subset of the other.  However there is a
6949 large common subset of instructions supported by both.  An MQ
6950 register is included in processors supporting the POWER architecture.
6951
6952 You use these options to specify which instructions are available on the
6953 processor you are using.  The default value of these options is
6954 determined when configuring GCC@.  Specifying the
6955 @option{-mcpu=@var{cpu_type}} overrides the specification of these
6956 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
6957 rather than the options listed above.
6958
6959 The @option{-mpower} option allows GCC to generate instructions that
6960 are found only in the POWER architecture and to use the MQ register.
6961 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
6962 to generate instructions that are present in the POWER2 architecture but
6963 not the original POWER architecture.
6964
6965 The @option{-mpowerpc} option allows GCC to generate instructions that
6966 are found only in the 32-bit subset of the PowerPC architecture.
6967 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
6968 GCC to use the optional PowerPC architecture instructions in the
6969 General Purpose group, including floating-point square root.  Specifying
6970 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
6971 use the optional PowerPC architecture instructions in the Graphics
6972 group, including floating-point select.
6973
6974 The @option{-mpowerpc64} option allows GCC to generate the additional
6975 64-bit instructions that are found in the full PowerPC64 architecture
6976 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
6977 @option{-mno-powerpc64}.
6978
6979 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
6980 will use only the instructions in the common subset of both
6981 architectures plus some special AIX common-mode calls, and will not use
6982 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
6983 permits GCC to use any instruction from either architecture and to
6984 allow use of the MQ register; specify this for the Motorola MPC601.
6985
6986 @item -mnew-mnemonics
6987 @itemx -mold-mnemonics
6988 @opindex mnew-mnemonics
6989 @opindex mold-mnemonics
6990 Select which mnemonics to use in the generated assembler code.  With
6991 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
6992 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
6993 assembler mnemonics defined for the POWER architecture.  Instructions
6994 defined in only one architecture have only one mnemonic; GCC uses that
6995 mnemonic irrespective of which of these options is specified.
6996
6997 GCC defaults to the mnemonics appropriate for the architecture in
6998 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
6999 value of these option.  Unless you are building a cross-compiler, you
7000 should normally not specify either @option{-mnew-mnemonics} or
7001 @option{-mold-mnemonics}, but should instead accept the default.
7002
7003 @item -mcpu=@var{cpu_type}
7004 @opindex mcpu
7005 Set architecture type, register usage, choice of mnemonics, and
7006 instruction scheduling parameters for machine type @var{cpu_type}.
7007 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
7008 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
7009 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
7010 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
7011 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
7012 @samp{860}, @samp{970}, @samp{common}, @samp{ec603e}, @samp{G3},
7013 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
7014 @samp{power4}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
7015 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64a}.
7016
7017 @option{-mcpu=common} selects a completely generic processor.  Code
7018 generated under this option will run on any POWER or PowerPC processor.
7019 GCC will use only the instructions in the common subset of both
7020 architectures, and will not use the MQ register.  GCC assumes a generic
7021 processor model for scheduling purposes.
7022
7023 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
7024 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
7025 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
7026 types, with an appropriate, generic processor model assumed for
7027 scheduling purposes.
7028
7029 The other options specify a specific processor.  Code generated under
7030 those options will run best on that processor, and may not run at all on
7031 others.
7032
7033 The @option{-mcpu} options automatically enable or disable the
7034 following options: @option{-maltivec}, @option{-mhard-float},
7035 @option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
7036 @option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
7037 @option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
7038 @option{-mstring}.  The particular options set for any particular CPU
7039 will vary between compiler versions, depending on what setting seems
7040 to produce optimal code for that CPU; it doesn't necessarily reflect
7041 the actual hardware's capabilities.  If you wish to set an individual
7042 option to a particular value, you may specify it after the
7043 @option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
7044
7045 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
7046 not enabled or disabled by the @option{-mcpu} option at present, since
7047 AIX does not have full support for these options.  You may still
7048 enable or disable them individually if you're sure it'll work in your
7049 environment.
7050
7051 @item -mtune=@var{cpu_type}
7052 @opindex mtune
7053 Set the instruction scheduling parameters for machine type
7054 @var{cpu_type}, but do not set the architecture type, register usage, or
7055 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
7056 values for @var{cpu_type} are used for @option{-mtune} as for
7057 @option{-mcpu}.  If both are specified, the code generated will use the
7058 architecture, registers, and mnemonics set by @option{-mcpu}, but the
7059 scheduling parameters set by @option{-mtune}.
7060
7061 @item -maltivec
7062 @itemx -mno-altivec
7063 @opindex maltivec
7064 @opindex mno-altivec
7065 These switches enable or disable the use of built-in functions that
7066 allow access to the AltiVec instruction set.  You may also need to set
7067 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
7068 enhancements.
7069
7070 @item -mabi=spe
7071 @opindex mabi=spe
7072 Extend the current ABI with SPE ABI extensions.  This does not change
7073 the default ABI, instead it adds the SPE ABI extensions to the current
7074 ABI@.
7075
7076 @item -mabi=no-spe
7077 @opindex mabi=no-spe
7078 Disable Booke SPE ABI extensions for the current ABI.
7079
7080 @item -misel=@var{yes/no}
7081 @itemx -misel
7082 @opindex misel
7083 This switch enables or disables the generation of ISEL instructions.
7084
7085 @item -mspe=@var{yes/no}
7086 @itemx -mspe
7087 @opindex mspe
7088 This switch enables or disables the generation of SPE simd
7089 instructions.
7090
7091 @item -mfloat-gprs=@var{yes/no}
7092 @itemx -mfloat-gprs
7093 @opindex mfloat-gprs
7094 This switch enables or disables the generation of floating point
7095 operations on the general purpose registers for architectures that
7096 support it.  This option is currently only available on the MPC8540.
7097
7098 @item -mfull-toc
7099 @itemx -mno-fp-in-toc
7100 @itemx -mno-sum-in-toc
7101 @itemx -mminimal-toc
7102 @opindex mfull-toc
7103 @opindex mno-fp-in-toc
7104 @opindex mno-sum-in-toc
7105 @opindex mminimal-toc
7106 Modify generation of the TOC (Table Of Contents), which is created for
7107 every executable file.  The @option{-mfull-toc} option is selected by
7108 default.  In that case, GCC will allocate at least one TOC entry for
7109 each unique non-automatic variable reference in your program.  GCC
7110 will also place floating-point constants in the TOC@.  However, only
7111 16,384 entries are available in the TOC@.
7112
7113 If you receive a linker error message that saying you have overflowed
7114 the available TOC space, you can reduce the amount of TOC space used
7115 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
7116 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
7117 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
7118 generate code to calculate the sum of an address and a constant at
7119 run-time instead of putting that sum into the TOC@.  You may specify one
7120 or both of these options.  Each causes GCC to produce very slightly
7121 slower and larger code at the expense of conserving TOC space.
7122
7123 If you still run out of space in the TOC even when you specify both of
7124 these options, specify @option{-mminimal-toc} instead.  This option causes
7125 GCC to make only one TOC entry for every file.  When you specify this
7126 option, GCC will produce code that is slower and larger but which
7127 uses extremely little TOC space.  You may wish to use this option
7128 only on files that contain less frequently executed code.
7129
7130 @item -maix64
7131 @itemx -maix32
7132 @opindex maix64
7133 @opindex maix32
7134 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7135 @code{long} type, and the infrastructure needed to support them.
7136 Specifying @option{-maix64} implies @option{-mpowerpc64} and
7137 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
7138 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
7139
7140 @item -mxl-call
7141 @itemx -mno-xl-call
7142 @opindex mxl-call
7143 @opindex mno-xl-call
7144 On AIX, pass floating-point arguments to prototyped functions beyond the
7145 register save area (RSA) on the stack in addition to argument FPRs.  The
7146 AIX calling convention was extended but not initially documented to
7147 handle an obscure K&R C case of calling a function that takes the
7148 address of its arguments with fewer arguments than declared.  AIX XL
7149 compilers access floating point arguments which do not fit in the
7150 RSA from the stack when a subroutine is compiled without
7151 optimization.  Because always storing floating-point arguments on the
7152 stack is inefficient and rarely needed, this option is not enabled by
7153 default and only is necessary when calling subroutines compiled by AIX
7154 XL compilers without optimization.
7155
7156 @item -mpe
7157 @opindex mpe
7158 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
7159 application written to use message passing with special startup code to
7160 enable the application to run.  The system must have PE installed in the
7161 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
7162 must be overridden with the @option{-specs=} option to specify the
7163 appropriate directory location.  The Parallel Environment does not
7164 support threads, so the @option{-mpe} option and the @option{-pthread}
7165 option are incompatible.
7166
7167 @item -malign-natural
7168 @itemx -malign-power
7169 @opindex malign-natural
7170 @opindex malign-power
7171 On AIX, Darwin, and 64-bit PowerPC GNU/Linux, the option
7172 @option{-malign-natural} overrides the ABI-defined alignment of larger
7173 types, such as floating-point doubles, on their natural size-based boundary.
7174 The option @option{-malign-power} instructs GCC to follow the ABI-specified
7175 alignment rules.  GCC defaults to the standard alignment defined in the ABI.
7176
7177 @item -msoft-float
7178 @itemx -mhard-float
7179 @opindex msoft-float
7180 @opindex mhard-float
7181 Generate code that does not use (uses) the floating-point register set.
7182 Software floating point emulation is provided if you use the
7183 @option{-msoft-float} option, and pass the option to GCC when linking.
7184
7185 @item -mmultiple
7186 @itemx -mno-multiple
7187 @opindex mmultiple
7188 @opindex mno-multiple
7189 Generate code that uses (does not use) the load multiple word
7190 instructions and the store multiple word instructions.  These
7191 instructions are generated by default on POWER systems, and not
7192 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
7193 endian PowerPC systems, since those instructions do not work when the
7194 processor is in little endian mode.  The exceptions are PPC740 and
7195 PPC750 which permit the instructions usage in little endian mode.
7196
7197 @item -mstring
7198 @itemx -mno-string
7199 @opindex mstring
7200 @opindex mno-string
7201 Generate code that uses (does not use) the load string instructions
7202 and the store string word instructions to save multiple registers and
7203 do small block moves.  These instructions are generated by default on
7204 POWER systems, and not generated on PowerPC systems.  Do not use
7205 @option{-mstring} on little endian PowerPC systems, since those
7206 instructions do not work when the processor is in little endian mode.
7207 The exceptions are PPC740 and PPC750 which permit the instructions
7208 usage in little endian mode.
7209
7210 @item -mupdate
7211 @itemx -mno-update
7212 @opindex mupdate
7213 @opindex mno-update
7214 Generate code that uses (does not use) the load or store instructions
7215 that update the base register to the address of the calculated memory
7216 location.  These instructions are generated by default.  If you use
7217 @option{-mno-update}, there is a small window between the time that the
7218 stack pointer is updated and the address of the previous frame is
7219 stored, which means code that walks the stack frame across interrupts or
7220 signals may get corrupted data.
7221
7222 @item -mfused-madd
7223 @itemx -mno-fused-madd
7224 @opindex mfused-madd
7225 @opindex mno-fused-madd
7226 Generate code that uses (does not use) the floating point multiply and
7227 accumulate instructions.  These instructions are generated by default if
7228 hardware floating is used.
7229
7230 @item -mno-bit-align
7231 @itemx -mbit-align
7232 @opindex mno-bit-align
7233 @opindex mbit-align
7234 On System V.4 and embedded PowerPC systems do not (do) force structures
7235 and unions that contain bit-fields to be aligned to the base type of the
7236 bit-field.
7237
7238 For example, by default a structure containing nothing but 8
7239 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
7240 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
7241 the structure would be aligned to a 1 byte boundary and be one byte in
7242 size.
7243
7244 @item -mno-strict-align
7245 @itemx -mstrict-align
7246 @opindex mno-strict-align
7247 @opindex mstrict-align
7248 On System V.4 and embedded PowerPC systems do not (do) assume that
7249 unaligned memory references will be handled by the system.
7250
7251 @item -mrelocatable
7252 @itemx -mno-relocatable
7253 @opindex mrelocatable
7254 @opindex mno-relocatable
7255 On embedded PowerPC systems generate code that allows (does not allow)
7256 the program to be relocated to a different address at runtime.  If you
7257 use @option{-mrelocatable} on any module, all objects linked together must
7258 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
7259
7260 @item -mrelocatable-lib
7261 @itemx -mno-relocatable-lib
7262 @opindex mrelocatable-lib
7263 @opindex mno-relocatable-lib
7264 On embedded PowerPC systems generate code that allows (does not allow)
7265 the program to be relocated to a different address at runtime.  Modules
7266 compiled with @option{-mrelocatable-lib} can be linked with either modules
7267 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
7268 with modules compiled with the @option{-mrelocatable} options.
7269
7270 @item -mno-toc
7271 @itemx -mtoc
7272 @opindex mno-toc
7273 @opindex mtoc
7274 On System V.4 and embedded PowerPC systems do not (do) assume that
7275 register 2 contains a pointer to a global area pointing to the addresses
7276 used in the program.
7277
7278 @item -mlittle
7279 @itemx -mlittle-endian
7280 @opindex mlittle
7281 @opindex mlittle-endian
7282 On System V.4 and embedded PowerPC systems compile code for the
7283 processor in little endian mode.  The @option{-mlittle-endian} option is
7284 the same as @option{-mlittle}.
7285
7286 @item -mbig
7287 @itemx -mbig-endian
7288 @opindex mbig
7289 @opindex mbig-endian
7290 On System V.4 and embedded PowerPC systems compile code for the
7291 processor in big endian mode.  The @option{-mbig-endian} option is
7292 the same as @option{-mbig}.
7293
7294 @item -mdynamic-no-pic
7295 @opindex mdynamic-no-pic
7296 On Darwin and Mac OS X systems, compile code so that it is not
7297 relocatable, but that its external references are relocatable.  The
7298 resulting code is suitable for applications, but not shared
7299 libraries.
7300
7301 @item -mprioritize-restricted-insns=@var{priority}
7302 @opindex mprioritize-restricted-insns
7303 This option controls the priority that is assigned to
7304 dispatch-slot restricted instructions during the second scheduling
7305 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
7306 @var{no/highest/second-highest} priority to dispatch slot restricted
7307 instructions.
7308
7309 @item -msched-costly-dep=@var{dependence_type}
7310 @opindex msched-costly-dep
7311 This option controls which dependences are considered costly
7312 by the target during instruction scheduling.  The argument
7313 @var{dependence_type} takes one of the following values:
7314 @var{no}: no dependence is costly,
7315 @var{all}: all dependences are costly,
7316 @var{true_store_to_load}: a true dependence from store to load is costly,
7317 @var{store_to_load}: any dependence from store to load is costly,
7318 @var{number}: any dependence which latency >= @var{number} is costly.
7319
7320 @item -minsert-sched-nops=@var{scheme}
7321 @opindex minsert-sched-nops
7322 This option controls which nop insertion scheme will be used during
7323 the second scheduling pass. The argument @var{scheme} takes one of the
7324 following values:
7325 @var{no}: Don't insert nops.
7326 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
7327 according to the scheduler's grouping.
7328 @var{regroup_exact}: Insert nops to force costly dependent insns into
7329 separate groups.  Insert exactly as many nops as needed to force an insn
7330 to a new group, according to the estimated processor grouping.
7331 @var{number}: Insert nops to force costly dependent insns into
7332 separate groups.  Insert @var{number} nops to force an insn to a new group.
7333
7334 @item -mcall-sysv
7335 @opindex mcall-sysv
7336 On System V.4 and embedded PowerPC systems compile code using calling
7337 conventions that adheres to the March 1995 draft of the System V
7338 Application Binary Interface, PowerPC processor supplement.  This is the
7339 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
7340
7341 @item -mcall-sysv-eabi
7342 @opindex mcall-sysv-eabi
7343 Specify both @option{-mcall-sysv} and @option{-meabi} options.
7344
7345 @item -mcall-sysv-noeabi
7346 @opindex mcall-sysv-noeabi
7347 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
7348
7349 @item -mcall-solaris
7350 @opindex mcall-solaris
7351 On System V.4 and embedded PowerPC systems compile code for the Solaris
7352 operating system.
7353
7354 @item -mcall-linux
7355 @opindex mcall-linux
7356 On System V.4 and embedded PowerPC systems compile code for the
7357 Linux-based GNU system.
7358
7359 @item -mcall-gnu
7360 @opindex mcall-gnu
7361 On System V.4 and embedded PowerPC systems compile code for the
7362 Hurd-based GNU system.
7363
7364 @item -mcall-netbsd
7365 @opindex mcall-netbsd
7366 On System V.4 and embedded PowerPC systems compile code for the
7367 NetBSD operating system.
7368
7369 @item -maix-struct-return
7370 @opindex maix-struct-return
7371 Return all structures in memory (as specified by the AIX ABI)@.
7372
7373 @item -msvr4-struct-return
7374 @opindex msvr4-struct-return
7375 Return structures smaller than 8 bytes in registers (as specified by the
7376 SVR4 ABI)@.
7377
7378 @item -mabi=altivec
7379 @opindex mabi=altivec
7380 Extend the current ABI with AltiVec ABI extensions.  This does not
7381 change the default ABI, instead it adds the AltiVec ABI extensions to
7382 the current ABI@.
7383
7384 @item -mabi=no-altivec
7385 @opindex mabi=no-altivec
7386 Disable AltiVec ABI extensions for the current ABI.
7387
7388 @item -mprototype
7389 @itemx -mno-prototype
7390 @opindex mprototype
7391 @opindex mno-prototype
7392 On System V.4 and embedded PowerPC systems assume that all calls to
7393 variable argument functions are properly prototyped.  Otherwise, the
7394 compiler must insert an instruction before every non prototyped call to
7395 set or clear bit 6 of the condition code register (@var{CR}) to
7396 indicate whether floating point values were passed in the floating point
7397 registers in case the function takes a variable arguments.  With
7398 @option{-mprototype}, only calls to prototyped variable argument functions
7399 will set or clear the bit.
7400
7401 @item -msim
7402 @opindex msim
7403 On embedded PowerPC systems, assume that the startup module is called
7404 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7405 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7406 configurations.
7407
7408 @item -mmvme
7409 @opindex mmvme
7410 On embedded PowerPC systems, assume that the startup module is called
7411 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7412 @file{libc.a}.
7413
7414 @item -mads
7415 @opindex mads
7416 On embedded PowerPC systems, assume that the startup module is called
7417 @file{crt0.o} and the standard C libraries are @file{libads.a} and
7418 @file{libc.a}.
7419
7420 @item -myellowknife
7421 @opindex myellowknife
7422 On embedded PowerPC systems, assume that the startup module is called
7423 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
7424 @file{libc.a}.
7425
7426 @item -mvxworks
7427 @opindex mvxworks
7428 On System V.4 and embedded PowerPC systems, specify that you are
7429 compiling for a VxWorks system.
7430
7431 @item -mwindiss
7432 @opindex mwindiss
7433 Specify that you are compiling for the WindISS simulation environment.
7434
7435 @item -memb
7436 @opindex memb
7437 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7438 header to indicate that @samp{eabi} extended relocations are used.
7439
7440 @item -meabi
7441 @itemx -mno-eabi
7442 @opindex meabi
7443 @opindex mno-eabi
7444 On System V.4 and embedded PowerPC systems do (do not) adhere to the
7445 Embedded Applications Binary Interface (eabi) which is a set of
7446 modifications to the System V.4 specifications.  Selecting @option{-meabi}
7447 means that the stack is aligned to an 8 byte boundary, a function
7448 @code{__eabi} is called to from @code{main} to set up the eabi
7449 environment, and the @option{-msdata} option can use both @code{r2} and
7450 @code{r13} to point to two separate small data areas.  Selecting
7451 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7452 do not call an initialization function from @code{main}, and the
7453 @option{-msdata} option will only use @code{r13} to point to a single
7454 small data area.  The @option{-meabi} option is on by default if you
7455 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7456
7457 @item -msdata=eabi
7458 @opindex msdata=eabi
7459 On System V.4 and embedded PowerPC systems, put small initialized
7460 @code{const} global and static data in the @samp{.sdata2} section, which
7461 is pointed to by register @code{r2}.  Put small initialized
7462 non-@code{const} global and static data in the @samp{.sdata} section,
7463 which is pointed to by register @code{r13}.  Put small uninitialized
7464 global and static data in the @samp{.sbss} section, which is adjacent to
7465 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7466 incompatible with the @option{-mrelocatable} option.  The
7467 @option{-msdata=eabi} option also sets the @option{-memb} option.
7468
7469 @item -msdata=sysv
7470 @opindex msdata=sysv
7471 On System V.4 and embedded PowerPC systems, put small global and static
7472 data in the @samp{.sdata} section, which is pointed to by register
7473 @code{r13}.  Put small uninitialized global and static data in the
7474 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7475 The @option{-msdata=sysv} option is incompatible with the
7476 @option{-mrelocatable} option.
7477
7478 @item -msdata=default
7479 @itemx -msdata
7480 @opindex msdata=default
7481 @opindex msdata
7482 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7483 compile code the same as @option{-msdata=eabi}, otherwise compile code the
7484 same as @option{-msdata=sysv}.
7485
7486 @item -msdata-data
7487 @opindex msdata-data
7488 On System V.4 and embedded PowerPC systems, put small global and static
7489 data in the @samp{.sdata} section.  Put small uninitialized global and
7490 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7491 to address small data however.  This is the default behavior unless
7492 other @option{-msdata} options are used.
7493
7494 @item -msdata=none
7495 @itemx -mno-sdata
7496 @opindex msdata=none
7497 @opindex mno-sdata
7498 On embedded PowerPC systems, put all initialized global and static data
7499 in the @samp{.data} section, and all uninitialized data in the
7500 @samp{.bss} section.
7501
7502 @item -G @var{num}
7503 @opindex G
7504 @cindex smaller data references (PowerPC)
7505 @cindex .sdata/.sdata2 references (PowerPC)
7506 On embedded PowerPC systems, put global and static items less than or
7507 equal to @var{num} bytes into the small data or bss sections instead of
7508 the normal data or bss section.  By default, @var{num} is 8.  The
7509 @option{-G @var{num}} switch is also passed to the linker.
7510 All modules should be compiled with the same @option{-G @var{num}} value.
7511
7512 @item -mregnames
7513 @itemx -mno-regnames
7514 @opindex mregnames
7515 @opindex mno-regnames
7516 On System V.4 and embedded PowerPC systems do (do not) emit register
7517 names in the assembly language output using symbolic forms.
7518
7519 @item -mlongcall
7520 @itemx -mno-longcall
7521 @opindex mlongcall
7522 @opindex mno-longcall
7523 Default to making all function calls via pointers, so that functions
7524 which reside further than 64 megabytes (67,108,864 bytes) from the
7525 current location can be called.  This setting can be overridden by the
7526 @code{shortcall} function attribute, or by @code{#pragma longcall(0)}.
7527
7528 Some linkers are capable of detecting out-of-range calls and generating
7529 glue code on the fly.  On these systems, long calls are unnecessary and
7530 generate slower code.  As of this writing, the AIX linker can do this,
7531 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7532 to the GNU linker for 32-bit PowerPC systems as well.
7533
7534 On Mach-O (Darwin) systems, this option directs the compiler emit to
7535 the glue for every direct call, and the Darwin linker decides whether
7536 to use or discard it.
7537
7538 In the future, we may cause GCC to ignore all longcall specifications
7539 when the linker is known to generate glue.
7540
7541 @item -pthread
7542 @opindex pthread
7543 Adds support for multithreading with the @dfn{pthreads} library.
7544 This option sets flags for both the preprocessor and linker.
7545
7546 @end table
7547
7548 @node Darwin Options
7549 @subsection Darwin Options
7550 @cindex Darwin options
7551
7552 These options are defined for all architectures running the Darwin operating
7553 system.  They are useful for compatibility with other Mac OS compilers.
7554
7555 @table @gcctabopt
7556 @item -all_load
7557 @opindex all_load
7558 Loads all members of static archive libraries.
7559 See man ld(1) for more information.
7560
7561 @item -arch_errors_fatal
7562 @opindex arch_errors_fatal
7563 Cause the errors having to do with files that have the wrong architecture
7564 to be fatal.
7565
7566 @item -bind_at_load
7567 @opindex bind_at_load
7568 Causes the output file to be marked such that the dynamic linker will
7569 bind all undefined references when the file is loaded or launched.
7570
7571 @item -bundle
7572 @opindex bundle
7573 Produce a Mach-o bundle format file.
7574 See man ld(1) for more information.
7575
7576 @item -bundle_loader @var{executable}
7577 @opindex bundle_loader
7578 This specifies the @var{executable} that will be loading the build
7579 output file being linked. See man ld(1) for more information.
7580
7581 @item -allowable_client  @var{client_name}
7582 @itemx -arch_only
7583
7584 @itemx -client_name
7585 @itemx -compatibility_version
7586 @itemx -current_version
7587 @itemx -dependency-file
7588 @itemx -dylib_file
7589 @itemx -dylinker_install_name
7590 @itemx -dynamic
7591 @itemx -dynamiclib
7592 @itemx -exported_symbols_list
7593 @itemx -filelist
7594 @itemx -flat_namespace
7595 @itemx -force_cpusubtype_ALL
7596 @itemx -force_flat_namespace
7597 @itemx -headerpad_max_install_names
7598 @itemx -image_base
7599 @itemx -init
7600 @itemx -install_name
7601 @itemx -keep_private_externs
7602 @itemx -multi_module
7603 @itemx -multiply_defined
7604 @itemx -multiply_defined_unused
7605 @itemx -noall_load
7606 @itemx -nofixprebinding
7607 @itemx -nomultidefs
7608 @itemx -noprebind
7609 @itemx -noseglinkedit
7610 @itemx -pagezero_size
7611 @itemx -prebind
7612 @itemx -prebind_all_twolevel_modules
7613 @itemx -private_bundle
7614 @itemx -read_only_relocs
7615 @itemx -sectalign
7616 @itemx -sectobjectsymbols
7617 @itemx -whyload
7618 @itemx -seg1addr
7619 @itemx -sectcreate
7620 @itemx -sectobjectsymbols
7621 @itemx -sectorder
7622 @itemx -seg_addr_table
7623 @itemx -seg_addr_table_filename
7624 @itemx -seglinkedit
7625 @itemx -segprot
7626 @itemx -segs_read_only_addr
7627 @itemx -segs_read_write_addr
7628 @itemx -single_module
7629 @itemx -static
7630 @itemx -sub_library
7631 @itemx -sub_umbrella
7632 @itemx -twolevel_namespace
7633 @itemx -umbrella
7634 @itemx -undefined
7635 @itemx -unexported_symbols_list
7636 @itemx -weak_reference_mismatches
7637 @itemx -whatsloaded
7638
7639 @opindex allowable_client
7640 @opindex arch_only
7641 @opindex client_name
7642 @opindex compatibility_version
7643 @opindex current_version
7644 @opindex dependency-file
7645 @opindex dylib_file
7646 @opindex dylinker_install_name
7647 @opindex dynamic
7648 @opindex dynamiclib
7649 @opindex exported_symbols_list
7650 @opindex filelist
7651 @opindex flat_namespace
7652 @opindex force_cpusubtype_ALL
7653 @opindex force_flat_namespace
7654 @opindex headerpad_max_install_names
7655 @opindex image_base
7656 @opindex init
7657 @opindex install_name
7658 @opindex keep_private_externs
7659 @opindex multi_module
7660 @opindex multiply_defined
7661 @opindex multiply_defined_unused
7662 @opindex noall_load
7663 @opindex nofixprebinding
7664 @opindex nomultidefs
7665 @opindex noprebind
7666 @opindex noseglinkedit
7667 @opindex pagezero_size
7668 @opindex prebind
7669 @opindex prebind_all_twolevel_modules
7670 @opindex private_bundle
7671 @opindex read_only_relocs
7672 @opindex sectalign
7673 @opindex sectobjectsymbols
7674 @opindex whyload
7675 @opindex seg1addr
7676 @opindex sectcreate
7677 @opindex sectobjectsymbols
7678 @opindex sectorder
7679 @opindex seg_addr_table
7680 @opindex seg_addr_table_filename
7681 @opindex seglinkedit
7682 @opindex segprot
7683 @opindex segs_read_only_addr
7684 @opindex segs_read_write_addr
7685 @opindex single_module
7686 @opindex static
7687 @opindex sub_library
7688 @opindex sub_umbrella
7689 @opindex twolevel_namespace
7690 @opindex umbrella
7691 @opindex undefined
7692 @opindex unexported_symbols_list
7693 @opindex weak_reference_mismatches
7694 @opindex whatsloaded
7695
7696 These options are available for Darwin linker. Darwin linker man page
7697 describes them in detail.
7698 @end table
7699
7700
7701 @node MIPS Options
7702 @subsection MIPS Options
7703 @cindex MIPS options
7704
7705 @table @gcctabopt
7706
7707 @item -EB
7708 @opindex EB
7709 Generate big-endian code.
7710
7711 @item -EL
7712 @opindex EL
7713 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
7714 configurations.
7715
7716 @item -march=@var{arch}
7717 @opindex march
7718 Generate code that will run on @var{arch}, which can be the name of a
7719 generic MIPS ISA, or the name of a particular processor.
7720 The ISA names are:
7721 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
7722 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
7723 The processor names are:
7724 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7725 @samp{m4k},
7726 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
7727 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
7728 @samp{rm9000},
7729 @samp{orion},
7730 @samp{sb1},
7731 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4300},
7732 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
7733 The special value @samp{from-abi} selects the
7734 most compatible architecture for the selected ABI (that is,
7735 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7736
7737 In processor names, a final @samp{000} can be abbreviated as @samp{k}
7738 (for example, @samp{-march=r2k}).  Prefixes are optional, and
7739 @samp{vr} may be written @samp{r}.
7740
7741 GCC defines two macros based on the value of this option.  The first
7742 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7743 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7744 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
7745 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7746 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7747
7748 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7749 above.  In other words, it will have the full prefix and will not
7750 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7751 the macro names the resolved architecture (either @samp{"mips1"} or
7752 @samp{"mips3"}).  It names the default architecture when no
7753 @option{-march} option is given.
7754
7755 @item -mtune=@var{arch}
7756 @opindex mtune
7757 Optimize for @var{arch}.  Among other things, this option controls
7758 the way instructions are scheduled, and the perceived cost of arithmetic
7759 operations.  The list of @var{arch} values is the same as for
7760 @option{-march}.
7761
7762 When this option is not used, GCC will optimize for the processor
7763 specified by @option{-march}.  By using @option{-march} and
7764 @option{-mtune} together, it is possible to generate code that will
7765 run on a family of processors, but optimize the code for one
7766 particular member of that family.
7767
7768 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
7769 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
7770 @samp{-march} ones described above.
7771
7772 @item -mips1
7773 @opindex mips1
7774 Equivalent to @samp{-march=mips1}.
7775
7776 @item -mips2
7777 @opindex mips2
7778 Equivalent to @samp{-march=mips2}.
7779
7780 @item -mips3
7781 @opindex mips3
7782 Equivalent to @samp{-march=mips3}.
7783
7784 @item -mips4
7785 @opindex mips4
7786 Equivalent to @samp{-march=mips4}.
7787
7788 @item -mips32
7789 @opindex mips32
7790 Equivalent to @samp{-march=mips32}.
7791
7792 @item -mips32r2
7793 @opindex mips32r2
7794 Equivalent to @samp{-march=mips32r2}.
7795
7796 @item -mips64
7797 @opindex mips64
7798 Equivalent to @samp{-march=mips64}.
7799
7800 @item -mips16
7801 @itemx -mno-mips16
7802 @opindex mips16
7803 @opindex mno-mips16
7804 Use (do not use) the MIPS16 ISA.
7805
7806 @item -mabi=32
7807 @itemx -mabi=o64
7808 @itemx -mabi=n32
7809 @itemx -mabi=64
7810 @itemx -mabi=eabi
7811 @opindex mabi=32
7812 @opindex mabi=o64
7813 @opindex mabi=n32
7814 @opindex mabi=64
7815 @opindex mabi=eabi
7816 Generate code for the given ABI@.
7817
7818 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
7819 generates 64-bit code when you select a 64-bit architecture, but you
7820 can use @option{-mgp32} to get 32-bit code instead.
7821
7822 @item -mabicalls
7823 @itemx -mno-abicalls
7824 @opindex mabicalls
7825 @opindex mno-abicalls
7826 Generate (do not generate) SVR4-style position-independent code.
7827 @option{-mabicalls} is the default for SVR4-based systems.
7828
7829 @item -mxgot
7830 @itemx -mno-xgot
7831 @opindex mxgot
7832 @opindex mno-xgot
7833 Lift (do not lift) the usual restrictions on the size of the global
7834 offset table.
7835
7836 GCC normally uses a single instruction to load values from the GOT.
7837 While this is relatively efficient, it will only work if the GOT
7838 is smaller than about 64k.  Anything larger will cause the linker
7839 to report an error such as:
7840
7841 @cindex relocation truncated to fit (MIPS)
7842 @smallexample
7843 relocation truncated to fit: R_MIPS_GOT16 foobar
7844 @end smallexample
7845
7846 If this happens, you should recompile your code with @option{-mxgot}.
7847 It should then work with very large GOTs, although it will also be
7848 less efficient, since it will take three instructions to fetch the
7849 value of a global symbol.
7850
7851 Note that some linkers can create multiple GOTs.  If you have such a
7852 linker, you should only need to use @option{-mxgot} when a single object
7853 file accesses more than 64k's worth of GOT entries.  Very few do.
7854
7855 These options have no effect unless GCC is generating position
7856 independent code.
7857
7858 @item -membedded-pic
7859 @itemx -mno-embedded-pic
7860 @opindex membedded-pic
7861 @opindex mno-embedded-pic
7862 Generate (do not generate) position-independent code suitable for some
7863 embedded systems.  All calls are made using PC relative addresses, and
7864 all data is addressed using the $gp register.  No more than 65536
7865 bytes of global data may be used.  This requires GNU as and GNU ld,
7866 which do most of the work.
7867
7868 @item -mgp32
7869 @opindex mgp32
7870 Assume that general-purpose registers are 32 bits wide.
7871
7872 @item -mgp64
7873 @opindex mgp64
7874 Assume that general-purpose registers are 64 bits wide.
7875
7876 @item -mfp32
7877 @opindex mfp32
7878 Assume that floating-point registers are 32 bits wide.
7879
7880 @item -mfp64
7881 @opindex mfp64
7882 Assume that floating-point registers are 64 bits wide.
7883
7884 @item -mhard-float
7885 @opindex mhard-float
7886 Use floating-point coprocessor instructions.
7887
7888 @item -msoft-float
7889 @opindex msoft-float
7890 Do not use floating-point coprocessor instructions.  Implement
7891 floating-point calculations using library calls instead.
7892
7893 @item -msingle-float
7894 @opindex msingle-float
7895 Assume that the floating-point coprocessor only supports single-precision
7896 operations.
7897
7898 @itemx -mdouble-float
7899 @opindex mdouble-float
7900 Assume that the floating-point coprocessor supports double-precision
7901 operations.  This is the default.
7902
7903 @item -mint64
7904 @opindex mint64
7905 Force @code{int} and @code{long} types to be 64 bits wide.  See
7906 @option{-mlong32} for an explanation of the default and the way
7907 that the pointer size is determined.
7908
7909 @item -mlong64
7910 @opindex mlong64
7911 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
7912 an explanation of the default and the way that the pointer size is
7913 determined.
7914
7915 @item -mlong32
7916 @opindex mlong32
7917 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
7918
7919 The default size of @code{int}s, @code{long}s and pointers depends on
7920 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
7921 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
7922 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
7923 or the same size as integer registers, whichever is smaller.
7924
7925 @item -G @var{num}
7926 @opindex G
7927 @cindex smaller data references (MIPS)
7928 @cindex gp-relative references (MIPS)
7929 Put global and static items less than or equal to @var{num} bytes into
7930 the small data or bss section instead of the normal data or bss section.
7931 This allows the data to be accessed using a single instruction.
7932
7933 All modules should be compiled with the same @option{-G @var{num}}
7934 value.
7935
7936 @item -membedded-data
7937 @itemx -mno-embedded-data
7938 @opindex membedded-data
7939 @opindex mno-embedded-data
7940 Allocate variables to the read-only data section first if possible, then
7941 next in the small data section if possible, otherwise in data.  This gives
7942 slightly slower code than the default, but reduces the amount of RAM required
7943 when executing, and thus may be preferred for some embedded systems.
7944
7945 @item -muninit-const-in-rodata
7946 @itemx -mno-uninit-const-in-rodata
7947 @opindex muninit-const-in-rodata
7948 @opindex mno-uninit-const-in-rodata
7949 Put uninitialized @code{const} variables in the read-only data section.
7950 This option is only meaningful in conjunction with @option{-membedded-data}.
7951
7952 @item -msplit-addresses
7953 @itemx -mno-split-addresses
7954 @opindex msplit-addresses
7955 @opindex mno-split-addresses
7956 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
7957 relocation operators.  This option has been superceded by
7958 @option{-mexplicit-relocs} but is retained for backwards compatibility.
7959
7960 @item -mexplicit-relocs
7961 @itemx -mno-explicit-relocs
7962 @opindex mexplicit-relocs
7963 @opindex mno-explicit-relocs
7964 Use (do not use) assembler relocation operators when dealing with symbolic
7965 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
7966 is to use assembler macros instead.
7967
7968 @option{-mexplicit-relocs} is usually the default if GCC was
7969 configured to use an assembler that supports relocation operators.
7970 However, there are two exceptions:
7971
7972 @itemize @bullet
7973 @item
7974 GCC is not yet able to generate explicit relocations for the combination
7975 of @option{-mabi=64} and @option{-mno-abicalls}.  This will be addressed
7976 in a future release.
7977
7978 @item
7979 The combination of @option{-mabicalls} and @option{-fno-unit-at-a-time}
7980 implies @option{-mno-explicit-relocs} unless explicitly overridden.
7981 This is because, when generating abicalls, the choice of relocation
7982 depends on whether a symbol is local or global.  In some rare cases,
7983 GCC will not be able to decide this until the whole compilation unit
7984 has been read.
7985 @end itemize
7986
7987 @item -mrnames
7988 @itemx -mno-rnames
7989 @opindex mrnames
7990 @opindex mno-rnames
7991 Generate (do not generate) code that refers to registers using their
7992 software names.  The default is @option{-mno-rnames}, which tells GCC
7993 to use hardware names like @samp{$4} instead of software names like
7994 @samp{a0}.  The only assembler known to support @option{-rnames} is
7995 the Algorithmics assembler.
7996
7997 @item -mcheck-zero-division
7998 @itemx -mno-check-zero-division
7999 @opindex mcheck-zero-division
8000 @opindex mno-check-zero-division
8001 Trap (do not trap) on integer division by zero.  The default is
8002 @option{-mcheck-zero-division}.
8003
8004 @item -mmemcpy
8005 @itemx -mno-memcpy
8006 @opindex mmemcpy
8007 @opindex mno-memcpy
8008 Force (do not force) the use of @code{memcpy()} for non-trivial block
8009 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
8010 most constant-sized copies.
8011
8012 @item -mlong-calls
8013 @itemx -mno-long-calls
8014 @opindex mlong-calls
8015 @opindex mno-long-calls
8016 Disable (do not disable) use of the @code{jal} instruction.  Calling
8017 functions using @code{jal} is more efficient but requires the caller
8018 and callee to be in the same 256 megabyte segment.
8019
8020 This option has no effect on abicalls code.  The default is
8021 @option{-mno-long-calls}.
8022
8023 @item -mmad
8024 @itemx -mno-mad
8025 @opindex mmad
8026 @opindex mno-mad
8027 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
8028 instructions, as provided by the R4650 ISA.
8029
8030 @item -mfused-madd
8031 @itemx -mno-fused-madd
8032 @opindex mfused-madd
8033 @opindex mno-fused-madd
8034 Enable (disable) use of the floating point multiply-accumulate
8035 instructions, when they are available.  The default is
8036 @option{-mfused-madd}.
8037
8038 When multiply-accumulate instructions are used, the intermediate
8039 product is calculated to infinite precision and is not subject to
8040 the FCSR Flush to Zero bit.  This may be undesirable in some
8041 circumstances.
8042
8043 @item -nocpp
8044 @opindex nocpp
8045 Tell the MIPS assembler to not run its preprocessor over user
8046 assembler files (with a @samp{.s} suffix) when assembling them.
8047
8048 @item -mfix-sb1
8049 @itemx -mno-fix-sb1
8050 @opindex mfix-sb1
8051 Work around certain SB-1 CPU core errata.
8052 (This flag currently works around the SB-1 revision 2
8053 ``F1'' and ``F2'' floating point errata.)
8054
8055 @item -mflush-func=@var{func}
8056 @itemx -mno-flush-func
8057 @opindex mflush-func
8058 Specifies the function to call to flush the I and D caches, or to not
8059 call any such function.  If called, the function must take the same
8060 arguments as the common @code{_flush_func()}, that is, the address of the
8061 memory range for which the cache is being flushed, the size of the
8062 memory range, and the number 3 (to flush both caches).  The default
8063 depends on the target gcc was configured for, but commonly is either
8064 @samp{_flush_func} or @samp{__cpu_flush}.
8065
8066 @item -mbranch-likely
8067 @itemx -mno-branch-likely
8068 @opindex mbranch-likely
8069 @opindex mno-branch-likely
8070 Enable or disable use of Branch Likely instructions, regardless of the
8071 default for the selected architecture.  By default, Branch Likely
8072 instructions may be generated if they are supported by the selected
8073 architecture.  An exception is for the MIPS32 and MIPS64 architectures
8074 and processors which implement those architectures; for those, Branch
8075 Likely instructions will not be generated by default because the MIPS32
8076 and MIPS64 architectures specifically deprecate their use.
8077 @end table
8078
8079 @node i386 and x86-64 Options
8080 @subsection Intel 386 and AMD x86-64 Options
8081 @cindex i386 Options
8082 @cindex x86-64 Options
8083 @cindex Intel 386 Options
8084 @cindex AMD x86-64 Options
8085
8086 These @samp{-m} options are defined for the i386 and x86-64 family of
8087 computers:
8088
8089 @table @gcctabopt
8090 @item -mtune=@var{cpu-type}
8091 @opindex mtune
8092 Tune to @var{cpu-type} everything applicable about the generated code, except
8093 for the ABI and the set of available instructions.  The choices for
8094 @var{cpu-type} are:
8095 @table @emph
8096 @item i386
8097 Original Intel's i386 CPU.
8098 @item i486
8099 Intel's i486 CPU.  (No scheduling is implemented for this chip.)
8100 @item i586, pentium
8101 Intel Pentium CPU with no MMX support.
8102 @item pentium-mmx
8103 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
8104 @item i686, pentiumpro
8105 Intel PentiumPro CPU.
8106 @item pentium2
8107 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
8108 @item pentium3, pentium3m
8109 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
8110 support.
8111 @item pentium-m
8112 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
8113 support.  Used by Centrino notebooks.
8114 @item pentium4, pentium4m
8115 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
8116 @item prescott
8117 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
8118 set support.
8119 @item nocona
8120 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
8121 SSE2 and SSE3 instruction set support.
8122 @item k6
8123 AMD K6 CPU with MMX instruction set support.
8124 @item k6-2, k6-3
8125 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
8126 @item athlon, athlon-tbird
8127 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
8128 support.
8129 @item athlon-4, athlon-xp, athlon-mp
8130 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
8131 instruction set support.
8132 @item k8, opteron, athlon64, athlon-fx
8133 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
8134 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
8135 @item winchip-c6
8136 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
8137 set support.
8138 @item winchip2
8139 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
8140 instruction set support.
8141 @item c3
8142 Via C3 CPU with MMX and 3dNOW!  instruction set support.  (No scheduling is
8143 implemented for this chip.)
8144 @item c3-2
8145 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
8146 implemented for this chip.)
8147 @end table
8148
8149 While picking a specific @var{cpu-type} will schedule things appropriately
8150 for that particular chip, the compiler will not generate any code that
8151 does not run on the i386 without the @option{-march=@var{cpu-type}} option
8152 being used.
8153
8154 @item -march=@var{cpu-type}
8155 @opindex march
8156 Generate instructions for the machine type @var{cpu-type}.  The choices
8157 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8158 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8159
8160 @item -mcpu=@var{cpu-type}
8161 @opindex mcpu
8162 A deprecated synonym for @option{-mtune}.
8163
8164 @item -m386
8165 @itemx -m486
8166 @itemx -mpentium
8167 @itemx -mpentiumpro
8168 @opindex m386
8169 @opindex m486
8170 @opindex mpentium
8171 @opindex mpentiumpro
8172 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8173 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8174 These synonyms are deprecated.
8175
8176 @item -mfpmath=@var{unit}
8177 @opindex march
8178 Generate floating point arithmetics for selected unit @var{unit}.  The choices
8179 for @var{unit} are:
8180
8181 @table @samp
8182 @item 387
8183 Use the standard 387 floating point coprocessor present majority of chips and
8184 emulated otherwise.  Code compiled with this option will run almost everywhere.
8185 The temporary results are computed in 80bit precision instead of precision
8186 specified by the type resulting in slightly different results compared to most
8187 of other chips. See @option{-ffloat-store} for more detailed description.
8188
8189 This is the default choice for i386 compiler.
8190
8191 @item sse
8192 Use scalar floating point instructions present in the SSE instruction set.
8193 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8194 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8195 instruction set supports only single precision arithmetics, thus the double and
8196 extended precision arithmetics is still done using 387.  Later version, present
8197 only in Pentium4 and the future AMD x86-64 chips supports double precision
8198 arithmetics too.
8199
8200 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8201 @option{-msse2} switches to enable SSE extensions and make this option
8202 effective.  For x86-64 compiler, these extensions are enabled by default.
8203
8204 The resulting code should be considerably faster in the majority of cases and avoid
8205 the numerical instability problems of 387 code, but may break some existing
8206 code that expects temporaries to be 80bit.
8207
8208 This is the default choice for the x86-64 compiler.
8209
8210 @item sse,387
8211 Attempt to utilize both instruction sets at once.  This effectively double the
8212 amount of available registers and on chips with separate execution units for
8213 387 and SSE the execution resources too.  Use this option with care, as it is
8214 still experimental, because the gcc register allocator does not model separate
8215 functional units well resulting in instable performance.
8216 @end table
8217
8218 @item -masm=@var{dialect}
8219 @opindex masm=@var{dialect}
8220 Output asm instructions using selected @var{dialect}. Supported choices are
8221 @samp{intel} or @samp{att} (the default one).
8222
8223 @item -mieee-fp
8224 @itemx -mno-ieee-fp
8225 @opindex mieee-fp
8226 @opindex mno-ieee-fp
8227 Control whether or not the compiler uses IEEE floating point
8228 comparisons.  These handle correctly the case where the result of a
8229 comparison is unordered.
8230
8231 @item -msoft-float
8232 @opindex msoft-float
8233 Generate output containing library calls for floating point.
8234 @strong{Warning:} the requisite libraries are not part of GCC@.
8235 Normally the facilities of the machine's usual C compiler are used, but
8236 this can't be done directly in cross-compilation.  You must make your
8237 own arrangements to provide suitable library functions for
8238 cross-compilation.
8239
8240 On machines where a function returns floating point results in the 80387
8241 register stack, some floating point opcodes may be emitted even if
8242 @option{-msoft-float} is used.
8243
8244 @item -mno-fp-ret-in-387
8245 @opindex mno-fp-ret-in-387
8246 Do not use the FPU registers for return values of functions.
8247
8248 The usual calling convention has functions return values of types
8249 @code{float} and @code{double} in an FPU register, even if there
8250 is no FPU@.  The idea is that the operating system should emulate
8251 an FPU@.
8252
8253 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8254 in ordinary CPU registers instead.
8255
8256 @item -mno-fancy-math-387
8257 @opindex mno-fancy-math-387
8258 Some 387 emulators do not support the @code{sin}, @code{cos} and
8259 @code{sqrt} instructions for the 387.  Specify this option to avoid
8260 generating those instructions.  This option is the default on FreeBSD,
8261 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8262 indicates that the target cpu will always have an FPU and so the
8263 instruction will not need emulation.  As of revision 2.6.1, these
8264 instructions are not generated unless you also use the
8265 @option{-funsafe-math-optimizations} switch.
8266
8267 @item -malign-double
8268 @itemx -mno-align-double
8269 @opindex malign-double
8270 @opindex mno-align-double
8271 Control whether GCC aligns @code{double}, @code{long double}, and
8272 @code{long long} variables on a two word boundary or a one word
8273 boundary.  Aligning @code{double} variables on a two word boundary will
8274 produce code that runs somewhat faster on a @samp{Pentium} at the
8275 expense of more memory.
8276
8277 @strong{Warning:} if you use the @option{-malign-double} switch,
8278 structures containing the above types will be aligned differently than
8279 the published application binary interface specifications for the 386
8280 and will not be binary compatible with structures in code compiled
8281 without that switch.
8282
8283 @item -m96bit-long-double
8284 @itemx -m128bit-long-double
8285 @opindex m96bit-long-double
8286 @opindex m128bit-long-double
8287 These switches control the size of @code{long double} type. The i386
8288 application binary interface specifies the size to be 96 bits,
8289 so @option{-m96bit-long-double} is the default in 32 bit mode.
8290
8291 Modern architectures (Pentium and newer) would prefer @code{long double}
8292 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
8293 conforming to the ABI, this would not be possible.  So specifying a
8294 @option{-m128bit-long-double} will align @code{long double}
8295 to a 16 byte boundary by padding the @code{long double} with an additional
8296 32 bit zero.
8297
8298 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8299 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
8300
8301 Notice that neither of these options enable any extra precision over the x87
8302 standard of 80 bits for a @code{long double}.
8303
8304 @strong{Warning:} if you override the default value for your target ABI, the
8305 structures and arrays containing @code{long double} variables will change
8306 their size as well as function calling convention for function taking
8307 @code{long double} will be modified.  Hence they will not be binary
8308 compatible with arrays or structures in code compiled without that switch.
8309
8310
8311 @item -msvr3-shlib
8312 @itemx -mno-svr3-shlib
8313 @opindex msvr3-shlib
8314 @opindex mno-svr3-shlib
8315 Control whether GCC places uninitialized local variables into the
8316 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
8317 into @code{bss}.  These options are meaningful only on System V Release 3.
8318
8319 @item -mrtd
8320 @opindex mrtd
8321 Use a different function-calling convention, in which functions that
8322 take a fixed number of arguments return with the @code{ret} @var{num}
8323 instruction, which pops their arguments while returning.  This saves one
8324 instruction in the caller since there is no need to pop the arguments
8325 there.
8326
8327 You can specify that an individual function is called with this calling
8328 sequence with the function attribute @samp{stdcall}.  You can also
8329 override the @option{-mrtd} option by using the function attribute
8330 @samp{cdecl}.  @xref{Function Attributes}.
8331
8332 @strong{Warning:} this calling convention is incompatible with the one
8333 normally used on Unix, so you cannot use it if you need to call
8334 libraries compiled with the Unix compiler.
8335
8336 Also, you must provide function prototypes for all functions that
8337 take variable numbers of arguments (including @code{printf});
8338 otherwise incorrect code will be generated for calls to those
8339 functions.
8340
8341 In addition, seriously incorrect code will result if you call a
8342 function with too many arguments.  (Normally, extra arguments are
8343 harmlessly ignored.)
8344
8345 @item -mregparm=@var{num}
8346 @opindex mregparm
8347 Control how many registers are used to pass integer arguments.  By
8348 default, no registers are used to pass arguments, and at most 3
8349 registers can be used.  You can control this behavior for a specific
8350 function by using the function attribute @samp{regparm}.
8351 @xref{Function Attributes}.
8352
8353 @strong{Warning:} if you use this switch, and
8354 @var{num} is nonzero, then you must build all modules with the same
8355 value, including any libraries.  This includes the system libraries and
8356 startup modules.
8357
8358 @item -mpreferred-stack-boundary=@var{num}
8359 @opindex mpreferred-stack-boundary
8360 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8361 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
8362 the default is 4 (16 bytes or 128 bits), except when optimizing for code
8363 size (@option{-Os}), in which case the default is the minimum correct
8364 alignment (4 bytes for x86, and 8 bytes for x86-64).
8365
8366 On Pentium and PentiumPro, @code{double} and @code{long double} values
8367 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8368 suffer significant run time performance penalties.  On Pentium III, the
8369 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8370 penalties if it is not 16 byte aligned.
8371
8372 To ensure proper alignment of this values on the stack, the stack boundary
8373 must be as aligned as that required by any value stored on the stack.
8374 Further, every function must be generated such that it keeps the stack
8375 aligned.  Thus calling a function compiled with a higher preferred
8376 stack boundary from a function compiled with a lower preferred stack
8377 boundary will most likely misalign the stack.  It is recommended that
8378 libraries that use callbacks always use the default setting.
8379
8380 This extra alignment does consume extra stack space, and generally
8381 increases code size.  Code that is sensitive to stack space usage, such
8382 as embedded systems and operating system kernels, may want to reduce the
8383 preferred alignment to @option{-mpreferred-stack-boundary=2}.
8384
8385 @item -mmmx
8386 @itemx -mno-mmx
8387 @item -msse
8388 @itemx -mno-sse
8389 @item -msse2
8390 @itemx -mno-sse2
8391 @item -msse3
8392 @itemx -mno-sse3
8393 @item -m3dnow
8394 @itemx -mno-3dnow
8395 @opindex mmmx
8396 @opindex mno-mmx
8397 @opindex msse
8398 @opindex mno-sse
8399 @opindex m3dnow
8400 @opindex mno-3dnow
8401 These switches enable or disable the use of built-in functions that allow
8402 direct access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the
8403 instruction set.
8404
8405 @xref{X86 Built-in Functions}, for details of the functions enabled
8406 and disabled by these switches.
8407
8408 To have SSE/SSE2 instructions generated automatically from floating-point
8409 code, see @option{-mfpmath=sse}.
8410
8411 @item -mpush-args
8412 @itemx -mno-push-args
8413 @opindex mpush-args
8414 @opindex mno-push-args
8415 Use PUSH operations to store outgoing parameters.  This method is shorter
8416 and usually equally fast as method using SUB/MOV operations and is enabled
8417 by default.  In some cases disabling it may improve performance because of
8418 improved scheduling and reduced dependencies.
8419
8420 @item -maccumulate-outgoing-args
8421 @opindex maccumulate-outgoing-args
8422 If enabled, the maximum amount of space required for outgoing arguments will be
8423 computed in the function prologue.  This is faster on most modern CPUs
8424 because of reduced dependencies, improved scheduling and reduced stack usage
8425 when preferred stack boundary is not equal to 2.  The drawback is a notable
8426 increase in code size.  This switch implies @option{-mno-push-args}.
8427
8428 @item -mthreads
8429 @opindex mthreads
8430 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8431 on thread-safe exception handling must compile and link all code with the
8432 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
8433 @option{-D_MT}; when linking, it links in a special thread helper library
8434 @option{-lmingwthrd} which cleans up per thread exception handling data.
8435
8436 @item -mno-align-stringops
8437 @opindex mno-align-stringops
8438 Do not align destination of inlined string operations.  This switch reduces
8439 code size and improves performance in case the destination is already aligned,
8440 but gcc don't know about it.
8441
8442 @item -minline-all-stringops
8443 @opindex minline-all-stringops
8444 By default GCC inlines string operations only when destination is known to be
8445 aligned at least to 4 byte boundary.  This enables more inlining, increase code
8446 size, but may improve performance of code that depends on fast memcpy, strlen
8447 and memset for short lengths.
8448
8449 @item -momit-leaf-frame-pointer
8450 @opindex momit-leaf-frame-pointer
8451 Don't keep the frame pointer in a register for leaf functions.  This
8452 avoids the instructions to save, set up and restore frame pointers and
8453 makes an extra register available in leaf functions.  The option
8454 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8455 which might make debugging harder.
8456
8457 @item -mtls-direct-seg-refs
8458 @itemx -mno-tls-direct-seg-refs
8459 @opindex mtls-direct-seg-refs
8460 Controls whether TLS variables may be accessed with offsets from the
8461 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8462 or whether the thread base pointer must be added.  Whether or not this
8463 is legal depends on the operating system, and whether it maps the
8464 segment to cover the entire TLS area.
8465
8466 For systems that use GNU libc, the default is on.
8467 @end table
8468
8469 These @samp{-m} switches are supported in addition to the above
8470 on AMD x86-64 processors in 64-bit environments.
8471
8472 @table @gcctabopt
8473 @item -m32
8474 @itemx -m64
8475 @opindex m32
8476 @opindex m64
8477 Generate code for a 32-bit or 64-bit environment.
8478 The 32-bit environment sets int, long and pointer to 32 bits and
8479 generates code that runs on any i386 system.
8480 The 64-bit environment sets int to 32 bits and long and pointer
8481 to 64 bits and generates code for AMD's x86-64 architecture.
8482
8483 @item -mno-red-zone
8484 @opindex no-red-zone
8485 Do not use a so called red zone for x86-64 code.  The red zone is mandated
8486 by the x86-64 ABI, it is a 128-byte area beyond the location of the
8487 stack pointer that will not be modified by signal or interrupt handlers
8488 and therefore can be used for temporary data without adjusting the stack
8489 pointer.  The flag @option{-mno-red-zone} disables this red zone.
8490
8491 @item -mcmodel=small
8492 @opindex mcmodel=small
8493 Generate code for the small code model: the program and its symbols must
8494 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8495 Programs can be statically or dynamically linked.  This is the default
8496 code model.
8497
8498 @item -mcmodel=kernel
8499 @opindex mcmodel=kernel
8500 Generate code for the kernel code model.  The kernel runs in the
8501 negative 2 GB of the address space.
8502 This model has to be used for Linux kernel code.
8503
8504 @item -mcmodel=medium
8505 @opindex mcmodel=medium
8506 Generate code for the medium model: The program is linked in the lower 2
8507 GB of the address space but symbols can be located anywhere in the
8508 address space.  Programs can be statically or dynamically linked, but
8509 building of shared libraries are not supported with the medium model.
8510
8511 @item -mcmodel=large
8512 @opindex mcmodel=large
8513 Generate code for the large model: This model makes no assumptions
8514 about addresses and sizes of sections.  Currently GCC does not implement
8515 this model.
8516 @end table
8517
8518 @node HPPA Options
8519 @subsection HPPA Options
8520 @cindex HPPA Options
8521
8522 These @samp{-m} options are defined for the HPPA family of computers:
8523
8524 @table @gcctabopt
8525 @item -march=@var{architecture-type}
8526 @opindex march
8527 Generate code for the specified architecture.  The choices for
8528 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8529 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8530 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8531 architecture option for your machine.  Code compiled for lower numbered
8532 architectures will run on higher numbered architectures, but not the
8533 other way around.
8534
8535 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
8536 next release of binutils (current is 2.9.1) will probably contain PA 2.0
8537 support.
8538
8539 @item -mpa-risc-1-0
8540 @itemx -mpa-risc-1-1
8541 @itemx -mpa-risc-2-0
8542 @opindex mpa-risc-1-0
8543 @opindex mpa-risc-1-1
8544 @opindex mpa-risc-2-0
8545 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8546
8547 @item -mbig-switch
8548 @opindex mbig-switch
8549 Generate code suitable for big switch tables.  Use this option only if
8550 the assembler/linker complain about out of range branches within a switch
8551 table.
8552
8553 @item -mjump-in-delay
8554 @opindex mjump-in-delay
8555 Fill delay slots of function calls with unconditional jump instructions
8556 by modifying the return pointer for the function call to be the target
8557 of the conditional jump.
8558
8559 @item -mdisable-fpregs
8560 @opindex mdisable-fpregs
8561 Prevent floating point registers from being used in any manner.  This is
8562 necessary for compiling kernels which perform lazy context switching of
8563 floating point registers.  If you use this option and attempt to perform
8564 floating point operations, the compiler will abort.
8565
8566 @item -mdisable-indexing
8567 @opindex mdisable-indexing
8568 Prevent the compiler from using indexing address modes.  This avoids some
8569 rather obscure problems when compiling MIG generated code under MACH@.
8570
8571 @item -mno-space-regs
8572 @opindex mno-space-regs
8573 Generate code that assumes the target has no space registers.  This allows
8574 GCC to generate faster indirect calls and use unscaled index address modes.
8575
8576 Such code is suitable for level 0 PA systems and kernels.
8577
8578 @item -mfast-indirect-calls
8579 @opindex mfast-indirect-calls
8580 Generate code that assumes calls never cross space boundaries.  This
8581 allows GCC to emit code which performs faster indirect calls.
8582
8583 This option will not work in the presence of shared libraries or nested
8584 functions.
8585
8586 @item -mlong-load-store
8587 @opindex mlong-load-store
8588 Generate 3-instruction load and store sequences as sometimes required by
8589 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8590 the HP compilers.
8591
8592 @item -mportable-runtime
8593 @opindex mportable-runtime
8594 Use the portable calling conventions proposed by HP for ELF systems.
8595
8596 @item -mgas
8597 @opindex mgas
8598 Enable the use of assembler directives only GAS understands.
8599
8600 @item -mschedule=@var{cpu-type}
8601 @opindex mschedule
8602 Schedule code according to the constraints for the machine type
8603 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8604 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8605 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8606 proper scheduling option for your machine.  The default scheduling is
8607 @samp{8000}.
8608
8609 @item -mlinker-opt
8610 @opindex mlinker-opt
8611 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8612 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8613 linkers in which they give bogus error messages when linking some programs.
8614
8615 @item -msoft-float
8616 @opindex msoft-float
8617 Generate output containing library calls for floating point.
8618 @strong{Warning:} the requisite libraries are not available for all HPPA
8619 targets.  Normally the facilities of the machine's usual C compiler are
8620 used, but this cannot be done directly in cross-compilation.  You must make
8621 your own arrangements to provide suitable library functions for
8622 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8623 does provide software floating point support.
8624
8625 @option{-msoft-float} changes the calling convention in the output file;
8626 therefore, it is only useful if you compile @emph{all} of a program with
8627 this option.  In particular, you need to compile @file{libgcc.a}, the
8628 library that comes with GCC, with @option{-msoft-float} in order for
8629 this to work.
8630
8631 @item -msio
8632 @opindex msio
8633 Generate the predefine, @code{_SIO}, for server IO.  The default is
8634 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8635 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8636 options are available under HP-UX and HI-UX.
8637
8638 @item -mgnu-ld
8639 @opindex gnu-ld
8640 Use GNU ld specific options.  This passes @option{-shared} to ld when
8641 building a shared library.  It is the default when GCC is configured,
8642 explicitly or implicitly, with the GNU linker.  This option does not
8643 have any affect on which ld is called, it only changes what parameters
8644 are passed to that ld.  The ld that is called is determined by the
8645 @option{--with-ld} configure option, gcc's program search path, and
8646 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8647 using @samp{which `gcc -print-prog-name=ld`}.
8648
8649 @item -mhp-ld
8650 @opindex hp-ld
8651 Use HP ld specific options.  This passes @option{-b} to ld when building
8652 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8653 links.  It is the default when GCC is configured, explicitly or
8654 implicitly, with the HP linker.  This option does not have any affect on
8655 which ld is called, it only changes what parameters are passed to that
8656 ld.  The ld that is called is determined by the @option{--with-ld}
8657 configure option, gcc's program search path, and finally by the user's
8658 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8659 `gcc -print-prog-name=ld`}.
8660
8661 @item -mfdpic
8662 @opindex mfdpic
8663
8664 Select the FDPIC ABI, that uses function descriptors to represent
8665 pointers to functions.  Without any PIC/PIE-related options, it
8666 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
8667 assumes GOT entries and small data are within a 12-bit range from the
8668 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
8669 are computed with 32 bits.
8670
8671 @item -minline-plt
8672 @opindex minline-plt
8673
8674 Enable inlining of PLT entries in function calls to functions that are
8675 not known to bind locally.  It has no effect without @option{-mfdpic}.
8676 It's enabled by default if optimizing for speed and compiling for
8677 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
8678 optimization option such as @option{-O3} or above is present in the
8679 command line.
8680
8681 @item -mgprel-ro
8682 @opindex mgprel-ro
8683
8684 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
8685 that is known to be in read-only sections.  It's enabled by default,
8686 except for @option{-fpic} or @option{-fpie}: even though it may help
8687 make the global offset table smaller, it trades 1 instruction for 4.
8688 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
8689 one of which may be shared by multiple symbols, and it avoids the need
8690 for a GOT entry for the referenced symbol, so it's more likely to be a
8691 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
8692
8693 @item -multilib-library-pic
8694 @opindex multilib-library-pic
8695
8696 Link with the (library, not FD) pic libraries.  It's implied by
8697 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
8698 @option{-fpic} without @option{-mfdpic}.  You should never have to use
8699 it explicitly.
8700
8701 @item -mlinked-fp
8702 @opindex mlinked-fp
8703
8704 Follow the EABI requirement of always creating a frame pointer whenever
8705 a stack frame is allocated.  This option is enabled by default and can
8706 be disabled with @option{-mno-linked-fp}.
8707
8708 @item -mlong-calls
8709 @opindex mno-long-calls
8710 Generate code that uses long call sequences.  This ensures that a call
8711 is always able to reach linker generated stubs.  The default is to generate
8712 long calls only when the distance from the call site to the beginning
8713 of the function or translation unit, as the case may be, exceeds a
8714 predefined limit set by the branch type being used.  The limits for
8715 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8716 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8717 240,000 bytes.
8718
8719 Distances are measured from the beginning of functions when using the
8720 @option{-ffunction-sections} option, or when using the @option{-mgas}
8721 and @option{-mno-portable-runtime} options together under HP-UX with
8722 the SOM linker.
8723
8724 It is normally not desirable to use this option as it will degrade
8725 performance.  However, it may be useful in large applications,
8726 particularly when partial linking is used to build the application.
8727
8728 The types of long calls used depends on the capabilities of the
8729 assembler and linker, and the type of code being generated.  The
8730 impact on systems that support long absolute calls, and long pic
8731 symbol-difference or pc-relative calls should be relatively small.
8732 However, an indirect call is used on 32-bit ELF systems in pic code
8733 and it is quite long.
8734
8735 @item -nolibdld
8736 @opindex nolibdld
8737 Suppress the generation of link options to search libdld.sl when the
8738 @option{-static} option is specified on HP-UX 10 and later.
8739
8740 @item -static
8741 @opindex static
8742 The HP-UX implementation of setlocale in libc has a dependency on
8743 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8744 when the @option{-static} option is specified, special link options
8745 are needed to resolve this dependency.
8746
8747 On HP-UX 10 and later, the GCC driver adds the necessary options to
8748 link with libdld.sl when the @option{-static} option is specified.
8749 This causes the resulting binary to be dynamic.  On the 64-bit port,
8750 the linkers generate dynamic binaries by default in any case.  The
8751 @option{-nolibdld} option can be used to prevent the GCC driver from
8752 adding these link options.
8753
8754 @item -threads
8755 @opindex threads
8756 Add support for multithreading with the @dfn{dce thread} library
8757 under HP-UX.  This option sets flags for both the preprocessor and
8758 linker.
8759 @end table
8760
8761 @node DEC Alpha Options
8762 @subsection DEC Alpha Options
8763
8764 These @samp{-m} options are defined for the DEC Alpha implementations:
8765
8766 @table @gcctabopt
8767 @item -mno-soft-float
8768 @itemx -msoft-float
8769 @opindex mno-soft-float
8770 @opindex msoft-float
8771 Use (do not use) the hardware floating-point instructions for
8772 floating-point operations.  When @option{-msoft-float} is specified,
8773 functions in @file{libgcc.a} will be used to perform floating-point
8774 operations.  Unless they are replaced by routines that emulate the
8775 floating-point operations, or compiled in such a way as to call such
8776 emulations routines, these routines will issue floating-point
8777 operations.   If you are compiling for an Alpha without floating-point
8778 operations, you must ensure that the library is built so as not to call
8779 them.
8780
8781 Note that Alpha implementations without floating-point operations are
8782 required to have floating-point registers.
8783
8784 @item -mfp-reg
8785 @itemx -mno-fp-regs
8786 @opindex mfp-reg
8787 @opindex mno-fp-regs
8788 Generate code that uses (does not use) the floating-point register set.
8789 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8790 register set is not used, floating point operands are passed in integer
8791 registers as if they were integers and floating-point results are passed
8792 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8793 so any function with a floating-point argument or return value called by code
8794 compiled with @option{-mno-fp-regs} must also be compiled with that
8795 option.
8796
8797 A typical use of this option is building a kernel that does not use,
8798 and hence need not save and restore, any floating-point registers.
8799
8800 @item -mieee
8801 @opindex mieee
8802 The Alpha architecture implements floating-point hardware optimized for
8803 maximum performance.  It is mostly compliant with the IEEE floating
8804 point standard.  However, for full compliance, software assistance is
8805 required.  This option generates code fully IEEE compliant code
8806 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8807 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8808 defined during compilation.  The resulting code is less efficient but is
8809 able to correctly support denormalized numbers and exceptional IEEE
8810 values such as not-a-number and plus/minus infinity.  Other Alpha
8811 compilers call this option @option{-ieee_with_no_inexact}.
8812
8813 @item -mieee-with-inexact
8814 @opindex mieee-with-inexact
8815 This is like @option{-mieee} except the generated code also maintains
8816 the IEEE @var{inexact-flag}.  Turning on this option causes the
8817 generated code to implement fully-compliant IEEE math.  In addition to
8818 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8819 macro.  On some Alpha implementations the resulting code may execute
8820 significantly slower than the code generated by default.  Since there is
8821 very little code that depends on the @var{inexact-flag}, you should
8822 normally not specify this option.  Other Alpha compilers call this
8823 option @option{-ieee_with_inexact}.
8824
8825 @item -mfp-trap-mode=@var{trap-mode}
8826 @opindex mfp-trap-mode
8827 This option controls what floating-point related traps are enabled.
8828 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8829 The trap mode can be set to one of four values:
8830
8831 @table @samp
8832 @item n
8833 This is the default (normal) setting.  The only traps that are enabled
8834 are the ones that cannot be disabled in software (e.g., division by zero
8835 trap).
8836
8837 @item u
8838 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8839 as well.
8840
8841 @item su
8842 Like @samp{su}, but the instructions are marked to be safe for software
8843 completion (see Alpha architecture manual for details).
8844
8845 @item sui
8846 Like @samp{su}, but inexact traps are enabled as well.
8847 @end table
8848
8849 @item -mfp-rounding-mode=@var{rounding-mode}
8850 @opindex mfp-rounding-mode
8851 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8852 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8853 of:
8854
8855 @table @samp
8856 @item n
8857 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8858 the nearest machine number or towards the even machine number in case
8859 of a tie.
8860
8861 @item m
8862 Round towards minus infinity.
8863
8864 @item c
8865 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8866
8867 @item d
8868 Dynamic rounding mode.  A field in the floating point control register
8869 (@var{fpcr}, see Alpha architecture reference manual) controls the
8870 rounding mode in effect.  The C library initializes this register for
8871 rounding towards plus infinity.  Thus, unless your program modifies the
8872 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8873 @end table
8874
8875 @item -mtrap-precision=@var{trap-precision}
8876 @opindex mtrap-precision
8877 In the Alpha architecture, floating point traps are imprecise.  This
8878 means without software assistance it is impossible to recover from a
8879 floating trap and program execution normally needs to be terminated.
8880 GCC can generate code that can assist operating system trap handlers
8881 in determining the exact location that caused a floating point trap.
8882 Depending on the requirements of an application, different levels of
8883 precisions can be selected:
8884
8885 @table @samp
8886 @item p
8887 Program precision.  This option is the default and means a trap handler
8888 can only identify which program caused a floating point exception.
8889
8890 @item f
8891 Function precision.  The trap handler can determine the function that
8892 caused a floating point exception.
8893
8894 @item i
8895 Instruction precision.  The trap handler can determine the exact
8896 instruction that caused a floating point exception.
8897 @end table
8898
8899 Other Alpha compilers provide the equivalent options called
8900 @option{-scope_safe} and @option{-resumption_safe}.
8901
8902 @item -mieee-conformant
8903 @opindex mieee-conformant
8904 This option marks the generated code as IEEE conformant.  You must not
8905 use this option unless you also specify @option{-mtrap-precision=i} and either
8906 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8907 is to emit the line @samp{.eflag 48} in the function prologue of the
8908 generated assembly file.  Under DEC Unix, this has the effect that
8909 IEEE-conformant math library routines will be linked in.
8910
8911 @item -mbuild-constants
8912 @opindex mbuild-constants
8913 Normally GCC examines a 32- or 64-bit integer constant to
8914 see if it can construct it from smaller constants in two or three
8915 instructions.  If it cannot, it will output the constant as a literal and
8916 generate code to load it from the data segment at runtime.
8917
8918 Use this option to require GCC to construct @emph{all} integer constants
8919 using code, even if it takes more instructions (the maximum is six).
8920
8921 You would typically use this option to build a shared library dynamic
8922 loader.  Itself a shared library, it must relocate itself in memory
8923 before it can find the variables and constants in its own data segment.
8924
8925 @item -malpha-as
8926 @itemx -mgas
8927 @opindex malpha-as
8928 @opindex mgas
8929 Select whether to generate code to be assembled by the vendor-supplied
8930 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8931
8932 @item -mbwx
8933 @itemx -mno-bwx
8934 @itemx -mcix
8935 @itemx -mno-cix
8936 @itemx -mfix
8937 @itemx -mno-fix
8938 @itemx -mmax
8939 @itemx -mno-max
8940 @opindex mbwx
8941 @opindex mno-bwx
8942 @opindex mcix
8943 @opindex mno-cix
8944 @opindex mfix
8945 @opindex mno-fix
8946 @opindex mmax
8947 @opindex mno-max
8948 Indicate whether GCC should generate code to use the optional BWX,
8949 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8950 sets supported by the CPU type specified via @option{-mcpu=} option or that
8951 of the CPU on which GCC was built if none was specified.
8952
8953 @item -mfloat-vax
8954 @itemx -mfloat-ieee
8955 @opindex mfloat-vax
8956 @opindex mfloat-ieee
8957 Generate code that uses (does not use) VAX F and G floating point
8958 arithmetic instead of IEEE single and double precision.
8959
8960 @item -mexplicit-relocs
8961 @itemx -mno-explicit-relocs
8962 @opindex mexplicit-relocs
8963 @opindex mno-explicit-relocs
8964 Older Alpha assemblers provided no way to generate symbol relocations
8965 except via assembler macros.  Use of these macros does not allow
8966 optimal instruction scheduling.  GNU binutils as of version 2.12
8967 supports a new syntax that allows the compiler to explicitly mark
8968 which relocations should apply to which instructions.  This option
8969 is mostly useful for debugging, as GCC detects the capabilities of
8970 the assembler when it is built and sets the default accordingly.
8971
8972 @item -msmall-data
8973 @itemx -mlarge-data
8974 @opindex msmall-data
8975 @opindex mlarge-data
8976 When @option{-mexplicit-relocs} is in effect, static data is
8977 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8978 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8979 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8980 16-bit relocations off of the @code{$gp} register.  This limits the
8981 size of the small data area to 64KB, but allows the variables to be
8982 directly accessed via a single instruction.
8983
8984 The default is @option{-mlarge-data}.  With this option the data area
8985 is limited to just below 2GB.  Programs that require more than 2GB of
8986 data must use @code{malloc} or @code{mmap} to allocate the data in the
8987 heap instead of in the program's data segment.
8988
8989 When generating code for shared libraries, @option{-fpic} implies
8990 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8991
8992 @item -msmall-text
8993 @itemx -mlarge-text
8994 @opindex msmall-text
8995 @opindex mlarge-text
8996 When @option{-msmall-text} is used, the compiler assumes that the
8997 code of the entire program (or shared library) fits in 4MB, and is
8998 thus reachable with a branch instruction.  When @option{-msmall-data}
8999 is used, the compiler can assume that all local symbols share the
9000 same @code{$gp} value, and thus reduce the number of instructions
9001 required for a function call from 4 to 1.
9002
9003 The default is @option{-mlarge-text}.
9004
9005 @item -mcpu=@var{cpu_type}
9006 @opindex mcpu
9007 Set the instruction set and instruction scheduling parameters for
9008 machine type @var{cpu_type}.  You can specify either the @samp{EV}
9009 style name or the corresponding chip number.  GCC supports scheduling
9010 parameters for the EV4, EV5 and EV6 family of processors and will
9011 choose the default values for the instruction set from the processor
9012 you specify.  If you do not specify a processor type, GCC will default
9013 to the processor on which the compiler was built.
9014
9015 Supported values for @var{cpu_type} are
9016
9017 @table @samp
9018 @item ev4
9019 @itemx ev45
9020 @itemx 21064
9021 Schedules as an EV4 and has no instruction set extensions.
9022
9023 @item ev5
9024 @itemx 21164
9025 Schedules as an EV5 and has no instruction set extensions.
9026
9027 @item ev56
9028 @itemx 21164a
9029 Schedules as an EV5 and supports the BWX extension.
9030
9031 @item pca56
9032 @itemx 21164pc
9033 @itemx 21164PC
9034 Schedules as an EV5 and supports the BWX and MAX extensions.
9035
9036 @item ev6
9037 @itemx 21264
9038 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
9039
9040 @item ev67
9041 @itemx 21264a
9042 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
9043 @end table
9044
9045 @item -mtune=@var{cpu_type}
9046 @opindex mtune
9047 Set only the instruction scheduling parameters for machine type
9048 @var{cpu_type}.  The instruction set is not changed.
9049
9050 @item -mmemory-latency=@var{time}
9051 @opindex mmemory-latency
9052 Sets the latency the scheduler should assume for typical memory
9053 references as seen by the application.  This number is highly
9054 dependent on the memory access patterns used by the application
9055 and the size of the external cache on the machine.
9056
9057 Valid options for @var{time} are
9058
9059 @table @samp
9060 @item @var{number}
9061 A decimal number representing clock cycles.
9062
9063 @item L1
9064 @itemx L2
9065 @itemx L3
9066 @itemx main
9067 The compiler contains estimates of the number of clock cycles for
9068 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9069 (also called Dcache, Scache, and Bcache), as well as to main memory.
9070 Note that L3 is only valid for EV5.
9071
9072 @end table
9073 @end table
9074
9075 @node DEC Alpha/VMS Options
9076 @subsection DEC Alpha/VMS Options
9077
9078 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9079
9080 @table @gcctabopt
9081 @item -mvms-return-codes
9082 @opindex mvms-return-codes
9083 Return VMS condition codes from main.  The default is to return POSIX
9084 style condition (e.g.@ error) codes.
9085 @end table
9086
9087 @node H8/300 Options
9088 @subsection H8/300 Options
9089
9090 These @samp{-m} options are defined for the H8/300 implementations:
9091
9092 @table @gcctabopt
9093 @item -mrelax
9094 @opindex mrelax
9095 Shorten some address references at link time, when possible; uses the
9096 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
9097 ld, Using ld}, for a fuller description.
9098
9099 @item -mh
9100 @opindex mh
9101 Generate code for the H8/300H@.
9102
9103 @item -ms
9104 @opindex ms
9105 Generate code for the H8S@.
9106
9107 @item -mn
9108 @opindex mn
9109 Generate code for the H8S and H8/300H in the normal mode.  This switch
9110 must be used either with -mh or -ms.
9111
9112 @item -ms2600
9113 @opindex ms2600
9114 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
9115
9116 @item -mint32
9117 @opindex mint32
9118 Make @code{int} data 32 bits by default.
9119
9120 @item -malign-300
9121 @opindex malign-300
9122 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9123 The default for the H8/300H and H8S is to align longs and floats on 4
9124 byte boundaries.
9125 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9126 This option has no effect on the H8/300.
9127 @end table
9128
9129 @node SH Options
9130 @subsection SH Options
9131
9132 These @samp{-m} options are defined for the SH implementations:
9133
9134 @table @gcctabopt
9135 @item -m1
9136 @opindex m1
9137 Generate code for the SH1.
9138
9139 @item -m2
9140 @opindex m2
9141 Generate code for the SH2.
9142
9143 @item -m2e
9144 Generate code for the SH2e.
9145
9146 @item -m3
9147 @opindex m3
9148 Generate code for the SH3.
9149
9150 @item -m3e
9151 @opindex m3e
9152 Generate code for the SH3e.
9153
9154 @item -m4-nofpu
9155 @opindex m4-nofpu
9156 Generate code for the SH4 without a floating-point unit.
9157
9158 @item -m4-single-only
9159 @opindex m4-single-only
9160 Generate code for the SH4 with a floating-point unit that only
9161 supports single-precision arithmetic.
9162
9163 @item -m4-single
9164 @opindex m4-single
9165 Generate code for the SH4 assuming the floating-point unit is in
9166 single-precision mode by default.
9167
9168 @item -m4
9169 @opindex m4
9170 Generate code for the SH4.
9171
9172 @item -mb
9173 @opindex mb
9174 Compile code for the processor in big endian mode.
9175
9176 @item -ml
9177 @opindex ml
9178 Compile code for the processor in little endian mode.
9179
9180 @item -mdalign
9181 @opindex mdalign
9182 Align doubles at 64-bit boundaries.  Note that this changes the calling
9183 conventions, and thus some functions from the standard C library will
9184 not work unless you recompile it first with @option{-mdalign}.
9185
9186 @item -mrelax
9187 @opindex mrelax
9188 Shorten some address references at link time, when possible; uses the
9189 linker option @option{-relax}.
9190
9191 @item -mbigtable
9192 @opindex mbigtable
9193 Use 32-bit offsets in @code{switch} tables.  The default is to use
9194 16-bit offsets.
9195
9196 @item -mfmovd
9197 @opindex mfmovd
9198 Enable the use of the instruction @code{fmovd}.
9199
9200 @item -mhitachi
9201 @opindex mhitachi
9202 Comply with the calling conventions defined by Renesas.
9203
9204 @item -mnomacsave
9205 @opindex mnomacsave
9206 Mark the @code{MAC} register as call-clobbered, even if
9207 @option{-mhitachi} is given.
9208
9209 @item -mieee
9210 @opindex mieee
9211 Increase IEEE-compliance of floating-point code.
9212
9213 @item -misize
9214 @opindex misize
9215 Dump instruction size and location in the assembly code.
9216
9217 @item -mpadstruct
9218 @opindex mpadstruct
9219 This option is deprecated.  It pads structures to multiple of 4 bytes,
9220 which is incompatible with the SH ABI@.
9221
9222 @item -mspace
9223 @opindex mspace
9224 Optimize for space instead of speed.  Implied by @option{-Os}.
9225
9226 @item -mprefergot
9227 @opindex mprefergot
9228 When generating position-independent code, emit function calls using
9229 the Global Offset Table instead of the Procedure Linkage Table.
9230
9231 @item -musermode
9232 @opindex musermode
9233 Generate a library function call to invalidate instruction cache
9234 entries, after fixing up a trampoline.  This library function call
9235 doesn't assume it can write to the whole memory address space.  This
9236 is the default when the target is @code{sh-*-linux*}.
9237 @end table
9238
9239 @node System V Options
9240 @subsection Options for System V
9241
9242 These additional options are available on System V Release 4 for
9243 compatibility with other compilers on those systems:
9244
9245 @table @gcctabopt
9246 @item -G
9247 @opindex G
9248 Create a shared object.
9249 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
9250
9251 @item -Qy
9252 @opindex Qy
9253 Identify the versions of each tool used by the compiler, in a
9254 @code{.ident} assembler directive in the output.
9255
9256 @item -Qn
9257 @opindex Qn
9258 Refrain from adding @code{.ident} directives to the output file (this is
9259 the default).
9260
9261 @item -YP,@var{dirs}
9262 @opindex YP
9263 Search the directories @var{dirs}, and no others, for libraries
9264 specified with @option{-l}.
9265
9266 @item -Ym,@var{dir}
9267 @opindex Ym
9268 Look in the directory @var{dir} to find the M4 preprocessor.
9269 The assembler uses this option.
9270 @c This is supposed to go with a -Yd for predefined M4 macro files, but
9271 @c the generic assembler that comes with Solaris takes just -Ym.
9272 @end table
9273
9274 @node TMS320C3x/C4x Options
9275 @subsection TMS320C3x/C4x Options
9276 @cindex TMS320C3x/C4x Options
9277
9278 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
9279
9280 @table @gcctabopt
9281
9282 @item -mcpu=@var{cpu_type}
9283 @opindex mcpu
9284 Set the instruction set, register set, and instruction scheduling
9285 parameters for machine type @var{cpu_type}.  Supported values for
9286 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
9287 @samp{c44}.  The default is @samp{c40} to generate code for the
9288 TMS320C40.
9289
9290 @item -mbig-memory
9291 @itemx -mbig
9292 @itemx -msmall-memory
9293 @itemx -msmall
9294 @opindex mbig-memory
9295 @opindex mbig
9296 @opindex msmall-memory
9297 @opindex msmall
9298 Generates code for the big or small memory model.  The small memory
9299 model assumed that all data fits into one 64K word page.  At run-time
9300 the data page (DP) register must be set to point to the 64K page
9301 containing the .bss and .data program sections.  The big memory model is
9302 the default and requires reloading of the DP register for every direct
9303 memory access.
9304
9305 @item -mbk
9306 @itemx -mno-bk
9307 @opindex mbk
9308 @opindex mno-bk
9309 Allow (disallow) allocation of general integer operands into the block
9310 count register BK@.
9311
9312 @item -mdb
9313 @itemx -mno-db
9314 @opindex mdb
9315 @opindex mno-db
9316 Enable (disable) generation of code using decrement and branch,
9317 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
9318 on the safe side, this is disabled for the C3x, since the maximum
9319 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
9320 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
9321 that it can utilize the decrement and branch instruction, but will give
9322 up if there is more than one memory reference in the loop.  Thus a loop
9323 where the loop counter is decremented can generate slightly more
9324 efficient code, in cases where the RPTB instruction cannot be utilized.
9325
9326 @item -mdp-isr-reload
9327 @itemx -mparanoid
9328 @opindex mdp-isr-reload
9329 @opindex mparanoid
9330 Force the DP register to be saved on entry to an interrupt service
9331 routine (ISR), reloaded to point to the data section, and restored on
9332 exit from the ISR@.  This should not be required unless someone has
9333 violated the small memory model by modifying the DP register, say within
9334 an object library.
9335
9336 @item -mmpyi
9337 @itemx -mno-mpyi
9338 @opindex mmpyi
9339 @opindex mno-mpyi
9340 For the C3x use the 24-bit MPYI instruction for integer multiplies
9341 instead of a library call to guarantee 32-bit results.  Note that if one
9342 of the operands is a constant, then the multiplication will be performed
9343 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
9344 then squaring operations are performed inline instead of a library call.
9345
9346 @item -mfast-fix
9347 @itemx -mno-fast-fix
9348 @opindex mfast-fix
9349 @opindex mno-fast-fix
9350 The C3x/C4x FIX instruction to convert a floating point value to an
9351 integer value chooses the nearest integer less than or equal to the
9352 floating point value rather than to the nearest integer.  Thus if the
9353 floating point number is negative, the result will be incorrectly
9354 truncated an additional code is necessary to detect and correct this
9355 case.  This option can be used to disable generation of the additional
9356 code required to correct the result.
9357
9358 @item -mrptb
9359 @itemx -mno-rptb
9360 @opindex mrptb
9361 @opindex mno-rptb
9362 Enable (disable) generation of repeat block sequences using the RPTB
9363 instruction for zero overhead looping.  The RPTB construct is only used
9364 for innermost loops that do not call functions or jump across the loop
9365 boundaries.  There is no advantage having nested RPTB loops due to the
9366 overhead required to save and restore the RC, RS, and RE registers.
9367 This is enabled by default with @option{-O2}.
9368
9369 @item -mrpts=@var{count}
9370 @itemx -mno-rpts
9371 @opindex mrpts
9372 @opindex mno-rpts
9373 Enable (disable) the use of the single instruction repeat instruction
9374 RPTS@.  If a repeat block contains a single instruction, and the loop
9375 count can be guaranteed to be less than the value @var{count}, GCC will
9376 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
9377 then a RPTS will be emitted even if the loop count cannot be determined
9378 at compile time.  Note that the repeated instruction following RPTS does
9379 not have to be reloaded from memory each iteration, thus freeing up the
9380 CPU buses for operands.  However, since interrupts are blocked by this
9381 instruction, it is disabled by default.
9382
9383 @item -mloop-unsigned
9384 @itemx -mno-loop-unsigned
9385 @opindex mloop-unsigned
9386 @opindex mno-loop-unsigned
9387 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
9388 is @math{2^{31} + 1} since these instructions test if the iteration count is
9389 negative to terminate the loop.  If the iteration count is unsigned
9390 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
9391 exceeded.  This switch allows an unsigned iteration count.
9392
9393 @item -mti
9394 @opindex mti
9395 Try to emit an assembler syntax that the TI assembler (asm30) is happy
9396 with.  This also enforces compatibility with the API employed by the TI
9397 C3x C compiler.  For example, long doubles are passed as structures
9398 rather than in floating point registers.
9399
9400 @item -mregparm
9401 @itemx -mmemparm
9402 @opindex mregparm
9403 @opindex mmemparm
9404 Generate code that uses registers (stack) for passing arguments to functions.
9405 By default, arguments are passed in registers where possible rather
9406 than by pushing arguments on to the stack.
9407
9408 @item -mparallel-insns
9409 @itemx -mno-parallel-insns
9410 @opindex mparallel-insns
9411 @opindex mno-parallel-insns
9412 Allow the generation of parallel instructions.  This is enabled by
9413 default with @option{-O2}.
9414
9415 @item -mparallel-mpy
9416 @itemx -mno-parallel-mpy
9417 @opindex mparallel-mpy
9418 @opindex mno-parallel-mpy
9419 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
9420 provided @option{-mparallel-insns} is also specified.  These instructions have
9421 tight register constraints which can pessimize the code generation
9422 of large functions.
9423
9424 @end table
9425
9426 @node V850 Options
9427 @subsection V850 Options
9428 @cindex V850 Options
9429
9430 These @samp{-m} options are defined for V850 implementations:
9431
9432 @table @gcctabopt
9433 @item -mlong-calls
9434 @itemx -mno-long-calls
9435 @opindex mlong-calls
9436 @opindex mno-long-calls
9437 Treat all calls as being far away (near).  If calls are assumed to be
9438 far away, the compiler will always load the functions address up into a
9439 register, and call indirect through the pointer.
9440
9441 @item -mno-ep
9442 @itemx -mep
9443 @opindex mno-ep
9444 @opindex mep
9445 Do not optimize (do optimize) basic blocks that use the same index
9446 pointer 4 or more times to copy pointer into the @code{ep} register, and
9447 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
9448 option is on by default if you optimize.
9449
9450 @item -mno-prolog-function
9451 @itemx -mprolog-function
9452 @opindex mno-prolog-function
9453 @opindex mprolog-function
9454 Do not use (do use) external functions to save and restore registers
9455 at the prologue and epilogue of a function.  The external functions
9456 are slower, but use less code space if more than one function saves
9457 the same number of registers.  The @option{-mprolog-function} option
9458 is on by default if you optimize.
9459
9460 @item -mspace
9461 @opindex mspace
9462 Try to make the code as small as possible.  At present, this just turns
9463 on the @option{-mep} and @option{-mprolog-function} options.
9464
9465 @item -mtda=@var{n}
9466 @opindex mtda
9467 Put static or global variables whose size is @var{n} bytes or less into
9468 the tiny data area that register @code{ep} points to.  The tiny data
9469 area can hold up to 256 bytes in total (128 bytes for byte references).
9470
9471 @item -msda=@var{n}
9472 @opindex msda
9473 Put static or global variables whose size is @var{n} bytes or less into
9474 the small data area that register @code{gp} points to.  The small data
9475 area can hold up to 64 kilobytes.
9476
9477 @item -mzda=@var{n}
9478 @opindex mzda
9479 Put static or global variables whose size is @var{n} bytes or less into
9480 the first 32 kilobytes of memory.
9481
9482 @item -mv850
9483 @opindex mv850
9484 Specify that the target processor is the V850.
9485
9486 @item -mbig-switch
9487 @opindex mbig-switch
9488 Generate code suitable for big switch tables.  Use this option only if
9489 the assembler/linker complain about out of range branches within a switch
9490 table.
9491
9492 @item -mapp-regs
9493 @opindex mapp-regs
9494 This option will cause r2 and r5 to be used in the code generated by
9495 the compiler.  This setting is the default.
9496
9497 @item -mno-app-regs
9498 @opindex mno-app-regs
9499 This option will cause r2 and r5 to be treated as fixed registers.
9500
9501 @item -mv850e1
9502 @opindex mv850e1
9503 Specify that the target processor is the V850E1.  The preprocessor
9504 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
9505 this option is used.
9506
9507 @item -mv850e
9508 @opindex mv850e
9509 Specify that the target processor is the V850E.  The preprocessor
9510 constant @samp{__v850e__} will be defined if this option is used.
9511
9512 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
9513 are defined then a default target processor will be chosen and the
9514 relevant @samp{__v850*__} preprocessor constant will be defined.
9515
9516 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9517 defined, regardless of which processor variant is the target.
9518
9519 @item -mdisable-callt
9520 @opindex mdisable-callt
9521 This option will suppress generation of the CALLT instruction for the
9522 v850e and v850e1 flavors of the v850 architecture.  The default is
9523 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
9524
9525 @end table
9526
9527 @node ARC Options
9528 @subsection ARC Options
9529 @cindex ARC Options
9530
9531 These options are defined for ARC implementations:
9532
9533 @table @gcctabopt
9534 @item -EL
9535 @opindex EL
9536 Compile code for little endian mode.  This is the default.
9537
9538 @item -EB
9539 @opindex EB
9540 Compile code for big endian mode.
9541
9542 @item -mmangle-cpu
9543 @opindex mmangle-cpu
9544 Prepend the name of the cpu to all public symbol names.
9545 In multiple-processor systems, there are many ARC variants with different
9546 instruction and register set characteristics.  This flag prevents code
9547 compiled for one cpu to be linked with code compiled for another.
9548 No facility exists for handling variants that are ``almost identical''.
9549 This is an all or nothing option.
9550
9551 @item -mcpu=@var{cpu}
9552 @opindex mcpu
9553 Compile code for ARC variant @var{cpu}.
9554 Which variants are supported depend on the configuration.
9555 All variants support @option{-mcpu=base}, this is the default.
9556
9557 @item -mtext=@var{text-section}
9558 @itemx -mdata=@var{data-section}
9559 @itemx -mrodata=@var{readonly-data-section}
9560 @opindex mtext
9561 @opindex mdata
9562 @opindex mrodata
9563 Put functions, data, and readonly data in @var{text-section},
9564 @var{data-section}, and @var{readonly-data-section} respectively
9565 by default.  This can be overridden with the @code{section} attribute.
9566 @xref{Variable Attributes}.
9567
9568 @end table
9569
9570 @node NS32K Options
9571 @subsection NS32K Options
9572 @cindex NS32K options
9573
9574 These are the @samp{-m} options defined for the 32000 series.  The default
9575 values for these options depends on which style of 32000 was selected when
9576 the compiler was configured; the defaults for the most common choices are
9577 given below.
9578
9579 @table @gcctabopt
9580 @item -m32032
9581 @itemx -m32032
9582 @opindex m32032
9583 @opindex m32032
9584 Generate output for a 32032.  This is the default
9585 when the compiler is configured for 32032 and 32016 based systems.
9586
9587 @item -m32332
9588 @itemx -m32332
9589 @opindex m32332
9590 @opindex m32332
9591 Generate output for a 32332.  This is the default
9592 when the compiler is configured for 32332-based systems.
9593
9594 @item -m32532
9595 @itemx -m32532
9596 @opindex m32532
9597 @opindex m32532
9598 Generate output for a 32532.  This is the default
9599 when the compiler is configured for 32532-based systems.
9600
9601 @item -m32081
9602 @opindex m32081
9603 Generate output containing 32081 instructions for floating point.
9604 This is the default for all systems.
9605
9606 @item -m32381
9607 @opindex m32381
9608 Generate output containing 32381 instructions for floating point.  This
9609 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9610 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9611
9612 @item -mmulti-add
9613 @opindex mmulti-add
9614 Try and generate multiply-add floating point instructions @code{polyF}
9615 and @code{dotF}.  This option is only available if the @option{-m32381}
9616 option is in effect.  Using these instructions requires changes to
9617 register allocation which generally has a negative impact on
9618 performance.  This option should only be enabled when compiling code
9619 particularly likely to make heavy use of multiply-add instructions.
9620
9621 @item -mnomulti-add
9622 @opindex mnomulti-add
9623 Do not try and generate multiply-add floating point instructions
9624 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9625
9626 @item -msoft-float
9627 @opindex msoft-float
9628 Generate output containing library calls for floating point.
9629 @strong{Warning:} the requisite libraries may not be available.
9630
9631 @item -mieee-compare
9632 @itemx -mno-ieee-compare
9633 @opindex mieee-compare
9634 @opindex mno-ieee-compare
9635 Control whether or not the compiler uses IEEE floating point
9636 comparisons.  These handle correctly the case where the result of a
9637 comparison is unordered.
9638 @strong{Warning:} the requisite kernel support may not be available.
9639
9640 @item -mnobitfield
9641 @opindex mnobitfield
9642 Do not use the bit-field instructions.  On some machines it is faster to
9643 use shifting and masking operations.  This is the default for the pc532.
9644
9645 @item -mbitfield
9646 @opindex mbitfield
9647 Do use the bit-field instructions.  This is the default for all platforms
9648 except the pc532.
9649
9650 @item -mrtd
9651 @opindex mrtd
9652 Use a different function-calling convention, in which functions
9653 that take a fixed number of arguments return pop their
9654 arguments on return with the @code{ret} instruction.
9655
9656 This calling convention is incompatible with the one normally
9657 used on Unix, so you cannot use it if you need to call libraries
9658 compiled with the Unix compiler.
9659
9660 Also, you must provide function prototypes for all functions that
9661 take variable numbers of arguments (including @code{printf});
9662 otherwise incorrect code will be generated for calls to those
9663 functions.
9664
9665 In addition, seriously incorrect code will result if you call a
9666 function with too many arguments.  (Normally, extra arguments are
9667 harmlessly ignored.)
9668
9669 This option takes its name from the 680x0 @code{rtd} instruction.
9670
9671
9672 @item -mregparam
9673 @opindex mregparam
9674 Use a different function-calling convention where the first two arguments
9675 are passed in registers.
9676
9677 This calling convention is incompatible with the one normally
9678 used on Unix, so you cannot use it if you need to call libraries
9679 compiled with the Unix compiler.
9680
9681 @item -mnoregparam
9682 @opindex mnoregparam
9683 Do not pass any arguments in registers.  This is the default for all
9684 targets.
9685
9686 @item -msb
9687 @opindex msb
9688 It is OK to use the sb as an index register which is always loaded with
9689 zero.  This is the default for the pc532-netbsd target.
9690
9691 @item -mnosb
9692 @opindex mnosb
9693 The sb register is not available for use or has not been initialized to
9694 zero by the run time system.  This is the default for all targets except
9695 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9696 @option{-fpic} is set.
9697
9698 @item -mhimem
9699 @opindex mhimem
9700 Many ns32000 series addressing modes use displacements of up to 512MB@.
9701 If an address is above 512MB then displacements from zero can not be used.
9702 This option causes code to be generated which can be loaded above 512MB@.
9703 This may be useful for operating systems or ROM code.
9704
9705 @item -mnohimem
9706 @opindex mnohimem
9707 Assume code will be loaded in the first 512MB of virtual address space.
9708 This is the default for all platforms.
9709
9710
9711 @end table
9712
9713 @node AVR Options
9714 @subsection AVR Options
9715 @cindex AVR Options
9716
9717 These options are defined for AVR implementations:
9718
9719 @table @gcctabopt
9720 @item -mmcu=@var{mcu}
9721 @opindex mmcu
9722 Specify ATMEL AVR instruction set or MCU type.
9723
9724 Instruction set avr1 is for the minimal AVR core, not supported by the C
9725 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9726 attiny11, attiny12, attiny15, attiny28).
9727
9728 Instruction set avr2 (default) is for the classic AVR core with up to
9729 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9730 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9731 at90c8534, at90s8535).
9732
9733 Instruction set avr3 is for the classic AVR core with up to 128K program
9734 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9735
9736 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9737 memory space (MCU types: atmega8, atmega83, atmega85).
9738
9739 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9740 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9741 atmega64, atmega128, at43usb355, at94k).
9742
9743 @item -msize
9744 @opindex msize
9745 Output instruction sizes to the asm file.
9746
9747 @item -minit-stack=@var{N}
9748 @opindex minit-stack
9749 Specify the initial stack address, which may be a symbol or numeric value,
9750 @samp{__stack} is the default.
9751
9752 @item -mno-interrupts
9753 @opindex mno-interrupts
9754 Generated code is not compatible with hardware interrupts.
9755 Code size will be smaller.
9756
9757 @item -mcall-prologues
9758 @opindex mcall-prologues
9759 Functions prologues/epilogues expanded as call to appropriate
9760 subroutines.  Code size will be smaller.
9761
9762 @item -mno-tablejump
9763 @opindex mno-tablejump
9764 Do not generate tablejump insns which sometimes increase code size.
9765
9766 @item -mtiny-stack
9767 @opindex mtiny-stack
9768 Change only the low 8 bits of the stack pointer.
9769 @end table
9770
9771 @node MCore Options
9772 @subsection MCore Options
9773 @cindex MCore options
9774
9775 These are the @samp{-m} options defined for the Motorola M*Core
9776 processors.
9777
9778 @table @gcctabopt
9779
9780 @item -mhardlit
9781 @itemx -mno-hardlit
9782 @opindex mhardlit
9783 @opindex mno-hardlit
9784 Inline constants into the code stream if it can be done in two
9785 instructions or less.
9786
9787 @item -mdiv
9788 @itemx -mno-div
9789 @opindex mdiv
9790 @opindex mno-div
9791 Use the divide instruction.  (Enabled by default).
9792
9793 @item -mrelax-immediate
9794 @itemx -mno-relax-immediate
9795 @opindex mrelax-immediate
9796 @opindex mno-relax-immediate
9797 Allow arbitrary sized immediates in bit operations.
9798
9799 @item -mwide-bitfields
9800 @itemx -mno-wide-bitfields
9801 @opindex mwide-bitfields
9802 @opindex mno-wide-bitfields
9803 Always treat bit-fields as int-sized.
9804
9805 @item -m4byte-functions
9806 @itemx -mno-4byte-functions
9807 @opindex m4byte-functions
9808 @opindex mno-4byte-functions
9809 Force all functions to be aligned to a four byte boundary.
9810
9811 @item -mcallgraph-data
9812 @itemx -mno-callgraph-data
9813 @opindex mcallgraph-data
9814 @opindex mno-callgraph-data
9815 Emit callgraph information.
9816
9817 @item -mslow-bytes
9818 @itemx -mno-slow-bytes
9819 @opindex mslow-bytes
9820 @opindex mno-slow-bytes
9821 Prefer word access when reading byte quantities.
9822
9823 @item -mlittle-endian
9824 @itemx -mbig-endian
9825 @opindex mlittle-endian
9826 @opindex mbig-endian
9827 Generate code for a little endian target.
9828
9829 @item -m210
9830 @itemx -m340
9831 @opindex m210
9832 @opindex m340
9833 Generate code for the 210 processor.
9834 @end table
9835
9836 @node IA-64 Options
9837 @subsection IA-64 Options
9838 @cindex IA-64 Options
9839
9840 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9841
9842 @table @gcctabopt
9843 @item -mbig-endian
9844 @opindex mbig-endian
9845 Generate code for a big endian target.  This is the default for HP-UX@.
9846
9847 @item -mlittle-endian
9848 @opindex mlittle-endian
9849 Generate code for a little endian target.  This is the default for AIX5
9850 and GNU/Linux.
9851
9852 @item -mgnu-as
9853 @itemx -mno-gnu-as
9854 @opindex mgnu-as
9855 @opindex mno-gnu-as
9856 Generate (or don't) code for the GNU assembler.  This is the default.
9857 @c Also, this is the default if the configure option @option{--with-gnu-as}
9858 @c is used.
9859
9860 @item -mgnu-ld
9861 @itemx -mno-gnu-ld
9862 @opindex mgnu-ld
9863 @opindex mno-gnu-ld
9864 Generate (or don't) code for the GNU linker.  This is the default.
9865 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9866 @c is used.
9867
9868 @item -mno-pic
9869 @opindex mno-pic
9870 Generate code that does not use a global pointer register.  The result
9871 is not position independent code, and violates the IA-64 ABI@.
9872
9873 @item -mvolatile-asm-stop
9874 @itemx -mno-volatile-asm-stop
9875 @opindex mvolatile-asm-stop
9876 @opindex mno-volatile-asm-stop
9877 Generate (or don't) a stop bit immediately before and after volatile asm
9878 statements.
9879
9880 @item -mb-step
9881 @opindex mb-step
9882 Generate code that works around Itanium B step errata.
9883
9884 @item -mregister-names
9885 @itemx -mno-register-names
9886 @opindex mregister-names
9887 @opindex mno-register-names
9888 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9889 the stacked registers.  This may make assembler output more readable.
9890
9891 @item -mno-sdata
9892 @itemx -msdata
9893 @opindex mno-sdata
9894 @opindex msdata
9895 Disable (or enable) optimizations that use the small data section.  This may
9896 be useful for working around optimizer bugs.
9897
9898 @item -mconstant-gp
9899 @opindex mconstant-gp
9900 Generate code that uses a single constant global pointer value.  This is
9901 useful when compiling kernel code.
9902
9903 @item -mauto-pic
9904 @opindex mauto-pic
9905 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9906 This is useful when compiling firmware code.
9907
9908 @item -minline-float-divide-min-latency
9909 @opindex minline-float-divide-min-latency
9910 Generate code for inline divides of floating point values
9911 using the minimum latency algorithm.
9912
9913 @item -minline-float-divide-max-throughput
9914 @opindex minline-float-divide-max-throughput
9915 Generate code for inline divides of floating point values
9916 using the maximum throughput algorithm.
9917
9918 @item -minline-int-divide-min-latency
9919 @opindex minline-int-divide-min-latency
9920 Generate code for inline divides of integer values
9921 using the minimum latency algorithm.
9922
9923 @item -minline-int-divide-max-throughput
9924 @opindex minline-int-divide-max-throughput
9925 Generate code for inline divides of integer values
9926 using the maximum throughput algorithm.
9927
9928 @item -mno-dwarf2-asm
9929 @itemx -mdwarf2-asm
9930 @opindex mno-dwarf2-asm
9931 @opindex mdwarf2-asm
9932 Don't (or do) generate assembler code for the DWARF2 line number debugging
9933 info.  This may be useful when not using the GNU assembler.
9934
9935 @item -mfixed-range=@var{register-range}
9936 @opindex mfixed-range
9937 Generate code treating the given register range as fixed registers.
9938 A fixed register is one that the register allocator can not use.  This is
9939 useful when compiling kernel code.  A register range is specified as
9940 two registers separated by a dash.  Multiple register ranges can be
9941 specified separated by a comma.
9942
9943 @item -mearly-stop-bits
9944 @itemx -mno-early-stop-bits
9945 @opindex mearly-stop-bits
9946 @opindex mno-early-stop-bits
9947 Allow stop bits to be placed earlier than immediately preceding the
9948 instruction that triggered the stop bit.  This can improve instruction
9949 scheduling, but does not always do so.
9950 @end table
9951
9952 @node S/390 and zSeries Options
9953 @subsection S/390 and zSeries Options
9954 @cindex S/390 and zSeries Options
9955
9956 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9957
9958 @table @gcctabopt
9959 @item -mhard-float
9960 @itemx -msoft-float
9961 @opindex mhard-float
9962 @opindex msoft-float
9963 Use (do not use) the hardware floating-point instructions and registers
9964 for floating-point operations.  When @option{-msoft-float} is specified,
9965 functions in @file{libgcc.a} will be used to perform floating-point
9966 operations.  When @option{-mhard-float} is specified, the compiler
9967 generates IEEE floating-point instructions.  This is the default.
9968
9969 @item -mbackchain
9970 @itemx -mno-backchain
9971 @opindex mbackchain
9972 @opindex mno-backchain
9973 Generate (or do not generate) code which maintains an explicit
9974 backchain within the stack frame that points to the caller's frame.
9975 This may be needed to allow debugging using tools that do not understand
9976 DWARF-2 call frame information.  The default is not to generate the
9977 backchain.
9978
9979 @item -msmall-exec
9980 @itemx -mno-small-exec
9981 @opindex msmall-exec
9982 @opindex mno-small-exec
9983 Generate (or do not generate) code using the @code{bras} instruction
9984 to do subroutine calls.
9985 This only works reliably if the total executable size does not
9986 exceed 64k.  The default is to use the @code{basr} instruction instead,
9987 which does not have this limitation.
9988
9989 @item -m64
9990 @itemx -m31
9991 @opindex m64
9992 @opindex m31
9993 When @option{-m31} is specified, generate code compliant to the
9994 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
9995 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
9996 particular to generate 64-bit instructions.  For the @samp{s390}
9997 targets, the default is @option{-m31}, while the @samp{s390x}
9998 targets default to @option{-m64}.
9999
10000 @item -mzarch
10001 @itemx -mesa
10002 @opindex mzarch
10003 @opindex mesa
10004 When @option{-mzarch} is specified, generate code using the
10005 instructions available on z/Architecture.
10006 When @option{-mesa} is specified, generate code using the
10007 instructions available on ESA/390. Note that @option{-mesa} is
10008 not possible with @option{-m64}.
10009 When generating code compliant to the GNU/Linux for S/390 ABI,
10010 the default is @option{-mesa}.  When generating code compliant
10011 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
10012
10013 @item -mmvcle
10014 @itemx -mno-mvcle
10015 @opindex mmvcle
10016 @opindex mno-mvcle
10017 Generate (or do not generate) code using the @code{mvcle} instruction
10018 to perform block moves.  When @option{-mno-mvcle} is specified,
10019 use a @code{mvc} loop instead.  This is the default.
10020
10021 @item -mdebug
10022 @itemx -mno-debug
10023 @opindex mdebug
10024 @opindex mno-debug
10025 Print (or do not print) additional debug information when compiling.
10026 The default is to not print debug information.
10027
10028 @item -march=@var{cpu-type}
10029 @opindex march
10030 Generate code that will run on @var{cpu-type}, which is the name of a system
10031 representing a certain processor type. Possible values for
10032 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
10033 When generating code using the instructions available on z/Architecture,
10034 the default is @option{-march=z900}.  Otherwise, the default is
10035 @option{-march=g5}.
10036
10037 @item -mtune=@var{cpu-type}
10038 @opindex mtune
10039 Tune to @var{cpu-type} everything applicable about the generated code,
10040 except for the ABI and the set of available instructions.
10041 The list of @var{cpu-type} values is the same as for @option{-march}.
10042 The default is the value used for @option{-march}.
10043
10044 @item -mfused-madd
10045 @itemx -mno-fused-madd
10046 @opindex mfused-madd
10047 @opindex mno-fused-madd
10048 Generate code that uses (does not use) the floating point multiply and
10049 accumulate instructions.  These instructions are generated by default if
10050 hardware floating point is used.
10051 @end table
10052
10053 @node CRIS Options
10054 @subsection CRIS Options
10055 @cindex CRIS Options
10056
10057 These options are defined specifically for the CRIS ports.
10058
10059 @table @gcctabopt
10060 @item -march=@var{architecture-type}
10061 @itemx -mcpu=@var{architecture-type}
10062 @opindex march
10063 @opindex mcpu
10064 Generate code for the specified architecture.  The choices for
10065 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10066 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
10067 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10068 @samp{v10}.
10069
10070 @item -mtune=@var{architecture-type}
10071 @opindex mtune
10072 Tune to @var{architecture-type} everything applicable about the generated
10073 code, except for the ABI and the set of available instructions.  The
10074 choices for @var{architecture-type} are the same as for
10075 @option{-march=@var{architecture-type}}.
10076
10077 @item -mmax-stack-frame=@var{n}
10078 @opindex mmax-stack-frame
10079 Warn when the stack frame of a function exceeds @var{n} bytes.
10080
10081 @item -melinux-stacksize=@var{n}
10082 @opindex melinux-stacksize
10083 Only available with the @samp{cris-axis-aout} target.  Arranges for
10084 indications in the program to the kernel loader that the stack of the
10085 program should be set to @var{n} bytes.
10086
10087 @item -metrax4
10088 @itemx -metrax100
10089 @opindex metrax4
10090 @opindex metrax100
10091 The options @option{-metrax4} and @option{-metrax100} are synonyms for
10092 @option{-march=v3} and @option{-march=v8} respectively.
10093
10094 @item -mpdebug
10095 @opindex mpdebug
10096 Enable CRIS-specific verbose debug-related information in the assembly
10097 code.  This option also has the effect to turn off the @samp{#NO_APP}
10098 formatted-code indicator to the assembler at the beginning of the
10099 assembly file.
10100
10101 @item -mcc-init
10102 @opindex mcc-init
10103 Do not use condition-code results from previous instruction; always emit
10104 compare and test instructions before use of condition codes.
10105
10106 @item -mno-side-effects
10107 @opindex mno-side-effects
10108 Do not emit instructions with side-effects in addressing modes other than
10109 post-increment.
10110
10111 @item -mstack-align
10112 @itemx -mno-stack-align
10113 @itemx -mdata-align
10114 @itemx -mno-data-align
10115 @itemx -mconst-align
10116 @itemx -mno-const-align
10117 @opindex mstack-align
10118 @opindex mno-stack-align
10119 @opindex mdata-align
10120 @opindex mno-data-align
10121 @opindex mconst-align
10122 @opindex mno-const-align
10123 These options (no-options) arranges (eliminate arrangements) for the
10124 stack-frame, individual data and constants to be aligned for the maximum
10125 single data access size for the chosen CPU model.  The default is to
10126 arrange for 32-bit alignment.  ABI details such as structure layout are
10127 not affected by these options.
10128
10129 @item -m32-bit
10130 @itemx -m16-bit
10131 @itemx -m8-bit
10132 @opindex m32-bit
10133 @opindex m16-bit
10134 @opindex m8-bit
10135 Similar to the stack- data- and const-align options above, these options
10136 arrange for stack-frame, writable data and constants to all be 32-bit,
10137 16-bit or 8-bit aligned.  The default is 32-bit alignment.
10138
10139 @item -mno-prologue-epilogue
10140 @itemx -mprologue-epilogue
10141 @opindex mno-prologue-epilogue
10142 @opindex mprologue-epilogue
10143 With @option{-mno-prologue-epilogue}, the normal function prologue and
10144 epilogue that sets up the stack-frame are omitted and no return
10145 instructions or return sequences are generated in the code.  Use this
10146 option only together with visual inspection of the compiled code: no
10147 warnings or errors are generated when call-saved registers must be saved,
10148 or storage for local variable needs to be allocated.
10149
10150 @item -mno-gotplt
10151 @itemx -mgotplt
10152 @opindex mno-gotplt
10153 @opindex mgotplt
10154 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10155 instruction sequences that load addresses for functions from the PLT part
10156 of the GOT rather than (traditional on other architectures) calls to the
10157 PLT.  The default is @option{-mgotplt}.
10158
10159 @item -maout
10160 @opindex maout
10161 Legacy no-op option only recognized with the cris-axis-aout target.
10162
10163 @item -melf
10164 @opindex melf
10165 Legacy no-op option only recognized with the cris-axis-elf and
10166 cris-axis-linux-gnu targets.
10167
10168 @item -melinux
10169 @opindex melinux
10170 Only recognized with the cris-axis-aout target, where it selects a
10171 GNU/linux-like multilib, include files and instruction set for
10172 @option{-march=v8}.
10173
10174 @item -mlinux
10175 @opindex mlinux
10176 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10177
10178 @item -sim
10179 @opindex sim
10180 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
10181 to link with input-output functions from a simulator library.  Code,
10182 initialized data and zero-initialized data are allocated consecutively.
10183
10184 @item -sim2
10185 @opindex sim2
10186 Like @option{-sim}, but pass linker options to locate initialized data at
10187 0x40000000 and zero-initialized data at 0x80000000.
10188 @end table
10189
10190 @node MMIX Options
10191 @subsection MMIX Options
10192 @cindex MMIX Options
10193
10194 These options are defined for the MMIX:
10195
10196 @table @gcctabopt
10197 @item -mlibfuncs
10198 @itemx -mno-libfuncs
10199 @opindex mlibfuncs
10200 @opindex mno-libfuncs
10201 Specify that intrinsic library functions are being compiled, passing all
10202 values in registers, no matter the size.
10203
10204 @item -mepsilon
10205 @itemx -mno-epsilon
10206 @opindex mepsilon
10207 @opindex mno-epsilon
10208 Generate floating-point comparison instructions that compare with respect
10209 to the @code{rE} epsilon register.
10210
10211 @item -mabi=mmixware
10212 @itemx -mabi=gnu
10213 @opindex mabi-mmixware
10214 @opindex mabi=gnu
10215 Generate code that passes function parameters and return values that (in
10216 the called function) are seen as registers @code{$0} and up, as opposed to
10217 the GNU ABI which uses global registers @code{$231} and up.
10218
10219 @item -mzero-extend
10220 @itemx -mno-zero-extend
10221 @opindex mzero-extend
10222 @opindex mno-zero-extend
10223 When reading data from memory in sizes shorter than 64 bits, use (do not
10224 use) zero-extending load instructions by default, rather than
10225 sign-extending ones.
10226
10227 @item -mknuthdiv
10228 @itemx -mno-knuthdiv
10229 @opindex mknuthdiv
10230 @opindex mno-knuthdiv
10231 Make the result of a division yielding a remainder have the same sign as
10232 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10233 remainder follows the sign of the dividend.  Both methods are
10234 arithmetically valid, the latter being almost exclusively used.
10235
10236 @item -mtoplevel-symbols
10237 @itemx -mno-toplevel-symbols
10238 @opindex mtoplevel-symbols
10239 @opindex mno-toplevel-symbols
10240 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10241 code can be used with the @code{PREFIX} assembly directive.
10242
10243 @item -melf
10244 @opindex melf
10245 Generate an executable in the ELF format, rather than the default
10246 @samp{mmo} format used by the @command{mmix} simulator.
10247
10248 @item -mbranch-predict
10249 @itemx -mno-branch-predict
10250 @opindex mbranch-predict
10251 @opindex mno-branch-predict
10252 Use (do not use) the probable-branch instructions, when static branch
10253 prediction indicates a probable branch.
10254
10255 @item -mbase-addresses
10256 @itemx -mno-base-addresses
10257 @opindex mbase-addresses
10258 @opindex mno-base-addresses
10259 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10260 base address automatically generates a request (handled by the assembler
10261 and the linker) for a constant to be set up in a global register.  The
10262 register is used for one or more base address requests within the range 0
10263 to 255 from the value held in the register.  The generally leads to short
10264 and fast code, but the number of different data items that can be
10265 addressed is limited.  This means that a program that uses lots of static
10266 data may require @option{-mno-base-addresses}.
10267
10268 @item -msingle-exit
10269 @itemx -mno-single-exit
10270 @opindex msingle-exit
10271 @opindex mno-single-exit
10272 Force (do not force) generated code to have a single exit point in each
10273 function.
10274 @end table
10275
10276 @node PDP-11 Options
10277 @subsection PDP-11 Options
10278 @cindex PDP-11 Options
10279
10280 These options are defined for the PDP-11:
10281
10282 @table @gcctabopt
10283 @item -mfpu
10284 @opindex mfpu
10285 Use hardware FPP floating point.  This is the default.  (FIS floating
10286 point on the PDP-11/40 is not supported.)
10287
10288 @item -msoft-float
10289 @opindex msoft-float
10290 Do not use hardware floating point.
10291
10292 @item -mac0
10293 @opindex mac0
10294 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10295
10296 @item -mno-ac0
10297 @opindex mno-ac0
10298 Return floating-point results in memory.  This is the default.
10299
10300 @item -m40
10301 @opindex m40
10302 Generate code for a PDP-11/40.
10303
10304 @item -m45
10305 @opindex m45
10306 Generate code for a PDP-11/45.  This is the default.
10307
10308 @item -m10
10309 @opindex m10
10310 Generate code for a PDP-11/10.
10311
10312 @item -mbcopy-builtin
10313 @opindex bcopy-builtin
10314 Use inline @code{movstrhi} patterns for copying memory.  This is the
10315 default.
10316
10317 @item -mbcopy
10318 @opindex mbcopy
10319 Do not use inline @code{movstrhi} patterns for copying memory.
10320
10321 @item -mint16
10322 @itemx -mno-int32
10323 @opindex mint16
10324 @opindex mno-int32
10325 Use 16-bit @code{int}.  This is the default.
10326
10327 @item -mint32
10328 @itemx -mno-int16
10329 @opindex mint32
10330 @opindex mno-int16
10331 Use 32-bit @code{int}.
10332
10333 @item -mfloat64
10334 @itemx -mno-float32
10335 @opindex mfloat64
10336 @opindex mno-float32
10337 Use 64-bit @code{float}.  This is the default.
10338
10339 @item -mfloat32
10340 @itemx -mno-float64
10341 @opindex mfloat32
10342 @opindex mno-float64
10343 Use 32-bit @code{float}.
10344
10345 @item -mabshi
10346 @opindex mabshi
10347 Use @code{abshi2} pattern.  This is the default.
10348
10349 @item -mno-abshi
10350 @opindex mno-abshi
10351 Do not use @code{abshi2} pattern.
10352
10353 @item -mbranch-expensive
10354 @opindex mbranch-expensive
10355 Pretend that branches are expensive.  This is for experimenting with
10356 code generation only.
10357
10358 @item -mbranch-cheap
10359 @opindex mbranch-cheap
10360 Do not pretend that branches are expensive.  This is the default.
10361
10362 @item -msplit
10363 @opindex msplit
10364 Generate code for a system with split I&D.
10365
10366 @item -mno-split
10367 @opindex mno-split
10368 Generate code for a system without split I&D.  This is the default.
10369
10370 @item -munix-asm
10371 @opindex munix-asm
10372 Use Unix assembler syntax.  This is the default when configured for
10373 @samp{pdp11-*-bsd}.
10374
10375 @item -mdec-asm
10376 @opindex mdec-asm
10377 Use DEC assembler syntax.  This is the default when configured for any
10378 PDP-11 target other than @samp{pdp11-*-bsd}.
10379 @end table
10380
10381 @node Xstormy16 Options
10382 @subsection Xstormy16 Options
10383 @cindex Xstormy16 Options
10384
10385 These options are defined for Xstormy16:
10386
10387 @table @gcctabopt
10388 @item -msim
10389 @opindex msim
10390 Choose startup files and linker script suitable for the simulator.
10391 @end table
10392
10393 @node FRV Options
10394 @subsection FRV Options
10395 @cindex FRV Options
10396
10397 @table @gcctabopt
10398 @item -mgpr-32
10399 @opindex mgpr-32
10400
10401 Only use the first 32 general purpose registers.
10402
10403 @item -mgpr-64
10404 @opindex mgpr-64
10405
10406 Use all 64 general purpose registers.
10407
10408 @item -mfpr-32
10409 @opindex mfpr-32
10410
10411 Use only the first 32 floating point registers.
10412
10413 @item -mfpr-64
10414 @opindex mfpr-64
10415
10416 Use all 64 floating point registers
10417
10418 @item -mhard-float
10419 @opindex mhard-float
10420
10421 Use hardware instructions for floating point operations.
10422
10423 @item -msoft-float
10424 @opindex msoft-float
10425
10426 Use library routines for floating point operations.
10427
10428 @item -malloc-cc
10429 @opindex malloc-cc
10430
10431 Dynamically allocate condition code registers.
10432
10433 @item -mfixed-cc
10434 @opindex mfixed-cc
10435
10436 Do not try to dynamically allocate condition code registers, only
10437 use @code{icc0} and @code{fcc0}.
10438
10439 @item -mdword
10440 @opindex mdword
10441
10442 Change ABI to use double word insns.
10443
10444 @item -mno-dword
10445 @opindex mno-dword
10446
10447 Do not use double word instructions.
10448
10449 @item -mdouble
10450 @opindex mdouble
10451
10452 Use floating point double instructions.
10453
10454 @item -mno-double
10455 @opindex mno-double
10456
10457 Do not use floating point double instructions.
10458
10459 @item -mmedia
10460 @opindex mmedia
10461
10462 Use media instructions.
10463
10464 @item -mno-media
10465 @opindex mno-media
10466
10467 Do not use media instructions.
10468
10469 @item -mmuladd
10470 @opindex mmuladd
10471
10472 Use multiply and add/subtract instructions.
10473
10474 @item -mno-muladd
10475 @opindex mno-muladd
10476
10477 Do not use multiply and add/subtract instructions.
10478
10479 @item -mlibrary-pic
10480 @opindex mlibrary-pic
10481
10482 Generate position-independent EABI code.
10483
10484 @item -macc-4
10485 @opindex macc-4
10486
10487 Use only the first four media accumulator registers.
10488
10489 @item -macc-8
10490 @opindex macc-8
10491
10492 Use all eight media accumulator registers.
10493
10494 @item -mpack
10495 @opindex mpack
10496
10497 Pack VLIW instructions.
10498
10499 @item -mno-pack
10500 @opindex mno-pack
10501
10502 Do not pack VLIW instructions.
10503
10504 @item -mno-eflags
10505 @opindex mno-eflags
10506
10507 Do not mark ABI switches in e_flags.
10508
10509 @item -mcond-move
10510 @opindex mcond-move
10511
10512 Enable the use of conditional-move instructions (default).
10513
10514 This switch is mainly for debugging the compiler and will likely be removed
10515 in a future version.
10516
10517 @item -mno-cond-move
10518 @opindex mno-cond-move
10519
10520 Disable the use of conditional-move instructions.
10521
10522 This switch is mainly for debugging the compiler and will likely be removed
10523 in a future version.
10524
10525 @item -mscc
10526 @opindex mscc
10527
10528 Enable the use of conditional set instructions (default).
10529
10530 This switch is mainly for debugging the compiler and will likely be removed
10531 in a future version.
10532
10533 @item -mno-scc
10534 @opindex mno-scc
10535
10536 Disable the use of conditional set instructions.
10537
10538 This switch is mainly for debugging the compiler and will likely be removed
10539 in a future version.
10540
10541 @item -mcond-exec
10542 @opindex mcond-exec
10543
10544 Enable the use of conditional execution (default).
10545
10546 This switch is mainly for debugging the compiler and will likely be removed
10547 in a future version.
10548
10549 @item -mno-cond-exec
10550 @opindex mno-cond-exec
10551
10552 Disable the use of conditional execution.
10553
10554 This switch is mainly for debugging the compiler and will likely be removed
10555 in a future version.
10556
10557 @item -mvliw-branch
10558 @opindex mvliw-branch
10559
10560 Run a pass to pack branches into VLIW instructions (default).
10561
10562 This switch is mainly for debugging the compiler and will likely be removed
10563 in a future version.
10564
10565 @item -mno-vliw-branch
10566 @opindex mno-vliw-branch
10567
10568 Do not run a pass to pack branches into VLIW instructions.
10569
10570 This switch is mainly for debugging the compiler and will likely be removed
10571 in a future version.
10572
10573 @item -mmulti-cond-exec
10574 @opindex mmulti-cond-exec
10575
10576 Enable optimization of @code{&&} and @code{||} in conditional execution
10577 (default).
10578
10579 This switch is mainly for debugging the compiler and will likely be removed
10580 in a future version.
10581
10582 @item -mno-multi-cond-exec
10583 @opindex mno-multi-cond-exec
10584
10585 Disable optimization of @code{&&} and @code{||} in conditional execution.
10586
10587 This switch is mainly for debugging the compiler and will likely be removed
10588 in a future version.
10589
10590 @item -mnested-cond-exec
10591 @opindex mnested-cond-exec
10592
10593 Enable nested conditional execution optimizations (default).
10594
10595 This switch is mainly for debugging the compiler and will likely be removed
10596 in a future version.
10597
10598 @item -mno-nested-cond-exec
10599 @opindex mno-nested-cond-exec
10600
10601 Disable nested conditional execution optimizations.
10602
10603 This switch is mainly for debugging the compiler and will likely be removed
10604 in a future version.
10605
10606 @item -mtomcat-stats
10607 @opindex mtomcat-stats
10608
10609 Cause gas to print out tomcat statistics.
10610
10611 @item -mcpu=@var{cpu}
10612 @opindex mcpu
10613
10614 Select the processor type for which to generate code.  Possible values are
10615 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
10616 @samp{frv}.
10617
10618 @end table
10619
10620 @node Xtensa Options
10621 @subsection Xtensa Options
10622 @cindex Xtensa Options
10623
10624 These options are supported for Xtensa targets:
10625
10626 @table @gcctabopt
10627 @item -mconst16
10628 @itemx -mno-const16
10629 @opindex mconst16
10630 @opindex mno-const16
10631 Enable or disable use of @code{CONST16} instructions for loading
10632 constant values.  The @code{CONST16} instruction is currently not a
10633 standard option from Tensilica.  When enabled, @code{CONST16}
10634 instructions are always used in place of the standard @code{L32R}
10635 instructions.  The use of @code{CONST16} is enabled by default only if
10636 the @code{L32R} instruction is not available.
10637
10638 @item -mfused-madd
10639 @itemx -mno-fused-madd
10640 @opindex mfused-madd
10641 @opindex mno-fused-madd
10642 Enable or disable use of fused multiply/add and multiply/subtract
10643 instructions in the floating-point option.  This has no effect if the
10644 floating-point option is not also enabled.  Disabling fused multiply/add
10645 and multiply/subtract instructions forces the compiler to use separate
10646 instructions for the multiply and add/subtract operations.  This may be
10647 desirable in some cases where strict IEEE 754-compliant results are
10648 required: the fused multiply add/subtract instructions do not round the
10649 intermediate result, thereby producing results with @emph{more} bits of
10650 precision than specified by the IEEE standard.  Disabling fused multiply
10651 add/subtract instructions also ensures that the program output is not
10652 sensitive to the compiler's ability to combine multiply and add/subtract
10653 operations.
10654
10655 @item -mtext-section-literals
10656 @itemx -mno-text-section-literals
10657 @opindex mtext-section-literals
10658 @opindex mno-text-section-literals
10659 Control the treatment of literal pools.  The default is
10660 @option{-mno-text-section-literals}, which places literals in a separate
10661 section in the output file.  This allows the literal pool to be placed
10662 in a data RAM/ROM, and it also allows the linker to combine literal
10663 pools from separate object files to remove redundant literals and
10664 improve code size.  With @option{-mtext-section-literals}, the literals
10665 are interspersed in the text section in order to keep them as close as
10666 possible to their references.  This may be necessary for large assembly
10667 files.
10668
10669 @item -mtarget-align
10670 @itemx -mno-target-align
10671 @opindex mtarget-align
10672 @opindex mno-target-align
10673 When this option is enabled, GCC instructs the assembler to
10674 automatically align instructions to reduce branch penalties at the
10675 expense of some code density.  The assembler attempts to widen density
10676 instructions to align branch targets and the instructions following call
10677 instructions.  If there are not enough preceding safe density
10678 instructions to align a target, no widening will be performed.  The
10679 default is @option{-mtarget-align}.  These options do not affect the
10680 treatment of auto-aligned instructions like @code{LOOP}, which the
10681 assembler will always align, either by widening density instructions or
10682 by inserting no-op instructions.
10683
10684 @item -mlongcalls
10685 @itemx -mno-longcalls
10686 @opindex mlongcalls
10687 @opindex mno-longcalls
10688 When this option is enabled, GCC instructs the assembler to translate
10689 direct calls to indirect calls unless it can determine that the target
10690 of a direct call is in the range allowed by the call instruction.  This
10691 translation typically occurs for calls to functions in other source
10692 files.  Specifically, the assembler translates a direct @code{CALL}
10693 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
10694 The default is @option{-mno-longcalls}.  This option should be used in
10695 programs where the call target can potentially be out of range.  This
10696 option is implemented in the assembler, not the compiler, so the
10697 assembly code generated by GCC will still show direct call
10698 instructions---look at the disassembled object code to see the actual
10699 instructions.  Note that the assembler will use an indirect call for
10700 every cross-file call, not just those that really will be out of range.
10701 @end table
10702
10703 @node Code Gen Options
10704 @section Options for Code Generation Conventions
10705 @cindex code generation conventions
10706 @cindex options, code generation
10707 @cindex run-time options
10708
10709 These machine-independent options control the interface conventions
10710 used in code generation.
10711
10712 Most of them have both positive and negative forms; the negative form
10713 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
10714 one of the forms is listed---the one which is not the default.  You
10715 can figure out the other form by either removing @samp{no-} or adding
10716 it.
10717
10718 @table @gcctabopt
10719 @item -fbounds-check
10720 @opindex fbounds-check
10721 For front-ends that support it, generate additional code to check that
10722 indices used to access arrays are within the declared range.  This is
10723 currently only supported by the Java and Fortran 77 front-ends, where
10724 this option defaults to true and false respectively.
10725
10726 @item -ftrapv
10727 @opindex ftrapv
10728 This option generates traps for signed overflow on addition, subtraction,
10729 multiplication operations.
10730
10731 @item -fwrapv
10732 @opindex fwrapv
10733 This option instructs the compiler to assume that signed arithmetic
10734 overflow of addition, subtraction and multiplication wraps around
10735 using twos-complement representation.  This flag enables some optimizations
10736 and disables other.  This option is enabled by default for the Java
10737 front-end, as required by the Java language specification.
10738
10739 @item -fexceptions
10740 @opindex fexceptions
10741 Enable exception handling.  Generates extra code needed to propagate
10742 exceptions.  For some targets, this implies GCC will generate frame
10743 unwind information for all functions, which can produce significant data
10744 size overhead, although it does not affect execution.  If you do not
10745 specify this option, GCC will enable it by default for languages like
10746 C++ which normally require exception handling, and disable it for
10747 languages like C that do not normally require it.  However, you may need
10748 to enable this option when compiling C code that needs to interoperate
10749 properly with exception handlers written in C++.  You may also wish to
10750 disable this option if you are compiling older C++ programs that don't
10751 use exception handling.
10752
10753 @item -fnon-call-exceptions
10754 @opindex fnon-call-exceptions
10755 Generate code that allows trapping instructions to throw exceptions.
10756 Note that this requires platform-specific runtime support that does
10757 not exist everywhere.  Moreover, it only allows @emph{trapping}
10758 instructions to throw exceptions, i.e.@: memory references or floating
10759 point instructions.  It does not allow exceptions to be thrown from
10760 arbitrary signal handlers such as @code{SIGALRM}.
10761
10762 @item -funwind-tables
10763 @opindex funwind-tables
10764 Similar to @option{-fexceptions}, except that it will just generate any needed
10765 static data, but will not affect the generated code in any other way.
10766 You will normally not enable this option; instead, a language processor
10767 that needs this handling would enable it on your behalf.
10768
10769 @item -fasynchronous-unwind-tables
10770 @opindex funwind-tables
10771 Generate unwind table in dwarf2 format, if supported by target machine.  The
10772 table is exact at each instruction boundary, so it can be used for stack
10773 unwinding from asynchronous events (such as debugger or garbage collector).
10774
10775 @item -fpcc-struct-return
10776 @opindex fpcc-struct-return
10777 Return ``short'' @code{struct} and @code{union} values in memory like
10778 longer ones, rather than in registers.  This convention is less
10779 efficient, but it has the advantage of allowing intercallability between
10780 GCC-compiled files and files compiled with other compilers, particularly
10781 the Portable C Compiler (pcc).
10782
10783 The precise convention for returning structures in memory depends
10784 on the target configuration macros.
10785
10786 Short structures and unions are those whose size and alignment match
10787 that of some integer type.
10788
10789 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
10790 switch is not binary compatible with code compiled with the
10791 @option{-freg-struct-return} switch.
10792 Use it to conform to a non-default application binary interface.
10793
10794 @item -freg-struct-return
10795 @opindex freg-struct-return
10796 Return @code{struct} and @code{union} values in registers when possible.
10797 This is more efficient for small structures than
10798 @option{-fpcc-struct-return}.
10799
10800 If you specify neither @option{-fpcc-struct-return} nor
10801 @option{-freg-struct-return}, GCC defaults to whichever convention is
10802 standard for the target.  If there is no standard convention, GCC
10803 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
10804 the principal compiler.  In those cases, we can choose the standard, and
10805 we chose the more efficient register return alternative.
10806
10807 @strong{Warning:} code compiled with the @option{-freg-struct-return}
10808 switch is not binary compatible with code compiled with the
10809 @option{-fpcc-struct-return} switch.
10810 Use it to conform to a non-default application binary interface.
10811
10812 @item -fshort-enums
10813 @opindex fshort-enums
10814 Allocate to an @code{enum} type only as many bytes as it needs for the
10815 declared range of possible values.  Specifically, the @code{enum} type
10816 will be equivalent to the smallest integer type which has enough room.
10817
10818 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
10819 code that is not binary compatible with code generated without that switch.
10820 Use it to conform to a non-default application binary interface.
10821
10822 @item -fshort-double
10823 @opindex fshort-double
10824 Use the same size for @code{double} as for @code{float}.
10825
10826 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
10827 code that is not binary compatible with code generated without that switch.
10828 Use it to conform to a non-default application binary interface.
10829
10830 @item -fshort-wchar
10831 @opindex fshort-wchar
10832 Override the underlying type for @samp{wchar_t} to be @samp{short
10833 unsigned int} instead of the default for the target.  This option is
10834 useful for building programs to run under WINE@.
10835
10836 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
10837 code that is not binary compatible with code generated without that switch.
10838 Use it to conform to a non-default application binary interface.
10839
10840 @item -fshared-data
10841 @opindex fshared-data
10842 Requests that the data and non-@code{const} variables of this
10843 compilation be shared data rather than private data.  The distinction
10844 makes sense only on certain operating systems, where shared data is
10845 shared between processes running the same program, while private data
10846 exists in one copy per process.
10847
10848 @item -fno-common
10849 @opindex fno-common
10850 In C, allocate even uninitialized global variables in the data section of the
10851 object file, rather than generating them as common blocks.  This has the
10852 effect that if the same variable is declared (without @code{extern}) in
10853 two different compilations, you will get an error when you link them.
10854 The only reason this might be useful is if you wish to verify that the
10855 program will work on other systems which always work this way.
10856
10857 @item -fno-ident
10858 @opindex fno-ident
10859 Ignore the @samp{#ident} directive.
10860
10861 @item -finhibit-size-directive
10862 @opindex finhibit-size-directive
10863 Don't output a @code{.size} assembler directive, or anything else that
10864 would cause trouble if the function is split in the middle, and the
10865 two halves are placed at locations far apart in memory.  This option is
10866 used when compiling @file{crtstuff.c}; you should not need to use it
10867 for anything else.
10868
10869 @item -fverbose-asm
10870 @opindex fverbose-asm
10871 Put extra commentary information in the generated assembly code to
10872 make it more readable.  This option is generally only of use to those
10873 who actually need to read the generated assembly code (perhaps while
10874 debugging the compiler itself).
10875
10876 @option{-fno-verbose-asm}, the default, causes the
10877 extra information to be omitted and is useful when comparing two assembler
10878 files.
10879
10880 @item -fpic
10881 @opindex fpic
10882 @cindex global offset table
10883 @cindex PIC
10884 Generate position-independent code (PIC) suitable for use in a shared
10885 library, if supported for the target machine.  Such code accesses all
10886 constant addresses through a global offset table (GOT)@.  The dynamic
10887 loader resolves the GOT entries when the program starts (the dynamic
10888 loader is not part of GCC; it is part of the operating system).  If
10889 the GOT size for the linked executable exceeds a machine-specific
10890 maximum size, you get an error message from the linker indicating that
10891 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
10892 instead.  (These maximums are 8k on the SPARC and 32k
10893 on the m68k and RS/6000.  The 386 has no such limit.)
10894
10895 Position-independent code requires special support, and therefore works
10896 only on certain machines.  For the 386, GCC supports PIC for System V
10897 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
10898 position-independent.
10899
10900 @item -fPIC
10901 @opindex fPIC
10902 If supported for the target machine, emit position-independent code,
10903 suitable for dynamic linking and avoiding any limit on the size of the
10904 global offset table.  This option makes a difference on the m68k
10905 and the SPARC.
10906
10907 Position-independent code requires special support, and therefore works
10908 only on certain machines.
10909
10910 @item -fpie
10911 @itemx -fPIE
10912 @opindex fpie
10913 @opindex fPIE
10914 These options are similar to @option{-fpic} and @option{-fPIC}, but
10915 generated position independent code can be only linked into executables.
10916 Usually these options are used when @option{-pie} GCC option will be
10917 used during linking.
10918
10919 @item -ffixed-@var{reg}
10920 @opindex ffixed
10921 Treat the register named @var{reg} as a fixed register; generated code
10922 should never refer to it (except perhaps as a stack pointer, frame
10923 pointer or in some other fixed role).
10924
10925 @var{reg} must be the name of a register.  The register names accepted
10926 are machine-specific and are defined in the @code{REGISTER_NAMES}
10927 macro in the machine description macro file.
10928
10929 This flag does not have a negative form, because it specifies a
10930 three-way choice.
10931
10932 @item -fcall-used-@var{reg}
10933 @opindex fcall-used
10934 Treat the register named @var{reg} as an allocable register that is
10935 clobbered by function calls.  It may be allocated for temporaries or
10936 variables that do not live across a call.  Functions compiled this way
10937 will not save and restore the register @var{reg}.
10938
10939 It is an error to used this flag with the frame pointer or stack pointer.
10940 Use of this flag for other registers that have fixed pervasive roles in
10941 the machine's execution model will produce disastrous results.
10942
10943 This flag does not have a negative form, because it specifies a
10944 three-way choice.
10945
10946 @item -fcall-saved-@var{reg}
10947 @opindex fcall-saved
10948 Treat the register named @var{reg} as an allocable register saved by
10949 functions.  It may be allocated even for temporaries or variables that
10950 live across a call.  Functions compiled this way will save and restore
10951 the register @var{reg} if they use it.
10952
10953 It is an error to used this flag with the frame pointer or stack pointer.
10954 Use of this flag for other registers that have fixed pervasive roles in
10955 the machine's execution model will produce disastrous results.
10956
10957 A different sort of disaster will result from the use of this flag for
10958 a register in which function values may be returned.
10959
10960 This flag does not have a negative form, because it specifies a
10961 three-way choice.
10962
10963 @item -fpack-struct
10964 @opindex fpack-struct
10965 Pack all structure members together without holes.
10966
10967 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
10968 code that is not binary compatible with code generated without that switch.
10969 Additionally, it makes the code suboptimal.
10970 Use it to conform to a non-default application binary interface.
10971
10972 @item -finstrument-functions
10973 @opindex finstrument-functions
10974 Generate instrumentation calls for entry and exit to functions.  Just
10975 after function entry and just before function exit, the following
10976 profiling functions will be called with the address of the current
10977 function and its call site.  (On some platforms,
10978 @code{__builtin_return_address} does not work beyond the current
10979 function, so the call site information may not be available to the
10980 profiling functions otherwise.)
10981
10982 @smallexample
10983 void __cyg_profile_func_enter (void *this_fn,
10984                                void *call_site);
10985 void __cyg_profile_func_exit  (void *this_fn,
10986                                void *call_site);
10987 @end smallexample
10988
10989 The first argument is the address of the start of the current function,
10990 which may be looked up exactly in the symbol table.
10991
10992 This instrumentation is also done for functions expanded inline in other
10993 functions.  The profiling calls will indicate where, conceptually, the
10994 inline function is entered and exited.  This means that addressable
10995 versions of such functions must be available.  If all your uses of a
10996 function are expanded inline, this may mean an additional expansion of
10997 code size.  If you use @samp{extern inline} in your C code, an
10998 addressable version of such functions must be provided.  (This is
10999 normally the case anyways, but if you get lucky and the optimizer always
11000 expands the functions inline, you might have gotten away without
11001 providing static copies.)
11002
11003 A function may be given the attribute @code{no_instrument_function}, in
11004 which case this instrumentation will not be done.  This can be used, for
11005 example, for the profiling functions listed above, high-priority
11006 interrupt routines, and any functions from which the profiling functions
11007 cannot safely be called (perhaps signal handlers, if the profiling
11008 routines generate output or allocate memory).
11009
11010 @item -fstack-check
11011 @opindex fstack-check
11012 Generate code to verify that you do not go beyond the boundary of the
11013 stack.  You should specify this flag if you are running in an
11014 environment with multiple threads, but only rarely need to specify it in
11015 a single-threaded environment since stack overflow is automatically
11016 detected on nearly all systems if there is only one stack.
11017
11018 Note that this switch does not actually cause checking to be done; the
11019 operating system must do that.  The switch causes generation of code
11020 to ensure that the operating system sees the stack being extended.
11021
11022 @item -fstack-limit-register=@var{reg}
11023 @itemx -fstack-limit-symbol=@var{sym}
11024 @itemx -fno-stack-limit
11025 @opindex fstack-limit-register
11026 @opindex fstack-limit-symbol
11027 @opindex fno-stack-limit
11028 Generate code to ensure that the stack does not grow beyond a certain value,
11029 either the value of a register or the address of a symbol.  If the stack
11030 would grow beyond the value, a signal is raised.  For most targets,
11031 the signal is raised before the stack overruns the boundary, so
11032 it is possible to catch the signal without taking special precautions.
11033
11034 For instance, if the stack starts at absolute address @samp{0x80000000}
11035 and grows downwards, you can use the flags
11036 @option{-fstack-limit-symbol=__stack_limit} and
11037 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11038 of 128KB@.  Note that this may only work with the GNU linker.
11039
11040 @cindex aliasing of parameters
11041 @cindex parameters, aliased
11042 @item -fargument-alias
11043 @itemx -fargument-noalias
11044 @itemx -fargument-noalias-global
11045 @opindex fargument-alias
11046 @opindex fargument-noalias
11047 @opindex fargument-noalias-global
11048 Specify the possible relationships among parameters and between
11049 parameters and global data.
11050
11051 @option{-fargument-alias} specifies that arguments (parameters) may
11052 alias each other and may alias global storage.@*
11053 @option{-fargument-noalias} specifies that arguments do not alias
11054 each other, but may alias global storage.@*
11055 @option{-fargument-noalias-global} specifies that arguments do not
11056 alias each other and do not alias global storage.
11057
11058 Each language will automatically use whatever option is required by
11059 the language standard.  You should not need to use these options yourself.
11060
11061 @item -fleading-underscore
11062 @opindex fleading-underscore
11063 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11064 change the way C symbols are represented in the object file.  One use
11065 is to help link with legacy assembly code.
11066
11067 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11068 generate code that is not binary compatible with code generated without that
11069 switch.  Use it to conform to a non-default application binary interface.
11070 Not all targets provide complete support for this switch.
11071
11072 @item -ftls-model=@var{model}
11073 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11074 The @var{model} argument should be one of @code{global-dynamic},
11075 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11076
11077 The default without @option{-fpic} is @code{initial-exec}; with
11078 @option{-fpic} the default is @code{global-dynamic}.
11079 @end table
11080
11081 @c man end
11082
11083 @node Environment Variables
11084 @section Environment Variables Affecting GCC
11085 @cindex environment variables
11086
11087 @c man begin ENVIRONMENT
11088 This section describes several environment variables that affect how GCC
11089 operates.  Some of them work by specifying directories or prefixes to use
11090 when searching for various kinds of files.  Some are used to specify other
11091 aspects of the compilation environment.
11092
11093 Note that you can also specify places to search using options such as
11094 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
11095 take precedence over places specified using environment variables, which
11096 in turn take precedence over those specified by the configuration of GCC@.
11097 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11098 GNU Compiler Collection (GCC) Internals}.
11099
11100 @table @env
11101 @item LANG
11102 @itemx LC_CTYPE
11103 @c @itemx LC_COLLATE
11104 @itemx LC_MESSAGES
11105 @c @itemx LC_MONETARY
11106 @c @itemx LC_NUMERIC
11107 @c @itemx LC_TIME
11108 @itemx LC_ALL
11109 @findex LANG
11110 @findex LC_CTYPE
11111 @c @findex LC_COLLATE
11112 @findex LC_MESSAGES
11113 @c @findex LC_MONETARY
11114 @c @findex LC_NUMERIC
11115 @c @findex LC_TIME
11116 @findex LC_ALL
11117 @cindex locale
11118 These environment variables control the way that GCC uses
11119 localization information that allow GCC to work with different
11120 national conventions.  GCC inspects the locale categories
11121 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
11122 so.  These locale categories can be set to any value supported by your
11123 installation.  A typical value is @samp{en_UK} for English in the United
11124 Kingdom.
11125
11126 The @env{LC_CTYPE} environment variable specifies character
11127 classification.  GCC uses it to determine the character boundaries in
11128 a string; this is needed for some multibyte encodings that contain quote
11129 and escape characters that would otherwise be interpreted as a string
11130 end or escape.
11131
11132 The @env{LC_MESSAGES} environment variable specifies the language to
11133 use in diagnostic messages.
11134
11135 If the @env{LC_ALL} environment variable is set, it overrides the value
11136 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11137 and @env{LC_MESSAGES} default to the value of the @env{LANG}
11138 environment variable.  If none of these variables are set, GCC
11139 defaults to traditional C English behavior.
11140
11141 @item TMPDIR
11142 @findex TMPDIR
11143 If @env{TMPDIR} is set, it specifies the directory to use for temporary
11144 files.  GCC uses temporary files to hold the output of one stage of
11145 compilation which is to be used as input to the next stage: for example,
11146 the output of the preprocessor, which is the input to the compiler
11147 proper.
11148
11149 @item GCC_EXEC_PREFIX
11150 @findex GCC_EXEC_PREFIX
11151 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
11152 names of the subprograms executed by the compiler.  No slash is added
11153 when this prefix is combined with the name of a subprogram, but you can
11154 specify a prefix that ends with a slash if you wish.
11155
11156 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
11157 an appropriate prefix to use based on the pathname it was invoked with.
11158
11159 If GCC cannot find the subprogram using the specified prefix, it
11160 tries looking in the usual places for the subprogram.
11161
11162 The default value of @env{GCC_EXEC_PREFIX} is
11163 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
11164 of @code{prefix} when you ran the @file{configure} script.
11165
11166 Other prefixes specified with @option{-B} take precedence over this prefix.
11167
11168 This prefix is also used for finding files such as @file{crt0.o} that are
11169 used for linking.
11170
11171 In addition, the prefix is used in an unusual way in finding the
11172 directories to search for header files.  For each of the standard
11173 directories whose name normally begins with @samp{/usr/local/lib/gcc}
11174 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
11175 replacing that beginning with the specified prefix to produce an
11176 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
11177 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
11178 These alternate directories are searched first; the standard directories
11179 come next.
11180
11181 @item COMPILER_PATH
11182 @findex COMPILER_PATH
11183 The value of @env{COMPILER_PATH} is a colon-separated list of
11184 directories, much like @env{PATH}.  GCC tries the directories thus
11185 specified when searching for subprograms, if it can't find the
11186 subprograms using @env{GCC_EXEC_PREFIX}.
11187
11188 @item LIBRARY_PATH
11189 @findex LIBRARY_PATH
11190 The value of @env{LIBRARY_PATH} is a colon-separated list of
11191 directories, much like @env{PATH}.  When configured as a native compiler,
11192 GCC tries the directories thus specified when searching for special
11193 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
11194 using GCC also uses these directories when searching for ordinary
11195 libraries for the @option{-l} option (but directories specified with
11196 @option{-L} come first).
11197
11198 @item LANG
11199 @findex LANG
11200 @cindex locale definition
11201 This variable is used to pass locale information to the compiler.  One way in
11202 which this information is used is to determine the character set to be used
11203 when character literals, string literals and comments are parsed in C and C++.
11204 When the compiler is configured to allow multibyte characters,
11205 the following values for @env{LANG} are recognized:
11206
11207 @table @samp
11208 @item C-JIS
11209 Recognize JIS characters.
11210 @item C-SJIS
11211 Recognize SJIS characters.
11212 @item C-EUCJP
11213 Recognize EUCJP characters.
11214 @end table
11215
11216 If @env{LANG} is not defined, or if it has some other value, then the
11217 compiler will use mblen and mbtowc as defined by the default locale to
11218 recognize and translate multibyte characters.
11219 @end table
11220
11221 @noindent
11222 Some additional environments variables affect the behavior of the
11223 preprocessor.
11224
11225 @include cppenv.texi
11226
11227 @c man end
11228
11229 @node Precompiled Headers
11230 @section Using Precompiled Headers
11231 @cindex precompiled headers
11232 @cindex speed of compilation
11233
11234 Often large projects have many header files that are included in every
11235 source file.  The time the compiler takes to process these header files
11236 over and over again can account for nearly all of the time required to
11237 build the project.  To make builds faster, GCC allows users to
11238 `precompile' a header file; then, if builds can use the precompiled
11239 header file they will be much faster.
11240
11241 To create a precompiled header file, simply compile it as you would any
11242 other file, if necessary using the @option{-x} option to make the driver
11243 treat it as a C or C++ header file.  You will probably want to use a
11244 tool like @command{make} to keep the precompiled header up-to-date when
11245 the headers it contains change.
11246
11247 A precompiled header file will be searched for when @code{#include} is
11248 seen in the compilation.  As it searches for the included file
11249 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
11250 compiler looks for a precompiled header in each directory just before it
11251 looks for the include file in that directory.  The name searched for is
11252 the name specified in the @code{#include} with @samp{.gch} appended.  If
11253 the precompiled header file can't be used, it is ignored.
11254
11255 For instance, if you have @code{#include "all.h"}, and you have
11256 @file{all.h.gch} in the same directory as @file{all.h}, then the
11257 precompiled header file will be used if possible, and the original
11258 header will be used otherwise.
11259
11260 Alternatively, you might decide to put the precompiled header file in a
11261 directory and use @option{-I} to ensure that directory is searched
11262 before (or instead of) the directory containing the original header.
11263 Then, if you want to check that the precompiled header file is always
11264 used, you can put a file of the same name as the original header in this
11265 directory containing an @code{#error} command.
11266
11267 This also works with @option{-include}.  So yet another way to use
11268 precompiled headers, good for projects not designed with precompiled
11269 header files in mind, is to simply take most of the header files used by
11270 a project, include them from another header file, precompile that header
11271 file, and @option{-include} the precompiled header.  If the header files
11272 have guards against multiple inclusion, they will be skipped because
11273 they've already been included (in the precompiled header).
11274
11275 If you need to precompile the same header file for different
11276 languages, targets, or compiler options, you can instead make a
11277 @emph{directory} named like @file{all.h.gch}, and put each precompiled
11278 header in the directory.  (It doesn't matter what you call the files
11279 in the directory, every precompiled header in the directory will be
11280 considered.)  The first precompiled header encountered in the
11281 directory that is valid for this compilation will be used; they're
11282 searched in no particular order.
11283
11284 There are many other possibilities, limited only by your imagination,
11285 good sense, and the constraints of your build system.
11286
11287 A precompiled header file can be used only when these conditions apply:
11288
11289 @itemize
11290 @item
11291 Only one precompiled header can be used in a particular compilation.
11292 @item
11293 A precompiled header can't be used once the first C token is seen.  You
11294 can have preprocessor directives before a precompiled header; you can
11295 even include a precompiled header from inside another header, so long as
11296 there are no C tokens before the @code{#include}.
11297 @item
11298 The precompiled header file must be produced for the same language as
11299 the current compilation.  You can't use a C precompiled header for a C++
11300 compilation.
11301 @item
11302 The precompiled header file must be produced by the same compiler
11303 version and configuration as the current compilation is using.
11304 The easiest way to guarantee this is to use the same compiler binary
11305 for creating and using precompiled headers.
11306 @item
11307 Any macros defined before the precompiled header (including with
11308 @option{-D}) must either be defined in the same way as when the
11309 precompiled header was generated, or must not affect the precompiled
11310 header, which usually means that the they don't appear in the
11311 precompiled header at all.
11312 @item
11313 Certain command-line options must be defined in the same way as when the
11314 precompiled header was generated.  At present, it's not clear which
11315 options are safe to change and which are not; the safest choice is to
11316 use exactly the same options when generating and using the precompiled
11317 header.
11318 @end itemize
11319
11320 For all of these but the last, the compiler will automatically ignore
11321 the precompiled header if the conditions aren't met.  For the last item,
11322 some option changes will cause the precompiled header to be rejected,
11323 but not all incompatible option combinations have yet been found.  If
11324 you find a new incompatible combination, please consider filing a bug
11325 report, see @ref{Bugs}.
11326
11327 @node Running Protoize
11328 @section Running Protoize
11329
11330 The program @code{protoize} is an optional part of GCC@.  You can use
11331 it to add prototypes to a program, thus converting the program to ISO
11332 C in one respect.  The companion program @code{unprotoize} does the
11333 reverse: it removes argument types from any prototypes that are found.
11334
11335 When you run these programs, you must specify a set of source files as
11336 command line arguments.  The conversion programs start out by compiling
11337 these files to see what functions they define.  The information gathered
11338 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
11339
11340 After scanning comes actual conversion.  The specified files are all
11341 eligible to be converted; any files they include (whether sources or
11342 just headers) are eligible as well.
11343
11344 But not all the eligible files are converted.  By default,
11345 @code{protoize} and @code{unprotoize} convert only source and header
11346 files in the current directory.  You can specify additional directories
11347 whose files should be converted with the @option{-d @var{directory}}
11348 option.  You can also specify particular files to exclude with the
11349 @option{-x @var{file}} option.  A file is converted if it is eligible, its
11350 directory name matches one of the specified directory names, and its
11351 name within the directory has not been excluded.
11352
11353 Basic conversion with @code{protoize} consists of rewriting most
11354 function definitions and function declarations to specify the types of
11355 the arguments.  The only ones not rewritten are those for varargs
11356 functions.
11357
11358 @code{protoize} optionally inserts prototype declarations at the
11359 beginning of the source file, to make them available for any calls that
11360 precede the function's definition.  Or it can insert prototype
11361 declarations with block scope in the blocks where undeclared functions
11362 are called.
11363
11364 Basic conversion with @code{unprotoize} consists of rewriting most
11365 function declarations to remove any argument types, and rewriting
11366 function definitions to the old-style pre-ISO form.
11367
11368 Both conversion programs print a warning for any function declaration or
11369 definition that they can't convert.  You can suppress these warnings
11370 with @option{-q}.
11371
11372 The output from @code{protoize} or @code{unprotoize} replaces the
11373 original source file.  The original file is renamed to a name ending
11374 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
11375 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
11376 for DOS) file already exists, then the source file is simply discarded.
11377
11378 @code{protoize} and @code{unprotoize} both depend on GCC itself to
11379 scan the program and collect information about the functions it uses.
11380 So neither of these programs will work until GCC is installed.
11381
11382 Here is a table of the options you can use with @code{protoize} and
11383 @code{unprotoize}.  Each option works with both programs unless
11384 otherwise stated.
11385
11386 @table @code
11387 @item -B @var{directory}
11388 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
11389 usual directory (normally @file{/usr/local/lib}).  This file contains
11390 prototype information about standard system functions.  This option
11391 applies only to @code{protoize}.
11392
11393 @item -c @var{compilation-options}
11394 Use @var{compilation-options} as the options when running @command{gcc} to
11395 produce the @samp{.X} files.  The special option @option{-aux-info} is
11396 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
11397
11398 Note that the compilation options must be given as a single argument to
11399 @code{protoize} or @code{unprotoize}.  If you want to specify several
11400 @command{gcc} options, you must quote the entire set of compilation options
11401 to make them a single word in the shell.
11402
11403 There are certain @command{gcc} arguments that you cannot use, because they
11404 would produce the wrong kind of output.  These include @option{-g},
11405 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
11406 the @var{compilation-options}, they are ignored.
11407
11408 @item -C
11409 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
11410 systems) instead of @samp{.c}.  This is convenient if you are converting
11411 a C program to C++.  This option applies only to @code{protoize}.
11412
11413 @item -g
11414 Add explicit global declarations.  This means inserting explicit
11415 declarations at the beginning of each source file for each function
11416 that is called in the file and was not declared.  These declarations
11417 precede the first function definition that contains a call to an
11418 undeclared function.  This option applies only to @code{protoize}.
11419
11420 @item -i @var{string}
11421 Indent old-style parameter declarations with the string @var{string}.
11422 This option applies only to @code{protoize}.
11423
11424 @code{unprotoize} converts prototyped function definitions to old-style
11425 function definitions, where the arguments are declared between the
11426 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
11427 uses five spaces as the indentation.  If you want to indent with just
11428 one space instead, use @option{-i " "}.
11429
11430 @item -k
11431 Keep the @samp{.X} files.  Normally, they are deleted after conversion
11432 is finished.
11433
11434 @item -l
11435 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
11436 a prototype declaration for each function in each block which calls the
11437 function without any declaration.  This option applies only to
11438 @code{protoize}.
11439
11440 @item -n
11441 Make no real changes.  This mode just prints information about the conversions
11442 that would have been done without @option{-n}.
11443
11444 @item -N
11445 Make no @samp{.save} files.  The original files are simply deleted.
11446 Use this option with caution.
11447
11448 @item -p @var{program}
11449 Use the program @var{program} as the compiler.  Normally, the name
11450 @file{gcc} is used.
11451
11452 @item -q
11453 Work quietly.  Most warnings are suppressed.
11454
11455 @item -v
11456 Print the version number, just like @option{-v} for @command{gcc}.
11457 @end table
11458
11459 If you need special compiler options to compile one of your program's
11460 source files, then you should generate that file's @samp{.X} file
11461 specially, by running @command{gcc} on that source file with the
11462 appropriate options and the option @option{-aux-info}.  Then run
11463 @code{protoize} on the entire set of files.  @code{protoize} will use
11464 the existing @samp{.X} file because it is newer than the source file.
11465 For example:
11466
11467 @smallexample
11468 gcc -Dfoo=bar file1.c -aux-info file1.X
11469 protoize *.c
11470 @end smallexample
11471
11472 @noindent
11473 You need to include the special files along with the rest in the
11474 @code{protoize} command, even though their @samp{.X} files already
11475 exist, because otherwise they won't get converted.
11476
11477 @xref{Protoize Caveats}, for more information on how to use
11478 @code{protoize} successfully.