OSDN Git Service

adf156f89e32ec9427f7e3d4ab7c5cd65a17930a
[pf3gnuchains/gcc-fork.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
9 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
10
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.2 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being ``GNU General Public License'' and ``Funding
15 Free Software'', the Front-Cover texts being (a) (see below), and with
16 the Back-Cover Texts being (b) (see below).  A copy of the license is
17 included in the gfdl(7) man page.
18
19 (a) The FSF's Front-Cover Text is:
20
21      A GNU Manual
22
23 (b) The FSF's Back-Cover Text is:
24
25      You have freedom to copy and modify this GNU Manual, like GNU
26      software.  Copies published by the Free Software Foundation raise
27      funds for GNU development.
28 @c man end
29 @c Set file name and title for the man page.
30 @setfilename gcc
31 @settitle GNU project C and C++ compiler
32 @c man begin SYNOPSIS
33 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39     [@option{-o} @var{outfile}] @var{infile}@dots{}
40
41 Only the most useful options are listed here; see below for the
42 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
43 @c man end
44 @c man begin SEEALSO
45 gpl(7), gfdl(7), fsf-funding(7),
46 cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47 and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
48 @file{ld}, @file{binutils} and @file{gdb}.
49 @c man end
50 @c man begin BUGS
51 For instructions on reporting bugs, see
52 @w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
53 script to report bugs is recommended.
54 @c man end
55 @c man begin AUTHOR
56 See the Info entry for @command{gcc}, or
57 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58 for contributors to GCC@.
59 @c man end
60 @end ignore
61
62 @node Invoking GCC
63 @chapter GCC Command Options
64 @cindex GCC command options
65 @cindex command options
66 @cindex options, GCC command
67
68 @c man begin DESCRIPTION
69 When you invoke GCC, it normally does preprocessing, compilation,
70 assembly and linking.  The ``overall options'' allow you to stop this
71 process at an intermediate stage.  For example, the @option{-c} option
72 says not to run the linker.  Then the output consists of object files
73 output by the assembler.
74
75 Other options are passed on to one stage of processing.  Some options
76 control the preprocessor and others the compiler itself.  Yet other
77 options control the assembler and linker; most of these are not
78 documented here, since you rarely need to use any of them.
79
80 @cindex C compilation options
81 Most of the command line options that you can use with GCC are useful
82 for C programs; when an option is only useful with another language
83 (usually C++), the explanation says so explicitly.  If the description
84 for a particular option does not mention a source language, you can use
85 that option with all supported languages.
86
87 @cindex C++ compilation options
88 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
89 options for compiling C++ programs.
90
91 @cindex grouping options
92 @cindex options, grouping
93 The @command{gcc} program accepts options and file names as operands.  Many
94 options have multi-letter names; therefore multiple single-letter options
95 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
96 -r}}.
97
98 @cindex order of options
99 @cindex options, order
100 You can mix options and other arguments.  For the most part, the order
101 you use doesn't matter.  Order does matter when you use several options
102 of the same kind; for example, if you specify @option{-L} more than once,
103 the directories are searched in the order specified.
104
105 Many options have long names starting with @samp{-f} or with
106 @samp{-W}---for example, @option{-fforce-mem},
107 @option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
108 these have both positive and negative forms; the negative form of
109 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
110 only one of these two forms, whichever one is not the default.
111
112 @c man end
113
114 @xref{Option Index}, for an index to GCC's options.
115
116 @menu
117 * Option Summary::      Brief list of all options, without explanations.
118 * Overall Options::     Controlling the kind of output:
119                         an executable, object files, assembler files,
120                         or preprocessed source.
121 * Invoking G++::        Compiling C++ programs.
122 * C Dialect Options::   Controlling the variant of C language compiled.
123 * C++ Dialect Options:: Variations on C++.
124 * Objective-C Dialect Options:: Variations on Objective-C.
125 * Language Independent Options:: Controlling how diagnostics should be
126                         formatted.
127 * Warning Options::     How picky should the compiler be?
128 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
129 * Optimize Options::    How much optimization?
130 * Preprocessor Options:: Controlling header files and macro definitions.
131                          Also, getting dependency information for Make.
132 * Assembler Options::   Passing options to the assembler.
133 * Link Options::        Specifying libraries and so on.
134 * Directory Options::   Where to find header files and libraries.
135                         Where to find the compiler executable files.
136 * Spec Files::          How to pass switches to sub-processes.
137 * Target Options::      Running a cross-compiler, or an old version of GCC.
138 * Submodel Options::    Specifying minor hardware or convention variations,
139                         such as 68010 vs 68020.
140 * Code Gen Options::    Specifying conventions for function calls, data layout
141                         and register usage.
142 * Environment Variables:: Env vars that affect GCC.
143 * Precompiled Headers:: Compiling a header once, and using it many times.
144 * Running Protoize::    Automatically adding or removing function prototypes.
145 @end menu
146
147 @c man begin OPTIONS
148
149 @node Option Summary
150 @section Option Summary
151
152 Here is a summary of all the options, grouped by type.  Explanations are
153 in the following sections.
154
155 @table @emph
156 @item Overall Options
157 @xref{Overall Options,,Options Controlling the Kind of Output}.
158 @gccoptlist{-c  -S  -E  -o @var{file}  -pipe  -pass-exit-codes  @gol
159 -x @var{language}  -v  -###  --help  --target-help  --version}
160
161 @item C Language Options
162 @xref{C Dialect Options,,Options Controlling C Dialect}.
163 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
164 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
165 -fhosted  -ffreestanding  -fms-extensions @gol
166 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
167 -fallow-single-precision  -fcond-mismatch @gol
168 -fsigned-bitfields  -fsigned-char @gol
169 -funsigned-bitfields  -funsigned-char @gol
170 -fwritable-strings}
171
172 @item C++ Language Options
173 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
174 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
175 -fconserve-space  -fno-const-strings @gol
176 -fno-elide-constructors @gol
177 -fno-enforce-eh-specs @gol
178 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
179 -fno-implicit-templates @gol
180 -fno-implicit-inline-templates @gol
181 -fno-implement-inlines  -fms-extensions @gol
182 -fno-nonansi-builtins  -fno-operator-names @gol
183 -fno-optional-diags  -fpermissive @gol
184 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
185 -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
186 -fno-default-inline  -Wabi  -Wctor-dtor-privacy @gol
187 -Wnon-virtual-dtor  -Wreorder @gol
188 -Weffc++  -Wno-deprecated @gol
189 -Wno-non-template-friend  -Wold-style-cast @gol
190 -Woverloaded-virtual  -Wno-pmf-conversions @gol
191 -Wsign-promo  -Wsynth}
192
193 @item Objective-C Language Options
194 @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
195 @gccoptlist{
196 -fconstant-string-class=@var{class-name} @gol
197 -fgnu-runtime  -fnext-runtime @gol
198 -fno-nil-receivers @gol
199 -fobjc-exceptions @gol
200 -freplace-objc-classes @gol
201 -fzero-link @gol
202 -gen-decls @gol
203 -Wno-protocol  -Wselector -Wundeclared-selector}
204
205 @item Language Independent Options
206 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
207 @gccoptlist{-fmessage-length=@var{n}  @gol
208 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
209
210 @item Warning Options
211 @xref{Warning Options,,Options to Request or Suppress Warnings}.
212 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
213 -w  -Wextra  -Wall  -Waggregate-return @gol
214 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
215 -Wconversion  -Wno-deprecated-declarations @gol
216 -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
217 -Werror  -Werror-implicit-function-declaration @gol
218 -Wfloat-equal  -Wformat  -Wformat=2 @gol
219 -Wno-format-extra-args -Wformat-nonliteral @gol
220 -Wformat-security  -Wformat-y2k @gol
221 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
222 -Wimport  -Wno-import  -Winit-self  -Winline @gol
223 -Wno-invalid-offsetof  -Winvalid-pch @gol
224 -Wlarger-than-@var{len}  -Wlong-long @gol
225 -Wmain  -Wmissing-braces @gol
226 -Wmissing-format-attribute  -Wmissing-noreturn @gol
227 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
228 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
229 -Wreturn-type  -Wsequence-point  -Wshadow @gol
230 -Wsign-compare  -Wstrict-aliasing @gol
231 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
232 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
233 -Wunknown-pragmas  -Wunreachable-code @gol
234 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
235 -Wunused-value  -Wunused-variable  -Wwrite-strings}
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 @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 -mpni -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 -mlibrary-pic  -macc-4 -macc-8 @gol
637 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
638 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
639 -mvliw-branch  -mno-vliw-branch @gol
640 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
641 -mno-nested-cond-exec  -mtomcat-stats @gol
642 -mcpu=@var{cpu}}
643
644 @item Code Generation Options
645 @xref{Code Gen Options,,Options for Code Generation Conventions}.
646 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
647 -ffixed-@var{reg}  -fexceptions @gol
648 -fnon-call-exceptions  -funwind-tables @gol
649 -fasynchronous-unwind-tables @gol
650 -finhibit-size-directive  -finstrument-functions @gol
651 -fno-common  -fno-ident @gol
652 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
653 -freg-struct-return  -fshared-data  -fshort-enums @gol
654 -fshort-double  -fshort-wchar @gol
655 -fverbose-asm  -fpack-struct  -fstack-check @gol
656 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
657 -fargument-alias  -fargument-noalias @gol
658 -fargument-noalias-global  -fleading-underscore @gol
659 -ftls-model=@var{model} @gol
660 -ftrapv  -fwrapv  -fbounds-check}
661 @end table
662
663 @menu
664 * Overall Options::     Controlling the kind of output:
665                         an executable, object files, assembler files,
666                         or preprocessed source.
667 * C Dialect Options::   Controlling the variant of C language compiled.
668 * C++ Dialect Options:: Variations on C++.
669 * Objective-C Dialect Options:: Variations on Objective-C.
670 * Language Independent Options:: Controlling how diagnostics should be
671                         formatted.
672 * Warning Options::     How picky should the compiler be?
673 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
674 * Optimize Options::    How much optimization?
675 * Preprocessor Options:: Controlling header files and macro definitions.
676                          Also, getting dependency information for Make.
677 * Assembler Options::   Passing options to the assembler.
678 * Link Options::        Specifying libraries and so on.
679 * Directory Options::   Where to find header files and libraries.
680                         Where to find the compiler executable files.
681 * Spec Files::          How to pass switches to sub-processes.
682 * Target Options::      Running a cross-compiler, or an old version of GCC.
683 @end menu
684
685 @node Overall Options
686 @section Options Controlling the Kind of Output
687
688 Compilation can involve up to four stages: preprocessing, compilation
689 proper, assembly and linking, always in that order.  GCC is capable of
690 preprocessing and compiling several files either into several
691 assembler input files, or into one assembler input file; then each
692 assembler input file produces an object file, and linking combines all
693 the object files (those newly compiled, and those specified as input)
694 into an executable file.
695
696 @cindex file name suffix
697 For any given input file, the file name suffix determines what kind of
698 compilation is done:
699
700 @table @gcctabopt
701 @item @var{file}.c
702 C source code which must be preprocessed.
703
704 @item @var{file}.i
705 C source code which should not be preprocessed.
706
707 @item @var{file}.ii
708 C++ source code which should not be preprocessed.
709
710 @item @var{file}.m
711 Objective-C source code.  Note that you must link with the library
712 @file{libobjc.a} to make an Objective-C program work.
713
714 @item @var{file}.mi
715 Objective-C source code which should not be preprocessed.
716
717 @item @var{file}.h
718 C or C++ header file to be turned into a precompiled header.
719
720 @item @var{file}.cc
721 @itemx @var{file}.cp
722 @itemx @var{file}.cxx
723 @itemx @var{file}.cpp
724 @itemx @var{file}.CPP
725 @itemx @var{file}.c++
726 @itemx @var{file}.C
727 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
728 the last two letters must both be literally @samp{x}.  Likewise,
729 @samp{.C} refers to a literal capital C@.
730
731 @item @var{file}.hh
732 @itemx @var{file}.H
733 C++ header file to be turned into a precompiled header.
734
735 @item @var{file}.f
736 @itemx @var{file}.for
737 @itemx @var{file}.FOR
738 Fortran source code which should not be preprocessed.
739
740 @item @var{file}.F
741 @itemx @var{file}.fpp
742 @itemx @var{file}.FPP
743 Fortran source code which must be preprocessed (with the traditional
744 preprocessor).
745
746 @item @var{file}.r
747 Fortran source code which must be preprocessed with a RATFOR
748 preprocessor (not included with GCC)@.
749
750 @xref{Overall Options,,Options Controlling the Kind of Output, g77,
751 Using and Porting GNU Fortran}, for more details of the handling of
752 Fortran input files.
753
754 @c FIXME: Descriptions of Java file types.
755 @c @var{file}.java
756 @c @var{file}.class
757 @c @var{file}.zip
758 @c @var{file}.jar
759
760 @item @var{file}.ads
761 Ada source code file which contains a library unit declaration (a
762 declaration of a package, subprogram, or generic, or a generic
763 instantiation), or a library unit renaming declaration (a package,
764 generic, or subprogram renaming declaration).  Such files are also
765 called @dfn{specs}.
766
767 @itemx @var{file}.adb
768 Ada source code file containing a library unit body (a subprogram or
769 package body).  Such files are also called @dfn{bodies}.
770
771 @c GCC also knows about some suffixes for languages not yet included:
772 @c Pascal:
773 @c @var{file}.p
774 @c @var{file}.pas
775
776 @item @var{file}.s
777 Assembler code.
778
779 @item @var{file}.S
780 Assembler code which must be preprocessed.
781
782 @item @var{other}
783 An object file to be fed straight into linking.
784 Any file name with no recognized suffix is treated this way.
785 @end table
786
787 @opindex x
788 You can specify the input language explicitly with the @option{-x} option:
789
790 @table @gcctabopt
791 @item -x @var{language}
792 Specify explicitly the @var{language} for the following input files
793 (rather than letting the compiler choose a default based on the file
794 name suffix).  This option applies to all following input files until
795 the next @option{-x} option.  Possible values for @var{language} are:
796 @smallexample
797 c  c-header  cpp-output
798 c++  c++-header  c++-cpp-output
799 objective-c  objective-c-header  objc-cpp-output
800 assembler  assembler-with-cpp
801 ada
802 f77  f77-cpp-input  ratfor
803 java
804 treelang
805 @end smallexample
806
807 @item -x none
808 Turn off any specification of a language, so that subsequent files are
809 handled according to their file name suffixes (as they are if @option{-x}
810 has not been used at all).
811
812 @item -pass-exit-codes
813 @opindex pass-exit-codes
814 Normally the @command{gcc} program will exit with the code of 1 if any
815 phase of the compiler returns a non-success return code.  If you specify
816 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
817 numerically highest error produced by any phase that returned an error
818 indication.
819 @end table
820
821 If you only want some of the stages of compilation, you can use
822 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
823 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
824 @command{gcc} is to stop.  Note that some combinations (for example,
825 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
826
827 @table @gcctabopt
828 @item -c
829 @opindex c
830 Compile or assemble the source files, but do not link.  The linking
831 stage simply is not done.  The ultimate output is in the form of an
832 object file for each source file.
833
834 By default, the object file name for a source file is made by replacing
835 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
836
837 Unrecognized input files, not requiring compilation or assembly, are
838 ignored.
839
840 @item -S
841 @opindex S
842 Stop after the stage of compilation proper; do not assemble.  The output
843 is in the form of an assembler code file for each non-assembler input
844 file specified.
845
846 By default, the assembler file name for a source file is made by
847 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
848
849 Input files that don't require compilation are ignored.
850
851 @item -E
852 @opindex E
853 Stop after the preprocessing stage; do not run the compiler proper.  The
854 output is in the form of preprocessed source code, which is sent to the
855 standard output.
856
857 Input files which don't require preprocessing are ignored.
858
859 @cindex output file option
860 @item -o @var{file}
861 @opindex o
862 Place output in file @var{file}.  This applies regardless to whatever
863 sort of output is being produced, whether it be an executable file,
864 an object file, an assembler file or preprocessed C code.
865
866 If you specify @option{-o} when compiling more than one input file, or
867 you are producing an executable file as output, all the source files
868 on the command line will be compiled at once.
869
870 If @option{-o} is not specified, the default is to put an executable file
871 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
872 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
873 all preprocessed C source on standard output.
874
875 @item -v
876 @opindex v
877 Print (on standard error output) the commands executed to run the stages
878 of compilation.  Also print the version number of the compiler driver
879 program and of the preprocessor and the compiler proper.
880
881 @item -###
882 @opindex ###
883 Like @option{-v} except the commands are not executed and all command
884 arguments are quoted.  This is useful for shell scripts to capture the
885 driver-generated command lines.
886
887 @item -pipe
888 @opindex pipe
889 Use pipes rather than temporary files for communication between the
890 various stages of compilation.  This fails to work on some systems where
891 the assembler is unable to read from a pipe; but the GNU assembler has
892 no trouble.
893
894 @item --help
895 @opindex help
896 Print (on the standard output) a description of the command line options
897 understood by @command{gcc}.  If the @option{-v} option is also specified
898 then @option{--help} will also be passed on to the various processes
899 invoked by @command{gcc}, so that they can display the command line options
900 they accept.  If the @option{-Wextra} option is also specified then command
901 line options which have no documentation associated with them will also
902 be displayed.
903
904 @item --target-help
905 @opindex target-help
906 Print (on the standard output) a description of target specific command
907 line options for each tool.
908
909 @item --version
910 @opindex version
911 Display the version number and copyrights of the invoked GCC.
912 @end table
913
914 @node Invoking G++
915 @section Compiling C++ Programs
916
917 @cindex suffixes for C++ source
918 @cindex C++ source file suffixes
919 C++ source files conventionally use one of the suffixes @samp{.C},
920 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
921 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
922 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
923 files with these names and compiles them as C++ programs even if you
924 call the compiler the same way as for compiling C programs (usually
925 with the name @command{gcc}).
926
927 @findex g++
928 @findex c++
929 However, C++ programs often require class libraries as well as a
930 compiler that understands the C++ language---and under some
931 circumstances, you might want to compile programs or header files from
932 standard input, or otherwise without a suffix that flags them as C++
933 programs.  You might also like to precompile a C header file with a
934 @samp{.h} extension to be used in C++ compilations.  @command{g++} is a
935 program that calls GCC with the default language set to C++, and
936 automatically specifies linking against the C++ library.  On many
937 systems, @command{g++} is also installed with the name @command{c++}.
938
939 @cindex invoking @command{g++}
940 When you compile C++ programs, you may specify many of the same
941 command-line options that you use for compiling programs in any
942 language; or command-line options meaningful for C and related
943 languages; or options that are meaningful only for C++ programs.
944 @xref{C Dialect Options,,Options Controlling C Dialect}, for
945 explanations of options for languages related to C@.
946 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
947 explanations of options that are meaningful only for C++ programs.
948
949 @node C Dialect Options
950 @section Options Controlling C Dialect
951 @cindex dialect options
952 @cindex language dialect options
953 @cindex options, dialect
954
955 The following options control the dialect of C (or languages derived
956 from C, such as C++ and Objective-C) that the compiler accepts:
957
958 @table @gcctabopt
959 @cindex ANSI support
960 @cindex ISO support
961 @item -ansi
962 @opindex ansi
963 In C mode, support all ISO C90 programs.  In C++ mode,
964 remove GNU extensions that conflict with ISO C++.
965
966 This turns off certain features of GCC that are incompatible with ISO
967 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
968 such as the @code{asm} and @code{typeof} keywords, and
969 predefined macros such as @code{unix} and @code{vax} that identify the
970 type of system you are using.  It also enables the undesirable and
971 rarely used ISO trigraph feature.  For the C compiler,
972 it disables recognition of C++ style @samp{//} comments as well as
973 the @code{inline} keyword.
974
975 The alternate keywords @code{__asm__}, @code{__extension__},
976 @code{__inline__} and @code{__typeof__} continue to work despite
977 @option{-ansi}.  You would not want to use them in an ISO C program, of
978 course, but it is useful to put them in header files that might be included
979 in compilations done with @option{-ansi}.  Alternate predefined macros
980 such as @code{__unix__} and @code{__vax__} are also available, with or
981 without @option{-ansi}.
982
983 The @option{-ansi} option does not cause non-ISO programs to be
984 rejected gratuitously.  For that, @option{-pedantic} is required in
985 addition to @option{-ansi}.  @xref{Warning Options}.
986
987 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
988 option is used.  Some header files may notice this macro and refrain
989 from declaring certain functions or defining certain macros that the
990 ISO standard doesn't call for; this is to avoid interfering with any
991 programs that might use these names for other things.
992
993 Functions which would normally be built in but do not have semantics
994 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
995 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
996 built-in functions provided by GCC}, for details of the functions
997 affected.
998
999 @item -std=
1000 @opindex std
1001 Determine the language standard.  This option is currently only
1002 supported when compiling C or C++.  A value for this option must be
1003 provided; possible values are
1004
1005 @table @samp
1006 @item c89
1007 @itemx iso9899:1990
1008 ISO C90 (same as @option{-ansi}).
1009
1010 @item iso9899:199409
1011 ISO C90 as modified in amendment 1.
1012
1013 @item c99
1014 @itemx c9x
1015 @itemx iso9899:1999
1016 @itemx iso9899:199x
1017 ISO C99.  Note that this standard is not yet fully supported; see
1018 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1019 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1020
1021 @item gnu89
1022 Default, ISO C90 plus GNU extensions (including some C99 features).
1023
1024 @item gnu99
1025 @itemx gnu9x
1026 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1027 this will become the default.  The name @samp{gnu9x} is deprecated.
1028
1029 @item c++98
1030 The 1998 ISO C++ standard plus amendments.
1031
1032 @item gnu++98
1033 The same as @option{-std=c++98} plus GNU extensions.  This is the
1034 default for C++ code.
1035 @end table
1036
1037 Even when this option is not specified, you can still use some of the
1038 features of newer standards in so far as they do not conflict with
1039 previous C standards.  For example, you may use @code{__restrict__} even
1040 when @option{-std=c99} is not specified.
1041
1042 The @option{-std} options specifying some version of ISO C have the same
1043 effects as @option{-ansi}, except that features that were not in ISO C90
1044 but are in the specified version (for example, @samp{//} comments and
1045 the @code{inline} keyword in ISO C99) are not disabled.
1046
1047 @xref{Standards,,Language Standards Supported by GCC}, for details of
1048 these standard versions.
1049
1050 @item -aux-info @var{filename}
1051 @opindex aux-info
1052 Output to the given filename prototyped declarations for all functions
1053 declared and/or defined in a translation unit, including those in header
1054 files.  This option is silently ignored in any language other than C@.
1055
1056 Besides declarations, the file indicates, in comments, the origin of
1057 each declaration (source file and line), whether the declaration was
1058 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1059 @samp{O} for old, respectively, in the first character after the line
1060 number and the colon), and whether it came from a declaration or a
1061 definition (@samp{C} or @samp{F}, respectively, in the following
1062 character).  In the case of function definitions, a K&R-style list of
1063 arguments followed by their declarations is also provided, inside
1064 comments, after the declaration.
1065
1066 @item -fno-asm
1067 @opindex fno-asm
1068 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1069 keyword, so that code can use these words as identifiers.  You can use
1070 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1071 instead.  @option{-ansi} implies @option{-fno-asm}.
1072
1073 In C++, this switch only affects the @code{typeof} keyword, since
1074 @code{asm} and @code{inline} are standard keywords.  You may want to
1075 use the @option{-fno-gnu-keywords} flag instead, which has the same
1076 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1077 switch only affects the @code{asm} and @code{typeof} keywords, since
1078 @code{inline} is a standard keyword in ISO C99.
1079
1080 @item -fno-builtin
1081 @itemx -fno-builtin-@var{function}
1082 @opindex fno-builtin
1083 @cindex built-in functions
1084 Don't recognize built-in functions that do not begin with
1085 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1086 functions provided by GCC}, for details of the functions affected,
1087 including those which are not built-in functions when @option{-ansi} or
1088 @option{-std} options for strict ISO C conformance are used because they
1089 do not have an ISO standard meaning.
1090
1091 GCC normally generates special code to handle certain built-in functions
1092 more efficiently; for instance, calls to @code{alloca} may become single
1093 instructions that adjust the stack directly, and calls to @code{memcpy}
1094 may become inline copy loops.  The resulting code is often both smaller
1095 and faster, but since the function calls no longer appear as such, you
1096 cannot set a breakpoint on those calls, nor can you change the behavior
1097 of the functions by linking with a different library.
1098
1099 With the @option{-fno-builtin-@var{function}} option
1100 only the built-in function @var{function} is
1101 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1102 function is named this is not built-in in this version of GCC, this
1103 option is ignored.  There is no corresponding
1104 @option{-fbuiltin-@var{function}} option; if you wish to enable
1105 built-in functions selectively when using @option{-fno-builtin} or
1106 @option{-ffreestanding}, you may define macros such as:
1107
1108 @smallexample
1109 #define abs(n)          __builtin_abs ((n))
1110 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1111 @end smallexample
1112
1113 @item -fhosted
1114 @opindex fhosted
1115 @cindex hosted environment
1116
1117 Assert that compilation takes place in a hosted environment.  This implies
1118 @option{-fbuiltin}.  A hosted environment is one in which the
1119 entire standard library is available, and in which @code{main} has a return
1120 type of @code{int}.  Examples are nearly everything except a kernel.
1121 This is equivalent to @option{-fno-freestanding}.
1122
1123 @item -ffreestanding
1124 @opindex ffreestanding
1125 @cindex hosted environment
1126
1127 Assert that compilation takes place in a freestanding environment.  This
1128 implies @option{-fno-builtin}.  A freestanding environment
1129 is one in which the standard library may not exist, and program startup may
1130 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1131 This is equivalent to @option{-fno-hosted}.
1132
1133 @xref{Standards,,Language Standards Supported by GCC}, for details of
1134 freestanding and hosted environments.
1135
1136 @item -fms-extensions
1137 @opindex fms-extensions
1138 Accept some non-standard constructs used in Microsoft header files.
1139
1140 @item -trigraphs
1141 @opindex trigraphs
1142 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1143 options for strict ISO C conformance) implies @option{-trigraphs}.
1144
1145 @item -no-integrated-cpp
1146 @opindex no-integrated-cpp
1147 Performs a compilation in two passes: preprocessing and compiling.  This
1148 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1149 @option{-B} option. The user supplied compilation step can then add in
1150 an additional preprocessing step after normal preprocessing but before
1151 compiling. The default is to use the integrated cpp (internal cpp)
1152
1153 The semantics of this option will change if "cc1", "cc1plus", and
1154 "cc1obj" are merged.
1155
1156 @cindex traditional C language
1157 @cindex C language, traditional
1158 @item -traditional
1159 @itemx -traditional-cpp
1160 @opindex traditional-cpp
1161 @opindex traditional
1162 Formerly, these options caused GCC to attempt to emulate a pre-standard
1163 C compiler.  They are now only supported with the @option{-E} switch.
1164 The preprocessor continues to support a pre-standard mode.  See the GNU
1165 CPP manual for details.
1166
1167 @item -fcond-mismatch
1168 @opindex fcond-mismatch
1169 Allow conditional expressions with mismatched types in the second and
1170 third arguments.  The value of such an expression is void.  This option
1171 is not supported for C++.
1172
1173 @item -funsigned-char
1174 @opindex funsigned-char
1175 Let the type @code{char} be unsigned, like @code{unsigned char}.
1176
1177 Each kind of machine has a default for what @code{char} should
1178 be.  It is either like @code{unsigned char} by default or like
1179 @code{signed char} by default.
1180
1181 Ideally, a portable program should always use @code{signed char} or
1182 @code{unsigned char} when it depends on the signedness of an object.
1183 But many programs have been written to use plain @code{char} and
1184 expect it to be signed, or expect it to be unsigned, depending on the
1185 machines they were written for.  This option, and its inverse, let you
1186 make such a program work with the opposite default.
1187
1188 The type @code{char} is always a distinct type from each of
1189 @code{signed char} or @code{unsigned char}, even though its behavior
1190 is always just like one of those two.
1191
1192 @item -fsigned-char
1193 @opindex fsigned-char
1194 Let the type @code{char} be signed, like @code{signed char}.
1195
1196 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1197 the negative form of @option{-funsigned-char}.  Likewise, the option
1198 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1199
1200 @item -fsigned-bitfields
1201 @itemx -funsigned-bitfields
1202 @itemx -fno-signed-bitfields
1203 @itemx -fno-unsigned-bitfields
1204 @opindex fsigned-bitfields
1205 @opindex funsigned-bitfields
1206 @opindex fno-signed-bitfields
1207 @opindex fno-unsigned-bitfields
1208 These options control whether a bit-field is signed or unsigned, when the
1209 declaration does not use either @code{signed} or @code{unsigned}.  By
1210 default, such a bit-field is signed, because this is consistent: the
1211 basic integer types such as @code{int} are signed types.
1212
1213 @item -fwritable-strings
1214 @opindex fwritable-strings
1215 Store string constants in the writable data segment and don't uniquize
1216 them.  This is for compatibility with old programs which assume they can
1217 write into string constants.
1218
1219 Writing into string constants is a very bad idea; ``constants'' should
1220 be constant.
1221
1222 This option is deprecated.
1223 @end table
1224
1225 @node C++ Dialect Options
1226 @section Options Controlling C++ Dialect
1227
1228 @cindex compiler options, C++
1229 @cindex C++ options, command line
1230 @cindex options, C++
1231 This section describes the command-line options that are only meaningful
1232 for C++ programs; but you can also use most of the GNU compiler options
1233 regardless of what language your program is in.  For example, you
1234 might compile a file @code{firstClass.C} like this:
1235
1236 @smallexample
1237 g++ -g -frepo -O -c firstClass.C
1238 @end smallexample
1239
1240 @noindent
1241 In this example, only @option{-frepo} is an option meant
1242 only for C++ programs; you can use the other options with any
1243 language supported by GCC@.
1244
1245 Here is a list of options that are @emph{only} for compiling C++ programs:
1246
1247 @table @gcctabopt
1248
1249 @item -fabi-version=@var{n}
1250 @opindex fabi-version
1251 Use version @var{n} of the C++ ABI.  Version 2 is the version of the
1252 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1253 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1254 the version that conforms most closely to the C++ ABI specification.
1255 Therefore, the ABI obtained using version 0 will change as ABI bugs
1256 are fixed.
1257
1258 The default is version 1.
1259
1260 @item -fno-access-control
1261 @opindex fno-access-control
1262 Turn off all access checking.  This switch is mainly useful for working
1263 around bugs in the access control code.
1264
1265 @item -fcheck-new
1266 @opindex fcheck-new
1267 Check that the pointer returned by @code{operator new} is non-null
1268 before attempting to modify the storage allocated.  This check is
1269 normally unnecessary because the C++ standard specifies that
1270 @code{operator new} will only return @code{0} if it is declared
1271 @samp{throw()}, in which case the compiler will always check the
1272 return value even without this option.  In all other cases, when
1273 @code{operator new} has a non-empty exception specification, memory
1274 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1275 @samp{new (nothrow)}.
1276
1277 @item -fconserve-space
1278 @opindex fconserve-space
1279 Put uninitialized or runtime-initialized global variables into the
1280 common segment, as C does.  This saves space in the executable at the
1281 cost of not diagnosing duplicate definitions.  If you compile with this
1282 flag and your program mysteriously crashes after @code{main()} has
1283 completed, you may have an object that is being destroyed twice because
1284 two definitions were merged.
1285
1286 This option is no longer useful on most targets, now that support has
1287 been added for putting variables into BSS without making them common.
1288
1289 @item -fno-const-strings
1290 @opindex fno-const-strings
1291 Give string constants type @code{char *} instead of type @code{const
1292 char *}.  By default, G++ uses type @code{const char *} as required by
1293 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1294 actually modify the value of a string constant, unless you also use
1295 @option{-fwritable-strings}.
1296
1297 This option might be removed in a future release of G++.  For maximum
1298 portability, you should structure your code so that it works with
1299 string constants that have type @code{const char *}.
1300
1301 @item -fno-elide-constructors
1302 @opindex fno-elide-constructors
1303 The C++ standard allows an implementation to omit creating a temporary
1304 which is only used to initialize another object of the same type.
1305 Specifying this option disables that optimization, and forces G++ to
1306 call the copy constructor in all cases.
1307
1308 @item -fno-enforce-eh-specs
1309 @opindex fno-enforce-eh-specs
1310 Don't check for violation of exception specifications at runtime.  This
1311 option violates the C++ standard, but may be useful for reducing code
1312 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1313 will still optimize based on the exception specifications.
1314
1315 @item -ffor-scope
1316 @itemx -fno-for-scope
1317 @opindex ffor-scope
1318 @opindex fno-for-scope
1319 If @option{-ffor-scope} is specified, the scope of variables declared in
1320 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1321 as specified by the C++ standard.
1322 If @option{-fno-for-scope} is specified, the scope of variables declared in
1323 a @i{for-init-statement} extends to the end of the enclosing scope,
1324 as was the case in old versions of G++, and other (traditional)
1325 implementations of C++.
1326
1327 The default if neither flag is given to follow the standard,
1328 but to allow and give a warning for old-style code that would
1329 otherwise be invalid, or have different behavior.
1330
1331 @item -fno-gnu-keywords
1332 @opindex fno-gnu-keywords
1333 Do not recognize @code{typeof} as a keyword, so that code can use this
1334 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1335 @option{-ansi} implies @option{-fno-gnu-keywords}.
1336
1337 @item -fno-implicit-templates
1338 @opindex fno-implicit-templates
1339 Never emit code for non-inline templates which are instantiated
1340 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1341 @xref{Template Instantiation}, for more information.
1342
1343 @item -fno-implicit-inline-templates
1344 @opindex fno-implicit-inline-templates
1345 Don't emit code for implicit instantiations of inline templates, either.
1346 The default is to handle inlines differently so that compiles with and
1347 without optimization will need the same set of explicit instantiations.
1348
1349 @item -fno-implement-inlines
1350 @opindex fno-implement-inlines
1351 To save space, do not emit out-of-line copies of inline functions
1352 controlled by @samp{#pragma implementation}.  This will cause linker
1353 errors if these functions are not inlined everywhere they are called.
1354
1355 @item -fms-extensions
1356 @opindex fms-extensions
1357 Disable pedantic warnings about constructs used in MFC, such as implicit
1358 int and getting a pointer to member function via non-standard syntax.
1359
1360 @item -fno-nonansi-builtins
1361 @opindex fno-nonansi-builtins
1362 Disable built-in declarations of functions that are not mandated by
1363 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1364 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1365
1366 @item -fno-operator-names
1367 @opindex fno-operator-names
1368 Do not treat the operator name keywords @code{and}, @code{bitand},
1369 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1370 synonyms as keywords.
1371
1372 @item -fno-optional-diags
1373 @opindex fno-optional-diags
1374 Disable diagnostics that the standard says a compiler does not need to
1375 issue.  Currently, the only such diagnostic issued by G++ is the one for
1376 a name having multiple meanings within a class.
1377
1378 @item -fpermissive
1379 @opindex fpermissive
1380 Downgrade some diagnostics about nonconformant code from errors to
1381 warnings.  Thus, using @option{-fpermissive} will allow some
1382 nonconforming code to compile.
1383
1384 @item -frepo
1385 @opindex frepo
1386 Enable automatic template instantiation at link time.  This option also
1387 implies @option{-fno-implicit-templates}.  @xref{Template
1388 Instantiation}, for more information.
1389
1390 @item -fno-rtti
1391 @opindex fno-rtti
1392 Disable generation of information about every class with virtual
1393 functions for use by the C++ runtime type identification features
1394 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1395 of the language, you can save some space by using this flag.  Note that
1396 exception handling uses the same information, but it will generate it as
1397 needed.
1398
1399 @item -fstats
1400 @opindex fstats
1401 Emit statistics about front-end processing at the end of the compilation.
1402 This information is generally only useful to the G++ development team.
1403
1404 @item -ftemplate-depth-@var{n}
1405 @opindex ftemplate-depth
1406 Set the maximum instantiation depth for template classes to @var{n}.
1407 A limit on the template instantiation depth is needed to detect
1408 endless recursions during template class instantiation.  ANSI/ISO C++
1409 conforming programs must not rely on a maximum depth greater than 17.
1410
1411 @item -fuse-cxa-atexit
1412 @opindex fuse-cxa-atexit
1413 Register destructors for objects with static storage duration with the
1414 @code{__cxa_atexit} function rather than the @code{atexit} function.
1415 This option is required for fully standards-compliant handling of static
1416 destructors, but will only work if your C library supports
1417 @code{__cxa_atexit}.
1418
1419 @item -fno-weak
1420 @opindex fno-weak
1421 Do not use weak symbol support, even if it is provided by the linker.
1422 By default, G++ will use weak symbols if they are available.  This
1423 option exists only for testing, and should not be used by end-users;
1424 it will result in inferior code and has no benefits.  This option may
1425 be removed in a future release of G++.
1426
1427 @item -nostdinc++
1428 @opindex nostdinc++
1429 Do not search for header files in the standard directories specific to
1430 C++, but do still search the other standard directories.  (This option
1431 is used when building the C++ library.)
1432 @end table
1433
1434 In addition, these optimization, warning, and code generation options
1435 have meanings only for C++ programs:
1436
1437 @table @gcctabopt
1438 @item -fno-default-inline
1439 @opindex fno-default-inline
1440 Do not assume @samp{inline} for functions defined inside a class scope.
1441 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1442 functions will have linkage like inline functions; they just won't be
1443 inlined by default.
1444
1445 @item -Wabi @r{(C++ only)}
1446 @opindex Wabi
1447 Warn when G++ generates code that is probably not compatible with the
1448 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1449 all such cases, there are probably some cases that are not warned about,
1450 even though G++ is generating incompatible code.  There may also be
1451 cases where warnings are emitted even though the code that is generated
1452 will be compatible.
1453
1454 You should rewrite your code to avoid these warnings if you are
1455 concerned about the fact that code generated by G++ may not be binary
1456 compatible with code generated by other compilers.
1457
1458 The known incompatibilities at this point include:
1459
1460 @itemize @bullet
1461
1462 @item
1463 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1464 pack data into the same byte as a base class.  For example:
1465
1466 @smallexample
1467 struct A @{ virtual void f(); int f1 : 1; @};
1468 struct B : public A @{ int f2 : 1; @};
1469 @end smallexample
1470
1471 @noindent
1472 In this case, G++ will place @code{B::f2} into the same byte
1473 as@code{A::f1}; other compilers will not.  You can avoid this problem
1474 by explicitly padding @code{A} so that its size is a multiple of the
1475 byte size on your platform; that will cause G++ and other compilers to
1476 layout @code{B} identically.
1477
1478 @item
1479 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1480 tail padding when laying out virtual bases.  For example:
1481
1482 @smallexample
1483 struct A @{ virtual void f(); char c1; @};
1484 struct B @{ B(); char c2; @};
1485 struct C : public A, public virtual B @{@};
1486 @end smallexample
1487
1488 @noindent
1489 In this case, G++ will not place @code{B} into the tail-padding for
1490 @code{A}; other compilers will.  You can avoid this problem by
1491 explicitly padding @code{A} so that its size is a multiple of its
1492 alignment (ignoring virtual base classes); that will cause G++ and other
1493 compilers to layout @code{C} identically.
1494
1495 @item
1496 Incorrect handling of bit-fields with declared widths greater than that
1497 of their underlying types, when the bit-fields appear in a union.  For
1498 example:
1499
1500 @smallexample
1501 union U @{ int i : 4096; @};
1502 @end smallexample
1503
1504 @noindent
1505 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1506 union too small by the number of bits in an @code{int}.
1507
1508 @item
1509 Empty classes can be placed at incorrect offsets.  For example:
1510
1511 @smallexample
1512 struct A @{@};
1513
1514 struct B @{
1515   A a;
1516   virtual void f ();
1517 @};
1518
1519 struct C : public B, public A @{@};
1520 @end smallexample
1521
1522 @noindent
1523 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1524 it should be placed at offset zero.  G++ mistakenly believes that the
1525 @code{A} data member of @code{B} is already at offset zero.
1526
1527 @item
1528 Names of template functions whose types involve @code{typename} or
1529 template template parameters can be mangled incorrectly.
1530
1531 @smallexample
1532 template <typename Q>
1533 void f(typename Q::X) @{@}
1534
1535 template <template <typename> class Q>
1536 void f(typename Q<int>::X) @{@}
1537 @end smallexample
1538
1539 @noindent
1540 Instantiations of these templates may be mangled incorrectly.
1541
1542 @end itemize
1543
1544 @item -Wctor-dtor-privacy @r{(C++ only)}
1545 @opindex Wctor-dtor-privacy
1546 Warn when a class seems unusable because all the constructors or
1547 destructors in that class are private, and it has neither friends nor
1548 public static member functions.
1549
1550 @item -Wnon-virtual-dtor @r{(C++ only)}
1551 @opindex Wnon-virtual-dtor
1552 Warn when a class appears to be polymorphic, thereby requiring a virtual
1553 destructor, yet it declares a non-virtual one.
1554 This warning is enabled by @option{-Wall}.
1555
1556 @item -Wreorder @r{(C++ only)}
1557 @opindex Wreorder
1558 @cindex reordering, warning
1559 @cindex warning for reordering of member initializers
1560 Warn when the order of member initializers given in the code does not
1561 match the order in which they must be executed.  For instance:
1562
1563 @smallexample
1564 struct A @{
1565   int i;
1566   int j;
1567   A(): j (0), i (1) @{ @}
1568 @};
1569 @end smallexample
1570
1571 The compiler will rearrange the member initializers for @samp{i}
1572 and @samp{j} to match the declaration order of the members, emitting
1573 a warning to that effect.  This warning is enabled by @option{-Wall}.
1574 @end table
1575
1576 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1577
1578 @table @gcctabopt
1579 @item -Weffc++ @r{(C++ only)}
1580 @opindex Weffc++
1581 Warn about violations of the following style guidelines from Scott Meyers'
1582 @cite{Effective C++} book:
1583
1584 @itemize @bullet
1585 @item
1586 Item 11:  Define a copy constructor and an assignment operator for classes
1587 with dynamically allocated memory.
1588
1589 @item
1590 Item 12:  Prefer initialization to assignment in constructors.
1591
1592 @item
1593 Item 14:  Make destructors virtual in base classes.
1594
1595 @item
1596 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1597
1598 @item
1599 Item 23:  Don't try to return a reference when you must return an object.
1600
1601 @end itemize
1602
1603 Also warn about violations of the following style guidelines from
1604 Scott Meyers' @cite{More Effective C++} book:
1605
1606 @itemize @bullet
1607 @item
1608 Item 6:  Distinguish between prefix and postfix forms of increment and
1609 decrement operators.
1610
1611 @item
1612 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1613
1614 @end itemize
1615
1616 When selecting this option, be aware that the standard library
1617 headers do not obey all of these guidelines; use @samp{grep -v}
1618 to filter out those warnings.
1619
1620 @item -Wno-deprecated @r{(C++ only)}
1621 @opindex Wno-deprecated
1622 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1623
1624 @item -Wno-non-template-friend @r{(C++ only)}
1625 @opindex Wno-non-template-friend
1626 Disable warnings when non-templatized friend functions are declared
1627 within a template.  Since the advent of explicit template specification
1628 support in G++, if the name of the friend is an unqualified-id (i.e.,
1629 @samp{friend foo(int)}), the C++ language specification demands that the
1630 friend declare or define an ordinary, nontemplate function.  (Section
1631 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1632 could be interpreted as a particular specialization of a templatized
1633 function.  Because this non-conforming behavior is no longer the default
1634 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1635 check existing code for potential trouble spots and is on by default.
1636 This new compiler behavior can be turned off with
1637 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1638 but disables the helpful warning.
1639
1640 @item -Wold-style-cast @r{(C++ only)}
1641 @opindex Wold-style-cast
1642 Warn if an old-style (C-style) cast to a non-void type is used within
1643 a C++ program.  The new-style casts (@samp{static_cast},
1644 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1645 unintended effects and much easier to search for.
1646
1647 @item -Woverloaded-virtual @r{(C++ only)}
1648 @opindex Woverloaded-virtual
1649 @cindex overloaded virtual fn, warning
1650 @cindex warning for overloaded virtual fn
1651 Warn when a function declaration hides virtual functions from a
1652 base class.  For example, in:
1653
1654 @smallexample
1655 struct A @{
1656   virtual void f();
1657 @};
1658
1659 struct B: public A @{
1660   void f(int);
1661 @};
1662 @end smallexample
1663
1664 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1665 like:
1666
1667 @smallexample
1668 B* b;
1669 b->f();
1670 @end smallexample
1671
1672 will fail to compile.
1673
1674 @item -Wno-pmf-conversions @r{(C++ only)}
1675 @opindex Wno-pmf-conversions
1676 Disable the diagnostic for converting a bound pointer to member function
1677 to a plain pointer.
1678
1679 @item -Wsign-promo @r{(C++ only)}
1680 @opindex Wsign-promo
1681 Warn when overload resolution chooses a promotion from unsigned or
1682 enumeral type to a signed type, over a conversion to an unsigned type of
1683 the same size.  Previous versions of G++ would try to preserve
1684 unsignedness, but the standard mandates the current behavior.
1685
1686 @item -Wsynth @r{(C++ only)}
1687 @opindex Wsynth
1688 @cindex warning for synthesized methods
1689 @cindex synthesized methods, warning
1690 Warn when G++'s synthesis behavior does not match that of cfront.  For
1691 instance:
1692
1693 @smallexample
1694 struct A @{
1695   operator int ();
1696   A& operator = (int);
1697 @};
1698
1699 main ()
1700 @{
1701   A a,b;
1702   a = b;
1703 @}
1704 @end smallexample
1705
1706 In this example, G++ will synthesize a default @samp{A& operator =
1707 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1708 @end table
1709
1710 @node Objective-C Dialect Options
1711 @section Options Controlling Objective-C Dialect
1712
1713 @cindex compiler options, Objective-C
1714 @cindex Objective-C options, command line
1715 @cindex options, Objective-C
1716 (NOTE: This manual does not describe the Objective-C language itself.  See
1717 @w{@uref{http://gcc.gnu.org/readings.html}} for references.)
1718
1719 This section describes the command-line options that are only meaningful
1720 for Objective-C programs, but you can also use most of the GNU compiler
1721 options regardless of what language your program is in.  For example,
1722 you might compile a file @code{some_class.m} like this:
1723
1724 @smallexample
1725 gcc -g -fgnu-runtime -O -c some_class.m
1726 @end smallexample
1727
1728 @noindent
1729 In this example, @option{-fgnu-runtime} is an option meant only for
1730 Objective-C programs; you can use the other options with any language
1731 supported by GCC@.
1732
1733 Here is a list of options that are @emph{only} for compiling Objective-C
1734 programs:
1735
1736 @table @gcctabopt
1737 @item -fconstant-string-class=@var{class-name}
1738 @opindex fconstant-string-class
1739 Use @var{class-name} as the name of the class to instantiate for each
1740 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1741 class name is @code{NXConstantString} if the GNU runtime is being used, and
1742 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1743 @option{-fconstant-cfstrings} option, if also present, will override the
1744 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1745 to be laid out as constant CoreFoundation strings.
1746
1747 @item -fgnu-runtime
1748 @opindex fgnu-runtime
1749 Generate object code compatible with the standard GNU Objective-C
1750 runtime.  This is the default for most types of systems.
1751
1752 @item -fnext-runtime
1753 @opindex fnext-runtime
1754 Generate output compatible with the NeXT runtime.  This is the default
1755 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1756 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1757 used.
1758
1759 @item -fno-nil-receivers
1760 @opindex -fno-nil-receivers
1761 Assume that all Objective-C message dispatches (e.g.,
1762 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1763 is not @code{nil}.  This allows for more efficient entry points in the runtime to be
1764 used.  Currently, this option is only available in conjunction with
1765 the NeXT runtime on Mac OS X 10.3 and later.
1766
1767 @item -fobjc-exceptions
1768 @opindex -fobjc-exceptions
1769 Enable syntactic support for structured exception handling in Objective-C,
1770 similar to what is offered by C++ and Java.  Currently, this option is only
1771 available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
1772
1773 @smallexample
1774   @@try @{
1775     @dots{}
1776        @@throw expr;
1777     @dots{}
1778   @}
1779   @@catch (AnObjCClass *exc) @{
1780     @dots{}
1781       @@throw expr;
1782     @dots{}
1783       @@throw;
1784     @dots{}
1785   @}
1786   @@catch (AnotherClass *exc) @{
1787     @dots{}
1788   @}
1789   @@catch (id allOthers) @{
1790     @dots{}
1791   @}
1792   @@finally @{
1793     @dots{}
1794       @@throw expr;
1795     @dots{}
1796   @}
1797 @end smallexample
1798
1799 The @code{@@throw} statement may appear anywhere in an Objective-C or
1800 Objective-C++ program; when used inside of a @code{@@catch} block, the
1801 @code{@@throw} may appear without an argument (as shown above), in which case
1802 the object caught by the @code{@@catch} will be rethrown.
1803
1804 Note that only (pointers to) Objective-C objects may be thrown and
1805 caught using this scheme.  When an object is thrown, it will be caught
1806 by the nearest @code{@@catch} clause capable of handling objects of that type,
1807 analogously to how @code{catch} blocks work in C++ and Java.  A
1808 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
1809 any and all Objective-C exceptions not caught by previous @code{@@catch}
1810 clauses (if any).
1811
1812 The @code{@@finally} clause, if present, will be executed upon exit from the
1813 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1814 regardless of whether any exceptions are thrown, caught or rethrown
1815 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1816 of the @code{finally} clause in Java.
1817
1818 There are several caveats to using the new exception mechanism:
1819
1820 @itemize @bullet
1821 @item
1822 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
1823 idioms provided by the @code{NSException} class, the new
1824 exceptions can only be used on Mac OS X 10.3 (Panther) and later
1825 systems, due to additional functionality needed in the (NeXT) Objective-C
1826 runtime.
1827
1828 @item
1829 As mentioned above, the new exceptions do not support handling
1830 types other than Objective-C objects.   Furthermore, when used from
1831 Objective-C++, the Objective-C exception model does not interoperate with C++
1832 exceptions at this time.  This means you cannot @code{@@throw} an exception
1833 from Objective-C and @code{catch} it in C++, or vice versa
1834 (i.e., @code{throw @dots{} @@catch}).
1835 @end itemize
1836
1837 The @option{-fobjc-exceptions} switch also enables the use of synchronization
1838 blocks for thread-safe execution:
1839
1840 @smallexample
1841   @@synchronized (ObjCClass *guard) @{
1842     @dots{}
1843   @}
1844 @end smallexample
1845
1846 Upon entering the @code{@@synchronized} block, a thread of execution shall
1847 first check whether a lock has been placed on the corresponding @code{guard}
1848 object by another thread.  If it has, the current thread shall wait until
1849 the other thread relinquishes its lock.  Once @code{guard} becomes available,
1850 the current thread will place its own lock on it, execute the code contained in
1851 the @code{@@synchronized} block, and finally relinquish the lock (thereby
1852 making @code{guard} available to other threads).
1853
1854 Unlike Java, Objective-C does not allow for entire methods to be marked
1855 @code{@@synchronized}.  Note that throwing exceptions out of
1856 @code{@@synchronized} blocks is allowed, and will cause the guarding object
1857 to be unlocked properly.
1858
1859 @item -freplace-objc-classes
1860 @opindex -freplace-objc-classes
1861 Emit a special marker instructing @command{ld(1)} not to statically link in
1862 the resulting object file, and allow @command{dyld(1)} to load it in at
1863 run time instead.  This is used in conjunction with the Fix-and-Continue
1864 debugging mode, where the object file in question may be recompiled and
1865 dynamically reloaded in the course of program execution, without the need
1866 to restart the program itself.  Currently, Fix-and-Continue functionality
1867 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
1868 and later.
1869
1870 @item -fzero-link
1871 @opindex -fzero-link
1872 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1873 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1874 compile time) with static class references that get initialized at load time,
1875 which improves run-time performance.  Specifying the @option{-fzero-link} flag
1876 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
1877 to be retained.  This is useful in Zero-Link debugging mode, since it allows
1878 for individual class implementations to be modified during program execution.
1879
1880 @item -gen-decls
1881 @opindex gen-decls
1882 Dump interface declarations for all classes seen in the source file to a
1883 file named @file{@var{sourcename}.decl}.
1884
1885 @item -Wno-protocol
1886 @opindex Wno-protocol
1887 If a class is declared to implement a protocol, a warning is issued for
1888 every method in the protocol that is not implemented by the class.  The
1889 default behavior is to issue a warning for every method not explicitly
1890 implemented in the class, even if a method implementation is inherited
1891 from the superclass.  If you use the @code{-Wno-protocol} option, then
1892 methods inherited from the superclass are considered to be implemented,
1893 and no warning is issued for them.
1894
1895 @item -Wselector
1896 @opindex Wselector
1897 Warn if multiple methods of different types for the same selector are
1898 found during compilation.  The check is performed on the list of methods
1899 in the final stage of compilation.  Additionally, a check is performed
1900 for each selector appearing in a @code{@@selector(@dots{})}
1901 expression, and a corresponding method for that selector has been found
1902 during compilation.  Because these checks scan the method table only at
1903 the end of compilation, these warnings are not produced if the final
1904 stage of compilation is not reached, for example because an error is
1905 found during compilation, or because the @code{-fsyntax-only} option is
1906 being used.
1907
1908 @item -Wundeclared-selector
1909 @opindex Wundeclared-selector
1910 Warn if a @code{@@selector(@dots{})} expression referring to an
1911 undeclared selector is found.  A selector is considered undeclared if no
1912 method with that name has been declared before the
1913 @code{@@selector(@dots{})} expression, either explicitly in an
1914 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
1915 an @code{@@implementation} section.  This option always performs its
1916 checks as soon as a @code{@@selector(@dots{})} expression is found,
1917 while @code{-Wselector} only performs its checks in the final stage of
1918 compilation.  This also enforces the coding style convention
1919 that methods and selectors must be declared before being used.
1920
1921 @item -print-objc-runtime-info
1922 @opindex -print-objc-runtime-info
1923 Generate C header describing the largest structure that is passed by
1924 value, if any.
1925
1926 @end table
1927
1928 @node Language Independent Options
1929 @section Options to Control Diagnostic Messages Formatting
1930 @cindex options to control diagnostics formatting
1931 @cindex diagnostic messages
1932 @cindex message formatting
1933
1934 Traditionally, diagnostic messages have been formatted irrespective of
1935 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1936 below can be used to control the diagnostic messages formatting
1937 algorithm, e.g.@: how many characters per line, how often source location
1938 information should be reported.  Right now, only the C++ front end can
1939 honor these options.  However it is expected, in the near future, that
1940 the remaining front ends would be able to digest them correctly.
1941
1942 @table @gcctabopt
1943 @item -fmessage-length=@var{n}
1944 @opindex fmessage-length
1945 Try to format error messages so that they fit on lines of about @var{n}
1946 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1947 the front ends supported by GCC@.  If @var{n} is zero, then no
1948 line-wrapping will be done; each error message will appear on a single
1949 line.
1950
1951 @opindex fdiagnostics-show-location
1952 @item -fdiagnostics-show-location=once
1953 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1954 reporter to emit @emph{once} source location information; that is, in
1955 case the message is too long to fit on a single physical line and has to
1956 be wrapped, the source location won't be emitted (as prefix) again,
1957 over and over, in subsequent continuation lines.  This is the default
1958 behavior.
1959
1960 @item -fdiagnostics-show-location=every-line
1961 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1962 messages reporter to emit the same source location information (as
1963 prefix) for physical lines that result from the process of breaking
1964 a message which is too long to fit on a single line.
1965
1966 @end table
1967
1968 @node Warning Options
1969 @section Options to Request or Suppress Warnings
1970 @cindex options to control warnings
1971 @cindex warning messages
1972 @cindex messages, warning
1973 @cindex suppressing warnings
1974
1975 Warnings are diagnostic messages that report constructions which
1976 are not inherently erroneous but which are risky or suggest there
1977 may have been an error.
1978
1979 You can request many specific warnings with options beginning @samp{-W},
1980 for example @option{-Wimplicit} to request warnings on implicit
1981 declarations.  Each of these specific warning options also has a
1982 negative form beginning @samp{-Wno-} to turn off warnings;
1983 for example, @option{-Wno-implicit}.  This manual lists only one of the
1984 two forms, whichever is not the default.
1985
1986 The following options control the amount and kinds of warnings produced
1987 by GCC; for further, language-specific options also refer to
1988 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
1989
1990 @table @gcctabopt
1991 @cindex syntax checking
1992 @item -fsyntax-only
1993 @opindex fsyntax-only
1994 Check the code for syntax errors, but don't do anything beyond that.
1995
1996 @item -pedantic
1997 @opindex pedantic
1998 Issue all the warnings demanded by strict ISO C and ISO C++;
1999 reject all programs that use forbidden extensions, and some other
2000 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2001 version of the ISO C standard specified by any @option{-std} option used.
2002
2003 Valid ISO C and ISO C++ programs should compile properly with or without
2004 this option (though a rare few will require @option{-ansi} or a
2005 @option{-std} option specifying the required version of ISO C)@.  However,
2006 without this option, certain GNU extensions and traditional C and C++
2007 features are supported as well.  With this option, they are rejected.
2008
2009 @option{-pedantic} does not cause warning messages for use of the
2010 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2011 warnings are also disabled in the expression that follows
2012 @code{__extension__}.  However, only system header files should use
2013 these escape routes; application programs should avoid them.
2014 @xref{Alternate Keywords}.
2015
2016 Some users try to use @option{-pedantic} to check programs for strict ISO
2017 C conformance.  They soon find that it does not do quite what they want:
2018 it finds some non-ISO practices, but not all---only those for which
2019 ISO C @emph{requires} a diagnostic, and some others for which
2020 diagnostics have been added.
2021
2022 A feature to report any failure to conform to ISO C might be useful in
2023 some instances, but would require considerable additional work and would
2024 be quite different from @option{-pedantic}.  We don't have plans to
2025 support such a feature in the near future.
2026
2027 Where the standard specified with @option{-std} represents a GNU
2028 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2029 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2030 extended dialect is based.  Warnings from @option{-pedantic} are given
2031 where they are required by the base standard.  (It would not make sense
2032 for such warnings to be given only for features not in the specified GNU
2033 C dialect, since by definition the GNU dialects of C include all
2034 features the compiler supports with the given option, and there would be
2035 nothing to warn about.)
2036
2037 @item -pedantic-errors
2038 @opindex pedantic-errors
2039 Like @option{-pedantic}, except that errors are produced rather than
2040 warnings.
2041
2042 @item -w
2043 @opindex w
2044 Inhibit all warning messages.
2045
2046 @item -Wno-import
2047 @opindex Wno-import
2048 Inhibit warning messages about the use of @samp{#import}.
2049
2050 @item -Wchar-subscripts
2051 @opindex Wchar-subscripts
2052 Warn if an array subscript has type @code{char}.  This is a common cause
2053 of error, as programmers often forget that this type is signed on some
2054 machines.
2055
2056 @item -Wcomment
2057 @opindex Wcomment
2058 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2059 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2060
2061 @item -Wformat
2062 @opindex Wformat
2063 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2064 the arguments supplied have types appropriate to the format string
2065 specified, and that the conversions specified in the format string make
2066 sense.  This includes standard functions, and others specified by format
2067 attributes (@pxref{Function Attributes}), in the @code{printf},
2068 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2069 not in the C standard) families.
2070
2071 The formats are checked against the format features supported by GNU
2072 libc version 2.2.  These include all ISO C90 and C99 features, as well
2073 as features from the Single Unix Specification and some BSD and GNU
2074 extensions.  Other library implementations may not support all these
2075 features; GCC does not support warning about features that go beyond a
2076 particular library's limitations.  However, if @option{-pedantic} is used
2077 with @option{-Wformat}, warnings will be given about format features not
2078 in the selected standard version (but not for @code{strfmon} formats,
2079 since those are not in any version of the C standard).  @xref{C Dialect
2080 Options,,Options Controlling C Dialect}.
2081
2082 Since @option{-Wformat} also checks for null format arguments for
2083 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2084
2085 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2086 aspects of format checking, the options @option{-Wformat-y2k},
2087 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2088 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2089 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2090
2091 @item -Wformat-y2k
2092 @opindex Wformat-y2k
2093 If @option{-Wformat} is specified, also warn about @code{strftime}
2094 formats which may yield only a two-digit year.
2095
2096 @item -Wno-format-extra-args
2097 @opindex Wno-format-extra-args
2098 If @option{-Wformat} is specified, do not warn about excess arguments to a
2099 @code{printf} or @code{scanf} format function.  The C standard specifies
2100 that such arguments are ignored.
2101
2102 Where the unused arguments lie between used arguments that are
2103 specified with @samp{$} operand number specifications, normally
2104 warnings are still given, since the implementation could not know what
2105 type to pass to @code{va_arg} to skip the unused arguments.  However,
2106 in the case of @code{scanf} formats, this option will suppress the
2107 warning if the unused arguments are all pointers, since the Single
2108 Unix Specification says that such unused arguments are allowed.
2109
2110 @item -Wno-format-zero-length
2111 @opindex Wno-format-zero-length
2112 If @option{-Wformat} is specified, do not warn about zero-length formats.
2113 The C standard specifies that zero-length formats are allowed.
2114
2115 @item -Wformat-nonliteral
2116 @opindex Wformat-nonliteral
2117 If @option{-Wformat} is specified, also warn if the format string is not a
2118 string literal and so cannot be checked, unless the format function
2119 takes its format arguments as a @code{va_list}.
2120
2121 @item -Wformat-security
2122 @opindex Wformat-security
2123 If @option{-Wformat} is specified, also warn about uses of format
2124 functions that represent possible security problems.  At present, this
2125 warns about calls to @code{printf} and @code{scanf} functions where the
2126 format string is not a string literal and there are no format arguments,
2127 as in @code{printf (foo);}.  This may be a security hole if the format
2128 string came from untrusted input and contains @samp{%n}.  (This is
2129 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2130 in future warnings may be added to @option{-Wformat-security} that are not
2131 included in @option{-Wformat-nonliteral}.)
2132
2133 @item -Wformat=2
2134 @opindex Wformat=2
2135 Enable @option{-Wformat} plus format checks not included in
2136 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2137 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2138
2139 @item -Wnonnull
2140 @opindex Wnonnull
2141 Warn about passing a null pointer for arguments marked as
2142 requiring a non-null value by the @code{nonnull} function attribute.
2143
2144 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2145 can be disabled with the @option{-Wno-nonnull} option.
2146
2147 @item -Winit-self @r{(C, C++, and Objective-C only)}
2148 @opindex Winit-self
2149 Warn about uninitialized variables which are initialized with themselves.
2150 Note this option can only be used with the @option{-Wuninitialized} option,
2151 which in turn only works with @option{-O1} and above.
2152
2153 For example, GCC will warn about @code{i} being uninitialized in the
2154 following snippet only when @option{-Winit-self} has been specified:
2155 @smallexample
2156 @group
2157 int f()
2158 @{
2159   int i = i;
2160   return i;
2161 @}
2162 @end group
2163 @end smallexample
2164
2165 @item -Wimplicit-int
2166 @opindex Wimplicit-int
2167 Warn when a declaration does not specify a type.
2168
2169 @item -Wimplicit-function-declaration
2170 @itemx -Werror-implicit-function-declaration
2171 @opindex Wimplicit-function-declaration
2172 @opindex Werror-implicit-function-declaration
2173 Give a warning (or error) whenever a function is used before being
2174 declared.
2175
2176 @item -Wimplicit
2177 @opindex Wimplicit
2178 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2179
2180 @item -Wmain
2181 @opindex Wmain
2182 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2183 function with external linkage, returning int, taking either zero
2184 arguments, two, or three arguments of appropriate types.
2185
2186 @item -Wmissing-braces
2187 @opindex Wmissing-braces
2188 Warn if an aggregate or union initializer is not fully bracketed.  In
2189 the following example, the initializer for @samp{a} is not fully
2190 bracketed, but that for @samp{b} is fully bracketed.
2191
2192 @smallexample
2193 int a[2][2] = @{ 0, 1, 2, 3 @};
2194 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2195 @end smallexample
2196
2197 @item -Wparentheses
2198 @opindex Wparentheses
2199 Warn if parentheses are omitted in certain contexts, such
2200 as when there is an assignment in a context where a truth value
2201 is expected, or when operators are nested whose precedence people
2202 often get confused about.
2203
2204 Also warn about constructions where there may be confusion to which
2205 @code{if} statement an @code{else} branch belongs.  Here is an example of
2206 such a case:
2207
2208 @smallexample
2209 @group
2210 @{
2211   if (a)
2212     if (b)
2213       foo ();
2214   else
2215     bar ();
2216 @}
2217 @end group
2218 @end smallexample
2219
2220 In C, every @code{else} branch belongs to the innermost possible @code{if}
2221 statement, which in this example is @code{if (b)}.  This is often not
2222 what the programmer expected, as illustrated in the above example by
2223 indentation the programmer chose.  When there is the potential for this
2224 confusion, GCC will issue a warning when this flag is specified.
2225 To eliminate the warning, add explicit braces around the innermost
2226 @code{if} statement so there is no way the @code{else} could belong to
2227 the enclosing @code{if}.  The resulting code would look like this:
2228
2229 @smallexample
2230 @group
2231 @{
2232   if (a)
2233     @{
2234       if (b)
2235         foo ();
2236       else
2237         bar ();
2238     @}
2239 @}
2240 @end group
2241 @end smallexample
2242
2243 @item -Wsequence-point
2244 @opindex Wsequence-point
2245 Warn about code that may have undefined semantics because of violations
2246 of sequence point rules in the C standard.
2247
2248 The C standard defines the order in which expressions in a C program are
2249 evaluated in terms of @dfn{sequence points}, which represent a partial
2250 ordering between the execution of parts of the program: those executed
2251 before the sequence point, and those executed after it.  These occur
2252 after the evaluation of a full expression (one which is not part of a
2253 larger expression), after the evaluation of the first operand of a
2254 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2255 function is called (but after the evaluation of its arguments and the
2256 expression denoting the called function), and in certain other places.
2257 Other than as expressed by the sequence point rules, the order of
2258 evaluation of subexpressions of an expression is not specified.  All
2259 these rules describe only a partial order rather than a total order,
2260 since, for example, if two functions are called within one expression
2261 with no sequence point between them, the order in which the functions
2262 are called is not specified.  However, the standards committee have
2263 ruled that function calls do not overlap.
2264
2265 It is not specified when between sequence points modifications to the
2266 values of objects take effect.  Programs whose behavior depends on this
2267 have undefined behavior; the C standard specifies that ``Between the
2268 previous and next sequence point an object shall have its stored value
2269 modified at most once by the evaluation of an expression.  Furthermore,
2270 the prior value shall be read only to determine the value to be
2271 stored.''.  If a program breaks these rules, the results on any
2272 particular implementation are entirely unpredictable.
2273
2274 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2275 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2276 diagnosed by this option, and it may give an occasional false positive
2277 result, but in general it has been found fairly effective at detecting
2278 this sort of problem in programs.
2279
2280 The present implementation of this option only works for C programs.  A
2281 future implementation may also work for C++ programs.
2282
2283 The C standard is worded confusingly, therefore there is some debate
2284 over the precise meaning of the sequence point rules in subtle cases.
2285 Links to discussions of the problem, including proposed formal
2286 definitions, may be found on our readings page, at
2287 @w{@uref{http://gcc.gnu.org/readings.html}}.
2288
2289 @item -Wreturn-type
2290 @opindex Wreturn-type
2291 Warn whenever a function is defined with a return-type that defaults to
2292 @code{int}.  Also warn about any @code{return} statement with no
2293 return-value in a function whose return-type is not @code{void}.
2294
2295 For C++, a function without return type always produces a diagnostic
2296 message, even when @option{-Wno-return-type} is specified.  The only
2297 exceptions are @samp{main} and functions defined in system headers.
2298
2299 @item -Wswitch
2300 @opindex Wswitch
2301 Warn whenever a @code{switch} statement has an index of enumeral type
2302 and lacks a @code{case} for one or more of the named codes of that
2303 enumeration.  (The presence of a @code{default} label prevents this
2304 warning.)  @code{case} labels outside the enumeration range also
2305 provoke warnings when this option is used.
2306
2307 @item -Wswitch-default
2308 @opindex Wswitch-switch
2309 Warn whenever a @code{switch} statement does not have a @code{default}
2310 case.
2311
2312 @item -Wswitch-enum
2313 @opindex Wswitch-enum
2314 Warn whenever a @code{switch} statement has an index of enumeral type
2315 and lacks a @code{case} for one or more of the named codes of that
2316 enumeration.  @code{case} labels outside the enumeration range also
2317 provoke warnings when this option is used.
2318
2319 @item -Wtrigraphs
2320 @opindex Wtrigraphs
2321 Warn if any trigraphs are encountered that might change the meaning of
2322 the program (trigraphs within comments are not warned about).
2323
2324 @item -Wunused-function
2325 @opindex Wunused-function
2326 Warn whenever a static function is declared but not defined or a
2327 non\-inline static function is unused.
2328
2329 @item -Wunused-label
2330 @opindex Wunused-label
2331 Warn whenever a label is declared but not used.
2332
2333 To suppress this warning use the @samp{unused} attribute
2334 (@pxref{Variable Attributes}).
2335
2336 @item -Wunused-parameter
2337 @opindex Wunused-parameter
2338 Warn whenever a function parameter is unused aside from its declaration.
2339
2340 To suppress this warning use the @samp{unused} attribute
2341 (@pxref{Variable Attributes}).
2342
2343 @item -Wunused-variable
2344 @opindex Wunused-variable
2345 Warn whenever a local variable or non-constant static variable is unused
2346 aside from its declaration
2347
2348 To suppress this warning use the @samp{unused} attribute
2349 (@pxref{Variable Attributes}).
2350
2351 @item -Wunused-value
2352 @opindex Wunused-value
2353 Warn whenever a statement computes a result that is explicitly not used.
2354
2355 To suppress this warning cast the expression to @samp{void}.
2356
2357 @item -Wunused
2358 @opindex Wunused
2359 All the above @option{-Wunused} options combined.
2360
2361 In order to get a warning about an unused function parameter, you must
2362 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2363 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2364
2365 @item -Wuninitialized
2366 @opindex Wuninitialized
2367 Warn if an automatic variable is used without first being initialized or
2368 if a variable may be clobbered by a @code{setjmp} call.
2369
2370 These warnings are possible only in optimizing compilation,
2371 because they require data flow information that is computed only
2372 when optimizing.  If you don't specify @option{-O}, you simply won't
2373 get these warnings.
2374
2375 If you want to warn about code which uses the uninitialized value of the
2376 variable in its own initializer, use the @option{-Winit-self} option.
2377
2378 These warnings occur only for variables that are candidates for
2379 register allocation.  Therefore, they do not occur for a variable that
2380 is declared @code{volatile}, or whose address is taken, or whose size
2381 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2382 structures, unions or arrays, even when they are in registers.
2383
2384 Note that there may be no warning about a variable that is used only
2385 to compute a value that itself is never used, because such
2386 computations may be deleted by data flow analysis before the warnings
2387 are printed.
2388
2389 These warnings are made optional because GCC is not smart
2390 enough to see all the reasons why the code might be correct
2391 despite appearing to have an error.  Here is one example of how
2392 this can happen:
2393
2394 @smallexample
2395 @group
2396 @{
2397   int x;
2398   switch (y)
2399     @{
2400     case 1: x = 1;
2401       break;
2402     case 2: x = 4;
2403       break;
2404     case 3: x = 5;
2405     @}
2406   foo (x);
2407 @}
2408 @end group
2409 @end smallexample
2410
2411 @noindent
2412 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2413 always initialized, but GCC doesn't know this.  Here is
2414 another common case:
2415
2416 @smallexample
2417 @{
2418   int save_y;
2419   if (change_y) save_y = y, y = new_y;
2420   @dots{}
2421   if (change_y) y = save_y;
2422 @}
2423 @end smallexample
2424
2425 @noindent
2426 This has no bug because @code{save_y} is used only if it is set.
2427
2428 @cindex @code{longjmp} warnings
2429 This option also warns when a non-volatile automatic variable might be
2430 changed by a call to @code{longjmp}.  These warnings as well are possible
2431 only in optimizing compilation.
2432
2433 The compiler sees only the calls to @code{setjmp}.  It cannot know
2434 where @code{longjmp} will be called; in fact, a signal handler could
2435 call it at any point in the code.  As a result, you may get a warning
2436 even when there is in fact no problem because @code{longjmp} cannot
2437 in fact be called at the place which would cause a problem.
2438
2439 Some spurious warnings can be avoided if you declare all the functions
2440 you use that never return as @code{noreturn}.  @xref{Function
2441 Attributes}.
2442
2443 @item -Wunknown-pragmas
2444 @opindex Wunknown-pragmas
2445 @cindex warning for unknown pragmas
2446 @cindex unknown pragmas, warning
2447 @cindex pragmas, warning of unknown
2448 Warn when a #pragma directive is encountered which is not understood by
2449 GCC@.  If this command line option is used, warnings will even be issued
2450 for unknown pragmas in system header files.  This is not the case if
2451 the warnings were only enabled by the @option{-Wall} command line option.
2452
2453 @item -Wstrict-aliasing
2454 @opindex Wstrict-aliasing
2455 This option is only active when @option{-fstrict-aliasing} is active.
2456 It warns about code which might break the strict aliasing rules that the
2457 compiler is using for optimization. The warning does not catch all
2458 cases, but does attempt to catch the more common pitfalls. It is
2459 included in @option{-Wall}.
2460
2461 @item -Wall
2462 @opindex Wall
2463 All of the above @samp{-W} options combined.  This enables all the
2464 warnings about constructions that some users consider questionable, and
2465 that are easy to avoid (or modify to prevent the warning), even in
2466 conjunction with macros.  This also enables some language-specific
2467 warnings described in @ref{C++ Dialect Options} and
2468 @ref{Objective-C Dialect Options}.
2469 @end table
2470
2471 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2472 Some of them warn about constructions that users generally do not
2473 consider questionable, but which occasionally you might wish to check
2474 for; others warn about constructions that are necessary or hard to avoid
2475 in some cases, and there is no simple way to modify the code to suppress
2476 the warning.
2477
2478 @table @gcctabopt
2479 @item -Wextra
2480 @opindex W
2481 @opindex Wextra
2482 (This option used to be called @option{-W}.  The older name is still
2483 supported, but the newer name is more descriptive.)  Print extra warning
2484 messages for these events:
2485
2486 @itemize @bullet
2487 @item
2488 A function can return either with or without a value.  (Falling
2489 off the end of the function body is considered returning without
2490 a value.)  For example, this function would evoke such a
2491 warning:
2492
2493 @smallexample
2494 @group
2495 foo (a)
2496 @{
2497   if (a > 0)
2498     return a;
2499 @}
2500 @end group
2501 @end smallexample
2502
2503 @item
2504 An expression-statement or the left-hand side of a comma expression
2505 contains no side effects.
2506 To suppress the warning, cast the unused expression to void.
2507 For example, an expression such as @samp{x[i,j]} will cause a warning,
2508 but @samp{x[(void)i,j]} will not.
2509
2510 @item
2511 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2512
2513 @item
2514 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2515 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2516 that of ordinary mathematical notation.
2517
2518 @item
2519 Storage-class specifiers like @code{static} are not the first things in
2520 a declaration.  According to the C Standard, this usage is obsolescent.
2521
2522 @item
2523 The return type of a function has a type qualifier such as @code{const}.
2524 Such a type qualifier has no effect, since the value returned by a
2525 function is not an lvalue.  (But don't warn about the GNU extension of
2526 @code{volatile void} return types.  That extension will be warned about
2527 if @option{-pedantic} is specified.)
2528
2529 @item
2530 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2531 arguments.
2532
2533 @item
2534 A comparison between signed and unsigned values could produce an
2535 incorrect result when the signed value is converted to unsigned.
2536 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2537
2538 @item
2539 An aggregate has an initializer which does not initialize all members.
2540 For example, the following code would cause such a warning, because
2541 @code{x.h} would be implicitly initialized to zero:
2542
2543 @smallexample
2544 struct s @{ int f, g, h; @};
2545 struct s x = @{ 3, 4 @};
2546 @end smallexample
2547
2548 @item
2549 A function parameter is declared without a type specifier in K&R-style
2550 functions:
2551
2552 @smallexample
2553 void foo(bar) @{ @}
2554 @end smallexample
2555
2556 @item
2557 An empty body occurs in an @samp{if} or @samp{else} statement.
2558
2559 @item
2560 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2561 @samp{>}, or @samp{>=}.
2562
2563 @item
2564 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2565
2566 @item
2567 Any of several floating-point events that often indicate errors, such as
2568 overflow, underflow, loss of precision, etc.
2569
2570 @item @r{(C++ only)}
2571 An enumerator and a non-enumerator both appear in a conditional expression.
2572
2573 @item @r{(C++ only)}
2574 A non-static reference or non-static @samp{const} member appears in a
2575 class without constructors.
2576
2577 @item @r{(C++ only)}
2578 Ambiguous virtual bases.
2579
2580 @item @r{(C++ only)}
2581 Subscripting an array which has been declared @samp{register}.
2582
2583 @item @r{(C++ only)}
2584 Taking the address of a variable which has been declared @samp{register}.
2585
2586 @item @r{(C++ only)}
2587 A base class is not initialized in a derived class' copy constructor.
2588 @end itemize
2589
2590 @item -Wno-div-by-zero
2591 @opindex Wno-div-by-zero
2592 @opindex Wdiv-by-zero
2593 Do not warn about compile-time integer division by zero.  Floating point
2594 division by zero is not warned about, as it can be a legitimate way of
2595 obtaining infinities and NaNs.
2596
2597 @item -Wsystem-headers
2598 @opindex Wsystem-headers
2599 @cindex warnings from system headers
2600 @cindex system headers, warnings from
2601 Print warning messages for constructs found in system header files.
2602 Warnings from system headers are normally suppressed, on the assumption
2603 that they usually do not indicate real problems and would only make the
2604 compiler output harder to read.  Using this command line option tells
2605 GCC to emit warnings from system headers as if they occurred in user
2606 code.  However, note that using @option{-Wall} in conjunction with this
2607 option will @emph{not} warn about unknown pragmas in system
2608 headers---for that, @option{-Wunknown-pragmas} must also be used.
2609
2610 @item -Wfloat-equal
2611 @opindex Wfloat-equal
2612 Warn if floating point values are used in equality comparisons.
2613
2614 The idea behind this is that sometimes it is convenient (for the
2615 programmer) to consider floating-point values as approximations to
2616 infinitely precise real numbers.  If you are doing this, then you need
2617 to compute (by analyzing the code, or in some other way) the maximum or
2618 likely maximum error that the computation introduces, and allow for it
2619 when performing comparisons (and when producing output, but that's a
2620 different problem).  In particular, instead of testing for equality, you
2621 would check to see whether the two values have ranges that overlap; and
2622 this is done with the relational operators, so equality comparisons are
2623 probably mistaken.
2624
2625 @item -Wtraditional @r{(C only)}
2626 @opindex Wtraditional
2627 Warn about certain constructs that behave differently in traditional and
2628 ISO C@.  Also warn about ISO C constructs that have no traditional C
2629 equivalent, and/or problematic constructs which should be avoided.
2630
2631 @itemize @bullet
2632 @item
2633 Macro parameters that appear within string literals in the macro body.
2634 In traditional C macro replacement takes place within string literals,
2635 but does not in ISO C@.
2636
2637 @item
2638 In traditional C, some preprocessor directives did not exist.
2639 Traditional preprocessors would only consider a line to be a directive
2640 if the @samp{#} appeared in column 1 on the line.  Therefore
2641 @option{-Wtraditional} warns about directives that traditional C
2642 understands but would ignore because the @samp{#} does not appear as the
2643 first character on the line.  It also suggests you hide directives like
2644 @samp{#pragma} not understood by traditional C by indenting them.  Some
2645 traditional implementations would not recognize @samp{#elif}, so it
2646 suggests avoiding it altogether.
2647
2648 @item
2649 A function-like macro that appears without arguments.
2650
2651 @item
2652 The unary plus operator.
2653
2654 @item
2655 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2656 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2657 constants.)  Note, these suffixes appear in macros defined in the system
2658 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2659 Use of these macros in user code might normally lead to spurious
2660 warnings, however gcc's integrated preprocessor has enough context to
2661 avoid warning in these cases.
2662
2663 @item
2664 A function declared external in one block and then used after the end of
2665 the block.
2666
2667 @item
2668 A @code{switch} statement has an operand of type @code{long}.
2669
2670 @item
2671 A non-@code{static} function declaration follows a @code{static} one.
2672 This construct is not accepted by some traditional C compilers.
2673
2674 @item
2675 The ISO type of an integer constant has a different width or
2676 signedness from its traditional type.  This warning is only issued if
2677 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2678 typically represent bit patterns, are not warned about.
2679
2680 @item
2681 Usage of ISO string concatenation is detected.
2682
2683 @item
2684 Initialization of automatic aggregates.
2685
2686 @item
2687 Identifier conflicts with labels.  Traditional C lacks a separate
2688 namespace for labels.
2689
2690 @item
2691 Initialization of unions.  If the initializer is zero, the warning is
2692 omitted.  This is done under the assumption that the zero initializer in
2693 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2694 initializer warnings and relies on default initialization to zero in the
2695 traditional C case.
2696
2697 @item
2698 Conversions by prototypes between fixed/floating point values and vice
2699 versa.  The absence of these prototypes when compiling with traditional
2700 C would cause serious problems.  This is a subset of the possible
2701 conversion warnings, for the full set use @option{-Wconversion}.
2702
2703 @item
2704 Use of ISO C style function definitions.  This warning intentionally is
2705 @emph{not} issued for prototype declarations or variadic functions
2706 because these ISO C features will appear in your code when using
2707 libiberty's traditional C compatibility macros, @code{PARAMS} and
2708 @code{VPARAMS}.  This warning is also bypassed for nested functions
2709 because that feature is already a gcc extension and thus not relevant to
2710 traditional C compatibility.
2711 @end itemize
2712
2713 @item -Wdeclaration-after-statement @r{(C only)}
2714 @opindex Wdeclaration-after-statement
2715 Warn when a declaration is found after a statement in a block.  This
2716 construct, known from C++, was introduced with ISO C99 and is by default
2717 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2718 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2719
2720 @item -Wundef
2721 @opindex Wundef
2722 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2723
2724 @item -Wendif-labels
2725 @opindex Wendif-labels
2726 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2727
2728 @item -Wshadow
2729 @opindex Wshadow
2730 Warn whenever a local variable shadows another local variable, parameter or
2731 global variable or whenever a built-in function is shadowed.
2732
2733 @item -Wlarger-than-@var{len}
2734 @opindex Wlarger-than
2735 Warn whenever an object of larger than @var{len} bytes is defined.
2736
2737 @item -Wpointer-arith
2738 @opindex Wpointer-arith
2739 Warn about anything that depends on the ``size of'' a function type or
2740 of @code{void}.  GNU C assigns these types a size of 1, for
2741 convenience in calculations with @code{void *} pointers and pointers
2742 to functions.
2743
2744 @item -Wbad-function-cast @r{(C only)}
2745 @opindex Wbad-function-cast
2746 Warn whenever a function call is cast to a non-matching type.
2747 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2748
2749 @item -Wcast-qual
2750 @opindex Wcast-qual
2751 Warn whenever a pointer is cast so as to remove a type qualifier from
2752 the target type.  For example, warn if a @code{const char *} is cast
2753 to an ordinary @code{char *}.
2754
2755 @item -Wcast-align
2756 @opindex Wcast-align
2757 Warn whenever a pointer is cast such that the required alignment of the
2758 target is increased.  For example, warn if a @code{char *} is cast to
2759 an @code{int *} on machines where integers can only be accessed at
2760 two- or four-byte boundaries.
2761
2762 @item -Wwrite-strings
2763 @opindex Wwrite-strings
2764 When compiling C, give string constants the type @code{const
2765 char[@var{length}]} so that
2766 copying the address of one into a non-@code{const} @code{char *}
2767 pointer will get a warning; when compiling C++, warn about the
2768 deprecated conversion from string constants to @code{char *}.
2769 These warnings will help you find at
2770 compile time code that can try to write into a string constant, but
2771 only if you have been very careful about using @code{const} in
2772 declarations and prototypes.  Otherwise, it will just be a nuisance;
2773 this is why we did not make @option{-Wall} request these warnings.
2774
2775 @item -Wconversion
2776 @opindex Wconversion
2777 Warn if a prototype causes a type conversion that is different from what
2778 would happen to the same argument in the absence of a prototype.  This
2779 includes conversions of fixed point to floating and vice versa, and
2780 conversions changing the width or signedness of a fixed point argument
2781 except when the same as the default promotion.
2782
2783 Also, warn if a negative integer constant expression is implicitly
2784 converted to an unsigned type.  For example, warn about the assignment
2785 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2786 casts like @code{(unsigned) -1}.
2787
2788 @item -Wsign-compare
2789 @opindex Wsign-compare
2790 @cindex warning for comparison of signed and unsigned values
2791 @cindex comparison of signed and unsigned values, warning
2792 @cindex signed and unsigned values, comparison warning
2793 Warn when a comparison between signed and unsigned values could produce
2794 an incorrect result when the signed value is converted to unsigned.
2795 This warning is also enabled by @option{-Wextra}; to get the other warnings
2796 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2797
2798 @item -Waggregate-return
2799 @opindex Waggregate-return
2800 Warn if any functions that return structures or unions are defined or
2801 called.  (In languages where you can return an array, this also elicits
2802 a warning.)
2803
2804 @item -Wstrict-prototypes @r{(C only)}
2805 @opindex Wstrict-prototypes
2806 Warn if a function is declared or defined without specifying the
2807 argument types.  (An old-style function definition is permitted without
2808 a warning if preceded by a declaration which specifies the argument
2809 types.)
2810
2811 @item -Wold-style-definition @r{(C only)}
2812 @opindex Wold-style-definition
2813 Warn if an old-style function definition is used.  A warning is given
2814 even if there is a previous prototype.
2815
2816 @item -Wmissing-prototypes @r{(C only)}
2817 @opindex Wmissing-prototypes
2818 Warn if a global function is defined without a previous prototype
2819 declaration.  This warning is issued even if the definition itself
2820 provides a prototype.  The aim is to detect global functions that fail
2821 to be declared in header files.
2822
2823 @item -Wmissing-declarations @r{(C only)}
2824 @opindex Wmissing-declarations
2825 Warn if a global function is defined without a previous declaration.
2826 Do so even if the definition itself provides a prototype.
2827 Use this option to detect global functions that are not declared in
2828 header files.
2829
2830 @item -Wmissing-noreturn
2831 @opindex Wmissing-noreturn
2832 Warn about functions which might be candidates for attribute @code{noreturn}.
2833 Note these are only possible candidates, not absolute ones.  Care should
2834 be taken to manually verify functions actually do not ever return before
2835 adding the @code{noreturn} attribute, otherwise subtle code generation
2836 bugs could be introduced.  You will not get a warning for @code{main} in
2837 hosted C environments.
2838
2839 @item -Wmissing-format-attribute
2840 @opindex Wmissing-format-attribute
2841 @opindex Wformat
2842 If @option{-Wformat} is enabled, also warn about functions which might be
2843 candidates for @code{format} attributes.  Note these are only possible
2844 candidates, not absolute ones.  GCC will guess that @code{format}
2845 attributes might be appropriate for any function that calls a function
2846 like @code{vprintf} or @code{vscanf}, but this might not always be the
2847 case, and some functions for which @code{format} attributes are
2848 appropriate may not be detected.  This option has no effect unless
2849 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2850
2851 @item -Wno-multichar
2852 @opindex Wno-multichar
2853 @opindex Wmultichar
2854 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2855 Usually they indicate a typo in the user's code, as they have
2856 implementation-defined values, and should not be used in portable code.
2857
2858 @item -Wno-deprecated-declarations
2859 @opindex Wno-deprecated-declarations
2860 Do not warn about uses of functions, variables, and types marked as
2861 deprecated by using the @code{deprecated} attribute.
2862 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2863 @pxref{Type Attributes}.)
2864
2865 @item -Wpacked
2866 @opindex Wpacked
2867 Warn if a structure is given the packed attribute, but the packed
2868 attribute has no effect on the layout or size of the structure.
2869 Such structures may be mis-aligned for little benefit.  For
2870 instance, in this code, the variable @code{f.x} in @code{struct bar}
2871 will be misaligned even though @code{struct bar} does not itself
2872 have the packed attribute:
2873
2874 @smallexample
2875 @group
2876 struct foo @{
2877   int x;
2878   char a, b, c, d;
2879 @} __attribute__((packed));
2880 struct bar @{
2881   char z;
2882   struct foo f;
2883 @};
2884 @end group
2885 @end smallexample
2886
2887 @item -Wpadded
2888 @opindex Wpadded
2889 Warn if padding is included in a structure, either to align an element
2890 of the structure or to align the whole structure.  Sometimes when this
2891 happens it is possible to rearrange the fields of the structure to
2892 reduce the padding and so make the structure smaller.
2893
2894 @item -Wredundant-decls
2895 @opindex Wredundant-decls
2896 Warn if anything is declared more than once in the same scope, even in
2897 cases where multiple declaration is valid and changes nothing.
2898
2899 @item -Wnested-externs @r{(C only)}
2900 @opindex Wnested-externs
2901 Warn if an @code{extern} declaration is encountered within a function.
2902
2903 @item -Wunreachable-code
2904 @opindex Wunreachable-code
2905 Warn if the compiler detects that code will never be executed.
2906
2907 This option is intended to warn when the compiler detects that at
2908 least a whole line of source code will never be executed, because
2909 some condition is never satisfied or because it is after a
2910 procedure that never returns.
2911
2912 It is possible for this option to produce a warning even though there
2913 are circumstances under which part of the affected line can be executed,
2914 so care should be taken when removing apparently-unreachable code.
2915
2916 For instance, when a function is inlined, a warning may mean that the
2917 line is unreachable in only one inlined copy of the function.
2918
2919 This option is not made part of @option{-Wall} because in a debugging
2920 version of a program there is often substantial code which checks
2921 correct functioning of the program and is, hopefully, unreachable
2922 because the program does work.  Another common use of unreachable
2923 code is to provide behavior which is selectable at compile-time.
2924
2925 @item -Winline
2926 @opindex Winline
2927 Warn if a function can not be inlined and it was declared as inline.
2928 Even with this option, the compiler will not warn about failures to
2929 inline functions declared in system headers.
2930
2931 The compiler uses a variety of heuristics to determine whether or not
2932 to inline a function.  For example, the compiler takes into account
2933 the size of the function being inlined and the the amount of inlining
2934 that has already been done in the current function.  Therefore,
2935 seemingly insignificant changes in the source program can cause the
2936 warnings produced by @option{-Winline} to appear or disappear.
2937
2938 @item -Wno-invalid-offsetof @r{(C++ only)}
2939 @opindex Wno-invalid-offsetof
2940 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
2941 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
2942 to a non-POD type is undefined.  In existing C++ implementations,
2943 however, @samp{offsetof} typically gives meaningful results even when
2944 applied to certain kinds of non-POD types. (Such as a simple
2945 @samp{struct} that fails to be a POD type only by virtue of having a
2946 constructor.)  This flag is for users who are aware that they are
2947 writing nonportable code and who have deliberately chosen to ignore the
2948 warning about it.
2949
2950 The restrictions on @samp{offsetof} may be relaxed in a future version
2951 of the C++ standard.
2952
2953 @item -Winvalid-pch
2954 @opindex Winvalid-pch
2955 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
2956 the search path but can't be used.
2957
2958 @item -Wlong-long
2959 @opindex Wlong-long
2960 @opindex Wno-long-long
2961 Warn if @samp{long long} type is used.  This is default.  To inhibit
2962 the warning messages, use @option{-Wno-long-long}.  Flags
2963 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2964 only when @option{-pedantic} flag is used.
2965
2966 @item -Wdisabled-optimization
2967 @opindex Wdisabled-optimization
2968 Warn if a requested optimization pass is disabled.  This warning does
2969 not generally indicate that there is anything wrong with your code; it
2970 merely indicates that GCC's optimizers were unable to handle the code
2971 effectively.  Often, the problem is that your code is too big or too
2972 complex; GCC will refuse to optimize programs when the optimization
2973 itself is likely to take inordinate amounts of time.
2974
2975 @item -Werror
2976 @opindex Werror
2977 Make all warnings into errors.
2978 @end table
2979
2980 @node Debugging Options
2981 @section Options for Debugging Your Program or GCC
2982 @cindex options, debugging
2983 @cindex debugging information options
2984
2985 GCC has various special options that are used for debugging
2986 either your program or GCC:
2987
2988 @table @gcctabopt
2989 @item -g
2990 @opindex g
2991 Produce debugging information in the operating system's native format
2992 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
2993 information.
2994
2995 On most systems that use stabs format, @option{-g} enables use of extra
2996 debugging information that only GDB can use; this extra information
2997 makes debugging work better in GDB but will probably make other debuggers
2998 crash or
2999 refuse to read the program.  If you want to control for certain whether
3000 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3001 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3002
3003 Unlike most other C compilers, GCC allows you to use @option{-g} with
3004 @option{-O}.  The shortcuts taken by optimized code may occasionally
3005 produce surprising results: some variables you declared may not exist
3006 at all; flow of control may briefly move where you did not expect it;
3007 some statements may not be executed because they compute constant
3008 results or their values were already at hand; some statements may
3009 execute in different places because they were moved out of loops.
3010
3011 Nevertheless it proves possible to debug optimized output.  This makes
3012 it reasonable to use the optimizer for programs that might have bugs.
3013
3014 The following options are useful when GCC is generated with the
3015 capability for more than one debugging format.
3016
3017 @item -ggdb
3018 @opindex ggdb
3019 Produce debugging information for use by GDB@.  This means to use the
3020 most expressive format available (DWARF 2, stabs, or the native format
3021 if neither of those are supported), including GDB extensions if at all
3022 possible.
3023
3024 @item -gstabs
3025 @opindex gstabs
3026 Produce debugging information in stabs format (if that is supported),
3027 without GDB extensions.  This is the format used by DBX on most BSD
3028 systems.  On MIPS, Alpha and System V Release 4 systems this option
3029 produces stabs debugging output which is not understood by DBX or SDB@.
3030 On System V Release 4 systems this option requires the GNU assembler.
3031
3032 @item -feliminate-unused-debug-symbols
3033 @opindex feliminate-unused-debug-symbols
3034 Produce debugging information in stabs format (if that is supported),
3035 for only symbols that are actually used.
3036
3037 @item -gstabs+
3038 @opindex gstabs+
3039 Produce debugging information in stabs format (if that is supported),
3040 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3041 use of these extensions is likely to make other debuggers crash or
3042 refuse to read the program.
3043
3044 @item -gcoff
3045 @opindex gcoff
3046 Produce debugging information in COFF format (if that is supported).
3047 This is the format used by SDB on most System V systems prior to
3048 System V Release 4.
3049
3050 @item -gxcoff
3051 @opindex gxcoff
3052 Produce debugging information in XCOFF format (if that is supported).
3053 This is the format used by the DBX debugger on IBM RS/6000 systems.
3054
3055 @item -gxcoff+
3056 @opindex gxcoff+
3057 Produce debugging information in XCOFF format (if that is supported),
3058 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3059 use of these extensions is likely to make other debuggers crash or
3060 refuse to read the program, and may cause assemblers other than the GNU
3061 assembler (GAS) to fail with an error.
3062
3063 @item -gdwarf-2
3064 @opindex gdwarf-2
3065 Produce debugging information in DWARF version 2 format (if that is
3066 supported).  This is the format used by DBX on IRIX 6.
3067
3068 @item -gvms
3069 @opindex gvms
3070 Produce debugging information in VMS debug format (if that is
3071 supported).  This is the format used by DEBUG on VMS systems.
3072
3073 @item -g@var{level}
3074 @itemx -ggdb@var{level}
3075 @itemx -gstabs@var{level}
3076 @itemx -gcoff@var{level}
3077 @itemx -gxcoff@var{level}
3078 @itemx -gvms@var{level}
3079 Request debugging information and also use @var{level} to specify how
3080 much information.  The default level is 2.
3081
3082 Level 1 produces minimal information, enough for making backtraces in
3083 parts of the program that you don't plan to debug.  This includes
3084 descriptions of functions and external variables, but no information
3085 about local variables and no line numbers.
3086
3087 Level 3 includes extra information, such as all the macro definitions
3088 present in the program.  Some debuggers support macro expansion when
3089 you use @option{-g3}.
3090
3091 Note that in order to avoid confusion between DWARF1 debug level 2,
3092 and DWARF2 @option{-gdwarf-2} does not accept a concatenated debug
3093 level.  Instead use an additional @option{-g@var{level}} option to
3094 change the debug level for DWARF2.
3095
3096 @item -feliminate-dwarf2-dups
3097 @opindex feliminate-dwarf2-dups
3098 Compress DWARF2 debugging information by eliminating duplicated
3099 information about each symbol.  This option only makes sense when
3100 generating DWARF2 debugging information with @option{-gdwarf-2}.
3101
3102 @cindex @command{prof}
3103 @item -p
3104 @opindex p
3105 Generate extra code to write profile information suitable for the
3106 analysis program @command{prof}.  You must use this option when compiling
3107 the source files you want data about, and you must also use it when
3108 linking.
3109
3110 @cindex @command{gprof}
3111 @item -pg
3112 @opindex pg
3113 Generate extra code to write profile information suitable for the
3114 analysis program @command{gprof}.  You must use this option when compiling
3115 the source files you want data about, and you must also use it when
3116 linking.
3117
3118 @item -Q
3119 @opindex Q
3120 Makes the compiler print out each function name as it is compiled, and
3121 print some statistics about each pass when it finishes.
3122
3123 @item -ftime-report
3124 @opindex ftime-report
3125 Makes the compiler print some statistics about the time consumed by each
3126 pass when it finishes.
3127
3128 @item -fmem-report
3129 @opindex fmem-report
3130 Makes the compiler print some statistics about permanent memory
3131 allocation when it finishes.
3132
3133 @item -fprofile-arcs
3134 @opindex fprofile-arcs
3135 Add code so that program flow @dfn{arcs} are instrumented.  During
3136 execution the program records how many times each branch and call is
3137 executed and how many times it is taken or returns.  When the compiled
3138 program exits it saves this data to a file called
3139 @file{@var{auxname}.gcda} for each source file. The data may be used for
3140 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3141 test coverage analysis (@option{-ftest-coverage}). Each object file's
3142 @var{auxname} is generated from the name of the output file, if
3143 explicitly specified and it is not the final executable, otherwise it is
3144 the basename of the source file. In both cases any suffix is removed
3145 (e.g.  @file{foo.gcda} for input file @file{dir/foo.c}, or
3146 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3147
3148 @itemize
3149
3150 @item
3151 Compile the source files with @option{-fprofile-arcs} plus optimization
3152 and code generation options. For test coverage analysis, use the
3153 additional @option{-ftest-coverage} option. You do not need to profile
3154 every source file in a program.
3155
3156 @item
3157 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3158 (the latter implies the former).
3159
3160 @item
3161 Run the program on a representative workload to generate the arc profile
3162 information. This may be repeated any number of times. You can run
3163 concurrent instances of your program, and provided that the file system
3164 supports locking, the data files will be correctly updated. Also
3165 @code{fork} calls are detected and correctly handled (double counting
3166 will not happen).
3167
3168 @item
3169 For profile-directed optimizations, compile the source files again with
3170 the same optimization and code generation options plus
3171 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3172 Control Optimization}).
3173
3174 @item
3175 For test coverage analysis, use @command{gcov} to produce human readable
3176 information from the @file{.gcno} and @file{.gcda} files. Refer to the
3177 @command{gcov} documentation for further information.
3178
3179 @end itemize
3180
3181 With @option{-fprofile-arcs}, for each function of your program GCC
3182 creates a program flow graph, then finds a spanning tree for the graph.
3183 Only arcs that are not on the spanning tree have to be instrumented: the
3184 compiler adds code to count the number of times that these arcs are
3185 executed.  When an arc is the only exit or only entrance to a block, the
3186 instrumentation code can be added to the block; otherwise, a new basic
3187 block must be created to hold the instrumentation code.
3188
3189 @need 2000
3190 @item -ftest-coverage
3191 @opindex ftest-coverage
3192 Produce a notes file that the @command{gcov} code-coverage utility
3193 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3194 show program coverage. Each source file's note file is called
3195 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
3196 above for a description of @var{auxname} and instructions on how to
3197 generate test coverage data. Coverage data will match the source files
3198 more closely, if you do not optimize.
3199
3200 @item -d@var{letters}
3201 @opindex d
3202 Says to make debugging dumps during compilation at times specified by
3203 @var{letters}.  This is used for debugging the compiler.  The file names
3204 for most of the dumps are made by appending a pass number and a word to
3205 the @var{dumpname}. @var{dumpname} is generated from the name of the
3206 output file, if explicitly specified and it is not an executable,
3207 otherwise it is the basename of the source file. In both cases any
3208 suffix is removed (e.g.  @file{foo.01.rtl} or @file{foo.02.sibling}).
3209 Here are the possible letters for use in @var{letters}, and their
3210 meanings:
3211
3212 @table @samp
3213 @item A
3214 @opindex dA
3215 Annotate the assembler output with miscellaneous debugging information.
3216 @item b
3217 @opindex db
3218 Dump after computing branch probabilities, to @file{@var{file}.12.bp}.
3219 @item B
3220 @opindex dB
3221 Dump after block reordering, to @file{@var{file}.31.bbro}.
3222 @item c
3223 @opindex dc
3224 Dump after instruction combination, to the file @file{@var{file}.20.combine}.
3225 @item C
3226 @opindex dC
3227 Dump after the first if conversion, to the file @file{@var{file}.14.ce1}.
3228 Also dump after the second if conversion, to the file @file{@var{file}.21.ce2}.
3229 @item d
3230 @opindex dd
3231 Dump after branch target load optimization, to to @file{@var{file}.32.btl}.
3232 Also dump after delayed branch scheduling, to @file{@var{file}.36.dbr}.
3233 @item D
3234 @opindex dD
3235 Dump all macro definitions, at the end of preprocessing, in addition to
3236 normal output.
3237 @item E
3238 @opindex dE
3239 Dump after the third if conversion, to @file{@var{file}.30.ce3}.
3240 @item f
3241 @opindex df
3242 Dump after control and data flow analysis, to @file{@var{file}.11.cfg}.
3243 Also dump after life analysis, to @file{@var{file}.19.life}.
3244 @item F
3245 @opindex dF
3246 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.07.addressof}.
3247 @item g
3248 @opindex dg
3249 Dump after global register allocation, to @file{@var{file}.25.greg}.
3250 @item G
3251 @opindex dG
3252 Dump after GCSE, to @file{@var{file}.08.gcse}.
3253 Also dump after jump bypassing and control flow optimizations, to
3254 @file{@var{file}.10.bypass}.
3255 @item h
3256 @opindex dh
3257 Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
3258 @item i
3259 @opindex di
3260 Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
3261 @item j
3262 @opindex dj
3263 Dump after the first jump optimization, to @file{@var{file}.04.jump}.
3264 @item k
3265 @opindex dk
3266 Dump after conversion from registers to stack, to @file{@var{file}.34.stack}.
3267 @item l
3268 @opindex dl
3269 Dump after local register allocation, to @file{@var{file}.24.lreg}.
3270 @item L
3271 @opindex dL
3272 Dump after loop optimization passes, to @file{@var{file}.09.loop} and
3273 @file{@var{file}.16.loop2}.
3274 @item M
3275 @opindex dM
3276 Dump after performing the machine dependent reorganization pass, to
3277 @file{@var{file}.35.mach}.
3278 @item n
3279 @opindex dn
3280 Dump after register renumbering, to @file{@var{file}.29.rnreg}.
3281 @item N
3282 @opindex dN
3283 Dump after the register move pass, to @file{@var{file}.22.regmove}.
3284 @item o
3285 @opindex do
3286 Dump after post-reload optimizations, to @file{@var{file}.26.postreload}.
3287 @item r
3288 @opindex dr
3289 Dump after RTL generation, to @file{@var{file}.01.rtl}.
3290 @item R
3291 @opindex dR
3292 Dump after the second scheduling pass, to @file{@var{file}.33.sched2}.
3293 @item s
3294 @opindex ds
3295 Dump after CSE (including the jump optimization that sometimes follows
3296 CSE), to @file{@var{file}.06.cse}.
3297 @item S
3298 @opindex dS
3299 Dump after the first scheduling pass, to @file{@var{file}.23.sched}.
3300 @item t
3301 @opindex dt
3302 Dump after the second CSE pass (including the jump optimization that
3303 sometimes follows CSE), to @file{@var{file}.18.cse2}.
3304 @item T
3305 @opindex dT
3306 Dump after running tracer, to @file{@var{file}.15.tracer}.
3307 @item u
3308 @opindex du
3309 Dump after null pointer elimination pass to @file{@var{file}.05.null}.
3310 @item U
3311 @opindex dU
3312 Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
3313 @item V
3314 @opindex dV
3315 Dump after the value profile transformations, to @file{@var{file}.13.vpt}.
3316 @item w
3317 @opindex dw
3318 Dump after the second flow pass, to @file{@var{file}.27.flow2}.
3319 @item z
3320 @opindex dz
3321 Dump after the peephole pass, to @file{@var{file}.28.peephole2}.
3322 @item Z
3323 @opindex dZ
3324 Dump after constructing the web, to @file{@var{file}.17.web}.
3325 @item a
3326 @opindex da
3327 Produce all the dumps listed above.
3328 @item H
3329 @opindex dH
3330 Produce a core dump whenever an error occurs.
3331 @item m
3332 @opindex dm
3333 Print statistics on memory usage, at the end of the run, to
3334 standard error.
3335 @item p
3336 @opindex dp
3337 Annotate the assembler output with a comment indicating which
3338 pattern and alternative was used.  The length of each instruction is
3339 also printed.
3340 @item P
3341 @opindex dP
3342 Dump the RTL in the assembler output as a comment before each instruction.
3343 Also turns on @option{-dp} annotation.
3344 @item v
3345 @opindex dv
3346 For each of the other indicated dump files (except for
3347 @file{@var{file}.01.rtl}), dump a representation of the control flow graph
3348 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3349 @item x
3350 @opindex dx
3351 Just generate RTL for a function instead of compiling it.  Usually used
3352 with @samp{r}.
3353 @item y
3354 @opindex dy
3355 Dump debugging information during parsing, to standard error.
3356 @end table
3357
3358 @item -fdump-unnumbered
3359 @opindex fdump-unnumbered
3360 When doing debugging dumps (see @option{-d} option above), suppress instruction
3361 numbers and line number note output.  This makes it more feasible to
3362 use diff on debugging dumps for compiler invocations with different
3363 options, in particular with and without @option{-g}.
3364
3365 @item -fdump-translation-unit @r{(C and C++ only)}
3366 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3367 @opindex fdump-translation-unit
3368 Dump a representation of the tree structure for the entire translation
3369 unit to a file.  The file name is made by appending @file{.tu} to the
3370 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3371 controls the details of the dump as described for the
3372 @option{-fdump-tree} options.
3373
3374 @item -fdump-class-hierarchy @r{(C++ only)}
3375 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3376 @opindex fdump-class-hierarchy
3377 Dump a representation of each class's hierarchy and virtual function
3378 table layout to a file.  The file name is made by appending @file{.class}
3379 to the source file name.  If the @samp{-@var{options}} form is used,
3380 @var{options} controls the details of the dump as described for the
3381 @option{-fdump-tree} options.
3382
3383 @item -fdump-tree-@var{switch} @r{(C++ only)}
3384 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3385 @opindex fdump-tree
3386 Control the dumping at various stages of processing the intermediate
3387 language tree to a file.  The file name is generated by appending a switch
3388 specific suffix to the source file name.  If the @samp{-@var{options}}
3389 form is used, @var{options} is a list of @samp{-} separated options that
3390 control the details of the dump. Not all options are applicable to all
3391 dumps, those which are not meaningful will be ignored. The following
3392 options are available
3393
3394 @table @samp
3395 @item address
3396 Print the address of each node.  Usually this is not meaningful as it
3397 changes according to the environment and source file. Its primary use
3398 is for tying up a dump file with a debug environment.
3399 @item slim
3400 Inhibit dumping of members of a scope or body of a function merely
3401 because that scope has been reached. Only dump such items when they
3402 are directly reachable by some other path.
3403 @item all
3404 Turn on all options.
3405 @end table
3406
3407 The following tree dumps are possible:
3408 @table @samp
3409 @item original
3410 Dump before any tree based optimization, to @file{@var{file}.original}.
3411 @item optimized
3412 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3413 @item inlined
3414 Dump after function inlining, to @file{@var{file}.inlined}.
3415 @end table
3416
3417 @item -frandom-seed=@var{string}
3418 @opindex frandom-string
3419 This option provides a seed that GCC uses when it would otherwise use
3420 random numbers.  It is used to generate certain symbol names
3421 that have to be different in every compiled file. It is also used to
3422 place unique stamps in coverage data files and the object files that
3423 produce them. You can use the @option{-frandom-seed} option to produce
3424 reproducibly identical object files.
3425
3426 The @var{string} should be different for every file you compile.
3427
3428 @item -fsched-verbose=@var{n}
3429 @opindex fsched-verbose
3430 On targets that use instruction scheduling, this option controls the
3431 amount of debugging output the scheduler prints.  This information is
3432 written to standard error, unless @option{-dS} or @option{-dR} is
3433 specified, in which case it is output to the usual dump
3434 listing file, @file{.sched} or @file{.sched2} respectively.  However
3435 for @var{n} greater than nine, the output is always printed to standard
3436 error.
3437
3438 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3439 same information as @option{-dRS}.  For @var{n} greater than one, it
3440 also output basic block probabilities, detailed ready list information
3441 and unit/insn info.  For @var{n} greater than two, it includes RTL
3442 at abort point, control-flow and regions info.  And for @var{n} over
3443 four, @option{-fsched-verbose} also includes dependence info.
3444
3445 @item -save-temps
3446 @opindex save-temps
3447 Store the usual ``temporary'' intermediate files permanently; place them
3448 in the current directory and name them based on the source file.  Thus,
3449 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3450 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3451 preprocessed @file{foo.i} output file even though the compiler now
3452 normally uses an integrated preprocessor.
3453
3454 @item -time
3455 @opindex time
3456 Report the CPU time taken by each subprocess in the compilation
3457 sequence.  For C source files, this is the compiler proper and assembler
3458 (plus the linker if linking is done).  The output looks like this:
3459
3460 @smallexample
3461 # cc1 0.12 0.01
3462 # as 0.00 0.01
3463 @end smallexample
3464
3465 The first number on each line is the ``user time,'' that is time spent
3466 executing the program itself.  The second number is ``system time,''
3467 time spent executing operating system routines on behalf of the program.
3468 Both numbers are in seconds.
3469
3470 @item -print-file-name=@var{library}
3471 @opindex print-file-name
3472 Print the full absolute name of the library file @var{library} that
3473 would be used when linking---and don't do anything else.  With this
3474 option, GCC does not compile or link anything; it just prints the
3475 file name.
3476
3477 @item -print-multi-directory
3478 @opindex print-multi-directory
3479 Print the directory name corresponding to the multilib selected by any
3480 other switches present in the command line.  This directory is supposed
3481 to exist in @env{GCC_EXEC_PREFIX}.
3482
3483 @item -print-multi-lib
3484 @opindex print-multi-lib
3485 Print the mapping from multilib directory names to compiler switches
3486 that enable them.  The directory name is separated from the switches by
3487 @samp{;}, and each switch starts with an @samp{@@} instead of the
3488 @samp{-}, without spaces between multiple switches.  This is supposed to
3489 ease shell-processing.
3490
3491 @item -print-prog-name=@var{program}
3492 @opindex print-prog-name
3493 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3494
3495 @item -print-libgcc-file-name
3496 @opindex print-libgcc-file-name
3497 Same as @option{-print-file-name=libgcc.a}.
3498
3499 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3500 but you do want to link with @file{libgcc.a}.  You can do
3501
3502 @smallexample
3503 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3504 @end smallexample
3505
3506 @item -print-search-dirs
3507 @opindex print-search-dirs
3508 Print the name of the configured installation directory and a list of
3509 program and library directories gcc will search---and don't do anything else.
3510
3511 This is useful when gcc prints the error message
3512 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3513 To resolve this you either need to put @file{cpp0} and the other compiler
3514 components where gcc expects to find them, or you can set the environment
3515 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3516 Don't forget the trailing '/'.
3517 @xref{Environment Variables}.
3518
3519 @item -dumpmachine
3520 @opindex dumpmachine
3521 Print the compiler's target machine (for example,
3522 @samp{i686-pc-linux-gnu})---and don't do anything else.
3523
3524 @item -dumpversion
3525 @opindex dumpversion
3526 Print the compiler version (for example, @samp{3.0})---and don't do
3527 anything else.
3528
3529 @item -dumpspecs
3530 @opindex dumpspecs
3531 Print the compiler's built-in specs---and don't do anything else.  (This
3532 is used when GCC itself is being built.)  @xref{Spec Files}.
3533
3534 @item -feliminate-unused-debug-types
3535 @opindex feliminate-unused-debug-types
3536 Normally, when producing DWARF2 output, GCC will emit debugging
3537 information for all types declared in a compilation
3538 unit, regardless of whether or not they are actually used
3539 in that compilation unit.  Sometimes this is useful, such as
3540 if, in the debugger, you want to cast a value to a type that is
3541 not actually used in your program (but is declared).  More often,
3542 however, this results in a significant amount of wasted space.
3543 With this option, GCC will avoid producing debug symbol output
3544 for types that are nowhere used in the source file being compiled.
3545 @end table
3546
3547 @node Optimize Options
3548 @section Options That Control Optimization
3549 @cindex optimize options
3550 @cindex options, optimization
3551
3552 These options control various sorts of optimizations.
3553
3554 Without any optimization option, the compiler's goal is to reduce the
3555 cost of compilation and to make debugging produce the expected
3556 results.  Statements are independent: if you stop the program with a
3557 breakpoint between statements, you can then assign a new value to any
3558 variable or change the program counter to any other statement in the
3559 function and get exactly the results you would expect from the source
3560 code.
3561
3562 Turning on optimization flags makes the compiler attempt to improve
3563 the performance and/or code size at the expense of compilation time
3564 and possibly the ability to debug the program.
3565
3566 The compiler performs optimization based on the knowledge it has of
3567 the program.  Using the @option{-funit-at-a-time} flag will allow the
3568 compiler to consider information gained from later functions in the
3569 file when compiling a function.  Compiling multiple files at once to a
3570 single output file (and using @option{-funit-at-a-time}) will allow
3571 the compiler to use information gained from all of the files when
3572 compiling each of them.
3573
3574 Not all optimizations are controlled directly by a flag.  Only
3575 optimizations that have a flag are listed.
3576
3577 @table @gcctabopt
3578 @item -O
3579 @itemx -O1
3580 @opindex O
3581 @opindex O1
3582 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3583 more memory for a large function.
3584
3585 With @option{-O}, the compiler tries to reduce code size and execution
3586 time, without performing any optimizations that take a great deal of
3587 compilation time.
3588
3589 @option{-O} turns on the following optimization flags:
3590 @gccoptlist{-fdefer-pop @gol
3591 -fmerge-constants @gol
3592 -fthread-jumps @gol
3593 -floop-optimize @gol
3594 -fif-conversion @gol
3595 -fif-conversion2 @gol
3596 -fdelayed-branch @gol
3597 -fguess-branch-probability @gol
3598 -fcprop-registers}
3599
3600 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
3601 where doing so does not interfere with debugging.
3602
3603 @item -O2
3604 @opindex O2
3605 Optimize even more.  GCC performs nearly all supported optimizations
3606 that do not involve a space-speed tradeoff.  The compiler does not
3607 perform loop unrolling or function inlining when you specify @option{-O2}.
3608 As compared to @option{-O}, this option increases both compilation time
3609 and the performance of the generated code.
3610
3611 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
3612 also turns on the following optimization flags:
3613 @gccoptlist{-fforce-mem @gol
3614 -foptimize-sibling-calls @gol
3615 -fstrength-reduce @gol
3616 -fcse-follow-jumps  -fcse-skip-blocks @gol
3617 -frerun-cse-after-loop  -frerun-loop-opt @gol
3618 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las @gol
3619 -fdelete-null-pointer-checks @gol
3620 -fexpensive-optimizations @gol
3621 -fregmove @gol
3622 -fschedule-insns  -fschedule-insns2 @gol
3623 -fsched-interblock  -fsched-spec @gol
3624 -fcaller-saves @gol
3625 -fpeephole2 @gol
3626 -freorder-blocks  -freorder-functions @gol
3627 -fstrict-aliasing @gol
3628 -funit-at-a-time @gol
3629 -falign-functions  -falign-jumps @gol
3630 -falign-loops  -falign-labels @gol
3631 -fcrossjumping}
3632
3633 Please note the warning under @option{-fgcse} about
3634 invoking @option{-O2} on programs that use computed gotos.
3635
3636 @item -O3
3637 @opindex O3
3638 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3639 @option{-O2} and also turns on the @option{-finline-functions},
3640 @option{-fweb} and @option{-frename-registers} options.
3641
3642 @item -O0
3643 @opindex O0
3644 Do not optimize.  This is the default.
3645
3646 @item -Os
3647 @opindex Os
3648 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3649 do not typically increase code size.  It also performs further
3650 optimizations designed to reduce code size.
3651
3652 @option{-Os} disables the following optimization flags:
3653 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3654 -falign-labels  -freorder-blocks  -fprefetch-loop-arrays}
3655
3656 If you use multiple @option{-O} options, with or without level numbers,
3657 the last such option is the one that is effective.
3658 @end table
3659
3660 Options of the form @option{-f@var{flag}} specify machine-independent
3661 flags.  Most flags have both positive and negative forms; the negative
3662 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3663 below, only one of the forms is listed---the one you typically will
3664 use.  You can figure out the other form by either removing @samp{no-}
3665 or adding it.
3666
3667 The following options control specific optimizations.  They are either
3668 activated by @option{-O} options or are related to ones that are.  You
3669 can use the following flags in the rare cases when ``fine-tuning'' of
3670 optimizations to be performed is desired.
3671
3672 @table @gcctabopt
3673 @item -fno-default-inline
3674 @opindex fno-default-inline
3675 Do not make member functions inline by default merely because they are
3676 defined inside the class scope (C++ only).  Otherwise, when you specify
3677 @w{@option{-O}}, member functions defined inside class scope are compiled
3678 inline by default; i.e., you don't need to add @samp{inline} in front of
3679 the member function name.
3680
3681 @item -fno-defer-pop
3682 @opindex fno-defer-pop
3683 Always pop the arguments to each function call as soon as that function
3684 returns.  For machines which must pop arguments after a function call,
3685 the compiler normally lets arguments accumulate on the stack for several
3686 function calls and pops them all at once.
3687
3688 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3689
3690 @item -fforce-mem
3691 @opindex fforce-mem
3692 Force memory operands to be copied into registers before doing
3693 arithmetic on them.  This produces better code by making all memory
3694 references potential common subexpressions.  When they are not common
3695 subexpressions, instruction combination should eliminate the separate
3696 register-load.
3697
3698 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3699
3700 @item -fforce-addr
3701 @opindex fforce-addr
3702 Force memory address constants to be copied into registers before
3703 doing arithmetic on them.  This may produce better code just as
3704 @option{-fforce-mem} may.
3705
3706 @item -fomit-frame-pointer
3707 @opindex fomit-frame-pointer
3708 Don't keep the frame pointer in a register for functions that
3709 don't need one.  This avoids the instructions to save, set up and
3710 restore frame pointers; it also makes an extra register available
3711 in many functions.  @strong{It also makes debugging impossible on
3712 some machines.}
3713
3714 On some machines, such as the VAX, this flag has no effect, because
3715 the standard calling sequence automatically handles the frame pointer
3716 and nothing is saved by pretending it doesn't exist.  The
3717 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3718 whether a target machine supports this flag.  @xref{Registers,,Register
3719 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3720
3721 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3722
3723 @item -foptimize-sibling-calls
3724 @opindex foptimize-sibling-calls
3725 Optimize sibling and tail recursive calls.
3726
3727 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3728
3729 @item -fno-inline
3730 @opindex fno-inline
3731 Don't pay attention to the @code{inline} keyword.  Normally this option
3732 is used to keep the compiler from expanding any functions inline.
3733 Note that if you are not optimizing, no functions can be expanded inline.
3734
3735 @item -finline-functions
3736 @opindex finline-functions
3737 Integrate all simple functions into their callers.  The compiler
3738 heuristically decides which functions are simple enough to be worth
3739 integrating in this way.
3740
3741 If all calls to a given function are integrated, and the function is
3742 declared @code{static}, then the function is normally not output as
3743 assembler code in its own right.
3744
3745 Enabled at level @option{-O3}.
3746
3747 @item -finline-limit=@var{n}
3748 @opindex finline-limit
3749 By default, gcc limits the size of functions that can be inlined.  This flag
3750 allows the control of this limit for functions that are explicitly marked as
3751 inline (i.e., marked with the inline keyword or defined within the class
3752 definition in c++).  @var{n} is the size of functions that can be inlined in
3753 number of pseudo instructions (not counting parameter handling).  The default
3754 value of @var{n} is 600.
3755 Increasing this value can result in more inlined code at
3756 the cost of compilation time and memory consumption.  Decreasing usually makes
3757 the compilation faster and less code will be inlined (which presumably
3758 means slower programs).  This option is particularly useful for programs that
3759 use inlining heavily such as those based on recursive templates with C++.
3760
3761 Inlining is actually controlled by a number of parameters, which may be
3762 specified individually by using @option{--param @var{name}=@var{value}}.
3763 The @option{-finline-limit=@var{n}} option sets some of these parameters
3764 as follows:
3765
3766 @table @gcctabopt
3767  @item max-inline-insns-single
3768   is set to @var{n}/2.
3769  @item max-inline-insns-auto
3770   is set to @var{n}/2.
3771  @item min-inline-insns
3772   is set to 130 or @var{n}/4, whichever is smaller.
3773  @item max-inline-insns-rtl
3774   is set to @var{n}.
3775 @end table
3776
3777 See below for a documentation of the individual
3778 parameters controlling inlining.
3779
3780 @emph{Note:} pseudo instruction represents, in this particular context, an
3781 abstract measurement of function's size.  In no way, it represents a count
3782 of assembly instructions and as such its exact meaning might change from one
3783 release to an another.
3784
3785 @item -fkeep-inline-functions
3786 @opindex fkeep-inline-functions
3787 Even if all calls to a given function are integrated, and the function
3788 is declared @code{static}, nevertheless output a separate run-time
3789 callable version of the function.  This switch does not affect
3790 @code{extern inline} functions.
3791
3792 @item -fkeep-static-consts
3793 @opindex fkeep-static-consts
3794 Emit variables declared @code{static const} when optimization isn't turned
3795 on, even if the variables aren't referenced.
3796
3797 GCC enables this option by default.  If you want to force the compiler to
3798 check if the variable was referenced, regardless of whether or not
3799 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3800
3801 @item -fmerge-constants
3802 Attempt to merge identical constants (string constants and floating point
3803 constants) across compilation units.
3804
3805 This option is the default for optimized compilation if the assembler and
3806 linker support it.  Use @option{-fno-merge-constants} to inhibit this
3807 behavior.
3808
3809 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3810
3811 @item -fmerge-all-constants
3812 Attempt to merge identical constants and identical variables.
3813
3814 This option implies @option{-fmerge-constants}.  In addition to
3815 @option{-fmerge-constants} this considers e.g. even constant initialized
3816 arrays or initialized constant variables with integral or floating point
3817 types.  Languages like C or C++ require each non-automatic variable to
3818 have distinct location, so using this option will result in non-conforming
3819 behavior.
3820
3821 @item -fnew-ra
3822 @opindex fnew-ra
3823 Use a graph coloring register allocator.  Currently this option is meant
3824 for testing, so we are interested to hear about miscompilations with
3825 @option{-fnew-ra}.
3826
3827 @item -fno-branch-count-reg
3828 @opindex fno-branch-count-reg
3829 Do not use ``decrement and branch'' instructions on a count register,
3830 but instead generate a sequence of instructions that decrement a
3831 register, compare it against zero, then branch based upon the result.
3832 This option is only meaningful on architectures that support such
3833 instructions, which include x86, PowerPC, IA-64 and S/390.
3834
3835 The default is @option{-fbranch-count-reg}, enabled when
3836 @option{-fstrength-reduce} is enabled.
3837
3838 @item -fno-function-cse
3839 @opindex fno-function-cse
3840 Do not put function addresses in registers; make each instruction that
3841 calls a constant function contain the function's address explicitly.
3842
3843 This option results in less efficient code, but some strange hacks
3844 that alter the assembler output may be confused by the optimizations
3845 performed when this option is not used.
3846
3847 The default is @option{-ffunction-cse}
3848
3849 @item -fno-zero-initialized-in-bss
3850 @opindex fno-zero-initialized-in-bss
3851 If the target supports a BSS section, GCC by default puts variables that
3852 are initialized to zero into BSS@.  This can save space in the resulting
3853 code.
3854
3855 This option turns off this behavior because some programs explicitly
3856 rely on variables going to the data section.  E.g., so that the
3857 resulting executable can find the beginning of that section and/or make
3858 assumptions based on that.
3859
3860 The default is @option{-fzero-initialized-in-bss}.
3861
3862 @item -fstrength-reduce
3863 @opindex fstrength-reduce
3864 Perform the optimizations of loop strength reduction and
3865 elimination of iteration variables.
3866
3867 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3868
3869 @item -fthread-jumps
3870 @opindex fthread-jumps
3871 Perform optimizations where we check to see if a jump branches to a
3872 location where another comparison subsumed by the first is found.  If
3873 so, the first branch is redirected to either the destination of the
3874 second branch or a point immediately following it, depending on whether
3875 the condition is known to be true or false.
3876
3877 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3878
3879 @item -fcse-follow-jumps
3880 @opindex fcse-follow-jumps
3881 In common subexpression elimination, scan through jump instructions
3882 when the target of the jump is not reached by any other path.  For
3883 example, when CSE encounters an @code{if} statement with an
3884 @code{else} clause, CSE will follow the jump when the condition
3885 tested is false.
3886
3887 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3888
3889 @item -fcse-skip-blocks
3890 @opindex fcse-skip-blocks
3891 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3892 follow jumps which conditionally skip over blocks.  When CSE
3893 encounters a simple @code{if} statement with no else clause,
3894 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3895 body of the @code{if}.
3896
3897 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3898
3899 @item -frerun-cse-after-loop
3900 @opindex frerun-cse-after-loop
3901 Re-run common subexpression elimination after loop optimizations has been
3902 performed.
3903
3904 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3905
3906 @item -frerun-loop-opt
3907 @opindex frerun-loop-opt
3908 Run the loop optimizer twice.
3909
3910 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3911
3912 @item -fgcse
3913 @opindex fgcse
3914 Perform a global common subexpression elimination pass.
3915 This pass also performs global constant and copy propagation.
3916
3917 @emph{Note:} When compiling a program using computed gotos, a GCC
3918 extension, you may get better runtime performance if you disable
3919 the global common subexpression elimination pass by adding
3920 @option{-fno-gcse} to the command line.
3921
3922 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3923
3924 @item -fgcse-lm
3925 @opindex fgcse-lm
3926 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3927 attempt to move loads which are only killed by stores into themselves.  This
3928 allows a loop containing a load/store sequence to be changed to a load outside
3929 the loop, and a copy/store within the loop.
3930
3931 Enabled by default when gcse is enabled.
3932
3933 @item -fgcse-sm
3934 @opindex fgcse-sm
3935 When @option{-fgcse-sm} is enabled, a store motion pass is run after
3936 global common subexpression elimination.  This pass will attempt to move
3937 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
3938 loops containing a load/store sequence can be changed to a load before
3939 the loop and a store after the loop.
3940
3941 Enabled by default when gcse is enabled.
3942
3943 @item -fgcse-las
3944 @opindex fgcse-las
3945 When @option{-fgcse-las} is enabled, the global common subexpression
3946 elimination pass eliminates redundant loads that come after stores to the
3947 same memory location (both partial and full redundancies).
3948
3949 Enabled by default when gcse is enabled.
3950
3951 @item -floop-optimize
3952 @opindex floop-optimize
3953 Perform loop optimizations: move constant expressions out of loops, simplify
3954 exit test conditions and optionally do strength-reduction and loop unrolling as
3955 well.
3956
3957 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3958
3959 @item -fcrossjumping
3960 @opindex crossjumping
3961 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
3962 resulting code may or may not perform better than without cross-jumping.
3963
3964 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3965
3966 @item -fif-conversion
3967 @opindex if-conversion
3968 Attempt to transform conditional jumps into branch-less equivalents.  This
3969 include use of conditional moves, min, max, set flags and abs instructions, and
3970 some tricks doable by standard arithmetics.  The use of conditional execution
3971 on chips where it is available is controlled by @code{if-conversion2}.
3972
3973 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3974
3975 @item -fif-conversion2
3976 @opindex if-conversion2
3977 Use conditional execution (where available) to transform conditional jumps into
3978 branch-less equivalents.
3979
3980 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3981
3982 @item -fdelete-null-pointer-checks
3983 @opindex fdelete-null-pointer-checks
3984 Use global dataflow analysis to identify and eliminate useless checks
3985 for null pointers.  The compiler assumes that dereferencing a null
3986 pointer would have halted the program.  If a pointer is checked after
3987 it has already been dereferenced, it cannot be null.
3988
3989 In some environments, this assumption is not true, and programs can
3990 safely dereference null pointers.  Use
3991 @option{-fno-delete-null-pointer-checks} to disable this optimization
3992 for programs which depend on that behavior.
3993
3994 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3995
3996 @item -fexpensive-optimizations
3997 @opindex fexpensive-optimizations
3998 Perform a number of minor optimizations that are relatively expensive.
3999
4000 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4001
4002 @item -foptimize-register-move
4003 @itemx -fregmove
4004 @opindex foptimize-register-move
4005 @opindex fregmove
4006 Attempt to reassign register numbers in move instructions and as
4007 operands of other simple instructions in order to maximize the amount of
4008 register tying.  This is especially helpful on machines with two-operand
4009 instructions.
4010
4011 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4012 optimization.
4013
4014 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4015
4016 @item -fdelayed-branch
4017 @opindex fdelayed-branch
4018 If supported for the target machine, attempt to reorder instructions
4019 to exploit instruction slots available after delayed branch
4020 instructions.
4021
4022 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4023
4024 @item -fschedule-insns
4025 @opindex fschedule-insns
4026 If supported for the target machine, attempt to reorder instructions to
4027 eliminate execution stalls due to required data being unavailable.  This
4028 helps machines that have slow floating point or memory load instructions
4029 by allowing other instructions to be issued until the result of the load
4030 or floating point instruction is required.
4031
4032 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4033
4034 @item -fschedule-insns2
4035 @opindex fschedule-insns2
4036 Similar to @option{-fschedule-insns}, but requests an additional pass of
4037 instruction scheduling after register allocation has been done.  This is
4038 especially useful on machines with a relatively small number of
4039 registers and where memory load instructions take more than one cycle.
4040
4041 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4042
4043 @item -fno-sched-interblock
4044 @opindex fno-sched-interblock
4045 Don't schedule instructions across basic blocks.  This is normally
4046 enabled by default when scheduling before register allocation, i.e.@:
4047 with @option{-fschedule-insns} or at @option{-O2} or higher.
4048
4049 @item -fno-sched-spec
4050 @opindex fno-sched-spec
4051 Don't allow speculative motion of non-load instructions.  This is normally
4052 enabled by default when scheduling before register allocation, i.e.@:
4053 with @option{-fschedule-insns} or at @option{-O2} or higher.
4054
4055 @item -fsched-spec-load
4056 @opindex fsched-spec-load
4057 Allow speculative motion of some load instructions.  This only makes
4058 sense when scheduling before register allocation, i.e.@: with
4059 @option{-fschedule-insns} or at @option{-O2} or higher.
4060
4061 @item -fsched-spec-load-dangerous
4062 @opindex fsched-spec-load-dangerous
4063 Allow speculative motion of more load instructions.  This only makes
4064 sense when scheduling before register allocation, i.e.@: with
4065 @option{-fschedule-insns} or at @option{-O2} or higher.
4066
4067 @item -fsched-stalled-insns=@var{n}
4068 @opindex fsched-stalled-insns
4069 Define how many insns (if any) can be moved prematurely from the queue
4070 of stalled insns into the ready list, during the second scheduling pass.
4071
4072 @item -fsched-stalled-insns-dep=@var{n}
4073 @opindex fsched-stalled-insns-dep
4074 Define how many insn groups (cycles) will be examined for a dependency
4075 on a stalled insn that is candidate for premature removal from the queue
4076 of stalled insns.  Has an effect only during the second scheduling pass,
4077 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4078
4079 @item -fsched2-use-superblocks
4080 @opindex fsched2-use-superblocks
4081 When scheduling after register allocation, do use superblock scheduling
4082 algorithm.  Superblock scheduling allows motion across basic block boundaries
4083 resulting on faster schedules.  This option is experimental, as not all machine
4084 descriptions used by GCC model the CPU closely enough to avoid unreliable
4085 results from the algorithm.
4086
4087 This only makes sense when scheduling after register allocation, i.e.@: with
4088 @option{-fschedule-insns2} or at @option{-O2} or higher.
4089
4090 @item -fsched2-use-traces
4091 @opindex fsched2-use-traces
4092 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4093 allocation and additionally perform code duplication in order to increase the
4094 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4095 trace formation.
4096
4097 This mode should produce faster but significantly longer programs.  Also
4098 without @code{-fbranch-probabilities} the traces constructed may not match the
4099 reality and hurt the performance.  This only makes
4100 sense when scheduling after register allocation, i.e.@: with
4101 @option{-fschedule-insns2} or at @option{-O2} or higher.
4102
4103 @item -fcaller-saves
4104 @opindex fcaller-saves
4105 Enable values to be allocated in registers that will be clobbered by
4106 function calls, by emitting extra instructions to save and restore the
4107 registers around such calls.  Such allocation is done only when it
4108 seems to result in better code than would otherwise be produced.
4109
4110 This option is always enabled by default on certain machines, usually
4111 those which have no call-preserved registers to use instead.
4112
4113 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4114
4115 @item -fmove-all-movables
4116 @opindex fmove-all-movables
4117 Forces all invariant computations in loops to be moved
4118 outside the loop.
4119
4120 @item -freduce-all-givs
4121 @opindex freduce-all-givs
4122 Forces all general-induction variables in loops to be
4123 strength-reduced.
4124
4125 @emph{Note:} When compiling programs written in Fortran,
4126 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
4127 by default when you use the optimizer.
4128
4129 These options may generate better or worse code; results are highly
4130 dependent on the structure of loops within the source code.
4131
4132 These two options are intended to be removed someday, once
4133 they have helped determine the efficacy of various
4134 approaches to improving loop optimizations.
4135
4136 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
4137 know how use of these options affects
4138 the performance of your production code.
4139 We're very interested in code that runs @emph{slower}
4140 when these options are @emph{enabled}.
4141
4142 @item -fno-peephole
4143 @itemx -fno-peephole2
4144 @opindex fno-peephole
4145 @opindex fno-peephole2
4146 Disable any machine-specific peephole optimizations.  The difference
4147 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
4148 are implemented in the compiler; some targets use one, some use the
4149 other, a few use both.
4150
4151 @option{-fpeephole} is enabled by default.
4152 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4153
4154 @item -fno-guess-branch-probability
4155 @opindex fno-guess-branch-probability
4156 Do not guess branch probabilities using a randomized model.
4157
4158 Sometimes gcc will opt to use a randomized model to guess branch
4159 probabilities, when none are available from either profiling feedback
4160 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
4161 different runs of the compiler on the same program may produce different
4162 object code.
4163
4164 In a hard real-time system, people don't want different runs of the
4165 compiler to produce code that has different behavior; minimizing
4166 non-determinism is of paramount import.  This switch allows users to
4167 reduce non-determinism, possibly at the expense of inferior
4168 optimization.
4169
4170 The default is @option{-fguess-branch-probability} at levels
4171 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4172
4173 @item -freorder-blocks
4174 @opindex freorder-blocks
4175 Reorder basic blocks in the compiled function in order to reduce number of
4176 taken branches and improve code locality.
4177
4178 Enabled at levels @option{-O2}, @option{-O3}.
4179
4180 @item -freorder-functions
4181 @opindex freorder-functions
4182 Reorder basic blocks in the compiled function in order to reduce number of
4183 taken branches and improve code locality. This is implemented by using special
4184 subsections @code{text.hot} for most frequently executed functions and
4185 @code{text.unlikely} for unlikely executed functions.  Reordering is done by
4186 the linker so object file format must support named sections and linker must
4187 place them in a reasonable way.
4188
4189 Also profile feedback must be available in to make this option effective.  See
4190 @option{-fprofile-arcs} for details.
4191
4192 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4193
4194 @item -fstrict-aliasing
4195 @opindex fstrict-aliasing
4196 Allows the compiler to assume the strictest aliasing rules applicable to
4197 the language being compiled.  For C (and C++), this activates
4198 optimizations based on the type of expressions.  In particular, an
4199 object of one type is assumed never to reside at the same address as an
4200 object of a different type, unless the types are almost the same.  For
4201 example, an @code{unsigned int} can alias an @code{int}, but not a
4202 @code{void*} or a @code{double}.  A character type may alias any other
4203 type.
4204
4205 Pay special attention to code like this:
4206 @smallexample
4207 union a_union @{
4208   int i;
4209   double d;
4210 @};
4211
4212 int f() @{
4213   a_union t;
4214   t.d = 3.0;
4215   return t.i;
4216 @}
4217 @end smallexample
4218 The practice of reading from a different union member than the one most
4219 recently written to (called ``type-punning'') is common.  Even with
4220 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4221 is accessed through the union type.  So, the code above will work as
4222 expected.  However, this code might not:
4223 @smallexample
4224 int f() @{
4225   a_union t;
4226   int* ip;
4227   t.d = 3.0;
4228   ip = &t.i;
4229   return *ip;
4230 @}
4231 @end smallexample
4232
4233 Every language that wishes to perform language-specific alias analysis
4234 should define a function that computes, given an @code{tree}
4235 node, an alias set for the node.  Nodes in different alias sets are not
4236 allowed to alias.  For an example, see the C front-end function
4237 @code{c_get_alias_set}.
4238
4239 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4240
4241 @item -falign-functions
4242 @itemx -falign-functions=@var{n}
4243 @opindex falign-functions
4244 Align the start of functions to the next power-of-two greater than
4245 @var{n}, skipping up to @var{n} bytes.  For instance,
4246 @option{-falign-functions=32} aligns functions to the next 32-byte
4247 boundary, but @option{-falign-functions=24} would align to the next
4248 32-byte boundary only if this can be done by skipping 23 bytes or less.
4249
4250 @option{-fno-align-functions} and @option{-falign-functions=1} are
4251 equivalent and mean that functions will not be aligned.
4252
4253 Some assemblers only support this flag when @var{n} is a power of two;
4254 in that case, it is rounded up.
4255
4256 If @var{n} is not specified or is zero, use a machine-dependent default.
4257
4258 Enabled at levels @option{-O2}, @option{-O3}.
4259
4260 @item -falign-labels
4261 @itemx -falign-labels=@var{n}
4262 @opindex falign-labels
4263 Align all branch targets to a power-of-two boundary, skipping up to
4264 @var{n} bytes like @option{-falign-functions}.  This option can easily
4265 make code slower, because it must insert dummy operations for when the
4266 branch target is reached in the usual flow of the code.
4267
4268 @option{-fno-align-labels} and @option{-falign-labels=1} are
4269 equivalent and mean that labels will not be aligned.
4270
4271 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4272 are greater than this value, then their values are used instead.
4273
4274 If @var{n} is not specified or is zero, use a machine-dependent default
4275 which is very likely to be @samp{1}, meaning no alignment.
4276
4277 Enabled at levels @option{-O2}, @option{-O3}.
4278
4279 @item -falign-loops
4280 @itemx -falign-loops=@var{n}
4281 @opindex falign-loops
4282 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4283 like @option{-falign-functions}.  The hope is that the loop will be
4284 executed many times, which will make up for any execution of the dummy
4285 operations.
4286
4287 @option{-fno-align-loops} and @option{-falign-loops=1} are
4288 equivalent and mean that loops will not be aligned.
4289
4290 If @var{n} is not specified or is zero, use a machine-dependent default.
4291
4292 Enabled at levels @option{-O2}, @option{-O3}.
4293
4294 @item -falign-jumps
4295 @itemx -falign-jumps=@var{n}
4296 @opindex falign-jumps
4297 Align branch targets to a power-of-two boundary, for branch targets
4298 where the targets can only be reached by jumping, skipping up to @var{n}
4299 bytes like @option{-falign-functions}.  In this case, no dummy operations
4300 need be executed.
4301
4302 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
4303 equivalent and mean that loops will not be aligned.
4304
4305 If @var{n} is not specified or is zero, use a machine-dependent default.
4306
4307 Enabled at levels @option{-O2}, @option{-O3}.
4308
4309 @item -frename-registers
4310 @opindex frename-registers
4311 Attempt to avoid false dependencies in scheduled code by making use
4312 of registers left over after register allocation.  This optimization
4313 will most benefit processors with lots of registers.  It can, however,
4314 make debugging impossible, since variables will no longer stay in
4315 a ``home register''.
4316
4317 @item -fweb
4318 @opindex fweb
4319 Constructs webs as commonly used for register allocation purposes and assign
4320 each web individual pseudo register.  This allows our register allocation pass
4321 to operate on pseudos directly, but also strengthens several other optimization
4322 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
4323 however, make debugging impossible, since variables will no longer stay in a
4324 ``home register''.
4325
4326 Enabled at levels @option{-O3}.
4327
4328 @item -fno-cprop-registers
4329 @opindex fno-cprop-registers
4330 After register allocation and post-register allocation instruction splitting,
4331 we perform a copy-propagation pass to try to reduce scheduling dependencies
4332 and occasionally eliminate the copy.
4333
4334 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4335
4336 @item -fprofile-generate
4337 @opindex fprofile-generate
4338 Enable options usually used for instrumenting application to produce profile usefull
4339 for later recompilation profile feedback based optimization.
4340
4341 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}
4342
4343 @item -fprofile-use
4344 @opindex fprofile-use
4345 Enable profile feedback directed optimizations, and optimizations
4346 generally profitable only with profile feedback available.
4347
4348 The following options are enabled: @code{-fbranch-probabilities},
4349 @code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
4350
4351 @end table
4352
4353 The following options control compiler behavior regarding floating
4354 point arithmetic.  These options trade off between speed and
4355 correctness.  All must be specifically enabled.
4356
4357 @table @gcctabopt
4358 @item -ffloat-store
4359 @opindex ffloat-store
4360 Do not store floating point variables in registers, and inhibit other
4361 options that might change whether a floating point value is taken from a
4362 register or memory.
4363
4364 @cindex floating point precision
4365 This option prevents undesirable excess precision on machines such as
4366 the 68000 where the floating registers (of the 68881) keep more
4367 precision than a @code{double} is supposed to have.  Similarly for the
4368 x86 architecture.  For most programs, the excess precision does only
4369 good, but a few programs rely on the precise definition of IEEE floating
4370 point.  Use @option{-ffloat-store} for such programs, after modifying
4371 them to store all pertinent intermediate computations into variables.
4372
4373 @item -ffast-math
4374 @opindex ffast-math
4375 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4376 @option{-fno-trapping-math}, @option{-ffinite-math-only},
4377 @option{-fno-rounding-math} and @option{-fno-signaling-nans}.
4378
4379 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4380
4381 This option should never be turned on by any @option{-O} option since
4382 it can result in incorrect output for programs which depend on
4383 an exact implementation of IEEE or ISO rules/specifications for
4384 math functions.
4385
4386 @item -fno-math-errno
4387 @opindex fno-math-errno
4388 Do not set ERRNO after calling math functions that are executed
4389 with a single instruction, e.g., sqrt.  A program that relies on
4390 IEEE exceptions for math error handling may want to use this flag
4391 for speed while maintaining IEEE arithmetic compatibility.
4392
4393 This option should never be turned on by any @option{-O} option since
4394 it can result in incorrect output for programs which depend on
4395 an exact implementation of IEEE or ISO rules/specifications for
4396 math functions.
4397
4398 The default is @option{-fmath-errno}.
4399
4400 @item -funsafe-math-optimizations
4401 @opindex funsafe-math-optimizations
4402 Allow optimizations for floating-point arithmetic that (a) assume
4403 that arguments and results are valid and (b) may violate IEEE or
4404 ANSI standards.  When used at link-time, it may include libraries
4405 or startup files that change the default FPU control word or other
4406 similar optimizations.
4407
4408 This option should never be turned on by any @option{-O} option since
4409 it can result in incorrect output for programs which depend on
4410 an exact implementation of IEEE or ISO rules/specifications for
4411 math functions.
4412
4413 The default is @option{-fno-unsafe-math-optimizations}.
4414
4415 @item -ffinite-math-only
4416 @opindex ffinite-math-only
4417 Allow optimizations for floating-point arithmetic that assume
4418 that arguments and results are not NaNs or +-Infs.
4419
4420 This option should never be turned on by any @option{-O} option since
4421 it can result in incorrect output for programs which depend on
4422 an exact implementation of IEEE or ISO rules/specifications.
4423
4424 The default is @option{-fno-finite-math-only}.
4425
4426 @item -fno-trapping-math
4427 @opindex fno-trapping-math
4428 Compile code assuming that floating-point operations cannot generate
4429 user-visible traps.  These traps include division by zero, overflow,
4430 underflow, inexact result and invalid operation.  This option implies
4431 @option{-fno-signaling-nans}.  Setting this option may allow faster
4432 code if one relies on ``non-stop'' IEEE arithmetic, for example.
4433
4434 This option should never be turned on by any @option{-O} option since
4435 it can result in incorrect output for programs which depend on
4436 an exact implementation of IEEE or ISO rules/specifications for
4437 math functions.
4438
4439 The default is @option{-ftrapping-math}.
4440
4441 @item -frounding-math
4442 @opindex frounding-math
4443 Disable transformations and optimizations that assume default floating
4444 point rounding behavior.  This is round-to-zero for all floating point
4445 to integer conversions, and round-to-nearest for all other arithmetic
4446 truncations.  This option should be specified for programs that change
4447 the FP rounding mode dynamically, or that may be executed with a
4448 non-default rounding mode.  This option disables constant folding of
4449 floating point expressions at compile-time (which may be affected by
4450 rounding mode) and arithmetic transformations that are unsafe in the
4451 presence of sign-dependent rounding modes.
4452
4453 The default is @option{-fno-rounding-math}.
4454
4455 This option is experimental and does not currently guarantee to
4456 disable all GCC optimizations that are affected by rounding mode.
4457 Future versions of gcc may provide finer control of this setting
4458 using C99's @code{FENV_ACCESS} pragma.  This command line option
4459 will be used to specify the default state for @code{FENV_ACCESS}.
4460
4461 @item -fsignaling-nans
4462 @opindex fsignaling-nans
4463 Compile code assuming that IEEE signaling NaNs may generate user-visible
4464 traps during floating-point operations.  Setting this option disables
4465 optimizations that may change the number of exceptions visible with
4466 signaling NaNs.  This option implies @option{-ftrapping-math}.
4467
4468 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4469 be defined.
4470
4471 The default is @option{-fno-signaling-nans}.
4472
4473 This option is experimental and does not currently guarantee to
4474 disable all GCC optimizations that affect signaling NaN behavior.
4475
4476 @item -fsingle-precision-constant
4477 @opindex fsingle-precision-constant
4478 Treat floating point constant as single precision constant instead of
4479 implicitly converting it to double precision constant.
4480
4481
4482 @end table
4483
4484 The following options control optimizations that may improve
4485 performance, but are not enabled by any @option{-O} options.  This
4486 section includes experimental options that may produce broken code.
4487
4488 @table @gcctabopt
4489 @item -fbranch-probabilities
4490 @opindex fbranch-probabilities
4491 After running a program compiled with @option{-fprofile-arcs}
4492 (@pxref{Debugging Options,, Options for Debugging Your Program or
4493 @command{gcc}}), you can compile it a second time using
4494 @option{-fbranch-probabilities}, to improve optimizations based on
4495 the number of times each branch was taken.  When the program
4496 compiled with @option{-fprofile-arcs} exits it saves arc execution
4497 counts to a file called @file{@var{sourcename}.gcda} for each source
4498 file  The information in this data file is very dependent on the
4499 structure of the generated code, so you must use the same source code
4500 and the same optimization options for both compilations.
4501
4502 With @option{-fbranch-probabilities}, GCC puts a
4503 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4504 These can be used to improve optimization.  Currently, they are only
4505 used in one place: in @file{reorg.c}, instead of guessing which path a
4506 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4507 exactly determine which path is taken more often.
4508
4509 @item -fprofile-values
4510 @opindex fprofile-values
4511 If combined with @option{-fprofile-arcs}, it adds code so that some
4512 data about values of expressions in the program is gathered.
4513
4514 With @option{-fbranch-probabilities}, it reads back the data gathered
4515 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4516 notes to instructions for their later usage in optimizations.
4517
4518 @item -fvpt
4519 @opindex fvpt
4520 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
4521 a code to gather information about values of expressions.
4522
4523 With @option{-fbranch-probabilities}, it reads back the data gathered
4524 and actually performs the optimizations based on them.
4525 Currently the optimizations include specialization of division operation
4526 using the knowledge about the value of the denominator.
4527
4528 @item -fnew-ra
4529 @opindex fnew-ra
4530 Use a graph coloring register allocator.  Currently this option is meant
4531 for testing, so we are interested to hear about miscompilations with
4532 @option{-fnew-ra}.
4533
4534 @item -ftracer
4535 @opindex ftracer
4536 Perform tail duplication to enlarge superblock size. This transformation
4537 simplifies the control flow of the function allowing other optimizations to do
4538 better job.
4539
4540 @item -funit-at-a-time
4541 @opindex funit-at-a-time
4542 Parse the whole compilation unit before starting to produce code.
4543 This allows some extra optimizations to take place but consumes more
4544 memory.
4545
4546 @item -funroll-loops
4547 @opindex funroll-loops
4548 Unroll loops whose number of iterations can be determined at compile time or
4549 upon entry to the loop.  @option{-funroll-loops} implies
4550 @option{-frerun-cse-after-loop}.  It also turns on complete loop peeling
4551 (i.e. complete removal of loops with small constant number of iterations).
4552 This option makes code larger, and may or may not make it run faster.
4553
4554 @item -funroll-all-loops
4555 @opindex funroll-all-loops
4556 Unroll all loops, even if their number of iterations is uncertain when
4557 the loop is entered.  This usually makes programs run more slowly.
4558 @option{-funroll-all-loops} implies the same options as
4559 @option{-funroll-loops}.
4560
4561 @item -fpeel-loops
4562 @opindex fpeel-loops
4563 Peels the loops for that there is enough information that they do not
4564 roll much (from profile feedback).  It also turns on complete loop peeling
4565 (i.e. complete removal of loops with small constant number of iterations).
4566
4567 @item -funswitch-loops
4568 @opindex funswitch-loops
4569 Move branches with loop invariant conditions out of the loop, with duplicates
4570 of the loop on both branches (modified according to result of the condition).
4571
4572 @item -fold-unroll-loops
4573 @opindex fold-unroll-loops
4574 Unroll loops whose number of iterations can be determined at compile
4575 time or upon entry to the loop, using the old loop unroller whose loop
4576 recognition is based on notes from frontend.  @option{-fold-unroll-loops} implies
4577 both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4578 option makes code larger, and may or may not make it run faster.
4579
4580 @item -fold-unroll-all-loops
4581 @opindex fold-unroll-all-loops
4582 Unroll all loops, even if their number of iterations is uncertain when
4583 the loop is entered. This is done using the old loop unroller whose loop
4584 recognition is based on notes from frontend.  This usually makes programs run more slowly.
4585 @option{-fold-unroll-all-loops} implies the same options as
4586 @option{-fold-unroll-loops}.
4587
4588 @item -funswitch-loops
4589 @opindex funswitch-loops
4590 Move branches with loop invariant conditions out of the loop, with duplicates
4591 of the loop on both branches (modified according to result of the condition).
4592
4593 @item -funswitch-loops
4594 @opindex funswitch-loops
4595 Move branches with loop invariant conditions out of the loop, with duplicates
4596 of the loop on both branches (modified according to result of the condition).
4597
4598 @item -fprefetch-loop-arrays
4599 @opindex fprefetch-loop-arrays
4600 If supported by the target machine, generate instructions to prefetch
4601 memory to improve the performance of loops that access large arrays.
4602
4603 Disabled at level @option{-Os}.
4604
4605 @item -ffunction-sections
4606 @itemx -fdata-sections
4607 @opindex ffunction-sections
4608 @opindex fdata-sections
4609 Place each function or data item into its own section in the output
4610 file if the target supports arbitrary sections.  The name of the
4611 function or the name of the data item determines the section's name
4612 in the output file.
4613
4614 Use these options on systems where the linker can perform optimizations
4615 to improve locality of reference in the instruction space.  Most systems
4616 using the ELF object format and SPARC processors running Solaris 2 have
4617 linkers with such optimizations.  AIX may have these optimizations in
4618 the future.
4619
4620 Only use these options when there are significant benefits from doing
4621 so.  When you specify these options, the assembler and linker will
4622 create larger object and executable files and will also be slower.
4623 You will not be able to use @code{gprof} on all systems if you
4624 specify this option and you may have problems with debugging if
4625 you specify both this option and @option{-g}.
4626
4627 @item -fbranch-target-load-optimize
4628 @opindex fbranch-target-load-optimize
4629 Perform branch target register load optimization before prologue / epilogue
4630 threading.
4631 The use of target registers can typically be exposed only during reload,
4632 thus hoisting loads out of loops and doing inter-block scheduling needs
4633 a separate optimization pass.
4634
4635 @item -fbranch-target-load-optimize2
4636 @opindex fbranch-target-load-optimize2
4637 Perform branch target register load optimization after prologue / epilogue
4638 threading.
4639
4640 @item -fbtr-bb-exclusive
4641 @opindex fbtr-bb-exclusive
4642 WHen performing branch target register load optimization, don't reuse
4643 branch target registers in within any basic block.
4644
4645 @item --param @var{name}=@var{value}
4646 @opindex param
4647 In some places, GCC uses various constants to control the amount of
4648 optimization that is done.  For example, GCC will not inline functions
4649 that contain more that a certain number of instructions.  You can
4650 control some of these constants on the command-line using the
4651 @option{--param} option.
4652
4653 The names of specific parameters, and the meaning of the values, are
4654 tied to the internals of the compiler, and are subject to change
4655 without notice in future releases.
4656
4657 In each case, the @var{value} is an integer.  The allowable choices for
4658 @var{name} are given in the following table:
4659
4660 @table @gcctabopt
4661 @item max-crossjump-edges
4662 The maximum number of incoming edges to consider for crossjumping.
4663 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
4664 the number of edges incoming to each block.  Increasing values mean
4665 more aggressive optimization, making the compile time increase with
4666 probably small improvement in executable size.
4667
4668 @item max-delay-slot-insn-search
4669 The maximum number of instructions to consider when looking for an
4670 instruction to fill a delay slot.  If more than this arbitrary number of
4671 instructions is searched, the time savings from filling the delay slot
4672 will be minimal so stop searching.  Increasing values mean more
4673 aggressive optimization, making the compile time increase with probably
4674 small improvement in executable run time.
4675
4676 @item max-delay-slot-live-search
4677 When trying to fill delay slots, the maximum number of instructions to
4678 consider when searching for a block with valid live register
4679 information.  Increasing this arbitrarily chosen value means more
4680 aggressive optimization, increasing the compile time.  This parameter
4681 should be removed when the delay slot code is rewritten to maintain the
4682 control-flow graph.
4683
4684 @item max-gcse-memory
4685 The approximate maximum amount of memory that will be allocated in
4686 order to perform the global common subexpression elimination
4687 optimization.  If more memory than specified is required, the
4688 optimization will not be done.
4689
4690 @item max-gcse-passes
4691 The maximum number of passes of GCSE to run.
4692
4693 @item max-pending-list-length
4694 The maximum number of pending dependencies scheduling will allow
4695 before flushing the current state and starting over.  Large functions
4696 with few branches or calls can create excessively large lists which
4697 needlessly consume memory and resources.
4698
4699 @item max-inline-insns-single
4700 Several parameters control the tree inliner used in gcc.
4701 This number sets the maximum number of instructions (counted in gcc's
4702 internal representation) in a single function that the tree inliner
4703 will consider for inlining.  This only affects functions declared
4704 inline and methods implemented in a class declaration (C++).
4705 The default value is 500.
4706
4707 @item max-inline-insns-auto
4708 When you use @option{-finline-functions} (included in @option{-O3}),
4709 a lot of functions that would otherwise not be considered for inlining
4710 by the compiler will be investigated.  To those functions, a different
4711 (more restrictive) limit compared to functions declared inline can
4712 be applied.
4713 The default value is 120.
4714
4715 @item large-function-insns
4716 The limit specifying really large functions.  For functions greater than this
4717 limit inlining is constrained by @option{--param large-function-growth}.
4718 This parameter is useful primarily to avoid extreme compilation time caused by non-linear
4719 algorithms used by the backend.
4720 This parameter is ignored when @option{-funit-at-a-time} is not used.
4721 The default value is 3000.
4722
4723 @item large-function-growth
4724 Specifies maximal growth of large function caused by inlining in percents.
4725 This parameter is ignored when @option{-funit-at-a-time} is not used.
4726 The default value is 200.
4727
4728 @item inline-unit-growth
4729 Specifies maximal overall growth of the compilation unit caused by inlining.
4730 This parameter is ignored when @option{-funit-at-a-time} is not used.
4731 The default value is 150.
4732
4733 @item max-inline-insns-rtl
4734 For languages that use the RTL inliner (this happens at a later stage
4735 than tree inlining), you can set the maximum allowable size (counted
4736 in RTL instructions) for the RTL inliner with this parameter.
4737 The default value is 600.
4738
4739 @item max-unrolled-insns
4740 The maximum number of instructions that a loop should have if that loop
4741 is unrolled, and if the loop is unrolled, it determines how many times
4742 the loop code is unrolled.
4743
4744 @item max-average-unrolled-insns
4745 The maximum number of instructions biased by probabilities of their execution
4746 that a loop should have if that loop is unrolled, and if the loop is unrolled,
4747 it determines how many times the loop code is unrolled.
4748
4749 @item max-unroll-times
4750 The maximum number of unrollings of a single loop.
4751
4752 @item max-peeled-insns
4753 The maximum number of instructions that a loop should have if that loop
4754 is peeled, and if the loop is peeled, it determines how many times
4755 the loop code is peeled.
4756
4757 @item max-peel-times
4758 The maximum number of peelings of a single loop.
4759
4760 @item max-completely-peeled-insns
4761 The maximum number of insns of a completely peeled loop.
4762
4763 @item max-completely-peel-times
4764 The maximum number of iterations of a loop to be suitable for complete peeling.
4765
4766 @item max-unswitch-insns
4767 The maximum number of insns of an unswitched loop.
4768
4769 @item max-unswitch-level
4770 The maximum number of branches unswitched in a single loop.
4771
4772 @item hot-bb-count-fraction
4773 Select fraction of the maximal count of repetitions of basic block in program
4774 given basic block needs to have to be considered hot.
4775
4776 @item hot-bb-frequency-fraction
4777 Select fraction of the maximal frequency of executions of basic block in
4778 function given basic block needs to have to be considered hot
4779
4780 @item tracer-dynamic-coverage
4781 @itemx tracer-dynamic-coverage-feedback
4782
4783 This value is used to limit superblock formation once the given percentage of
4784 executed instructions is covered.  This limits unnecessary code size
4785 expansion.
4786
4787 The @option{tracer-dynamic-coverage-feedback} is used only when profile
4788 feedback is available.  The real profiles (as opposed to statically estimated
4789 ones) are much less balanced allowing the threshold to be larger value.
4790
4791 @item tracer-max-code-growth
4792 Stop tail duplication once code growth has reached given percentage.  This is
4793 rather hokey argument, as most of the duplicates will be eliminated later in
4794 cross jumping, so it may be set to much higher values than is the desired code
4795 growth.
4796
4797 @item tracer-min-branch-ratio
4798
4799 Stop reverse growth when the reverse probability of best edge is less than this
4800 threshold (in percent).
4801
4802 @item tracer-min-branch-ratio
4803 @itemx tracer-min-branch-ratio-feedback
4804
4805 Stop forward growth if the best edge do have probability lower than this
4806 threshold.
4807
4808 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
4809 compilation for profile feedback and one for compilation without.  The value
4810 for compilation with profile feedback needs to be more conservative (higher) in
4811 order to make tracer effective.
4812
4813 @item max-cse-path-length
4814
4815 Maximum number of basic blocks on path that cse considers.
4816
4817 @item ggc-min-expand
4818
4819 GCC uses a garbage collector to manage its own memory allocation.  This
4820 parameter specifies the minimum percentage by which the garbage
4821 collector's heap should be allowed to expand between collections.
4822 Tuning this may improve compilation speed; it has no effect on code
4823 generation.
4824
4825 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
4826 RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
4827 the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
4828 GCC is not able to calculate RAM on a particular platform, the lower
4829 bound of 30% is used.  Setting this parameter and
4830 @option{ggc-min-heapsize} to zero causes a full collection to occur at
4831 every opportunity.  This is extremely slow, but can be useful for
4832 debugging.
4833
4834 @item ggc-min-heapsize
4835
4836 Minimum size of the garbage collector's heap before it begins bothering
4837 to collect garbage.  The first collection occurs after the heap expands
4838 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
4839 tuning this may improve compilation speed, and has no effect on code
4840 generation.
4841
4842 The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
4843 upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
4844 available, the notion of "RAM" is the smallest of actual RAM,
4845 RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
4846 RAM on a particular platform, the lower bound is used.  Setting this
4847 parameter very large effectively disables garbage collection.  Setting
4848 this parameter and @option{ggc-min-expand} to zero causes a full
4849 collection to occur at every opportunity.
4850
4851 @item max-reload-search-insns
4852 The maximum number of instruction reload should look backward for equivalent
4853 register.  Increasing values mean more aggressive optimization, making the
4854 compile time increase with probably slightly better performance.  The default
4855 value is 100.
4856
4857 @item max-cselib-memory-location
4858 The maximum number of memory locations cselib should take into acount.
4859 Increasing values mean more aggressive optimization, making the compile time
4860 increase with probably slightly better performance.  The default value is 500.
4861
4862 @item reorder-blocks-duplicate
4863 @itemx reorder-blocks-duplicate-feedback
4864
4865 Used by basic block reordering pass to decide whether to use unconditional
4866 branch or duplicate the code on its destination.  Code is duplicated when its
4867 estimated size is smaller than this value multiplied by the estimated size of
4868 unconditional jump in the hot spots of the program.
4869
4870 The @option{reorder-block-duplicate-feedback} is used only when profile
4871 feedback is available and may be set to higher values than
4872 @option{reorder-block-duplicate} since information about the hot spots is more
4873 accurate.
4874 @end table
4875 @end table
4876
4877 @node Preprocessor Options
4878 @section Options Controlling the Preprocessor
4879 @cindex preprocessor options
4880 @cindex options, preprocessor
4881
4882 These options control the C preprocessor, which is run on each C source
4883 file before actual compilation.
4884
4885 If you use the @option{-E} option, nothing is done except preprocessing.
4886 Some of these options make sense only together with @option{-E} because
4887 they cause the preprocessor output to be unsuitable for actual
4888 compilation.
4889
4890 @table @gcctabopt
4891 @opindex Wp
4892 You can use @option{-Wp,@var{option}} to bypass the compiler driver
4893 and pass @var{option} directly through to the preprocessor.  If
4894 @var{option} contains commas, it is split into multiple options at the
4895 commas.  However, many options are modified, translated or interpreted
4896 by the compiler driver before being passed to the preprocessor, and
4897 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4898 interface is undocumented and subject to change, so whenever possible
4899 you should avoid using @option{-Wp} and let the driver handle the
4900 options instead.
4901
4902 @item -Xpreprocessor @var{option}
4903 @opindex preprocessor
4904 Pass @var{option} as an option to the preprocessor.  You can use this to
4905 supply system-specific preprocessor options which GCC does not know how to
4906 recognize.
4907
4908 If you want to pass an option that takes an argument, you must use
4909 @option{-Xpreprocessor} twice, once for the option and once for the argument.
4910 @end table
4911
4912 @include cppopts.texi
4913
4914 @node Assembler Options
4915 @section Passing Options to the Assembler
4916
4917 @c prevent bad page break with this line
4918 You can pass options to the assembler.
4919
4920 @table @gcctabopt
4921 @item -Wa,@var{option}
4922 @opindex Wa
4923 Pass @var{option} as an option to the assembler.  If @var{option}
4924 contains commas, it is split into multiple options at the commas.
4925
4926 @item -Xassembler @var{option}
4927 @opindex Xassembler
4928 Pass @var{option} as an option to the assembler.  You can use this to
4929 supply system-specific assembler options which GCC does not know how to
4930 recognize.
4931
4932 If you want to pass an option that takes an argument, you must use
4933 @option{-Xassembler} twice, once for the option and once for the argument.
4934
4935 @end table
4936
4937 @node Link Options
4938 @section Options for Linking
4939 @cindex link options
4940 @cindex options, linking
4941
4942 These options come into play when the compiler links object files into
4943 an executable output file.  They are meaningless if the compiler is
4944 not doing a link step.
4945
4946 @table @gcctabopt
4947 @cindex file names
4948 @item @var{object-file-name}
4949 A file name that does not end in a special recognized suffix is
4950 considered to name an object file or library.  (Object files are
4951 distinguished from libraries by the linker according to the file
4952 contents.)  If linking is done, these object files are used as input
4953 to the linker.
4954
4955 @item -c
4956 @itemx -S
4957 @itemx -E
4958 @opindex c
4959 @opindex S
4960 @opindex E
4961 If any of these options is used, then the linker is not run, and
4962 object file names should not be used as arguments.  @xref{Overall
4963 Options}.
4964
4965 @cindex Libraries
4966 @item -l@var{library}
4967 @itemx -l @var{library}
4968 @opindex l
4969 Search the library named @var{library} when linking.  (The second
4970 alternative with the library as a separate argument is only for
4971 POSIX compliance and is not recommended.)
4972
4973 It makes a difference where in the command you write this option; the
4974 linker searches and processes libraries and object files in the order they
4975 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4976 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
4977 to functions in @samp{z}, those functions may not be loaded.
4978
4979 The linker searches a standard list of directories for the library,
4980 which is actually a file named @file{lib@var{library}.a}.  The linker
4981 then uses this file as if it had been specified precisely by name.
4982
4983 The directories searched include several standard system directories
4984 plus any that you specify with @option{-L}.
4985
4986 Normally the files found this way are library files---archive files
4987 whose members are object files.  The linker handles an archive file by
4988 scanning through it for members which define symbols that have so far
4989 been referenced but not defined.  But if the file that is found is an
4990 ordinary object file, it is linked in the usual fashion.  The only
4991 difference between using an @option{-l} option and specifying a file name
4992 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
4993 and searches several directories.
4994
4995 @item -lobjc
4996 @opindex lobjc
4997 You need this special case of the @option{-l} option in order to
4998 link an Objective-C program.
4999
5000 @item -nostartfiles
5001 @opindex nostartfiles
5002 Do not use the standard system startup files when linking.
5003 The standard system libraries are used normally, unless @option{-nostdlib}
5004 or @option{-nodefaultlibs} is used.
5005
5006 @item -nodefaultlibs
5007 @opindex nodefaultlibs
5008 Do not use the standard system libraries when linking.
5009 Only the libraries you specify will be passed to the linker.
5010 The standard startup files are used normally, unless @option{-nostartfiles}
5011 is used.  The compiler may generate calls to memcmp, memset, and memcpy
5012 for System V (and ISO C) environments or to bcopy and bzero for
5013 BSD environments.  These entries are usually resolved by entries in
5014 libc.  These entry points should be supplied through some other
5015 mechanism when this option is specified.
5016
5017 @item -nostdlib
5018 @opindex nostdlib
5019 Do not use the standard system startup files or libraries when linking.
5020 No startup files and only the libraries you specify will be passed to
5021 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
5022 for System V (and ISO C) environments or to bcopy and bzero for
5023 BSD environments.  These entries are usually resolved by entries in
5024 libc.  These entry points should be supplied through some other
5025 mechanism when this option is specified.
5026
5027 @cindex @option{-lgcc}, use with @option{-nostdlib}
5028 @cindex @option{-nostdlib} and unresolved references
5029 @cindex unresolved references and @option{-nostdlib}
5030 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5031 @cindex @option{-nodefaultlibs} and unresolved references
5032 @cindex unresolved references and @option{-nodefaultlibs}
5033 One of the standard libraries bypassed by @option{-nostdlib} and
5034 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
5035 that GCC uses to overcome shortcomings of particular machines, or special
5036 needs for some languages.
5037 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5038 Collection (GCC) Internals},
5039 for more discussion of @file{libgcc.a}.)
5040 In most cases, you need @file{libgcc.a} even when you want to avoid
5041 other standard libraries.  In other words, when you specify @option{-nostdlib}
5042 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
5043 This ensures that you have no unresolved references to internal GCC
5044 library subroutines.  (For example, @samp{__main}, used to ensure C++
5045 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5046 GNU Compiler Collection (GCC) Internals}.)
5047
5048 @item -pie
5049 @opindex pie
5050 Produce a position independent executable on targets which support it.
5051 For predictable results, you must also specify the same set of options
5052 that were used to generate code (@option{-fpie}, @option{-fPIE},
5053 or model suboptions) when you specify this option.
5054
5055 @item -s
5056 @opindex s
5057 Remove all symbol table and relocation information from the executable.
5058
5059 @item -static
5060 @opindex static
5061 On systems that support dynamic linking, this prevents linking with the shared
5062 libraries.  On other systems, this option has no effect.
5063
5064 @item -shared
5065 @opindex shared
5066 Produce a shared object which can then be linked with other objects to
5067 form an executable.  Not all systems support this option.  For predictable
5068 results, you must also specify the same set of options that were used to
5069 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
5070 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
5071 needs to build supplementary stub code for constructors to work.  On
5072 multi-libbed systems, @samp{gcc -shared} must select the correct support
5073 libraries to link against.  Failing to supply the correct flags may lead
5074 to subtle defects.  Supplying them in cases where they are not necessary
5075 is innocuous.}
5076
5077 @item -shared-libgcc
5078 @itemx -static-libgcc
5079 @opindex shared-libgcc
5080 @opindex static-libgcc
5081 On systems that provide @file{libgcc} as a shared library, these options
5082 force the use of either the shared or static version respectively.
5083 If no shared version of @file{libgcc} was built when the compiler was
5084 configured, these options have no effect.
5085
5086 There are several situations in which an application should use the
5087 shared @file{libgcc} instead of the static version.  The most common
5088 of these is when the application wishes to throw and catch exceptions
5089 across different shared libraries.  In that case, each of the libraries
5090 as well as the application itself should use the shared @file{libgcc}.
5091
5092 Therefore, the G++ and GCJ drivers automatically add
5093 @option{-shared-libgcc} whenever you build a shared library or a main
5094 executable, because C++ and Java programs typically use exceptions, so
5095 this is the right thing to do.
5096
5097 If, instead, you use the GCC driver to create shared libraries, you may
5098 find that they will not always be linked with the shared @file{libgcc}.
5099 If GCC finds, at its configuration time, that you have a GNU linker that
5100 does not support option @option{--eh-frame-hdr}, it will link the shared
5101 version of @file{libgcc} into shared libraries by default.  Otherwise,
5102 it will take advantage of the linker and optimize away the linking with
5103 the shared version of @file{libgcc}, linking with the static version of
5104 libgcc by default.  This allows exceptions to propagate through such
5105 shared libraries, without incurring relocation costs at library load
5106 time.
5107
5108 However, if a library or main executable is supposed to throw or catch
5109 exceptions, you must link it using the G++ or GCJ driver, as appropriate
5110 for the languages used in the program, or using the option
5111 @option{-shared-libgcc}, such that it is linked with the shared
5112 @file{libgcc}.
5113
5114 @item -symbolic
5115 @opindex symbolic
5116 Bind references to global symbols when building a shared object.  Warn
5117 about any unresolved references (unless overridden by the link editor
5118 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
5119 this option.
5120
5121 @item -Xlinker @var{option}
5122 @opindex Xlinker
5123 Pass @var{option} as an option to the linker.  You can use this to
5124 supply system-specific linker options which GCC does not know how to
5125 recognize.
5126
5127 If you want to pass an option that takes an argument, you must use
5128 @option{-Xlinker} twice, once for the option and once for the argument.
5129 For example, to pass @option{-assert definitions}, you must write
5130 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
5131 @option{-Xlinker "-assert definitions"}, because this passes the entire
5132 string as a single argument, which is not what the linker expects.
5133
5134 @item -Wl,@var{option}
5135 @opindex Wl
5136 Pass @var{option} as an option to the linker.  If @var{option} contains
5137 commas, it is split into multiple options at the commas.
5138
5139 @item -u @var{symbol}
5140 @opindex u
5141 Pretend the symbol @var{symbol} is undefined, to force linking of
5142 library modules to define it.  You can use @option{-u} multiple times with
5143 different symbols to force loading of additional library modules.
5144 @end table
5145
5146 @node Directory Options
5147 @section Options for Directory Search
5148 @cindex directory options
5149 @cindex options, directory search
5150 @cindex search path
5151
5152 These options specify directories to search for header files, for
5153 libraries and for parts of the compiler:
5154
5155 @table @gcctabopt
5156 @item -I@var{dir}
5157 @opindex I
5158 Add the directory @var{dir} to the head of the list of directories to be
5159 searched for header files.  This can be used to override a system header
5160 file, substituting your own version, since these directories are
5161 searched before the system header file directories.  However, you should
5162 not use this option to add directories that contain vendor-supplied
5163 system header files (use @option{-isystem} for that).  If you use more than
5164 one @option{-I} option, the directories are scanned in left-to-right
5165 order; the standard system directories come after.
5166
5167 If a standard system include directory, or a directory specified with
5168 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
5169 option will be ignored.  The directory will still be searched but as a
5170 system directory at its normal position in the system include chain.
5171 This is to ensure that GCC's procedure to fix buggy system headers and
5172 the ordering for the include_next directive are not inadvertently changed.
5173 If you really need to change the search order for system directories,
5174 use the @option{-nostdinc} and/or @option{-isystem} options.
5175
5176 @item -I-
5177 @opindex I-
5178 Any directories you specify with @option{-I} options before the @option{-I-}
5179 option are searched only for the case of @samp{#include "@var{file}"};
5180 they are not searched for @samp{#include <@var{file}>}.
5181
5182 If additional directories are specified with @option{-I} options after
5183 the @option{-I-}, these directories are searched for all @samp{#include}
5184 directives.  (Ordinarily @emph{all} @option{-I} directories are used
5185 this way.)
5186
5187 In addition, the @option{-I-} option inhibits the use of the current
5188 directory (where the current input file came from) as the first search
5189 directory for @samp{#include "@var{file}"}.  There is no way to
5190 override this effect of @option{-I-}.  With @option{-I.} you can specify
5191 searching the directory which was current when the compiler was
5192 invoked.  That is not exactly the same as what the preprocessor does
5193 by default, but it is often satisfactory.
5194
5195 @option{-I-} does not inhibit the use of the standard system directories
5196 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
5197 independent.
5198
5199 @item -L@var{dir}
5200 @opindex L
5201 Add directory @var{dir} to the list of directories to be searched
5202 for @option{-l}.
5203
5204 @item -B@var{prefix}
5205 @opindex B
5206 This option specifies where to find the executables, libraries,
5207 include files, and data files of the compiler itself.
5208
5209 The compiler driver program runs one or more of the subprograms
5210 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
5211 @var{prefix} as a prefix for each program it tries to run, both with and
5212 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5213
5214 For each subprogram to be run, the compiler driver first tries the
5215 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
5216 was not specified, the driver tries two standard prefixes, which are
5217 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
5218 those results in a file name that is found, the unmodified program
5219 name is searched for using the directories specified in your
5220 @env{PATH} environment variable.
5221
5222 The compiler will check to see if the path provided by the @option{-B}
5223 refers to a directory, and if necessary it will add a directory
5224 separator character at the end of the path.
5225
5226 @option{-B} prefixes that effectively specify directory names also apply
5227 to libraries in the linker, because the compiler translates these
5228 options into @option{-L} options for the linker.  They also apply to
5229 includes files in the preprocessor, because the compiler translates these
5230 options into @option{-isystem} options for the preprocessor.  In this case,
5231 the compiler appends @samp{include} to the prefix.
5232
5233 The run-time support file @file{libgcc.a} can also be searched for using
5234 the @option{-B} prefix, if needed.  If it is not found there, the two
5235 standard prefixes above are tried, and that is all.  The file is left
5236 out of the link if it is not found by those means.
5237
5238 Another way to specify a prefix much like the @option{-B} prefix is to use
5239 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
5240 Variables}.
5241
5242 As a special kludge, if the path provided by @option{-B} is
5243 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
5244 9, then it will be replaced by @file{[dir/]include}.  This is to help
5245 with boot-strapping the compiler.
5246
5247 @item -specs=@var{file}
5248 @opindex specs
5249 Process @var{file} after the compiler reads in the standard @file{specs}
5250 file, in order to override the defaults that the @file{gcc} driver
5251 program uses when determining what switches to pass to @file{cc1},
5252 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
5253 @option{-specs=@var{file}} can be specified on the command line, and they
5254 are processed in order, from left to right.
5255 @end table
5256
5257 @c man end
5258
5259 @node Spec Files
5260 @section Specifying subprocesses and the switches to pass to them
5261 @cindex Spec Files
5262
5263 @command{gcc} is a driver program.  It performs its job by invoking a
5264 sequence of other programs to do the work of compiling, assembling and
5265 linking.  GCC interprets its command-line parameters and uses these to
5266 deduce which programs it should invoke, and which command-line options
5267 it ought to place on their command lines.  This behavior is controlled
5268 by @dfn{spec strings}.  In most cases there is one spec string for each
5269 program that GCC can invoke, but a few programs have multiple spec
5270 strings to control their behavior.  The spec strings built into GCC can
5271 be overridden by using the @option{-specs=} command-line switch to specify
5272 a spec file.
5273
5274 @dfn{Spec files} are plaintext files that are used to construct spec
5275 strings.  They consist of a sequence of directives separated by blank
5276 lines.  The type of directive is determined by the first non-whitespace
5277 character on the line and it can be one of the following:
5278
5279 @table @code
5280 @item %@var{command}
5281 Issues a @var{command} to the spec file processor.  The commands that can
5282 appear here are:
5283
5284 @table @code
5285 @item %include <@var{file}>
5286 @cindex %include
5287 Search for @var{file} and insert its text at the current point in the
5288 specs file.
5289
5290 @item %include_noerr <@var{file}>
5291 @cindex %include_noerr
5292 Just like @samp{%include}, but do not generate an error message if the include
5293 file cannot be found.
5294
5295 @item %rename @var{old_name} @var{new_name}
5296 @cindex %rename
5297 Rename the spec string @var{old_name} to @var{new_name}.
5298
5299 @end table
5300
5301 @item *[@var{spec_name}]:
5302 This tells the compiler to create, override or delete the named spec
5303 string.  All lines after this directive up to the next directive or
5304 blank line are considered to be the text for the spec string.  If this
5305 results in an empty string then the spec will be deleted.  (Or, if the
5306 spec did not exist, then nothing will happened.)  Otherwise, if the spec
5307 does not currently exist a new spec will be created.  If the spec does
5308 exist then its contents will be overridden by the text of this
5309 directive, unless the first character of that text is the @samp{+}
5310 character, in which case the text will be appended to the spec.
5311
5312 @item [@var{suffix}]:
5313 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
5314 and up to the next directive or blank line are considered to make up the
5315 spec string for the indicated suffix.  When the compiler encounters an
5316 input file with the named suffix, it will processes the spec string in
5317 order to work out how to compile that file.  For example:
5318
5319 @smallexample
5320 .ZZ:
5321 z-compile -input %i
5322 @end smallexample
5323
5324 This says that any input file whose name ends in @samp{.ZZ} should be
5325 passed to the program @samp{z-compile}, which should be invoked with the
5326 command-line switch @option{-input} and with the result of performing the
5327 @samp{%i} substitution.  (See below.)
5328
5329 As an alternative to providing a spec string, the text that follows a
5330 suffix directive can be one of the following:
5331
5332 @table @code
5333 @item @@@var{language}
5334 This says that the suffix is an alias for a known @var{language}.  This is
5335 similar to using the @option{-x} command-line switch to GCC to specify a
5336 language explicitly.  For example:
5337
5338 @smallexample
5339 .ZZ:
5340 @@c++
5341 @end smallexample
5342
5343 Says that .ZZ files are, in fact, C++ source files.
5344
5345 @item #@var{name}
5346 This causes an error messages saying:
5347
5348 @smallexample
5349 @var{name} compiler not installed on this system.
5350 @end smallexample
5351 @end table
5352
5353 GCC already has an extensive list of suffixes built into it.
5354 This directive will add an entry to the end of the list of suffixes, but
5355 since the list is searched from the end backwards, it is effectively
5356 possible to override earlier entries using this technique.
5357
5358 @end table
5359
5360 GCC has the following spec strings built into it.  Spec files can
5361 override these strings or create their own.  Note that individual
5362 targets can also add their own spec strings to this list.
5363
5364 @smallexample
5365 asm          Options to pass to the assembler
5366 asm_final    Options to pass to the assembler post-processor
5367 cpp          Options to pass to the C preprocessor
5368 cc1          Options to pass to the C compiler
5369 cc1plus      Options to pass to the C++ compiler
5370 endfile      Object files to include at the end of the link
5371 link         Options to pass to the linker
5372 lib          Libraries to include on the command line to the linker
5373 libgcc       Decides which GCC support library to pass to the linker
5374 linker       Sets the name of the linker
5375 predefines   Defines to be passed to the C preprocessor
5376 signed_char  Defines to pass to CPP to say whether @code{char} is signed
5377              by default
5378 startfile    Object files to include at the start of the link
5379 @end smallexample
5380
5381 Here is a small example of a spec file:
5382
5383 @smallexample
5384 %rename lib                 old_lib
5385
5386 *lib:
5387 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
5388 @end smallexample
5389
5390 This example renames the spec called @samp{lib} to @samp{old_lib} and
5391 then overrides the previous definition of @samp{lib} with a new one.
5392 The new definition adds in some extra command-line options before
5393 including the text of the old definition.
5394
5395 @dfn{Spec strings} are a list of command-line options to be passed to their
5396 corresponding program.  In addition, the spec strings can contain
5397 @samp{%}-prefixed sequences to substitute variable text or to
5398 conditionally insert text into the command line.  Using these constructs
5399 it is possible to generate quite complex command lines.
5400
5401 Here is a table of all defined @samp{%}-sequences for spec
5402 strings.  Note that spaces are not generated automatically around the
5403 results of expanding these sequences.  Therefore you can concatenate them
5404 together or combine them with constant text in a single argument.
5405
5406 @table @code
5407 @item %%
5408 Substitute one @samp{%} into the program name or argument.
5409
5410 @item %i
5411 Substitute the name of the input file being processed.
5412
5413 @item %b
5414 Substitute the basename of the input file being processed.
5415 This is the substring up to (and not including) the last period
5416 and not including the directory.
5417
5418 @item %B
5419 This is the same as @samp{%b}, but include the file suffix (text after
5420 the last period).
5421
5422 @item %d
5423 Marks the argument containing or following the @samp{%d} as a
5424 temporary file name, so that that file will be deleted if GCC exits
5425 successfully.  Unlike @samp{%g}, this contributes no text to the
5426 argument.
5427
5428 @item %g@var{suffix}
5429 Substitute a file name that has suffix @var{suffix} and is chosen
5430 once per compilation, and mark the argument in the same way as
5431 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5432 name is now chosen in a way that is hard to predict even when previously
5433 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5434 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5435 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5436 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5437 was simply substituted with a file name chosen once per compilation,
5438 without regard to any appended suffix (which was therefore treated
5439 just like ordinary text), making such attacks more likely to succeed.
5440
5441 @item %u@var{suffix}
5442 Like @samp{%g}, but generates a new temporary file name even if
5443 @samp{%u@var{suffix}} was already seen.
5444
5445 @item %U@var{suffix}
5446 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5447 new one if there is no such last file name.  In the absence of any
5448 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5449 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5450 would involve the generation of two distinct file names, one
5451 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5452 simply substituted with a file name chosen for the previous @samp{%u},
5453 without regard to any appended suffix.
5454
5455 @item %j@var{suffix}
5456 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5457 writable, and if save-temps is off; otherwise, substitute the name
5458 of a temporary file, just like @samp{%u}.  This temporary file is not
5459 meant for communication between processes, but rather as a junk
5460 disposal mechanism.
5461
5462 @item %|@var{suffix}
5463 @itemx %m@var{suffix}
5464 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
5465 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
5466 all.  These are the two most common ways to instruct a program that it
5467 should read from standard input or write to standard output.  If you
5468 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
5469 construct: see for example @file{f/lang-specs.h}.
5470
5471 @item %.@var{SUFFIX}
5472 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5473 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5474 terminated by the next space or %.
5475
5476 @item %w
5477 Marks the argument containing or following the @samp{%w} as the
5478 designated output file of this compilation.  This puts the argument
5479 into the sequence of arguments that @samp{%o} will substitute later.
5480
5481 @item %o
5482 Substitutes the names of all the output files, with spaces
5483 automatically placed around them.  You should write spaces
5484 around the @samp{%o} as well or the results are undefined.
5485 @samp{%o} is for use in the specs for running the linker.
5486 Input files whose names have no recognized suffix are not compiled
5487 at all, but they are included among the output files, so they will
5488 be linked.
5489
5490 @item %O
5491 Substitutes the suffix for object files.  Note that this is
5492 handled specially when it immediately follows @samp{%g, %u, or %U},
5493 because of the need for those to form complete file names.  The
5494 handling is such that @samp{%O} is treated exactly as if it had already
5495 been substituted, except that @samp{%g, %u, and %U} do not currently
5496 support additional @var{suffix} characters following @samp{%O} as they would
5497 following, for example, @samp{.o}.
5498
5499 @item %p
5500 Substitutes the standard macro predefinitions for the
5501 current target machine.  Use this when running @code{cpp}.
5502
5503 @item %P
5504 Like @samp{%p}, but puts @samp{__} before and after the name of each
5505 predefined macro, except for macros that start with @samp{__} or with
5506 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5507 C@.
5508
5509 @item %I
5510 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5511 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5512 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5513 as necessary.
5514
5515 @item %s
5516 Current argument is the name of a library or startup file of some sort.
5517 Search for that file in a standard list of directories and substitute
5518 the full name found.
5519
5520 @item %e@var{str}
5521 Print @var{str} as an error message.  @var{str} is terminated by a newline.
5522 Use this when inconsistent options are detected.
5523
5524 @item %(@var{name})
5525 Substitute the contents of spec string @var{name} at this point.
5526
5527 @item %[@var{name}]
5528 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
5529
5530 @item %x@{@var{option}@}
5531 Accumulate an option for @samp{%X}.
5532
5533 @item %X
5534 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
5535 spec string.
5536
5537 @item %Y
5538 Output the accumulated assembler options specified by @option{-Wa}.
5539
5540 @item %Z
5541 Output the accumulated preprocessor options specified by @option{-Wp}.
5542
5543 @item %a
5544 Process the @code{asm} spec.  This is used to compute the
5545 switches to be passed to the assembler.
5546
5547 @item %A
5548 Process the @code{asm_final} spec.  This is a spec string for
5549 passing switches to an assembler post-processor, if such a program is
5550 needed.
5551
5552 @item %l
5553 Process the @code{link} spec.  This is the spec for computing the
5554 command line passed to the linker.  Typically it will make use of the
5555 @samp{%L %G %S %D and %E} sequences.
5556
5557 @item %D
5558 Dump out a @option{-L} option for each directory that GCC believes might
5559 contain startup files.  If the target supports multilibs then the
5560 current multilib directory will be prepended to each of these paths.
5561
5562 @item %M
5563 Output the multilib directory with directory separators replaced with
5564 @samp{_}.  If multilib directories are not set, or the multilib directory is
5565 @file{.} then this option emits nothing.
5566
5567 @item %L
5568 Process the @code{lib} spec.  This is a spec string for deciding which
5569 libraries should be included on the command line to the linker.
5570
5571 @item %G
5572 Process the @code{libgcc} spec.  This is a spec string for deciding
5573 which GCC support library should be included on the command line to the linker.
5574
5575 @item %S
5576 Process the @code{startfile} spec.  This is a spec for deciding which
5577 object files should be the first ones passed to the linker.  Typically
5578 this might be a file named @file{crt0.o}.
5579
5580 @item %E
5581 Process the @code{endfile} spec.  This is a spec string that specifies
5582 the last object files that will be passed to the linker.
5583
5584 @item %C
5585 Process the @code{cpp} spec.  This is used to construct the arguments
5586 to be passed to the C preprocessor.
5587
5588 @item %c
5589 Process the @code{signed_char} spec.  This is intended to be used
5590 to tell cpp whether a char is signed.  It typically has the definition:
5591 @smallexample
5592 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
5593 @end smallexample
5594
5595 @item %1
5596 Process the @code{cc1} spec.  This is used to construct the options to be
5597 passed to the actual C compiler (@samp{cc1}).
5598
5599 @item %2
5600 Process the @code{cc1plus} spec.  This is used to construct the options to be
5601 passed to the actual C++ compiler (@samp{cc1plus}).
5602
5603 @item %*
5604 Substitute the variable part of a matched option.  See below.
5605 Note that each comma in the substituted string is replaced by
5606 a single space.
5607
5608 @item %<@code{S}
5609 Remove all occurrences of @code{-S} from the command line.  Note---this
5610 command is position dependent.  @samp{%} commands in the spec string
5611 before this one will see @code{-S}, @samp{%} commands in the spec string
5612 after this one will not.
5613
5614 @item %:@var{function}(@var{args})
5615 Call the named function @var{function}, passing it @var{args}.
5616 @var{args} is first processed as a nested spec string, then split
5617 into an argument vector in the usual fashion.  The function returns
5618 a string which is processed as if it had appeared literally as part
5619 of the current spec.
5620
5621 The following built-in spec functions are provided:
5622
5623 @table @code
5624 @item @code{if-exists}
5625 The @code{if-exists} spec function takes one argument, an absolute
5626 pathname to a file.  If the file exists, @code{if-exists} returns the
5627 pathname.  Here is a small example of its usage:
5628
5629 @smallexample
5630 *startfile:
5631 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
5632 @end smallexample
5633
5634 @item @code{if-exists-else}
5635 The @code{if-exists-else} spec function is similar to the @code{if-exists}
5636 spec function, except that it takes two arguments.  The first argument is
5637 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
5638 returns the pathname.  If it does not exist, it returns the second argument.
5639 This way, @code{if-exists-else} can be used to select one file or another,
5640 based on the existence of the first.  Here is a small example of its usage:
5641
5642 @smallexample
5643 *startfile:
5644 crt0%O%s %:if-exists(crti%O%s) \
5645 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
5646 @end smallexample
5647 @end table
5648
5649 @item %@{@code{S}@}
5650 Substitutes the @code{-S} switch, if that switch was given to GCC@.
5651 If that switch was not specified, this substitutes nothing.  Note that
5652 the leading dash is omitted when specifying this option, and it is
5653 automatically inserted if the substitution is performed.  Thus the spec
5654 string @samp{%@{foo@}} would match the command-line option @option{-foo}
5655 and would output the command line option @option{-foo}.
5656
5657 @item %W@{@code{S}@}
5658 Like %@{@code{S}@} but mark last argument supplied within as a file to be
5659 deleted on failure.
5660
5661 @item %@{@code{S}*@}
5662 Substitutes all the switches specified to GCC whose names start
5663 with @code{-S}, but which also take an argument.  This is used for
5664 switches like @option{-o}, @option{-D}, @option{-I}, etc.
5665 GCC considers @option{-o foo} as being
5666 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
5667 text, including the space.  Thus two arguments would be generated.
5668
5669 @item %@{@code{S}*&@code{T}*@}
5670 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
5671 (the order of @code{S} and @code{T} in the spec is not significant).
5672 There can be any number of ampersand-separated variables; for each the
5673 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
5674
5675 @item %@{@code{S}:@code{X}@}
5676 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
5677
5678 @item %@{!@code{S}:@code{X}@}
5679 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
5680
5681 @item %@{@code{S}*:@code{X}@}
5682 Substitutes @code{X} if one or more switches whose names start with
5683 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
5684 once, no matter how many such switches appeared.  However, if @code{%*}
5685 appears somewhere in @code{X}, then @code{X} will be substituted once
5686 for each matching switch, with the @code{%*} replaced by the part of
5687 that switch that matched the @code{*}.
5688
5689 @item %@{.@code{S}:@code{X}@}
5690 Substitutes @code{X}, if processing a file with suffix @code{S}.
5691
5692 @item %@{!.@code{S}:@code{X}@}
5693 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
5694
5695 @item %@{@code{S}|@code{P}:@code{X}@}
5696 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
5697 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
5698 although they have a stronger binding than the @samp{|}.  If @code{%*}
5699 appears in @code{X}, all of the alternatives must be starred, and only
5700 the first matching alternative is substituted.
5701
5702 For example, a spec string like this:
5703
5704 @smallexample
5705 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5706 @end smallexample
5707
5708 will output the following command-line options from the following input
5709 command-line options:
5710
5711 @smallexample
5712 fred.c        -foo -baz
5713 jim.d         -bar -boggle
5714 -d fred.c     -foo -baz -boggle
5715 -d jim.d      -bar -baz -boggle
5716 @end smallexample
5717
5718 @item %@{S:X; T:Y; :D@}
5719
5720 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
5721 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
5722 be as many clauses as you need.  This may be combined with @code{.},
5723 @code{!}, @code{|}, and @code{*} as needed.
5724
5725
5726 @end table
5727
5728 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
5729 construct may contain other nested @samp{%} constructs or spaces, or
5730 even newlines.  They are processed as usual, as described above.
5731 Trailing white space in @code{X} is ignored.  White space may also
5732 appear anywhere on the left side of the colon in these constructs,
5733 except between @code{.} or @code{*} and the corresponding word.
5734
5735 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
5736 handled specifically in these constructs.  If another value of
5737 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5738 @option{-W} switch is found later in the command line, the earlier
5739 switch value is ignored, except with @{@code{S}*@} where @code{S} is
5740 just one letter, which passes all matching options.
5741
5742 The character @samp{|} at the beginning of the predicate text is used to
5743 indicate that a command should be piped to the following command, but
5744 only if @option{-pipe} is specified.
5745
5746 It is built into GCC which switches take arguments and which do not.
5747 (You might think it would be useful to generalize this to allow each
5748 compiler's spec to say which switches take arguments.  But this cannot
5749 be done in a consistent fashion.  GCC cannot even decide which input
5750 files have been specified without knowing which switches take arguments,
5751 and it must know which input files to compile in order to tell which
5752 compilers to run).
5753
5754 GCC also knows implicitly that arguments starting in @option{-l} are to be
5755 treated as compiler output files, and passed to the linker in their
5756 proper position among the other output files.
5757
5758 @c man begin OPTIONS
5759
5760 @node Target Options
5761 @section Specifying Target Machine and Compiler Version
5762 @cindex target options
5763 @cindex cross compiling
5764 @cindex specifying machine version
5765 @cindex specifying compiler version and target machine
5766 @cindex compiler version, specifying
5767 @cindex target machine, specifying
5768
5769 The usual way to run GCC is to run the executable called @file{gcc}, or
5770 @file{<machine>-gcc} when cross-compiling, or
5771 @file{<machine>-gcc-<version>} to run a version other than the one that
5772 was installed last.  Sometimes this is inconvenient, so GCC provides
5773 options that will switch to another cross-compiler or version.
5774
5775 @table @gcctabopt
5776 @item -b @var{machine}
5777 @opindex b
5778 The argument @var{machine} specifies the target machine for compilation.
5779
5780 The value to use for @var{machine} is the same as was specified as the
5781 machine type when configuring GCC as a cross-compiler.  For
5782 example, if a cross-compiler was configured with @samp{configure
5783 i386v}, meaning to compile for an 80386 running System V, then you
5784 would specify @option{-b i386v} to run that cross compiler.
5785
5786 @item -V @var{version}
5787 @opindex V
5788 The argument @var{version} specifies which version of GCC to run.
5789 This is useful when multiple versions are installed.  For example,
5790 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5791 @end table
5792
5793 The @option{-V} and @option{-b} options work by running the
5794 @file{<machine>-gcc-<version>} executable, so there's no real reason to
5795 use them if you can just run that directly.
5796
5797 @node Submodel Options
5798 @section Hardware Models and Configurations
5799 @cindex submodel options
5800 @cindex specifying hardware config
5801 @cindex hardware models and configurations, specifying
5802 @cindex machine dependent options
5803
5804 Earlier we discussed the standard option @option{-b} which chooses among
5805 different installed compilers for completely different target
5806 machines, such as VAX vs.@: 68000 vs.@: 80386.
5807
5808 In addition, each of these target machine types can have its own
5809 special options, starting with @samp{-m}, to choose among various
5810 hardware models or configurations---for example, 68010 vs 68020,
5811 floating coprocessor or none.  A single installed version of the
5812 compiler can compile for any model or configuration, according to the
5813 options specified.
5814
5815 Some configurations of the compiler also support additional special
5816 options, usually for compatibility with other compilers on the same
5817 platform.
5818
5819 These options are defined by the macro @code{TARGET_SWITCHES} in the
5820 machine description.  The default for the options is also defined by
5821 that macro, which enables you to change the defaults.
5822
5823 @menu
5824 * M680x0 Options::
5825 * M68hc1x Options::
5826 * VAX Options::
5827 * SPARC Options::
5828 * ARM Options::
5829 * MN10300 Options::
5830 * M32R/D Options::
5831 * RS/6000 and PowerPC Options::
5832 * Darwin Options::
5833 * MIPS Options::
5834 * i386 and x86-64 Options::
5835 * HPPA Options::
5836 * DEC Alpha Options::
5837 * DEC Alpha/VMS Options::
5838 * H8/300 Options::
5839 * SH Options::
5840 * System V Options::
5841 * TMS320C3x/C4x Options::
5842 * V850 Options::
5843 * ARC Options::
5844 * NS32K Options::
5845 * AVR Options::
5846 * MCore Options::
5847 * IA-64 Options::
5848 * S/390 and zSeries Options::
5849 * CRIS Options::
5850 * MMIX Options::
5851 * PDP-11 Options::
5852 * Xstormy16 Options::
5853 * Xtensa Options::
5854 * FRV Options::
5855 @end menu
5856
5857 @node M680x0 Options
5858 @subsection M680x0 Options
5859 @cindex M680x0 options
5860
5861 These are the @samp{-m} options defined for the 68000 series.  The default
5862 values for these options depends on which style of 68000 was selected when
5863 the compiler was configured; the defaults for the most common choices are
5864 given below.
5865
5866 @table @gcctabopt
5867 @item -m68000
5868 @itemx -mc68000
5869 @opindex m68000
5870 @opindex mc68000
5871 Generate output for a 68000.  This is the default
5872 when the compiler is configured for 68000-based systems.
5873
5874 Use this option for microcontrollers with a 68000 or EC000 core,
5875 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5876
5877 @item -m68020
5878 @itemx -mc68020
5879 @opindex m68020
5880 @opindex mc68020
5881 Generate output for a 68020.  This is the default
5882 when the compiler is configured for 68020-based systems.
5883
5884 @item -m68881
5885 @opindex m68881
5886 Generate output containing 68881 instructions for floating point.
5887 This is the default for most 68020 systems unless @option{--nfp} was
5888 specified when the compiler was configured.
5889
5890 @item -m68030
5891 @opindex m68030
5892 Generate output for a 68030.  This is the default when the compiler is
5893 configured for 68030-based systems.
5894
5895 @item -m68040
5896 @opindex m68040
5897 Generate output for a 68040.  This is the default when the compiler is
5898 configured for 68040-based systems.
5899
5900 This option inhibits the use of 68881/68882 instructions that have to be
5901 emulated by software on the 68040.  Use this option if your 68040 does not
5902 have code to emulate those instructions.
5903
5904 @item -m68060
5905 @opindex m68060
5906 Generate output for a 68060.  This is the default when the compiler is
5907 configured for 68060-based systems.
5908
5909 This option inhibits the use of 68020 and 68881/68882 instructions that
5910 have to be emulated by software on the 68060.  Use this option if your 68060
5911 does not have code to emulate those instructions.
5912
5913 @item -mcpu32
5914 @opindex mcpu32
5915 Generate output for a CPU32.  This is the default
5916 when the compiler is configured for CPU32-based systems.
5917
5918 Use this option for microcontrollers with a
5919 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5920 68336, 68340, 68341, 68349 and 68360.
5921
5922 @item -m5200
5923 @opindex m5200
5924 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5925 when the compiler is configured for 520X-based systems.
5926
5927 Use this option for microcontroller with a 5200 core, including
5928 the MCF5202, MCF5203, MCF5204 and MCF5202.
5929
5930
5931 @item -m68020-40
5932 @opindex m68020-40
5933 Generate output for a 68040, without using any of the new instructions.
5934 This results in code which can run relatively efficiently on either a
5935 68020/68881 or a 68030 or a 68040.  The generated code does use the
5936 68881 instructions that are emulated on the 68040.
5937
5938 @item -m68020-60
5939 @opindex m68020-60
5940 Generate output for a 68060, 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 68060.
5944
5945 @item -msoft-float
5946 @opindex msoft-float
5947 Generate output containing library calls for floating point.
5948 @strong{Warning:} the requisite libraries are not available for all m68k
5949 targets.  Normally the facilities of the machine's usual C compiler are
5950 used, but this can't be done directly in cross-compilation.  You must
5951 make your own arrangements to provide suitable library functions for
5952 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5953 @samp{m68k-*-coff} do provide software floating point support.
5954
5955 @item -mshort
5956 @opindex mshort
5957 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5958
5959 @item -mnobitfield
5960 @opindex mnobitfield
5961 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5962 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
5963
5964 @item -mbitfield
5965 @opindex mbitfield
5966 Do use the bit-field instructions.  The @option{-m68020} option implies
5967 @option{-mbitfield}.  This is the default if you use a configuration
5968 designed for a 68020.
5969
5970 @item -mrtd
5971 @opindex mrtd
5972 Use a different function-calling convention, in which functions
5973 that take a fixed number of arguments return with the @code{rtd}
5974 instruction, which pops their arguments while returning.  This
5975 saves one instruction in the caller since there is no need to pop
5976 the arguments there.
5977
5978 This calling convention is incompatible with the one normally
5979 used on Unix, so you cannot use it if you need to call libraries
5980 compiled with the Unix compiler.
5981
5982 Also, you must provide function prototypes for all functions that
5983 take variable numbers of arguments (including @code{printf});
5984 otherwise incorrect code will be generated for calls to those
5985 functions.
5986
5987 In addition, seriously incorrect code will result if you call a
5988 function with too many arguments.  (Normally, extra arguments are
5989 harmlessly ignored.)
5990
5991 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
5992 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
5993
5994 @item -malign-int
5995 @itemx -mno-align-int
5996 @opindex malign-int
5997 @opindex mno-align-int
5998 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
5999 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
6000 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
6001 Aligning variables on 32-bit boundaries produces code that runs somewhat
6002 faster on processors with 32-bit busses at the expense of more memory.
6003
6004 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
6005 align structures containing the above types  differently than
6006 most published application binary interface specifications for the m68k.
6007
6008 @item -mpcrel
6009 @opindex mpcrel
6010 Use the pc-relative addressing mode of the 68000 directly, instead of
6011 using a global offset table.  At present, this option implies @option{-fpic},
6012 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
6013 not presently supported with @option{-mpcrel}, though this could be supported for
6014 68020 and higher processors.
6015
6016 @item -mno-strict-align
6017 @itemx -mstrict-align
6018 @opindex mno-strict-align
6019 @opindex mstrict-align
6020 Do not (do) assume that unaligned memory references will be handled by
6021 the system.
6022
6023 @item -msep-data
6024 Generate code that allows the data segment to be located in a different
6025 area of memory from the text segment.  This allows for execute in place in
6026 an environment without virtual memory management.  This option implies -fPIC.
6027
6028 @item -mno-sep-data
6029 Generate code that assumes that the data segment follows the text segment.
6030 This is the default.
6031
6032 @item -mid-shared-library
6033 Generate code that supports shared libraries via the library ID method.
6034 This allows for execute in place and shared libraries in an environment
6035 without virtual memory management.  This option implies -fPIC.
6036
6037 @item -mno-id-shared-library
6038 Generate code that doesn't assume ID based shared libraries are being used.
6039 This is the default.
6040
6041 @item -mshared-library-id=n
6042 Specified the identification number of the ID based shared library being
6043 compiled.  Specifying a value of 0 will generate more compact code, specifying
6044 other values will force the allocation of that number to the current
6045 library but is no more space or time efficient than omitting this option.
6046
6047 @end table
6048
6049 @node M68hc1x Options
6050 @subsection M68hc1x Options
6051 @cindex M68hc1x options
6052
6053 These are the @samp{-m} options defined for the 68hc11 and 68hc12
6054 microcontrollers.  The default values for these options depends on
6055 which style of microcontroller was selected when the compiler was configured;
6056 the defaults for the most common choices are given below.
6057
6058 @table @gcctabopt
6059 @item -m6811
6060 @itemx -m68hc11
6061 @opindex m6811
6062 @opindex m68hc11
6063 Generate output for a 68HC11.  This is the default
6064 when the compiler is configured for 68HC11-based systems.
6065
6066 @item -m6812
6067 @itemx -m68hc12
6068 @opindex m6812
6069 @opindex m68hc12
6070 Generate output for a 68HC12.  This is the default
6071 when the compiler is configured for 68HC12-based systems.
6072
6073 @item -m68S12
6074 @itemx -m68hcs12
6075 @opindex m68S12
6076 @opindex m68hcs12
6077 Generate output for a 68HCS12.
6078
6079 @item -mauto-incdec
6080 @opindex mauto-incdec
6081 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
6082 addressing modes.
6083
6084 @item -minmax
6085 @itemx -nominmax
6086 @opindex minmax
6087 @opindex mnominmax
6088 Enable the use of 68HC12 min and max instructions.
6089
6090 @item -mlong-calls
6091 @itemx -mno-long-calls
6092 @opindex mlong-calls
6093 @opindex mno-long-calls
6094 Treat all calls as being far away (near).  If calls are assumed to be
6095 far away, the compiler will use the @code{call} instruction to
6096 call a function and the @code{rtc} instruction for returning.
6097
6098 @item -mshort
6099 @opindex mshort
6100 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6101
6102 @item -msoft-reg-count=@var{count}
6103 @opindex msoft-reg-count
6104 Specify the number of pseudo-soft registers which are used for the
6105 code generation.  The maximum number is 32.  Using more pseudo-soft
6106 register may or may not result in better code depending on the program.
6107 The default is 4 for 68HC11 and 2 for 68HC12.
6108
6109 @end table
6110
6111 @node VAX Options
6112 @subsection VAX Options
6113 @cindex VAX options
6114
6115 These @samp{-m} options are defined for the VAX:
6116
6117 @table @gcctabopt
6118 @item -munix
6119 @opindex munix
6120 Do not output certain jump instructions (@code{aobleq} and so on)
6121 that the Unix assembler for the VAX cannot handle across long
6122 ranges.
6123
6124 @item -mgnu
6125 @opindex mgnu
6126 Do output those jump instructions, on the assumption that you
6127 will assemble with the GNU assembler.
6128
6129 @item -mg
6130 @opindex mg
6131 Output code for g-format floating point numbers instead of d-format.
6132 @end table
6133
6134 @node SPARC Options
6135 @subsection SPARC Options
6136 @cindex SPARC options
6137
6138 These @samp{-m} options are supported on the SPARC:
6139
6140 @table @gcctabopt
6141 @item -mno-app-regs
6142 @itemx -mapp-regs
6143 @opindex mno-app-regs
6144 @opindex mapp-regs
6145 Specify @option{-mapp-regs} to generate output using the global registers
6146 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
6147 is the default.
6148
6149 To be fully SVR4 ABI compliant at the cost of some performance loss,
6150 specify @option{-mno-app-regs}.  You should compile libraries and system
6151 software with this option.
6152
6153 @item -mfpu
6154 @itemx -mhard-float
6155 @opindex mfpu
6156 @opindex mhard-float
6157 Generate output containing floating point instructions.  This is the
6158 default.
6159
6160 @item -mno-fpu
6161 @itemx -msoft-float
6162 @opindex mno-fpu
6163 @opindex msoft-float
6164 Generate output containing library calls for floating point.
6165 @strong{Warning:} the requisite libraries are not available for all SPARC
6166 targets.  Normally the facilities of the machine's usual C compiler are
6167 used, but this cannot be done directly in cross-compilation.  You must make
6168 your own arrangements to provide suitable library functions for
6169 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
6170 @samp{sparclite-*-*} do provide software floating point support.
6171
6172 @option{-msoft-float} changes the calling convention in the output file;
6173 therefore, it is only useful if you compile @emph{all} of a program with
6174 this option.  In particular, you need to compile @file{libgcc.a}, the
6175 library that comes with GCC, with @option{-msoft-float} in order for
6176 this to work.
6177
6178 @item -mhard-quad-float
6179 @opindex mhard-quad-float
6180 Generate output containing quad-word (long double) floating point
6181 instructions.
6182
6183 @item -msoft-quad-float
6184 @opindex msoft-quad-float
6185 Generate output containing library calls for quad-word (long double)
6186 floating point instructions.  The functions called are those specified
6187 in the SPARC ABI@.  This is the default.
6188
6189 As of this writing, there are no SPARC implementations that have hardware
6190 support for the quad-word floating point instructions.  They all invoke
6191 a trap handler for one of these instructions, and then the trap handler
6192 emulates the effect of the instruction.  Because of the trap handler overhead,
6193 this is much slower than calling the ABI library routines.  Thus the
6194 @option{-msoft-quad-float} option is the default.
6195
6196 @item -mno-unaligned-doubles
6197 @itemx -munaligned-doubles
6198 @opindex mno-unaligned-doubles
6199 @opindex munaligned-doubles
6200 Assume that doubles have 8 byte alignment.  This is the default.
6201
6202 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
6203 alignment only if they are contained in another type, or if they have an
6204 absolute address.  Otherwise, it assumes they have 4 byte alignment.
6205 Specifying this option avoids some rare compatibility problems with code
6206 generated by other compilers.  It is not the default because it results
6207 in a performance loss, especially for floating point code.
6208
6209 @item -mno-faster-structs
6210 @itemx -mfaster-structs
6211 @opindex mno-faster-structs
6212 @opindex mfaster-structs
6213 With @option{-mfaster-structs}, the compiler assumes that structures
6214 should have 8 byte alignment.  This enables the use of pairs of
6215 @code{ldd} and @code{std} instructions for copies in structure
6216 assignment, in place of twice as many @code{ld} and @code{st} pairs.
6217 However, the use of this changed alignment directly violates the SPARC
6218 ABI@.  Thus, it's intended only for use on targets where the developer
6219 acknowledges that their resulting code will not be directly in line with
6220 the rules of the ABI@.
6221
6222 @item -mimpure-text
6223 @opindex mimpure-text
6224 @option{-mimpure-text}, used in addition to @option{-shared}, tells
6225 the compiler to not pass @option{-z text} to the linker when linking a
6226 shared object.  Using this option, you can link position-dependent
6227 code into a shared object.
6228
6229 @option{-mimpure-text} suppresses the ``relocations remain against
6230 allocatable but non-writable sections'' linker error message.
6231 However, the necessary relocations will trigger copy-on-write, and the
6232 shared object is not actually shared across processes.  Instead of
6233 using @option{-mimpure-text}, you should compile all source code with
6234 @option{-fpic} or @option{-fPIC}.
6235
6236 This option is only available on SunOS and Solaris.
6237
6238 @item -mcpu=@var{cpu_type}
6239 @opindex mcpu
6240 Set the instruction set, register set, and instruction scheduling parameters
6241 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
6242 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
6243 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
6244 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
6245 @samp{ultrasparc3}.
6246
6247 Default instruction scheduling parameters are used for values that select
6248 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
6249 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
6250
6251 Here is a list of each supported architecture and their supported
6252 implementations.
6253
6254 @smallexample
6255     v7:             cypress
6256     v8:             supersparc, hypersparc
6257     sparclite:      f930, f934, sparclite86x
6258     sparclet:       tsc701
6259     v9:             ultrasparc, ultrasparc3
6260 @end smallexample
6261
6262 By default (unless configured otherwise), GCC generates code for the V7
6263 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
6264 additionally optimizes it for the Cypress CY7C602 chip, as used in the
6265 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
6266 SPARCStation 1, 2, IPX etc.
6267
6268 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
6269 architecture.  The only difference from V7 code is that the compiler emits
6270 the integer multiply and integer divide instructions which exist in SPARC-V8
6271 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
6272 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
6273 2000 series.
6274
6275 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
6276 the SPARC architecture.  This adds the integer multiply, integer divide step
6277 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
6278 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
6279 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU.  With
6280 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
6281 MB86934 chip, which is the more recent SPARClite with FPU.
6282
6283 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
6284 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
6285 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
6286 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
6287 optimizes it for the TEMIC SPARClet chip.
6288
6289 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
6290 architecture.  This adds 64-bit integer and floating-point move instructions,
6291 3 additional floating-point condition code registers and conditional move
6292 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
6293 optimizes it for the Sun UltraSPARC I/II chips.  With
6294 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
6295 Sun UltraSPARC III chip.
6296
6297 @item -mtune=@var{cpu_type}
6298 @opindex mtune
6299 Set the instruction scheduling parameters for machine type
6300 @var{cpu_type}, but do not set the instruction set or register set that the
6301 option @option{-mcpu=@var{cpu_type}} would.
6302
6303 The same values for @option{-mcpu=@var{cpu_type}} can be used for
6304 @option{-mtune=@var{cpu_type}}, but the only useful values are those
6305 that select a particular cpu implementation.  Those are @samp{cypress},
6306 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
6307 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
6308 @samp{ultrasparc3}.
6309
6310 @item -mv8plus
6311 @itemx -mno-v8plus
6312 @opindex -mv8plus
6313 @opindex -mno-v8plus
6314 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI.  The
6315 difference from the V8 ABI is that the global and out registers are
6316 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
6317 mode for all SPARC-V9 processors.
6318
6319 @item -mvis
6320 @itemx -mno-vis
6321 @opindex -mvis
6322 @opindex -mno-vis
6323 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
6324 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
6325 @end table
6326
6327 These @samp{-m} options are supported in addition to the above
6328 on SPARC-V9 processors in 64-bit environments:
6329
6330 @table @gcctabopt
6331 @item -mlittle-endian
6332 @opindex mlittle-endian
6333 Generate code for a processor running in little-endian mode. It is only
6334 available for a few configurations and most notably not on Solaris.
6335
6336 @item -m32
6337 @itemx -m64
6338 @opindex m32
6339 @opindex m64
6340 Generate code for a 32-bit or 64-bit environment.
6341 The 32-bit environment sets int, long and pointer to 32 bits.
6342 The 64-bit environment sets int to 32 bits and long and pointer
6343 to 64 bits.
6344
6345 @item -mcmodel=medlow
6346 @opindex mcmodel=medlow
6347 Generate code for the Medium/Low code model: the program must be linked
6348 in the low 32 bits of the address space.  Pointers are 64 bits.
6349 Programs can be statically or dynamically linked.
6350
6351 @item -mcmodel=medmid
6352 @opindex mcmodel=medmid
6353 Generate code for the Medium/Middle code model: the program must be linked
6354 in the low 44 bits of the address space, the text segment must be less than
6355 2G bytes, and data segment must be within 2G of the text segment.
6356 Pointers are 64 bits.
6357
6358 @item -mcmodel=medany
6359 @opindex mcmodel=medany
6360 Generate code for the Medium/Anywhere code model: the program may be linked
6361 anywhere in 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=embmedany
6366 @opindex mcmodel=embmedany
6367 Generate code for the Medium/Anywhere code model for embedded systems:
6368 assume a 32-bit text and a 32-bit data segment, both starting anywhere
6369 (determined at link time).  Register %g4 points to the base of the
6370 data segment.  Pointers are still 64 bits.
6371 Programs are statically linked, PIC is not supported.
6372
6373 @item -mstack-bias
6374 @itemx -mno-stack-bias
6375 @opindex mstack-bias
6376 @opindex mno-stack-bias
6377 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
6378 frame pointer if present, are offset by @minus{}2047 which must be added back
6379 when making stack frame references.  This is the default in 64-bit mode.
6380 Otherwise, assume no such offset is present.
6381 @end table
6382
6383 @node ARM Options
6384 @subsection ARM Options
6385 @cindex ARM options
6386
6387 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6388 architectures:
6389
6390 @table @gcctabopt
6391 @item -mapcs-frame
6392 @opindex mapcs-frame
6393 Generate a stack frame that is compliant with the ARM Procedure Call
6394 Standard for all functions, even if this is not strictly necessary for
6395 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
6396 with this option will cause the stack frames not to be generated for
6397 leaf functions.  The default is @option{-mno-apcs-frame}.
6398
6399 @item -mapcs
6400 @opindex mapcs
6401 This is a synonym for @option{-mapcs-frame}.
6402
6403 @item -mapcs-26
6404 @opindex mapcs-26
6405 Generate code for a processor running with a 26-bit program counter,
6406 and conforming to the function calling standards for the APCS 26-bit
6407 option.  This option replaces the @option{-m2} and @option{-m3} options
6408 of previous releases of the compiler.
6409
6410 @item -mapcs-32
6411 @opindex mapcs-32
6412 Generate code for a processor running with a 32-bit program counter,
6413 and conforming to the function calling standards for the APCS 32-bit
6414 option.  This option replaces the @option{-m6} option of previous releases
6415 of the compiler.
6416
6417 @ignore
6418 @c not currently implemented
6419 @item -mapcs-stack-check
6420 @opindex mapcs-stack-check
6421 Generate code to check the amount of stack space available upon entry to
6422 every function (that actually uses some stack space).  If there is
6423 insufficient space available then either the function
6424 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6425 called, depending upon the amount of stack space required.  The run time
6426 system is required to provide these functions.  The default is
6427 @option{-mno-apcs-stack-check}, since this produces smaller code.
6428
6429 @c not currently implemented
6430 @item -mapcs-float
6431 @opindex mapcs-float
6432 Pass floating point arguments using the float point registers.  This is
6433 one of the variants of the APCS@.  This option is recommended if the
6434 target hardware has a floating point unit or if a lot of floating point
6435 arithmetic is going to be performed by the code.  The default is
6436 @option{-mno-apcs-float}, since integer only code is slightly increased in
6437 size if @option{-mapcs-float} is used.
6438
6439 @c not currently implemented
6440 @item -mapcs-reentrant
6441 @opindex mapcs-reentrant
6442 Generate reentrant, position independent code.  The default is
6443 @option{-mno-apcs-reentrant}.
6444 @end ignore
6445
6446 @item -mthumb-interwork
6447 @opindex mthumb-interwork
6448 Generate code which supports calling between the ARM and Thumb
6449 instruction sets.  Without this option the two instruction sets cannot
6450 be reliably used inside one program.  The default is
6451 @option{-mno-thumb-interwork}, since slightly larger code is generated
6452 when @option{-mthumb-interwork} is specified.
6453
6454 @item -mno-sched-prolog
6455 @opindex mno-sched-prolog
6456 Prevent the reordering of instructions in the function prolog, or the
6457 merging of those instruction with the instructions in the function's
6458 body.  This means that all functions will start with a recognizable set
6459 of instructions (or in fact one of a choice from a small set of
6460 different function prologues), and this information can be used to
6461 locate the start if functions inside an executable piece of code.  The
6462 default is @option{-msched-prolog}.
6463
6464 @item -mhard-float
6465 @opindex mhard-float
6466 Generate output containing floating point instructions.  This is the
6467 default.
6468
6469 @item -msoft-float
6470 @opindex msoft-float
6471 Generate output containing library calls for floating point.
6472 @strong{Warning:} the requisite libraries are not available for all ARM
6473 targets.  Normally the facilities of the machine's usual C compiler are
6474 used, but this cannot be done directly in cross-compilation.  You must make
6475 your own arrangements to provide suitable library functions for
6476 cross-compilation.
6477
6478 @option{-msoft-float} changes the calling convention in the output file;
6479 therefore, it is only useful if you compile @emph{all} of a program with
6480 this option.  In particular, you need to compile @file{libgcc.a}, the
6481 library that comes with GCC, with @option{-msoft-float} in order for
6482 this to work.
6483
6484 @item -mfloat-abi=@var{name}
6485 @opindex mfloat-abi
6486 Specifies which ABI to use for floating point values.  Permissible values
6487 are: @samp{soft}, @samp{softfp} and @samp{hard}.
6488
6489 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
6490 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
6491 of floating point instructions, but still uses the soft-float calling
6492 conventions.
6493
6494 @item -mlittle-endian
6495 @opindex mlittle-endian
6496 Generate code for a processor running in little-endian mode.  This is
6497 the default for all standard configurations.
6498
6499 @item -mbig-endian
6500 @opindex mbig-endian
6501 Generate code for a processor running in big-endian mode; the default is
6502 to compile code for a little-endian processor.
6503
6504 @item -mwords-little-endian
6505 @opindex mwords-little-endian
6506 This option only applies when generating code for big-endian processors.
6507 Generate code for a little-endian word order but a big-endian byte
6508 order.  That is, a byte order of the form @samp{32107654}.  Note: this
6509 option should only be used if you require compatibility with code for
6510 big-endian ARM processors generated by versions of the compiler prior to
6511 2.8.
6512
6513 @item -malignment-traps
6514 @opindex malignment-traps
6515 Generate code that will not trap if the MMU has alignment traps enabled.
6516 On ARM architectures prior to ARMv4, there were no instructions to
6517 access half-word objects stored in memory.  However, when reading from
6518 memory a feature of the ARM architecture allows a word load to be used,
6519 even if the address is unaligned, and the processor core will rotate the
6520 data as it is being loaded.  This option tells the compiler that such
6521 misaligned accesses will cause a MMU trap and that it should instead
6522 synthesize the access as a series of byte accesses.  The compiler can
6523 still use word accesses to load half-word data if it knows that the
6524 address is aligned to a word boundary.
6525
6526 This option is ignored when compiling for ARM architecture 4 or later,
6527 since these processors have instructions to directly access half-word
6528 objects in memory.
6529
6530 @item -mno-alignment-traps
6531 @opindex mno-alignment-traps
6532 Generate code that assumes that the MMU will not trap unaligned
6533 accesses.  This produces better code when the target instruction set
6534 does not have half-word memory operations (i.e.@: implementations prior to
6535 ARMv4).
6536
6537 Note that you cannot use this option to access unaligned word objects,
6538 since the processor will only fetch one 32-bit aligned object from
6539 memory.
6540
6541 The default setting for most targets is @option{-mno-alignment-traps}, since
6542 this produces better code when there are no half-word memory
6543 instructions available.
6544
6545 @item -mshort-load-bytes
6546 @itemx -mno-short-load-words
6547 @opindex mshort-load-bytes
6548 @opindex mno-short-load-words
6549 These are deprecated aliases for @option{-malignment-traps}.
6550
6551 @item -mno-short-load-bytes
6552 @itemx -mshort-load-words
6553 @opindex mno-short-load-bytes
6554 @opindex mshort-load-words
6555 This are deprecated aliases for @option{-mno-alignment-traps}.
6556
6557 @item -mcpu=@var{name}
6558 @opindex mcpu
6559 This specifies the name of the target ARM processor.  GCC uses this name
6560 to determine what kind of instructions it can emit when generating
6561 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6562 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6563 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6564 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6565 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6566 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6567 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6568 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6569 @samp{arm920t}, @samp{arm926ejs}, @samp{arm940t}, @samp{arm9tdmi},
6570 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ejs},
6571 @samp{arm1136js}, @samp{arm1136jfs} ,@samp{xscale}, @samp{iwmmxt},
6572 @samp{ep9312}.
6573
6574 @itemx -mtune=@var{name}
6575 @opindex mtune
6576 This option is very similar to the @option{-mcpu=} option, except that
6577 instead of specifying the actual target processor type, and hence
6578 restricting which instructions can be used, it specifies that GCC should
6579 tune the performance of the code as if the target were of the type
6580 specified in this option, but still choosing the instructions that it
6581 will generate based on the cpu specified by a @option{-mcpu=} option.
6582 For some ARM implementations better performance can be obtained by using
6583 this option.
6584
6585 @item -march=@var{name}
6586 @opindex march
6587 This specifies the name of the target ARM architecture.  GCC uses this
6588 name to determine what kind of instructions it can emit when generating
6589 assembly code.  This option can be used in conjunction with or instead
6590 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6591 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6592 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
6593 @samp{iwmmxt}, @samp{ep9312}.
6594
6595 @item -mfpu=@var{name}
6596 @itemx -mfpe=@var{number}
6597 @itemx -mfp=@var{number}
6598 @opindex mfpu
6599 @opindex mfpe
6600 @opindex mfp
6601 This specifies what floating point hardware (or hardware emulation) is
6602 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
6603 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
6604 are synonyms for @option{-mpfu}=@samp{fpe}@var{number}, for compatibility
6605 with older versions of GCC@.
6606
6607 If @option{-msoft-float} is specified this specifies the format of
6608 floating point values.
6609
6610 @item -mstructure-size-boundary=@var{n}
6611 @opindex mstructure-size-boundary
6612 The size of all structures and unions will be rounded up to a multiple
6613 of the number of bits set by this option.  Permissible values are 8 and
6614 32.  The default value varies for different toolchains.  For the COFF
6615 targeted toolchain the default value is 8.  Specifying the larger number
6616 can produce faster, more efficient code, but can also increase the size
6617 of the program.  The two values are potentially incompatible.  Code
6618 compiled with one value cannot necessarily expect to work with code or
6619 libraries compiled with the other value, if they exchange information
6620 using structures or unions.
6621
6622 @item -mabort-on-noreturn
6623 @opindex mabort-on-noreturn
6624 Generate a call to the function @code{abort} at the end of a
6625 @code{noreturn} function.  It will be executed if the function tries to
6626 return.
6627
6628 @item -mlong-calls
6629 @itemx -mno-long-calls
6630 @opindex mlong-calls
6631 @opindex mno-long-calls
6632 Tells the compiler to perform function calls by first loading the
6633 address of the function into a register and then performing a subroutine
6634 call on this register.  This switch is needed if the target function
6635 will lie outside of the 64 megabyte addressing range of the offset based
6636 version of subroutine call instruction.
6637
6638 Even if this switch is enabled, not all function calls will be turned
6639 into long calls.  The heuristic is that static functions, functions
6640 which have the @samp{short-call} attribute, functions that are inside
6641 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6642 definitions have already been compiled within the current compilation
6643 unit, will not be turned into long calls.  The exception to this rule is
6644 that weak function definitions, functions with the @samp{long-call}
6645 attribute or the @samp{section} attribute, and functions that are within
6646 the scope of a @samp{#pragma long_calls} directive, will always be
6647 turned into long calls.
6648
6649 This feature is not enabled by default.  Specifying
6650 @option{-mno-long-calls} will restore the default behavior, as will
6651 placing the function calls within the scope of a @samp{#pragma
6652 long_calls_off} directive.  Note these switches have no effect on how
6653 the compiler generates code to handle function calls via function
6654 pointers.
6655
6656 @item -mnop-fun-dllimport
6657 @opindex mnop-fun-dllimport
6658 Disable support for the @code{dllimport} attribute.
6659
6660 @item -msingle-pic-base
6661 @opindex msingle-pic-base
6662 Treat the register used for PIC addressing as read-only, rather than
6663 loading it in the prologue for each function.  The run-time system is
6664 responsible for initializing this register with an appropriate value
6665 before execution begins.
6666
6667 @item -mpic-register=@var{reg}
6668 @opindex mpic-register
6669 Specify the register to be used for PIC addressing.  The default is R10
6670 unless stack-checking is enabled, when R9 is used.
6671
6672 @item -mcirrus-fix-invalid-insns
6673 @opindex mcirrus-fix-invalid-insns
6674 @opindex mno-cirrus-fix-invalid-insns
6675 Insert NOPs into the instruction stream to in order to work around
6676 problems with invalid Maverick instruction combinations.  This option
6677 is only valid if the @option{-mcpu=ep9312} option has been used to
6678 enable generation of instructions for the Cirrus Maverick floating
6679 point co-processor.  This option is not enabled by default, since the
6680 problem is only present in older Maverick implementations.  The default
6681 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
6682 switch.
6683
6684 @item -mpoke-function-name
6685 @opindex mpoke-function-name
6686 Write the name of each function into the text section, directly
6687 preceding the function prologue.  The generated code is similar to this:
6688
6689 @smallexample
6690      t0
6691          .ascii "arm_poke_function_name", 0
6692          .align
6693      t1
6694          .word 0xff000000 + (t1 - t0)
6695      arm_poke_function_name
6696          mov     ip, sp
6697          stmfd   sp!, @{fp, ip, lr, pc@}
6698          sub     fp, ip, #4
6699 @end smallexample
6700
6701 When performing a stack backtrace, code can inspect the value of
6702 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6703 location @code{pc - 12} and the top 8 bits are set, then we know that
6704 there is a function name embedded immediately preceding this location
6705 and has length @code{((pc[-3]) & 0xff000000)}.
6706
6707 @item -mthumb
6708 @opindex mthumb
6709 Generate code for the 16-bit Thumb instruction set.  The default is to
6710 use the 32-bit ARM instruction set.
6711
6712 @item -mtpcs-frame
6713 @opindex mtpcs-frame
6714 Generate a stack frame that is compliant with the Thumb Procedure Call
6715 Standard for all non-leaf functions.  (A leaf function is one that does
6716 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6717
6718 @item -mtpcs-leaf-frame
6719 @opindex mtpcs-leaf-frame
6720 Generate a stack frame that is compliant with the Thumb Procedure Call
6721 Standard for all leaf functions.  (A leaf function is one that does
6722 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6723
6724 @item -mcallee-super-interworking
6725 @opindex mcallee-super-interworking
6726 Gives all externally visible functions in the file being compiled an ARM
6727 instruction set header which switches to Thumb mode before executing the
6728 rest of the function.  This allows these functions to be called from
6729 non-interworking code.
6730
6731 @item -mcaller-super-interworking
6732 @opindex mcaller-super-interworking
6733 Allows calls via function pointers (including virtual functions) to
6734 execute correctly regardless of whether the target code has been
6735 compiled for interworking or not.  There is a small overhead in the cost
6736 of executing a function pointer if this option is enabled.
6737
6738 @end table
6739
6740 @node MN10300 Options
6741 @subsection MN10300 Options
6742 @cindex MN10300 options
6743
6744 These @option{-m} options are defined for Matsushita MN10300 architectures:
6745
6746 @table @gcctabopt
6747 @item -mmult-bug
6748 @opindex mmult-bug
6749 Generate code to avoid bugs in the multiply instructions for the MN10300
6750 processors.  This is the default.
6751
6752 @item -mno-mult-bug
6753 @opindex mno-mult-bug
6754 Do not generate code to avoid bugs in the multiply instructions for the
6755 MN10300 processors.
6756
6757 @item -mam33
6758 @opindex mam33
6759 Generate code which uses features specific to the AM33 processor.
6760
6761 @item -mno-am33
6762 @opindex mno-am33
6763 Do not generate code which uses features specific to the AM33 processor.  This
6764 is the default.
6765
6766 @item -mno-crt0
6767 @opindex mno-crt0
6768 Do not link in the C run-time initialization object file.
6769
6770 @item -mrelax
6771 @opindex mrelax
6772 Indicate to the linker that it should perform a relaxation optimization pass
6773 to shorten branches, calls and absolute memory addresses.  This option only
6774 has an effect when used on the command line for the final link step.
6775
6776 This option makes symbolic debugging impossible.
6777 @end table
6778
6779
6780 @node M32R/D Options
6781 @subsection M32R/D Options
6782 @cindex M32R/D options
6783
6784 These @option{-m} options are defined for Renesas M32R/D architectures:
6785
6786 @table @gcctabopt
6787 @item -m32r2
6788 @opindex m32r2
6789 Generate code for the M32R/2@.
6790
6791 @item -m32rx
6792 @opindex m32rx
6793 Generate code for the M32R/X@.
6794
6795 @item -m32r
6796 @opindex m32r
6797 Generate code for the M32R@.  This is the default.
6798
6799 @item -mmodel=small
6800 @opindex mmodel=small
6801 Assume all objects live in the lower 16MB of memory (so that their addresses
6802 can be loaded with the @code{ld24} instruction), and assume all subroutines
6803 are reachable with the @code{bl} instruction.
6804 This is the default.
6805
6806 The addressability of a particular object can be set with the
6807 @code{model} attribute.
6808
6809 @item -mmodel=medium
6810 @opindex mmodel=medium
6811 Assume objects may be anywhere in the 32-bit address space (the compiler
6812 will generate @code{seth/add3} instructions to load their addresses), and
6813 assume all subroutines are reachable with the @code{bl} instruction.
6814
6815 @item -mmodel=large
6816 @opindex mmodel=large
6817 Assume objects may be anywhere in the 32-bit address space (the compiler
6818 will generate @code{seth/add3} instructions to load their addresses), and
6819 assume subroutines may not be reachable with the @code{bl} instruction
6820 (the compiler will generate the much slower @code{seth/add3/jl}
6821 instruction sequence).
6822
6823 @item -msdata=none
6824 @opindex msdata=none
6825 Disable use of the small data area.  Variables will be put into
6826 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6827 @code{section} attribute has been specified).
6828 This is the default.
6829
6830 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6831 Objects may be explicitly put in the small data area with the
6832 @code{section} attribute using one of these sections.
6833
6834 @item -msdata=sdata
6835 @opindex msdata=sdata
6836 Put small global and static data in the small data area, but do not
6837 generate special code to reference them.
6838
6839 @item -msdata=use
6840 @opindex msdata=use
6841 Put small global and static data in the small data area, and generate
6842 special instructions to reference them.
6843
6844 @item -G @var{num}
6845 @opindex G
6846 @cindex smaller data references
6847 Put global and static objects less than or equal to @var{num} bytes
6848 into the small data or bss sections instead of the normal data or bss
6849 sections.  The default value of @var{num} is 8.
6850 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6851 for this option to have any effect.
6852
6853 All modules should be compiled with the same @option{-G @var{num}} value.
6854 Compiling with different values of @var{num} may or may not work; if it
6855 doesn't the linker will give an error message---incorrect code will not be
6856 generated.
6857
6858 @item -mdebug
6859 @opindex -mdebug
6860 Makes the M32R specific code in the compiler display some statistics
6861 that might help in debugging programs.
6862
6863 @item -malign-loops
6864 @opindex malign-loops
6865 Align all loops to a 32-byte boundary.
6866
6867 @item -mno-align-loops
6868 @opindex mno-align-loops
6869 Do not enforce a 32-byte alignment for loops.  This is the default.
6870
6871 @item -missue-rate=@var{number}
6872 @opindex missue-rate=@var{number}
6873 Issue @var{number} instructions per cycle.  @var{number} can only be 1
6874 or 2.
6875
6876 @item -mbranch-cost=@var{number}
6877 @opindex mbranch-cost=@var{number}
6878 @var{number} can only be 1 or 2.  If it is 1 then branches will be
6879 preferred over conditional code, if it is 2, then the opposite will
6880 apply.
6881
6882 @item -mflush-trap=@var{number}
6883 @opindex mflush-trap=@var{number}
6884 Specifies the trap number to use to flush the cache.  The default is
6885 12.  Valid numbers are between 0 and 15 inclusive.
6886
6887 @item -mno-flush-trap
6888 @opindex mno-flush-trap
6889 Specifies that the cache cannot be flushed by using a trap.
6890
6891 @item -mflush-func=@var{name}
6892 @opindex mflush-func=@var{name}
6893 Specifies the name of the operating system function to call to flush
6894 the cache.  The default is @emph{_flush_cache}, but a function call
6895 will only be used if a trap is not available.
6896
6897 @item -mno-flush-func
6898 @opindex mno-flush-func
6899 Indicates that there is no OS function for flushing the cache.
6900
6901 @end table
6902
6903 @node RS/6000 and PowerPC Options
6904 @subsection IBM RS/6000 and PowerPC Options
6905 @cindex RS/6000 and PowerPC Options
6906 @cindex IBM RS/6000 and PowerPC Options
6907
6908 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6909 @table @gcctabopt
6910 @item -mpower
6911 @itemx -mno-power
6912 @itemx -mpower2
6913 @itemx -mno-power2
6914 @itemx -mpowerpc
6915 @itemx -mno-powerpc
6916 @itemx -mpowerpc-gpopt
6917 @itemx -mno-powerpc-gpopt
6918 @itemx -mpowerpc-gfxopt
6919 @itemx -mno-powerpc-gfxopt
6920 @itemx -mpowerpc64
6921 @itemx -mno-powerpc64
6922 @opindex mpower
6923 @opindex mno-power
6924 @opindex mpower2
6925 @opindex mno-power2
6926 @opindex mpowerpc
6927 @opindex mno-powerpc
6928 @opindex mpowerpc-gpopt
6929 @opindex mno-powerpc-gpopt
6930 @opindex mpowerpc-gfxopt
6931 @opindex mno-powerpc-gfxopt
6932 @opindex mpowerpc64
6933 @opindex mno-powerpc64
6934 GCC supports two related instruction set architectures for the
6935 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
6936 instructions supported by the @samp{rios} chip set used in the original
6937 RS/6000 systems and the @dfn{PowerPC} instruction set is the
6938 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
6939 the IBM 4xx microprocessors.
6940
6941 Neither architecture is a subset of the other.  However there is a
6942 large common subset of instructions supported by both.  An MQ
6943 register is included in processors supporting the POWER architecture.
6944
6945 You use these options to specify which instructions are available on the
6946 processor you are using.  The default value of these options is
6947 determined when configuring GCC@.  Specifying the
6948 @option{-mcpu=@var{cpu_type}} overrides the specification of these
6949 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
6950 rather than the options listed above.
6951
6952 The @option{-mpower} option allows GCC to generate instructions that
6953 are found only in the POWER architecture and to use the MQ register.
6954 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
6955 to generate instructions that are present in the POWER2 architecture but
6956 not the original POWER architecture.
6957
6958 The @option{-mpowerpc} option allows GCC to generate instructions that
6959 are found only in the 32-bit subset of the PowerPC architecture.
6960 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
6961 GCC to use the optional PowerPC architecture instructions in the
6962 General Purpose group, including floating-point square root.  Specifying
6963 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
6964 use the optional PowerPC architecture instructions in the Graphics
6965 group, including floating-point select.
6966
6967 The @option{-mpowerpc64} option allows GCC to generate the additional
6968 64-bit instructions that are found in the full PowerPC64 architecture
6969 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
6970 @option{-mno-powerpc64}.
6971
6972 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
6973 will use only the instructions in the common subset of both
6974 architectures plus some special AIX common-mode calls, and will not use
6975 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
6976 permits GCC to use any instruction from either architecture and to
6977 allow use of the MQ register; specify this for the Motorola MPC601.
6978
6979 @item -mnew-mnemonics
6980 @itemx -mold-mnemonics
6981 @opindex mnew-mnemonics
6982 @opindex mold-mnemonics
6983 Select which mnemonics to use in the generated assembler code.  With
6984 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
6985 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
6986 assembler mnemonics defined for the POWER architecture.  Instructions
6987 defined in only one architecture have only one mnemonic; GCC uses that
6988 mnemonic irrespective of which of these options is specified.
6989
6990 GCC defaults to the mnemonics appropriate for the architecture in
6991 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
6992 value of these option.  Unless you are building a cross-compiler, you
6993 should normally not specify either @option{-mnew-mnemonics} or
6994 @option{-mold-mnemonics}, but should instead accept the default.
6995
6996 @item -mcpu=@var{cpu_type}
6997 @opindex mcpu
6998 Set architecture type, register usage, choice of mnemonics, and
6999 instruction scheduling parameters for machine type @var{cpu_type}.
7000 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
7001 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
7002 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
7003 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
7004 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
7005 @samp{860}, @samp{970}, @samp{common}, @samp{ec603e}, @samp{G3},
7006 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
7007 @samp{power4}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
7008 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64a}.
7009
7010 @option{-mcpu=common} selects a completely generic processor.  Code
7011 generated under this option will run on any POWER or PowerPC processor.
7012 GCC will use only the instructions in the common subset of both
7013 architectures, and will not use the MQ register.  GCC assumes a generic
7014 processor model for scheduling purposes.
7015
7016 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
7017 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
7018 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
7019 types, with an appropriate, generic processor model assumed for
7020 scheduling purposes.
7021
7022 The other options specify a specific processor.  Code generated under
7023 those options will run best on that processor, and may not run at all on
7024 others.
7025
7026 The @option{-mcpu} options automatically enable or disable the
7027 following options: @option{-maltivec}, @option{-mhard-float},
7028 @option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
7029 @option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
7030 @option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
7031 @option{-mstring}.  The particular options set for any particular CPU
7032 will vary between compiler versions, depending on what setting seems
7033 to produce optimal code for that CPU; it doesn't necessarily reflect
7034 the actual hardware's capabilities.  If you wish to set an individual
7035 option to a particular value, you may specify it after the
7036 @option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
7037
7038 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
7039 not enabled or disabled by the @option{-mcpu} option at present, since
7040 AIX does not have full support for these options.  You may still
7041 enable or disable them individually if you're sure it'll work in your
7042 environment.
7043
7044 @item -mtune=@var{cpu_type}
7045 @opindex mtune
7046 Set the instruction scheduling parameters for machine type
7047 @var{cpu_type}, but do not set the architecture type, register usage, or
7048 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
7049 values for @var{cpu_type} are used for @option{-mtune} as for
7050 @option{-mcpu}.  If both are specified, the code generated will use the
7051 architecture, registers, and mnemonics set by @option{-mcpu}, but the
7052 scheduling parameters set by @option{-mtune}.
7053
7054 @item -maltivec
7055 @itemx -mno-altivec
7056 @opindex maltivec
7057 @opindex mno-altivec
7058 These switches enable or disable the use of built-in functions that
7059 allow access to the AltiVec instruction set.  You may also need to set
7060 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
7061 enhancements.
7062
7063 @item -mabi=spe
7064 @opindex mabi=spe
7065 Extend the current ABI with SPE ABI extensions.  This does not change
7066 the default ABI, instead it adds the SPE ABI extensions to the current
7067 ABI@.
7068
7069 @item -mabi=no-spe
7070 @opindex mabi=no-spe
7071 Disable Booke SPE ABI extensions for the current ABI.
7072
7073 @item -misel=@var{yes/no}
7074 @itemx -misel
7075 @opindex misel
7076 This switch enables or disables the generation of ISEL instructions.
7077
7078 @item -mspe=@var{yes/no}
7079 @itemx -mspe
7080 @opindex mspe
7081 This switch enables or disables the generation of SPE simd
7082 instructions.
7083
7084 @item -mfloat-gprs=@var{yes/no}
7085 @itemx -mfloat-gprs
7086 @opindex mfloat-gprs
7087 This switch enables or disables the generation of floating point
7088 operations on the general purpose registers for architectures that
7089 support it.  This option is currently only available on the MPC8540.
7090
7091 @item -mfull-toc
7092 @itemx -mno-fp-in-toc
7093 @itemx -mno-sum-in-toc
7094 @itemx -mminimal-toc
7095 @opindex mfull-toc
7096 @opindex mno-fp-in-toc
7097 @opindex mno-sum-in-toc
7098 @opindex mminimal-toc
7099 Modify generation of the TOC (Table Of Contents), which is created for
7100 every executable file.  The @option{-mfull-toc} option is selected by
7101 default.  In that case, GCC will allocate at least one TOC entry for
7102 each unique non-automatic variable reference in your program.  GCC
7103 will also place floating-point constants in the TOC@.  However, only
7104 16,384 entries are available in the TOC@.
7105
7106 If you receive a linker error message that saying you have overflowed
7107 the available TOC space, you can reduce the amount of TOC space used
7108 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
7109 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
7110 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
7111 generate code to calculate the sum of an address and a constant at
7112 run-time instead of putting that sum into the TOC@.  You may specify one
7113 or both of these options.  Each causes GCC to produce very slightly
7114 slower and larger code at the expense of conserving TOC space.
7115
7116 If you still run out of space in the TOC even when you specify both of
7117 these options, specify @option{-mminimal-toc} instead.  This option causes
7118 GCC to make only one TOC entry for every file.  When you specify this
7119 option, GCC will produce code that is slower and larger but which
7120 uses extremely little TOC space.  You may wish to use this option
7121 only on files that contain less frequently executed code.
7122
7123 @item -maix64
7124 @itemx -maix32
7125 @opindex maix64
7126 @opindex maix32
7127 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7128 @code{long} type, and the infrastructure needed to support them.
7129 Specifying @option{-maix64} implies @option{-mpowerpc64} and
7130 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
7131 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
7132
7133 @item -mxl-call
7134 @itemx -mno-xl-call
7135 @opindex mxl-call
7136 @opindex mno-xl-call
7137 On AIX, pass floating-point arguments to prototyped functions beyond the
7138 register save area (RSA) on the stack in addition to argument FPRs.  The
7139 AIX calling convention was extended but not initially documented to
7140 handle an obscure K&R C case of calling a function that takes the
7141 address of its arguments with fewer arguments than declared.  AIX XL
7142 compilers access floating point arguments which do not fit in the
7143 RSA from the stack when a subroutine is compiled without
7144 optimization.  Because always storing floating-point arguments on the
7145 stack is inefficient and rarely needed, this option is not enabled by
7146 default and only is necessary when calling subroutines compiled by AIX
7147 XL compilers without optimization.
7148
7149 @item -mpe
7150 @opindex mpe
7151 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
7152 application written to use message passing with special startup code to
7153 enable the application to run.  The system must have PE installed in the
7154 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
7155 must be overridden with the @option{-specs=} option to specify the
7156 appropriate directory location.  The Parallel Environment does not
7157 support threads, so the @option{-mpe} option and the @option{-pthread}
7158 option are incompatible.
7159
7160 @item -malign-natural
7161 @itemx -malign-power
7162 @opindex malign-natural
7163 @opindex malign-power
7164 On AIX, Darwin, and 64-bit PowerPC GNU/Linux, the option
7165 @option{-malign-natural} overrides the ABI-defined alignment of larger
7166 types, such as floating-point doubles, on their natural size-based boundary.
7167 The option @option{-malign-power} instructs GCC to follow the ABI-specified
7168 alignment rules.  GCC defaults to the standard alignment defined in the ABI.
7169
7170 @item -msoft-float
7171 @itemx -mhard-float
7172 @opindex msoft-float
7173 @opindex mhard-float
7174 Generate code that does not use (uses) the floating-point register set.
7175 Software floating point emulation is provided if you use the
7176 @option{-msoft-float} option, and pass the option to GCC when linking.
7177
7178 @item -mmultiple
7179 @itemx -mno-multiple
7180 @opindex mmultiple
7181 @opindex mno-multiple
7182 Generate code that uses (does not use) the load multiple word
7183 instructions and the store multiple word instructions.  These
7184 instructions are generated by default on POWER systems, and not
7185 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
7186 endian PowerPC systems, since those instructions do not work when the
7187 processor is in little endian mode.  The exceptions are PPC740 and
7188 PPC750 which permit the instructions usage in little endian mode.
7189
7190 @item -mstring
7191 @itemx -mno-string
7192 @opindex mstring
7193 @opindex mno-string
7194 Generate code that uses (does not use) the load string instructions
7195 and the store string word instructions to save multiple registers and
7196 do small block moves.  These instructions are generated by default on
7197 POWER systems, and not generated on PowerPC systems.  Do not use
7198 @option{-mstring} on little endian PowerPC systems, since those
7199 instructions do not work when the processor is in little endian mode.
7200 The exceptions are PPC740 and PPC750 which permit the instructions
7201 usage in little endian mode.
7202
7203 @item -mupdate
7204 @itemx -mno-update
7205 @opindex mupdate
7206 @opindex mno-update
7207 Generate code that uses (does not use) the load or store instructions
7208 that update the base register to the address of the calculated memory
7209 location.  These instructions are generated by default.  If you use
7210 @option{-mno-update}, there is a small window between the time that the
7211 stack pointer is updated and the address of the previous frame is
7212 stored, which means code that walks the stack frame across interrupts or
7213 signals may get corrupted data.
7214
7215 @item -mfused-madd
7216 @itemx -mno-fused-madd
7217 @opindex mfused-madd
7218 @opindex mno-fused-madd
7219 Generate code that uses (does not use) the floating point multiply and
7220 accumulate instructions.  These instructions are generated by default if
7221 hardware floating is used.
7222
7223 @item -mno-bit-align
7224 @itemx -mbit-align
7225 @opindex mno-bit-align
7226 @opindex mbit-align
7227 On System V.4 and embedded PowerPC systems do not (do) force structures
7228 and unions that contain bit-fields to be aligned to the base type of the
7229 bit-field.
7230
7231 For example, by default a structure containing nothing but 8
7232 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
7233 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
7234 the structure would be aligned to a 1 byte boundary and be one byte in
7235 size.
7236
7237 @item -mno-strict-align
7238 @itemx -mstrict-align
7239 @opindex mno-strict-align
7240 @opindex mstrict-align
7241 On System V.4 and embedded PowerPC systems do not (do) assume that
7242 unaligned memory references will be handled by the system.
7243
7244 @item -mrelocatable
7245 @itemx -mno-relocatable
7246 @opindex mrelocatable
7247 @opindex mno-relocatable
7248 On embedded PowerPC systems generate code that allows (does not allow)
7249 the program to be relocated to a different address at runtime.  If you
7250 use @option{-mrelocatable} on any module, all objects linked together must
7251 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
7252
7253 @item -mrelocatable-lib
7254 @itemx -mno-relocatable-lib
7255 @opindex mrelocatable-lib
7256 @opindex mno-relocatable-lib
7257 On embedded PowerPC systems generate code that allows (does not allow)
7258 the program to be relocated to a different address at runtime.  Modules
7259 compiled with @option{-mrelocatable-lib} can be linked with either modules
7260 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
7261 with modules compiled with the @option{-mrelocatable} options.
7262
7263 @item -mno-toc
7264 @itemx -mtoc
7265 @opindex mno-toc
7266 @opindex mtoc
7267 On System V.4 and embedded PowerPC systems do not (do) assume that
7268 register 2 contains a pointer to a global area pointing to the addresses
7269 used in the program.
7270
7271 @item -mlittle
7272 @itemx -mlittle-endian
7273 @opindex mlittle
7274 @opindex mlittle-endian
7275 On System V.4 and embedded PowerPC systems compile code for the
7276 processor in little endian mode.  The @option{-mlittle-endian} option is
7277 the same as @option{-mlittle}.
7278
7279 @item -mbig
7280 @itemx -mbig-endian
7281 @opindex mbig
7282 @opindex mbig-endian
7283 On System V.4 and embedded PowerPC systems compile code for the
7284 processor in big endian mode.  The @option{-mbig-endian} option is
7285 the same as @option{-mbig}.
7286
7287 @item -mdynamic-no-pic
7288 @opindex mdynamic-no-pic
7289 On Darwin and Mac OS X systems, compile code so that it is not
7290 relocatable, but that its external references are relocatable.  The
7291 resulting code is suitable for applications, but not shared
7292 libraries.
7293
7294 @item -mprioritize-restricted-insns=@var{priority}
7295 @opindex mprioritize-restricted-insns
7296 This option controls the priority that is assigned to
7297 dispatch-slot restricted instructions during the second scheduling
7298 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
7299 @var{no/highest/second-highest} priority to dispatch slot restricted
7300 instructions.
7301
7302 @item -msched-costly-dep=@var{dependence_type}
7303 @opindex msched-costly-dep
7304 This option controls which dependences are considered costly
7305 by the target during instruction scheduling.  The argument
7306 @var{dependence_type} takes one of the following values:
7307 @var{no}: no dependence is costly,
7308 @var{all}: all dependences are costly,
7309 @var{true_store_to_load}: a true dependence from store to load is costly,
7310 @var{store_to_load}: any dependence from store to load is costly,
7311 @var{number}: any dependence which latency >= @var{number} is costly.
7312
7313 @item -minsert-sched-nops=@var{scheme}
7314 @opindex minsert-sched-nops
7315 This option controls which nop insertion scheme will be used during
7316 the second scheduling pass. The argument @var{scheme} takes one of the
7317 following values:
7318 @var{no}: Don't insert nops.
7319 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
7320 according to the scheduler's grouping.
7321 @var{regroup_exact}: Insert nops to force costly dependent insns into
7322 separate groups.  Insert exactly as many nops as needed to force an insn
7323 to a new group, according to the estimated processor grouping.
7324 @var{number}: Insert nops to force costly dependent insns into
7325 separate groups.  Insert @var{number} nops to force an insn to a new group.
7326
7327 @item -mcall-sysv
7328 @opindex mcall-sysv
7329 On System V.4 and embedded PowerPC systems compile code using calling
7330 conventions that adheres to the March 1995 draft of the System V
7331 Application Binary Interface, PowerPC processor supplement.  This is the
7332 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
7333
7334 @item -mcall-sysv-eabi
7335 @opindex mcall-sysv-eabi
7336 Specify both @option{-mcall-sysv} and @option{-meabi} options.
7337
7338 @item -mcall-sysv-noeabi
7339 @opindex mcall-sysv-noeabi
7340 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
7341
7342 @item -mcall-solaris
7343 @opindex mcall-solaris
7344 On System V.4 and embedded PowerPC systems compile code for the Solaris
7345 operating system.
7346
7347 @item -mcall-linux
7348 @opindex mcall-linux
7349 On System V.4 and embedded PowerPC systems compile code for the
7350 Linux-based GNU system.
7351
7352 @item -mcall-gnu
7353 @opindex mcall-gnu
7354 On System V.4 and embedded PowerPC systems compile code for the
7355 Hurd-based GNU system.
7356
7357 @item -mcall-netbsd
7358 @opindex mcall-netbsd
7359 On System V.4 and embedded PowerPC systems compile code for the
7360 NetBSD operating system.
7361
7362 @item -maix-struct-return
7363 @opindex maix-struct-return
7364 Return all structures in memory (as specified by the AIX ABI)@.
7365
7366 @item -msvr4-struct-return
7367 @opindex msvr4-struct-return
7368 Return structures smaller than 8 bytes in registers (as specified by the
7369 SVR4 ABI)@.
7370
7371 @item -mabi=altivec
7372 @opindex mabi=altivec
7373 Extend the current ABI with AltiVec ABI extensions.  This does not
7374 change the default ABI, instead it adds the AltiVec ABI extensions to
7375 the current ABI@.
7376
7377 @item -mabi=no-altivec
7378 @opindex mabi=no-altivec
7379 Disable AltiVec ABI extensions for the current ABI.
7380
7381 @item -mprototype
7382 @itemx -mno-prototype
7383 @opindex mprototype
7384 @opindex mno-prototype
7385 On System V.4 and embedded PowerPC systems assume that all calls to
7386 variable argument functions are properly prototyped.  Otherwise, the
7387 compiler must insert an instruction before every non prototyped call to
7388 set or clear bit 6 of the condition code register (@var{CR}) to
7389 indicate whether floating point values were passed in the floating point
7390 registers in case the function takes a variable arguments.  With
7391 @option{-mprototype}, only calls to prototyped variable argument functions
7392 will set or clear the bit.
7393
7394 @item -msim
7395 @opindex msim
7396 On embedded PowerPC systems, assume that the startup module is called
7397 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7398 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7399 configurations.
7400
7401 @item -mmvme
7402 @opindex mmvme
7403 On embedded PowerPC systems, assume that the startup module is called
7404 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7405 @file{libc.a}.
7406
7407 @item -mads
7408 @opindex mads
7409 On embedded PowerPC systems, assume that the startup module is called
7410 @file{crt0.o} and the standard C libraries are @file{libads.a} and
7411 @file{libc.a}.
7412
7413 @item -myellowknife
7414 @opindex myellowknife
7415 On embedded PowerPC systems, assume that the startup module is called
7416 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
7417 @file{libc.a}.
7418
7419 @item -mvxworks
7420 @opindex mvxworks
7421 On System V.4 and embedded PowerPC systems, specify that you are
7422 compiling for a VxWorks system.
7423
7424 @item -mwindiss
7425 @opindex mwindiss
7426 Specify that you are compiling for the WindISS simulation environment.
7427
7428 @item -memb
7429 @opindex memb
7430 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7431 header to indicate that @samp{eabi} extended relocations are used.
7432
7433 @item -meabi
7434 @itemx -mno-eabi
7435 @opindex meabi
7436 @opindex mno-eabi
7437 On System V.4 and embedded PowerPC systems do (do not) adhere to the
7438 Embedded Applications Binary Interface (eabi) which is a set of
7439 modifications to the System V.4 specifications.  Selecting @option{-meabi}
7440 means that the stack is aligned to an 8 byte boundary, a function
7441 @code{__eabi} is called to from @code{main} to set up the eabi
7442 environment, and the @option{-msdata} option can use both @code{r2} and
7443 @code{r13} to point to two separate small data areas.  Selecting
7444 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7445 do not call an initialization function from @code{main}, and the
7446 @option{-msdata} option will only use @code{r13} to point to a single
7447 small data area.  The @option{-meabi} option is on by default if you
7448 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7449
7450 @item -msdata=eabi
7451 @opindex msdata=eabi
7452 On System V.4 and embedded PowerPC systems, put small initialized
7453 @code{const} global and static data in the @samp{.sdata2} section, which
7454 is pointed to by register @code{r2}.  Put small initialized
7455 non-@code{const} global and static data in the @samp{.sdata} section,
7456 which is pointed to by register @code{r13}.  Put small uninitialized
7457 global and static data in the @samp{.sbss} section, which is adjacent to
7458 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7459 incompatible with the @option{-mrelocatable} option.  The
7460 @option{-msdata=eabi} option also sets the @option{-memb} option.
7461
7462 @item -msdata=sysv
7463 @opindex msdata=sysv
7464 On System V.4 and embedded PowerPC systems, put small global and static
7465 data in the @samp{.sdata} section, which is pointed to by register
7466 @code{r13}.  Put small uninitialized global and static data in the
7467 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7468 The @option{-msdata=sysv} option is incompatible with the
7469 @option{-mrelocatable} option.
7470
7471 @item -msdata=default
7472 @itemx -msdata
7473 @opindex msdata=default
7474 @opindex msdata
7475 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7476 compile code the same as @option{-msdata=eabi}, otherwise compile code the
7477 same as @option{-msdata=sysv}.
7478
7479 @item -msdata-data
7480 @opindex msdata-data
7481 On System V.4 and embedded PowerPC systems, put small global and static
7482 data in the @samp{.sdata} section.  Put small uninitialized global and
7483 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7484 to address small data however.  This is the default behavior unless
7485 other @option{-msdata} options are used.
7486
7487 @item -msdata=none
7488 @itemx -mno-sdata
7489 @opindex msdata=none
7490 @opindex mno-sdata
7491 On embedded PowerPC systems, put all initialized global and static data
7492 in the @samp{.data} section, and all uninitialized data in the
7493 @samp{.bss} section.
7494
7495 @item -G @var{num}
7496 @opindex G
7497 @cindex smaller data references (PowerPC)
7498 @cindex .sdata/.sdata2 references (PowerPC)
7499 On embedded PowerPC systems, put global and static items less than or
7500 equal to @var{num} bytes into the small data or bss sections instead of
7501 the normal data or bss section.  By default, @var{num} is 8.  The
7502 @option{-G @var{num}} switch is also passed to the linker.
7503 All modules should be compiled with the same @option{-G @var{num}} value.
7504
7505 @item -mregnames
7506 @itemx -mno-regnames
7507 @opindex mregnames
7508 @opindex mno-regnames
7509 On System V.4 and embedded PowerPC systems do (do not) emit register
7510 names in the assembly language output using symbolic forms.
7511
7512 @item -mlongcall
7513 @itemx -mno-longcall
7514 @opindex mlongcall
7515 @opindex mno-longcall
7516 Default to making all function calls via pointers, so that functions
7517 which reside further than 64 megabytes (67,108,864 bytes) from the
7518 current location can be called.  This setting can be overridden by the
7519 @code{shortcall} function attribute, or by @code{#pragma longcall(0)}.
7520
7521 Some linkers are capable of detecting out-of-range calls and generating
7522 glue code on the fly.  On these systems, long calls are unnecessary and
7523 generate slower code.  As of this writing, the AIX linker can do this,
7524 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7525 to the GNU linker for 32-bit PowerPC systems as well.
7526
7527 On Mach-O (Darwin) systems, this option directs the compiler emit to
7528 the glue for every direct call, and the Darwin linker decides whether
7529 to use or discard it.
7530
7531 In the future, we may cause GCC to ignore all longcall specifications
7532 when the linker is known to generate glue.
7533
7534 @item -pthread
7535 @opindex pthread
7536 Adds support for multithreading with the @dfn{pthreads} library.
7537 This option sets flags for both the preprocessor and linker.
7538
7539 @end table
7540
7541 @node Darwin Options
7542 @subsection Darwin Options
7543 @cindex Darwin options
7544
7545 These options are defined for all architectures running the Darwin operating
7546 system.  They are useful for compatibility with other Mac OS compilers.
7547
7548 @table @gcctabopt
7549 @item -all_load
7550 @opindex all_load
7551 Loads all members of static archive libraries.
7552 See man ld(1) for more information.
7553
7554 @item -arch_errors_fatal
7555 @opindex arch_errors_fatal
7556 Cause the errors having to do with files that have the wrong architecture
7557 to be fatal.
7558
7559 @item -bind_at_load
7560 @opindex bind_at_load
7561 Causes the output file to be marked such that the dynamic linker will
7562 bind all undefined references when the file is loaded or launched.
7563
7564 @item -bundle
7565 @opindex bundle
7566 Produce a Mach-o bundle format file.
7567 See man ld(1) for more information.
7568
7569 @item -bundle_loader @var{executable}
7570 @opindex bundle_loader
7571 This specifies the @var{executable} that will be loading the build
7572 output file being linked. See man ld(1) for more information.
7573
7574 @item -allowable_client  @var{client_name}
7575 @itemx -arch_only
7576
7577 @itemx -client_name
7578 @itemx -compatibility_version
7579 @itemx -current_version
7580 @itemx -dependency-file
7581 @itemx -dylib_file
7582 @itemx -dylinker_install_name
7583 @itemx -dynamic
7584 @itemx -dynamiclib
7585 @itemx -exported_symbols_list
7586 @itemx -filelist
7587 @itemx -flat_namespace
7588 @itemx -force_cpusubtype_ALL
7589 @itemx -force_flat_namespace
7590 @itemx -headerpad_max_install_names
7591 @itemx -image_base
7592 @itemx -init
7593 @itemx -install_name
7594 @itemx -keep_private_externs
7595 @itemx -multi_module
7596 @itemx -multiply_defined
7597 @itemx -multiply_defined_unused
7598 @itemx -noall_load
7599 @itemx -nofixprebinding
7600 @itemx -nomultidefs
7601 @itemx -noprebind
7602 @itemx -noseglinkedit
7603 @itemx -pagezero_size
7604 @itemx -prebind
7605 @itemx -prebind_all_twolevel_modules
7606 @itemx -private_bundle
7607 @itemx -read_only_relocs
7608 @itemx -sectalign
7609 @itemx -sectobjectsymbols
7610 @itemx -whyload
7611 @itemx -seg1addr
7612 @itemx -sectcreate
7613 @itemx -sectobjectsymbols
7614 @itemx -sectorder
7615 @itemx -seg_addr_table
7616 @itemx -seg_addr_table_filename
7617 @itemx -seglinkedit
7618 @itemx -segprot
7619 @itemx -segs_read_only_addr
7620 @itemx -segs_read_write_addr
7621 @itemx -single_module
7622 @itemx -static
7623 @itemx -sub_library
7624 @itemx -sub_umbrella
7625 @itemx -twolevel_namespace
7626 @itemx -umbrella
7627 @itemx -undefined
7628 @itemx -unexported_symbols_list
7629 @itemx -weak_reference_mismatches
7630 @itemx -whatsloaded
7631
7632 @opindex allowable_client
7633 @opindex arch_only
7634 @opindex client_name
7635 @opindex compatibility_version
7636 @opindex current_version
7637 @opindex dependency-file
7638 @opindex dylib_file
7639 @opindex dylinker_install_name
7640 @opindex dynamic
7641 @opindex dynamiclib
7642 @opindex exported_symbols_list
7643 @opindex filelist
7644 @opindex flat_namespace
7645 @opindex force_cpusubtype_ALL
7646 @opindex force_flat_namespace
7647 @opindex headerpad_max_install_names
7648 @opindex image_base
7649 @opindex init
7650 @opindex install_name
7651 @opindex keep_private_externs
7652 @opindex multi_module
7653 @opindex multiply_defined
7654 @opindex multiply_defined_unused
7655 @opindex noall_load
7656 @opindex nofixprebinding
7657 @opindex nomultidefs
7658 @opindex noprebind
7659 @opindex noseglinkedit
7660 @opindex pagezero_size
7661 @opindex prebind
7662 @opindex prebind_all_twolevel_modules
7663 @opindex private_bundle
7664 @opindex read_only_relocs
7665 @opindex sectalign
7666 @opindex sectobjectsymbols
7667 @opindex whyload
7668 @opindex seg1addr
7669 @opindex sectcreate
7670 @opindex sectobjectsymbols
7671 @opindex sectorder
7672 @opindex seg_addr_table
7673 @opindex seg_addr_table_filename
7674 @opindex seglinkedit
7675 @opindex segprot
7676 @opindex segs_read_only_addr
7677 @opindex segs_read_write_addr
7678 @opindex single_module
7679 @opindex static
7680 @opindex sub_library
7681 @opindex sub_umbrella
7682 @opindex twolevel_namespace
7683 @opindex umbrella
7684 @opindex undefined
7685 @opindex unexported_symbols_list
7686 @opindex weak_reference_mismatches
7687 @opindex whatsloaded
7688
7689 These options are available for Darwin linker. Darwin linker man page
7690 describes them in detail.
7691 @end table
7692
7693
7694 @node MIPS Options
7695 @subsection MIPS Options
7696 @cindex MIPS options
7697
7698 @table @gcctabopt
7699
7700 @item -EB
7701 @opindex EB
7702 Generate big-endian code.
7703
7704 @item -EL
7705 @opindex EL
7706 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
7707 configurations.
7708
7709 @item -march=@var{arch}
7710 @opindex march
7711 Generate code that will run on @var{arch}, which can be the name of a
7712 generic MIPS ISA, or the name of a particular processor.
7713 The ISA names are:
7714 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
7715 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
7716 The processor names are:
7717 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7718 @samp{m4k},
7719 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
7720 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
7721 @samp{rm9000},
7722 @samp{orion},
7723 @samp{sb1},
7724 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4300},
7725 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
7726 The special value @samp{from-abi} selects the
7727 most compatible architecture for the selected ABI (that is,
7728 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7729
7730 In processor names, a final @samp{000} can be abbreviated as @samp{k}
7731 (for example, @samp{-march=r2k}).  Prefixes are optional, and
7732 @samp{vr} may be written @samp{r}.
7733
7734 GCC defines two macros based on the value of this option.  The first
7735 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7736 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7737 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
7738 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7739 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7740
7741 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7742 above.  In other words, it will have the full prefix and will not
7743 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7744 the macro names the resolved architecture (either @samp{"mips1"} or
7745 @samp{"mips3"}).  It names the default architecture when no
7746 @option{-march} option is given.
7747
7748 @item -mtune=@var{arch}
7749 @opindex mtune
7750 Optimize for @var{arch}.  Among other things, this option controls
7751 the way instructions are scheduled, and the perceived cost of arithmetic
7752 operations.  The list of @var{arch} values is the same as for
7753 @option{-march}.
7754
7755 When this option is not used, GCC will optimize for the processor
7756 specified by @option{-march}.  By using @option{-march} and
7757 @option{-mtune} together, it is possible to generate code that will
7758 run on a family of processors, but optimize the code for one
7759 particular member of that family.
7760
7761 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
7762 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
7763 @samp{-march} ones described above.
7764
7765 @item -mips1
7766 @opindex mips1
7767 Equivalent to @samp{-march=mips1}.
7768
7769 @item -mips2
7770 @opindex mips2
7771 Equivalent to @samp{-march=mips2}.
7772
7773 @item -mips3
7774 @opindex mips3
7775 Equivalent to @samp{-march=mips3}.
7776
7777 @item -mips4
7778 @opindex mips4
7779 Equivalent to @samp{-march=mips4}.
7780
7781 @item -mips32
7782 @opindex mips32
7783 Equivalent to @samp{-march=mips32}.
7784
7785 @item -mips32r2
7786 @opindex mips32r2
7787 Equivalent to @samp{-march=mips32r2}.
7788
7789 @item -mips64
7790 @opindex mips64
7791 Equivalent to @samp{-march=mips64}.
7792
7793 @item -mips16
7794 @itemx -mno-mips16
7795 @opindex mips16
7796 @opindex mno-mips16
7797 Use (do not use) the MIPS16 ISA.
7798
7799 @item -mabi=32
7800 @itemx -mabi=o64
7801 @itemx -mabi=n32
7802 @itemx -mabi=64
7803 @itemx -mabi=eabi
7804 @opindex mabi=32
7805 @opindex mabi=o64
7806 @opindex mabi=n32
7807 @opindex mabi=64
7808 @opindex mabi=eabi
7809 Generate code for the given ABI@.
7810
7811 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
7812 generates 64-bit code when you select a 64-bit architecture, but you
7813 can use @option{-mgp32} to get 32-bit code instead.
7814
7815 @item -mabicalls
7816 @itemx -mno-abicalls
7817 @opindex mabicalls
7818 @opindex mno-abicalls
7819 Generate (do not generate) SVR4-style position-independent code.
7820 @option{-mabicalls} is the default for SVR4-based systems.
7821
7822 @item -mxgot
7823 @itemx -mno-xgot
7824 @opindex mxgot
7825 @opindex mno-xgot
7826 Lift (do not lift) the usual restrictions on the size of the global
7827 offset table.
7828
7829 GCC normally uses a single instruction to load values from the GOT.
7830 While this is relatively efficient, it will only work if the GOT
7831 is smaller than about 64k.  Anything larger will cause the linker
7832 to report an error such as:
7833
7834 @cindex relocation truncated to fit (MIPS)
7835 @smallexample
7836 relocation truncated to fit: R_MIPS_GOT16 foobar
7837 @end smallexample
7838
7839 If this happens, you should recompile your code with @option{-mxgot}.
7840 It should then work with very large GOTs, although it will also be
7841 less efficient, since it will take three instructions to fetch the
7842 value of a global symbol.
7843
7844 Note that some linkers can create multiple GOTs.  If you have such a
7845 linker, you should only need to use @option{-mxgot} when a single object
7846 file accesses more than 64k's worth of GOT entries.  Very few do.
7847
7848 These options have no effect unless GCC is generating position
7849 independent code.
7850
7851 @item -membedded-pic
7852 @itemx -mno-embedded-pic
7853 @opindex membedded-pic
7854 @opindex mno-embedded-pic
7855 Generate (do not generate) position-independent code suitable for some
7856 embedded systems.  All calls are made using PC relative addresses, and
7857 all data is addressed using the $gp register.  No more than 65536
7858 bytes of global data may be used.  This requires GNU as and GNU ld,
7859 which do most of the work.
7860
7861 @item -mgp32
7862 @opindex mgp32
7863 Assume that general-purpose registers are 32 bits wide.
7864
7865 @item -mgp64
7866 @opindex mgp64
7867 Assume that general-purpose registers are 64 bits wide.
7868
7869 @item -mfp32
7870 @opindex mfp32
7871 Assume that floating-point registers are 32 bits wide.
7872
7873 @item -mfp64
7874 @opindex mfp64
7875 Assume that floating-point registers are 64 bits wide.
7876
7877 @item -mhard-float
7878 @opindex mhard-float
7879 Use floating-point coprocessor instructions.
7880
7881 @item -msoft-float
7882 @opindex msoft-float
7883 Do not use floating-point coprocessor instructions.  Implement
7884 floating-point calculations using library calls instead.
7885
7886 @item -msingle-float
7887 @opindex msingle-float
7888 Assume that the floating-point coprocessor only supports single-precision
7889 operations.
7890
7891 @itemx -mdouble-float
7892 @opindex mdouble-float
7893 Assume that the floating-point coprocessor supports double-precision
7894 operations.  This is the default.
7895
7896 @item -mint64
7897 @opindex mint64
7898 Force @code{int} and @code{long} types to be 64 bits wide.  See
7899 @option{-mlong32} for an explanation of the default and the way
7900 that the pointer size is determined.
7901
7902 @item -mlong64
7903 @opindex mlong64
7904 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
7905 an explanation of the default and the way that the pointer size is
7906 determined.
7907
7908 @item -mlong32
7909 @opindex mlong32
7910 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
7911
7912 The default size of @code{int}s, @code{long}s and pointers depends on
7913 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
7914 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
7915 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
7916 or the same size as integer registers, whichever is smaller.
7917
7918 @item -G @var{num}
7919 @opindex G
7920 @cindex smaller data references (MIPS)
7921 @cindex gp-relative references (MIPS)
7922 Put global and static items less than or equal to @var{num} bytes into
7923 the small data or bss section instead of the normal data or bss section.
7924 This allows the data to be accessed using a single instruction.
7925
7926 All modules should be compiled with the same @option{-G @var{num}}
7927 value.
7928
7929 @item -membedded-data
7930 @itemx -mno-embedded-data
7931 @opindex membedded-data
7932 @opindex mno-embedded-data
7933 Allocate variables to the read-only data section first if possible, then
7934 next in the small data section if possible, otherwise in data.  This gives
7935 slightly slower code than the default, but reduces the amount of RAM required
7936 when executing, and thus may be preferred for some embedded systems.
7937
7938 @item -muninit-const-in-rodata
7939 @itemx -mno-uninit-const-in-rodata
7940 @opindex muninit-const-in-rodata
7941 @opindex mno-uninit-const-in-rodata
7942 Put uninitialized @code{const} variables in the read-only data section.
7943 This option is only meaningful in conjunction with @option{-membedded-data}.
7944
7945 @item -msplit-addresses
7946 @itemx -mno-split-addresses
7947 @opindex msplit-addresses
7948 @opindex mno-split-addresses
7949 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
7950 relocation operators.  This option has been superceded by
7951 @option{-mexplicit-relocs} but is retained for backwards compatibility.
7952
7953 @item -mexplicit-relocs
7954 @itemx -mno-explicit-relocs
7955 @opindex mexplicit-relocs
7956 @opindex mno-explicit-relocs
7957 Use (do not use) assembler relocation operators when dealing with symbolic
7958 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
7959 is to use assembler macros instead.
7960
7961 @option{-mexplicit-relocs} is usually the default if GCC was
7962 configured to use an assembler that supports relocation operators.
7963 However, there are two exceptions:
7964
7965 @itemize @bullet
7966 @item
7967 GCC is not yet able to generate explicit relocations for the combination
7968 of @option{-mabi=64} and @option{-mno-abicalls}.  This will be addressed
7969 in a future release.
7970
7971 @item
7972 The combination of @option{-mabicalls} and @option{-fno-unit-at-a-time}
7973 implies @option{-mno-explicit-relocs} unless explicitly overridden.
7974 This is because, when generating abicalls, the choice of relocation
7975 depends on whether a symbol is local or global.  In some rare cases,
7976 GCC will not be able to decide this until the whole compilation unit
7977 has been read.
7978 @end itemize
7979
7980 @item -mrnames
7981 @itemx -mno-rnames
7982 @opindex mrnames
7983 @opindex mno-rnames
7984 Generate (do not generate) code that refers to registers using their
7985 software names.  The default is @option{-mno-rnames}, which tells GCC
7986 to use hardware names like @samp{$4} instead of software names like
7987 @samp{a0}.  The only assembler known to support @option{-rnames} is
7988 the Algorithmics assembler.
7989
7990 @item -mcheck-zero-division
7991 @itemx -mno-check-zero-division
7992 @opindex mcheck-zero-division
7993 @opindex mno-check-zero-division
7994 Trap (do not trap) on integer division by zero.  The default is
7995 @option{-mcheck-zero-division}.
7996
7997 @item -mmemcpy
7998 @itemx -mno-memcpy
7999 @opindex mmemcpy
8000 @opindex mno-memcpy
8001 Force (do not force) the use of @code{memcpy()} for non-trivial block
8002 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
8003 most constant-sized copies.
8004
8005 @item -mlong-calls
8006 @itemx -mno-long-calls
8007 @opindex mlong-calls
8008 @opindex mno-long-calls
8009 Disable (do not disable) use of the @code{jal} instruction.  Calling
8010 functions using @code{jal} is more efficient but requires the caller
8011 and callee to be in the same 256 megabyte segment.
8012
8013 This option has no effect on abicalls code.  The default is
8014 @option{-mno-long-calls}.
8015
8016 @item -mmad
8017 @itemx -mno-mad
8018 @opindex mmad
8019 @opindex mno-mad
8020 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
8021 instructions, as provided by the R4650 ISA.
8022
8023 @item -mfused-madd
8024 @itemx -mno-fused-madd
8025 @opindex mfused-madd
8026 @opindex mno-fused-madd
8027 Enable (disable) use of the floating point multiply-accumulate
8028 instructions, when they are available.  The default is
8029 @option{-mfused-madd}.
8030
8031 When multiply-accumulate instructions are used, the intermediate
8032 product is calculated to infinite precision and is not subject to
8033 the FCSR Flush to Zero bit.  This may be undesirable in some
8034 circumstances.
8035
8036 @item -nocpp
8037 @opindex nocpp
8038 Tell the MIPS assembler to not run its preprocessor over user
8039 assembler files (with a @samp{.s} suffix) when assembling them.
8040
8041 @item -mfix-sb1
8042 @itemx -mno-fix-sb1
8043 @opindex mfix-sb1
8044 Work around certain SB-1 CPU core errata.
8045 (This flag currently works around the SB-1 revision 2
8046 ``F1'' and ``F2'' floating point errata.)
8047
8048 @item -mflush-func=@var{func}
8049 @itemx -mno-flush-func
8050 @opindex mflush-func
8051 Specifies the function to call to flush the I and D caches, or to not
8052 call any such function.  If called, the function must take the same
8053 arguments as the common @code{_flush_func()}, that is, the address of the
8054 memory range for which the cache is being flushed, the size of the
8055 memory range, and the number 3 (to flush both caches).  The default
8056 depends on the target gcc was configured for, but commonly is either
8057 @samp{_flush_func} or @samp{__cpu_flush}.
8058
8059 @item -mbranch-likely
8060 @itemx -mno-branch-likely
8061 @opindex mbranch-likely
8062 @opindex mno-branch-likely
8063 Enable or disable use of Branch Likely instructions, regardless of the
8064 default for the selected architecture.  By default, Branch Likely
8065 instructions may be generated if they are supported by the selected
8066 architecture.  An exception is for the MIPS32 and MIPS64 architectures
8067 and processors which implement those architectures; for those, Branch
8068 Likely instructions will not be generated by default because the MIPS32
8069 and MIPS64 architectures specifically deprecate their use.
8070 @end table
8071
8072 @node i386 and x86-64 Options
8073 @subsection Intel 386 and AMD x86-64 Options
8074 @cindex i386 Options
8075 @cindex x86-64 Options
8076 @cindex Intel 386 Options
8077 @cindex AMD x86-64 Options
8078
8079 These @samp{-m} options are defined for the i386 and x86-64 family of
8080 computers:
8081
8082 @table @gcctabopt
8083 @item -mtune=@var{cpu-type}
8084 @opindex mtune
8085 Tune to @var{cpu-type} everything applicable about the generated code, except
8086 for the ABI and the set of available instructions.  The choices for
8087 @var{cpu-type} are:
8088 @table @emph
8089 @item i386
8090 Original Intel's i386 CPU.
8091 @item i486
8092 Intel's i486 CPU.  (No scheduling is implemented for this chip.)
8093 @item i586, pentium
8094 Intel Pentium CPU with no MMX support.
8095 @item pentium-mmx
8096 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
8097 @item i686, pentiumpro
8098 Intel PentiumPro CPU.
8099 @item pentium2
8100 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
8101 @item pentium3
8102 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
8103 support.
8104 @item pentium4
8105 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
8106 @item k6
8107 AMD K6 CPU with MMX instruction set support.
8108 @item k6-2, k6-3
8109 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
8110 @item athlon, athlon-tbird
8111 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
8112 support.
8113 @item athlon-4, athlon-xp, athlon-mp
8114 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
8115 instruction set support.
8116 @item k8, opteron, athlon64, athlon-fx
8117 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
8118 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
8119 @item winchip-c6
8120 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
8121 set support.
8122 @item winchip2
8123 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
8124 instruction set support.
8125 @item c3
8126 Via C3 CPU with MMX and 3dNOW!  instruction set support.  (No scheduling is
8127 implemented for this chip.)
8128 @item c3-2
8129 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
8130 implemented for this chip.)
8131 @end table
8132
8133 While picking a specific @var{cpu-type} will schedule things appropriately
8134 for that particular chip, the compiler will not generate any code that
8135 does not run on the i386 without the @option{-march=@var{cpu-type}} option
8136 being used.
8137
8138 @item -march=@var{cpu-type}
8139 @opindex march
8140 Generate instructions for the machine type @var{cpu-type}.  The choices
8141 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8142 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8143
8144 @item -mcpu=@var{cpu-type}
8145 @opindex mcpu
8146 A deprecated synonym for @option{-mtune}.
8147
8148 @item -m386
8149 @itemx -m486
8150 @itemx -mpentium
8151 @itemx -mpentiumpro
8152 @opindex m386
8153 @opindex m486
8154 @opindex mpentium
8155 @opindex mpentiumpro
8156 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8157 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8158 These synonyms are deprecated.
8159
8160 @item -mfpmath=@var{unit}
8161 @opindex march
8162 Generate floating point arithmetics for selected unit @var{unit}.  The choices
8163 for @var{unit} are:
8164
8165 @table @samp
8166 @item 387
8167 Use the standard 387 floating point coprocessor present majority of chips and
8168 emulated otherwise.  Code compiled with this option will run almost everywhere.
8169 The temporary results are computed in 80bit precision instead of precision
8170 specified by the type resulting in slightly different results compared to most
8171 of other chips. See @option{-ffloat-store} for more detailed description.
8172
8173 This is the default choice for i386 compiler.
8174
8175 @item sse
8176 Use scalar floating point instructions present in the SSE instruction set.
8177 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8178 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8179 instruction set supports only single precision arithmetics, thus the double and
8180 extended precision arithmetics is still done using 387.  Later version, present
8181 only in Pentium4 and the future AMD x86-64 chips supports double precision
8182 arithmetics too.
8183
8184 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8185 @option{-msse2} switches to enable SSE extensions and make this option
8186 effective.  For x86-64 compiler, these extensions are enabled by default.
8187
8188 The resulting code should be considerably faster in the majority of cases and avoid
8189 the numerical instability problems of 387 code, but may break some existing
8190 code that expects temporaries to be 80bit.
8191
8192 This is the default choice for the x86-64 compiler.
8193
8194 @item pni
8195 Use all SSE extensions enabled by @option{-msse2} as well as the new
8196 SSE extensions in Prescott New Instructions. @option{-mpni} also
8197 enables 2 builtin functions, @code{__builtin_ia32_monitor} and
8198 @code{__builtin_ia32_mwait}, for new instructions @code{monitor} and
8199 @code{mwait}.
8200
8201 @item sse,387
8202 Attempt to utilize both instruction sets at once.  This effectively double the
8203 amount of available registers and on chips with separate execution units for
8204 387 and SSE the execution resources too.  Use this option with care, as it is
8205 still experimental, because the gcc register allocator does not model separate
8206 functional units well resulting in instable performance.
8207 @end table
8208
8209 @item -masm=@var{dialect}
8210 @opindex masm=@var{dialect}
8211 Output asm instructions using selected @var{dialect}. Supported choices are
8212 @samp{intel} or @samp{att} (the default one).
8213
8214 @item -mieee-fp
8215 @itemx -mno-ieee-fp
8216 @opindex mieee-fp
8217 @opindex mno-ieee-fp
8218 Control whether or not the compiler uses IEEE floating point
8219 comparisons.  These handle correctly the case where the result of a
8220 comparison is unordered.
8221
8222 @item -msoft-float
8223 @opindex msoft-float
8224 Generate output containing library calls for floating point.
8225 @strong{Warning:} the requisite libraries are not part of GCC@.
8226 Normally the facilities of the machine's usual C compiler are used, but
8227 this can't be done directly in cross-compilation.  You must make your
8228 own arrangements to provide suitable library functions for
8229 cross-compilation.
8230
8231 On machines where a function returns floating point results in the 80387
8232 register stack, some floating point opcodes may be emitted even if
8233 @option{-msoft-float} is used.
8234
8235 @item -mno-fp-ret-in-387
8236 @opindex mno-fp-ret-in-387
8237 Do not use the FPU registers for return values of functions.
8238
8239 The usual calling convention has functions return values of types
8240 @code{float} and @code{double} in an FPU register, even if there
8241 is no FPU@.  The idea is that the operating system should emulate
8242 an FPU@.
8243
8244 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8245 in ordinary CPU registers instead.
8246
8247 @item -mno-fancy-math-387
8248 @opindex mno-fancy-math-387
8249 Some 387 emulators do not support the @code{sin}, @code{cos} and
8250 @code{sqrt} instructions for the 387.  Specify this option to avoid
8251 generating those instructions.  This option is the default on FreeBSD,
8252 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8253 indicates that the target cpu will always have an FPU and so the
8254 instruction will not need emulation.  As of revision 2.6.1, these
8255 instructions are not generated unless you also use the
8256 @option{-funsafe-math-optimizations} switch.
8257
8258 @item -malign-double
8259 @itemx -mno-align-double
8260 @opindex malign-double
8261 @opindex mno-align-double
8262 Control whether GCC aligns @code{double}, @code{long double}, and
8263 @code{long long} variables on a two word boundary or a one word
8264 boundary.  Aligning @code{double} variables on a two word boundary will
8265 produce code that runs somewhat faster on a @samp{Pentium} at the
8266 expense of more memory.
8267
8268 @strong{Warning:} if you use the @option{-malign-double} switch,
8269 structures containing the above types will be aligned differently than
8270 the published application binary interface specifications for the 386
8271 and will not be binary compatible with structures in code compiled
8272 without that switch.
8273
8274 @item -m96bit-long-double
8275 @itemx -m128bit-long-double
8276 @opindex m96bit-long-double
8277 @opindex m128bit-long-double
8278 These switches control the size of @code{long double} type. The i386
8279 application binary interface specifies the size to be 96 bits,
8280 so @option{-m96bit-long-double} is the default in 32 bit mode.
8281
8282 Modern architectures (Pentium and newer) would prefer @code{long double}
8283 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
8284 conforming to the ABI, this would not be possible.  So specifying a
8285 @option{-m128bit-long-double} will align @code{long double}
8286 to a 16 byte boundary by padding the @code{long double} with an additional
8287 32 bit zero.
8288
8289 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8290 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
8291
8292 Notice that neither of these options enable any extra precision over the x87
8293 standard of 80 bits for a @code{long double}.
8294
8295 @strong{Warning:} if you override the default value for your target ABI, the
8296 structures and arrays containing @code{long double} variables will change
8297 their size as well as function calling convention for function taking
8298 @code{long double} will be modified.  Hence they will not be binary
8299 compatible with arrays or structures in code compiled without that switch.
8300
8301
8302 @item -msvr3-shlib
8303 @itemx -mno-svr3-shlib
8304 @opindex msvr3-shlib
8305 @opindex mno-svr3-shlib
8306 Control whether GCC places uninitialized local variables into the
8307 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
8308 into @code{bss}.  These options are meaningful only on System V Release 3.
8309
8310 @item -mrtd
8311 @opindex mrtd
8312 Use a different function-calling convention, in which functions that
8313 take a fixed number of arguments return with the @code{ret} @var{num}
8314 instruction, which pops their arguments while returning.  This saves one
8315 instruction in the caller since there is no need to pop the arguments
8316 there.
8317
8318 You can specify that an individual function is called with this calling
8319 sequence with the function attribute @samp{stdcall}.  You can also
8320 override the @option{-mrtd} option by using the function attribute
8321 @samp{cdecl}.  @xref{Function Attributes}.
8322
8323 @strong{Warning:} this calling convention is incompatible with the one
8324 normally used on Unix, so you cannot use it if you need to call
8325 libraries compiled with the Unix compiler.
8326
8327 Also, you must provide function prototypes for all functions that
8328 take variable numbers of arguments (including @code{printf});
8329 otherwise incorrect code will be generated for calls to those
8330 functions.
8331
8332 In addition, seriously incorrect code will result if you call a
8333 function with too many arguments.  (Normally, extra arguments are
8334 harmlessly ignored.)
8335
8336 @item -mregparm=@var{num}
8337 @opindex mregparm
8338 Control how many registers are used to pass integer arguments.  By
8339 default, no registers are used to pass arguments, and at most 3
8340 registers can be used.  You can control this behavior for a specific
8341 function by using the function attribute @samp{regparm}.
8342 @xref{Function Attributes}.
8343
8344 @strong{Warning:} if you use this switch, and
8345 @var{num} is nonzero, then you must build all modules with the same
8346 value, including any libraries.  This includes the system libraries and
8347 startup modules.
8348
8349 @item -mpreferred-stack-boundary=@var{num}
8350 @opindex mpreferred-stack-boundary
8351 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8352 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
8353 the default is 4 (16 bytes or 128 bits), except when optimizing for code
8354 size (@option{-Os}), in which case the default is the minimum correct
8355 alignment (4 bytes for x86, and 8 bytes for x86-64).
8356
8357 On Pentium and PentiumPro, @code{double} and @code{long double} values
8358 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8359 suffer significant run time performance penalties.  On Pentium III, the
8360 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8361 penalties if it is not 16 byte aligned.
8362
8363 To ensure proper alignment of this values on the stack, the stack boundary
8364 must be as aligned as that required by any value stored on the stack.
8365 Further, every function must be generated such that it keeps the stack
8366 aligned.  Thus calling a function compiled with a higher preferred
8367 stack boundary from a function compiled with a lower preferred stack
8368 boundary will most likely misalign the stack.  It is recommended that
8369 libraries that use callbacks always use the default setting.
8370
8371 This extra alignment does consume extra stack space, and generally
8372 increases code size.  Code that is sensitive to stack space usage, such
8373 as embedded systems and operating system kernels, may want to reduce the
8374 preferred alignment to @option{-mpreferred-stack-boundary=2}.
8375
8376 @item -mmmx
8377 @itemx -mno-mmx
8378 @item -msse
8379 @itemx -mno-sse
8380 @item -msse2
8381 @itemx -mno-sse2
8382 @item -mpni
8383 @itemx -mno-pni
8384 @item -m3dnow
8385 @itemx -mno-3dnow
8386 @opindex mmmx
8387 @opindex mno-mmx
8388 @opindex msse
8389 @opindex mno-sse
8390 @opindex m3dnow
8391 @opindex mno-3dnow
8392 These switches enable or disable the use of built-in functions that allow
8393 direct access to the MMX, SSE and 3Dnow extensions of the instruction set.
8394
8395 @xref{X86 Built-in Functions}, for details of the functions enabled
8396 and disabled by these switches.
8397
8398 To have SSE/SSE2 instructions generated automatically from floating-point
8399 code, see @option{-mfpmath=sse}.
8400
8401 @item -mpush-args
8402 @itemx -mno-push-args
8403 @opindex mpush-args
8404 @opindex mno-push-args
8405 Use PUSH operations to store outgoing parameters.  This method is shorter
8406 and usually equally fast as method using SUB/MOV operations and is enabled
8407 by default.  In some cases disabling it may improve performance because of
8408 improved scheduling and reduced dependencies.
8409
8410 @item -maccumulate-outgoing-args
8411 @opindex maccumulate-outgoing-args
8412 If enabled, the maximum amount of space required for outgoing arguments will be
8413 computed in the function prologue.  This is faster on most modern CPUs
8414 because of reduced dependencies, improved scheduling and reduced stack usage
8415 when preferred stack boundary is not equal to 2.  The drawback is a notable
8416 increase in code size.  This switch implies @option{-mno-push-args}.
8417
8418 @item -mthreads
8419 @opindex mthreads
8420 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8421 on thread-safe exception handling must compile and link all code with the
8422 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
8423 @option{-D_MT}; when linking, it links in a special thread helper library
8424 @option{-lmingwthrd} which cleans up per thread exception handling data.
8425
8426 @item -mno-align-stringops
8427 @opindex mno-align-stringops
8428 Do not align destination of inlined string operations.  This switch reduces
8429 code size and improves performance in case the destination is already aligned,
8430 but gcc don't know about it.
8431
8432 @item -minline-all-stringops
8433 @opindex minline-all-stringops
8434 By default GCC inlines string operations only when destination is known to be
8435 aligned at least to 4 byte boundary.  This enables more inlining, increase code
8436 size, but may improve performance of code that depends on fast memcpy, strlen
8437 and memset for short lengths.
8438
8439 @item -momit-leaf-frame-pointer
8440 @opindex momit-leaf-frame-pointer
8441 Don't keep the frame pointer in a register for leaf functions.  This
8442 avoids the instructions to save, set up and restore frame pointers and
8443 makes an extra register available in leaf functions.  The option
8444 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8445 which might make debugging harder.
8446
8447 @item -mtls-direct-seg-refs
8448 @itemx -mno-tls-direct-seg-refs
8449 @opindex mtls-direct-seg-refs
8450 Controls whether TLS variables may be accessed with offsets from the
8451 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8452 or whether the thread base pointer must be added.  Whether or not this
8453 is legal depends on the operating system, and whether it maps the
8454 segment to cover the entire TLS area.
8455
8456 For systems that use GNU libc, the default is on.
8457 @end table
8458
8459 These @samp{-m} switches are supported in addition to the above
8460 on AMD x86-64 processors in 64-bit environments.
8461
8462 @table @gcctabopt
8463 @item -m32
8464 @itemx -m64
8465 @opindex m32
8466 @opindex m64
8467 Generate code for a 32-bit or 64-bit environment.
8468 The 32-bit environment sets int, long and pointer to 32 bits and
8469 generates code that runs on any i386 system.
8470 The 64-bit environment sets int to 32 bits and long and pointer
8471 to 64 bits and generates code for AMD's x86-64 architecture.
8472
8473 @item -mno-red-zone
8474 @opindex no-red-zone
8475 Do not use a so called red zone for x86-64 code.  The red zone is mandated
8476 by the x86-64 ABI, it is a 128-byte area beyond the location of the
8477 stack pointer that will not be modified by signal or interrupt handlers
8478 and therefore can be used for temporary data without adjusting the stack
8479 pointer.  The flag @option{-mno-red-zone} disables this red zone.
8480
8481 @item -mcmodel=small
8482 @opindex mcmodel=small
8483 Generate code for the small code model: the program and its symbols must
8484 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8485 Programs can be statically or dynamically linked.  This is the default
8486 code model.
8487
8488 @item -mcmodel=kernel
8489 @opindex mcmodel=kernel
8490 Generate code for the kernel code model.  The kernel runs in the
8491 negative 2 GB of the address space.
8492 This model has to be used for Linux kernel code.
8493
8494 @item -mcmodel=medium
8495 @opindex mcmodel=medium
8496 Generate code for the medium model: The program is linked in the lower 2
8497 GB of the address space but symbols can be located anywhere in the
8498 address space.  Programs can be statically or dynamically linked, but
8499 building of shared libraries are not supported with the medium model.
8500
8501 @item -mcmodel=large
8502 @opindex mcmodel=large
8503 Generate code for the large model: This model makes no assumptions
8504 about addresses and sizes of sections.  Currently GCC does not implement
8505 this model.
8506 @end table
8507
8508 @node HPPA Options
8509 @subsection HPPA Options
8510 @cindex HPPA Options
8511
8512 These @samp{-m} options are defined for the HPPA family of computers:
8513
8514 @table @gcctabopt
8515 @item -march=@var{architecture-type}
8516 @opindex march
8517 Generate code for the specified architecture.  The choices for
8518 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8519 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8520 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8521 architecture option for your machine.  Code compiled for lower numbered
8522 architectures will run on higher numbered architectures, but not the
8523 other way around.
8524
8525 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
8526 next release of binutils (current is 2.9.1) will probably contain PA 2.0
8527 support.
8528
8529 @item -mpa-risc-1-0
8530 @itemx -mpa-risc-1-1
8531 @itemx -mpa-risc-2-0
8532 @opindex mpa-risc-1-0
8533 @opindex mpa-risc-1-1
8534 @opindex mpa-risc-2-0
8535 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8536
8537 @item -mbig-switch
8538 @opindex mbig-switch
8539 Generate code suitable for big switch tables.  Use this option only if
8540 the assembler/linker complain about out of range branches within a switch
8541 table.
8542
8543 @item -mjump-in-delay
8544 @opindex mjump-in-delay
8545 Fill delay slots of function calls with unconditional jump instructions
8546 by modifying the return pointer for the function call to be the target
8547 of the conditional jump.
8548
8549 @item -mdisable-fpregs
8550 @opindex mdisable-fpregs
8551 Prevent floating point registers from being used in any manner.  This is
8552 necessary for compiling kernels which perform lazy context switching of
8553 floating point registers.  If you use this option and attempt to perform
8554 floating point operations, the compiler will abort.
8555
8556 @item -mdisable-indexing
8557 @opindex mdisable-indexing
8558 Prevent the compiler from using indexing address modes.  This avoids some
8559 rather obscure problems when compiling MIG generated code under MACH@.
8560
8561 @item -mno-space-regs
8562 @opindex mno-space-regs
8563 Generate code that assumes the target has no space registers.  This allows
8564 GCC to generate faster indirect calls and use unscaled index address modes.
8565
8566 Such code is suitable for level 0 PA systems and kernels.
8567
8568 @item -mfast-indirect-calls
8569 @opindex mfast-indirect-calls
8570 Generate code that assumes calls never cross space boundaries.  This
8571 allows GCC to emit code which performs faster indirect calls.
8572
8573 This option will not work in the presence of shared libraries or nested
8574 functions.
8575
8576 @item -mlong-load-store
8577 @opindex mlong-load-store
8578 Generate 3-instruction load and store sequences as sometimes required by
8579 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8580 the HP compilers.
8581
8582 @item -mportable-runtime
8583 @opindex mportable-runtime
8584 Use the portable calling conventions proposed by HP for ELF systems.
8585
8586 @item -mgas
8587 @opindex mgas
8588 Enable the use of assembler directives only GAS understands.
8589
8590 @item -mschedule=@var{cpu-type}
8591 @opindex mschedule
8592 Schedule code according to the constraints for the machine type
8593 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8594 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8595 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8596 proper scheduling option for your machine.  The default scheduling is
8597 @samp{8000}.
8598
8599 @item -mlinker-opt
8600 @opindex mlinker-opt
8601 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8602 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8603 linkers in which they give bogus error messages when linking some programs.
8604
8605 @item -msoft-float
8606 @opindex msoft-float
8607 Generate output containing library calls for floating point.
8608 @strong{Warning:} the requisite libraries are not available for all HPPA
8609 targets.  Normally the facilities of the machine's usual C compiler are
8610 used, but this cannot be done directly in cross-compilation.  You must make
8611 your own arrangements to provide suitable library functions for
8612 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8613 does provide software floating point support.
8614
8615 @option{-msoft-float} changes the calling convention in the output file;
8616 therefore, it is only useful if you compile @emph{all} of a program with
8617 this option.  In particular, you need to compile @file{libgcc.a}, the
8618 library that comes with GCC, with @option{-msoft-float} in order for
8619 this to work.
8620
8621 @item -msio
8622 @opindex msio
8623 Generate the predefine, @code{_SIO}, for server IO.  The default is
8624 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8625 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8626 options are available under HP-UX and HI-UX.
8627
8628 @item -mgnu-ld
8629 @opindex gnu-ld
8630 Use GNU ld specific options.  This passes @option{-shared} to ld when
8631 building a shared library.  It is the default when GCC is configured,
8632 explicitly or implicitly, with the GNU linker.  This option does not
8633 have any affect on which ld is called, it only changes what parameters
8634 are passed to that ld.  The ld that is called is determined by the
8635 @option{--with-ld} configure option, gcc's program search path, and
8636 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8637 using @samp{which `gcc -print-prog-name=ld`}.
8638
8639 @item -mhp-ld
8640 @opindex hp-ld
8641 Use HP ld specific options.  This passes @option{-b} to ld when building
8642 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8643 links.  It is the default when GCC is configured, explicitly or
8644 implicitly, with the HP linker.  This option does not have any affect on
8645 which ld is called, it only changes what parameters are passed to that
8646 ld.  The ld that is called is determined by the @option{--with-ld}
8647 configure option, gcc's program search path, and finally by the user's
8648 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8649 `gcc -print-prog-name=ld`}.
8650
8651 @item -mlong-calls
8652 @opindex mno-long-calls
8653 Generate code that uses long call sequences.  This ensures that a call
8654 is always able to reach linker generated stubs.  The default is to generate
8655 long calls only when the distance from the call site to the beginning
8656 of the function or translation unit, as the case may be, exceeds a
8657 predefined limit set by the branch type being used.  The limits for
8658 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8659 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8660 240,000 bytes.
8661
8662 Distances are measured from the beginning of functions when using the
8663 @option{-ffunction-sections} option, or when using the @option{-mgas}
8664 and @option{-mno-portable-runtime} options together under HP-UX with
8665 the SOM linker.
8666
8667 It is normally not desirable to use this option as it will degrade
8668 performance.  However, it may be useful in large applications,
8669 particularly when partial linking is used to build the application.
8670
8671 The types of long calls used depends on the capabilities of the
8672 assembler and linker, and the type of code being generated.  The
8673 impact on systems that support long absolute calls, and long pic
8674 symbol-difference or pc-relative calls should be relatively small.
8675 However, an indirect call is used on 32-bit ELF systems in pic code
8676 and it is quite long.
8677
8678 @item -nolibdld
8679 @opindex nolibdld
8680 Suppress the generation of link options to search libdld.sl when the
8681 @option{-static} option is specified on HP-UX 10 and later.
8682
8683 @item -static
8684 @opindex static
8685 The HP-UX implementation of setlocale in libc has a dependency on
8686 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8687 when the @option{-static} option is specified, special link options
8688 are needed to resolve this dependency.
8689
8690 On HP-UX 10 and later, the GCC driver adds the necessary options to
8691 link with libdld.sl when the @option{-static} option is specified.
8692 This causes the resulting binary to be dynamic.  On the 64-bit port,
8693 the linkers generate dynamic binaries by default in any case.  The
8694 @option{-nolibdld} option can be used to prevent the GCC driver from
8695 adding these link options.
8696
8697 @item -threads
8698 @opindex threads
8699 Add support for multithreading with the @dfn{dce thread} library
8700 under HP-UX.  This option sets flags for both the preprocessor and
8701 linker.
8702 @end table
8703
8704 @node DEC Alpha Options
8705 @subsection DEC Alpha Options
8706
8707 These @samp{-m} options are defined for the DEC Alpha implementations:
8708
8709 @table @gcctabopt
8710 @item -mno-soft-float
8711 @itemx -msoft-float
8712 @opindex mno-soft-float
8713 @opindex msoft-float
8714 Use (do not use) the hardware floating-point instructions for
8715 floating-point operations.  When @option{-msoft-float} is specified,
8716 functions in @file{libgcc.a} will be used to perform floating-point
8717 operations.  Unless they are replaced by routines that emulate the
8718 floating-point operations, or compiled in such a way as to call such
8719 emulations routines, these routines will issue floating-point
8720 operations.   If you are compiling for an Alpha without floating-point
8721 operations, you must ensure that the library is built so as not to call
8722 them.
8723
8724 Note that Alpha implementations without floating-point operations are
8725 required to have floating-point registers.
8726
8727 @item -mfp-reg
8728 @itemx -mno-fp-regs
8729 @opindex mfp-reg
8730 @opindex mno-fp-regs
8731 Generate code that uses (does not use) the floating-point register set.
8732 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8733 register set is not used, floating point operands are passed in integer
8734 registers as if they were integers and floating-point results are passed
8735 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8736 so any function with a floating-point argument or return value called by code
8737 compiled with @option{-mno-fp-regs} must also be compiled with that
8738 option.
8739
8740 A typical use of this option is building a kernel that does not use,
8741 and hence need not save and restore, any floating-point registers.
8742
8743 @item -mieee
8744 @opindex mieee
8745 The Alpha architecture implements floating-point hardware optimized for
8746 maximum performance.  It is mostly compliant with the IEEE floating
8747 point standard.  However, for full compliance, software assistance is
8748 required.  This option generates code fully IEEE compliant code
8749 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8750 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8751 defined during compilation.  The resulting code is less efficient but is
8752 able to correctly support denormalized numbers and exceptional IEEE
8753 values such as not-a-number and plus/minus infinity.  Other Alpha
8754 compilers call this option @option{-ieee_with_no_inexact}.
8755
8756 @item -mieee-with-inexact
8757 @opindex mieee-with-inexact
8758 This is like @option{-mieee} except the generated code also maintains
8759 the IEEE @var{inexact-flag}.  Turning on this option causes the
8760 generated code to implement fully-compliant IEEE math.  In addition to
8761 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8762 macro.  On some Alpha implementations the resulting code may execute
8763 significantly slower than the code generated by default.  Since there is
8764 very little code that depends on the @var{inexact-flag}, you should
8765 normally not specify this option.  Other Alpha compilers call this
8766 option @option{-ieee_with_inexact}.
8767
8768 @item -mfp-trap-mode=@var{trap-mode}
8769 @opindex mfp-trap-mode
8770 This option controls what floating-point related traps are enabled.
8771 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8772 The trap mode can be set to one of four values:
8773
8774 @table @samp
8775 @item n
8776 This is the default (normal) setting.  The only traps that are enabled
8777 are the ones that cannot be disabled in software (e.g., division by zero
8778 trap).
8779
8780 @item u
8781 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8782 as well.
8783
8784 @item su
8785 Like @samp{su}, but the instructions are marked to be safe for software
8786 completion (see Alpha architecture manual for details).
8787
8788 @item sui
8789 Like @samp{su}, but inexact traps are enabled as well.
8790 @end table
8791
8792 @item -mfp-rounding-mode=@var{rounding-mode}
8793 @opindex mfp-rounding-mode
8794 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8795 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8796 of:
8797
8798 @table @samp
8799 @item n
8800 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8801 the nearest machine number or towards the even machine number in case
8802 of a tie.
8803
8804 @item m
8805 Round towards minus infinity.
8806
8807 @item c
8808 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8809
8810 @item d
8811 Dynamic rounding mode.  A field in the floating point control register
8812 (@var{fpcr}, see Alpha architecture reference manual) controls the
8813 rounding mode in effect.  The C library initializes this register for
8814 rounding towards plus infinity.  Thus, unless your program modifies the
8815 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8816 @end table
8817
8818 @item -mtrap-precision=@var{trap-precision}
8819 @opindex mtrap-precision
8820 In the Alpha architecture, floating point traps are imprecise.  This
8821 means without software assistance it is impossible to recover from a
8822 floating trap and program execution normally needs to be terminated.
8823 GCC can generate code that can assist operating system trap handlers
8824 in determining the exact location that caused a floating point trap.
8825 Depending on the requirements of an application, different levels of
8826 precisions can be selected:
8827
8828 @table @samp
8829 @item p
8830 Program precision.  This option is the default and means a trap handler
8831 can only identify which program caused a floating point exception.
8832
8833 @item f
8834 Function precision.  The trap handler can determine the function that
8835 caused a floating point exception.
8836
8837 @item i
8838 Instruction precision.  The trap handler can determine the exact
8839 instruction that caused a floating point exception.
8840 @end table
8841
8842 Other Alpha compilers provide the equivalent options called
8843 @option{-scope_safe} and @option{-resumption_safe}.
8844
8845 @item -mieee-conformant
8846 @opindex mieee-conformant
8847 This option marks the generated code as IEEE conformant.  You must not
8848 use this option unless you also specify @option{-mtrap-precision=i} and either
8849 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8850 is to emit the line @samp{.eflag 48} in the function prologue of the
8851 generated assembly file.  Under DEC Unix, this has the effect that
8852 IEEE-conformant math library routines will be linked in.
8853
8854 @item -mbuild-constants
8855 @opindex mbuild-constants
8856 Normally GCC examines a 32- or 64-bit integer constant to
8857 see if it can construct it from smaller constants in two or three
8858 instructions.  If it cannot, it will output the constant as a literal and
8859 generate code to load it from the data segment at runtime.
8860
8861 Use this option to require GCC to construct @emph{all} integer constants
8862 using code, even if it takes more instructions (the maximum is six).
8863
8864 You would typically use this option to build a shared library dynamic
8865 loader.  Itself a shared library, it must relocate itself in memory
8866 before it can find the variables and constants in its own data segment.
8867
8868 @item -malpha-as
8869 @itemx -mgas
8870 @opindex malpha-as
8871 @opindex mgas
8872 Select whether to generate code to be assembled by the vendor-supplied
8873 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8874
8875 @item -mbwx
8876 @itemx -mno-bwx
8877 @itemx -mcix
8878 @itemx -mno-cix
8879 @itemx -mfix
8880 @itemx -mno-fix
8881 @itemx -mmax
8882 @itemx -mno-max
8883 @opindex mbwx
8884 @opindex mno-bwx
8885 @opindex mcix
8886 @opindex mno-cix
8887 @opindex mfix
8888 @opindex mno-fix
8889 @opindex mmax
8890 @opindex mno-max
8891 Indicate whether GCC should generate code to use the optional BWX,
8892 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8893 sets supported by the CPU type specified via @option{-mcpu=} option or that
8894 of the CPU on which GCC was built if none was specified.
8895
8896 @item -mfloat-vax
8897 @itemx -mfloat-ieee
8898 @opindex mfloat-vax
8899 @opindex mfloat-ieee
8900 Generate code that uses (does not use) VAX F and G floating point
8901 arithmetic instead of IEEE single and double precision.
8902
8903 @item -mexplicit-relocs
8904 @itemx -mno-explicit-relocs
8905 @opindex mexplicit-relocs
8906 @opindex mno-explicit-relocs
8907 Older Alpha assemblers provided no way to generate symbol relocations
8908 except via assembler macros.  Use of these macros does not allow
8909 optimal instruction scheduling.  GNU binutils as of version 2.12
8910 supports a new syntax that allows the compiler to explicitly mark
8911 which relocations should apply to which instructions.  This option
8912 is mostly useful for debugging, as GCC detects the capabilities of
8913 the assembler when it is built and sets the default accordingly.
8914
8915 @item -msmall-data
8916 @itemx -mlarge-data
8917 @opindex msmall-data
8918 @opindex mlarge-data
8919 When @option{-mexplicit-relocs} is in effect, static data is
8920 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8921 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8922 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8923 16-bit relocations off of the @code{$gp} register.  This limits the
8924 size of the small data area to 64KB, but allows the variables to be
8925 directly accessed via a single instruction.
8926
8927 The default is @option{-mlarge-data}.  With this option the data area
8928 is limited to just below 2GB.  Programs that require more than 2GB of
8929 data must use @code{malloc} or @code{mmap} to allocate the data in the
8930 heap instead of in the program's data segment.
8931
8932 When generating code for shared libraries, @option{-fpic} implies
8933 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8934
8935 @item -msmall-text
8936 @itemx -mlarge-text
8937 @opindex msmall-text
8938 @opindex mlarge-text
8939 When @option{-msmall-text} is used, the compiler assumes that the
8940 code of the entire program (or shared library) fits in 4MB, and is
8941 thus reachable with a branch instruction.  When @option{-msmall-data}
8942 is used, the compiler can assume that all local symbols share the
8943 same @code{$gp} value, and thus reduce the number of instructions
8944 required for a function call from 4 to 1.
8945
8946 The default is @option{-mlarge-text}.
8947
8948 @item -mcpu=@var{cpu_type}
8949 @opindex mcpu
8950 Set the instruction set and instruction scheduling parameters for
8951 machine type @var{cpu_type}.  You can specify either the @samp{EV}
8952 style name or the corresponding chip number.  GCC supports scheduling
8953 parameters for the EV4, EV5 and EV6 family of processors and will
8954 choose the default values for the instruction set from the processor
8955 you specify.  If you do not specify a processor type, GCC will default
8956 to the processor on which the compiler was built.
8957
8958 Supported values for @var{cpu_type} are
8959
8960 @table @samp
8961 @item ev4
8962 @itemx ev45
8963 @itemx 21064
8964 Schedules as an EV4 and has no instruction set extensions.
8965
8966 @item ev5
8967 @itemx 21164
8968 Schedules as an EV5 and has no instruction set extensions.
8969
8970 @item ev56
8971 @itemx 21164a
8972 Schedules as an EV5 and supports the BWX extension.
8973
8974 @item pca56
8975 @itemx 21164pc
8976 @itemx 21164PC
8977 Schedules as an EV5 and supports the BWX and MAX extensions.
8978
8979 @item ev6
8980 @itemx 21264
8981 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8982
8983 @item ev67
8984 @itemx 21264a
8985 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8986 @end table
8987
8988 @item -mtune=@var{cpu_type}
8989 @opindex mtune
8990 Set only the instruction scheduling parameters for machine type
8991 @var{cpu_type}.  The instruction set is not changed.
8992
8993 @item -mmemory-latency=@var{time}
8994 @opindex mmemory-latency
8995 Sets the latency the scheduler should assume for typical memory
8996 references as seen by the application.  This number is highly
8997 dependent on the memory access patterns used by the application
8998 and the size of the external cache on the machine.
8999
9000 Valid options for @var{time} are
9001
9002 @table @samp
9003 @item @var{number}
9004 A decimal number representing clock cycles.
9005
9006 @item L1
9007 @itemx L2
9008 @itemx L3
9009 @itemx main
9010 The compiler contains estimates of the number of clock cycles for
9011 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9012 (also called Dcache, Scache, and Bcache), as well as to main memory.
9013 Note that L3 is only valid for EV5.
9014
9015 @end table
9016 @end table
9017
9018 @node DEC Alpha/VMS Options
9019 @subsection DEC Alpha/VMS Options
9020
9021 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9022
9023 @table @gcctabopt
9024 @item -mvms-return-codes
9025 @opindex mvms-return-codes
9026 Return VMS condition codes from main.  The default is to return POSIX
9027 style condition (e.g.@ error) codes.
9028 @end table
9029
9030 @node H8/300 Options
9031 @subsection H8/300 Options
9032
9033 These @samp{-m} options are defined for the H8/300 implementations:
9034
9035 @table @gcctabopt
9036 @item -mrelax
9037 @opindex mrelax
9038 Shorten some address references at link time, when possible; uses the
9039 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
9040 ld, Using ld}, for a fuller description.
9041
9042 @item -mh
9043 @opindex mh
9044 Generate code for the H8/300H@.
9045
9046 @item -ms
9047 @opindex ms
9048 Generate code for the H8S@.
9049
9050 @item -mn
9051 @opindex mn
9052 Generate code for the H8S and H8/300H in the normal mode.  This switch
9053 must be used either with -mh or -ms.
9054
9055 @item -ms2600
9056 @opindex ms2600
9057 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
9058
9059 @item -mint32
9060 @opindex mint32
9061 Make @code{int} data 32 bits by default.
9062
9063 @item -malign-300
9064 @opindex malign-300
9065 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9066 The default for the H8/300H and H8S is to align longs and floats on 4
9067 byte boundaries.
9068 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9069 This option has no effect on the H8/300.
9070 @end table
9071
9072 @node SH Options
9073 @subsection SH Options
9074
9075 These @samp{-m} options are defined for the SH implementations:
9076
9077 @table @gcctabopt
9078 @item -m1
9079 @opindex m1
9080 Generate code for the SH1.
9081
9082 @item -m2
9083 @opindex m2
9084 Generate code for the SH2.
9085
9086 @item -m2e
9087 Generate code for the SH2e.
9088
9089 @item -m3
9090 @opindex m3
9091 Generate code for the SH3.
9092
9093 @item -m3e
9094 @opindex m3e
9095 Generate code for the SH3e.
9096
9097 @item -m4-nofpu
9098 @opindex m4-nofpu
9099 Generate code for the SH4 without a floating-point unit.
9100
9101 @item -m4-single-only
9102 @opindex m4-single-only
9103 Generate code for the SH4 with a floating-point unit that only
9104 supports single-precision arithmetic.
9105
9106 @item -m4-single
9107 @opindex m4-single
9108 Generate code for the SH4 assuming the floating-point unit is in
9109 single-precision mode by default.
9110
9111 @item -m4
9112 @opindex m4
9113 Generate code for the SH4.
9114
9115 @item -mb
9116 @opindex mb
9117 Compile code for the processor in big endian mode.
9118
9119 @item -ml
9120 @opindex ml
9121 Compile code for the processor in little endian mode.
9122
9123 @item -mdalign
9124 @opindex mdalign
9125 Align doubles at 64-bit boundaries.  Note that this changes the calling
9126 conventions, and thus some functions from the standard C library will
9127 not work unless you recompile it first with @option{-mdalign}.
9128
9129 @item -mrelax
9130 @opindex mrelax
9131 Shorten some address references at link time, when possible; uses the
9132 linker option @option{-relax}.
9133
9134 @item -mbigtable
9135 @opindex mbigtable
9136 Use 32-bit offsets in @code{switch} tables.  The default is to use
9137 16-bit offsets.
9138
9139 @item -mfmovd
9140 @opindex mfmovd
9141 Enable the use of the instruction @code{fmovd}.
9142
9143 @item -mhitachi
9144 @opindex mhitachi
9145 Comply with the calling conventions defined by Renesas.
9146
9147 @item -mnomacsave
9148 @opindex mnomacsave
9149 Mark the @code{MAC} register as call-clobbered, even if
9150 @option{-mhitachi} is given.
9151
9152 @item -mieee
9153 @opindex mieee
9154 Increase IEEE-compliance of floating-point code.
9155
9156 @item -misize
9157 @opindex misize
9158 Dump instruction size and location in the assembly code.
9159
9160 @item -mpadstruct
9161 @opindex mpadstruct
9162 This option is deprecated.  It pads structures to multiple of 4 bytes,
9163 which is incompatible with the SH ABI@.
9164
9165 @item -mspace
9166 @opindex mspace
9167 Optimize for space instead of speed.  Implied by @option{-Os}.
9168
9169 @item -mprefergot
9170 @opindex mprefergot
9171 When generating position-independent code, emit function calls using
9172 the Global Offset Table instead of the Procedure Linkage Table.
9173
9174 @item -musermode
9175 @opindex musermode
9176 Generate a library function call to invalidate instruction cache
9177 entries, after fixing up a trampoline.  This library function call
9178 doesn't assume it can write to the whole memory address space.  This
9179 is the default when the target is @code{sh-*-linux*}.
9180 @end table
9181
9182 @node System V Options
9183 @subsection Options for System V
9184
9185 These additional options are available on System V Release 4 for
9186 compatibility with other compilers on those systems:
9187
9188 @table @gcctabopt
9189 @item -G
9190 @opindex G
9191 Create a shared object.
9192 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
9193
9194 @item -Qy
9195 @opindex Qy
9196 Identify the versions of each tool used by the compiler, in a
9197 @code{.ident} assembler directive in the output.
9198
9199 @item -Qn
9200 @opindex Qn
9201 Refrain from adding @code{.ident} directives to the output file (this is
9202 the default).
9203
9204 @item -YP,@var{dirs}
9205 @opindex YP
9206 Search the directories @var{dirs}, and no others, for libraries
9207 specified with @option{-l}.
9208
9209 @item -Ym,@var{dir}
9210 @opindex Ym
9211 Look in the directory @var{dir} to find the M4 preprocessor.
9212 The assembler uses this option.
9213 @c This is supposed to go with a -Yd for predefined M4 macro files, but
9214 @c the generic assembler that comes with Solaris takes just -Ym.
9215 @end table
9216
9217 @node TMS320C3x/C4x Options
9218 @subsection TMS320C3x/C4x Options
9219 @cindex TMS320C3x/C4x Options
9220
9221 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
9222
9223 @table @gcctabopt
9224
9225 @item -mcpu=@var{cpu_type}
9226 @opindex mcpu
9227 Set the instruction set, register set, and instruction scheduling
9228 parameters for machine type @var{cpu_type}.  Supported values for
9229 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
9230 @samp{c44}.  The default is @samp{c40} to generate code for the
9231 TMS320C40.
9232
9233 @item -mbig-memory
9234 @itemx -mbig
9235 @itemx -msmall-memory
9236 @itemx -msmall
9237 @opindex mbig-memory
9238 @opindex mbig
9239 @opindex msmall-memory
9240 @opindex msmall
9241 Generates code for the big or small memory model.  The small memory
9242 model assumed that all data fits into one 64K word page.  At run-time
9243 the data page (DP) register must be set to point to the 64K page
9244 containing the .bss and .data program sections.  The big memory model is
9245 the default and requires reloading of the DP register for every direct
9246 memory access.
9247
9248 @item -mbk
9249 @itemx -mno-bk
9250 @opindex mbk
9251 @opindex mno-bk
9252 Allow (disallow) allocation of general integer operands into the block
9253 count register BK@.
9254
9255 @item -mdb
9256 @itemx -mno-db
9257 @opindex mdb
9258 @opindex mno-db
9259 Enable (disable) generation of code using decrement and branch,
9260 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
9261 on the safe side, this is disabled for the C3x, since the maximum
9262 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
9263 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
9264 that it can utilize the decrement and branch instruction, but will give
9265 up if there is more than one memory reference in the loop.  Thus a loop
9266 where the loop counter is decremented can generate slightly more
9267 efficient code, in cases where the RPTB instruction cannot be utilized.
9268
9269 @item -mdp-isr-reload
9270 @itemx -mparanoid
9271 @opindex mdp-isr-reload
9272 @opindex mparanoid
9273 Force the DP register to be saved on entry to an interrupt service
9274 routine (ISR), reloaded to point to the data section, and restored on
9275 exit from the ISR@.  This should not be required unless someone has
9276 violated the small memory model by modifying the DP register, say within
9277 an object library.
9278
9279 @item -mmpyi
9280 @itemx -mno-mpyi
9281 @opindex mmpyi
9282 @opindex mno-mpyi
9283 For the C3x use the 24-bit MPYI instruction for integer multiplies
9284 instead of a library call to guarantee 32-bit results.  Note that if one
9285 of the operands is a constant, then the multiplication will be performed
9286 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
9287 then squaring operations are performed inline instead of a library call.
9288
9289 @item -mfast-fix
9290 @itemx -mno-fast-fix
9291 @opindex mfast-fix
9292 @opindex mno-fast-fix
9293 The C3x/C4x FIX instruction to convert a floating point value to an
9294 integer value chooses the nearest integer less than or equal to the
9295 floating point value rather than to the nearest integer.  Thus if the
9296 floating point number is negative, the result will be incorrectly
9297 truncated an additional code is necessary to detect and correct this
9298 case.  This option can be used to disable generation of the additional
9299 code required to correct the result.
9300
9301 @item -mrptb
9302 @itemx -mno-rptb
9303 @opindex mrptb
9304 @opindex mno-rptb
9305 Enable (disable) generation of repeat block sequences using the RPTB
9306 instruction for zero overhead looping.  The RPTB construct is only used
9307 for innermost loops that do not call functions or jump across the loop
9308 boundaries.  There is no advantage having nested RPTB loops due to the
9309 overhead required to save and restore the RC, RS, and RE registers.
9310 This is enabled by default with @option{-O2}.
9311
9312 @item -mrpts=@var{count}
9313 @itemx -mno-rpts
9314 @opindex mrpts
9315 @opindex mno-rpts
9316 Enable (disable) the use of the single instruction repeat instruction
9317 RPTS@.  If a repeat block contains a single instruction, and the loop
9318 count can be guaranteed to be less than the value @var{count}, GCC will
9319 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
9320 then a RPTS will be emitted even if the loop count cannot be determined
9321 at compile time.  Note that the repeated instruction following RPTS does
9322 not have to be reloaded from memory each iteration, thus freeing up the
9323 CPU buses for operands.  However, since interrupts are blocked by this
9324 instruction, it is disabled by default.
9325
9326 @item -mloop-unsigned
9327 @itemx -mno-loop-unsigned
9328 @opindex mloop-unsigned
9329 @opindex mno-loop-unsigned
9330 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
9331 is @math{2^{31} + 1} since these instructions test if the iteration count is
9332 negative to terminate the loop.  If the iteration count is unsigned
9333 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
9334 exceeded.  This switch allows an unsigned iteration count.
9335
9336 @item -mti
9337 @opindex mti
9338 Try to emit an assembler syntax that the TI assembler (asm30) is happy
9339 with.  This also enforces compatibility with the API employed by the TI
9340 C3x C compiler.  For example, long doubles are passed as structures
9341 rather than in floating point registers.
9342
9343 @item -mregparm
9344 @itemx -mmemparm
9345 @opindex mregparm
9346 @opindex mmemparm
9347 Generate code that uses registers (stack) for passing arguments to functions.
9348 By default, arguments are passed in registers where possible rather
9349 than by pushing arguments on to the stack.
9350
9351 @item -mparallel-insns
9352 @itemx -mno-parallel-insns
9353 @opindex mparallel-insns
9354 @opindex mno-parallel-insns
9355 Allow the generation of parallel instructions.  This is enabled by
9356 default with @option{-O2}.
9357
9358 @item -mparallel-mpy
9359 @itemx -mno-parallel-mpy
9360 @opindex mparallel-mpy
9361 @opindex mno-parallel-mpy
9362 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
9363 provided @option{-mparallel-insns} is also specified.  These instructions have
9364 tight register constraints which can pessimize the code generation
9365 of large functions.
9366
9367 @end table
9368
9369 @node V850 Options
9370 @subsection V850 Options
9371 @cindex V850 Options
9372
9373 These @samp{-m} options are defined for V850 implementations:
9374
9375 @table @gcctabopt
9376 @item -mlong-calls
9377 @itemx -mno-long-calls
9378 @opindex mlong-calls
9379 @opindex mno-long-calls
9380 Treat all calls as being far away (near).  If calls are assumed to be
9381 far away, the compiler will always load the functions address up into a
9382 register, and call indirect through the pointer.
9383
9384 @item -mno-ep
9385 @itemx -mep
9386 @opindex mno-ep
9387 @opindex mep
9388 Do not optimize (do optimize) basic blocks that use the same index
9389 pointer 4 or more times to copy pointer into the @code{ep} register, and
9390 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
9391 option is on by default if you optimize.
9392
9393 @item -mno-prolog-function
9394 @itemx -mprolog-function
9395 @opindex mno-prolog-function
9396 @opindex mprolog-function
9397 Do not use (do use) external functions to save and restore registers
9398 at the prologue and epilogue of a function.  The external functions
9399 are slower, but use less code space if more than one function saves
9400 the same number of registers.  The @option{-mprolog-function} option
9401 is on by default if you optimize.
9402
9403 @item -mspace
9404 @opindex mspace
9405 Try to make the code as small as possible.  At present, this just turns
9406 on the @option{-mep} and @option{-mprolog-function} options.
9407
9408 @item -mtda=@var{n}
9409 @opindex mtda
9410 Put static or global variables whose size is @var{n} bytes or less into
9411 the tiny data area that register @code{ep} points to.  The tiny data
9412 area can hold up to 256 bytes in total (128 bytes for byte references).
9413
9414 @item -msda=@var{n}
9415 @opindex msda
9416 Put static or global variables whose size is @var{n} bytes or less into
9417 the small data area that register @code{gp} points to.  The small data
9418 area can hold up to 64 kilobytes.
9419
9420 @item -mzda=@var{n}
9421 @opindex mzda
9422 Put static or global variables whose size is @var{n} bytes or less into
9423 the first 32 kilobytes of memory.
9424
9425 @item -mv850
9426 @opindex mv850
9427 Specify that the target processor is the V850.
9428
9429 @item -mbig-switch
9430 @opindex mbig-switch
9431 Generate code suitable for big switch tables.  Use this option only if
9432 the assembler/linker complain about out of range branches within a switch
9433 table.
9434
9435 @item -mapp-regs
9436 @opindex mapp-regs
9437 This option will cause r2 and r5 to be used in the code generated by
9438 the compiler.  This setting is the default.
9439
9440 @item -mno-app-regs
9441 @opindex mno-app-regs
9442 This option will cause r2 and r5 to be treated as fixed registers.
9443
9444 @item -mv850e1
9445 @opindex mv850e1
9446 Specify that the target processor is the V850E1.  The preprocessor
9447 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
9448 this option is used.
9449
9450 @item -mv850e
9451 @opindex mv850e
9452 Specify that the target processor is the V850E.  The preprocessor
9453 constant @samp{__v850e__} will be defined if this option is used.
9454
9455 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
9456 are defined then a default target processor will be chosen and the
9457 relevant @samp{__v850*__} preprocessor constant will be defined.
9458
9459 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9460 defined, regardless of which processor variant is the target.
9461
9462 @item -mdisable-callt
9463 @opindex mdisable-callt
9464 This option will suppress generation of the CALLT instruction for the
9465 v850e and v850e1 flavors of the v850 architecture.  The default is
9466 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
9467
9468 @end table
9469
9470 @node ARC Options
9471 @subsection ARC Options
9472 @cindex ARC Options
9473
9474 These options are defined for ARC implementations:
9475
9476 @table @gcctabopt
9477 @item -EL
9478 @opindex EL
9479 Compile code for little endian mode.  This is the default.
9480
9481 @item -EB
9482 @opindex EB
9483 Compile code for big endian mode.
9484
9485 @item -mmangle-cpu
9486 @opindex mmangle-cpu
9487 Prepend the name of the cpu to all public symbol names.
9488 In multiple-processor systems, there are many ARC variants with different
9489 instruction and register set characteristics.  This flag prevents code
9490 compiled for one cpu to be linked with code compiled for another.
9491 No facility exists for handling variants that are ``almost identical''.
9492 This is an all or nothing option.
9493
9494 @item -mcpu=@var{cpu}
9495 @opindex mcpu
9496 Compile code for ARC variant @var{cpu}.
9497 Which variants are supported depend on the configuration.
9498 All variants support @option{-mcpu=base}, this is the default.
9499
9500 @item -mtext=@var{text-section}
9501 @itemx -mdata=@var{data-section}
9502 @itemx -mrodata=@var{readonly-data-section}
9503 @opindex mtext
9504 @opindex mdata
9505 @opindex mrodata
9506 Put functions, data, and readonly data in @var{text-section},
9507 @var{data-section}, and @var{readonly-data-section} respectively
9508 by default.  This can be overridden with the @code{section} attribute.
9509 @xref{Variable Attributes}.
9510
9511 @end table
9512
9513 @node NS32K Options
9514 @subsection NS32K Options
9515 @cindex NS32K options
9516
9517 These are the @samp{-m} options defined for the 32000 series.  The default
9518 values for these options depends on which style of 32000 was selected when
9519 the compiler was configured; the defaults for the most common choices are
9520 given below.
9521
9522 @table @gcctabopt
9523 @item -m32032
9524 @itemx -m32032
9525 @opindex m32032
9526 @opindex m32032
9527 Generate output for a 32032.  This is the default
9528 when the compiler is configured for 32032 and 32016 based systems.
9529
9530 @item -m32332
9531 @itemx -m32332
9532 @opindex m32332
9533 @opindex m32332
9534 Generate output for a 32332.  This is the default
9535 when the compiler is configured for 32332-based systems.
9536
9537 @item -m32532
9538 @itemx -m32532
9539 @opindex m32532
9540 @opindex m32532
9541 Generate output for a 32532.  This is the default
9542 when the compiler is configured for 32532-based systems.
9543
9544 @item -m32081
9545 @opindex m32081
9546 Generate output containing 32081 instructions for floating point.
9547 This is the default for all systems.
9548
9549 @item -m32381
9550 @opindex m32381
9551 Generate output containing 32381 instructions for floating point.  This
9552 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9553 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9554
9555 @item -mmulti-add
9556 @opindex mmulti-add
9557 Try and generate multiply-add floating point instructions @code{polyF}
9558 and @code{dotF}.  This option is only available if the @option{-m32381}
9559 option is in effect.  Using these instructions requires changes to
9560 register allocation which generally has a negative impact on
9561 performance.  This option should only be enabled when compiling code
9562 particularly likely to make heavy use of multiply-add instructions.
9563
9564 @item -mnomulti-add
9565 @opindex mnomulti-add
9566 Do not try and generate multiply-add floating point instructions
9567 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9568
9569 @item -msoft-float
9570 @opindex msoft-float
9571 Generate output containing library calls for floating point.
9572 @strong{Warning:} the requisite libraries may not be available.
9573
9574 @item -mieee-compare
9575 @itemx -mno-ieee-compare
9576 @opindex mieee-compare
9577 @opindex mno-ieee-compare
9578 Control whether or not the compiler uses IEEE floating point
9579 comparisons.  These handle correctly the case where the result of a
9580 comparison is unordered.
9581 @strong{Warning:} the requisite kernel support may not be available.
9582
9583 @item -mnobitfield
9584 @opindex mnobitfield
9585 Do not use the bit-field instructions.  On some machines it is faster to
9586 use shifting and masking operations.  This is the default for the pc532.
9587
9588 @item -mbitfield
9589 @opindex mbitfield
9590 Do use the bit-field instructions.  This is the default for all platforms
9591 except the pc532.
9592
9593 @item -mrtd
9594 @opindex mrtd
9595 Use a different function-calling convention, in which functions
9596 that take a fixed number of arguments return pop their
9597 arguments on return with the @code{ret} instruction.
9598
9599 This calling convention is incompatible with the one normally
9600 used on Unix, so you cannot use it if you need to call libraries
9601 compiled with the Unix compiler.
9602
9603 Also, you must provide function prototypes for all functions that
9604 take variable numbers of arguments (including @code{printf});
9605 otherwise incorrect code will be generated for calls to those
9606 functions.
9607
9608 In addition, seriously incorrect code will result if you call a
9609 function with too many arguments.  (Normally, extra arguments are
9610 harmlessly ignored.)
9611
9612 This option takes its name from the 680x0 @code{rtd} instruction.
9613
9614
9615 @item -mregparam
9616 @opindex mregparam
9617 Use a different function-calling convention where the first two arguments
9618 are passed in registers.
9619
9620 This calling convention is incompatible with the one normally
9621 used on Unix, so you cannot use it if you need to call libraries
9622 compiled with the Unix compiler.
9623
9624 @item -mnoregparam
9625 @opindex mnoregparam
9626 Do not pass any arguments in registers.  This is the default for all
9627 targets.
9628
9629 @item -msb
9630 @opindex msb
9631 It is OK to use the sb as an index register which is always loaded with
9632 zero.  This is the default for the pc532-netbsd target.
9633
9634 @item -mnosb
9635 @opindex mnosb
9636 The sb register is not available for use or has not been initialized to
9637 zero by the run time system.  This is the default for all targets except
9638 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9639 @option{-fpic} is set.
9640
9641 @item -mhimem
9642 @opindex mhimem
9643 Many ns32000 series addressing modes use displacements of up to 512MB@.
9644 If an address is above 512MB then displacements from zero can not be used.
9645 This option causes code to be generated which can be loaded above 512MB@.
9646 This may be useful for operating systems or ROM code.
9647
9648 @item -mnohimem
9649 @opindex mnohimem
9650 Assume code will be loaded in the first 512MB of virtual address space.
9651 This is the default for all platforms.
9652
9653
9654 @end table
9655
9656 @node AVR Options
9657 @subsection AVR Options
9658 @cindex AVR Options
9659
9660 These options are defined for AVR implementations:
9661
9662 @table @gcctabopt
9663 @item -mmcu=@var{mcu}
9664 @opindex mmcu
9665 Specify ATMEL AVR instruction set or MCU type.
9666
9667 Instruction set avr1 is for the minimal AVR core, not supported by the C
9668 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9669 attiny11, attiny12, attiny15, attiny28).
9670
9671 Instruction set avr2 (default) is for the classic AVR core with up to
9672 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9673 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9674 at90c8534, at90s8535).
9675
9676 Instruction set avr3 is for the classic AVR core with up to 128K program
9677 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9678
9679 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9680 memory space (MCU types: atmega8, atmega83, atmega85).
9681
9682 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9683 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9684 atmega64, atmega128, at43usb355, at94k).
9685
9686 @item -msize
9687 @opindex msize
9688 Output instruction sizes to the asm file.
9689
9690 @item -minit-stack=@var{N}
9691 @opindex minit-stack
9692 Specify the initial stack address, which may be a symbol or numeric value,
9693 @samp{__stack} is the default.
9694
9695 @item -mno-interrupts
9696 @opindex mno-interrupts
9697 Generated code is not compatible with hardware interrupts.
9698 Code size will be smaller.
9699
9700 @item -mcall-prologues
9701 @opindex mcall-prologues
9702 Functions prologues/epilogues expanded as call to appropriate
9703 subroutines.  Code size will be smaller.
9704
9705 @item -mno-tablejump
9706 @opindex mno-tablejump
9707 Do not generate tablejump insns which sometimes increase code size.
9708
9709 @item -mtiny-stack
9710 @opindex mtiny-stack
9711 Change only the low 8 bits of the stack pointer.
9712 @end table
9713
9714 @node MCore Options
9715 @subsection MCore Options
9716 @cindex MCore options
9717
9718 These are the @samp{-m} options defined for the Motorola M*Core
9719 processors.
9720
9721 @table @gcctabopt
9722
9723 @item -mhardlit
9724 @itemx -mno-hardlit
9725 @opindex mhardlit
9726 @opindex mno-hardlit
9727 Inline constants into the code stream if it can be done in two
9728 instructions or less.
9729
9730 @item -mdiv
9731 @itemx -mno-div
9732 @opindex mdiv
9733 @opindex mno-div
9734 Use the divide instruction.  (Enabled by default).
9735
9736 @item -mrelax-immediate
9737 @itemx -mno-relax-immediate
9738 @opindex mrelax-immediate
9739 @opindex mno-relax-immediate
9740 Allow arbitrary sized immediates in bit operations.
9741
9742 @item -mwide-bitfields
9743 @itemx -mno-wide-bitfields
9744 @opindex mwide-bitfields
9745 @opindex mno-wide-bitfields
9746 Always treat bit-fields as int-sized.
9747
9748 @item -m4byte-functions
9749 @itemx -mno-4byte-functions
9750 @opindex m4byte-functions
9751 @opindex mno-4byte-functions
9752 Force all functions to be aligned to a four byte boundary.
9753
9754 @item -mcallgraph-data
9755 @itemx -mno-callgraph-data
9756 @opindex mcallgraph-data
9757 @opindex mno-callgraph-data
9758 Emit callgraph information.
9759
9760 @item -mslow-bytes
9761 @itemx -mno-slow-bytes
9762 @opindex mslow-bytes
9763 @opindex mno-slow-bytes
9764 Prefer word access when reading byte quantities.
9765
9766 @item -mlittle-endian
9767 @itemx -mbig-endian
9768 @opindex mlittle-endian
9769 @opindex mbig-endian
9770 Generate code for a little endian target.
9771
9772 @item -m210
9773 @itemx -m340
9774 @opindex m210
9775 @opindex m340
9776 Generate code for the 210 processor.
9777 @end table
9778
9779 @node IA-64 Options
9780 @subsection IA-64 Options
9781 @cindex IA-64 Options
9782
9783 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9784
9785 @table @gcctabopt
9786 @item -mbig-endian
9787 @opindex mbig-endian
9788 Generate code for a big endian target.  This is the default for HP-UX@.
9789
9790 @item -mlittle-endian
9791 @opindex mlittle-endian
9792 Generate code for a little endian target.  This is the default for AIX5
9793 and GNU/Linux.
9794
9795 @item -mgnu-as
9796 @itemx -mno-gnu-as
9797 @opindex mgnu-as
9798 @opindex mno-gnu-as
9799 Generate (or don't) code for the GNU assembler.  This is the default.
9800 @c Also, this is the default if the configure option @option{--with-gnu-as}
9801 @c is used.
9802
9803 @item -mgnu-ld
9804 @itemx -mno-gnu-ld
9805 @opindex mgnu-ld
9806 @opindex mno-gnu-ld
9807 Generate (or don't) code for the GNU linker.  This is the default.
9808 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9809 @c is used.
9810
9811 @item -mno-pic
9812 @opindex mno-pic
9813 Generate code that does not use a global pointer register.  The result
9814 is not position independent code, and violates the IA-64 ABI@.
9815
9816 @item -mvolatile-asm-stop
9817 @itemx -mno-volatile-asm-stop
9818 @opindex mvolatile-asm-stop
9819 @opindex mno-volatile-asm-stop
9820 Generate (or don't) a stop bit immediately before and after volatile asm
9821 statements.
9822
9823 @item -mb-step
9824 @opindex mb-step
9825 Generate code that works around Itanium B step errata.
9826
9827 @item -mregister-names
9828 @itemx -mno-register-names
9829 @opindex mregister-names
9830 @opindex mno-register-names
9831 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9832 the stacked registers.  This may make assembler output more readable.
9833
9834 @item -mno-sdata
9835 @itemx -msdata
9836 @opindex mno-sdata
9837 @opindex msdata
9838 Disable (or enable) optimizations that use the small data section.  This may
9839 be useful for working around optimizer bugs.
9840
9841 @item -mconstant-gp
9842 @opindex mconstant-gp
9843 Generate code that uses a single constant global pointer value.  This is
9844 useful when compiling kernel code.
9845
9846 @item -mauto-pic
9847 @opindex mauto-pic
9848 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9849 This is useful when compiling firmware code.
9850
9851 @item -minline-float-divide-min-latency
9852 @opindex minline-float-divide-min-latency
9853 Generate code for inline divides of floating point values
9854 using the minimum latency algorithm.
9855
9856 @item -minline-float-divide-max-throughput
9857 @opindex minline-float-divide-max-throughput
9858 Generate code for inline divides of floating point values
9859 using the maximum throughput algorithm.
9860
9861 @item -minline-int-divide-min-latency
9862 @opindex minline-int-divide-min-latency
9863 Generate code for inline divides of integer values
9864 using the minimum latency algorithm.
9865
9866 @item -minline-int-divide-max-throughput
9867 @opindex minline-int-divide-max-throughput
9868 Generate code for inline divides of integer values
9869 using the maximum throughput algorithm.
9870
9871 @item -mno-dwarf2-asm
9872 @itemx -mdwarf2-asm
9873 @opindex mno-dwarf2-asm
9874 @opindex mdwarf2-asm
9875 Don't (or do) generate assembler code for the DWARF2 line number debugging
9876 info.  This may be useful when not using the GNU assembler.
9877
9878 @item -mfixed-range=@var{register-range}
9879 @opindex mfixed-range
9880 Generate code treating the given register range as fixed registers.
9881 A fixed register is one that the register allocator can not use.  This is
9882 useful when compiling kernel code.  A register range is specified as
9883 two registers separated by a dash.  Multiple register ranges can be
9884 specified separated by a comma.
9885
9886 @item -mearly-stop-bits
9887 @itemx -mno-early-stop-bits
9888 @opindex mearly-stop-bits
9889 @opindex mno-early-stop-bits
9890 Allow stop bits to be placed earlier than immediately preceding the
9891 instruction that triggered the stop bit.  This can improve instruction
9892 scheduling, but does not always do so.
9893 @end table
9894
9895 @node S/390 and zSeries Options
9896 @subsection S/390 and zSeries Options
9897 @cindex S/390 and zSeries Options
9898
9899 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9900
9901 @table @gcctabopt
9902 @item -mhard-float
9903 @itemx -msoft-float
9904 @opindex mhard-float
9905 @opindex msoft-float
9906 Use (do not use) the hardware floating-point instructions and registers
9907 for floating-point operations.  When @option{-msoft-float} is specified,
9908 functions in @file{libgcc.a} will be used to perform floating-point
9909 operations.  When @option{-mhard-float} is specified, the compiler
9910 generates IEEE floating-point instructions.  This is the default.
9911
9912 @item -mbackchain
9913 @itemx -mno-backchain
9914 @opindex mbackchain
9915 @opindex mno-backchain
9916 Generate (or do not generate) code which maintains an explicit
9917 backchain within the stack frame that points to the caller's frame.
9918 This may be needed to allow debugging using tools that do not understand
9919 DWARF-2 call frame information.  The default is not to generate the
9920 backchain.
9921
9922 @item -msmall-exec
9923 @itemx -mno-small-exec
9924 @opindex msmall-exec
9925 @opindex mno-small-exec
9926 Generate (or do not generate) code using the @code{bras} instruction
9927 to do subroutine calls.
9928 This only works reliably if the total executable size does not
9929 exceed 64k.  The default is to use the @code{basr} instruction instead,
9930 which does not have this limitation.
9931
9932 @item -m64
9933 @itemx -m31
9934 @opindex m64
9935 @opindex m31
9936 When @option{-m31} is specified, generate code compliant to the
9937 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
9938 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
9939 particular to generate 64-bit instructions.  For the @samp{s390}
9940 targets, the default is @option{-m31}, while the @samp{s390x}
9941 targets default to @option{-m64}.
9942
9943 @item -mzarch
9944 @itemx -mesa
9945 @opindex mzarch
9946 @opindex mesa
9947 When @option{-mzarch} is specified, generate code using the
9948 instructions available on z/Architecture.
9949 When @option{-mesa} is specified, generate code using the
9950 instructions available on ESA/390. Note that @option{-mesa} is
9951 not possible with @option{-m64}.
9952 When generating code compliant to the GNU/Linux for S/390 ABI,
9953 the default is @option{-mesa}.  When generating code compliant
9954 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
9955
9956 @item -mmvcle
9957 @itemx -mno-mvcle
9958 @opindex mmvcle
9959 @opindex mno-mvcle
9960 Generate (or do not generate) code using the @code{mvcle} instruction
9961 to perform block moves.  When @option{-mno-mvcle} is specified,
9962 use a @code{mvc} loop instead.  This is the default.
9963
9964 @item -mdebug
9965 @itemx -mno-debug
9966 @opindex mdebug
9967 @opindex mno-debug
9968 Print (or do not print) additional debug information when compiling.
9969 The default is to not print debug information.
9970
9971 @item -march=@var{cpu-type}
9972 @opindex march
9973 Generate code that will run on @var{cpu-type}, which is the name of a system
9974 representing a certain processor type. Possible values for
9975 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
9976 When generating code using the instructions available on z/Architecture,
9977 the default is @option{-march=z900}.  Otherwise, the default is
9978 @option{-march=g5}.
9979
9980 @item -mtune=@var{cpu-type}
9981 @opindex mtune
9982 Tune to @var{cpu-type} everything applicable about the generated code,
9983 except for the ABI and the set of available instructions.
9984 The list of @var{cpu-type} values is the same as for @option{-march}.
9985 The default is the value used for @option{-march}.
9986
9987 @item -mfused-madd
9988 @itemx -mno-fused-madd
9989 @opindex mfused-madd
9990 @opindex mno-fused-madd
9991 Generate code that uses (does not use) the floating point multiply and
9992 accumulate instructions.  These instructions are generated by default if
9993 hardware floating point is used.
9994 @end table
9995
9996 @node CRIS Options
9997 @subsection CRIS Options
9998 @cindex CRIS Options
9999
10000 These options are defined specifically for the CRIS ports.
10001
10002 @table @gcctabopt
10003 @item -march=@var{architecture-type}
10004 @itemx -mcpu=@var{architecture-type}
10005 @opindex march
10006 @opindex mcpu
10007 Generate code for the specified architecture.  The choices for
10008 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10009 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
10010 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10011 @samp{v10}.
10012
10013 @item -mtune=@var{architecture-type}
10014 @opindex mtune
10015 Tune to @var{architecture-type} everything applicable about the generated
10016 code, except for the ABI and the set of available instructions.  The
10017 choices for @var{architecture-type} are the same as for
10018 @option{-march=@var{architecture-type}}.
10019
10020 @item -mmax-stack-frame=@var{n}
10021 @opindex mmax-stack-frame
10022 Warn when the stack frame of a function exceeds @var{n} bytes.
10023
10024 @item -melinux-stacksize=@var{n}
10025 @opindex melinux-stacksize
10026 Only available with the @samp{cris-axis-aout} target.  Arranges for
10027 indications in the program to the kernel loader that the stack of the
10028 program should be set to @var{n} bytes.
10029
10030 @item -metrax4
10031 @itemx -metrax100
10032 @opindex metrax4
10033 @opindex metrax100
10034 The options @option{-metrax4} and @option{-metrax100} are synonyms for
10035 @option{-march=v3} and @option{-march=v8} respectively.
10036
10037 @item -mpdebug
10038 @opindex mpdebug
10039 Enable CRIS-specific verbose debug-related information in the assembly
10040 code.  This option also has the effect to turn off the @samp{#NO_APP}
10041 formatted-code indicator to the assembler at the beginning of the
10042 assembly file.
10043
10044 @item -mcc-init
10045 @opindex mcc-init
10046 Do not use condition-code results from previous instruction; always emit
10047 compare and test instructions before use of condition codes.
10048
10049 @item -mno-side-effects
10050 @opindex mno-side-effects
10051 Do not emit instructions with side-effects in addressing modes other than
10052 post-increment.
10053
10054 @item -mstack-align
10055 @itemx -mno-stack-align
10056 @itemx -mdata-align
10057 @itemx -mno-data-align
10058 @itemx -mconst-align
10059 @itemx -mno-const-align
10060 @opindex mstack-align
10061 @opindex mno-stack-align
10062 @opindex mdata-align
10063 @opindex mno-data-align
10064 @opindex mconst-align
10065 @opindex mno-const-align
10066 These options (no-options) arranges (eliminate arrangements) for the
10067 stack-frame, individual data and constants to be aligned for the maximum
10068 single data access size for the chosen CPU model.  The default is to
10069 arrange for 32-bit alignment.  ABI details such as structure layout are
10070 not affected by these options.
10071
10072 @item -m32-bit
10073 @itemx -m16-bit
10074 @itemx -m8-bit
10075 @opindex m32-bit
10076 @opindex m16-bit
10077 @opindex m8-bit
10078 Similar to the stack- data- and const-align options above, these options
10079 arrange for stack-frame, writable data and constants to all be 32-bit,
10080 16-bit or 8-bit aligned.  The default is 32-bit alignment.
10081
10082 @item -mno-prologue-epilogue
10083 @itemx -mprologue-epilogue
10084 @opindex mno-prologue-epilogue
10085 @opindex mprologue-epilogue
10086 With @option{-mno-prologue-epilogue}, the normal function prologue and
10087 epilogue that sets up the stack-frame are omitted and no return
10088 instructions or return sequences are generated in the code.  Use this
10089 option only together with visual inspection of the compiled code: no
10090 warnings or errors are generated when call-saved registers must be saved,
10091 or storage for local variable needs to be allocated.
10092
10093 @item -mno-gotplt
10094 @itemx -mgotplt
10095 @opindex mno-gotplt
10096 @opindex mgotplt
10097 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10098 instruction sequences that load addresses for functions from the PLT part
10099 of the GOT rather than (traditional on other architectures) calls to the
10100 PLT.  The default is @option{-mgotplt}.
10101
10102 @item -maout
10103 @opindex maout
10104 Legacy no-op option only recognized with the cris-axis-aout target.
10105
10106 @item -melf
10107 @opindex melf
10108 Legacy no-op option only recognized with the cris-axis-elf and
10109 cris-axis-linux-gnu targets.
10110
10111 @item -melinux
10112 @opindex melinux
10113 Only recognized with the cris-axis-aout target, where it selects a
10114 GNU/linux-like multilib, include files and instruction set for
10115 @option{-march=v8}.
10116
10117 @item -mlinux
10118 @opindex mlinux
10119 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10120
10121 @item -sim
10122 @opindex sim
10123 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
10124 to link with input-output functions from a simulator library.  Code,
10125 initialized data and zero-initialized data are allocated consecutively.
10126
10127 @item -sim2
10128 @opindex sim2
10129 Like @option{-sim}, but pass linker options to locate initialized data at
10130 0x40000000 and zero-initialized data at 0x80000000.
10131 @end table
10132
10133 @node MMIX Options
10134 @subsection MMIX Options
10135 @cindex MMIX Options
10136
10137 These options are defined for the MMIX:
10138
10139 @table @gcctabopt
10140 @item -mlibfuncs
10141 @itemx -mno-libfuncs
10142 @opindex mlibfuncs
10143 @opindex mno-libfuncs
10144 Specify that intrinsic library functions are being compiled, passing all
10145 values in registers, no matter the size.
10146
10147 @item -mepsilon
10148 @itemx -mno-epsilon
10149 @opindex mepsilon
10150 @opindex mno-epsilon
10151 Generate floating-point comparison instructions that compare with respect
10152 to the @code{rE} epsilon register.
10153
10154 @item -mabi=mmixware
10155 @itemx -mabi=gnu
10156 @opindex mabi-mmixware
10157 @opindex mabi=gnu
10158 Generate code that passes function parameters and return values that (in
10159 the called function) are seen as registers @code{$0} and up, as opposed to
10160 the GNU ABI which uses global registers @code{$231} and up.
10161
10162 @item -mzero-extend
10163 @itemx -mno-zero-extend
10164 @opindex mzero-extend
10165 @opindex mno-zero-extend
10166 When reading data from memory in sizes shorter than 64 bits, use (do not
10167 use) zero-extending load instructions by default, rather than
10168 sign-extending ones.
10169
10170 @item -mknuthdiv
10171 @itemx -mno-knuthdiv
10172 @opindex mknuthdiv
10173 @opindex mno-knuthdiv
10174 Make the result of a division yielding a remainder have the same sign as
10175 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10176 remainder follows the sign of the dividend.  Both methods are
10177 arithmetically valid, the latter being almost exclusively used.
10178
10179 @item -mtoplevel-symbols
10180 @itemx -mno-toplevel-symbols
10181 @opindex mtoplevel-symbols
10182 @opindex mno-toplevel-symbols
10183 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10184 code can be used with the @code{PREFIX} assembly directive.
10185
10186 @item -melf
10187 @opindex melf
10188 Generate an executable in the ELF format, rather than the default
10189 @samp{mmo} format used by the @command{mmix} simulator.
10190
10191 @item -mbranch-predict
10192 @itemx -mno-branch-predict
10193 @opindex mbranch-predict
10194 @opindex mno-branch-predict
10195 Use (do not use) the probable-branch instructions, when static branch
10196 prediction indicates a probable branch.
10197
10198 @item -mbase-addresses
10199 @itemx -mno-base-addresses
10200 @opindex mbase-addresses
10201 @opindex mno-base-addresses
10202 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10203 base address automatically generates a request (handled by the assembler
10204 and the linker) for a constant to be set up in a global register.  The
10205 register is used for one or more base address requests within the range 0
10206 to 255 from the value held in the register.  The generally leads to short
10207 and fast code, but the number of different data items that can be
10208 addressed is limited.  This means that a program that uses lots of static
10209 data may require @option{-mno-base-addresses}.
10210
10211 @item -msingle-exit
10212 @itemx -mno-single-exit
10213 @opindex msingle-exit
10214 @opindex mno-single-exit
10215 Force (do not force) generated code to have a single exit point in each
10216 function.
10217 @end table
10218
10219 @node PDP-11 Options
10220 @subsection PDP-11 Options
10221 @cindex PDP-11 Options
10222
10223 These options are defined for the PDP-11:
10224
10225 @table @gcctabopt
10226 @item -mfpu
10227 @opindex mfpu
10228 Use hardware FPP floating point.  This is the default.  (FIS floating
10229 point on the PDP-11/40 is not supported.)
10230
10231 @item -msoft-float
10232 @opindex msoft-float
10233 Do not use hardware floating point.
10234
10235 @item -mac0
10236 @opindex mac0
10237 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10238
10239 @item -mno-ac0
10240 @opindex mno-ac0
10241 Return floating-point results in memory.  This is the default.
10242
10243 @item -m40
10244 @opindex m40
10245 Generate code for a PDP-11/40.
10246
10247 @item -m45
10248 @opindex m45
10249 Generate code for a PDP-11/45.  This is the default.
10250
10251 @item -m10
10252 @opindex m10
10253 Generate code for a PDP-11/10.
10254
10255 @item -mbcopy-builtin
10256 @opindex bcopy-builtin
10257 Use inline @code{movstrhi} patterns for copying memory.  This is the
10258 default.
10259
10260 @item -mbcopy
10261 @opindex mbcopy
10262 Do not use inline @code{movstrhi} patterns for copying memory.
10263
10264 @item -mint16
10265 @itemx -mno-int32
10266 @opindex mint16
10267 @opindex mno-int32
10268 Use 16-bit @code{int}.  This is the default.
10269
10270 @item -mint32
10271 @itemx -mno-int16
10272 @opindex mint32
10273 @opindex mno-int16
10274 Use 32-bit @code{int}.
10275
10276 @item -mfloat64
10277 @itemx -mno-float32
10278 @opindex mfloat64
10279 @opindex mno-float32
10280 Use 64-bit @code{float}.  This is the default.
10281
10282 @item -mfloat32
10283 @itemx -mno-float64
10284 @opindex mfloat32
10285 @opindex mno-float64
10286 Use 32-bit @code{float}.
10287
10288 @item -mabshi
10289 @opindex mabshi
10290 Use @code{abshi2} pattern.  This is the default.
10291
10292 @item -mno-abshi
10293 @opindex mno-abshi
10294 Do not use @code{abshi2} pattern.
10295
10296 @item -mbranch-expensive
10297 @opindex mbranch-expensive
10298 Pretend that branches are expensive.  This is for experimenting with
10299 code generation only.
10300
10301 @item -mbranch-cheap
10302 @opindex mbranch-cheap
10303 Do not pretend that branches are expensive.  This is the default.
10304
10305 @item -msplit
10306 @opindex msplit
10307 Generate code for a system with split I&D.
10308
10309 @item -mno-split
10310 @opindex mno-split
10311 Generate code for a system without split I&D.  This is the default.
10312
10313 @item -munix-asm
10314 @opindex munix-asm
10315 Use Unix assembler syntax.  This is the default when configured for
10316 @samp{pdp11-*-bsd}.
10317
10318 @item -mdec-asm
10319 @opindex mdec-asm
10320 Use DEC assembler syntax.  This is the default when configured for any
10321 PDP-11 target other than @samp{pdp11-*-bsd}.
10322 @end table
10323
10324 @node Xstormy16 Options
10325 @subsection Xstormy16 Options
10326 @cindex Xstormy16 Options
10327
10328 These options are defined for Xstormy16:
10329
10330 @table @gcctabopt
10331 @item -msim
10332 @opindex msim
10333 Choose startup files and linker script suitable for the simulator.
10334 @end table
10335
10336 @node FRV Options
10337 @subsection FRV Options
10338 @cindex FRV Options
10339
10340 @table @gcctabopt
10341 @item -mgpr-32
10342 @opindex mgpr-32
10343
10344 Only use the first 32 general purpose registers.
10345
10346 @item -mgpr-64
10347 @opindex mgpr-64
10348
10349 Use all 64 general purpose registers.
10350
10351 @item -mfpr-32
10352 @opindex mfpr-32
10353
10354 Use only the first 32 floating point registers.
10355
10356 @item -mfpr-64
10357 @opindex mfpr-64
10358
10359 Use all 64 floating point registers
10360
10361 @item -mhard-float
10362 @opindex mhard-float
10363
10364 Use hardware instructions for floating point operations.
10365
10366 @item -msoft-float
10367 @opindex msoft-float
10368
10369 Use library routines for floating point operations.
10370
10371 @item -malloc-cc
10372 @opindex malloc-cc
10373
10374 Dynamically allocate condition code registers.
10375
10376 @item -mfixed-cc
10377 @opindex mfixed-cc
10378
10379 Do not try to dynamically allocate condition code registers, only
10380 use @code{icc0} and @code{fcc0}.
10381
10382 @item -mdword
10383 @opindex mdword
10384
10385 Change ABI to use double word insns.
10386
10387 @item -mno-dword
10388 @opindex mno-dword
10389
10390 Do not use double word instructions.
10391
10392 @item -mdouble
10393 @opindex mdouble
10394
10395 Use floating point double instructions.
10396
10397 @item -mno-double
10398 @opindex mno-double
10399
10400 Do not use floating point double instructions.
10401
10402 @item -mmedia
10403 @opindex mmedia
10404
10405 Use media instructions.
10406
10407 @item -mno-media
10408 @opindex mno-media
10409
10410 Do not use media instructions.
10411
10412 @item -mmuladd
10413 @opindex mmuladd
10414
10415 Use multiply and add/subtract instructions.
10416
10417 @item -mno-muladd
10418 @opindex mno-muladd
10419
10420 Do not use multiply and add/subtract instructions.
10421
10422 @item -mlibrary-pic
10423 @opindex mlibrary-pic
10424
10425 Enable PIC support for building libraries
10426
10427 @item -macc-4
10428 @opindex macc-4
10429
10430 Use only the first four media accumulator registers.
10431
10432 @item -macc-8
10433 @opindex macc-8
10434
10435 Use all eight media accumulator registers.
10436
10437 @item -mpack
10438 @opindex mpack
10439
10440 Pack VLIW instructions.
10441
10442 @item -mno-pack
10443 @opindex mno-pack
10444
10445 Do not pack VLIW instructions.
10446
10447 @item -mno-eflags
10448 @opindex mno-eflags
10449
10450 Do not mark ABI switches in e_flags.
10451
10452 @item -mcond-move
10453 @opindex mcond-move
10454
10455 Enable the use of conditional-move instructions (default).
10456
10457 This switch is mainly for debugging the compiler and will likely be removed
10458 in a future version.
10459
10460 @item -mno-cond-move
10461 @opindex mno-cond-move
10462
10463 Disable the use of conditional-move instructions.
10464
10465 This switch is mainly for debugging the compiler and will likely be removed
10466 in a future version.
10467
10468 @item -mscc
10469 @opindex mscc
10470
10471 Enable the use of conditional set instructions (default).
10472
10473 This switch is mainly for debugging the compiler and will likely be removed
10474 in a future version.
10475
10476 @item -mno-scc
10477 @opindex mno-scc
10478
10479 Disable the use of conditional set instructions.
10480
10481 This switch is mainly for debugging the compiler and will likely be removed
10482 in a future version.
10483
10484 @item -mcond-exec
10485 @opindex mcond-exec
10486
10487 Enable the use of conditional execution (default).
10488
10489 This switch is mainly for debugging the compiler and will likely be removed
10490 in a future version.
10491
10492 @item -mno-cond-exec
10493 @opindex mno-cond-exec
10494
10495 Disable the use of conditional execution.
10496
10497 This switch is mainly for debugging the compiler and will likely be removed
10498 in a future version.
10499
10500 @item -mvliw-branch
10501 @opindex mvliw-branch
10502
10503 Run a pass to pack branches into VLIW instructions (default).
10504
10505 This switch is mainly for debugging the compiler and will likely be removed
10506 in a future version.
10507
10508 @item -mno-vliw-branch
10509 @opindex mno-vliw-branch
10510
10511 Do not run a pass to pack branches into VLIW instructions.
10512
10513 This switch is mainly for debugging the compiler and will likely be removed
10514 in a future version.
10515
10516 @item -mmulti-cond-exec
10517 @opindex mmulti-cond-exec
10518
10519 Enable optimization of @code{&&} and @code{||} in conditional execution
10520 (default).
10521
10522 This switch is mainly for debugging the compiler and will likely be removed
10523 in a future version.
10524
10525 @item -mno-multi-cond-exec
10526 @opindex mno-multi-cond-exec
10527
10528 Disable optimization of @code{&&} and @code{||} in conditional execution.
10529
10530 This switch is mainly for debugging the compiler and will likely be removed
10531 in a future version.
10532
10533 @item -mnested-cond-exec
10534 @opindex mnested-cond-exec
10535
10536 Enable nested conditional execution optimizations (default).
10537
10538 This switch is mainly for debugging the compiler and will likely be removed
10539 in a future version.
10540
10541 @item -mno-nested-cond-exec
10542 @opindex mno-nested-cond-exec
10543
10544 Disable nested conditional execution optimizations.
10545
10546 This switch is mainly for debugging the compiler and will likely be removed
10547 in a future version.
10548
10549 @item -mtomcat-stats
10550 @opindex mtomcat-stats
10551
10552 Cause gas to print out tomcat statistics.
10553
10554 @item -mcpu=@var{cpu}
10555 @opindex mcpu
10556
10557 Select the processor type for which to generate code.  Possible values are
10558 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
10559 @samp{frv}.
10560
10561 @end table
10562
10563 @node Xtensa Options
10564 @subsection Xtensa Options
10565 @cindex Xtensa Options
10566
10567 These options are supported for Xtensa targets:
10568
10569 @table @gcctabopt
10570 @item -mconst16
10571 @itemx -mno-const16
10572 @opindex mconst16
10573 @opindex mno-const16
10574 Enable or disable use of @code{CONST16} instructions for loading
10575 constant values.  The @code{CONST16} instruction is currently not a
10576 standard option from Tensilica.  When enabled, @code{CONST16}
10577 instructions are always used in place of the standard @code{L32R}
10578 instructions.  The use of @code{CONST16} is enabled by default only if
10579 the @code{L32R} instruction is not available.
10580
10581 @item -mfused-madd
10582 @itemx -mno-fused-madd
10583 @opindex mfused-madd
10584 @opindex mno-fused-madd
10585 Enable or disable use of fused multiply/add and multiply/subtract
10586 instructions in the floating-point option.  This has no effect if the
10587 floating-point option is not also enabled.  Disabling fused multiply/add
10588 and multiply/subtract instructions forces the compiler to use separate
10589 instructions for the multiply and add/subtract operations.  This may be
10590 desirable in some cases where strict IEEE 754-compliant results are
10591 required: the fused multiply add/subtract instructions do not round the
10592 intermediate result, thereby producing results with @emph{more} bits of
10593 precision than specified by the IEEE standard.  Disabling fused multiply
10594 add/subtract instructions also ensures that the program output is not
10595 sensitive to the compiler's ability to combine multiply and add/subtract
10596 operations.
10597
10598 @item -mtext-section-literals
10599 @itemx -mno-text-section-literals
10600 @opindex mtext-section-literals
10601 @opindex mno-text-section-literals
10602 Control the treatment of literal pools.  The default is
10603 @option{-mno-text-section-literals}, which places literals in a separate
10604 section in the output file.  This allows the literal pool to be placed
10605 in a data RAM/ROM, and it also allows the linker to combine literal
10606 pools from separate object files to remove redundant literals and
10607 improve code size.  With @option{-mtext-section-literals}, the literals
10608 are interspersed in the text section in order to keep them as close as
10609 possible to their references.  This may be necessary for large assembly
10610 files.
10611
10612 @item -mtarget-align
10613 @itemx -mno-target-align
10614 @opindex mtarget-align
10615 @opindex mno-target-align
10616 When this option is enabled, GCC instructs the assembler to
10617 automatically align instructions to reduce branch penalties at the
10618 expense of some code density.  The assembler attempts to widen density
10619 instructions to align branch targets and the instructions following call
10620 instructions.  If there are not enough preceding safe density
10621 instructions to align a target, no widening will be performed.  The
10622 default is @option{-mtarget-align}.  These options do not affect the
10623 treatment of auto-aligned instructions like @code{LOOP}, which the
10624 assembler will always align, either by widening density instructions or
10625 by inserting no-op instructions.
10626
10627 @item -mlongcalls
10628 @itemx -mno-longcalls
10629 @opindex mlongcalls
10630 @opindex mno-longcalls
10631 When this option is enabled, GCC instructs the assembler to translate
10632 direct calls to indirect calls unless it can determine that the target
10633 of a direct call is in the range allowed by the call instruction.  This
10634 translation typically occurs for calls to functions in other source
10635 files.  Specifically, the assembler translates a direct @code{CALL}
10636 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
10637 The default is @option{-mno-longcalls}.  This option should be used in
10638 programs where the call target can potentially be out of range.  This
10639 option is implemented in the assembler, not the compiler, so the
10640 assembly code generated by GCC will still show direct call
10641 instructions---look at the disassembled object code to see the actual
10642 instructions.  Note that the assembler will use an indirect call for
10643 every cross-file call, not just those that really will be out of range.
10644 @end table
10645
10646 @node Code Gen Options
10647 @section Options for Code Generation Conventions
10648 @cindex code generation conventions
10649 @cindex options, code generation
10650 @cindex run-time options
10651
10652 These machine-independent options control the interface conventions
10653 used in code generation.
10654
10655 Most of them have both positive and negative forms; the negative form
10656 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
10657 one of the forms is listed---the one which is not the default.  You
10658 can figure out the other form by either removing @samp{no-} or adding
10659 it.
10660
10661 @table @gcctabopt
10662 @item -fbounds-check
10663 @opindex fbounds-check
10664 For front-ends that support it, generate additional code to check that
10665 indices used to access arrays are within the declared range.  This is
10666 currently only supported by the Java and Fortran 77 front-ends, where
10667 this option defaults to true and false respectively.
10668
10669 @item -ftrapv
10670 @opindex ftrapv
10671 This option generates traps for signed overflow on addition, subtraction,
10672 multiplication operations.
10673
10674 @item -fwrapv
10675 @opindex fwrapv
10676 This option instructs the compiler to assume that signed arithmetic
10677 overflow of addition, subtraction and multiplication wraps around
10678 using twos-complement representation.  This flag enables some optimizations
10679 and disables other.  This option is enabled by default for the Java
10680 front-end, as required by the Java language specification.
10681
10682 @item -fexceptions
10683 @opindex fexceptions
10684 Enable exception handling.  Generates extra code needed to propagate
10685 exceptions.  For some targets, this implies GCC will generate frame
10686 unwind information for all functions, which can produce significant data
10687 size overhead, although it does not affect execution.  If you do not
10688 specify this option, GCC will enable it by default for languages like
10689 C++ which normally require exception handling, and disable it for
10690 languages like C that do not normally require it.  However, you may need
10691 to enable this option when compiling C code that needs to interoperate
10692 properly with exception handlers written in C++.  You may also wish to
10693 disable this option if you are compiling older C++ programs that don't
10694 use exception handling.
10695
10696 @item -fnon-call-exceptions
10697 @opindex fnon-call-exceptions
10698 Generate code that allows trapping instructions to throw exceptions.
10699 Note that this requires platform-specific runtime support that does
10700 not exist everywhere.  Moreover, it only allows @emph{trapping}
10701 instructions to throw exceptions, i.e.@: memory references or floating
10702 point instructions.  It does not allow exceptions to be thrown from
10703 arbitrary signal handlers such as @code{SIGALRM}.
10704
10705 @item -funwind-tables
10706 @opindex funwind-tables
10707 Similar to @option{-fexceptions}, except that it will just generate any needed
10708 static data, but will not affect the generated code in any other way.
10709 You will normally not enable this option; instead, a language processor
10710 that needs this handling would enable it on your behalf.
10711
10712 @item -fasynchronous-unwind-tables
10713 @opindex funwind-tables
10714 Generate unwind table in dwarf2 format, if supported by target machine.  The
10715 table is exact at each instruction boundary, so it can be used for stack
10716 unwinding from asynchronous events (such as debugger or garbage collector).
10717
10718 @item -fpcc-struct-return
10719 @opindex fpcc-struct-return
10720 Return ``short'' @code{struct} and @code{union} values in memory like
10721 longer ones, rather than in registers.  This convention is less
10722 efficient, but it has the advantage of allowing intercallability between
10723 GCC-compiled files and files compiled with other compilers, particularly
10724 the Portable C Compiler (pcc).
10725
10726 The precise convention for returning structures in memory depends
10727 on the target configuration macros.
10728
10729 Short structures and unions are those whose size and alignment match
10730 that of some integer type.
10731
10732 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
10733 switch is not binary compatible with code compiled with the
10734 @option{-freg-struct-return} switch.
10735 Use it to conform to a non-default application binary interface.
10736
10737 @item -freg-struct-return
10738 @opindex freg-struct-return
10739 Return @code{struct} and @code{union} values in registers when possible.
10740 This is more efficient for small structures than
10741 @option{-fpcc-struct-return}.
10742
10743 If you specify neither @option{-fpcc-struct-return} nor
10744 @option{-freg-struct-return}, GCC defaults to whichever convention is
10745 standard for the target.  If there is no standard convention, GCC
10746 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
10747 the principal compiler.  In those cases, we can choose the standard, and
10748 we chose the more efficient register return alternative.
10749
10750 @strong{Warning:} code compiled with the @option{-freg-struct-return}
10751 switch is not binary compatible with code compiled with the
10752 @option{-fpcc-struct-return} switch.
10753 Use it to conform to a non-default application binary interface.
10754
10755 @item -fshort-enums
10756 @opindex fshort-enums
10757 Allocate to an @code{enum} type only as many bytes as it needs for the
10758 declared range of possible values.  Specifically, the @code{enum} type
10759 will be equivalent to the smallest integer type which has enough room.
10760
10761 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
10762 code that is not binary compatible with code generated without that switch.
10763 Use it to conform to a non-default application binary interface.
10764
10765 @item -fshort-double
10766 @opindex fshort-double
10767 Use the same size for @code{double} as for @code{float}.
10768
10769 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
10770 code that is not binary compatible with code generated without that switch.
10771 Use it to conform to a non-default application binary interface.
10772
10773 @item -fshort-wchar
10774 @opindex fshort-wchar
10775 Override the underlying type for @samp{wchar_t} to be @samp{short
10776 unsigned int} instead of the default for the target.  This option is
10777 useful for building programs to run under WINE@.
10778
10779 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
10780 code that is not binary compatible with code generated without that switch.
10781 Use it to conform to a non-default application binary interface.
10782
10783 @item -fshared-data
10784 @opindex fshared-data
10785 Requests that the data and non-@code{const} variables of this
10786 compilation be shared data rather than private data.  The distinction
10787 makes sense only on certain operating systems, where shared data is
10788 shared between processes running the same program, while private data
10789 exists in one copy per process.
10790
10791 @item -fno-common
10792 @opindex fno-common
10793 In C, allocate even uninitialized global variables in the data section of the
10794 object file, rather than generating them as common blocks.  This has the
10795 effect that if the same variable is declared (without @code{extern}) in
10796 two different compilations, you will get an error when you link them.
10797 The only reason this might be useful is if you wish to verify that the
10798 program will work on other systems which always work this way.
10799
10800 @item -fno-ident
10801 @opindex fno-ident
10802 Ignore the @samp{#ident} directive.
10803
10804 @item -finhibit-size-directive
10805 @opindex finhibit-size-directive
10806 Don't output a @code{.size} assembler directive, or anything else that
10807 would cause trouble if the function is split in the middle, and the
10808 two halves are placed at locations far apart in memory.  This option is
10809 used when compiling @file{crtstuff.c}; you should not need to use it
10810 for anything else.
10811
10812 @item -fverbose-asm
10813 @opindex fverbose-asm
10814 Put extra commentary information in the generated assembly code to
10815 make it more readable.  This option is generally only of use to those
10816 who actually need to read the generated assembly code (perhaps while
10817 debugging the compiler itself).
10818
10819 @option{-fno-verbose-asm}, the default, causes the
10820 extra information to be omitted and is useful when comparing two assembler
10821 files.
10822
10823 @item -fpic
10824 @opindex fpic
10825 @cindex global offset table
10826 @cindex PIC
10827 Generate position-independent code (PIC) suitable for use in a shared
10828 library, if supported for the target machine.  Such code accesses all
10829 constant addresses through a global offset table (GOT)@.  The dynamic
10830 loader resolves the GOT entries when the program starts (the dynamic
10831 loader is not part of GCC; it is part of the operating system).  If
10832 the GOT size for the linked executable exceeds a machine-specific
10833 maximum size, you get an error message from the linker indicating that
10834 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
10835 instead.  (These maximums are 8k on the SPARC and 32k
10836 on the m68k and RS/6000.  The 386 has no such limit.)
10837
10838 Position-independent code requires special support, and therefore works
10839 only on certain machines.  For the 386, GCC supports PIC for System V
10840 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
10841 position-independent.
10842
10843 @item -fPIC
10844 @opindex fPIC
10845 If supported for the target machine, emit position-independent code,
10846 suitable for dynamic linking and avoiding any limit on the size of the
10847 global offset table.  This option makes a difference on the m68k
10848 and the SPARC.
10849
10850 Position-independent code requires special support, and therefore works
10851 only on certain machines.
10852
10853 @item -fpie
10854 @itemx -fPIE
10855 @opindex fpie
10856 @opindex fPIE
10857 These options are similar to @option{-fpic} and @option{-fPIC}, but
10858 generated position independent code can be only linked into executables.
10859 Usually these options are used when @option{-pie} GCC option will be
10860 used during linking.
10861
10862 @item -ffixed-@var{reg}
10863 @opindex ffixed
10864 Treat the register named @var{reg} as a fixed register; generated code
10865 should never refer to it (except perhaps as a stack pointer, frame
10866 pointer or in some other fixed role).
10867
10868 @var{reg} must be the name of a register.  The register names accepted
10869 are machine-specific and are defined in the @code{REGISTER_NAMES}
10870 macro in the machine description macro file.
10871
10872 This flag does not have a negative form, because it specifies a
10873 three-way choice.
10874
10875 @item -fcall-used-@var{reg}
10876 @opindex fcall-used
10877 Treat the register named @var{reg} as an allocable register that is
10878 clobbered by function calls.  It may be allocated for temporaries or
10879 variables that do not live across a call.  Functions compiled this way
10880 will not save and restore the register @var{reg}.
10881
10882 It is an error to used this flag with the frame pointer or stack pointer.
10883 Use of this flag for other registers that have fixed pervasive roles in
10884 the machine's execution model will produce disastrous results.
10885
10886 This flag does not have a negative form, because it specifies a
10887 three-way choice.
10888
10889 @item -fcall-saved-@var{reg}
10890 @opindex fcall-saved
10891 Treat the register named @var{reg} as an allocable register saved by
10892 functions.  It may be allocated even for temporaries or variables that
10893 live across a call.  Functions compiled this way will save and restore
10894 the register @var{reg} if they use it.
10895
10896 It is an error to used this flag with the frame pointer or stack pointer.
10897 Use of this flag for other registers that have fixed pervasive roles in
10898 the machine's execution model will produce disastrous results.
10899
10900 A different sort of disaster will result from the use of this flag for
10901 a register in which function values may be returned.
10902
10903 This flag does not have a negative form, because it specifies a
10904 three-way choice.
10905
10906 @item -fpack-struct
10907 @opindex fpack-struct
10908 Pack all structure members together without holes.
10909
10910 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
10911 code that is not binary compatible with code generated without that switch.
10912 Additionally, it makes the code suboptimal.
10913 Use it to conform to a non-default application binary interface.
10914
10915 @item -finstrument-functions
10916 @opindex finstrument-functions
10917 Generate instrumentation calls for entry and exit to functions.  Just
10918 after function entry and just before function exit, the following
10919 profiling functions will be called with the address of the current
10920 function and its call site.  (On some platforms,
10921 @code{__builtin_return_address} does not work beyond the current
10922 function, so the call site information may not be available to the
10923 profiling functions otherwise.)
10924
10925 @smallexample
10926 void __cyg_profile_func_enter (void *this_fn,
10927                                void *call_site);
10928 void __cyg_profile_func_exit  (void *this_fn,
10929                                void *call_site);
10930 @end smallexample
10931
10932 The first argument is the address of the start of the current function,
10933 which may be looked up exactly in the symbol table.
10934
10935 This instrumentation is also done for functions expanded inline in other
10936 functions.  The profiling calls will indicate where, conceptually, the
10937 inline function is entered and exited.  This means that addressable
10938 versions of such functions must be available.  If all your uses of a
10939 function are expanded inline, this may mean an additional expansion of
10940 code size.  If you use @samp{extern inline} in your C code, an
10941 addressable version of such functions must be provided.  (This is
10942 normally the case anyways, but if you get lucky and the optimizer always
10943 expands the functions inline, you might have gotten away without
10944 providing static copies.)
10945
10946 A function may be given the attribute @code{no_instrument_function}, in
10947 which case this instrumentation will not be done.  This can be used, for
10948 example, for the profiling functions listed above, high-priority
10949 interrupt routines, and any functions from which the profiling functions
10950 cannot safely be called (perhaps signal handlers, if the profiling
10951 routines generate output or allocate memory).
10952
10953 @item -fstack-check
10954 @opindex fstack-check
10955 Generate code to verify that you do not go beyond the boundary of the
10956 stack.  You should specify this flag if you are running in an
10957 environment with multiple threads, but only rarely need to specify it in
10958 a single-threaded environment since stack overflow is automatically
10959 detected on nearly all systems if there is only one stack.
10960
10961 Note that this switch does not actually cause checking to be done; the
10962 operating system must do that.  The switch causes generation of code
10963 to ensure that the operating system sees the stack being extended.
10964
10965 @item -fstack-limit-register=@var{reg}
10966 @itemx -fstack-limit-symbol=@var{sym}
10967 @itemx -fno-stack-limit
10968 @opindex fstack-limit-register
10969 @opindex fstack-limit-symbol
10970 @opindex fno-stack-limit
10971 Generate code to ensure that the stack does not grow beyond a certain value,
10972 either the value of a register or the address of a symbol.  If the stack
10973 would grow beyond the value, a signal is raised.  For most targets,
10974 the signal is raised before the stack overruns the boundary, so
10975 it is possible to catch the signal without taking special precautions.
10976
10977 For instance, if the stack starts at absolute address @samp{0x80000000}
10978 and grows downwards, you can use the flags
10979 @option{-fstack-limit-symbol=__stack_limit} and
10980 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10981 of 128KB@.  Note that this may only work with the GNU linker.
10982
10983 @cindex aliasing of parameters
10984 @cindex parameters, aliased
10985 @item -fargument-alias
10986 @itemx -fargument-noalias
10987 @itemx -fargument-noalias-global
10988 @opindex fargument-alias
10989 @opindex fargument-noalias
10990 @opindex fargument-noalias-global
10991 Specify the possible relationships among parameters and between
10992 parameters and global data.
10993
10994 @option{-fargument-alias} specifies that arguments (parameters) may
10995 alias each other and may alias global storage.@*
10996 @option{-fargument-noalias} specifies that arguments do not alias
10997 each other, but may alias global storage.@*
10998 @option{-fargument-noalias-global} specifies that arguments do not
10999 alias each other and do not alias global storage.
11000
11001 Each language will automatically use whatever option is required by
11002 the language standard.  You should not need to use these options yourself.
11003
11004 @item -fleading-underscore
11005 @opindex fleading-underscore
11006 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11007 change the way C symbols are represented in the object file.  One use
11008 is to help link with legacy assembly code.
11009
11010 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11011 generate code that is not binary compatible with code generated without that
11012 switch.  Use it to conform to a non-default application binary interface.
11013 Not all targets provide complete support for this switch.
11014
11015 @item -ftls-model=@var{model}
11016 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11017 The @var{model} argument should be one of @code{global-dynamic},
11018 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11019
11020 The default without @option{-fpic} is @code{initial-exec}; with
11021 @option{-fpic} the default is @code{global-dynamic}.
11022 @end table
11023
11024 @c man end
11025
11026 @node Environment Variables
11027 @section Environment Variables Affecting GCC
11028 @cindex environment variables
11029
11030 @c man begin ENVIRONMENT
11031 This section describes several environment variables that affect how GCC
11032 operates.  Some of them work by specifying directories or prefixes to use
11033 when searching for various kinds of files.  Some are used to specify other
11034 aspects of the compilation environment.
11035
11036 Note that you can also specify places to search using options such as
11037 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
11038 take precedence over places specified using environment variables, which
11039 in turn take precedence over those specified by the configuration of GCC@.
11040 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11041 GNU Compiler Collection (GCC) Internals}.
11042
11043 @table @env
11044 @item LANG
11045 @itemx LC_CTYPE
11046 @c @itemx LC_COLLATE
11047 @itemx LC_MESSAGES
11048 @c @itemx LC_MONETARY
11049 @c @itemx LC_NUMERIC
11050 @c @itemx LC_TIME
11051 @itemx LC_ALL
11052 @findex LANG
11053 @findex LC_CTYPE
11054 @c @findex LC_COLLATE
11055 @findex LC_MESSAGES
11056 @c @findex LC_MONETARY
11057 @c @findex LC_NUMERIC
11058 @c @findex LC_TIME
11059 @findex LC_ALL
11060 @cindex locale
11061 These environment variables control the way that GCC uses
11062 localization information that allow GCC to work with different
11063 national conventions.  GCC inspects the locale categories
11064 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
11065 so.  These locale categories can be set to any value supported by your
11066 installation.  A typical value is @samp{en_UK} for English in the United
11067 Kingdom.
11068
11069 The @env{LC_CTYPE} environment variable specifies character
11070 classification.  GCC uses it to determine the character boundaries in
11071 a string; this is needed for some multibyte encodings that contain quote
11072 and escape characters that would otherwise be interpreted as a string
11073 end or escape.
11074
11075 The @env{LC_MESSAGES} environment variable specifies the language to
11076 use in diagnostic messages.
11077
11078 If the @env{LC_ALL} environment variable is set, it overrides the value
11079 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11080 and @env{LC_MESSAGES} default to the value of the @env{LANG}
11081 environment variable.  If none of these variables are set, GCC
11082 defaults to traditional C English behavior.
11083
11084 @item TMPDIR
11085 @findex TMPDIR
11086 If @env{TMPDIR} is set, it specifies the directory to use for temporary
11087 files.  GCC uses temporary files to hold the output of one stage of
11088 compilation which is to be used as input to the next stage: for example,
11089 the output of the preprocessor, which is the input to the compiler
11090 proper.
11091
11092 @item GCC_EXEC_PREFIX
11093 @findex GCC_EXEC_PREFIX
11094 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
11095 names of the subprograms executed by the compiler.  No slash is added
11096 when this prefix is combined with the name of a subprogram, but you can
11097 specify a prefix that ends with a slash if you wish.
11098
11099 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
11100 an appropriate prefix to use based on the pathname it was invoked with.
11101
11102 If GCC cannot find the subprogram using the specified prefix, it
11103 tries looking in the usual places for the subprogram.
11104
11105 The default value of @env{GCC_EXEC_PREFIX} is
11106 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
11107 of @code{prefix} when you ran the @file{configure} script.
11108
11109 Other prefixes specified with @option{-B} take precedence over this prefix.
11110
11111 This prefix is also used for finding files such as @file{crt0.o} that are
11112 used for linking.
11113
11114 In addition, the prefix is used in an unusual way in finding the
11115 directories to search for header files.  For each of the standard
11116 directories whose name normally begins with @samp{/usr/local/lib/gcc}
11117 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
11118 replacing that beginning with the specified prefix to produce an
11119 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
11120 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
11121 These alternate directories are searched first; the standard directories
11122 come next.
11123
11124 @item COMPILER_PATH
11125 @findex COMPILER_PATH
11126 The value of @env{COMPILER_PATH} is a colon-separated list of
11127 directories, much like @env{PATH}.  GCC tries the directories thus
11128 specified when searching for subprograms, if it can't find the
11129 subprograms using @env{GCC_EXEC_PREFIX}.
11130
11131 @item LIBRARY_PATH
11132 @findex LIBRARY_PATH
11133 The value of @env{LIBRARY_PATH} is a colon-separated list of
11134 directories, much like @env{PATH}.  When configured as a native compiler,
11135 GCC tries the directories thus specified when searching for special
11136 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
11137 using GCC also uses these directories when searching for ordinary
11138 libraries for the @option{-l} option (but directories specified with
11139 @option{-L} come first).
11140
11141 @item LANG
11142 @findex LANG
11143 @cindex locale definition
11144 This variable is used to pass locale information to the compiler.  One way in
11145 which this information is used is to determine the character set to be used
11146 when character literals, string literals and comments are parsed in C and C++.
11147 When the compiler is configured to allow multibyte characters,
11148 the following values for @env{LANG} are recognized:
11149
11150 @table @samp
11151 @item C-JIS
11152 Recognize JIS characters.
11153 @item C-SJIS
11154 Recognize SJIS characters.
11155 @item C-EUCJP
11156 Recognize EUCJP characters.
11157 @end table
11158
11159 If @env{LANG} is not defined, or if it has some other value, then the
11160 compiler will use mblen and mbtowc as defined by the default locale to
11161 recognize and translate multibyte characters.
11162 @end table
11163
11164 @noindent
11165 Some additional environments variables affect the behavior of the
11166 preprocessor.
11167
11168 @include cppenv.texi
11169
11170 @c man end
11171
11172 @node Precompiled Headers
11173 @section Using Precompiled Headers
11174 @cindex precompiled headers
11175 @cindex speed of compilation
11176
11177 Often large projects have many header files that are included in every
11178 source file.  The time the compiler takes to process these header files
11179 over and over again can account for nearly all of the time required to
11180 build the project.  To make builds faster, GCC allows users to
11181 `precompile' a header file; then, if builds can use the precompiled
11182 header file they will be much faster.
11183
11184 To create a precompiled header file, simply compile it as you would any
11185 other file, if necessary using the @option{-x} option to make the driver
11186 treat it as a C or C++ header file.  You will probably want to use a
11187 tool like @command{make} to keep the precompiled header up-to-date when
11188 the headers it contains change.
11189
11190 A precompiled header file will be searched for when @code{#include} is
11191 seen in the compilation.  As it searches for the included file
11192 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
11193 compiler looks for a precompiled header in each directory just before it
11194 looks for the include file in that directory.  The name searched for is
11195 the name specified in the @code{#include} with @samp{.gch} appended.  If
11196 the precompiled header file can't be used, it is ignored.
11197
11198 For instance, if you have @code{#include "all.h"}, and you have
11199 @file{all.h.gch} in the same directory as @file{all.h}, then the
11200 precompiled header file will be used if possible, and the original
11201 header will be used otherwise.
11202
11203 Alternatively, you might decide to put the precompiled header file in a
11204 directory and use @option{-I} to ensure that directory is searched
11205 before (or instead of) the directory containing the original header.
11206 Then, if you want to check that the precompiled header file is always
11207 used, you can put a file of the same name as the original header in this
11208 directory containing an @code{#error} command.
11209
11210 This also works with @option{-include}.  So yet another way to use
11211 precompiled headers, good for projects not designed with precompiled
11212 header files in mind, is to simply take most of the header files used by
11213 a project, include them from another header file, precompile that header
11214 file, and @option{-include} the precompiled header.  If the header files
11215 have guards against multiple inclusion, they will be skipped because
11216 they've already been included (in the precompiled header).
11217
11218 If you need to precompile the same header file for different
11219 languages, targets, or compiler options, you can instead make a
11220 @emph{directory} named like @file{all.h.gch}, and put each precompiled
11221 header in the directory.  (It doesn't matter what you call the files
11222 in the directory, every precompiled header in the directory will be
11223 considered.)  The first precompiled header encountered in the
11224 directory that is valid for this compilation will be used; they're
11225 searched in no particular order.
11226
11227 There are many other possibilities, limited only by your imagination,
11228 good sense, and the constraints of your build system.
11229
11230 A precompiled header file can be used only when these conditions apply:
11231
11232 @itemize
11233 @item
11234 Only one precompiled header can be used in a particular compilation.
11235 @item
11236 A precompiled header can't be used once the first C token is seen.  You
11237 can have preprocessor directives before a precompiled header; you can
11238 even include a precompiled header from inside another header, so long as
11239 there are no C tokens before the @code{#include}.
11240 @item
11241 The precompiled header file must be produced for the same language as
11242 the current compilation.  You can't use a C precompiled header for a C++
11243 compilation.
11244 @item
11245 The precompiled header file must be produced by the same compiler
11246 version and configuration as the current compilation is using.
11247 The easiest way to guarantee this is to use the same compiler binary
11248 for creating and using precompiled headers.
11249 @item
11250 Any macros defined before the precompiled header (including with
11251 @option{-D}) must either be defined in the same way as when the
11252 precompiled header was generated, or must not affect the precompiled
11253 header, which usually means that the they don't appear in the
11254 precompiled header at all.
11255 @item
11256 Certain command-line options must be defined in the same way as when the
11257 precompiled header was generated.  At present, it's not clear which
11258 options are safe to change and which are not; the safest choice is to
11259 use exactly the same options when generating and using the precompiled
11260 header.
11261 @end itemize
11262
11263 For all of these but the last, the compiler will automatically ignore
11264 the precompiled header if the conditions aren't met.  For the last item,
11265 some option changes will cause the precompiled header to be rejected,
11266 but not all incompatible option combinations have yet been found.  If
11267 you find a new incompatible combination, please consider filing a bug
11268 report, see @ref{Bugs}.
11269
11270 @node Running Protoize
11271 @section Running Protoize
11272
11273 The program @code{protoize} is an optional part of GCC@.  You can use
11274 it to add prototypes to a program, thus converting the program to ISO
11275 C in one respect.  The companion program @code{unprotoize} does the
11276 reverse: it removes argument types from any prototypes that are found.
11277
11278 When you run these programs, you must specify a set of source files as
11279 command line arguments.  The conversion programs start out by compiling
11280 these files to see what functions they define.  The information gathered
11281 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
11282
11283 After scanning comes actual conversion.  The specified files are all
11284 eligible to be converted; any files they include (whether sources or
11285 just headers) are eligible as well.
11286
11287 But not all the eligible files are converted.  By default,
11288 @code{protoize} and @code{unprotoize} convert only source and header
11289 files in the current directory.  You can specify additional directories
11290 whose files should be converted with the @option{-d @var{directory}}
11291 option.  You can also specify particular files to exclude with the
11292 @option{-x @var{file}} option.  A file is converted if it is eligible, its
11293 directory name matches one of the specified directory names, and its
11294 name within the directory has not been excluded.
11295
11296 Basic conversion with @code{protoize} consists of rewriting most
11297 function definitions and function declarations to specify the types of
11298 the arguments.  The only ones not rewritten are those for varargs
11299 functions.
11300
11301 @code{protoize} optionally inserts prototype declarations at the
11302 beginning of the source file, to make them available for any calls that
11303 precede the function's definition.  Or it can insert prototype
11304 declarations with block scope in the blocks where undeclared functions
11305 are called.
11306
11307 Basic conversion with @code{unprotoize} consists of rewriting most
11308 function declarations to remove any argument types, and rewriting
11309 function definitions to the old-style pre-ISO form.
11310
11311 Both conversion programs print a warning for any function declaration or
11312 definition that they can't convert.  You can suppress these warnings
11313 with @option{-q}.
11314
11315 The output from @code{protoize} or @code{unprotoize} replaces the
11316 original source file.  The original file is renamed to a name ending
11317 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
11318 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
11319 for DOS) file already exists, then the source file is simply discarded.
11320
11321 @code{protoize} and @code{unprotoize} both depend on GCC itself to
11322 scan the program and collect information about the functions it uses.
11323 So neither of these programs will work until GCC is installed.
11324
11325 Here is a table of the options you can use with @code{protoize} and
11326 @code{unprotoize}.  Each option works with both programs unless
11327 otherwise stated.
11328
11329 @table @code
11330 @item -B @var{directory}
11331 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
11332 usual directory (normally @file{/usr/local/lib}).  This file contains
11333 prototype information about standard system functions.  This option
11334 applies only to @code{protoize}.
11335
11336 @item -c @var{compilation-options}
11337 Use @var{compilation-options} as the options when running @command{gcc} to
11338 produce the @samp{.X} files.  The special option @option{-aux-info} is
11339 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
11340
11341 Note that the compilation options must be given as a single argument to
11342 @code{protoize} or @code{unprotoize}.  If you want to specify several
11343 @command{gcc} options, you must quote the entire set of compilation options
11344 to make them a single word in the shell.
11345
11346 There are certain @command{gcc} arguments that you cannot use, because they
11347 would produce the wrong kind of output.  These include @option{-g},
11348 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
11349 the @var{compilation-options}, they are ignored.
11350
11351 @item -C
11352 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
11353 systems) instead of @samp{.c}.  This is convenient if you are converting
11354 a C program to C++.  This option applies only to @code{protoize}.
11355
11356 @item -g
11357 Add explicit global declarations.  This means inserting explicit
11358 declarations at the beginning of each source file for each function
11359 that is called in the file and was not declared.  These declarations
11360 precede the first function definition that contains a call to an
11361 undeclared function.  This option applies only to @code{protoize}.
11362
11363 @item -i @var{string}
11364 Indent old-style parameter declarations with the string @var{string}.
11365 This option applies only to @code{protoize}.
11366
11367 @code{unprotoize} converts prototyped function definitions to old-style
11368 function definitions, where the arguments are declared between the
11369 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
11370 uses five spaces as the indentation.  If you want to indent with just
11371 one space instead, use @option{-i " "}.
11372
11373 @item -k
11374 Keep the @samp{.X} files.  Normally, they are deleted after conversion
11375 is finished.
11376
11377 @item -l
11378 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
11379 a prototype declaration for each function in each block which calls the
11380 function without any declaration.  This option applies only to
11381 @code{protoize}.
11382
11383 @item -n
11384 Make no real changes.  This mode just prints information about the conversions
11385 that would have been done without @option{-n}.
11386
11387 @item -N
11388 Make no @samp{.save} files.  The original files are simply deleted.
11389 Use this option with caution.
11390
11391 @item -p @var{program}
11392 Use the program @var{program} as the compiler.  Normally, the name
11393 @file{gcc} is used.
11394
11395 @item -q
11396 Work quietly.  Most warnings are suppressed.
11397
11398 @item -v
11399 Print the version number, just like @option{-v} for @command{gcc}.
11400 @end table
11401
11402 If you need special compiler options to compile one of your program's
11403 source files, then you should generate that file's @samp{.X} file
11404 specially, by running @command{gcc} on that source file with the
11405 appropriate options and the option @option{-aux-info}.  Then run
11406 @code{protoize} on the entire set of files.  @code{protoize} will use
11407 the existing @samp{.X} file because it is newer than the source file.
11408 For example:
11409
11410 @smallexample
11411 gcc -Dfoo=bar file1.c -aux-info file1.X
11412 protoize *.c
11413 @end smallexample
11414
11415 @noindent
11416 You need to include the special files along with the rest in the
11417 @code{protoize} command, even though their @samp{.X} files already
11418 exist, because otherwise they won't get converted.
11419
11420 @xref{Protoize Caveats}, for more information on how to use
11421 @code{protoize} successfully.