OSDN Git Service

570e8e7f9e1859cf1f4809109c091d3f4666a831
[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}  -combine -pipe  -pass-exit-codes  @gol
159 -x @var{language}  -v  -###  --help  --target-help  --version}
160
161 @item C Language Options
162 @xref{C Dialect Options,,Options Controlling C Dialect}.
163 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
164 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
165 -fhosted  -ffreestanding  -fms-extensions @gol
166 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
167 -fallow-single-precision  -fcond-mismatch @gol
168 -fsigned-bitfields  -fsigned-char @gol
169 -funsigned-bitfields  -funsigned-char}
170
171 @item C++ Language Options
172 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
173 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
174 -fconserve-space  -fno-const-strings @gol
175 -fno-elide-constructors @gol
176 -fno-enforce-eh-specs @gol
177 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
178 -fno-implicit-templates @gol
179 -fno-implicit-inline-templates @gol
180 -fno-implement-inlines  -fms-extensions @gol
181 -fno-nonansi-builtins  -fno-operator-names @gol
182 -fno-optional-diags  -fpermissive @gol
183 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
184 -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
185 -fno-default-inline  -Wabi  -Wctor-dtor-privacy @gol
186 -Wnon-virtual-dtor  -Wreorder @gol
187 -Weffc++  -Wno-deprecated @gol
188 -Wno-non-template-friend  -Wold-style-cast @gol
189 -Woverloaded-virtual  -Wno-pmf-conversions @gol
190 -Wsign-promo  -Wsynth}
191
192 @item Objective-C Language Options
193 @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
194 @gccoptlist{
195 -fconstant-string-class=@var{class-name} @gol
196 -fgnu-runtime  -fnext-runtime @gol
197 -fno-nil-receivers @gol
198 -fobjc-exceptions @gol
199 -freplace-objc-classes @gol
200 -fzero-link @gol
201 -gen-decls @gol
202 -Wno-protocol  -Wselector -Wundeclared-selector}
203
204 @item Language Independent Options
205 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
206 @gccoptlist{-fmessage-length=@var{n}  @gol
207 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
208
209 @item Warning Options
210 @xref{Warning Options,,Options to Request or Suppress Warnings}.
211 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
212 -w  -Wextra  -Wall  -Waggregate-return @gol
213 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
214 -Wconversion  -Wno-deprecated-declarations @gol
215 -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
216 -Werror  -Werror-implicit-function-declaration @gol
217 -Wfloat-equal  -Wformat  -Wformat=2 @gol
218 -Wno-format-extra-args -Wformat-nonliteral @gol
219 -Wformat-security  -Wformat-y2k @gol
220 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
221 -Wimport  -Wno-import  -Winit-self  -Winline @gol
222 -Wno-invalid-offsetof  -Winvalid-pch @gol
223 -Wlarger-than-@var{len}  -Wlong-long @gol
224 -Wmain  -Wmissing-braces @gol
225 -Wmissing-format-attribute  -Wmissing-noreturn @gol
226 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
227 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
228 -Wreturn-type  -Wsequence-point  -Wshadow @gol
229 -Wsign-compare  -Wstrict-aliasing -Wstrict-aliasing=2 @gol
230 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
231 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
232 -Wunknown-pragmas  -Wunreachable-code @gol
233 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
234 -Wunused-value  -Wunused-variable  -Wwrite-strings @gol
235 -Wvariadic-macros}
236
237 @item C-only Warning Options
238 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
239 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
240 -Wstrict-prototypes  -Wtraditional @gol
241 -Wdeclaration-after-statement}
242
243 @item Debugging Options
244 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
245 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
246 -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
247 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
248 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
249 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
250 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
251 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
252 -feliminate-unused-debug-symbols -fmem-report -fprofile-arcs @gol
253 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
254 -ftest-coverage  -ftime-report -fvar-tracking @gol
255 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
256 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
257 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
258 -print-multi-directory  -print-multi-lib @gol
259 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
260 -save-temps  -time}
261
262 @item Optimization Options
263 @xref{Optimize Options,,Options that Control Optimization}.
264 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
265 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
266 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
267 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
268 -fcaller-saves  -fcprop-registers @gol
269 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
270 -fdelayed-branch  -fdelete-null-pointer-checks @gol
271 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
272 -fforce-addr  -fforce-mem  -ffunction-sections @gol
273 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -floop-optimize @gol
274 -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
275 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
276 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
277 -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
278 -fno-default-inline  -fno-defer-pop @gol
279 -fno-function-cse  -fno-guess-branch-probability @gol
280 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
281 -funsafe-math-optimizations  -ffinite-math-only @gol
282 -fno-trapping-math  -fno-zero-initialized-in-bss @gol
283 -fomit-frame-pointer  -foptimize-register-move @gol
284 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
285 -fprofile-generate -fprofile-use @gol
286 -freduce-all-givs  -fregmove  -frename-registers @gol
287 -freorder-blocks  -freorder-blocks-and-partition -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 -mabi=@var{name} @gol
372 -mapcs-26  -mapcs-32 @gol
373 -mapcs-stack-check  -mno-apcs-stack-check @gol
374 -mapcs-float  -mno-apcs-float @gol
375 -mapcs-reentrant  -mno-apcs-reentrant @gol
376 -msched-prolog  -mno-sched-prolog @gol
377 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
378 -malignment-traps  -mno-alignment-traps @gol
379 -mfloat-abi=@var{name}  soft-float  -mhard-float  -mfpe @gol
380 -mthumb-interwork  -mno-thumb-interwork @gol
381 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
382 -mstructure-size-boundary=@var{n} @gol
383 -mabort-on-noreturn @gol
384 -mlong-calls  -mno-long-calls @gol
385 -msingle-pic-base  -mno-single-pic-base @gol
386 -mpic-register=@var{reg} @gol
387 -mnop-fun-dllimport @gol
388 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
389 -mpoke-function-name @gol
390 -mthumb  -marm @gol
391 -mtpcs-frame  -mtpcs-leaf-frame @gol
392 -mcaller-super-interworking  -mcallee-super-interworking}
393
394 @emph{MN10300 Options}
395 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
396 -mam33  -mno-am33 @gol
397 -mam33-2  -mno-am33-2 @gol
398 -mno-crt0  -mrelax}
399
400 @emph{M32R/D Options}
401 @gccoptlist{-m32r2 -m32rx -m32r @gol
402 -mdebug @gol
403 -malign-loops -mno-align-loops @gol
404 -missue-rate=@var{number} @gol
405 -mbranch-cost=@var{number} @gol
406 -mmodel=@var{code-size-model-type} @gol
407 -msdata=@var{sdata-type} @gol
408 -mno-flush-func -mflush-func=@var{name} @gol
409 -mno-flush-trap -mflush-trap=@var{number} @gol
410 -G @var{num}}
411
412 @emph{RS/6000 and PowerPC Options}
413 @gccoptlist{-mcpu=@var{cpu-type} @gol
414 -mtune=@var{cpu-type} @gol
415 -mpower  -mno-power  -mpower2  -mno-power2 @gol
416 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
417 -maltivec  -mno-altivec @gol
418 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
419 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
420 -mnew-mnemonics  -mold-mnemonics @gol
421 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
422 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
423 -malign-power  -malign-natural @gol
424 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
425 -mstring  -mno-string  -mupdate  -mno-update @gol
426 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
427 -mstrict-align  -mno-strict-align  -mrelocatable @gol
428 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
429 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
430 -mdynamic-no-pic @gol
431 -mprioritize-restricted-insns=@var{priority} @gol
432 -msched-costly-dep=@var{dependence_type} @gol
433 -minsert-sched-nops=@var{scheme} @gol
434 -mcall-sysv  -mcall-netbsd @gol
435 -maix-struct-return  -msvr4-struct-return @gol
436 -mabi=altivec  -mabi=no-altivec @gol
437 -mabi=spe  -mabi=no-spe @gol
438 -misel=yes  -misel=no @gol
439 -mspe=yes  -mspe=no @gol
440 -mfloat-gprs=yes  -mfloat-gprs=no @gol
441 -mprototype  -mno-prototype @gol
442 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
443 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
444
445 @emph{Darwin Options}
446 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
447 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
448 -client_name  -compatibility_version  -current_version @gol
449 -dependency-file  -dylib_file  -dylinker_install_name @gol
450 -dynamic  -dynamiclib  -exported_symbols_list @gol
451 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
452 -force_flat_namespace  -headerpad_max_install_names @gol
453 -image_base  -init  -install_name  -keep_private_externs @gol
454 -multi_module  -multiply_defined  -multiply_defined_unused @gol
455 -noall_load  -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
456 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
457 -private_bundle  -read_only_relocs  -sectalign @gol
458 -sectobjectsymbols  -whyload  -seg1addr @gol
459 -sectcreate  -sectobjectsymbols  -sectorder @gol
460 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
461 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
462 -single_module  -static  -sub_library  -sub_umbrella @gol
463 -twolevel_namespace  -umbrella  -undefined @gol
464 -unexported_symbols_list  -weak_reference_mismatches @gol
465 -whatsloaded}
466
467 @emph{MIPS Options}
468 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
469 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
470 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
471 -mxgot  -mno-xgot  -membedded-pic  -mno-embedded-pic @gol
472 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
473 -msingle-float  -mdouble-float  -mint64  -mlong64  -mlong32 @gol
474 -G@var{num}  -membedded-data  -mno-embedded-data @gol
475 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
476 -msplit-addresses  -mno-split-addresses  @gol
477 -mexplicit-relocs  -mno-explicit-relocs  @gol
478 -mrnames  -mno-rnames @gol
479 -mcheck-zero-division  -mno-check-zero-division @gol
480 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
481 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
482 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
483 -mfix-vr4120  -mno-fix-vr4120  -mfix-sb1  -mno-fix-sb1 @gol
484 -mflush-func=@var{func}  -mno-flush-func @gol
485 -mbranch-likely  -mno-branch-likely}
486
487 @emph{i386 and x86-64 Options}
488 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
489 -mfpmath=@var{unit} @gol
490 -masm=@var{dialect}  -mno-fancy-math-387 @gol
491 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
492 -mno-wide-multiply  -mrtd  -malign-double @gol
493 -mpreferred-stack-boundary=@var{num} @gol
494 -mmmx  -msse  -msse2 -msse3 -m3dnow @gol
495 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
496 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
497 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
498 -mno-red-zone -mno-tls-direct-seg-refs @gol
499 -mcmodel=@var{code-model} @gol
500 -m32  -m64}
501
502 @emph{HPPA Options}
503 @gccoptlist{-march=@var{architecture-type} @gol
504 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
505 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
506 -mjump-in-delay -mlinker-opt -mlong-calls @gol
507 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
508 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
509 -mno-jump-in-delay  -mno-long-load-store @gol
510 -mno-portable-runtime  -mno-soft-float @gol
511 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
512 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
513 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
514 -nolibdld  -static  -threads}
515
516 @emph{DEC Alpha Options}
517 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
518 -mieee  -mieee-with-inexact  -mieee-conformant @gol
519 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
520 -mtrap-precision=@var{mode}  -mbuild-constants @gol
521 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
522 -mbwx  -mmax  -mfix  -mcix @gol
523 -mfloat-vax  -mfloat-ieee @gol
524 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
525 -msmall-text  -mlarge-text @gol
526 -mmemory-latency=@var{time}}
527
528 @emph{DEC Alpha/VMS Options}
529 @gccoptlist{-mvms-return-codes}
530
531 @emph{H8/300 Options}
532 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
533
534 @emph{SH Options}
535 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
536 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
537 -m5-64media  -m5-64media-nofpu @gol
538 -m5-32media  -m5-32media-nofpu @gol
539 -m5-compact  -m5-compact-nofpu @gol
540 -mb  -ml  -mdalign  -mrelax @gol
541 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
542 -mieee  -misize  -mpadstruct  -mspace @gol
543 -mprefergot  -musermode}
544
545 @emph{System V Options}
546 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
547
548 @emph{ARC Options}
549 @gccoptlist{-EB  -EL @gol
550 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
551 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
552
553 @emph{TMS320C3x/C4x Options}
554 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
555 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
556 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
557 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
558
559 @emph{V850 Options}
560 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
561 -mprolog-function  -mno-prolog-function  -mspace @gol
562 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
563 -mapp-regs  -mno-app-regs @gol
564 -mdisable-callt  -mno-disable-callt @gol
565 -mv850e1 @gol
566 -mv850e @gol
567 -mv850  -mbig-switch}
568
569 @emph{NS32K Options}
570 @gccoptlist{-m32032  -m32332  -m32532  -m32081  -m32381 @gol
571 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
572 -mregparam  -mnoregparam  -msb  -mnosb @gol
573 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
574
575 @emph{AVR Options}
576 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
577 -mcall-prologues  -mno-tablejump  -mtiny-stack}
578
579 @emph{MCore Options}
580 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
581 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
582 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
583 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
584 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
585
586 @emph{MMIX Options}
587 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
588 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
589 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
590 -mno-base-addresses  -msingle-exit  -mno-single-exit}
591
592 @emph{IA-64 Options}
593 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
594 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
595 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
596 -minline-float-divide-max-throughput @gol
597 -minline-int-divide-min-latency @gol
598 -minline-int-divide-max-throughput  -mno-dwarf2-asm @gol
599 -mfixed-range=@var{register-range}}
600
601 @emph{S/390 and zSeries Options}
602 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
603 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
604 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
605 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch  -mfused-madd  -mno-fused-madd}
606
607 @emph{CRIS Options}
608 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
609 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
610 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
611 -mstack-align  -mdata-align  -mconst-align @gol
612 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
613 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
614 -mmul-bug-workaround  -mno-mul-bug-workaround}
615
616 @emph{PDP-11 Options}
617 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
618 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
619 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
620 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
621 -mbranch-expensive  -mbranch-cheap @gol
622 -msplit  -mno-split  -munix-asm  -mdec-asm}
623
624 @emph{Xstormy16 Options}
625 @gccoptlist{-msim}
626
627 @emph{Xtensa Options}
628 @gccoptlist{-mconst16 -mno-const16 @gol
629 -mfused-madd  -mno-fused-madd @gol
630 -mtext-section-literals  -mno-text-section-literals @gol
631 -mtarget-align  -mno-target-align @gol
632 -mlongcalls  -mno-longcalls}
633
634 @emph{FRV Options}
635 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
636 -mhard-float  -msoft-float @gol
637 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
638 -mdouble  -mno-double @gol
639 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
640 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp @gol
641 -mlibrary-pic  -macc-4 -macc-8 @gol
642 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
643 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
644 -mvliw-branch  -mno-vliw-branch @gol
645 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
646 -mno-nested-cond-exec  -mtomcat-stats @gol
647 -mcpu=@var{cpu}}
648
649 @item Code Generation Options
650 @xref{Code Gen Options,,Options for Code Generation Conventions}.
651 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
652 -ffixed-@var{reg}  -fexceptions @gol
653 -fnon-call-exceptions  -funwind-tables @gol
654 -fasynchronous-unwind-tables @gol
655 -finhibit-size-directive  -finstrument-functions @gol
656 -fno-common  -fno-ident @gol
657 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
658 -freg-struct-return  -fshared-data  -fshort-enums @gol
659 -fshort-double  -fshort-wchar @gol
660 -fverbose-asm  -fpack-struct  -fstack-check @gol
661 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
662 -fargument-alias  -fargument-noalias @gol
663 -fargument-noalias-global  -fleading-underscore @gol
664 -ftls-model=@var{model} @gol
665 -ftrapv  -fwrapv  -fbounds-check}
666 @end table
667
668 @menu
669 * Overall Options::     Controlling the kind of output:
670                         an executable, object files, assembler files,
671                         or preprocessed source.
672 * C Dialect Options::   Controlling the variant of C language compiled.
673 * C++ Dialect Options:: Variations on C++.
674 * Objective-C Dialect Options:: Variations on Objective-C.
675 * Language Independent Options:: Controlling how diagnostics should be
676                         formatted.
677 * Warning Options::     How picky should the compiler be?
678 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
679 * Optimize Options::    How much optimization?
680 * Preprocessor Options:: Controlling header files and macro definitions.
681                          Also, getting dependency information for Make.
682 * Assembler Options::   Passing options to the assembler.
683 * Link Options::        Specifying libraries and so on.
684 * Directory Options::   Where to find header files and libraries.
685                         Where to find the compiler executable files.
686 * Spec Files::          How to pass switches to sub-processes.
687 * Target Options::      Running a cross-compiler, or an old version of GCC.
688 @end menu
689
690 @node Overall Options
691 @section Options Controlling the Kind of Output
692
693 Compilation can involve up to four stages: preprocessing, compilation
694 proper, assembly and linking, always in that order.  GCC is capable of
695 preprocessing and compiling several files either into several
696 assembler input files, or into one assembler input file; then each
697 assembler input file produces an object file, and linking combines all
698 the object files (those newly compiled, and those specified as input)
699 into an executable file.
700
701 @cindex file name suffix
702 For any given input file, the file name suffix determines what kind of
703 compilation is done:
704
705 @table @gcctabopt
706 @item @var{file}.c
707 C source code which must be preprocessed.
708
709 @item @var{file}.i
710 C source code which should not be preprocessed.
711
712 @item @var{file}.ii
713 C++ source code which should not be preprocessed.
714
715 @item @var{file}.m
716 Objective-C source code.  Note that you must link with the library
717 @file{libobjc.a} to make an Objective-C program work.
718
719 @item @var{file}.mi
720 Objective-C source code which should not be preprocessed.
721
722 @item @var{file}.h
723 C or C++ header file to be turned into a precompiled header.
724
725 @item @var{file}.cc
726 @itemx @var{file}.cp
727 @itemx @var{file}.cxx
728 @itemx @var{file}.cpp
729 @itemx @var{file}.CPP
730 @itemx @var{file}.c++
731 @itemx @var{file}.C
732 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
733 the last two letters must both be literally @samp{x}.  Likewise,
734 @samp{.C} refers to a literal capital C@.
735
736 @item @var{file}.hh
737 @itemx @var{file}.H
738 C++ header file to be turned into a precompiled header.
739
740 @item @var{file}.f
741 @itemx @var{file}.for
742 @itemx @var{file}.FOR
743 Fortran source code which should not be preprocessed.
744
745 @item @var{file}.F
746 @itemx @var{file}.fpp
747 @itemx @var{file}.FPP
748 Fortran source code which must be preprocessed (with the traditional
749 preprocessor).
750
751 @item @var{file}.r
752 Fortran source code which must be preprocessed with a RATFOR
753 preprocessor (not included with GCC)@.
754
755 @xref{Overall Options,,Options Controlling the Kind of Output, g77,
756 Using and Porting GNU Fortran}, for more details of the handling of
757 Fortran input files.
758
759 @c FIXME: Descriptions of Java file types.
760 @c @var{file}.java
761 @c @var{file}.class
762 @c @var{file}.zip
763 @c @var{file}.jar
764
765 @item @var{file}.ads
766 Ada source code file which contains a library unit declaration (a
767 declaration of a package, subprogram, or generic, or a generic
768 instantiation), or a library unit renaming declaration (a package,
769 generic, or subprogram renaming declaration).  Such files are also
770 called @dfn{specs}.
771
772 @itemx @var{file}.adb
773 Ada source code file containing a library unit body (a subprogram or
774 package body).  Such files are also called @dfn{bodies}.
775
776 @c GCC also knows about some suffixes for languages not yet included:
777 @c Pascal:
778 @c @var{file}.p
779 @c @var{file}.pas
780
781 @item @var{file}.s
782 Assembler code.
783
784 @item @var{file}.S
785 Assembler code which must be preprocessed.
786
787 @item @var{other}
788 An object file to be fed straight into linking.
789 Any file name with no recognized suffix is treated this way.
790 @end table
791
792 @opindex x
793 You can specify the input language explicitly with the @option{-x} option:
794
795 @table @gcctabopt
796 @item -x @var{language}
797 Specify explicitly the @var{language} for the following input files
798 (rather than letting the compiler choose a default based on the file
799 name suffix).  This option applies to all following input files until
800 the next @option{-x} option.  Possible values for @var{language} are:
801 @smallexample
802 c  c-header  cpp-output
803 c++  c++-header  c++-cpp-output
804 objective-c  objective-c-header  objc-cpp-output
805 assembler  assembler-with-cpp
806 ada
807 f77  f77-cpp-input  ratfor
808 java
809 treelang
810 @end smallexample
811
812 @item -x none
813 Turn off any specification of a language, so that subsequent files are
814 handled according to their file name suffixes (as they are if @option{-x}
815 has not been used at all).
816
817 @item -pass-exit-codes
818 @opindex pass-exit-codes
819 Normally the @command{gcc} program will exit with the code of 1 if any
820 phase of the compiler returns a non-success return code.  If you specify
821 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
822 numerically highest error produced by any phase that returned an error
823 indication.
824 @end table
825
826 If you only want some of the stages of compilation, you can use
827 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
828 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
829 @command{gcc} is to stop.  Note that some combinations (for example,
830 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
831
832 @table @gcctabopt
833 @item -c
834 @opindex c
835 Compile or assemble the source files, but do not link.  The linking
836 stage simply is not done.  The ultimate output is in the form of an
837 object file for each source file.
838
839 By default, the object file name for a source file is made by replacing
840 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
841
842 Unrecognized input files, not requiring compilation or assembly, are
843 ignored.
844
845 @item -S
846 @opindex S
847 Stop after the stage of compilation proper; do not assemble.  The output
848 is in the form of an assembler code file for each non-assembler input
849 file specified.
850
851 By default, the assembler file name for a source file is made by
852 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
853
854 Input files that don't require compilation are ignored.
855
856 @item -E
857 @opindex E
858 Stop after the preprocessing stage; do not run the compiler proper.  The
859 output is in the form of preprocessed source code, which is sent to the
860 standard output.
861
862 Input files which don't require preprocessing are ignored.
863
864 @cindex output file option
865 @item -o @var{file}
866 @opindex o
867 Place output in file @var{file}.  This applies regardless to whatever
868 sort of output is being produced, whether it be an executable file,
869 an object file, an assembler file or preprocessed C code.
870
871 If @option{-o} is not specified, the default is to put an executable file
872 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
873 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
874 all preprocessed C source on standard output.
875
876 @item -v
877 @opindex v
878 Print (on standard error output) the commands executed to run the stages
879 of compilation.  Also print the version number of the compiler driver
880 program and of the preprocessor and the compiler proper.
881
882 @item -###
883 @opindex ###
884 Like @option{-v} except the commands are not executed and all command
885 arguments are quoted.  This is useful for shell scripts to capture the
886 driver-generated command lines.
887
888 @item -pipe
889 @opindex pipe
890 Use pipes rather than temporary files for communication between the
891 various stages of compilation.  This fails to work on some systems where
892 the assembler is unable to read from a pipe; but the GNU assembler has
893 no trouble.
894
895 @item -combine
896 @opindex combine
897 If you are compiling multiple source files, this option tells the driver
898 to pass all the source files to the compiler at once (for those 
899 languages for which the compiler can handle this).  This will allow
900 intermodule analysis (IMA) to be performed by the compiler.  Currently the only
901 language for which this is supported is C.  If you pass source files for
902 multiple languages to the driver, using this option, the driver will invoke
903 the compiler(s) that support IMA once each, passing each compiler all the
904 source files appropriate for it.  For those languages that do not support
905 IMA this option will be ignored, and the compiler will be invoked once for
906 each source file in that language.  If you use this option in conjunction
907 with -save-temps, the compiler will generate multiple pre-processed files
908 (one for each source file), but only one (combined) .o or .s file. 
909
910 @item --help
911 @opindex help
912 Print (on the standard output) a description of the command line options
913 understood by @command{gcc}.  If the @option{-v} option is also specified
914 then @option{--help} will also be passed on to the various processes
915 invoked by @command{gcc}, so that they can display the command line options
916 they accept.  If the @option{-Wextra} option is also specified then command
917 line options which have no documentation associated with them will also
918 be displayed.
919
920 @item --target-help
921 @opindex target-help
922 Print (on the standard output) a description of target specific command
923 line options for each tool.
924
925 @item --version
926 @opindex version
927 Display the version number and copyrights of the invoked GCC.
928 @end table
929
930 @node Invoking G++
931 @section Compiling C++ Programs
932
933 @cindex suffixes for C++ source
934 @cindex C++ source file suffixes
935 C++ source files conventionally use one of the suffixes @samp{.C},
936 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
937 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
938 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
939 files with these names and compiles them as C++ programs even if you
940 call the compiler the same way as for compiling C programs (usually
941 with the name @command{gcc}).
942
943 @findex g++
944 @findex c++
945 However, C++ programs often require class libraries as well as a
946 compiler that understands the C++ language---and under some
947 circumstances, you might want to compile programs or header files from
948 standard input, or otherwise without a suffix that flags them as C++
949 programs.  You might also like to precompile a C header file with a
950 @samp{.h} extension to be used in C++ compilations.  @command{g++} is a
951 program that calls GCC with the default language set to C++, and
952 automatically specifies linking against the C++ library.  On many
953 systems, @command{g++} is also installed with the name @command{c++}.
954
955 @cindex invoking @command{g++}
956 When you compile C++ programs, you may specify many of the same
957 command-line options that you use for compiling programs in any
958 language; or command-line options meaningful for C and related
959 languages; or options that are meaningful only for C++ programs.
960 @xref{C Dialect Options,,Options Controlling C Dialect}, for
961 explanations of options for languages related to C@.
962 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
963 explanations of options that are meaningful only for C++ programs.
964
965 @node C Dialect Options
966 @section Options Controlling C Dialect
967 @cindex dialect options
968 @cindex language dialect options
969 @cindex options, dialect
970
971 The following options control the dialect of C (or languages derived
972 from C, such as C++ and Objective-C) that the compiler accepts:
973
974 @table @gcctabopt
975 @cindex ANSI support
976 @cindex ISO support
977 @item -ansi
978 @opindex ansi
979 In C mode, support all ISO C90 programs.  In C++ mode,
980 remove GNU extensions that conflict with ISO C++.
981
982 This turns off certain features of GCC that are incompatible with ISO
983 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
984 such as the @code{asm} and @code{typeof} keywords, and
985 predefined macros such as @code{unix} and @code{vax} that identify the
986 type of system you are using.  It also enables the undesirable and
987 rarely used ISO trigraph feature.  For the C compiler,
988 it disables recognition of C++ style @samp{//} comments as well as
989 the @code{inline} keyword.
990
991 The alternate keywords @code{__asm__}, @code{__extension__},
992 @code{__inline__} and @code{__typeof__} continue to work despite
993 @option{-ansi}.  You would not want to use them in an ISO C program, of
994 course, but it is useful to put them in header files that might be included
995 in compilations done with @option{-ansi}.  Alternate predefined macros
996 such as @code{__unix__} and @code{__vax__} are also available, with or
997 without @option{-ansi}.
998
999 The @option{-ansi} option does not cause non-ISO programs to be
1000 rejected gratuitously.  For that, @option{-pedantic} is required in
1001 addition to @option{-ansi}.  @xref{Warning Options}.
1002
1003 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1004 option is used.  Some header files may notice this macro and refrain
1005 from declaring certain functions or defining certain macros that the
1006 ISO standard doesn't call for; this is to avoid interfering with any
1007 programs that might use these names for other things.
1008
1009 Functions which would normally be built in but do not have semantics
1010 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1011 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1012 built-in functions provided by GCC}, for details of the functions
1013 affected.
1014
1015 @item -std=
1016 @opindex std
1017 Determine the language standard.  This option is currently only
1018 supported when compiling C or C++.  A value for this option must be
1019 provided; possible values are
1020
1021 @table @samp
1022 @item c89
1023 @itemx iso9899:1990
1024 ISO C90 (same as @option{-ansi}).
1025
1026 @item iso9899:199409
1027 ISO C90 as modified in amendment 1.
1028
1029 @item c99
1030 @itemx c9x
1031 @itemx iso9899:1999
1032 @itemx iso9899:199x
1033 ISO C99.  Note that this standard is not yet fully supported; see
1034 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1035 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1036
1037 @item gnu89
1038 Default, ISO C90 plus GNU extensions (including some C99 features).
1039
1040 @item gnu99
1041 @itemx gnu9x
1042 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1043 this will become the default.  The name @samp{gnu9x} is deprecated.
1044
1045 @item c++98
1046 The 1998 ISO C++ standard plus amendments.
1047
1048 @item gnu++98
1049 The same as @option{-std=c++98} plus GNU extensions.  This is the
1050 default for C++ code.
1051 @end table
1052
1053 Even when this option is not specified, you can still use some of the
1054 features of newer standards in so far as they do not conflict with
1055 previous C standards.  For example, you may use @code{__restrict__} even
1056 when @option{-std=c99} is not specified.
1057
1058 The @option{-std} options specifying some version of ISO C have the same
1059 effects as @option{-ansi}, except that features that were not in ISO C90
1060 but are in the specified version (for example, @samp{//} comments and
1061 the @code{inline} keyword in ISO C99) are not disabled.
1062
1063 @xref{Standards,,Language Standards Supported by GCC}, for details of
1064 these standard versions.
1065
1066 @item -aux-info @var{filename}
1067 @opindex aux-info
1068 Output to the given filename prototyped declarations for all functions
1069 declared and/or defined in a translation unit, including those in header
1070 files.  This option is silently ignored in any language other than C@.
1071
1072 Besides declarations, the file indicates, in comments, the origin of
1073 each declaration (source file and line), whether the declaration was
1074 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1075 @samp{O} for old, respectively, in the first character after the line
1076 number and the colon), and whether it came from a declaration or a
1077 definition (@samp{C} or @samp{F}, respectively, in the following
1078 character).  In the case of function definitions, a K&R-style list of
1079 arguments followed by their declarations is also provided, inside
1080 comments, after the declaration.
1081
1082 @item -fno-asm
1083 @opindex fno-asm
1084 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1085 keyword, so that code can use these words as identifiers.  You can use
1086 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1087 instead.  @option{-ansi} implies @option{-fno-asm}.
1088
1089 In C++, this switch only affects the @code{typeof} keyword, since
1090 @code{asm} and @code{inline} are standard keywords.  You may want to
1091 use the @option{-fno-gnu-keywords} flag instead, which has the same
1092 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1093 switch only affects the @code{asm} and @code{typeof} keywords, since
1094 @code{inline} is a standard keyword in ISO C99.
1095
1096 @item -fno-builtin
1097 @itemx -fno-builtin-@var{function}
1098 @opindex fno-builtin
1099 @cindex built-in functions
1100 Don't recognize built-in functions that do not begin with
1101 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1102 functions provided by GCC}, for details of the functions affected,
1103 including those which are not built-in functions when @option{-ansi} or
1104 @option{-std} options for strict ISO C conformance are used because they
1105 do not have an ISO standard meaning.
1106
1107 GCC normally generates special code to handle certain built-in functions
1108 more efficiently; for instance, calls to @code{alloca} may become single
1109 instructions that adjust the stack directly, and calls to @code{memcpy}
1110 may become inline copy loops.  The resulting code is often both smaller
1111 and faster, but since the function calls no longer appear as such, you
1112 cannot set a breakpoint on those calls, nor can you change the behavior
1113 of the functions by linking with a different library.
1114
1115 With the @option{-fno-builtin-@var{function}} option
1116 only the built-in function @var{function} is
1117 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1118 function is named this is not built-in in this version of GCC, this
1119 option is ignored.  There is no corresponding
1120 @option{-fbuiltin-@var{function}} option; if you wish to enable
1121 built-in functions selectively when using @option{-fno-builtin} or
1122 @option{-ffreestanding}, you may define macros such as:
1123
1124 @smallexample
1125 #define abs(n)          __builtin_abs ((n))
1126 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1127 @end smallexample
1128
1129 @item -fhosted
1130 @opindex fhosted
1131 @cindex hosted environment
1132
1133 Assert that compilation takes place in a hosted environment.  This implies
1134 @option{-fbuiltin}.  A hosted environment is one in which the
1135 entire standard library is available, and in which @code{main} has a return
1136 type of @code{int}.  Examples are nearly everything except a kernel.
1137 This is equivalent to @option{-fno-freestanding}.
1138
1139 @item -ffreestanding
1140 @opindex ffreestanding
1141 @cindex hosted environment
1142
1143 Assert that compilation takes place in a freestanding environment.  This
1144 implies @option{-fno-builtin}.  A freestanding environment
1145 is one in which the standard library may not exist, and program startup may
1146 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1147 This is equivalent to @option{-fno-hosted}.
1148
1149 @xref{Standards,,Language Standards Supported by GCC}, for details of
1150 freestanding and hosted environments.
1151
1152 @item -fms-extensions
1153 @opindex fms-extensions
1154 Accept some non-standard constructs used in Microsoft header files.
1155
1156 @item -trigraphs
1157 @opindex trigraphs
1158 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1159 options for strict ISO C conformance) implies @option{-trigraphs}.
1160
1161 @item -no-integrated-cpp
1162 @opindex no-integrated-cpp
1163 Performs a compilation in two passes: preprocessing and compiling.  This
1164 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1165 @option{-B} option. The user supplied compilation step can then add in
1166 an additional preprocessing step after normal preprocessing but before
1167 compiling. The default is to use the integrated cpp (internal cpp)
1168
1169 The semantics of this option will change if "cc1", "cc1plus", and
1170 "cc1obj" are merged.
1171
1172 @cindex traditional C language
1173 @cindex C language, traditional
1174 @item -traditional
1175 @itemx -traditional-cpp
1176 @opindex traditional-cpp
1177 @opindex traditional
1178 Formerly, these options caused GCC to attempt to emulate a pre-standard
1179 C compiler.  They are now only supported with the @option{-E} switch.
1180 The preprocessor continues to support a pre-standard mode.  See the GNU
1181 CPP manual for details.
1182
1183 @item -fcond-mismatch
1184 @opindex fcond-mismatch
1185 Allow conditional expressions with mismatched types in the second and
1186 third arguments.  The value of such an expression is void.  This option
1187 is not supported for C++.
1188
1189 @item -funsigned-char
1190 @opindex funsigned-char
1191 Let the type @code{char} be unsigned, like @code{unsigned char}.
1192
1193 Each kind of machine has a default for what @code{char} should
1194 be.  It is either like @code{unsigned char} by default or like
1195 @code{signed char} by default.
1196
1197 Ideally, a portable program should always use @code{signed char} or
1198 @code{unsigned char} when it depends on the signedness of an object.
1199 But many programs have been written to use plain @code{char} and
1200 expect it to be signed, or expect it to be unsigned, depending on the
1201 machines they were written for.  This option, and its inverse, let you
1202 make such a program work with the opposite default.
1203
1204 The type @code{char} is always a distinct type from each of
1205 @code{signed char} or @code{unsigned char}, even though its behavior
1206 is always just like one of those two.
1207
1208 @item -fsigned-char
1209 @opindex fsigned-char
1210 Let the type @code{char} be signed, like @code{signed char}.
1211
1212 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1213 the negative form of @option{-funsigned-char}.  Likewise, the option
1214 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1215
1216 @item -fsigned-bitfields
1217 @itemx -funsigned-bitfields
1218 @itemx -fno-signed-bitfields
1219 @itemx -fno-unsigned-bitfields
1220 @opindex fsigned-bitfields
1221 @opindex funsigned-bitfields
1222 @opindex fno-signed-bitfields
1223 @opindex fno-unsigned-bitfields
1224 These options control whether a bit-field is signed or unsigned, when the
1225 declaration does not use either @code{signed} or @code{unsigned}.  By
1226 default, such a bit-field is signed, because this is consistent: the
1227 basic integer types such as @code{int} are signed types.
1228 @end table
1229
1230 @node C++ Dialect Options
1231 @section Options Controlling C++ Dialect
1232
1233 @cindex compiler options, C++
1234 @cindex C++ options, command line
1235 @cindex options, C++
1236 This section describes the command-line options that are only meaningful
1237 for C++ programs; but you can also use most of the GNU compiler options
1238 regardless of what language your program is in.  For example, you
1239 might compile a file @code{firstClass.C} like this:
1240
1241 @smallexample
1242 g++ -g -frepo -O -c firstClass.C
1243 @end smallexample
1244
1245 @noindent
1246 In this example, only @option{-frepo} is an option meant
1247 only for C++ programs; you can use the other options with any
1248 language supported by GCC@.
1249
1250 Here is a list of options that are @emph{only} for compiling C++ programs:
1251
1252 @table @gcctabopt
1253
1254 @item -fabi-version=@var{n}
1255 @opindex fabi-version
1256 Use version @var{n} of the C++ ABI.  Version 2 is the version of the
1257 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1258 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1259 the version that conforms most closely to the C++ ABI specification.
1260 Therefore, the ABI obtained using version 0 will change as ABI bugs
1261 are fixed.
1262
1263 The default is version 2.
1264
1265 @item -fno-access-control
1266 @opindex fno-access-control
1267 Turn off all access checking.  This switch is mainly useful for working
1268 around bugs in the access control code.
1269
1270 @item -fcheck-new
1271 @opindex fcheck-new
1272 Check that the pointer returned by @code{operator new} is non-null
1273 before attempting to modify the storage allocated.  This check is
1274 normally unnecessary because the C++ standard specifies that
1275 @code{operator new} will only return @code{0} if it is declared
1276 @samp{throw()}, in which case the compiler will always check the
1277 return value even without this option.  In all other cases, when
1278 @code{operator new} has a non-empty exception specification, memory
1279 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1280 @samp{new (nothrow)}.
1281
1282 @item -fconserve-space
1283 @opindex fconserve-space
1284 Put uninitialized or runtime-initialized global variables into the
1285 common segment, as C does.  This saves space in the executable at the
1286 cost of not diagnosing duplicate definitions.  If you compile with this
1287 flag and your program mysteriously crashes after @code{main()} has
1288 completed, you may have an object that is being destroyed twice because
1289 two definitions were merged.
1290
1291 This option is no longer useful on most targets, now that support has
1292 been added for putting variables into BSS without making them common.
1293
1294 @item -fno-const-strings
1295 @opindex fno-const-strings
1296 Give string constants type @code{char *} instead of type @code{const
1297 char *}.  By default, G++ uses type @code{const char *} as required by
1298 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1299 actually modify the value of a string constant.
1300
1301 This option might be removed in a future release of G++.  For maximum
1302 portability, you should structure your code so that it works with
1303 string constants that have type @code{const char *}.
1304
1305 @item -fno-elide-constructors
1306 @opindex fno-elide-constructors
1307 The C++ standard allows an implementation to omit creating a temporary
1308 which is only used to initialize another object of the same type.
1309 Specifying this option disables that optimization, and forces G++ to
1310 call the copy constructor in all cases.
1311
1312 @item -fno-enforce-eh-specs
1313 @opindex fno-enforce-eh-specs
1314 Don't check for violation of exception specifications at runtime.  This
1315 option violates the C++ standard, but may be useful for reducing code
1316 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1317 will still optimize based on the exception specifications.
1318
1319 @item -ffor-scope
1320 @itemx -fno-for-scope
1321 @opindex ffor-scope
1322 @opindex fno-for-scope
1323 If @option{-ffor-scope} is specified, the scope of variables declared in
1324 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1325 as specified by the C++ standard.
1326 If @option{-fno-for-scope} is specified, the scope of variables declared in
1327 a @i{for-init-statement} extends to the end of the enclosing scope,
1328 as was the case in old versions of G++, and other (traditional)
1329 implementations of C++.
1330
1331 The default if neither flag is given to follow the standard,
1332 but to allow and give a warning for old-style code that would
1333 otherwise be invalid, or have different behavior.
1334
1335 @item -fno-gnu-keywords
1336 @opindex fno-gnu-keywords
1337 Do not recognize @code{typeof} as a keyword, so that code can use this
1338 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1339 @option{-ansi} implies @option{-fno-gnu-keywords}.
1340
1341 @item -fno-implicit-templates
1342 @opindex fno-implicit-templates
1343 Never emit code for non-inline templates which are instantiated
1344 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1345 @xref{Template Instantiation}, for more information.
1346
1347 @item -fno-implicit-inline-templates
1348 @opindex fno-implicit-inline-templates
1349 Don't emit code for implicit instantiations of inline templates, either.
1350 The default is to handle inlines differently so that compiles with and
1351 without optimization will need the same set of explicit instantiations.
1352
1353 @item -fno-implement-inlines
1354 @opindex fno-implement-inlines
1355 To save space, do not emit out-of-line copies of inline functions
1356 controlled by @samp{#pragma implementation}.  This will cause linker
1357 errors if these functions are not inlined everywhere they are called.
1358
1359 @item -fms-extensions
1360 @opindex fms-extensions
1361 Disable pedantic warnings about constructs used in MFC, such as implicit
1362 int and getting a pointer to member function via non-standard syntax.
1363
1364 @item -fno-nonansi-builtins
1365 @opindex fno-nonansi-builtins
1366 Disable built-in declarations of functions that are not mandated by
1367 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1368 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1369
1370 @item -fno-operator-names
1371 @opindex fno-operator-names
1372 Do not treat the operator name keywords @code{and}, @code{bitand},
1373 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1374 synonyms as keywords.
1375
1376 @item -fno-optional-diags
1377 @opindex fno-optional-diags
1378 Disable diagnostics that the standard says a compiler does not need to
1379 issue.  Currently, the only such diagnostic issued by G++ is the one for
1380 a name having multiple meanings within a class.
1381
1382 @item -fpermissive
1383 @opindex fpermissive
1384 Downgrade some diagnostics about nonconformant code from errors to
1385 warnings.  Thus, using @option{-fpermissive} will allow some
1386 nonconforming code to compile.
1387
1388 @item -frepo
1389 @opindex frepo
1390 Enable automatic template instantiation at link time.  This option also
1391 implies @option{-fno-implicit-templates}.  @xref{Template
1392 Instantiation}, for more information.
1393
1394 @item -fno-rtti
1395 @opindex fno-rtti
1396 Disable generation of information about every class with virtual
1397 functions for use by the C++ runtime type identification features
1398 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1399 of the language, you can save some space by using this flag.  Note that
1400 exception handling uses the same information, but it will generate it as
1401 needed.
1402
1403 @item -fstats
1404 @opindex fstats
1405 Emit statistics about front-end processing at the end of the compilation.
1406 This information is generally only useful to the G++ development team.
1407
1408 @item -ftemplate-depth-@var{n}
1409 @opindex ftemplate-depth
1410 Set the maximum instantiation depth for template classes to @var{n}.
1411 A limit on the template instantiation depth is needed to detect
1412 endless recursions during template class instantiation.  ANSI/ISO C++
1413 conforming programs must not rely on a maximum depth greater than 17.
1414
1415 @item -fuse-cxa-atexit
1416 @opindex fuse-cxa-atexit
1417 Register destructors for objects with static storage duration with the
1418 @code{__cxa_atexit} function rather than the @code{atexit} function.
1419 This option is required for fully standards-compliant handling of static
1420 destructors, but will only work if your C library supports
1421 @code{__cxa_atexit}.
1422
1423 @item -fno-weak
1424 @opindex fno-weak
1425 Do not use weak symbol support, even if it is provided by the linker.
1426 By default, G++ will use weak symbols if they are available.  This
1427 option exists only for testing, and should not be used by end-users;
1428 it will result in inferior code and has no benefits.  This option may
1429 be removed in a future release of G++.
1430
1431 @item -nostdinc++
1432 @opindex nostdinc++
1433 Do not search for header files in the standard directories specific to
1434 C++, but do still search the other standard directories.  (This option
1435 is used when building the C++ library.)
1436 @end table
1437
1438 In addition, these optimization, warning, and code generation options
1439 have meanings only for C++ programs:
1440
1441 @table @gcctabopt
1442 @item -fno-default-inline
1443 @opindex fno-default-inline
1444 Do not assume @samp{inline} for functions defined inside a class scope.
1445 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1446 functions will have linkage like inline functions; they just won't be
1447 inlined by default.
1448
1449 @item -Wabi @r{(C++ only)}
1450 @opindex Wabi
1451 Warn when G++ generates code that is probably not compatible with the
1452 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1453 all such cases, there are probably some cases that are not warned about,
1454 even though G++ is generating incompatible code.  There may also be
1455 cases where warnings are emitted even though the code that is generated
1456 will be compatible.
1457
1458 You should rewrite your code to avoid these warnings if you are
1459 concerned about the fact that code generated by G++ may not be binary
1460 compatible with code generated by other compilers.
1461
1462 The known incompatibilities at this point include:
1463
1464 @itemize @bullet
1465
1466 @item
1467 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1468 pack data into the same byte as a base class.  For example:
1469
1470 @smallexample
1471 struct A @{ virtual void f(); int f1 : 1; @};
1472 struct B : public A @{ int f2 : 1; @};
1473 @end smallexample
1474
1475 @noindent
1476 In this case, G++ will place @code{B::f2} into the same byte
1477 as@code{A::f1}; other compilers will not.  You can avoid this problem
1478 by explicitly padding @code{A} so that its size is a multiple of the
1479 byte size on your platform; that will cause G++ and other compilers to
1480 layout @code{B} identically.
1481
1482 @item
1483 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1484 tail padding when laying out virtual bases.  For example:
1485
1486 @smallexample
1487 struct A @{ virtual void f(); char c1; @};
1488 struct B @{ B(); char c2; @};
1489 struct C : public A, public virtual B @{@};
1490 @end smallexample
1491
1492 @noindent
1493 In this case, G++ will not place @code{B} into the tail-padding for
1494 @code{A}; other compilers will.  You can avoid this problem by
1495 explicitly padding @code{A} so that its size is a multiple of its
1496 alignment (ignoring virtual base classes); that will cause G++ and other
1497 compilers to layout @code{C} identically.
1498
1499 @item
1500 Incorrect handling of bit-fields with declared widths greater than that
1501 of their underlying types, when the bit-fields appear in a union.  For
1502 example:
1503
1504 @smallexample
1505 union U @{ int i : 4096; @};
1506 @end smallexample
1507
1508 @noindent
1509 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1510 union too small by the number of bits in an @code{int}.
1511
1512 @item
1513 Empty classes can be placed at incorrect offsets.  For example:
1514
1515 @smallexample
1516 struct A @{@};
1517
1518 struct B @{
1519   A a;
1520   virtual void f ();
1521 @};
1522
1523 struct C : public B, public A @{@};
1524 @end smallexample
1525
1526 @noindent
1527 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1528 it should be placed at offset zero.  G++ mistakenly believes that the
1529 @code{A} data member of @code{B} is already at offset zero.
1530
1531 @item
1532 Names of template functions whose types involve @code{typename} or
1533 template template parameters can be mangled incorrectly.
1534
1535 @smallexample
1536 template <typename Q>
1537 void f(typename Q::X) @{@}
1538
1539 template <template <typename> class Q>
1540 void f(typename Q<int>::X) @{@}
1541 @end smallexample
1542
1543 @noindent
1544 Instantiations of these templates may be mangled incorrectly.
1545
1546 @end itemize
1547
1548 @item -Wctor-dtor-privacy @r{(C++ only)}
1549 @opindex Wctor-dtor-privacy
1550 Warn when a class seems unusable because all the constructors or
1551 destructors in that class are private, and it has neither friends nor
1552 public static member functions.
1553
1554 @item -Wnon-virtual-dtor @r{(C++ only)}
1555 @opindex Wnon-virtual-dtor
1556 Warn when a class appears to be polymorphic, thereby requiring a virtual
1557 destructor, yet it declares a non-virtual one.
1558 This warning is enabled by @option{-Wall}.
1559
1560 @item -Wreorder @r{(C++ only)}
1561 @opindex Wreorder
1562 @cindex reordering, warning
1563 @cindex warning for reordering of member initializers
1564 Warn when the order of member initializers given in the code does not
1565 match the order in which they must be executed.  For instance:
1566
1567 @smallexample
1568 struct A @{
1569   int i;
1570   int j;
1571   A(): j (0), i (1) @{ @}
1572 @};
1573 @end smallexample
1574
1575 The compiler will rearrange the member initializers for @samp{i}
1576 and @samp{j} to match the declaration order of the members, emitting
1577 a warning to that effect.  This warning is enabled by @option{-Wall}.
1578 @end table
1579
1580 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1581
1582 @table @gcctabopt
1583 @item -Weffc++ @r{(C++ only)}
1584 @opindex Weffc++
1585 Warn about violations of the following style guidelines from Scott Meyers'
1586 @cite{Effective C++} book:
1587
1588 @itemize @bullet
1589 @item
1590 Item 11:  Define a copy constructor and an assignment operator for classes
1591 with dynamically allocated memory.
1592
1593 @item
1594 Item 12:  Prefer initialization to assignment in constructors.
1595
1596 @item
1597 Item 14:  Make destructors virtual in base classes.
1598
1599 @item
1600 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1601
1602 @item
1603 Item 23:  Don't try to return a reference when you must return an object.
1604
1605 @end itemize
1606
1607 Also warn about violations of the following style guidelines from
1608 Scott Meyers' @cite{More Effective C++} book:
1609
1610 @itemize @bullet
1611 @item
1612 Item 6:  Distinguish between prefix and postfix forms of increment and
1613 decrement operators.
1614
1615 @item
1616 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1617
1618 @end itemize
1619
1620 When selecting this option, be aware that the standard library
1621 headers do not obey all of these guidelines; use @samp{grep -v}
1622 to filter out those warnings.
1623
1624 @item -Wno-deprecated @r{(C++ only)}
1625 @opindex Wno-deprecated
1626 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1627
1628 @item -Wno-non-template-friend @r{(C++ only)}
1629 @opindex Wno-non-template-friend
1630 Disable warnings when non-templatized friend functions are declared
1631 within a template.  Since the advent of explicit template specification
1632 support in G++, if the name of the friend is an unqualified-id (i.e.,
1633 @samp{friend foo(int)}), the C++ language specification demands that the
1634 friend declare or define an ordinary, nontemplate function.  (Section
1635 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1636 could be interpreted as a particular specialization of a templatized
1637 function.  Because this non-conforming behavior is no longer the default
1638 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1639 check existing code for potential trouble spots and is on by default.
1640 This new compiler behavior can be turned off with
1641 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1642 but disables the helpful warning.
1643
1644 @item -Wold-style-cast @r{(C++ only)}
1645 @opindex Wold-style-cast
1646 Warn if an old-style (C-style) cast to a non-void type is used within
1647 a C++ program.  The new-style casts (@samp{static_cast},
1648 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1649 unintended effects and much easier to search for.
1650
1651 @item -Woverloaded-virtual @r{(C++ only)}
1652 @opindex Woverloaded-virtual
1653 @cindex overloaded virtual fn, warning
1654 @cindex warning for overloaded virtual fn
1655 Warn when a function declaration hides virtual functions from a
1656 base class.  For example, in:
1657
1658 @smallexample
1659 struct A @{
1660   virtual void f();
1661 @};
1662
1663 struct B: public A @{
1664   void f(int);
1665 @};
1666 @end smallexample
1667
1668 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1669 like:
1670
1671 @smallexample
1672 B* b;
1673 b->f();
1674 @end smallexample
1675
1676 will fail to compile.
1677
1678 @item -Wno-pmf-conversions @r{(C++ only)}
1679 @opindex Wno-pmf-conversions
1680 Disable the diagnostic for converting a bound pointer to member function
1681 to a plain pointer.
1682
1683 @item -Wsign-promo @r{(C++ only)}
1684 @opindex Wsign-promo
1685 Warn when overload resolution chooses a promotion from unsigned or
1686 enumeral type to a signed type, over a conversion to an unsigned type of
1687 the same size.  Previous versions of G++ would try to preserve
1688 unsignedness, but the standard mandates the current behavior.
1689
1690 @item -Wsynth @r{(C++ only)}
1691 @opindex Wsynth
1692 @cindex warning for synthesized methods
1693 @cindex synthesized methods, warning
1694 Warn when G++'s synthesis behavior does not match that of cfront.  For
1695 instance:
1696
1697 @smallexample
1698 struct A @{
1699   operator int ();
1700   A& operator = (int);
1701 @};
1702
1703 main ()
1704 @{
1705   A a,b;
1706   a = b;
1707 @}
1708 @end smallexample
1709
1710 In this example, G++ will synthesize a default @samp{A& operator =
1711 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1712 @end table
1713
1714 @node Objective-C Dialect Options
1715 @section Options Controlling Objective-C Dialect
1716
1717 @cindex compiler options, Objective-C
1718 @cindex Objective-C options, command line
1719 @cindex options, Objective-C
1720 (NOTE: This manual does not describe the Objective-C language itself.  See
1721 @w{@uref{http://gcc.gnu.org/readings.html}} for references.)
1722
1723 This section describes the command-line options that are only meaningful
1724 for Objective-C programs, but you can also use most of the GNU compiler
1725 options regardless of what language your program is in.  For example,
1726 you might compile a file @code{some_class.m} like this:
1727
1728 @smallexample
1729 gcc -g -fgnu-runtime -O -c some_class.m
1730 @end smallexample
1731
1732 @noindent
1733 In this example, @option{-fgnu-runtime} is an option meant only for
1734 Objective-C programs; you can use the other options with any language
1735 supported by GCC@.
1736
1737 Here is a list of options that are @emph{only} for compiling Objective-C
1738 programs:
1739
1740 @table @gcctabopt
1741 @item -fconstant-string-class=@var{class-name}
1742 @opindex fconstant-string-class
1743 Use @var{class-name} as the name of the class to instantiate for each
1744 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1745 class name is @code{NXConstantString} if the GNU runtime is being used, and
1746 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1747 @option{-fconstant-cfstrings} option, if also present, will override the
1748 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1749 to be laid out as constant CoreFoundation strings.
1750
1751 @item -fgnu-runtime
1752 @opindex fgnu-runtime
1753 Generate object code compatible with the standard GNU Objective-C
1754 runtime.  This is the default for most types of systems.
1755
1756 @item -fnext-runtime
1757 @opindex fnext-runtime
1758 Generate output compatible with the NeXT runtime.  This is the default
1759 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1760 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1761 used.
1762
1763 @item -fno-nil-receivers
1764 @opindex -fno-nil-receivers
1765 Assume that all Objective-C message dispatches (e.g.,
1766 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1767 is not @code{nil}.  This allows for more efficient entry points in the runtime to be
1768 used.  Currently, this option is only available in conjunction with
1769 the NeXT runtime on Mac OS X 10.3 and later.
1770
1771 @item -fobjc-exceptions
1772 @opindex -fobjc-exceptions
1773 Enable syntactic support for structured exception handling in Objective-C,
1774 similar to what is offered by C++ and Java.  Currently, this option is only
1775 available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
1776
1777 @smallexample
1778   @@try @{
1779     @dots{}
1780        @@throw expr;
1781     @dots{}
1782   @}
1783   @@catch (AnObjCClass *exc) @{
1784     @dots{}
1785       @@throw expr;
1786     @dots{}
1787       @@throw;
1788     @dots{}
1789   @}
1790   @@catch (AnotherClass *exc) @{
1791     @dots{}
1792   @}
1793   @@catch (id allOthers) @{
1794     @dots{}
1795   @}
1796   @@finally @{
1797     @dots{}
1798       @@throw expr;
1799     @dots{}
1800   @}
1801 @end smallexample
1802
1803 The @code{@@throw} statement may appear anywhere in an Objective-C or
1804 Objective-C++ program; when used inside of a @code{@@catch} block, the
1805 @code{@@throw} may appear without an argument (as shown above), in which case
1806 the object caught by the @code{@@catch} will be rethrown.
1807
1808 Note that only (pointers to) Objective-C objects may be thrown and
1809 caught using this scheme.  When an object is thrown, it will be caught
1810 by the nearest @code{@@catch} clause capable of handling objects of that type,
1811 analogously to how @code{catch} blocks work in C++ and Java.  A
1812 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
1813 any and all Objective-C exceptions not caught by previous @code{@@catch}
1814 clauses (if any).
1815
1816 The @code{@@finally} clause, if present, will be executed upon exit from the
1817 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1818 regardless of whether any exceptions are thrown, caught or rethrown
1819 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1820 of the @code{finally} clause in Java.
1821
1822 There are several caveats to using the new exception mechanism:
1823
1824 @itemize @bullet
1825 @item
1826 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
1827 idioms provided by the @code{NSException} class, the new
1828 exceptions can only be used on Mac OS X 10.3 (Panther) and later
1829 systems, due to additional functionality needed in the (NeXT) Objective-C
1830 runtime.
1831
1832 @item
1833 As mentioned above, the new exceptions do not support handling
1834 types other than Objective-C objects.   Furthermore, when used from
1835 Objective-C++, the Objective-C exception model does not interoperate with C++
1836 exceptions at this time.  This means you cannot @code{@@throw} an exception
1837 from Objective-C and @code{catch} it in C++, or vice versa
1838 (i.e., @code{throw @dots{} @@catch}).
1839 @end itemize
1840
1841 The @option{-fobjc-exceptions} switch also enables the use of synchronization
1842 blocks for thread-safe execution:
1843
1844 @smallexample
1845   @@synchronized (ObjCClass *guard) @{
1846     @dots{}
1847   @}
1848 @end smallexample
1849
1850 Upon entering the @code{@@synchronized} block, a thread of execution shall
1851 first check whether a lock has been placed on the corresponding @code{guard}
1852 object by another thread.  If it has, the current thread shall wait until
1853 the other thread relinquishes its lock.  Once @code{guard} becomes available,
1854 the current thread will place its own lock on it, execute the code contained in
1855 the @code{@@synchronized} block, and finally relinquish the lock (thereby
1856 making @code{guard} available to other threads).
1857
1858 Unlike Java, Objective-C does not allow for entire methods to be marked
1859 @code{@@synchronized}.  Note that throwing exceptions out of
1860 @code{@@synchronized} blocks is allowed, and will cause the guarding object
1861 to be unlocked properly.
1862
1863 @item -freplace-objc-classes
1864 @opindex -freplace-objc-classes
1865 Emit a special marker instructing @command{ld(1)} not to statically link in
1866 the resulting object file, and allow @command{dyld(1)} to load it in at
1867 run time instead.  This is used in conjunction with the Fix-and-Continue
1868 debugging mode, where the object file in question may be recompiled and
1869 dynamically reloaded in the course of program execution, without the need
1870 to restart the program itself.  Currently, Fix-and-Continue functionality
1871 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
1872 and later.
1873
1874 @item -fzero-link
1875 @opindex -fzero-link
1876 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1877 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1878 compile time) with static class references that get initialized at load time,
1879 which improves run-time performance.  Specifying the @option{-fzero-link} flag
1880 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
1881 to be retained.  This is useful in Zero-Link debugging mode, since it allows
1882 for individual class implementations to be modified during program execution.
1883
1884 @item -gen-decls
1885 @opindex gen-decls
1886 Dump interface declarations for all classes seen in the source file to a
1887 file named @file{@var{sourcename}.decl}.
1888
1889 @item -Wno-protocol
1890 @opindex Wno-protocol
1891 If a class is declared to implement a protocol, a warning is issued for
1892 every method in the protocol that is not implemented by the class.  The
1893 default behavior is to issue a warning for every method not explicitly
1894 implemented in the class, even if a method implementation is inherited
1895 from the superclass.  If you use the @code{-Wno-protocol} option, then
1896 methods inherited from the superclass are considered to be implemented,
1897 and no warning is issued for them.
1898
1899 @item -Wselector
1900 @opindex Wselector
1901 Warn if multiple methods of different types for the same selector are
1902 found during compilation.  The check is performed on the list of methods
1903 in the final stage of compilation.  Additionally, a check is performed
1904 for each selector appearing in a @code{@@selector(@dots{})}
1905 expression, and a corresponding method for that selector has been found
1906 during compilation.  Because these checks scan the method table only at
1907 the end of compilation, these warnings are not produced if the final
1908 stage of compilation is not reached, for example because an error is
1909 found during compilation, or because the @code{-fsyntax-only} option is
1910 being used.
1911
1912 @item -Wundeclared-selector
1913 @opindex Wundeclared-selector
1914 Warn if a @code{@@selector(@dots{})} expression referring to an
1915 undeclared selector is found.  A selector is considered undeclared if no
1916 method with that name has been declared before the
1917 @code{@@selector(@dots{})} expression, either explicitly in an
1918 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
1919 an @code{@@implementation} section.  This option always performs its
1920 checks as soon as a @code{@@selector(@dots{})} expression is found,
1921 while @code{-Wselector} only performs its checks in the final stage of
1922 compilation.  This also enforces the coding style convention
1923 that methods and selectors must be declared before being used.
1924
1925 @item -print-objc-runtime-info
1926 @opindex -print-objc-runtime-info
1927 Generate C header describing the largest structure that is passed by
1928 value, if any.
1929
1930 @end table
1931
1932 @node Language Independent Options
1933 @section Options to Control Diagnostic Messages Formatting
1934 @cindex options to control diagnostics formatting
1935 @cindex diagnostic messages
1936 @cindex message formatting
1937
1938 Traditionally, diagnostic messages have been formatted irrespective of
1939 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1940 below can be used to control the diagnostic messages formatting
1941 algorithm, e.g.@: how many characters per line, how often source location
1942 information should be reported.  Right now, only the C++ front end can
1943 honor these options.  However it is expected, in the near future, that
1944 the remaining front ends would be able to digest them correctly.
1945
1946 @table @gcctabopt
1947 @item -fmessage-length=@var{n}
1948 @opindex fmessage-length
1949 Try to format error messages so that they fit on lines of about @var{n}
1950 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1951 the front ends supported by GCC@.  If @var{n} is zero, then no
1952 line-wrapping will be done; each error message will appear on a single
1953 line.
1954
1955 @opindex fdiagnostics-show-location
1956 @item -fdiagnostics-show-location=once
1957 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1958 reporter to emit @emph{once} source location information; that is, in
1959 case the message is too long to fit on a single physical line and has to
1960 be wrapped, the source location won't be emitted (as prefix) again,
1961 over and over, in subsequent continuation lines.  This is the default
1962 behavior.
1963
1964 @item -fdiagnostics-show-location=every-line
1965 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1966 messages reporter to emit the same source location information (as
1967 prefix) for physical lines that result from the process of breaking
1968 a message which is too long to fit on a single line.
1969
1970 @end table
1971
1972 @node Warning Options
1973 @section Options to Request or Suppress Warnings
1974 @cindex options to control warnings
1975 @cindex warning messages
1976 @cindex messages, warning
1977 @cindex suppressing warnings
1978
1979 Warnings are diagnostic messages that report constructions which
1980 are not inherently erroneous but which are risky or suggest there
1981 may have been an error.
1982
1983 You can request many specific warnings with options beginning @samp{-W},
1984 for example @option{-Wimplicit} to request warnings on implicit
1985 declarations.  Each of these specific warning options also has a
1986 negative form beginning @samp{-Wno-} to turn off warnings;
1987 for example, @option{-Wno-implicit}.  This manual lists only one of the
1988 two forms, whichever is not the default.
1989
1990 The following options control the amount and kinds of warnings produced
1991 by GCC; for further, language-specific options also refer to
1992 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
1993
1994 @table @gcctabopt
1995 @cindex syntax checking
1996 @item -fsyntax-only
1997 @opindex fsyntax-only
1998 Check the code for syntax errors, but don't do anything beyond that.
1999
2000 @item -pedantic
2001 @opindex pedantic
2002 Issue all the warnings demanded by strict ISO C and ISO C++;
2003 reject all programs that use forbidden extensions, and some other
2004 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2005 version of the ISO C standard specified by any @option{-std} option used.
2006
2007 Valid ISO C and ISO C++ programs should compile properly with or without
2008 this option (though a rare few will require @option{-ansi} or a
2009 @option{-std} option specifying the required version of ISO C)@.  However,
2010 without this option, certain GNU extensions and traditional C and C++
2011 features are supported as well.  With this option, they are rejected.
2012
2013 @option{-pedantic} does not cause warning messages for use of the
2014 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2015 warnings are also disabled in the expression that follows
2016 @code{__extension__}.  However, only system header files should use
2017 these escape routes; application programs should avoid them.
2018 @xref{Alternate Keywords}.
2019
2020 Some users try to use @option{-pedantic} to check programs for strict ISO
2021 C conformance.  They soon find that it does not do quite what they want:
2022 it finds some non-ISO practices, but not all---only those for which
2023 ISO C @emph{requires} a diagnostic, and some others for which
2024 diagnostics have been added.
2025
2026 A feature to report any failure to conform to ISO C might be useful in
2027 some instances, but would require considerable additional work and would
2028 be quite different from @option{-pedantic}.  We don't have plans to
2029 support such a feature in the near future.
2030
2031 Where the standard specified with @option{-std} represents a GNU
2032 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2033 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2034 extended dialect is based.  Warnings from @option{-pedantic} are given
2035 where they are required by the base standard.  (It would not make sense
2036 for such warnings to be given only for features not in the specified GNU
2037 C dialect, since by definition the GNU dialects of C include all
2038 features the compiler supports with the given option, and there would be
2039 nothing to warn about.)
2040
2041 @item -pedantic-errors
2042 @opindex pedantic-errors
2043 Like @option{-pedantic}, except that errors are produced rather than
2044 warnings.
2045
2046 @item -w
2047 @opindex w
2048 Inhibit all warning messages.
2049
2050 @item -Wno-import
2051 @opindex Wno-import
2052 Inhibit warning messages about the use of @samp{#import}.
2053
2054 @item -Wchar-subscripts
2055 @opindex Wchar-subscripts
2056 Warn if an array subscript has type @code{char}.  This is a common cause
2057 of error, as programmers often forget that this type is signed on some
2058 machines.
2059
2060 @item -Wcomment
2061 @opindex Wcomment
2062 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2063 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2064
2065 @item -Wformat
2066 @opindex Wformat
2067 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2068 the arguments supplied have types appropriate to the format string
2069 specified, and that the conversions specified in the format string make
2070 sense.  This includes standard functions, and others specified by format
2071 attributes (@pxref{Function Attributes}), in the @code{printf},
2072 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2073 not in the C standard) families.
2074
2075 The formats are checked against the format features supported by GNU
2076 libc version 2.2.  These include all ISO C90 and C99 features, as well
2077 as features from the Single Unix Specification and some BSD and GNU
2078 extensions.  Other library implementations may not support all these
2079 features; GCC does not support warning about features that go beyond a
2080 particular library's limitations.  However, if @option{-pedantic} is used
2081 with @option{-Wformat}, warnings will be given about format features not
2082 in the selected standard version (but not for @code{strfmon} formats,
2083 since those are not in any version of the C standard).  @xref{C Dialect
2084 Options,,Options Controlling C Dialect}.
2085
2086 Since @option{-Wformat} also checks for null format arguments for
2087 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2088
2089 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2090 aspects of format checking, the options @option{-Wformat-y2k},
2091 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2092 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2093 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2094
2095 @item -Wformat-y2k
2096 @opindex Wformat-y2k
2097 If @option{-Wformat} is specified, also warn about @code{strftime}
2098 formats which may yield only a two-digit year.
2099
2100 @item -Wno-format-extra-args
2101 @opindex Wno-format-extra-args
2102 If @option{-Wformat} is specified, do not warn about excess arguments to a
2103 @code{printf} or @code{scanf} format function.  The C standard specifies
2104 that such arguments are ignored.
2105
2106 Where the unused arguments lie between used arguments that are
2107 specified with @samp{$} operand number specifications, normally
2108 warnings are still given, since the implementation could not know what
2109 type to pass to @code{va_arg} to skip the unused arguments.  However,
2110 in the case of @code{scanf} formats, this option will suppress the
2111 warning if the unused arguments are all pointers, since the Single
2112 Unix Specification says that such unused arguments are allowed.
2113
2114 @item -Wno-format-zero-length
2115 @opindex Wno-format-zero-length
2116 If @option{-Wformat} is specified, do not warn about zero-length formats.
2117 The C standard specifies that zero-length formats are allowed.
2118
2119 @item -Wformat-nonliteral
2120 @opindex Wformat-nonliteral
2121 If @option{-Wformat} is specified, also warn if the format string is not a
2122 string literal and so cannot be checked, unless the format function
2123 takes its format arguments as a @code{va_list}.
2124
2125 @item -Wformat-security
2126 @opindex Wformat-security
2127 If @option{-Wformat} is specified, also warn about uses of format
2128 functions that represent possible security problems.  At present, this
2129 warns about calls to @code{printf} and @code{scanf} functions where the
2130 format string is not a string literal and there are no format arguments,
2131 as in @code{printf (foo);}.  This may be a security hole if the format
2132 string came from untrusted input and contains @samp{%n}.  (This is
2133 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2134 in future warnings may be added to @option{-Wformat-security} that are not
2135 included in @option{-Wformat-nonliteral}.)
2136
2137 @item -Wformat=2
2138 @opindex Wformat=2
2139 Enable @option{-Wformat} plus format checks not included in
2140 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2141 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2142
2143 @item -Wnonnull
2144 @opindex Wnonnull
2145 Warn about passing a null pointer for arguments marked as
2146 requiring a non-null value by the @code{nonnull} function attribute.
2147
2148 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2149 can be disabled with the @option{-Wno-nonnull} option.
2150
2151 @item -Winit-self @r{(C, C++, and Objective-C only)}
2152 @opindex Winit-self
2153 Warn about uninitialized variables which are initialized with themselves.
2154 Note this option can only be used with the @option{-Wuninitialized} option,
2155 which in turn only works with @option{-O1} and above.
2156
2157 For example, GCC will warn about @code{i} being uninitialized in the
2158 following snippet only when @option{-Winit-self} has been specified:
2159 @smallexample
2160 @group
2161 int f()
2162 @{
2163   int i = i;
2164   return i;
2165 @}
2166 @end group
2167 @end smallexample
2168
2169 @item -Wimplicit-int
2170 @opindex Wimplicit-int
2171 Warn when a declaration does not specify a type.
2172
2173 @item -Wimplicit-function-declaration
2174 @itemx -Werror-implicit-function-declaration
2175 @opindex Wimplicit-function-declaration
2176 @opindex Werror-implicit-function-declaration
2177 Give a warning (or error) whenever a function is used before being
2178 declared.
2179
2180 @item -Wimplicit
2181 @opindex Wimplicit
2182 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2183
2184 @item -Wmain
2185 @opindex Wmain
2186 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2187 function with external linkage, returning int, taking either zero
2188 arguments, two, or three arguments of appropriate types.
2189
2190 @item -Wmissing-braces
2191 @opindex Wmissing-braces
2192 Warn if an aggregate or union initializer is not fully bracketed.  In
2193 the following example, the initializer for @samp{a} is not fully
2194 bracketed, but that for @samp{b} is fully bracketed.
2195
2196 @smallexample
2197 int a[2][2] = @{ 0, 1, 2, 3 @};
2198 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2199 @end smallexample
2200
2201 @item -Wparentheses
2202 @opindex Wparentheses
2203 Warn if parentheses are omitted in certain contexts, such
2204 as when there is an assignment in a context where a truth value
2205 is expected, or when operators are nested whose precedence people
2206 often get confused about.
2207
2208 Also warn about constructions where there may be confusion to which
2209 @code{if} statement an @code{else} branch belongs.  Here is an example of
2210 such a case:
2211
2212 @smallexample
2213 @group
2214 @{
2215   if (a)
2216     if (b)
2217       foo ();
2218   else
2219     bar ();
2220 @}
2221 @end group
2222 @end smallexample
2223
2224 In C, every @code{else} branch belongs to the innermost possible @code{if}
2225 statement, which in this example is @code{if (b)}.  This is often not
2226 what the programmer expected, as illustrated in the above example by
2227 indentation the programmer chose.  When there is the potential for this
2228 confusion, GCC will issue a warning when this flag is specified.
2229 To eliminate the warning, add explicit braces around the innermost
2230 @code{if} statement so there is no way the @code{else} could belong to
2231 the enclosing @code{if}.  The resulting code would look like this:
2232
2233 @smallexample
2234 @group
2235 @{
2236   if (a)
2237     @{
2238       if (b)
2239         foo ();
2240       else
2241         bar ();
2242     @}
2243 @}
2244 @end group
2245 @end smallexample
2246
2247 @item -Wsequence-point
2248 @opindex Wsequence-point
2249 Warn about code that may have undefined semantics because of violations
2250 of sequence point rules in the C standard.
2251
2252 The C standard defines the order in which expressions in a C program are
2253 evaluated in terms of @dfn{sequence points}, which represent a partial
2254 ordering between the execution of parts of the program: those executed
2255 before the sequence point, and those executed after it.  These occur
2256 after the evaluation of a full expression (one which is not part of a
2257 larger expression), after the evaluation of the first operand of a
2258 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2259 function is called (but after the evaluation of its arguments and the
2260 expression denoting the called function), and in certain other places.
2261 Other than as expressed by the sequence point rules, the order of
2262 evaluation of subexpressions of an expression is not specified.  All
2263 these rules describe only a partial order rather than a total order,
2264 since, for example, if two functions are called within one expression
2265 with no sequence point between them, the order in which the functions
2266 are called is not specified.  However, the standards committee have
2267 ruled that function calls do not overlap.
2268
2269 It is not specified when between sequence points modifications to the
2270 values of objects take effect.  Programs whose behavior depends on this
2271 have undefined behavior; the C standard specifies that ``Between the
2272 previous and next sequence point an object shall have its stored value
2273 modified at most once by the evaluation of an expression.  Furthermore,
2274 the prior value shall be read only to determine the value to be
2275 stored.''.  If a program breaks these rules, the results on any
2276 particular implementation are entirely unpredictable.
2277
2278 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2279 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2280 diagnosed by this option, and it may give an occasional false positive
2281 result, but in general it has been found fairly effective at detecting
2282 this sort of problem in programs.
2283
2284 The present implementation of this option only works for C programs.  A
2285 future implementation may also work for C++ programs.
2286
2287 The C standard is worded confusingly, therefore there is some debate
2288 over the precise meaning of the sequence point rules in subtle cases.
2289 Links to discussions of the problem, including proposed formal
2290 definitions, may be found on our readings page, at
2291 @w{@uref{http://gcc.gnu.org/readings.html}}.
2292
2293 @item -Wreturn-type
2294 @opindex Wreturn-type
2295 Warn whenever a function is defined with a return-type that defaults to
2296 @code{int}.  Also warn about any @code{return} statement with no
2297 return-value in a function whose return-type is not @code{void}.
2298
2299 For C++, a function without return type always produces a diagnostic
2300 message, even when @option{-Wno-return-type} is specified.  The only
2301 exceptions are @samp{main} and functions defined in system headers.
2302
2303 @item -Wswitch
2304 @opindex Wswitch
2305 Warn whenever a @code{switch} statement has an index of enumeral type
2306 and lacks a @code{case} for one or more of the named codes of that
2307 enumeration.  (The presence of a @code{default} label prevents this
2308 warning.)  @code{case} labels outside the enumeration range also
2309 provoke warnings when this option is used.
2310
2311 @item -Wswitch-default
2312 @opindex Wswitch-switch
2313 Warn whenever a @code{switch} statement does not have a @code{default}
2314 case.
2315
2316 @item -Wswitch-enum
2317 @opindex Wswitch-enum
2318 Warn whenever a @code{switch} statement has an index of enumeral type
2319 and lacks a @code{case} for one or more of the named codes of that
2320 enumeration.  @code{case} labels outside the enumeration range also
2321 provoke warnings when this option is used.
2322
2323 @item -Wtrigraphs
2324 @opindex Wtrigraphs
2325 Warn if any trigraphs are encountered that might change the meaning of
2326 the program (trigraphs within comments are not warned about).
2327
2328 @item -Wunused-function
2329 @opindex Wunused-function
2330 Warn whenever a static function is declared but not defined or a
2331 non\-inline static function is unused.
2332
2333 @item -Wunused-label
2334 @opindex Wunused-label
2335 Warn whenever a label is declared but not used.
2336
2337 To suppress this warning use the @samp{unused} attribute
2338 (@pxref{Variable Attributes}).
2339
2340 @item -Wunused-parameter
2341 @opindex Wunused-parameter
2342 Warn whenever a function parameter is unused aside from its declaration.
2343
2344 To suppress this warning use the @samp{unused} attribute
2345 (@pxref{Variable Attributes}).
2346
2347 @item -Wunused-variable
2348 @opindex Wunused-variable
2349 Warn whenever a local variable or non-constant static variable is unused
2350 aside from its declaration
2351
2352 To suppress this warning use the @samp{unused} attribute
2353 (@pxref{Variable Attributes}).
2354
2355 @item -Wunused-value
2356 @opindex Wunused-value
2357 Warn whenever a statement computes a result that is explicitly not used.
2358
2359 To suppress this warning cast the expression to @samp{void}.
2360
2361 @item -Wunused
2362 @opindex Wunused
2363 All the above @option{-Wunused} options combined.
2364
2365 In order to get a warning about an unused function parameter, you must
2366 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2367 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2368
2369 @item -Wuninitialized
2370 @opindex Wuninitialized
2371 Warn if an automatic variable is used without first being initialized or
2372 if a variable may be clobbered by a @code{setjmp} call.
2373
2374 These warnings are possible only in optimizing compilation,
2375 because they require data flow information that is computed only
2376 when optimizing.  If you don't specify @option{-O}, you simply won't
2377 get these warnings.
2378
2379 If you want to warn about code which uses the uninitialized value of the
2380 variable in its own initializer, use the @option{-Winit-self} option.
2381
2382 These warnings occur only for variables that are candidates for
2383 register allocation.  Therefore, they do not occur for a variable that
2384 is declared @code{volatile}, or whose address is taken, or whose size
2385 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2386 structures, unions or arrays, even when they are in registers.
2387
2388 Note that there may be no warning about a variable that is used only
2389 to compute a value that itself is never used, because such
2390 computations may be deleted by data flow analysis before the warnings
2391 are printed.
2392
2393 These warnings are made optional because GCC is not smart
2394 enough to see all the reasons why the code might be correct
2395 despite appearing to have an error.  Here is one example of how
2396 this can happen:
2397
2398 @smallexample
2399 @group
2400 @{
2401   int x;
2402   switch (y)
2403     @{
2404     case 1: x = 1;
2405       break;
2406     case 2: x = 4;
2407       break;
2408     case 3: x = 5;
2409     @}
2410   foo (x);
2411 @}
2412 @end group
2413 @end smallexample
2414
2415 @noindent
2416 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2417 always initialized, but GCC doesn't know this.  Here is
2418 another common case:
2419
2420 @smallexample
2421 @{
2422   int save_y;
2423   if (change_y) save_y = y, y = new_y;
2424   @dots{}
2425   if (change_y) y = save_y;
2426 @}
2427 @end smallexample
2428
2429 @noindent
2430 This has no bug because @code{save_y} is used only if it is set.
2431
2432 @cindex @code{longjmp} warnings
2433 This option also warns when a non-volatile automatic variable might be
2434 changed by a call to @code{longjmp}.  These warnings as well are possible
2435 only in optimizing compilation.
2436
2437 The compiler sees only the calls to @code{setjmp}.  It cannot know
2438 where @code{longjmp} will be called; in fact, a signal handler could
2439 call it at any point in the code.  As a result, you may get a warning
2440 even when there is in fact no problem because @code{longjmp} cannot
2441 in fact be called at the place which would cause a problem.
2442
2443 Some spurious warnings can be avoided if you declare all the functions
2444 you use that never return as @code{noreturn}.  @xref{Function
2445 Attributes}.
2446
2447 @item -Wunknown-pragmas
2448 @opindex Wunknown-pragmas
2449 @cindex warning for unknown pragmas
2450 @cindex unknown pragmas, warning
2451 @cindex pragmas, warning of unknown
2452 Warn when a #pragma directive is encountered which is not understood by
2453 GCC@.  If this command line option is used, warnings will even be issued
2454 for unknown pragmas in system header files.  This is not the case if
2455 the warnings were only enabled by the @option{-Wall} command line option.
2456
2457 @item -Wstrict-aliasing
2458 @opindex Wstrict-aliasing
2459 This option is only active when @option{-fstrict-aliasing} is active.
2460 It warns about code which might break the strict aliasing rules that the
2461 compiler is using for optimization. The warning does not catch all
2462 cases, but does attempt to catch the more common pitfalls. It is
2463 included in @option{-Wall}.
2464
2465 @item -Wstrict-aliasing=2
2466 @opindex Wstrict-aliasing=2
2467 This option is only active when @option{-fstrict-aliasing} is active.
2468 It warns about all code which might break the strict aliasing rules that the
2469 compiler is using for optimization.  This warning catches all cases, but
2470 it will also give a warning for some ambiguous cases that are safe.
2471
2472 @item -Wall
2473 @opindex Wall
2474 All of the above @samp{-W} options combined.  This enables all the
2475 warnings about constructions that some users consider questionable, and
2476 that are easy to avoid (or modify to prevent the warning), even in
2477 conjunction with macros.  This also enables some language-specific
2478 warnings described in @ref{C++ Dialect Options} and
2479 @ref{Objective-C Dialect Options}.
2480 @end table
2481
2482 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2483 Some of them warn about constructions that users generally do not
2484 consider questionable, but which occasionally you might wish to check
2485 for; others warn about constructions that are necessary or hard to avoid
2486 in some cases, and there is no simple way to modify the code to suppress
2487 the warning.
2488
2489 @table @gcctabopt
2490 @item -Wextra
2491 @opindex W
2492 @opindex Wextra
2493 (This option used to be called @option{-W}.  The older name is still
2494 supported, but the newer name is more descriptive.)  Print extra warning
2495 messages for these events:
2496
2497 @itemize @bullet
2498 @item
2499 A function can return either with or without a value.  (Falling
2500 off the end of the function body is considered returning without
2501 a value.)  For example, this function would evoke such a
2502 warning:
2503
2504 @smallexample
2505 @group
2506 foo (a)
2507 @{
2508   if (a > 0)
2509     return a;
2510 @}
2511 @end group
2512 @end smallexample
2513
2514 @item
2515 An expression-statement or the left-hand side of a comma expression
2516 contains no side effects.
2517 To suppress the warning, cast the unused expression to void.
2518 For example, an expression such as @samp{x[i,j]} will cause a warning,
2519 but @samp{x[(void)i,j]} will not.
2520
2521 @item
2522 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2523
2524 @item
2525 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2526 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2527 that of ordinary mathematical notation.
2528
2529 @item
2530 Storage-class specifiers like @code{static} are not the first things in
2531 a declaration.  According to the C Standard, this usage is obsolescent.
2532
2533 @item
2534 The return type of a function has a type qualifier such as @code{const}.
2535 Such a type qualifier has no effect, since the value returned by a
2536 function is not an lvalue.  (But don't warn about the GNU extension of
2537 @code{volatile void} return types.  That extension will be warned about
2538 if @option{-pedantic} is specified.)
2539
2540 @item
2541 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2542 arguments.
2543
2544 @item
2545 A comparison between signed and unsigned values could produce an
2546 incorrect result when the signed value is converted to unsigned.
2547 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2548
2549 @item
2550 An aggregate has an initializer which does not initialize all members.
2551 For example, the following code would cause such a warning, because
2552 @code{x.h} would be implicitly initialized to zero:
2553
2554 @smallexample
2555 struct s @{ int f, g, h; @};
2556 struct s x = @{ 3, 4 @};
2557 @end smallexample
2558
2559 @item
2560 A function parameter is declared without a type specifier in K&R-style
2561 functions:
2562
2563 @smallexample
2564 void foo(bar) @{ @}
2565 @end smallexample
2566
2567 @item
2568 An empty body occurs in an @samp{if} or @samp{else} statement.
2569
2570 @item
2571 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2572 @samp{>}, or @samp{>=}.
2573
2574 @item
2575 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2576
2577 @item
2578 Any of several floating-point events that often indicate errors, such as
2579 overflow, underflow, loss of precision, etc.
2580
2581 @item @r{(C++ only)}
2582 An enumerator and a non-enumerator both appear in a conditional expression.
2583
2584 @item @r{(C++ only)}
2585 A non-static reference or non-static @samp{const} member appears in a
2586 class without constructors.
2587
2588 @item @r{(C++ only)}
2589 Ambiguous virtual bases.
2590
2591 @item @r{(C++ only)}
2592 Subscripting an array which has been declared @samp{register}.
2593
2594 @item @r{(C++ only)}
2595 Taking the address of a variable which has been declared @samp{register}.
2596
2597 @item @r{(C++ only)}
2598 A base class is not initialized in a derived class' copy constructor.
2599 @end itemize
2600
2601 @item -Wno-div-by-zero
2602 @opindex Wno-div-by-zero
2603 @opindex Wdiv-by-zero
2604 Do not warn about compile-time integer division by zero.  Floating point
2605 division by zero is not warned about, as it can be a legitimate way of
2606 obtaining infinities and NaNs.
2607
2608 @item -Wsystem-headers
2609 @opindex Wsystem-headers
2610 @cindex warnings from system headers
2611 @cindex system headers, warnings from
2612 Print warning messages for constructs found in system header files.
2613 Warnings from system headers are normally suppressed, on the assumption
2614 that they usually do not indicate real problems and would only make the
2615 compiler output harder to read.  Using this command line option tells
2616 GCC to emit warnings from system headers as if they occurred in user
2617 code.  However, note that using @option{-Wall} in conjunction with this
2618 option will @emph{not} warn about unknown pragmas in system
2619 headers---for that, @option{-Wunknown-pragmas} must also be used.
2620
2621 @item -Wfloat-equal
2622 @opindex Wfloat-equal
2623 Warn if floating point values are used in equality comparisons.
2624
2625 The idea behind this is that sometimes it is convenient (for the
2626 programmer) to consider floating-point values as approximations to
2627 infinitely precise real numbers.  If you are doing this, then you need
2628 to compute (by analyzing the code, or in some other way) the maximum or
2629 likely maximum error that the computation introduces, and allow for it
2630 when performing comparisons (and when producing output, but that's a
2631 different problem).  In particular, instead of testing for equality, you
2632 would check to see whether the two values have ranges that overlap; and
2633 this is done with the relational operators, so equality comparisons are
2634 probably mistaken.
2635
2636 @item -Wtraditional @r{(C only)}
2637 @opindex Wtraditional
2638 Warn about certain constructs that behave differently in traditional and
2639 ISO C@.  Also warn about ISO C constructs that have no traditional C
2640 equivalent, and/or problematic constructs which should be avoided.
2641
2642 @itemize @bullet
2643 @item
2644 Macro parameters that appear within string literals in the macro body.
2645 In traditional C macro replacement takes place within string literals,
2646 but does not in ISO C@.
2647
2648 @item
2649 In traditional C, some preprocessor directives did not exist.
2650 Traditional preprocessors would only consider a line to be a directive
2651 if the @samp{#} appeared in column 1 on the line.  Therefore
2652 @option{-Wtraditional} warns about directives that traditional C
2653 understands but would ignore because the @samp{#} does not appear as the
2654 first character on the line.  It also suggests you hide directives like
2655 @samp{#pragma} not understood by traditional C by indenting them.  Some
2656 traditional implementations would not recognize @samp{#elif}, so it
2657 suggests avoiding it altogether.
2658
2659 @item
2660 A function-like macro that appears without arguments.
2661
2662 @item
2663 The unary plus operator.
2664
2665 @item
2666 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2667 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2668 constants.)  Note, these suffixes appear in macros defined in the system
2669 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2670 Use of these macros in user code might normally lead to spurious
2671 warnings, however GCC's integrated preprocessor has enough context to
2672 avoid warning in these cases.
2673
2674 @item
2675 A function declared external in one block and then used after the end of
2676 the block.
2677
2678 @item
2679 A @code{switch} statement has an operand of type @code{long}.
2680
2681 @item
2682 A non-@code{static} function declaration follows a @code{static} one.
2683 This construct is not accepted by some traditional C compilers.
2684
2685 @item
2686 The ISO type of an integer constant has a different width or
2687 signedness from its traditional type.  This warning is only issued if
2688 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2689 typically represent bit patterns, are not warned about.
2690
2691 @item
2692 Usage of ISO string concatenation is detected.
2693
2694 @item
2695 Initialization of automatic aggregates.
2696
2697 @item
2698 Identifier conflicts with labels.  Traditional C lacks a separate
2699 namespace for labels.
2700
2701 @item
2702 Initialization of unions.  If the initializer is zero, the warning is
2703 omitted.  This is done under the assumption that the zero initializer in
2704 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2705 initializer warnings and relies on default initialization to zero in the
2706 traditional C case.
2707
2708 @item
2709 Conversions by prototypes between fixed/floating point values and vice
2710 versa.  The absence of these prototypes when compiling with traditional
2711 C would cause serious problems.  This is a subset of the possible
2712 conversion warnings, for the full set use @option{-Wconversion}.
2713
2714 @item
2715 Use of ISO C style function definitions.  This warning intentionally is
2716 @emph{not} issued for prototype declarations or variadic functions
2717 because these ISO C features will appear in your code when using
2718 libiberty's traditional C compatibility macros, @code{PARAMS} and
2719 @code{VPARAMS}.  This warning is also bypassed for nested functions
2720 because that feature is already a GCC extension and thus not relevant to
2721 traditional C compatibility.
2722 @end itemize
2723
2724 @item -Wdeclaration-after-statement @r{(C only)}
2725 @opindex Wdeclaration-after-statement
2726 Warn when a declaration is found after a statement in a block.  This
2727 construct, known from C++, was introduced with ISO C99 and is by default
2728 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2729 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2730
2731 @item -Wundef
2732 @opindex Wundef
2733 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2734
2735 @item -Wendif-labels
2736 @opindex Wendif-labels
2737 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2738
2739 @item -Wshadow
2740 @opindex Wshadow
2741 Warn whenever a local variable shadows another local variable, parameter or
2742 global variable or whenever a built-in function is shadowed.
2743
2744 @item -Wlarger-than-@var{len}
2745 @opindex Wlarger-than
2746 Warn whenever an object of larger than @var{len} bytes is defined.
2747
2748 @item -Wpointer-arith
2749 @opindex Wpointer-arith
2750 Warn about anything that depends on the ``size of'' a function type or
2751 of @code{void}.  GNU C assigns these types a size of 1, for
2752 convenience in calculations with @code{void *} pointers and pointers
2753 to functions.
2754
2755 @item -Wbad-function-cast @r{(C only)}
2756 @opindex Wbad-function-cast
2757 Warn whenever a function call is cast to a non-matching type.
2758 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2759
2760 @item -Wcast-qual
2761 @opindex Wcast-qual
2762 Warn whenever a pointer is cast so as to remove a type qualifier from
2763 the target type.  For example, warn if a @code{const char *} is cast
2764 to an ordinary @code{char *}.
2765
2766 @item -Wcast-align
2767 @opindex Wcast-align
2768 Warn whenever a pointer is cast such that the required alignment of the
2769 target is increased.  For example, warn if a @code{char *} is cast to
2770 an @code{int *} on machines where integers can only be accessed at
2771 two- or four-byte boundaries.
2772
2773 @item -Wwrite-strings
2774 @opindex Wwrite-strings
2775 When compiling C, give string constants the type @code{const
2776 char[@var{length}]} so that
2777 copying the address of one into a non-@code{const} @code{char *}
2778 pointer will get a warning; when compiling C++, warn about the
2779 deprecated conversion from string constants to @code{char *}.
2780 These warnings will help you find at
2781 compile time code that can try to write into a string constant, but
2782 only if you have been very careful about using @code{const} in
2783 declarations and prototypes.  Otherwise, it will just be a nuisance;
2784 this is why we did not make @option{-Wall} request these warnings.
2785
2786 @item -Wconversion
2787 @opindex Wconversion
2788 Warn if a prototype causes a type conversion that is different from what
2789 would happen to the same argument in the absence of a prototype.  This
2790 includes conversions of fixed point to floating and vice versa, and
2791 conversions changing the width or signedness of a fixed point argument
2792 except when the same as the default promotion.
2793
2794 Also, warn if a negative integer constant expression is implicitly
2795 converted to an unsigned type.  For example, warn about the assignment
2796 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2797 casts like @code{(unsigned) -1}.
2798
2799 @item -Wsign-compare
2800 @opindex Wsign-compare
2801 @cindex warning for comparison of signed and unsigned values
2802 @cindex comparison of signed and unsigned values, warning
2803 @cindex signed and unsigned values, comparison warning
2804 Warn when a comparison between signed and unsigned values could produce
2805 an incorrect result when the signed value is converted to unsigned.
2806 This warning is also enabled by @option{-Wextra}; to get the other warnings
2807 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2808
2809 @item -Waggregate-return
2810 @opindex Waggregate-return
2811 Warn if any functions that return structures or unions are defined or
2812 called.  (In languages where you can return an array, this also elicits
2813 a warning.)
2814
2815 @item -Wstrict-prototypes @r{(C only)}
2816 @opindex Wstrict-prototypes
2817 Warn if a function is declared or defined without specifying the
2818 argument types.  (An old-style function definition is permitted without
2819 a warning if preceded by a declaration which specifies the argument
2820 types.)
2821
2822 @item -Wold-style-definition @r{(C only)}
2823 @opindex Wold-style-definition
2824 Warn if an old-style function definition is used.  A warning is given
2825 even if there is a previous prototype.
2826
2827 @item -Wmissing-prototypes @r{(C only)}
2828 @opindex Wmissing-prototypes
2829 Warn if a global function is defined without a previous prototype
2830 declaration.  This warning is issued even if the definition itself
2831 provides a prototype.  The aim is to detect global functions that fail
2832 to be declared in header files.
2833
2834 @item -Wmissing-declarations @r{(C only)}
2835 @opindex Wmissing-declarations
2836 Warn if a global function is defined without a previous declaration.
2837 Do so even if the definition itself provides a prototype.
2838 Use this option to detect global functions that are not declared in
2839 header files.
2840
2841 @item -Wmissing-noreturn
2842 @opindex Wmissing-noreturn
2843 Warn about functions which might be candidates for attribute @code{noreturn}.
2844 Note these are only possible candidates, not absolute ones.  Care should
2845 be taken to manually verify functions actually do not ever return before
2846 adding the @code{noreturn} attribute, otherwise subtle code generation
2847 bugs could be introduced.  You will not get a warning for @code{main} in
2848 hosted C environments.
2849
2850 @item -Wmissing-format-attribute
2851 @opindex Wmissing-format-attribute
2852 @opindex Wformat
2853 If @option{-Wformat} is enabled, also warn about functions which might be
2854 candidates for @code{format} attributes.  Note these are only possible
2855 candidates, not absolute ones.  GCC will guess that @code{format}
2856 attributes might be appropriate for any function that calls a function
2857 like @code{vprintf} or @code{vscanf}, but this might not always be the
2858 case, and some functions for which @code{format} attributes are
2859 appropriate may not be detected.  This option has no effect unless
2860 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2861
2862 @item -Wno-multichar
2863 @opindex Wno-multichar
2864 @opindex Wmultichar
2865 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2866 Usually they indicate a typo in the user's code, as they have
2867 implementation-defined values, and should not be used in portable code.
2868
2869 @item -Wno-deprecated-declarations
2870 @opindex Wno-deprecated-declarations
2871 Do not warn about uses of functions, variables, and types marked as
2872 deprecated by using the @code{deprecated} attribute.
2873 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2874 @pxref{Type Attributes}.)
2875
2876 @item -Wpacked
2877 @opindex Wpacked
2878 Warn if a structure is given the packed attribute, but the packed
2879 attribute has no effect on the layout or size of the structure.
2880 Such structures may be mis-aligned for little benefit.  For
2881 instance, in this code, the variable @code{f.x} in @code{struct bar}
2882 will be misaligned even though @code{struct bar} does not itself
2883 have the packed attribute:
2884
2885 @smallexample
2886 @group
2887 struct foo @{
2888   int x;
2889   char a, b, c, d;
2890 @} __attribute__((packed));
2891 struct bar @{
2892   char z;
2893   struct foo f;
2894 @};
2895 @end group
2896 @end smallexample
2897
2898 @item -Wpadded
2899 @opindex Wpadded
2900 Warn if padding is included in a structure, either to align an element
2901 of the structure or to align the whole structure.  Sometimes when this
2902 happens it is possible to rearrange the fields of the structure to
2903 reduce the padding and so make the structure smaller.
2904
2905 @item -Wredundant-decls
2906 @opindex Wredundant-decls
2907 Warn if anything is declared more than once in the same scope, even in
2908 cases where multiple declaration is valid and changes nothing.
2909
2910 @item -Wnested-externs @r{(C only)}
2911 @opindex Wnested-externs
2912 Warn if an @code{extern} declaration is encountered within a function.
2913
2914 @item -Wunreachable-code
2915 @opindex Wunreachable-code
2916 Warn if the compiler detects that code will never be executed.
2917
2918 This option is intended to warn when the compiler detects that at
2919 least a whole line of source code will never be executed, because
2920 some condition is never satisfied or because it is after a
2921 procedure that never returns.
2922
2923 It is possible for this option to produce a warning even though there
2924 are circumstances under which part of the affected line can be executed,
2925 so care should be taken when removing apparently-unreachable code.
2926
2927 For instance, when a function is inlined, a warning may mean that the
2928 line is unreachable in only one inlined copy of the function.
2929
2930 This option is not made part of @option{-Wall} because in a debugging
2931 version of a program there is often substantial code which checks
2932 correct functioning of the program and is, hopefully, unreachable
2933 because the program does work.  Another common use of unreachable
2934 code is to provide behavior which is selectable at compile-time.
2935
2936 @item -Winline
2937 @opindex Winline
2938 Warn if a function can not be inlined and it was declared as inline.
2939 Even with this option, the compiler will not warn about failures to
2940 inline functions declared in system headers.
2941
2942 The compiler uses a variety of heuristics to determine whether or not
2943 to inline a function.  For example, the compiler takes into account
2944 the size of the function being inlined and the the amount of inlining
2945 that has already been done in the current function.  Therefore,
2946 seemingly insignificant changes in the source program can cause the
2947 warnings produced by @option{-Winline} to appear or disappear.
2948
2949 @item -Wno-invalid-offsetof @r{(C++ only)}
2950 @opindex Wno-invalid-offsetof
2951 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
2952 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
2953 to a non-POD type is undefined.  In existing C++ implementations,
2954 however, @samp{offsetof} typically gives meaningful results even when
2955 applied to certain kinds of non-POD types. (Such as a simple
2956 @samp{struct} that fails to be a POD type only by virtue of having a
2957 constructor.)  This flag is for users who are aware that they are
2958 writing nonportable code and who have deliberately chosen to ignore the
2959 warning about it.
2960
2961 The restrictions on @samp{offsetof} may be relaxed in a future version
2962 of the C++ standard.
2963
2964 @item -Winvalid-pch
2965 @opindex Winvalid-pch
2966 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
2967 the search path but can't be used.
2968
2969 @item -Wlong-long
2970 @opindex Wlong-long
2971 @opindex Wno-long-long
2972 Warn if @samp{long long} type is used.  This is default.  To inhibit
2973 the warning messages, use @option{-Wno-long-long}.  Flags
2974 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2975 only when @option{-pedantic} flag is used.
2976
2977 @item -Wvariadic-macros
2978 @opindex Wvariadic-macros
2979 @opindex Wno-variadic-macros
2980 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
2981 alternate syntax when in pedantic ISO C99 mode.  This is default.
2982 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
2983
2984 @item -Wdisabled-optimization
2985 @opindex Wdisabled-optimization
2986 Warn if a requested optimization pass is disabled.  This warning does
2987 not generally indicate that there is anything wrong with your code; it
2988 merely indicates that GCC's optimizers were unable to handle the code
2989 effectively.  Often, the problem is that your code is too big or too
2990 complex; GCC will refuse to optimize programs when the optimization
2991 itself is likely to take inordinate amounts of time.
2992
2993 @item -Werror
2994 @opindex Werror
2995 Make all warnings into errors.
2996 @end table
2997
2998 @node Debugging Options
2999 @section Options for Debugging Your Program or GCC
3000 @cindex options, debugging
3001 @cindex debugging information options
3002
3003 GCC has various special options that are used for debugging
3004 either your program or GCC:
3005
3006 @table @gcctabopt
3007 @item -g
3008 @opindex g
3009 Produce debugging information in the operating system's native format
3010 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
3011 information.
3012
3013 On most systems that use stabs format, @option{-g} enables use of extra
3014 debugging information that only GDB can use; this extra information
3015 makes debugging work better in GDB but will probably make other debuggers
3016 crash or
3017 refuse to read the program.  If you want to control for certain whether
3018 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3019 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3020
3021 Unlike most other C compilers, GCC allows you to use @option{-g} with
3022 @option{-O}.  The shortcuts taken by optimized code may occasionally
3023 produce surprising results: some variables you declared may not exist
3024 at all; flow of control may briefly move where you did not expect it;
3025 some statements may not be executed because they compute constant
3026 results or their values were already at hand; some statements may
3027 execute in different places because they were moved out of loops.
3028
3029 Nevertheless it proves possible to debug optimized output.  This makes
3030 it reasonable to use the optimizer for programs that might have bugs.
3031
3032 The following options are useful when GCC is generated with the
3033 capability for more than one debugging format.
3034
3035 @item -ggdb
3036 @opindex ggdb
3037 Produce debugging information for use by GDB@.  This means to use the
3038 most expressive format available (DWARF 2, stabs, or the native format
3039 if neither of those are supported), including GDB extensions if at all
3040 possible.
3041
3042 @item -gstabs
3043 @opindex gstabs
3044 Produce debugging information in stabs format (if that is supported),
3045 without GDB extensions.  This is the format used by DBX on most BSD
3046 systems.  On MIPS, Alpha and System V Release 4 systems this option
3047 produces stabs debugging output which is not understood by DBX or SDB@.
3048 On System V Release 4 systems this option requires the GNU assembler.
3049
3050 @item -feliminate-unused-debug-symbols
3051 @opindex feliminate-unused-debug-symbols
3052 Produce debugging information in stabs format (if that is supported),
3053 for only symbols that are actually used.
3054
3055 @item -gstabs+
3056 @opindex gstabs+
3057 Produce debugging information in stabs 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.
3061
3062 @item -gcoff
3063 @opindex gcoff
3064 Produce debugging information in COFF format (if that is supported).
3065 This is the format used by SDB on most System V systems prior to
3066 System V Release 4.
3067
3068 @item -gxcoff
3069 @opindex gxcoff
3070 Produce debugging information in XCOFF format (if that is supported).
3071 This is the format used by the DBX debugger on IBM RS/6000 systems.
3072
3073 @item -gxcoff+
3074 @opindex gxcoff+
3075 Produce debugging information in XCOFF format (if that is supported),
3076 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3077 use of these extensions is likely to make other debuggers crash or
3078 refuse to read the program, and may cause assemblers other than the GNU
3079 assembler (GAS) to fail with an error.
3080
3081 @item -gdwarf-2
3082 @opindex gdwarf-2
3083 Produce debugging information in DWARF version 2 format (if that is
3084 supported).  This is the format used by DBX on IRIX 6.
3085
3086 @item -gvms
3087 @opindex gvms
3088 Produce debugging information in VMS debug format (if that is
3089 supported).  This is the format used by DEBUG on VMS systems.
3090
3091 @item -g@var{level}
3092 @itemx -ggdb@var{level}
3093 @itemx -gstabs@var{level}
3094 @itemx -gcoff@var{level}
3095 @itemx -gxcoff@var{level}
3096 @itemx -gvms@var{level}
3097 Request debugging information and also use @var{level} to specify how
3098 much information.  The default level is 2.
3099
3100 Level 1 produces minimal information, enough for making backtraces in
3101 parts of the program that you don't plan to debug.  This includes
3102 descriptions of functions and external variables, but no information
3103 about local variables and no line numbers.
3104
3105 Level 3 includes extra information, such as all the macro definitions
3106 present in the program.  Some debuggers support macro expansion when
3107 you use @option{-g3}.
3108
3109 Note that in order to avoid confusion between DWARF1 debug level 2,
3110 and DWARF2 @option{-gdwarf-2} does not accept a concatenated debug
3111 level.  Instead use an additional @option{-g@var{level}} option to
3112 change the debug level for DWARF2.
3113
3114 @item -feliminate-dwarf2-dups
3115 @opindex feliminate-dwarf2-dups
3116 Compress DWARF2 debugging information by eliminating duplicated
3117 information about each symbol.  This option only makes sense when
3118 generating DWARF2 debugging information with @option{-gdwarf-2}.
3119
3120 @cindex @command{prof}
3121 @item -p
3122 @opindex p
3123 Generate extra code to write profile information suitable for the
3124 analysis program @command{prof}.  You must use this option when compiling
3125 the source files you want data about, and you must also use it when
3126 linking.
3127
3128 @cindex @command{gprof}
3129 @item -pg
3130 @opindex pg
3131 Generate extra code to write profile information suitable for the
3132 analysis program @command{gprof}.  You must use this option when compiling
3133 the source files you want data about, and you must also use it when
3134 linking.
3135
3136 @item -Q
3137 @opindex Q
3138 Makes the compiler print out each function name as it is compiled, and
3139 print some statistics about each pass when it finishes.
3140
3141 @item -ftime-report
3142 @opindex ftime-report
3143 Makes the compiler print some statistics about the time consumed by each
3144 pass when it finishes.
3145
3146 @item -fmem-report
3147 @opindex fmem-report
3148 Makes the compiler print some statistics about permanent memory
3149 allocation when it finishes.
3150
3151 @item -fprofile-arcs
3152 @opindex fprofile-arcs
3153 Add code so that program flow @dfn{arcs} are instrumented.  During
3154 execution the program records how many times each branch and call is
3155 executed and how many times it is taken or returns.  When the compiled
3156 program exits it saves this data to a file called
3157 @file{@var{auxname}.gcda} for each source file. The data may be used for
3158 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3159 test coverage analysis (@option{-ftest-coverage}). Each object file's
3160 @var{auxname} is generated from the name of the output file, if
3161 explicitly specified and it is not the final executable, otherwise it is
3162 the basename of the source file. In both cases any suffix is removed
3163 (e.g.  @file{foo.gcda} for input file @file{dir/foo.c}, or
3164 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3165
3166 @itemize
3167
3168 @item
3169 Compile the source files with @option{-fprofile-arcs} plus optimization
3170 and code generation options. For test coverage analysis, use the
3171 additional @option{-ftest-coverage} option. You do not need to profile
3172 every source file in a program.
3173
3174 @item
3175 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3176 (the latter implies the former).
3177
3178 @item
3179 Run the program on a representative workload to generate the arc profile
3180 information. This may be repeated any number of times. You can run
3181 concurrent instances of your program, and provided that the file system
3182 supports locking, the data files will be correctly updated. Also
3183 @code{fork} calls are detected and correctly handled (double counting
3184 will not happen).
3185
3186 @item
3187 For profile-directed optimizations, compile the source files again with
3188 the same optimization and code generation options plus
3189 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3190 Control Optimization}).
3191
3192 @item
3193 For test coverage analysis, use @command{gcov} to produce human readable
3194 information from the @file{.gcno} and @file{.gcda} files. Refer to the
3195 @command{gcov} documentation for further information.
3196
3197 @end itemize
3198
3199 With @option{-fprofile-arcs}, for each function of your program GCC
3200 creates a program flow graph, then finds a spanning tree for the graph.
3201 Only arcs that are not on the spanning tree have to be instrumented: the
3202 compiler adds code to count the number of times that these arcs are
3203 executed.  When an arc is the only exit or only entrance to a block, the
3204 instrumentation code can be added to the block; otherwise, a new basic
3205 block must be created to hold the instrumentation code.
3206
3207 @need 2000
3208 @item -ftest-coverage
3209 @opindex ftest-coverage
3210 Produce a notes file that the @command{gcov} code-coverage utility
3211 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3212 show program coverage. Each source file's note file is called
3213 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
3214 above for a description of @var{auxname} and instructions on how to
3215 generate test coverage data. Coverage data will match the source files
3216 more closely, if you do not optimize.
3217
3218 @item -d@var{letters}
3219 @opindex d
3220 Says to make debugging dumps during compilation at times specified by
3221 @var{letters}.  This is used for debugging the compiler.  The file names
3222 for most of the dumps are made by appending a pass number and a word to
3223 the @var{dumpname}. @var{dumpname} is generated from the name of the
3224 output file, if explicitly specified and it is not an executable,
3225 otherwise it is the basename of the source file. In both cases any
3226 suffix is removed (e.g.  @file{foo.01.rtl} or @file{foo.02.sibling}).
3227 Here are the possible letters for use in @var{letters}, and their
3228 meanings:
3229
3230 @table @samp
3231 @item A
3232 @opindex dA
3233 Annotate the assembler output with miscellaneous debugging information.
3234 @item b
3235 @opindex db
3236 Dump after computing branch probabilities, to @file{@var{file}.12.bp}.
3237 @item B
3238 @opindex dB
3239 Dump after block reordering, to @file{@var{file}.31.bbro}.
3240 @item c
3241 @opindex dc
3242 Dump after instruction combination, to the file @file{@var{file}.20.combine}.
3243 @item C
3244 @opindex dC
3245 Dump after the first if conversion, to the file @file{@var{file}.14.ce1}.
3246 Also dump after the second if conversion, to the file @file{@var{file}.21.ce2}.
3247 @item d
3248 @opindex dd
3249 Dump after branch target load optimization, to to @file{@var{file}.32.btl}.
3250 Also dump after delayed branch scheduling, to @file{@var{file}.36.dbr}.
3251 @item D
3252 @opindex dD
3253 Dump all macro definitions, at the end of preprocessing, in addition to
3254 normal output.
3255 @item E
3256 @opindex dE
3257 Dump after the third if conversion, to @file{@var{file}.30.ce3}.
3258 @item f
3259 @opindex df
3260 Dump after control and data flow analysis, to @file{@var{file}.11.cfg}.
3261 Also dump after life analysis, to @file{@var{file}.19.life}.
3262 @item F
3263 @opindex dF
3264 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.07.addressof}.
3265 @item g
3266 @opindex dg
3267 Dump after global register allocation, to @file{@var{file}.25.greg}.
3268 @item G
3269 @opindex dG
3270 Dump after GCSE, to @file{@var{file}.08.gcse}.
3271 Also dump after jump bypassing and control flow optimizations, to
3272 @file{@var{file}.10.bypass}.
3273 @item h
3274 @opindex dh
3275 Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
3276 @item i
3277 @opindex di
3278 Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
3279 @item j
3280 @opindex dj
3281 Dump after the first jump optimization, to @file{@var{file}.04.jump}.
3282 @item k
3283 @opindex dk
3284 Dump after conversion from registers to stack, to @file{@var{file}.34.stack}.
3285 @item l
3286 @opindex dl
3287 Dump after local register allocation, to @file{@var{file}.24.lreg}.
3288 @item L
3289 @opindex dL
3290 Dump after loop optimization passes, to @file{@var{file}.09.loop} and
3291 @file{@var{file}.16.loop2}.
3292 @item M
3293 @opindex dM
3294 Dump after performing the machine dependent reorganization pass, to
3295 @file{@var{file}.35.mach}.
3296 @item n
3297 @opindex dn
3298 Dump after register renumbering, to @file{@var{file}.29.rnreg}.
3299 @item N
3300 @opindex dN
3301 Dump after the register move pass, to @file{@var{file}.22.regmove}.
3302 @item o
3303 @opindex do
3304 Dump after post-reload optimizations, to @file{@var{file}.26.postreload}.
3305 @item r
3306 @opindex dr
3307 Dump after RTL generation, to @file{@var{file}.01.rtl}.
3308 @item R
3309 @opindex dR
3310 Dump after the second scheduling pass, to @file{@var{file}.33.sched2}.
3311 @item s
3312 @opindex ds
3313 Dump after CSE (including the jump optimization that sometimes follows
3314 CSE), to @file{@var{file}.06.cse}.
3315 @item S
3316 @opindex dS
3317 Dump after the first scheduling pass, to @file{@var{file}.23.sched}.
3318 @item t
3319 @opindex dt
3320 Dump after the second CSE pass (including the jump optimization that
3321 sometimes follows CSE), to @file{@var{file}.18.cse2}.
3322 @item T
3323 @opindex dT
3324 Dump after running tracer, to @file{@var{file}.15.tracer}.
3325 @item u
3326 @opindex du
3327 Dump after null pointer elimination pass to @file{@var{file}.05.null}.
3328 @item U
3329 @opindex dU
3330 Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
3331 @item V
3332 @opindex dV
3333 Dump after the value profile transformations, to @file{@var{file}.13.vpt}.
3334 Also dump after variable tracking, to @file{@var{file}.35.vartrack}.
3335 @item w
3336 @opindex dw
3337 Dump after the second flow pass, to @file{@var{file}.27.flow2}.
3338 @item z
3339 @opindex dz
3340 Dump after the peephole pass, to @file{@var{file}.28.peephole2}.
3341 @item Z
3342 @opindex dZ
3343 Dump after constructing the web, to @file{@var{file}.17.web}.
3344 @item a
3345 @opindex da
3346 Produce all the dumps listed above.
3347 @item H
3348 @opindex dH
3349 Produce a core dump whenever an error occurs.
3350 @item m
3351 @opindex dm
3352 Print statistics on memory usage, at the end of the run, to
3353 standard error.
3354 @item p
3355 @opindex dp
3356 Annotate the assembler output with a comment indicating which
3357 pattern and alternative was used.  The length of each instruction is
3358 also printed.
3359 @item P
3360 @opindex dP
3361 Dump the RTL in the assembler output as a comment before each instruction.
3362 Also turns on @option{-dp} annotation.
3363 @item v
3364 @opindex dv
3365 For each of the other indicated dump files (except for
3366 @file{@var{file}.01.rtl}), dump a representation of the control flow graph
3367 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3368 @item x
3369 @opindex dx
3370 Just generate RTL for a function instead of compiling it.  Usually used
3371 with @samp{r}.
3372 @item y
3373 @opindex dy
3374 Dump debugging information during parsing, to standard error.
3375 @end table
3376
3377 @item -fdump-unnumbered
3378 @opindex fdump-unnumbered
3379 When doing debugging dumps (see @option{-d} option above), suppress instruction
3380 numbers and line number note output.  This makes it more feasible to
3381 use diff on debugging dumps for compiler invocations with different
3382 options, in particular with and without @option{-g}.
3383
3384 @item -fdump-translation-unit @r{(C and C++ only)}
3385 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3386 @opindex fdump-translation-unit
3387 Dump a representation of the tree structure for the entire translation
3388 unit to a file.  The file name is made by appending @file{.tu} to the
3389 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3390 controls the details of the dump as described for the
3391 @option{-fdump-tree} options.
3392
3393 @item -fdump-class-hierarchy @r{(C++ only)}
3394 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3395 @opindex fdump-class-hierarchy
3396 Dump a representation of each class's hierarchy and virtual function
3397 table layout to a file.  The file name is made by appending @file{.class}
3398 to the source file name.  If the @samp{-@var{options}} form is used,
3399 @var{options} controls the details of the dump as described for the
3400 @option{-fdump-tree} options.
3401
3402 @item -fdump-tree-@var{switch} @r{(C++ only)}
3403 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3404 @opindex fdump-tree
3405 Control the dumping at various stages of processing the intermediate
3406 language tree to a file.  The file name is generated by appending a switch
3407 specific suffix to the source file name.  If the @samp{-@var{options}}
3408 form is used, @var{options} is a list of @samp{-} separated options that
3409 control the details of the dump. Not all options are applicable to all
3410 dumps, those which are not meaningful will be ignored. The following
3411 options are available
3412
3413 @table @samp
3414 @item address
3415 Print the address of each node.  Usually this is not meaningful as it
3416 changes according to the environment and source file. Its primary use
3417 is for tying up a dump file with a debug environment.
3418 @item slim
3419 Inhibit dumping of members of a scope or body of a function merely
3420 because that scope has been reached. Only dump such items when they
3421 are directly reachable by some other path.
3422 @item all
3423 Turn on all options.
3424 @end table
3425
3426 The following tree dumps are possible:
3427 @table @samp
3428 @item original
3429 Dump before any tree based optimization, to @file{@var{file}.original}.
3430 @item optimized
3431 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3432 @item inlined
3433 Dump after function inlining, to @file{@var{file}.inlined}.
3434 @end table
3435
3436 @item -frandom-seed=@var{string}
3437 @opindex frandom-string
3438 This option provides a seed that GCC uses when it would otherwise use
3439 random numbers.  It is used to generate certain symbol names
3440 that have to be different in every compiled file. It is also used to
3441 place unique stamps in coverage data files and the object files that
3442 produce them. You can use the @option{-frandom-seed} option to produce
3443 reproducibly identical object files.
3444
3445 The @var{string} should be different for every file you compile.
3446
3447 @item -fsched-verbose=@var{n}
3448 @opindex fsched-verbose
3449 On targets that use instruction scheduling, this option controls the
3450 amount of debugging output the scheduler prints.  This information is
3451 written to standard error, unless @option{-dS} or @option{-dR} is
3452 specified, in which case it is output to the usual dump
3453 listing file, @file{.sched} or @file{.sched2} respectively.  However
3454 for @var{n} greater than nine, the output is always printed to standard
3455 error.
3456
3457 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3458 same information as @option{-dRS}.  For @var{n} greater than one, it
3459 also output basic block probabilities, detailed ready list information
3460 and unit/insn info.  For @var{n} greater than two, it includes RTL
3461 at abort point, control-flow and regions info.  And for @var{n} over
3462 four, @option{-fsched-verbose} also includes dependence info.
3463
3464 @item -save-temps
3465 @opindex save-temps
3466 Store the usual ``temporary'' intermediate files permanently; place them
3467 in the current directory and name them based on the source file.  Thus,
3468 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3469 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3470 preprocessed @file{foo.i} output file even though the compiler now
3471 normally uses an integrated preprocessor.
3472
3473 @item -time
3474 @opindex time
3475 Report the CPU time taken by each subprocess in the compilation
3476 sequence.  For C source files, this is the compiler proper and assembler
3477 (plus the linker if linking is done).  The output looks like this:
3478
3479 @smallexample
3480 # cc1 0.12 0.01
3481 # as 0.00 0.01
3482 @end smallexample
3483
3484 The first number on each line is the ``user time,'' that is time spent
3485 executing the program itself.  The second number is ``system time,''
3486 time spent executing operating system routines on behalf of the program.
3487 Both numbers are in seconds.
3488
3489 @item -fvar-tracking
3490 @opindex fvar-tracking
3491 Run variable tracking pass. It computes where variables are stored at each
3492 position in code. Better debugging information is then generated
3493 (if the debugging information format supports this information).
3494
3495 It is enabled by default when compiling with optimization (@option{-Os},
3496 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
3497 the debug info format supports it.
3498
3499 @item -print-file-name=@var{library}
3500 @opindex print-file-name
3501 Print the full absolute name of the library file @var{library} that
3502 would be used when linking---and don't do anything else.  With this
3503 option, GCC does not compile or link anything; it just prints the
3504 file name.
3505
3506 @item -print-multi-directory
3507 @opindex print-multi-directory
3508 Print the directory name corresponding to the multilib selected by any
3509 other switches present in the command line.  This directory is supposed
3510 to exist in @env{GCC_EXEC_PREFIX}.
3511
3512 @item -print-multi-lib
3513 @opindex print-multi-lib
3514 Print the mapping from multilib directory names to compiler switches
3515 that enable them.  The directory name is separated from the switches by
3516 @samp{;}, and each switch starts with an @samp{@@} instead of the
3517 @samp{-}, without spaces between multiple switches.  This is supposed to
3518 ease shell-processing.
3519
3520 @item -print-prog-name=@var{program}
3521 @opindex print-prog-name
3522 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3523
3524 @item -print-libgcc-file-name
3525 @opindex print-libgcc-file-name
3526 Same as @option{-print-file-name=libgcc.a}.
3527
3528 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3529 but you do want to link with @file{libgcc.a}.  You can do
3530
3531 @smallexample
3532 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3533 @end smallexample
3534
3535 @item -print-search-dirs
3536 @opindex print-search-dirs
3537 Print the name of the configured installation directory and a list of
3538 program and library directories @command{gcc} will search---and don't do anything else.
3539
3540 This is useful when @command{gcc} prints the error message
3541 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3542 To resolve this you either need to put @file{cpp0} and the other compiler
3543 components where @command{gcc} expects to find them, or you can set the environment
3544 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3545 Don't forget the trailing '/'.
3546 @xref{Environment Variables}.
3547
3548 @item -dumpmachine
3549 @opindex dumpmachine
3550 Print the compiler's target machine (for example,
3551 @samp{i686-pc-linux-gnu})---and don't do anything else.
3552
3553 @item -dumpversion
3554 @opindex dumpversion
3555 Print the compiler version (for example, @samp{3.0})---and don't do
3556 anything else.
3557
3558 @item -dumpspecs
3559 @opindex dumpspecs
3560 Print the compiler's built-in specs---and don't do anything else.  (This
3561 is used when GCC itself is being built.)  @xref{Spec Files}.
3562
3563 @item -feliminate-unused-debug-types
3564 @opindex feliminate-unused-debug-types
3565 Normally, when producing DWARF2 output, GCC will emit debugging
3566 information for all types declared in a compilation
3567 unit, regardless of whether or not they are actually used
3568 in that compilation unit.  Sometimes this is useful, such as
3569 if, in the debugger, you want to cast a value to a type that is
3570 not actually used in your program (but is declared).  More often,
3571 however, this results in a significant amount of wasted space.
3572 With this option, GCC will avoid producing debug symbol output
3573 for types that are nowhere used in the source file being compiled.
3574 @end table
3575
3576 @node Optimize Options
3577 @section Options That Control Optimization
3578 @cindex optimize options
3579 @cindex options, optimization
3580
3581 These options control various sorts of optimizations.
3582
3583 Without any optimization option, the compiler's goal is to reduce the
3584 cost of compilation and to make debugging produce the expected
3585 results.  Statements are independent: if you stop the program with a
3586 breakpoint between statements, you can then assign a new value to any
3587 variable or change the program counter to any other statement in the
3588 function and get exactly the results you would expect from the source
3589 code.
3590
3591 Turning on optimization flags makes the compiler attempt to improve
3592 the performance and/or code size at the expense of compilation time
3593 and possibly the ability to debug the program.
3594
3595 The compiler performs optimization based on the knowledge it has of
3596 the program.  Using the @option{-funit-at-a-time} flag will allow the
3597 compiler to consider information gained from later functions in the
3598 file when compiling a function.  Compiling multiple files at once to a
3599 single output file (and using @option{-funit-at-a-time}) will allow
3600 the compiler to use information gained from all of the files when
3601 compiling each of them.
3602
3603 Not all optimizations are controlled directly by a flag.  Only
3604 optimizations that have a flag are listed.
3605
3606 @table @gcctabopt
3607 @item -O
3608 @itemx -O1
3609 @opindex O
3610 @opindex O1
3611 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3612 more memory for a large function.
3613
3614 With @option{-O}, the compiler tries to reduce code size and execution
3615 time, without performing any optimizations that take a great deal of
3616 compilation time.
3617
3618 @option{-O} turns on the following optimization flags:
3619 @gccoptlist{-fdefer-pop @gol
3620 -fmerge-constants @gol
3621 -fthread-jumps @gol
3622 -floop-optimize @gol
3623 -fif-conversion @gol
3624 -fif-conversion2 @gol
3625 -fdelayed-branch @gol
3626 -fguess-branch-probability @gol
3627 -fcprop-registers}
3628
3629 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
3630 where doing so does not interfere with debugging.
3631
3632 @item -O2
3633 @opindex O2
3634 Optimize even more.  GCC performs nearly all supported optimizations
3635 that do not involve a space-speed tradeoff.  The compiler does not
3636 perform loop unrolling or function inlining when you specify @option{-O2}.
3637 As compared to @option{-O}, this option increases both compilation time
3638 and the performance of the generated code.
3639
3640 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
3641 also turns on the following optimization flags:
3642 @gccoptlist{-fforce-mem @gol
3643 -foptimize-sibling-calls @gol
3644 -fstrength-reduce @gol
3645 -fcse-follow-jumps  -fcse-skip-blocks @gol
3646 -frerun-cse-after-loop  -frerun-loop-opt @gol
3647 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las @gol
3648 -fdelete-null-pointer-checks @gol
3649 -fexpensive-optimizations @gol
3650 -fregmove @gol
3651 -fschedule-insns  -fschedule-insns2 @gol
3652 -fsched-interblock  -fsched-spec @gol
3653 -fcaller-saves @gol
3654 -fpeephole2 @gol
3655 -freorder-blocks  -freorder-functions @gol
3656 -fstrict-aliasing @gol
3657 -funit-at-a-time @gol
3658 -falign-functions  -falign-jumps @gol
3659 -falign-loops  -falign-labels @gol
3660 -fcrossjumping}
3661
3662 Please note the warning under @option{-fgcse} about
3663 invoking @option{-O2} on programs that use computed gotos.
3664
3665 @item -O3
3666 @opindex O3
3667 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3668 @option{-O2} and also turns on the @option{-finline-functions},
3669 @option{-fweb} and @option{-frename-registers} options.
3670
3671 @item -O0
3672 @opindex O0
3673 Do not optimize.  This is the default.
3674
3675 @item -Os
3676 @opindex Os
3677 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3678 do not typically increase code size.  It also performs further
3679 optimizations designed to reduce code size.
3680
3681 @option{-Os} disables the following optimization flags:
3682 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3683 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition -fprefetch-loop-arrays}
3684
3685 If you use multiple @option{-O} options, with or without level numbers,
3686 the last such option is the one that is effective.
3687 @end table
3688
3689 Options of the form @option{-f@var{flag}} specify machine-independent
3690 flags.  Most flags have both positive and negative forms; the negative
3691 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3692 below, only one of the forms is listed---the one you typically will
3693 use.  You can figure out the other form by either removing @samp{no-}
3694 or adding it.
3695
3696 The following options control specific optimizations.  They are either
3697 activated by @option{-O} options or are related to ones that are.  You
3698 can use the following flags in the rare cases when ``fine-tuning'' of
3699 optimizations to be performed is desired.
3700
3701 @table @gcctabopt
3702 @item -fno-default-inline
3703 @opindex fno-default-inline
3704 Do not make member functions inline by default merely because they are
3705 defined inside the class scope (C++ only).  Otherwise, when you specify
3706 @w{@option{-O}}, member functions defined inside class scope are compiled
3707 inline by default; i.e., you don't need to add @samp{inline} in front of
3708 the member function name.
3709
3710 @item -fno-defer-pop
3711 @opindex fno-defer-pop
3712 Always pop the arguments to each function call as soon as that function
3713 returns.  For machines which must pop arguments after a function call,
3714 the compiler normally lets arguments accumulate on the stack for several
3715 function calls and pops them all at once.
3716
3717 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3718
3719 @item -fforce-mem
3720 @opindex fforce-mem
3721 Force memory operands to be copied into registers before doing
3722 arithmetic on them.  This produces better code by making all memory
3723 references potential common subexpressions.  When they are not common
3724 subexpressions, instruction combination should eliminate the separate
3725 register-load.
3726
3727 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3728
3729 @item -fforce-addr
3730 @opindex fforce-addr
3731 Force memory address constants to be copied into registers before
3732 doing arithmetic on them.  This may produce better code just as
3733 @option{-fforce-mem} may.
3734
3735 @item -fomit-frame-pointer
3736 @opindex fomit-frame-pointer
3737 Don't keep the frame pointer in a register for functions that
3738 don't need one.  This avoids the instructions to save, set up and
3739 restore frame pointers; it also makes an extra register available
3740 in many functions.  @strong{It also makes debugging impossible on
3741 some machines.}
3742
3743 On some machines, such as the VAX, this flag has no effect, because
3744 the standard calling sequence automatically handles the frame pointer
3745 and nothing is saved by pretending it doesn't exist.  The
3746 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3747 whether a target machine supports this flag.  @xref{Registers,,Register
3748 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3749
3750 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3751
3752 @item -foptimize-sibling-calls
3753 @opindex foptimize-sibling-calls
3754 Optimize sibling and tail recursive calls.
3755
3756 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3757
3758 @item -fno-inline
3759 @opindex fno-inline
3760 Don't pay attention to the @code{inline} keyword.  Normally this option
3761 is used to keep the compiler from expanding any functions inline.
3762 Note that if you are not optimizing, no functions can be expanded inline.
3763
3764 @item -finline-functions
3765 @opindex finline-functions
3766 Integrate all simple functions into their callers.  The compiler
3767 heuristically decides which functions are simple enough to be worth
3768 integrating in this way.
3769
3770 If all calls to a given function are integrated, and the function is
3771 declared @code{static}, then the function is normally not output as
3772 assembler code in its own right.
3773
3774 Enabled at level @option{-O3}.
3775
3776 @item -finline-limit=@var{n}
3777 @opindex finline-limit
3778 By default, GCC limits the size of functions that can be inlined.  This flag
3779 allows the control of this limit for functions that are explicitly marked as
3780 inline (i.e., marked with the inline keyword or defined within the class
3781 definition in c++).  @var{n} is the size of functions that can be inlined in
3782 number of pseudo instructions (not counting parameter handling).  The default
3783 value of @var{n} is 600.
3784 Increasing this value can result in more inlined code at
3785 the cost of compilation time and memory consumption.  Decreasing usually makes
3786 the compilation faster and less code will be inlined (which presumably
3787 means slower programs).  This option is particularly useful for programs that
3788 use inlining heavily such as those based on recursive templates with C++.
3789
3790 Inlining is actually controlled by a number of parameters, which may be
3791 specified individually by using @option{--param @var{name}=@var{value}}.
3792 The @option{-finline-limit=@var{n}} option sets some of these parameters
3793 as follows:
3794
3795 @table @gcctabopt
3796  @item max-inline-insns-single
3797   is set to @var{n}/2.
3798  @item max-inline-insns-auto
3799   is set to @var{n}/2.
3800  @item min-inline-insns
3801   is set to 130 or @var{n}/4, whichever is smaller.
3802  @item max-inline-insns-rtl
3803   is set to @var{n}.
3804 @end table
3805
3806 See below for a documentation of the individual
3807 parameters controlling inlining.
3808
3809 @emph{Note:} pseudo instruction represents, in this particular context, an
3810 abstract measurement of function's size.  In no way, it represents a count
3811 of assembly instructions and as such its exact meaning might change from one
3812 release to an another.
3813
3814 @item -fkeep-inline-functions
3815 @opindex fkeep-inline-functions
3816 Even if all calls to a given function are integrated, and the function
3817 is declared @code{static}, nevertheless output a separate run-time
3818 callable version of the function.  This switch does not affect
3819 @code{extern inline} functions.
3820
3821 @item -fkeep-static-consts
3822 @opindex fkeep-static-consts
3823 Emit variables declared @code{static const} when optimization isn't turned
3824 on, even if the variables aren't referenced.
3825
3826 GCC enables this option by default.  If you want to force the compiler to
3827 check if the variable was referenced, regardless of whether or not
3828 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3829
3830 @item -fmerge-constants
3831 Attempt to merge identical constants (string constants and floating point
3832 constants) across compilation units.
3833
3834 This option is the default for optimized compilation if the assembler and
3835 linker support it.  Use @option{-fno-merge-constants} to inhibit this
3836 behavior.
3837
3838 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3839
3840 @item -fmerge-all-constants
3841 Attempt to merge identical constants and identical variables.
3842
3843 This option implies @option{-fmerge-constants}.  In addition to
3844 @option{-fmerge-constants} this considers e.g. even constant initialized
3845 arrays or initialized constant variables with integral or floating point
3846 types.  Languages like C or C++ require each non-automatic variable to
3847 have distinct location, so using this option will result in non-conforming
3848 behavior.
3849
3850 @item -fnew-ra
3851 @opindex fnew-ra
3852 Use a graph coloring register allocator.  Currently this option is meant
3853 only for testing.  Users should not specify this option, since it is not
3854 yet ready for production use.
3855
3856 @item -fno-branch-count-reg
3857 @opindex fno-branch-count-reg
3858 Do not use ``decrement and branch'' instructions on a count register,
3859 but instead generate a sequence of instructions that decrement a
3860 register, compare it against zero, then branch based upon the result.
3861 This option is only meaningful on architectures that support such
3862 instructions, which include x86, PowerPC, IA-64 and S/390.
3863
3864 The default is @option{-fbranch-count-reg}, enabled when
3865 @option{-fstrength-reduce} is enabled.
3866
3867 @item -fno-function-cse
3868 @opindex fno-function-cse
3869 Do not put function addresses in registers; make each instruction that
3870 calls a constant function contain the function's address explicitly.
3871
3872 This option results in less efficient code, but some strange hacks
3873 that alter the assembler output may be confused by the optimizations
3874 performed when this option is not used.
3875
3876 The default is @option{-ffunction-cse}
3877
3878 @item -fno-zero-initialized-in-bss
3879 @opindex fno-zero-initialized-in-bss
3880 If the target supports a BSS section, GCC by default puts variables that
3881 are initialized to zero into BSS@.  This can save space in the resulting
3882 code.
3883
3884 This option turns off this behavior because some programs explicitly
3885 rely on variables going to the data section.  E.g., so that the
3886 resulting executable can find the beginning of that section and/or make
3887 assumptions based on that.
3888
3889 The default is @option{-fzero-initialized-in-bss}.
3890
3891 @item -fstrength-reduce
3892 @opindex fstrength-reduce
3893 Perform the optimizations of loop strength reduction and
3894 elimination of iteration variables.
3895
3896 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3897
3898 @item -fthread-jumps
3899 @opindex fthread-jumps
3900 Perform optimizations where we check to see if a jump branches to a
3901 location where another comparison subsumed by the first is found.  If
3902 so, the first branch is redirected to either the destination of the
3903 second branch or a point immediately following it, depending on whether
3904 the condition is known to be true or false.
3905
3906 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3907
3908 @item -fcse-follow-jumps
3909 @opindex fcse-follow-jumps
3910 In common subexpression elimination, scan through jump instructions
3911 when the target of the jump is not reached by any other path.  For
3912 example, when CSE encounters an @code{if} statement with an
3913 @code{else} clause, CSE will follow the jump when the condition
3914 tested is false.
3915
3916 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3917
3918 @item -fcse-skip-blocks
3919 @opindex fcse-skip-blocks
3920 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3921 follow jumps which conditionally skip over blocks.  When CSE
3922 encounters a simple @code{if} statement with no else clause,
3923 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3924 body of the @code{if}.
3925
3926 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3927
3928 @item -frerun-cse-after-loop
3929 @opindex frerun-cse-after-loop
3930 Re-run common subexpression elimination after loop optimizations has been
3931 performed.
3932
3933 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3934
3935 @item -frerun-loop-opt
3936 @opindex frerun-loop-opt
3937 Run the loop optimizer twice.
3938
3939 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3940
3941 @item -fgcse
3942 @opindex fgcse
3943 Perform a global common subexpression elimination pass.
3944 This pass also performs global constant and copy propagation.
3945
3946 @emph{Note:} When compiling a program using computed gotos, a GCC
3947 extension, you may get better runtime performance if you disable
3948 the global common subexpression elimination pass by adding
3949 @option{-fno-gcse} to the command line.
3950
3951 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3952
3953 @item -fgcse-lm
3954 @opindex fgcse-lm
3955 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3956 attempt to move loads which are only killed by stores into themselves.  This
3957 allows a loop containing a load/store sequence to be changed to a load outside
3958 the loop, and a copy/store within the loop.
3959
3960 Enabled by default when gcse is enabled.
3961
3962 @item -fgcse-sm
3963 @opindex fgcse-sm
3964 When @option{-fgcse-sm} is enabled, a store motion pass is run after
3965 global common subexpression elimination.  This pass will attempt to move
3966 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
3967 loops containing a load/store sequence can be changed to a load before
3968 the loop and a store after the loop.
3969
3970 Enabled by default when gcse is enabled.
3971
3972 @item -fgcse-las
3973 @opindex fgcse-las
3974 When @option{-fgcse-las} is enabled, the global common subexpression
3975 elimination pass eliminates redundant loads that come after stores to the
3976 same memory location (both partial and full redundancies).
3977
3978 Enabled by default when gcse is enabled.
3979
3980 @item -floop-optimize
3981 @opindex floop-optimize
3982 Perform loop optimizations: move constant expressions out of loops, simplify
3983 exit test conditions and optionally do strength-reduction and loop unrolling as
3984 well.
3985
3986 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3987
3988 @item -fcrossjumping
3989 @opindex crossjumping
3990 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
3991 resulting code may or may not perform better than without cross-jumping.
3992
3993 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3994
3995 @item -fif-conversion
3996 @opindex if-conversion
3997 Attempt to transform conditional jumps into branch-less equivalents.  This
3998 include use of conditional moves, min, max, set flags and abs instructions, and
3999 some tricks doable by standard arithmetics.  The use of conditional execution
4000 on chips where it is available is controlled by @code{if-conversion2}.
4001
4002 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4003
4004 @item -fif-conversion2
4005 @opindex if-conversion2
4006 Use conditional execution (where available) to transform conditional jumps into
4007 branch-less equivalents.
4008
4009 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4010
4011 @item -fdelete-null-pointer-checks
4012 @opindex fdelete-null-pointer-checks
4013 Use global dataflow analysis to identify and eliminate useless checks
4014 for null pointers.  The compiler assumes that dereferencing a null
4015 pointer would have halted the program.  If a pointer is checked after
4016 it has already been dereferenced, it cannot be null.
4017
4018 In some environments, this assumption is not true, and programs can
4019 safely dereference null pointers.  Use
4020 @option{-fno-delete-null-pointer-checks} to disable this optimization
4021 for programs which depend on that behavior.
4022
4023 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4024
4025 @item -fexpensive-optimizations
4026 @opindex fexpensive-optimizations
4027 Perform a number of minor optimizations that are relatively expensive.
4028
4029 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4030
4031 @item -foptimize-register-move
4032 @itemx -fregmove
4033 @opindex foptimize-register-move
4034 @opindex fregmove
4035 Attempt to reassign register numbers in move instructions and as
4036 operands of other simple instructions in order to maximize the amount of
4037 register tying.  This is especially helpful on machines with two-operand
4038 instructions.
4039
4040 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4041 optimization.
4042
4043 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4044
4045 @item -fdelayed-branch
4046 @opindex fdelayed-branch
4047 If supported for the target machine, attempt to reorder instructions
4048 to exploit instruction slots available after delayed branch
4049 instructions.
4050
4051 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4052
4053 @item -fschedule-insns
4054 @opindex fschedule-insns
4055 If supported for the target machine, attempt to reorder instructions to
4056 eliminate execution stalls due to required data being unavailable.  This
4057 helps machines that have slow floating point or memory load instructions
4058 by allowing other instructions to be issued until the result of the load
4059 or floating point instruction is required.
4060
4061 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4062
4063 @item -fschedule-insns2
4064 @opindex fschedule-insns2
4065 Similar to @option{-fschedule-insns}, but requests an additional pass of
4066 instruction scheduling after register allocation has been done.  This is
4067 especially useful on machines with a relatively small number of
4068 registers and where memory load instructions take more than one cycle.
4069
4070 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4071
4072 @item -fno-sched-interblock
4073 @opindex fno-sched-interblock
4074 Don't schedule instructions across basic blocks.  This is normally
4075 enabled by default when scheduling before register allocation, i.e.@:
4076 with @option{-fschedule-insns} or at @option{-O2} or higher.
4077
4078 @item -fno-sched-spec
4079 @opindex fno-sched-spec
4080 Don't allow speculative motion of non-load instructions.  This is normally
4081 enabled by default when scheduling before register allocation, i.e.@:
4082 with @option{-fschedule-insns} or at @option{-O2} or higher.
4083
4084 @item -fsched-spec-load
4085 @opindex fsched-spec-load
4086 Allow speculative motion of some load instructions.  This only makes
4087 sense when scheduling before register allocation, i.e.@: with
4088 @option{-fschedule-insns} or at @option{-O2} or higher.
4089
4090 @item -fsched-spec-load-dangerous
4091 @opindex fsched-spec-load-dangerous
4092 Allow speculative motion of more load instructions.  This only makes
4093 sense when scheduling before register allocation, i.e.@: with
4094 @option{-fschedule-insns} or at @option{-O2} or higher.
4095
4096 @item -fsched-stalled-insns=@var{n}
4097 @opindex fsched-stalled-insns
4098 Define how many insns (if any) can be moved prematurely from the queue
4099 of stalled insns into the ready list, during the second scheduling pass.
4100
4101 @item -fsched-stalled-insns-dep=@var{n}
4102 @opindex fsched-stalled-insns-dep
4103 Define how many insn groups (cycles) will be examined for a dependency
4104 on a stalled insn that is candidate for premature removal from the queue
4105 of stalled insns.  Has an effect only during the second scheduling pass,
4106 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4107
4108 @item -fsched2-use-superblocks
4109 @opindex fsched2-use-superblocks
4110 When scheduling after register allocation, do use superblock scheduling
4111 algorithm.  Superblock scheduling allows motion across basic block boundaries
4112 resulting on faster schedules.  This option is experimental, as not all machine
4113 descriptions used by GCC model the CPU closely enough to avoid unreliable
4114 results from the algorithm.
4115
4116 This only makes sense when scheduling after register allocation, i.e.@: with
4117 @option{-fschedule-insns2} or at @option{-O2} or higher.
4118
4119 @item -fsched2-use-traces
4120 @opindex fsched2-use-traces
4121 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4122 allocation and additionally perform code duplication in order to increase the
4123 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4124 trace formation.
4125
4126 This mode should produce faster but significantly longer programs.  Also
4127 without @code{-fbranch-probabilities} the traces constructed may not match the
4128 reality and hurt the performance.  This only makes
4129 sense when scheduling after register allocation, i.e.@: with
4130 @option{-fschedule-insns2} or at @option{-O2} or higher.
4131
4132 @item -fcaller-saves
4133 @opindex fcaller-saves
4134 Enable values to be allocated in registers that will be clobbered by
4135 function calls, by emitting extra instructions to save and restore the
4136 registers around such calls.  Such allocation is done only when it
4137 seems to result in better code than would otherwise be produced.
4138
4139 This option is always enabled by default on certain machines, usually
4140 those which have no call-preserved registers to use instead.
4141
4142 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4143
4144 @item -fmove-all-movables
4145 @opindex fmove-all-movables
4146 Forces all invariant computations in loops to be moved
4147 outside the loop.
4148
4149 @item -freduce-all-givs
4150 @opindex freduce-all-givs
4151 Forces all general-induction variables in loops to be
4152 strength-reduced.
4153
4154 @emph{Note:} When compiling programs written in Fortran,
4155 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
4156 by default when you use the optimizer.
4157
4158 These options may generate better or worse code; results are highly
4159 dependent on the structure of loops within the source code.
4160
4161 These two options are intended to be removed someday, once
4162 they have helped determine the efficacy of various
4163 approaches to improving loop optimizations.
4164
4165 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
4166 know how use of these options affects
4167 the performance of your production code.
4168 We're very interested in code that runs @emph{slower}
4169 when these options are @emph{enabled}.
4170
4171 @item -fno-peephole
4172 @itemx -fno-peephole2
4173 @opindex fno-peephole
4174 @opindex fno-peephole2
4175 Disable any machine-specific peephole optimizations.  The difference
4176 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
4177 are implemented in the compiler; some targets use one, some use the
4178 other, a few use both.
4179
4180 @option{-fpeephole} is enabled by default.
4181 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4182
4183 @item -fno-guess-branch-probability
4184 @opindex fno-guess-branch-probability
4185 Do not guess branch probabilities using a randomized model.
4186
4187 Sometimes GCC will opt to use a randomized model to guess branch
4188 probabilities, when none are available from either profiling feedback
4189 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
4190 different runs of the compiler on the same program may produce different
4191 object code.
4192
4193 In a hard real-time system, people don't want different runs of the
4194 compiler to produce code that has different behavior; minimizing
4195 non-determinism is of paramount import.  This switch allows users to
4196 reduce non-determinism, possibly at the expense of inferior
4197 optimization.
4198
4199 The default is @option{-fguess-branch-probability} at levels
4200 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4201
4202 @item -freorder-blocks
4203 @opindex freorder-blocks
4204 Reorder basic blocks in the compiled function in order to reduce number of
4205 taken branches and improve code locality.
4206
4207 Enabled at levels @option{-O2}, @option{-O3}.
4208
4209 @item -freorder-blocks-and-partition
4210 @opindex freorder-blocks-and-partition
4211 In addition to reordering basic blocks in the compiled function, in order
4212 to reduce number of taken branches, partitions hot and cold basic blocks
4213 into separate sections of the assembly and .o files, to improve
4214 paging and cache locality performance.
4215
4216 @item -freorder-functions
4217 @opindex freorder-functions
4218 Reorder basic blocks in the compiled function in order to reduce number of
4219 taken branches and improve code locality. This is implemented by using special
4220 subsections @code{.text.hot} for most frequently executed functions and
4221 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
4222 the linker so object file format must support named sections and linker must
4223 place them in a reasonable way.
4224
4225 Also profile feedback must be available in to make this option effective.  See
4226 @option{-fprofile-arcs} for details.
4227
4228 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4229
4230 @item -fstrict-aliasing
4231 @opindex fstrict-aliasing
4232 Allows the compiler to assume the strictest aliasing rules applicable to
4233 the language being compiled.  For C (and C++), this activates
4234 optimizations based on the type of expressions.  In particular, an
4235 object of one type is assumed never to reside at the same address as an
4236 object of a different type, unless the types are almost the same.  For
4237 example, an @code{unsigned int} can alias an @code{int}, but not a
4238 @code{void*} or a @code{double}.  A character type may alias any other
4239 type.
4240
4241 Pay special attention to code like this:
4242 @smallexample
4243 union a_union @{
4244   int i;
4245   double d;
4246 @};
4247
4248 int f() @{
4249   a_union t;
4250   t.d = 3.0;
4251   return t.i;
4252 @}
4253 @end smallexample
4254 The practice of reading from a different union member than the one most
4255 recently written to (called ``type-punning'') is common.  Even with
4256 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4257 is accessed through the union type.  So, the code above will work as
4258 expected.  However, this code might not:
4259 @smallexample
4260 int f() @{
4261   a_union t;
4262   int* ip;
4263   t.d = 3.0;
4264   ip = &t.i;
4265   return *ip;
4266 @}
4267 @end smallexample
4268
4269 Every language that wishes to perform language-specific alias analysis
4270 should define a function that computes, given an @code{tree}
4271 node, an alias set for the node.  Nodes in different alias sets are not
4272 allowed to alias.  For an example, see the C front-end function
4273 @code{c_get_alias_set}.
4274
4275 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4276
4277 @item -falign-functions
4278 @itemx -falign-functions=@var{n}
4279 @opindex falign-functions
4280 Align the start of functions to the next power-of-two greater than
4281 @var{n}, skipping up to @var{n} bytes.  For instance,
4282 @option{-falign-functions=32} aligns functions to the next 32-byte
4283 boundary, but @option{-falign-functions=24} would align to the next
4284 32-byte boundary only if this can be done by skipping 23 bytes or less.
4285
4286 @option{-fno-align-functions} and @option{-falign-functions=1} are
4287 equivalent and mean that functions will not be aligned.
4288
4289 Some assemblers only support this flag when @var{n} is a power of two;
4290 in that case, it is rounded up.
4291
4292 If @var{n} is not specified or is zero, use a machine-dependent default.
4293
4294 Enabled at levels @option{-O2}, @option{-O3}.
4295
4296 @item -falign-labels
4297 @itemx -falign-labels=@var{n}
4298 @opindex falign-labels
4299 Align all branch targets to a power-of-two boundary, skipping up to
4300 @var{n} bytes like @option{-falign-functions}.  This option can easily
4301 make code slower, because it must insert dummy operations for when the
4302 branch target is reached in the usual flow of the code.
4303
4304 @option{-fno-align-labels} and @option{-falign-labels=1} are
4305 equivalent and mean that labels will not be aligned.
4306
4307 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4308 are greater than this value, then their values are used instead.
4309
4310 If @var{n} is not specified or is zero, use a machine-dependent default
4311 which is very likely to be @samp{1}, meaning no alignment.
4312
4313 Enabled at levels @option{-O2}, @option{-O3}.
4314
4315 @item -falign-loops
4316 @itemx -falign-loops=@var{n}
4317 @opindex falign-loops
4318 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4319 like @option{-falign-functions}.  The hope is that the loop will be
4320 executed many times, which will make up for any execution of the dummy
4321 operations.
4322
4323 @option{-fno-align-loops} and @option{-falign-loops=1} are
4324 equivalent and mean that loops will not be aligned.
4325
4326 If @var{n} is not specified or is zero, use a machine-dependent default.
4327
4328 Enabled at levels @option{-O2}, @option{-O3}.
4329
4330 @item -falign-jumps
4331 @itemx -falign-jumps=@var{n}
4332 @opindex falign-jumps
4333 Align branch targets to a power-of-two boundary, for branch targets
4334 where the targets can only be reached by jumping, skipping up to @var{n}
4335 bytes like @option{-falign-functions}.  In this case, no dummy operations
4336 need be executed.
4337
4338 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
4339 equivalent and mean that loops will not be aligned.
4340
4341 If @var{n} is not specified or is zero, use a machine-dependent default.
4342
4343 Enabled at levels @option{-O2}, @option{-O3}.
4344
4345 @item -frename-registers
4346 @opindex frename-registers
4347 Attempt to avoid false dependencies in scheduled code by making use
4348 of registers left over after register allocation.  This optimization
4349 will most benefit processors with lots of registers.  Depending on the
4350 debug information format adopted by the target, however, it can
4351 make debugging impossible, since variables will no longer stay in
4352 a ``home register''.
4353
4354 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
4355 on targets where the default format for debugging information supports
4356 variable tracking.
4357
4358 @item -fweb
4359 @opindex fweb
4360 Constructs webs as commonly used for register allocation purposes and assign
4361 each web individual pseudo register.  This allows our register allocation pass
4362 to operate on pseudos directly, but also strengthens several other optimization
4363 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
4364 however, make debugging impossible, since variables will no longer stay in a
4365 ``home register''.
4366
4367 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os},
4368 on targets where the default format for debugging information supports
4369 variable tracking.
4370
4371 @item -fno-cprop-registers
4372 @opindex fno-cprop-registers
4373 After register allocation and post-register allocation instruction splitting,
4374 we perform a copy-propagation pass to try to reduce scheduling dependencies
4375 and occasionally eliminate the copy.
4376
4377 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4378
4379 @item -fprofile-generate
4380 @opindex fprofile-generate
4381
4382 Enable options usually used for instrumenting application to produce
4383 profile useful for later recompilation with profile feedback based
4384 optimization.  You must use @code{-fprofile-generate} both when
4385 compiling and when linking your program.
4386
4387 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
4388
4389 @item -fprofile-use
4390 @opindex fprofile-use
4391 Enable profile feedback directed optimizations, and optimizations
4392 generally profitable only with profile feedback available.
4393
4394 The following options are enabled: @code{-fbranch-probabilities},
4395 @code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
4396
4397 @end table
4398
4399 The following options control compiler behavior regarding floating
4400 point arithmetic.  These options trade off between speed and
4401 correctness.  All must be specifically enabled.
4402
4403 @table @gcctabopt
4404 @item -ffloat-store
4405 @opindex ffloat-store
4406 Do not store floating point variables in registers, and inhibit other
4407 options that might change whether a floating point value is taken from a
4408 register or memory.
4409
4410 @cindex floating point precision
4411 This option prevents undesirable excess precision on machines such as
4412 the 68000 where the floating registers (of the 68881) keep more
4413 precision than a @code{double} is supposed to have.  Similarly for the
4414 x86 architecture.  For most programs, the excess precision does only
4415 good, but a few programs rely on the precise definition of IEEE floating
4416 point.  Use @option{-ffloat-store} for such programs, after modifying
4417 them to store all pertinent intermediate computations into variables.
4418
4419 @item -ffast-math
4420 @opindex ffast-math
4421 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4422 @option{-fno-trapping-math}, @option{-ffinite-math-only},
4423 @option{-fno-rounding-math} and @option{-fno-signaling-nans}.
4424
4425 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4426
4427 This option should never be turned on by any @option{-O} option since
4428 it can result in incorrect output for programs which depend on
4429 an exact implementation of IEEE or ISO rules/specifications for
4430 math functions.
4431
4432 @item -fno-math-errno
4433 @opindex fno-math-errno
4434 Do not set ERRNO after calling math functions that are executed
4435 with a single instruction, e.g., sqrt.  A program that relies on
4436 IEEE exceptions for math error handling may want to use this flag
4437 for speed while maintaining IEEE arithmetic compatibility.
4438
4439 This option should never be turned on by any @option{-O} option since
4440 it can result in incorrect output for programs which depend on
4441 an exact implementation of IEEE or ISO rules/specifications for
4442 math functions.
4443
4444 The default is @option{-fmath-errno}.
4445
4446 @item -funsafe-math-optimizations
4447 @opindex funsafe-math-optimizations
4448 Allow optimizations for floating-point arithmetic that (a) assume
4449 that arguments and results are valid and (b) may violate IEEE or
4450 ANSI standards.  When used at link-time, it may include libraries
4451 or startup files that change the default FPU control word or other
4452 similar optimizations.
4453
4454 This option should never be turned on by any @option{-O} option since
4455 it can result in incorrect output for programs which depend on
4456 an exact implementation of IEEE or ISO rules/specifications for
4457 math functions.
4458
4459 The default is @option{-fno-unsafe-math-optimizations}.
4460
4461 @item -ffinite-math-only
4462 @opindex ffinite-math-only
4463 Allow optimizations for floating-point arithmetic that assume
4464 that arguments and results are not NaNs or +-Infs.
4465
4466 This option should never be turned on by any @option{-O} option since
4467 it can result in incorrect output for programs which depend on
4468 an exact implementation of IEEE or ISO rules/specifications.
4469
4470 The default is @option{-fno-finite-math-only}.
4471
4472 @item -fno-trapping-math
4473 @opindex fno-trapping-math
4474 Compile code assuming that floating-point operations cannot generate
4475 user-visible traps.  These traps include division by zero, overflow,
4476 underflow, inexact result and invalid operation.  This option implies
4477 @option{-fno-signaling-nans}.  Setting this option may allow faster
4478 code if one relies on ``non-stop'' IEEE arithmetic, for example.
4479
4480 This option should never be turned on by any @option{-O} option since
4481 it can result in incorrect output for programs which depend on
4482 an exact implementation of IEEE or ISO rules/specifications for
4483 math functions.
4484
4485 The default is @option{-ftrapping-math}.
4486
4487 @item -frounding-math
4488 @opindex frounding-math
4489 Disable transformations and optimizations that assume default floating
4490 point rounding behavior.  This is round-to-zero for all floating point
4491 to integer conversions, and round-to-nearest for all other arithmetic
4492 truncations.  This option should be specified for programs that change
4493 the FP rounding mode dynamically, or that may be executed with a
4494 non-default rounding mode.  This option disables constant folding of
4495 floating point expressions at compile-time (which may be affected by
4496 rounding mode) and arithmetic transformations that are unsafe in the
4497 presence of sign-dependent rounding modes.
4498
4499 The default is @option{-fno-rounding-math}.
4500
4501 This option is experimental and does not currently guarantee to
4502 disable all GCC optimizations that are affected by rounding mode.
4503 Future versions of GCC may provide finer control of this setting
4504 using C99's @code{FENV_ACCESS} pragma.  This command line option
4505 will be used to specify the default state for @code{FENV_ACCESS}.
4506
4507 @item -fsignaling-nans
4508 @opindex fsignaling-nans
4509 Compile code assuming that IEEE signaling NaNs may generate user-visible
4510 traps during floating-point operations.  Setting this option disables
4511 optimizations that may change the number of exceptions visible with
4512 signaling NaNs.  This option implies @option{-ftrapping-math}.
4513
4514 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4515 be defined.
4516
4517 The default is @option{-fno-signaling-nans}.
4518
4519 This option is experimental and does not currently guarantee to
4520 disable all GCC optimizations that affect signaling NaN behavior.
4521
4522 @item -fsingle-precision-constant
4523 @opindex fsingle-precision-constant
4524 Treat floating point constant as single precision constant instead of
4525 implicitly converting it to double precision constant.
4526
4527
4528 @end table
4529
4530 The following options control optimizations that may improve
4531 performance, but are not enabled by any @option{-O} options.  This
4532 section includes experimental options that may produce broken code.
4533
4534 @table @gcctabopt
4535 @item -fbranch-probabilities
4536 @opindex fbranch-probabilities
4537 After running a program compiled with @option{-fprofile-arcs}
4538 (@pxref{Debugging Options,, Options for Debugging Your Program or
4539 @command{gcc}}), you can compile it a second time using
4540 @option{-fbranch-probabilities}, to improve optimizations based on
4541 the number of times each branch was taken.  When the program
4542 compiled with @option{-fprofile-arcs} exits it saves arc execution
4543 counts to a file called @file{@var{sourcename}.gcda} for each source
4544 file  The information in this data file is very dependent on the
4545 structure of the generated code, so you must use the same source code
4546 and the same optimization options for both compilations.
4547
4548 With @option{-fbranch-probabilities}, GCC puts a
4549 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4550 These can be used to improve optimization.  Currently, they are only
4551 used in one place: in @file{reorg.c}, instead of guessing which path a
4552 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4553 exactly determine which path is taken more often.
4554
4555 @item -fprofile-values
4556 @opindex fprofile-values
4557 If combined with @option{-fprofile-arcs}, it adds code so that some
4558 data about values of expressions in the program is gathered.
4559
4560 With @option{-fbranch-probabilities}, it reads back the data gathered
4561 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4562 notes to instructions for their later usage in optimizations.
4563
4564 Enabled with @option{-profile-generate} and @option{-profile-use}.
4565
4566 @item -fvpt
4567 @opindex fvpt
4568 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
4569 a code to gather information about values of expressions.
4570
4571 With @option{-fbranch-probabilities}, it reads back the data gathered
4572 and actually performs the optimizations based on them.
4573 Currently the optimizations include specialization of division operation
4574 using the knowledge about the value of the denominator.
4575
4576 Enabled with @option{-profile-generate} and @option{-profile-use}.
4577
4578 @item -fnew-ra
4579 @opindex fnew-ra
4580 Use a graph coloring register allocator.  Currently this option is meant
4581 for testing, so we are interested to hear about miscompilations with
4582 @option{-fnew-ra}.
4583
4584 @item -ftracer
4585 @opindex ftracer
4586 Perform tail duplication to enlarge superblock size. This transformation
4587 simplifies the control flow of the function allowing other optimizations to do
4588 better job.
4589
4590 Enabled with @option{-profile-use}.
4591
4592 @item -funit-at-a-time
4593 @opindex funit-at-a-time
4594 Parse the whole compilation unit before starting to produce code.
4595 This allows some extra optimizations to take place but consumes more
4596 memory.
4597
4598 Enabled at levels @option{-O2}, @option{-O3}.
4599
4600 @item -funroll-loops
4601 @opindex funroll-loops
4602 Unroll loops whose number of iterations can be determined at compile time or
4603 upon entry to the loop.  @option{-funroll-loops} implies
4604 @option{-frerun-cse-after-loop}.  It also turns on complete loop peeling
4605 (i.e. complete removal of loops with small constant number of iterations).
4606 This option makes code larger, and may or may not make it run faster.
4607
4608 Enabled with @option{-profile-use}.
4609
4610 @item -funroll-all-loops
4611 @opindex funroll-all-loops
4612 Unroll all loops, even if their number of iterations is uncertain when
4613 the loop is entered.  This usually makes programs run more slowly.
4614 @option{-funroll-all-loops} implies the same options as
4615 @option{-funroll-loops}.
4616
4617 @item -fpeel-loops
4618 @opindex fpeel-loops
4619 Peels the loops for that there is enough information that they do not
4620 roll much (from profile feedback).  It also turns on complete loop peeling
4621 (i.e. complete removal of loops with small constant number of iterations).
4622
4623 Enabled with @option{-profile-use}.
4624
4625 @item -funswitch-loops
4626 @opindex funswitch-loops
4627 Move branches with loop invariant conditions out of the loop, with duplicates
4628 of the loop on both branches (modified according to result of the condition).
4629
4630 @item -fold-unroll-loops
4631 @opindex fold-unroll-loops
4632 Unroll loops whose number of iterations can be determined at compile
4633 time or upon entry to the loop, using the old loop unroller whose loop
4634 recognition is based on notes from frontend.  @option{-fold-unroll-loops} implies
4635 both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4636 option makes code larger, and may or may not make it run faster.
4637
4638 @item -fold-unroll-all-loops
4639 @opindex fold-unroll-all-loops
4640 Unroll all loops, even if their number of iterations is uncertain when
4641 the loop is entered. This is done using the old loop unroller whose loop
4642 recognition is based on notes from frontend.  This usually makes programs run more slowly.
4643 @option{-fold-unroll-all-loops} implies the same options as
4644 @option{-fold-unroll-loops}.
4645
4646 @item -fprefetch-loop-arrays
4647 @opindex fprefetch-loop-arrays
4648 If supported by the target machine, generate instructions to prefetch
4649 memory to improve the performance of loops that access large arrays.
4650
4651 Disabled at level @option{-Os}.
4652
4653 @item -ffunction-sections
4654 @itemx -fdata-sections
4655 @opindex ffunction-sections
4656 @opindex fdata-sections
4657 Place each function or data item into its own section in the output
4658 file if the target supports arbitrary sections.  The name of the
4659 function or the name of the data item determines the section's name
4660 in the output file.
4661
4662 Use these options on systems where the linker can perform optimizations
4663 to improve locality of reference in the instruction space.  Most systems
4664 using the ELF object format and SPARC processors running Solaris 2 have
4665 linkers with such optimizations.  AIX may have these optimizations in
4666 the future.
4667
4668 Only use these options when there are significant benefits from doing
4669 so.  When you specify these options, the assembler and linker will
4670 create larger object and executable files and will also be slower.
4671 You will not be able to use @code{gprof} on all systems if you
4672 specify this option and you may have problems with debugging if
4673 you specify both this option and @option{-g}.
4674
4675 @item -fbranch-target-load-optimize
4676 @opindex fbranch-target-load-optimize
4677 Perform branch target register load optimization before prologue / epilogue
4678 threading.
4679 The use of target registers can typically be exposed only during reload,
4680 thus hoisting loads out of loops and doing inter-block scheduling needs
4681 a separate optimization pass.
4682
4683 @item -fbranch-target-load-optimize2
4684 @opindex fbranch-target-load-optimize2
4685 Perform branch target register load optimization after prologue / epilogue
4686 threading.
4687
4688 @item -fbtr-bb-exclusive
4689 @opindex fbtr-bb-exclusive
4690 When performing branch target register load optimization, don't reuse
4691 branch target registers in within any basic block.
4692
4693 @item --param @var{name}=@var{value}
4694 @opindex param
4695 In some places, GCC uses various constants to control the amount of
4696 optimization that is done.  For example, GCC will not inline functions
4697 that contain more that a certain number of instructions.  You can
4698 control some of these constants on the command-line using the
4699 @option{--param} option.
4700
4701 The names of specific parameters, and the meaning of the values, are
4702 tied to the internals of the compiler, and are subject to change
4703 without notice in future releases.
4704
4705 In each case, the @var{value} is an integer.  The allowable choices for
4706 @var{name} are given in the following table:
4707
4708 @table @gcctabopt
4709 @item max-crossjump-edges
4710 The maximum number of incoming edges to consider for crossjumping.
4711 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
4712 the number of edges incoming to each block.  Increasing values mean
4713 more aggressive optimization, making the compile time increase with
4714 probably small improvement in executable size.
4715
4716 @item max-delay-slot-insn-search
4717 The maximum number of instructions to consider when looking for an
4718 instruction to fill a delay slot.  If more than this arbitrary number of
4719 instructions is searched, the time savings from filling the delay slot
4720 will be minimal so stop searching.  Increasing values mean more
4721 aggressive optimization, making the compile time increase with probably
4722 small improvement in executable run time.
4723
4724 @item max-delay-slot-live-search
4725 When trying to fill delay slots, the maximum number of instructions to
4726 consider when searching for a block with valid live register
4727 information.  Increasing this arbitrarily chosen value means more
4728 aggressive optimization, increasing the compile time.  This parameter
4729 should be removed when the delay slot code is rewritten to maintain the
4730 control-flow graph.
4731
4732 @item max-gcse-memory
4733 The approximate maximum amount of memory that will be allocated in
4734 order to perform the global common subexpression elimination
4735 optimization.  If more memory than specified is required, the
4736 optimization will not be done.
4737
4738 @item max-gcse-passes
4739 The maximum number of passes of GCSE to run.  The default is 1.
4740
4741 @item max-pending-list-length
4742 The maximum number of pending dependencies scheduling will allow
4743 before flushing the current state and starting over.  Large functions
4744 with few branches or calls can create excessively large lists which
4745 needlessly consume memory and resources.
4746
4747 @item max-inline-insns-single
4748 Several parameters control the tree inliner used in gcc.
4749 This number sets the maximum number of instructions (counted in GCC's
4750 internal representation) in a single function that the tree inliner
4751 will consider for inlining.  This only affects functions declared
4752 inline and methods implemented in a class declaration (C++).
4753 The default value is 500.
4754
4755 @item max-inline-insns-auto
4756 When you use @option{-finline-functions} (included in @option{-O3}),
4757 a lot of functions that would otherwise not be considered for inlining
4758 by the compiler will be investigated.  To those functions, a different
4759 (more restrictive) limit compared to functions declared inline can
4760 be applied.
4761 The default value is 120.
4762
4763 @item large-function-insns
4764 The limit specifying really large functions.  For functions greater than this
4765 limit inlining is constrained by @option{--param large-function-growth}.
4766 This parameter is useful primarily to avoid extreme compilation time caused by non-linear
4767 algorithms used by the backend.
4768 This parameter is ignored when @option{-funit-at-a-time} is not used.
4769 The default value is 3000.
4770
4771 @item large-function-growth
4772 Specifies maximal growth of large function caused by inlining in percents.
4773 This parameter is ignored when @option{-funit-at-a-time} is not used.
4774 The default value is 200.
4775
4776 @item inline-unit-growth
4777 Specifies maximal overall growth of the compilation unit caused by inlining.
4778 This parameter is ignored when @option{-funit-at-a-time} is not used.
4779 The default value is 150.
4780
4781 @item max-inline-insns-rtl
4782 For languages that use the RTL inliner (this happens at a later stage
4783 than tree inlining), you can set the maximum allowable size (counted
4784 in RTL instructions) for the RTL inliner with this parameter.
4785 The default value is 600.
4786
4787 @item max-unrolled-insns
4788 The maximum number of instructions that a loop should have if that loop
4789 is unrolled, and if the loop is unrolled, it determines how many times
4790 the loop code is unrolled.
4791
4792 @item max-average-unrolled-insns
4793 The maximum number of instructions biased by probabilities of their execution
4794 that a loop should have if that loop is unrolled, and if the loop is unrolled,
4795 it determines how many times the loop code is unrolled.
4796
4797 @item max-unroll-times
4798 The maximum number of unrollings of a single loop.
4799
4800 @item max-peeled-insns
4801 The maximum number of instructions that a loop should have if that loop
4802 is peeled, and if the loop is peeled, it determines how many times
4803 the loop code is peeled.
4804
4805 @item max-peel-times
4806 The maximum number of peelings of a single loop.
4807
4808 @item max-completely-peeled-insns
4809 The maximum number of insns of a completely peeled loop.
4810
4811 @item max-completely-peel-times
4812 The maximum number of iterations of a loop to be suitable for complete peeling.
4813
4814 @item max-unswitch-insns
4815 The maximum number of insns of an unswitched loop.
4816
4817 @item max-unswitch-level
4818 The maximum number of branches unswitched in a single loop.
4819
4820 @item hot-bb-count-fraction
4821 Select fraction of the maximal count of repetitions of basic block in program
4822 given basic block needs to have to be considered hot.
4823
4824 @item hot-bb-frequency-fraction
4825 Select fraction of the maximal frequency of executions of basic block in
4826 function given basic block needs to have to be considered hot
4827
4828 @item tracer-dynamic-coverage
4829 @itemx tracer-dynamic-coverage-feedback
4830
4831 This value is used to limit superblock formation once the given percentage of
4832 executed instructions is covered.  This limits unnecessary code size
4833 expansion.
4834
4835 The @option{tracer-dynamic-coverage-feedback} is used only when profile
4836 feedback is available.  The real profiles (as opposed to statically estimated
4837 ones) are much less balanced allowing the threshold to be larger value.
4838
4839 @item tracer-max-code-growth
4840 Stop tail duplication once code growth has reached given percentage.  This is
4841 rather hokey argument, as most of the duplicates will be eliminated later in
4842 cross jumping, so it may be set to much higher values than is the desired code
4843 growth.
4844
4845 @item tracer-min-branch-ratio
4846
4847 Stop reverse growth when the reverse probability of best edge is less than this
4848 threshold (in percent).
4849
4850 @item tracer-min-branch-ratio
4851 @itemx tracer-min-branch-ratio-feedback
4852
4853 Stop forward growth if the best edge do have probability lower than this
4854 threshold.
4855
4856 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
4857 compilation for profile feedback and one for compilation without.  The value
4858 for compilation with profile feedback needs to be more conservative (higher) in
4859 order to make tracer effective.
4860
4861 @item max-cse-path-length
4862
4863 Maximum number of basic blocks on path that cse considers.  The default is 10.
4864
4865 @item ggc-min-expand
4866
4867 GCC uses a garbage collector to manage its own memory allocation.  This
4868 parameter specifies the minimum percentage by which the garbage
4869 collector's heap should be allowed to expand between collections.
4870 Tuning this may improve compilation speed; it has no effect on code
4871 generation.
4872
4873 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
4874 RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
4875 the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
4876 GCC is not able to calculate RAM on a particular platform, the lower
4877 bound of 30% is used.  Setting this parameter and
4878 @option{ggc-min-heapsize} to zero causes a full collection to occur at
4879 every opportunity.  This is extremely slow, but can be useful for
4880 debugging.
4881
4882 @item ggc-min-heapsize
4883
4884 Minimum size of the garbage collector's heap before it begins bothering
4885 to collect garbage.  The first collection occurs after the heap expands
4886 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
4887 tuning this may improve compilation speed, and has no effect on code
4888 generation.
4889
4890 The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
4891 upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
4892 available, the notion of "RAM" is the smallest of actual RAM,
4893 RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
4894 RAM on a particular platform, the lower bound is used.  Setting this
4895 parameter very large effectively disables garbage collection.  Setting
4896 this parameter and @option{ggc-min-expand} to zero causes a full
4897 collection to occur at every opportunity.
4898
4899 @item max-reload-search-insns
4900 The maximum number of instruction reload should look backward for equivalent
4901 register.  Increasing values mean more aggressive optimization, making the
4902 compile time increase with probably slightly better performance.  The default
4903 value is 100.
4904
4905 @item max-cselib-memory-location
4906 The maximum number of memory locations cselib should take into acount.
4907 Increasing values mean more aggressive optimization, making the compile time
4908 increase with probably slightly better performance.  The default value is 500.
4909
4910 @item reorder-blocks-duplicate
4911 @itemx reorder-blocks-duplicate-feedback
4912
4913 Used by basic block reordering pass to decide whether to use unconditional
4914 branch or duplicate the code on its destination.  Code is duplicated when its
4915 estimated size is smaller than this value multiplied by the estimated size of
4916 unconditional jump in the hot spots of the program.
4917
4918 The @option{reorder-block-duplicate-feedback} is used only when profile
4919 feedback is available and may be set to higher values than
4920 @option{reorder-block-duplicate} since information about the hot spots is more
4921 accurate.
4922
4923 @item max-sched-region-blocks
4924 The maximum number of blocks in a region to be considered for
4925 interblock scheduling.  The default value is 10.
4926
4927 @item max-sched-region-insns
4928 The maximum number of insns in a region to be considered for
4929 interblock scheduling.  The default value is 100.
4930 @end table
4931 @end table
4932
4933 @node Preprocessor Options
4934 @section Options Controlling the Preprocessor
4935 @cindex preprocessor options
4936 @cindex options, preprocessor
4937
4938 These options control the C preprocessor, which is run on each C source
4939 file before actual compilation.
4940
4941 If you use the @option{-E} option, nothing is done except preprocessing.
4942 Some of these options make sense only together with @option{-E} because
4943 they cause the preprocessor output to be unsuitable for actual
4944 compilation.
4945
4946 @table @gcctabopt
4947 @opindex Wp
4948 You can use @option{-Wp,@var{option}} to bypass the compiler driver
4949 and pass @var{option} directly through to the preprocessor.  If
4950 @var{option} contains commas, it is split into multiple options at the
4951 commas.  However, many options are modified, translated or interpreted
4952 by the compiler driver before being passed to the preprocessor, and
4953 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4954 interface is undocumented and subject to change, so whenever possible
4955 you should avoid using @option{-Wp} and let the driver handle the
4956 options instead.
4957
4958 @item -Xpreprocessor @var{option}
4959 @opindex preprocessor
4960 Pass @var{option} as an option to the preprocessor.  You can use this to
4961 supply system-specific preprocessor options which GCC does not know how to
4962 recognize.
4963
4964 If you want to pass an option that takes an argument, you must use
4965 @option{-Xpreprocessor} twice, once for the option and once for the argument.
4966 @end table
4967
4968 @include cppopts.texi
4969
4970 @node Assembler Options
4971 @section Passing Options to the Assembler
4972
4973 @c prevent bad page break with this line
4974 You can pass options to the assembler.
4975
4976 @table @gcctabopt
4977 @item -Wa,@var{option}
4978 @opindex Wa
4979 Pass @var{option} as an option to the assembler.  If @var{option}
4980 contains commas, it is split into multiple options at the commas.
4981
4982 @item -Xassembler @var{option}
4983 @opindex Xassembler
4984 Pass @var{option} as an option to the assembler.  You can use this to
4985 supply system-specific assembler options which GCC does not know how to
4986 recognize.
4987
4988 If you want to pass an option that takes an argument, you must use
4989 @option{-Xassembler} twice, once for the option and once for the argument.
4990
4991 @end table
4992
4993 @node Link Options
4994 @section Options for Linking
4995 @cindex link options
4996 @cindex options, linking
4997
4998 These options come into play when the compiler links object files into
4999 an executable output file.  They are meaningless if the compiler is
5000 not doing a link step.
5001
5002 @table @gcctabopt
5003 @cindex file names
5004 @item @var{object-file-name}
5005 A file name that does not end in a special recognized suffix is
5006 considered to name an object file or library.  (Object files are
5007 distinguished from libraries by the linker according to the file
5008 contents.)  If linking is done, these object files are used as input
5009 to the linker.
5010
5011 @item -c
5012 @itemx -S
5013 @itemx -E
5014 @opindex c
5015 @opindex S
5016 @opindex E
5017 If any of these options is used, then the linker is not run, and
5018 object file names should not be used as arguments.  @xref{Overall
5019 Options}.
5020
5021 @cindex Libraries
5022 @item -l@var{library}
5023 @itemx -l @var{library}
5024 @opindex l
5025 Search the library named @var{library} when linking.  (The second
5026 alternative with the library as a separate argument is only for
5027 POSIX compliance and is not recommended.)
5028
5029 It makes a difference where in the command you write this option; the
5030 linker searches and processes libraries and object files in the order they
5031 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
5032 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
5033 to functions in @samp{z}, those functions may not be loaded.
5034
5035 The linker searches a standard list of directories for the library,
5036 which is actually a file named @file{lib@var{library}.a}.  The linker
5037 then uses this file as if it had been specified precisely by name.
5038
5039 The directories searched include several standard system directories
5040 plus any that you specify with @option{-L}.
5041
5042 Normally the files found this way are library files---archive files
5043 whose members are object files.  The linker handles an archive file by
5044 scanning through it for members which define symbols that have so far
5045 been referenced but not defined.  But if the file that is found is an
5046 ordinary object file, it is linked in the usual fashion.  The only
5047 difference between using an @option{-l} option and specifying a file name
5048 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
5049 and searches several directories.
5050
5051 @item -lobjc
5052 @opindex lobjc
5053 You need this special case of the @option{-l} option in order to
5054 link an Objective-C program.
5055
5056 @item -nostartfiles
5057 @opindex nostartfiles
5058 Do not use the standard system startup files when linking.
5059 The standard system libraries are used normally, unless @option{-nostdlib}
5060 or @option{-nodefaultlibs} is used.
5061
5062 @item -nodefaultlibs
5063 @opindex nodefaultlibs
5064 Do not use the standard system libraries when linking.
5065 Only the libraries you specify will be passed to the linker.
5066 The standard startup files are used normally, unless @option{-nostartfiles}
5067 is used.  The compiler may generate calls to memcmp, memset, and memcpy
5068 for System V (and ISO C) environments or to bcopy and bzero for
5069 BSD environments.  These entries are usually resolved by entries in
5070 libc.  These entry points should be supplied through some other
5071 mechanism when this option is specified.
5072
5073 @item -nostdlib
5074 @opindex nostdlib
5075 Do not use the standard system startup files or libraries when linking.
5076 No startup files and only the libraries you specify will be passed to
5077 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
5078 for System V (and ISO C) environments or to bcopy and bzero for
5079 BSD environments.  These entries are usually resolved by entries in
5080 libc.  These entry points should be supplied through some other
5081 mechanism when this option is specified.
5082
5083 @cindex @option{-lgcc}, use with @option{-nostdlib}
5084 @cindex @option{-nostdlib} and unresolved references
5085 @cindex unresolved references and @option{-nostdlib}
5086 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5087 @cindex @option{-nodefaultlibs} and unresolved references
5088 @cindex unresolved references and @option{-nodefaultlibs}
5089 One of the standard libraries bypassed by @option{-nostdlib} and
5090 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
5091 that GCC uses to overcome shortcomings of particular machines, or special
5092 needs for some languages.
5093 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5094 Collection (GCC) Internals},
5095 for more discussion of @file{libgcc.a}.)
5096 In most cases, you need @file{libgcc.a} even when you want to avoid
5097 other standard libraries.  In other words, when you specify @option{-nostdlib}
5098 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
5099 This ensures that you have no unresolved references to internal GCC
5100 library subroutines.  (For example, @samp{__main}, used to ensure C++
5101 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5102 GNU Compiler Collection (GCC) Internals}.)
5103
5104 @item -pie
5105 @opindex pie
5106 Produce a position independent executable on targets which support it.
5107 For predictable results, you must also specify the same set of options
5108 that were used to generate code (@option{-fpie}, @option{-fPIE},
5109 or model suboptions) when you specify this option.
5110
5111 @item -s
5112 @opindex s
5113 Remove all symbol table and relocation information from the executable.
5114
5115 @item -static
5116 @opindex static
5117 On systems that support dynamic linking, this prevents linking with the shared
5118 libraries.  On other systems, this option has no effect.
5119
5120 @item -shared
5121 @opindex shared
5122 Produce a shared object which can then be linked with other objects to
5123 form an executable.  Not all systems support this option.  For predictable
5124 results, you must also specify the same set of options that were used to
5125 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
5126 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
5127 needs to build supplementary stub code for constructors to work.  On
5128 multi-libbed systems, @samp{gcc -shared} must select the correct support
5129 libraries to link against.  Failing to supply the correct flags may lead
5130 to subtle defects.  Supplying them in cases where they are not necessary
5131 is innocuous.}
5132
5133 @item -shared-libgcc
5134 @itemx -static-libgcc
5135 @opindex shared-libgcc
5136 @opindex static-libgcc
5137 On systems that provide @file{libgcc} as a shared library, these options
5138 force the use of either the shared or static version respectively.
5139 If no shared version of @file{libgcc} was built when the compiler was
5140 configured, these options have no effect.
5141
5142 There are several situations in which an application should use the
5143 shared @file{libgcc} instead of the static version.  The most common
5144 of these is when the application wishes to throw and catch exceptions
5145 across different shared libraries.  In that case, each of the libraries
5146 as well as the application itself should use the shared @file{libgcc}.
5147
5148 Therefore, the G++ and GCJ drivers automatically add
5149 @option{-shared-libgcc} whenever you build a shared library or a main
5150 executable, because C++ and Java programs typically use exceptions, so
5151 this is the right thing to do.
5152
5153 If, instead, you use the GCC driver to create shared libraries, you may
5154 find that they will not always be linked with the shared @file{libgcc}.
5155 If GCC finds, at its configuration time, that you have a GNU linker that
5156 does not support option @option{--eh-frame-hdr}, it will link the shared
5157 version of @file{libgcc} into shared libraries by default.  Otherwise,
5158 it will take advantage of the linker and optimize away the linking with
5159 the shared version of @file{libgcc}, linking with the static version of
5160 libgcc by default.  This allows exceptions to propagate through such
5161 shared libraries, without incurring relocation costs at library load
5162 time.
5163
5164 However, if a library or main executable is supposed to throw or catch
5165 exceptions, you must link it using the G++ or GCJ driver, as appropriate
5166 for the languages used in the program, or using the option
5167 @option{-shared-libgcc}, such that it is linked with the shared
5168 @file{libgcc}.
5169
5170 @item -symbolic
5171 @opindex symbolic
5172 Bind references to global symbols when building a shared object.  Warn
5173 about any unresolved references (unless overridden by the link editor
5174 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
5175 this option.
5176
5177 @item -Xlinker @var{option}
5178 @opindex Xlinker
5179 Pass @var{option} as an option to the linker.  You can use this to
5180 supply system-specific linker options which GCC does not know how to
5181 recognize.
5182
5183 If you want to pass an option that takes an argument, you must use
5184 @option{-Xlinker} twice, once for the option and once for the argument.
5185 For example, to pass @option{-assert definitions}, you must write
5186 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
5187 @option{-Xlinker "-assert definitions"}, because this passes the entire
5188 string as a single argument, which is not what the linker expects.
5189
5190 @item -Wl,@var{option}
5191 @opindex Wl
5192 Pass @var{option} as an option to the linker.  If @var{option} contains
5193 commas, it is split into multiple options at the commas.
5194
5195 @item -u @var{symbol}
5196 @opindex u
5197 Pretend the symbol @var{symbol} is undefined, to force linking of
5198 library modules to define it.  You can use @option{-u} multiple times with
5199 different symbols to force loading of additional library modules.
5200 @end table
5201
5202 @node Directory Options
5203 @section Options for Directory Search
5204 @cindex directory options
5205 @cindex options, directory search
5206 @cindex search path
5207
5208 These options specify directories to search for header files, for
5209 libraries and for parts of the compiler:
5210
5211 @table @gcctabopt
5212 @item -I@var{dir}
5213 @opindex I
5214 Add the directory @var{dir} to the head of the list of directories to be
5215 searched for header files.  This can be used to override a system header
5216 file, substituting your own version, since these directories are
5217 searched before the system header file directories.  However, you should
5218 not use this option to add directories that contain vendor-supplied
5219 system header files (use @option{-isystem} for that).  If you use more than
5220 one @option{-I} option, the directories are scanned in left-to-right
5221 order; the standard system directories come after.
5222
5223 If a standard system include directory, or a directory specified with
5224 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
5225 option will be ignored.  The directory will still be searched but as a
5226 system directory at its normal position in the system include chain.
5227 This is to ensure that GCC's procedure to fix buggy system headers and
5228 the ordering for the include_next directive are not inadvertently changed.
5229 If you really need to change the search order for system directories,
5230 use the @option{-nostdinc} and/or @option{-isystem} options.
5231
5232 @item -I-
5233 @opindex I-
5234 Any directories you specify with @option{-I} options before the @option{-I-}
5235 option are searched only for the case of @samp{#include "@var{file}"};
5236 they are not searched for @samp{#include <@var{file}>}.
5237
5238 If additional directories are specified with @option{-I} options after
5239 the @option{-I-}, these directories are searched for all @samp{#include}
5240 directives.  (Ordinarily @emph{all} @option{-I} directories are used
5241 this way.)
5242
5243 In addition, the @option{-I-} option inhibits the use of the current
5244 directory (where the current input file came from) as the first search
5245 directory for @samp{#include "@var{file}"}.  There is no way to
5246 override this effect of @option{-I-}.  With @option{-I.} you can specify
5247 searching the directory which was current when the compiler was
5248 invoked.  That is not exactly the same as what the preprocessor does
5249 by default, but it is often satisfactory.
5250
5251 @option{-I-} does not inhibit the use of the standard system directories
5252 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
5253 independent.
5254
5255 @item -L@var{dir}
5256 @opindex L
5257 Add directory @var{dir} to the list of directories to be searched
5258 for @option{-l}.
5259
5260 @item -B@var{prefix}
5261 @opindex B
5262 This option specifies where to find the executables, libraries,
5263 include files, and data files of the compiler itself.
5264
5265 The compiler driver program runs one or more of the subprograms
5266 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
5267 @var{prefix} as a prefix for each program it tries to run, both with and
5268 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5269
5270 For each subprogram to be run, the compiler driver first tries the
5271 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
5272 was not specified, the driver tries two standard prefixes, which are
5273 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
5274 those results in a file name that is found, the unmodified program
5275 name is searched for using the directories specified in your
5276 @env{PATH} environment variable.
5277
5278 The compiler will check to see if the path provided by the @option{-B}
5279 refers to a directory, and if necessary it will add a directory
5280 separator character at the end of the path.
5281
5282 @option{-B} prefixes that effectively specify directory names also apply
5283 to libraries in the linker, because the compiler translates these
5284 options into @option{-L} options for the linker.  They also apply to
5285 includes files in the preprocessor, because the compiler translates these
5286 options into @option{-isystem} options for the preprocessor.  In this case,
5287 the compiler appends @samp{include} to the prefix.
5288
5289 The run-time support file @file{libgcc.a} can also be searched for using
5290 the @option{-B} prefix, if needed.  If it is not found there, the two
5291 standard prefixes above are tried, and that is all.  The file is left
5292 out of the link if it is not found by those means.
5293
5294 Another way to specify a prefix much like the @option{-B} prefix is to use
5295 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
5296 Variables}.
5297
5298 As a special kludge, if the path provided by @option{-B} is
5299 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
5300 9, then it will be replaced by @file{[dir/]include}.  This is to help
5301 with boot-strapping the compiler.
5302
5303 @item -specs=@var{file}
5304 @opindex specs
5305 Process @var{file} after the compiler reads in the standard @file{specs}
5306 file, in order to override the defaults that the @file{gcc} driver
5307 program uses when determining what switches to pass to @file{cc1},
5308 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
5309 @option{-specs=@var{file}} can be specified on the command line, and they
5310 are processed in order, from left to right.
5311 @end table
5312
5313 @c man end
5314
5315 @node Spec Files
5316 @section Specifying subprocesses and the switches to pass to them
5317 @cindex Spec Files
5318
5319 @command{gcc} is a driver program.  It performs its job by invoking a
5320 sequence of other programs to do the work of compiling, assembling and
5321 linking.  GCC interprets its command-line parameters and uses these to
5322 deduce which programs it should invoke, and which command-line options
5323 it ought to place on their command lines.  This behavior is controlled
5324 by @dfn{spec strings}.  In most cases there is one spec string for each
5325 program that GCC can invoke, but a few programs have multiple spec
5326 strings to control their behavior.  The spec strings built into GCC can
5327 be overridden by using the @option{-specs=} command-line switch to specify
5328 a spec file.
5329
5330 @dfn{Spec files} are plaintext files that are used to construct spec
5331 strings.  They consist of a sequence of directives separated by blank
5332 lines.  The type of directive is determined by the first non-whitespace
5333 character on the line and it can be one of the following:
5334
5335 @table @code
5336 @item %@var{command}
5337 Issues a @var{command} to the spec file processor.  The commands that can
5338 appear here are:
5339
5340 @table @code
5341 @item %include <@var{file}>
5342 @cindex %include
5343 Search for @var{file} and insert its text at the current point in the
5344 specs file.
5345
5346 @item %include_noerr <@var{file}>
5347 @cindex %include_noerr
5348 Just like @samp{%include}, but do not generate an error message if the include
5349 file cannot be found.
5350
5351 @item %rename @var{old_name} @var{new_name}
5352 @cindex %rename
5353 Rename the spec string @var{old_name} to @var{new_name}.
5354
5355 @end table
5356
5357 @item *[@var{spec_name}]:
5358 This tells the compiler to create, override or delete the named spec
5359 string.  All lines after this directive up to the next directive or
5360 blank line are considered to be the text for the spec string.  If this
5361 results in an empty string then the spec will be deleted.  (Or, if the
5362 spec did not exist, then nothing will happened.)  Otherwise, if the spec
5363 does not currently exist a new spec will be created.  If the spec does
5364 exist then its contents will be overridden by the text of this
5365 directive, unless the first character of that text is the @samp{+}
5366 character, in which case the text will be appended to the spec.
5367
5368 @item [@var{suffix}]:
5369 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
5370 and up to the next directive or blank line are considered to make up the
5371 spec string for the indicated suffix.  When the compiler encounters an
5372 input file with the named suffix, it will processes the spec string in
5373 order to work out how to compile that file.  For example:
5374
5375 @smallexample
5376 .ZZ:
5377 z-compile -input %i
5378 @end smallexample
5379
5380 This says that any input file whose name ends in @samp{.ZZ} should be
5381 passed to the program @samp{z-compile}, which should be invoked with the
5382 command-line switch @option{-input} and with the result of performing the
5383 @samp{%i} substitution.  (See below.)
5384
5385 As an alternative to providing a spec string, the text that follows a
5386 suffix directive can be one of the following:
5387
5388 @table @code
5389 @item @@@var{language}
5390 This says that the suffix is an alias for a known @var{language}.  This is
5391 similar to using the @option{-x} command-line switch to GCC to specify a
5392 language explicitly.  For example:
5393
5394 @smallexample
5395 .ZZ:
5396 @@c++
5397 @end smallexample
5398
5399 Says that .ZZ files are, in fact, C++ source files.
5400
5401 @item #@var{name}
5402 This causes an error messages saying:
5403
5404 @smallexample
5405 @var{name} compiler not installed on this system.
5406 @end smallexample
5407 @end table
5408
5409 GCC already has an extensive list of suffixes built into it.
5410 This directive will add an entry to the end of the list of suffixes, but
5411 since the list is searched from the end backwards, it is effectively
5412 possible to override earlier entries using this technique.
5413
5414 @end table
5415
5416 GCC has the following spec strings built into it.  Spec files can
5417 override these strings or create their own.  Note that individual
5418 targets can also add their own spec strings to this list.
5419
5420 @smallexample
5421 asm          Options to pass to the assembler
5422 asm_final    Options to pass to the assembler post-processor
5423 cpp          Options to pass to the C preprocessor
5424 cc1          Options to pass to the C compiler
5425 cc1plus      Options to pass to the C++ compiler
5426 endfile      Object files to include at the end of the link
5427 link         Options to pass to the linker
5428 lib          Libraries to include on the command line to the linker
5429 libgcc       Decides which GCC support library to pass to the linker
5430 linker       Sets the name of the linker
5431 predefines   Defines to be passed to the C preprocessor
5432 signed_char  Defines to pass to CPP to say whether @code{char} is signed
5433              by default
5434 startfile    Object files to include at the start of the link
5435 @end smallexample
5436
5437 Here is a small example of a spec file:
5438
5439 @smallexample
5440 %rename lib                 old_lib
5441
5442 *lib:
5443 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
5444 @end smallexample
5445
5446 This example renames the spec called @samp{lib} to @samp{old_lib} and
5447 then overrides the previous definition of @samp{lib} with a new one.
5448 The new definition adds in some extra command-line options before
5449 including the text of the old definition.
5450
5451 @dfn{Spec strings} are a list of command-line options to be passed to their
5452 corresponding program.  In addition, the spec strings can contain
5453 @samp{%}-prefixed sequences to substitute variable text or to
5454 conditionally insert text into the command line.  Using these constructs
5455 it is possible to generate quite complex command lines.
5456
5457 Here is a table of all defined @samp{%}-sequences for spec
5458 strings.  Note that spaces are not generated automatically around the
5459 results of expanding these sequences.  Therefore you can concatenate them
5460 together or combine them with constant text in a single argument.
5461
5462 @table @code
5463 @item %%
5464 Substitute one @samp{%} into the program name or argument.
5465
5466 @item %i
5467 Substitute the name of the input file being processed.
5468
5469 @item %b
5470 Substitute the basename of the input file being processed.
5471 This is the substring up to (and not including) the last period
5472 and not including the directory.
5473
5474 @item %B
5475 This is the same as @samp{%b}, but include the file suffix (text after
5476 the last period).
5477
5478 @item %d
5479 Marks the argument containing or following the @samp{%d} as a
5480 temporary file name, so that that file will be deleted if GCC exits
5481 successfully.  Unlike @samp{%g}, this contributes no text to the
5482 argument.
5483
5484 @item %g@var{suffix}
5485 Substitute a file name that has suffix @var{suffix} and is chosen
5486 once per compilation, and mark the argument in the same way as
5487 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5488 name is now chosen in a way that is hard to predict even when previously
5489 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5490 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5491 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5492 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5493 was simply substituted with a file name chosen once per compilation,
5494 without regard to any appended suffix (which was therefore treated
5495 just like ordinary text), making such attacks more likely to succeed.
5496
5497 @item %u@var{suffix}
5498 Like @samp{%g}, but generates a new temporary file name even if
5499 @samp{%u@var{suffix}} was already seen.
5500
5501 @item %U@var{suffix}
5502 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5503 new one if there is no such last file name.  In the absence of any
5504 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5505 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5506 would involve the generation of two distinct file names, one
5507 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5508 simply substituted with a file name chosen for the previous @samp{%u},
5509 without regard to any appended suffix.
5510
5511 @item %j@var{suffix}
5512 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5513 writable, and if save-temps is off; otherwise, substitute the name
5514 of a temporary file, just like @samp{%u}.  This temporary file is not
5515 meant for communication between processes, but rather as a junk
5516 disposal mechanism.
5517
5518 @item %|@var{suffix}
5519 @itemx %m@var{suffix}
5520 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
5521 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
5522 all.  These are the two most common ways to instruct a program that it
5523 should read from standard input or write to standard output.  If you
5524 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
5525 construct: see for example @file{f/lang-specs.h}.
5526
5527 @item %.@var{SUFFIX}
5528 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5529 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5530 terminated by the next space or %.
5531
5532 @item %w
5533 Marks the argument containing or following the @samp{%w} as the
5534 designated output file of this compilation.  This puts the argument
5535 into the sequence of arguments that @samp{%o} will substitute later.
5536
5537 @item %o
5538 Substitutes the names of all the output files, with spaces
5539 automatically placed around them.  You should write spaces
5540 around the @samp{%o} as well or the results are undefined.
5541 @samp{%o} is for use in the specs for running the linker.
5542 Input files whose names have no recognized suffix are not compiled
5543 at all, but they are included among the output files, so they will
5544 be linked.
5545
5546 @item %O
5547 Substitutes the suffix for object files.  Note that this is
5548 handled specially when it immediately follows @samp{%g, %u, or %U},
5549 because of the need for those to form complete file names.  The
5550 handling is such that @samp{%O} is treated exactly as if it had already
5551 been substituted, except that @samp{%g, %u, and %U} do not currently
5552 support additional @var{suffix} characters following @samp{%O} as they would
5553 following, for example, @samp{.o}.
5554
5555 @item %p
5556 Substitutes the standard macro predefinitions for the
5557 current target machine.  Use this when running @code{cpp}.
5558
5559 @item %P
5560 Like @samp{%p}, but puts @samp{__} before and after the name of each
5561 predefined macro, except for macros that start with @samp{__} or with
5562 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5563 C@.
5564
5565 @item %I
5566 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5567 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5568 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5569 as necessary.
5570
5571 @item %s
5572 Current argument is the name of a library or startup file of some sort.
5573 Search for that file in a standard list of directories and substitute
5574 the full name found.
5575
5576 @item %e@var{str}
5577 Print @var{str} as an error message.  @var{str} is terminated by a newline.
5578 Use this when inconsistent options are detected.
5579
5580 @item %(@var{name})
5581 Substitute the contents of spec string @var{name} at this point.
5582
5583 @item %[@var{name}]
5584 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
5585
5586 @item %x@{@var{option}@}
5587 Accumulate an option for @samp{%X}.
5588
5589 @item %X
5590 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
5591 spec string.
5592
5593 @item %Y
5594 Output the accumulated assembler options specified by @option{-Wa}.
5595
5596 @item %Z
5597 Output the accumulated preprocessor options specified by @option{-Wp}.
5598
5599 @item %a
5600 Process the @code{asm} spec.  This is used to compute the
5601 switches to be passed to the assembler.
5602
5603 @item %A
5604 Process the @code{asm_final} spec.  This is a spec string for
5605 passing switches to an assembler post-processor, if such a program is
5606 needed.
5607
5608 @item %l
5609 Process the @code{link} spec.  This is the spec for computing the
5610 command line passed to the linker.  Typically it will make use of the
5611 @samp{%L %G %S %D and %E} sequences.
5612
5613 @item %D
5614 Dump out a @option{-L} option for each directory that GCC believes might
5615 contain startup files.  If the target supports multilibs then the
5616 current multilib directory will be prepended to each of these paths.
5617
5618 @item %M
5619 Output the multilib directory with directory separators replaced with
5620 @samp{_}.  If multilib directories are not set, or the multilib directory is
5621 @file{.} then this option emits nothing.
5622
5623 @item %L
5624 Process the @code{lib} spec.  This is a spec string for deciding which
5625 libraries should be included on the command line to the linker.
5626
5627 @item %G
5628 Process the @code{libgcc} spec.  This is a spec string for deciding
5629 which GCC support library should be included on the command line to the linker.
5630
5631 @item %S
5632 Process the @code{startfile} spec.  This is a spec for deciding which
5633 object files should be the first ones passed to the linker.  Typically
5634 this might be a file named @file{crt0.o}.
5635
5636 @item %E
5637 Process the @code{endfile} spec.  This is a spec string that specifies
5638 the last object files that will be passed to the linker.
5639
5640 @item %C
5641 Process the @code{cpp} spec.  This is used to construct the arguments
5642 to be passed to the C preprocessor.
5643
5644 @item %c
5645 Process the @code{signed_char} spec.  This is intended to be used
5646 to tell cpp whether a char is signed.  It typically has the definition:
5647 @smallexample
5648 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
5649 @end smallexample
5650
5651 @item %1
5652 Process the @code{cc1} spec.  This is used to construct the options to be
5653 passed to the actual C compiler (@samp{cc1}).
5654
5655 @item %2
5656 Process the @code{cc1plus} spec.  This is used to construct the options to be
5657 passed to the actual C++ compiler (@samp{cc1plus}).
5658
5659 @item %*
5660 Substitute the variable part of a matched option.  See below.
5661 Note that each comma in the substituted string is replaced by
5662 a single space.
5663
5664 @item %<@code{S}
5665 Remove all occurrences of @code{-S} from the command line.  Note---this
5666 command is position dependent.  @samp{%} commands in the spec string
5667 before this one will see @code{-S}, @samp{%} commands in the spec string
5668 after this one will not.
5669
5670 @item %:@var{function}(@var{args})
5671 Call the named function @var{function}, passing it @var{args}.
5672 @var{args} is first processed as a nested spec string, then split
5673 into an argument vector in the usual fashion.  The function returns
5674 a string which is processed as if it had appeared literally as part
5675 of the current spec.
5676
5677 The following built-in spec functions are provided:
5678
5679 @table @code
5680 @item @code{if-exists}
5681 The @code{if-exists} spec function takes one argument, an absolute
5682 pathname to a file.  If the file exists, @code{if-exists} returns the
5683 pathname.  Here is a small example of its usage:
5684
5685 @smallexample
5686 *startfile:
5687 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
5688 @end smallexample
5689
5690 @item @code{if-exists-else}
5691 The @code{if-exists-else} spec function is similar to the @code{if-exists}
5692 spec function, except that it takes two arguments.  The first argument is
5693 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
5694 returns the pathname.  If it does not exist, it returns the second argument.
5695 This way, @code{if-exists-else} can be used to select one file or another,
5696 based on the existence of the first.  Here is a small example of its usage:
5697
5698 @smallexample
5699 *startfile:
5700 crt0%O%s %:if-exists(crti%O%s) \
5701 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
5702 @end smallexample
5703 @end table
5704
5705 @item %@{@code{S}@}
5706 Substitutes the @code{-S} switch, if that switch was given to GCC@.
5707 If that switch was not specified, this substitutes nothing.  Note that
5708 the leading dash is omitted when specifying this option, and it is
5709 automatically inserted if the substitution is performed.  Thus the spec
5710 string @samp{%@{foo@}} would match the command-line option @option{-foo}
5711 and would output the command line option @option{-foo}.
5712
5713 @item %W@{@code{S}@}
5714 Like %@{@code{S}@} but mark last argument supplied within as a file to be
5715 deleted on failure.
5716
5717 @item %@{@code{S}*@}
5718 Substitutes all the switches specified to GCC whose names start
5719 with @code{-S}, but which also take an argument.  This is used for
5720 switches like @option{-o}, @option{-D}, @option{-I}, etc.
5721 GCC considers @option{-o foo} as being
5722 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
5723 text, including the space.  Thus two arguments would be generated.
5724
5725 @item %@{@code{S}*&@code{T}*@}
5726 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
5727 (the order of @code{S} and @code{T} in the spec is not significant).
5728 There can be any number of ampersand-separated variables; for each the
5729 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
5730
5731 @item %@{@code{S}:@code{X}@}
5732 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
5733
5734 @item %@{!@code{S}:@code{X}@}
5735 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
5736
5737 @item %@{@code{S}*:@code{X}@}
5738 Substitutes @code{X} if one or more switches whose names start with
5739 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
5740 once, no matter how many such switches appeared.  However, if @code{%*}
5741 appears somewhere in @code{X}, then @code{X} will be substituted once
5742 for each matching switch, with the @code{%*} replaced by the part of
5743 that switch that matched the @code{*}.
5744
5745 @item %@{.@code{S}:@code{X}@}
5746 Substitutes @code{X}, if processing a file with suffix @code{S}.
5747
5748 @item %@{!.@code{S}:@code{X}@}
5749 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
5750
5751 @item %@{@code{S}|@code{P}:@code{X}@}
5752 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
5753 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
5754 although they have a stronger binding than the @samp{|}.  If @code{%*}
5755 appears in @code{X}, all of the alternatives must be starred, and only
5756 the first matching alternative is substituted.
5757
5758 For example, a spec string like this:
5759
5760 @smallexample
5761 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5762 @end smallexample
5763
5764 will output the following command-line options from the following input
5765 command-line options:
5766
5767 @smallexample
5768 fred.c        -foo -baz
5769 jim.d         -bar -boggle
5770 -d fred.c     -foo -baz -boggle
5771 -d jim.d      -bar -baz -boggle
5772 @end smallexample
5773
5774 @item %@{S:X; T:Y; :D@}
5775
5776 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
5777 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
5778 be as many clauses as you need.  This may be combined with @code{.},
5779 @code{!}, @code{|}, and @code{*} as needed.
5780
5781
5782 @end table
5783
5784 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
5785 construct may contain other nested @samp{%} constructs or spaces, or
5786 even newlines.  They are processed as usual, as described above.
5787 Trailing white space in @code{X} is ignored.  White space may also
5788 appear anywhere on the left side of the colon in these constructs,
5789 except between @code{.} or @code{*} and the corresponding word.
5790
5791 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
5792 handled specifically in these constructs.  If another value of
5793 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5794 @option{-W} switch is found later in the command line, the earlier
5795 switch value is ignored, except with @{@code{S}*@} where @code{S} is
5796 just one letter, which passes all matching options.
5797
5798 The character @samp{|} at the beginning of the predicate text is used to
5799 indicate that a command should be piped to the following command, but
5800 only if @option{-pipe} is specified.
5801
5802 It is built into GCC which switches take arguments and which do not.
5803 (You might think it would be useful to generalize this to allow each
5804 compiler's spec to say which switches take arguments.  But this cannot
5805 be done in a consistent fashion.  GCC cannot even decide which input
5806 files have been specified without knowing which switches take arguments,
5807 and it must know which input files to compile in order to tell which
5808 compilers to run).
5809
5810 GCC also knows implicitly that arguments starting in @option{-l} are to be
5811 treated as compiler output files, and passed to the linker in their
5812 proper position among the other output files.
5813
5814 @c man begin OPTIONS
5815
5816 @node Target Options
5817 @section Specifying Target Machine and Compiler Version
5818 @cindex target options
5819 @cindex cross compiling
5820 @cindex specifying machine version
5821 @cindex specifying compiler version and target machine
5822 @cindex compiler version, specifying
5823 @cindex target machine, specifying
5824
5825 The usual way to run GCC is to run the executable called @file{gcc}, or
5826 @file{<machine>-gcc} when cross-compiling, or
5827 @file{<machine>-gcc-<version>} to run a version other than the one that
5828 was installed last.  Sometimes this is inconvenient, so GCC provides
5829 options that will switch to another cross-compiler or version.
5830
5831 @table @gcctabopt
5832 @item -b @var{machine}
5833 @opindex b
5834 The argument @var{machine} specifies the target machine for compilation.
5835
5836 The value to use for @var{machine} is the same as was specified as the
5837 machine type when configuring GCC as a cross-compiler.  For
5838 example, if a cross-compiler was configured with @samp{configure
5839 i386v}, meaning to compile for an 80386 running System V, then you
5840 would specify @option{-b i386v} to run that cross compiler.
5841
5842 @item -V @var{version}
5843 @opindex V
5844 The argument @var{version} specifies which version of GCC to run.
5845 This is useful when multiple versions are installed.  For example,
5846 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5847 @end table
5848
5849 The @option{-V} and @option{-b} options work by running the
5850 @file{<machine>-gcc-<version>} executable, so there's no real reason to
5851 use them if you can just run that directly.
5852
5853 @node Submodel Options
5854 @section Hardware Models and Configurations
5855 @cindex submodel options
5856 @cindex specifying hardware config
5857 @cindex hardware models and configurations, specifying
5858 @cindex machine dependent options
5859
5860 Earlier we discussed the standard option @option{-b} which chooses among
5861 different installed compilers for completely different target
5862 machines, such as VAX vs.@: 68000 vs.@: 80386.
5863
5864 In addition, each of these target machine types can have its own
5865 special options, starting with @samp{-m}, to choose among various
5866 hardware models or configurations---for example, 68010 vs 68020,
5867 floating coprocessor or none.  A single installed version of the
5868 compiler can compile for any model or configuration, according to the
5869 options specified.
5870
5871 Some configurations of the compiler also support additional special
5872 options, usually for compatibility with other compilers on the same
5873 platform.
5874
5875 These options are defined by the macro @code{TARGET_SWITCHES} in the
5876 machine description.  The default for the options is also defined by
5877 that macro, which enables you to change the defaults.
5878
5879 @menu
5880 * M680x0 Options::
5881 * M68hc1x Options::
5882 * VAX Options::
5883 * SPARC Options::
5884 * ARM Options::
5885 * MN10300 Options::
5886 * M32R/D Options::
5887 * RS/6000 and PowerPC Options::
5888 * Darwin Options::
5889 * MIPS Options::
5890 * i386 and x86-64 Options::
5891 * HPPA Options::
5892 * DEC Alpha Options::
5893 * DEC Alpha/VMS Options::
5894 * H8/300 Options::
5895 * SH Options::
5896 * System V Options::
5897 * TMS320C3x/C4x Options::
5898 * V850 Options::
5899 * ARC Options::
5900 * NS32K Options::
5901 * AVR Options::
5902 * MCore Options::
5903 * IA-64 Options::
5904 * S/390 and zSeries Options::
5905 * CRIS Options::
5906 * MMIX Options::
5907 * PDP-11 Options::
5908 * Xstormy16 Options::
5909 * Xtensa Options::
5910 * FRV Options::
5911 @end menu
5912
5913 @node M680x0 Options
5914 @subsection M680x0 Options
5915 @cindex M680x0 options
5916
5917 These are the @samp{-m} options defined for the 68000 series.  The default
5918 values for these options depends on which style of 68000 was selected when
5919 the compiler was configured; the defaults for the most common choices are
5920 given below.
5921
5922 @table @gcctabopt
5923 @item -m68000
5924 @itemx -mc68000
5925 @opindex m68000
5926 @opindex mc68000
5927 Generate output for a 68000.  This is the default
5928 when the compiler is configured for 68000-based systems.
5929
5930 Use this option for microcontrollers with a 68000 or EC000 core,
5931 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5932
5933 @item -m68020
5934 @itemx -mc68020
5935 @opindex m68020
5936 @opindex mc68020
5937 Generate output for a 68020.  This is the default
5938 when the compiler is configured for 68020-based systems.
5939
5940 @item -m68881
5941 @opindex m68881
5942 Generate output containing 68881 instructions for floating point.
5943 This is the default for most 68020 systems unless @option{--nfp} was
5944 specified when the compiler was configured.
5945
5946 @item -m68030
5947 @opindex m68030
5948 Generate output for a 68030.  This is the default when the compiler is
5949 configured for 68030-based systems.
5950
5951 @item -m68040
5952 @opindex m68040
5953 Generate output for a 68040.  This is the default when the compiler is
5954 configured for 68040-based systems.
5955
5956 This option inhibits the use of 68881/68882 instructions that have to be
5957 emulated by software on the 68040.  Use this option if your 68040 does not
5958 have code to emulate those instructions.
5959
5960 @item -m68060
5961 @opindex m68060
5962 Generate output for a 68060.  This is the default when the compiler is
5963 configured for 68060-based systems.
5964
5965 This option inhibits the use of 68020 and 68881/68882 instructions that
5966 have to be emulated by software on the 68060.  Use this option if your 68060
5967 does not have code to emulate those instructions.
5968
5969 @item -mcpu32
5970 @opindex mcpu32
5971 Generate output for a CPU32.  This is the default
5972 when the compiler is configured for CPU32-based systems.
5973
5974 Use this option for microcontrollers with a
5975 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5976 68336, 68340, 68341, 68349 and 68360.
5977
5978 @item -m5200
5979 @opindex m5200
5980 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5981 when the compiler is configured for 520X-based systems.
5982
5983 Use this option for microcontroller with a 5200 core, including
5984 the MCF5202, MCF5203, MCF5204 and MCF5202.
5985
5986
5987 @item -m68020-40
5988 @opindex m68020-40
5989 Generate output for a 68040, without using any of the new instructions.
5990 This results in code which can run relatively efficiently on either a
5991 68020/68881 or a 68030 or a 68040.  The generated code does use the
5992 68881 instructions that are emulated on the 68040.
5993
5994 @item -m68020-60
5995 @opindex m68020-60
5996 Generate output for a 68060, without using any of the new instructions.
5997 This results in code which can run relatively efficiently on either a
5998 68020/68881 or a 68030 or a 68040.  The generated code does use the
5999 68881 instructions that are emulated on the 68060.
6000
6001 @item -msoft-float
6002 @opindex msoft-float
6003 Generate output containing library calls for floating point.
6004 @strong{Warning:} the requisite libraries are not available for all m68k
6005 targets.  Normally the facilities of the machine's usual C compiler are
6006 used, but this can't be done directly in cross-compilation.  You must
6007 make your own arrangements to provide suitable library functions for
6008 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
6009 @samp{m68k-*-coff} do provide software floating point support.
6010
6011 @item -mshort
6012 @opindex mshort
6013 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6014
6015 @item -mnobitfield
6016 @opindex mnobitfield
6017 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
6018 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
6019
6020 @item -mbitfield
6021 @opindex mbitfield
6022 Do use the bit-field instructions.  The @option{-m68020} option implies
6023 @option{-mbitfield}.  This is the default if you use a configuration
6024 designed for a 68020.
6025
6026 @item -mrtd
6027 @opindex mrtd
6028 Use a different function-calling convention, in which functions
6029 that take a fixed number of arguments return with the @code{rtd}
6030 instruction, which pops their arguments while returning.  This
6031 saves one instruction in the caller since there is no need to pop
6032 the arguments there.
6033
6034 This calling convention is incompatible with the one normally
6035 used on Unix, so you cannot use it if you need to call libraries
6036 compiled with the Unix compiler.
6037
6038 Also, you must provide function prototypes for all functions that
6039 take variable numbers of arguments (including @code{printf});
6040 otherwise incorrect code will be generated for calls to those
6041 functions.
6042
6043 In addition, seriously incorrect code will result if you call a
6044 function with too many arguments.  (Normally, extra arguments are
6045 harmlessly ignored.)
6046
6047 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
6048 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
6049
6050 @item -malign-int
6051 @itemx -mno-align-int
6052 @opindex malign-int
6053 @opindex mno-align-int
6054 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
6055 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
6056 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
6057 Aligning variables on 32-bit boundaries produces code that runs somewhat
6058 faster on processors with 32-bit busses at the expense of more memory.
6059
6060 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
6061 align structures containing the above types  differently than
6062 most published application binary interface specifications for the m68k.
6063
6064 @item -mpcrel
6065 @opindex mpcrel
6066 Use the pc-relative addressing mode of the 68000 directly, instead of
6067 using a global offset table.  At present, this option implies @option{-fpic},
6068 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
6069 not presently supported with @option{-mpcrel}, though this could be supported for
6070 68020 and higher processors.
6071
6072 @item -mno-strict-align
6073 @itemx -mstrict-align
6074 @opindex mno-strict-align
6075 @opindex mstrict-align
6076 Do not (do) assume that unaligned memory references will be handled by
6077 the system.
6078
6079 @item -msep-data
6080 Generate code that allows the data segment to be located in a different
6081 area of memory from the text segment.  This allows for execute in place in
6082 an environment without virtual memory management.  This option implies -fPIC.
6083
6084 @item -mno-sep-data
6085 Generate code that assumes that the data segment follows the text segment.
6086 This is the default.
6087
6088 @item -mid-shared-library
6089 Generate code that supports shared libraries via the library ID method.
6090 This allows for execute in place and shared libraries in an environment
6091 without virtual memory management.  This option implies -fPIC.
6092
6093 @item -mno-id-shared-library
6094 Generate code that doesn't assume ID based shared libraries are being used.
6095 This is the default.
6096
6097 @item -mshared-library-id=n
6098 Specified the identification number of the ID based shared library being
6099 compiled.  Specifying a value of 0 will generate more compact code, specifying
6100 other values will force the allocation of that number to the current
6101 library but is no more space or time efficient than omitting this option.
6102
6103 @end table
6104
6105 @node M68hc1x Options
6106 @subsection M68hc1x Options
6107 @cindex M68hc1x options
6108
6109 These are the @samp{-m} options defined for the 68hc11 and 68hc12
6110 microcontrollers.  The default values for these options depends on
6111 which style of microcontroller was selected when the compiler was configured;
6112 the defaults for the most common choices are given below.
6113
6114 @table @gcctabopt
6115 @item -m6811
6116 @itemx -m68hc11
6117 @opindex m6811
6118 @opindex m68hc11
6119 Generate output for a 68HC11.  This is the default
6120 when the compiler is configured for 68HC11-based systems.
6121
6122 @item -m6812
6123 @itemx -m68hc12
6124 @opindex m6812
6125 @opindex m68hc12
6126 Generate output for a 68HC12.  This is the default
6127 when the compiler is configured for 68HC12-based systems.
6128
6129 @item -m68S12
6130 @itemx -m68hcs12
6131 @opindex m68S12
6132 @opindex m68hcs12
6133 Generate output for a 68HCS12.
6134
6135 @item -mauto-incdec
6136 @opindex mauto-incdec
6137 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
6138 addressing modes.
6139
6140 @item -minmax
6141 @itemx -nominmax
6142 @opindex minmax
6143 @opindex mnominmax
6144 Enable the use of 68HC12 min and max instructions.
6145
6146 @item -mlong-calls
6147 @itemx -mno-long-calls
6148 @opindex mlong-calls
6149 @opindex mno-long-calls
6150 Treat all calls as being far away (near).  If calls are assumed to be
6151 far away, the compiler will use the @code{call} instruction to
6152 call a function and the @code{rtc} instruction for returning.
6153
6154 @item -mshort
6155 @opindex mshort
6156 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6157
6158 @item -msoft-reg-count=@var{count}
6159 @opindex msoft-reg-count
6160 Specify the number of pseudo-soft registers which are used for the
6161 code generation.  The maximum number is 32.  Using more pseudo-soft
6162 register may or may not result in better code depending on the program.
6163 The default is 4 for 68HC11 and 2 for 68HC12.
6164
6165 @end table
6166
6167 @node VAX Options
6168 @subsection VAX Options
6169 @cindex VAX options
6170
6171 These @samp{-m} options are defined for the VAX:
6172
6173 @table @gcctabopt
6174 @item -munix
6175 @opindex munix
6176 Do not output certain jump instructions (@code{aobleq} and so on)
6177 that the Unix assembler for the VAX cannot handle across long
6178 ranges.
6179
6180 @item -mgnu
6181 @opindex mgnu
6182 Do output those jump instructions, on the assumption that you
6183 will assemble with the GNU assembler.
6184
6185 @item -mg
6186 @opindex mg
6187 Output code for g-format floating point numbers instead of d-format.
6188 @end table
6189
6190 @node SPARC Options
6191 @subsection SPARC Options
6192 @cindex SPARC options
6193
6194 These @samp{-m} options are supported on the SPARC:
6195
6196 @table @gcctabopt
6197 @item -mno-app-regs
6198 @itemx -mapp-regs
6199 @opindex mno-app-regs
6200 @opindex mapp-regs
6201 Specify @option{-mapp-regs} to generate output using the global registers
6202 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
6203 is the default.
6204
6205 To be fully SVR4 ABI compliant at the cost of some performance loss,
6206 specify @option{-mno-app-regs}.  You should compile libraries and system
6207 software with this option.
6208
6209 @item -mfpu
6210 @itemx -mhard-float
6211 @opindex mfpu
6212 @opindex mhard-float
6213 Generate output containing floating point instructions.  This is the
6214 default.
6215
6216 @item -mno-fpu
6217 @itemx -msoft-float
6218 @opindex mno-fpu
6219 @opindex msoft-float
6220 Generate output containing library calls for floating point.
6221 @strong{Warning:} the requisite libraries are not available for all SPARC
6222 targets.  Normally the facilities of the machine's usual C compiler are
6223 used, but this cannot be done directly in cross-compilation.  You must make
6224 your own arrangements to provide suitable library functions for
6225 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
6226 @samp{sparclite-*-*} do provide software floating point support.
6227
6228 @option{-msoft-float} changes the calling convention in the output file;
6229 therefore, it is only useful if you compile @emph{all} of a program with
6230 this option.  In particular, you need to compile @file{libgcc.a}, the
6231 library that comes with GCC, with @option{-msoft-float} in order for
6232 this to work.
6233
6234 @item -mhard-quad-float
6235 @opindex mhard-quad-float
6236 Generate output containing quad-word (long double) floating point
6237 instructions.
6238
6239 @item -msoft-quad-float
6240 @opindex msoft-quad-float
6241 Generate output containing library calls for quad-word (long double)
6242 floating point instructions.  The functions called are those specified
6243 in the SPARC ABI@.  This is the default.
6244
6245 As of this writing, there are no SPARC implementations that have hardware
6246 support for the quad-word floating point instructions.  They all invoke
6247 a trap handler for one of these instructions, and then the trap handler
6248 emulates the effect of the instruction.  Because of the trap handler overhead,
6249 this is much slower than calling the ABI library routines.  Thus the
6250 @option{-msoft-quad-float} option is the default.
6251
6252 @item -mno-unaligned-doubles
6253 @itemx -munaligned-doubles
6254 @opindex mno-unaligned-doubles
6255 @opindex munaligned-doubles
6256 Assume that doubles have 8 byte alignment.  This is the default.
6257
6258 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
6259 alignment only if they are contained in another type, or if they have an
6260 absolute address.  Otherwise, it assumes they have 4 byte alignment.
6261 Specifying this option avoids some rare compatibility problems with code
6262 generated by other compilers.  It is not the default because it results
6263 in a performance loss, especially for floating point code.
6264
6265 @item -mno-faster-structs
6266 @itemx -mfaster-structs
6267 @opindex mno-faster-structs
6268 @opindex mfaster-structs
6269 With @option{-mfaster-structs}, the compiler assumes that structures
6270 should have 8 byte alignment.  This enables the use of pairs of
6271 @code{ldd} and @code{std} instructions for copies in structure
6272 assignment, in place of twice as many @code{ld} and @code{st} pairs.
6273 However, the use of this changed alignment directly violates the SPARC
6274 ABI@.  Thus, it's intended only for use on targets where the developer
6275 acknowledges that their resulting code will not be directly in line with
6276 the rules of the ABI@.
6277
6278 @item -mimpure-text
6279 @opindex mimpure-text
6280 @option{-mimpure-text}, used in addition to @option{-shared}, tells
6281 the compiler to not pass @option{-z text} to the linker when linking a
6282 shared object.  Using this option, you can link position-dependent
6283 code into a shared object.
6284
6285 @option{-mimpure-text} suppresses the ``relocations remain against
6286 allocatable but non-writable sections'' linker error message.
6287 However, the necessary relocations will trigger copy-on-write, and the
6288 shared object is not actually shared across processes.  Instead of
6289 using @option{-mimpure-text}, you should compile all source code with
6290 @option{-fpic} or @option{-fPIC}.
6291
6292 This option is only available on SunOS and Solaris.
6293
6294 @item -mcpu=@var{cpu_type}
6295 @opindex mcpu
6296 Set the instruction set, register set, and instruction scheduling parameters
6297 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
6298 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
6299 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
6300 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
6301 @samp{ultrasparc3}.
6302
6303 Default instruction scheduling parameters are used for values that select
6304 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
6305 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
6306
6307 Here is a list of each supported architecture and their supported
6308 implementations.
6309
6310 @smallexample
6311     v7:             cypress
6312     v8:             supersparc, hypersparc
6313     sparclite:      f930, f934, sparclite86x
6314     sparclet:       tsc701
6315     v9:             ultrasparc, ultrasparc3
6316 @end smallexample
6317
6318 By default (unless configured otherwise), GCC generates code for the V7
6319 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
6320 additionally optimizes it for the Cypress CY7C602 chip, as used in the
6321 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
6322 SPARCStation 1, 2, IPX etc.
6323
6324 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
6325 architecture.  The only difference from V7 code is that the compiler emits
6326 the integer multiply and integer divide instructions which exist in SPARC-V8
6327 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
6328 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
6329 2000 series.
6330
6331 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
6332 the SPARC architecture.  This adds the integer multiply, integer divide step
6333 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
6334 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
6335 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU.  With
6336 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
6337 MB86934 chip, which is the more recent SPARClite with FPU.
6338
6339 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
6340 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
6341 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
6342 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
6343 optimizes it for the TEMIC SPARClet chip.
6344
6345 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
6346 architecture.  This adds 64-bit integer and floating-point move instructions,
6347 3 additional floating-point condition code registers and conditional move
6348 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
6349 optimizes it for the Sun UltraSPARC I/II chips.  With
6350 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
6351 Sun UltraSPARC III chip.
6352
6353 @item -mtune=@var{cpu_type}
6354 @opindex mtune
6355 Set the instruction scheduling parameters for machine type
6356 @var{cpu_type}, but do not set the instruction set or register set that the
6357 option @option{-mcpu=@var{cpu_type}} would.
6358
6359 The same values for @option{-mcpu=@var{cpu_type}} can be used for
6360 @option{-mtune=@var{cpu_type}}, but the only useful values are those
6361 that select a particular cpu implementation.  Those are @samp{cypress},
6362 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
6363 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
6364 @samp{ultrasparc3}.
6365
6366 @item -mv8plus
6367 @itemx -mno-v8plus
6368 @opindex -mv8plus
6369 @opindex -mno-v8plus
6370 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI.  The
6371 difference from the V8 ABI is that the global and out registers are
6372 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
6373 mode for all SPARC-V9 processors.
6374
6375 @item -mvis
6376 @itemx -mno-vis
6377 @opindex -mvis
6378 @opindex -mno-vis
6379 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
6380 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
6381 @end table
6382
6383 These @samp{-m} options are supported in addition to the above
6384 on SPARC-V9 processors in 64-bit environments:
6385
6386 @table @gcctabopt
6387 @item -mlittle-endian
6388 @opindex mlittle-endian
6389 Generate code for a processor running in little-endian mode. It is only
6390 available for a few configurations and most notably not on Solaris.
6391
6392 @item -m32
6393 @itemx -m64
6394 @opindex m32
6395 @opindex m64
6396 Generate code for a 32-bit or 64-bit environment.
6397 The 32-bit environment sets int, long and pointer to 32 bits.
6398 The 64-bit environment sets int to 32 bits and long and pointer
6399 to 64 bits.
6400
6401 @item -mcmodel=medlow
6402 @opindex mcmodel=medlow
6403 Generate code for the Medium/Low code model: 64-bit addresses, programs
6404 must be linked in the low 32 bits of memory.  Programs can be statically
6405 or dynamically linked.
6406
6407 @item -mcmodel=medmid
6408 @opindex mcmodel=medmid
6409 Generate code for the Medium/Middle code model: 64-bit addresses, programs
6410 must be linked in the low 44 bits of memory, the text and data segments must
6411 be less than 2GB in size and the data segment must be located within 2GB of
6412 the text segment.
6413
6414 @item -mcmodel=medany
6415 @opindex mcmodel=medany
6416 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
6417 may be linked anywhere in memory, the text and data segments must be less
6418 than 2GB in size and the data segment must be located within 2GB of the
6419 text segment.
6420
6421 @item -mcmodel=embmedany
6422 @opindex mcmodel=embmedany
6423 Generate code for the Medium/Anywhere code model for embedded systems:
6424 64-bit addresses, the text and data segments must be less than 2GB in
6425 size, both starting anywhere in memory (determined at link time).  The
6426 global register %g4 points to the base of the data segment.  Programs
6427 are statically linked and PIC is not supported.
6428
6429 @item -mstack-bias
6430 @itemx -mno-stack-bias
6431 @opindex mstack-bias
6432 @opindex mno-stack-bias
6433 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
6434 frame pointer if present, are offset by @minus{}2047 which must be added back
6435 when making stack frame references.  This is the default in 64-bit mode.
6436 Otherwise, assume no such offset is present.
6437 @end table
6438
6439 @node ARM Options
6440 @subsection ARM Options
6441 @cindex ARM options
6442
6443 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6444 architectures:
6445
6446 @table @gcctabopt
6447 @item -mabi=@var{name}
6448 @opindex mabi
6449 Generate code for the specified ABI.  Permissible values are: @samp{apcs-gnu},
6450 @samp{atpcs}, @samp{aapcs} and @samp{iwmmxt}.
6451
6452 @item -mapcs-frame
6453 @opindex mapcs-frame
6454 Generate a stack frame that is compliant with the ARM Procedure Call
6455 Standard for all functions, even if this is not strictly necessary for
6456 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
6457 with this option will cause the stack frames not to be generated for
6458 leaf functions.  The default is @option{-mno-apcs-frame}.
6459
6460 @item -mapcs
6461 @opindex mapcs
6462 This is a synonym for @option{-mapcs-frame}.
6463
6464 @item -mapcs-26
6465 @opindex mapcs-26
6466 Generate code for a processor running with a 26-bit program counter,
6467 and conforming to the function calling standards for the APCS 26-bit
6468 option.  This option replaces the @option{-m2} and @option{-m3} options
6469 of previous releases of the compiler.
6470
6471 @item -mapcs-32
6472 @opindex mapcs-32
6473 Generate code for a processor running with a 32-bit program counter,
6474 and conforming to the function calling standards for the APCS 32-bit
6475 option.  This option replaces the @option{-m6} option of previous releases
6476 of the compiler.
6477
6478 @ignore
6479 @c not currently implemented
6480 @item -mapcs-stack-check
6481 @opindex mapcs-stack-check
6482 Generate code to check the amount of stack space available upon entry to
6483 every function (that actually uses some stack space).  If there is
6484 insufficient space available then either the function
6485 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6486 called, depending upon the amount of stack space required.  The run time
6487 system is required to provide these functions.  The default is
6488 @option{-mno-apcs-stack-check}, since this produces smaller code.
6489
6490 @c not currently implemented
6491 @item -mapcs-float
6492 @opindex mapcs-float
6493 Pass floating point arguments using the float point registers.  This is
6494 one of the variants of the APCS@.  This option is recommended if the
6495 target hardware has a floating point unit or if a lot of floating point
6496 arithmetic is going to be performed by the code.  The default is
6497 @option{-mno-apcs-float}, since integer only code is slightly increased in
6498 size if @option{-mapcs-float} is used.
6499
6500 @c not currently implemented
6501 @item -mapcs-reentrant
6502 @opindex mapcs-reentrant
6503 Generate reentrant, position independent code.  The default is
6504 @option{-mno-apcs-reentrant}.
6505 @end ignore
6506
6507 @item -mthumb-interwork
6508 @opindex mthumb-interwork
6509 Generate code which supports calling between the ARM and Thumb
6510 instruction sets.  Without this option the two instruction sets cannot
6511 be reliably used inside one program.  The default is
6512 @option{-mno-thumb-interwork}, since slightly larger code is generated
6513 when @option{-mthumb-interwork} is specified.
6514
6515 @item -mno-sched-prolog
6516 @opindex mno-sched-prolog
6517 Prevent the reordering of instructions in the function prolog, or the
6518 merging of those instruction with the instructions in the function's
6519 body.  This means that all functions will start with a recognizable set
6520 of instructions (or in fact one of a choice from a small set of
6521 different function prologues), and this information can be used to
6522 locate the start if functions inside an executable piece of code.  The
6523 default is @option{-msched-prolog}.
6524
6525 @item -mhard-float
6526 @opindex mhard-float
6527 Generate output containing floating point instructions.  This is the
6528 default.
6529
6530 @item -msoft-float
6531 @opindex msoft-float
6532 Generate output containing library calls for floating point.
6533 @strong{Warning:} the requisite libraries are not available for all ARM
6534 targets.  Normally the facilities of the machine's usual C compiler are
6535 used, but this cannot be done directly in cross-compilation.  You must make
6536 your own arrangements to provide suitable library functions for
6537 cross-compilation.
6538
6539 @option{-msoft-float} changes the calling convention in the output file;
6540 therefore, it is only useful if you compile @emph{all} of a program with
6541 this option.  In particular, you need to compile @file{libgcc.a}, the
6542 library that comes with GCC, with @option{-msoft-float} in order for
6543 this to work.
6544
6545 @item -mfloat-abi=@var{name}
6546 @opindex mfloat-abi
6547 Specifies which ABI to use for floating point values.  Permissible values
6548 are: @samp{soft}, @samp{softfp} and @samp{hard}.
6549
6550 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
6551 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
6552 of floating point instructions, but still uses the soft-float calling
6553 conventions.
6554
6555 @item -mlittle-endian
6556 @opindex mlittle-endian
6557 Generate code for a processor running in little-endian mode.  This is
6558 the default for all standard configurations.
6559
6560 @item -mbig-endian
6561 @opindex mbig-endian
6562 Generate code for a processor running in big-endian mode; the default is
6563 to compile code for a little-endian processor.
6564
6565 @item -mwords-little-endian
6566 @opindex mwords-little-endian
6567 This option only applies when generating code for big-endian processors.
6568 Generate code for a little-endian word order but a big-endian byte
6569 order.  That is, a byte order of the form @samp{32107654}.  Note: this
6570 option should only be used if you require compatibility with code for
6571 big-endian ARM processors generated by versions of the compiler prior to
6572 2.8.
6573
6574 @item -malignment-traps
6575 @opindex malignment-traps
6576 Generate code that will not trap if the MMU has alignment traps enabled.
6577 On ARM architectures prior to ARMv4, there were no instructions to
6578 access half-word objects stored in memory.  However, when reading from
6579 memory a feature of the ARM architecture allows a word load to be used,
6580 even if the address is unaligned, and the processor core will rotate the
6581 data as it is being loaded.  This option tells the compiler that such
6582 misaligned accesses will cause a MMU trap and that it should instead
6583 synthesize the access as a series of byte accesses.  The compiler can
6584 still use word accesses to load half-word data if it knows that the
6585 address is aligned to a word boundary.
6586
6587 This option is ignored when compiling for ARM architecture 4 or later,
6588 since these processors have instructions to directly access half-word
6589 objects in memory.
6590
6591 @item -mno-alignment-traps
6592 @opindex mno-alignment-traps
6593 Generate code that assumes that the MMU will not trap unaligned
6594 accesses.  This produces better code when the target instruction set
6595 does not have half-word memory operations (i.e.@: implementations prior to
6596 ARMv4).
6597
6598 Note that you cannot use this option to access unaligned word objects,
6599 since the processor will only fetch one 32-bit aligned object from
6600 memory.
6601
6602 The default setting for most targets is @option{-mno-alignment-traps}, since
6603 this produces better code when there are no half-word memory
6604 instructions available.
6605
6606 @item -mshort-load-bytes
6607 @itemx -mno-short-load-words
6608 @opindex mshort-load-bytes
6609 @opindex mno-short-load-words
6610 These are deprecated aliases for @option{-malignment-traps}.
6611
6612 @item -mno-short-load-bytes
6613 @itemx -mshort-load-words
6614 @opindex mno-short-load-bytes
6615 @opindex mshort-load-words
6616 This are deprecated aliases for @option{-mno-alignment-traps}.
6617
6618 @item -mcpu=@var{name}
6619 @opindex mcpu
6620 This specifies the name of the target ARM processor.  GCC uses this name
6621 to determine what kind of instructions it can emit when generating
6622 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6623 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6624 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6625 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6626 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6627 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6628 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6629 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6630 @samp{arm920t}, @samp{arm926ejs}, @samp{arm940t}, @samp{arm9tdmi},
6631 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ejs},
6632 @samp{arm1136js}, @samp{arm1136jfs} ,@samp{xscale}, @samp{iwmmxt},
6633 @samp{ep9312}.
6634
6635 @itemx -mtune=@var{name}
6636 @opindex mtune
6637 This option is very similar to the @option{-mcpu=} option, except that
6638 instead of specifying the actual target processor type, and hence
6639 restricting which instructions can be used, it specifies that GCC should
6640 tune the performance of the code as if the target were of the type
6641 specified in this option, but still choosing the instructions that it
6642 will generate based on the cpu specified by a @option{-mcpu=} option.
6643 For some ARM implementations better performance can be obtained by using
6644 this option.
6645
6646 @item -march=@var{name}
6647 @opindex march
6648 This specifies the name of the target ARM architecture.  GCC uses this
6649 name to determine what kind of instructions it can emit when generating
6650 assembly code.  This option can be used in conjunction with or instead
6651 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6652 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6653 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
6654 @samp{iwmmxt}, @samp{ep9312}.
6655
6656 @item -mfpu=@var{name}
6657 @itemx -mfpe=@var{number}
6658 @itemx -mfp=@var{number}
6659 @opindex mfpu
6660 @opindex mfpe
6661 @opindex mfp
6662 This specifies what floating point hardware (or hardware emulation) is
6663 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
6664 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
6665 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
6666 with older versions of GCC@.
6667
6668 If @option{-msoft-float} is specified this specifies the format of
6669 floating point values.
6670
6671 @item -mstructure-size-boundary=@var{n}
6672 @opindex mstructure-size-boundary
6673 The size of all structures and unions will be rounded up to a multiple
6674 of the number of bits set by this option.  Permissible values are 8, 32
6675 and 64.  The default value varies for different toolchains.  For the COFF
6676 targeted toolchain the default value is 8.  A value of 64 is only allowed
6677 if the underlying ABI supports it.
6678
6679 Specifying the larger number can produce faster, more efficient code, but
6680 can also increase the size of the program.  Different values are potentially
6681 incompatible.  Code compiled with one value cannot necessarily expect to
6682 work with code or libraries compiled with another value, if they exchange
6683 information using structures or unions.
6684
6685 @item -mabort-on-noreturn
6686 @opindex mabort-on-noreturn
6687 Generate a call to the function @code{abort} at the end of a
6688 @code{noreturn} function.  It will be executed if the function tries to
6689 return.
6690
6691 @item -mlong-calls
6692 @itemx -mno-long-calls
6693 @opindex mlong-calls
6694 @opindex mno-long-calls
6695 Tells the compiler to perform function calls by first loading the
6696 address of the function into a register and then performing a subroutine
6697 call on this register.  This switch is needed if the target function
6698 will lie outside of the 64 megabyte addressing range of the offset based
6699 version of subroutine call instruction.
6700
6701 Even if this switch is enabled, not all function calls will be turned
6702 into long calls.  The heuristic is that static functions, functions
6703 which have the @samp{short-call} attribute, functions that are inside
6704 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6705 definitions have already been compiled within the current compilation
6706 unit, will not be turned into long calls.  The exception to this rule is
6707 that weak function definitions, functions with the @samp{long-call}
6708 attribute or the @samp{section} attribute, and functions that are within
6709 the scope of a @samp{#pragma long_calls} directive, will always be
6710 turned into long calls.
6711
6712 This feature is not enabled by default.  Specifying
6713 @option{-mno-long-calls} will restore the default behavior, as will
6714 placing the function calls within the scope of a @samp{#pragma
6715 long_calls_off} directive.  Note these switches have no effect on how
6716 the compiler generates code to handle function calls via function
6717 pointers.
6718
6719 @item -mnop-fun-dllimport
6720 @opindex mnop-fun-dllimport
6721 Disable support for the @code{dllimport} attribute.
6722
6723 @item -msingle-pic-base
6724 @opindex msingle-pic-base
6725 Treat the register used for PIC addressing as read-only, rather than
6726 loading it in the prologue for each function.  The run-time system is
6727 responsible for initializing this register with an appropriate value
6728 before execution begins.
6729
6730 @item -mpic-register=@var{reg}
6731 @opindex mpic-register
6732 Specify the register to be used for PIC addressing.  The default is R10
6733 unless stack-checking is enabled, when R9 is used.
6734
6735 @item -mcirrus-fix-invalid-insns
6736 @opindex mcirrus-fix-invalid-insns
6737 @opindex mno-cirrus-fix-invalid-insns
6738 Insert NOPs into the instruction stream to in order to work around
6739 problems with invalid Maverick instruction combinations.  This option
6740 is only valid if the @option{-mcpu=ep9312} option has been used to
6741 enable generation of instructions for the Cirrus Maverick floating
6742 point co-processor.  This option is not enabled by default, since the
6743 problem is only present in older Maverick implementations.  The default
6744 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
6745 switch.
6746
6747 @item -mpoke-function-name
6748 @opindex mpoke-function-name
6749 Write the name of each function into the text section, directly
6750 preceding the function prologue.  The generated code is similar to this:
6751
6752 @smallexample
6753      t0
6754          .ascii "arm_poke_function_name", 0
6755          .align
6756      t1
6757          .word 0xff000000 + (t1 - t0)
6758      arm_poke_function_name
6759          mov     ip, sp
6760          stmfd   sp!, @{fp, ip, lr, pc@}
6761          sub     fp, ip, #4
6762 @end smallexample
6763
6764 When performing a stack backtrace, code can inspect the value of
6765 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6766 location @code{pc - 12} and the top 8 bits are set, then we know that
6767 there is a function name embedded immediately preceding this location
6768 and has length @code{((pc[-3]) & 0xff000000)}.
6769
6770 @item -mthumb
6771 @opindex mthumb
6772 Generate code for the 16-bit Thumb instruction set.  The default is to
6773 use the 32-bit ARM instruction set.
6774
6775 @item -mtpcs-frame
6776 @opindex mtpcs-frame
6777 Generate a stack frame that is compliant with the Thumb Procedure Call
6778 Standard for all non-leaf functions.  (A leaf function is one that does
6779 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6780
6781 @item -mtpcs-leaf-frame
6782 @opindex mtpcs-leaf-frame
6783 Generate a stack frame that is compliant with the Thumb Procedure Call
6784 Standard for all leaf functions.  (A leaf function is one that does
6785 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6786
6787 @item -mcallee-super-interworking
6788 @opindex mcallee-super-interworking
6789 Gives all externally visible functions in the file being compiled an ARM
6790 instruction set header which switches to Thumb mode before executing the
6791 rest of the function.  This allows these functions to be called from
6792 non-interworking code.
6793
6794 @item -mcaller-super-interworking
6795 @opindex mcaller-super-interworking
6796 Allows calls via function pointers (including virtual functions) to
6797 execute correctly regardless of whether the target code has been
6798 compiled for interworking or not.  There is a small overhead in the cost
6799 of executing a function pointer if this option is enabled.
6800
6801 @end table
6802
6803 @node MN10300 Options
6804 @subsection MN10300 Options
6805 @cindex MN10300 options
6806
6807 These @option{-m} options are defined for Matsushita MN10300 architectures:
6808
6809 @table @gcctabopt
6810 @item -mmult-bug
6811 @opindex mmult-bug
6812 Generate code to avoid bugs in the multiply instructions for the MN10300
6813 processors.  This is the default.
6814
6815 @item -mno-mult-bug
6816 @opindex mno-mult-bug
6817 Do not generate code to avoid bugs in the multiply instructions for the
6818 MN10300 processors.
6819
6820 @item -mam33
6821 @opindex mam33
6822 Generate code which uses features specific to the AM33 processor.
6823
6824 @item -mno-am33
6825 @opindex mno-am33
6826 Do not generate code which uses features specific to the AM33 processor.  This
6827 is the default.
6828
6829 @item -mno-crt0
6830 @opindex mno-crt0
6831 Do not link in the C run-time initialization object file.
6832
6833 @item -mrelax
6834 @opindex mrelax
6835 Indicate to the linker that it should perform a relaxation optimization pass
6836 to shorten branches, calls and absolute memory addresses.  This option only
6837 has an effect when used on the command line for the final link step.
6838
6839 This option makes symbolic debugging impossible.
6840 @end table
6841
6842
6843 @node M32R/D Options
6844 @subsection M32R/D Options
6845 @cindex M32R/D options
6846
6847 These @option{-m} options are defined for Renesas M32R/D architectures:
6848
6849 @table @gcctabopt
6850 @item -m32r2
6851 @opindex m32r2
6852 Generate code for the M32R/2@.
6853
6854 @item -m32rx
6855 @opindex m32rx
6856 Generate code for the M32R/X@.
6857
6858 @item -m32r
6859 @opindex m32r
6860 Generate code for the M32R@.  This is the default.
6861
6862 @item -mmodel=small
6863 @opindex mmodel=small
6864 Assume all objects live in the lower 16MB of memory (so that their addresses
6865 can be loaded with the @code{ld24} instruction), and assume all subroutines
6866 are reachable with the @code{bl} instruction.
6867 This is the default.
6868
6869 The addressability of a particular object can be set with the
6870 @code{model} attribute.
6871
6872 @item -mmodel=medium
6873 @opindex mmodel=medium
6874 Assume objects may be anywhere in the 32-bit address space (the compiler
6875 will generate @code{seth/add3} instructions to load their addresses), and
6876 assume all subroutines are reachable with the @code{bl} instruction.
6877
6878 @item -mmodel=large
6879 @opindex mmodel=large
6880 Assume objects may be anywhere in the 32-bit address space (the compiler
6881 will generate @code{seth/add3} instructions to load their addresses), and
6882 assume subroutines may not be reachable with the @code{bl} instruction
6883 (the compiler will generate the much slower @code{seth/add3/jl}
6884 instruction sequence).
6885
6886 @item -msdata=none
6887 @opindex msdata=none
6888 Disable use of the small data area.  Variables will be put into
6889 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6890 @code{section} attribute has been specified).
6891 This is the default.
6892
6893 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6894 Objects may be explicitly put in the small data area with the
6895 @code{section} attribute using one of these sections.
6896
6897 @item -msdata=sdata
6898 @opindex msdata=sdata
6899 Put small global and static data in the small data area, but do not
6900 generate special code to reference them.
6901
6902 @item -msdata=use
6903 @opindex msdata=use
6904 Put small global and static data in the small data area, and generate
6905 special instructions to reference them.
6906
6907 @item -G @var{num}
6908 @opindex G
6909 @cindex smaller data references
6910 Put global and static objects less than or equal to @var{num} bytes
6911 into the small data or bss sections instead of the normal data or bss
6912 sections.  The default value of @var{num} is 8.
6913 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6914 for this option to have any effect.
6915
6916 All modules should be compiled with the same @option{-G @var{num}} value.
6917 Compiling with different values of @var{num} may or may not work; if it
6918 doesn't the linker will give an error message---incorrect code will not be
6919 generated.
6920
6921 @item -mdebug
6922 @opindex -mdebug
6923 Makes the M32R specific code in the compiler display some statistics
6924 that might help in debugging programs.
6925
6926 @item -malign-loops
6927 @opindex malign-loops
6928 Align all loops to a 32-byte boundary.
6929
6930 @item -mno-align-loops
6931 @opindex mno-align-loops
6932 Do not enforce a 32-byte alignment for loops.  This is the default.
6933
6934 @item -missue-rate=@var{number}
6935 @opindex missue-rate=@var{number}
6936 Issue @var{number} instructions per cycle.  @var{number} can only be 1
6937 or 2.
6938
6939 @item -mbranch-cost=@var{number}
6940 @opindex mbranch-cost=@var{number}
6941 @var{number} can only be 1 or 2.  If it is 1 then branches will be
6942 preferred over conditional code, if it is 2, then the opposite will
6943 apply.
6944
6945 @item -mflush-trap=@var{number}
6946 @opindex mflush-trap=@var{number}
6947 Specifies the trap number to use to flush the cache.  The default is
6948 12.  Valid numbers are between 0 and 15 inclusive.
6949
6950 @item -mno-flush-trap
6951 @opindex mno-flush-trap
6952 Specifies that the cache cannot be flushed by using a trap.
6953
6954 @item -mflush-func=@var{name}
6955 @opindex mflush-func=@var{name}
6956 Specifies the name of the operating system function to call to flush
6957 the cache.  The default is @emph{_flush_cache}, but a function call
6958 will only be used if a trap is not available.
6959
6960 @item -mno-flush-func
6961 @opindex mno-flush-func
6962 Indicates that there is no OS function for flushing the cache.
6963
6964 @end table
6965
6966 @node RS/6000 and PowerPC Options
6967 @subsection IBM RS/6000 and PowerPC Options
6968 @cindex RS/6000 and PowerPC Options
6969 @cindex IBM RS/6000 and PowerPC Options
6970
6971 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6972 @table @gcctabopt
6973 @item -mpower
6974 @itemx -mno-power
6975 @itemx -mpower2
6976 @itemx -mno-power2
6977 @itemx -mpowerpc
6978 @itemx -mno-powerpc
6979 @itemx -mpowerpc-gpopt
6980 @itemx -mno-powerpc-gpopt
6981 @itemx -mpowerpc-gfxopt
6982 @itemx -mno-powerpc-gfxopt
6983 @itemx -mpowerpc64
6984 @itemx -mno-powerpc64
6985 @opindex mpower
6986 @opindex mno-power
6987 @opindex mpower2
6988 @opindex mno-power2
6989 @opindex mpowerpc
6990 @opindex mno-powerpc
6991 @opindex mpowerpc-gpopt
6992 @opindex mno-powerpc-gpopt
6993 @opindex mpowerpc-gfxopt
6994 @opindex mno-powerpc-gfxopt
6995 @opindex mpowerpc64
6996 @opindex mno-powerpc64
6997 GCC supports two related instruction set architectures for the
6998 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
6999 instructions supported by the @samp{rios} chip set used in the original
7000 RS/6000 systems and the @dfn{PowerPC} instruction set is the
7001 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
7002 the IBM 4xx microprocessors.
7003
7004 Neither architecture is a subset of the other.  However there is a
7005 large common subset of instructions supported by both.  An MQ
7006 register is included in processors supporting the POWER architecture.
7007
7008 You use these options to specify which instructions are available on the
7009 processor you are using.  The default value of these options is
7010 determined when configuring GCC@.  Specifying the
7011 @option{-mcpu=@var{cpu_type}} overrides the specification of these
7012 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
7013 rather than the options listed above.
7014
7015 The @option{-mpower} option allows GCC to generate instructions that
7016 are found only in the POWER architecture and to use the MQ register.
7017 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
7018 to generate instructions that are present in the POWER2 architecture but
7019 not the original POWER architecture.
7020
7021 The @option{-mpowerpc} option allows GCC to generate instructions that
7022 are found only in the 32-bit subset of the PowerPC architecture.
7023 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
7024 GCC to use the optional PowerPC architecture instructions in the
7025 General Purpose group, including floating-point square root.  Specifying
7026 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
7027 use the optional PowerPC architecture instructions in the Graphics
7028 group, including floating-point select.
7029
7030 The @option{-mpowerpc64} option allows GCC to generate the additional
7031 64-bit instructions that are found in the full PowerPC64 architecture
7032 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
7033 @option{-mno-powerpc64}.
7034
7035 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
7036 will use only the instructions in the common subset of both
7037 architectures plus some special AIX common-mode calls, and will not use
7038 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
7039 permits GCC to use any instruction from either architecture and to
7040 allow use of the MQ register; specify this for the Motorola MPC601.
7041
7042 @item -mnew-mnemonics
7043 @itemx -mold-mnemonics
7044 @opindex mnew-mnemonics
7045 @opindex mold-mnemonics
7046 Select which mnemonics to use in the generated assembler code.  With
7047 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
7048 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
7049 assembler mnemonics defined for the POWER architecture.  Instructions
7050 defined in only one architecture have only one mnemonic; GCC uses that
7051 mnemonic irrespective of which of these options is specified.
7052
7053 GCC defaults to the mnemonics appropriate for the architecture in
7054 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
7055 value of these option.  Unless you are building a cross-compiler, you
7056 should normally not specify either @option{-mnew-mnemonics} or
7057 @option{-mold-mnemonics}, but should instead accept the default.
7058
7059 @item -mcpu=@var{cpu_type}
7060 @opindex mcpu
7061 Set architecture type, register usage, choice of mnemonics, and
7062 instruction scheduling parameters for machine type @var{cpu_type}.
7063 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
7064 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
7065 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
7066 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
7067 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
7068 @samp{860}, @samp{970}, @samp{common}, @samp{ec603e}, @samp{G3},
7069 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
7070 @samp{power4}, @samp{power5}, @samp{powerpc}, @samp{powerpc64},
7071 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64a}.
7072
7073 @option{-mcpu=common} selects a completely generic processor.  Code
7074 generated under this option will run on any POWER or PowerPC processor.
7075 GCC will use only the instructions in the common subset of both
7076 architectures, and will not use the MQ register.  GCC assumes a generic
7077 processor model for scheduling purposes.
7078
7079 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
7080 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
7081 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
7082 types, with an appropriate, generic processor model assumed for
7083 scheduling purposes.
7084
7085 The other options specify a specific processor.  Code generated under
7086 those options will run best on that processor, and may not run at all on
7087 others.
7088
7089 The @option{-mcpu} options automatically enable or disable the
7090 following options: @option{-maltivec}, @option{-mhard-float},
7091 @option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
7092 @option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
7093 @option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
7094 @option{-mstring}.  The particular options set for any particular CPU
7095 will vary between compiler versions, depending on what setting seems
7096 to produce optimal code for that CPU; it doesn't necessarily reflect
7097 the actual hardware's capabilities.  If you wish to set an individual
7098 option to a particular value, you may specify it after the
7099 @option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
7100
7101 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
7102 not enabled or disabled by the @option{-mcpu} option at present, since
7103 AIX does not have full support for these options.  You may still
7104 enable or disable them individually if you're sure it'll work in your
7105 environment.
7106
7107 @item -mtune=@var{cpu_type}
7108 @opindex mtune
7109 Set the instruction scheduling parameters for machine type
7110 @var{cpu_type}, but do not set the architecture type, register usage, or
7111 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
7112 values for @var{cpu_type} are used for @option{-mtune} as for
7113 @option{-mcpu}.  If both are specified, the code generated will use the
7114 architecture, registers, and mnemonics set by @option{-mcpu}, but the
7115 scheduling parameters set by @option{-mtune}.
7116
7117 @item -maltivec
7118 @itemx -mno-altivec
7119 @opindex maltivec
7120 @opindex mno-altivec
7121 These switches enable or disable the use of built-in functions that
7122 allow access to the AltiVec instruction set.  You may also need to set
7123 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
7124 enhancements.
7125
7126 @item -mabi=spe
7127 @opindex mabi=spe
7128 Extend the current ABI with SPE ABI extensions.  This does not change
7129 the default ABI, instead it adds the SPE ABI extensions to the current
7130 ABI@.
7131
7132 @item -mabi=no-spe
7133 @opindex mabi=no-spe
7134 Disable Booke SPE ABI extensions for the current ABI.
7135
7136 @item -misel=@var{yes/no}
7137 @itemx -misel
7138 @opindex misel
7139 This switch enables or disables the generation of ISEL instructions.
7140
7141 @item -mspe=@var{yes/no}
7142 @itemx -mspe
7143 @opindex mspe
7144 This switch enables or disables the generation of SPE simd
7145 instructions.
7146
7147 @item -mfloat-gprs=@var{yes/no}
7148 @itemx -mfloat-gprs
7149 @opindex mfloat-gprs
7150 This switch enables or disables the generation of floating point
7151 operations on the general purpose registers for architectures that
7152 support it.  This option is currently only available on the MPC8540.
7153
7154 @item -mfull-toc
7155 @itemx -mno-fp-in-toc
7156 @itemx -mno-sum-in-toc
7157 @itemx -mminimal-toc
7158 @opindex mfull-toc
7159 @opindex mno-fp-in-toc
7160 @opindex mno-sum-in-toc
7161 @opindex mminimal-toc
7162 Modify generation of the TOC (Table Of Contents), which is created for
7163 every executable file.  The @option{-mfull-toc} option is selected by
7164 default.  In that case, GCC will allocate at least one TOC entry for
7165 each unique non-automatic variable reference in your program.  GCC
7166 will also place floating-point constants in the TOC@.  However, only
7167 16,384 entries are available in the TOC@.
7168
7169 If you receive a linker error message that saying you have overflowed
7170 the available TOC space, you can reduce the amount of TOC space used
7171 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
7172 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
7173 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
7174 generate code to calculate the sum of an address and a constant at
7175 run-time instead of putting that sum into the TOC@.  You may specify one
7176 or both of these options.  Each causes GCC to produce very slightly
7177 slower and larger code at the expense of conserving TOC space.
7178
7179 If you still run out of space in the TOC even when you specify both of
7180 these options, specify @option{-mminimal-toc} instead.  This option causes
7181 GCC to make only one TOC entry for every file.  When you specify this
7182 option, GCC will produce code that is slower and larger but which
7183 uses extremely little TOC space.  You may wish to use this option
7184 only on files that contain less frequently executed code.
7185
7186 @item -maix64
7187 @itemx -maix32
7188 @opindex maix64
7189 @opindex maix32
7190 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7191 @code{long} type, and the infrastructure needed to support them.
7192 Specifying @option{-maix64} implies @option{-mpowerpc64} and
7193 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
7194 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
7195
7196 @item -mxl-call
7197 @itemx -mno-xl-call
7198 @opindex mxl-call
7199 @opindex mno-xl-call
7200 On AIX, pass floating-point arguments to prototyped functions beyond the
7201 register save area (RSA) on the stack in addition to argument FPRs.  The
7202 AIX calling convention was extended but not initially documented to
7203 handle an obscure K&R C case of calling a function that takes the
7204 address of its arguments with fewer arguments than declared.  AIX XL
7205 compilers access floating point arguments which do not fit in the
7206 RSA from the stack when a subroutine is compiled without
7207 optimization.  Because always storing floating-point arguments on the
7208 stack is inefficient and rarely needed, this option is not enabled by
7209 default and only is necessary when calling subroutines compiled by AIX
7210 XL compilers without optimization.
7211
7212 @item -mpe
7213 @opindex mpe
7214 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
7215 application written to use message passing with special startup code to
7216 enable the application to run.  The system must have PE installed in the
7217 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
7218 must be overridden with the @option{-specs=} option to specify the
7219 appropriate directory location.  The Parallel Environment does not
7220 support threads, so the @option{-mpe} option and the @option{-pthread}
7221 option are incompatible.
7222
7223 @item -malign-natural
7224 @itemx -malign-power
7225 @opindex malign-natural
7226 @opindex malign-power
7227 On AIX, Darwin, and 64-bit PowerPC GNU/Linux, the option
7228 @option{-malign-natural} overrides the ABI-defined alignment of larger
7229 types, such as floating-point doubles, on their natural size-based boundary.
7230 The option @option{-malign-power} instructs GCC to follow the ABI-specified
7231 alignment rules.  GCC defaults to the standard alignment defined in the ABI.
7232
7233 @item -msoft-float
7234 @itemx -mhard-float
7235 @opindex msoft-float
7236 @opindex mhard-float
7237 Generate code that does not use (uses) the floating-point register set.
7238 Software floating point emulation is provided if you use the
7239 @option{-msoft-float} option, and pass the option to GCC when linking.
7240
7241 @item -mmultiple
7242 @itemx -mno-multiple
7243 @opindex mmultiple
7244 @opindex mno-multiple
7245 Generate code that uses (does not use) the load multiple word
7246 instructions and the store multiple word instructions.  These
7247 instructions are generated by default on POWER systems, and not
7248 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
7249 endian PowerPC systems, since those instructions do not work when the
7250 processor is in little endian mode.  The exceptions are PPC740 and
7251 PPC750 which permit the instructions usage in little endian mode.
7252
7253 @item -mstring
7254 @itemx -mno-string
7255 @opindex mstring
7256 @opindex mno-string
7257 Generate code that uses (does not use) the load string instructions
7258 and the store string word instructions to save multiple registers and
7259 do small block moves.  These instructions are generated by default on
7260 POWER systems, and not generated on PowerPC systems.  Do not use
7261 @option{-mstring} on little endian PowerPC systems, since those
7262 instructions do not work when the processor is in little endian mode.
7263 The exceptions are PPC740 and PPC750 which permit the instructions
7264 usage in little endian mode.
7265
7266 @item -mupdate
7267 @itemx -mno-update
7268 @opindex mupdate
7269 @opindex mno-update
7270 Generate code that uses (does not use) the load or store instructions
7271 that update the base register to the address of the calculated memory
7272 location.  These instructions are generated by default.  If you use
7273 @option{-mno-update}, there is a small window between the time that the
7274 stack pointer is updated and the address of the previous frame is
7275 stored, which means code that walks the stack frame across interrupts or
7276 signals may get corrupted data.
7277
7278 @item -mfused-madd
7279 @itemx -mno-fused-madd
7280 @opindex mfused-madd
7281 @opindex mno-fused-madd
7282 Generate code that uses (does not use) the floating point multiply and
7283 accumulate instructions.  These instructions are generated by default if
7284 hardware floating is used.
7285
7286 @item -mno-bit-align
7287 @itemx -mbit-align
7288 @opindex mno-bit-align
7289 @opindex mbit-align
7290 On System V.4 and embedded PowerPC systems do not (do) force structures
7291 and unions that contain bit-fields to be aligned to the base type of the
7292 bit-field.
7293
7294 For example, by default a structure containing nothing but 8
7295 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
7296 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
7297 the structure would be aligned to a 1 byte boundary and be one byte in
7298 size.
7299
7300 @item -mno-strict-align
7301 @itemx -mstrict-align
7302 @opindex mno-strict-align
7303 @opindex mstrict-align
7304 On System V.4 and embedded PowerPC systems do not (do) assume that
7305 unaligned memory references will be handled by the system.
7306
7307 @item -mrelocatable
7308 @itemx -mno-relocatable
7309 @opindex mrelocatable
7310 @opindex mno-relocatable
7311 On embedded PowerPC systems generate code that allows (does not allow)
7312 the program to be relocated to a different address at runtime.  If you
7313 use @option{-mrelocatable} on any module, all objects linked together must
7314 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
7315
7316 @item -mrelocatable-lib
7317 @itemx -mno-relocatable-lib
7318 @opindex mrelocatable-lib
7319 @opindex mno-relocatable-lib
7320 On embedded PowerPC systems generate code that allows (does not allow)
7321 the program to be relocated to a different address at runtime.  Modules
7322 compiled with @option{-mrelocatable-lib} can be linked with either modules
7323 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
7324 with modules compiled with the @option{-mrelocatable} options.
7325
7326 @item -mno-toc
7327 @itemx -mtoc
7328 @opindex mno-toc
7329 @opindex mtoc
7330 On System V.4 and embedded PowerPC systems do not (do) assume that
7331 register 2 contains a pointer to a global area pointing to the addresses
7332 used in the program.
7333
7334 @item -mlittle
7335 @itemx -mlittle-endian
7336 @opindex mlittle
7337 @opindex mlittle-endian
7338 On System V.4 and embedded PowerPC systems compile code for the
7339 processor in little endian mode.  The @option{-mlittle-endian} option is
7340 the same as @option{-mlittle}.
7341
7342 @item -mbig
7343 @itemx -mbig-endian
7344 @opindex mbig
7345 @opindex mbig-endian
7346 On System V.4 and embedded PowerPC systems compile code for the
7347 processor in big endian mode.  The @option{-mbig-endian} option is
7348 the same as @option{-mbig}.
7349
7350 @item -mdynamic-no-pic
7351 @opindex mdynamic-no-pic
7352 On Darwin and Mac OS X systems, compile code so that it is not
7353 relocatable, but that its external references are relocatable.  The
7354 resulting code is suitable for applications, but not shared
7355 libraries.
7356
7357 @item -mprioritize-restricted-insns=@var{priority}
7358 @opindex mprioritize-restricted-insns
7359 This option controls the priority that is assigned to
7360 dispatch-slot restricted instructions during the second scheduling
7361 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
7362 @var{no/highest/second-highest} priority to dispatch slot restricted
7363 instructions.
7364
7365 @item -msched-costly-dep=@var{dependence_type}
7366 @opindex msched-costly-dep
7367 This option controls which dependences are considered costly
7368 by the target during instruction scheduling.  The argument
7369 @var{dependence_type} takes one of the following values:
7370 @var{no}: no dependence is costly,
7371 @var{all}: all dependences are costly,
7372 @var{true_store_to_load}: a true dependence from store to load is costly,
7373 @var{store_to_load}: any dependence from store to load is costly,
7374 @var{number}: any dependence which latency >= @var{number} is costly.
7375
7376 @item -minsert-sched-nops=@var{scheme}
7377 @opindex minsert-sched-nops
7378 This option controls which nop insertion scheme will be used during
7379 the second scheduling pass. The argument @var{scheme} takes one of the
7380 following values:
7381 @var{no}: Don't insert nops.
7382 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
7383 according to the scheduler's grouping.
7384 @var{regroup_exact}: Insert nops to force costly dependent insns into
7385 separate groups.  Insert exactly as many nops as needed to force an insn
7386 to a new group, according to the estimated processor grouping.
7387 @var{number}: Insert nops to force costly dependent insns into
7388 separate groups.  Insert @var{number} nops to force an insn to a new group.
7389
7390 @item -mcall-sysv
7391 @opindex mcall-sysv
7392 On System V.4 and embedded PowerPC systems compile code using calling
7393 conventions that adheres to the March 1995 draft of the System V
7394 Application Binary Interface, PowerPC processor supplement.  This is the
7395 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
7396
7397 @item -mcall-sysv-eabi
7398 @opindex mcall-sysv-eabi
7399 Specify both @option{-mcall-sysv} and @option{-meabi} options.
7400
7401 @item -mcall-sysv-noeabi
7402 @opindex mcall-sysv-noeabi
7403 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
7404
7405 @item -mcall-solaris
7406 @opindex mcall-solaris
7407 On System V.4 and embedded PowerPC systems compile code for the Solaris
7408 operating system.
7409
7410 @item -mcall-linux
7411 @opindex mcall-linux
7412 On System V.4 and embedded PowerPC systems compile code for the
7413 Linux-based GNU system.
7414
7415 @item -mcall-gnu
7416 @opindex mcall-gnu
7417 On System V.4 and embedded PowerPC systems compile code for the
7418 Hurd-based GNU system.
7419
7420 @item -mcall-netbsd
7421 @opindex mcall-netbsd
7422 On System V.4 and embedded PowerPC systems compile code for the
7423 NetBSD operating system.
7424
7425 @item -maix-struct-return
7426 @opindex maix-struct-return
7427 Return all structures in memory (as specified by the AIX ABI)@.
7428
7429 @item -msvr4-struct-return
7430 @opindex msvr4-struct-return
7431 Return structures smaller than 8 bytes in registers (as specified by the
7432 SVR4 ABI)@.
7433
7434 @item -mabi=altivec
7435 @opindex mabi=altivec
7436 Extend the current ABI with AltiVec ABI extensions.  This does not
7437 change the default ABI, instead it adds the AltiVec ABI extensions to
7438 the current ABI@.
7439
7440 @item -mabi=no-altivec
7441 @opindex mabi=no-altivec
7442 Disable AltiVec ABI extensions for the current ABI.
7443
7444 @item -mprototype
7445 @itemx -mno-prototype
7446 @opindex mprototype
7447 @opindex mno-prototype
7448 On System V.4 and embedded PowerPC systems assume that all calls to
7449 variable argument functions are properly prototyped.  Otherwise, the
7450 compiler must insert an instruction before every non prototyped call to
7451 set or clear bit 6 of the condition code register (@var{CR}) to
7452 indicate whether floating point values were passed in the floating point
7453 registers in case the function takes a variable arguments.  With
7454 @option{-mprototype}, only calls to prototyped variable argument functions
7455 will set or clear the bit.
7456
7457 @item -msim
7458 @opindex msim
7459 On embedded PowerPC systems, assume that the startup module is called
7460 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7461 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7462 configurations.
7463
7464 @item -mmvme
7465 @opindex mmvme
7466 On embedded PowerPC systems, assume that the startup module is called
7467 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7468 @file{libc.a}.
7469
7470 @item -mads
7471 @opindex mads
7472 On embedded PowerPC systems, assume that the startup module is called
7473 @file{crt0.o} and the standard C libraries are @file{libads.a} and
7474 @file{libc.a}.
7475
7476 @item -myellowknife
7477 @opindex myellowknife
7478 On embedded PowerPC systems, assume that the startup module is called
7479 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
7480 @file{libc.a}.
7481
7482 @item -mvxworks
7483 @opindex mvxworks
7484 On System V.4 and embedded PowerPC systems, specify that you are
7485 compiling for a VxWorks system.
7486
7487 @item -mwindiss
7488 @opindex mwindiss
7489 Specify that you are compiling for the WindISS simulation environment.
7490
7491 @item -memb
7492 @opindex memb
7493 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7494 header to indicate that @samp{eabi} extended relocations are used.
7495
7496 @item -meabi
7497 @itemx -mno-eabi
7498 @opindex meabi
7499 @opindex mno-eabi
7500 On System V.4 and embedded PowerPC systems do (do not) adhere to the
7501 Embedded Applications Binary Interface (eabi) which is a set of
7502 modifications to the System V.4 specifications.  Selecting @option{-meabi}
7503 means that the stack is aligned to an 8 byte boundary, a function
7504 @code{__eabi} is called to from @code{main} to set up the eabi
7505 environment, and the @option{-msdata} option can use both @code{r2} and
7506 @code{r13} to point to two separate small data areas.  Selecting
7507 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7508 do not call an initialization function from @code{main}, and the
7509 @option{-msdata} option will only use @code{r13} to point to a single
7510 small data area.  The @option{-meabi} option is on by default if you
7511 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7512
7513 @item -msdata=eabi
7514 @opindex msdata=eabi
7515 On System V.4 and embedded PowerPC systems, put small initialized
7516 @code{const} global and static data in the @samp{.sdata2} section, which
7517 is pointed to by register @code{r2}.  Put small initialized
7518 non-@code{const} global and static data in the @samp{.sdata} section,
7519 which is pointed to by register @code{r13}.  Put small uninitialized
7520 global and static data in the @samp{.sbss} section, which is adjacent to
7521 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7522 incompatible with the @option{-mrelocatable} option.  The
7523 @option{-msdata=eabi} option also sets the @option{-memb} option.
7524
7525 @item -msdata=sysv
7526 @opindex msdata=sysv
7527 On System V.4 and embedded PowerPC systems, put small global and static
7528 data in the @samp{.sdata} section, which is pointed to by register
7529 @code{r13}.  Put small uninitialized global and static data in the
7530 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7531 The @option{-msdata=sysv} option is incompatible with the
7532 @option{-mrelocatable} option.
7533
7534 @item -msdata=default
7535 @itemx -msdata
7536 @opindex msdata=default
7537 @opindex msdata
7538 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7539 compile code the same as @option{-msdata=eabi}, otherwise compile code the
7540 same as @option{-msdata=sysv}.
7541
7542 @item -msdata-data
7543 @opindex msdata-data
7544 On System V.4 and embedded PowerPC systems, put small global and static
7545 data in the @samp{.sdata} section.  Put small uninitialized global and
7546 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7547 to address small data however.  This is the default behavior unless
7548 other @option{-msdata} options are used.
7549
7550 @item -msdata=none
7551 @itemx -mno-sdata
7552 @opindex msdata=none
7553 @opindex mno-sdata
7554 On embedded PowerPC systems, put all initialized global and static data
7555 in the @samp{.data} section, and all uninitialized data in the
7556 @samp{.bss} section.
7557
7558 @item -G @var{num}
7559 @opindex G
7560 @cindex smaller data references (PowerPC)
7561 @cindex .sdata/.sdata2 references (PowerPC)
7562 On embedded PowerPC systems, put global and static items less than or
7563 equal to @var{num} bytes into the small data or bss sections instead of
7564 the normal data or bss section.  By default, @var{num} is 8.  The
7565 @option{-G @var{num}} switch is also passed to the linker.
7566 All modules should be compiled with the same @option{-G @var{num}} value.
7567
7568 @item -mregnames
7569 @itemx -mno-regnames
7570 @opindex mregnames
7571 @opindex mno-regnames
7572 On System V.4 and embedded PowerPC systems do (do not) emit register
7573 names in the assembly language output using symbolic forms.
7574
7575 @item -mlongcall
7576 @itemx -mno-longcall
7577 @opindex mlongcall
7578 @opindex mno-longcall
7579 Default to making all function calls indirectly, using a register, so
7580 that functions which reside further than 32 megabytes (33,554,432
7581 bytes) from the current location can be called.  This setting can be
7582 overridden by the @code{shortcall} function attribute, or by
7583 @code{#pragma longcall(0)}.
7584
7585 Some linkers are capable of detecting out-of-range calls and generating
7586 glue code on the fly.  On these systems, long calls are unnecessary and
7587 generate slower code.  As of this writing, the AIX linker can do this,
7588 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7589 to the GNU linker for 32-bit PowerPC systems as well.
7590
7591 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
7592 callee, L42'', plus a ``branch island'' (glue code).  The two target
7593 addresses represent the callee and the ``branch island.'' The
7594 Darwin/PPC linker will prefer the first address and generate a ``bl
7595 callee'' if the PPC ``bl'' instruction will reach the callee directly;
7596 otherwise, the linker will generate ``bl L42'' to call the ``branch
7597 island.''  The ``branch island'' is appended to the body of the
7598 calling function; it computes the full 32-bit address of the callee
7599 and jumps to it.
7600
7601 On Mach-O (Darwin) systems, this option directs the compiler emit to
7602 the glue for every direct call, and the Darwin linker decides whether
7603 to use or discard it.
7604
7605 In the future, we may cause GCC to ignore all longcall specifications
7606 when the linker is known to generate glue.
7607
7608 @item -pthread
7609 @opindex pthread
7610 Adds support for multithreading with the @dfn{pthreads} library.
7611 This option sets flags for both the preprocessor and linker.
7612
7613 @end table
7614
7615 @node Darwin Options
7616 @subsection Darwin Options
7617 @cindex Darwin options
7618
7619 These options are defined for all architectures running the Darwin operating
7620 system.  They are useful for compatibility with other Mac OS compilers.
7621
7622 @table @gcctabopt
7623 @item -all_load
7624 @opindex all_load
7625 Loads all members of static archive libraries.
7626 See man ld(1) for more information.
7627
7628 @item -arch_errors_fatal
7629 @opindex arch_errors_fatal
7630 Cause the errors having to do with files that have the wrong architecture
7631 to be fatal.
7632
7633 @item -bind_at_load
7634 @opindex bind_at_load
7635 Causes the output file to be marked such that the dynamic linker will
7636 bind all undefined references when the file is loaded or launched.
7637
7638 @item -bundle
7639 @opindex bundle
7640 Produce a Mach-o bundle format file.
7641 See man ld(1) for more information.
7642
7643 @item -bundle_loader @var{executable}
7644 @opindex bundle_loader
7645 This specifies the @var{executable} that will be loading the build
7646 output file being linked. See man ld(1) for more information.
7647
7648 @item -allowable_client  @var{client_name}
7649 @itemx -arch_only
7650
7651 @itemx -client_name
7652 @itemx -compatibility_version
7653 @itemx -current_version
7654 @itemx -dependency-file
7655 @itemx -dylib_file
7656 @itemx -dylinker_install_name
7657 @itemx -dynamic
7658 @itemx -dynamiclib
7659 @itemx -exported_symbols_list
7660 @itemx -filelist
7661 @itemx -flat_namespace
7662 @itemx -force_cpusubtype_ALL
7663 @itemx -force_flat_namespace
7664 @itemx -headerpad_max_install_names
7665 @itemx -image_base
7666 @itemx -init
7667 @itemx -install_name
7668 @itemx -keep_private_externs
7669 @itemx -multi_module
7670 @itemx -multiply_defined
7671 @itemx -multiply_defined_unused
7672 @itemx -noall_load
7673 @itemx -nofixprebinding
7674 @itemx -nomultidefs
7675 @itemx -noprebind
7676 @itemx -noseglinkedit
7677 @itemx -pagezero_size
7678 @itemx -prebind
7679 @itemx -prebind_all_twolevel_modules
7680 @itemx -private_bundle
7681 @itemx -read_only_relocs
7682 @itemx -sectalign
7683 @itemx -sectobjectsymbols
7684 @itemx -whyload
7685 @itemx -seg1addr
7686 @itemx -sectcreate
7687 @itemx -sectobjectsymbols
7688 @itemx -sectorder
7689 @itemx -seg_addr_table
7690 @itemx -seg_addr_table_filename
7691 @itemx -seglinkedit
7692 @itemx -segprot
7693 @itemx -segs_read_only_addr
7694 @itemx -segs_read_write_addr
7695 @itemx -single_module
7696 @itemx -static
7697 @itemx -sub_library
7698 @itemx -sub_umbrella
7699 @itemx -twolevel_namespace
7700 @itemx -umbrella
7701 @itemx -undefined
7702 @itemx -unexported_symbols_list
7703 @itemx -weak_reference_mismatches
7704 @itemx -whatsloaded
7705
7706 @opindex allowable_client
7707 @opindex arch_only
7708 @opindex client_name
7709 @opindex compatibility_version
7710 @opindex current_version
7711 @opindex dependency-file
7712 @opindex dylib_file
7713 @opindex dylinker_install_name
7714 @opindex dynamic
7715 @opindex dynamiclib
7716 @opindex exported_symbols_list
7717 @opindex filelist
7718 @opindex flat_namespace
7719 @opindex force_cpusubtype_ALL
7720 @opindex force_flat_namespace
7721 @opindex headerpad_max_install_names
7722 @opindex image_base
7723 @opindex init
7724 @opindex install_name
7725 @opindex keep_private_externs
7726 @opindex multi_module
7727 @opindex multiply_defined
7728 @opindex multiply_defined_unused
7729 @opindex noall_load
7730 @opindex nofixprebinding
7731 @opindex nomultidefs
7732 @opindex noprebind
7733 @opindex noseglinkedit
7734 @opindex pagezero_size
7735 @opindex prebind
7736 @opindex prebind_all_twolevel_modules
7737 @opindex private_bundle
7738 @opindex read_only_relocs
7739 @opindex sectalign
7740 @opindex sectobjectsymbols
7741 @opindex whyload
7742 @opindex seg1addr
7743 @opindex sectcreate
7744 @opindex sectobjectsymbols
7745 @opindex sectorder
7746 @opindex seg_addr_table
7747 @opindex seg_addr_table_filename
7748 @opindex seglinkedit
7749 @opindex segprot
7750 @opindex segs_read_only_addr
7751 @opindex segs_read_write_addr
7752 @opindex single_module
7753 @opindex static
7754 @opindex sub_library
7755 @opindex sub_umbrella
7756 @opindex twolevel_namespace
7757 @opindex umbrella
7758 @opindex undefined
7759 @opindex unexported_symbols_list
7760 @opindex weak_reference_mismatches
7761 @opindex whatsloaded
7762
7763 These options are available for Darwin linker. Darwin linker man page
7764 describes them in detail.
7765 @end table
7766
7767
7768 @node MIPS Options
7769 @subsection MIPS Options
7770 @cindex MIPS options
7771
7772 @table @gcctabopt
7773
7774 @item -EB
7775 @opindex EB
7776 Generate big-endian code.
7777
7778 @item -EL
7779 @opindex EL
7780 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
7781 configurations.
7782
7783 @item -march=@var{arch}
7784 @opindex march
7785 Generate code that will run on @var{arch}, which can be the name of a
7786 generic MIPS ISA, or the name of a particular processor.
7787 The ISA names are:
7788 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
7789 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
7790 The processor names are:
7791 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7792 @samp{m4k},
7793 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
7794 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
7795 @samp{rm9000},
7796 @samp{orion},
7797 @samp{sb1},
7798 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
7799 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
7800 The special value @samp{from-abi} selects the
7801 most compatible architecture for the selected ABI (that is,
7802 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7803
7804 In processor names, a final @samp{000} can be abbreviated as @samp{k}
7805 (for example, @samp{-march=r2k}).  Prefixes are optional, and
7806 @samp{vr} may be written @samp{r}.
7807
7808 GCC defines two macros based on the value of this option.  The first
7809 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7810 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7811 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
7812 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7813 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7814
7815 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7816 above.  In other words, it will have the full prefix and will not
7817 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7818 the macro names the resolved architecture (either @samp{"mips1"} or
7819 @samp{"mips3"}).  It names the default architecture when no
7820 @option{-march} option is given.
7821
7822 @item -mtune=@var{arch}
7823 @opindex mtune
7824 Optimize for @var{arch}.  Among other things, this option controls
7825 the way instructions are scheduled, and the perceived cost of arithmetic
7826 operations.  The list of @var{arch} values is the same as for
7827 @option{-march}.
7828
7829 When this option is not used, GCC will optimize for the processor
7830 specified by @option{-march}.  By using @option{-march} and
7831 @option{-mtune} together, it is possible to generate code that will
7832 run on a family of processors, but optimize the code for one
7833 particular member of that family.
7834
7835 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
7836 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
7837 @samp{-march} ones described above.
7838
7839 @item -mips1
7840 @opindex mips1
7841 Equivalent to @samp{-march=mips1}.
7842
7843 @item -mips2
7844 @opindex mips2
7845 Equivalent to @samp{-march=mips2}.
7846
7847 @item -mips3
7848 @opindex mips3
7849 Equivalent to @samp{-march=mips3}.
7850
7851 @item -mips4
7852 @opindex mips4
7853 Equivalent to @samp{-march=mips4}.
7854
7855 @item -mips32
7856 @opindex mips32
7857 Equivalent to @samp{-march=mips32}.
7858
7859 @item -mips32r2
7860 @opindex mips32r2
7861 Equivalent to @samp{-march=mips32r2}.
7862
7863 @item -mips64
7864 @opindex mips64
7865 Equivalent to @samp{-march=mips64}.
7866
7867 @item -mips16
7868 @itemx -mno-mips16
7869 @opindex mips16
7870 @opindex mno-mips16
7871 Use (do not use) the MIPS16 ISA.
7872
7873 @item -mabi=32
7874 @itemx -mabi=o64
7875 @itemx -mabi=n32
7876 @itemx -mabi=64
7877 @itemx -mabi=eabi
7878 @opindex mabi=32
7879 @opindex mabi=o64
7880 @opindex mabi=n32
7881 @opindex mabi=64
7882 @opindex mabi=eabi
7883 Generate code for the given ABI@.
7884
7885 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
7886 generates 64-bit code when you select a 64-bit architecture, but you
7887 can use @option{-mgp32} to get 32-bit code instead.
7888
7889 For information about the O64 ABI, see
7890 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
7891
7892 @item -mabicalls
7893 @itemx -mno-abicalls
7894 @opindex mabicalls
7895 @opindex mno-abicalls
7896 Generate (do not generate) SVR4-style position-independent code.
7897 @option{-mabicalls} is the default for SVR4-based systems.
7898
7899 @item -mxgot
7900 @itemx -mno-xgot
7901 @opindex mxgot
7902 @opindex mno-xgot
7903 Lift (do not lift) the usual restrictions on the size of the global
7904 offset table.
7905
7906 GCC normally uses a single instruction to load values from the GOT.
7907 While this is relatively efficient, it will only work if the GOT
7908 is smaller than about 64k.  Anything larger will cause the linker
7909 to report an error such as:
7910
7911 @cindex relocation truncated to fit (MIPS)
7912 @smallexample
7913 relocation truncated to fit: R_MIPS_GOT16 foobar
7914 @end smallexample
7915
7916 If this happens, you should recompile your code with @option{-mxgot}.
7917 It should then work with very large GOTs, although it will also be
7918 less efficient, since it will take three instructions to fetch the
7919 value of a global symbol.
7920
7921 Note that some linkers can create multiple GOTs.  If you have such a
7922 linker, you should only need to use @option{-mxgot} when a single object
7923 file accesses more than 64k's worth of GOT entries.  Very few do.
7924
7925 These options have no effect unless GCC is generating position
7926 independent code.
7927
7928 @item -membedded-pic
7929 @itemx -mno-embedded-pic
7930 @opindex membedded-pic
7931 @opindex mno-embedded-pic
7932 Generate (do not generate) position-independent code suitable for some
7933 embedded systems.  All calls are made using PC relative addresses, and
7934 all data is addressed using the $gp register.  No more than 65536
7935 bytes of global data may be used.  This requires GNU as and GNU ld,
7936 which do most of the work.
7937
7938 @item -mgp32
7939 @opindex mgp32
7940 Assume that general-purpose registers are 32 bits wide.
7941
7942 @item -mgp64
7943 @opindex mgp64
7944 Assume that general-purpose registers are 64 bits wide.
7945
7946 @item -mfp32
7947 @opindex mfp32
7948 Assume that floating-point registers are 32 bits wide.
7949
7950 @item -mfp64
7951 @opindex mfp64
7952 Assume that floating-point registers are 64 bits wide.
7953
7954 @item -mhard-float
7955 @opindex mhard-float
7956 Use floating-point coprocessor instructions.
7957
7958 @item -msoft-float
7959 @opindex msoft-float
7960 Do not use floating-point coprocessor instructions.  Implement
7961 floating-point calculations using library calls instead.
7962
7963 @item -msingle-float
7964 @opindex msingle-float
7965 Assume that the floating-point coprocessor only supports single-precision
7966 operations.
7967
7968 @itemx -mdouble-float
7969 @opindex mdouble-float
7970 Assume that the floating-point coprocessor supports double-precision
7971 operations.  This is the default.
7972
7973 @item -mint64
7974 @opindex mint64
7975 Force @code{int} and @code{long} types to be 64 bits wide.  See
7976 @option{-mlong32} for an explanation of the default and the way
7977 that the pointer size is determined.
7978
7979 @item -mlong64
7980 @opindex mlong64
7981 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
7982 an explanation of the default and the way that the pointer size is
7983 determined.
7984
7985 @item -mlong32
7986 @opindex mlong32
7987 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
7988
7989 The default size of @code{int}s, @code{long}s and pointers depends on
7990 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
7991 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
7992 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
7993 or the same size as integer registers, whichever is smaller.
7994
7995 @item -G @var{num}
7996 @opindex G
7997 @cindex smaller data references (MIPS)
7998 @cindex gp-relative references (MIPS)
7999 Put global and static items less than or equal to @var{num} bytes into
8000 the small data or bss section instead of the normal data or bss section.
8001 This allows the data to be accessed using a single instruction.
8002
8003 All modules should be compiled with the same @option{-G @var{num}}
8004 value.
8005
8006 @item -membedded-data
8007 @itemx -mno-embedded-data
8008 @opindex membedded-data
8009 @opindex mno-embedded-data
8010 Allocate variables to the read-only data section first if possible, then
8011 next in the small data section if possible, otherwise in data.  This gives
8012 slightly slower code than the default, but reduces the amount of RAM required
8013 when executing, and thus may be preferred for some embedded systems.
8014
8015 @item -muninit-const-in-rodata
8016 @itemx -mno-uninit-const-in-rodata
8017 @opindex muninit-const-in-rodata
8018 @opindex mno-uninit-const-in-rodata
8019 Put uninitialized @code{const} variables in the read-only data section.
8020 This option is only meaningful in conjunction with @option{-membedded-data}.
8021
8022 @item -msplit-addresses
8023 @itemx -mno-split-addresses
8024 @opindex msplit-addresses
8025 @opindex mno-split-addresses
8026 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
8027 relocation operators.  This option has been superceded by
8028 @option{-mexplicit-relocs} but is retained for backwards compatibility.
8029
8030 @item -mexplicit-relocs
8031 @itemx -mno-explicit-relocs
8032 @opindex mexplicit-relocs
8033 @opindex mno-explicit-relocs
8034 Use (do not use) assembler relocation operators when dealing with symbolic
8035 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
8036 is to use assembler macros instead.
8037
8038 @option{-mexplicit-relocs} is usually the default if GCC was configured
8039 to use an assembler that supports relocation operators.  However, the
8040 combination of @option{-mabicalls} and @option{-fno-unit-at-a-time}
8041 implies @option{-mno-explicit-relocs} unless explicitly overridden.
8042 This is because, when generating abicalls, the choice of relocation
8043 depends on whether a symbol is local or global.  In some rare cases,
8044 GCC will not be able to decide this until the whole compilation unit
8045 has been read.
8046
8047 @item -mrnames
8048 @itemx -mno-rnames
8049 @opindex mrnames
8050 @opindex mno-rnames
8051 Generate (do not generate) code that refers to registers using their
8052 software names.  The default is @option{-mno-rnames}, which tells GCC
8053 to use hardware names like @samp{$4} instead of software names like
8054 @samp{a0}.  The only assembler known to support @option{-rnames} is
8055 the Algorithmics assembler.
8056
8057 @item -mcheck-zero-division
8058 @itemx -mno-check-zero-division
8059 @opindex mcheck-zero-division
8060 @opindex mno-check-zero-division
8061 Trap (do not trap) on integer division by zero.  The default is
8062 @option{-mcheck-zero-division}.
8063
8064 @item -mmemcpy
8065 @itemx -mno-memcpy
8066 @opindex mmemcpy
8067 @opindex mno-memcpy
8068 Force (do not force) the use of @code{memcpy()} for non-trivial block
8069 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
8070 most constant-sized copies.
8071
8072 @item -mlong-calls
8073 @itemx -mno-long-calls
8074 @opindex mlong-calls
8075 @opindex mno-long-calls
8076 Disable (do not disable) use of the @code{jal} instruction.  Calling
8077 functions using @code{jal} is more efficient but requires the caller
8078 and callee to be in the same 256 megabyte segment.
8079
8080 This option has no effect on abicalls code.  The default is
8081 @option{-mno-long-calls}.
8082
8083 @item -mmad
8084 @itemx -mno-mad
8085 @opindex mmad
8086 @opindex mno-mad
8087 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
8088 instructions, as provided by the R4650 ISA.
8089
8090 @item -mfused-madd
8091 @itemx -mno-fused-madd
8092 @opindex mfused-madd
8093 @opindex mno-fused-madd
8094 Enable (disable) use of the floating point multiply-accumulate
8095 instructions, when they are available.  The default is
8096 @option{-mfused-madd}.
8097
8098 When multiply-accumulate instructions are used, the intermediate
8099 product is calculated to infinite precision and is not subject to
8100 the FCSR Flush to Zero bit.  This may be undesirable in some
8101 circumstances.
8102
8103 @item -nocpp
8104 @opindex nocpp
8105 Tell the MIPS assembler to not run its preprocessor over user
8106 assembler files (with a @samp{.s} suffix) when assembling them.
8107
8108 @item -mfix-r4000
8109 @itemx -mno-fix-r4000
8110 @opindex mfix-r4000
8111 @opindex mno-fix-r4000
8112 Work around certain R4000 CPU errata:
8113 @itemize @minus
8114 @item
8115 A double-word or a variable shift may give an incorrect result if executed
8116 immediately after starting an integer division.
8117 @item
8118 A double-word or a variable shift may give an incorrect result if executed
8119 while an integer multiplication is in progress.
8120 @item
8121 An integer division may give an incorrect result if started in a delay slot
8122 of a taken branch or a jump.
8123 @end itemize
8124
8125 @item -mfix-r4400
8126 @itemx -mno-fix-r4400
8127 @opindex mfix-r4400
8128 @opindex mno-fix-r4400
8129 Work around certain R4400 CPU errata:
8130 @itemize @minus
8131 @item
8132 A double-word or a variable shift may give an incorrect result if executed
8133 immediately after starting an integer division.
8134 @end itemize
8135
8136 @item -mfix-vr4120
8137 @itemx -mno-fix-vr4120
8138 @opindex mfix-vr4120
8139 Work around certain VR4120 errata:
8140 @itemize @minus
8141 @item
8142 @code{dmultu} does not always produce the correct result.
8143 @item
8144 @code{div} and @code{ddiv} do not always produce the correct result if one
8145 of the operands is negative.
8146 @end itemize
8147 The workarounds for the division errata rely on special functions in
8148 @file{libgcc.a}.  At present, these functions are only provided by
8149 the @code{mips64vr*-elf} configurations.
8150
8151 Other VR4120 errata require a nop to be inserted between certain pairs of
8152 instructions.  These errata are handled by the assembler, not by GCC itself.
8153
8154 @item -mfix-sb1
8155 @itemx -mno-fix-sb1
8156 @opindex mfix-sb1
8157 Work around certain SB-1 CPU core errata.
8158 (This flag currently works around the SB-1 revision 2
8159 ``F1'' and ``F2'' floating point errata.)
8160
8161 @item -mflush-func=@var{func}
8162 @itemx -mno-flush-func
8163 @opindex mflush-func
8164 Specifies the function to call to flush the I and D caches, or to not
8165 call any such function.  If called, the function must take the same
8166 arguments as the common @code{_flush_func()}, that is, the address of the
8167 memory range for which the cache is being flushed, the size of the
8168 memory range, and the number 3 (to flush both caches).  The default
8169 depends on the target GCC was configured for, but commonly is either
8170 @samp{_flush_func} or @samp{__cpu_flush}.
8171
8172 @item -mbranch-likely
8173 @itemx -mno-branch-likely
8174 @opindex mbranch-likely
8175 @opindex mno-branch-likely
8176 Enable or disable use of Branch Likely instructions, regardless of the
8177 default for the selected architecture.  By default, Branch Likely
8178 instructions may be generated if they are supported by the selected
8179 architecture.  An exception is for the MIPS32 and MIPS64 architectures
8180 and processors which implement those architectures; for those, Branch
8181 Likely instructions will not be generated by default because the MIPS32
8182 and MIPS64 architectures specifically deprecate their use.
8183 @end table
8184
8185 @node i386 and x86-64 Options
8186 @subsection Intel 386 and AMD x86-64 Options
8187 @cindex i386 Options
8188 @cindex x86-64 Options
8189 @cindex Intel 386 Options
8190 @cindex AMD x86-64 Options
8191
8192 These @samp{-m} options are defined for the i386 and x86-64 family of
8193 computers:
8194
8195 @table @gcctabopt
8196 @item -mtune=@var{cpu-type}
8197 @opindex mtune
8198 Tune to @var{cpu-type} everything applicable about the generated code, except
8199 for the ABI and the set of available instructions.  The choices for
8200 @var{cpu-type} are:
8201 @table @emph
8202 @item i386
8203 Original Intel's i386 CPU.
8204 @item i486
8205 Intel's i486 CPU.  (No scheduling is implemented for this chip.)
8206 @item i586, pentium
8207 Intel Pentium CPU with no MMX support.
8208 @item pentium-mmx
8209 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
8210 @item i686, pentiumpro
8211 Intel PentiumPro CPU.
8212 @item pentium2
8213 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
8214 @item pentium3, pentium3m
8215 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
8216 support.
8217 @item pentium-m
8218 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
8219 support.  Used by Centrino notebooks.
8220 @item pentium4, pentium4m
8221 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
8222 @item prescott
8223 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
8224 set support.
8225 @item nocona
8226 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
8227 SSE2 and SSE3 instruction set support.
8228 @item k6
8229 AMD K6 CPU with MMX instruction set support.
8230 @item k6-2, k6-3
8231 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
8232 @item athlon, athlon-tbird
8233 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
8234 support.
8235 @item athlon-4, athlon-xp, athlon-mp
8236 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
8237 instruction set support.
8238 @item k8, opteron, athlon64, athlon-fx
8239 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
8240 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
8241 @item winchip-c6
8242 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
8243 set support.
8244 @item winchip2
8245 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
8246 instruction set support.
8247 @item c3
8248 Via C3 CPU with MMX and 3dNOW!  instruction set support.  (No scheduling is
8249 implemented for this chip.)
8250 @item c3-2
8251 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
8252 implemented for this chip.)
8253 @end table
8254
8255 While picking a specific @var{cpu-type} will schedule things appropriately
8256 for that particular chip, the compiler will not generate any code that
8257 does not run on the i386 without the @option{-march=@var{cpu-type}} option
8258 being used.
8259
8260 @item -march=@var{cpu-type}
8261 @opindex march
8262 Generate instructions for the machine type @var{cpu-type}.  The choices
8263 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8264 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8265
8266 @item -mcpu=@var{cpu-type}
8267 @opindex mcpu
8268 A deprecated synonym for @option{-mtune}.
8269
8270 @item -m386
8271 @itemx -m486
8272 @itemx -mpentium
8273 @itemx -mpentiumpro
8274 @opindex m386
8275 @opindex m486
8276 @opindex mpentium
8277 @opindex mpentiumpro
8278 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8279 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8280 These synonyms are deprecated.
8281
8282 @item -mfpmath=@var{unit}
8283 @opindex march
8284 Generate floating point arithmetics for selected unit @var{unit}.  The choices
8285 for @var{unit} are:
8286
8287 @table @samp
8288 @item 387
8289 Use the standard 387 floating point coprocessor present majority of chips and
8290 emulated otherwise.  Code compiled with this option will run almost everywhere.
8291 The temporary results are computed in 80bit precision instead of precision
8292 specified by the type resulting in slightly different results compared to most
8293 of other chips. See @option{-ffloat-store} for more detailed description.
8294
8295 This is the default choice for i386 compiler.
8296
8297 @item sse
8298 Use scalar floating point instructions present in the SSE instruction set.
8299 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8300 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8301 instruction set supports only single precision arithmetics, thus the double and
8302 extended precision arithmetics is still done using 387.  Later version, present
8303 only in Pentium4 and the future AMD x86-64 chips supports double precision
8304 arithmetics too.
8305
8306 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8307 @option{-msse2} switches to enable SSE extensions and make this option
8308 effective.  For x86-64 compiler, these extensions are enabled by default.
8309
8310 The resulting code should be considerably faster in the majority of cases and avoid
8311 the numerical instability problems of 387 code, but may break some existing
8312 code that expects temporaries to be 80bit.
8313
8314 This is the default choice for the x86-64 compiler.
8315
8316 @item sse,387
8317 Attempt to utilize both instruction sets at once.  This effectively double the
8318 amount of available registers and on chips with separate execution units for
8319 387 and SSE the execution resources too.  Use this option with care, as it is
8320 still experimental, because the GCC register allocator does not model separate
8321 functional units well resulting in instable performance.
8322 @end table
8323
8324 @item -masm=@var{dialect}
8325 @opindex masm=@var{dialect}
8326 Output asm instructions using selected @var{dialect}. Supported choices are
8327 @samp{intel} or @samp{att} (the default one).
8328
8329 @item -mieee-fp
8330 @itemx -mno-ieee-fp
8331 @opindex mieee-fp
8332 @opindex mno-ieee-fp
8333 Control whether or not the compiler uses IEEE floating point
8334 comparisons.  These handle correctly the case where the result of a
8335 comparison is unordered.
8336
8337 @item -msoft-float
8338 @opindex msoft-float
8339 Generate output containing library calls for floating point.
8340 @strong{Warning:} the requisite libraries are not part of GCC@.
8341 Normally the facilities of the machine's usual C compiler are used, but
8342 this can't be done directly in cross-compilation.  You must make your
8343 own arrangements to provide suitable library functions for
8344 cross-compilation.
8345
8346 On machines where a function returns floating point results in the 80387
8347 register stack, some floating point opcodes may be emitted even if
8348 @option{-msoft-float} is used.
8349
8350 @item -mno-fp-ret-in-387
8351 @opindex mno-fp-ret-in-387
8352 Do not use the FPU registers for return values of functions.
8353
8354 The usual calling convention has functions return values of types
8355 @code{float} and @code{double} in an FPU register, even if there
8356 is no FPU@.  The idea is that the operating system should emulate
8357 an FPU@.
8358
8359 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8360 in ordinary CPU registers instead.
8361
8362 @item -mno-fancy-math-387
8363 @opindex mno-fancy-math-387
8364 Some 387 emulators do not support the @code{sin}, @code{cos} and
8365 @code{sqrt} instructions for the 387.  Specify this option to avoid
8366 generating those instructions.  This option is the default on FreeBSD,
8367 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8368 indicates that the target cpu will always have an FPU and so the
8369 instruction will not need emulation.  As of revision 2.6.1, these
8370 instructions are not generated unless you also use the
8371 @option{-funsafe-math-optimizations} switch.
8372
8373 @item -malign-double
8374 @itemx -mno-align-double
8375 @opindex malign-double
8376 @opindex mno-align-double
8377 Control whether GCC aligns @code{double}, @code{long double}, and
8378 @code{long long} variables on a two word boundary or a one word
8379 boundary.  Aligning @code{double} variables on a two word boundary will
8380 produce code that runs somewhat faster on a @samp{Pentium} at the
8381 expense of more memory.
8382
8383 @strong{Warning:} if you use the @option{-malign-double} switch,
8384 structures containing the above types will be aligned differently than
8385 the published application binary interface specifications for the 386
8386 and will not be binary compatible with structures in code compiled
8387 without that switch.
8388
8389 @item -m96bit-long-double
8390 @itemx -m128bit-long-double
8391 @opindex m96bit-long-double
8392 @opindex m128bit-long-double
8393 These switches control the size of @code{long double} type. The i386
8394 application binary interface specifies the size to be 96 bits,
8395 so @option{-m96bit-long-double} is the default in 32 bit mode.
8396
8397 Modern architectures (Pentium and newer) would prefer @code{long double}
8398 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
8399 conforming to the ABI, this would not be possible.  So specifying a
8400 @option{-m128bit-long-double} will align @code{long double}
8401 to a 16 byte boundary by padding the @code{long double} with an additional
8402 32 bit zero.
8403
8404 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8405 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
8406
8407 Notice that neither of these options enable any extra precision over the x87
8408 standard of 80 bits for a @code{long double}.
8409
8410 @strong{Warning:} if you override the default value for your target ABI, the
8411 structures and arrays containing @code{long double} variables will change
8412 their size as well as function calling convention for function taking
8413 @code{long double} will be modified.  Hence they will not be binary
8414 compatible with arrays or structures in code compiled without that switch.
8415
8416
8417 @item -msvr3-shlib
8418 @itemx -mno-svr3-shlib
8419 @opindex msvr3-shlib
8420 @opindex mno-svr3-shlib
8421 Control whether GCC places uninitialized local variables into the
8422 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
8423 into @code{bss}.  These options are meaningful only on System V Release 3.
8424
8425 @item -mrtd
8426 @opindex mrtd
8427 Use a different function-calling convention, in which functions that
8428 take a fixed number of arguments return with the @code{ret} @var{num}
8429 instruction, which pops their arguments while returning.  This saves one
8430 instruction in the caller since there is no need to pop the arguments
8431 there.
8432
8433 You can specify that an individual function is called with this calling
8434 sequence with the function attribute @samp{stdcall}.  You can also
8435 override the @option{-mrtd} option by using the function attribute
8436 @samp{cdecl}.  @xref{Function Attributes}.
8437
8438 @strong{Warning:} this calling convention is incompatible with the one
8439 normally used on Unix, so you cannot use it if you need to call
8440 libraries compiled with the Unix compiler.
8441
8442 Also, you must provide function prototypes for all functions that
8443 take variable numbers of arguments (including @code{printf});
8444 otherwise incorrect code will be generated for calls to those
8445 functions.
8446
8447 In addition, seriously incorrect code will result if you call a
8448 function with too many arguments.  (Normally, extra arguments are
8449 harmlessly ignored.)
8450
8451 @item -mregparm=@var{num}
8452 @opindex mregparm
8453 Control how many registers are used to pass integer arguments.  By
8454 default, no registers are used to pass arguments, and at most 3
8455 registers can be used.  You can control this behavior for a specific
8456 function by using the function attribute @samp{regparm}.
8457 @xref{Function Attributes}.
8458
8459 @strong{Warning:} if you use this switch, and
8460 @var{num} is nonzero, then you must build all modules with the same
8461 value, including any libraries.  This includes the system libraries and
8462 startup modules.
8463
8464 @item -mpreferred-stack-boundary=@var{num}
8465 @opindex mpreferred-stack-boundary
8466 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8467 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
8468 the default is 4 (16 bytes or 128 bits), except when optimizing for code
8469 size (@option{-Os}), in which case the default is the minimum correct
8470 alignment (4 bytes for x86, and 8 bytes for x86-64).
8471
8472 On Pentium and PentiumPro, @code{double} and @code{long double} values
8473 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8474 suffer significant run time performance penalties.  On Pentium III, the
8475 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8476 penalties if it is not 16 byte aligned.
8477
8478 To ensure proper alignment of this values on the stack, the stack boundary
8479 must be as aligned as that required by any value stored on the stack.
8480 Further, every function must be generated such that it keeps the stack
8481 aligned.  Thus calling a function compiled with a higher preferred
8482 stack boundary from a function compiled with a lower preferred stack
8483 boundary will most likely misalign the stack.  It is recommended that
8484 libraries that use callbacks always use the default setting.
8485
8486 This extra alignment does consume extra stack space, and generally
8487 increases code size.  Code that is sensitive to stack space usage, such
8488 as embedded systems and operating system kernels, may want to reduce the
8489 preferred alignment to @option{-mpreferred-stack-boundary=2}.
8490
8491 @item -mmmx
8492 @itemx -mno-mmx
8493 @item -msse
8494 @itemx -mno-sse
8495 @item -msse2
8496 @itemx -mno-sse2
8497 @item -msse3
8498 @itemx -mno-sse3
8499 @item -m3dnow
8500 @itemx -mno-3dnow
8501 @opindex mmmx
8502 @opindex mno-mmx
8503 @opindex msse
8504 @opindex mno-sse
8505 @opindex m3dnow
8506 @opindex mno-3dnow
8507 These switches enable or disable the use of built-in functions that allow
8508 direct access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the
8509 instruction set.
8510
8511 @xref{X86 Built-in Functions}, for details of the functions enabled
8512 and disabled by these switches.
8513
8514 To have SSE/SSE2 instructions generated automatically from floating-point
8515 code, see @option{-mfpmath=sse}.
8516
8517 @item -mpush-args
8518 @itemx -mno-push-args
8519 @opindex mpush-args
8520 @opindex mno-push-args
8521 Use PUSH operations to store outgoing parameters.  This method is shorter
8522 and usually equally fast as method using SUB/MOV operations and is enabled
8523 by default.  In some cases disabling it may improve performance because of
8524 improved scheduling and reduced dependencies.
8525
8526 @item -maccumulate-outgoing-args
8527 @opindex maccumulate-outgoing-args
8528 If enabled, the maximum amount of space required for outgoing arguments will be
8529 computed in the function prologue.  This is faster on most modern CPUs
8530 because of reduced dependencies, improved scheduling and reduced stack usage
8531 when preferred stack boundary is not equal to 2.  The drawback is a notable
8532 increase in code size.  This switch implies @option{-mno-push-args}.
8533
8534 @item -mthreads
8535 @opindex mthreads
8536 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8537 on thread-safe exception handling must compile and link all code with the
8538 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
8539 @option{-D_MT}; when linking, it links in a special thread helper library
8540 @option{-lmingwthrd} which cleans up per thread exception handling data.
8541
8542 @item -mno-align-stringops
8543 @opindex mno-align-stringops
8544 Do not align destination of inlined string operations.  This switch reduces
8545 code size and improves performance in case the destination is already aligned,
8546 but GCC doesn't know about it.
8547
8548 @item -minline-all-stringops
8549 @opindex minline-all-stringops
8550 By default GCC inlines string operations only when destination is known to be
8551 aligned at least to 4 byte boundary.  This enables more inlining, increase code
8552 size, but may improve performance of code that depends on fast memcpy, strlen
8553 and memset for short lengths.
8554
8555 @item -momit-leaf-frame-pointer
8556 @opindex momit-leaf-frame-pointer
8557 Don't keep the frame pointer in a register for leaf functions.  This
8558 avoids the instructions to save, set up and restore frame pointers and
8559 makes an extra register available in leaf functions.  The option
8560 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8561 which might make debugging harder.
8562
8563 @item -mtls-direct-seg-refs
8564 @itemx -mno-tls-direct-seg-refs
8565 @opindex mtls-direct-seg-refs
8566 Controls whether TLS variables may be accessed with offsets from the
8567 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8568 or whether the thread base pointer must be added.  Whether or not this
8569 is legal depends on the operating system, and whether it maps the
8570 segment to cover the entire TLS area.
8571
8572 For systems that use GNU libc, the default is on.
8573 @end table
8574
8575 These @samp{-m} switches are supported in addition to the above
8576 on AMD x86-64 processors in 64-bit environments.
8577
8578 @table @gcctabopt
8579 @item -m32
8580 @itemx -m64
8581 @opindex m32
8582 @opindex m64
8583 Generate code for a 32-bit or 64-bit environment.
8584 The 32-bit environment sets int, long and pointer to 32 bits and
8585 generates code that runs on any i386 system.
8586 The 64-bit environment sets int to 32 bits and long and pointer
8587 to 64 bits and generates code for AMD's x86-64 architecture.
8588
8589 @item -mno-red-zone
8590 @opindex no-red-zone
8591 Do not use a so called red zone for x86-64 code.  The red zone is mandated
8592 by the x86-64 ABI, it is a 128-byte area beyond the location of the
8593 stack pointer that will not be modified by signal or interrupt handlers
8594 and therefore can be used for temporary data without adjusting the stack
8595 pointer.  The flag @option{-mno-red-zone} disables this red zone.
8596
8597 @item -mcmodel=small
8598 @opindex mcmodel=small
8599 Generate code for the small code model: the program and its symbols must
8600 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8601 Programs can be statically or dynamically linked.  This is the default
8602 code model.
8603
8604 @item -mcmodel=kernel
8605 @opindex mcmodel=kernel
8606 Generate code for the kernel code model.  The kernel runs in the
8607 negative 2 GB of the address space.
8608 This model has to be used for Linux kernel code.
8609
8610 @item -mcmodel=medium
8611 @opindex mcmodel=medium
8612 Generate code for the medium model: The program is linked in the lower 2
8613 GB of the address space but symbols can be located anywhere in the
8614 address space.  Programs can be statically or dynamically linked, but
8615 building of shared libraries are not supported with the medium model.
8616
8617 @item -mcmodel=large
8618 @opindex mcmodel=large
8619 Generate code for the large model: This model makes no assumptions
8620 about addresses and sizes of sections.  Currently GCC does not implement
8621 this model.
8622 @end table
8623
8624 @node HPPA Options
8625 @subsection HPPA Options
8626 @cindex HPPA Options
8627
8628 These @samp{-m} options are defined for the HPPA family of computers:
8629
8630 @table @gcctabopt
8631 @item -march=@var{architecture-type}
8632 @opindex march
8633 Generate code for the specified architecture.  The choices for
8634 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8635 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8636 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8637 architecture option for your machine.  Code compiled for lower numbered
8638 architectures will run on higher numbered architectures, but not the
8639 other way around.
8640
8641 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
8642 next release of binutils (current is 2.9.1) will probably contain PA 2.0
8643 support.
8644
8645 @item -mpa-risc-1-0
8646 @itemx -mpa-risc-1-1
8647 @itemx -mpa-risc-2-0
8648 @opindex mpa-risc-1-0
8649 @opindex mpa-risc-1-1
8650 @opindex mpa-risc-2-0
8651 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8652
8653 @item -mbig-switch
8654 @opindex mbig-switch
8655 Generate code suitable for big switch tables.  Use this option only if
8656 the assembler/linker complain about out of range branches within a switch
8657 table.
8658
8659 @item -mjump-in-delay
8660 @opindex mjump-in-delay
8661 Fill delay slots of function calls with unconditional jump instructions
8662 by modifying the return pointer for the function call to be the target
8663 of the conditional jump.
8664
8665 @item -mdisable-fpregs
8666 @opindex mdisable-fpregs
8667 Prevent floating point registers from being used in any manner.  This is
8668 necessary for compiling kernels which perform lazy context switching of
8669 floating point registers.  If you use this option and attempt to perform
8670 floating point operations, the compiler will abort.
8671
8672 @item -mdisable-indexing
8673 @opindex mdisable-indexing
8674 Prevent the compiler from using indexing address modes.  This avoids some
8675 rather obscure problems when compiling MIG generated code under MACH@.
8676
8677 @item -mno-space-regs
8678 @opindex mno-space-regs
8679 Generate code that assumes the target has no space registers.  This allows
8680 GCC to generate faster indirect calls and use unscaled index address modes.
8681
8682 Such code is suitable for level 0 PA systems and kernels.
8683
8684 @item -mfast-indirect-calls
8685 @opindex mfast-indirect-calls
8686 Generate code that assumes calls never cross space boundaries.  This
8687 allows GCC to emit code which performs faster indirect calls.
8688
8689 This option will not work in the presence of shared libraries or nested
8690 functions.
8691
8692 @item -mlong-load-store
8693 @opindex mlong-load-store
8694 Generate 3-instruction load and store sequences as sometimes required by
8695 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8696 the HP compilers.
8697
8698 @item -mportable-runtime
8699 @opindex mportable-runtime
8700 Use the portable calling conventions proposed by HP for ELF systems.
8701
8702 @item -mgas
8703 @opindex mgas
8704 Enable the use of assembler directives only GAS understands.
8705
8706 @item -mschedule=@var{cpu-type}
8707 @opindex mschedule
8708 Schedule code according to the constraints for the machine type
8709 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8710 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8711 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8712 proper scheduling option for your machine.  The default scheduling is
8713 @samp{8000}.
8714
8715 @item -mlinker-opt
8716 @opindex mlinker-opt
8717 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8718 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8719 linkers in which they give bogus error messages when linking some programs.
8720
8721 @item -msoft-float
8722 @opindex msoft-float
8723 Generate output containing library calls for floating point.
8724 @strong{Warning:} the requisite libraries are not available for all HPPA
8725 targets.  Normally the facilities of the machine's usual C compiler are
8726 used, but this cannot be done directly in cross-compilation.  You must make
8727 your own arrangements to provide suitable library functions for
8728 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8729 does provide software floating point support.
8730
8731 @option{-msoft-float} changes the calling convention in the output file;
8732 therefore, it is only useful if you compile @emph{all} of a program with
8733 this option.  In particular, you need to compile @file{libgcc.a}, the
8734 library that comes with GCC, with @option{-msoft-float} in order for
8735 this to work.
8736
8737 @item -msio
8738 @opindex msio
8739 Generate the predefine, @code{_SIO}, for server IO.  The default is
8740 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8741 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8742 options are available under HP-UX and HI-UX.
8743
8744 @item -mgnu-ld
8745 @opindex gnu-ld
8746 Use GNU ld specific options.  This passes @option{-shared} to ld when
8747 building a shared library.  It is the default when GCC is configured,
8748 explicitly or implicitly, with the GNU linker.  This option does not
8749 have any affect on which ld is called, it only changes what parameters
8750 are passed to that ld.  The ld that is called is determined by the
8751 @option{--with-ld} configure option, GCC's program search path, and
8752 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8753 using @samp{which `gcc -print-prog-name=ld`}.
8754
8755 @item -mhp-ld
8756 @opindex hp-ld
8757 Use HP ld specific options.  This passes @option{-b} to ld when building
8758 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8759 links.  It is the default when GCC is configured, explicitly or
8760 implicitly, with the HP linker.  This option does not have any affect on
8761 which ld is called, it only changes what parameters are passed to that
8762 ld.  The ld that is called is determined by the @option{--with-ld}
8763 configure option, GCC's program search path, and finally by the user's
8764 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8765 `gcc -print-prog-name=ld`}.
8766
8767 @item -mfdpic
8768 @opindex mfdpic
8769
8770 Select the FDPIC ABI, that uses function descriptors to represent
8771 pointers to functions.  Without any PIC/PIE-related options, it
8772 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
8773 assumes GOT entries and small data are within a 12-bit range from the
8774 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
8775 are computed with 32 bits.
8776
8777 @item -minline-plt
8778 @opindex minline-plt
8779
8780 Enable inlining of PLT entries in function calls to functions that are
8781 not known to bind locally.  It has no effect without @option{-mfdpic}.
8782 It's enabled by default if optimizing for speed and compiling for
8783 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
8784 optimization option such as @option{-O3} or above is present in the
8785 command line.
8786
8787 @item -mgprel-ro
8788 @opindex mgprel-ro
8789
8790 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
8791 that is known to be in read-only sections.  It's enabled by default,
8792 except for @option{-fpic} or @option{-fpie}: even though it may help
8793 make the global offset table smaller, it trades 1 instruction for 4.
8794 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
8795 one of which may be shared by multiple symbols, and it avoids the need
8796 for a GOT entry for the referenced symbol, so it's more likely to be a
8797 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
8798
8799 @item -multilib-library-pic
8800 @opindex multilib-library-pic
8801
8802 Link with the (library, not FD) pic libraries.  It's implied by
8803 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
8804 @option{-fpic} without @option{-mfdpic}.  You should never have to use
8805 it explicitly.
8806
8807 @item -mlinked-fp
8808 @opindex mlinked-fp
8809
8810 Follow the EABI requirement of always creating a frame pointer whenever
8811 a stack frame is allocated.  This option is enabled by default and can
8812 be disabled with @option{-mno-linked-fp}.
8813
8814 @item -mlong-calls
8815 @opindex mno-long-calls
8816 Generate code that uses long call sequences.  This ensures that a call
8817 is always able to reach linker generated stubs.  The default is to generate
8818 long calls only when the distance from the call site to the beginning
8819 of the function or translation unit, as the case may be, exceeds a
8820 predefined limit set by the branch type being used.  The limits for
8821 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8822 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8823 240,000 bytes.
8824
8825 Distances are measured from the beginning of functions when using the
8826 @option{-ffunction-sections} option, or when using the @option{-mgas}
8827 and @option{-mno-portable-runtime} options together under HP-UX with
8828 the SOM linker.
8829
8830 It is normally not desirable to use this option as it will degrade
8831 performance.  However, it may be useful in large applications,
8832 particularly when partial linking is used to build the application.
8833
8834 The types of long calls used depends on the capabilities of the
8835 assembler and linker, and the type of code being generated.  The
8836 impact on systems that support long absolute calls, and long pic
8837 symbol-difference or pc-relative calls should be relatively small.
8838 However, an indirect call is used on 32-bit ELF systems in pic code
8839 and it is quite long.
8840
8841 @item -nolibdld
8842 @opindex nolibdld
8843 Suppress the generation of link options to search libdld.sl when the
8844 @option{-static} option is specified on HP-UX 10 and later.
8845
8846 @item -static
8847 @opindex static
8848 The HP-UX implementation of setlocale in libc has a dependency on
8849 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8850 when the @option{-static} option is specified, special link options
8851 are needed to resolve this dependency.
8852
8853 On HP-UX 10 and later, the GCC driver adds the necessary options to
8854 link with libdld.sl when the @option{-static} option is specified.
8855 This causes the resulting binary to be dynamic.  On the 64-bit port,
8856 the linkers generate dynamic binaries by default in any case.  The
8857 @option{-nolibdld} option can be used to prevent the GCC driver from
8858 adding these link options.
8859
8860 @item -threads
8861 @opindex threads
8862 Add support for multithreading with the @dfn{dce thread} library
8863 under HP-UX.  This option sets flags for both the preprocessor and
8864 linker.
8865 @end table
8866
8867 @node DEC Alpha Options
8868 @subsection DEC Alpha Options
8869
8870 These @samp{-m} options are defined for the DEC Alpha implementations:
8871
8872 @table @gcctabopt
8873 @item -mno-soft-float
8874 @itemx -msoft-float
8875 @opindex mno-soft-float
8876 @opindex msoft-float
8877 Use (do not use) the hardware floating-point instructions for
8878 floating-point operations.  When @option{-msoft-float} is specified,
8879 functions in @file{libgcc.a} will be used to perform floating-point
8880 operations.  Unless they are replaced by routines that emulate the
8881 floating-point operations, or compiled in such a way as to call such
8882 emulations routines, these routines will issue floating-point
8883 operations.   If you are compiling for an Alpha without floating-point
8884 operations, you must ensure that the library is built so as not to call
8885 them.
8886
8887 Note that Alpha implementations without floating-point operations are
8888 required to have floating-point registers.
8889
8890 @item -mfp-reg
8891 @itemx -mno-fp-regs
8892 @opindex mfp-reg
8893 @opindex mno-fp-regs
8894 Generate code that uses (does not use) the floating-point register set.
8895 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8896 register set is not used, floating point operands are passed in integer
8897 registers as if they were integers and floating-point results are passed
8898 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8899 so any function with a floating-point argument or return value called by code
8900 compiled with @option{-mno-fp-regs} must also be compiled with that
8901 option.
8902
8903 A typical use of this option is building a kernel that does not use,
8904 and hence need not save and restore, any floating-point registers.
8905
8906 @item -mieee
8907 @opindex mieee
8908 The Alpha architecture implements floating-point hardware optimized for
8909 maximum performance.  It is mostly compliant with the IEEE floating
8910 point standard.  However, for full compliance, software assistance is
8911 required.  This option generates code fully IEEE compliant code
8912 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8913 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8914 defined during compilation.  The resulting code is less efficient but is
8915 able to correctly support denormalized numbers and exceptional IEEE
8916 values such as not-a-number and plus/minus infinity.  Other Alpha
8917 compilers call this option @option{-ieee_with_no_inexact}.
8918
8919 @item -mieee-with-inexact
8920 @opindex mieee-with-inexact
8921 This is like @option{-mieee} except the generated code also maintains
8922 the IEEE @var{inexact-flag}.  Turning on this option causes the
8923 generated code to implement fully-compliant IEEE math.  In addition to
8924 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8925 macro.  On some Alpha implementations the resulting code may execute
8926 significantly slower than the code generated by default.  Since there is
8927 very little code that depends on the @var{inexact-flag}, you should
8928 normally not specify this option.  Other Alpha compilers call this
8929 option @option{-ieee_with_inexact}.
8930
8931 @item -mfp-trap-mode=@var{trap-mode}
8932 @opindex mfp-trap-mode
8933 This option controls what floating-point related traps are enabled.
8934 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8935 The trap mode can be set to one of four values:
8936
8937 @table @samp
8938 @item n
8939 This is the default (normal) setting.  The only traps that are enabled
8940 are the ones that cannot be disabled in software (e.g., division by zero
8941 trap).
8942
8943 @item u
8944 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8945 as well.
8946
8947 @item su
8948 Like @samp{su}, but the instructions are marked to be safe for software
8949 completion (see Alpha architecture manual for details).
8950
8951 @item sui
8952 Like @samp{su}, but inexact traps are enabled as well.
8953 @end table
8954
8955 @item -mfp-rounding-mode=@var{rounding-mode}
8956 @opindex mfp-rounding-mode
8957 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8958 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8959 of:
8960
8961 @table @samp
8962 @item n
8963 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8964 the nearest machine number or towards the even machine number in case
8965 of a tie.
8966
8967 @item m
8968 Round towards minus infinity.
8969
8970 @item c
8971 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8972
8973 @item d
8974 Dynamic rounding mode.  A field in the floating point control register
8975 (@var{fpcr}, see Alpha architecture reference manual) controls the
8976 rounding mode in effect.  The C library initializes this register for
8977 rounding towards plus infinity.  Thus, unless your program modifies the
8978 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8979 @end table
8980
8981 @item -mtrap-precision=@var{trap-precision}
8982 @opindex mtrap-precision
8983 In the Alpha architecture, floating point traps are imprecise.  This
8984 means without software assistance it is impossible to recover from a
8985 floating trap and program execution normally needs to be terminated.
8986 GCC can generate code that can assist operating system trap handlers
8987 in determining the exact location that caused a floating point trap.
8988 Depending on the requirements of an application, different levels of
8989 precisions can be selected:
8990
8991 @table @samp
8992 @item p
8993 Program precision.  This option is the default and means a trap handler
8994 can only identify which program caused a floating point exception.
8995
8996 @item f
8997 Function precision.  The trap handler can determine the function that
8998 caused a floating point exception.
8999
9000 @item i
9001 Instruction precision.  The trap handler can determine the exact
9002 instruction that caused a floating point exception.
9003 @end table
9004
9005 Other Alpha compilers provide the equivalent options called
9006 @option{-scope_safe} and @option{-resumption_safe}.
9007
9008 @item -mieee-conformant
9009 @opindex mieee-conformant
9010 This option marks the generated code as IEEE conformant.  You must not
9011 use this option unless you also specify @option{-mtrap-precision=i} and either
9012 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
9013 is to emit the line @samp{.eflag 48} in the function prologue of the
9014 generated assembly file.  Under DEC Unix, this has the effect that
9015 IEEE-conformant math library routines will be linked in.
9016
9017 @item -mbuild-constants
9018 @opindex mbuild-constants
9019 Normally GCC examines a 32- or 64-bit integer constant to
9020 see if it can construct it from smaller constants in two or three
9021 instructions.  If it cannot, it will output the constant as a literal and
9022 generate code to load it from the data segment at runtime.
9023
9024 Use this option to require GCC to construct @emph{all} integer constants
9025 using code, even if it takes more instructions (the maximum is six).
9026
9027 You would typically use this option to build a shared library dynamic
9028 loader.  Itself a shared library, it must relocate itself in memory
9029 before it can find the variables and constants in its own data segment.
9030
9031 @item -malpha-as
9032 @itemx -mgas
9033 @opindex malpha-as
9034 @opindex mgas
9035 Select whether to generate code to be assembled by the vendor-supplied
9036 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
9037
9038 @item -mbwx
9039 @itemx -mno-bwx
9040 @itemx -mcix
9041 @itemx -mno-cix
9042 @itemx -mfix
9043 @itemx -mno-fix
9044 @itemx -mmax
9045 @itemx -mno-max
9046 @opindex mbwx
9047 @opindex mno-bwx
9048 @opindex mcix
9049 @opindex mno-cix
9050 @opindex mfix
9051 @opindex mno-fix
9052 @opindex mmax
9053 @opindex mno-max
9054 Indicate whether GCC should generate code to use the optional BWX,
9055 CIX, FIX and MAX instruction sets.  The default is to use the instruction
9056 sets supported by the CPU type specified via @option{-mcpu=} option or that
9057 of the CPU on which GCC was built if none was specified.
9058
9059 @item -mfloat-vax
9060 @itemx -mfloat-ieee
9061 @opindex mfloat-vax
9062 @opindex mfloat-ieee
9063 Generate code that uses (does not use) VAX F and G floating point
9064 arithmetic instead of IEEE single and double precision.
9065
9066 @item -mexplicit-relocs
9067 @itemx -mno-explicit-relocs
9068 @opindex mexplicit-relocs
9069 @opindex mno-explicit-relocs
9070 Older Alpha assemblers provided no way to generate symbol relocations
9071 except via assembler macros.  Use of these macros does not allow
9072 optimal instruction scheduling.  GNU binutils as of version 2.12
9073 supports a new syntax that allows the compiler to explicitly mark
9074 which relocations should apply to which instructions.  This option
9075 is mostly useful for debugging, as GCC detects the capabilities of
9076 the assembler when it is built and sets the default accordingly.
9077
9078 @item -msmall-data
9079 @itemx -mlarge-data
9080 @opindex msmall-data
9081 @opindex mlarge-data
9082 When @option{-mexplicit-relocs} is in effect, static data is
9083 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
9084 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
9085 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
9086 16-bit relocations off of the @code{$gp} register.  This limits the
9087 size of the small data area to 64KB, but allows the variables to be
9088 directly accessed via a single instruction.
9089
9090 The default is @option{-mlarge-data}.  With this option the data area
9091 is limited to just below 2GB.  Programs that require more than 2GB of
9092 data must use @code{malloc} or @code{mmap} to allocate the data in the
9093 heap instead of in the program's data segment.
9094
9095 When generating code for shared libraries, @option{-fpic} implies
9096 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
9097
9098 @item -msmall-text
9099 @itemx -mlarge-text
9100 @opindex msmall-text
9101 @opindex mlarge-text
9102 When @option{-msmall-text} is used, the compiler assumes that the
9103 code of the entire program (or shared library) fits in 4MB, and is
9104 thus reachable with a branch instruction.  When @option{-msmall-data}
9105 is used, the compiler can assume that all local symbols share the
9106 same @code{$gp} value, and thus reduce the number of instructions
9107 required for a function call from 4 to 1.
9108
9109 The default is @option{-mlarge-text}.
9110
9111 @item -mcpu=@var{cpu_type}
9112 @opindex mcpu
9113 Set the instruction set and instruction scheduling parameters for
9114 machine type @var{cpu_type}.  You can specify either the @samp{EV}
9115 style name or the corresponding chip number.  GCC supports scheduling
9116 parameters for the EV4, EV5 and EV6 family of processors and will
9117 choose the default values for the instruction set from the processor
9118 you specify.  If you do not specify a processor type, GCC will default
9119 to the processor on which the compiler was built.
9120
9121 Supported values for @var{cpu_type} are
9122
9123 @table @samp
9124 @item ev4
9125 @itemx ev45
9126 @itemx 21064
9127 Schedules as an EV4 and has no instruction set extensions.
9128
9129 @item ev5
9130 @itemx 21164
9131 Schedules as an EV5 and has no instruction set extensions.
9132
9133 @item ev56
9134 @itemx 21164a
9135 Schedules as an EV5 and supports the BWX extension.
9136
9137 @item pca56
9138 @itemx 21164pc
9139 @itemx 21164PC
9140 Schedules as an EV5 and supports the BWX and MAX extensions.
9141
9142 @item ev6
9143 @itemx 21264
9144 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
9145
9146 @item ev67
9147 @itemx 21264a
9148 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
9149 @end table
9150
9151 @item -mtune=@var{cpu_type}
9152 @opindex mtune
9153 Set only the instruction scheduling parameters for machine type
9154 @var{cpu_type}.  The instruction set is not changed.
9155
9156 @item -mmemory-latency=@var{time}
9157 @opindex mmemory-latency
9158 Sets the latency the scheduler should assume for typical memory
9159 references as seen by the application.  This number is highly
9160 dependent on the memory access patterns used by the application
9161 and the size of the external cache on the machine.
9162
9163 Valid options for @var{time} are
9164
9165 @table @samp
9166 @item @var{number}
9167 A decimal number representing clock cycles.
9168
9169 @item L1
9170 @itemx L2
9171 @itemx L3
9172 @itemx main
9173 The compiler contains estimates of the number of clock cycles for
9174 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9175 (also called Dcache, Scache, and Bcache), as well as to main memory.
9176 Note that L3 is only valid for EV5.
9177
9178 @end table
9179 @end table
9180
9181 @node DEC Alpha/VMS Options
9182 @subsection DEC Alpha/VMS Options
9183
9184 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9185
9186 @table @gcctabopt
9187 @item -mvms-return-codes
9188 @opindex mvms-return-codes
9189 Return VMS condition codes from main.  The default is to return POSIX
9190 style condition (e.g.@ error) codes.
9191 @end table
9192
9193 @node H8/300 Options
9194 @subsection H8/300 Options
9195
9196 These @samp{-m} options are defined for the H8/300 implementations:
9197
9198 @table @gcctabopt
9199 @item -mrelax
9200 @opindex mrelax
9201 Shorten some address references at link time, when possible; uses the
9202 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
9203 ld, Using ld}, for a fuller description.
9204
9205 @item -mh
9206 @opindex mh
9207 Generate code for the H8/300H@.
9208
9209 @item -ms
9210 @opindex ms
9211 Generate code for the H8S@.
9212
9213 @item -mn
9214 @opindex mn
9215 Generate code for the H8S and H8/300H in the normal mode.  This switch
9216 must be used either with -mh or -ms.
9217
9218 @item -ms2600
9219 @opindex ms2600
9220 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
9221
9222 @item -mint32
9223 @opindex mint32
9224 Make @code{int} data 32 bits by default.
9225
9226 @item -malign-300
9227 @opindex malign-300
9228 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9229 The default for the H8/300H and H8S is to align longs and floats on 4
9230 byte boundaries.
9231 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9232 This option has no effect on the H8/300.
9233 @end table
9234
9235 @node SH Options
9236 @subsection SH Options
9237
9238 These @samp{-m} options are defined for the SH implementations:
9239
9240 @table @gcctabopt
9241 @item -m1
9242 @opindex m1
9243 Generate code for the SH1.
9244
9245 @item -m2
9246 @opindex m2
9247 Generate code for the SH2.
9248
9249 @item -m2e
9250 Generate code for the SH2e.
9251
9252 @item -m3
9253 @opindex m3
9254 Generate code for the SH3.
9255
9256 @item -m3e
9257 @opindex m3e
9258 Generate code for the SH3e.
9259
9260 @item -m4-nofpu
9261 @opindex m4-nofpu
9262 Generate code for the SH4 without a floating-point unit.
9263
9264 @item -m4-single-only
9265 @opindex m4-single-only
9266 Generate code for the SH4 with a floating-point unit that only
9267 supports single-precision arithmetic.
9268
9269 @item -m4-single
9270 @opindex m4-single
9271 Generate code for the SH4 assuming the floating-point unit is in
9272 single-precision mode by default.
9273
9274 @item -m4
9275 @opindex m4
9276 Generate code for the SH4.
9277
9278 @item -mb
9279 @opindex mb
9280 Compile code for the processor in big endian mode.
9281
9282 @item -ml
9283 @opindex ml
9284 Compile code for the processor in little endian mode.
9285
9286 @item -mdalign
9287 @opindex mdalign
9288 Align doubles at 64-bit boundaries.  Note that this changes the calling
9289 conventions, and thus some functions from the standard C library will
9290 not work unless you recompile it first with @option{-mdalign}.
9291
9292 @item -mrelax
9293 @opindex mrelax
9294 Shorten some address references at link time, when possible; uses the
9295 linker option @option{-relax}.
9296
9297 @item -mbigtable
9298 @opindex mbigtable
9299 Use 32-bit offsets in @code{switch} tables.  The default is to use
9300 16-bit offsets.
9301
9302 @item -mfmovd
9303 @opindex mfmovd
9304 Enable the use of the instruction @code{fmovd}.
9305
9306 @item -mhitachi
9307 @opindex mhitachi
9308 Comply with the calling conventions defined by Renesas.
9309
9310 @item -mnomacsave
9311 @opindex mnomacsave
9312 Mark the @code{MAC} register as call-clobbered, even if
9313 @option{-mhitachi} is given.
9314
9315 @item -mieee
9316 @opindex mieee
9317 Increase IEEE-compliance of floating-point code.
9318
9319 @item -misize
9320 @opindex misize
9321 Dump instruction size and location in the assembly code.
9322
9323 @item -mpadstruct
9324 @opindex mpadstruct
9325 This option is deprecated.  It pads structures to multiple of 4 bytes,
9326 which is incompatible with the SH ABI@.
9327
9328 @item -mspace
9329 @opindex mspace
9330 Optimize for space instead of speed.  Implied by @option{-Os}.
9331
9332 @item -mprefergot
9333 @opindex mprefergot
9334 When generating position-independent code, emit function calls using
9335 the Global Offset Table instead of the Procedure Linkage Table.
9336
9337 @item -musermode
9338 @opindex musermode
9339 Generate a library function call to invalidate instruction cache
9340 entries, after fixing up a trampoline.  This library function call
9341 doesn't assume it can write to the whole memory address space.  This
9342 is the default when the target is @code{sh-*-linux*}.
9343 @end table
9344
9345 @node System V Options
9346 @subsection Options for System V
9347
9348 These additional options are available on System V Release 4 for
9349 compatibility with other compilers on those systems:
9350
9351 @table @gcctabopt
9352 @item -G
9353 @opindex G
9354 Create a shared object.
9355 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
9356
9357 @item -Qy
9358 @opindex Qy
9359 Identify the versions of each tool used by the compiler, in a
9360 @code{.ident} assembler directive in the output.
9361
9362 @item -Qn
9363 @opindex Qn
9364 Refrain from adding @code{.ident} directives to the output file (this is
9365 the default).
9366
9367 @item -YP,@var{dirs}
9368 @opindex YP
9369 Search the directories @var{dirs}, and no others, for libraries
9370 specified with @option{-l}.
9371
9372 @item -Ym,@var{dir}
9373 @opindex Ym
9374 Look in the directory @var{dir} to find the M4 preprocessor.
9375 The assembler uses this option.
9376 @c This is supposed to go with a -Yd for predefined M4 macro files, but
9377 @c the generic assembler that comes with Solaris takes just -Ym.
9378 @end table
9379
9380 @node TMS320C3x/C4x Options
9381 @subsection TMS320C3x/C4x Options
9382 @cindex TMS320C3x/C4x Options
9383
9384 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
9385
9386 @table @gcctabopt
9387
9388 @item -mcpu=@var{cpu_type}
9389 @opindex mcpu
9390 Set the instruction set, register set, and instruction scheduling
9391 parameters for machine type @var{cpu_type}.  Supported values for
9392 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
9393 @samp{c44}.  The default is @samp{c40} to generate code for the
9394 TMS320C40.
9395
9396 @item -mbig-memory
9397 @itemx -mbig
9398 @itemx -msmall-memory
9399 @itemx -msmall
9400 @opindex mbig-memory
9401 @opindex mbig
9402 @opindex msmall-memory
9403 @opindex msmall
9404 Generates code for the big or small memory model.  The small memory
9405 model assumed that all data fits into one 64K word page.  At run-time
9406 the data page (DP) register must be set to point to the 64K page
9407 containing the .bss and .data program sections.  The big memory model is
9408 the default and requires reloading of the DP register for every direct
9409 memory access.
9410
9411 @item -mbk
9412 @itemx -mno-bk
9413 @opindex mbk
9414 @opindex mno-bk
9415 Allow (disallow) allocation of general integer operands into the block
9416 count register BK@.
9417
9418 @item -mdb
9419 @itemx -mno-db
9420 @opindex mdb
9421 @opindex mno-db
9422 Enable (disable) generation of code using decrement and branch,
9423 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
9424 on the safe side, this is disabled for the C3x, since the maximum
9425 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
9426 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
9427 that it can utilize the decrement and branch instruction, but will give
9428 up if there is more than one memory reference in the loop.  Thus a loop
9429 where the loop counter is decremented can generate slightly more
9430 efficient code, in cases where the RPTB instruction cannot be utilized.
9431
9432 @item -mdp-isr-reload
9433 @itemx -mparanoid
9434 @opindex mdp-isr-reload
9435 @opindex mparanoid
9436 Force the DP register to be saved on entry to an interrupt service
9437 routine (ISR), reloaded to point to the data section, and restored on
9438 exit from the ISR@.  This should not be required unless someone has
9439 violated the small memory model by modifying the DP register, say within
9440 an object library.
9441
9442 @item -mmpyi
9443 @itemx -mno-mpyi
9444 @opindex mmpyi
9445 @opindex mno-mpyi
9446 For the C3x use the 24-bit MPYI instruction for integer multiplies
9447 instead of a library call to guarantee 32-bit results.  Note that if one
9448 of the operands is a constant, then the multiplication will be performed
9449 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
9450 then squaring operations are performed inline instead of a library call.
9451
9452 @item -mfast-fix
9453 @itemx -mno-fast-fix
9454 @opindex mfast-fix
9455 @opindex mno-fast-fix
9456 The C3x/C4x FIX instruction to convert a floating point value to an
9457 integer value chooses the nearest integer less than or equal to the
9458 floating point value rather than to the nearest integer.  Thus if the
9459 floating point number is negative, the result will be incorrectly
9460 truncated an additional code is necessary to detect and correct this
9461 case.  This option can be used to disable generation of the additional
9462 code required to correct the result.
9463
9464 @item -mrptb
9465 @itemx -mno-rptb
9466 @opindex mrptb
9467 @opindex mno-rptb
9468 Enable (disable) generation of repeat block sequences using the RPTB
9469 instruction for zero overhead looping.  The RPTB construct is only used
9470 for innermost loops that do not call functions or jump across the loop
9471 boundaries.  There is no advantage having nested RPTB loops due to the
9472 overhead required to save and restore the RC, RS, and RE registers.
9473 This is enabled by default with @option{-O2}.
9474
9475 @item -mrpts=@var{count}
9476 @itemx -mno-rpts
9477 @opindex mrpts
9478 @opindex mno-rpts
9479 Enable (disable) the use of the single instruction repeat instruction
9480 RPTS@.  If a repeat block contains a single instruction, and the loop
9481 count can be guaranteed to be less than the value @var{count}, GCC will
9482 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
9483 then a RPTS will be emitted even if the loop count cannot be determined
9484 at compile time.  Note that the repeated instruction following RPTS does
9485 not have to be reloaded from memory each iteration, thus freeing up the
9486 CPU buses for operands.  However, since interrupts are blocked by this
9487 instruction, it is disabled by default.
9488
9489 @item -mloop-unsigned
9490 @itemx -mno-loop-unsigned
9491 @opindex mloop-unsigned
9492 @opindex mno-loop-unsigned
9493 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
9494 is @math{2^{31} + 1} since these instructions test if the iteration count is
9495 negative to terminate the loop.  If the iteration count is unsigned
9496 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
9497 exceeded.  This switch allows an unsigned iteration count.
9498
9499 @item -mti
9500 @opindex mti
9501 Try to emit an assembler syntax that the TI assembler (asm30) is happy
9502 with.  This also enforces compatibility with the API employed by the TI
9503 C3x C compiler.  For example, long doubles are passed as structures
9504 rather than in floating point registers.
9505
9506 @item -mregparm
9507 @itemx -mmemparm
9508 @opindex mregparm
9509 @opindex mmemparm
9510 Generate code that uses registers (stack) for passing arguments to functions.
9511 By default, arguments are passed in registers where possible rather
9512 than by pushing arguments on to the stack.
9513
9514 @item -mparallel-insns
9515 @itemx -mno-parallel-insns
9516 @opindex mparallel-insns
9517 @opindex mno-parallel-insns
9518 Allow the generation of parallel instructions.  This is enabled by
9519 default with @option{-O2}.
9520
9521 @item -mparallel-mpy
9522 @itemx -mno-parallel-mpy
9523 @opindex mparallel-mpy
9524 @opindex mno-parallel-mpy
9525 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
9526 provided @option{-mparallel-insns} is also specified.  These instructions have
9527 tight register constraints which can pessimize the code generation
9528 of large functions.
9529
9530 @end table
9531
9532 @node V850 Options
9533 @subsection V850 Options
9534 @cindex V850 Options
9535
9536 These @samp{-m} options are defined for V850 implementations:
9537
9538 @table @gcctabopt
9539 @item -mlong-calls
9540 @itemx -mno-long-calls
9541 @opindex mlong-calls
9542 @opindex mno-long-calls
9543 Treat all calls as being far away (near).  If calls are assumed to be
9544 far away, the compiler will always load the functions address up into a
9545 register, and call indirect through the pointer.
9546
9547 @item -mno-ep
9548 @itemx -mep
9549 @opindex mno-ep
9550 @opindex mep
9551 Do not optimize (do optimize) basic blocks that use the same index
9552 pointer 4 or more times to copy pointer into the @code{ep} register, and
9553 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
9554 option is on by default if you optimize.
9555
9556 @item -mno-prolog-function
9557 @itemx -mprolog-function
9558 @opindex mno-prolog-function
9559 @opindex mprolog-function
9560 Do not use (do use) external functions to save and restore registers
9561 at the prologue and epilogue of a function.  The external functions
9562 are slower, but use less code space if more than one function saves
9563 the same number of registers.  The @option{-mprolog-function} option
9564 is on by default if you optimize.
9565
9566 @item -mspace
9567 @opindex mspace
9568 Try to make the code as small as possible.  At present, this just turns
9569 on the @option{-mep} and @option{-mprolog-function} options.
9570
9571 @item -mtda=@var{n}
9572 @opindex mtda
9573 Put static or global variables whose size is @var{n} bytes or less into
9574 the tiny data area that register @code{ep} points to.  The tiny data
9575 area can hold up to 256 bytes in total (128 bytes for byte references).
9576
9577 @item -msda=@var{n}
9578 @opindex msda
9579 Put static or global variables whose size is @var{n} bytes or less into
9580 the small data area that register @code{gp} points to.  The small data
9581 area can hold up to 64 kilobytes.
9582
9583 @item -mzda=@var{n}
9584 @opindex mzda
9585 Put static or global variables whose size is @var{n} bytes or less into
9586 the first 32 kilobytes of memory.
9587
9588 @item -mv850
9589 @opindex mv850
9590 Specify that the target processor is the V850.
9591
9592 @item -mbig-switch
9593 @opindex mbig-switch
9594 Generate code suitable for big switch tables.  Use this option only if
9595 the assembler/linker complain about out of range branches within a switch
9596 table.
9597
9598 @item -mapp-regs
9599 @opindex mapp-regs
9600 This option will cause r2 and r5 to be used in the code generated by
9601 the compiler.  This setting is the default.
9602
9603 @item -mno-app-regs
9604 @opindex mno-app-regs
9605 This option will cause r2 and r5 to be treated as fixed registers.
9606
9607 @item -mv850e1
9608 @opindex mv850e1
9609 Specify that the target processor is the V850E1.  The preprocessor
9610 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
9611 this option is used.
9612
9613 @item -mv850e
9614 @opindex mv850e
9615 Specify that the target processor is the V850E.  The preprocessor
9616 constant @samp{__v850e__} will be defined if this option is used.
9617
9618 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
9619 are defined then a default target processor will be chosen and the
9620 relevant @samp{__v850*__} preprocessor constant will be defined.
9621
9622 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9623 defined, regardless of which processor variant is the target.
9624
9625 @item -mdisable-callt
9626 @opindex mdisable-callt
9627 This option will suppress generation of the CALLT instruction for the
9628 v850e and v850e1 flavors of the v850 architecture.  The default is
9629 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
9630
9631 @end table
9632
9633 @node ARC Options
9634 @subsection ARC Options
9635 @cindex ARC Options
9636
9637 These options are defined for ARC implementations:
9638
9639 @table @gcctabopt
9640 @item -EL
9641 @opindex EL
9642 Compile code for little endian mode.  This is the default.
9643
9644 @item -EB
9645 @opindex EB
9646 Compile code for big endian mode.
9647
9648 @item -mmangle-cpu
9649 @opindex mmangle-cpu
9650 Prepend the name of the cpu to all public symbol names.
9651 In multiple-processor systems, there are many ARC variants with different
9652 instruction and register set characteristics.  This flag prevents code
9653 compiled for one cpu to be linked with code compiled for another.
9654 No facility exists for handling variants that are ``almost identical''.
9655 This is an all or nothing option.
9656
9657 @item -mcpu=@var{cpu}
9658 @opindex mcpu
9659 Compile code for ARC variant @var{cpu}.
9660 Which variants are supported depend on the configuration.
9661 All variants support @option{-mcpu=base}, this is the default.
9662
9663 @item -mtext=@var{text-section}
9664 @itemx -mdata=@var{data-section}
9665 @itemx -mrodata=@var{readonly-data-section}
9666 @opindex mtext
9667 @opindex mdata
9668 @opindex mrodata
9669 Put functions, data, and readonly data in @var{text-section},
9670 @var{data-section}, and @var{readonly-data-section} respectively
9671 by default.  This can be overridden with the @code{section} attribute.
9672 @xref{Variable Attributes}.
9673
9674 @end table
9675
9676 @node NS32K Options
9677 @subsection NS32K Options
9678 @cindex NS32K options
9679
9680 These are the @samp{-m} options defined for the 32000 series.  The default
9681 values for these options depends on which style of 32000 was selected when
9682 the compiler was configured; the defaults for the most common choices are
9683 given below.
9684
9685 @table @gcctabopt
9686 @item -m32032
9687 @itemx -m32032
9688 @opindex m32032
9689 @opindex m32032
9690 Generate output for a 32032.  This is the default
9691 when the compiler is configured for 32032 and 32016 based systems.
9692
9693 @item -m32332
9694 @itemx -m32332
9695 @opindex m32332
9696 @opindex m32332
9697 Generate output for a 32332.  This is the default
9698 when the compiler is configured for 32332-based systems.
9699
9700 @item -m32532
9701 @itemx -m32532
9702 @opindex m32532
9703 @opindex m32532
9704 Generate output for a 32532.  This is the default
9705 when the compiler is configured for 32532-based systems.
9706
9707 @item -m32081
9708 @opindex m32081
9709 Generate output containing 32081 instructions for floating point.
9710 This is the default for all systems.
9711
9712 @item -m32381
9713 @opindex m32381
9714 Generate output containing 32381 instructions for floating point.  This
9715 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9716 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9717
9718 @item -mmulti-add
9719 @opindex mmulti-add
9720 Try and generate multiply-add floating point instructions @code{polyF}
9721 and @code{dotF}.  This option is only available if the @option{-m32381}
9722 option is in effect.  Using these instructions requires changes to
9723 register allocation which generally has a negative impact on
9724 performance.  This option should only be enabled when compiling code
9725 particularly likely to make heavy use of multiply-add instructions.
9726
9727 @item -mnomulti-add
9728 @opindex mnomulti-add
9729 Do not try and generate multiply-add floating point instructions
9730 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9731
9732 @item -msoft-float
9733 @opindex msoft-float
9734 Generate output containing library calls for floating point.
9735 @strong{Warning:} the requisite libraries may not be available.
9736
9737 @item -mieee-compare
9738 @itemx -mno-ieee-compare
9739 @opindex mieee-compare
9740 @opindex mno-ieee-compare
9741 Control whether or not the compiler uses IEEE floating point
9742 comparisons.  These handle correctly the case where the result of a
9743 comparison is unordered.
9744 @strong{Warning:} the requisite kernel support may not be available.
9745
9746 @item -mnobitfield
9747 @opindex mnobitfield
9748 Do not use the bit-field instructions.  On some machines it is faster to
9749 use shifting and masking operations.  This is the default for the pc532.
9750
9751 @item -mbitfield
9752 @opindex mbitfield
9753 Do use the bit-field instructions.  This is the default for all platforms
9754 except the pc532.
9755
9756 @item -mrtd
9757 @opindex mrtd
9758 Use a different function-calling convention, in which functions
9759 that take a fixed number of arguments return pop their
9760 arguments on return with the @code{ret} instruction.
9761
9762 This calling convention is incompatible with the one normally
9763 used on Unix, so you cannot use it if you need to call libraries
9764 compiled with the Unix compiler.
9765
9766 Also, you must provide function prototypes for all functions that
9767 take variable numbers of arguments (including @code{printf});
9768 otherwise incorrect code will be generated for calls to those
9769 functions.
9770
9771 In addition, seriously incorrect code will result if you call a
9772 function with too many arguments.  (Normally, extra arguments are
9773 harmlessly ignored.)
9774
9775 This option takes its name from the 680x0 @code{rtd} instruction.
9776
9777
9778 @item -mregparam
9779 @opindex mregparam
9780 Use a different function-calling convention where the first two arguments
9781 are passed in registers.
9782
9783 This calling convention is incompatible with the one normally
9784 used on Unix, so you cannot use it if you need to call libraries
9785 compiled with the Unix compiler.
9786
9787 @item -mnoregparam
9788 @opindex mnoregparam
9789 Do not pass any arguments in registers.  This is the default for all
9790 targets.
9791
9792 @item -msb
9793 @opindex msb
9794 It is OK to use the sb as an index register which is always loaded with
9795 zero.  This is the default for the pc532-netbsd target.
9796
9797 @item -mnosb
9798 @opindex mnosb
9799 The sb register is not available for use or has not been initialized to
9800 zero by the run time system.  This is the default for all targets except
9801 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9802 @option{-fpic} is set.
9803
9804 @item -mhimem
9805 @opindex mhimem
9806 Many ns32000 series addressing modes use displacements of up to 512MB@.
9807 If an address is above 512MB then displacements from zero can not be used.
9808 This option causes code to be generated which can be loaded above 512MB@.
9809 This may be useful for operating systems or ROM code.
9810
9811 @item -mnohimem
9812 @opindex mnohimem
9813 Assume code will be loaded in the first 512MB of virtual address space.
9814 This is the default for all platforms.
9815
9816
9817 @end table
9818
9819 @node AVR Options
9820 @subsection AVR Options
9821 @cindex AVR Options
9822
9823 These options are defined for AVR implementations:
9824
9825 @table @gcctabopt
9826 @item -mmcu=@var{mcu}
9827 @opindex mmcu
9828 Specify ATMEL AVR instruction set or MCU type.
9829
9830 Instruction set avr1 is for the minimal AVR core, not supported by the C
9831 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9832 attiny11, attiny12, attiny15, attiny28).
9833
9834 Instruction set avr2 (default) is for the classic AVR core with up to
9835 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9836 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9837 at90c8534, at90s8535).
9838
9839 Instruction set avr3 is for the classic AVR core with up to 128K program
9840 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9841
9842 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9843 memory space (MCU types: atmega8, atmega83, atmega85).
9844
9845 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9846 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9847 atmega64, atmega128, at43usb355, at94k).
9848
9849 @item -msize
9850 @opindex msize
9851 Output instruction sizes to the asm file.
9852
9853 @item -minit-stack=@var{N}
9854 @opindex minit-stack
9855 Specify the initial stack address, which may be a symbol or numeric value,
9856 @samp{__stack} is the default.
9857
9858 @item -mno-interrupts
9859 @opindex mno-interrupts
9860 Generated code is not compatible with hardware interrupts.
9861 Code size will be smaller.
9862
9863 @item -mcall-prologues
9864 @opindex mcall-prologues
9865 Functions prologues/epilogues expanded as call to appropriate
9866 subroutines.  Code size will be smaller.
9867
9868 @item -mno-tablejump
9869 @opindex mno-tablejump
9870 Do not generate tablejump insns which sometimes increase code size.
9871
9872 @item -mtiny-stack
9873 @opindex mtiny-stack
9874 Change only the low 8 bits of the stack pointer.
9875 @end table
9876
9877 @node MCore Options
9878 @subsection MCore Options
9879 @cindex MCore options
9880
9881 These are the @samp{-m} options defined for the Motorola M*Core
9882 processors.
9883
9884 @table @gcctabopt
9885
9886 @item -mhardlit
9887 @itemx -mno-hardlit
9888 @opindex mhardlit
9889 @opindex mno-hardlit
9890 Inline constants into the code stream if it can be done in two
9891 instructions or less.
9892
9893 @item -mdiv
9894 @itemx -mno-div
9895 @opindex mdiv
9896 @opindex mno-div
9897 Use the divide instruction.  (Enabled by default).
9898
9899 @item -mrelax-immediate
9900 @itemx -mno-relax-immediate
9901 @opindex mrelax-immediate
9902 @opindex mno-relax-immediate
9903 Allow arbitrary sized immediates in bit operations.
9904
9905 @item -mwide-bitfields
9906 @itemx -mno-wide-bitfields
9907 @opindex mwide-bitfields
9908 @opindex mno-wide-bitfields
9909 Always treat bit-fields as int-sized.
9910
9911 @item -m4byte-functions
9912 @itemx -mno-4byte-functions
9913 @opindex m4byte-functions
9914 @opindex mno-4byte-functions
9915 Force all functions to be aligned to a four byte boundary.
9916
9917 @item -mcallgraph-data
9918 @itemx -mno-callgraph-data
9919 @opindex mcallgraph-data
9920 @opindex mno-callgraph-data
9921 Emit callgraph information.
9922
9923 @item -mslow-bytes
9924 @itemx -mno-slow-bytes
9925 @opindex mslow-bytes
9926 @opindex mno-slow-bytes
9927 Prefer word access when reading byte quantities.
9928
9929 @item -mlittle-endian
9930 @itemx -mbig-endian
9931 @opindex mlittle-endian
9932 @opindex mbig-endian
9933 Generate code for a little endian target.
9934
9935 @item -m210
9936 @itemx -m340
9937 @opindex m210
9938 @opindex m340
9939 Generate code for the 210 processor.
9940 @end table
9941
9942 @node IA-64 Options
9943 @subsection IA-64 Options
9944 @cindex IA-64 Options
9945
9946 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9947
9948 @table @gcctabopt
9949 @item -mbig-endian
9950 @opindex mbig-endian
9951 Generate code for a big endian target.  This is the default for HP-UX@.
9952
9953 @item -mlittle-endian
9954 @opindex mlittle-endian
9955 Generate code for a little endian target.  This is the default for AIX5
9956 and GNU/Linux.
9957
9958 @item -mgnu-as
9959 @itemx -mno-gnu-as
9960 @opindex mgnu-as
9961 @opindex mno-gnu-as
9962 Generate (or don't) code for the GNU assembler.  This is the default.
9963 @c Also, this is the default if the configure option @option{--with-gnu-as}
9964 @c is used.
9965
9966 @item -mgnu-ld
9967 @itemx -mno-gnu-ld
9968 @opindex mgnu-ld
9969 @opindex mno-gnu-ld
9970 Generate (or don't) code for the GNU linker.  This is the default.
9971 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9972 @c is used.
9973
9974 @item -mno-pic
9975 @opindex mno-pic
9976 Generate code that does not use a global pointer register.  The result
9977 is not position independent code, and violates the IA-64 ABI@.
9978
9979 @item -mvolatile-asm-stop
9980 @itemx -mno-volatile-asm-stop
9981 @opindex mvolatile-asm-stop
9982 @opindex mno-volatile-asm-stop
9983 Generate (or don't) a stop bit immediately before and after volatile asm
9984 statements.
9985
9986 @item -mb-step
9987 @opindex mb-step
9988 Generate code that works around Itanium B step errata.
9989
9990 @item -mregister-names
9991 @itemx -mno-register-names
9992 @opindex mregister-names
9993 @opindex mno-register-names
9994 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9995 the stacked registers.  This may make assembler output more readable.
9996
9997 @item -mno-sdata
9998 @itemx -msdata
9999 @opindex mno-sdata
10000 @opindex msdata
10001 Disable (or enable) optimizations that use the small data section.  This may
10002 be useful for working around optimizer bugs.
10003
10004 @item -mconstant-gp
10005 @opindex mconstant-gp
10006 Generate code that uses a single constant global pointer value.  This is
10007 useful when compiling kernel code.
10008
10009 @item -mauto-pic
10010 @opindex mauto-pic
10011 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
10012 This is useful when compiling firmware code.
10013
10014 @item -minline-float-divide-min-latency
10015 @opindex minline-float-divide-min-latency
10016 Generate code for inline divides of floating point values
10017 using the minimum latency algorithm.
10018
10019 @item -minline-float-divide-max-throughput
10020 @opindex minline-float-divide-max-throughput
10021 Generate code for inline divides of floating point values
10022 using the maximum throughput algorithm.
10023
10024 @item -minline-int-divide-min-latency
10025 @opindex minline-int-divide-min-latency
10026 Generate code for inline divides of integer values
10027 using the minimum latency algorithm.
10028
10029 @item -minline-int-divide-max-throughput
10030 @opindex minline-int-divide-max-throughput
10031 Generate code for inline divides of integer values
10032 using the maximum throughput algorithm.
10033
10034 @item -mno-dwarf2-asm
10035 @itemx -mdwarf2-asm
10036 @opindex mno-dwarf2-asm
10037 @opindex mdwarf2-asm
10038 Don't (or do) generate assembler code for the DWARF2 line number debugging
10039 info.  This may be useful when not using the GNU assembler.
10040
10041 @item -mfixed-range=@var{register-range}
10042 @opindex mfixed-range
10043 Generate code treating the given register range as fixed registers.
10044 A fixed register is one that the register allocator can not use.  This is
10045 useful when compiling kernel code.  A register range is specified as
10046 two registers separated by a dash.  Multiple register ranges can be
10047 specified separated by a comma.
10048
10049 @item -mearly-stop-bits
10050 @itemx -mno-early-stop-bits
10051 @opindex mearly-stop-bits
10052 @opindex mno-early-stop-bits
10053 Allow stop bits to be placed earlier than immediately preceding the
10054 instruction that triggered the stop bit.  This can improve instruction
10055 scheduling, but does not always do so.
10056 @end table
10057
10058 @node S/390 and zSeries Options
10059 @subsection S/390 and zSeries Options
10060 @cindex S/390 and zSeries Options
10061
10062 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
10063
10064 @table @gcctabopt
10065 @item -mhard-float
10066 @itemx -msoft-float
10067 @opindex mhard-float
10068 @opindex msoft-float
10069 Use (do not use) the hardware floating-point instructions and registers
10070 for floating-point operations.  When @option{-msoft-float} is specified,
10071 functions in @file{libgcc.a} will be used to perform floating-point
10072 operations.  When @option{-mhard-float} is specified, the compiler
10073 generates IEEE floating-point instructions.  This is the default.
10074
10075 @item -mbackchain
10076 @itemx -mno-backchain
10077 @opindex mbackchain
10078 @opindex mno-backchain
10079 Generate (or do not generate) code which maintains an explicit
10080 backchain within the stack frame that points to the caller's frame.
10081 This may be needed to allow debugging using tools that do not understand
10082 DWARF-2 call frame information.  The default is not to generate the
10083 backchain.
10084
10085 @item -msmall-exec
10086 @itemx -mno-small-exec
10087 @opindex msmall-exec
10088 @opindex mno-small-exec
10089 Generate (or do not generate) code using the @code{bras} instruction
10090 to do subroutine calls.
10091 This only works reliably if the total executable size does not
10092 exceed 64k.  The default is to use the @code{basr} instruction instead,
10093 which does not have this limitation.
10094
10095 @item -m64
10096 @itemx -m31
10097 @opindex m64
10098 @opindex m31
10099 When @option{-m31} is specified, generate code compliant to the
10100 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
10101 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
10102 particular to generate 64-bit instructions.  For the @samp{s390}
10103 targets, the default is @option{-m31}, while the @samp{s390x}
10104 targets default to @option{-m64}.
10105
10106 @item -mzarch
10107 @itemx -mesa
10108 @opindex mzarch
10109 @opindex mesa
10110 When @option{-mzarch} is specified, generate code using the
10111 instructions available on z/Architecture.
10112 When @option{-mesa} is specified, generate code using the
10113 instructions available on ESA/390. Note that @option{-mesa} is
10114 not possible with @option{-m64}.
10115 When generating code compliant to the GNU/Linux for S/390 ABI,
10116 the default is @option{-mesa}.  When generating code compliant
10117 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
10118
10119 @item -mmvcle
10120 @itemx -mno-mvcle
10121 @opindex mmvcle
10122 @opindex mno-mvcle
10123 Generate (or do not generate) code using the @code{mvcle} instruction
10124 to perform block moves.  When @option{-mno-mvcle} is specified,
10125 use a @code{mvc} loop instead.  This is the default.
10126
10127 @item -mdebug
10128 @itemx -mno-debug
10129 @opindex mdebug
10130 @opindex mno-debug
10131 Print (or do not print) additional debug information when compiling.
10132 The default is to not print debug information.
10133
10134 @item -march=@var{cpu-type}
10135 @opindex march
10136 Generate code that will run on @var{cpu-type}, which is the name of a system
10137 representing a certain processor type. Possible values for
10138 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
10139 When generating code using the instructions available on z/Architecture,
10140 the default is @option{-march=z900}.  Otherwise, the default is
10141 @option{-march=g5}.
10142
10143 @item -mtune=@var{cpu-type}
10144 @opindex mtune
10145 Tune to @var{cpu-type} everything applicable about the generated code,
10146 except for the ABI and the set of available instructions.
10147 The list of @var{cpu-type} values is the same as for @option{-march}.
10148 The default is the value used for @option{-march}.
10149
10150 @item -mfused-madd
10151 @itemx -mno-fused-madd
10152 @opindex mfused-madd
10153 @opindex mno-fused-madd
10154 Generate code that uses (does not use) the floating point multiply and
10155 accumulate instructions.  These instructions are generated by default if
10156 hardware floating point is used.
10157 @end table
10158
10159 @node CRIS Options
10160 @subsection CRIS Options
10161 @cindex CRIS Options
10162
10163 These options are defined specifically for the CRIS ports.
10164
10165 @table @gcctabopt
10166 @item -march=@var{architecture-type}
10167 @itemx -mcpu=@var{architecture-type}
10168 @opindex march
10169 @opindex mcpu
10170 Generate code for the specified architecture.  The choices for
10171 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10172 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
10173 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10174 @samp{v10}.
10175
10176 @item -mtune=@var{architecture-type}
10177 @opindex mtune
10178 Tune to @var{architecture-type} everything applicable about the generated
10179 code, except for the ABI and the set of available instructions.  The
10180 choices for @var{architecture-type} are the same as for
10181 @option{-march=@var{architecture-type}}.
10182
10183 @item -mmax-stack-frame=@var{n}
10184 @opindex mmax-stack-frame
10185 Warn when the stack frame of a function exceeds @var{n} bytes.
10186
10187 @item -melinux-stacksize=@var{n}
10188 @opindex melinux-stacksize
10189 Only available with the @samp{cris-axis-aout} target.  Arranges for
10190 indications in the program to the kernel loader that the stack of the
10191 program should be set to @var{n} bytes.
10192
10193 @item -metrax4
10194 @itemx -metrax100
10195 @opindex metrax4
10196 @opindex metrax100
10197 The options @option{-metrax4} and @option{-metrax100} are synonyms for
10198 @option{-march=v3} and @option{-march=v8} respectively.
10199
10200 @item -mmul-bug-workaround
10201 @itemx -mno-mul-bug-workaround
10202 @opindex mmul-bug-workaround
10203 @opindex mno-mul-bug-workaround
10204 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
10205 models where it applies.  This option is active by default.
10206
10207 @item -mpdebug
10208 @opindex mpdebug
10209 Enable CRIS-specific verbose debug-related information in the assembly
10210 code.  This option also has the effect to turn off the @samp{#NO_APP}
10211 formatted-code indicator to the assembler at the beginning of the
10212 assembly file.
10213
10214 @item -mcc-init
10215 @opindex mcc-init
10216 Do not use condition-code results from previous instruction; always emit
10217 compare and test instructions before use of condition codes.
10218
10219 @item -mno-side-effects
10220 @opindex mno-side-effects
10221 Do not emit instructions with side-effects in addressing modes other than
10222 post-increment.
10223
10224 @item -mstack-align
10225 @itemx -mno-stack-align
10226 @itemx -mdata-align
10227 @itemx -mno-data-align
10228 @itemx -mconst-align
10229 @itemx -mno-const-align
10230 @opindex mstack-align
10231 @opindex mno-stack-align
10232 @opindex mdata-align
10233 @opindex mno-data-align
10234 @opindex mconst-align
10235 @opindex mno-const-align
10236 These options (no-options) arranges (eliminate arrangements) for the
10237 stack-frame, individual data and constants to be aligned for the maximum
10238 single data access size for the chosen CPU model.  The default is to
10239 arrange for 32-bit alignment.  ABI details such as structure layout are
10240 not affected by these options.
10241
10242 @item -m32-bit
10243 @itemx -m16-bit
10244 @itemx -m8-bit
10245 @opindex m32-bit
10246 @opindex m16-bit
10247 @opindex m8-bit
10248 Similar to the stack- data- and const-align options above, these options
10249 arrange for stack-frame, writable data and constants to all be 32-bit,
10250 16-bit or 8-bit aligned.  The default is 32-bit alignment.
10251
10252 @item -mno-prologue-epilogue
10253 @itemx -mprologue-epilogue
10254 @opindex mno-prologue-epilogue
10255 @opindex mprologue-epilogue
10256 With @option{-mno-prologue-epilogue}, the normal function prologue and
10257 epilogue that sets up the stack-frame are omitted and no return
10258 instructions or return sequences are generated in the code.  Use this
10259 option only together with visual inspection of the compiled code: no
10260 warnings or errors are generated when call-saved registers must be saved,
10261 or storage for local variable needs to be allocated.
10262
10263 @item -mno-gotplt
10264 @itemx -mgotplt
10265 @opindex mno-gotplt
10266 @opindex mgotplt
10267 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10268 instruction sequences that load addresses for functions from the PLT part
10269 of the GOT rather than (traditional on other architectures) calls to the
10270 PLT.  The default is @option{-mgotplt}.
10271
10272 @item -maout
10273 @opindex maout
10274 Legacy no-op option only recognized with the cris-axis-aout target.
10275
10276 @item -melf
10277 @opindex melf
10278 Legacy no-op option only recognized with the cris-axis-elf and
10279 cris-axis-linux-gnu targets.
10280
10281 @item -melinux
10282 @opindex melinux
10283 Only recognized with the cris-axis-aout target, where it selects a
10284 GNU/linux-like multilib, include files and instruction set for
10285 @option{-march=v8}.
10286
10287 @item -mlinux
10288 @opindex mlinux
10289 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10290
10291 @item -sim
10292 @opindex sim
10293 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
10294 to link with input-output functions from a simulator library.  Code,
10295 initialized data and zero-initialized data are allocated consecutively.
10296
10297 @item -sim2
10298 @opindex sim2
10299 Like @option{-sim}, but pass linker options to locate initialized data at
10300 0x40000000 and zero-initialized data at 0x80000000.
10301 @end table
10302
10303 @node MMIX Options
10304 @subsection MMIX Options
10305 @cindex MMIX Options
10306
10307 These options are defined for the MMIX:
10308
10309 @table @gcctabopt
10310 @item -mlibfuncs
10311 @itemx -mno-libfuncs
10312 @opindex mlibfuncs
10313 @opindex mno-libfuncs
10314 Specify that intrinsic library functions are being compiled, passing all
10315 values in registers, no matter the size.
10316
10317 @item -mepsilon
10318 @itemx -mno-epsilon
10319 @opindex mepsilon
10320 @opindex mno-epsilon
10321 Generate floating-point comparison instructions that compare with respect
10322 to the @code{rE} epsilon register.
10323
10324 @item -mabi=mmixware
10325 @itemx -mabi=gnu
10326 @opindex mabi-mmixware
10327 @opindex mabi=gnu
10328 Generate code that passes function parameters and return values that (in
10329 the called function) are seen as registers @code{$0} and up, as opposed to
10330 the GNU ABI which uses global registers @code{$231} and up.
10331
10332 @item -mzero-extend
10333 @itemx -mno-zero-extend
10334 @opindex mzero-extend
10335 @opindex mno-zero-extend
10336 When reading data from memory in sizes shorter than 64 bits, use (do not
10337 use) zero-extending load instructions by default, rather than
10338 sign-extending ones.
10339
10340 @item -mknuthdiv
10341 @itemx -mno-knuthdiv
10342 @opindex mknuthdiv
10343 @opindex mno-knuthdiv
10344 Make the result of a division yielding a remainder have the same sign as
10345 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10346 remainder follows the sign of the dividend.  Both methods are
10347 arithmetically valid, the latter being almost exclusively used.
10348
10349 @item -mtoplevel-symbols
10350 @itemx -mno-toplevel-symbols
10351 @opindex mtoplevel-symbols
10352 @opindex mno-toplevel-symbols
10353 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10354 code can be used with the @code{PREFIX} assembly directive.
10355
10356 @item -melf
10357 @opindex melf
10358 Generate an executable in the ELF format, rather than the default
10359 @samp{mmo} format used by the @command{mmix} simulator.
10360
10361 @item -mbranch-predict
10362 @itemx -mno-branch-predict
10363 @opindex mbranch-predict
10364 @opindex mno-branch-predict
10365 Use (do not use) the probable-branch instructions, when static branch
10366 prediction indicates a probable branch.
10367
10368 @item -mbase-addresses
10369 @itemx -mno-base-addresses
10370 @opindex mbase-addresses
10371 @opindex mno-base-addresses
10372 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10373 base address automatically generates a request (handled by the assembler
10374 and the linker) for a constant to be set up in a global register.  The
10375 register is used for one or more base address requests within the range 0
10376 to 255 from the value held in the register.  The generally leads to short
10377 and fast code, but the number of different data items that can be
10378 addressed is limited.  This means that a program that uses lots of static
10379 data may require @option{-mno-base-addresses}.
10380
10381 @item -msingle-exit
10382 @itemx -mno-single-exit
10383 @opindex msingle-exit
10384 @opindex mno-single-exit
10385 Force (do not force) generated code to have a single exit point in each
10386 function.
10387 @end table
10388
10389 @node PDP-11 Options
10390 @subsection PDP-11 Options
10391 @cindex PDP-11 Options
10392
10393 These options are defined for the PDP-11:
10394
10395 @table @gcctabopt
10396 @item -mfpu
10397 @opindex mfpu
10398 Use hardware FPP floating point.  This is the default.  (FIS floating
10399 point on the PDP-11/40 is not supported.)
10400
10401 @item -msoft-float
10402 @opindex msoft-float
10403 Do not use hardware floating point.
10404
10405 @item -mac0
10406 @opindex mac0
10407 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10408
10409 @item -mno-ac0
10410 @opindex mno-ac0
10411 Return floating-point results in memory.  This is the default.
10412
10413 @item -m40
10414 @opindex m40
10415 Generate code for a PDP-11/40.
10416
10417 @item -m45
10418 @opindex m45
10419 Generate code for a PDP-11/45.  This is the default.
10420
10421 @item -m10
10422 @opindex m10
10423 Generate code for a PDP-11/10.
10424
10425 @item -mbcopy-builtin
10426 @opindex bcopy-builtin
10427 Use inline @code{movstrhi} patterns for copying memory.  This is the
10428 default.
10429
10430 @item -mbcopy
10431 @opindex mbcopy
10432 Do not use inline @code{movstrhi} patterns for copying memory.
10433
10434 @item -mint16
10435 @itemx -mno-int32
10436 @opindex mint16
10437 @opindex mno-int32
10438 Use 16-bit @code{int}.  This is the default.
10439
10440 @item -mint32
10441 @itemx -mno-int16
10442 @opindex mint32
10443 @opindex mno-int16
10444 Use 32-bit @code{int}.
10445
10446 @item -mfloat64
10447 @itemx -mno-float32
10448 @opindex mfloat64
10449 @opindex mno-float32
10450 Use 64-bit @code{float}.  This is the default.
10451
10452 @item -mfloat32
10453 @itemx -mno-float64
10454 @opindex mfloat32
10455 @opindex mno-float64
10456 Use 32-bit @code{float}.
10457
10458 @item -mabshi
10459 @opindex mabshi
10460 Use @code{abshi2} pattern.  This is the default.
10461
10462 @item -mno-abshi
10463 @opindex mno-abshi
10464 Do not use @code{abshi2} pattern.
10465
10466 @item -mbranch-expensive
10467 @opindex mbranch-expensive
10468 Pretend that branches are expensive.  This is for experimenting with
10469 code generation only.
10470
10471 @item -mbranch-cheap
10472 @opindex mbranch-cheap
10473 Do not pretend that branches are expensive.  This is the default.
10474
10475 @item -msplit
10476 @opindex msplit
10477 Generate code for a system with split I&D.
10478
10479 @item -mno-split
10480 @opindex mno-split
10481 Generate code for a system without split I&D.  This is the default.
10482
10483 @item -munix-asm
10484 @opindex munix-asm
10485 Use Unix assembler syntax.  This is the default when configured for
10486 @samp{pdp11-*-bsd}.
10487
10488 @item -mdec-asm
10489 @opindex mdec-asm
10490 Use DEC assembler syntax.  This is the default when configured for any
10491 PDP-11 target other than @samp{pdp11-*-bsd}.
10492 @end table
10493
10494 @node Xstormy16 Options
10495 @subsection Xstormy16 Options
10496 @cindex Xstormy16 Options
10497
10498 These options are defined for Xstormy16:
10499
10500 @table @gcctabopt
10501 @item -msim
10502 @opindex msim
10503 Choose startup files and linker script suitable for the simulator.
10504 @end table
10505
10506 @node FRV Options
10507 @subsection FRV Options
10508 @cindex FRV Options
10509
10510 @table @gcctabopt
10511 @item -mgpr-32
10512 @opindex mgpr-32
10513
10514 Only use the first 32 general purpose registers.
10515
10516 @item -mgpr-64
10517 @opindex mgpr-64
10518
10519 Use all 64 general purpose registers.
10520
10521 @item -mfpr-32
10522 @opindex mfpr-32
10523
10524 Use only the first 32 floating point registers.
10525
10526 @item -mfpr-64
10527 @opindex mfpr-64
10528
10529 Use all 64 floating point registers
10530
10531 @item -mhard-float
10532 @opindex mhard-float
10533
10534 Use hardware instructions for floating point operations.
10535
10536 @item -msoft-float
10537 @opindex msoft-float
10538
10539 Use library routines for floating point operations.
10540
10541 @item -malloc-cc
10542 @opindex malloc-cc
10543
10544 Dynamically allocate condition code registers.
10545
10546 @item -mfixed-cc
10547 @opindex mfixed-cc
10548
10549 Do not try to dynamically allocate condition code registers, only
10550 use @code{icc0} and @code{fcc0}.
10551
10552 @item -mdword
10553 @opindex mdword
10554
10555 Change ABI to use double word insns.
10556
10557 @item -mno-dword
10558 @opindex mno-dword
10559
10560 Do not use double word instructions.
10561
10562 @item -mdouble
10563 @opindex mdouble
10564
10565 Use floating point double instructions.
10566
10567 @item -mno-double
10568 @opindex mno-double
10569
10570 Do not use floating point double instructions.
10571
10572 @item -mmedia
10573 @opindex mmedia
10574
10575 Use media instructions.
10576
10577 @item -mno-media
10578 @opindex mno-media
10579
10580 Do not use media instructions.
10581
10582 @item -mmuladd
10583 @opindex mmuladd
10584
10585 Use multiply and add/subtract instructions.
10586
10587 @item -mno-muladd
10588 @opindex mno-muladd
10589
10590 Do not use multiply and add/subtract instructions.
10591
10592 @item -mlibrary-pic
10593 @opindex mlibrary-pic
10594
10595 Generate position-independent EABI code.
10596
10597 @item -macc-4
10598 @opindex macc-4
10599
10600 Use only the first four media accumulator registers.
10601
10602 @item -macc-8
10603 @opindex macc-8
10604
10605 Use all eight media accumulator registers.
10606
10607 @item -mpack
10608 @opindex mpack
10609
10610 Pack VLIW instructions.
10611
10612 @item -mno-pack
10613 @opindex mno-pack
10614
10615 Do not pack VLIW instructions.
10616
10617 @item -mno-eflags
10618 @opindex mno-eflags
10619
10620 Do not mark ABI switches in e_flags.
10621
10622 @item -mcond-move
10623 @opindex mcond-move
10624
10625 Enable the use of conditional-move instructions (default).
10626
10627 This switch is mainly for debugging the compiler and will likely be removed
10628 in a future version.
10629
10630 @item -mno-cond-move
10631 @opindex mno-cond-move
10632
10633 Disable the use of conditional-move instructions.
10634
10635 This switch is mainly for debugging the compiler and will likely be removed
10636 in a future version.
10637
10638 @item -mscc
10639 @opindex mscc
10640
10641 Enable the use of conditional set instructions (default).
10642
10643 This switch is mainly for debugging the compiler and will likely be removed
10644 in a future version.
10645
10646 @item -mno-scc
10647 @opindex mno-scc
10648
10649 Disable the use of conditional set instructions.
10650
10651 This switch is mainly for debugging the compiler and will likely be removed
10652 in a future version.
10653
10654 @item -mcond-exec
10655 @opindex mcond-exec
10656
10657 Enable the use of conditional execution (default).
10658
10659 This switch is mainly for debugging the compiler and will likely be removed
10660 in a future version.
10661
10662 @item -mno-cond-exec
10663 @opindex mno-cond-exec
10664
10665 Disable the use of conditional execution.
10666
10667 This switch is mainly for debugging the compiler and will likely be removed
10668 in a future version.
10669
10670 @item -mvliw-branch
10671 @opindex mvliw-branch
10672
10673 Run a pass to pack branches into VLIW instructions (default).
10674
10675 This switch is mainly for debugging the compiler and will likely be removed
10676 in a future version.
10677
10678 @item -mno-vliw-branch
10679 @opindex mno-vliw-branch
10680
10681 Do not run a pass to pack branches into VLIW instructions.
10682
10683 This switch is mainly for debugging the compiler and will likely be removed
10684 in a future version.
10685
10686 @item -mmulti-cond-exec
10687 @opindex mmulti-cond-exec
10688
10689 Enable optimization of @code{&&} and @code{||} in conditional execution
10690 (default).
10691
10692 This switch is mainly for debugging the compiler and will likely be removed
10693 in a future version.
10694
10695 @item -mno-multi-cond-exec
10696 @opindex mno-multi-cond-exec
10697
10698 Disable optimization of @code{&&} and @code{||} in conditional execution.
10699
10700 This switch is mainly for debugging the compiler and will likely be removed
10701 in a future version.
10702
10703 @item -mnested-cond-exec
10704 @opindex mnested-cond-exec
10705
10706 Enable nested conditional execution optimizations (default).
10707
10708 This switch is mainly for debugging the compiler and will likely be removed
10709 in a future version.
10710
10711 @item -mno-nested-cond-exec
10712 @opindex mno-nested-cond-exec
10713
10714 Disable nested conditional execution optimizations.
10715
10716 This switch is mainly for debugging the compiler and will likely be removed
10717 in a future version.
10718
10719 @item -mtomcat-stats
10720 @opindex mtomcat-stats
10721
10722 Cause gas to print out tomcat statistics.
10723
10724 @item -mcpu=@var{cpu}
10725 @opindex mcpu
10726
10727 Select the processor type for which to generate code.  Possible values are
10728 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
10729 @samp{frv}.
10730
10731 @end table
10732
10733 @node Xtensa Options
10734 @subsection Xtensa Options
10735 @cindex Xtensa Options
10736
10737 These options are supported for Xtensa targets:
10738
10739 @table @gcctabopt
10740 @item -mconst16
10741 @itemx -mno-const16
10742 @opindex mconst16
10743 @opindex mno-const16
10744 Enable or disable use of @code{CONST16} instructions for loading
10745 constant values.  The @code{CONST16} instruction is currently not a
10746 standard option from Tensilica.  When enabled, @code{CONST16}
10747 instructions are always used in place of the standard @code{L32R}
10748 instructions.  The use of @code{CONST16} is enabled by default only if
10749 the @code{L32R} instruction is not available.
10750
10751 @item -mfused-madd
10752 @itemx -mno-fused-madd
10753 @opindex mfused-madd
10754 @opindex mno-fused-madd
10755 Enable or disable use of fused multiply/add and multiply/subtract
10756 instructions in the floating-point option.  This has no effect if the
10757 floating-point option is not also enabled.  Disabling fused multiply/add
10758 and multiply/subtract instructions forces the compiler to use separate
10759 instructions for the multiply and add/subtract operations.  This may be
10760 desirable in some cases where strict IEEE 754-compliant results are
10761 required: the fused multiply add/subtract instructions do not round the
10762 intermediate result, thereby producing results with @emph{more} bits of
10763 precision than specified by the IEEE standard.  Disabling fused multiply
10764 add/subtract instructions also ensures that the program output is not
10765 sensitive to the compiler's ability to combine multiply and add/subtract
10766 operations.
10767
10768 @item -mtext-section-literals
10769 @itemx -mno-text-section-literals
10770 @opindex mtext-section-literals
10771 @opindex mno-text-section-literals
10772 Control the treatment of literal pools.  The default is
10773 @option{-mno-text-section-literals}, which places literals in a separate
10774 section in the output file.  This allows the literal pool to be placed
10775 in a data RAM/ROM, and it also allows the linker to combine literal
10776 pools from separate object files to remove redundant literals and
10777 improve code size.  With @option{-mtext-section-literals}, the literals
10778 are interspersed in the text section in order to keep them as close as
10779 possible to their references.  This may be necessary for large assembly
10780 files.
10781
10782 @item -mtarget-align
10783 @itemx -mno-target-align
10784 @opindex mtarget-align
10785 @opindex mno-target-align
10786 When this option is enabled, GCC instructs the assembler to
10787 automatically align instructions to reduce branch penalties at the
10788 expense of some code density.  The assembler attempts to widen density
10789 instructions to align branch targets and the instructions following call
10790 instructions.  If there are not enough preceding safe density
10791 instructions to align a target, no widening will be performed.  The
10792 default is @option{-mtarget-align}.  These options do not affect the
10793 treatment of auto-aligned instructions like @code{LOOP}, which the
10794 assembler will always align, either by widening density instructions or
10795 by inserting no-op instructions.
10796
10797 @item -mlongcalls
10798 @itemx -mno-longcalls
10799 @opindex mlongcalls
10800 @opindex mno-longcalls
10801 When this option is enabled, GCC instructs the assembler to translate
10802 direct calls to indirect calls unless it can determine that the target
10803 of a direct call is in the range allowed by the call instruction.  This
10804 translation typically occurs for calls to functions in other source
10805 files.  Specifically, the assembler translates a direct @code{CALL}
10806 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
10807 The default is @option{-mno-longcalls}.  This option should be used in
10808 programs where the call target can potentially be out of range.  This
10809 option is implemented in the assembler, not the compiler, so the
10810 assembly code generated by GCC will still show direct call
10811 instructions---look at the disassembled object code to see the actual
10812 instructions.  Note that the assembler will use an indirect call for
10813 every cross-file call, not just those that really will be out of range.
10814 @end table
10815
10816 @node Code Gen Options
10817 @section Options for Code Generation Conventions
10818 @cindex code generation conventions
10819 @cindex options, code generation
10820 @cindex run-time options
10821
10822 These machine-independent options control the interface conventions
10823 used in code generation.
10824
10825 Most of them have both positive and negative forms; the negative form
10826 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
10827 one of the forms is listed---the one which is not the default.  You
10828 can figure out the other form by either removing @samp{no-} or adding
10829 it.
10830
10831 @table @gcctabopt
10832 @item -fbounds-check
10833 @opindex fbounds-check
10834 For front-ends that support it, generate additional code to check that
10835 indices used to access arrays are within the declared range.  This is
10836 currently only supported by the Java and Fortran 77 front-ends, where
10837 this option defaults to true and false respectively.
10838
10839 @item -ftrapv
10840 @opindex ftrapv
10841 This option generates traps for signed overflow on addition, subtraction,
10842 multiplication operations.
10843
10844 @item -fwrapv
10845 @opindex fwrapv
10846 This option instructs the compiler to assume that signed arithmetic
10847 overflow of addition, subtraction and multiplication wraps around
10848 using twos-complement representation.  This flag enables some optimizations
10849 and disables other.  This option is enabled by default for the Java
10850 front-end, as required by the Java language specification.
10851
10852 @item -fexceptions
10853 @opindex fexceptions
10854 Enable exception handling.  Generates extra code needed to propagate
10855 exceptions.  For some targets, this implies GCC will generate frame
10856 unwind information for all functions, which can produce significant data
10857 size overhead, although it does not affect execution.  If you do not
10858 specify this option, GCC will enable it by default for languages like
10859 C++ which normally require exception handling, and disable it for
10860 languages like C that do not normally require it.  However, you may need
10861 to enable this option when compiling C code that needs to interoperate
10862 properly with exception handlers written in C++.  You may also wish to
10863 disable this option if you are compiling older C++ programs that don't
10864 use exception handling.
10865
10866 @item -fnon-call-exceptions
10867 @opindex fnon-call-exceptions
10868 Generate code that allows trapping instructions to throw exceptions.
10869 Note that this requires platform-specific runtime support that does
10870 not exist everywhere.  Moreover, it only allows @emph{trapping}
10871 instructions to throw exceptions, i.e.@: memory references or floating
10872 point instructions.  It does not allow exceptions to be thrown from
10873 arbitrary signal handlers such as @code{SIGALRM}.
10874
10875 @item -funwind-tables
10876 @opindex funwind-tables
10877 Similar to @option{-fexceptions}, except that it will just generate any needed
10878 static data, but will not affect the generated code in any other way.
10879 You will normally not enable this option; instead, a language processor
10880 that needs this handling would enable it on your behalf.
10881
10882 @item -fasynchronous-unwind-tables
10883 @opindex funwind-tables
10884 Generate unwind table in dwarf2 format, if supported by target machine.  The
10885 table is exact at each instruction boundary, so it can be used for stack
10886 unwinding from asynchronous events (such as debugger or garbage collector).
10887
10888 @item -fpcc-struct-return
10889 @opindex fpcc-struct-return
10890 Return ``short'' @code{struct} and @code{union} values in memory like
10891 longer ones, rather than in registers.  This convention is less
10892 efficient, but it has the advantage of allowing intercallability between
10893 GCC-compiled files and files compiled with other compilers, particularly
10894 the Portable C Compiler (pcc).
10895
10896 The precise convention for returning structures in memory depends
10897 on the target configuration macros.
10898
10899 Short structures and unions are those whose size and alignment match
10900 that of some integer type.
10901
10902 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
10903 switch is not binary compatible with code compiled with the
10904 @option{-freg-struct-return} switch.
10905 Use it to conform to a non-default application binary interface.
10906
10907 @item -freg-struct-return
10908 @opindex freg-struct-return
10909 Return @code{struct} and @code{union} values in registers when possible.
10910 This is more efficient for small structures than
10911 @option{-fpcc-struct-return}.
10912
10913 If you specify neither @option{-fpcc-struct-return} nor
10914 @option{-freg-struct-return}, GCC defaults to whichever convention is
10915 standard for the target.  If there is no standard convention, GCC
10916 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
10917 the principal compiler.  In those cases, we can choose the standard, and
10918 we chose the more efficient register return alternative.
10919
10920 @strong{Warning:} code compiled with the @option{-freg-struct-return}
10921 switch is not binary compatible with code compiled with the
10922 @option{-fpcc-struct-return} switch.
10923 Use it to conform to a non-default application binary interface.
10924
10925 @item -fshort-enums
10926 @opindex fshort-enums
10927 Allocate to an @code{enum} type only as many bytes as it needs for the
10928 declared range of possible values.  Specifically, the @code{enum} type
10929 will be equivalent to the smallest integer type which has enough room.
10930
10931 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
10932 code that is not binary compatible with code generated without that switch.
10933 Use it to conform to a non-default application binary interface.
10934
10935 @item -fshort-double
10936 @opindex fshort-double
10937 Use the same size for @code{double} as for @code{float}.
10938
10939 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
10940 code that is not binary compatible with code generated without that switch.
10941 Use it to conform to a non-default application binary interface.
10942
10943 @item -fshort-wchar
10944 @opindex fshort-wchar
10945 Override the underlying type for @samp{wchar_t} to be @samp{short
10946 unsigned int} instead of the default for the target.  This option is
10947 useful for building programs to run under WINE@.
10948
10949 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
10950 code that is not binary compatible with code generated without that switch.
10951 Use it to conform to a non-default application binary interface.
10952
10953 @item -fshared-data
10954 @opindex fshared-data
10955 Requests that the data and non-@code{const} variables of this
10956 compilation be shared data rather than private data.  The distinction
10957 makes sense only on certain operating systems, where shared data is
10958 shared between processes running the same program, while private data
10959 exists in one copy per process.
10960
10961 @item -fno-common
10962 @opindex fno-common
10963 In C, allocate even uninitialized global variables in the data section of the
10964 object file, rather than generating them as common blocks.  This has the
10965 effect that if the same variable is declared (without @code{extern}) in
10966 two different compilations, you will get an error when you link them.
10967 The only reason this might be useful is if you wish to verify that the
10968 program will work on other systems which always work this way.
10969
10970 @item -fno-ident
10971 @opindex fno-ident
10972 Ignore the @samp{#ident} directive.
10973
10974 @item -finhibit-size-directive
10975 @opindex finhibit-size-directive
10976 Don't output a @code{.size} assembler directive, or anything else that
10977 would cause trouble if the function is split in the middle, and the
10978 two halves are placed at locations far apart in memory.  This option is
10979 used when compiling @file{crtstuff.c}; you should not need to use it
10980 for anything else.
10981
10982 @item -fverbose-asm
10983 @opindex fverbose-asm
10984 Put extra commentary information in the generated assembly code to
10985 make it more readable.  This option is generally only of use to those
10986 who actually need to read the generated assembly code (perhaps while
10987 debugging the compiler itself).
10988
10989 @option{-fno-verbose-asm}, the default, causes the
10990 extra information to be omitted and is useful when comparing two assembler
10991 files.
10992
10993 @item -fpic
10994 @opindex fpic
10995 @cindex global offset table
10996 @cindex PIC
10997 Generate position-independent code (PIC) suitable for use in a shared
10998 library, if supported for the target machine.  Such code accesses all
10999 constant addresses through a global offset table (GOT)@.  The dynamic
11000 loader resolves the GOT entries when the program starts (the dynamic
11001 loader is not part of GCC; it is part of the operating system).  If
11002 the GOT size for the linked executable exceeds a machine-specific
11003 maximum size, you get an error message from the linker indicating that
11004 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11005 instead.  (These maximums are 8k on the SPARC and 32k
11006 on the m68k and RS/6000.  The 386 has no such limit.)
11007
11008 Position-independent code requires special support, and therefore works
11009 only on certain machines.  For the 386, GCC supports PIC for System V
11010 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
11011 position-independent.
11012
11013 @item -fPIC
11014 @opindex fPIC
11015 If supported for the target machine, emit position-independent code,
11016 suitable for dynamic linking and avoiding any limit on the size of the
11017 global offset table.  This option makes a difference on the m68k
11018 and the SPARC.
11019
11020 Position-independent code requires special support, and therefore works
11021 only on certain machines.
11022
11023 @item -fpie
11024 @itemx -fPIE
11025 @opindex fpie
11026 @opindex fPIE
11027 These options are similar to @option{-fpic} and @option{-fPIC}, but
11028 generated position independent code can be only linked into executables.
11029 Usually these options are used when @option{-pie} GCC option will be
11030 used during linking.
11031
11032 @item -ffixed-@var{reg}
11033 @opindex ffixed
11034 Treat the register named @var{reg} as a fixed register; generated code
11035 should never refer to it (except perhaps as a stack pointer, frame
11036 pointer or in some other fixed role).
11037
11038 @var{reg} must be the name of a register.  The register names accepted
11039 are machine-specific and are defined in the @code{REGISTER_NAMES}
11040 macro in the machine description macro file.
11041
11042 This flag does not have a negative form, because it specifies a
11043 three-way choice.
11044
11045 @item -fcall-used-@var{reg}
11046 @opindex fcall-used
11047 Treat the register named @var{reg} as an allocable register that is
11048 clobbered by function calls.  It may be allocated for temporaries or
11049 variables that do not live across a call.  Functions compiled this way
11050 will not save and restore the register @var{reg}.
11051
11052 It is an error to used this flag with the frame pointer or stack pointer.
11053 Use of this flag for other registers that have fixed pervasive roles in
11054 the machine's execution model will produce disastrous results.
11055
11056 This flag does not have a negative form, because it specifies a
11057 three-way choice.
11058
11059 @item -fcall-saved-@var{reg}
11060 @opindex fcall-saved
11061 Treat the register named @var{reg} as an allocable register saved by
11062 functions.  It may be allocated even for temporaries or variables that
11063 live across a call.  Functions compiled this way will save and restore
11064 the register @var{reg} if they use it.
11065
11066 It is an error to used this flag with the frame pointer or stack pointer.
11067 Use of this flag for other registers that have fixed pervasive roles in
11068 the machine's execution model will produce disastrous results.
11069
11070 A different sort of disaster will result from the use of this flag for
11071 a register in which function values may be returned.
11072
11073 This flag does not have a negative form, because it specifies a
11074 three-way choice.
11075
11076 @item -fpack-struct
11077 @opindex fpack-struct
11078 Pack all structure members together without holes.
11079
11080 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11081 code that is not binary compatible with code generated without that switch.
11082 Additionally, it makes the code suboptimal.
11083 Use it to conform to a non-default application binary interface.
11084
11085 @item -finstrument-functions
11086 @opindex finstrument-functions
11087 Generate instrumentation calls for entry and exit to functions.  Just
11088 after function entry and just before function exit, the following
11089 profiling functions will be called with the address of the current
11090 function and its call site.  (On some platforms,
11091 @code{__builtin_return_address} does not work beyond the current
11092 function, so the call site information may not be available to the
11093 profiling functions otherwise.)
11094
11095 @smallexample
11096 void __cyg_profile_func_enter (void *this_fn,
11097                                void *call_site);
11098 void __cyg_profile_func_exit  (void *this_fn,
11099                                void *call_site);
11100 @end smallexample
11101
11102 The first argument is the address of the start of the current function,
11103 which may be looked up exactly in the symbol table.
11104
11105 This instrumentation is also done for functions expanded inline in other
11106 functions.  The profiling calls will indicate where, conceptually, the
11107 inline function is entered and exited.  This means that addressable
11108 versions of such functions must be available.  If all your uses of a
11109 function are expanded inline, this may mean an additional expansion of
11110 code size.  If you use @samp{extern inline} in your C code, an
11111 addressable version of such functions must be provided.  (This is
11112 normally the case anyways, but if you get lucky and the optimizer always
11113 expands the functions inline, you might have gotten away without
11114 providing static copies.)
11115
11116 A function may be given the attribute @code{no_instrument_function}, in
11117 which case this instrumentation will not be done.  This can be used, for
11118 example, for the profiling functions listed above, high-priority
11119 interrupt routines, and any functions from which the profiling functions
11120 cannot safely be called (perhaps signal handlers, if the profiling
11121 routines generate output or allocate memory).
11122
11123 @item -fstack-check
11124 @opindex fstack-check
11125 Generate code to verify that you do not go beyond the boundary of the
11126 stack.  You should specify this flag if you are running in an
11127 environment with multiple threads, but only rarely need to specify it in
11128 a single-threaded environment since stack overflow is automatically
11129 detected on nearly all systems if there is only one stack.
11130
11131 Note that this switch does not actually cause checking to be done; the
11132 operating system must do that.  The switch causes generation of code
11133 to ensure that the operating system sees the stack being extended.
11134
11135 @item -fstack-limit-register=@var{reg}
11136 @itemx -fstack-limit-symbol=@var{sym}
11137 @itemx -fno-stack-limit
11138 @opindex fstack-limit-register
11139 @opindex fstack-limit-symbol
11140 @opindex fno-stack-limit
11141 Generate code to ensure that the stack does not grow beyond a certain value,
11142 either the value of a register or the address of a symbol.  If the stack
11143 would grow beyond the value, a signal is raised.  For most targets,
11144 the signal is raised before the stack overruns the boundary, so
11145 it is possible to catch the signal without taking special precautions.
11146
11147 For instance, if the stack starts at absolute address @samp{0x80000000}
11148 and grows downwards, you can use the flags
11149 @option{-fstack-limit-symbol=__stack_limit} and
11150 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11151 of 128KB@.  Note that this may only work with the GNU linker.
11152
11153 @cindex aliasing of parameters
11154 @cindex parameters, aliased
11155 @item -fargument-alias
11156 @itemx -fargument-noalias
11157 @itemx -fargument-noalias-global
11158 @opindex fargument-alias
11159 @opindex fargument-noalias
11160 @opindex fargument-noalias-global
11161 Specify the possible relationships among parameters and between
11162 parameters and global data.
11163
11164 @option{-fargument-alias} specifies that arguments (parameters) may
11165 alias each other and may alias global storage.@*
11166 @option{-fargument-noalias} specifies that arguments do not alias
11167 each other, but may alias global storage.@*
11168 @option{-fargument-noalias-global} specifies that arguments do not
11169 alias each other and do not alias global storage.
11170
11171 Each language will automatically use whatever option is required by
11172 the language standard.  You should not need to use these options yourself.
11173
11174 @item -fleading-underscore
11175 @opindex fleading-underscore
11176 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11177 change the way C symbols are represented in the object file.  One use
11178 is to help link with legacy assembly code.
11179
11180 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11181 generate code that is not binary compatible with code generated without that
11182 switch.  Use it to conform to a non-default application binary interface.
11183 Not all targets provide complete support for this switch.
11184
11185 @item -ftls-model=@var{model}
11186 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11187 The @var{model} argument should be one of @code{global-dynamic},
11188 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11189
11190 The default without @option{-fpic} is @code{initial-exec}; with
11191 @option{-fpic} the default is @code{global-dynamic}.
11192 @end table
11193
11194 @c man end
11195
11196 @node Environment Variables
11197 @section Environment Variables Affecting GCC
11198 @cindex environment variables
11199
11200 @c man begin ENVIRONMENT
11201 This section describes several environment variables that affect how GCC
11202 operates.  Some of them work by specifying directories or prefixes to use
11203 when searching for various kinds of files.  Some are used to specify other
11204 aspects of the compilation environment.
11205
11206 Note that you can also specify places to search using options such as
11207 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
11208 take precedence over places specified using environment variables, which
11209 in turn take precedence over those specified by the configuration of GCC@.
11210 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11211 GNU Compiler Collection (GCC) Internals}.
11212
11213 @table @env
11214 @item LANG
11215 @itemx LC_CTYPE
11216 @c @itemx LC_COLLATE
11217 @itemx LC_MESSAGES
11218 @c @itemx LC_MONETARY
11219 @c @itemx LC_NUMERIC
11220 @c @itemx LC_TIME
11221 @itemx LC_ALL
11222 @findex LANG
11223 @findex LC_CTYPE
11224 @c @findex LC_COLLATE
11225 @findex LC_MESSAGES
11226 @c @findex LC_MONETARY
11227 @c @findex LC_NUMERIC
11228 @c @findex LC_TIME
11229 @findex LC_ALL
11230 @cindex locale
11231 These environment variables control the way that GCC uses
11232 localization information that allow GCC to work with different
11233 national conventions.  GCC inspects the locale categories
11234 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
11235 so.  These locale categories can be set to any value supported by your
11236 installation.  A typical value is @samp{en_UK} for English in the United
11237 Kingdom.
11238
11239 The @env{LC_CTYPE} environment variable specifies character
11240 classification.  GCC uses it to determine the character boundaries in
11241 a string; this is needed for some multibyte encodings that contain quote
11242 and escape characters that would otherwise be interpreted as a string
11243 end or escape.
11244
11245 The @env{LC_MESSAGES} environment variable specifies the language to
11246 use in diagnostic messages.
11247
11248 If the @env{LC_ALL} environment variable is set, it overrides the value
11249 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11250 and @env{LC_MESSAGES} default to the value of the @env{LANG}
11251 environment variable.  If none of these variables are set, GCC
11252 defaults to traditional C English behavior.
11253
11254 @item TMPDIR
11255 @findex TMPDIR
11256 If @env{TMPDIR} is set, it specifies the directory to use for temporary
11257 files.  GCC uses temporary files to hold the output of one stage of
11258 compilation which is to be used as input to the next stage: for example,
11259 the output of the preprocessor, which is the input to the compiler
11260 proper.
11261
11262 @item GCC_EXEC_PREFIX
11263 @findex GCC_EXEC_PREFIX
11264 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
11265 names of the subprograms executed by the compiler.  No slash is added
11266 when this prefix is combined with the name of a subprogram, but you can
11267 specify a prefix that ends with a slash if you wish.
11268
11269 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
11270 an appropriate prefix to use based on the pathname it was invoked with.
11271
11272 If GCC cannot find the subprogram using the specified prefix, it
11273 tries looking in the usual places for the subprogram.
11274
11275 The default value of @env{GCC_EXEC_PREFIX} is
11276 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
11277 of @code{prefix} when you ran the @file{configure} script.
11278
11279 Other prefixes specified with @option{-B} take precedence over this prefix.
11280
11281 This prefix is also used for finding files such as @file{crt0.o} that are
11282 used for linking.
11283
11284 In addition, the prefix is used in an unusual way in finding the
11285 directories to search for header files.  For each of the standard
11286 directories whose name normally begins with @samp{/usr/local/lib/gcc}
11287 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
11288 replacing that beginning with the specified prefix to produce an
11289 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
11290 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
11291 These alternate directories are searched first; the standard directories
11292 come next.
11293
11294 @item COMPILER_PATH
11295 @findex COMPILER_PATH
11296 The value of @env{COMPILER_PATH} is a colon-separated list of
11297 directories, much like @env{PATH}.  GCC tries the directories thus
11298 specified when searching for subprograms, if it can't find the
11299 subprograms using @env{GCC_EXEC_PREFIX}.
11300
11301 @item LIBRARY_PATH
11302 @findex LIBRARY_PATH
11303 The value of @env{LIBRARY_PATH} is a colon-separated list of
11304 directories, much like @env{PATH}.  When configured as a native compiler,
11305 GCC tries the directories thus specified when searching for special
11306 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
11307 using GCC also uses these directories when searching for ordinary
11308 libraries for the @option{-l} option (but directories specified with
11309 @option{-L} come first).
11310
11311 @item LANG
11312 @findex LANG
11313 @cindex locale definition
11314 This variable is used to pass locale information to the compiler.  One way in
11315 which this information is used is to determine the character set to be used
11316 when character literals, string literals and comments are parsed in C and C++.
11317 When the compiler is configured to allow multibyte characters,
11318 the following values for @env{LANG} are recognized:
11319
11320 @table @samp
11321 @item C-JIS
11322 Recognize JIS characters.
11323 @item C-SJIS
11324 Recognize SJIS characters.
11325 @item C-EUCJP
11326 Recognize EUCJP characters.
11327 @end table
11328
11329 If @env{LANG} is not defined, or if it has some other value, then the
11330 compiler will use mblen and mbtowc as defined by the default locale to
11331 recognize and translate multibyte characters.
11332 @end table
11333
11334 @noindent
11335 Some additional environments variables affect the behavior of the
11336 preprocessor.
11337
11338 @include cppenv.texi
11339
11340 @c man end
11341
11342 @node Precompiled Headers
11343 @section Using Precompiled Headers
11344 @cindex precompiled headers
11345 @cindex speed of compilation
11346
11347 Often large projects have many header files that are included in every
11348 source file.  The time the compiler takes to process these header files
11349 over and over again can account for nearly all of the time required to
11350 build the project.  To make builds faster, GCC allows users to
11351 `precompile' a header file; then, if builds can use the precompiled
11352 header file they will be much faster.
11353
11354 @strong{Caution:} There are a few known situations where GCC will
11355 crash when trying to use a precompiled header.  If you have trouble
11356 with a precompiled header, you should remove the precompiled header
11357 and compile without it.  In addition, please use GCC's on-line
11358 defect-tracking system to report any problems you encounter with
11359 precompiled headers.  @xref{Bugs}.
11360
11361 To create a precompiled header file, simply compile it as you would any
11362 other file, if necessary using the @option{-x} option to make the driver
11363 treat it as a C or C++ header file.  You will probably want to use a
11364 tool like @command{make} to keep the precompiled header up-to-date when
11365 the headers it contains change.
11366
11367 A precompiled header file will be searched for when @code{#include} is
11368 seen in the compilation.  As it searches for the included file
11369 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
11370 compiler looks for a precompiled header in each directory just before it
11371 looks for the include file in that directory.  The name searched for is
11372 the name specified in the @code{#include} with @samp{.gch} appended.  If
11373 the precompiled header file can't be used, it is ignored.
11374
11375 For instance, if you have @code{#include "all.h"}, and you have
11376 @file{all.h.gch} in the same directory as @file{all.h}, then the
11377 precompiled header file will be used if possible, and the original
11378 header will be used otherwise.
11379
11380 Alternatively, you might decide to put the precompiled header file in a
11381 directory and use @option{-I} to ensure that directory is searched
11382 before (or instead of) the directory containing the original header.
11383 Then, if you want to check that the precompiled header file is always
11384 used, you can put a file of the same name as the original header in this
11385 directory containing an @code{#error} command.
11386
11387 This also works with @option{-include}.  So yet another way to use
11388 precompiled headers, good for projects not designed with precompiled
11389 header files in mind, is to simply take most of the header files used by
11390 a project, include them from another header file, precompile that header
11391 file, and @option{-include} the precompiled header.  If the header files
11392 have guards against multiple inclusion, they will be skipped because
11393 they've already been included (in the precompiled header).
11394
11395 If you need to precompile the same header file for different
11396 languages, targets, or compiler options, you can instead make a
11397 @emph{directory} named like @file{all.h.gch}, and put each precompiled
11398 header in the directory, perhaps using @option{-o}.  It doesn't matter
11399 what you call the files in the directory, every precompiled header in
11400 the directory will be considered.  The first precompiled header
11401 encountered in the directory that is valid for this compilation will
11402 be used; they're searched in no particular order.
11403
11404 There are many other possibilities, limited only by your imagination,
11405 good sense, and the constraints of your build system.
11406
11407 A precompiled header file can be used only when these conditions apply:
11408
11409 @itemize
11410 @item
11411 Only one precompiled header can be used in a particular compilation.
11412
11413 @item
11414 A precompiled header can't be used once the first C token is seen.  You
11415 can have preprocessor directives before a precompiled header; you can
11416 even include a precompiled header from inside another header, so long as
11417 there are no C tokens before the @code{#include}.
11418
11419 @item
11420 The precompiled header file must be produced for the same language as
11421 the current compilation.  You can't use a C precompiled header for a C++
11422 compilation.
11423
11424 @item
11425 The precompiled header file must be produced by the same compiler
11426 version and configuration as the current compilation is using.
11427 The easiest way to guarantee this is to use the same compiler binary
11428 for creating and using precompiled headers.
11429
11430 @item
11431 Any macros defined before the precompiled header is included must
11432 either be defined in the same way as when the precompiled header was
11433 generated, or must not affect the precompiled header, which usually
11434 means that the they don't appear in the precompiled header at all.
11435
11436 The @option{-D} option is one way to define a macro before a
11437 precompiled header is included; using a @code{#define} can also do it.
11438 There are also some options that define macros implicitly, like
11439 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
11440 defined this way.
11441
11442 @item If debugging information is output when using the precompiled
11443 header, using @option{-g} or similar, the same kind of debugging information
11444 must have been output when building the precompiled header.  However,
11445 a precompiled header built using @option{-g} can be used in a compilation
11446 when no debugging information is being output.
11447
11448 @item The same @option{-m} options must generally be used when building
11449 and using the precompiled header.  @xref{Submodel Options},
11450 for any cases where this rule is relaxed.
11451
11452 @item Each of the following options must be the same when building and using
11453 the precompiled header:
11454
11455 @gccoptlist{-fexceptions -funit-at-a-time}
11456
11457 @item
11458 Some other command-line options starting with @option{-f},
11459 @option{-p}, or @option{-O} must be defined in the same way as when
11460 the precompiled header was generated.  At present, it's not clear
11461 which options are safe to change and which are not; the safest choice
11462 is to use exactly the same options when generating and using the
11463 precompiled header.  The following are known to be safe:
11464
11465 @gccoptlist{-pedantic-errors}
11466
11467 @end itemize
11468
11469 For all of these except the last, the compiler will automatically
11470 ignore the precompiled header if the conditions aren't met.  If you
11471 find an option combination that doesn't work and doesn't cause the
11472 precompiled header to be ignored, please consider filing a bug report,
11473 see @ref{Bugs}.
11474
11475 @node Running Protoize
11476 @section Running Protoize
11477
11478 The program @code{protoize} is an optional part of GCC@.  You can use
11479 it to add prototypes to a program, thus converting the program to ISO
11480 C in one respect.  The companion program @code{unprotoize} does the
11481 reverse: it removes argument types from any prototypes that are found.
11482
11483 When you run these programs, you must specify a set of source files as
11484 command line arguments.  The conversion programs start out by compiling
11485 these files to see what functions they define.  The information gathered
11486 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
11487
11488 After scanning comes actual conversion.  The specified files are all
11489 eligible to be converted; any files they include (whether sources or
11490 just headers) are eligible as well.
11491
11492 But not all the eligible files are converted.  By default,
11493 @code{protoize} and @code{unprotoize} convert only source and header
11494 files in the current directory.  You can specify additional directories
11495 whose files should be converted with the @option{-d @var{directory}}
11496 option.  You can also specify particular files to exclude with the
11497 @option{-x @var{file}} option.  A file is converted if it is eligible, its
11498 directory name matches one of the specified directory names, and its
11499 name within the directory has not been excluded.
11500
11501 Basic conversion with @code{protoize} consists of rewriting most
11502 function definitions and function declarations to specify the types of
11503 the arguments.  The only ones not rewritten are those for varargs
11504 functions.
11505
11506 @code{protoize} optionally inserts prototype declarations at the
11507 beginning of the source file, to make them available for any calls that
11508 precede the function's definition.  Or it can insert prototype
11509 declarations with block scope in the blocks where undeclared functions
11510 are called.
11511
11512 Basic conversion with @code{unprotoize} consists of rewriting most
11513 function declarations to remove any argument types, and rewriting
11514 function definitions to the old-style pre-ISO form.
11515
11516 Both conversion programs print a warning for any function declaration or
11517 definition that they can't convert.  You can suppress these warnings
11518 with @option{-q}.
11519
11520 The output from @code{protoize} or @code{unprotoize} replaces the
11521 original source file.  The original file is renamed to a name ending
11522 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
11523 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
11524 for DOS) file already exists, then the source file is simply discarded.
11525
11526 @code{protoize} and @code{unprotoize} both depend on GCC itself to
11527 scan the program and collect information about the functions it uses.
11528 So neither of these programs will work until GCC is installed.
11529
11530 Here is a table of the options you can use with @code{protoize} and
11531 @code{unprotoize}.  Each option works with both programs unless
11532 otherwise stated.
11533
11534 @table @code
11535 @item -B @var{directory}
11536 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
11537 usual directory (normally @file{/usr/local/lib}).  This file contains
11538 prototype information about standard system functions.  This option
11539 applies only to @code{protoize}.
11540
11541 @item -c @var{compilation-options}
11542 Use @var{compilation-options} as the options when running @command{gcc} to
11543 produce the @samp{.X} files.  The special option @option{-aux-info} is
11544 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
11545
11546 Note that the compilation options must be given as a single argument to
11547 @code{protoize} or @code{unprotoize}.  If you want to specify several
11548 @command{gcc} options, you must quote the entire set of compilation options
11549 to make them a single word in the shell.
11550
11551 There are certain @command{gcc} arguments that you cannot use, because they
11552 would produce the wrong kind of output.  These include @option{-g},
11553 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
11554 the @var{compilation-options}, they are ignored.
11555
11556 @item -C
11557 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
11558 systems) instead of @samp{.c}.  This is convenient if you are converting
11559 a C program to C++.  This option applies only to @code{protoize}.
11560
11561 @item -g
11562 Add explicit global declarations.  This means inserting explicit
11563 declarations at the beginning of each source file for each function
11564 that is called in the file and was not declared.  These declarations
11565 precede the first function definition that contains a call to an
11566 undeclared function.  This option applies only to @code{protoize}.
11567
11568 @item -i @var{string}
11569 Indent old-style parameter declarations with the string @var{string}.
11570 This option applies only to @code{protoize}.
11571
11572 @code{unprotoize} converts prototyped function definitions to old-style
11573 function definitions, where the arguments are declared between the
11574 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
11575 uses five spaces as the indentation.  If you want to indent with just
11576 one space instead, use @option{-i " "}.
11577
11578 @item -k
11579 Keep the @samp{.X} files.  Normally, they are deleted after conversion
11580 is finished.
11581
11582 @item -l
11583 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
11584 a prototype declaration for each function in each block which calls the
11585 function without any declaration.  This option applies only to
11586 @code{protoize}.
11587
11588 @item -n
11589 Make no real changes.  This mode just prints information about the conversions
11590 that would have been done without @option{-n}.
11591
11592 @item -N
11593 Make no @samp{.save} files.  The original files are simply deleted.
11594 Use this option with caution.
11595
11596 @item -p @var{program}
11597 Use the program @var{program} as the compiler.  Normally, the name
11598 @file{gcc} is used.
11599
11600 @item -q
11601 Work quietly.  Most warnings are suppressed.
11602
11603 @item -v
11604 Print the version number, just like @option{-v} for @command{gcc}.
11605 @end table
11606
11607 If you need special compiler options to compile one of your program's
11608 source files, then you should generate that file's @samp{.X} file
11609 specially, by running @command{gcc} on that source file with the
11610 appropriate options and the option @option{-aux-info}.  Then run
11611 @code{protoize} on the entire set of files.  @code{protoize} will use
11612 the existing @samp{.X} file because it is newer than the source file.
11613 For example:
11614
11615 @smallexample
11616 gcc -Dfoo=bar file1.c -aux-info file1.X
11617 protoize *.c
11618 @end smallexample
11619
11620 @noindent
11621 You need to include the special files along with the rest in the
11622 @code{protoize} command, even though their @samp{.X} files already
11623 exist, because otherwise they won't get converted.
11624
11625 @xref{Protoize Caveats}, for more information on how to use
11626 @code{protoize} successfully.