gcc/
[official-gcc.git] / gcc / doc / invoke.texi
blob3fc575d34de25c585a7abfb9855e86d28b6de5c9
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 @c Free Software Foundation, Inc.
4 @c This is part of the GCC manual.
5 @c For copying conditions, see the file gcc.texi.
7 @ignore
8 @c man begin INCLUDE
9 @include gcc-vers.texi
10 @c man end
12 @c man begin COPYRIGHT
13 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
14 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
15 Free Software Foundation, Inc.
17 Permission is granted to copy, distribute and/or modify this document
18 under the terms of the GNU Free Documentation License, Version 1.2 or
19 any later version published by the Free Software Foundation; with the
20 Invariant Sections being ``GNU General Public License'' and ``Funding
21 Free Software'', the Front-Cover texts being (a) (see below), and with
22 the Back-Cover Texts being (b) (see below).  A copy of the license is
23 included in the gfdl(7) man page.
25 (a) The FSF's Front-Cover Text is:
27      A GNU Manual
29 (b) The FSF's Back-Cover Text is:
31      You have freedom to copy and modify this GNU Manual, like GNU
32      software.  Copies published by the Free Software Foundation raise
33      funds for GNU development.
34 @c man end
35 @c Set file name and title for the man page.
36 @setfilename gcc
37 @settitle GNU project C and C++ compiler
38 @c man begin SYNOPSIS
39 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
40     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
41     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
42     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
43     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
44     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
45     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
47 Only the most useful options are listed here; see below for the
48 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
49 @c man end
50 @c man begin SEEALSO
51 gpl(7), gfdl(7), fsf-funding(7),
52 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
53 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
54 @file{ld}, @file{binutils} and @file{gdb}.
55 @c man end
56 @c man begin BUGS
57 For instructions on reporting bugs, see
58 @w{@value{BUGURL}}.
59 @c man end
60 @c man begin AUTHOR
61 See the Info entry for @command{gcc}, or
62 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
63 for contributors to GCC@.
64 @c man end
65 @end ignore
67 @node Invoking GCC
68 @chapter GCC Command Options
69 @cindex GCC command options
70 @cindex command options
71 @cindex options, GCC command
73 @c man begin DESCRIPTION
74 When you invoke GCC, it normally does preprocessing, compilation,
75 assembly and linking.  The ``overall options'' allow you to stop this
76 process at an intermediate stage.  For example, the @option{-c} option
77 says not to run the linker.  Then the output consists of object files
78 output by the assembler.
80 Other options are passed on to one stage of processing.  Some options
81 control the preprocessor and others the compiler itself.  Yet other
82 options control the assembler and linker; most of these are not
83 documented here, since you rarely need to use any of them.
85 @cindex C compilation options
86 Most of the command line options that you can use with GCC are useful
87 for C programs; when an option is only useful with another language
88 (usually C++), the explanation says so explicitly.  If the description
89 for a particular option does not mention a source language, you can use
90 that option with all supported languages.
92 @cindex C++ compilation options
93 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
94 options for compiling C++ programs.
96 @cindex grouping options
97 @cindex options, grouping
98 The @command{gcc} program accepts options and file names as operands.  Many
99 options have multi-letter names; therefore multiple single-letter options
100 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
101 -v}}.
103 @cindex order of options
104 @cindex options, order
105 You can mix options and other arguments.  For the most part, the order
106 you use doesn't matter.  Order does matter when you use several
107 options of the same kind; for example, if you specify @option{-L} more
108 than once, the directories are searched in the order specified.  Also,
109 the placement of the @option{-l} option is significant.
111 Many options have long names starting with @samp{-f} or with
112 @samp{-W}---for example,
113 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
114 these have both positive and negative forms; the negative form of
115 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
116 only one of these two forms, whichever one is not the default.
118 @c man end
120 @xref{Option Index}, for an index to GCC's options.
122 @menu
123 * Option Summary::      Brief list of all options, without explanations.
124 * Overall Options::     Controlling the kind of output:
125                         an executable, object files, assembler files,
126                         or preprocessed source.
127 * Invoking G++::        Compiling C++ programs.
128 * C Dialect Options::   Controlling the variant of C language compiled.
129 * C++ Dialect Options:: Variations on C++.
130 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
131                         and Objective-C++.
132 * Language Independent Options:: Controlling how diagnostics should be
133                         formatted.
134 * Warning Options::     How picky should the compiler be?
135 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
136 * Optimize Options::    How much optimization?
137 * Preprocessor Options:: Controlling header files and macro definitions.
138                          Also, getting dependency information for Make.
139 * Assembler Options::   Passing options to the assembler.
140 * Link Options::        Specifying libraries and so on.
141 * Directory Options::   Where to find header files and libraries.
142                         Where to find the compiler executable files.
143 * Spec Files::          How to pass switches to sub-processes.
144 * Target Options::      Running a cross-compiler, or an old version of GCC.
145 * Submodel Options::    Specifying minor hardware or convention variations,
146                         such as 68010 vs 68020.
147 * Code Gen Options::    Specifying conventions for function calls, data layout
148                         and register usage.
149 * Environment Variables:: Env vars that affect GCC.
150 * Precompiled Headers:: Compiling a header once, and using it many times.
151 @end menu
153 @c man begin OPTIONS
155 @node Option Summary
156 @section Option Summary
158 Here is a summary of all the options, grouped by type.  Explanations are
159 in the following sections.
161 @table @emph
162 @item Overall Options
163 @xref{Overall Options,,Options Controlling the Kind of Output}.
164 @gccoptlist{-c  -S  -E  -o @var{file}  -combine  -pipe  -pass-exit-codes  @gol
165 -x @var{language}  -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  @gol
166 --version -wrapper@@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg}}
168 @item C Language Options
169 @xref{C Dialect Options,,Options Controlling C Dialect}.
170 @gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
171 -aux-info @var{filename} @gol
172 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
173 -fhosted  -ffreestanding -fopenmp -fms-extensions @gol
174 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
175 -fallow-single-precision  -fcond-mismatch -flax-vector-conversions @gol
176 -fsigned-bitfields  -fsigned-char @gol
177 -funsigned-bitfields  -funsigned-char}
179 @item C++ Language Options
180 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
181 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
182 -fconserve-space  -ffriend-injection @gol
183 -fno-elide-constructors @gol
184 -fno-enforce-eh-specs @gol
185 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
186 -fno-implicit-templates @gol
187 -fno-implicit-inline-templates @gol
188 -fno-implement-inlines  -fms-extensions @gol
189 -fno-nonansi-builtins  -fno-operator-names @gol
190 -fno-optional-diags  -fpermissive @gol
191 -fno-pretty-templates @gol
192 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
193 -fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
194 -fno-default-inline  -fvisibility-inlines-hidden @gol
195 -fvisibility-ms-compat @gol
196 -Wabi  -Wctor-dtor-privacy @gol
197 -Wnon-virtual-dtor  -Wreorder @gol
198 -Weffc++  -Wstrict-null-sentinel @gol
199 -Wno-non-template-friend  -Wold-style-cast @gol
200 -Woverloaded-virtual  -Wno-pmf-conversions @gol
201 -Wsign-promo}
203 @item Objective-C and Objective-C++ Language Options
204 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
205 Objective-C and Objective-C++ Dialects}.
206 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
207 -fgnu-runtime  -fnext-runtime @gol
208 -fno-nil-receivers @gol
209 -fobjc-call-cxx-cdtors @gol
210 -fobjc-direct-dispatch @gol
211 -fobjc-exceptions @gol
212 -fobjc-gc @gol
213 -freplace-objc-classes @gol
214 -fzero-link @gol
215 -gen-decls @gol
216 -Wassign-intercept @gol
217 -Wno-protocol  -Wselector @gol
218 -Wstrict-selector-match @gol
219 -Wundeclared-selector}
221 @item Language Independent Options
222 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
223 @gccoptlist{-fmessage-length=@var{n}  @gol
224 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
225 -fdiagnostics-show-option}
227 @item Warning Options
228 @xref{Warning Options,,Options to Request or Suppress Warnings}.
229 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
230 -w  -Wextra  -Wall  -Waddress  -Waggregate-return  -Warray-bounds @gol
231 -Wno-attributes -Wno-builtin-macro-redefined @gol
232 -Wc++-compat -Wc++0x-compat -Wcast-align  -Wcast-qual  @gol
233 -Wchar-subscripts -Wclobbered  -Wcomment @gol
234 -Wconversion  -Wcoverage-mismatch  -Wno-deprecated  @gol
235 -Wno-deprecated-declarations -Wdisabled-optimization  @gol
236 -Wno-div-by-zero -Wempty-body  -Wenum-compare -Wno-endif-labels @gol
237 -Werror  -Werror=* @gol
238 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
239 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
240 -Wformat-security  -Wformat-y2k @gol
241 -Wframe-larger-than=@var{len} -Wignored-qualifiers @gol
242 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
243 -Winit-self  -Winline @gol
244 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
245 -Winvalid-pch -Wlarger-than=@var{len}  -Wunsafe-loop-optimizations @gol
246 -Wlogical-op -Wlong-long @gol
247 -Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
248 -Wmissing-format-attribute  -Wmissing-include-dirs @gol
249 -Wmissing-noreturn  -Wno-mudflap @gol
250 -Wno-multichar  -Wnonnull  -Wno-overflow @gol
251 -Woverlength-strings  -Wpacked  -Wpacked-bitfield-compat  -Wpadded @gol
252 -Wparentheses  -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
253 -Wpointer-arith  -Wno-pointer-to-int-cast @gol
254 -Wredundant-decls @gol
255 -Wreturn-type  -Wsequence-point  -Wshadow @gol
256 -Wsign-compare  -Wsign-conversion  -Wstack-protector @gol
257 -Wstrict-aliasing -Wstrict-aliasing=n @gol
258 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
259 -Wswitch  -Wswitch-default  -Wswitch-enum -Wsync-nand @gol
260 -Wsystem-headers  -Wtrigraphs  -Wtype-limits  -Wundef  -Wuninitialized @gol
261 -Wunknown-pragmas  -Wno-pragmas -Wunreachable-code @gol
262 -Wunsuffixed-float-constants  -Wunused  -Wunused-function @gol
263 -Wunused-label  -Wunused-parameter  -Wunused-value  -Wunused-variable @gol
264 -Wvariadic-macros -Wvla @gol
265 -Wvolatile-register-var  -Wwrite-strings}
267 @item C and Objective-C-only Warning Options
268 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
269 -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
270 -Wold-style-declaration  -Wold-style-definition @gol
271 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
272 -Wdeclaration-after-statement -Wpointer-sign}
274 @item Debugging Options
275 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
276 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
277 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
278 -fdump-noaddr -fdump-unnumbered @gol
279 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
280 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
281 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
282 -fdump-statistics @gol
283 -fdump-tree-all @gol
284 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
285 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
286 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
287 -fdump-tree-ch @gol
288 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
289 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
290 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
291 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
292 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
293 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
294 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
295 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
296 -fdump-tree-nrv -fdump-tree-vect @gol
297 -fdump-tree-sink @gol
298 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
299 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
300 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
301 -ftree-vectorizer-verbose=@var{n} @gol
302 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
303 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
304 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
305 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
306 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
307 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
308 -ftest-coverage  -ftime-report -fvar-tracking @gol
309 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
310 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
311 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
312 -fdebug-prefix-map=@var{old}=@var{new} @gol
313 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
314 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
315 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
316 -print-multi-directory  -print-multi-lib @gol
317 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
318 -print-sysroot -print-sysroot-headers-suffix @gol
319 -save-temps -save-temps=cwd -save-temps=obj -time}
321 @item Optimization Options
322 @xref{Optimize Options,,Options that Control Optimization}.
323 @gccoptlist{
324 -falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
325 -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
326 -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
327 -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
328 -fcheck-data-deps -fconserve-stack -fcprop-registers -fcrossjumping @gol
329 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range @gol
330 -fdata-sections -fdce -fdce @gol
331 -fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse @gol
332 -fearly-inlining -fexpensive-optimizations -ffast-math @gol
333 -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
334 -fforward-propagate -ffunction-sections @gol
335 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol
336 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
337 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
338 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta @gol 
339 -fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
340 -fipa-type-escape -fira-algorithm=@var{algorithm} @gol
341 -fira-region=@var{region} -fira-coalesce -fno-ira-share-save-slots @gol
342 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
343 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
344 -floop-block -floop-interchange -floop-strip-mine @gol
345 -fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
346 -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
347 -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
348 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
349 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
350 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
351 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
352 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
353 -fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays @gol
354 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
355 -fprofile-generate=@var{path} @gol
356 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
357 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
358 -freorder-blocks-and-partition -freorder-functions @gol
359 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
360 -frounding-math -fsched2-use-superblocks @gol
361 -fsched2-use-traces -fsched-spec-load -fsched-spec-load-dangerous @gol
362 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
363 -fschedule-insns -fschedule-insns2 -fsection-anchors -fsee @gol
364 -fselective-scheduling -fselective-scheduling2 @gol
365 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
366 -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
367 -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
368 -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
369 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
370 -ftree-copyrename -ftree-dce @gol
371 -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im @gol
372 -ftree-loop-distribution @gol
373 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
374 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-reassoc @gol
375 -ftree-sink -ftree-sra -ftree-switch-conversion @gol
376 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
377 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
378 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
379 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
380 -fwhole-program @gol
381 --param @var{name}=@var{value}
382 -O  -O0  -O1  -O2  -O3  -Os}
384 @item Preprocessor Options
385 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
386 @gccoptlist{-A@var{question}=@var{answer} @gol
387 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
388 -C  -dD  -dI  -dM  -dN @gol
389 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
390 -idirafter @var{dir} @gol
391 -include @var{file}  -imacros @var{file} @gol
392 -iprefix @var{file}  -iwithprefix @var{dir} @gol
393 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
394 -imultilib @var{dir} -isysroot @var{dir} @gol
395 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
396 -P  -fworking-directory  -remap @gol
397 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
398 -Xpreprocessor @var{option}}
400 @item Assembler Option
401 @xref{Assembler Options,,Passing Options to the Assembler}.
402 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
404 @item Linker Options
405 @xref{Link Options,,Options for Linking}.
406 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
407 -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
408 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
409 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
410 -u @var{symbol}}
412 @item Directory Options
413 @xref{Directory Options,,Options for Directory Search}.
414 @gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}
415 -specs=@var{file}  -I- --sysroot=@var{dir}}
417 @item Target Options
418 @c I wrote this xref this way to avoid overfull hbox. -- rms
419 @xref{Target Options}.
420 @gccoptlist{-V @var{version}  -b @var{machine}}
422 @item Machine Dependent Options
423 @xref{Submodel Options,,Hardware Models and Configurations}.
424 @c This list is ordered alphanumerically by subsection name.
425 @c Try and put the significant identifier (CPU or system) first,
426 @c so users have a clue at guessing where the ones they want will be.
428 @emph{ARC Options}
429 @gccoptlist{-EB  -EL @gol
430 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
431 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
433 @emph{ARM Options}
434 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
435 -mabi=@var{name} @gol
436 -mapcs-stack-check  -mno-apcs-stack-check @gol
437 -mapcs-float  -mno-apcs-float @gol
438 -mapcs-reentrant  -mno-apcs-reentrant @gol
439 -msched-prolog  -mno-sched-prolog @gol
440 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
441 -mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
442 -mthumb-interwork  -mno-thumb-interwork @gol
443 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
444 -mstructure-size-boundary=@var{n} @gol
445 -mabort-on-noreturn @gol
446 -mlong-calls  -mno-long-calls @gol
447 -msingle-pic-base  -mno-single-pic-base @gol
448 -mpic-register=@var{reg} @gol
449 -mnop-fun-dllimport @gol
450 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
451 -mpoke-function-name @gol
452 -mthumb  -marm @gol
453 -mtpcs-frame  -mtpcs-leaf-frame @gol
454 -mcaller-super-interworking  -mcallee-super-interworking @gol
455 -mtp=@var{name} @gol
456 -mword-relocations @gol
457 -mfix-cortex-m3-ldrd}
459 @emph{AVR Options}
460 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
461 -mcall-prologues  -mtiny-stack  -mint8}
463 @emph{Blackfin Options}
464 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
465 -msim -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
466 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
467 -mlow-64k -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
468 -mno-id-shared-library  -mshared-library-id=@var{n} @gol
469 -mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
470 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
471 -mfast-fp -minline-plt -mmulticore  -mcorea  -mcoreb  -msdram @gol
472 -micplb}
474 @emph{CRIS Options}
475 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
476 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
477 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
478 -mstack-align  -mdata-align  -mconst-align @gol
479 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
480 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
481 -mmul-bug-workaround  -mno-mul-bug-workaround}
483 @emph{CRX Options}
484 @gccoptlist{-mmac -mpush-args}
486 @emph{Darwin Options}
487 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
488 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
489 -client_name  -compatibility_version  -current_version @gol
490 -dead_strip @gol
491 -dependency-file  -dylib_file  -dylinker_install_name @gol
492 -dynamic  -dynamiclib  -exported_symbols_list @gol
493 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
494 -force_flat_namespace  -headerpad_max_install_names @gol
495 -iframework @gol
496 -image_base  -init  -install_name  -keep_private_externs @gol
497 -multi_module  -multiply_defined  -multiply_defined_unused @gol
498 -noall_load   -no_dead_strip_inits_and_terms @gol
499 -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
500 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
501 -private_bundle  -read_only_relocs  -sectalign @gol
502 -sectobjectsymbols  -whyload  -seg1addr @gol
503 -sectcreate  -sectobjectsymbols  -sectorder @gol
504 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
505 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
506 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
507 -single_module  -static  -sub_library  -sub_umbrella @gol
508 -twolevel_namespace  -umbrella  -undefined @gol
509 -unexported_symbols_list  -weak_reference_mismatches @gol
510 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
511 -mkernel -mone-byte-bool}
513 @emph{DEC Alpha Options}
514 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
515 -mieee  -mieee-with-inexact  -mieee-conformant @gol
516 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
517 -mtrap-precision=@var{mode}  -mbuild-constants @gol
518 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
519 -mbwx  -mmax  -mfix  -mcix @gol
520 -mfloat-vax  -mfloat-ieee @gol
521 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
522 -msmall-text  -mlarge-text @gol
523 -mmemory-latency=@var{time}}
525 @emph{DEC Alpha/VMS Options}
526 @gccoptlist{-mvms-return-codes}
528 @emph{FR30 Options}
529 @gccoptlist{-msmall-model -mno-lsim}
531 @emph{FRV Options}
532 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
533 -mhard-float  -msoft-float @gol
534 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
535 -mdouble  -mno-double @gol
536 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
537 -mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
538 -mlinked-fp  -mlong-calls  -malign-labels @gol
539 -mlibrary-pic  -macc-4  -macc-8 @gol
540 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
541 -moptimize-membar -mno-optimize-membar @gol
542 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
543 -mvliw-branch  -mno-vliw-branch @gol
544 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
545 -mno-nested-cond-exec  -mtomcat-stats @gol
546 -mTLS -mtls @gol
547 -mcpu=@var{cpu}}
549 @emph{GNU/Linux Options}
550 @gccoptlist{-muclibc}
552 @emph{H8/300 Options}
553 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
555 @emph{HPPA Options}
556 @gccoptlist{-march=@var{architecture-type} @gol
557 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
558 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
559 -mfixed-range=@var{register-range} @gol
560 -mjump-in-delay -mlinker-opt -mlong-calls @gol
561 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
562 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
563 -mno-jump-in-delay  -mno-long-load-store @gol
564 -mno-portable-runtime  -mno-soft-float @gol
565 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
566 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
567 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
568 -munix=@var{unix-std}  -nolibdld  -static  -threads}
570 @emph{i386 and x86-64 Options}
571 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
572 -mfpmath=@var{unit} @gol
573 -masm=@var{dialect}  -mno-fancy-math-387 @gol
574 -mno-fp-ret-in-387  -msoft-float @gol
575 -mno-wide-multiply  -mrtd  -malign-double @gol
576 -mpreferred-stack-boundary=@var{num}
577 -mincoming-stack-boundary=@var{num}
578 -mcld -mcx16 -msahf -mrecip @gol
579 -mmmx  -msse  -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
580 -maes -mpclmul @gol
581 -msse4a -m3dnow -mpopcnt -mabm -msse5 @gol
582 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
583 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
584 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
585 -m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
586 -mveclibabi=@var{type} -mpc32 -mpc64 -mpc80 -mstackrealign @gol
587 -momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
588 -mcmodel=@var{code-model} -mabi=@var{name} @gol
589 -m32  -m64 -mlarge-data-threshold=@var{num} @gol
590 -mfused-madd -mno-fused-madd -msse2avx}
592 @emph{IA-64 Options}
593 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
594 -mvolatile-asm-stop  -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  @gol
599 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
600 -mno-dwarf2-asm -mearly-stop-bits @gol
601 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
602 -mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
603 -mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
604 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
605 -msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
606 -mno-sched-prefer-non-data-spec-insns @gol
607 -mno-sched-prefer-non-control-spec-insns @gol
608 -mno-sched-count-spec-in-critical-path}
610 @emph{M32R/D Options}
611 @gccoptlist{-m32r2 -m32rx -m32r @gol
612 -mdebug @gol
613 -malign-loops -mno-align-loops @gol
614 -missue-rate=@var{number} @gol
615 -mbranch-cost=@var{number} @gol
616 -mmodel=@var{code-size-model-type} @gol
617 -msdata=@var{sdata-type} @gol
618 -mno-flush-func -mflush-func=@var{name} @gol
619 -mno-flush-trap -mflush-trap=@var{number} @gol
620 -G @var{num}}
622 @emph{M32C Options}
623 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
625 @emph{M680x0 Options}
626 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
627 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
628 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
629 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
630 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
631 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
632 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
633 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
634 -mxgot -mno-xgot}
636 @emph{M68hc1x Options}
637 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
638 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
639 -msoft-reg-count=@var{count}}
641 @emph{MCore Options}
642 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
643 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
644 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
645 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
646 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
648 @emph{MIPS Options}
649 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
650 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2 @gol
651 -mips64  -mips64r2 @gol
652 -mips16  -mno-mips16  -mflip-mips16 @gol
653 -minterlink-mips16  -mno-interlink-mips16 @gol
654 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
655 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
656 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
657 -msingle-float  -mdouble-float  -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
658 -mfpu=@var{fpu-type} @gol
659 -msmartmips  -mno-smartmips @gol
660 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
661 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
662 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
663 -G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
664 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
665 -membedded-data  -mno-embedded-data @gol
666 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
667 -mcode-readable=@var{setting} @gol
668 -msplit-addresses  -mno-split-addresses @gol
669 -mexplicit-relocs  -mno-explicit-relocs @gol
670 -mcheck-zero-division  -mno-check-zero-division @gol
671 -mdivide-traps  -mdivide-breaks @gol
672 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
673 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
674 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
675 -mfix-r10000 -mno-fix-r10000  -mfix-vr4120  -mno-fix-vr4120 @gol
676 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
677 -mflush-func=@var{func}  -mno-flush-func @gol
678 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
679 -mfp-exceptions -mno-fp-exceptions @gol
680 -mvr4130-align -mno-vr4130-align}
682 @emph{MMIX Options}
683 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
684 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
685 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
686 -mno-base-addresses  -msingle-exit  -mno-single-exit}
688 @emph{MN10300 Options}
689 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
690 -mam33  -mno-am33 @gol
691 -mam33-2  -mno-am33-2 @gol
692 -mreturn-pointer-on-d0 @gol
693 -mno-crt0  -mrelax}
695 @emph{PDP-11 Options}
696 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
697 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
698 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
699 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
700 -mbranch-expensive  -mbranch-cheap @gol
701 -msplit  -mno-split  -munix-asm  -mdec-asm}
703 @emph{picoChip Options}
704 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N}
705 -msymbol-as-address -mno-inefficient-warnings}
707 @emph{PowerPC Options}
708 See RS/6000 and PowerPC Options.
710 @emph{RS/6000 and PowerPC Options}
711 @gccoptlist{-mcpu=@var{cpu-type} @gol
712 -mtune=@var{cpu-type} @gol
713 -mpower  -mno-power  -mpower2  -mno-power2 @gol
714 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
715 -maltivec  -mno-altivec @gol
716 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
717 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
718 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mfprnd  -mno-fprnd @gol
719 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
720 -mnew-mnemonics  -mold-mnemonics @gol
721 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
722 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
723 -malign-power  -malign-natural @gol
724 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
725 -msingle-float -mdouble-float -msimple-fpu @gol
726 -mstring  -mno-string  -mupdate  -mno-update @gol
727 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
728 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
729 -mstrict-align  -mno-strict-align  -mrelocatable @gol
730 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
731 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
732 -mdynamic-no-pic  -maltivec  -mswdiv @gol
733 -mprioritize-restricted-insns=@var{priority} @gol
734 -msched-costly-dep=@var{dependence_type} @gol
735 -minsert-sched-nops=@var{scheme} @gol
736 -mcall-sysv  -mcall-netbsd @gol
737 -maix-struct-return  -msvr4-struct-return @gol
738 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
739 -misel -mno-isel @gol
740 -misel=yes  -misel=no @gol
741 -mspe -mno-spe @gol
742 -mspe=yes  -mspe=no @gol
743 -mpaired @gol
744 -mgen-cell-microcode -mwarn-cell-microcode @gol
745 -mvrsave -mno-vrsave @gol
746 -mmulhw -mno-mulhw @gol
747 -mdlmzb -mno-dlmzb @gol
748 -mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
749 -mprototype  -mno-prototype @gol
750 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
751 -msdata=@var{opt}  -mvxworks  -G @var{num}  -pthread}
753 @emph{S/390 and zSeries Options}
754 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
755 -mhard-float  -msoft-float  -mhard-dfp -mno-hard-dfp @gol
756 -mlong-double-64 -mlong-double-128 @gol
757 -mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
758 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
759 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
760 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
761 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
763 @emph{Score Options}
764 @gccoptlist{-meb -mel @gol
765 -mnhwloop @gol
766 -muls @gol
767 -mmac @gol
768 -mscore5 -mscore5u -mscore7 -mscore7d}
770 @emph{SH Options}
771 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
772 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
773 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
774 -m5-64media  -m5-64media-nofpu @gol
775 -m5-32media  -m5-32media-nofpu @gol
776 -m5-compact  -m5-compact-nofpu @gol
777 -mb  -ml  -mdalign  -mrelax @gol
778 -mbigtable  -mfmovd  -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
779 -mieee  -mbitops  -misize  -minline-ic_invalidate -mpadstruct  -mspace @gol
780 -mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
781 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
782 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
783 -minvalid-symbols}
785 @emph{SPARC Options}
786 @gccoptlist{-mcpu=@var{cpu-type} @gol
787 -mtune=@var{cpu-type} @gol
788 -mcmodel=@var{code-model} @gol
789 -m32  -m64  -mapp-regs  -mno-app-regs @gol
790 -mfaster-structs  -mno-faster-structs @gol
791 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
792 -mhard-quad-float  -msoft-quad-float @gol
793 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
794 -mstack-bias  -mno-stack-bias @gol
795 -munaligned-doubles  -mno-unaligned-doubles @gol
796 -mv8plus  -mno-v8plus  -mvis  -mno-vis
797 -threads -pthreads -pthread}
799 @emph{SPU Options}
800 @gccoptlist{-mwarn-reloc -merror-reloc @gol
801 -msafe-dma -munsafe-dma @gol
802 -mbranch-hints @gol
803 -msmall-mem -mlarge-mem -mstdmain @gol
804 -mfixed-range=@var{register-range}}
806 @emph{System V Options}
807 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
809 @emph{V850 Options}
810 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
811 -mprolog-function  -mno-prolog-function  -mspace @gol
812 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
813 -mapp-regs  -mno-app-regs @gol
814 -mdisable-callt  -mno-disable-callt @gol
815 -mv850e1 @gol
816 -mv850e @gol
817 -mv850  -mbig-switch}
819 @emph{VAX Options}
820 @gccoptlist{-mg  -mgnu  -munix}
822 @emph{VxWorks Options}
823 @gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
824 -Xbind-lazy  -Xbind-now}
826 @emph{x86-64 Options}
827 See i386 and x86-64 Options.
829 @emph{i386 and x86-64 Windows Options}
830 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
831 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows}
833 @emph{Xstormy16 Options}
834 @gccoptlist{-msim}
836 @emph{Xtensa Options}
837 @gccoptlist{-mconst16 -mno-const16 @gol
838 -mfused-madd  -mno-fused-madd @gol
839 -mserialize-volatile  -mno-serialize-volatile @gol
840 -mtext-section-literals  -mno-text-section-literals @gol
841 -mtarget-align  -mno-target-align @gol
842 -mlongcalls  -mno-longcalls}
844 @emph{zSeries Options}
845 See S/390 and zSeries Options.
847 @item Code Generation Options
848 @xref{Code Gen Options,,Options for Code Generation Conventions}.
849 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
850 -ffixed-@var{reg}  -fexceptions @gol
851 -fnon-call-exceptions  -funwind-tables @gol
852 -fasynchronous-unwind-tables @gol
853 -finhibit-size-directive  -finstrument-functions @gol
854 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
855 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
856 -fno-common  -fno-ident @gol
857 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
858 -fno-jump-tables @gol
859 -frecord-gcc-switches @gol
860 -freg-struct-return  -fshort-enums @gol
861 -fshort-double  -fshort-wchar @gol
862 -fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
863 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
864 -fno-stack-limit  -fargument-alias  -fargument-noalias @gol
865 -fargument-noalias-global  -fargument-noalias-anything @gol
866 -fleading-underscore  -ftls-model=@var{model} @gol
867 -ftrapv  -fwrapv  -fbounds-check @gol
868 -fvisibility}
869 @end table
871 @menu
872 * Overall Options::     Controlling the kind of output:
873                         an executable, object files, assembler files,
874                         or preprocessed source.
875 * C Dialect Options::   Controlling the variant of C language compiled.
876 * C++ Dialect Options:: Variations on C++.
877 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
878                         and Objective-C++.
879 * Language Independent Options:: Controlling how diagnostics should be
880                         formatted.
881 * Warning Options::     How picky should the compiler be?
882 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
883 * Optimize Options::    How much optimization?
884 * Preprocessor Options:: Controlling header files and macro definitions.
885                          Also, getting dependency information for Make.
886 * Assembler Options::   Passing options to the assembler.
887 * Link Options::        Specifying libraries and so on.
888 * Directory Options::   Where to find header files and libraries.
889                         Where to find the compiler executable files.
890 * Spec Files::          How to pass switches to sub-processes.
891 * Target Options::      Running a cross-compiler, or an old version of GCC.
892 @end menu
894 @node Overall Options
895 @section Options Controlling the Kind of Output
897 Compilation can involve up to four stages: preprocessing, compilation
898 proper, assembly and linking, always in that order.  GCC is capable of
899 preprocessing and compiling several files either into several
900 assembler input files, or into one assembler input file; then each
901 assembler input file produces an object file, and linking combines all
902 the object files (those newly compiled, and those specified as input)
903 into an executable file.
905 @cindex file name suffix
906 For any given input file, the file name suffix determines what kind of
907 compilation is done:
909 @table @gcctabopt
910 @item @var{file}.c
911 C source code which must be preprocessed.
913 @item @var{file}.i
914 C source code which should not be preprocessed.
916 @item @var{file}.ii
917 C++ source code which should not be preprocessed.
919 @item @var{file}.m
920 Objective-C source code.  Note that you must link with the @file{libobjc}
921 library to make an Objective-C program work.
923 @item @var{file}.mi
924 Objective-C source code which should not be preprocessed.
926 @item @var{file}.mm
927 @itemx @var{file}.M
928 Objective-C++ source code.  Note that you must link with the @file{libobjc}
929 library to make an Objective-C++ program work.  Note that @samp{.M} refers
930 to a literal capital M@.
932 @item @var{file}.mii
933 Objective-C++ source code which should not be preprocessed.
935 @item @var{file}.h
936 C, C++, Objective-C or Objective-C++ header file to be turned into a
937 precompiled header.
939 @item @var{file}.cc
940 @itemx @var{file}.cp
941 @itemx @var{file}.cxx
942 @itemx @var{file}.cpp
943 @itemx @var{file}.CPP
944 @itemx @var{file}.c++
945 @itemx @var{file}.C
946 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
947 the last two letters must both be literally @samp{x}.  Likewise,
948 @samp{.C} refers to a literal capital C@.
950 @item @var{file}.mm
951 @itemx @var{file}.M
952 Objective-C++ source code which must be preprocessed.
954 @item @var{file}.mii
955 Objective-C++ source code which should not be preprocessed.
957 @item @var{file}.hh
958 @itemx @var{file}.H
959 @itemx @var{file}.hp
960 @itemx @var{file}.hxx
961 @itemx @var{file}.hpp
962 @itemx @var{file}.HPP
963 @itemx @var{file}.h++
964 @itemx @var{file}.tcc
965 C++ header file to be turned into a precompiled header.
967 @item @var{file}.f
968 @itemx @var{file}.for
969 @itemx @var{file}.ftn
970 Fixed form Fortran source code which should not be preprocessed.
972 @item @var{file}.F
973 @itemx @var{file}.FOR
974 @itemx @var{file}.fpp
975 @itemx @var{file}.FPP
976 @itemx @var{file}.FTN
977 Fixed form Fortran source code which must be preprocessed (with the traditional
978 preprocessor).
980 @item @var{file}.f90
981 @itemx @var{file}.f95
982 @itemx @var{file}.f03
983 @itemx @var{file}.f08
984 Free form Fortran source code which should not be preprocessed.
986 @item @var{file}.F90
987 @itemx @var{file}.F95
988 @itemx @var{file}.F03
989 @itemx @var{file}.F08
990 Free form Fortran source code which must be preprocessed (with the
991 traditional preprocessor).
993 @c FIXME: Descriptions of Java file types.
994 @c @var{file}.java
995 @c @var{file}.class
996 @c @var{file}.zip
997 @c @var{file}.jar
999 @item @var{file}.ads
1000 Ada source code file which contains a library unit declaration (a
1001 declaration of a package, subprogram, or generic, or a generic
1002 instantiation), or a library unit renaming declaration (a package,
1003 generic, or subprogram renaming declaration).  Such files are also
1004 called @dfn{specs}.
1006 @item @var{file}.adb
1007 Ada source code file containing a library unit body (a subprogram or
1008 package body).  Such files are also called @dfn{bodies}.
1010 @c GCC also knows about some suffixes for languages not yet included:
1011 @c Pascal:
1012 @c @var{file}.p
1013 @c @var{file}.pas
1014 @c Ratfor:
1015 @c @var{file}.r
1017 @item @var{file}.s
1018 Assembler code.
1020 @item @var{file}.S
1021 @itemx @var{file}.sx
1022 Assembler code which must be preprocessed.
1024 @item @var{other}
1025 An object file to be fed straight into linking.
1026 Any file name with no recognized suffix is treated this way.
1027 @end table
1029 @opindex x
1030 You can specify the input language explicitly with the @option{-x} option:
1032 @table @gcctabopt
1033 @item -x @var{language}
1034 Specify explicitly the @var{language} for the following input files
1035 (rather than letting the compiler choose a default based on the file
1036 name suffix).  This option applies to all following input files until
1037 the next @option{-x} option.  Possible values for @var{language} are:
1038 @smallexample
1039 c  c-header  c-cpp-output
1040 c++  c++-header  c++-cpp-output
1041 objective-c  objective-c-header  objective-c-cpp-output
1042 objective-c++ objective-c++-header objective-c++-cpp-output
1043 assembler  assembler-with-cpp
1045 f77  f77-cpp-input f95  f95-cpp-input
1046 java
1047 @end smallexample
1049 @item -x none
1050 Turn off any specification of a language, so that subsequent files are
1051 handled according to their file name suffixes (as they are if @option{-x}
1052 has not been used at all).
1054 @item -pass-exit-codes
1055 @opindex pass-exit-codes
1056 Normally the @command{gcc} program will exit with the code of 1 if any
1057 phase of the compiler returns a non-success return code.  If you specify
1058 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1059 numerically highest error produced by any phase that returned an error
1060 indication.  The C, C++, and Fortran frontends return 4, if an internal
1061 compiler error is encountered.
1062 @end table
1064 If you only want some of the stages of compilation, you can use
1065 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1066 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1067 @command{gcc} is to stop.  Note that some combinations (for example,
1068 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1070 @table @gcctabopt
1071 @item -c
1072 @opindex c
1073 Compile or assemble the source files, but do not link.  The linking
1074 stage simply is not done.  The ultimate output is in the form of an
1075 object file for each source file.
1077 By default, the object file name for a source file is made by replacing
1078 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1080 Unrecognized input files, not requiring compilation or assembly, are
1081 ignored.
1083 @item -S
1084 @opindex S
1085 Stop after the stage of compilation proper; do not assemble.  The output
1086 is in the form of an assembler code file for each non-assembler input
1087 file specified.
1089 By default, the assembler file name for a source file is made by
1090 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1092 Input files that don't require compilation are ignored.
1094 @item -E
1095 @opindex E
1096 Stop after the preprocessing stage; do not run the compiler proper.  The
1097 output is in the form of preprocessed source code, which is sent to the
1098 standard output.
1100 Input files which don't require preprocessing are ignored.
1102 @cindex output file option
1103 @item -o @var{file}
1104 @opindex o
1105 Place output in file @var{file}.  This applies regardless to whatever
1106 sort of output is being produced, whether it be an executable file,
1107 an object file, an assembler file or preprocessed C code.
1109 If @option{-o} is not specified, the default is to put an executable
1110 file in @file{a.out}, the object file for
1111 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1112 assembler file in @file{@var{source}.s}, a precompiled header file in
1113 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1114 standard output.
1116 @item -v
1117 @opindex v
1118 Print (on standard error output) the commands executed to run the stages
1119 of compilation.  Also print the version number of the compiler driver
1120 program and of the preprocessor and the compiler proper.
1122 @item -###
1123 @opindex ###
1124 Like @option{-v} except the commands are not executed and all command
1125 arguments are quoted.  This is useful for shell scripts to capture the
1126 driver-generated command lines.
1128 @item -pipe
1129 @opindex pipe
1130 Use pipes rather than temporary files for communication between the
1131 various stages of compilation.  This fails to work on some systems where
1132 the assembler is unable to read from a pipe; but the GNU assembler has
1133 no trouble.
1135 @item -combine
1136 @opindex combine
1137 If you are compiling multiple source files, this option tells the driver
1138 to pass all the source files to the compiler at once (for those
1139 languages for which the compiler can handle this).  This will allow
1140 intermodule analysis (IMA) to be performed by the compiler.  Currently the only
1141 language for which this is supported is C@.  If you pass source files for
1142 multiple languages to the driver, using this option, the driver will invoke
1143 the compiler(s) that support IMA once each, passing each compiler all the
1144 source files appropriate for it.  For those languages that do not support
1145 IMA this option will be ignored, and the compiler will be invoked once for
1146 each source file in that language.  If you use this option in conjunction
1147 with @option{-save-temps}, the compiler will generate multiple
1148 pre-processed files
1149 (one for each source file), but only one (combined) @file{.o} or
1150 @file{.s} file.
1152 @item --help
1153 @opindex help
1154 Print (on the standard output) a description of the command line options
1155 understood by @command{gcc}.  If the @option{-v} option is also specified
1156 then @option{--help} will also be passed on to the various processes
1157 invoked by @command{gcc}, so that they can display the command line options
1158 they accept.  If the @option{-Wextra} option has also been specified
1159 (prior to the @option{--help} option), then command line options which
1160 have no documentation associated with them will also be displayed.
1162 @item --target-help
1163 @opindex target-help
1164 Print (on the standard output) a description of target-specific command
1165 line options for each tool.  For some targets extra target-specific
1166 information may also be printed.
1168 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1169 Print (on the standard output) a description of the command line
1170 options understood by the compiler that fit into all specified classes
1171 and qualifiers.  These are the supported classes:
1173 @table @asis
1174 @item @samp{optimizers}
1175 This will display all of the optimization options supported by the
1176 compiler.
1178 @item @samp{warnings}
1179 This will display all of the options controlling warning messages
1180 produced by the compiler.
1182 @item @samp{target}
1183 This will display target-specific options.  Unlike the
1184 @option{--target-help} option however, target-specific options of the
1185 linker and assembler will not be displayed.  This is because those
1186 tools do not currently support the extended @option{--help=} syntax.
1188 @item @samp{params}
1189 This will display the values recognized by the @option{--param}
1190 option.
1192 @item @var{language}
1193 This will display the options supported for @var{language}, where 
1194 @var{language} is the name of one of the languages supported in this 
1195 version of GCC.
1197 @item @samp{common}
1198 This will display the options that are common to all languages.
1199 @end table
1201 These are the supported qualifiers:
1203 @table @asis
1204 @item @samp{undocumented}
1205 Display only those options which are undocumented.
1207 @item @samp{joined}
1208 Display options which take an argument that appears after an equal
1209 sign in the same continuous piece of text, such as:
1210 @samp{--help=target}.
1212 @item @samp{separate}
1213 Display options which take an argument that appears as a separate word
1214 following the original option, such as: @samp{-o output-file}.
1215 @end table
1217 Thus for example to display all the undocumented target-specific
1218 switches supported by the compiler the following can be used:
1220 @smallexample
1221 --help=target,undocumented
1222 @end smallexample
1224 The sense of a qualifier can be inverted by prefixing it with the
1225 @samp{^} character, so for example to display all binary warning
1226 options (i.e., ones that are either on or off and that do not take an
1227 argument), which have a description the following can be used:
1229 @smallexample
1230 --help=warnings,^joined,^undocumented
1231 @end smallexample
1233 The argument to @option{--help=} should not consist solely of inverted
1234 qualifiers.
1236 Combining several classes is possible, although this usually
1237 restricts the output by so much that there is nothing to display.  One
1238 case where it does work however is when one of the classes is
1239 @var{target}.  So for example to display all the target-specific
1240 optimization options the following can be used:
1242 @smallexample
1243 --help=target,optimizers
1244 @end smallexample
1246 The @option{--help=} option can be repeated on the command line.  Each
1247 successive use will display its requested class of options, skipping
1248 those that have already been displayed.
1250 If the @option{-Q} option appears on the command line before the
1251 @option{--help=} option, then the descriptive text displayed by
1252 @option{--help=} is changed.  Instead of describing the displayed
1253 options, an indication is given as to whether the option is enabled,
1254 disabled or set to a specific value (assuming that the compiler
1255 knows this at the point where the @option{--help=} option is used).
1257 Here is a truncated example from the ARM port of @command{gcc}:
1259 @smallexample
1260   % gcc -Q -mabi=2 --help=target -c
1261   The following options are target specific:
1262   -mabi=                                2
1263   -mabort-on-noreturn                   [disabled]
1264   -mapcs                                [disabled]
1265 @end smallexample
1267 The output is sensitive to the effects of previous command line
1268 options, so for example it is possible to find out which optimizations
1269 are enabled at @option{-O2} by using:
1271 @smallexample
1272 -Q -O2 --help=optimizers
1273 @end smallexample
1275 Alternatively you can discover which binary optimizations are enabled
1276 by @option{-O3} by using:
1278 @smallexample
1279 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1280 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1281 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1282 @end smallexample
1284 @item --version
1285 @opindex version
1286 Display the version number and copyrights of the invoked GCC@.
1288 @item -wrapper
1289 @opindex wrapper
1290 Invoke all subcommands under a wrapper program. It takes a single
1291 comma separated list as an argument, which will be used to invoke
1292 the wrapper:
1294 @smallexample
1295 gcc -c t.c -wrapper gdb,--args
1296 @end smallexample
1298 This will invoke all subprograms of gcc under "gdb --args",
1299 thus cc1 invocation will be "gdb --args cc1 ...".
1301 @item -fplugin=@var{name}.so
1302 Load the plugin code in file @var{name}.so, assumed to be a
1303 shared object to be dlopen'd by the compiler.  The base name of
1304 the shared object file is used to identify the plugin for the
1305 purposes of argument parsing (See
1306 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1307 Each plugin should define the callback functions specified in the
1308 Plugins API.
1310 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1311 Define an argument called @var{key} with a value of @var{value}
1312 for the plugin called @var{name}.
1314 @include @value{srcdir}/../libiberty/at-file.texi
1315 @end table
1317 @node Invoking G++
1318 @section Compiling C++ Programs
1320 @cindex suffixes for C++ source
1321 @cindex C++ source file suffixes
1322 C++ source files conventionally use one of the suffixes @samp{.C},
1323 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1324 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1325 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1326 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1327 files with these names and compiles them as C++ programs even if you
1328 call the compiler the same way as for compiling C programs (usually
1329 with the name @command{gcc}).
1331 @findex g++
1332 @findex c++
1333 However, the use of @command{gcc} does not add the C++ library.
1334 @command{g++} is a program that calls GCC and treats @samp{.c},
1335 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1336 files unless @option{-x} is used, and automatically specifies linking
1337 against the C++ library.  This program is also useful when
1338 precompiling a C header file with a @samp{.h} extension for use in C++
1339 compilations.  On many systems, @command{g++} is also installed with
1340 the name @command{c++}.
1342 @cindex invoking @command{g++}
1343 When you compile C++ programs, you may specify many of the same
1344 command-line options that you use for compiling programs in any
1345 language; or command-line options meaningful for C and related
1346 languages; or options that are meaningful only for C++ programs.
1347 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1348 explanations of options for languages related to C@.
1349 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1350 explanations of options that are meaningful only for C++ programs.
1352 @node C Dialect Options
1353 @section Options Controlling C Dialect
1354 @cindex dialect options
1355 @cindex language dialect options
1356 @cindex options, dialect
1358 The following options control the dialect of C (or languages derived
1359 from C, such as C++, Objective-C and Objective-C++) that the compiler
1360 accepts:
1362 @table @gcctabopt
1363 @cindex ANSI support
1364 @cindex ISO support
1365 @item -ansi
1366 @opindex ansi
1367 In C mode, this is equivalent to @samp{-std=c89}. In C++ mode, it is
1368 equivalent to @samp{-std=c++98}.
1370 This turns off certain features of GCC that are incompatible with ISO
1371 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1372 such as the @code{asm} and @code{typeof} keywords, and
1373 predefined macros such as @code{unix} and @code{vax} that identify the
1374 type of system you are using.  It also enables the undesirable and
1375 rarely used ISO trigraph feature.  For the C compiler,
1376 it disables recognition of C++ style @samp{//} comments as well as
1377 the @code{inline} keyword.
1379 The alternate keywords @code{__asm__}, @code{__extension__},
1380 @code{__inline__} and @code{__typeof__} continue to work despite
1381 @option{-ansi}.  You would not want to use them in an ISO C program, of
1382 course, but it is useful to put them in header files that might be included
1383 in compilations done with @option{-ansi}.  Alternate predefined macros
1384 such as @code{__unix__} and @code{__vax__} are also available, with or
1385 without @option{-ansi}.
1387 The @option{-ansi} option does not cause non-ISO programs to be
1388 rejected gratuitously.  For that, @option{-pedantic} is required in
1389 addition to @option{-ansi}.  @xref{Warning Options}.
1391 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1392 option is used.  Some header files may notice this macro and refrain
1393 from declaring certain functions or defining certain macros that the
1394 ISO standard doesn't call for; this is to avoid interfering with any
1395 programs that might use these names for other things.
1397 Functions that would normally be built in but do not have semantics
1398 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1399 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1400 built-in functions provided by GCC}, for details of the functions
1401 affected.
1403 @item -std=
1404 @opindex std
1405 Determine the language standard. @xref{Standards,,Language Standards
1406 Supported by GCC}, for details of these standard versions.  This option
1407 is currently only supported when compiling C or C++. 
1409 The compiler can accept several base standards, such as @samp{c89} or
1410 @samp{c++98}, and GNU dialects of those standards, such as
1411 @samp{gnu89} or @samp{gnu++98}.  By specifying a base standard, the
1412 compiler will accept all programs following that standard and those
1413 using GNU extensions that do not contradict it.  For example,
1414 @samp{-std=c89} turns off certain features of GCC that are
1415 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1416 keywords, but not other GNU extensions that do not have a meaning in
1417 ISO C90, such as omitting the middle term of a @code{?:}
1418 expression. On the other hand, by specifying a GNU dialect of a
1419 standard, all features the compiler support are enabled, even when
1420 those features change the meaning of the base standard and some
1421 strict-conforming programs may be rejected.  The particular standard
1422 is used by @option{-pedantic} to identify which features are GNU
1423 extensions given that version of the standard. For example
1424 @samp{-std=gnu89 -pedantic} would warn about C++ style @samp{//}
1425 comments, while @samp{-std=gnu99 -pedantic} would not.
1427 A value for this option must be provided; possible values are
1429 @table @samp
1430 @item c89
1431 @itemx iso9899:1990
1432 Support all ISO C90 programs (certain GNU extensions that conflict
1433 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1435 @item iso9899:199409
1436 ISO C90 as modified in amendment 1.
1438 @item c99
1439 @itemx c9x
1440 @itemx iso9899:1999
1441 @itemx iso9899:199x
1442 ISO C99.  Note that this standard is not yet fully supported; see
1443 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1444 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1446 @item gnu89
1447 GNU dialect of ISO C90 (including some C99 features). This
1448 is the default for C code.
1450 @item gnu99
1451 @itemx gnu9x
1452 GNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC,
1453 this will become the default.  The name @samp{gnu9x} is deprecated.
1455 @item c++98
1456 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1457 C++ code.
1459 @item gnu++98
1460 GNU dialect of @option{-std=c++98}.  This is the default for
1461 C++ code.
1463 @item c++0x
1464 The working draft of the upcoming ISO C++0x standard. This option
1465 enables experimental features that are likely to be included in
1466 C++0x. The working draft is constantly changing, and any feature that is
1467 enabled by this flag may be removed from future versions of GCC if it is
1468 not part of the C++0x standard.
1470 @item gnu++0x
1471 GNU dialect of @option{-std=c++0x}. This option enables
1472 experimental features that may be removed in future versions of GCC.
1473 @end table
1475 @item -fgnu89-inline
1476 @opindex fgnu89-inline
1477 The option @option{-fgnu89-inline} tells GCC to use the traditional
1478 GNU semantics for @code{inline} functions when in C99 mode.
1479 @xref{Inline,,An Inline Function is As Fast As a Macro}.  This option
1480 is accepted and ignored by GCC versions 4.1.3 up to but not including
1481 4.3.  In GCC versions 4.3 and later it changes the behavior of GCC in
1482 C99 mode.  Using this option is roughly equivalent to adding the
1483 @code{gnu_inline} function attribute to all inline functions
1484 (@pxref{Function Attributes}).
1486 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1487 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1488 specifies the default behavior).  This option was first supported in
1489 GCC 4.3.  This option is not supported in C89 or gnu89 mode.
1491 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1492 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1493 in effect for @code{inline} functions.  @xref{Common Predefined
1494 Macros,,,cpp,The C Preprocessor}.
1496 @item -aux-info @var{filename}
1497 @opindex aux-info
1498 Output to the given filename prototyped declarations for all functions
1499 declared and/or defined in a translation unit, including those in header
1500 files.  This option is silently ignored in any language other than C@.
1502 Besides declarations, the file indicates, in comments, the origin of
1503 each declaration (source file and line), whether the declaration was
1504 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1505 @samp{O} for old, respectively, in the first character after the line
1506 number and the colon), and whether it came from a declaration or a
1507 definition (@samp{C} or @samp{F}, respectively, in the following
1508 character).  In the case of function definitions, a K&R-style list of
1509 arguments followed by their declarations is also provided, inside
1510 comments, after the declaration.
1512 @item -fno-asm
1513 @opindex fno-asm
1514 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1515 keyword, so that code can use these words as identifiers.  You can use
1516 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1517 instead.  @option{-ansi} implies @option{-fno-asm}.
1519 In C++, this switch only affects the @code{typeof} keyword, since
1520 @code{asm} and @code{inline} are standard keywords.  You may want to
1521 use the @option{-fno-gnu-keywords} flag instead, which has the same
1522 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1523 switch only affects the @code{asm} and @code{typeof} keywords, since
1524 @code{inline} is a standard keyword in ISO C99.
1526 @item -fno-builtin
1527 @itemx -fno-builtin-@var{function}
1528 @opindex fno-builtin
1529 @cindex built-in functions
1530 Don't recognize built-in functions that do not begin with
1531 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1532 functions provided by GCC}, for details of the functions affected,
1533 including those which are not built-in functions when @option{-ansi} or
1534 @option{-std} options for strict ISO C conformance are used because they
1535 do not have an ISO standard meaning.
1537 GCC normally generates special code to handle certain built-in functions
1538 more efficiently; for instance, calls to @code{alloca} may become single
1539 instructions that adjust the stack directly, and calls to @code{memcpy}
1540 may become inline copy loops.  The resulting code is often both smaller
1541 and faster, but since the function calls no longer appear as such, you
1542 cannot set a breakpoint on those calls, nor can you change the behavior
1543 of the functions by linking with a different library.  In addition,
1544 when a function is recognized as a built-in function, GCC may use
1545 information about that function to warn about problems with calls to
1546 that function, or to generate more efficient code, even if the
1547 resulting code still contains calls to that function.  For example,
1548 warnings are given with @option{-Wformat} for bad calls to
1549 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1550 known not to modify global memory.
1552 With the @option{-fno-builtin-@var{function}} option
1553 only the built-in function @var{function} is
1554 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1555 function is named that is not built-in in this version of GCC, this
1556 option is ignored.  There is no corresponding
1557 @option{-fbuiltin-@var{function}} option; if you wish to enable
1558 built-in functions selectively when using @option{-fno-builtin} or
1559 @option{-ffreestanding}, you may define macros such as:
1561 @smallexample
1562 #define abs(n)          __builtin_abs ((n))
1563 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1564 @end smallexample
1566 @item -fhosted
1567 @opindex fhosted
1568 @cindex hosted environment
1570 Assert that compilation takes place in a hosted environment.  This implies
1571 @option{-fbuiltin}.  A hosted environment is one in which the
1572 entire standard library is available, and in which @code{main} has a return
1573 type of @code{int}.  Examples are nearly everything except a kernel.
1574 This is equivalent to @option{-fno-freestanding}.
1576 @item -ffreestanding
1577 @opindex ffreestanding
1578 @cindex hosted environment
1580 Assert that compilation takes place in a freestanding environment.  This
1581 implies @option{-fno-builtin}.  A freestanding environment
1582 is one in which the standard library may not exist, and program startup may
1583 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1584 This is equivalent to @option{-fno-hosted}.
1586 @xref{Standards,,Language Standards Supported by GCC}, for details of
1587 freestanding and hosted environments.
1589 @item -fopenmp
1590 @opindex fopenmp
1591 @cindex openmp parallel
1592 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1593 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1594 compiler generates parallel code according to the OpenMP Application
1595 Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.  This option
1596 implies @option{-pthread}, and thus is only supported on targets that
1597 have support for @option{-pthread}.
1599 @item -fms-extensions
1600 @opindex fms-extensions
1601 Accept some non-standard constructs used in Microsoft header files.
1603 Some cases of unnamed fields in structures and unions are only
1604 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1605 fields within structs/unions}, for details.
1607 @item -trigraphs
1608 @opindex trigraphs
1609 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1610 options for strict ISO C conformance) implies @option{-trigraphs}.
1612 @item -no-integrated-cpp
1613 @opindex no-integrated-cpp
1614 Performs a compilation in two passes: preprocessing and compiling.  This
1615 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1616 @option{-B} option.  The user supplied compilation step can then add in
1617 an additional preprocessing step after normal preprocessing but before
1618 compiling.  The default is to use the integrated cpp (internal cpp)
1620 The semantics of this option will change if "cc1", "cc1plus", and
1621 "cc1obj" are merged.
1623 @cindex traditional C language
1624 @cindex C language, traditional
1625 @item -traditional
1626 @itemx -traditional-cpp
1627 @opindex traditional-cpp
1628 @opindex traditional
1629 Formerly, these options caused GCC to attempt to emulate a pre-standard
1630 C compiler.  They are now only supported with the @option{-E} switch.
1631 The preprocessor continues to support a pre-standard mode.  See the GNU
1632 CPP manual for details.
1634 @item -fcond-mismatch
1635 @opindex fcond-mismatch
1636 Allow conditional expressions with mismatched types in the second and
1637 third arguments.  The value of such an expression is void.  This option
1638 is not supported for C++.
1640 @item -flax-vector-conversions
1641 @opindex flax-vector-conversions
1642 Allow implicit conversions between vectors with differing numbers of
1643 elements and/or incompatible element types.  This option should not be
1644 used for new code.
1646 @item -funsigned-char
1647 @opindex funsigned-char
1648 Let the type @code{char} be unsigned, like @code{unsigned char}.
1650 Each kind of machine has a default for what @code{char} should
1651 be.  It is either like @code{unsigned char} by default or like
1652 @code{signed char} by default.
1654 Ideally, a portable program should always use @code{signed char} or
1655 @code{unsigned char} when it depends on the signedness of an object.
1656 But many programs have been written to use plain @code{char} and
1657 expect it to be signed, or expect it to be unsigned, depending on the
1658 machines they were written for.  This option, and its inverse, let you
1659 make such a program work with the opposite default.
1661 The type @code{char} is always a distinct type from each of
1662 @code{signed char} or @code{unsigned char}, even though its behavior
1663 is always just like one of those two.
1665 @item -fsigned-char
1666 @opindex fsigned-char
1667 Let the type @code{char} be signed, like @code{signed char}.
1669 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1670 the negative form of @option{-funsigned-char}.  Likewise, the option
1671 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1673 @item -fsigned-bitfields
1674 @itemx -funsigned-bitfields
1675 @itemx -fno-signed-bitfields
1676 @itemx -fno-unsigned-bitfields
1677 @opindex fsigned-bitfields
1678 @opindex funsigned-bitfields
1679 @opindex fno-signed-bitfields
1680 @opindex fno-unsigned-bitfields
1681 These options control whether a bit-field is signed or unsigned, when the
1682 declaration does not use either @code{signed} or @code{unsigned}.  By
1683 default, such a bit-field is signed, because this is consistent: the
1684 basic integer types such as @code{int} are signed types.
1685 @end table
1687 @node C++ Dialect Options
1688 @section Options Controlling C++ Dialect
1690 @cindex compiler options, C++
1691 @cindex C++ options, command line
1692 @cindex options, C++
1693 This section describes the command-line options that are only meaningful
1694 for C++ programs; but you can also use most of the GNU compiler options
1695 regardless of what language your program is in.  For example, you
1696 might compile a file @code{firstClass.C} like this:
1698 @smallexample
1699 g++ -g -frepo -O -c firstClass.C
1700 @end smallexample
1702 @noindent
1703 In this example, only @option{-frepo} is an option meant
1704 only for C++ programs; you can use the other options with any
1705 language supported by GCC@.
1707 Here is a list of options that are @emph{only} for compiling C++ programs:
1709 @table @gcctabopt
1711 @item -fabi-version=@var{n}
1712 @opindex fabi-version
1713 Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1714 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1715 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1716 the version that conforms most closely to the C++ ABI specification.
1717 Therefore, the ABI obtained using version 0 will change as ABI bugs
1718 are fixed.
1720 The default is version 2.
1722 @item -fno-access-control
1723 @opindex fno-access-control
1724 Turn off all access checking.  This switch is mainly useful for working
1725 around bugs in the access control code.
1727 @item -fcheck-new
1728 @opindex fcheck-new
1729 Check that the pointer returned by @code{operator new} is non-null
1730 before attempting to modify the storage allocated.  This check is
1731 normally unnecessary because the C++ standard specifies that
1732 @code{operator new} will only return @code{0} if it is declared
1733 @samp{throw()}, in which case the compiler will always check the
1734 return value even without this option.  In all other cases, when
1735 @code{operator new} has a non-empty exception specification, memory
1736 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1737 @samp{new (nothrow)}.
1739 @item -fconserve-space
1740 @opindex fconserve-space
1741 Put uninitialized or runtime-initialized global variables into the
1742 common segment, as C does.  This saves space in the executable at the
1743 cost of not diagnosing duplicate definitions.  If you compile with this
1744 flag and your program mysteriously crashes after @code{main()} has
1745 completed, you may have an object that is being destroyed twice because
1746 two definitions were merged.
1748 This option is no longer useful on most targets, now that support has
1749 been added for putting variables into BSS without making them common.
1751 @item -ffriend-injection
1752 @opindex ffriend-injection
1753 Inject friend functions into the enclosing namespace, so that they are
1754 visible outside the scope of the class in which they are declared.
1755 Friend functions were documented to work this way in the old Annotated
1756 C++ Reference Manual, and versions of G++ before 4.1 always worked
1757 that way.  However, in ISO C++ a friend function which is not declared
1758 in an enclosing scope can only be found using argument dependent
1759 lookup.  This option causes friends to be injected as they were in
1760 earlier releases.
1762 This option is for compatibility, and may be removed in a future
1763 release of G++.
1765 @item -fno-elide-constructors
1766 @opindex fno-elide-constructors
1767 The C++ standard allows an implementation to omit creating a temporary
1768 which is only used to initialize another object of the same type.
1769 Specifying this option disables that optimization, and forces G++ to
1770 call the copy constructor in all cases.
1772 @item -fno-enforce-eh-specs
1773 @opindex fno-enforce-eh-specs
1774 Don't generate code to check for violation of exception specifications
1775 at runtime.  This option violates the C++ standard, but may be useful
1776 for reducing code size in production builds, much like defining
1777 @samp{NDEBUG}.  This does not give user code permission to throw
1778 exceptions in violation of the exception specifications; the compiler
1779 will still optimize based on the specifications, so throwing an
1780 unexpected exception will result in undefined behavior.
1782 @item -ffor-scope
1783 @itemx -fno-for-scope
1784 @opindex ffor-scope
1785 @opindex fno-for-scope
1786 If @option{-ffor-scope} is specified, the scope of variables declared in
1787 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1788 as specified by the C++ standard.
1789 If @option{-fno-for-scope} is specified, the scope of variables declared in
1790 a @i{for-init-statement} extends to the end of the enclosing scope,
1791 as was the case in old versions of G++, and other (traditional)
1792 implementations of C++.
1794 The default if neither flag is given to follow the standard,
1795 but to allow and give a warning for old-style code that would
1796 otherwise be invalid, or have different behavior.
1798 @item -fno-gnu-keywords
1799 @opindex fno-gnu-keywords
1800 Do not recognize @code{typeof} as a keyword, so that code can use this
1801 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1802 @option{-ansi} implies @option{-fno-gnu-keywords}.
1804 @item -fno-implicit-templates
1805 @opindex fno-implicit-templates
1806 Never emit code for non-inline templates which are instantiated
1807 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1808 @xref{Template Instantiation}, for more information.
1810 @item -fno-implicit-inline-templates
1811 @opindex fno-implicit-inline-templates
1812 Don't emit code for implicit instantiations of inline templates, either.
1813 The default is to handle inlines differently so that compiles with and
1814 without optimization will need the same set of explicit instantiations.
1816 @item -fno-implement-inlines
1817 @opindex fno-implement-inlines
1818 To save space, do not emit out-of-line copies of inline functions
1819 controlled by @samp{#pragma implementation}.  This will cause linker
1820 errors if these functions are not inlined everywhere they are called.
1822 @item -fms-extensions
1823 @opindex fms-extensions
1824 Disable pedantic warnings about constructs used in MFC, such as implicit
1825 int and getting a pointer to member function via non-standard syntax.
1827 @item -fno-nonansi-builtins
1828 @opindex fno-nonansi-builtins
1829 Disable built-in declarations of functions that are not mandated by
1830 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1831 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1833 @item -fno-operator-names
1834 @opindex fno-operator-names
1835 Do not treat the operator name keywords @code{and}, @code{bitand},
1836 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1837 synonyms as keywords.
1839 @item -fno-optional-diags
1840 @opindex fno-optional-diags
1841 Disable diagnostics that the standard says a compiler does not need to
1842 issue.  Currently, the only such diagnostic issued by G++ is the one for
1843 a name having multiple meanings within a class.
1845 @item -fpermissive
1846 @opindex fpermissive
1847 Downgrade some diagnostics about nonconformant code from errors to
1848 warnings.  Thus, using @option{-fpermissive} will allow some
1849 nonconforming code to compile.
1851 @item -fno-pretty-templates
1852 @opindex fno-pretty-templates
1853 When an error message refers to a specialization of a function
1854 template, the compiler will normally print the signature of the
1855 template followed by the template arguments and any typedefs or
1856 typenames in the signature (e.g. @code{void f(T) [with T = int]}
1857 rather than @code{void f(int)}) so that it's clear which template is
1858 involved.  When an error message refers to a specialization of a class
1859 template, the compiler will omit any template arguments which match
1860 the default template arguments for that template.  If either of these
1861 behaviors make it harder to understand the error message rather than
1862 easier, using @option{-fno-pretty-templates} will disable them.
1864 @item -frepo
1865 @opindex frepo
1866 Enable automatic template instantiation at link time.  This option also
1867 implies @option{-fno-implicit-templates}.  @xref{Template
1868 Instantiation}, for more information.
1870 @item -fno-rtti
1871 @opindex fno-rtti
1872 Disable generation of information about every class with virtual
1873 functions for use by the C++ runtime type identification features
1874 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1875 of the language, you can save some space by using this flag.  Note that
1876 exception handling uses the same information, but it will generate it as
1877 needed. The @samp{dynamic_cast} operator can still be used for casts that
1878 do not require runtime type information, i.e.@: casts to @code{void *} or to
1879 unambiguous base classes.
1881 @item -fstats
1882 @opindex fstats
1883 Emit statistics about front-end processing at the end of the compilation.
1884 This information is generally only useful to the G++ development team.
1886 @item -ftemplate-depth-@var{n}
1887 @opindex ftemplate-depth
1888 Set the maximum instantiation depth for template classes to @var{n}.
1889 A limit on the template instantiation depth is needed to detect
1890 endless recursions during template class instantiation.  ANSI/ISO C++
1891 conforming programs must not rely on a maximum depth greater than 17.
1893 @item -fno-threadsafe-statics
1894 @opindex fno-threadsafe-statics
1895 Do not emit the extra code to use the routines specified in the C++
1896 ABI for thread-safe initialization of local statics.  You can use this
1897 option to reduce code size slightly in code that doesn't need to be
1898 thread-safe.
1900 @item -fuse-cxa-atexit
1901 @opindex fuse-cxa-atexit
1902 Register destructors for objects with static storage duration with the
1903 @code{__cxa_atexit} function rather than the @code{atexit} function.
1904 This option is required for fully standards-compliant handling of static
1905 destructors, but will only work if your C library supports
1906 @code{__cxa_atexit}.
1908 @item -fno-use-cxa-get-exception-ptr
1909 @opindex fno-use-cxa-get-exception-ptr
1910 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
1911 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1912 if the runtime routine is not available.
1914 @item -fvisibility-inlines-hidden
1915 @opindex fvisibility-inlines-hidden
1916 This switch declares that the user does not attempt to compare
1917 pointers to inline methods where the addresses of the two functions
1918 were taken in different shared objects.
1920 The effect of this is that GCC may, effectively, mark inline methods with
1921 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1922 appear in the export table of a DSO and do not require a PLT indirection
1923 when used within the DSO@.  Enabling this option can have a dramatic effect
1924 on load and link times of a DSO as it massively reduces the size of the
1925 dynamic export table when the library makes heavy use of templates.
1927 The behavior of this switch is not quite the same as marking the
1928 methods as hidden directly, because it does not affect static variables
1929 local to the function or cause the compiler to deduce that
1930 the function is defined in only one shared object.
1932 You may mark a method as having a visibility explicitly to negate the
1933 effect of the switch for that method.  For example, if you do want to
1934 compare pointers to a particular inline method, you might mark it as
1935 having default visibility.  Marking the enclosing class with explicit
1936 visibility will have no effect.
1938 Explicitly instantiated inline methods are unaffected by this option
1939 as their linkage might otherwise cross a shared library boundary.
1940 @xref{Template Instantiation}.
1942 @item -fvisibility-ms-compat
1943 @opindex fvisibility-ms-compat
1944 This flag attempts to use visibility settings to make GCC's C++
1945 linkage model compatible with that of Microsoft Visual Studio.
1947 The flag makes these changes to GCC's linkage model:
1949 @enumerate
1950 @item
1951 It sets the default visibility to @code{hidden}, like
1952 @option{-fvisibility=hidden}.
1954 @item
1955 Types, but not their members, are not hidden by default.
1957 @item
1958 The One Definition Rule is relaxed for types without explicit
1959 visibility specifications which are defined in more than one different
1960 shared object: those declarations are permitted if they would have
1961 been permitted when this option was not used.
1962 @end enumerate
1964 In new code it is better to use @option{-fvisibility=hidden} and
1965 export those classes which are intended to be externally visible.
1966 Unfortunately it is possible for code to rely, perhaps accidentally,
1967 on the Visual Studio behavior.
1969 Among the consequences of these changes are that static data members
1970 of the same type with the same name but defined in different shared
1971 objects will be different, so changing one will not change the other;
1972 and that pointers to function members defined in different shared
1973 objects may not compare equal.  When this flag is given, it is a
1974 violation of the ODR to define types with the same name differently.
1976 @item -fno-weak
1977 @opindex fno-weak
1978 Do not use weak symbol support, even if it is provided by the linker.
1979 By default, G++ will use weak symbols if they are available.  This
1980 option exists only for testing, and should not be used by end-users;
1981 it will result in inferior code and has no benefits.  This option may
1982 be removed in a future release of G++.
1984 @item -nostdinc++
1985 @opindex nostdinc++
1986 Do not search for header files in the standard directories specific to
1987 C++, but do still search the other standard directories.  (This option
1988 is used when building the C++ library.)
1989 @end table
1991 In addition, these optimization, warning, and code generation options
1992 have meanings only for C++ programs:
1994 @table @gcctabopt
1995 @item -fno-default-inline
1996 @opindex fno-default-inline
1997 Do not assume @samp{inline} for functions defined inside a class scope.
1998 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1999 functions will have linkage like inline functions; they just won't be
2000 inlined by default.
2002 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2003 @opindex Wabi
2004 @opindex Wno-abi
2005 Warn when G++ generates code that is probably not compatible with the
2006 vendor-neutral C++ ABI@.  Although an effort has been made to warn about
2007 all such cases, there are probably some cases that are not warned about,
2008 even though G++ is generating incompatible code.  There may also be
2009 cases where warnings are emitted even though the code that is generated
2010 will be compatible.
2012 You should rewrite your code to avoid these warnings if you are
2013 concerned about the fact that code generated by G++ may not be binary
2014 compatible with code generated by other compilers.
2016 The known incompatibilities at this point include:
2018 @itemize @bullet
2020 @item
2021 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
2022 pack data into the same byte as a base class.  For example:
2024 @smallexample
2025 struct A @{ virtual void f(); int f1 : 1; @};
2026 struct B : public A @{ int f2 : 1; @};
2027 @end smallexample
2029 @noindent
2030 In this case, G++ will place @code{B::f2} into the same byte
2031 as@code{A::f1}; other compilers will not.  You can avoid this problem
2032 by explicitly padding @code{A} so that its size is a multiple of the
2033 byte size on your platform; that will cause G++ and other compilers to
2034 layout @code{B} identically.
2036 @item
2037 Incorrect handling of tail-padding for virtual bases.  G++ does not use
2038 tail padding when laying out virtual bases.  For example:
2040 @smallexample
2041 struct A @{ virtual void f(); char c1; @};
2042 struct B @{ B(); char c2; @};
2043 struct C : public A, public virtual B @{@};
2044 @end smallexample
2046 @noindent
2047 In this case, G++ will not place @code{B} into the tail-padding for
2048 @code{A}; other compilers will.  You can avoid this problem by
2049 explicitly padding @code{A} so that its size is a multiple of its
2050 alignment (ignoring virtual base classes); that will cause G++ and other
2051 compilers to layout @code{C} identically.
2053 @item
2054 Incorrect handling of bit-fields with declared widths greater than that
2055 of their underlying types, when the bit-fields appear in a union.  For
2056 example:
2058 @smallexample
2059 union U @{ int i : 4096; @};
2060 @end smallexample
2062 @noindent
2063 Assuming that an @code{int} does not have 4096 bits, G++ will make the
2064 union too small by the number of bits in an @code{int}.
2066 @item
2067 Empty classes can be placed at incorrect offsets.  For example:
2069 @smallexample
2070 struct A @{@};
2072 struct B @{
2073   A a;
2074   virtual void f ();
2077 struct C : public B, public A @{@};
2078 @end smallexample
2080 @noindent
2081 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2082 it should be placed at offset zero.  G++ mistakenly believes that the
2083 @code{A} data member of @code{B} is already at offset zero.
2085 @item
2086 Names of template functions whose types involve @code{typename} or
2087 template template parameters can be mangled incorrectly.
2089 @smallexample
2090 template <typename Q>
2091 void f(typename Q::X) @{@}
2093 template <template <typename> class Q>
2094 void f(typename Q<int>::X) @{@}
2095 @end smallexample
2097 @noindent
2098 Instantiations of these templates may be mangled incorrectly.
2100 @end itemize
2102 It also warns psABI related changes.  The known psABI changes at this
2103 point include:
2105 @itemize @bullet
2107 @item
2108 For SYSV/x86-64, when passing union with long double, it is changed to
2109 pass in memory as specified in psABI.  For example:
2111 @smallexample
2112 union U @{
2113   long double ld;
2114   int i;
2116 @end smallexample
2118 @noindent
2119 @code{union U} will always be passed in memory.
2121 @end itemize
2123 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2124 @opindex Wctor-dtor-privacy
2125 @opindex Wno-ctor-dtor-privacy
2126 Warn when a class seems unusable because all the constructors or
2127 destructors in that class are private, and it has neither friends nor
2128 public static member functions.
2130 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2131 @opindex Wnon-virtual-dtor
2132 @opindex Wno-non-virtual-dtor
2133 Warn when a class has virtual functions and accessible non-virtual
2134 destructor, in which case it would be possible but unsafe to delete
2135 an instance of a derived class through a pointer to the base class.
2136 This warning is also enabled if -Weffc++ is specified.
2138 @item -Wreorder @r{(C++ and Objective-C++ only)}
2139 @opindex Wreorder
2140 @opindex Wno-reorder
2141 @cindex reordering, warning
2142 @cindex warning for reordering of member initializers
2143 Warn when the order of member initializers given in the code does not
2144 match the order in which they must be executed.  For instance:
2146 @smallexample
2147 struct A @{
2148   int i;
2149   int j;
2150   A(): j (0), i (1) @{ @}
2152 @end smallexample
2154 The compiler will rearrange the member initializers for @samp{i}
2155 and @samp{j} to match the declaration order of the members, emitting
2156 a warning to that effect.  This warning is enabled by @option{-Wall}.
2157 @end table
2159 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2161 @table @gcctabopt
2162 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2163 @opindex Weffc++
2164 @opindex Wno-effc++
2165 Warn about violations of the following style guidelines from Scott Meyers'
2166 @cite{Effective C++} book:
2168 @itemize @bullet
2169 @item
2170 Item 11:  Define a copy constructor and an assignment operator for classes
2171 with dynamically allocated memory.
2173 @item
2174 Item 12:  Prefer initialization to assignment in constructors.
2176 @item
2177 Item 14:  Make destructors virtual in base classes.
2179 @item
2180 Item 15:  Have @code{operator=} return a reference to @code{*this}.
2182 @item
2183 Item 23:  Don't try to return a reference when you must return an object.
2185 @end itemize
2187 Also warn about violations of the following style guidelines from
2188 Scott Meyers' @cite{More Effective C++} book:
2190 @itemize @bullet
2191 @item
2192 Item 6:  Distinguish between prefix and postfix forms of increment and
2193 decrement operators.
2195 @item
2196 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
2198 @end itemize
2200 When selecting this option, be aware that the standard library
2201 headers do not obey all of these guidelines; use @samp{grep -v}
2202 to filter out those warnings.
2204 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2205 @opindex Wstrict-null-sentinel
2206 @opindex Wno-strict-null-sentinel
2207 Warn also about the use of an uncasted @code{NULL} as sentinel.  When
2208 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2209 to @code{__null}.  Although it is a null pointer constant not a null pointer,
2210 it is guaranteed to be of the same size as a pointer.  But this use is
2211 not portable across different compilers.
2213 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2214 @opindex Wno-non-template-friend
2215 @opindex Wnon-template-friend
2216 Disable warnings when non-templatized friend functions are declared
2217 within a template.  Since the advent of explicit template specification
2218 support in G++, if the name of the friend is an unqualified-id (i.e.,
2219 @samp{friend foo(int)}), the C++ language specification demands that the
2220 friend declare or define an ordinary, nontemplate function.  (Section
2221 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
2222 could be interpreted as a particular specialization of a templatized
2223 function.  Because this non-conforming behavior is no longer the default
2224 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2225 check existing code for potential trouble spots and is on by default.
2226 This new compiler behavior can be turned off with
2227 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2228 but disables the helpful warning.
2230 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2231 @opindex Wold-style-cast
2232 @opindex Wno-old-style-cast
2233 Warn if an old-style (C-style) cast to a non-void type is used within
2234 a C++ program.  The new-style casts (@samp{dynamic_cast},
2235 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2236 less vulnerable to unintended effects and much easier to search for.
2238 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2239 @opindex Woverloaded-virtual
2240 @opindex Wno-overloaded-virtual
2241 @cindex overloaded virtual fn, warning
2242 @cindex warning for overloaded virtual fn
2243 Warn when a function declaration hides virtual functions from a
2244 base class.  For example, in:
2246 @smallexample
2247 struct A @{
2248   virtual void f();
2251 struct B: public A @{
2252   void f(int);
2254 @end smallexample
2256 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2257 like:
2259 @smallexample
2260 B* b;
2261 b->f();
2262 @end smallexample
2264 will fail to compile.
2266 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2267 @opindex Wno-pmf-conversions
2268 @opindex Wpmf-conversions
2269 Disable the diagnostic for converting a bound pointer to member function
2270 to a plain pointer.
2272 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2273 @opindex Wsign-promo
2274 @opindex Wno-sign-promo
2275 Warn when overload resolution chooses a promotion from unsigned or
2276 enumerated type to a signed type, over a conversion to an unsigned type of
2277 the same size.  Previous versions of G++ would try to preserve
2278 unsignedness, but the standard mandates the current behavior.
2280 @smallexample
2281 struct A @{
2282   operator int ();
2283   A& operator = (int);
2286 main ()
2288   A a,b;
2289   a = b;
2291 @end smallexample
2293 In this example, G++ will synthesize a default @samp{A& operator =
2294 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2295 @end table
2297 @node Objective-C and Objective-C++ Dialect Options
2298 @section Options Controlling Objective-C and Objective-C++ Dialects
2300 @cindex compiler options, Objective-C and Objective-C++
2301 @cindex Objective-C and Objective-C++ options, command line
2302 @cindex options, Objective-C and Objective-C++
2303 (NOTE: This manual does not describe the Objective-C and Objective-C++
2304 languages themselves.  See @xref{Standards,,Language Standards
2305 Supported by GCC}, for references.)
2307 This section describes the command-line options that are only meaningful
2308 for Objective-C and Objective-C++ programs, but you can also use most of
2309 the language-independent GNU compiler options.
2310 For example, you might compile a file @code{some_class.m} like this:
2312 @smallexample
2313 gcc -g -fgnu-runtime -O -c some_class.m
2314 @end smallexample
2316 @noindent
2317 In this example, @option{-fgnu-runtime} is an option meant only for
2318 Objective-C and Objective-C++ programs; you can use the other options with
2319 any language supported by GCC@.
2321 Note that since Objective-C is an extension of the C language, Objective-C
2322 compilations may also use options specific to the C front-end (e.g.,
2323 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
2324 C++-specific options (e.g., @option{-Wabi}).
2326 Here is a list of options that are @emph{only} for compiling Objective-C
2327 and Objective-C++ programs:
2329 @table @gcctabopt
2330 @item -fconstant-string-class=@var{class-name}
2331 @opindex fconstant-string-class
2332 Use @var{class-name} as the name of the class to instantiate for each
2333 literal string specified with the syntax @code{@@"@dots{}"}.  The default
2334 class name is @code{NXConstantString} if the GNU runtime is being used, and
2335 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
2336 @option{-fconstant-cfstrings} option, if also present, will override the
2337 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2338 to be laid out as constant CoreFoundation strings.
2340 @item -fgnu-runtime
2341 @opindex fgnu-runtime
2342 Generate object code compatible with the standard GNU Objective-C
2343 runtime.  This is the default for most types of systems.
2345 @item -fnext-runtime
2346 @opindex fnext-runtime
2347 Generate output compatible with the NeXT runtime.  This is the default
2348 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
2349 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2350 used.
2352 @item -fno-nil-receivers
2353 @opindex fno-nil-receivers
2354 Assume that all Objective-C message dispatches (e.g.,
2355 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
2356 is not @code{nil}.  This allows for more efficient entry points in the runtime
2357 to be used.  Currently, this option is only available in conjunction with
2358 the NeXT runtime on Mac OS X 10.3 and later.
2360 @item -fobjc-call-cxx-cdtors
2361 @opindex fobjc-call-cxx-cdtors
2362 For each Objective-C class, check if any of its instance variables is a
2363 C++ object with a non-trivial default constructor.  If so, synthesize a
2364 special @code{- (id) .cxx_construct} instance method that will run
2365 non-trivial default constructors on any such instance variables, in order,
2366 and then return @code{self}.  Similarly, check if any instance variable
2367 is a C++ object with a non-trivial destructor, and if so, synthesize a
2368 special @code{- (void) .cxx_destruct} method that will run
2369 all such default destructors, in reverse order.
2371 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2372 thusly generated will only operate on instance variables declared in the
2373 current Objective-C class, and not those inherited from superclasses.  It
2374 is the responsibility of the Objective-C runtime to invoke all such methods
2375 in an object's inheritance hierarchy.  The @code{- (id) .cxx_construct} methods
2376 will be invoked by the runtime immediately after a new object
2377 instance is allocated; the @code{- (void) .cxx_destruct} methods will
2378 be invoked immediately before the runtime deallocates an object instance.
2380 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2381 support for invoking the @code{- (id) .cxx_construct} and
2382 @code{- (void) .cxx_destruct} methods.
2384 @item -fobjc-direct-dispatch
2385 @opindex fobjc-direct-dispatch
2386 Allow fast jumps to the message dispatcher.  On Darwin this is
2387 accomplished via the comm page.
2389 @item -fobjc-exceptions
2390 @opindex fobjc-exceptions
2391 Enable syntactic support for structured exception handling in Objective-C,
2392 similar to what is offered by C++ and Java.  This option is
2393 unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2394 earlier.
2396 @smallexample
2397   @@try @{
2398     @dots{}
2399        @@throw expr;
2400     @dots{}
2401   @}
2402   @@catch (AnObjCClass *exc) @{
2403     @dots{}
2404       @@throw expr;
2405     @dots{}
2406       @@throw;
2407     @dots{}
2408   @}
2409   @@catch (AnotherClass *exc) @{
2410     @dots{}
2411   @}
2412   @@catch (id allOthers) @{
2413     @dots{}
2414   @}
2415   @@finally @{
2416     @dots{}
2417       @@throw expr;
2418     @dots{}
2419   @}
2420 @end smallexample
2422 The @code{@@throw} statement may appear anywhere in an Objective-C or
2423 Objective-C++ program; when used inside of a @code{@@catch} block, the
2424 @code{@@throw} may appear without an argument (as shown above), in which case
2425 the object caught by the @code{@@catch} will be rethrown.
2427 Note that only (pointers to) Objective-C objects may be thrown and
2428 caught using this scheme.  When an object is thrown, it will be caught
2429 by the nearest @code{@@catch} clause capable of handling objects of that type,
2430 analogously to how @code{catch} blocks work in C++ and Java.  A
2431 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2432 any and all Objective-C exceptions not caught by previous @code{@@catch}
2433 clauses (if any).
2435 The @code{@@finally} clause, if present, will be executed upon exit from the
2436 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
2437 regardless of whether any exceptions are thrown, caught or rethrown
2438 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2439 of the @code{finally} clause in Java.
2441 There are several caveats to using the new exception mechanism:
2443 @itemize @bullet
2444 @item
2445 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2446 idioms provided by the @code{NSException} class, the new
2447 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2448 systems, due to additional functionality needed in the (NeXT) Objective-C
2449 runtime.
2451 @item
2452 As mentioned above, the new exceptions do not support handling
2453 types other than Objective-C objects.   Furthermore, when used from
2454 Objective-C++, the Objective-C exception model does not interoperate with C++
2455 exceptions at this time.  This means you cannot @code{@@throw} an exception
2456 from Objective-C and @code{catch} it in C++, or vice versa
2457 (i.e., @code{throw @dots{} @@catch}).
2458 @end itemize
2460 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2461 blocks for thread-safe execution:
2463 @smallexample
2464   @@synchronized (ObjCClass *guard) @{
2465     @dots{}
2466   @}
2467 @end smallexample
2469 Upon entering the @code{@@synchronized} block, a thread of execution shall
2470 first check whether a lock has been placed on the corresponding @code{guard}
2471 object by another thread.  If it has, the current thread shall wait until
2472 the other thread relinquishes its lock.  Once @code{guard} becomes available,
2473 the current thread will place its own lock on it, execute the code contained in
2474 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2475 making @code{guard} available to other threads).
2477 Unlike Java, Objective-C does not allow for entire methods to be marked
2478 @code{@@synchronized}.  Note that throwing exceptions out of
2479 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2480 to be unlocked properly.
2482 @item -fobjc-gc
2483 @opindex fobjc-gc
2484 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2486 @item -freplace-objc-classes
2487 @opindex freplace-objc-classes
2488 Emit a special marker instructing @command{ld(1)} not to statically link in
2489 the resulting object file, and allow @command{dyld(1)} to load it in at
2490 run time instead.  This is used in conjunction with the Fix-and-Continue
2491 debugging mode, where the object file in question may be recompiled and
2492 dynamically reloaded in the course of program execution, without the need
2493 to restart the program itself.  Currently, Fix-and-Continue functionality
2494 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2495 and later.
2497 @item -fzero-link
2498 @opindex fzero-link
2499 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2500 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2501 compile time) with static class references that get initialized at load time,
2502 which improves run-time performance.  Specifying the @option{-fzero-link} flag
2503 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2504 to be retained.  This is useful in Zero-Link debugging mode, since it allows
2505 for individual class implementations to be modified during program execution.
2507 @item -gen-decls
2508 @opindex gen-decls
2509 Dump interface declarations for all classes seen in the source file to a
2510 file named @file{@var{sourcename}.decl}.
2512 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2513 @opindex Wassign-intercept
2514 @opindex Wno-assign-intercept
2515 Warn whenever an Objective-C assignment is being intercepted by the
2516 garbage collector.
2518 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2519 @opindex Wno-protocol
2520 @opindex Wprotocol
2521 If a class is declared to implement a protocol, a warning is issued for
2522 every method in the protocol that is not implemented by the class.  The
2523 default behavior is to issue a warning for every method not explicitly
2524 implemented in the class, even if a method implementation is inherited
2525 from the superclass.  If you use the @option{-Wno-protocol} option, then
2526 methods inherited from the superclass are considered to be implemented,
2527 and no warning is issued for them.
2529 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2530 @opindex Wselector
2531 @opindex Wno-selector
2532 Warn if multiple methods of different types for the same selector are
2533 found during compilation.  The check is performed on the list of methods
2534 in the final stage of compilation.  Additionally, a check is performed
2535 for each selector appearing in a @code{@@selector(@dots{})}
2536 expression, and a corresponding method for that selector has been found
2537 during compilation.  Because these checks scan the method table only at
2538 the end of compilation, these warnings are not produced if the final
2539 stage of compilation is not reached, for example because an error is
2540 found during compilation, or because the @option{-fsyntax-only} option is
2541 being used.
2543 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2544 @opindex Wstrict-selector-match
2545 @opindex Wno-strict-selector-match
2546 Warn if multiple methods with differing argument and/or return types are
2547 found for a given selector when attempting to send a message using this
2548 selector to a receiver of type @code{id} or @code{Class}.  When this flag
2549 is off (which is the default behavior), the compiler will omit such warnings
2550 if any differences found are confined to types which share the same size
2551 and alignment.
2553 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2554 @opindex Wundeclared-selector
2555 @opindex Wno-undeclared-selector
2556 Warn if a @code{@@selector(@dots{})} expression referring to an
2557 undeclared selector is found.  A selector is considered undeclared if no
2558 method with that name has been declared before the
2559 @code{@@selector(@dots{})} expression, either explicitly in an
2560 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2561 an @code{@@implementation} section.  This option always performs its
2562 checks as soon as a @code{@@selector(@dots{})} expression is found,
2563 while @option{-Wselector} only performs its checks in the final stage of
2564 compilation.  This also enforces the coding style convention
2565 that methods and selectors must be declared before being used.
2567 @item -print-objc-runtime-info
2568 @opindex print-objc-runtime-info
2569 Generate C header describing the largest structure that is passed by
2570 value, if any.
2572 @end table
2574 @node Language Independent Options
2575 @section Options to Control Diagnostic Messages Formatting
2576 @cindex options to control diagnostics formatting
2577 @cindex diagnostic messages
2578 @cindex message formatting
2580 Traditionally, diagnostic messages have been formatted irrespective of
2581 the output device's aspect (e.g.@: its width, @dots{}).  The options described
2582 below can be used to control the diagnostic messages formatting
2583 algorithm, e.g.@: how many characters per line, how often source location
2584 information should be reported.  Right now, only the C++ front end can
2585 honor these options.  However it is expected, in the near future, that
2586 the remaining front ends would be able to digest them correctly.
2588 @table @gcctabopt
2589 @item -fmessage-length=@var{n}
2590 @opindex fmessage-length
2591 Try to format error messages so that they fit on lines of about @var{n}
2592 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2593 the front ends supported by GCC@.  If @var{n} is zero, then no
2594 line-wrapping will be done; each error message will appear on a single
2595 line.
2597 @opindex fdiagnostics-show-location
2598 @item -fdiagnostics-show-location=once
2599 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2600 reporter to emit @emph{once} source location information; that is, in
2601 case the message is too long to fit on a single physical line and has to
2602 be wrapped, the source location won't be emitted (as prefix) again,
2603 over and over, in subsequent continuation lines.  This is the default
2604 behavior.
2606 @item -fdiagnostics-show-location=every-line
2607 Only meaningful in line-wrapping mode.  Instructs the diagnostic
2608 messages reporter to emit the same source location information (as
2609 prefix) for physical lines that result from the process of breaking
2610 a message which is too long to fit on a single line.
2612 @item -fdiagnostics-show-option
2613 @opindex fdiagnostics-show-option
2614 This option instructs the diagnostic machinery to add text to each
2615 diagnostic emitted, which indicates which command line option directly
2616 controls that diagnostic, when such an option is known to the
2617 diagnostic machinery.
2619 @item -Wcoverage-mismatch
2620 @opindex Wcoverage-mismatch
2621 Warn if feedback profiles do not match when using the
2622 @option{-fprofile-use} option.
2623 If a source file was changed between @option{-fprofile-gen} and
2624 @option{-fprofile-use}, the files with the profile feedback can fail
2625 to match the source file and GCC can not use the profile feedback
2626 information.  By default, GCC emits an error message in this case.
2627 The option @option{-Wcoverage-mismatch} emits a warning instead of an
2628 error.  GCC does not use appropriate feedback profiles, so using this
2629 option can result in poorly optimized code.  This option is useful
2630 only in the case of very minor changes such as bug fixes to an
2631 existing code-base.
2633 @end table
2635 @node Warning Options
2636 @section Options to Request or Suppress Warnings
2637 @cindex options to control warnings
2638 @cindex warning messages
2639 @cindex messages, warning
2640 @cindex suppressing warnings
2642 Warnings are diagnostic messages that report constructions which
2643 are not inherently erroneous but which are risky or suggest there
2644 may have been an error.
2646 The following language-independent options do not enable specific
2647 warnings but control the kinds of diagnostics produced by GCC.
2649 @table @gcctabopt
2650 @cindex syntax checking
2651 @item -fsyntax-only
2652 @opindex fsyntax-only
2653 Check the code for syntax errors, but don't do anything beyond that.
2655 @item -w
2656 @opindex w
2657 Inhibit all warning messages.
2659 @item -Werror
2660 @opindex Werror
2661 @opindex Wno-error
2662 Make all warnings into errors.
2664 @item -Werror=
2665 @opindex Werror=
2666 @opindex Wno-error=
2667 Make the specified warning into an error.  The specifier for a warning
2668 is appended, for example @option{-Werror=switch} turns the warnings
2669 controlled by @option{-Wswitch} into errors.  This switch takes a
2670 negative form, to be used to negate @option{-Werror} for specific
2671 warnings, for example @option{-Wno-error=switch} makes
2672 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
2673 is in effect.  You can use the @option{-fdiagnostics-show-option}
2674 option to have each controllable warning amended with the option which
2675 controls it, to determine what to use with this option.
2677 Note that specifying @option{-Werror=}@var{foo} automatically implies
2678 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
2679 imply anything.
2681 @item -Wfatal-errors
2682 @opindex Wfatal-errors
2683 @opindex Wno-fatal-errors
2684 This option causes the compiler to abort compilation on the first error
2685 occurred rather than trying to keep going and printing further error
2686 messages.
2688 @end table
2690 You can request many specific warnings with options beginning
2691 @samp{-W}, for example @option{-Wimplicit} to request warnings on
2692 implicit declarations.  Each of these specific warning options also
2693 has a negative form beginning @samp{-Wno-} to turn off warnings; for
2694 example, @option{-Wno-implicit}.  This manual lists only one of the
2695 two forms, whichever is not the default.  For further,
2696 language-specific options also refer to @ref{C++ Dialect Options} and
2697 @ref{Objective-C and Objective-C++ Dialect Options}.
2699 @table @gcctabopt
2700 @item -pedantic
2701 @opindex pedantic
2702 Issue all the warnings demanded by strict ISO C and ISO C++;
2703 reject all programs that use forbidden extensions, and some other
2704 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2705 version of the ISO C standard specified by any @option{-std} option used.
2707 Valid ISO C and ISO C++ programs should compile properly with or without
2708 this option (though a rare few will require @option{-ansi} or a
2709 @option{-std} option specifying the required version of ISO C)@.  However,
2710 without this option, certain GNU extensions and traditional C and C++
2711 features are supported as well.  With this option, they are rejected.
2713 @option{-pedantic} does not cause warning messages for use of the
2714 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2715 warnings are also disabled in the expression that follows
2716 @code{__extension__}.  However, only system header files should use
2717 these escape routes; application programs should avoid them.
2718 @xref{Alternate Keywords}.
2720 Some users try to use @option{-pedantic} to check programs for strict ISO
2721 C conformance.  They soon find that it does not do quite what they want:
2722 it finds some non-ISO practices, but not all---only those for which
2723 ISO C @emph{requires} a diagnostic, and some others for which
2724 diagnostics have been added.
2726 A feature to report any failure to conform to ISO C might be useful in
2727 some instances, but would require considerable additional work and would
2728 be quite different from @option{-pedantic}.  We don't have plans to
2729 support such a feature in the near future.
2731 Where the standard specified with @option{-std} represents a GNU
2732 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2733 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2734 extended dialect is based.  Warnings from @option{-pedantic} are given
2735 where they are required by the base standard.  (It would not make sense
2736 for such warnings to be given only for features not in the specified GNU
2737 C dialect, since by definition the GNU dialects of C include all
2738 features the compiler supports with the given option, and there would be
2739 nothing to warn about.)
2741 @item -pedantic-errors
2742 @opindex pedantic-errors
2743 Like @option{-pedantic}, except that errors are produced rather than
2744 warnings.
2746 @item -Wall
2747 @opindex Wall
2748 @opindex Wno-all
2749 This enables all the warnings about constructions that some users
2750 consider questionable, and that are easy to avoid (or modify to
2751 prevent the warning), even in conjunction with macros.  This also
2752 enables some language-specific warnings described in @ref{C++ Dialect
2753 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2755 @option{-Wall} turns on the following warning flags:
2757 @gccoptlist{-Waddress   @gol
2758 -Warray-bounds @r{(only with} @option{-O2}@r{)}  @gol
2759 -Wc++0x-compat  @gol
2760 -Wchar-subscripts  @gol
2761 -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
2762 -Wimplicit-int  @gol
2763 -Wimplicit-function-declaration  @gol
2764 -Wcomment  @gol
2765 -Wformat   @gol
2766 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
2767 -Wmissing-braces  @gol
2768 -Wnonnull  @gol
2769 -Wparentheses  @gol
2770 -Wpointer-sign  @gol
2771 -Wreorder   @gol
2772 -Wreturn-type  @gol
2773 -Wsequence-point  @gol
2774 -Wsign-compare @r{(only in C++)}  @gol
2775 -Wstrict-aliasing  @gol
2776 -Wstrict-overflow=1  @gol
2777 -Wswitch  @gol
2778 -Wtrigraphs  @gol
2779 -Wuninitialized  @gol
2780 -Wunknown-pragmas  @gol
2781 -Wunused-function  @gol
2782 -Wunused-label     @gol
2783 -Wunused-value     @gol
2784 -Wunused-variable  @gol
2785 -Wvolatile-register-var @gol
2788 Note that some warning flags are not implied by @option{-Wall}.  Some of
2789 them warn about constructions that users generally do not consider
2790 questionable, but which occasionally you might wish to check for;
2791 others warn about constructions that are necessary or hard to avoid in
2792 some cases, and there is no simple way to modify the code to suppress
2793 the warning. Some of them are enabled by @option{-Wextra} but many of
2794 them must be enabled individually.
2796 @item -Wextra
2797 @opindex W
2798 @opindex Wextra
2799 @opindex Wno-extra
2800 This enables some extra warning flags that are not enabled by
2801 @option{-Wall}. (This option used to be called @option{-W}.  The older
2802 name is still supported, but the newer name is more descriptive.)
2804 @gccoptlist{-Wclobbered  @gol
2805 -Wempty-body  @gol
2806 -Wignored-qualifiers @gol
2807 -Wlogical-op @gol
2808 -Wmissing-field-initializers  @gol
2809 -Wmissing-parameter-type @r{(C only)}  @gol
2810 -Wold-style-declaration @r{(C only)}  @gol
2811 -Woverride-init  @gol
2812 -Wsign-compare  @gol
2813 -Wtype-limits  @gol
2814 -Wuninitialized  @gol
2815 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}  @gol
2818 The option @option{-Wextra} also prints warning messages for the
2819 following cases:
2821 @itemize @bullet
2823 @item
2824 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2825 @samp{>}, or @samp{>=}.
2827 @item 
2828 (C++ only) An enumerator and a non-enumerator both appear in a
2829 conditional expression.
2831 @item 
2832 (C++ only) Ambiguous virtual bases.
2834 @item 
2835 (C++ only) Subscripting an array which has been declared @samp{register}.
2837 @item 
2838 (C++ only) Taking the address of a variable which has been declared
2839 @samp{register}.
2841 @item 
2842 (C++ only) A base class is not initialized in a derived class' copy
2843 constructor.
2845 @end itemize
2847 @item -Wchar-subscripts
2848 @opindex Wchar-subscripts
2849 @opindex Wno-char-subscripts
2850 Warn if an array subscript has type @code{char}.  This is a common cause
2851 of error, as programmers often forget that this type is signed on some
2852 machines.
2853 This warning is enabled by @option{-Wall}.
2855 @item -Wcomment
2856 @opindex Wcomment
2857 @opindex Wno-comment
2858 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2859 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2860 This warning is enabled by @option{-Wall}.
2862 @item -Wformat
2863 @opindex Wformat
2864 @opindex Wno-format
2865 @opindex ffreestanding
2866 @opindex fno-builtin
2867 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2868 the arguments supplied have types appropriate to the format string
2869 specified, and that the conversions specified in the format string make
2870 sense.  This includes standard functions, and others specified by format
2871 attributes (@pxref{Function Attributes}), in the @code{printf},
2872 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2873 not in the C standard) families (or other target-specific families).
2874 Which functions are checked without format attributes having been
2875 specified depends on the standard version selected, and such checks of
2876 functions without the attribute specified are disabled by
2877 @option{-ffreestanding} or @option{-fno-builtin}.
2879 The formats are checked against the format features supported by GNU
2880 libc version 2.2.  These include all ISO C90 and C99 features, as well
2881 as features from the Single Unix Specification and some BSD and GNU
2882 extensions.  Other library implementations may not support all these
2883 features; GCC does not support warning about features that go beyond a
2884 particular library's limitations.  However, if @option{-pedantic} is used
2885 with @option{-Wformat}, warnings will be given about format features not
2886 in the selected standard version (but not for @code{strfmon} formats,
2887 since those are not in any version of the C standard).  @xref{C Dialect
2888 Options,,Options Controlling C Dialect}.
2890 Since @option{-Wformat} also checks for null format arguments for
2891 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2893 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2894 aspects of format checking, the options @option{-Wformat-y2k},
2895 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2896 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2897 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2899 @item -Wformat-y2k
2900 @opindex Wformat-y2k
2901 @opindex Wno-format-y2k
2902 If @option{-Wformat} is specified, also warn about @code{strftime}
2903 formats which may yield only a two-digit year.
2905 @item -Wno-format-contains-nul
2906 @opindex Wno-format-contains-nul
2907 @opindex Wformat-contains-nul
2908 If @option{-Wformat} is specified, do not warn about format strings that
2909 contain NUL bytes.
2911 @item -Wno-format-extra-args
2912 @opindex Wno-format-extra-args
2913 @opindex Wformat-extra-args
2914 If @option{-Wformat} is specified, do not warn about excess arguments to a
2915 @code{printf} or @code{scanf} format function.  The C standard specifies
2916 that such arguments are ignored.
2918 Where the unused arguments lie between used arguments that are
2919 specified with @samp{$} operand number specifications, normally
2920 warnings are still given, since the implementation could not know what
2921 type to pass to @code{va_arg} to skip the unused arguments.  However,
2922 in the case of @code{scanf} formats, this option will suppress the
2923 warning if the unused arguments are all pointers, since the Single
2924 Unix Specification says that such unused arguments are allowed.
2926 @item -Wno-format-zero-length @r{(C and Objective-C only)}
2927 @opindex Wno-format-zero-length
2928 @opindex Wformat-zero-length
2929 If @option{-Wformat} is specified, do not warn about zero-length formats.
2930 The C standard specifies that zero-length formats are allowed.
2932 @item -Wformat-nonliteral
2933 @opindex Wformat-nonliteral
2934 @opindex Wno-format-nonliteral
2935 If @option{-Wformat} is specified, also warn if the format string is not a
2936 string literal and so cannot be checked, unless the format function
2937 takes its format arguments as a @code{va_list}.
2939 @item -Wformat-security
2940 @opindex Wformat-security
2941 @opindex Wno-format-security
2942 If @option{-Wformat} is specified, also warn about uses of format
2943 functions that represent possible security problems.  At present, this
2944 warns about calls to @code{printf} and @code{scanf} functions where the
2945 format string is not a string literal and there are no format arguments,
2946 as in @code{printf (foo);}.  This may be a security hole if the format
2947 string came from untrusted input and contains @samp{%n}.  (This is
2948 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2949 in future warnings may be added to @option{-Wformat-security} that are not
2950 included in @option{-Wformat-nonliteral}.)
2952 @item -Wformat=2
2953 @opindex Wformat=2
2954 @opindex Wno-format=2
2955 Enable @option{-Wformat} plus format checks not included in
2956 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2957 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2959 @item -Wnonnull @r{(C and Objective-C only)}
2960 @opindex Wnonnull
2961 @opindex Wno-nonnull
2962 Warn about passing a null pointer for arguments marked as
2963 requiring a non-null value by the @code{nonnull} function attribute.
2965 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2966 can be disabled with the @option{-Wno-nonnull} option.
2968 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
2969 @opindex Winit-self
2970 @opindex Wno-init-self
2971 Warn about uninitialized variables which are initialized with themselves.
2972 Note this option can only be used with the @option{-Wuninitialized} option.
2974 For example, GCC will warn about @code{i} being uninitialized in the
2975 following snippet only when @option{-Winit-self} has been specified:
2976 @smallexample
2977 @group
2978 int f()
2980   int i = i;
2981   return i;
2983 @end group
2984 @end smallexample
2986 @item -Wimplicit-int @r{(C and Objective-C only)}
2987 @opindex Wimplicit-int
2988 @opindex Wno-implicit-int
2989 Warn when a declaration does not specify a type.
2990 This warning is enabled by @option{-Wall}.
2992 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
2993 @opindex Wimplicit-function-declaration
2994 @opindex Wno-implicit-function-declaration
2995 Give a warning whenever a function is used before being declared. In
2996 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
2997 enabled by default and it is made into an error by
2998 @option{-pedantic-errors}. This warning is also enabled by
2999 @option{-Wall}.
3001 @item -Wimplicit
3002 @opindex Wimplicit
3003 @opindex Wno-implicit
3004 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3005 This warning is enabled by @option{-Wall}.
3007 @item -Wignored-qualifiers @r{(C and C++ only)}
3008 @opindex Wignored-qualifiers
3009 @opindex Wno-ignored-qualifiers
3010 Warn if the return type of a function has a type qualifier
3011 such as @code{const}.  For ISO C such a type qualifier has no effect,
3012 since the value returned by a function is not an lvalue.
3013 For C++, the warning is only emitted for scalar types or @code{void}.
3014 ISO C prohibits qualified @code{void} return types on function
3015 definitions, so such return types always receive a warning
3016 even without this option.
3018 This warning is also enabled by @option{-Wextra}.
3020 @item -Wmain
3021 @opindex Wmain
3022 @opindex Wno-main
3023 Warn if the type of @samp{main} is suspicious.  @samp{main} should be
3024 a function with external linkage, returning int, taking either zero
3025 arguments, two, or three arguments of appropriate types.  This warning
3026 is enabled by default in C++ and is enabled by either @option{-Wall}
3027 or @option{-pedantic}.
3029 @item -Wmissing-braces
3030 @opindex Wmissing-braces
3031 @opindex Wno-missing-braces
3032 Warn if an aggregate or union initializer is not fully bracketed.  In
3033 the following example, the initializer for @samp{a} is not fully
3034 bracketed, but that for @samp{b} is fully bracketed.
3036 @smallexample
3037 int a[2][2] = @{ 0, 1, 2, 3 @};
3038 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3039 @end smallexample
3041 This warning is enabled by @option{-Wall}.
3043 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3044 @opindex Wmissing-include-dirs
3045 @opindex Wno-missing-include-dirs
3046 Warn if a user-supplied include directory does not exist.
3048 @item -Wparentheses
3049 @opindex Wparentheses
3050 @opindex Wno-parentheses
3051 Warn if parentheses are omitted in certain contexts, such
3052 as when there is an assignment in a context where a truth value
3053 is expected, or when operators are nested whose precedence people
3054 often get confused about.
3056 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3057 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3058 interpretation from that of ordinary mathematical notation.
3060 Also warn about constructions where there may be confusion to which
3061 @code{if} statement an @code{else} branch belongs.  Here is an example of
3062 such a case:
3064 @smallexample
3065 @group
3067   if (a)
3068     if (b)
3069       foo ();
3070   else
3071     bar ();
3073 @end group
3074 @end smallexample
3076 In C/C++, every @code{else} branch belongs to the innermost possible
3077 @code{if} statement, which in this example is @code{if (b)}.  This is
3078 often not what the programmer expected, as illustrated in the above
3079 example by indentation the programmer chose.  When there is the
3080 potential for this confusion, GCC will issue a warning when this flag
3081 is specified.  To eliminate the warning, add explicit braces around
3082 the innermost @code{if} statement so there is no way the @code{else}
3083 could belong to the enclosing @code{if}.  The resulting code would
3084 look like this:
3086 @smallexample
3087 @group
3089   if (a)
3090     @{
3091       if (b)
3092         foo ();
3093       else
3094         bar ();
3095     @}
3097 @end group
3098 @end smallexample
3100 This warning is enabled by @option{-Wall}.
3102 @item -Wsequence-point
3103 @opindex Wsequence-point
3104 @opindex Wno-sequence-point
3105 Warn about code that may have undefined semantics because of violations
3106 of sequence point rules in the C and C++ standards.
3108 The C and C++ standards defines the order in which expressions in a C/C++
3109 program are evaluated in terms of @dfn{sequence points}, which represent
3110 a partial ordering between the execution of parts of the program: those
3111 executed before the sequence point, and those executed after it.  These
3112 occur after the evaluation of a full expression (one which is not part
3113 of a larger expression), after the evaluation of the first operand of a
3114 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3115 function is called (but after the evaluation of its arguments and the
3116 expression denoting the called function), and in certain other places.
3117 Other than as expressed by the sequence point rules, the order of
3118 evaluation of subexpressions of an expression is not specified.  All
3119 these rules describe only a partial order rather than a total order,
3120 since, for example, if two functions are called within one expression
3121 with no sequence point between them, the order in which the functions
3122 are called is not specified.  However, the standards committee have
3123 ruled that function calls do not overlap.
3125 It is not specified when between sequence points modifications to the
3126 values of objects take effect.  Programs whose behavior depends on this
3127 have undefined behavior; the C and C++ standards specify that ``Between
3128 the previous and next sequence point an object shall have its stored
3129 value modified at most once by the evaluation of an expression.
3130 Furthermore, the prior value shall be read only to determine the value
3131 to be stored.''.  If a program breaks these rules, the results on any
3132 particular implementation are entirely unpredictable.
3134 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3135 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
3136 diagnosed by this option, and it may give an occasional false positive
3137 result, but in general it has been found fairly effective at detecting
3138 this sort of problem in programs.
3140 The standard is worded confusingly, therefore there is some debate
3141 over the precise meaning of the sequence point rules in subtle cases.
3142 Links to discussions of the problem, including proposed formal
3143 definitions, may be found on the GCC readings page, at
3144 @w{@uref{http://gcc.gnu.org/readings.html}}.
3146 This warning is enabled by @option{-Wall} for C and C++.
3148 @item -Wreturn-type
3149 @opindex Wreturn-type
3150 @opindex Wno-return-type
3151 Warn whenever a function is defined with a return-type that defaults
3152 to @code{int}.  Also warn about any @code{return} statement with no
3153 return-value in a function whose return-type is not @code{void}
3154 (falling off the end of the function body is considered returning
3155 without a value), and about a @code{return} statement with an
3156 expression in a function whose return-type is @code{void}.
3158 For C++, a function without return type always produces a diagnostic
3159 message, even when @option{-Wno-return-type} is specified.  The only
3160 exceptions are @samp{main} and functions defined in system headers.
3162 This warning is enabled by @option{-Wall}.
3164 @item -Wswitch
3165 @opindex Wswitch
3166 @opindex Wno-switch
3167 Warn whenever a @code{switch} statement has an index of enumerated type
3168 and lacks a @code{case} for one or more of the named codes of that
3169 enumeration.  (The presence of a @code{default} label prevents this
3170 warning.)  @code{case} labels outside the enumeration range also
3171 provoke warnings when this option is used.
3172 This warning is enabled by @option{-Wall}.
3174 @item -Wswitch-default
3175 @opindex Wswitch-default
3176 @opindex Wno-switch-default
3177 Warn whenever a @code{switch} statement does not have a @code{default}
3178 case.
3180 @item -Wswitch-enum
3181 @opindex Wswitch-enum
3182 @opindex Wno-switch-enum
3183 Warn whenever a @code{switch} statement has an index of enumerated type
3184 and lacks a @code{case} for one or more of the named codes of that
3185 enumeration.  @code{case} labels outside the enumeration range also
3186 provoke warnings when this option is used.
3188 @item -Wsync-nand @r{(C and C++ only)}
3189 @opindex Wsync-nand
3190 @opindex Wno-sync-nand
3191 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3192 built-in functions are used.  These functions changed semantics in GCC 4.4.
3194 @item -Wtrigraphs
3195 @opindex Wtrigraphs
3196 @opindex Wno-trigraphs
3197 Warn if any trigraphs are encountered that might change the meaning of
3198 the program (trigraphs within comments are not warned about).
3199 This warning is enabled by @option{-Wall}.
3201 @item -Wunused-function
3202 @opindex Wunused-function
3203 @opindex Wno-unused-function
3204 Warn whenever a static function is declared but not defined or a
3205 non-inline static function is unused.
3206 This warning is enabled by @option{-Wall}.
3208 @item -Wunused-label
3209 @opindex Wunused-label
3210 @opindex Wno-unused-label
3211 Warn whenever a label is declared but not used.
3212 This warning is enabled by @option{-Wall}.
3214 To suppress this warning use the @samp{unused} attribute
3215 (@pxref{Variable Attributes}).
3217 @item -Wunused-parameter
3218 @opindex Wunused-parameter
3219 @opindex Wno-unused-parameter
3220 Warn whenever a function parameter is unused aside from its declaration.
3222 To suppress this warning use the @samp{unused} attribute
3223 (@pxref{Variable Attributes}).
3225 @item -Wunused-variable
3226 @opindex Wunused-variable
3227 @opindex Wno-unused-variable
3228 Warn whenever a local variable or non-constant static variable is unused
3229 aside from its declaration.
3230 This warning is enabled by @option{-Wall}.
3232 To suppress this warning use the @samp{unused} attribute
3233 (@pxref{Variable Attributes}).
3235 @item -Wunused-value
3236 @opindex Wunused-value
3237 @opindex Wno-unused-value
3238 Warn whenever a statement computes a result that is explicitly not
3239 used. To suppress this warning cast the unused expression to
3240 @samp{void}. This includes an expression-statement or the left-hand
3241 side of a comma expression that contains no side effects. For example,
3242 an expression such as @samp{x[i,j]} will cause a warning, while
3243 @samp{x[(void)i,j]} will not.
3245 This warning is enabled by @option{-Wall}.
3247 @item -Wunused
3248 @opindex Wunused
3249 @opindex Wno-unused
3250 All the above @option{-Wunused} options combined.
3252 In order to get a warning about an unused function parameter, you must
3253 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3254 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3256 @item -Wuninitialized
3257 @opindex Wuninitialized
3258 @opindex Wno-uninitialized
3259 Warn if an automatic variable is used without first being initialized
3260 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3261 warn if a non-static reference or non-static @samp{const} member
3262 appears in a class without constructors.
3264 If you want to warn about code which uses the uninitialized value of the
3265 variable in its own initializer, use the @option{-Winit-self} option.
3267 These warnings occur for individual uninitialized or clobbered
3268 elements of structure, union or array variables as well as for
3269 variables which are uninitialized or clobbered as a whole.  They do
3270 not occur for variables or elements declared @code{volatile}.  Because
3271 these warnings depend on optimization, the exact variables or elements
3272 for which there are warnings will depend on the precise optimization
3273 options and version of GCC used.
3275 Note that there may be no warning about a variable that is used only
3276 to compute a value that itself is never used, because such
3277 computations may be deleted by data flow analysis before the warnings
3278 are printed.
3280 These warnings are made optional because GCC is not smart
3281 enough to see all the reasons why the code might be correct
3282 despite appearing to have an error.  Here is one example of how
3283 this can happen:
3285 @smallexample
3286 @group
3288   int x;
3289   switch (y)
3290     @{
3291     case 1: x = 1;
3292       break;
3293     case 2: x = 4;
3294       break;
3295     case 3: x = 5;
3296     @}
3297   foo (x);
3299 @end group
3300 @end smallexample
3302 @noindent
3303 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3304 always initialized, but GCC doesn't know this.  Here is
3305 another common case:
3307 @smallexample
3309   int save_y;
3310   if (change_y) save_y = y, y = new_y;
3311   @dots{}
3312   if (change_y) y = save_y;
3314 @end smallexample
3316 @noindent
3317 This has no bug because @code{save_y} is used only if it is set.
3319 @cindex @code{longjmp} warnings
3320 This option also warns when a non-volatile automatic variable might be
3321 changed by a call to @code{longjmp}.  These warnings as well are possible
3322 only in optimizing compilation.
3324 The compiler sees only the calls to @code{setjmp}.  It cannot know
3325 where @code{longjmp} will be called; in fact, a signal handler could
3326 call it at any point in the code.  As a result, you may get a warning
3327 even when there is in fact no problem because @code{longjmp} cannot
3328 in fact be called at the place which would cause a problem.
3330 Some spurious warnings can be avoided if you declare all the functions
3331 you use that never return as @code{noreturn}.  @xref{Function
3332 Attributes}.
3334 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3336 @item -Wunknown-pragmas
3337 @opindex Wunknown-pragmas
3338 @opindex Wno-unknown-pragmas
3339 @cindex warning for unknown pragmas
3340 @cindex unknown pragmas, warning
3341 @cindex pragmas, warning of unknown
3342 Warn when a #pragma directive is encountered which is not understood by
3343 GCC@.  If this command line option is used, warnings will even be issued
3344 for unknown pragmas in system header files.  This is not the case if
3345 the warnings were only enabled by the @option{-Wall} command line option.
3347 @item -Wno-pragmas
3348 @opindex Wno-pragmas
3349 @opindex Wpragmas
3350 Do not warn about misuses of pragmas, such as incorrect parameters,
3351 invalid syntax, or conflicts between pragmas.  See also
3352 @samp{-Wunknown-pragmas}.
3354 @item -Wstrict-aliasing
3355 @opindex Wstrict-aliasing
3356 @opindex Wno-strict-aliasing
3357 This option is only active when @option{-fstrict-aliasing} is active.
3358 It warns about code which might break the strict aliasing rules that the
3359 compiler is using for optimization.  The warning does not catch all
3360 cases, but does attempt to catch the more common pitfalls.  It is
3361 included in @option{-Wall}.
3362 It is equivalent to @option{-Wstrict-aliasing=3}
3364 @item -Wstrict-aliasing=n
3365 @opindex Wstrict-aliasing=n
3366 @opindex Wno-strict-aliasing=n
3367 This option is only active when @option{-fstrict-aliasing} is active.
3368 It warns about code which might break the strict aliasing rules that the
3369 compiler is using for optimization.
3370 Higher levels correspond to higher accuracy (fewer false positives).
3371 Higher levels also correspond to more effort, similar to the way -O works.
3372 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3373 with n=3.
3375 Level 1: Most aggressive, quick, least accurate.
3376 Possibly useful when higher levels
3377 do not warn but -fstrict-aliasing still breaks the code, as it has very few 
3378 false negatives.  However, it has many false positives.
3379 Warns for all pointer conversions between possibly incompatible types, 
3380 even if never dereferenced.  Runs in the frontend only.
3382 Level 2: Aggressive, quick, not too precise.
3383 May still have many false positives (not as many as level 1 though),
3384 and few false negatives (but possibly more than level 1).
3385 Unlike level 1, it only warns when an address is taken.  Warns about
3386 incomplete types.  Runs in the frontend only.
3388 Level 3 (default for @option{-Wstrict-aliasing}): 
3389 Should have very few false positives and few false 
3390 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
3391 Takes care of the common punn+dereference pattern in the frontend:
3392 @code{*(int*)&some_float}.
3393 If optimization is enabled, it also runs in the backend, where it deals 
3394 with multiple statement cases using flow-sensitive points-to information.
3395 Only warns when the converted pointer is dereferenced.
3396 Does not warn about incomplete types.
3398 @item -Wstrict-overflow
3399 @itemx -Wstrict-overflow=@var{n}
3400 @opindex Wstrict-overflow
3401 @opindex Wno-strict-overflow
3402 This option is only active when @option{-fstrict-overflow} is active.
3403 It warns about cases where the compiler optimizes based on the
3404 assumption that signed overflow does not occur.  Note that it does not
3405 warn about all cases where the code might overflow: it only warns
3406 about cases where the compiler implements some optimization.  Thus
3407 this warning depends on the optimization level.
3409 An optimization which assumes that signed overflow does not occur is
3410 perfectly safe if the values of the variables involved are such that
3411 overflow never does, in fact, occur.  Therefore this warning can
3412 easily give a false positive: a warning about code which is not
3413 actually a problem.  To help focus on important issues, several
3414 warning levels are defined.  No warnings are issued for the use of
3415 undefined signed overflow when estimating how many iterations a loop
3416 will require, in particular when determining whether a loop will be
3417 executed at all.
3419 @table @gcctabopt
3420 @item -Wstrict-overflow=1
3421 Warn about cases which are both questionable and easy to avoid.  For
3422 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3423 compiler will simplify this to @code{1}.  This level of
3424 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3425 are not, and must be explicitly requested.
3427 @item -Wstrict-overflow=2
3428 Also warn about other cases where a comparison is simplified to a
3429 constant.  For example: @code{abs (x) >= 0}.  This can only be
3430 simplified when @option{-fstrict-overflow} is in effect, because
3431 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3432 zero.  @option{-Wstrict-overflow} (with no level) is the same as
3433 @option{-Wstrict-overflow=2}.
3435 @item -Wstrict-overflow=3
3436 Also warn about other cases where a comparison is simplified.  For
3437 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3439 @item -Wstrict-overflow=4
3440 Also warn about other simplifications not covered by the above cases.
3441 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3443 @item -Wstrict-overflow=5
3444 Also warn about cases where the compiler reduces the magnitude of a
3445 constant involved in a comparison.  For example: @code{x + 2 > y} will
3446 be simplified to @code{x + 1 >= y}.  This is reported only at the
3447 highest warning level because this simplification applies to many
3448 comparisons, so this warning level will give a very large number of
3449 false positives.
3450 @end table
3452 @item -Warray-bounds
3453 @opindex Wno-array-bounds
3454 @opindex Warray-bounds
3455 This option is only active when @option{-ftree-vrp} is active
3456 (default for -O2 and above). It warns about subscripts to arrays
3457 that are always out of bounds. This warning is enabled by @option{-Wall}.
3459 @item -Wno-div-by-zero
3460 @opindex Wno-div-by-zero
3461 @opindex Wdiv-by-zero
3462 Do not warn about compile-time integer division by zero.  Floating point
3463 division by zero is not warned about, as it can be a legitimate way of
3464 obtaining infinities and NaNs.
3466 @item -Wsystem-headers
3467 @opindex Wsystem-headers
3468 @opindex Wno-system-headers
3469 @cindex warnings from system headers
3470 @cindex system headers, warnings from
3471 Print warning messages for constructs found in system header files.
3472 Warnings from system headers are normally suppressed, on the assumption
3473 that they usually do not indicate real problems and would only make the
3474 compiler output harder to read.  Using this command line option tells
3475 GCC to emit warnings from system headers as if they occurred in user
3476 code.  However, note that using @option{-Wall} in conjunction with this
3477 option will @emph{not} warn about unknown pragmas in system
3478 headers---for that, @option{-Wunknown-pragmas} must also be used.
3480 @item -Wfloat-equal
3481 @opindex Wfloat-equal
3482 @opindex Wno-float-equal
3483 Warn if floating point values are used in equality comparisons.
3485 The idea behind this is that sometimes it is convenient (for the
3486 programmer) to consider floating-point values as approximations to
3487 infinitely precise real numbers.  If you are doing this, then you need
3488 to compute (by analyzing the code, or in some other way) the maximum or
3489 likely maximum error that the computation introduces, and allow for it
3490 when performing comparisons (and when producing output, but that's a
3491 different problem).  In particular, instead of testing for equality, you
3492 would check to see whether the two values have ranges that overlap; and
3493 this is done with the relational operators, so equality comparisons are
3494 probably mistaken.
3496 @item -Wtraditional @r{(C and Objective-C only)}
3497 @opindex Wtraditional
3498 @opindex Wno-traditional
3499 Warn about certain constructs that behave differently in traditional and
3500 ISO C@.  Also warn about ISO C constructs that have no traditional C
3501 equivalent, and/or problematic constructs which should be avoided.
3503 @itemize @bullet
3504 @item
3505 Macro parameters that appear within string literals in the macro body.
3506 In traditional C macro replacement takes place within string literals,
3507 but does not in ISO C@.
3509 @item
3510 In traditional C, some preprocessor directives did not exist.
3511 Traditional preprocessors would only consider a line to be a directive
3512 if the @samp{#} appeared in column 1 on the line.  Therefore
3513 @option{-Wtraditional} warns about directives that traditional C
3514 understands but would ignore because the @samp{#} does not appear as the
3515 first character on the line.  It also suggests you hide directives like
3516 @samp{#pragma} not understood by traditional C by indenting them.  Some
3517 traditional implementations would not recognize @samp{#elif}, so it
3518 suggests avoiding it altogether.
3520 @item
3521 A function-like macro that appears without arguments.
3523 @item
3524 The unary plus operator.
3526 @item
3527 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3528 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
3529 constants.)  Note, these suffixes appear in macros defined in the system
3530 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3531 Use of these macros in user code might normally lead to spurious
3532 warnings, however GCC's integrated preprocessor has enough context to
3533 avoid warning in these cases.
3535 @item
3536 A function declared external in one block and then used after the end of
3537 the block.
3539 @item
3540 A @code{switch} statement has an operand of type @code{long}.
3542 @item
3543 A non-@code{static} function declaration follows a @code{static} one.
3544 This construct is not accepted by some traditional C compilers.
3546 @item
3547 The ISO type of an integer constant has a different width or
3548 signedness from its traditional type.  This warning is only issued if
3549 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
3550 typically represent bit patterns, are not warned about.
3552 @item
3553 Usage of ISO string concatenation is detected.
3555 @item
3556 Initialization of automatic aggregates.
3558 @item
3559 Identifier conflicts with labels.  Traditional C lacks a separate
3560 namespace for labels.
3562 @item
3563 Initialization of unions.  If the initializer is zero, the warning is
3564 omitted.  This is done under the assumption that the zero initializer in
3565 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3566 initializer warnings and relies on default initialization to zero in the
3567 traditional C case.
3569 @item
3570 Conversions by prototypes between fixed/floating point values and vice
3571 versa.  The absence of these prototypes when compiling with traditional
3572 C would cause serious problems.  This is a subset of the possible
3573 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3575 @item
3576 Use of ISO C style function definitions.  This warning intentionally is
3577 @emph{not} issued for prototype declarations or variadic functions
3578 because these ISO C features will appear in your code when using
3579 libiberty's traditional C compatibility macros, @code{PARAMS} and
3580 @code{VPARAMS}.  This warning is also bypassed for nested functions
3581 because that feature is already a GCC extension and thus not relevant to
3582 traditional C compatibility.
3583 @end itemize
3585 @item -Wtraditional-conversion @r{(C and Objective-C only)}
3586 @opindex Wtraditional-conversion
3587 @opindex Wno-traditional-conversion
3588 Warn if a prototype causes a type conversion that is different from what
3589 would happen to the same argument in the absence of a prototype.  This
3590 includes conversions of fixed point to floating and vice versa, and
3591 conversions changing the width or signedness of a fixed point argument
3592 except when the same as the default promotion.
3594 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
3595 @opindex Wdeclaration-after-statement
3596 @opindex Wno-declaration-after-statement
3597 Warn when a declaration is found after a statement in a block.  This
3598 construct, known from C++, was introduced with ISO C99 and is by default
3599 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
3600 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
3602 @item -Wundef
3603 @opindex Wundef
3604 @opindex Wno-undef
3605 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3607 @item -Wno-endif-labels
3608 @opindex Wno-endif-labels
3609 @opindex Wendif-labels
3610 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3612 @item -Wshadow
3613 @opindex Wshadow
3614 @opindex Wno-shadow
3615 Warn whenever a local variable shadows another local variable, parameter or
3616 global variable or whenever a built-in function is shadowed.
3618 @item -Wlarger-than=@var{len}
3619 @opindex Wlarger-than=@var{len}
3620 @opindex Wlarger-than-@var{len}
3621 Warn whenever an object of larger than @var{len} bytes is defined.
3623 @item -Wframe-larger-than=@var{len}
3624 @opindex Wframe-larger-than
3625 Warn if the size of a function frame is larger than @var{len} bytes.
3626 The computation done to determine the stack frame size is approximate
3627 and not conservative.
3628 The actual requirements may be somewhat greater than @var{len}
3629 even if you do not get a warning.  In addition, any space allocated
3630 via @code{alloca}, variable-length arrays, or related constructs
3631 is not included by the compiler when determining
3632 whether or not to issue a warning.
3634 @item -Wunsafe-loop-optimizations
3635 @opindex Wunsafe-loop-optimizations
3636 @opindex Wno-unsafe-loop-optimizations
3637 Warn if the loop cannot be optimized because the compiler could not
3638 assume anything on the bounds of the loop indices.  With
3639 @option{-funsafe-loop-optimizations} warn if the compiler made
3640 such assumptions.
3642 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
3643 @opindex Wno-pedantic-ms-format
3644 @opindex Wpedantic-ms-format
3645 Disables the warnings about non-ISO @code{printf} / @code{scanf} format
3646 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
3647 depending on the MS runtime, when you are using the options @option{-Wformat}
3648 and @option{-pedantic} without gnu-extensions.
3650 @item -Wpointer-arith
3651 @opindex Wpointer-arith
3652 @opindex Wno-pointer-arith
3653 Warn about anything that depends on the ``size of'' a function type or
3654 of @code{void}.  GNU C assigns these types a size of 1, for
3655 convenience in calculations with @code{void *} pointers and pointers
3656 to functions.  In C++, warn also when an arithmetic operation involves
3657 @code{NULL}.  This warning is also enabled by @option{-pedantic}.
3659 @item -Wtype-limits
3660 @opindex Wtype-limits
3661 @opindex Wno-type-limits
3662 Warn if a comparison is always true or always false due to the limited
3663 range of the data type, but do not warn for constant expressions.  For
3664 example, warn if an unsigned variable is compared against zero with
3665 @samp{<} or @samp{>=}.  This warning is also enabled by
3666 @option{-Wextra}.
3668 @item -Wbad-function-cast @r{(C and Objective-C only)}
3669 @opindex Wbad-function-cast
3670 @opindex Wno-bad-function-cast
3671 Warn whenever a function call is cast to a non-matching type.
3672 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3674 @item -Wc++-compat @r{(C and Objective-C only)}
3675 Warn about ISO C constructs that are outside of the common subset of
3676 ISO C and ISO C++, e.g.@: request for implicit conversion from
3677 @code{void *} to a pointer to non-@code{void} type.
3679 @item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3680 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3681 ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
3682 in ISO C++ 200x.  This warning is enabled by @option{-Wall}.
3684 @item -Wcast-qual
3685 @opindex Wcast-qual
3686 @opindex Wno-cast-qual
3687 Warn whenever a pointer is cast so as to remove a type qualifier from
3688 the target type.  For example, warn if a @code{const char *} is cast
3689 to an ordinary @code{char *}.
3691 @item -Wcast-align
3692 @opindex Wcast-align
3693 @opindex Wno-cast-align
3694 Warn whenever a pointer is cast such that the required alignment of the
3695 target is increased.  For example, warn if a @code{char *} is cast to
3696 an @code{int *} on machines where integers can only be accessed at
3697 two- or four-byte boundaries.
3699 @item -Wwrite-strings
3700 @opindex Wwrite-strings
3701 @opindex Wno-write-strings
3702 When compiling C, give string constants the type @code{const
3703 char[@var{length}]} so that copying the address of one into a
3704 non-@code{const} @code{char *} pointer will get a warning.  These
3705 warnings will help you find at compile time code that can try to write
3706 into a string constant, but only if you have been very careful about
3707 using @code{const} in declarations and prototypes.  Otherwise, it will
3708 just be a nuisance. This is why we did not make @option{-Wall} request
3709 these warnings.
3711 When compiling C++, warn about the deprecated conversion from string
3712 literals to @code{char *}.  This warning is enabled by default for C++
3713 programs.
3715 @item -Wclobbered
3716 @opindex Wclobbered
3717 @opindex Wno-clobbered
3718 Warn for variables that might be changed by @samp{longjmp} or
3719 @samp{vfork}.  This warning is also enabled by @option{-Wextra}.
3721 @item -Wconversion
3722 @opindex Wconversion
3723 @opindex Wno-conversion
3724 Warn for implicit conversions that may alter a value. This includes
3725 conversions between real and integer, like @code{abs (x)} when
3726 @code{x} is @code{double}; conversions between signed and unsigned,
3727 like @code{unsigned ui = -1}; and conversions to smaller types, like
3728 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3729 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3730 changed by the conversion like in @code{abs (2.0)}.  Warnings about
3731 conversions between signed and unsigned integers can be disabled by
3732 using @option{-Wno-sign-conversion}.
3734 For C++, also warn for conversions between @code{NULL} and non-pointer
3735 types; confusing overload resolution for user-defined conversions; and
3736 conversions that will never use a type conversion operator:
3737 conversions to @code{void}, the same type, a base class or a reference
3738 to them. Warnings about conversions between signed and unsigned
3739 integers are disabled by default in C++ unless
3740 @option{-Wsign-conversion} is explicitly enabled.
3742 @item -Wempty-body
3743 @opindex Wempty-body
3744 @opindex Wno-empty-body
3745 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
3746 while} statement.  This warning is also enabled by @option{-Wextra}.
3748 @item -Wenum-compare
3749 @opindex Wenum-compare
3750 @opindex Wno-enum-compare
3751 Warn about a comparison between values of different enum types. In C++
3752 this warning is enabled by default.  In C this warning is enabled by
3753 @option{-Wall}.
3755 @item -Wsign-compare
3756 @opindex Wsign-compare
3757 @opindex Wno-sign-compare
3758 @cindex warning for comparison of signed and unsigned values
3759 @cindex comparison of signed and unsigned values, warning
3760 @cindex signed and unsigned values, comparison warning
3761 Warn when a comparison between signed and unsigned values could produce
3762 an incorrect result when the signed value is converted to unsigned.
3763 This warning is also enabled by @option{-Wextra}; to get the other warnings
3764 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3766 @item -Wsign-conversion
3767 @opindex Wsign-conversion
3768 @opindex Wno-sign-conversion
3769 Warn for implicit conversions that may change the sign of an integer
3770 value, like assigning a signed integer expression to an unsigned
3771 integer variable. An explicit cast silences the warning. In C, this
3772 option is enabled also by @option{-Wconversion}.
3774 @item -Waddress
3775 @opindex Waddress
3776 @opindex Wno-address
3777 Warn about suspicious uses of memory addresses. These include using
3778 the address of a function in a conditional expression, such as
3779 @code{void func(void); if (func)}, and comparisons against the memory
3780 address of a string literal, such as @code{if (x == "abc")}.  Such
3781 uses typically indicate a programmer error: the address of a function
3782 always evaluates to true, so their use in a conditional usually
3783 indicate that the programmer forgot the parentheses in a function
3784 call; and comparisons against string literals result in unspecified
3785 behavior and are not portable in C, so they usually indicate that the
3786 programmer intended to use @code{strcmp}.  This warning is enabled by
3787 @option{-Wall}.
3789 @item -Wlogical-op
3790 @opindex Wlogical-op
3791 @opindex Wno-logical-op
3792 Warn about suspicious uses of logical operators in expressions.
3793 This includes using logical operators in contexts where a
3794 bit-wise operator is likely to be expected.  This warning is enabled by
3795 @option{-Wextra}.
3797 @item -Waggregate-return
3798 @opindex Waggregate-return
3799 @opindex Wno-aggregate-return
3800 Warn if any functions that return structures or unions are defined or
3801 called.  (In languages where you can return an array, this also elicits
3802 a warning.)
3804 @item -Wno-attributes
3805 @opindex Wno-attributes
3806 @opindex Wattributes
3807 Do not warn if an unexpected @code{__attribute__} is used, such as
3808 unrecognized attributes, function attributes applied to variables,
3809 etc.  This will not stop errors for incorrect use of supported
3810 attributes.
3812 @item -Wno-builtin-macro-redefined
3813 @opindex Wno-builtin-macro-redefined
3814 @opindex Wbuiltin-macro-redefined
3815 Do not warn if certain built-in macros are redefined.  This suppresses
3816 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
3817 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
3819 @item -Wstrict-prototypes @r{(C and Objective-C only)}
3820 @opindex Wstrict-prototypes
3821 @opindex Wno-strict-prototypes
3822 Warn if a function is declared or defined without specifying the
3823 argument types.  (An old-style function definition is permitted without
3824 a warning if preceded by a declaration which specifies the argument
3825 types.)
3827 @item -Wold-style-declaration @r{(C and Objective-C only)}
3828 @opindex Wold-style-declaration
3829 @opindex Wno-old-style-declaration
3830 Warn for obsolescent usages, according to the C Standard, in a
3831 declaration. For example, warn if storage-class specifiers like
3832 @code{static} are not the first things in a declaration.  This warning
3833 is also enabled by @option{-Wextra}.
3835 @item -Wold-style-definition @r{(C and Objective-C only)}
3836 @opindex Wold-style-definition
3837 @opindex Wno-old-style-definition
3838 Warn if an old-style function definition is used.  A warning is given
3839 even if there is a previous prototype.
3841 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
3842 @opindex Wmissing-parameter-type
3843 @opindex Wno-missing-parameter-type
3844 A function parameter is declared without a type specifier in K&R-style
3845 functions:
3847 @smallexample
3848 void foo(bar) @{ @}
3849 @end smallexample
3851 This warning is also enabled by @option{-Wextra}.
3853 @item -Wmissing-prototypes @r{(C and Objective-C only)}
3854 @opindex Wmissing-prototypes
3855 @opindex Wno-missing-prototypes
3856 Warn if a global function is defined without a previous prototype
3857 declaration.  This warning is issued even if the definition itself
3858 provides a prototype.  The aim is to detect global functions that fail
3859 to be declared in header files.
3861 @item -Wmissing-declarations
3862 @opindex Wmissing-declarations
3863 @opindex Wno-missing-declarations
3864 Warn if a global function is defined without a previous declaration.
3865 Do so even if the definition itself provides a prototype.
3866 Use this option to detect global functions that are not declared in
3867 header files.  In C++, no warnings are issued for function templates,
3868 or for inline functions, or for functions in anonymous namespaces.
3870 @item -Wmissing-field-initializers
3871 @opindex Wmissing-field-initializers
3872 @opindex Wno-missing-field-initializers
3873 @opindex W
3874 @opindex Wextra
3875 @opindex Wno-extra
3876 Warn if a structure's initializer has some fields missing.  For
3877 example, the following code would cause such a warning, because
3878 @code{x.h} is implicitly zero:
3880 @smallexample
3881 struct s @{ int f, g, h; @};
3882 struct s x = @{ 3, 4 @};
3883 @end smallexample
3885 This option does not warn about designated initializers, so the following
3886 modification would not trigger a warning:
3888 @smallexample
3889 struct s @{ int f, g, h; @};
3890 struct s x = @{ .f = 3, .g = 4 @};
3891 @end smallexample
3893 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
3894 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3896 @item -Wmissing-noreturn
3897 @opindex Wmissing-noreturn
3898 @opindex Wno-missing-noreturn
3899 Warn about functions which might be candidates for attribute @code{noreturn}.
3900 Note these are only possible candidates, not absolute ones.  Care should
3901 be taken to manually verify functions actually do not ever return before
3902 adding the @code{noreturn} attribute, otherwise subtle code generation
3903 bugs could be introduced.  You will not get a warning for @code{main} in
3904 hosted C environments.
3906 @item -Wmissing-format-attribute
3907 @opindex Wmissing-format-attribute
3908 @opindex Wno-missing-format-attribute
3909 @opindex Wformat
3910 @opindex Wno-format
3911 Warn about function pointers which might be candidates for @code{format}
3912 attributes.  Note these are only possible candidates, not absolute ones.
3913 GCC will guess that function pointers with @code{format} attributes that
3914 are used in assignment, initialization, parameter passing or return
3915 statements should have a corresponding @code{format} attribute in the
3916 resulting type.  I.e.@: the left-hand side of the assignment or
3917 initialization, the type of the parameter variable, or the return type
3918 of the containing function respectively should also have a @code{format}
3919 attribute to avoid the warning.
3921 GCC will also warn about function definitions which might be
3922 candidates for @code{format} attributes.  Again, these are only
3923 possible candidates.  GCC will guess that @code{format} attributes
3924 might be appropriate for any function that calls a function like
3925 @code{vprintf} or @code{vscanf}, but this might not always be the
3926 case, and some functions for which @code{format} attributes are
3927 appropriate may not be detected.
3929 @item -Wno-multichar
3930 @opindex Wno-multichar
3931 @opindex Wmultichar
3932 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3933 Usually they indicate a typo in the user's code, as they have
3934 implementation-defined values, and should not be used in portable code.
3936 @item -Wnormalized=<none|id|nfc|nfkc>
3937 @opindex Wnormalized=
3938 @cindex NFC
3939 @cindex NFKC
3940 @cindex character set, input normalization
3941 In ISO C and ISO C++, two identifiers are different if they are
3942 different sequences of characters.  However, sometimes when characters
3943 outside the basic ASCII character set are used, you can have two
3944 different character sequences that look the same.  To avoid confusion,
3945 the ISO 10646 standard sets out some @dfn{normalization rules} which
3946 when applied ensure that two sequences that look the same are turned into
3947 the same sequence.  GCC can warn you if you are using identifiers which
3948 have not been normalized; this option controls that warning.
3950 There are four levels of warning that GCC supports.  The default is
3951 @option{-Wnormalized=nfc}, which warns about any identifier which is
3952 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
3953 recommended form for most uses.
3955 Unfortunately, there are some characters which ISO C and ISO C++ allow
3956 in identifiers that when turned into NFC aren't allowable as
3957 identifiers.  That is, there's no way to use these symbols in portable
3958 ISO C or C++ and have all your identifiers in NFC@.
3959 @option{-Wnormalized=id} suppresses the warning for these characters.
3960 It is hoped that future versions of the standards involved will correct
3961 this, which is why this option is not the default.
3963 You can switch the warning off for all characters by writing
3964 @option{-Wnormalized=none}.  You would only want to do this if you
3965 were using some other normalization scheme (like ``D''), because
3966 otherwise you can easily create bugs that are literally impossible to see.
3968 Some characters in ISO 10646 have distinct meanings but look identical
3969 in some fonts or display methodologies, especially once formatting has
3970 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3971 LETTER N'', will display just like a regular @code{n} which has been
3972 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
3973 normalization scheme to convert all these into a standard form as
3974 well, and GCC will warn if your code is not in NFKC if you use
3975 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
3976 about every identifier that contains the letter O because it might be
3977 confused with the digit 0, and so is not the default, but may be
3978 useful as a local coding convention if the programming environment is
3979 unable to be fixed to display these characters distinctly.
3981 @item -Wno-deprecated
3982 @opindex Wno-deprecated
3983 @opindex Wdeprecated
3984 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
3986 @item -Wno-deprecated-declarations
3987 @opindex Wno-deprecated-declarations
3988 @opindex Wdeprecated-declarations
3989 Do not warn about uses of functions (@pxref{Function Attributes}),
3990 variables (@pxref{Variable Attributes}), and types (@pxref{Type
3991 Attributes}) marked as deprecated by using the @code{deprecated}
3992 attribute.
3994 @item -Wno-overflow
3995 @opindex Wno-overflow
3996 @opindex Woverflow
3997 Do not warn about compile-time overflow in constant expressions.
3999 @item -Woverride-init @r{(C and Objective-C only)}
4000 @opindex Woverride-init
4001 @opindex Wno-override-init
4002 @opindex W
4003 @opindex Wextra
4004 @opindex Wno-extra
4005 Warn if an initialized field without side effects is overridden when
4006 using designated initializers (@pxref{Designated Inits, , Designated
4007 Initializers}).
4009 This warning is included in @option{-Wextra}.  To get other
4010 @option{-Wextra} warnings without this one, use @samp{-Wextra
4011 -Wno-override-init}.
4013 @item -Wpacked
4014 @opindex Wpacked
4015 @opindex Wno-packed
4016 Warn if a structure is given the packed attribute, but the packed
4017 attribute has no effect on the layout or size of the structure.
4018 Such structures may be mis-aligned for little benefit.  For
4019 instance, in this code, the variable @code{f.x} in @code{struct bar}
4020 will be misaligned even though @code{struct bar} does not itself
4021 have the packed attribute:
4023 @smallexample
4024 @group
4025 struct foo @{
4026   int x;
4027   char a, b, c, d;
4028 @} __attribute__((packed));
4029 struct bar @{
4030   char z;
4031   struct foo f;
4033 @end group
4034 @end smallexample
4036 @item -Wpacked-bitfield-compat
4037 @opindex Wpacked-bitfield-compat
4038 @opindex Wno-packed-bitfield-compat
4039 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4040 on bit-fields of type @code{char}.  This has been fixed in GCC 4.4 but
4041 the change can lead to differences in the structure layout.  GCC
4042 informs you when the offset of such a field has changed in GCC 4.4.
4043 For example there is no longer a 4-bit padding between field @code{a}
4044 and @code{b} in this structure:
4046 @smallexample
4047 struct foo
4049   char a:4;
4050   char b:8;
4051 @} __attribute__ ((packed));
4052 @end smallexample
4054 This warning is enabled by default.  Use
4055 @option{-Wno-packed-bitfield-compat} to disable this warning.
4057 @item -Wpadded
4058 @opindex Wpadded
4059 @opindex Wno-padded
4060 Warn if padding is included in a structure, either to align an element
4061 of the structure or to align the whole structure.  Sometimes when this
4062 happens it is possible to rearrange the fields of the structure to
4063 reduce the padding and so make the structure smaller.
4065 @item -Wredundant-decls
4066 @opindex Wredundant-decls
4067 @opindex Wno-redundant-decls
4068 Warn if anything is declared more than once in the same scope, even in
4069 cases where multiple declaration is valid and changes nothing.
4071 @item -Wnested-externs @r{(C and Objective-C only)}
4072 @opindex Wnested-externs
4073 @opindex Wno-nested-externs
4074 Warn if an @code{extern} declaration is encountered within a function.
4076 @item -Wunreachable-code
4077 @opindex Wunreachable-code
4078 @opindex Wno-unreachable-code
4079 Warn if the compiler detects that code will never be executed.
4081 This option is intended to warn when the compiler detects that at
4082 least a whole line of source code will never be executed, because
4083 some condition is never satisfied or because it is after a
4084 procedure that never returns.
4086 It is possible for this option to produce a warning even though there
4087 are circumstances under which part of the affected line can be executed,
4088 so care should be taken when removing apparently-unreachable code.
4090 For instance, when a function is inlined, a warning may mean that the
4091 line is unreachable in only one inlined copy of the function.
4093 This option is not made part of @option{-Wall} because in a debugging
4094 version of a program there is often substantial code which checks
4095 correct functioning of the program and is, hopefully, unreachable
4096 because the program does work.  Another common use of unreachable
4097 code is to provide behavior which is selectable at compile-time.
4099 @item -Winline
4100 @opindex Winline
4101 @opindex Wno-inline
4102 Warn if a function can not be inlined and it was declared as inline.
4103 Even with this option, the compiler will not warn about failures to
4104 inline functions declared in system headers.
4106 The compiler uses a variety of heuristics to determine whether or not
4107 to inline a function.  For example, the compiler takes into account
4108 the size of the function being inlined and the amount of inlining
4109 that has already been done in the current function.  Therefore,
4110 seemingly insignificant changes in the source program can cause the
4111 warnings produced by @option{-Winline} to appear or disappear.
4113 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4114 @opindex Wno-invalid-offsetof
4115 @opindex Winvalid-offsetof
4116 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4117 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
4118 to a non-POD type is undefined.  In existing C++ implementations,
4119 however, @samp{offsetof} typically gives meaningful results even when
4120 applied to certain kinds of non-POD types. (Such as a simple
4121 @samp{struct} that fails to be a POD type only by virtue of having a
4122 constructor.)  This flag is for users who are aware that they are
4123 writing nonportable code and who have deliberately chosen to ignore the
4124 warning about it.
4126 The restrictions on @samp{offsetof} may be relaxed in a future version
4127 of the C++ standard.
4129 @item -Wno-int-to-pointer-cast @r{(C and Objective-C only)}
4130 @opindex Wno-int-to-pointer-cast
4131 @opindex Wint-to-pointer-cast
4132 Suppress warnings from casts to pointer type of an integer of a
4133 different size.
4135 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4136 @opindex Wno-pointer-to-int-cast
4137 @opindex Wpointer-to-int-cast
4138 Suppress warnings from casts from a pointer to an integer type of a
4139 different size.
4141 @item -Winvalid-pch
4142 @opindex Winvalid-pch
4143 @opindex Wno-invalid-pch
4144 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4145 the search path but can't be used.
4147 @item -Wlong-long
4148 @opindex Wlong-long
4149 @opindex Wno-long-long
4150 Warn if @samp{long long} type is used.  This is enabled by either
4151 @option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4152 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
4154 @item -Wvariadic-macros
4155 @opindex Wvariadic-macros
4156 @opindex Wno-variadic-macros
4157 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4158 alternate syntax when in pedantic ISO C99 mode.  This is default.
4159 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4161 @item -Wvla
4162 @opindex Wvla
4163 @opindex Wno-vla
4164 Warn if variable length array is used in the code.
4165 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
4166 the variable length array.
4168 @item -Wvolatile-register-var
4169 @opindex Wvolatile-register-var
4170 @opindex Wno-volatile-register-var
4171 Warn if a register variable is declared volatile.  The volatile
4172 modifier does not inhibit all optimizations that may eliminate reads
4173 and/or writes to register variables.  This warning is enabled by
4174 @option{-Wall}.
4176 @item -Wdisabled-optimization
4177 @opindex Wdisabled-optimization
4178 @opindex Wno-disabled-optimization
4179 Warn if a requested optimization pass is disabled.  This warning does
4180 not generally indicate that there is anything wrong with your code; it
4181 merely indicates that GCC's optimizers were unable to handle the code
4182 effectively.  Often, the problem is that your code is too big or too
4183 complex; GCC will refuse to optimize programs when the optimization
4184 itself is likely to take inordinate amounts of time.
4186 @item -Wpointer-sign @r{(C and Objective-C only)}
4187 @opindex Wpointer-sign
4188 @opindex Wno-pointer-sign
4189 Warn for pointer argument passing or assignment with different signedness.
4190 This option is only supported for C and Objective-C@.  It is implied by
4191 @option{-Wall} and by @option{-pedantic}, which can be disabled with
4192 @option{-Wno-pointer-sign}.
4194 @item -Wstack-protector
4195 @opindex Wstack-protector
4196 @opindex Wno-stack-protector
4197 This option is only active when @option{-fstack-protector} is active.  It
4198 warns about functions that will not be protected against stack smashing.
4200 @item -Wno-mudflap
4201 @opindex Wno-mudflap
4202 Suppress warnings about constructs that cannot be instrumented by
4203 @option{-fmudflap}.
4205 @item -Woverlength-strings
4206 @opindex Woverlength-strings
4207 @opindex Wno-overlength-strings
4208 Warn about string constants which are longer than the ``minimum
4209 maximum'' length specified in the C standard.  Modern compilers
4210 generally allow string constants which are much longer than the
4211 standard's minimum limit, but very portable programs should avoid
4212 using longer strings.
4214 The limit applies @emph{after} string constant concatenation, and does
4215 not count the trailing NUL@.  In C89, the limit was 509 characters; in
4216 C99, it was raised to 4095.  C++98 does not specify a normative
4217 minimum maximum, so we do not diagnose overlength strings in C++@.
4219 This option is implied by @option{-pedantic}, and can be disabled with
4220 @option{-Wno-overlength-strings}.
4222 @item -Wunsuffixed-float-constants
4223 @opindex Wunsuffixed-float-constants
4225 GCC will issue a warning for any floating constant that does not have
4226 a suffix.  When used together with @option{-Wsystem-headers} it will
4227 warn about such constants in system header files.  This can be useful
4228 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4229 from the decimal floating-point extension to C99.
4230 @end table
4232 @node Debugging Options
4233 @section Options for Debugging Your Program or GCC
4234 @cindex options, debugging
4235 @cindex debugging information options
4237 GCC has various special options that are used for debugging
4238 either your program or GCC:
4240 @table @gcctabopt
4241 @item -g
4242 @opindex g
4243 Produce debugging information in the operating system's native format
4244 (stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
4245 information.
4247 On most systems that use stabs format, @option{-g} enables use of extra
4248 debugging information that only GDB can use; this extra information
4249 makes debugging work better in GDB but will probably make other debuggers
4250 crash or
4251 refuse to read the program.  If you want to control for certain whether
4252 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4253 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4255 GCC allows you to use @option{-g} with
4256 @option{-O}.  The shortcuts taken by optimized code may occasionally
4257 produce surprising results: some variables you declared may not exist
4258 at all; flow of control may briefly move where you did not expect it;
4259 some statements may not be executed because they compute constant
4260 results or their values were already at hand; some statements may
4261 execute in different places because they were moved out of loops.
4263 Nevertheless it proves possible to debug optimized output.  This makes
4264 it reasonable to use the optimizer for programs that might have bugs.
4266 The following options are useful when GCC is generated with the
4267 capability for more than one debugging format.
4269 @item -ggdb
4270 @opindex ggdb
4271 Produce debugging information for use by GDB@.  This means to use the
4272 most expressive format available (DWARF 2, stabs, or the native format
4273 if neither of those are supported), including GDB extensions if at all
4274 possible.
4276 @item -gstabs
4277 @opindex gstabs
4278 Produce debugging information in stabs format (if that is supported),
4279 without GDB extensions.  This is the format used by DBX on most BSD
4280 systems.  On MIPS, Alpha and System V Release 4 systems this option
4281 produces stabs debugging output which is not understood by DBX or SDB@.
4282 On System V Release 4 systems this option requires the GNU assembler.
4284 @item -feliminate-unused-debug-symbols
4285 @opindex feliminate-unused-debug-symbols
4286 Produce debugging information in stabs format (if that is supported),
4287 for only symbols that are actually used.
4289 @item -femit-class-debug-always
4290 Instead of emitting debugging information for a C++ class in only one
4291 object file, emit it in all object files using the class.  This option
4292 should be used only with debuggers that are unable to handle the way GCC
4293 normally emits debugging information for classes because using this
4294 option will increase the size of debugging information by as much as a
4295 factor of two.
4297 @item -gstabs+
4298 @opindex gstabs+
4299 Produce debugging information in stabs format (if that is supported),
4300 using GNU extensions understood only by the GNU debugger (GDB)@.  The
4301 use of these extensions is likely to make other debuggers crash or
4302 refuse to read the program.
4304 @item -gcoff
4305 @opindex gcoff
4306 Produce debugging information in COFF format (if that is supported).
4307 This is the format used by SDB on most System V systems prior to
4308 System V Release 4.
4310 @item -gxcoff
4311 @opindex gxcoff
4312 Produce debugging information in XCOFF format (if that is supported).
4313 This is the format used by the DBX debugger on IBM RS/6000 systems.
4315 @item -gxcoff+
4316 @opindex gxcoff+
4317 Produce debugging information in XCOFF format (if that is supported),
4318 using GNU extensions understood only by the GNU debugger (GDB)@.  The
4319 use of these extensions is likely to make other debuggers crash or
4320 refuse to read the program, and may cause assemblers other than the GNU
4321 assembler (GAS) to fail with an error.
4323 @item -gdwarf-2
4324 @opindex gdwarf-2
4325 Produce debugging information in DWARF version 2 format (if that is
4326 supported).  This is the format used by DBX on IRIX 6.  With this
4327 option, GCC uses features of DWARF version 3 when they are useful;
4328 version 3 is upward compatible with version 2, but may still cause
4329 problems for older debuggers.
4331 @item -gvms
4332 @opindex gvms
4333 Produce debugging information in VMS debug format (if that is
4334 supported).  This is the format used by DEBUG on VMS systems.
4336 @item -g@var{level}
4337 @itemx -ggdb@var{level}
4338 @itemx -gstabs@var{level}
4339 @itemx -gcoff@var{level}
4340 @itemx -gxcoff@var{level}
4341 @itemx -gvms@var{level}
4342 Request debugging information and also use @var{level} to specify how
4343 much information.  The default level is 2.
4345 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
4346 @option{-g}.
4348 Level 1 produces minimal information, enough for making backtraces in
4349 parts of the program that you don't plan to debug.  This includes
4350 descriptions of functions and external variables, but no information
4351 about local variables and no line numbers.
4353 Level 3 includes extra information, such as all the macro definitions
4354 present in the program.  Some debuggers support macro expansion when
4355 you use @option{-g3}.
4357 @option{-gdwarf-2} does not accept a concatenated debug level, because
4358 GCC used to support an option @option{-gdwarf} that meant to generate
4359 debug information in version 1 of the DWARF format (which is very
4360 different from version 2), and it would have been too confusing.  That
4361 debug format is long obsolete, but the option cannot be changed now.
4362 Instead use an additional @option{-g@var{level}} option to change the
4363 debug level for DWARF2.
4365 @item -feliminate-dwarf2-dups
4366 @opindex feliminate-dwarf2-dups
4367 Compress DWARF2 debugging information by eliminating duplicated
4368 information about each symbol.  This option only makes sense when
4369 generating DWARF2 debugging information with @option{-gdwarf-2}.
4371 @item -femit-struct-debug-baseonly
4372 Emit debug information for struct-like types
4373 only when the base name of the compilation source file
4374 matches the base name of file in which the struct was defined.
4376 This option substantially reduces the size of debugging information,
4377 but at significant potential loss in type information to the debugger.
4378 See @option{-femit-struct-debug-reduced} for a less aggressive option.
4379 See @option{-femit-struct-debug-detailed} for more detailed control.
4381 This option works only with DWARF 2.
4383 @item -femit-struct-debug-reduced
4384 Emit debug information for struct-like types
4385 only when the base name of the compilation source file
4386 matches the base name of file in which the type was defined,
4387 unless the struct is a template or defined in a system header.
4389 This option significantly reduces the size of debugging information,
4390 with some potential loss in type information to the debugger.
4391 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4392 See @option{-femit-struct-debug-detailed} for more detailed control.
4394 This option works only with DWARF 2.
4396 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4397 Specify the struct-like types
4398 for which the compiler will generate debug information.
4399 The intent is to reduce duplicate struct debug information
4400 between different object files within the same program.
4402 This option is a detailed version of
4403 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4404 which will serve for most needs.
4406 A specification has the syntax
4407 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4409 The optional first word limits the specification to
4410 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4411 A struct type is used directly when it is the type of a variable, member.
4412 Indirect uses arise through pointers to structs.
4413 That is, when use of an incomplete struct would be legal, the use is indirect.
4414 An example is
4415 @samp{struct one direct; struct two * indirect;}.
4417 The optional second word limits the specification to
4418 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4419 Generic structs are a bit complicated to explain.
4420 For C++, these are non-explicit specializations of template classes,
4421 or non-template classes within the above.
4422 Other programming languages have generics,
4423 but @samp{-femit-struct-debug-detailed} does not yet implement them.
4425 The third word specifies the source files for those
4426 structs for which the compiler will emit debug information.
4427 The values @samp{none} and @samp{any} have the normal meaning.
4428 The value @samp{base} means that
4429 the base of name of the file in which the type declaration appears
4430 must match the base of the name of the main compilation file.
4431 In practice, this means that
4432 types declared in @file{foo.c} and @file{foo.h} will have debug information,
4433 but types declared in other header will not.
4434 The value @samp{sys} means those types satisfying @samp{base}
4435 or declared in system or compiler headers.
4437 You may need to experiment to determine the best settings for your application.
4439 The default is @samp{-femit-struct-debug-detailed=all}.
4441 This option works only with DWARF 2.
4443 @item -fno-merge-debug-strings
4444 @opindex fmerge-debug-strings
4445 @opindex fno-merge-debug-strings
4446 Direct the linker to not merge together strings in the debugging
4447 information which are identical in different object files.  Merging is
4448 not supported by all assemblers or linkers.  Merging decreases the size
4449 of the debug information in the output file at the cost of increasing
4450 link processing time.  Merging is enabled by default.
4452 @item -fdebug-prefix-map=@var{old}=@var{new}
4453 @opindex fdebug-prefix-map
4454 When compiling files in directory @file{@var{old}}, record debugging
4455 information describing them as in @file{@var{new}} instead.
4457 @item -fno-dwarf2-cfi-asm
4458 @opindex fdwarf2-cfi-asm
4459 @opindex fno-dwarf2-cfi-asm
4460 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
4461 instead of using GAS @code{.cfi_*} directives.
4463 @cindex @command{prof}
4464 @item -p
4465 @opindex p
4466 Generate extra code to write profile information suitable for the
4467 analysis program @command{prof}.  You must use this option when compiling
4468 the source files you want data about, and you must also use it when
4469 linking.
4471 @cindex @command{gprof}
4472 @item -pg
4473 @opindex pg
4474 Generate extra code to write profile information suitable for the
4475 analysis program @command{gprof}.  You must use this option when compiling
4476 the source files you want data about, and you must also use it when
4477 linking.
4479 @item -Q
4480 @opindex Q
4481 Makes the compiler print out each function name as it is compiled, and
4482 print some statistics about each pass when it finishes.
4484 @item -ftime-report
4485 @opindex ftime-report
4486 Makes the compiler print some statistics about the time consumed by each
4487 pass when it finishes.
4489 @item -fmem-report
4490 @opindex fmem-report
4491 Makes the compiler print some statistics about permanent memory
4492 allocation when it finishes.
4494 @item -fpre-ipa-mem-report
4495 @opindex fpre-ipa-mem-report
4496 @item -fpost-ipa-mem-report
4497 @opindex fpost-ipa-mem-report
4498 Makes the compiler print some statistics about permanent memory
4499 allocation before or after interprocedural optimization.
4501 @item -fprofile-arcs
4502 @opindex fprofile-arcs
4503 Add code so that program flow @dfn{arcs} are instrumented.  During
4504 execution the program records how many times each branch and call is
4505 executed and how many times it is taken or returns.  When the compiled
4506 program exits it saves this data to a file called
4507 @file{@var{auxname}.gcda} for each source file.  The data may be used for
4508 profile-directed optimizations (@option{-fbranch-probabilities}), or for
4509 test coverage analysis (@option{-ftest-coverage}).  Each object file's
4510 @var{auxname} is generated from the name of the output file, if
4511 explicitly specified and it is not the final executable, otherwise it is
4512 the basename of the source file.  In both cases any suffix is removed
4513 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
4514 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
4515 @xref{Cross-profiling}.
4517 @cindex @command{gcov}
4518 @item --coverage
4519 @opindex coverage
4521 This option is used to compile and link code instrumented for coverage
4522 analysis.  The option is a synonym for @option{-fprofile-arcs}
4523 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4524 linking).  See the documentation for those options for more details.
4526 @itemize
4528 @item
4529 Compile the source files with @option{-fprofile-arcs} plus optimization
4530 and code generation options.  For test coverage analysis, use the
4531 additional @option{-ftest-coverage} option.  You do not need to profile
4532 every source file in a program.
4534 @item
4535 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4536 (the latter implies the former).
4538 @item
4539 Run the program on a representative workload to generate the arc profile
4540 information.  This may be repeated any number of times.  You can run
4541 concurrent instances of your program, and provided that the file system
4542 supports locking, the data files will be correctly updated.  Also
4543 @code{fork} calls are detected and correctly handled (double counting
4544 will not happen).
4546 @item
4547 For profile-directed optimizations, compile the source files again with
4548 the same optimization and code generation options plus
4549 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
4550 Control Optimization}).
4552 @item
4553 For test coverage analysis, use @command{gcov} to produce human readable
4554 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
4555 @command{gcov} documentation for further information.
4557 @end itemize
4559 With @option{-fprofile-arcs}, for each function of your program GCC
4560 creates a program flow graph, then finds a spanning tree for the graph.
4561 Only arcs that are not on the spanning tree have to be instrumented: the
4562 compiler adds code to count the number of times that these arcs are
4563 executed.  When an arc is the only exit or only entrance to a block, the
4564 instrumentation code can be added to the block; otherwise, a new basic
4565 block must be created to hold the instrumentation code.
4567 @need 2000
4568 @item -ftest-coverage
4569 @opindex ftest-coverage
4570 Produce a notes file that the @command{gcov} code-coverage utility
4571 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
4572 show program coverage.  Each source file's note file is called
4573 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
4574 above for a description of @var{auxname} and instructions on how to
4575 generate test coverage data.  Coverage data will match the source files
4576 more closely, if you do not optimize.
4578 @item -fdbg-cnt-list
4579 @opindex fdbg-cnt-list
4580 Print the name and the counter upperbound for all debug counters.
4582 @item -fdbg-cnt=@var{counter-value-list}
4583 @opindex fdbg-cnt
4584 Set the internal debug counter upperbound. @var{counter-value-list} 
4585 is a comma-separated list of @var{name}:@var{value} pairs
4586 which sets the upperbound of each debug counter @var{name} to @var{value}.
4587 All debug counters have the initial upperbound of @var{UINT_MAX},
4588 thus dbg_cnt() returns true always unless the upperbound is set by this option.
4589 e.g. With -fdbg-cnt=dce:10,tail_call:0
4590 dbg_cnt(dce) will return true only for first 10 invocations
4591 and dbg_cnt(tail_call) will return false always.
4593 @item -d@var{letters}
4594 @itemx -fdump-rtl-@var{pass}
4595 @opindex d
4596 Says to make debugging dumps during compilation at times specified by
4597 @var{letters}.  This is used for debugging the RTL-based passes of the
4598 compiler.  The file names for most of the dumps are made by appending
4599 a pass number and a word to the @var{dumpname}, and the files are
4600 created in the directory of the output file.  @var{dumpname} is
4601 generated from the name of the output file, if explicitly specified
4602 and it is not an executable, otherwise it is the basename of the
4603 source file. These switches may have different effects when
4604 @option{-E} is used for preprocessing.
4606 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
4607 @option{-d} option @var{letters}.  Here are the possible
4608 letters for use in @var{pass} and @var{letters}, and their meanings:
4610 @table @gcctabopt
4612 @item -fdump-rtl-alignments
4613 @opindex fdump-rtl-alignments
4614 Dump after branch alignments have been computed.
4616 @item -fdump-rtl-asmcons
4617 @opindex fdump-rtl-asmcons
4618 Dump after fixing rtl statements that have unsatisfied in/out constraints.
4620 @item -fdump-rtl-auto_inc_dec
4621 @opindex fdump-rtl-auto_inc_dec
4622 Dump after auto-inc-dec discovery.  This pass is only run on
4623 architectures that have auto inc or auto dec instructions.
4625 @item -fdump-rtl-barriers
4626 @opindex fdump-rtl-barriers
4627 Dump after cleaning up the barrier instructions.
4629 @item -fdump-rtl-bbpart
4630 @opindex fdump-rtl-bbpart
4631 Dump after partitioning hot and cold basic blocks.
4633 @item -fdump-rtl-bbro
4634 @opindex fdump-rtl-bbro
4635 Dump after block reordering.
4637 @item -fdump-rtl-btl1
4638 @itemx -fdump-rtl-btl2
4639 @opindex fdump-rtl-btl2
4640 @opindex fdump-rtl-btl2
4641 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
4642 after the two branch
4643 target load optimization passes.
4645 @item -fdump-rtl-bypass
4646 @opindex fdump-rtl-bypass
4647 Dump after jump bypassing and control flow optimizations.
4649 @item -fdump-rtl-combine
4650 @opindex fdump-rtl-combine
4651 Dump after the RTL instruction combination pass.
4653 @item -fdump-rtl-compgotos
4654 @opindex fdump-rtl-compgotos
4655 Dump after duplicating the computed gotos.
4657 @item -fdump-rtl-ce1
4658 @itemx -fdump-rtl-ce2
4659 @itemx -fdump-rtl-ce3
4660 @opindex fdump-rtl-ce1
4661 @opindex fdump-rtl-ce2
4662 @opindex fdump-rtl-ce3
4663 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
4664 @option{-fdump-rtl-ce3} enable dumping after the three
4665 if conversion passes. 
4667 @itemx -fdump-rtl-cprop_hardreg
4668 @opindex fdump-rtl-cprop_hardreg
4669 Dump after hard register copy propagation.
4671 @itemx -fdump-rtl-csa
4672 @opindex fdump-rtl-csa
4673 Dump after combining stack adjustments.
4675 @item -fdump-rtl-cse1
4676 @itemx -fdump-rtl-cse2
4677 @opindex fdump-rtl-cse1
4678 @opindex fdump-rtl-cse2
4679 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
4680 the two common sub-expression elimination passes.
4682 @itemx -fdump-rtl-dce
4683 @opindex fdump-rtl-dce
4684 Dump after the standalone dead code elimination passes.
4686 @itemx -fdump-rtl-dbr
4687 @opindex fdump-rtl-dbr
4688 Dump after delayed branch scheduling.
4690 @item -fdump-rtl-dce1
4691 @itemx -fdump-rtl-dce2
4692 @opindex fdump-rtl-dce1
4693 @opindex fdump-rtl-dce2
4694 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
4695 the two dead store elimination passes.
4697 @item -fdump-rtl-eh
4698 @opindex fdump-rtl-eh
4699 Dump after finalization of EH handling code.
4701 @item -fdump-rtl-eh_ranges
4702 @opindex fdump-rtl-eh_ranges
4703 Dump after conversion of EH handling range regions.
4705 @item -fdump-rtl-expand
4706 @opindex fdump-rtl-expand
4707 Dump after RTL generation.
4709 @item -fdump-rtl-fwprop1
4710 @itemx -fdump-rtl-fwprop2
4711 @opindex fdump-rtl-fwprop1
4712 @opindex fdump-rtl-fwprop2
4713 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
4714 dumping after the two forward propagation passes.
4716 @item -fdump-rtl-gcse1
4717 @itemx -fdump-rtl-gcse2
4718 @opindex fdump-rtl-gcse1
4719 @opindex fdump-rtl-gcse2
4720 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
4721 after global common subexpression elimination.
4723 @item -fdump-rtl-init-regs
4724 @opindex fdump-rtl-init-regs
4725 Dump after the initialization of the registers.
4727 @item -fdump-rtl-initvals
4728 @opindex fdump-rtl-initvals
4729 Dump after the computation of the initial value sets.
4731 @itemx -fdump-rtl-into_cfglayout
4732 @opindex fdump-rtl-into_cfglayout
4733 Dump after converting to cfglayout mode.
4735 @item -fdump-rtl-ira
4736 @opindex fdump-rtl-ira
4737 Dump after iterated register allocation.
4739 @item -fdump-rtl-jump
4740 @opindex fdump-rtl-jump
4741 Dump after the second jump optimization.
4743 @item -fdump-rtl-loop2
4744 @opindex fdump-rtl-loop2
4745 @option{-fdump-rtl-loop2} enables dumping after the rtl
4746 loop optimization passes.
4748 @item -fdump-rtl-mach
4749 @opindex fdump-rtl-mach
4750 Dump after performing the machine dependent reorganization pass, if that
4751 pass exists.
4753 @item -fdump-rtl-mode_sw
4754 @opindex fdump-rtl-mode_sw
4755 Dump after removing redundant mode switches.
4757 @item -fdump-rtl-rnreg
4758 @opindex fdump-rtl-rnreg
4759 Dump after register renumbering.
4761 @itemx -fdump-rtl-outof_cfglayout
4762 @opindex fdump-rtl-outof_cfglayout
4763 Dump after converting from cfglayout mode.
4765 @item -fdump-rtl-peephole2
4766 @opindex fdump-rtl-peephole2
4767 Dump after the peephole pass.
4769 @item -fdump-rtl-postreload
4770 @opindex fdump-rtl-postreload
4771 Dump after post-reload optimizations.
4773 @itemx -fdump-rtl-pro_and_epilogue
4774 @opindex fdump-rtl-pro_and_epilogue
4775 Dump after generating the function pro and epilogues.
4777 @item -fdump-rtl-regmove
4778 @opindex fdump-rtl-regmove
4779 Dump after the register move pass.
4781 @item -fdump-rtl-sched1
4782 @itemx -fdump-rtl-sched2
4783 @opindex fdump-rtl-sched1
4784 @opindex fdump-rtl-sched2
4785 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
4786 after the basic block scheduling passes.
4788 @item -fdump-rtl-see
4789 @opindex fdump-rtl-see
4790 Dump after sign extension elimination.
4792 @item -fdump-rtl-seqabstr
4793 @opindex fdump-rtl-seqabstr
4794 Dump after common sequence discovery. 
4796 @item -fdump-rtl-shorten
4797 @opindex fdump-rtl-shorten
4798 Dump after shortening branches.
4800 @item -fdump-rtl-sibling
4801 @opindex fdump-rtl-sibling
4802 Dump after sibling call optimizations.
4804 @item -fdump-rtl-split1
4805 @itemx -fdump-rtl-split2
4806 @itemx -fdump-rtl-split3
4807 @itemx -fdump-rtl-split4
4808 @itemx -fdump-rtl-split5
4809 @opindex fdump-rtl-split1
4810 @opindex fdump-rtl-split2
4811 @opindex fdump-rtl-split3
4812 @opindex fdump-rtl-split4
4813 @opindex fdump-rtl-split5
4814 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
4815 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
4816 @option{-fdump-rtl-split5} enable dumping after five rounds of
4817 instruction splitting.
4819 @item -fdump-rtl-sms
4820 @opindex fdump-rtl-sms
4821 Dump after modulo scheduling.  This pass is only run on some
4822 architectures.
4824 @item -fdump-rtl-stack
4825 @opindex fdump-rtl-stack
4826 Dump after conversion from GCC's "flat register file" registers to the
4827 x87's stack-like registers.  This pass is only run on x86 variants.
4829 @item -fdump-rtl-subreg1
4830 @itemx -fdump-rtl-subreg2
4831 @opindex fdump-rtl-subreg1
4832 @opindex fdump-rtl-subreg2
4833 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
4834 the two subreg expansion passes.
4836 @item -fdump-rtl-unshare
4837 @opindex fdump-rtl-unshare
4838 Dump after all rtl has been unshared.
4840 @item -fdump-rtl-vartrack
4841 @opindex fdump-rtl-vartrack
4842 Dump after variable tracking.
4844 @item -fdump-rtl-vregs
4845 @opindex fdump-rtl-vregs
4846 Dump after converting virtual registers to hard registers.
4848 @item -fdump-rtl-web
4849 @opindex fdump-rtl-web
4850 Dump after live range splitting.
4852 @item -fdump-rtl-regclass
4853 @itemx -fdump-rtl-subregs_of_mode_init
4854 @itemx -fdump-rtl-subregs_of_mode_finish
4855 @itemx -fdump-rtl-dfinit
4856 @itemx -fdump-rtl-dfinish
4857 @opindex fdump-rtl-regclass
4858 @opindex fdump-rtl-subregs_of_mode_init
4859 @opindex fdump-rtl-subregs_of_mode_finish
4860 @opindex fdump-rtl-dfinit
4861 @opindex fdump-rtl-dfinish
4862 These dumps are defined but always produce empty files.
4864 @item -fdump-rtl-all
4865 @opindex fdump-rtl-all
4866 Produce all the dumps listed above.
4868 @item -dA
4869 @opindex dA
4870 Annotate the assembler output with miscellaneous debugging information.
4872 @item -dD
4873 @opindex dD
4874 Dump all macro definitions, at the end of preprocessing, in addition to
4875 normal output.
4877 @item -dH
4878 @opindex dH
4879 Produce a core dump whenever an error occurs.
4881 @item -dm
4882 @opindex dm
4883 Print statistics on memory usage, at the end of the run, to
4884 standard error.
4886 @item -dp
4887 @opindex dp
4888 Annotate the assembler output with a comment indicating which
4889 pattern and alternative was used.  The length of each instruction is
4890 also printed.
4892 @item -dP
4893 @opindex dP
4894 Dump the RTL in the assembler output as a comment before each instruction.
4895 Also turns on @option{-dp} annotation.
4897 @item -dv
4898 @opindex dv
4899 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
4900 dump a representation of the control flow graph suitable for viewing with VCG
4901 to @file{@var{file}.@var{pass}.vcg}.
4903 @item -dx
4904 @opindex dx
4905 Just generate RTL for a function instead of compiling it.  Usually used
4906 with @option{-fdump-rtl-expand}.
4908 @item -dy
4909 @opindex dy
4910 Dump debugging information during parsing, to standard error.
4911 @end table
4913 @item -fdump-noaddr
4914 @opindex fdump-noaddr
4915 When doing debugging dumps, suppress address output.  This makes it more
4916 feasible to use diff on debugging dumps for compiler invocations with
4917 different compiler binaries and/or different
4918 text / bss / data / heap / stack / dso start locations.
4920 @item -fdump-unnumbered
4921 @opindex fdump-unnumbered
4922 When doing debugging dumps, suppress instruction numbers and address output.
4923 This makes it more feasible to use diff on debugging dumps for compiler
4924 invocations with different options, in particular with and without
4925 @option{-g}.
4927 @item -fdump-translation-unit @r{(C++ only)}
4928 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
4929 @opindex fdump-translation-unit
4930 Dump a representation of the tree structure for the entire translation
4931 unit to a file.  The file name is made by appending @file{.tu} to the
4932 source file name, and the file is created in the same directory as the
4933 output file.  If the @samp{-@var{options}} form is used, @var{options}
4934 controls the details of the dump as described for the
4935 @option{-fdump-tree} options.
4937 @item -fdump-class-hierarchy @r{(C++ only)}
4938 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
4939 @opindex fdump-class-hierarchy
4940 Dump a representation of each class's hierarchy and virtual function
4941 table layout to a file.  The file name is made by appending
4942 @file{.class} to the source file name, and the file is created in the
4943 same directory as the output file.  If the @samp{-@var{options}} form
4944 is used, @var{options} controls the details of the dump as described
4945 for the @option{-fdump-tree} options.
4947 @item -fdump-ipa-@var{switch}
4948 @opindex fdump-ipa
4949 Control the dumping at various stages of inter-procedural analysis
4950 language tree to a file.  The file name is generated by appending a
4951 switch specific suffix to the source file name, and the file is created
4952 in the same directory as the output file.  The following dumps are
4953 possible:
4955 @table @samp
4956 @item all
4957 Enables all inter-procedural analysis dumps.
4959 @item cgraph
4960 Dumps information about call-graph optimization, unused function removal,
4961 and inlining decisions.
4963 @item inline
4964 Dump after function inlining.
4966 @end table
4968 @item -fdump-statistics-@var{option}
4969 @opindex -fdump-statistics
4970 Enable and control dumping of pass statistics in a separate file.  The
4971 file name is generated by appending a suffix ending in
4972 @samp{.statistics} to the source file name, and the file is created in
4973 the same directory as the output file.  If the @samp{-@var{option}}
4974 form is used, @samp{-stats} will cause counters to be summed over the
4975 whole compilation unit while @samp{-details} will dump every event as
4976 the passes generate them.  The default with no option is to sum
4977 counters for each function compiled.
4979 @item -fdump-tree-@var{switch}
4980 @itemx -fdump-tree-@var{switch}-@var{options}
4981 @opindex fdump-tree
4982 Control the dumping at various stages of processing the intermediate
4983 language tree to a file.  The file name is generated by appending a
4984 switch specific suffix to the source file name, and the file is
4985 created in the same directory as the output file.  If the
4986 @samp{-@var{options}} form is used, @var{options} is a list of
4987 @samp{-} separated options that control the details of the dump.  Not
4988 all options are applicable to all dumps, those which are not
4989 meaningful will be ignored.  The following options are available
4991 @table @samp
4992 @item address
4993 Print the address of each node.  Usually this is not meaningful as it
4994 changes according to the environment and source file.  Its primary use
4995 is for tying up a dump file with a debug environment.
4996 @item slim
4997 Inhibit dumping of members of a scope or body of a function merely
4998 because that scope has been reached.  Only dump such items when they
4999 are directly reachable by some other path.  When dumping pretty-printed
5000 trees, this option inhibits dumping the bodies of control structures.
5001 @item raw
5002 Print a raw representation of the tree.  By default, trees are
5003 pretty-printed into a C-like representation.
5004 @item details
5005 Enable more detailed dumps (not honored by every dump option).
5006 @item stats
5007 Enable dumping various statistics about the pass (not honored by every dump
5008 option).
5009 @item blocks
5010 Enable showing basic block boundaries (disabled in raw dumps).
5011 @item vops
5012 Enable showing virtual operands for every statement.
5013 @item lineno
5014 Enable showing line numbers for statements.
5015 @item uid
5016 Enable showing the unique ID (@code{DECL_UID}) for each variable.
5017 @item verbose
5018 Enable showing the tree dump for each statement.
5019 @item all
5020 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5021 and @option{lineno}.
5022 @end table
5024 The following tree dumps are possible:
5025 @table @samp
5027 @item original
5028 Dump before any tree based optimization, to @file{@var{file}.original}.
5030 @item optimized
5031 Dump after all tree based optimization, to @file{@var{file}.optimized}.
5033 @item gimple
5034 @opindex fdump-tree-gimple
5035 Dump each function before and after the gimplification pass to a file.  The
5036 file name is made by appending @file{.gimple} to the source file name.
5038 @item cfg
5039 @opindex fdump-tree-cfg
5040 Dump the control flow graph of each function to a file.  The file name is
5041 made by appending @file{.cfg} to the source file name.
5043 @item vcg
5044 @opindex fdump-tree-vcg
5045 Dump the control flow graph of each function to a file in VCG format.  The
5046 file name is made by appending @file{.vcg} to the source file name.  Note
5047 that if the file contains more than one function, the generated file cannot
5048 be used directly by VCG@.  You will need to cut and paste each function's
5049 graph into its own separate file first.
5051 @item ch
5052 @opindex fdump-tree-ch
5053 Dump each function after copying loop headers.  The file name is made by
5054 appending @file{.ch} to the source file name.
5056 @item ssa
5057 @opindex fdump-tree-ssa
5058 Dump SSA related information to a file.  The file name is made by appending
5059 @file{.ssa} to the source file name.
5061 @item alias
5062 @opindex fdump-tree-alias
5063 Dump aliasing information for each function.  The file name is made by
5064 appending @file{.alias} to the source file name.
5066 @item ccp
5067 @opindex fdump-tree-ccp
5068 Dump each function after CCP@.  The file name is made by appending
5069 @file{.ccp} to the source file name.
5071 @item storeccp
5072 @opindex fdump-tree-storeccp
5073 Dump each function after STORE-CCP@.  The file name is made by appending
5074 @file{.storeccp} to the source file name.
5076 @item pre
5077 @opindex fdump-tree-pre
5078 Dump trees after partial redundancy elimination.  The file name is made
5079 by appending @file{.pre} to the source file name.
5081 @item fre
5082 @opindex fdump-tree-fre
5083 Dump trees after full redundancy elimination.  The file name is made
5084 by appending @file{.fre} to the source file name.
5086 @item copyprop
5087 @opindex fdump-tree-copyprop
5088 Dump trees after copy propagation.  The file name is made
5089 by appending @file{.copyprop} to the source file name.
5091 @item store_copyprop
5092 @opindex fdump-tree-store_copyprop
5093 Dump trees after store copy-propagation.  The file name is made
5094 by appending @file{.store_copyprop} to the source file name.
5096 @item dce
5097 @opindex fdump-tree-dce
5098 Dump each function after dead code elimination.  The file name is made by
5099 appending @file{.dce} to the source file name.
5101 @item mudflap
5102 @opindex fdump-tree-mudflap
5103 Dump each function after adding mudflap instrumentation.  The file name is
5104 made by appending @file{.mudflap} to the source file name.
5106 @item sra
5107 @opindex fdump-tree-sra
5108 Dump each function after performing scalar replacement of aggregates.  The
5109 file name is made by appending @file{.sra} to the source file name.
5111 @item sink
5112 @opindex fdump-tree-sink
5113 Dump each function after performing code sinking.  The file name is made
5114 by appending @file{.sink} to the source file name.
5116 @item dom
5117 @opindex fdump-tree-dom
5118 Dump each function after applying dominator tree optimizations.  The file
5119 name is made by appending @file{.dom} to the source file name.
5121 @item dse
5122 @opindex fdump-tree-dse
5123 Dump each function after applying dead store elimination.  The file
5124 name is made by appending @file{.dse} to the source file name.
5126 @item phiopt
5127 @opindex fdump-tree-phiopt
5128 Dump each function after optimizing PHI nodes into straightline code.  The file
5129 name is made by appending @file{.phiopt} to the source file name.
5131 @item forwprop
5132 @opindex fdump-tree-forwprop
5133 Dump each function after forward propagating single use variables.  The file
5134 name is made by appending @file{.forwprop} to the source file name.
5136 @item copyrename
5137 @opindex fdump-tree-copyrename
5138 Dump each function after applying the copy rename optimization.  The file
5139 name is made by appending @file{.copyrename} to the source file name.
5141 @item nrv
5142 @opindex fdump-tree-nrv
5143 Dump each function after applying the named return value optimization on
5144 generic trees.  The file name is made by appending @file{.nrv} to the source
5145 file name.
5147 @item vect
5148 @opindex fdump-tree-vect
5149 Dump each function after applying vectorization of loops.  The file name is
5150 made by appending @file{.vect} to the source file name.
5152 @item vrp
5153 @opindex fdump-tree-vrp
5154 Dump each function after Value Range Propagation (VRP).  The file name
5155 is made by appending @file{.vrp} to the source file name.
5157 @item all
5158 @opindex fdump-tree-all
5159 Enable all the available tree dumps with the flags provided in this option.
5160 @end table
5162 @item -ftree-vectorizer-verbose=@var{n}
5163 @opindex ftree-vectorizer-verbose
5164 This option controls the amount of debugging output the vectorizer prints.
5165 This information is written to standard error, unless
5166 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
5167 in which case it is output to the usual dump listing file, @file{.vect}.
5168 For @var{n}=0 no diagnostic information is reported.
5169 If @var{n}=1 the vectorizer reports each loop that got vectorized,
5170 and the total number of loops that got vectorized.
5171 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
5172 the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
5173 inner-most, single-bb, single-entry/exit loops.  This is the same verbosity
5174 level that @option{-fdump-tree-vect-stats} uses.
5175 Higher verbosity levels mean either more information dumped for each
5176 reported loop, or same amount of information reported for more loops:
5177 If @var{n}=3, alignment related information is added to the reports.
5178 If @var{n}=4, data-references related information (e.g.@: memory dependences,
5179 memory access-patterns) is added to the reports.
5180 If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops
5181 that did not pass the first analysis phase (i.e., may not be countable, or
5182 may have complicated control-flow).
5183 If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
5184 For @var{n}=7, all the information the vectorizer generates during its
5185 analysis and transformation is reported.  This is the same verbosity level
5186 that @option{-fdump-tree-vect-details} uses.
5188 @item -frandom-seed=@var{string}
5189 @opindex frandom-string
5190 This option provides a seed that GCC uses when it would otherwise use
5191 random numbers.  It is used to generate certain symbol names
5192 that have to be different in every compiled file.  It is also used to
5193 place unique stamps in coverage data files and the object files that
5194 produce them.  You can use the @option{-frandom-seed} option to produce
5195 reproducibly identical object files.
5197 The @var{string} should be different for every file you compile.
5199 @item -fsched-verbose=@var{n}
5200 @opindex fsched-verbose
5201 On targets that use instruction scheduling, this option controls the
5202 amount of debugging output the scheduler prints.  This information is
5203 written to standard error, unless @option{-fdump-rtl-sched1} or
5204 @option{-fdump-rtl-sched2} is specified, in which case it is output
5205 to the usual dump listing file, @file{.sched} or @file{.sched2}
5206 respectively.  However for @var{n} greater than nine, the output is
5207 always printed to standard error.
5209 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
5210 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
5211 For @var{n} greater than one, it also output basic block probabilities,
5212 detailed ready list information and unit/insn info.  For @var{n} greater
5213 than two, it includes RTL at abort point, control-flow and regions info.
5214 And for @var{n} over four, @option{-fsched-verbose} also includes
5215 dependence info.
5217 @item -save-temps
5218 @itemx -save-temps=cwd
5219 @opindex save-temps
5220 Store the usual ``temporary'' intermediate files permanently; place them
5221 in the current directory and name them based on the source file.  Thus,
5222 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
5223 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
5224 preprocessed @file{foo.i} output file even though the compiler now
5225 normally uses an integrated preprocessor.
5227 When used in combination with the @option{-x} command line option,
5228 @option{-save-temps} is sensible enough to avoid over writing an
5229 input source file with the same extension as an intermediate file.
5230 The corresponding intermediate file may be obtained by renaming the
5231 source file before using @option{-save-temps}.
5233 If you invoke GCC in parallel, compiling several different source
5234 files that share a common base name in different subdirectories or the
5235 same source file compiled for multiple output destinations, it is
5236 likely that the different parallel compilers will interfere with each
5237 other, and overwrite the temporary files.  For instance:
5239 @smallexample
5240 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
5241 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
5242 @end smallexample
5244 may result in @file{foo.i} and @file{foo.o} being written to
5245 simultaneously by both compilers.
5247 @item -save-temps=obj
5248 @opindex save-temps=obj
5249 Store the usual ``temporary'' intermediate files permanently.  If the
5250 @option{-o} option is used, the temporary files are based on the
5251 object file.  If the @option{-o} option is not used, the
5252 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
5254 For example:
5256 @smallexample
5257 gcc -save-temps=obj -c foo.c
5258 gcc -save-temps=obj -c bar.c -o dir/xbar.o
5259 gcc -save-temps=obj foobar.c -o dir2/yfoobar
5260 @end smallexample
5262 would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
5263 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
5264 @file{dir2/yfoobar.o}.
5266 @item -time
5267 @opindex time
5268 Report the CPU time taken by each subprocess in the compilation
5269 sequence.  For C source files, this is the compiler proper and assembler
5270 (plus the linker if linking is done).  The output looks like this:
5272 @smallexample
5273 # cc1 0.12 0.01
5274 # as 0.00 0.01
5275 @end smallexample
5277 The first number on each line is the ``user time'', that is time spent
5278 executing the program itself.  The second number is ``system time'',
5279 time spent executing operating system routines on behalf of the program.
5280 Both numbers are in seconds.
5282 @item -fvar-tracking
5283 @opindex fvar-tracking
5284 Run variable tracking pass.  It computes where variables are stored at each
5285 position in code.  Better debugging information is then generated
5286 (if the debugging information format supports this information).
5288 It is enabled by default when compiling with optimization (@option{-Os},
5289 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5290 the debug info format supports it.
5292 @item -print-file-name=@var{library}
5293 @opindex print-file-name
5294 Print the full absolute name of the library file @var{library} that
5295 would be used when linking---and don't do anything else.  With this
5296 option, GCC does not compile or link anything; it just prints the
5297 file name.
5299 @item -print-multi-directory
5300 @opindex print-multi-directory
5301 Print the directory name corresponding to the multilib selected by any
5302 other switches present in the command line.  This directory is supposed
5303 to exist in @env{GCC_EXEC_PREFIX}.
5305 @item -print-multi-lib
5306 @opindex print-multi-lib
5307 Print the mapping from multilib directory names to compiler switches
5308 that enable them.  The directory name is separated from the switches by
5309 @samp{;}, and each switch starts with an @samp{@@} instead of the
5310 @samp{-}, without spaces between multiple switches.  This is supposed to
5311 ease shell-processing.
5313 @item -print-prog-name=@var{program}
5314 @opindex print-prog-name
5315 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
5317 @item -print-libgcc-file-name
5318 @opindex print-libgcc-file-name
5319 Same as @option{-print-file-name=libgcc.a}.
5321 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
5322 but you do want to link with @file{libgcc.a}.  You can do
5324 @smallexample
5325 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
5326 @end smallexample
5328 @item -print-search-dirs
5329 @opindex print-search-dirs
5330 Print the name of the configured installation directory and a list of
5331 program and library directories @command{gcc} will search---and don't do anything else.
5333 This is useful when @command{gcc} prints the error message
5334 @samp{installation problem, cannot exec cpp0: No such file or directory}.
5335 To resolve this you either need to put @file{cpp0} and the other compiler
5336 components where @command{gcc} expects to find them, or you can set the environment
5337 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
5338 Don't forget the trailing @samp{/}.
5339 @xref{Environment Variables}.
5341 @item -print-sysroot
5342 @opindex print-sysroot
5343 Print the target sysroot directory that will be used during
5344 compilation.  This is the target sysroot specified either at configure
5345 time or using the @option{--sysroot} option, possibly with an extra
5346 suffix that depends on compilation options.  If no target sysroot is
5347 specified, the option prints nothing.
5349 @item -print-sysroot-headers-suffix
5350 @opindex print-sysroot-headers-suffix
5351 Print the suffix added to the target sysroot when searching for
5352 headers, or give an error if the compiler is not configured with such
5353 a suffix---and don't do anything else.
5355 @item -dumpmachine
5356 @opindex dumpmachine
5357 Print the compiler's target machine (for example,
5358 @samp{i686-pc-linux-gnu})---and don't do anything else.
5360 @item -dumpversion
5361 @opindex dumpversion
5362 Print the compiler version (for example, @samp{3.0})---and don't do
5363 anything else.
5365 @item -dumpspecs
5366 @opindex dumpspecs
5367 Print the compiler's built-in specs---and don't do anything else.  (This
5368 is used when GCC itself is being built.)  @xref{Spec Files}.
5370 @item -feliminate-unused-debug-types
5371 @opindex feliminate-unused-debug-types
5372 Normally, when producing DWARF2 output, GCC will emit debugging
5373 information for all types declared in a compilation
5374 unit, regardless of whether or not they are actually used
5375 in that compilation unit.  Sometimes this is useful, such as
5376 if, in the debugger, you want to cast a value to a type that is
5377 not actually used in your program (but is declared).  More often,
5378 however, this results in a significant amount of wasted space.
5379 With this option, GCC will avoid producing debug symbol output
5380 for types that are nowhere used in the source file being compiled.
5381 @end table
5383 @node Optimize Options
5384 @section Options That Control Optimization
5385 @cindex optimize options
5386 @cindex options, optimization
5388 These options control various sorts of optimizations.
5390 Without any optimization option, the compiler's goal is to reduce the
5391 cost of compilation and to make debugging produce the expected
5392 results.  Statements are independent: if you stop the program with a
5393 breakpoint between statements, you can then assign a new value to any
5394 variable or change the program counter to any other statement in the
5395 function and get exactly the results you would expect from the source
5396 code.
5398 Turning on optimization flags makes the compiler attempt to improve
5399 the performance and/or code size at the expense of compilation time
5400 and possibly the ability to debug the program.
5402 The compiler performs optimization based on the knowledge it has of the
5403 program.  Compiling multiple files at once to a single output file mode allows
5404 the compiler to use information gained from all of the files when compiling
5405 each of them.
5407 Not all optimizations are controlled directly by a flag.  Only
5408 optimizations that have a flag are listed in this section.
5410 Depending on the target and how GCC was configured, a slightly different 
5411 set of optimizations may be enabled at each @option{-O} level than 
5412 those listed here.  You can invoke GCC with @samp{-Q --help=optimizers} 
5413 to find out the exact set of optimizations that are enabled at each level.
5414 @xref{Overall Options}, for examples.
5416 @table @gcctabopt
5417 @item -O
5418 @itemx -O1
5419 @opindex O
5420 @opindex O1
5421 Optimize.  Optimizing compilation takes somewhat more time, and a lot
5422 more memory for a large function.
5424 With @option{-O}, the compiler tries to reduce code size and execution
5425 time, without performing any optimizations that take a great deal of
5426 compilation time.
5428 @option{-O} turns on the following optimization flags:
5429 @gccoptlist{
5430 -fauto-inc-dec @gol
5431 -fcprop-registers @gol
5432 -fdce @gol
5433 -fdefer-pop @gol
5434 -fdelayed-branch @gol
5435 -fdse @gol
5436 -fguess-branch-probability @gol
5437 -fif-conversion2 @gol
5438 -fif-conversion @gol
5439 -finline-small-functions @gol
5440 -fipa-pure-const @gol
5441 -fipa-reference @gol
5442 -fmerge-constants
5443 -fsplit-wide-types @gol
5444 -ftree-builtin-call-dce @gol
5445 -ftree-ccp @gol
5446 -ftree-ch @gol
5447 -ftree-copyrename @gol
5448 -ftree-dce @gol
5449 -ftree-dominator-opts @gol
5450 -ftree-dse @gol
5451 -ftree-fre @gol
5452 -ftree-sra @gol
5453 -ftree-ter @gol
5454 -funit-at-a-time}
5456 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
5457 where doing so does not interfere with debugging.
5459 @item -O2
5460 @opindex O2
5461 Optimize even more.  GCC performs nearly all supported optimizations
5462 that do not involve a space-speed tradeoff.
5463 As compared to @option{-O}, this option increases both compilation time
5464 and the performance of the generated code.
5466 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
5467 also turns on the following optimization flags:
5468 @gccoptlist{-fthread-jumps @gol
5469 -falign-functions  -falign-jumps @gol
5470 -falign-loops  -falign-labels @gol
5471 -fcaller-saves @gol
5472 -fcrossjumping @gol
5473 -fcse-follow-jumps  -fcse-skip-blocks @gol
5474 -fdelete-null-pointer-checks @gol
5475 -fexpensive-optimizations @gol
5476 -fgcse  -fgcse-lm  @gol
5477 -findirect-inlining @gol
5478 -foptimize-sibling-calls @gol
5479 -fpeephole2 @gol
5480 -fregmove @gol
5481 -freorder-blocks  -freorder-functions @gol
5482 -frerun-cse-after-loop  @gol
5483 -fsched-interblock  -fsched-spec @gol
5484 -fschedule-insns  -fschedule-insns2 @gol
5485 -fstrict-aliasing -fstrict-overflow @gol
5486 -ftree-switch-conversion @gol
5487 -ftree-pre @gol
5488 -ftree-vrp}
5490 Please note the warning under @option{-fgcse} about
5491 invoking @option{-O2} on programs that use computed gotos.
5493 @item -O3
5494 @opindex O3
5495 Optimize yet more.  @option{-O3} turns on all optimizations specified
5496 by @option{-O2} and also turns on the @option{-finline-functions},
5497 @option{-funswitch-loops}, @option{-fpredictive-commoning},
5498 @option{-fgcse-after-reload} and @option{-ftree-vectorize} options.
5500 @item -O0
5501 @opindex O0
5502 Reduce compilation time and make debugging produce the expected
5503 results.  This is the default.
5505 @item -Os
5506 @opindex Os
5507 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
5508 do not typically increase code size.  It also performs further
5509 optimizations designed to reduce code size.
5511 @option{-Os} disables the following optimization flags:
5512 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
5513 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
5514 -fprefetch-loop-arrays  -ftree-vect-loop-version}
5516 If you use multiple @option{-O} options, with or without level numbers,
5517 the last such option is the one that is effective.
5518 @end table
5520 Options of the form @option{-f@var{flag}} specify machine-independent
5521 flags.  Most flags have both positive and negative forms; the negative
5522 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
5523 below, only one of the forms is listed---the one you typically will
5524 use.  You can figure out the other form by either removing @samp{no-}
5525 or adding it.
5527 The following options control specific optimizations.  They are either
5528 activated by @option{-O} options or are related to ones that are.  You
5529 can use the following flags in the rare cases when ``fine-tuning'' of
5530 optimizations to be performed is desired.
5532 @table @gcctabopt
5533 @item -fno-default-inline
5534 @opindex fno-default-inline
5535 Do not make member functions inline by default merely because they are
5536 defined inside the class scope (C++ only).  Otherwise, when you specify
5537 @w{@option{-O}}, member functions defined inside class scope are compiled
5538 inline by default; i.e., you don't need to add @samp{inline} in front of
5539 the member function name.
5541 @item -fno-defer-pop
5542 @opindex fno-defer-pop
5543 Always pop the arguments to each function call as soon as that function
5544 returns.  For machines which must pop arguments after a function call,
5545 the compiler normally lets arguments accumulate on the stack for several
5546 function calls and pops them all at once.
5548 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5550 @item -fforward-propagate
5551 @opindex fforward-propagate
5552 Perform a forward propagation pass on RTL@.  The pass tries to combine two
5553 instructions and checks if the result can be simplified.  If loop unrolling
5554 is active, two passes are performed and the second is scheduled after
5555 loop unrolling.
5557 This option is enabled by default at optimization levels @option{-O2},
5558 @option{-O3}, @option{-Os}.
5560 @item -fomit-frame-pointer
5561 @opindex fomit-frame-pointer
5562 Don't keep the frame pointer in a register for functions that
5563 don't need one.  This avoids the instructions to save, set up and
5564 restore frame pointers; it also makes an extra register available
5565 in many functions.  @strong{It also makes debugging impossible on
5566 some machines.}
5568 On some machines, such as the VAX, this flag has no effect, because
5569 the standard calling sequence automatically handles the frame pointer
5570 and nothing is saved by pretending it doesn't exist.  The
5571 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
5572 whether a target machine supports this flag.  @xref{Registers,,Register
5573 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
5575 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5577 @item -foptimize-sibling-calls
5578 @opindex foptimize-sibling-calls
5579 Optimize sibling and tail recursive calls.
5581 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5583 @item -fno-inline
5584 @opindex fno-inline
5585 Don't pay attention to the @code{inline} keyword.  Normally this option
5586 is used to keep the compiler from expanding any functions inline.
5587 Note that if you are not optimizing, no functions can be expanded inline.
5589 @item -finline-small-functions
5590 @opindex finline-small-functions
5591 Integrate functions into their callers when their body is smaller than expected
5592 function call code (so overall size of program gets smaller).  The compiler
5593 heuristically decides which functions are simple enough to be worth integrating
5594 in this way.
5596 Enabled at level @option{-O2}.
5598 @item -findirect-inlining
5599 @opindex findirect-inlining
5600 Inline also indirect calls that are discovered to be known at compile
5601 time thanks to previous inlining.  This option has any effect only
5602 when inlining itself is turned on by the @option{-finline-functions}
5603 or @option{-finline-small-functions} options.
5605 Enabled at level @option{-O2}.
5607 @item -finline-functions
5608 @opindex finline-functions
5609 Integrate all simple functions into their callers.  The compiler
5610 heuristically decides which functions are simple enough to be worth
5611 integrating in this way.
5613 If all calls to a given function are integrated, and the function is
5614 declared @code{static}, then the function is normally not output as
5615 assembler code in its own right.
5617 Enabled at level @option{-O3}.
5619 @item -finline-functions-called-once
5620 @opindex finline-functions-called-once
5621 Consider all @code{static} functions called once for inlining into their
5622 caller even if they are not marked @code{inline}.  If a call to a given
5623 function is integrated, then the function is not output as assembler code
5624 in its own right.
5626 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
5628 @item -fearly-inlining
5629 @opindex fearly-inlining
5630 Inline functions marked by @code{always_inline} and functions whose body seems
5631 smaller than the function call overhead early before doing
5632 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
5633 makes profiling significantly cheaper and usually inlining faster on programs
5634 having large chains of nested wrapper functions.
5636 Enabled by default.
5638 @item -finline-limit=@var{n}
5639 @opindex finline-limit
5640 By default, GCC limits the size of functions that can be inlined.  This flag
5641 allows coarse control of this limit.  @var{n} is the size of functions that
5642 can be inlined in number of pseudo instructions.
5644 Inlining is actually controlled by a number of parameters, which may be
5645 specified individually by using @option{--param @var{name}=@var{value}}.
5646 The @option{-finline-limit=@var{n}} option sets some of these parameters
5647 as follows:
5649 @table @gcctabopt
5650 @item max-inline-insns-single
5651 is set to @var{n}/2.
5652 @item max-inline-insns-auto
5653 is set to @var{n}/2.
5654 @end table
5656 See below for a documentation of the individual
5657 parameters controlling inlining and for the defaults of these parameters.
5659 @emph{Note:} there may be no value to @option{-finline-limit} that results
5660 in default behavior.
5662 @emph{Note:} pseudo instruction represents, in this particular context, an
5663 abstract measurement of function's size.  In no way does it represent a count
5664 of assembly instructions and as such its exact meaning might change from one
5665 release to an another.
5667 @item -fkeep-inline-functions
5668 @opindex fkeep-inline-functions
5669 In C, emit @code{static} functions that are declared @code{inline}
5670 into the object file, even if the function has been inlined into all
5671 of its callers.  This switch does not affect functions using the
5672 @code{extern inline} extension in GNU C89@.  In C++, emit any and all
5673 inline functions into the object file.
5675 @item -fkeep-static-consts
5676 @opindex fkeep-static-consts
5677 Emit variables declared @code{static const} when optimization isn't turned
5678 on, even if the variables aren't referenced.
5680 GCC enables this option by default.  If you want to force the compiler to
5681 check if the variable was referenced, regardless of whether or not
5682 optimization is turned on, use the @option{-fno-keep-static-consts} option.
5684 @item -fmerge-constants
5685 @opindex fmerge-constants
5686 Attempt to merge identical constants (string constants and floating point
5687 constants) across compilation units.
5689 This option is the default for optimized compilation if the assembler and
5690 linker support it.  Use @option{-fno-merge-constants} to inhibit this
5691 behavior.
5693 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5695 @item -fmerge-all-constants
5696 @opindex fmerge-all-constants
5697 Attempt to merge identical constants and identical variables.
5699 This option implies @option{-fmerge-constants}.  In addition to
5700 @option{-fmerge-constants} this considers e.g.@: even constant initialized
5701 arrays or initialized constant variables with integral or floating point
5702 types.  Languages like C or C++ require each variable, including multiple
5703 instances of the same variable in recursive calls, to have distinct locations,
5704 so using this option will result in non-conforming
5705 behavior.
5707 @item -fmodulo-sched
5708 @opindex fmodulo-sched
5709 Perform swing modulo scheduling immediately before the first scheduling
5710 pass.  This pass looks at innermost loops and reorders their
5711 instructions by overlapping different iterations.
5713 @item -fmodulo-sched-allow-regmoves
5714 @opindex fmodulo-sched-allow-regmoves
5715 Perform more aggressive SMS based modulo scheduling with register moves
5716 allowed.  By setting this flag certain anti-dependences edges will be
5717 deleted which will trigger the generation of reg-moves based on the
5718 life-range analysis.  This option is effective only with
5719 @option{-fmodulo-sched} enabled.
5721 @item -fno-branch-count-reg
5722 @opindex fno-branch-count-reg
5723 Do not use ``decrement and branch'' instructions on a count register,
5724 but instead generate a sequence of instructions that decrement a
5725 register, compare it against zero, then branch based upon the result.
5726 This option is only meaningful on architectures that support such
5727 instructions, which include x86, PowerPC, IA-64 and S/390.
5729 The default is @option{-fbranch-count-reg}.
5731 @item -fno-function-cse
5732 @opindex fno-function-cse
5733 Do not put function addresses in registers; make each instruction that
5734 calls a constant function contain the function's address explicitly.
5736 This option results in less efficient code, but some strange hacks
5737 that alter the assembler output may be confused by the optimizations
5738 performed when this option is not used.
5740 The default is @option{-ffunction-cse}
5742 @item -fno-zero-initialized-in-bss
5743 @opindex fno-zero-initialized-in-bss
5744 If the target supports a BSS section, GCC by default puts variables that
5745 are initialized to zero into BSS@.  This can save space in the resulting
5746 code.
5748 This option turns off this behavior because some programs explicitly
5749 rely on variables going to the data section.  E.g., so that the
5750 resulting executable can find the beginning of that section and/or make
5751 assumptions based on that.
5753 The default is @option{-fzero-initialized-in-bss}.
5755 @item -fmudflap -fmudflapth -fmudflapir
5756 @opindex fmudflap
5757 @opindex fmudflapth
5758 @opindex fmudflapir
5759 @cindex bounds checking
5760 @cindex mudflap
5761 For front-ends that support it (C and C++), instrument all risky
5762 pointer/array dereferencing operations, some standard library
5763 string/heap functions, and some other associated constructs with
5764 range/validity tests.  Modules so instrumented should be immune to
5765 buffer overflows, invalid heap use, and some other classes of C/C++
5766 programming errors.  The instrumentation relies on a separate runtime
5767 library (@file{libmudflap}), which will be linked into a program if
5768 @option{-fmudflap} is given at link time.  Run-time behavior of the
5769 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
5770 environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
5771 for its options.
5773 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
5774 link if your program is multi-threaded.  Use @option{-fmudflapir}, in
5775 addition to @option{-fmudflap} or @option{-fmudflapth}, if
5776 instrumentation should ignore pointer reads.  This produces less
5777 instrumentation (and therefore faster execution) and still provides
5778 some protection against outright memory corrupting writes, but allows
5779 erroneously read data to propagate within a program.
5781 @item -fthread-jumps
5782 @opindex fthread-jumps
5783 Perform optimizations where we check to see if a jump branches to a
5784 location where another comparison subsumed by the first is found.  If
5785 so, the first branch is redirected to either the destination of the
5786 second branch or a point immediately following it, depending on whether
5787 the condition is known to be true or false.
5789 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5791 @item -fsplit-wide-types
5792 @opindex fsplit-wide-types
5793 When using a type that occupies multiple registers, such as @code{long
5794 long} on a 32-bit system, split the registers apart and allocate them
5795 independently.  This normally generates better code for those types,
5796 but may make debugging more difficult.
5798 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
5799 @option{-Os}.
5801 @item -fcse-follow-jumps
5802 @opindex fcse-follow-jumps
5803 In common subexpression elimination (CSE), scan through jump instructions
5804 when the target of the jump is not reached by any other path.  For
5805 example, when CSE encounters an @code{if} statement with an
5806 @code{else} clause, CSE will follow the jump when the condition
5807 tested is false.
5809 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5811 @item -fcse-skip-blocks
5812 @opindex fcse-skip-blocks
5813 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
5814 follow jumps which conditionally skip over blocks.  When CSE
5815 encounters a simple @code{if} statement with no else clause,
5816 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
5817 body of the @code{if}.
5819 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5821 @item -frerun-cse-after-loop
5822 @opindex frerun-cse-after-loop
5823 Re-run common subexpression elimination after loop optimizations has been
5824 performed.
5826 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5828 @item -fgcse
5829 @opindex fgcse
5830 Perform a global common subexpression elimination pass.
5831 This pass also performs global constant and copy propagation.
5833 @emph{Note:} When compiling a program using computed gotos, a GCC
5834 extension, you may get better runtime performance if you disable
5835 the global common subexpression elimination pass by adding
5836 @option{-fno-gcse} to the command line.
5838 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5840 @item -fgcse-lm
5841 @opindex fgcse-lm
5842 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
5843 attempt to move loads which are only killed by stores into themselves.  This
5844 allows a loop containing a load/store sequence to be changed to a load outside
5845 the loop, and a copy/store within the loop.
5847 Enabled by default when gcse is enabled.
5849 @item -fgcse-sm
5850 @opindex fgcse-sm
5851 When @option{-fgcse-sm} is enabled, a store motion pass is run after
5852 global common subexpression elimination.  This pass will attempt to move
5853 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
5854 loops containing a load/store sequence can be changed to a load before
5855 the loop and a store after the loop.
5857 Not enabled at any optimization level.
5859 @item -fgcse-las
5860 @opindex fgcse-las
5861 When @option{-fgcse-las} is enabled, the global common subexpression
5862 elimination pass eliminates redundant loads that come after stores to the
5863 same memory location (both partial and full redundancies).
5865 Not enabled at any optimization level.
5867 @item -fgcse-after-reload
5868 @opindex fgcse-after-reload
5869 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
5870 pass is performed after reload.  The purpose of this pass is to cleanup
5871 redundant spilling.
5873 @item -funsafe-loop-optimizations
5874 @opindex funsafe-loop-optimizations
5875 If given, the loop optimizer will assume that loop indices do not
5876 overflow, and that the loops with nontrivial exit condition are not
5877 infinite.  This enables a wider range of loop optimizations even if
5878 the loop optimizer itself cannot prove that these assumptions are valid.
5879 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
5880 if it finds this kind of loop.
5882 @item -fcrossjumping
5883 @opindex fcrossjumping
5884 Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
5885 resulting code may or may not perform better than without cross-jumping.
5887 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5889 @item -fauto-inc-dec
5890 @opindex fauto-inc-dec
5891 Combine increments or decrements of addresses with memory accesses.
5892 This pass is always skipped on architectures that do not have
5893 instructions to support this.  Enabled by default at @option{-O} and
5894 higher on architectures that support this.
5896 @item -fdce
5897 @opindex fdce
5898 Perform dead code elimination (DCE) on RTL@.
5899 Enabled by default at @option{-O} and higher.
5901 @item -fdse
5902 @opindex fdse
5903 Perform dead store elimination (DSE) on RTL@.
5904 Enabled by default at @option{-O} and higher.
5906 @item -fif-conversion
5907 @opindex fif-conversion
5908 Attempt to transform conditional jumps into branch-less equivalents.  This
5909 include use of conditional moves, min, max, set flags and abs instructions, and
5910 some tricks doable by standard arithmetics.  The use of conditional execution
5911 on chips where it is available is controlled by @code{if-conversion2}.
5913 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5915 @item -fif-conversion2
5916 @opindex fif-conversion2
5917 Use conditional execution (where available) to transform conditional jumps into
5918 branch-less equivalents.
5920 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5922 @item -fdelete-null-pointer-checks
5923 @opindex fdelete-null-pointer-checks
5924 Assume that programs cannot safely dereference null pointers, and that
5925 no code or data element resides there.  This enables simple constant
5926 folding optimizations at all optimization levels.  In addition, other
5927 optimization passes in GCC use this flag to control global dataflow
5928 analyses that eliminate useless checks for null pointers; these assume
5929 that if a pointer is checked after it has already been dereferenced,
5930 it cannot be null.
5932 Note however that in some environments this assumption is not true.
5933 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
5934 for programs which depend on that behavior.
5936 Some targets, especially embedded ones, disable this option at all levels.
5937 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
5938 @option{-O2}, @option{-O3}, @option{-Os}.  Passes that use the information
5939 are enabled independently at different optimization levels.
5941 @item -fexpensive-optimizations
5942 @opindex fexpensive-optimizations
5943 Perform a number of minor optimizations that are relatively expensive.
5945 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5947 @item -foptimize-register-move
5948 @itemx -fregmove
5949 @opindex foptimize-register-move
5950 @opindex fregmove
5951 Attempt to reassign register numbers in move instructions and as
5952 operands of other simple instructions in order to maximize the amount of
5953 register tying.  This is especially helpful on machines with two-operand
5954 instructions.
5956 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
5957 optimization.
5959 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5961 @item -fira-algorithm=@var{algorithm}
5962 Use specified coloring algorithm for the integrated register
5963 allocator.  The @var{algorithm} argument should be @code{priority} or
5964 @code{CB}.  The first algorithm specifies Chow's priority coloring,
5965 the second one specifies Chaitin-Briggs coloring.  The second
5966 algorithm can be unimplemented for some architectures.  If it is
5967 implemented, it is the default because Chaitin-Briggs coloring as a
5968 rule generates a better code.
5970 @item -fira-region=@var{region}
5971 Use specified regions for the integrated register allocator.  The
5972 @var{region} argument should be one of @code{all}, @code{mixed}, or
5973 @code{one}.  The first value means using all loops as register
5974 allocation regions, the second value which is the default means using
5975 all loops except for loops with small register pressure as the
5976 regions, and third one means using all function as a single region.
5977 The first value can give best result for machines with small size and
5978 irregular register set, the third one results in faster and generates
5979 decent code and the smallest size code, and the default value usually
5980 give the best results in most cases and for most architectures.
5982 @item -fira-coalesce
5983 @opindex fira-coalesce
5984 Do optimistic register coalescing.  This option might be profitable for
5985 architectures with big regular register files.
5987 @item -fno-ira-share-save-slots
5988 @opindex fno-ira-share-save-slots
5989 Switch off sharing stack slots used for saving call used hard
5990 registers living through a call.  Each hard register will get a
5991 separate stack slot and as a result function stack frame will be
5992 bigger.
5994 @item -fno-ira-share-spill-slots
5995 @opindex fno-ira-share-spill-slots
5996 Switch off sharing stack slots allocated for pseudo-registers.  Each
5997 pseudo-register which did not get a hard register will get a separate
5998 stack slot and as a result function stack frame will be bigger.
6000 @item -fira-verbose=@var{n}
6001 @opindex fira-verbose
6002 Set up how verbose dump file for the integrated register allocator
6003 will be.  Default value is 5.  If the value is greater or equal to 10,
6004 the dump file will be stderr as if the value were @var{n} minus 10.
6006 @item -fdelayed-branch
6007 @opindex fdelayed-branch
6008 If supported for the target machine, attempt to reorder instructions
6009 to exploit instruction slots available after delayed branch
6010 instructions.
6012 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6014 @item -fschedule-insns
6015 @opindex fschedule-insns
6016 If supported for the target machine, attempt to reorder instructions to
6017 eliminate execution stalls due to required data being unavailable.  This
6018 helps machines that have slow floating point or memory load instructions
6019 by allowing other instructions to be issued until the result of the load
6020 or floating point instruction is required.
6022 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6024 @item -fschedule-insns2
6025 @opindex fschedule-insns2
6026 Similar to @option{-fschedule-insns}, but requests an additional pass of
6027 instruction scheduling after register allocation has been done.  This is
6028 especially useful on machines with a relatively small number of
6029 registers and where memory load instructions take more than one cycle.
6031 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6033 @item -fno-sched-interblock
6034 @opindex fno-sched-interblock
6035 Don't schedule instructions across basic blocks.  This is normally
6036 enabled by default when scheduling before register allocation, i.e.@:
6037 with @option{-fschedule-insns} or at @option{-O2} or higher.
6039 @item -fno-sched-spec
6040 @opindex fno-sched-spec
6041 Don't allow speculative motion of non-load instructions.  This is normally
6042 enabled by default when scheduling before register allocation, i.e.@:
6043 with @option{-fschedule-insns} or at @option{-O2} or higher.
6045 @item -fsched-spec-load
6046 @opindex fsched-spec-load
6047 Allow speculative motion of some load instructions.  This only makes
6048 sense when scheduling before register allocation, i.e.@: with
6049 @option{-fschedule-insns} or at @option{-O2} or higher.
6051 @item -fsched-spec-load-dangerous
6052 @opindex fsched-spec-load-dangerous
6053 Allow speculative motion of more load instructions.  This only makes
6054 sense when scheduling before register allocation, i.e.@: with
6055 @option{-fschedule-insns} or at @option{-O2} or higher.
6057 @item -fsched-stalled-insns
6058 @itemx -fsched-stalled-insns=@var{n}
6059 @opindex fsched-stalled-insns
6060 Define how many insns (if any) can be moved prematurely from the queue
6061 of stalled insns into the ready list, during the second scheduling pass.
6062 @option{-fno-sched-stalled-insns} means that no insns will be moved
6063 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6064 on how many queued insns can be moved prematurely.
6065 @option{-fsched-stalled-insns} without a value is equivalent to
6066 @option{-fsched-stalled-insns=1}.
6068 @item -fsched-stalled-insns-dep
6069 @itemx -fsched-stalled-insns-dep=@var{n}
6070 @opindex fsched-stalled-insns-dep
6071 Define how many insn groups (cycles) will be examined for a dependency
6072 on a stalled insn that is candidate for premature removal from the queue
6073 of stalled insns.  This has an effect only during the second scheduling pass,
6074 and only if @option{-fsched-stalled-insns} is used.
6075 @option{-fno-sched-stalled-insns-dep} is equivalent to
6076 @option{-fsched-stalled-insns-dep=0}.
6077 @option{-fsched-stalled-insns-dep} without a value is equivalent to
6078 @option{-fsched-stalled-insns-dep=1}.
6080 @item -fsched2-use-superblocks
6081 @opindex fsched2-use-superblocks
6082 When scheduling after register allocation, do use superblock scheduling
6083 algorithm.  Superblock scheduling allows motion across basic block boundaries
6084 resulting on faster schedules.  This option is experimental, as not all machine
6085 descriptions used by GCC model the CPU closely enough to avoid unreliable
6086 results from the algorithm.
6088 This only makes sense when scheduling after register allocation, i.e.@: with
6089 @option{-fschedule-insns2} or at @option{-O2} or higher.
6091 @item -fsched2-use-traces
6092 @opindex fsched2-use-traces
6093 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
6094 allocation and additionally perform code duplication in order to increase the
6095 size of superblocks using tracer pass.  See @option{-ftracer} for details on
6096 trace formation.
6098 This mode should produce faster but significantly longer programs.  Also
6099 without @option{-fbranch-probabilities} the traces constructed may not
6100 match the reality and hurt the performance.  This only makes
6101 sense when scheduling after register allocation, i.e.@: with
6102 @option{-fschedule-insns2} or at @option{-O2} or higher.
6104 @item -fsee
6105 @opindex fsee
6106 Eliminate redundant sign extension instructions and move the non-redundant
6107 ones to optimal placement using lazy code motion (LCM).
6109 @item -freschedule-modulo-scheduled-loops
6110 @opindex freschedule-modulo-scheduled-loops
6111 The modulo scheduling comes before the traditional scheduling, if a loop
6112 was modulo scheduled we may want to prevent the later scheduling passes
6113 from changing its schedule, we use this option to control that.
6115 @item -fselective-scheduling
6116 @opindex fselective-scheduling
6117 Schedule instructions using selective scheduling algorithm.  Selective
6118 scheduling runs instead of the first scheduler pass.
6120 @item -fselective-scheduling2
6121 @opindex fselective-scheduling2
6122 Schedule instructions using selective scheduling algorithm.  Selective
6123 scheduling runs instead of the second scheduler pass.
6125 @item -fsel-sched-pipelining
6126 @opindex fsel-sched-pipelining
6127 Enable software pipelining of innermost loops during selective scheduling.  
6128 This option has no effect until one of @option{-fselective-scheduling} or 
6129 @option{-fselective-scheduling2} is turned on.
6131 @item -fsel-sched-pipelining-outer-loops
6132 @opindex fsel-sched-pipelining-outer-loops
6133 When pipelining loops during selective scheduling, also pipeline outer loops.
6134 This option has no effect until @option{-fsel-sched-pipelining} is turned on.
6136 @item -fcaller-saves
6137 @opindex fcaller-saves
6138 Enable values to be allocated in registers that will be clobbered by
6139 function calls, by emitting extra instructions to save and restore the
6140 registers around such calls.  Such allocation is done only when it
6141 seems to result in better code than would otherwise be produced.
6143 This option is always enabled by default on certain machines, usually
6144 those which have no call-preserved registers to use instead.
6146 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6148 @item -fconserve-stack
6149 @opindex fconserve-stack
6150 Attempt to minimize stack usage.  The compiler will attempt to use less
6151 stack space, even if that makes the program slower.  This option
6152 implies setting the @option{large-stack-frame} parameter to 100
6153 and the @option{large-stack-frame-growth} parameter to 400.
6155 @item -ftree-reassoc
6156 @opindex ftree-reassoc
6157 Perform reassociation on trees.  This flag is enabled by default
6158 at @option{-O} and higher.
6160 @item -ftree-pre
6161 @opindex ftree-pre
6162 Perform partial redundancy elimination (PRE) on trees.  This flag is
6163 enabled by default at @option{-O2} and @option{-O3}.
6165 @item -ftree-fre
6166 @opindex ftree-fre
6167 Perform full redundancy elimination (FRE) on trees.  The difference
6168 between FRE and PRE is that FRE only considers expressions
6169 that are computed on all paths leading to the redundant computation.
6170 This analysis is faster than PRE, though it exposes fewer redundancies.
6171 This flag is enabled by default at @option{-O} and higher.
6173 @item -ftree-copy-prop
6174 @opindex ftree-copy-prop
6175 Perform copy propagation on trees.  This pass eliminates unnecessary
6176 copy operations.  This flag is enabled by default at @option{-O} and
6177 higher.
6179 @item -fipa-pure-const
6180 @opindex fipa-pure-const
6181 Discover which functions are pure or constant.
6182 Enabled by default at @option{-O} and higher.
6184 @item -fipa-reference
6185 @opindex fipa-reference
6186 Discover which static variables do not escape cannot escape the
6187 compilation unit.
6188 Enabled by default at @option{-O} and higher.
6190 @item -fipa-struct-reorg
6191 @opindex fipa-struct-reorg
6192 Perform structure reorganization optimization, that change C-like structures 
6193 layout in order to better utilize spatial locality.  This transformation is 
6194 affective for programs containing arrays of structures.  Available in two 
6195 compilation modes: profile-based (enabled with @option{-fprofile-generate})
6196 or static (which uses built-in heuristics).  Require @option{-fipa-type-escape}
6197 to provide the safety of this transformation.  It works only in whole program
6198 mode, so it requires @option{-fwhole-program} and @option{-combine} to be
6199 enabled.  Structures considered @samp{cold} by this transformation are not
6200 affected (see @option{--param struct-reorg-cold-struct-ratio=@var{value}}).
6202 With this flag, the program debug info reflects a new structure layout.
6204 @item -fipa-pta
6205 @opindex fipa-pta
6206 Perform interprocedural pointer analysis.  This option is experimental
6207 and does not affect generated code.
6209 @item -fipa-cp
6210 @opindex fipa-cp
6211 Perform interprocedural constant propagation.
6212 This optimization analyzes the program to determine when values passed
6213 to functions are constants and then optimizes accordingly.  
6214 This optimization can substantially increase performance
6215 if the application has constants passed to functions.
6216 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
6218 @item -fipa-cp-clone
6219 @opindex fipa-cp-clone
6220 Perform function cloning to make interprocedural constant propagation stronger.
6221 When enabled, interprocedural constant propagation will perform function cloning
6222 when externally visible function can be called with constant arguments.
6223 Because this optimization can create multiple copies of functions,
6224 it may significantly increase code size
6225 (see @option{--param ipcp-unit-growth=@var{value}}).
6226 This flag is enabled by default at @option{-O3}.
6228 @item -fipa-matrix-reorg
6229 @opindex fipa-matrix-reorg
6230 Perform matrix flattening and transposing.
6231 Matrix flattening tries to replace an @math{m}-dimensional matrix
6232 with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
6233 This reduces the level of indirection needed for accessing the elements
6234 of the matrix. The second optimization is matrix transposing that
6235 attempts to change the order of the matrix's dimensions in order to
6236 improve cache locality.
6237 Both optimizations need the @option{-fwhole-program} flag. 
6238 Transposing is enabled only if profiling information is available.
6241 @item -ftree-sink
6242 @opindex ftree-sink
6243 Perform forward store motion  on trees.  This flag is
6244 enabled by default at @option{-O} and higher.
6246 @item -ftree-ccp
6247 @opindex ftree-ccp
6248 Perform sparse conditional constant propagation (CCP) on trees.  This
6249 pass only operates on local scalar variables and is enabled by default
6250 at @option{-O} and higher.
6252 @item -ftree-switch-conversion
6253 Perform conversion of simple initializations in a switch to
6254 initializations from a scalar array.  This flag is enabled by default
6255 at @option{-O2} and higher.
6257 @item -ftree-dce
6258 @opindex ftree-dce
6259 Perform dead code elimination (DCE) on trees.  This flag is enabled by
6260 default at @option{-O} and higher.
6262 @item -ftree-builtin-call-dce
6263 @opindex ftree-builtin-call-dce
6264 Perform conditional dead code elimination (DCE) for calls to builtin functions 
6265 that may set @code{errno} but are otherwise side-effect free.  This flag is 
6266 enabled by default at @option{-O2} and higher if @option{-Os} is not also 
6267 specified.
6269 @item -ftree-dominator-opts
6270 @opindex ftree-dominator-opts
6271 Perform a variety of simple scalar cleanups (constant/copy
6272 propagation, redundancy elimination, range propagation and expression
6273 simplification) based on a dominator tree traversal.  This also
6274 performs jump threading (to reduce jumps to jumps). This flag is
6275 enabled by default at @option{-O} and higher.
6277 @item -ftree-dse
6278 @opindex ftree-dse
6279 Perform dead store elimination (DSE) on trees.  A dead store is a store into
6280 a memory location which will later be overwritten by another store without
6281 any intervening loads.  In this case the earlier store can be deleted.  This
6282 flag is enabled by default at @option{-O} and higher.
6284 @item -ftree-ch
6285 @opindex ftree-ch
6286 Perform loop header copying on trees.  This is beneficial since it increases
6287 effectiveness of code motion optimizations.  It also saves one jump.  This flag
6288 is enabled by default at @option{-O} and higher.  It is not enabled
6289 for @option{-Os}, since it usually increases code size.
6291 @item -ftree-loop-optimize
6292 @opindex ftree-loop-optimize
6293 Perform loop optimizations on trees.  This flag is enabled by default
6294 at @option{-O} and higher.
6296 @item -ftree-loop-linear
6297 @opindex ftree-loop-linear
6298 Perform linear loop transformations on tree.  This flag can improve cache
6299 performance and allow further loop optimizations to take place.
6301 @item -floop-interchange
6302 Perform loop interchange transformations on loops.  Interchanging two
6303 nested loops switches the inner and outer loops.  For example, given a
6304 loop like:
6305 @smallexample
6306 DO J = 1, M
6307   DO I = 1, N
6308     A(J, I) = A(J, I) * C
6309   ENDDO
6310 ENDDO
6311 @end smallexample
6312 loop interchange will transform the loop as if the user had written:
6313 @smallexample
6314 DO I = 1, N
6315   DO J = 1, M
6316     A(J, I) = A(J, I) * C
6317   ENDDO
6318 ENDDO
6319 @end smallexample
6320 which can be beneficial when @code{N} is larger than the caches,
6321 because in Fortran, the elements of an array are stored in memory
6322 contiguously by column, and the original loop iterates over rows,
6323 potentially creating at each access a cache miss.  This optimization
6324 applies to all the languages supported by GCC and is not limited to
6325 Fortran.  To use this code transformation, GCC has to be configured
6326 with @option{--with-ppl} and @option{--with-cloog} to enable the
6327 Graphite loop transformation infrastructure.
6329 @item -floop-strip-mine
6330 Perform loop strip mining transformations on loops.  Strip mining
6331 splits a loop into two nested loops.  The outer loop has strides 
6332 equal to the strip size and the inner loop has strides of the 
6333 original loop within a strip.  For example, given a loop like:
6334 @smallexample
6335 DO I = 1, N
6336   A(I) = A(I) + C
6337 ENDDO
6338 @end smallexample
6339 loop strip mining will transform the loop as if the user had written:
6340 @smallexample
6341 DO II = 1, N, 4
6342   DO I = II, min (II + 3, N)
6343     A(I) = A(I) + C
6344   ENDDO
6345 ENDDO
6346 @end smallexample
6347 This optimization applies to all the languages supported by GCC and is
6348 not limited to Fortran.  To use this code transformation, GCC has to
6349 be configured with @option{--with-ppl} and @option{--with-cloog} to
6350 enable the Graphite loop transformation infrastructure.
6352 @item -floop-block
6353 Perform loop blocking transformations on loops.  Blocking strip mines
6354 each loop in the loop nest such that the memory accesses of the
6355 element loops fit inside caches.  For example, given a loop like:
6356 @smallexample
6357 DO I = 1, N
6358   DO J = 1, M
6359     A(J, I) = B(I) + C(J)
6360   ENDDO
6361 ENDDO
6362 @end smallexample
6363 loop blocking will transform the loop as if the user had written:
6364 @smallexample
6365 DO II = 1, N, 64
6366   DO JJ = 1, M, 64
6367     DO I = II, min (II + 63, N)
6368       DO J = JJ, min (JJ + 63, M)
6369         A(J, I) = B(I) + C(J)
6370       ENDDO
6371     ENDDO
6372   ENDDO
6373 ENDDO
6374 @end smallexample
6375 which can be beneficial when @code{M} is larger than the caches,
6376 because the innermost loop will iterate over a smaller amount of data
6377 that can be kept in the caches.  This optimization applies to all the
6378 languages supported by GCC and is not limited to Fortran.  To use this
6379 code transformation, GCC has to be configured with @option{--with-ppl}
6380 and @option{--with-cloog} to enable the Graphite loop transformation
6381 infrastructure.
6383 @item -fcheck-data-deps
6384 @opindex fcheck-data-deps
6385 Compare the results of several data dependence analyzers.  This option
6386 is used for debugging the data dependence analyzers.
6388 @item -ftree-loop-distribution
6389 Perform loop distribution.  This flag can improve cache performance on
6390 big loop bodies and allow further loop optimizations, like
6391 parallelization or vectorization, to take place.  For example, the loop
6392 @smallexample
6393 DO I = 1, N
6394   A(I) = B(I) + C
6395   D(I) = E(I) * F
6396 ENDDO
6397 @end smallexample
6398 is transformed to
6399 @smallexample
6400 DO I = 1, N
6401    A(I) = B(I) + C
6402 ENDDO
6403 DO I = 1, N
6404    D(I) = E(I) * F
6405 ENDDO
6406 @end smallexample
6408 @item -ftree-loop-im
6409 @opindex ftree-loop-im
6410 Perform loop invariant motion on trees.  This pass moves only invariants that
6411 would be hard to handle at RTL level (function calls, operations that expand to
6412 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
6413 operands of conditions that are invariant out of the loop, so that we can use
6414 just trivial invariantness analysis in loop unswitching.  The pass also includes
6415 store motion.
6417 @item -ftree-loop-ivcanon
6418 @opindex ftree-loop-ivcanon
6419 Create a canonical counter for number of iterations in the loop for that
6420 determining number of iterations requires complicated analysis.  Later
6421 optimizations then may determine the number easily.  Useful especially
6422 in connection with unrolling.
6424 @item -fivopts
6425 @opindex fivopts
6426 Perform induction variable optimizations (strength reduction, induction
6427 variable merging and induction variable elimination) on trees.
6429 @item -ftree-parallelize-loops=n
6430 @opindex ftree-parallelize-loops
6431 Parallelize loops, i.e., split their iteration space to run in n threads.
6432 This is only possible for loops whose iterations are independent
6433 and can be arbitrarily reordered.  The optimization is only
6434 profitable on multiprocessor machines, for loops that are CPU-intensive,
6435 rather than constrained e.g.@: by memory bandwidth.  This option
6436 implies @option{-pthread}, and thus is only supported on targets
6437 that have support for @option{-pthread}.
6439 @item -ftree-sra
6440 @opindex ftree-sra
6441 Perform scalar replacement of aggregates.  This pass replaces structure
6442 references with scalars to prevent committing structures to memory too
6443 early.  This flag is enabled by default at @option{-O} and higher.
6445 @item -ftree-copyrename
6446 @opindex ftree-copyrename
6447 Perform copy renaming on trees.  This pass attempts to rename compiler
6448 temporaries to other variables at copy locations, usually resulting in
6449 variable names which more closely resemble the original variables.  This flag
6450 is enabled by default at @option{-O} and higher.
6452 @item -ftree-ter
6453 @opindex ftree-ter
6454 Perform temporary expression replacement during the SSA->normal phase.  Single
6455 use/single def temporaries are replaced at their use location with their
6456 defining expression.  This results in non-GIMPLE code, but gives the expanders
6457 much more complex trees to work on resulting in better RTL generation.  This is
6458 enabled by default at @option{-O} and higher.
6460 @item -ftree-vectorize
6461 @opindex ftree-vectorize
6462 Perform loop vectorization on trees. This flag is enabled by default at
6463 @option{-O3}.
6465 @item -ftree-vect-loop-version
6466 @opindex ftree-vect-loop-version
6467 Perform loop versioning when doing loop vectorization on trees.  When a loop
6468 appears to be vectorizable except that data alignment or data dependence cannot
6469 be determined at compile time then vectorized and non-vectorized versions of
6470 the loop are generated along with runtime checks for alignment or dependence
6471 to control which version is executed.  This option is enabled by default
6472 except at level @option{-Os} where it is disabled.
6474 @item -fvect-cost-model
6475 @opindex fvect-cost-model
6476 Enable cost model for vectorization.
6478 @item -ftree-vrp
6479 @opindex ftree-vrp
6480 Perform Value Range Propagation on trees.  This is similar to the
6481 constant propagation pass, but instead of values, ranges of values are
6482 propagated.  This allows the optimizers to remove unnecessary range
6483 checks like array bound checks and null pointer checks.  This is
6484 enabled by default at @option{-O2} and higher.  Null pointer check
6485 elimination is only done if @option{-fdelete-null-pointer-checks} is
6486 enabled.
6488 @item -ftracer
6489 @opindex ftracer
6490 Perform tail duplication to enlarge superblock size.  This transformation
6491 simplifies the control flow of the function allowing other optimizations to do
6492 better job.
6494 @item -funroll-loops
6495 @opindex funroll-loops
6496 Unroll loops whose number of iterations can be determined at compile
6497 time or upon entry to the loop.  @option{-funroll-loops} implies
6498 @option{-frerun-cse-after-loop}.  This option makes code larger,
6499 and may or may not make it run faster.
6501 @item -funroll-all-loops
6502 @opindex funroll-all-loops
6503 Unroll all loops, even if their number of iterations is uncertain when
6504 the loop is entered.  This usually makes programs run more slowly.
6505 @option{-funroll-all-loops} implies the same options as
6506 @option{-funroll-loops},
6508 @item -fsplit-ivs-in-unroller
6509 @opindex fsplit-ivs-in-unroller
6510 Enables expressing of values of induction variables in later iterations
6511 of the unrolled loop using the value in the first iteration.  This breaks
6512 long dependency chains, thus improving efficiency of the scheduling passes.
6514 Combination of @option{-fweb} and CSE is often sufficient to obtain the
6515 same effect.  However in cases the loop body is more complicated than
6516 a single basic block, this is not reliable.  It also does not work at all
6517 on some of the architectures due to restrictions in the CSE pass.
6519 This optimization is enabled by default.
6521 @item -fvariable-expansion-in-unroller
6522 @opindex fvariable-expansion-in-unroller
6523 With this option, the compiler will create multiple copies of some
6524 local variables when unrolling a loop which can result in superior code.
6526 @item -fpredictive-commoning
6527 @opindex fpredictive-commoning
6528 Perform predictive commoning optimization, i.e., reusing computations
6529 (especially memory loads and stores) performed in previous
6530 iterations of loops.
6532 This option is enabled at level @option{-O3}.
6534 @item -fprefetch-loop-arrays
6535 @opindex fprefetch-loop-arrays
6536 If supported by the target machine, generate instructions to prefetch
6537 memory to improve the performance of loops that access large arrays.
6539 This option may generate better or worse code; results are highly
6540 dependent on the structure of loops within the source code.
6542 Disabled at level @option{-Os}.
6544 @item -fno-peephole
6545 @itemx -fno-peephole2
6546 @opindex fno-peephole
6547 @opindex fno-peephole2
6548 Disable any machine-specific peephole optimizations.  The difference
6549 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6550 are implemented in the compiler; some targets use one, some use the
6551 other, a few use both.
6553 @option{-fpeephole} is enabled by default.
6554 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6556 @item -fno-guess-branch-probability
6557 @opindex fno-guess-branch-probability
6558 Do not guess branch probabilities using heuristics.
6560 GCC will use heuristics to guess branch probabilities if they are
6561 not provided by profiling feedback (@option{-fprofile-arcs}).  These
6562 heuristics are based on the control flow graph.  If some branch probabilities
6563 are specified by @samp{__builtin_expect}, then the heuristics will be
6564 used to guess branch probabilities for the rest of the control flow graph,
6565 taking the @samp{__builtin_expect} info into account.  The interactions
6566 between the heuristics and @samp{__builtin_expect} can be complex, and in
6567 some cases, it may be useful to disable the heuristics so that the effects
6568 of @samp{__builtin_expect} are easier to understand.
6570 The default is @option{-fguess-branch-probability} at levels
6571 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6573 @item -freorder-blocks
6574 @opindex freorder-blocks
6575 Reorder basic blocks in the compiled function in order to reduce number of
6576 taken branches and improve code locality.
6578 Enabled at levels @option{-O2}, @option{-O3}.
6580 @item -freorder-blocks-and-partition
6581 @opindex freorder-blocks-and-partition
6582 In addition to reordering basic blocks in the compiled function, in order
6583 to reduce number of taken branches, partitions hot and cold basic blocks
6584 into separate sections of the assembly and .o files, to improve
6585 paging and cache locality performance.
6587 This optimization is automatically turned off in the presence of
6588 exception handling, for linkonce sections, for functions with a user-defined
6589 section attribute and on any architecture that does not support named
6590 sections.
6592 @item -freorder-functions
6593 @opindex freorder-functions
6594 Reorder functions in the object file in order to
6595 improve code locality.  This is implemented by using special
6596 subsections @code{.text.hot} for most frequently executed functions and
6597 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
6598 the linker so object file format must support named sections and linker must
6599 place them in a reasonable way.
6601 Also profile feedback must be available in to make this option effective.  See
6602 @option{-fprofile-arcs} for details.
6604 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6606 @item -fstrict-aliasing
6607 @opindex fstrict-aliasing
6608 Allows the compiler to assume the strictest aliasing rules applicable to
6609 the language being compiled.  For C (and C++), this activates
6610 optimizations based on the type of expressions.  In particular, an
6611 object of one type is assumed never to reside at the same address as an
6612 object of a different type, unless the types are almost the same.  For
6613 example, an @code{unsigned int} can alias an @code{int}, but not a
6614 @code{void*} or a @code{double}.  A character type may alias any other
6615 type.
6617 @anchor{Type-punning}Pay special attention to code like this:
6618 @smallexample
6619 union a_union @{
6620   int i;
6621   double d;
6624 int f() @{
6625   a_union t;
6626   t.d = 3.0;
6627   return t.i;
6629 @end smallexample
6630 The practice of reading from a different union member than the one most
6631 recently written to (called ``type-punning'') is common.  Even with
6632 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
6633 is accessed through the union type.  So, the code above will work as
6634 expected.  @xref{Structures unions enumerations and bit-fields
6635 implementation}.  However, this code might not:
6636 @smallexample
6637 int f() @{
6638   a_union t;
6639   int* ip;
6640   t.d = 3.0;
6641   ip = &t.i;
6642   return *ip;
6644 @end smallexample
6646 Similarly, access by taking the address, casting the resulting pointer
6647 and dereferencing the result has undefined behavior, even if the cast
6648 uses a union type, e.g.:
6649 @smallexample
6650 int f() @{
6651   double d = 3.0;
6652   return ((union a_union *) &d)->i;
6654 @end smallexample
6656 The @option{-fstrict-aliasing} option is enabled at levels
6657 @option{-O2}, @option{-O3}, @option{-Os}.
6659 @item -fstrict-overflow
6660 @opindex fstrict-overflow
6661 Allow the compiler to assume strict signed overflow rules, depending
6662 on the language being compiled.  For C (and C++) this means that
6663 overflow when doing arithmetic with signed numbers is undefined, which
6664 means that the compiler may assume that it will not happen.  This
6665 permits various optimizations.  For example, the compiler will assume
6666 that an expression like @code{i + 10 > i} will always be true for
6667 signed @code{i}.  This assumption is only valid if signed overflow is
6668 undefined, as the expression is false if @code{i + 10} overflows when
6669 using twos complement arithmetic.  When this option is in effect any
6670 attempt to determine whether an operation on signed numbers will
6671 overflow must be written carefully to not actually involve overflow.
6673 This option also allows the compiler to assume strict pointer
6674 semantics: given a pointer to an object, if adding an offset to that
6675 pointer does not produce a pointer to the same object, the addition is
6676 undefined.  This permits the compiler to conclude that @code{p + u >
6677 p} is always true for a pointer @code{p} and unsigned integer
6678 @code{u}.  This assumption is only valid because pointer wraparound is
6679 undefined, as the expression is false if @code{p + u} overflows using
6680 twos complement arithmetic.
6682 See also the @option{-fwrapv} option.  Using @option{-fwrapv} means
6683 that integer signed overflow is fully defined: it wraps.  When
6684 @option{-fwrapv} is used, there is no difference between
6685 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
6686 integers.  With @option{-fwrapv} certain types of overflow are
6687 permitted.  For example, if the compiler gets an overflow when doing
6688 arithmetic on constants, the overflowed value can still be used with
6689 @option{-fwrapv}, but not otherwise.
6691 The @option{-fstrict-overflow} option is enabled at levels
6692 @option{-O2}, @option{-O3}, @option{-Os}.
6694 @item -falign-functions
6695 @itemx -falign-functions=@var{n}
6696 @opindex falign-functions
6697 Align the start of functions to the next power-of-two greater than
6698 @var{n}, skipping up to @var{n} bytes.  For instance,
6699 @option{-falign-functions=32} aligns functions to the next 32-byte
6700 boundary, but @option{-falign-functions=24} would align to the next
6701 32-byte boundary only if this can be done by skipping 23 bytes or less.
6703 @option{-fno-align-functions} and @option{-falign-functions=1} are
6704 equivalent and mean that functions will not be aligned.
6706 Some assemblers only support this flag when @var{n} is a power of two;
6707 in that case, it is rounded up.
6709 If @var{n} is not specified or is zero, use a machine-dependent default.
6711 Enabled at levels @option{-O2}, @option{-O3}.
6713 @item -falign-labels
6714 @itemx -falign-labels=@var{n}
6715 @opindex falign-labels
6716 Align all branch targets to a power-of-two boundary, skipping up to
6717 @var{n} bytes like @option{-falign-functions}.  This option can easily
6718 make code slower, because it must insert dummy operations for when the
6719 branch target is reached in the usual flow of the code.
6721 @option{-fno-align-labels} and @option{-falign-labels=1} are
6722 equivalent and mean that labels will not be aligned.
6724 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
6725 are greater than this value, then their values are used instead.
6727 If @var{n} is not specified or is zero, use a machine-dependent default
6728 which is very likely to be @samp{1}, meaning no alignment.
6730 Enabled at levels @option{-O2}, @option{-O3}.
6732 @item -falign-loops
6733 @itemx -falign-loops=@var{n}
6734 @opindex falign-loops
6735 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
6736 like @option{-falign-functions}.  The hope is that the loop will be
6737 executed many times, which will make up for any execution of the dummy
6738 operations.
6740 @option{-fno-align-loops} and @option{-falign-loops=1} are
6741 equivalent and mean that loops will not be aligned.
6743 If @var{n} is not specified or is zero, use a machine-dependent default.
6745 Enabled at levels @option{-O2}, @option{-O3}.
6747 @item -falign-jumps
6748 @itemx -falign-jumps=@var{n}
6749 @opindex falign-jumps
6750 Align branch targets to a power-of-two boundary, for branch targets
6751 where the targets can only be reached by jumping, skipping up to @var{n}
6752 bytes like @option{-falign-functions}.  In this case, no dummy operations
6753 need be executed.
6755 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
6756 equivalent and mean that loops will not be aligned.
6758 If @var{n} is not specified or is zero, use a machine-dependent default.
6760 Enabled at levels @option{-O2}, @option{-O3}.
6762 @item -funit-at-a-time
6763 @opindex funit-at-a-time
6764 This option is left for compatibility reasons. @option{-funit-at-a-time}
6765 has no effect, while @option{-fno-unit-at-a-time} implies
6766 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
6768 Enabled by default.
6770 @item -fno-toplevel-reorder
6771 @opindex fno-toplevel-reorder
6772 Do not reorder top-level functions, variables, and @code{asm}
6773 statements.  Output them in the same order that they appear in the
6774 input file.  When this option is used, unreferenced static variables
6775 will not be removed.  This option is intended to support existing code
6776 which relies on a particular ordering.  For new code, it is better to
6777 use attributes.
6779 Enabled at level @option{-O0}.  When disabled explicitly, it also imply
6780 @option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
6781 targets.
6783 @item -fweb
6784 @opindex fweb
6785 Constructs webs as commonly used for register allocation purposes and assign
6786 each web individual pseudo register.  This allows the register allocation pass
6787 to operate on pseudos directly, but also strengthens several other optimization
6788 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
6789 however, make debugging impossible, since variables will no longer stay in a
6790 ``home register''.
6792 Enabled by default with @option{-funroll-loops}.
6794 @item -fwhole-program
6795 @opindex fwhole-program
6796 Assume that the current compilation unit represents the whole program being
6797 compiled.  All public functions and variables with the exception of @code{main}
6798 and those merged by attribute @code{externally_visible} become static functions
6799 and in effect are optimized more aggressively by interprocedural optimizers.
6800 While this option is equivalent to proper use of the @code{static} keyword for
6801 programs consisting of a single file, in combination with option
6802 @option{--combine} this flag can be used to compile many smaller scale C
6803 programs since the functions and variables become local for the whole combined
6804 compilation unit, not for the single source file itself.
6806 This option is not supported for Fortran programs.
6808 @item -fcprop-registers
6809 @opindex fcprop-registers
6810 After register allocation and post-register allocation instruction splitting,
6811 we perform a copy-propagation pass to try to reduce scheduling dependencies
6812 and occasionally eliminate the copy.
6814 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6816 @item -fprofile-correction
6817 @opindex fprofile-correction
6818 Profiles collected using an instrumented binary for multi-threaded programs may
6819 be inconsistent due to missed counter updates. When this option is specified,
6820 GCC will use heuristics to correct or smooth out such inconsistencies. By
6821 default, GCC will emit an error message when an inconsistent profile is detected.
6823 @item -fprofile-dir=@var{path}
6824 @opindex fprofile-dir
6826 Set the directory to search the profile data files in to @var{path}.
6827 This option affects only the profile data generated by
6828 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
6829 and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 
6830 and its related options.
6831 By default, GCC will use the current directory as @var{path}
6832 thus the profile data file will appear in the same directory as the object file.
6834 @item -fprofile-generate
6835 @itemx -fprofile-generate=@var{path}
6836 @opindex fprofile-generate
6838 Enable options usually used for instrumenting application to produce
6839 profile useful for later recompilation with profile feedback based
6840 optimization.  You must use @option{-fprofile-generate} both when
6841 compiling and when linking your program.
6843 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
6845 If @var{path} is specified, GCC will look at the @var{path} to find
6846 the profile feedback data files. See @option{-fprofile-dir}.
6848 @item -fprofile-use
6849 @itemx -fprofile-use=@var{path}
6850 @opindex fprofile-use
6851 Enable profile feedback directed optimizations, and optimizations
6852 generally profitable only with profile feedback available.
6854 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
6855 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
6857 By default, GCC emits an error message if the feedback profiles do not
6858 match the source code.  This error can be turned into a warning by using
6859 @option{-Wcoverage-mismatch}.  Note this may result in poorly optimized
6860 code.
6862 If @var{path} is specified, GCC will look at the @var{path} to find
6863 the profile feedback data files. See @option{-fprofile-dir}.
6864 @end table
6866 The following options control compiler behavior regarding floating
6867 point arithmetic.  These options trade off between speed and
6868 correctness.  All must be specifically enabled.
6870 @table @gcctabopt
6871 @item -ffloat-store
6872 @opindex ffloat-store
6873 Do not store floating point variables in registers, and inhibit other
6874 options that might change whether a floating point value is taken from a
6875 register or memory.
6877 @cindex floating point precision
6878 This option prevents undesirable excess precision on machines such as
6879 the 68000 where the floating registers (of the 68881) keep more
6880 precision than a @code{double} is supposed to have.  Similarly for the
6881 x86 architecture.  For most programs, the excess precision does only
6882 good, but a few programs rely on the precise definition of IEEE floating
6883 point.  Use @option{-ffloat-store} for such programs, after modifying
6884 them to store all pertinent intermediate computations into variables.
6886 @item -fexcess-precision=@var{style}
6887 @opindex fexcess-precision
6888 This option allows further control over excess precision on machines
6889 where floating-point registers have more precision than the IEEE
6890 @code{float} and @code{double} types and the processor does not
6891 support operations rounding to those types.  By default,
6892 @option{-fexcess-precision=fast} is in effect; this means that
6893 operations are carried out in the precision of the registers and that
6894 it is unpredictable when rounding to the types specified in the source
6895 code takes place.  When compiling C, if
6896 @option{-fexcess-precision=standard} is specified then excess
6897 precision will follow the rules specified in ISO C99; in particular,
6898 both casts and assignments cause values to be rounded to their
6899 semantic types (whereas @option{-ffloat-store} only affects
6900 assignments).  This option is enabled by default for C if a strict
6901 conformance option such as @option{-std=c99} is used.
6903 @opindex mfpmath
6904 @option{-fexcess-precision=standard} is not implemented for languages
6905 other than C, and has no effect if
6906 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
6907 specified.  On the x86, it also has no effect if @option{-mfpmath=sse}
6908 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
6909 semantics apply without excess precision, and in the latter, rounding
6910 is unpredictable.
6912 @item -ffast-math
6913 @opindex ffast-math
6914 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
6915 @option{-ffinite-math-only}, @option{-fno-rounding-math},
6916 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
6918 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
6920 This option is not turned on by any @option{-O} option since
6921 it can result in incorrect output for programs which depend on
6922 an exact implementation of IEEE or ISO rules/specifications for
6923 math functions. It may, however, yield faster code for programs
6924 that do not require the guarantees of these specifications.
6926 @item -fno-math-errno
6927 @opindex fno-math-errno
6928 Do not set ERRNO after calling math functions that are executed
6929 with a single instruction, e.g., sqrt.  A program that relies on
6930 IEEE exceptions for math error handling may want to use this flag
6931 for speed while maintaining IEEE arithmetic compatibility.
6933 This option is not turned on by any @option{-O} option since
6934 it can result in incorrect output for programs which depend on
6935 an exact implementation of IEEE or ISO rules/specifications for
6936 math functions. It may, however, yield faster code for programs
6937 that do not require the guarantees of these specifications.
6939 The default is @option{-fmath-errno}.
6941 On Darwin systems, the math library never sets @code{errno}.  There is
6942 therefore no reason for the compiler to consider the possibility that
6943 it might, and @option{-fno-math-errno} is the default.
6945 @item -funsafe-math-optimizations
6946 @opindex funsafe-math-optimizations
6948 Allow optimizations for floating-point arithmetic that (a) assume
6949 that arguments and results are valid and (b) may violate IEEE or
6950 ANSI standards.  When used at link-time, it may include libraries
6951 or startup files that change the default FPU control word or other
6952 similar optimizations.
6954 This option is not turned on by any @option{-O} option since
6955 it can result in incorrect output for programs which depend on
6956 an exact implementation of IEEE or ISO rules/specifications for
6957 math functions. It may, however, yield faster code for programs
6958 that do not require the guarantees of these specifications.
6959 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
6960 @option{-fassociative-math} and @option{-freciprocal-math}.
6962 The default is @option{-fno-unsafe-math-optimizations}.
6964 @item -fassociative-math
6965 @opindex fassociative-math
6967 Allow re-association of operands in series of floating-point operations.
6968 This violates the ISO C and C++ language standard by possibly changing
6969 computation result.  NOTE: re-ordering may change the sign of zero as
6970 well as ignore NaNs and inhibit or create underflow or overflow (and
6971 thus cannot be used on a code which relies on rounding behavior like
6972 @code{(x + 2**52) - 2**52)}.  May also reorder floating-point comparisons
6973 and thus may not be used when ordered comparisons are required.
6974 This option requires that both @option{-fno-signed-zeros} and
6975 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
6976 much sense with @option{-frounding-math}.
6978 The default is @option{-fno-associative-math}.
6980 @item -freciprocal-math
6981 @opindex freciprocal-math
6983 Allow the reciprocal of a value to be used instead of dividing by
6984 the value if this enables optimizations.  For example @code{x / y}
6985 can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
6986 is subject to common subexpression elimination.  Note that this loses
6987 precision and increases the number of flops operating on the value.
6989 The default is @option{-fno-reciprocal-math}.
6991 @item -ffinite-math-only
6992 @opindex ffinite-math-only
6993 Allow optimizations for floating-point arithmetic that assume
6994 that arguments and results are not NaNs or +-Infs.
6996 This option is not turned on by any @option{-O} option since
6997 it can result in incorrect output for programs which depend on
6998 an exact implementation of IEEE or ISO rules/specifications for
6999 math functions. It may, however, yield faster code for programs
7000 that do not require the guarantees of these specifications.
7002 The default is @option{-fno-finite-math-only}.
7004 @item -fno-signed-zeros
7005 @opindex fno-signed-zeros
7006 Allow optimizations for floating point arithmetic that ignore the
7007 signedness of zero.  IEEE arithmetic specifies the behavior of
7008 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
7009 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
7010 This option implies that the sign of a zero result isn't significant.
7012 The default is @option{-fsigned-zeros}.
7014 @item -fno-trapping-math
7015 @opindex fno-trapping-math
7016 Compile code assuming that floating-point operations cannot generate
7017 user-visible traps.  These traps include division by zero, overflow,
7018 underflow, inexact result and invalid operation.  This option requires
7019 that @option{-fno-signaling-nans} be in effect.  Setting this option may
7020 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
7022 This option should never be turned on by any @option{-O} option since
7023 it can result in incorrect output for programs which depend on
7024 an exact implementation of IEEE or ISO rules/specifications for
7025 math functions.
7027 The default is @option{-ftrapping-math}.
7029 @item -frounding-math
7030 @opindex frounding-math
7031 Disable transformations and optimizations that assume default floating
7032 point rounding behavior.  This is round-to-zero for all floating point
7033 to integer conversions, and round-to-nearest for all other arithmetic
7034 truncations.  This option should be specified for programs that change
7035 the FP rounding mode dynamically, or that may be executed with a
7036 non-default rounding mode.  This option disables constant folding of
7037 floating point expressions at compile-time (which may be affected by
7038 rounding mode) and arithmetic transformations that are unsafe in the
7039 presence of sign-dependent rounding modes.
7041 The default is @option{-fno-rounding-math}.
7043 This option is experimental and does not currently guarantee to
7044 disable all GCC optimizations that are affected by rounding mode.
7045 Future versions of GCC may provide finer control of this setting
7046 using C99's @code{FENV_ACCESS} pragma.  This command line option
7047 will be used to specify the default state for @code{FENV_ACCESS}.
7049 @item -fsignaling-nans
7050 @opindex fsignaling-nans
7051 Compile code assuming that IEEE signaling NaNs may generate user-visible
7052 traps during floating-point operations.  Setting this option disables
7053 optimizations that may change the number of exceptions visible with
7054 signaling NaNs.  This option implies @option{-ftrapping-math}.
7056 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
7057 be defined.
7059 The default is @option{-fno-signaling-nans}.
7061 This option is experimental and does not currently guarantee to
7062 disable all GCC optimizations that affect signaling NaN behavior.
7064 @item -fsingle-precision-constant
7065 @opindex fsingle-precision-constant
7066 Treat floating point constant as single precision constant instead of
7067 implicitly converting it to double precision constant.
7069 @item -fcx-limited-range
7070 @opindex fcx-limited-range
7071 When enabled, this option states that a range reduction step is not
7072 needed when performing complex division.  Also, there is no checking
7073 whether the result of a complex multiplication or division is @code{NaN
7074 + I*NaN}, with an attempt to rescue the situation in that case.  The
7075 default is @option{-fno-cx-limited-range}, but is enabled by
7076 @option{-ffast-math}.
7078 This option controls the default setting of the ISO C99
7079 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
7080 all languages.
7082 @item -fcx-fortran-rules
7083 @opindex fcx-fortran-rules
7084 Complex multiplication and division follow Fortran rules.  Range
7085 reduction is done as part of complex division, but there is no checking
7086 whether the result of a complex multiplication or division is @code{NaN
7087 + I*NaN}, with an attempt to rescue the situation in that case.
7089 The default is @option{-fno-cx-fortran-rules}.
7091 @end table
7093 The following options control optimizations that may improve
7094 performance, but are not enabled by any @option{-O} options.  This
7095 section includes experimental options that may produce broken code.
7097 @table @gcctabopt
7098 @item -fbranch-probabilities
7099 @opindex fbranch-probabilities
7100 After running a program compiled with @option{-fprofile-arcs}
7101 (@pxref{Debugging Options,, Options for Debugging Your Program or
7102 @command{gcc}}), you can compile it a second time using
7103 @option{-fbranch-probabilities}, to improve optimizations based on
7104 the number of times each branch was taken.  When the program
7105 compiled with @option{-fprofile-arcs} exits it saves arc execution
7106 counts to a file called @file{@var{sourcename}.gcda} for each source
7107 file.  The information in this data file is very dependent on the
7108 structure of the generated code, so you must use the same source code
7109 and the same optimization options for both compilations.
7111 With @option{-fbranch-probabilities}, GCC puts a
7112 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
7113 These can be used to improve optimization.  Currently, they are only
7114 used in one place: in @file{reorg.c}, instead of guessing which path a
7115 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
7116 exactly determine which path is taken more often.
7118 @item -fprofile-values
7119 @opindex fprofile-values
7120 If combined with @option{-fprofile-arcs}, it adds code so that some
7121 data about values of expressions in the program is gathered.
7123 With @option{-fbranch-probabilities}, it reads back the data gathered
7124 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
7125 notes to instructions for their later usage in optimizations.
7127 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
7129 @item -fvpt
7130 @opindex fvpt
7131 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
7132 a code to gather information about values of expressions.
7134 With @option{-fbranch-probabilities}, it reads back the data gathered
7135 and actually performs the optimizations based on them.
7136 Currently the optimizations include specialization of division operation
7137 using the knowledge about the value of the denominator.
7139 @item -frename-registers
7140 @opindex frename-registers
7141 Attempt to avoid false dependencies in scheduled code by making use
7142 of registers left over after register allocation.  This optimization
7143 will most benefit processors with lots of registers.  Depending on the
7144 debug information format adopted by the target, however, it can
7145 make debugging impossible, since variables will no longer stay in
7146 a ``home register''.
7148 Enabled by default with @option{-funroll-loops}.
7150 @item -ftracer
7151 @opindex ftracer
7152 Perform tail duplication to enlarge superblock size.  This transformation
7153 simplifies the control flow of the function allowing other optimizations to do
7154 better job.
7156 Enabled with @option{-fprofile-use}.
7158 @item -funroll-loops
7159 @opindex funroll-loops
7160 Unroll loops whose number of iterations can be determined at compile time or
7161 upon entry to the loop.  @option{-funroll-loops} implies
7162 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
7163 It also turns on complete loop peeling (i.e.@: complete removal of loops with
7164 small constant number of iterations).  This option makes code larger, and may
7165 or may not make it run faster.
7167 Enabled with @option{-fprofile-use}.
7169 @item -funroll-all-loops
7170 @opindex funroll-all-loops
7171 Unroll all loops, even if their number of iterations is uncertain when
7172 the loop is entered.  This usually makes programs run more slowly.
7173 @option{-funroll-all-loops} implies the same options as
7174 @option{-funroll-loops}.
7176 @item -fpeel-loops
7177 @opindex fpeel-loops
7178 Peels the loops for that there is enough information that they do not
7179 roll much (from profile feedback).  It also turns on complete loop peeling
7180 (i.e.@: complete removal of loops with small constant number of iterations).
7182 Enabled with @option{-fprofile-use}.
7184 @item -fmove-loop-invariants
7185 @opindex fmove-loop-invariants
7186 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
7187 at level @option{-O1}
7189 @item -funswitch-loops
7190 @opindex funswitch-loops
7191 Move branches with loop invariant conditions out of the loop, with duplicates
7192 of the loop on both branches (modified according to result of the condition).
7194 @item -ffunction-sections
7195 @itemx -fdata-sections
7196 @opindex ffunction-sections
7197 @opindex fdata-sections
7198 Place each function or data item into its own section in the output
7199 file if the target supports arbitrary sections.  The name of the
7200 function or the name of the data item determines the section's name
7201 in the output file.
7203 Use these options on systems where the linker can perform optimizations
7204 to improve locality of reference in the instruction space.  Most systems
7205 using the ELF object format and SPARC processors running Solaris 2 have
7206 linkers with such optimizations.  AIX may have these optimizations in
7207 the future.
7209 Only use these options when there are significant benefits from doing
7210 so.  When you specify these options, the assembler and linker will
7211 create larger object and executable files and will also be slower.
7212 You will not be able to use @code{gprof} on all systems if you
7213 specify this option and you may have problems with debugging if
7214 you specify both this option and @option{-g}.
7216 @item -fbranch-target-load-optimize
7217 @opindex fbranch-target-load-optimize
7218 Perform branch target register load optimization before prologue / epilogue
7219 threading.
7220 The use of target registers can typically be exposed only during reload,
7221 thus hoisting loads out of loops and doing inter-block scheduling needs
7222 a separate optimization pass.
7224 @item -fbranch-target-load-optimize2
7225 @opindex fbranch-target-load-optimize2
7226 Perform branch target register load optimization after prologue / epilogue
7227 threading.
7229 @item -fbtr-bb-exclusive
7230 @opindex fbtr-bb-exclusive
7231 When performing branch target register load optimization, don't reuse
7232 branch target registers in within any basic block.
7234 @item -fstack-protector
7235 @opindex fstack-protector
7236 Emit extra code to check for buffer overflows, such as stack smashing
7237 attacks.  This is done by adding a guard variable to functions with
7238 vulnerable objects.  This includes functions that call alloca, and
7239 functions with buffers larger than 8 bytes.  The guards are initialized
7240 when a function is entered and then checked when the function exits.
7241 If a guard check fails, an error message is printed and the program exits.
7243 @item -fstack-protector-all
7244 @opindex fstack-protector-all
7245 Like @option{-fstack-protector} except that all functions are protected.
7247 @item -fsection-anchors
7248 @opindex fsection-anchors
7249 Try to reduce the number of symbolic address calculations by using
7250 shared ``anchor'' symbols to address nearby objects.  This transformation
7251 can help to reduce the number of GOT entries and GOT accesses on some
7252 targets.
7254 For example, the implementation of the following function @code{foo}:
7256 @smallexample
7257 static int a, b, c;
7258 int foo (void) @{ return a + b + c; @}
7259 @end smallexample
7261 would usually calculate the addresses of all three variables, but if you
7262 compile it with @option{-fsection-anchors}, it will access the variables
7263 from a common anchor point instead.  The effect is similar to the
7264 following pseudocode (which isn't valid C):
7266 @smallexample
7267 int foo (void)
7269   register int *xr = &x;
7270   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
7272 @end smallexample
7274 Not all targets support this option.
7276 @item --param @var{name}=@var{value}
7277 @opindex param
7278 In some places, GCC uses various constants to control the amount of
7279 optimization that is done.  For example, GCC will not inline functions
7280 that contain more that a certain number of instructions.  You can
7281 control some of these constants on the command-line using the
7282 @option{--param} option.
7284 The names of specific parameters, and the meaning of the values, are
7285 tied to the internals of the compiler, and are subject to change
7286 without notice in future releases.
7288 In each case, the @var{value} is an integer.  The allowable choices for
7289 @var{name} are given in the following table:
7291 @table @gcctabopt
7292 @item sra-max-structure-size
7293 The maximum structure size, in bytes, at which the scalar replacement
7294 of aggregates (SRA) optimization will perform block copies.  The
7295 default value, 0, implies that GCC will select the most appropriate
7296 size itself.
7298 @item sra-field-structure-ratio
7299 The threshold ratio (as a percentage) between instantiated fields and
7300 the complete structure size.  We say that if the ratio of the number
7301 of bytes in instantiated fields to the number of bytes in the complete
7302 structure exceeds this parameter, then block copies are not used.  The
7303 default is 75.
7305 @item struct-reorg-cold-struct-ratio
7306 The threshold ratio (as a percentage) between a structure frequency
7307 and the frequency of the hottest structure in the program.  This parameter
7308 is used by struct-reorg optimization enabled by @option{-fipa-struct-reorg}.
7309 We say that if the ratio of a structure frequency, calculated by profiling, 
7310 to the hottest structure frequency in the program is less than this 
7311 parameter, then structure reorganization is not applied to this structure.
7312 The default is 10.
7314 @item predictable-branch-cost-outcome
7315 When branch is predicted to be taken with probability lower than this threshold
7316 (in percent), then it is considered well predictable. The default is 10.
7318 @item max-crossjump-edges
7319 The maximum number of incoming edges to consider for crossjumping.
7320 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
7321 the number of edges incoming to each block.  Increasing values mean
7322 more aggressive optimization, making the compile time increase with
7323 probably small improvement in executable size.
7325 @item min-crossjump-insns
7326 The minimum number of instructions which must be matched at the end
7327 of two blocks before crossjumping will be performed on them.  This
7328 value is ignored in the case where all instructions in the block being
7329 crossjumped from are matched.  The default value is 5.
7331 @item max-grow-copy-bb-insns
7332 The maximum code size expansion factor when copying basic blocks
7333 instead of jumping.  The expansion is relative to a jump instruction.
7334 The default value is 8.
7336 @item max-goto-duplication-insns
7337 The maximum number of instructions to duplicate to a block that jumps
7338 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
7339 passes, GCC factors computed gotos early in the compilation process,
7340 and unfactors them as late as possible.  Only computed jumps at the
7341 end of a basic blocks with no more than max-goto-duplication-insns are
7342 unfactored.  The default value is 8.
7344 @item max-delay-slot-insn-search
7345 The maximum number of instructions to consider when looking for an
7346 instruction to fill a delay slot.  If more than this arbitrary number of
7347 instructions is searched, the time savings from filling the delay slot
7348 will be minimal so stop searching.  Increasing values mean more
7349 aggressive optimization, making the compile time increase with probably
7350 small improvement in executable run time.
7352 @item max-delay-slot-live-search
7353 When trying to fill delay slots, the maximum number of instructions to
7354 consider when searching for a block with valid live register
7355 information.  Increasing this arbitrarily chosen value means more
7356 aggressive optimization, increasing the compile time.  This parameter
7357 should be removed when the delay slot code is rewritten to maintain the
7358 control-flow graph.
7360 @item max-gcse-memory
7361 The approximate maximum amount of memory that will be allocated in
7362 order to perform the global common subexpression elimination
7363 optimization.  If more memory than specified is required, the
7364 optimization will not be done.
7366 @item max-pending-list-length
7367 The maximum number of pending dependencies scheduling will allow
7368 before flushing the current state and starting over.  Large functions
7369 with few branches or calls can create excessively large lists which
7370 needlessly consume memory and resources.
7372 @item max-inline-insns-single
7373 Several parameters control the tree inliner used in gcc.
7374 This number sets the maximum number of instructions (counted in GCC's
7375 internal representation) in a single function that the tree inliner
7376 will consider for inlining.  This only affects functions declared
7377 inline and methods implemented in a class declaration (C++).
7378 The default value is 450.
7380 @item max-inline-insns-auto
7381 When you use @option{-finline-functions} (included in @option{-O3}),
7382 a lot of functions that would otherwise not be considered for inlining
7383 by the compiler will be investigated.  To those functions, a different
7384 (more restrictive) limit compared to functions declared inline can
7385 be applied.
7386 The default value is 90.
7388 @item large-function-insns
7389 The limit specifying really large functions.  For functions larger than this
7390 limit after inlining, inlining is constrained by
7391 @option{--param large-function-growth}.  This parameter is useful primarily
7392 to avoid extreme compilation time caused by non-linear algorithms used by the
7393 backend.
7394 The default value is 2700.
7396 @item large-function-growth
7397 Specifies maximal growth of large function caused by inlining in percents.
7398 The default value is 100 which limits large function growth to 2.0 times
7399 the original size.
7401 @item large-unit-insns
7402 The limit specifying large translation unit.  Growth caused by inlining of
7403 units larger than this limit is limited by @option{--param inline-unit-growth}.
7404 For small units this might be too tight (consider unit consisting of function A
7405 that is inline and B that just calls A three time.  If B is small relative to
7406 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
7407 large units consisting of small inlineable functions however the overall unit
7408 growth limit is needed to avoid exponential explosion of code size.  Thus for
7409 smaller units, the size is increased to @option{--param large-unit-insns}
7410 before applying @option{--param inline-unit-growth}.  The default is 10000
7412 @item inline-unit-growth
7413 Specifies maximal overall growth of the compilation unit caused by inlining.
7414 The default value is 30 which limits unit growth to 1.3 times the original
7415 size.
7417 @item ipcp-unit-growth
7418 Specifies maximal overall growth of the compilation unit caused by
7419 interprocedural constant propagation.  The default value is 10 which limits
7420 unit growth to 1.1 times the original size.
7422 @item large-stack-frame
7423 The limit specifying large stack frames.  While inlining the algorithm is trying
7424 to not grow past this limit too much.  Default value is 256 bytes.
7426 @item large-stack-frame-growth
7427 Specifies maximal growth of large stack frames caused by inlining in percents.
7428 The default value is 1000 which limits large stack frame growth to 11 times
7429 the original size.
7431 @item max-inline-insns-recursive
7432 @itemx max-inline-insns-recursive-auto
7433 Specifies maximum number of instructions out-of-line copy of self recursive inline
7434 function can grow into by performing recursive inlining.
7436 For functions declared inline @option{--param max-inline-insns-recursive} is
7437 taken into account.  For function not declared inline, recursive inlining
7438 happens only when @option{-finline-functions} (included in @option{-O3}) is
7439 enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
7440 default value is 450.
7442 @item max-inline-recursive-depth
7443 @itemx max-inline-recursive-depth-auto
7444 Specifies maximum recursion depth used by the recursive inlining.
7446 For functions declared inline @option{--param max-inline-recursive-depth} is
7447 taken into account.  For function not declared inline, recursive inlining
7448 happens only when @option{-finline-functions} (included in @option{-O3}) is
7449 enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
7450 default value is 8.
7452 @item min-inline-recursive-probability
7453 Recursive inlining is profitable only for function having deep recursion
7454 in average and can hurt for function having little recursion depth by
7455 increasing the prologue size or complexity of function body to other
7456 optimizers.
7458 When profile feedback is available (see @option{-fprofile-generate}) the actual
7459 recursion depth can be guessed from probability that function will recurse via
7460 given call expression.  This parameter limits inlining only to call expression
7461 whose probability exceeds given threshold (in percents).  The default value is
7464 @item inline-call-cost
7465 Specify cost of call instruction relative to simple arithmetics operations
7466 (having cost of 1).  Increasing this cost disqualifies inlining of non-leaf
7467 functions and at the same time increases size of leaf function that is believed to
7468 reduce function size by being inlined.  In effect it increases amount of
7469 inlining for code having large abstraction penalty (many functions that just
7470 pass the arguments to other functions) and decrease inlining for code with low
7471 abstraction penalty.  The default value is 12.
7473 @item min-vect-loop-bound
7474 The minimum number of iterations under which a loop will not get vectorized
7475 when @option{-ftree-vectorize} is used.  The number of iterations after
7476 vectorization needs to be greater than the value specified by this option
7477 to allow vectorization.  The default value is 0.
7479 @item max-unrolled-insns
7480 The maximum number of instructions that a loop should have if that loop
7481 is unrolled, and if the loop is unrolled, it determines how many times
7482 the loop code is unrolled.
7484 @item max-average-unrolled-insns
7485 The maximum number of instructions biased by probabilities of their execution
7486 that a loop should have if that loop is unrolled, and if the loop is unrolled,
7487 it determines how many times the loop code is unrolled.
7489 @item max-unroll-times
7490 The maximum number of unrollings of a single loop.
7492 @item max-peeled-insns
7493 The maximum number of instructions that a loop should have if that loop
7494 is peeled, and if the loop is peeled, it determines how many times
7495 the loop code is peeled.
7497 @item max-peel-times
7498 The maximum number of peelings of a single loop.
7500 @item max-completely-peeled-insns
7501 The maximum number of insns of a completely peeled loop.
7503 @item max-completely-peel-times
7504 The maximum number of iterations of a loop to be suitable for complete peeling.
7506 @item max-unswitch-insns
7507 The maximum number of insns of an unswitched loop.
7509 @item max-unswitch-level
7510 The maximum number of branches unswitched in a single loop.
7512 @item lim-expensive
7513 The minimum cost of an expensive expression in the loop invariant motion.
7515 @item iv-consider-all-candidates-bound
7516 Bound on number of candidates for induction variables below that
7517 all candidates are considered for each use in induction variable
7518 optimizations.  Only the most relevant candidates are considered
7519 if there are more candidates, to avoid quadratic time complexity.
7521 @item iv-max-considered-uses
7522 The induction variable optimizations give up on loops that contain more
7523 induction variable uses.
7525 @item iv-always-prune-cand-set-bound
7526 If number of candidates in the set is smaller than this value,
7527 we always try to remove unnecessary ivs from the set during its
7528 optimization when a new iv is added to the set.
7530 @item scev-max-expr-size
7531 Bound on size of expressions used in the scalar evolutions analyzer.
7532 Large expressions slow the analyzer.
7534 @item omega-max-vars
7535 The maximum number of variables in an Omega constraint system.
7536 The default value is 128.
7538 @item omega-max-geqs
7539 The maximum number of inequalities in an Omega constraint system.
7540 The default value is 256.
7542 @item omega-max-eqs
7543 The maximum number of equalities in an Omega constraint system.
7544 The default value is 128.
7546 @item omega-max-wild-cards
7547 The maximum number of wildcard variables that the Omega solver will
7548 be able to insert.  The default value is 18.
7550 @item omega-hash-table-size
7551 The size of the hash table in the Omega solver.  The default value is
7552 550.
7554 @item omega-max-keys
7555 The maximal number of keys used by the Omega solver.  The default
7556 value is 500.
7558 @item omega-eliminate-redundant-constraints
7559 When set to 1, use expensive methods to eliminate all redundant
7560 constraints.  The default value is 0.
7562 @item vect-max-version-for-alignment-checks
7563 The maximum number of runtime checks that can be performed when
7564 doing loop versioning for alignment in the vectorizer.  See option
7565 ftree-vect-loop-version for more information.
7567 @item vect-max-version-for-alias-checks
7568 The maximum number of runtime checks that can be performed when
7569 doing loop versioning for alias in the vectorizer.  See option
7570 ftree-vect-loop-version for more information.
7572 @item max-iterations-to-track
7574 The maximum number of iterations of a loop the brute force algorithm
7575 for analysis of # of iterations of the loop tries to evaluate.
7577 @item hot-bb-count-fraction
7578 Select fraction of the maximal count of repetitions of basic block in program
7579 given basic block needs to have to be considered hot.
7581 @item hot-bb-frequency-fraction
7582 Select fraction of the maximal frequency of executions of basic block in
7583 function given basic block needs to have to be considered hot
7585 @item max-predicted-iterations
7586 The maximum number of loop iterations we predict statically.  This is useful
7587 in cases where function contain single loop with known bound and other loop
7588 with unknown.  We predict the known number of iterations correctly, while
7589 the unknown number of iterations average to roughly 10.  This means that the
7590 loop without bounds would appear artificially cold relative to the other one.
7592 @item align-threshold
7594 Select fraction of the maximal frequency of executions of basic block in
7595 function given basic block will get aligned.
7597 @item align-loop-iterations
7599 A loop expected to iterate at lest the selected number of iterations will get
7600 aligned.
7602 @item tracer-dynamic-coverage
7603 @itemx tracer-dynamic-coverage-feedback
7605 This value is used to limit superblock formation once the given percentage of
7606 executed instructions is covered.  This limits unnecessary code size
7607 expansion.
7609 The @option{tracer-dynamic-coverage-feedback} is used only when profile
7610 feedback is available.  The real profiles (as opposed to statically estimated
7611 ones) are much less balanced allowing the threshold to be larger value.
7613 @item tracer-max-code-growth
7614 Stop tail duplication once code growth has reached given percentage.  This is
7615 rather hokey argument, as most of the duplicates will be eliminated later in
7616 cross jumping, so it may be set to much higher values than is the desired code
7617 growth.
7619 @item tracer-min-branch-ratio
7621 Stop reverse growth when the reverse probability of best edge is less than this
7622 threshold (in percent).
7624 @item tracer-min-branch-ratio
7625 @itemx tracer-min-branch-ratio-feedback
7627 Stop forward growth if the best edge do have probability lower than this
7628 threshold.
7630 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
7631 compilation for profile feedback and one for compilation without.  The value
7632 for compilation with profile feedback needs to be more conservative (higher) in
7633 order to make tracer effective.
7635 @item max-cse-path-length
7637 Maximum number of basic blocks on path that cse considers.  The default is 10.
7639 @item max-cse-insns
7640 The maximum instructions CSE process before flushing. The default is 1000.
7642 @item ggc-min-expand
7644 GCC uses a garbage collector to manage its own memory allocation.  This
7645 parameter specifies the minimum percentage by which the garbage
7646 collector's heap should be allowed to expand between collections.
7647 Tuning this may improve compilation speed; it has no effect on code
7648 generation.
7650 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
7651 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
7652 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
7653 GCC is not able to calculate RAM on a particular platform, the lower
7654 bound of 30% is used.  Setting this parameter and
7655 @option{ggc-min-heapsize} to zero causes a full collection to occur at
7656 every opportunity.  This is extremely slow, but can be useful for
7657 debugging.
7659 @item ggc-min-heapsize
7661 Minimum size of the garbage collector's heap before it begins bothering
7662 to collect garbage.  The first collection occurs after the heap expands
7663 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
7664 tuning this may improve compilation speed, and has no effect on code
7665 generation.
7667 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
7668 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
7669 with a lower bound of 4096 (four megabytes) and an upper bound of
7670 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
7671 particular platform, the lower bound is used.  Setting this parameter
7672 very large effectively disables garbage collection.  Setting this
7673 parameter and @option{ggc-min-expand} to zero causes a full collection
7674 to occur at every opportunity.
7676 @item max-reload-search-insns
7677 The maximum number of instruction reload should look backward for equivalent
7678 register.  Increasing values mean more aggressive optimization, making the
7679 compile time increase with probably slightly better performance.  The default
7680 value is 100.
7682 @item max-cselib-memory-locations
7683 The maximum number of memory locations cselib should take into account.
7684 Increasing values mean more aggressive optimization, making the compile time
7685 increase with probably slightly better performance.  The default value is 500.
7687 @item reorder-blocks-duplicate
7688 @itemx reorder-blocks-duplicate-feedback
7690 Used by basic block reordering pass to decide whether to use unconditional
7691 branch or duplicate the code on its destination.  Code is duplicated when its
7692 estimated size is smaller than this value multiplied by the estimated size of
7693 unconditional jump in the hot spots of the program.
7695 The @option{reorder-block-duplicate-feedback} is used only when profile
7696 feedback is available and may be set to higher values than
7697 @option{reorder-block-duplicate} since information about the hot spots is more
7698 accurate.
7700 @item max-sched-ready-insns
7701 The maximum number of instructions ready to be issued the scheduler should
7702 consider at any given time during the first scheduling pass.  Increasing
7703 values mean more thorough searches, making the compilation time increase
7704 with probably little benefit.  The default value is 100.
7706 @item max-sched-region-blocks
7707 The maximum number of blocks in a region to be considered for
7708 interblock scheduling.  The default value is 10.
7710 @item max-pipeline-region-blocks
7711 The maximum number of blocks in a region to be considered for
7712 pipelining in the selective scheduler.  The default value is 15.
7714 @item max-sched-region-insns
7715 The maximum number of insns in a region to be considered for
7716 interblock scheduling.  The default value is 100.
7718 @item max-pipeline-region-insns
7719 The maximum number of insns in a region to be considered for
7720 pipelining in the selective scheduler.  The default value is 200.
7722 @item min-spec-prob
7723 The minimum probability (in percents) of reaching a source block
7724 for interblock speculative scheduling.  The default value is 40.
7726 @item max-sched-extend-regions-iters
7727 The maximum number of iterations through CFG to extend regions.
7728 0 - disable region extension,
7729 N - do at most N iterations.
7730 The default value is 0.
7732 @item max-sched-insn-conflict-delay
7733 The maximum conflict delay for an insn to be considered for speculative motion.
7734 The default value is 3.
7736 @item sched-spec-prob-cutoff
7737 The minimal probability of speculation success (in percents), so that
7738 speculative insn will be scheduled.
7739 The default value is 40.
7741 @item sched-mem-true-dep-cost
7742 Minimal distance (in CPU cycles) between store and load targeting same
7743 memory locations.  The default value is 1.
7745 @item selsched-max-lookahead
7746 The maximum size of the lookahead window of selective scheduling.  It is a
7747 depth of search for available instructions.
7748 The default value is 50.
7750 @item selsched-max-sched-times
7751 The maximum number of times that an instruction will be scheduled during 
7752 selective scheduling.  This is the limit on the number of iterations 
7753 through which the instruction may be pipelined.  The default value is 2.
7755 @item selsched-max-insns-to-rename
7756 The maximum number of best instructions in the ready list that are considered
7757 for renaming in the selective scheduler.  The default value is 2.
7759 @item max-last-value-rtl
7760 The maximum size measured as number of RTLs that can be recorded in an expression
7761 in combiner for a pseudo register as last known value of that register.  The default
7762 is 10000.
7764 @item integer-share-limit
7765 Small integer constants can use a shared data structure, reducing the
7766 compiler's memory usage and increasing its speed.  This sets the maximum
7767 value of a shared integer constant.  The default value is 256.
7769 @item min-virtual-mappings
7770 Specifies the minimum number of virtual mappings in the incremental
7771 SSA updater that should be registered to trigger the virtual mappings
7772 heuristic defined by virtual-mappings-ratio.  The default value is
7773 100.
7775 @item virtual-mappings-ratio
7776 If the number of virtual mappings is virtual-mappings-ratio bigger
7777 than the number of virtual symbols to be updated, then the incremental
7778 SSA updater switches to a full update for those symbols.  The default
7779 ratio is 3.
7781 @item ssp-buffer-size
7782 The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
7783 protection when @option{-fstack-protection} is used.
7785 @item max-jump-thread-duplication-stmts
7786 Maximum number of statements allowed in a block that needs to be
7787 duplicated when threading jumps.
7789 @item max-fields-for-field-sensitive
7790 Maximum number of fields in a structure we will treat in
7791 a field sensitive manner during pointer analysis.  The default is zero
7792 for -O0, and -O1 and 100 for -Os, -O2, and -O3.
7794 @item prefetch-latency
7795 Estimate on average number of instructions that are executed before
7796 prefetch finishes.  The distance we prefetch ahead is proportional
7797 to this constant.  Increasing this number may also lead to less
7798 streams being prefetched (see @option{simultaneous-prefetches}).
7800 @item simultaneous-prefetches
7801 Maximum number of prefetches that can run at the same time.
7803 @item l1-cache-line-size
7804 The size of cache line in L1 cache, in bytes.
7806 @item l1-cache-size
7807 The size of L1 cache, in kilobytes.
7809 @item l2-cache-size
7810 The size of L2 cache, in kilobytes.
7812 @item use-canonical-types
7813 Whether the compiler should use the ``canonical'' type system.  By
7814 default, this should always be 1, which uses a more efficient internal
7815 mechanism for comparing types in C++ and Objective-C++.  However, if
7816 bugs in the canonical type system are causing compilation failures,
7817 set this value to 0 to disable canonical types.
7819 @item switch-conversion-max-branch-ratio
7820 Switch initialization conversion will refuse to create arrays that are
7821 bigger than @option{switch-conversion-max-branch-ratio} times the number of
7822 branches in the switch.
7824 @item max-partial-antic-length
7825 Maximum length of the partial antic set computed during the tree
7826 partial redundancy elimination optimization (@option{-ftree-pre}) when
7827 optimizing at @option{-O3} and above.  For some sorts of source code
7828 the enhanced partial redundancy elimination optimization can run away,
7829 consuming all of the memory available on the host machine.  This
7830 parameter sets a limit on the length of the sets that are computed,
7831 which prevents the runaway behavior.  Setting a value of 0 for
7832 this parameter will allow an unlimited set length.
7834 @item sccvn-max-scc-size
7835 Maximum size of a strongly connected component (SCC) during SCCVN
7836 processing.  If this limit is hit, SCCVN processing for the whole
7837 function will not be done and optimizations depending on it will
7838 be disabled.  The default maximum SCC size is 10000.
7840 @item ira-max-loops-num
7841 IRA uses a regional register allocation by default.  If a function
7842 contains loops more than number given by the parameter, only at most
7843 given number of the most frequently executed loops will form regions
7844 for the regional register allocation.  The default value of the
7845 parameter is 100.
7847 @item ira-max-conflict-table-size
7848 Although IRA uses a sophisticated algorithm of compression conflict
7849 table, the table can be still big for huge functions.  If the conflict
7850 table for a function could be more than size in MB given by the
7851 parameter, the conflict table is not built and faster, simpler, and
7852 lower quality register allocation algorithm will be used.  The
7853 algorithm do not use pseudo-register conflicts.  The default value of
7854 the parameter is 2000.
7856 @item loop-invariant-max-bbs-in-loop
7857 Loop invariant motion can be very expensive, both in compile time and
7858 in amount of needed compile time memory, with very large loops.  Loops
7859 with more basic blocks than this parameter won't have loop invariant
7860 motion optimization performed on them.  The default value of the
7861 parameter is 1000 for -O1 and 10000 for -O2 and above.
7863 @end table
7864 @end table
7866 @node Preprocessor Options
7867 @section Options Controlling the Preprocessor
7868 @cindex preprocessor options
7869 @cindex options, preprocessor
7871 These options control the C preprocessor, which is run on each C source
7872 file before actual compilation.
7874 If you use the @option{-E} option, nothing is done except preprocessing.
7875 Some of these options make sense only together with @option{-E} because
7876 they cause the preprocessor output to be unsuitable for actual
7877 compilation.
7879 @table @gcctabopt
7880 @opindex Wp
7881 You can use @option{-Wp,@var{option}} to bypass the compiler driver
7882 and pass @var{option} directly through to the preprocessor.  If
7883 @var{option} contains commas, it is split into multiple options at the
7884 commas.  However, many options are modified, translated or interpreted
7885 by the compiler driver before being passed to the preprocessor, and
7886 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
7887 interface is undocumented and subject to change, so whenever possible
7888 you should avoid using @option{-Wp} and let the driver handle the
7889 options instead.
7891 @item -Xpreprocessor @var{option}
7892 @opindex preprocessor
7893 Pass @var{option} as an option to the preprocessor.  You can use this to
7894 supply system-specific preprocessor options which GCC does not know how to
7895 recognize.
7897 If you want to pass an option that takes an argument, you must use
7898 @option{-Xpreprocessor} twice, once for the option and once for the argument.
7899 @end table
7901 @include cppopts.texi
7903 @node Assembler Options
7904 @section Passing Options to the Assembler
7906 @c prevent bad page break with this line
7907 You can pass options to the assembler.
7909 @table @gcctabopt
7910 @item -Wa,@var{option}
7911 @opindex Wa
7912 Pass @var{option} as an option to the assembler.  If @var{option}
7913 contains commas, it is split into multiple options at the commas.
7915 @item -Xassembler @var{option}
7916 @opindex Xassembler
7917 Pass @var{option} as an option to the assembler.  You can use this to
7918 supply system-specific assembler options which GCC does not know how to
7919 recognize.
7921 If you want to pass an option that takes an argument, you must use
7922 @option{-Xassembler} twice, once for the option and once for the argument.
7924 @end table
7926 @node Link Options
7927 @section Options for Linking
7928 @cindex link options
7929 @cindex options, linking
7931 These options come into play when the compiler links object files into
7932 an executable output file.  They are meaningless if the compiler is
7933 not doing a link step.
7935 @table @gcctabopt
7936 @cindex file names
7937 @item @var{object-file-name}
7938 A file name that does not end in a special recognized suffix is
7939 considered to name an object file or library.  (Object files are
7940 distinguished from libraries by the linker according to the file
7941 contents.)  If linking is done, these object files are used as input
7942 to the linker.
7944 @item -c
7945 @itemx -S
7946 @itemx -E
7947 @opindex c
7948 @opindex S
7949 @opindex E
7950 If any of these options is used, then the linker is not run, and
7951 object file names should not be used as arguments.  @xref{Overall
7952 Options}.
7954 @cindex Libraries
7955 @item -l@var{library}
7956 @itemx -l @var{library}
7957 @opindex l
7958 Search the library named @var{library} when linking.  (The second
7959 alternative with the library as a separate argument is only for
7960 POSIX compliance and is not recommended.)
7962 It makes a difference where in the command you write this option; the
7963 linker searches and processes libraries and object files in the order they
7964 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
7965 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
7966 to functions in @samp{z}, those functions may not be loaded.
7968 The linker searches a standard list of directories for the library,
7969 which is actually a file named @file{lib@var{library}.a}.  The linker
7970 then uses this file as if it had been specified precisely by name.
7972 The directories searched include several standard system directories
7973 plus any that you specify with @option{-L}.
7975 Normally the files found this way are library files---archive files
7976 whose members are object files.  The linker handles an archive file by
7977 scanning through it for members which define symbols that have so far
7978 been referenced but not defined.  But if the file that is found is an
7979 ordinary object file, it is linked in the usual fashion.  The only
7980 difference between using an @option{-l} option and specifying a file name
7981 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
7982 and searches several directories.
7984 @item -lobjc
7985 @opindex lobjc
7986 You need this special case of the @option{-l} option in order to
7987 link an Objective-C or Objective-C++ program.
7989 @item -nostartfiles
7990 @opindex nostartfiles
7991 Do not use the standard system startup files when linking.
7992 The standard system libraries are used normally, unless @option{-nostdlib}
7993 or @option{-nodefaultlibs} is used.
7995 @item -nodefaultlibs
7996 @opindex nodefaultlibs
7997 Do not use the standard system libraries when linking.
7998 Only the libraries you specify will be passed to the linker.
7999 The standard startup files are used normally, unless @option{-nostartfiles}
8000 is used.  The compiler may generate calls to @code{memcmp},
8001 @code{memset}, @code{memcpy} and @code{memmove}.
8002 These entries are usually resolved by entries in
8003 libc.  These entry points should be supplied through some other
8004 mechanism when this option is specified.
8006 @item -nostdlib
8007 @opindex nostdlib
8008 Do not use the standard system startup files or libraries when linking.
8009 No startup files and only the libraries you specify will be passed to
8010 the linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
8011 @code{memcpy} and @code{memmove}.
8012 These entries are usually resolved by entries in
8013 libc.  These entry points should be supplied through some other
8014 mechanism when this option is specified.
8016 @cindex @option{-lgcc}, use with @option{-nostdlib}
8017 @cindex @option{-nostdlib} and unresolved references
8018 @cindex unresolved references and @option{-nostdlib}
8019 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
8020 @cindex @option{-nodefaultlibs} and unresolved references
8021 @cindex unresolved references and @option{-nodefaultlibs}
8022 One of the standard libraries bypassed by @option{-nostdlib} and
8023 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
8024 that GCC uses to overcome shortcomings of particular machines, or special
8025 needs for some languages.
8026 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
8027 Collection (GCC) Internals},
8028 for more discussion of @file{libgcc.a}.)
8029 In most cases, you need @file{libgcc.a} even when you want to avoid
8030 other standard libraries.  In other words, when you specify @option{-nostdlib}
8031 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
8032 This ensures that you have no unresolved references to internal GCC
8033 library subroutines.  (For example, @samp{__main}, used to ensure C++
8034 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
8035 GNU Compiler Collection (GCC) Internals}.)
8037 @item -pie
8038 @opindex pie
8039 Produce a position independent executable on targets which support it.
8040 For predictable results, you must also specify the same set of options
8041 that were used to generate code (@option{-fpie}, @option{-fPIE},
8042 or model suboptions) when you specify this option.
8044 @item -rdynamic
8045 @opindex rdynamic
8046 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
8047 that support it. This instructs the linker to add all symbols, not
8048 only used ones, to the dynamic symbol table. This option is needed
8049 for some uses of @code{dlopen} or to allow obtaining backtraces
8050 from within a program.
8052 @item -s
8053 @opindex s
8054 Remove all symbol table and relocation information from the executable.
8056 @item -static
8057 @opindex static
8058 On systems that support dynamic linking, this prevents linking with the shared
8059 libraries.  On other systems, this option has no effect.
8061 @item -shared
8062 @opindex shared
8063 Produce a shared object which can then be linked with other objects to
8064 form an executable.  Not all systems support this option.  For predictable
8065 results, you must also specify the same set of options that were used to
8066 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
8067 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
8068 needs to build supplementary stub code for constructors to work.  On
8069 multi-libbed systems, @samp{gcc -shared} must select the correct support
8070 libraries to link against.  Failing to supply the correct flags may lead
8071 to subtle defects.  Supplying them in cases where they are not necessary
8072 is innocuous.}
8074 @item -shared-libgcc
8075 @itemx -static-libgcc
8076 @opindex shared-libgcc
8077 @opindex static-libgcc
8078 On systems that provide @file{libgcc} as a shared library, these options
8079 force the use of either the shared or static version respectively.
8080 If no shared version of @file{libgcc} was built when the compiler was
8081 configured, these options have no effect.
8083 There are several situations in which an application should use the
8084 shared @file{libgcc} instead of the static version.  The most common
8085 of these is when the application wishes to throw and catch exceptions
8086 across different shared libraries.  In that case, each of the libraries
8087 as well as the application itself should use the shared @file{libgcc}.
8089 Therefore, the G++ and GCJ drivers automatically add
8090 @option{-shared-libgcc} whenever you build a shared library or a main
8091 executable, because C++ and Java programs typically use exceptions, so
8092 this is the right thing to do.
8094 If, instead, you use the GCC driver to create shared libraries, you may
8095 find that they will not always be linked with the shared @file{libgcc}.
8096 If GCC finds, at its configuration time, that you have a non-GNU linker
8097 or a GNU linker that does not support option @option{--eh-frame-hdr},
8098 it will link the shared version of @file{libgcc} into shared libraries
8099 by default.  Otherwise, it will take advantage of the linker and optimize
8100 away the linking with the shared version of @file{libgcc}, linking with
8101 the static version of libgcc by default.  This allows exceptions to
8102 propagate through such shared libraries, without incurring relocation
8103 costs at library load time.
8105 However, if a library or main executable is supposed to throw or catch
8106 exceptions, you must link it using the G++ or GCJ driver, as appropriate
8107 for the languages used in the program, or using the option
8108 @option{-shared-libgcc}, such that it is linked with the shared
8109 @file{libgcc}.
8111 @item -symbolic
8112 @opindex symbolic
8113 Bind references to global symbols when building a shared object.  Warn
8114 about any unresolved references (unless overridden by the link editor
8115 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
8116 this option.
8118 @item -T @var{script}
8119 @opindex T
8120 @cindex linker script
8121 Use @var{script} as the linker script.  This option is supported by most
8122 systems using the GNU linker.  On some targets, such as bare-board
8123 targets without an operating system, the @option{-T} option may be required 
8124 when linking to avoid references to undefined symbols.
8126 @item -Xlinker @var{option}
8127 @opindex Xlinker
8128 Pass @var{option} as an option to the linker.  You can use this to
8129 supply system-specific linker options which GCC does not know how to
8130 recognize.
8132 If you want to pass an option that takes a separate argument, you must use
8133 @option{-Xlinker} twice, once for the option and once for the argument.
8134 For example, to pass @option{-assert definitions}, you must write
8135 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
8136 @option{-Xlinker "-assert definitions"}, because this passes the entire
8137 string as a single argument, which is not what the linker expects.
8139 When using the GNU linker, it is usually more convenient to pass 
8140 arguments to linker options using the @option{@var{option}=@var{value}}
8141 syntax than as separate arguments.  For example, you can specify
8142 @samp{-Xlinker -Map=output.map} rather than
8143 @samp{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
8144 this syntax for command-line options.
8146 @item -Wl,@var{option}
8147 @opindex Wl
8148 Pass @var{option} as an option to the linker.  If @var{option} contains
8149 commas, it is split into multiple options at the commas.  You can use this
8150 syntax to pass an argument to the option.  
8151 For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
8152 linker.  When using the GNU linker, you can also get the same effect with
8153 @samp{-Wl,-Map=output.map}.
8155 @item -u @var{symbol}
8156 @opindex u
8157 Pretend the symbol @var{symbol} is undefined, to force linking of
8158 library modules to define it.  You can use @option{-u} multiple times with
8159 different symbols to force loading of additional library modules.
8160 @end table
8162 @node Directory Options
8163 @section Options for Directory Search
8164 @cindex directory options
8165 @cindex options, directory search
8166 @cindex search path
8168 These options specify directories to search for header files, for
8169 libraries and for parts of the compiler:
8171 @table @gcctabopt
8172 @item -I@var{dir}
8173 @opindex I
8174 Add the directory @var{dir} to the head of the list of directories to be
8175 searched for header files.  This can be used to override a system header
8176 file, substituting your own version, since these directories are
8177 searched before the system header file directories.  However, you should
8178 not use this option to add directories that contain vendor-supplied
8179 system header files (use @option{-isystem} for that).  If you use more than
8180 one @option{-I} option, the directories are scanned in left-to-right
8181 order; the standard system directories come after.
8183 If a standard system include directory, or a directory specified with
8184 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
8185 option will be ignored.  The directory will still be searched but as a
8186 system directory at its normal position in the system include chain.
8187 This is to ensure that GCC's procedure to fix buggy system headers and
8188 the ordering for the include_next directive are not inadvertently changed.
8189 If you really need to change the search order for system directories,
8190 use the @option{-nostdinc} and/or @option{-isystem} options.
8192 @item -iquote@var{dir}
8193 @opindex iquote
8194 Add the directory @var{dir} to the head of the list of directories to
8195 be searched for header files only for the case of @samp{#include
8196 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
8197 otherwise just like @option{-I}.
8199 @item -L@var{dir}
8200 @opindex L
8201 Add directory @var{dir} to the list of directories to be searched
8202 for @option{-l}.
8204 @item -B@var{prefix}
8205 @opindex B
8206 This option specifies where to find the executables, libraries,
8207 include files, and data files of the compiler itself.
8209 The compiler driver program runs one or more of the subprograms
8210 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
8211 @var{prefix} as a prefix for each program it tries to run, both with and
8212 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
8214 For each subprogram to be run, the compiler driver first tries the
8215 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
8216 was not specified, the driver tries two standard prefixes, which are
8217 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
8218 those results in a file name that is found, the unmodified program
8219 name is searched for using the directories specified in your
8220 @env{PATH} environment variable.
8222 The compiler will check to see if the path provided by the @option{-B}
8223 refers to a directory, and if necessary it will add a directory
8224 separator character at the end of the path.
8226 @option{-B} prefixes that effectively specify directory names also apply
8227 to libraries in the linker, because the compiler translates these
8228 options into @option{-L} options for the linker.  They also apply to
8229 includes files in the preprocessor, because the compiler translates these
8230 options into @option{-isystem} options for the preprocessor.  In this case,
8231 the compiler appends @samp{include} to the prefix.
8233 The run-time support file @file{libgcc.a} can also be searched for using
8234 the @option{-B} prefix, if needed.  If it is not found there, the two
8235 standard prefixes above are tried, and that is all.  The file is left
8236 out of the link if it is not found by those means.
8238 Another way to specify a prefix much like the @option{-B} prefix is to use
8239 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
8240 Variables}.
8242 As a special kludge, if the path provided by @option{-B} is
8243 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
8244 9, then it will be replaced by @file{[dir/]include}.  This is to help
8245 with boot-strapping the compiler.
8247 @item -specs=@var{file}
8248 @opindex specs
8249 Process @var{file} after the compiler reads in the standard @file{specs}
8250 file, in order to override the defaults that the @file{gcc} driver
8251 program uses when determining what switches to pass to @file{cc1},
8252 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
8253 @option{-specs=@var{file}} can be specified on the command line, and they
8254 are processed in order, from left to right.
8256 @item --sysroot=@var{dir}
8257 @opindex sysroot
8258 Use @var{dir} as the logical root directory for headers and libraries.
8259 For example, if the compiler would normally search for headers in
8260 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
8261 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
8263 If you use both this option and the @option{-isysroot} option, then
8264 the @option{--sysroot} option will apply to libraries, but the
8265 @option{-isysroot} option will apply to header files.
8267 The GNU linker (beginning with version 2.16) has the necessary support
8268 for this option.  If your linker does not support this option, the
8269 header file aspect of @option{--sysroot} will still work, but the
8270 library aspect will not.
8272 @item -I-
8273 @opindex I-
8274 This option has been deprecated.  Please use @option{-iquote} instead for
8275 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
8276 Any directories you specify with @option{-I} options before the @option{-I-}
8277 option are searched only for the case of @samp{#include "@var{file}"};
8278 they are not searched for @samp{#include <@var{file}>}.
8280 If additional directories are specified with @option{-I} options after
8281 the @option{-I-}, these directories are searched for all @samp{#include}
8282 directives.  (Ordinarily @emph{all} @option{-I} directories are used
8283 this way.)
8285 In addition, the @option{-I-} option inhibits the use of the current
8286 directory (where the current input file came from) as the first search
8287 directory for @samp{#include "@var{file}"}.  There is no way to
8288 override this effect of @option{-I-}.  With @option{-I.} you can specify
8289 searching the directory which was current when the compiler was
8290 invoked.  That is not exactly the same as what the preprocessor does
8291 by default, but it is often satisfactory.
8293 @option{-I-} does not inhibit the use of the standard system directories
8294 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
8295 independent.
8296 @end table
8298 @c man end
8300 @node Spec Files
8301 @section Specifying subprocesses and the switches to pass to them
8302 @cindex Spec Files
8304 @command{gcc} is a driver program.  It performs its job by invoking a
8305 sequence of other programs to do the work of compiling, assembling and
8306 linking.  GCC interprets its command-line parameters and uses these to
8307 deduce which programs it should invoke, and which command-line options
8308 it ought to place on their command lines.  This behavior is controlled
8309 by @dfn{spec strings}.  In most cases there is one spec string for each
8310 program that GCC can invoke, but a few programs have multiple spec
8311 strings to control their behavior.  The spec strings built into GCC can
8312 be overridden by using the @option{-specs=} command-line switch to specify
8313 a spec file.
8315 @dfn{Spec files} are plaintext files that are used to construct spec
8316 strings.  They consist of a sequence of directives separated by blank
8317 lines.  The type of directive is determined by the first non-whitespace
8318 character on the line and it can be one of the following:
8320 @table @code
8321 @item %@var{command}
8322 Issues a @var{command} to the spec file processor.  The commands that can
8323 appear here are:
8325 @table @code
8326 @item %include <@var{file}>
8327 @cindex %include
8328 Search for @var{file} and insert its text at the current point in the
8329 specs file.
8331 @item %include_noerr <@var{file}>
8332 @cindex %include_noerr
8333 Just like @samp{%include}, but do not generate an error message if the include
8334 file cannot be found.
8336 @item %rename @var{old_name} @var{new_name}
8337 @cindex %rename
8338 Rename the spec string @var{old_name} to @var{new_name}.
8340 @end table
8342 @item *[@var{spec_name}]:
8343 This tells the compiler to create, override or delete the named spec
8344 string.  All lines after this directive up to the next directive or
8345 blank line are considered to be the text for the spec string.  If this
8346 results in an empty string then the spec will be deleted.  (Or, if the
8347 spec did not exist, then nothing will happened.)  Otherwise, if the spec
8348 does not currently exist a new spec will be created.  If the spec does
8349 exist then its contents will be overridden by the text of this
8350 directive, unless the first character of that text is the @samp{+}
8351 character, in which case the text will be appended to the spec.
8353 @item [@var{suffix}]:
8354 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
8355 and up to the next directive or blank line are considered to make up the
8356 spec string for the indicated suffix.  When the compiler encounters an
8357 input file with the named suffix, it will processes the spec string in
8358 order to work out how to compile that file.  For example:
8360 @smallexample
8361 .ZZ:
8362 z-compile -input %i
8363 @end smallexample
8365 This says that any input file whose name ends in @samp{.ZZ} should be
8366 passed to the program @samp{z-compile}, which should be invoked with the
8367 command-line switch @option{-input} and with the result of performing the
8368 @samp{%i} substitution.  (See below.)
8370 As an alternative to providing a spec string, the text that follows a
8371 suffix directive can be one of the following:
8373 @table @code
8374 @item @@@var{language}
8375 This says that the suffix is an alias for a known @var{language}.  This is
8376 similar to using the @option{-x} command-line switch to GCC to specify a
8377 language explicitly.  For example:
8379 @smallexample
8380 .ZZ:
8381 @@c++
8382 @end smallexample
8384 Says that .ZZ files are, in fact, C++ source files.
8386 @item #@var{name}
8387 This causes an error messages saying:
8389 @smallexample
8390 @var{name} compiler not installed on this system.
8391 @end smallexample
8392 @end table
8394 GCC already has an extensive list of suffixes built into it.
8395 This directive will add an entry to the end of the list of suffixes, but
8396 since the list is searched from the end backwards, it is effectively
8397 possible to override earlier entries using this technique.
8399 @end table
8401 GCC has the following spec strings built into it.  Spec files can
8402 override these strings or create their own.  Note that individual
8403 targets can also add their own spec strings to this list.
8405 @smallexample
8406 asm          Options to pass to the assembler
8407 asm_final    Options to pass to the assembler post-processor
8408 cpp          Options to pass to the C preprocessor
8409 cc1          Options to pass to the C compiler
8410 cc1plus      Options to pass to the C++ compiler
8411 endfile      Object files to include at the end of the link
8412 link         Options to pass to the linker
8413 lib          Libraries to include on the command line to the linker
8414 libgcc       Decides which GCC support library to pass to the linker
8415 linker       Sets the name of the linker
8416 predefines   Defines to be passed to the C preprocessor
8417 signed_char  Defines to pass to CPP to say whether @code{char} is signed
8418              by default
8419 startfile    Object files to include at the start of the link
8420 @end smallexample
8422 Here is a small example of a spec file:
8424 @smallexample
8425 %rename lib                 old_lib
8427 *lib:
8428 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
8429 @end smallexample
8431 This example renames the spec called @samp{lib} to @samp{old_lib} and
8432 then overrides the previous definition of @samp{lib} with a new one.
8433 The new definition adds in some extra command-line options before
8434 including the text of the old definition.
8436 @dfn{Spec strings} are a list of command-line options to be passed to their
8437 corresponding program.  In addition, the spec strings can contain
8438 @samp{%}-prefixed sequences to substitute variable text or to
8439 conditionally insert text into the command line.  Using these constructs
8440 it is possible to generate quite complex command lines.
8442 Here is a table of all defined @samp{%}-sequences for spec
8443 strings.  Note that spaces are not generated automatically around the
8444 results of expanding these sequences.  Therefore you can concatenate them
8445 together or combine them with constant text in a single argument.
8447 @table @code
8448 @item %%
8449 Substitute one @samp{%} into the program name or argument.
8451 @item %i
8452 Substitute the name of the input file being processed.
8454 @item %b
8455 Substitute the basename of the input file being processed.
8456 This is the substring up to (and not including) the last period
8457 and not including the directory.
8459 @item %B
8460 This is the same as @samp{%b}, but include the file suffix (text after
8461 the last period).
8463 @item %d
8464 Marks the argument containing or following the @samp{%d} as a
8465 temporary file name, so that that file will be deleted if GCC exits
8466 successfully.  Unlike @samp{%g}, this contributes no text to the
8467 argument.
8469 @item %g@var{suffix}
8470 Substitute a file name that has suffix @var{suffix} and is chosen
8471 once per compilation, and mark the argument in the same way as
8472 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
8473 name is now chosen in a way that is hard to predict even when previously
8474 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
8475 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
8476 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
8477 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
8478 was simply substituted with a file name chosen once per compilation,
8479 without regard to any appended suffix (which was therefore treated
8480 just like ordinary text), making such attacks more likely to succeed.
8482 @item %u@var{suffix}
8483 Like @samp{%g}, but generates a new temporary file name even if
8484 @samp{%u@var{suffix}} was already seen.
8486 @item %U@var{suffix}
8487 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
8488 new one if there is no such last file name.  In the absence of any
8489 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
8490 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
8491 would involve the generation of two distinct file names, one
8492 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
8493 simply substituted with a file name chosen for the previous @samp{%u},
8494 without regard to any appended suffix.
8496 @item %j@var{suffix}
8497 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
8498 writable, and if save-temps is off; otherwise, substitute the name
8499 of a temporary file, just like @samp{%u}.  This temporary file is not
8500 meant for communication between processes, but rather as a junk
8501 disposal mechanism.
8503 @item %|@var{suffix}
8504 @itemx %m@var{suffix}
8505 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
8506 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
8507 all.  These are the two most common ways to instruct a program that it
8508 should read from standard input or write to standard output.  If you
8509 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
8510 construct: see for example @file{f/lang-specs.h}.
8512 @item %.@var{SUFFIX}
8513 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
8514 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
8515 terminated by the next space or %.
8517 @item %w
8518 Marks the argument containing or following the @samp{%w} as the
8519 designated output file of this compilation.  This puts the argument
8520 into the sequence of arguments that @samp{%o} will substitute later.
8522 @item %o
8523 Substitutes the names of all the output files, with spaces
8524 automatically placed around them.  You should write spaces
8525 around the @samp{%o} as well or the results are undefined.
8526 @samp{%o} is for use in the specs for running the linker.
8527 Input files whose names have no recognized suffix are not compiled
8528 at all, but they are included among the output files, so they will
8529 be linked.
8531 @item %O
8532 Substitutes the suffix for object files.  Note that this is
8533 handled specially when it immediately follows @samp{%g, %u, or %U},
8534 because of the need for those to form complete file names.  The
8535 handling is such that @samp{%O} is treated exactly as if it had already
8536 been substituted, except that @samp{%g, %u, and %U} do not currently
8537 support additional @var{suffix} characters following @samp{%O} as they would
8538 following, for example, @samp{.o}.
8540 @item %p
8541 Substitutes the standard macro predefinitions for the
8542 current target machine.  Use this when running @code{cpp}.
8544 @item %P
8545 Like @samp{%p}, but puts @samp{__} before and after the name of each
8546 predefined macro, except for macros that start with @samp{__} or with
8547 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
8550 @item %I
8551 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
8552 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
8553 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
8554 and @option{-imultilib} as necessary.
8556 @item %s
8557 Current argument is the name of a library or startup file of some sort.
8558 Search for that file in a standard list of directories and substitute
8559 the full name found.
8561 @item %e@var{str}
8562 Print @var{str} as an error message.  @var{str} is terminated by a newline.
8563 Use this when inconsistent options are detected.
8565 @item %(@var{name})
8566 Substitute the contents of spec string @var{name} at this point.
8568 @item %[@var{name}]
8569 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
8571 @item %x@{@var{option}@}
8572 Accumulate an option for @samp{%X}.
8574 @item %X
8575 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
8576 spec string.
8578 @item %Y
8579 Output the accumulated assembler options specified by @option{-Wa}.
8581 @item %Z
8582 Output the accumulated preprocessor options specified by @option{-Wp}.
8584 @item %a
8585 Process the @code{asm} spec.  This is used to compute the
8586 switches to be passed to the assembler.
8588 @item %A
8589 Process the @code{asm_final} spec.  This is a spec string for
8590 passing switches to an assembler post-processor, if such a program is
8591 needed.
8593 @item %l
8594 Process the @code{link} spec.  This is the spec for computing the
8595 command line passed to the linker.  Typically it will make use of the
8596 @samp{%L %G %S %D and %E} sequences.
8598 @item %D
8599 Dump out a @option{-L} option for each directory that GCC believes might
8600 contain startup files.  If the target supports multilibs then the
8601 current multilib directory will be prepended to each of these paths.
8603 @item %L
8604 Process the @code{lib} spec.  This is a spec string for deciding which
8605 libraries should be included on the command line to the linker.
8607 @item %G
8608 Process the @code{libgcc} spec.  This is a spec string for deciding
8609 which GCC support library should be included on the command line to the linker.
8611 @item %S
8612 Process the @code{startfile} spec.  This is a spec for deciding which
8613 object files should be the first ones passed to the linker.  Typically
8614 this might be a file named @file{crt0.o}.
8616 @item %E
8617 Process the @code{endfile} spec.  This is a spec string that specifies
8618 the last object files that will be passed to the linker.
8620 @item %C
8621 Process the @code{cpp} spec.  This is used to construct the arguments
8622 to be passed to the C preprocessor.
8624 @item %1
8625 Process the @code{cc1} spec.  This is used to construct the options to be
8626 passed to the actual C compiler (@samp{cc1}).
8628 @item %2
8629 Process the @code{cc1plus} spec.  This is used to construct the options to be
8630 passed to the actual C++ compiler (@samp{cc1plus}).
8632 @item %*
8633 Substitute the variable part of a matched option.  See below.
8634 Note that each comma in the substituted string is replaced by
8635 a single space.
8637 @item %<@code{S}
8638 Remove all occurrences of @code{-S} from the command line.  Note---this
8639 command is position dependent.  @samp{%} commands in the spec string
8640 before this one will see @code{-S}, @samp{%} commands in the spec string
8641 after this one will not.
8643 @item %:@var{function}(@var{args})
8644 Call the named function @var{function}, passing it @var{args}.
8645 @var{args} is first processed as a nested spec string, then split
8646 into an argument vector in the usual fashion.  The function returns
8647 a string which is processed as if it had appeared literally as part
8648 of the current spec.
8650 The following built-in spec functions are provided:
8652 @table @code
8653 @item @code{getenv}
8654 The @code{getenv} spec function takes two arguments: an environment
8655 variable name and a string.  If the environment variable is not
8656 defined, a fatal error is issued.  Otherwise, the return value is the
8657 value of the environment variable concatenated with the string.  For
8658 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
8660 @smallexample
8661 %:getenv(TOPDIR /include)
8662 @end smallexample
8664 expands to @file{/path/to/top/include}.
8666 @item @code{if-exists}
8667 The @code{if-exists} spec function takes one argument, an absolute
8668 pathname to a file.  If the file exists, @code{if-exists} returns the
8669 pathname.  Here is a small example of its usage:
8671 @smallexample
8672 *startfile:
8673 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
8674 @end smallexample
8676 @item @code{if-exists-else}
8677 The @code{if-exists-else} spec function is similar to the @code{if-exists}
8678 spec function, except that it takes two arguments.  The first argument is
8679 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
8680 returns the pathname.  If it does not exist, it returns the second argument.
8681 This way, @code{if-exists-else} can be used to select one file or another,
8682 based on the existence of the first.  Here is a small example of its usage:
8684 @smallexample
8685 *startfile:
8686 crt0%O%s %:if-exists(crti%O%s) \
8687 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
8688 @end smallexample
8690 @item @code{replace-outfile}
8691 The @code{replace-outfile} spec function takes two arguments.  It looks for the
8692 first argument in the outfiles array and replaces it with the second argument.  Here
8693 is a small example of its usage:
8695 @smallexample
8696 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
8697 @end smallexample
8699 @item @code{print-asm-header}
8700 The @code{print-asm-header} function takes no arguments and simply
8701 prints a banner like:
8703 @smallexample
8704 Assembler options
8705 =================
8707 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
8708 @end smallexample
8710 It is used to separate compiler options from assembler options
8711 in the @option{--target-help} output.
8712 @end table
8714 @item %@{@code{S}@}
8715 Substitutes the @code{-S} switch, if that switch was given to GCC@.
8716 If that switch was not specified, this substitutes nothing.  Note that
8717 the leading dash is omitted when specifying this option, and it is
8718 automatically inserted if the substitution is performed.  Thus the spec
8719 string @samp{%@{foo@}} would match the command-line option @option{-foo}
8720 and would output the command line option @option{-foo}.
8722 @item %W@{@code{S}@}
8723 Like %@{@code{S}@} but mark last argument supplied within as a file to be
8724 deleted on failure.
8726 @item %@{@code{S}*@}
8727 Substitutes all the switches specified to GCC whose names start
8728 with @code{-S}, but which also take an argument.  This is used for
8729 switches like @option{-o}, @option{-D}, @option{-I}, etc.
8730 GCC considers @option{-o foo} as being
8731 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
8732 text, including the space.  Thus two arguments would be generated.
8734 @item %@{@code{S}*&@code{T}*@}
8735 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
8736 (the order of @code{S} and @code{T} in the spec is not significant).
8737 There can be any number of ampersand-separated variables; for each the
8738 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
8740 @item %@{@code{S}:@code{X}@}
8741 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
8743 @item %@{!@code{S}:@code{X}@}
8744 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
8746 @item %@{@code{S}*:@code{X}@}
8747 Substitutes @code{X} if one or more switches whose names start with
8748 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
8749 once, no matter how many such switches appeared.  However, if @code{%*}
8750 appears somewhere in @code{X}, then @code{X} will be substituted once
8751 for each matching switch, with the @code{%*} replaced by the part of
8752 that switch that matched the @code{*}.
8754 @item %@{.@code{S}:@code{X}@}
8755 Substitutes @code{X}, if processing a file with suffix @code{S}.
8757 @item %@{!.@code{S}:@code{X}@}
8758 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
8760 @item %@{,@code{S}:@code{X}@}
8761 Substitutes @code{X}, if processing a file for language @code{S}.
8763 @item %@{!,@code{S}:@code{X}@}
8764 Substitutes @code{X}, if not processing a file for language @code{S}.
8766 @item %@{@code{S}|@code{P}:@code{X}@}
8767 Substitutes @code{X} if either @code{-S} or @code{-P} was given to
8768 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
8769 @code{*} sequences as well, although they have a stronger binding than
8770 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
8771 alternatives must be starred, and only the first matching alternative
8772 is substituted.
8774 For example, a spec string like this:
8776 @smallexample
8777 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
8778 @end smallexample
8780 will output the following command-line options from the following input
8781 command-line options:
8783 @smallexample
8784 fred.c        -foo -baz
8785 jim.d         -bar -boggle
8786 -d fred.c     -foo -baz -boggle
8787 -d jim.d      -bar -baz -boggle
8788 @end smallexample
8790 @item %@{S:X; T:Y; :D@}
8792 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
8793 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
8794 be as many clauses as you need.  This may be combined with @code{.},
8795 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
8798 @end table
8800 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
8801 construct may contain other nested @samp{%} constructs or spaces, or
8802 even newlines.  They are processed as usual, as described above.
8803 Trailing white space in @code{X} is ignored.  White space may also
8804 appear anywhere on the left side of the colon in these constructs,
8805 except between @code{.} or @code{*} and the corresponding word.
8807 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
8808 handled specifically in these constructs.  If another value of
8809 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
8810 @option{-W} switch is found later in the command line, the earlier
8811 switch value is ignored, except with @{@code{S}*@} where @code{S} is
8812 just one letter, which passes all matching options.
8814 The character @samp{|} at the beginning of the predicate text is used to
8815 indicate that a command should be piped to the following command, but
8816 only if @option{-pipe} is specified.
8818 It is built into GCC which switches take arguments and which do not.
8819 (You might think it would be useful to generalize this to allow each
8820 compiler's spec to say which switches take arguments.  But this cannot
8821 be done in a consistent fashion.  GCC cannot even decide which input
8822 files have been specified without knowing which switches take arguments,
8823 and it must know which input files to compile in order to tell which
8824 compilers to run).
8826 GCC also knows implicitly that arguments starting in @option{-l} are to be
8827 treated as compiler output files, and passed to the linker in their
8828 proper position among the other output files.
8830 @c man begin OPTIONS
8832 @node Target Options
8833 @section Specifying Target Machine and Compiler Version
8834 @cindex target options
8835 @cindex cross compiling
8836 @cindex specifying machine version
8837 @cindex specifying compiler version and target machine
8838 @cindex compiler version, specifying
8839 @cindex target machine, specifying
8841 The usual way to run GCC is to run the executable called @file{gcc}, or
8842 @file{<machine>-gcc} when cross-compiling, or
8843 @file{<machine>-gcc-<version>} to run a version other than the one that
8844 was installed last.  Sometimes this is inconvenient, so GCC provides
8845 options that will switch to another cross-compiler or version.
8847 @table @gcctabopt
8848 @item -b @var{machine}
8849 @opindex b
8850 The argument @var{machine} specifies the target machine for compilation.
8852 The value to use for @var{machine} is the same as was specified as the
8853 machine type when configuring GCC as a cross-compiler.  For
8854 example, if a cross-compiler was configured with @samp{configure
8855 arm-elf}, meaning to compile for an arm processor with elf binaries,
8856 then you would specify @option{-b arm-elf} to run that cross compiler.
8857 Because there are other options beginning with @option{-b}, the
8858 configuration must contain a hyphen, or @option{-b} alone should be one
8859 argument followed by the configuration in the next argument.
8861 @item -V @var{version}
8862 @opindex V
8863 The argument @var{version} specifies which version of GCC to run.
8864 This is useful when multiple versions are installed.  For example,
8865 @var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
8866 @end table
8868 The @option{-V} and @option{-b} options work by running the
8869 @file{<machine>-gcc-<version>} executable, so there's no real reason to
8870 use them if you can just run that directly.
8872 @node Submodel Options
8873 @section Hardware Models and Configurations
8874 @cindex submodel options
8875 @cindex specifying hardware config
8876 @cindex hardware models and configurations, specifying
8877 @cindex machine dependent options
8879 Earlier we discussed the standard option @option{-b} which chooses among
8880 different installed compilers for completely different target
8881 machines, such as VAX vs.@: 68000 vs.@: 80386.
8883 In addition, each of these target machine types can have its own
8884 special options, starting with @samp{-m}, to choose among various
8885 hardware models or configurations---for example, 68010 vs 68020,
8886 floating coprocessor or none.  A single installed version of the
8887 compiler can compile for any model or configuration, according to the
8888 options specified.
8890 Some configurations of the compiler also support additional special
8891 options, usually for compatibility with other compilers on the same
8892 platform.
8894 @c This list is ordered alphanumerically by subsection name.
8895 @c It should be the same order and spelling as these options are listed
8896 @c in Machine Dependent Options
8898 @menu
8899 * ARC Options::
8900 * ARM Options::
8901 * AVR Options::
8902 * Blackfin Options::
8903 * CRIS Options::
8904 * CRX Options::
8905 * Darwin Options::
8906 * DEC Alpha Options::
8907 * DEC Alpha/VMS Options::
8908 * FR30 Options::
8909 * FRV Options::
8910 * GNU/Linux Options::
8911 * H8/300 Options::
8912 * HPPA Options::
8913 * i386 and x86-64 Options::
8914 * i386 and x86-64 Windows Options::
8915 * IA-64 Options::
8916 * M32C Options::
8917 * M32R/D Options::
8918 * M680x0 Options::
8919 * M68hc1x Options::
8920 * MCore Options::
8921 * MIPS Options::
8922 * MMIX Options::
8923 * MN10300 Options::
8924 * PDP-11 Options::
8925 * picoChip Options::
8926 * PowerPC Options::
8927 * RS/6000 and PowerPC Options::
8928 * S/390 and zSeries Options::
8929 * Score Options::
8930 * SH Options::
8931 * SPARC Options::
8932 * SPU Options::
8933 * System V Options::
8934 * V850 Options::
8935 * VAX Options::
8936 * VxWorks Options::
8937 * x86-64 Options::
8938 * Xstormy16 Options::
8939 * Xtensa Options::
8940 * zSeries Options::
8941 @end menu
8943 @node ARC Options
8944 @subsection ARC Options
8945 @cindex ARC Options
8947 These options are defined for ARC implementations:
8949 @table @gcctabopt
8950 @item -EL
8951 @opindex EL
8952 Compile code for little endian mode.  This is the default.
8954 @item -EB
8955 @opindex EB
8956 Compile code for big endian mode.
8958 @item -mmangle-cpu
8959 @opindex mmangle-cpu
8960 Prepend the name of the cpu to all public symbol names.
8961 In multiple-processor systems, there are many ARC variants with different
8962 instruction and register set characteristics.  This flag prevents code
8963 compiled for one cpu to be linked with code compiled for another.
8964 No facility exists for handling variants that are ``almost identical''.
8965 This is an all or nothing option.
8967 @item -mcpu=@var{cpu}
8968 @opindex mcpu
8969 Compile code for ARC variant @var{cpu}.
8970 Which variants are supported depend on the configuration.
8971 All variants support @option{-mcpu=base}, this is the default.
8973 @item -mtext=@var{text-section}
8974 @itemx -mdata=@var{data-section}
8975 @itemx -mrodata=@var{readonly-data-section}
8976 @opindex mtext
8977 @opindex mdata
8978 @opindex mrodata
8979 Put functions, data, and readonly data in @var{text-section},
8980 @var{data-section}, and @var{readonly-data-section} respectively
8981 by default.  This can be overridden with the @code{section} attribute.
8982 @xref{Variable Attributes}.
8984 @item -mfix-cortex-m3-ldrd
8985 @opindex mfix-cortex-m3-ldrd
8986 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
8987 with overlapping destination and base registers are used.  This option avoids
8988 generating these instructions.  This option is enabled by default when
8989 @option{-mcpu=cortex-m3} is specified.
8991 @end table
8993 @node ARM Options
8994 @subsection ARM Options
8995 @cindex ARM options
8997 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
8998 architectures:
9000 @table @gcctabopt
9001 @item -mabi=@var{name}
9002 @opindex mabi
9003 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
9004 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
9006 @item -mapcs-frame
9007 @opindex mapcs-frame
9008 Generate a stack frame that is compliant with the ARM Procedure Call
9009 Standard for all functions, even if this is not strictly necessary for
9010 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
9011 with this option will cause the stack frames not to be generated for
9012 leaf functions.  The default is @option{-mno-apcs-frame}.
9014 @item -mapcs
9015 @opindex mapcs
9016 This is a synonym for @option{-mapcs-frame}.
9018 @ignore
9019 @c not currently implemented
9020 @item -mapcs-stack-check
9021 @opindex mapcs-stack-check
9022 Generate code to check the amount of stack space available upon entry to
9023 every function (that actually uses some stack space).  If there is
9024 insufficient space available then either the function
9025 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
9026 called, depending upon the amount of stack space required.  The run time
9027 system is required to provide these functions.  The default is
9028 @option{-mno-apcs-stack-check}, since this produces smaller code.
9030 @c not currently implemented
9031 @item -mapcs-float
9032 @opindex mapcs-float
9033 Pass floating point arguments using the float point registers.  This is
9034 one of the variants of the APCS@.  This option is recommended if the
9035 target hardware has a floating point unit or if a lot of floating point
9036 arithmetic is going to be performed by the code.  The default is
9037 @option{-mno-apcs-float}, since integer only code is slightly increased in
9038 size if @option{-mapcs-float} is used.
9040 @c not currently implemented
9041 @item -mapcs-reentrant
9042 @opindex mapcs-reentrant
9043 Generate reentrant, position independent code.  The default is
9044 @option{-mno-apcs-reentrant}.
9045 @end ignore
9047 @item -mthumb-interwork
9048 @opindex mthumb-interwork
9049 Generate code which supports calling between the ARM and Thumb
9050 instruction sets.  Without this option the two instruction sets cannot
9051 be reliably used inside one program.  The default is
9052 @option{-mno-thumb-interwork}, since slightly larger code is generated
9053 when @option{-mthumb-interwork} is specified.
9055 @item -mno-sched-prolog
9056 @opindex mno-sched-prolog
9057 Prevent the reordering of instructions in the function prolog, or the
9058 merging of those instruction with the instructions in the function's
9059 body.  This means that all functions will start with a recognizable set
9060 of instructions (or in fact one of a choice from a small set of
9061 different function prologues), and this information can be used to
9062 locate the start if functions inside an executable piece of code.  The
9063 default is @option{-msched-prolog}.
9065 @item -mfloat-abi=@var{name}
9066 @opindex mfloat-abi
9067 Specifies which floating-point ABI to use.  Permissible values
9068 are: @samp{soft}, @samp{softfp} and @samp{hard}.
9070 Specifying @samp{soft} causes GCC to generate output containing 
9071 library calls for floating-point operations.
9072 @samp{softfp} allows the generation of code using hardware floating-point 
9073 instructions, but still uses the soft-float calling conventions.  
9074 @samp{hard} allows generation of floating-point instructions 
9075 and uses FPU-specific calling conventions.
9077 Using @option{-mfloat-abi=hard} with VFP coprocessors is not supported.
9078 Use @option{-mfloat-abi=softfp} with the appropriate @option{-mfpu} option
9079 to allow the compiler to generate code that makes use of the hardware
9080 floating-point capabilities for these CPUs.
9082 The default depends on the specific target configuration.  Note that
9083 the hard-float and soft-float ABIs are not link-compatible; you must
9084 compile your entire program with the same ABI, and link with a
9085 compatible set of libraries.
9087 @item -mhard-float
9088 @opindex mhard-float
9089 Equivalent to @option{-mfloat-abi=hard}.
9091 @item -msoft-float
9092 @opindex msoft-float
9093 Equivalent to @option{-mfloat-abi=soft}.
9095 @item -mlittle-endian
9096 @opindex mlittle-endian
9097 Generate code for a processor running in little-endian mode.  This is
9098 the default for all standard configurations.
9100 @item -mbig-endian
9101 @opindex mbig-endian
9102 Generate code for a processor running in big-endian mode; the default is
9103 to compile code for a little-endian processor.
9105 @item -mwords-little-endian
9106 @opindex mwords-little-endian
9107 This option only applies when generating code for big-endian processors.
9108 Generate code for a little-endian word order but a big-endian byte
9109 order.  That is, a byte order of the form @samp{32107654}.  Note: this
9110 option should only be used if you require compatibility with code for
9111 big-endian ARM processors generated by versions of the compiler prior to
9112 2.8.
9114 @item -mcpu=@var{name}
9115 @opindex mcpu
9116 This specifies the name of the target ARM processor.  GCC uses this name
9117 to determine what kind of instructions it can emit when generating
9118 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
9119 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
9120 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
9121 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
9122 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
9123 @samp{arm720},
9124 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
9125 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
9126 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
9127 @samp{strongarm1110},
9128 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
9129 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
9130 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
9131 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
9132 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
9133 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
9134 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
9135 @samp{cortex-a8}, @samp{cortex-a9},
9136 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m3},
9137 @samp{cortex-m1},
9138 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
9140 @item -mtune=@var{name}
9141 @opindex mtune
9142 This option is very similar to the @option{-mcpu=} option, except that
9143 instead of specifying the actual target processor type, and hence
9144 restricting which instructions can be used, it specifies that GCC should
9145 tune the performance of the code as if the target were of the type
9146 specified in this option, but still choosing the instructions that it
9147 will generate based on the cpu specified by a @option{-mcpu=} option.
9148 For some ARM implementations better performance can be obtained by using
9149 this option.
9151 @item -march=@var{name}
9152 @opindex march
9153 This specifies the name of the target ARM architecture.  GCC uses this
9154 name to determine what kind of instructions it can emit when generating
9155 assembly code.  This option can be used in conjunction with or instead
9156 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
9157 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
9158 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
9159 @samp{armv6}, @samp{armv6j},
9160 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
9161 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
9162 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
9164 @item -mfpu=@var{name}
9165 @itemx -mfpe=@var{number}
9166 @itemx -mfp=@var{number}
9167 @opindex mfpu
9168 @opindex mfpe
9169 @opindex mfp
9170 This specifies what floating point hardware (or hardware emulation) is
9171 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
9172 @samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-d16} and
9173 @samp{neon}.  @option{-mfp} and @option{-mfpe}
9174 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
9175 with older versions of GCC@.
9177 If @option{-msoft-float} is specified this specifies the format of
9178 floating point values.
9180 @item -mstructure-size-boundary=@var{n}
9181 @opindex mstructure-size-boundary
9182 The size of all structures and unions will be rounded up to a multiple
9183 of the number of bits set by this option.  Permissible values are 8, 32
9184 and 64.  The default value varies for different toolchains.  For the COFF
9185 targeted toolchain the default value is 8.  A value of 64 is only allowed
9186 if the underlying ABI supports it.
9188 Specifying the larger number can produce faster, more efficient code, but
9189 can also increase the size of the program.  Different values are potentially
9190 incompatible.  Code compiled with one value cannot necessarily expect to
9191 work with code or libraries compiled with another value, if they exchange
9192 information using structures or unions.
9194 @item -mabort-on-noreturn
9195 @opindex mabort-on-noreturn
9196 Generate a call to the function @code{abort} at the end of a
9197 @code{noreturn} function.  It will be executed if the function tries to
9198 return.
9200 @item -mlong-calls
9201 @itemx -mno-long-calls
9202 @opindex mlong-calls
9203 @opindex mno-long-calls
9204 Tells the compiler to perform function calls by first loading the
9205 address of the function into a register and then performing a subroutine
9206 call on this register.  This switch is needed if the target function
9207 will lie outside of the 64 megabyte addressing range of the offset based
9208 version of subroutine call instruction.
9210 Even if this switch is enabled, not all function calls will be turned
9211 into long calls.  The heuristic is that static functions, functions
9212 which have the @samp{short-call} attribute, functions that are inside
9213 the scope of a @samp{#pragma no_long_calls} directive and functions whose
9214 definitions have already been compiled within the current compilation
9215 unit, will not be turned into long calls.  The exception to this rule is
9216 that weak function definitions, functions with the @samp{long-call}
9217 attribute or the @samp{section} attribute, and functions that are within
9218 the scope of a @samp{#pragma long_calls} directive, will always be
9219 turned into long calls.
9221 This feature is not enabled by default.  Specifying
9222 @option{-mno-long-calls} will restore the default behavior, as will
9223 placing the function calls within the scope of a @samp{#pragma
9224 long_calls_off} directive.  Note these switches have no effect on how
9225 the compiler generates code to handle function calls via function
9226 pointers.
9228 @item -msingle-pic-base
9229 @opindex msingle-pic-base
9230 Treat the register used for PIC addressing as read-only, rather than
9231 loading it in the prologue for each function.  The run-time system is
9232 responsible for initializing this register with an appropriate value
9233 before execution begins.
9235 @item -mpic-register=@var{reg}
9236 @opindex mpic-register
9237 Specify the register to be used for PIC addressing.  The default is R10
9238 unless stack-checking is enabled, when R9 is used.
9240 @item -mcirrus-fix-invalid-insns
9241 @opindex mcirrus-fix-invalid-insns
9242 @opindex mno-cirrus-fix-invalid-insns
9243 Insert NOPs into the instruction stream to in order to work around
9244 problems with invalid Maverick instruction combinations.  This option
9245 is only valid if the @option{-mcpu=ep9312} option has been used to
9246 enable generation of instructions for the Cirrus Maverick floating
9247 point co-processor.  This option is not enabled by default, since the
9248 problem is only present in older Maverick implementations.  The default
9249 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
9250 switch.
9252 @item -mpoke-function-name
9253 @opindex mpoke-function-name
9254 Write the name of each function into the text section, directly
9255 preceding the function prologue.  The generated code is similar to this:
9257 @smallexample
9258      t0
9259          .ascii "arm_poke_function_name", 0
9260          .align
9261      t1
9262          .word 0xff000000 + (t1 - t0)
9263      arm_poke_function_name
9264          mov     ip, sp
9265          stmfd   sp!, @{fp, ip, lr, pc@}
9266          sub     fp, ip, #4
9267 @end smallexample
9269 When performing a stack backtrace, code can inspect the value of
9270 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
9271 location @code{pc - 12} and the top 8 bits are set, then we know that
9272 there is a function name embedded immediately preceding this location
9273 and has length @code{((pc[-3]) & 0xff000000)}.
9275 @item -mthumb
9276 @opindex mthumb
9277 Generate code for the Thumb instruction set.  The default is to
9278 use the 32-bit ARM instruction set.
9279 This option automatically enables either 16-bit Thumb-1 or
9280 mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
9281 and @option{-march=@var{name}} options. This option is not passed to the 
9282 assembler. If you want to force assembler files to be interpreted as Thumb code,
9283 either add a @samp{.thumb} directive to the source or pass the @option{-mthumb} 
9284 option directly to the assembler by prefixing it with @option{-Wa}.
9286 @item -mtpcs-frame
9287 @opindex mtpcs-frame
9288 Generate a stack frame that is compliant with the Thumb Procedure Call
9289 Standard for all non-leaf functions.  (A leaf function is one that does
9290 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
9292 @item -mtpcs-leaf-frame
9293 @opindex mtpcs-leaf-frame
9294 Generate a stack frame that is compliant with the Thumb Procedure Call
9295 Standard for all leaf functions.  (A leaf function is one that does
9296 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
9298 @item -mcallee-super-interworking
9299 @opindex mcallee-super-interworking
9300 Gives all externally visible functions in the file being compiled an ARM
9301 instruction set header which switches to Thumb mode before executing the
9302 rest of the function.  This allows these functions to be called from
9303 non-interworking code.
9305 @item -mcaller-super-interworking
9306 @opindex mcaller-super-interworking
9307 Allows calls via function pointers (including virtual functions) to
9308 execute correctly regardless of whether the target code has been
9309 compiled for interworking or not.  There is a small overhead in the cost
9310 of executing a function pointer if this option is enabled.
9312 @item -mtp=@var{name}
9313 @opindex mtp
9314 Specify the access model for the thread local storage pointer.  The valid
9315 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
9316 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
9317 (supported in the arm6k architecture), and @option{auto}, which uses the
9318 best available method for the selected processor.  The default setting is
9319 @option{auto}.
9321 @item -mword-relocations
9322 @opindex mword-relocations
9323 Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
9324 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
9325 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
9326 is specified.
9328 @end table
9330 @node AVR Options
9331 @subsection AVR Options
9332 @cindex AVR Options
9334 These options are defined for AVR implementations:
9336 @table @gcctabopt
9337 @item -mmcu=@var{mcu}
9338 @opindex mmcu
9339 Specify ATMEL AVR instruction set or MCU type.
9341 Instruction set avr1 is for the minimal AVR core, not supported by the C
9342 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9343 attiny11, attiny12, attiny15, attiny28).
9345 Instruction set avr2 (default) is for the classic AVR core with up to
9346 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9347 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9348 at90c8534, at90s8535).
9350 Instruction set avr3 is for the classic AVR core with up to 128K program
9351 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9353 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9354 memory space (MCU types: atmega8, atmega83, atmega85).
9356 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9357 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9358 atmega64, atmega128, at43usb355, at94k).
9360 @item -msize
9361 @opindex msize
9362 Output instruction sizes to the asm file.
9364 @item -minit-stack=@var{N}
9365 @opindex minit-stack
9366 Specify the initial stack address, which may be a symbol or numeric value,
9367 @samp{__stack} is the default.
9369 @item -mno-interrupts
9370 @opindex mno-interrupts
9371 Generated code is not compatible with hardware interrupts.
9372 Code size will be smaller.
9374 @item -mcall-prologues
9375 @opindex mcall-prologues
9376 Functions prologues/epilogues expanded as call to appropriate
9377 subroutines.  Code size will be smaller.
9379 @item -mtiny-stack
9380 @opindex mtiny-stack
9381 Change only the low 8 bits of the stack pointer.
9383 @item -mint8
9384 @opindex mint8
9385 Assume int to be 8 bit integer.  This affects the sizes of all types: A
9386 char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
9387 and long long will be 4 bytes.  Please note that this option does not
9388 comply to the C standards, but it will provide you with smaller code
9389 size.
9390 @end table
9392 @node Blackfin Options
9393 @subsection Blackfin Options
9394 @cindex Blackfin Options
9396 @table @gcctabopt
9397 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
9398 @opindex mcpu=
9399 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
9400 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
9401 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
9402 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
9403 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
9404 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
9405 @samp{bf561}.
9406 The optional @var{sirevision} specifies the silicon revision of the target
9407 Blackfin processor.  Any workarounds available for the targeted silicon revision
9408 will be enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
9409 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
9410 will be enabled.  The @code{__SILICON_REVISION__} macro is defined to two
9411 hexadecimal digits representing the major and minor numbers in the silicon
9412 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
9413 is not defined.  If @var{sirevision} is @samp{any}, the
9414 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
9415 If this optional @var{sirevision} is not used, GCC assumes the latest known
9416 silicon revision of the targeted Blackfin processor.
9418 Support for @samp{bf561} is incomplete.  For @samp{bf561},
9419 Only the processor macro is defined.
9420 Without this option, @samp{bf532} is used as the processor by default.
9421 The corresponding predefined processor macros for @var{cpu} is to
9422 be defined.  And for @samp{bfin-elf} toolchain, this causes the hardware BSP
9423 provided by libgloss to be linked in if @option{-msim} is not given.
9425 @item -msim
9426 @opindex msim
9427 Specifies that the program will be run on the simulator.  This causes
9428 the simulator BSP provided by libgloss to be linked in.  This option
9429 has effect only for @samp{bfin-elf} toolchain.
9430 Certain other options, such as @option{-mid-shared-library} and
9431 @option{-mfdpic}, imply @option{-msim}.
9433 @item -momit-leaf-frame-pointer
9434 @opindex momit-leaf-frame-pointer
9435 Don't keep the frame pointer in a register for leaf functions.  This
9436 avoids the instructions to save, set up and restore frame pointers and
9437 makes an extra register available in leaf functions.  The option
9438 @option{-fomit-frame-pointer} removes the frame pointer for all functions
9439 which might make debugging harder.
9441 @item -mspecld-anomaly
9442 @opindex mspecld-anomaly
9443 When enabled, the compiler will ensure that the generated code does not
9444 contain speculative loads after jump instructions. If this option is used,
9445 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
9447 @item -mno-specld-anomaly
9448 @opindex mno-specld-anomaly
9449 Don't generate extra code to prevent speculative loads from occurring.
9451 @item -mcsync-anomaly
9452 @opindex mcsync-anomaly
9453 When enabled, the compiler will ensure that the generated code does not
9454 contain CSYNC or SSYNC instructions too soon after conditional branches.
9455 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
9457 @item -mno-csync-anomaly
9458 @opindex mno-csync-anomaly
9459 Don't generate extra code to prevent CSYNC or SSYNC instructions from
9460 occurring too soon after a conditional branch.
9462 @item -mlow-64k
9463 @opindex mlow-64k
9464 When enabled, the compiler is free to take advantage of the knowledge that
9465 the entire program fits into the low 64k of memory.
9467 @item -mno-low-64k
9468 @opindex mno-low-64k
9469 Assume that the program is arbitrarily large.  This is the default.
9471 @item -mstack-check-l1
9472 @opindex mstack-check-l1
9473 Do stack checking using information placed into L1 scratchpad memory by the
9474 uClinux kernel.
9476 @item -mid-shared-library
9477 @opindex mid-shared-library
9478 Generate code that supports shared libraries via the library ID method.
9479 This allows for execute in place and shared libraries in an environment
9480 without virtual memory management.  This option implies @option{-fPIC}.
9481 With a @samp{bfin-elf} target, this option implies @option{-msim}.
9483 @item -mno-id-shared-library
9484 @opindex mno-id-shared-library
9485 Generate code that doesn't assume ID based shared libraries are being used.
9486 This is the default.
9488 @item -mleaf-id-shared-library
9489 @opindex mleaf-id-shared-library
9490 Generate code that supports shared libraries via the library ID method,
9491 but assumes that this library or executable won't link against any other
9492 ID shared libraries.  That allows the compiler to use faster code for jumps
9493 and calls.
9495 @item -mno-leaf-id-shared-library
9496 @opindex mno-leaf-id-shared-library
9497 Do not assume that the code being compiled won't link against any ID shared
9498 libraries.  Slower code will be generated for jump and call insns.
9500 @item -mshared-library-id=n
9501 @opindex mshared-library-id
9502 Specified the identification number of the ID based shared library being
9503 compiled.  Specifying a value of 0 will generate more compact code, specifying
9504 other values will force the allocation of that number to the current
9505 library but is no more space or time efficient than omitting this option.
9507 @item -msep-data
9508 @opindex msep-data
9509 Generate code that allows the data segment to be located in a different
9510 area of memory from the text segment.  This allows for execute in place in
9511 an environment without virtual memory management by eliminating relocations
9512 against the text section.
9514 @item -mno-sep-data
9515 @opindex mno-sep-data
9516 Generate code that assumes that the data segment follows the text segment.
9517 This is the default.
9519 @item -mlong-calls
9520 @itemx -mno-long-calls
9521 @opindex mlong-calls
9522 @opindex mno-long-calls
9523 Tells the compiler to perform function calls by first loading the
9524 address of the function into a register and then performing a subroutine
9525 call on this register.  This switch is needed if the target function
9526 will lie outside of the 24 bit addressing range of the offset based
9527 version of subroutine call instruction.
9529 This feature is not enabled by default.  Specifying
9530 @option{-mno-long-calls} will restore the default behavior.  Note these
9531 switches have no effect on how the compiler generates code to handle
9532 function calls via function pointers.
9534 @item -mfast-fp
9535 @opindex mfast-fp
9536 Link with the fast floating-point library. This library relaxes some of
9537 the IEEE floating-point standard's rules for checking inputs against
9538 Not-a-Number (NAN), in the interest of performance.
9540 @item -minline-plt
9541 @opindex minline-plt
9542 Enable inlining of PLT entries in function calls to functions that are
9543 not known to bind locally.  It has no effect without @option{-mfdpic}.
9545 @item -mmulticore
9546 @opindex mmulticore
9547 Build standalone application for multicore Blackfin processor. Proper
9548 start files and link scripts will be used to support multicore.
9549 This option defines @code{__BFIN_MULTICORE}. It can only be used with
9550 @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
9551 @option{-mcorea} or @option{-mcoreb}. If it's used without
9552 @option{-mcorea} or @option{-mcoreb}, single application/dual core
9553 programming model is used. In this model, the main function of Core B
9554 should be named as coreb_main. If it's used with @option{-mcorea} or
9555 @option{-mcoreb}, one application per core programming model is used.
9556 If this option is not used, single core application programming
9557 model is used.
9559 @item -mcorea
9560 @opindex mcorea
9561 Build standalone application for Core A of BF561 when using
9562 one application per core programming model. Proper start files
9563 and link scripts will be used to support Core A. This option
9564 defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
9566 @item -mcoreb
9567 @opindex mcoreb
9568 Build standalone application for Core B of BF561 when using
9569 one application per core programming model. Proper start files
9570 and link scripts will be used to support Core B. This option
9571 defines @code{__BFIN_COREB}. When this option is used, coreb_main
9572 should be used instead of main. It must be used with
9573 @option{-mmulticore}. 
9575 @item -msdram
9576 @opindex msdram
9577 Build standalone application for SDRAM. Proper start files and
9578 link scripts will be used to put the application into SDRAM.
9579 Loader should initialize SDRAM before loading the application
9580 into SDRAM. This option defines @code{__BFIN_SDRAM}.
9582 @item -micplb
9583 @opindex micplb
9584 Assume that ICPLBs are enabled at runtime.  This has an effect on certain
9585 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
9586 are enabled; for standalone applications the default is off.
9587 @end table
9589 @node CRIS Options
9590 @subsection CRIS Options
9591 @cindex CRIS Options
9593 These options are defined specifically for the CRIS ports.
9595 @table @gcctabopt
9596 @item -march=@var{architecture-type}
9597 @itemx -mcpu=@var{architecture-type}
9598 @opindex march
9599 @opindex mcpu
9600 Generate code for the specified architecture.  The choices for
9601 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
9602 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
9603 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
9604 @samp{v10}.
9606 @item -mtune=@var{architecture-type}
9607 @opindex mtune
9608 Tune to @var{architecture-type} everything applicable about the generated
9609 code, except for the ABI and the set of available instructions.  The
9610 choices for @var{architecture-type} are the same as for
9611 @option{-march=@var{architecture-type}}.
9613 @item -mmax-stack-frame=@var{n}
9614 @opindex mmax-stack-frame
9615 Warn when the stack frame of a function exceeds @var{n} bytes.
9617 @item -metrax4
9618 @itemx -metrax100
9619 @opindex metrax4
9620 @opindex metrax100
9621 The options @option{-metrax4} and @option{-metrax100} are synonyms for
9622 @option{-march=v3} and @option{-march=v8} respectively.
9624 @item -mmul-bug-workaround
9625 @itemx -mno-mul-bug-workaround
9626 @opindex mmul-bug-workaround
9627 @opindex mno-mul-bug-workaround
9628 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
9629 models where it applies.  This option is active by default.
9631 @item -mpdebug
9632 @opindex mpdebug
9633 Enable CRIS-specific verbose debug-related information in the assembly
9634 code.  This option also has the effect to turn off the @samp{#NO_APP}
9635 formatted-code indicator to the assembler at the beginning of the
9636 assembly file.
9638 @item -mcc-init
9639 @opindex mcc-init
9640 Do not use condition-code results from previous instruction; always emit
9641 compare and test instructions before use of condition codes.
9643 @item -mno-side-effects
9644 @opindex mno-side-effects
9645 Do not emit instructions with side-effects in addressing modes other than
9646 post-increment.
9648 @item -mstack-align
9649 @itemx -mno-stack-align
9650 @itemx -mdata-align
9651 @itemx -mno-data-align
9652 @itemx -mconst-align
9653 @itemx -mno-const-align
9654 @opindex mstack-align
9655 @opindex mno-stack-align
9656 @opindex mdata-align
9657 @opindex mno-data-align
9658 @opindex mconst-align
9659 @opindex mno-const-align
9660 These options (no-options) arranges (eliminate arrangements) for the
9661 stack-frame, individual data and constants to be aligned for the maximum
9662 single data access size for the chosen CPU model.  The default is to
9663 arrange for 32-bit alignment.  ABI details such as structure layout are
9664 not affected by these options.
9666 @item -m32-bit
9667 @itemx -m16-bit
9668 @itemx -m8-bit
9669 @opindex m32-bit
9670 @opindex m16-bit
9671 @opindex m8-bit
9672 Similar to the stack- data- and const-align options above, these options
9673 arrange for stack-frame, writable data and constants to all be 32-bit,
9674 16-bit or 8-bit aligned.  The default is 32-bit alignment.
9676 @item -mno-prologue-epilogue
9677 @itemx -mprologue-epilogue
9678 @opindex mno-prologue-epilogue
9679 @opindex mprologue-epilogue
9680 With @option{-mno-prologue-epilogue}, the normal function prologue and
9681 epilogue that sets up the stack-frame are omitted and no return
9682 instructions or return sequences are generated in the code.  Use this
9683 option only together with visual inspection of the compiled code: no
9684 warnings or errors are generated when call-saved registers must be saved,
9685 or storage for local variable needs to be allocated.
9687 @item -mno-gotplt
9688 @itemx -mgotplt
9689 @opindex mno-gotplt
9690 @opindex mgotplt
9691 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
9692 instruction sequences that load addresses for functions from the PLT part
9693 of the GOT rather than (traditional on other architectures) calls to the
9694 PLT@.  The default is @option{-mgotplt}.
9696 @item -melf
9697 @opindex melf
9698 Legacy no-op option only recognized with the cris-axis-elf and
9699 cris-axis-linux-gnu targets.
9701 @item -mlinux
9702 @opindex mlinux
9703 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
9705 @item -sim
9706 @opindex sim
9707 This option, recognized for the cris-axis-elf arranges
9708 to link with input-output functions from a simulator library.  Code,
9709 initialized data and zero-initialized data are allocated consecutively.
9711 @item -sim2
9712 @opindex sim2
9713 Like @option{-sim}, but pass linker options to locate initialized data at
9714 0x40000000 and zero-initialized data at 0x80000000.
9715 @end table
9717 @node CRX Options
9718 @subsection CRX Options
9719 @cindex CRX Options
9721 These options are defined specifically for the CRX ports.
9723 @table @gcctabopt
9725 @item -mmac
9726 @opindex mmac
9727 Enable the use of multiply-accumulate instructions. Disabled by default.
9729 @item -mpush-args
9730 @opindex mpush-args
9731 Push instructions will be used to pass outgoing arguments when functions
9732 are called. Enabled by default.
9733 @end table
9735 @node Darwin Options
9736 @subsection Darwin Options
9737 @cindex Darwin options
9739 These options are defined for all architectures running the Darwin operating
9740 system.
9742 FSF GCC on Darwin does not create ``fat'' object files; it will create
9743 an object file for the single architecture that it was built to
9744 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
9745 @option{-arch} options are used; it does so by running the compiler or
9746 linker multiple times and joining the results together with
9747 @file{lipo}.
9749 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
9750 @samp{i686}) is determined by the flags that specify the ISA
9751 that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
9752 @option{-force_cpusubtype_ALL} option can be used to override this.
9754 The Darwin tools vary in their behavior when presented with an ISA
9755 mismatch.  The assembler, @file{as}, will only permit instructions to
9756 be used that are valid for the subtype of the file it is generating,
9757 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
9758 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
9759 and print an error if asked to create a shared library with a less
9760 restrictive subtype than its input files (for instance, trying to put
9761 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
9762 for executables, @file{ld}, will quietly give the executable the most
9763 restrictive subtype of any of its input files.
9765 @table @gcctabopt
9766 @item -F@var{dir}
9767 @opindex F
9768 Add the framework directory @var{dir} to the head of the list of
9769 directories to be searched for header files.  These directories are
9770 interleaved with those specified by @option{-I} options and are
9771 scanned in a left-to-right order.
9773 A framework directory is a directory with frameworks in it.  A
9774 framework is a directory with a @samp{"Headers"} and/or
9775 @samp{"PrivateHeaders"} directory contained directly in it that ends
9776 in @samp{".framework"}.  The name of a framework is the name of this
9777 directory excluding the @samp{".framework"}.  Headers associated with
9778 the framework are found in one of those two directories, with
9779 @samp{"Headers"} being searched first.  A subframework is a framework
9780 directory that is in a framework's @samp{"Frameworks"} directory.
9781 Includes of subframework headers can only appear in a header of a
9782 framework that contains the subframework, or in a sibling subframework
9783 header.  Two subframeworks are siblings if they occur in the same
9784 framework.  A subframework should not have the same name as a
9785 framework, a warning will be issued if this is violated.  Currently a
9786 subframework cannot have subframeworks, in the future, the mechanism
9787 may be extended to support this.  The standard frameworks can be found
9788 in @samp{"/System/Library/Frameworks"} and
9789 @samp{"/Library/Frameworks"}.  An example include looks like
9790 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
9791 the name of the framework and header.h is found in the
9792 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
9794 @item -iframework@var{dir}
9795 @opindex iframework
9796 Like @option{-F} except the directory is a treated as a system
9797 directory.  The main difference between this @option{-iframework} and
9798 @option{-F} is that with @option{-iframework} the compiler does not
9799 warn about constructs contained within header files found via
9800 @var{dir}.  This option is valid only for the C family of languages.
9802 @item -gused
9803 @opindex gused
9804 Emit debugging information for symbols that are used.  For STABS
9805 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
9806 This is by default ON@.
9808 @item -gfull
9809 @opindex gfull
9810 Emit debugging information for all symbols and types.
9812 @item -mmacosx-version-min=@var{version}
9813 The earliest version of MacOS X that this executable will run on
9814 is @var{version}.  Typical values of @var{version} include @code{10.1},
9815 @code{10.2}, and @code{10.3.9}.
9817 If the compiler was built to use the system's headers by default,
9818 then the default for this option is the system version on which the
9819 compiler is running, otherwise the default is to make choices which
9820 are compatible with as many systems and code bases as possible.
9822 @item -mkernel
9823 @opindex mkernel
9824 Enable kernel development mode.  The @option{-mkernel} option sets
9825 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
9826 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
9827 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
9828 applicable.  This mode also sets @option{-mno-altivec},
9829 @option{-msoft-float}, @option{-fno-builtin} and
9830 @option{-mlong-branch} for PowerPC targets.
9832 @item -mone-byte-bool
9833 @opindex mone-byte-bool
9834 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
9835 By default @samp{sizeof(bool)} is @samp{4} when compiling for
9836 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
9837 option has no effect on x86.
9839 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
9840 to generate code that is not binary compatible with code generated
9841 without that switch.  Using this switch may require recompiling all
9842 other modules in a program, including system libraries.  Use this
9843 switch to conform to a non-default data model.
9845 @item -mfix-and-continue
9846 @itemx -ffix-and-continue
9847 @itemx -findirect-data
9848 @opindex mfix-and-continue
9849 @opindex ffix-and-continue
9850 @opindex findirect-data
9851 Generate code suitable for fast turn around development.  Needed to
9852 enable gdb to dynamically load @code{.o} files into already running
9853 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
9854 are provided for backwards compatibility.
9856 @item -all_load
9857 @opindex all_load
9858 Loads all members of static archive libraries.
9859 See man ld(1) for more information.
9861 @item -arch_errors_fatal
9862 @opindex arch_errors_fatal
9863 Cause the errors having to do with files that have the wrong architecture
9864 to be fatal.
9866 @item -bind_at_load
9867 @opindex bind_at_load
9868 Causes the output file to be marked such that the dynamic linker will
9869 bind all undefined references when the file is loaded or launched.
9871 @item -bundle
9872 @opindex bundle
9873 Produce a Mach-o bundle format file.
9874 See man ld(1) for more information.
9876 @item -bundle_loader @var{executable}
9877 @opindex bundle_loader
9878 This option specifies the @var{executable} that will be loading the build
9879 output file being linked.  See man ld(1) for more information.
9881 @item -dynamiclib
9882 @opindex dynamiclib
9883 When passed this option, GCC will produce a dynamic library instead of
9884 an executable when linking, using the Darwin @file{libtool} command.
9886 @item -force_cpusubtype_ALL
9887 @opindex force_cpusubtype_ALL
9888 This causes GCC's output file to have the @var{ALL} subtype, instead of
9889 one controlled by the @option{-mcpu} or @option{-march} option.
9891 @item -allowable_client  @var{client_name}
9892 @itemx -client_name
9893 @itemx -compatibility_version
9894 @itemx -current_version
9895 @itemx -dead_strip
9896 @itemx -dependency-file
9897 @itemx -dylib_file
9898 @itemx -dylinker_install_name
9899 @itemx -dynamic
9900 @itemx -exported_symbols_list
9901 @itemx -filelist
9902 @itemx -flat_namespace
9903 @itemx -force_flat_namespace
9904 @itemx -headerpad_max_install_names
9905 @itemx -image_base
9906 @itemx -init
9907 @itemx -install_name
9908 @itemx -keep_private_externs
9909 @itemx -multi_module
9910 @itemx -multiply_defined
9911 @itemx -multiply_defined_unused
9912 @itemx -noall_load
9913 @itemx -no_dead_strip_inits_and_terms
9914 @itemx -nofixprebinding
9915 @itemx -nomultidefs
9916 @itemx -noprebind
9917 @itemx -noseglinkedit
9918 @itemx -pagezero_size
9919 @itemx -prebind
9920 @itemx -prebind_all_twolevel_modules
9921 @itemx -private_bundle
9922 @itemx -read_only_relocs
9923 @itemx -sectalign
9924 @itemx -sectobjectsymbols
9925 @itemx -whyload
9926 @itemx -seg1addr
9927 @itemx -sectcreate
9928 @itemx -sectobjectsymbols
9929 @itemx -sectorder
9930 @itemx -segaddr
9931 @itemx -segs_read_only_addr
9932 @itemx -segs_read_write_addr
9933 @itemx -seg_addr_table
9934 @itemx -seg_addr_table_filename
9935 @itemx -seglinkedit
9936 @itemx -segprot
9937 @itemx -segs_read_only_addr
9938 @itemx -segs_read_write_addr
9939 @itemx -single_module
9940 @itemx -static
9941 @itemx -sub_library
9942 @itemx -sub_umbrella
9943 @itemx -twolevel_namespace
9944 @itemx -umbrella
9945 @itemx -undefined
9946 @itemx -unexported_symbols_list
9947 @itemx -weak_reference_mismatches
9948 @itemx -whatsloaded
9949 @opindex allowable_client
9950 @opindex client_name
9951 @opindex compatibility_version
9952 @opindex current_version
9953 @opindex dead_strip
9954 @opindex dependency-file
9955 @opindex dylib_file
9956 @opindex dylinker_install_name
9957 @opindex dynamic
9958 @opindex exported_symbols_list
9959 @opindex filelist
9960 @opindex flat_namespace
9961 @opindex force_flat_namespace
9962 @opindex headerpad_max_install_names
9963 @opindex image_base
9964 @opindex init
9965 @opindex install_name
9966 @opindex keep_private_externs
9967 @opindex multi_module
9968 @opindex multiply_defined
9969 @opindex multiply_defined_unused
9970 @opindex noall_load
9971 @opindex no_dead_strip_inits_and_terms
9972 @opindex nofixprebinding
9973 @opindex nomultidefs
9974 @opindex noprebind
9975 @opindex noseglinkedit
9976 @opindex pagezero_size
9977 @opindex prebind
9978 @opindex prebind_all_twolevel_modules
9979 @opindex private_bundle
9980 @opindex read_only_relocs
9981 @opindex sectalign
9982 @opindex sectobjectsymbols
9983 @opindex whyload
9984 @opindex seg1addr
9985 @opindex sectcreate
9986 @opindex sectobjectsymbols
9987 @opindex sectorder
9988 @opindex segaddr
9989 @opindex segs_read_only_addr
9990 @opindex segs_read_write_addr
9991 @opindex seg_addr_table
9992 @opindex seg_addr_table_filename
9993 @opindex seglinkedit
9994 @opindex segprot
9995 @opindex segs_read_only_addr
9996 @opindex segs_read_write_addr
9997 @opindex single_module
9998 @opindex static
9999 @opindex sub_library
10000 @opindex sub_umbrella
10001 @opindex twolevel_namespace
10002 @opindex umbrella
10003 @opindex undefined
10004 @opindex unexported_symbols_list
10005 @opindex weak_reference_mismatches
10006 @opindex whatsloaded
10007 These options are passed to the Darwin linker.  The Darwin linker man page
10008 describes them in detail.
10009 @end table
10011 @node DEC Alpha Options
10012 @subsection DEC Alpha Options
10014 These @samp{-m} options are defined for the DEC Alpha implementations:
10016 @table @gcctabopt
10017 @item -mno-soft-float
10018 @itemx -msoft-float
10019 @opindex mno-soft-float
10020 @opindex msoft-float
10021 Use (do not use) the hardware floating-point instructions for
10022 floating-point operations.  When @option{-msoft-float} is specified,
10023 functions in @file{libgcc.a} will be used to perform floating-point
10024 operations.  Unless they are replaced by routines that emulate the
10025 floating-point operations, or compiled in such a way as to call such
10026 emulations routines, these routines will issue floating-point
10027 operations.   If you are compiling for an Alpha without floating-point
10028 operations, you must ensure that the library is built so as not to call
10029 them.
10031 Note that Alpha implementations without floating-point operations are
10032 required to have floating-point registers.
10034 @item -mfp-reg
10035 @itemx -mno-fp-regs
10036 @opindex mfp-reg
10037 @opindex mno-fp-regs
10038 Generate code that uses (does not use) the floating-point register set.
10039 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
10040 register set is not used, floating point operands are passed in integer
10041 registers as if they were integers and floating-point results are passed
10042 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
10043 so any function with a floating-point argument or return value called by code
10044 compiled with @option{-mno-fp-regs} must also be compiled with that
10045 option.
10047 A typical use of this option is building a kernel that does not use,
10048 and hence need not save and restore, any floating-point registers.
10050 @item -mieee
10051 @opindex mieee
10052 The Alpha architecture implements floating-point hardware optimized for
10053 maximum performance.  It is mostly compliant with the IEEE floating
10054 point standard.  However, for full compliance, software assistance is
10055 required.  This option generates code fully IEEE compliant code
10056 @emph{except} that the @var{inexact-flag} is not maintained (see below).
10057 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
10058 defined during compilation.  The resulting code is less efficient but is
10059 able to correctly support denormalized numbers and exceptional IEEE
10060 values such as not-a-number and plus/minus infinity.  Other Alpha
10061 compilers call this option @option{-ieee_with_no_inexact}.
10063 @item -mieee-with-inexact
10064 @opindex mieee-with-inexact
10065 This is like @option{-mieee} except the generated code also maintains
10066 the IEEE @var{inexact-flag}.  Turning on this option causes the
10067 generated code to implement fully-compliant IEEE math.  In addition to
10068 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
10069 macro.  On some Alpha implementations the resulting code may execute
10070 significantly slower than the code generated by default.  Since there is
10071 very little code that depends on the @var{inexact-flag}, you should
10072 normally not specify this option.  Other Alpha compilers call this
10073 option @option{-ieee_with_inexact}.
10075 @item -mfp-trap-mode=@var{trap-mode}
10076 @opindex mfp-trap-mode
10077 This option controls what floating-point related traps are enabled.
10078 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
10079 The trap mode can be set to one of four values:
10081 @table @samp
10082 @item n
10083 This is the default (normal) setting.  The only traps that are enabled
10084 are the ones that cannot be disabled in software (e.g., division by zero
10085 trap).
10087 @item u
10088 In addition to the traps enabled by @samp{n}, underflow traps are enabled
10089 as well.
10091 @item su
10092 Like @samp{u}, but the instructions are marked to be safe for software
10093 completion (see Alpha architecture manual for details).
10095 @item sui
10096 Like @samp{su}, but inexact traps are enabled as well.
10097 @end table
10099 @item -mfp-rounding-mode=@var{rounding-mode}
10100 @opindex mfp-rounding-mode
10101 Selects the IEEE rounding mode.  Other Alpha compilers call this option
10102 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
10105 @table @samp
10106 @item n
10107 Normal IEEE rounding mode.  Floating point numbers are rounded towards
10108 the nearest machine number or towards the even machine number in case
10109 of a tie.
10111 @item m
10112 Round towards minus infinity.
10114 @item c
10115 Chopped rounding mode.  Floating point numbers are rounded towards zero.
10117 @item d
10118 Dynamic rounding mode.  A field in the floating point control register
10119 (@var{fpcr}, see Alpha architecture reference manual) controls the
10120 rounding mode in effect.  The C library initializes this register for
10121 rounding towards plus infinity.  Thus, unless your program modifies the
10122 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
10123 @end table
10125 @item -mtrap-precision=@var{trap-precision}
10126 @opindex mtrap-precision
10127 In the Alpha architecture, floating point traps are imprecise.  This
10128 means without software assistance it is impossible to recover from a
10129 floating trap and program execution normally needs to be terminated.
10130 GCC can generate code that can assist operating system trap handlers
10131 in determining the exact location that caused a floating point trap.
10132 Depending on the requirements of an application, different levels of
10133 precisions can be selected:
10135 @table @samp
10136 @item p
10137 Program precision.  This option is the default and means a trap handler
10138 can only identify which program caused a floating point exception.
10140 @item f
10141 Function precision.  The trap handler can determine the function that
10142 caused a floating point exception.
10144 @item i
10145 Instruction precision.  The trap handler can determine the exact
10146 instruction that caused a floating point exception.
10147 @end table
10149 Other Alpha compilers provide the equivalent options called
10150 @option{-scope_safe} and @option{-resumption_safe}.
10152 @item -mieee-conformant
10153 @opindex mieee-conformant
10154 This option marks the generated code as IEEE conformant.  You must not
10155 use this option unless you also specify @option{-mtrap-precision=i} and either
10156 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
10157 is to emit the line @samp{.eflag 48} in the function prologue of the
10158 generated assembly file.  Under DEC Unix, this has the effect that
10159 IEEE-conformant math library routines will be linked in.
10161 @item -mbuild-constants
10162 @opindex mbuild-constants
10163 Normally GCC examines a 32- or 64-bit integer constant to
10164 see if it can construct it from smaller constants in two or three
10165 instructions.  If it cannot, it will output the constant as a literal and
10166 generate code to load it from the data segment at runtime.
10168 Use this option to require GCC to construct @emph{all} integer constants
10169 using code, even if it takes more instructions (the maximum is six).
10171 You would typically use this option to build a shared library dynamic
10172 loader.  Itself a shared library, it must relocate itself in memory
10173 before it can find the variables and constants in its own data segment.
10175 @item -malpha-as
10176 @itemx -mgas
10177 @opindex malpha-as
10178 @opindex mgas
10179 Select whether to generate code to be assembled by the vendor-supplied
10180 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
10182 @item -mbwx
10183 @itemx -mno-bwx
10184 @itemx -mcix
10185 @itemx -mno-cix
10186 @itemx -mfix
10187 @itemx -mno-fix
10188 @itemx -mmax
10189 @itemx -mno-max
10190 @opindex mbwx
10191 @opindex mno-bwx
10192 @opindex mcix
10193 @opindex mno-cix
10194 @opindex mfix
10195 @opindex mno-fix
10196 @opindex mmax
10197 @opindex mno-max
10198 Indicate whether GCC should generate code to use the optional BWX,
10199 CIX, FIX and MAX instruction sets.  The default is to use the instruction
10200 sets supported by the CPU type specified via @option{-mcpu=} option or that
10201 of the CPU on which GCC was built if none was specified.
10203 @item -mfloat-vax
10204 @itemx -mfloat-ieee
10205 @opindex mfloat-vax
10206 @opindex mfloat-ieee
10207 Generate code that uses (does not use) VAX F and G floating point
10208 arithmetic instead of IEEE single and double precision.
10210 @item -mexplicit-relocs
10211 @itemx -mno-explicit-relocs
10212 @opindex mexplicit-relocs
10213 @opindex mno-explicit-relocs
10214 Older Alpha assemblers provided no way to generate symbol relocations
10215 except via assembler macros.  Use of these macros does not allow
10216 optimal instruction scheduling.  GNU binutils as of version 2.12
10217 supports a new syntax that allows the compiler to explicitly mark
10218 which relocations should apply to which instructions.  This option
10219 is mostly useful for debugging, as GCC detects the capabilities of
10220 the assembler when it is built and sets the default accordingly.
10222 @item -msmall-data
10223 @itemx -mlarge-data
10224 @opindex msmall-data
10225 @opindex mlarge-data
10226 When @option{-mexplicit-relocs} is in effect, static data is
10227 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
10228 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
10229 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
10230 16-bit relocations off of the @code{$gp} register.  This limits the
10231 size of the small data area to 64KB, but allows the variables to be
10232 directly accessed via a single instruction.
10234 The default is @option{-mlarge-data}.  With this option the data area
10235 is limited to just below 2GB@.  Programs that require more than 2GB of
10236 data must use @code{malloc} or @code{mmap} to allocate the data in the
10237 heap instead of in the program's data segment.
10239 When generating code for shared libraries, @option{-fpic} implies
10240 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
10242 @item -msmall-text
10243 @itemx -mlarge-text
10244 @opindex msmall-text
10245 @opindex mlarge-text
10246 When @option{-msmall-text} is used, the compiler assumes that the
10247 code of the entire program (or shared library) fits in 4MB, and is
10248 thus reachable with a branch instruction.  When @option{-msmall-data}
10249 is used, the compiler can assume that all local symbols share the
10250 same @code{$gp} value, and thus reduce the number of instructions
10251 required for a function call from 4 to 1.
10253 The default is @option{-mlarge-text}.
10255 @item -mcpu=@var{cpu_type}
10256 @opindex mcpu
10257 Set the instruction set and instruction scheduling parameters for
10258 machine type @var{cpu_type}.  You can specify either the @samp{EV}
10259 style name or the corresponding chip number.  GCC supports scheduling
10260 parameters for the EV4, EV5 and EV6 family of processors and will
10261 choose the default values for the instruction set from the processor
10262 you specify.  If you do not specify a processor type, GCC will default
10263 to the processor on which the compiler was built.
10265 Supported values for @var{cpu_type} are
10267 @table @samp
10268 @item ev4
10269 @itemx ev45
10270 @itemx 21064
10271 Schedules as an EV4 and has no instruction set extensions.
10273 @item ev5
10274 @itemx 21164
10275 Schedules as an EV5 and has no instruction set extensions.
10277 @item ev56
10278 @itemx 21164a
10279 Schedules as an EV5 and supports the BWX extension.
10281 @item pca56
10282 @itemx 21164pc
10283 @itemx 21164PC
10284 Schedules as an EV5 and supports the BWX and MAX extensions.
10286 @item ev6
10287 @itemx 21264
10288 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
10290 @item ev67
10291 @itemx 21264a
10292 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
10293 @end table
10295 Native Linux/GNU toolchains also support the value @samp{native},
10296 which selects the best architecture option for the host processor.
10297 @option{-mcpu=native} has no effect if GCC does not recognize
10298 the processor.
10300 @item -mtune=@var{cpu_type}
10301 @opindex mtune
10302 Set only the instruction scheduling parameters for machine type
10303 @var{cpu_type}.  The instruction set is not changed.
10305 Native Linux/GNU toolchains also support the value @samp{native},
10306 which selects the best architecture option for the host processor.
10307 @option{-mtune=native} has no effect if GCC does not recognize
10308 the processor.
10310 @item -mmemory-latency=@var{time}
10311 @opindex mmemory-latency
10312 Sets the latency the scheduler should assume for typical memory
10313 references as seen by the application.  This number is highly
10314 dependent on the memory access patterns used by the application
10315 and the size of the external cache on the machine.
10317 Valid options for @var{time} are
10319 @table @samp
10320 @item @var{number}
10321 A decimal number representing clock cycles.
10323 @item L1
10324 @itemx L2
10325 @itemx L3
10326 @itemx main
10327 The compiler contains estimates of the number of clock cycles for
10328 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
10329 (also called Dcache, Scache, and Bcache), as well as to main memory.
10330 Note that L3 is only valid for EV5.
10332 @end table
10333 @end table
10335 @node DEC Alpha/VMS Options
10336 @subsection DEC Alpha/VMS Options
10338 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
10340 @table @gcctabopt
10341 @item -mvms-return-codes
10342 @opindex mvms-return-codes
10343 Return VMS condition codes from main.  The default is to return POSIX
10344 style condition (e.g.@: error) codes.
10345 @end table
10347 @node FR30 Options
10348 @subsection FR30 Options
10349 @cindex FR30 Options
10351 These options are defined specifically for the FR30 port.
10353 @table @gcctabopt
10355 @item -msmall-model
10356 @opindex msmall-model
10357 Use the small address space model.  This can produce smaller code, but
10358 it does assume that all symbolic values and addresses will fit into a
10359 20-bit range.
10361 @item -mno-lsim
10362 @opindex mno-lsim
10363 Assume that run-time support has been provided and so there is no need
10364 to include the simulator library (@file{libsim.a}) on the linker
10365 command line.
10367 @end table
10369 @node FRV Options
10370 @subsection FRV Options
10371 @cindex FRV Options
10373 @table @gcctabopt
10374 @item -mgpr-32
10375 @opindex mgpr-32
10377 Only use the first 32 general purpose registers.
10379 @item -mgpr-64
10380 @opindex mgpr-64
10382 Use all 64 general purpose registers.
10384 @item -mfpr-32
10385 @opindex mfpr-32
10387 Use only the first 32 floating point registers.
10389 @item -mfpr-64
10390 @opindex mfpr-64
10392 Use all 64 floating point registers
10394 @item -mhard-float
10395 @opindex mhard-float
10397 Use hardware instructions for floating point operations.
10399 @item -msoft-float
10400 @opindex msoft-float
10402 Use library routines for floating point operations.
10404 @item -malloc-cc
10405 @opindex malloc-cc
10407 Dynamically allocate condition code registers.
10409 @item -mfixed-cc
10410 @opindex mfixed-cc
10412 Do not try to dynamically allocate condition code registers, only
10413 use @code{icc0} and @code{fcc0}.
10415 @item -mdword
10416 @opindex mdword
10418 Change ABI to use double word insns.
10420 @item -mno-dword
10421 @opindex mno-dword
10423 Do not use double word instructions.
10425 @item -mdouble
10426 @opindex mdouble
10428 Use floating point double instructions.
10430 @item -mno-double
10431 @opindex mno-double
10433 Do not use floating point double instructions.
10435 @item -mmedia
10436 @opindex mmedia
10438 Use media instructions.
10440 @item -mno-media
10441 @opindex mno-media
10443 Do not use media instructions.
10445 @item -mmuladd
10446 @opindex mmuladd
10448 Use multiply and add/subtract instructions.
10450 @item -mno-muladd
10451 @opindex mno-muladd
10453 Do not use multiply and add/subtract instructions.
10455 @item -mfdpic
10456 @opindex mfdpic
10458 Select the FDPIC ABI, that uses function descriptors to represent
10459 pointers to functions.  Without any PIC/PIE-related options, it
10460 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
10461 assumes GOT entries and small data are within a 12-bit range from the
10462 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
10463 are computed with 32 bits.
10464 With a @samp{bfin-elf} target, this option implies @option{-msim}.
10466 @item -minline-plt
10467 @opindex minline-plt
10469 Enable inlining of PLT entries in function calls to functions that are
10470 not known to bind locally.  It has no effect without @option{-mfdpic}.
10471 It's enabled by default if optimizing for speed and compiling for
10472 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
10473 optimization option such as @option{-O3} or above is present in the
10474 command line.
10476 @item -mTLS
10477 @opindex TLS
10479 Assume a large TLS segment when generating thread-local code.
10481 @item -mtls
10482 @opindex tls
10484 Do not assume a large TLS segment when generating thread-local code.
10486 @item -mgprel-ro
10487 @opindex mgprel-ro
10489 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
10490 that is known to be in read-only sections.  It's enabled by default,
10491 except for @option{-fpic} or @option{-fpie}: even though it may help
10492 make the global offset table smaller, it trades 1 instruction for 4.
10493 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
10494 one of which may be shared by multiple symbols, and it avoids the need
10495 for a GOT entry for the referenced symbol, so it's more likely to be a
10496 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
10498 @item -multilib-library-pic
10499 @opindex multilib-library-pic
10501 Link with the (library, not FD) pic libraries.  It's implied by
10502 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
10503 @option{-fpic} without @option{-mfdpic}.  You should never have to use
10504 it explicitly.
10506 @item -mlinked-fp
10507 @opindex mlinked-fp
10509 Follow the EABI requirement of always creating a frame pointer whenever
10510 a stack frame is allocated.  This option is enabled by default and can
10511 be disabled with @option{-mno-linked-fp}.
10513 @item -mlong-calls
10514 @opindex mlong-calls
10516 Use indirect addressing to call functions outside the current
10517 compilation unit.  This allows the functions to be placed anywhere
10518 within the 32-bit address space.
10520 @item -malign-labels
10521 @opindex malign-labels
10523 Try to align labels to an 8-byte boundary by inserting nops into the
10524 previous packet.  This option only has an effect when VLIW packing
10525 is enabled.  It doesn't create new packets; it merely adds nops to
10526 existing ones.
10528 @item -mlibrary-pic
10529 @opindex mlibrary-pic
10531 Generate position-independent EABI code.
10533 @item -macc-4
10534 @opindex macc-4
10536 Use only the first four media accumulator registers.
10538 @item -macc-8
10539 @opindex macc-8
10541 Use all eight media accumulator registers.
10543 @item -mpack
10544 @opindex mpack
10546 Pack VLIW instructions.
10548 @item -mno-pack
10549 @opindex mno-pack
10551 Do not pack VLIW instructions.
10553 @item -mno-eflags
10554 @opindex mno-eflags
10556 Do not mark ABI switches in e_flags.
10558 @item -mcond-move
10559 @opindex mcond-move
10561 Enable the use of conditional-move instructions (default).
10563 This switch is mainly for debugging the compiler and will likely be removed
10564 in a future version.
10566 @item -mno-cond-move
10567 @opindex mno-cond-move
10569 Disable the use of conditional-move instructions.
10571 This switch is mainly for debugging the compiler and will likely be removed
10572 in a future version.
10574 @item -mscc
10575 @opindex mscc
10577 Enable the use of conditional set instructions (default).
10579 This switch is mainly for debugging the compiler and will likely be removed
10580 in a future version.
10582 @item -mno-scc
10583 @opindex mno-scc
10585 Disable the use of conditional set instructions.
10587 This switch is mainly for debugging the compiler and will likely be removed
10588 in a future version.
10590 @item -mcond-exec
10591 @opindex mcond-exec
10593 Enable the use of conditional execution (default).
10595 This switch is mainly for debugging the compiler and will likely be removed
10596 in a future version.
10598 @item -mno-cond-exec
10599 @opindex mno-cond-exec
10601 Disable the use of conditional execution.
10603 This switch is mainly for debugging the compiler and will likely be removed
10604 in a future version.
10606 @item -mvliw-branch
10607 @opindex mvliw-branch
10609 Run a pass to pack branches into VLIW instructions (default).
10611 This switch is mainly for debugging the compiler and will likely be removed
10612 in a future version.
10614 @item -mno-vliw-branch
10615 @opindex mno-vliw-branch
10617 Do not run a pass to pack branches into VLIW instructions.
10619 This switch is mainly for debugging the compiler and will likely be removed
10620 in a future version.
10622 @item -mmulti-cond-exec
10623 @opindex mmulti-cond-exec
10625 Enable optimization of @code{&&} and @code{||} in conditional execution
10626 (default).
10628 This switch is mainly for debugging the compiler and will likely be removed
10629 in a future version.
10631 @item -mno-multi-cond-exec
10632 @opindex mno-multi-cond-exec
10634 Disable optimization of @code{&&} and @code{||} in conditional execution.
10636 This switch is mainly for debugging the compiler and will likely be removed
10637 in a future version.
10639 @item -mnested-cond-exec
10640 @opindex mnested-cond-exec
10642 Enable nested conditional execution optimizations (default).
10644 This switch is mainly for debugging the compiler and will likely be removed
10645 in a future version.
10647 @item -mno-nested-cond-exec
10648 @opindex mno-nested-cond-exec
10650 Disable nested conditional execution optimizations.
10652 This switch is mainly for debugging the compiler and will likely be removed
10653 in a future version.
10655 @item -moptimize-membar
10656 @opindex moptimize-membar
10658 This switch removes redundant @code{membar} instructions from the
10659 compiler generated code.  It is enabled by default.
10661 @item -mno-optimize-membar
10662 @opindex mno-optimize-membar
10664 This switch disables the automatic removal of redundant @code{membar}
10665 instructions from the generated code.
10667 @item -mtomcat-stats
10668 @opindex mtomcat-stats
10670 Cause gas to print out tomcat statistics.
10672 @item -mcpu=@var{cpu}
10673 @opindex mcpu
10675 Select the processor type for which to generate code.  Possible values are
10676 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
10677 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
10679 @end table
10681 @node GNU/Linux Options
10682 @subsection GNU/Linux Options
10684 These @samp{-m} options are defined for GNU/Linux targets:
10686 @table @gcctabopt
10687 @item -mglibc
10688 @opindex mglibc
10689 Use the GNU C library instead of uClibc.  This is the default except
10690 on @samp{*-*-linux-*uclibc*} targets.
10692 @item -muclibc
10693 @opindex muclibc
10694 Use uClibc instead of the GNU C library.  This is the default on
10695 @samp{*-*-linux-*uclibc*} targets.
10696 @end table
10698 @node H8/300 Options
10699 @subsection H8/300 Options
10701 These @samp{-m} options are defined for the H8/300 implementations:
10703 @table @gcctabopt
10704 @item -mrelax
10705 @opindex mrelax
10706 Shorten some address references at link time, when possible; uses the
10707 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
10708 ld, Using ld}, for a fuller description.
10710 @item -mh
10711 @opindex mh
10712 Generate code for the H8/300H@.
10714 @item -ms
10715 @opindex ms
10716 Generate code for the H8S@.
10718 @item -mn
10719 @opindex mn
10720 Generate code for the H8S and H8/300H in the normal mode.  This switch
10721 must be used either with @option{-mh} or @option{-ms}.
10723 @item -ms2600
10724 @opindex ms2600
10725 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
10727 @item -mint32
10728 @opindex mint32
10729 Make @code{int} data 32 bits by default.
10731 @item -malign-300
10732 @opindex malign-300
10733 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
10734 The default for the H8/300H and H8S is to align longs and floats on 4
10735 byte boundaries.
10736 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
10737 This option has no effect on the H8/300.
10738 @end table
10740 @node HPPA Options
10741 @subsection HPPA Options
10742 @cindex HPPA Options
10744 These @samp{-m} options are defined for the HPPA family of computers:
10746 @table @gcctabopt
10747 @item -march=@var{architecture-type}
10748 @opindex march
10749 Generate code for the specified architecture.  The choices for
10750 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
10751 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
10752 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
10753 architecture option for your machine.  Code compiled for lower numbered
10754 architectures will run on higher numbered architectures, but not the
10755 other way around.
10757 @item -mpa-risc-1-0
10758 @itemx -mpa-risc-1-1
10759 @itemx -mpa-risc-2-0
10760 @opindex mpa-risc-1-0
10761 @opindex mpa-risc-1-1
10762 @opindex mpa-risc-2-0
10763 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
10765 @item -mbig-switch
10766 @opindex mbig-switch
10767 Generate code suitable for big switch tables.  Use this option only if
10768 the assembler/linker complain about out of range branches within a switch
10769 table.
10771 @item -mjump-in-delay
10772 @opindex mjump-in-delay
10773 Fill delay slots of function calls with unconditional jump instructions
10774 by modifying the return pointer for the function call to be the target
10775 of the conditional jump.
10777 @item -mdisable-fpregs
10778 @opindex mdisable-fpregs
10779 Prevent floating point registers from being used in any manner.  This is
10780 necessary for compiling kernels which perform lazy context switching of
10781 floating point registers.  If you use this option and attempt to perform
10782 floating point operations, the compiler will abort.
10784 @item -mdisable-indexing
10785 @opindex mdisable-indexing
10786 Prevent the compiler from using indexing address modes.  This avoids some
10787 rather obscure problems when compiling MIG generated code under MACH@.
10789 @item -mno-space-regs
10790 @opindex mno-space-regs
10791 Generate code that assumes the target has no space registers.  This allows
10792 GCC to generate faster indirect calls and use unscaled index address modes.
10794 Such code is suitable for level 0 PA systems and kernels.
10796 @item -mfast-indirect-calls
10797 @opindex mfast-indirect-calls
10798 Generate code that assumes calls never cross space boundaries.  This
10799 allows GCC to emit code which performs faster indirect calls.
10801 This option will not work in the presence of shared libraries or nested
10802 functions.
10804 @item -mfixed-range=@var{register-range}
10805 @opindex mfixed-range
10806 Generate code treating the given register range as fixed registers.
10807 A fixed register is one that the register allocator can not use.  This is
10808 useful when compiling kernel code.  A register range is specified as
10809 two registers separated by a dash.  Multiple register ranges can be
10810 specified separated by a comma.
10812 @item -mlong-load-store
10813 @opindex mlong-load-store
10814 Generate 3-instruction load and store sequences as sometimes required by
10815 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
10816 the HP compilers.
10818 @item -mportable-runtime
10819 @opindex mportable-runtime
10820 Use the portable calling conventions proposed by HP for ELF systems.
10822 @item -mgas
10823 @opindex mgas
10824 Enable the use of assembler directives only GAS understands.
10826 @item -mschedule=@var{cpu-type}
10827 @opindex mschedule
10828 Schedule code according to the constraints for the machine type
10829 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
10830 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
10831 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
10832 proper scheduling option for your machine.  The default scheduling is
10833 @samp{8000}.
10835 @item -mlinker-opt
10836 @opindex mlinker-opt
10837 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
10838 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
10839 linkers in which they give bogus error messages when linking some programs.
10841 @item -msoft-float
10842 @opindex msoft-float
10843 Generate output containing library calls for floating point.
10844 @strong{Warning:} the requisite libraries are not available for all HPPA
10845 targets.  Normally the facilities of the machine's usual C compiler are
10846 used, but this cannot be done directly in cross-compilation.  You must make
10847 your own arrangements to provide suitable library functions for
10848 cross-compilation.
10850 @option{-msoft-float} changes the calling convention in the output file;
10851 therefore, it is only useful if you compile @emph{all} of a program with
10852 this option.  In particular, you need to compile @file{libgcc.a}, the
10853 library that comes with GCC, with @option{-msoft-float} in order for
10854 this to work.
10856 @item -msio
10857 @opindex msio
10858 Generate the predefine, @code{_SIO}, for server IO@.  The default is
10859 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
10860 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
10861 options are available under HP-UX and HI-UX@.
10863 @item -mgnu-ld
10864 @opindex gnu-ld
10865 Use GNU ld specific options.  This passes @option{-shared} to ld when
10866 building a shared library.  It is the default when GCC is configured,
10867 explicitly or implicitly, with the GNU linker.  This option does not
10868 have any affect on which ld is called, it only changes what parameters
10869 are passed to that ld.  The ld that is called is determined by the
10870 @option{--with-ld} configure option, GCC's program search path, and
10871 finally by the user's @env{PATH}.  The linker used by GCC can be printed
10872 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
10873 on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
10875 @item -mhp-ld
10876 @opindex hp-ld
10877 Use HP ld specific options.  This passes @option{-b} to ld when building
10878 a shared library and passes @option{+Accept TypeMismatch} to ld on all
10879 links.  It is the default when GCC is configured, explicitly or
10880 implicitly, with the HP linker.  This option does not have any affect on
10881 which ld is called, it only changes what parameters are passed to that
10882 ld.  The ld that is called is determined by the @option{--with-ld}
10883 configure option, GCC's program search path, and finally by the user's
10884 @env{PATH}.  The linker used by GCC can be printed using @samp{which
10885 `gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
10886 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
10888 @item -mlong-calls
10889 @opindex mno-long-calls
10890 Generate code that uses long call sequences.  This ensures that a call
10891 is always able to reach linker generated stubs.  The default is to generate
10892 long calls only when the distance from the call site to the beginning
10893 of the function or translation unit, as the case may be, exceeds a
10894 predefined limit set by the branch type being used.  The limits for
10895 normal calls are 7,600,000 and 240,000 bytes, respectively for the
10896 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
10897 240,000 bytes.
10899 Distances are measured from the beginning of functions when using the
10900 @option{-ffunction-sections} option, or when using the @option{-mgas}
10901 and @option{-mno-portable-runtime} options together under HP-UX with
10902 the SOM linker.
10904 It is normally not desirable to use this option as it will degrade
10905 performance.  However, it may be useful in large applications,
10906 particularly when partial linking is used to build the application.
10908 The types of long calls used depends on the capabilities of the
10909 assembler and linker, and the type of code being generated.  The
10910 impact on systems that support long absolute calls, and long pic
10911 symbol-difference or pc-relative calls should be relatively small.
10912 However, an indirect call is used on 32-bit ELF systems in pic code
10913 and it is quite long.
10915 @item -munix=@var{unix-std}
10916 @opindex march
10917 Generate compiler predefines and select a startfile for the specified
10918 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
10919 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
10920 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
10921 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
10922 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
10923 and later.
10925 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
10926 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
10927 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
10928 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
10929 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
10930 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
10932 It is @emph{important} to note that this option changes the interfaces
10933 for various library routines.  It also affects the operational behavior
10934 of the C library.  Thus, @emph{extreme} care is needed in using this
10935 option.
10937 Library code that is intended to operate with more than one UNIX
10938 standard must test, set and restore the variable @var{__xpg4_extended_mask}
10939 as appropriate.  Most GNU software doesn't provide this capability.
10941 @item -nolibdld
10942 @opindex nolibdld
10943 Suppress the generation of link options to search libdld.sl when the
10944 @option{-static} option is specified on HP-UX 10 and later.
10946 @item -static
10947 @opindex static
10948 The HP-UX implementation of setlocale in libc has a dependency on
10949 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
10950 when the @option{-static} option is specified, special link options
10951 are needed to resolve this dependency.
10953 On HP-UX 10 and later, the GCC driver adds the necessary options to
10954 link with libdld.sl when the @option{-static} option is specified.
10955 This causes the resulting binary to be dynamic.  On the 64-bit port,
10956 the linkers generate dynamic binaries by default in any case.  The
10957 @option{-nolibdld} option can be used to prevent the GCC driver from
10958 adding these link options.
10960 @item -threads
10961 @opindex threads
10962 Add support for multithreading with the @dfn{dce thread} library
10963 under HP-UX@.  This option sets flags for both the preprocessor and
10964 linker.
10965 @end table
10967 @node i386 and x86-64 Options
10968 @subsection Intel 386 and AMD x86-64 Options
10969 @cindex i386 Options
10970 @cindex x86-64 Options
10971 @cindex Intel 386 Options
10972 @cindex AMD x86-64 Options
10974 These @samp{-m} options are defined for the i386 and x86-64 family of
10975 computers:
10977 @table @gcctabopt
10978 @item -mtune=@var{cpu-type}
10979 @opindex mtune
10980 Tune to @var{cpu-type} everything applicable about the generated code, except
10981 for the ABI and the set of available instructions.  The choices for
10982 @var{cpu-type} are:
10983 @table @emph
10984 @item generic
10985 Produce code optimized for the most common IA32/AMD64/EM64T processors.
10986 If you know the CPU on which your code will run, then you should use
10987 the corresponding @option{-mtune} option instead of
10988 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
10989 of your application will have, then you should use this option.
10991 As new processors are deployed in the marketplace, the behavior of this
10992 option will change.  Therefore, if you upgrade to a newer version of
10993 GCC, the code generated option will change to reflect the processors
10994 that were most common when that version of GCC was released.
10996 There is no @option{-march=generic} option because @option{-march}
10997 indicates the instruction set the compiler can use, and there is no
10998 generic instruction set applicable to all processors.  In contrast,
10999 @option{-mtune} indicates the processor (or, in this case, collection of
11000 processors) for which the code is optimized.
11001 @item native
11002 This selects the CPU to tune for at compilation time by determining
11003 the processor type of the compiling machine.  Using @option{-mtune=native}
11004 will produce code optimized for the local machine under the constraints
11005 of the selected instruction set.  Using @option{-march=native} will
11006 enable all instruction subsets supported by the local machine (hence
11007 the result might not run on different machines).
11008 @item i386
11009 Original Intel's i386 CPU@.
11010 @item i486
11011 Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
11012 @item i586, pentium
11013 Intel Pentium CPU with no MMX support.
11014 @item pentium-mmx
11015 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
11016 @item pentiumpro
11017 Intel PentiumPro CPU@.
11018 @item i686
11019 Same as @code{generic}, but when used as @code{march} option, PentiumPro
11020 instruction set will be used, so the code will run on all i686 family chips.
11021 @item pentium2
11022 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
11023 @item pentium3, pentium3m
11024 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
11025 support.
11026 @item pentium-m
11027 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
11028 support.  Used by Centrino notebooks.
11029 @item pentium4, pentium4m
11030 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
11031 @item prescott
11032 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
11033 set support.
11034 @item nocona
11035 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
11036 SSE2 and SSE3 instruction set support.
11037 @item core2
11038 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
11039 instruction set support.
11040 @item atom
11041 Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
11042 instruction set support.
11043 @item k6
11044 AMD K6 CPU with MMX instruction set support.
11045 @item k6-2, k6-3
11046 Improved versions of AMD K6 CPU with MMX and 3dNOW!@: instruction set support.
11047 @item athlon, athlon-tbird
11048 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW!@: and SSE prefetch instructions
11049 support.
11050 @item athlon-4, athlon-xp, athlon-mp
11051 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW!@: and full SSE
11052 instruction set support.
11053 @item k8, opteron, athlon64, athlon-fx
11054 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
11055 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW!@: and 64-bit instruction set extensions.)
11056 @item k8-sse3, opteron-sse3, athlon64-sse3
11057 Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
11058 @item amdfam10, barcelona
11059 AMD Family 10h core based CPUs with x86-64 instruction set support.  (This
11060 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
11061 instruction set extensions.)
11062 @item winchip-c6
11063 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
11064 set support.
11065 @item winchip2
11066 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!@:
11067 instruction set support.
11068 @item c3
11069 Via C3 CPU with MMX and 3dNOW!@: instruction set support.  (No scheduling is
11070 implemented for this chip.)
11071 @item c3-2
11072 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
11073 implemented for this chip.)
11074 @item geode
11075 Embedded AMD CPU with MMX and 3dNOW! instruction set support.
11076 @end table
11078 While picking a specific @var{cpu-type} will schedule things appropriately
11079 for that particular chip, the compiler will not generate any code that
11080 does not run on the i386 without the @option{-march=@var{cpu-type}} option
11081 being used.
11083 @item -march=@var{cpu-type}
11084 @opindex march
11085 Generate instructions for the machine type @var{cpu-type}.  The choices
11086 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
11087 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
11089 @item -mcpu=@var{cpu-type}
11090 @opindex mcpu
11091 A deprecated synonym for @option{-mtune}.
11093 @item -mfpmath=@var{unit}
11094 @opindex mfpmath
11095 Generate floating point arithmetics for selected unit @var{unit}.  The choices
11096 for @var{unit} are:
11098 @table @samp
11099 @item 387
11100 Use the standard 387 floating point coprocessor present majority of chips and
11101 emulated otherwise.  Code compiled with this option will run almost everywhere.
11102 The temporary results are computed in 80bit precision instead of precision
11103 specified by the type resulting in slightly different results compared to most
11104 of other chips.  See @option{-ffloat-store} for more detailed description.
11106 This is the default choice for i386 compiler.
11108 @item sse
11109 Use scalar floating point instructions present in the SSE instruction set.
11110 This instruction set is supported by Pentium3 and newer chips, in the AMD line
11111 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
11112 instruction set supports only single precision arithmetics, thus the double and
11113 extended precision arithmetics is still done using 387.  Later version, present
11114 only in Pentium4 and the future AMD x86-64 chips supports double precision
11115 arithmetics too.
11117 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
11118 or @option{-msse2} switches to enable SSE extensions and make this option
11119 effective.  For the x86-64 compiler, these extensions are enabled by default.
11121 The resulting code should be considerably faster in the majority of cases and avoid
11122 the numerical instability problems of 387 code, but may break some existing
11123 code that expects temporaries to be 80bit.
11125 This is the default choice for the x86-64 compiler.
11127 @item sse,387
11128 @itemx sse+387
11129 @itemx both
11130 Attempt to utilize both instruction sets at once.  This effectively double the
11131 amount of available registers and on chips with separate execution units for
11132 387 and SSE the execution resources too.  Use this option with care, as it is
11133 still experimental, because the GCC register allocator does not model separate
11134 functional units well resulting in instable performance.
11135 @end table
11137 @item -masm=@var{dialect}
11138 @opindex masm=@var{dialect}
11139 Output asm instructions using selected @var{dialect}.  Supported
11140 choices are @samp{intel} or @samp{att} (the default one).  Darwin does
11141 not support @samp{intel}.
11143 @item -mieee-fp
11144 @itemx -mno-ieee-fp
11145 @opindex mieee-fp
11146 @opindex mno-ieee-fp
11147 Control whether or not the compiler uses IEEE floating point
11148 comparisons.  These handle correctly the case where the result of a
11149 comparison is unordered.
11151 @item -msoft-float
11152 @opindex msoft-float
11153 Generate output containing library calls for floating point.
11154 @strong{Warning:} the requisite libraries are not part of GCC@.
11155 Normally the facilities of the machine's usual C compiler are used, but
11156 this can't be done directly in cross-compilation.  You must make your
11157 own arrangements to provide suitable library functions for
11158 cross-compilation.
11160 On machines where a function returns floating point results in the 80387
11161 register stack, some floating point opcodes may be emitted even if
11162 @option{-msoft-float} is used.
11164 @item -mno-fp-ret-in-387
11165 @opindex mno-fp-ret-in-387
11166 Do not use the FPU registers for return values of functions.
11168 The usual calling convention has functions return values of types
11169 @code{float} and @code{double} in an FPU register, even if there
11170 is no FPU@.  The idea is that the operating system should emulate
11171 an FPU@.
11173 The option @option{-mno-fp-ret-in-387} causes such values to be returned
11174 in ordinary CPU registers instead.
11176 @item -mno-fancy-math-387
11177 @opindex mno-fancy-math-387
11178 Some 387 emulators do not support the @code{sin}, @code{cos} and
11179 @code{sqrt} instructions for the 387.  Specify this option to avoid
11180 generating those instructions.  This option is the default on FreeBSD,
11181 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
11182 indicates that the target cpu will always have an FPU and so the
11183 instruction will not need emulation.  As of revision 2.6.1, these
11184 instructions are not generated unless you also use the
11185 @option{-funsafe-math-optimizations} switch.
11187 @item -malign-double
11188 @itemx -mno-align-double
11189 @opindex malign-double
11190 @opindex mno-align-double
11191 Control whether GCC aligns @code{double}, @code{long double}, and
11192 @code{long long} variables on a two word boundary or a one word
11193 boundary.  Aligning @code{double} variables on a two word boundary will
11194 produce code that runs somewhat faster on a @samp{Pentium} at the
11195 expense of more memory.
11197 On x86-64, @option{-malign-double} is enabled by default.
11199 @strong{Warning:} if you use the @option{-malign-double} switch,
11200 structures containing the above types will be aligned differently than
11201 the published application binary interface specifications for the 386
11202 and will not be binary compatible with structures in code compiled
11203 without that switch.
11205 @item -m96bit-long-double
11206 @itemx -m128bit-long-double
11207 @opindex m96bit-long-double
11208 @opindex m128bit-long-double
11209 These switches control the size of @code{long double} type.  The i386
11210 application binary interface specifies the size to be 96 bits,
11211 so @option{-m96bit-long-double} is the default in 32 bit mode.
11213 Modern architectures (Pentium and newer) would prefer @code{long double}
11214 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
11215 conforming to the ABI, this would not be possible.  So specifying a
11216 @option{-m128bit-long-double} will align @code{long double}
11217 to a 16 byte boundary by padding the @code{long double} with an additional
11218 32 bit zero.
11220 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
11221 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
11223 Notice that neither of these options enable any extra precision over the x87
11224 standard of 80 bits for a @code{long double}.
11226 @strong{Warning:} if you override the default value for your target ABI, the
11227 structures and arrays containing @code{long double} variables will change
11228 their size as well as function calling convention for function taking
11229 @code{long double} will be modified.  Hence they will not be binary
11230 compatible with arrays or structures in code compiled without that switch.
11232 @item -mlarge-data-threshold=@var{number}
11233 @opindex mlarge-data-threshold=@var{number}
11234 When @option{-mcmodel=medium} is specified, the data greater than
11235 @var{threshold} are placed in large data section.  This value must be the
11236 same across all object linked into the binary and defaults to 65535.
11238 @item -mrtd
11239 @opindex mrtd
11240 Use a different function-calling convention, in which functions that
11241 take a fixed number of arguments return with the @code{ret} @var{num}
11242 instruction, which pops their arguments while returning.  This saves one
11243 instruction in the caller since there is no need to pop the arguments
11244 there.
11246 You can specify that an individual function is called with this calling
11247 sequence with the function attribute @samp{stdcall}.  You can also
11248 override the @option{-mrtd} option by using the function attribute
11249 @samp{cdecl}.  @xref{Function Attributes}.
11251 @strong{Warning:} this calling convention is incompatible with the one
11252 normally used on Unix, so you cannot use it if you need to call
11253 libraries compiled with the Unix compiler.
11255 Also, you must provide function prototypes for all functions that
11256 take variable numbers of arguments (including @code{printf});
11257 otherwise incorrect code will be generated for calls to those
11258 functions.
11260 In addition, seriously incorrect code will result if you call a
11261 function with too many arguments.  (Normally, extra arguments are
11262 harmlessly ignored.)
11264 @item -mregparm=@var{num}
11265 @opindex mregparm
11266 Control how many registers are used to pass integer arguments.  By
11267 default, no registers are used to pass arguments, and at most 3
11268 registers can be used.  You can control this behavior for a specific
11269 function by using the function attribute @samp{regparm}.
11270 @xref{Function Attributes}.
11272 @strong{Warning:} if you use this switch, and
11273 @var{num} is nonzero, then you must build all modules with the same
11274 value, including any libraries.  This includes the system libraries and
11275 startup modules.
11277 @item -msseregparm
11278 @opindex msseregparm
11279 Use SSE register passing conventions for float and double arguments
11280 and return values.  You can control this behavior for a specific
11281 function by using the function attribute @samp{sseregparm}.
11282 @xref{Function Attributes}.
11284 @strong{Warning:} if you use this switch then you must build all
11285 modules with the same value, including any libraries.  This includes
11286 the system libraries and startup modules.
11288 @item -mpc32
11289 @itemx -mpc64
11290 @itemx -mpc80
11291 @opindex mpc32
11292 @opindex mpc64
11293 @opindex mpc80
11295 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
11296 is specified, the significands of results of floating-point operations are
11297 rounded to 24 bits (single precision); @option{-mpc64} rounds the
11298 significands of results of floating-point operations to 53 bits (double
11299 precision) and @option{-mpc80} rounds the significands of results of
11300 floating-point operations to 64 bits (extended double precision), which is
11301 the default.  When this option is used, floating-point operations in higher
11302 precisions are not available to the programmer without setting the FPU
11303 control word explicitly.
11305 Setting the rounding of floating-point operations to less than the default
11306 80 bits can speed some programs by 2% or more.  Note that some mathematical
11307 libraries assume that extended precision (80 bit) floating-point operations
11308 are enabled by default; routines in such libraries could suffer significant
11309 loss of accuracy, typically through so-called "catastrophic cancellation",
11310 when this option is used to set the precision to less than extended precision. 
11312 @item -mstackrealign
11313 @opindex mstackrealign
11314 Realign the stack at entry.  On the Intel x86, the @option{-mstackrealign}
11315 option will generate an alternate prologue and epilogue that realigns the
11316 runtime stack if necessary.  This supports mixing legacy codes that keep
11317 a 4-byte aligned stack with modern codes that keep a 16-byte stack for
11318 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
11319 applicable to individual functions.
11321 @item -mpreferred-stack-boundary=@var{num}
11322 @opindex mpreferred-stack-boundary
11323 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
11324 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
11325 the default is 4 (16 bytes or 128 bits).
11327 @item -mincoming-stack-boundary=@var{num}
11328 @opindex mincoming-stack-boundary
11329 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
11330 boundary.  If @option{-mincoming-stack-boundary} is not specified,
11331 the one specified by @option{-mpreferred-stack-boundary} will be used.
11333 On Pentium and PentiumPro, @code{double} and @code{long double} values
11334 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
11335 suffer significant run time performance penalties.  On Pentium III, the
11336 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
11337 properly if it is not 16 byte aligned.
11339 To ensure proper alignment of this values on the stack, the stack boundary
11340 must be as aligned as that required by any value stored on the stack.
11341 Further, every function must be generated such that it keeps the stack
11342 aligned.  Thus calling a function compiled with a higher preferred
11343 stack boundary from a function compiled with a lower preferred stack
11344 boundary will most likely misalign the stack.  It is recommended that
11345 libraries that use callbacks always use the default setting.
11347 This extra alignment does consume extra stack space, and generally
11348 increases code size.  Code that is sensitive to stack space usage, such
11349 as embedded systems and operating system kernels, may want to reduce the
11350 preferred alignment to @option{-mpreferred-stack-boundary=2}.
11352 @item -mmmx
11353 @itemx -mno-mmx
11354 @itemx -msse
11355 @itemx -mno-sse
11356 @itemx -msse2
11357 @itemx -mno-sse2
11358 @itemx -msse3
11359 @itemx -mno-sse3
11360 @itemx -mssse3
11361 @itemx -mno-ssse3
11362 @itemx -msse4.1
11363 @itemx -mno-sse4.1
11364 @itemx -msse4.2
11365 @itemx -mno-sse4.2
11366 @itemx -msse4
11367 @itemx -mno-sse4
11368 @itemx -mavx
11369 @itemx -mno-avx
11370 @itemx -maes
11371 @itemx -mno-aes
11372 @itemx -mpclmul
11373 @itemx -mno-pclmul
11374 @itemx -msse4a
11375 @itemx -mno-sse4a
11376 @itemx -msse5
11377 @itemx -mno-sse5
11378 @itemx -m3dnow
11379 @itemx -mno-3dnow
11380 @itemx -mpopcnt
11381 @itemx -mno-popcnt
11382 @itemx -mabm
11383 @itemx -mno-abm
11384 @opindex mmmx
11385 @opindex mno-mmx
11386 @opindex msse
11387 @opindex mno-sse
11388 @opindex m3dnow
11389 @opindex mno-3dnow
11390 These switches enable or disable the use of instructions in the MMX,
11391 SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AES, PCLMUL, SSE4A, SSE5, ABM or
11392 3DNow!@: extended instruction sets.
11393 These extensions are also available as built-in functions: see
11394 @ref{X86 Built-in Functions}, for details of the functions enabled and
11395 disabled by these switches.
11397 To have SSE/SSE2 instructions generated automatically from floating-point
11398 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
11400 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
11401 generates new AVX instructions or AVX equivalence for all SSEx instructions
11402 when needed.
11404 These options will enable GCC to use these extended instructions in
11405 generated code, even without @option{-mfpmath=sse}.  Applications which
11406 perform runtime CPU detection must compile separate files for each
11407 supported architecture, using the appropriate flags.  In particular,
11408 the file containing the CPU detection code should be compiled without
11409 these options.
11411 @item -mcld
11412 @opindex mcld
11413 This option instructs GCC to emit a @code{cld} instruction in the prologue
11414 of functions that use string instructions.  String instructions depend on
11415 the DF flag to select between autoincrement or autodecrement mode.  While the
11416 ABI specifies the DF flag to be cleared on function entry, some operating
11417 systems violate this specification by not clearing the DF flag in their
11418 exception dispatchers.  The exception handler can be invoked with the DF flag
11419 set which leads to wrong direction mode, when string instructions are used.
11420 This option can be enabled by default on 32-bit x86 targets by configuring
11421 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
11422 instructions can be suppressed with the @option{-mno-cld} compiler option
11423 in this case.
11425 @item -mcx16
11426 @opindex mcx16
11427 This option will enable GCC to use CMPXCHG16B instruction in generated code.
11428 CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
11429 data types.  This is useful for high resolution counters that could be updated
11430 by multiple processors (or cores).  This instruction is generated as part of
11431 atomic built-in functions: see @ref{Atomic Builtins} for details.
11433 @item -msahf
11434 @opindex msahf
11435 This option will enable GCC to use SAHF instruction in generated 64-bit code.
11436 Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
11437 by AMD64 until introduction of Pentium 4 G1 step in December 2005.  LAHF and
11438 SAHF are load and store instructions, respectively, for certain status flags.
11439 In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
11440 or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
11442 @item -mrecip
11443 @opindex mrecip
11444 This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
11445 vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
11446 to increase precision instead of DIVSS and SQRTSS (and their vectorized
11447 variants) for single precision floating point arguments.  These instructions
11448 are generated only when @option{-funsafe-math-optimizations} is enabled
11449 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
11450 Note that while the throughput of the sequence is higher than the throughput
11451 of the non-reciprocal instruction, the precision of the sequence can be
11452 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
11454 @item -mveclibabi=@var{type}
11455 @opindex mveclibabi
11456 Specifies the ABI type to use for vectorizing intrinsics using an
11457 external library.  Supported types are @code{svml} for the Intel short
11458 vector math library and @code{acml} for the AMD math core library style
11459 of interfacing.  GCC will currently emit calls to @code{vmldExp2},
11460 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
11461 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
11462 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
11463 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
11464 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
11465 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
11466 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
11467 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
11468 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
11469 function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
11470 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
11471 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
11472 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
11473 @code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
11474 when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
11475 @option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
11476 compatible library will have to be specified at link time.
11478 @item -mabi=@var{name}
11479 @opindex mabi
11480 Generate code for the specified calling convention.  Permissible values
11481 are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
11482 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
11483 ABI when targeting Windows.  On all other systems, the default is the
11484 SYSV ABI.  You can control this behavior for a specific function by
11485 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
11486 @xref{Function Attributes}.
11488 @item -mpush-args
11489 @itemx -mno-push-args
11490 @opindex mpush-args
11491 @opindex mno-push-args
11492 Use PUSH operations to store outgoing parameters.  This method is shorter
11493 and usually equally fast as method using SUB/MOV operations and is enabled
11494 by default.  In some cases disabling it may improve performance because of
11495 improved scheduling and reduced dependencies.
11497 @item -maccumulate-outgoing-args
11498 @opindex maccumulate-outgoing-args
11499 If enabled, the maximum amount of space required for outgoing arguments will be
11500 computed in the function prologue.  This is faster on most modern CPUs
11501 because of reduced dependencies, improved scheduling and reduced stack usage
11502 when preferred stack boundary is not equal to 2.  The drawback is a notable
11503 increase in code size.  This switch implies @option{-mno-push-args}.
11505 @item -mthreads
11506 @opindex mthreads
11507 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
11508 on thread-safe exception handling must compile and link all code with the
11509 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
11510 @option{-D_MT}; when linking, it links in a special thread helper library
11511 @option{-lmingwthrd} which cleans up per thread exception handling data.
11513 @item -mno-align-stringops
11514 @opindex mno-align-stringops
11515 Do not align destination of inlined string operations.  This switch reduces
11516 code size and improves performance in case the destination is already aligned,
11517 but GCC doesn't know about it.
11519 @item -minline-all-stringops
11520 @opindex minline-all-stringops
11521 By default GCC inlines string operations only when destination is known to be
11522 aligned at least to 4 byte boundary.  This enables more inlining, increase code
11523 size, but may improve performance of code that depends on fast memcpy, strlen
11524 and memset for short lengths.
11526 @item -minline-stringops-dynamically
11527 @opindex minline-stringops-dynamically
11528 For string operation of unknown size, inline runtime checks so for small
11529 blocks inline code is used, while for large blocks library call is used.
11531 @item -mstringop-strategy=@var{alg}
11532 @opindex mstringop-strategy=@var{alg}
11533 Overwrite internal decision heuristic about particular algorithm to inline
11534 string operation with.  The allowed values are @code{rep_byte},
11535 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
11536 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
11537 expanding inline loop, @code{libcall} for always expanding library call.
11539 @item -momit-leaf-frame-pointer
11540 @opindex momit-leaf-frame-pointer
11541 Don't keep the frame pointer in a register for leaf functions.  This
11542 avoids the instructions to save, set up and restore frame pointers and
11543 makes an extra register available in leaf functions.  The option
11544 @option{-fomit-frame-pointer} removes the frame pointer for all functions
11545 which might make debugging harder.
11547 @item -mtls-direct-seg-refs
11548 @itemx -mno-tls-direct-seg-refs
11549 @opindex mtls-direct-seg-refs
11550 Controls whether TLS variables may be accessed with offsets from the
11551 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
11552 or whether the thread base pointer must be added.  Whether or not this
11553 is legal depends on the operating system, and whether it maps the
11554 segment to cover the entire TLS area.
11556 For systems that use GNU libc, the default is on.
11558 @item -mfused-madd
11559 @itemx -mno-fused-madd
11560 @opindex mfused-madd
11561 Enable automatic generation of fused floating point multiply-add instructions
11562 if the ISA supports such instructions.  The -mfused-madd option is on by
11563 default.  The fused multiply-add instructions have a different
11564 rounding behavior compared to executing a multiply followed by an add.
11566 @item -msse2avx
11567 @itemx -mno-sse2avx
11568 @opindex msse2avx
11569 Specify that the assembler should encode SSE instructions with VEX
11570 prefix.  The option @option{-mavx} turns this on by default.
11571 @end table
11573 These @samp{-m} switches are supported in addition to the above
11574 on AMD x86-64 processors in 64-bit environments.
11576 @table @gcctabopt
11577 @item -m32
11578 @itemx -m64
11579 @opindex m32
11580 @opindex m64
11581 Generate code for a 32-bit or 64-bit environment.
11582 The 32-bit environment sets int, long and pointer to 32 bits and
11583 generates code that runs on any i386 system.
11584 The 64-bit environment sets int to 32 bits and long and pointer
11585 to 64 bits and generates code for AMD's x86-64 architecture. For
11586 darwin only the -m64 option turns off the @option{-fno-pic} and
11587 @option{-mdynamic-no-pic} options.
11589 @item -mno-red-zone
11590 @opindex no-red-zone
11591 Do not use a so called red zone for x86-64 code.  The red zone is mandated
11592 by the x86-64 ABI, it is a 128-byte area beyond the location of the
11593 stack pointer that will not be modified by signal or interrupt handlers
11594 and therefore can be used for temporary data without adjusting the stack
11595 pointer.  The flag @option{-mno-red-zone} disables this red zone.
11597 @item -mcmodel=small
11598 @opindex mcmodel=small
11599 Generate code for the small code model: the program and its symbols must
11600 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
11601 Programs can be statically or dynamically linked.  This is the default
11602 code model.
11604 @item -mcmodel=kernel
11605 @opindex mcmodel=kernel
11606 Generate code for the kernel code model.  The kernel runs in the
11607 negative 2 GB of the address space.
11608 This model has to be used for Linux kernel code.
11610 @item -mcmodel=medium
11611 @opindex mcmodel=medium
11612 Generate code for the medium model: The program is linked in the lower 2
11613 GB of the address space.  Small symbols are also placed there.  Symbols
11614 with sizes larger than @option{-mlarge-data-threshold} are put into
11615 large data or bss sections and can be located above 2GB.  Programs can
11616 be statically or dynamically linked.
11618 @item -mcmodel=large
11619 @opindex mcmodel=large
11620 Generate code for the large model: This model makes no assumptions
11621 about addresses and sizes of sections.
11622 @end table
11624 @node IA-64 Options
11625 @subsection IA-64 Options
11626 @cindex IA-64 Options
11628 These are the @samp{-m} options defined for the Intel IA-64 architecture.
11630 @table @gcctabopt
11631 @item -mbig-endian
11632 @opindex mbig-endian
11633 Generate code for a big endian target.  This is the default for HP-UX@.
11635 @item -mlittle-endian
11636 @opindex mlittle-endian
11637 Generate code for a little endian target.  This is the default for AIX5
11638 and GNU/Linux.
11640 @item -mgnu-as
11641 @itemx -mno-gnu-as
11642 @opindex mgnu-as
11643 @opindex mno-gnu-as
11644 Generate (or don't) code for the GNU assembler.  This is the default.
11645 @c Also, this is the default if the configure option @option{--with-gnu-as}
11646 @c is used.
11648 @item -mgnu-ld
11649 @itemx -mno-gnu-ld
11650 @opindex mgnu-ld
11651 @opindex mno-gnu-ld
11652 Generate (or don't) code for the GNU linker.  This is the default.
11653 @c Also, this is the default if the configure option @option{--with-gnu-ld}
11654 @c is used.
11656 @item -mno-pic
11657 @opindex mno-pic
11658 Generate code that does not use a global pointer register.  The result
11659 is not position independent code, and violates the IA-64 ABI@.
11661 @item -mvolatile-asm-stop
11662 @itemx -mno-volatile-asm-stop
11663 @opindex mvolatile-asm-stop
11664 @opindex mno-volatile-asm-stop
11665 Generate (or don't) a stop bit immediately before and after volatile asm
11666 statements.
11668 @item -mregister-names
11669 @itemx -mno-register-names
11670 @opindex mregister-names
11671 @opindex mno-register-names
11672 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
11673 the stacked registers.  This may make assembler output more readable.
11675 @item -mno-sdata
11676 @itemx -msdata
11677 @opindex mno-sdata
11678 @opindex msdata
11679 Disable (or enable) optimizations that use the small data section.  This may
11680 be useful for working around optimizer bugs.
11682 @item -mconstant-gp
11683 @opindex mconstant-gp
11684 Generate code that uses a single constant global pointer value.  This is
11685 useful when compiling kernel code.
11687 @item -mauto-pic
11688 @opindex mauto-pic
11689 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
11690 This is useful when compiling firmware code.
11692 @item -minline-float-divide-min-latency
11693 @opindex minline-float-divide-min-latency
11694 Generate code for inline divides of floating point values
11695 using the minimum latency algorithm.
11697 @item -minline-float-divide-max-throughput
11698 @opindex minline-float-divide-max-throughput
11699 Generate code for inline divides of floating point values
11700 using the maximum throughput algorithm.
11702 @item -minline-int-divide-min-latency
11703 @opindex minline-int-divide-min-latency
11704 Generate code for inline divides of integer values
11705 using the minimum latency algorithm.
11707 @item -minline-int-divide-max-throughput
11708 @opindex minline-int-divide-max-throughput
11709 Generate code for inline divides of integer values
11710 using the maximum throughput algorithm.
11712 @item -minline-sqrt-min-latency
11713 @opindex minline-sqrt-min-latency
11714 Generate code for inline square roots
11715 using the minimum latency algorithm.
11717 @item -minline-sqrt-max-throughput
11718 @opindex minline-sqrt-max-throughput
11719 Generate code for inline square roots
11720 using the maximum throughput algorithm.
11722 @item -mno-dwarf2-asm
11723 @itemx -mdwarf2-asm
11724 @opindex mno-dwarf2-asm
11725 @opindex mdwarf2-asm
11726 Don't (or do) generate assembler code for the DWARF2 line number debugging
11727 info.  This may be useful when not using the GNU assembler.
11729 @item -mearly-stop-bits
11730 @itemx -mno-early-stop-bits
11731 @opindex mearly-stop-bits
11732 @opindex mno-early-stop-bits
11733 Allow stop bits to be placed earlier than immediately preceding the
11734 instruction that triggered the stop bit.  This can improve instruction
11735 scheduling, but does not always do so.
11737 @item -mfixed-range=@var{register-range}
11738 @opindex mfixed-range
11739 Generate code treating the given register range as fixed registers.
11740 A fixed register is one that the register allocator can not use.  This is
11741 useful when compiling kernel code.  A register range is specified as
11742 two registers separated by a dash.  Multiple register ranges can be
11743 specified separated by a comma.
11745 @item -mtls-size=@var{tls-size}
11746 @opindex mtls-size
11747 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
11750 @item -mtune=@var{cpu-type}
11751 @opindex mtune
11752 Tune the instruction scheduling for a particular CPU, Valid values are
11753 itanium, itanium1, merced, itanium2, and mckinley.
11755 @item -mt
11756 @itemx -pthread
11757 @opindex mt
11758 @opindex pthread
11759 Add support for multithreading using the POSIX threads library.  This
11760 option sets flags for both the preprocessor and linker.  It does
11761 not affect the thread safety of object code produced by the compiler or
11762 that of libraries supplied with it.  These are HP-UX specific flags.
11764 @item -milp32
11765 @itemx -mlp64
11766 @opindex milp32
11767 @opindex mlp64
11768 Generate code for a 32-bit or 64-bit environment.
11769 The 32-bit environment sets int, long and pointer to 32 bits.
11770 The 64-bit environment sets int to 32 bits and long and pointer
11771 to 64 bits.  These are HP-UX specific flags.
11773 @item -mno-sched-br-data-spec
11774 @itemx -msched-br-data-spec
11775 @opindex mno-sched-br-data-spec
11776 @opindex msched-br-data-spec
11777 (Dis/En)able data speculative scheduling before reload.
11778 This will result in generation of the ld.a instructions and
11779 the corresponding check instructions (ld.c / chk.a).
11780 The default is 'disable'.
11782 @item -msched-ar-data-spec
11783 @itemx -mno-sched-ar-data-spec
11784 @opindex msched-ar-data-spec
11785 @opindex mno-sched-ar-data-spec
11786 (En/Dis)able data speculative scheduling after reload.
11787 This will result in generation of the ld.a instructions and
11788 the corresponding check instructions (ld.c / chk.a).
11789 The default is 'enable'.
11791 @item -mno-sched-control-spec
11792 @itemx -msched-control-spec
11793 @opindex mno-sched-control-spec
11794 @opindex msched-control-spec
11795 (Dis/En)able control speculative scheduling.  This feature is
11796 available only during region scheduling (i.e.@: before reload).
11797 This will result in generation of the ld.s instructions and
11798 the corresponding check instructions chk.s .
11799 The default is 'disable'.
11801 @item -msched-br-in-data-spec
11802 @itemx -mno-sched-br-in-data-spec
11803 @opindex msched-br-in-data-spec
11804 @opindex mno-sched-br-in-data-spec
11805 (En/Dis)able speculative scheduling of the instructions that
11806 are dependent on the data speculative loads before reload.
11807 This is effective only with @option{-msched-br-data-spec} enabled.
11808 The default is 'enable'.
11810 @item -msched-ar-in-data-spec
11811 @itemx -mno-sched-ar-in-data-spec
11812 @opindex msched-ar-in-data-spec
11813 @opindex mno-sched-ar-in-data-spec
11814 (En/Dis)able speculative scheduling of the instructions that
11815 are dependent on the data speculative loads after reload.
11816 This is effective only with @option{-msched-ar-data-spec} enabled.
11817 The default is 'enable'.
11819 @item -msched-in-control-spec
11820 @itemx -mno-sched-in-control-spec
11821 @opindex msched-in-control-spec
11822 @opindex mno-sched-in-control-spec
11823 (En/Dis)able speculative scheduling of the instructions that
11824 are dependent on the control speculative loads.
11825 This is effective only with @option{-msched-control-spec} enabled.
11826 The default is 'enable'.
11828 @item -msched-ldc
11829 @itemx -mno-sched-ldc
11830 @opindex msched-ldc
11831 @opindex mno-sched-ldc
11832 (En/Dis)able use of simple data speculation checks ld.c .
11833 If disabled, only chk.a instructions will be emitted to check
11834 data speculative loads.
11835 The default is 'enable'.
11837 @item -mno-sched-control-ldc
11838 @itemx -msched-control-ldc
11839 @opindex mno-sched-control-ldc
11840 @opindex msched-control-ldc
11841 (Dis/En)able use of ld.c instructions to check control speculative loads.
11842 If enabled, in case of control speculative load with no speculatively
11843 scheduled dependent instructions this load will be emitted as ld.sa and
11844 ld.c will be used to check it.
11845 The default is 'disable'.
11847 @item -mno-sched-spec-verbose
11848 @itemx -msched-spec-verbose
11849 @opindex mno-sched-spec-verbose
11850 @opindex msched-spec-verbose
11851 (Dis/En)able printing of the information about speculative motions.
11853 @item -mno-sched-prefer-non-data-spec-insns
11854 @itemx -msched-prefer-non-data-spec-insns
11855 @opindex mno-sched-prefer-non-data-spec-insns
11856 @opindex msched-prefer-non-data-spec-insns
11857 If enabled, data speculative instructions will be chosen for schedule
11858 only if there are no other choices at the moment.  This will make
11859 the use of the data speculation much more conservative.
11860 The default is 'disable'.
11862 @item -mno-sched-prefer-non-control-spec-insns
11863 @itemx -msched-prefer-non-control-spec-insns
11864 @opindex mno-sched-prefer-non-control-spec-insns
11865 @opindex msched-prefer-non-control-spec-insns
11866 If enabled, control speculative instructions will be chosen for schedule
11867 only if there are no other choices at the moment.  This will make
11868 the use of the control speculation much more conservative.
11869 The default is 'disable'.
11871 @item -mno-sched-count-spec-in-critical-path
11872 @itemx -msched-count-spec-in-critical-path
11873 @opindex mno-sched-count-spec-in-critical-path
11874 @opindex msched-count-spec-in-critical-path
11875 If enabled, speculative dependencies will be considered during
11876 computation of the instructions priorities.  This will make the use of the
11877 speculation a bit more conservative.
11878 The default is 'disable'.
11880 @end table
11882 @node M32C Options
11883 @subsection M32C Options
11884 @cindex M32C options
11886 @table @gcctabopt
11887 @item -mcpu=@var{name}
11888 @opindex mcpu=
11889 Select the CPU for which code is generated.  @var{name} may be one of
11890 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
11891 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
11892 the M32C/80 series.
11894 @item -msim
11895 @opindex msim
11896 Specifies that the program will be run on the simulator.  This causes
11897 an alternate runtime library to be linked in which supports, for
11898 example, file I/O@.  You must not use this option when generating
11899 programs that will run on real hardware; you must provide your own
11900 runtime library for whatever I/O functions are needed.
11902 @item -memregs=@var{number}
11903 @opindex memregs=
11904 Specifies the number of memory-based pseudo-registers GCC will use
11905 during code generation.  These pseudo-registers will be used like real
11906 registers, so there is a tradeoff between GCC's ability to fit the
11907 code into available registers, and the performance penalty of using
11908 memory instead of registers.  Note that all modules in a program must
11909 be compiled with the same value for this option.  Because of that, you
11910 must not use this option with the default runtime libraries gcc
11911 builds.
11913 @end table
11915 @node M32R/D Options
11916 @subsection M32R/D Options
11917 @cindex M32R/D options
11919 These @option{-m} options are defined for Renesas M32R/D architectures:
11921 @table @gcctabopt
11922 @item -m32r2
11923 @opindex m32r2
11924 Generate code for the M32R/2@.
11926 @item -m32rx
11927 @opindex m32rx
11928 Generate code for the M32R/X@.
11930 @item -m32r
11931 @opindex m32r
11932 Generate code for the M32R@.  This is the default.
11934 @item -mmodel=small
11935 @opindex mmodel=small
11936 Assume all objects live in the lower 16MB of memory (so that their addresses
11937 can be loaded with the @code{ld24} instruction), and assume all subroutines
11938 are reachable with the @code{bl} instruction.
11939 This is the default.
11941 The addressability of a particular object can be set with the
11942 @code{model} attribute.
11944 @item -mmodel=medium
11945 @opindex mmodel=medium
11946 Assume objects may be anywhere in the 32-bit address space (the compiler
11947 will generate @code{seth/add3} instructions to load their addresses), and
11948 assume all subroutines are reachable with the @code{bl} instruction.
11950 @item -mmodel=large
11951 @opindex mmodel=large
11952 Assume objects may be anywhere in the 32-bit address space (the compiler
11953 will generate @code{seth/add3} instructions to load their addresses), and
11954 assume subroutines may not be reachable with the @code{bl} instruction
11955 (the compiler will generate the much slower @code{seth/add3/jl}
11956 instruction sequence).
11958 @item -msdata=none
11959 @opindex msdata=none
11960 Disable use of the small data area.  Variables will be put into
11961 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
11962 @code{section} attribute has been specified).
11963 This is the default.
11965 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
11966 Objects may be explicitly put in the small data area with the
11967 @code{section} attribute using one of these sections.
11969 @item -msdata=sdata
11970 @opindex msdata=sdata
11971 Put small global and static data in the small data area, but do not
11972 generate special code to reference them.
11974 @item -msdata=use
11975 @opindex msdata=use
11976 Put small global and static data in the small data area, and generate
11977 special instructions to reference them.
11979 @item -G @var{num}
11980 @opindex G
11981 @cindex smaller data references
11982 Put global and static objects less than or equal to @var{num} bytes
11983 into the small data or bss sections instead of the normal data or bss
11984 sections.  The default value of @var{num} is 8.
11985 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
11986 for this option to have any effect.
11988 All modules should be compiled with the same @option{-G @var{num}} value.
11989 Compiling with different values of @var{num} may or may not work; if it
11990 doesn't the linker will give an error message---incorrect code will not be
11991 generated.
11993 @item -mdebug
11994 @opindex mdebug
11995 Makes the M32R specific code in the compiler display some statistics
11996 that might help in debugging programs.
11998 @item -malign-loops
11999 @opindex malign-loops
12000 Align all loops to a 32-byte boundary.
12002 @item -mno-align-loops
12003 @opindex mno-align-loops
12004 Do not enforce a 32-byte alignment for loops.  This is the default.
12006 @item -missue-rate=@var{number}
12007 @opindex missue-rate=@var{number}
12008 Issue @var{number} instructions per cycle.  @var{number} can only be 1
12009 or 2.
12011 @item -mbranch-cost=@var{number}
12012 @opindex mbranch-cost=@var{number}
12013 @var{number} can only be 1 or 2.  If it is 1 then branches will be
12014 preferred over conditional code, if it is 2, then the opposite will
12015 apply.
12017 @item -mflush-trap=@var{number}
12018 @opindex mflush-trap=@var{number}
12019 Specifies the trap number to use to flush the cache.  The default is
12020 12.  Valid numbers are between 0 and 15 inclusive.
12022 @item -mno-flush-trap
12023 @opindex mno-flush-trap
12024 Specifies that the cache cannot be flushed by using a trap.
12026 @item -mflush-func=@var{name}
12027 @opindex mflush-func=@var{name}
12028 Specifies the name of the operating system function to call to flush
12029 the cache.  The default is @emph{_flush_cache}, but a function call
12030 will only be used if a trap is not available.
12032 @item -mno-flush-func
12033 @opindex mno-flush-func
12034 Indicates that there is no OS function for flushing the cache.
12036 @end table
12038 @node M680x0 Options
12039 @subsection M680x0 Options
12040 @cindex M680x0 options
12042 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
12043 The default settings depend on which architecture was selected when
12044 the compiler was configured; the defaults for the most common choices
12045 are given below.
12047 @table @gcctabopt
12048 @item -march=@var{arch}
12049 @opindex march
12050 Generate code for a specific M680x0 or ColdFire instruction set
12051 architecture.  Permissible values of @var{arch} for M680x0
12052 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
12053 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
12054 architectures are selected according to Freescale's ISA classification
12055 and the permissible values are: @samp{isaa}, @samp{isaaplus},
12056 @samp{isab} and @samp{isac}.
12058 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
12059 code for a ColdFire target.  The @var{arch} in this macro is one of the
12060 @option{-march} arguments given above.
12062 When used together, @option{-march} and @option{-mtune} select code
12063 that runs on a family of similar processors but that is optimized
12064 for a particular microarchitecture.
12066 @item -mcpu=@var{cpu}
12067 @opindex mcpu
12068 Generate code for a specific M680x0 or ColdFire processor.
12069 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
12070 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
12071 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
12072 below, which also classifies the CPUs into families:
12074 @multitable @columnfractions 0.20 0.80
12075 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
12076 @item @samp{51qe} @tab @samp{51qe}
12077 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
12078 @item @samp{5206e} @tab @samp{5206e}
12079 @item @samp{5208} @tab @samp{5207} @samp{5208}
12080 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
12081 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
12082 @item @samp{5216} @tab @samp{5214} @samp{5216}
12083 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
12084 @item @samp{5225} @tab @samp{5224} @samp{5225}
12085 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
12086 @item @samp{5249} @tab @samp{5249}
12087 @item @samp{5250} @tab @samp{5250}
12088 @item @samp{5271} @tab @samp{5270} @samp{5271}
12089 @item @samp{5272} @tab @samp{5272}
12090 @item @samp{5275} @tab @samp{5274} @samp{5275}
12091 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
12092 @item @samp{5307} @tab @samp{5307}
12093 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
12094 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
12095 @item @samp{5407} @tab @samp{5407}
12096 @item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485}
12097 @end multitable
12099 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
12100 @var{arch} is compatible with @var{cpu}.  Other combinations of
12101 @option{-mcpu} and @option{-march} are rejected.
12103 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
12104 @var{cpu} is selected.  It also defines @samp{__mcf_family_@var{family}},
12105 where the value of @var{family} is given by the table above.
12107 @item -mtune=@var{tune}
12108 @opindex mtune
12109 Tune the code for a particular microarchitecture, within the
12110 constraints set by @option{-march} and @option{-mcpu}.
12111 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
12112 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
12113 and @samp{cpu32}.  The ColdFire microarchitectures
12114 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
12116 You can also use @option{-mtune=68020-40} for code that needs
12117 to run relatively well on 68020, 68030 and 68040 targets.
12118 @option{-mtune=68020-60} is similar but includes 68060 targets
12119 as well.  These two options select the same tuning decisions as
12120 @option{-m68020-40} and @option{-m68020-60} respectively.
12122 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
12123 when tuning for 680x0 architecture @var{arch}.  It also defines
12124 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
12125 option is used.  If gcc is tuning for a range of architectures,
12126 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
12127 it defines the macros for every architecture in the range.
12129 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
12130 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
12131 of the arguments given above.
12133 @item -m68000
12134 @itemx -mc68000
12135 @opindex m68000
12136 @opindex mc68000
12137 Generate output for a 68000.  This is the default
12138 when the compiler is configured for 68000-based systems.
12139 It is equivalent to @option{-march=68000}.
12141 Use this option for microcontrollers with a 68000 or EC000 core,
12142 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
12144 @item -m68010
12145 @opindex m68010
12146 Generate output for a 68010.  This is the default
12147 when the compiler is configured for 68010-based systems.
12148 It is equivalent to @option{-march=68010}.
12150 @item -m68020
12151 @itemx -mc68020
12152 @opindex m68020
12153 @opindex mc68020
12154 Generate output for a 68020.  This is the default
12155 when the compiler is configured for 68020-based systems.
12156 It is equivalent to @option{-march=68020}.
12158 @item -m68030
12159 @opindex m68030
12160 Generate output for a 68030.  This is the default when the compiler is
12161 configured for 68030-based systems.  It is equivalent to
12162 @option{-march=68030}.
12164 @item -m68040
12165 @opindex m68040
12166 Generate output for a 68040.  This is the default when the compiler is
12167 configured for 68040-based systems.  It is equivalent to
12168 @option{-march=68040}.
12170 This option inhibits the use of 68881/68882 instructions that have to be
12171 emulated by software on the 68040.  Use this option if your 68040 does not
12172 have code to emulate those instructions.
12174 @item -m68060
12175 @opindex m68060
12176 Generate output for a 68060.  This is the default when the compiler is
12177 configured for 68060-based systems.  It is equivalent to
12178 @option{-march=68060}.
12180 This option inhibits the use of 68020 and 68881/68882 instructions that
12181 have to be emulated by software on the 68060.  Use this option if your 68060
12182 does not have code to emulate those instructions.
12184 @item -mcpu32
12185 @opindex mcpu32
12186 Generate output for a CPU32.  This is the default
12187 when the compiler is configured for CPU32-based systems.
12188 It is equivalent to @option{-march=cpu32}.
12190 Use this option for microcontrollers with a
12191 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
12192 68336, 68340, 68341, 68349 and 68360.
12194 @item -m5200
12195 @opindex m5200
12196 Generate output for a 520X ColdFire CPU@.  This is the default
12197 when the compiler is configured for 520X-based systems.
12198 It is equivalent to @option{-mcpu=5206}, and is now deprecated
12199 in favor of that option.
12201 Use this option for microcontroller with a 5200 core, including
12202 the MCF5202, MCF5203, MCF5204 and MCF5206.
12204 @item -m5206e
12205 @opindex m5206e
12206 Generate output for a 5206e ColdFire CPU@.  The option is now
12207 deprecated in favor of the equivalent @option{-mcpu=5206e}.
12209 @item -m528x
12210 @opindex m528x
12211 Generate output for a member of the ColdFire 528X family.
12212 The option is now deprecated in favor of the equivalent
12213 @option{-mcpu=528x}.
12215 @item -m5307
12216 @opindex m5307
12217 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
12218 in favor of the equivalent @option{-mcpu=5307}.
12220 @item -m5407
12221 @opindex m5407
12222 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
12223 in favor of the equivalent @option{-mcpu=5407}.
12225 @item -mcfv4e
12226 @opindex mcfv4e
12227 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
12228 This includes use of hardware floating point instructions.
12229 The option is equivalent to @option{-mcpu=547x}, and is now
12230 deprecated in favor of that option.
12232 @item -m68020-40
12233 @opindex m68020-40
12234 Generate output for a 68040, without using any of the new instructions.
12235 This results in code which can run relatively efficiently on either a
12236 68020/68881 or a 68030 or a 68040.  The generated code does use the
12237 68881 instructions that are emulated on the 68040.
12239 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
12241 @item -m68020-60
12242 @opindex m68020-60
12243 Generate output for a 68060, without using any of the new instructions.
12244 This results in code which can run relatively efficiently on either a
12245 68020/68881 or a 68030 or a 68040.  The generated code does use the
12246 68881 instructions that are emulated on the 68060.
12248 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
12250 @item -mhard-float
12251 @itemx -m68881
12252 @opindex mhard-float
12253 @opindex m68881
12254 Generate floating-point instructions.  This is the default for 68020
12255 and above, and for ColdFire devices that have an FPU@.  It defines the
12256 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
12257 on ColdFire targets.
12259 @item -msoft-float
12260 @opindex msoft-float
12261 Do not generate floating-point instructions; use library calls instead.
12262 This is the default for 68000, 68010, and 68832 targets.  It is also
12263 the default for ColdFire devices that have no FPU.
12265 @item -mdiv
12266 @itemx -mno-div
12267 @opindex mdiv
12268 @opindex mno-div
12269 Generate (do not generate) ColdFire hardware divide and remainder
12270 instructions.  If @option{-march} is used without @option{-mcpu},
12271 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
12272 architectures.  Otherwise, the default is taken from the target CPU
12273 (either the default CPU, or the one specified by @option{-mcpu}).  For
12274 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
12275 @option{-mcpu=5206e}.
12277 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
12279 @item -mshort
12280 @opindex mshort
12281 Consider type @code{int} to be 16 bits wide, like @code{short int}.
12282 Additionally, parameters passed on the stack are also aligned to a
12283 16-bit boundary even on targets whose API mandates promotion to 32-bit.
12285 @item -mno-short
12286 @opindex mno-short
12287 Do not consider type @code{int} to be 16 bits wide.  This is the default.
12289 @item -mnobitfield
12290 @itemx -mno-bitfield
12291 @opindex mnobitfield
12292 @opindex mno-bitfield
12293 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
12294 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
12296 @item -mbitfield
12297 @opindex mbitfield
12298 Do use the bit-field instructions.  The @option{-m68020} option implies
12299 @option{-mbitfield}.  This is the default if you use a configuration
12300 designed for a 68020.
12302 @item -mrtd
12303 @opindex mrtd
12304 Use a different function-calling convention, in which functions
12305 that take a fixed number of arguments return with the @code{rtd}
12306 instruction, which pops their arguments while returning.  This
12307 saves one instruction in the caller since there is no need to pop
12308 the arguments there.
12310 This calling convention is incompatible with the one normally
12311 used on Unix, so you cannot use it if you need to call libraries
12312 compiled with the Unix compiler.
12314 Also, you must provide function prototypes for all functions that
12315 take variable numbers of arguments (including @code{printf});
12316 otherwise incorrect code will be generated for calls to those
12317 functions.
12319 In addition, seriously incorrect code will result if you call a
12320 function with too many arguments.  (Normally, extra arguments are
12321 harmlessly ignored.)
12323 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
12324 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
12326 @item -mno-rtd
12327 @opindex mno-rtd
12328 Do not use the calling conventions selected by @option{-mrtd}.
12329 This is the default.
12331 @item -malign-int
12332 @itemx -mno-align-int
12333 @opindex malign-int
12334 @opindex mno-align-int
12335 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
12336 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
12337 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
12338 Aligning variables on 32-bit boundaries produces code that runs somewhat
12339 faster on processors with 32-bit busses at the expense of more memory.
12341 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
12342 align structures containing the above types  differently than
12343 most published application binary interface specifications for the m68k.
12345 @item -mpcrel
12346 @opindex mpcrel
12347 Use the pc-relative addressing mode of the 68000 directly, instead of
12348 using a global offset table.  At present, this option implies @option{-fpic},
12349 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
12350 not presently supported with @option{-mpcrel}, though this could be supported for
12351 68020 and higher processors.
12353 @item -mno-strict-align
12354 @itemx -mstrict-align
12355 @opindex mno-strict-align
12356 @opindex mstrict-align
12357 Do not (do) assume that unaligned memory references will be handled by
12358 the system.
12360 @item -msep-data
12361 Generate code that allows the data segment to be located in a different
12362 area of memory from the text segment.  This allows for execute in place in
12363 an environment without virtual memory management.  This option implies
12364 @option{-fPIC}.
12366 @item -mno-sep-data
12367 Generate code that assumes that the data segment follows the text segment.
12368 This is the default.
12370 @item -mid-shared-library
12371 Generate code that supports shared libraries via the library ID method.
12372 This allows for execute in place and shared libraries in an environment
12373 without virtual memory management.  This option implies @option{-fPIC}.
12375 @item -mno-id-shared-library
12376 Generate code that doesn't assume ID based shared libraries are being used.
12377 This is the default.
12379 @item -mshared-library-id=n
12380 Specified the identification number of the ID based shared library being
12381 compiled.  Specifying a value of 0 will generate more compact code, specifying
12382 other values will force the allocation of that number to the current
12383 library but is no more space or time efficient than omitting this option.
12385 @item -mxgot
12386 @itemx -mno-xgot
12387 @opindex mxgot
12388 @opindex mno-xgot
12389 When generating position-independent code for ColdFire, generate code
12390 that works if the GOT has more than 8192 entries.  This code is
12391 larger and slower than code generated without this option.  On M680x0
12392 processors, this option is not needed; @option{-fPIC} suffices.
12394 GCC normally uses a single instruction to load values from the GOT@.
12395 While this is relatively efficient, it only works if the GOT
12396 is smaller than about 64k.  Anything larger causes the linker
12397 to report an error such as:
12399 @cindex relocation truncated to fit (ColdFire)
12400 @smallexample
12401 relocation truncated to fit: R_68K_GOT16O foobar
12402 @end smallexample
12404 If this happens, you should recompile your code with @option{-mxgot}.
12405 It should then work with very large GOTs.  However, code generated with
12406 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
12407 the value of a global symbol.
12409 Note that some linkers, including newer versions of the GNU linker,
12410 can create multiple GOTs and sort GOT entries.  If you have such a linker,
12411 you should only need to use @option{-mxgot} when compiling a single
12412 object file that accesses more than 8192 GOT entries.  Very few do.
12414 These options have no effect unless GCC is generating
12415 position-independent code.
12417 @end table
12419 @node M68hc1x Options
12420 @subsection M68hc1x Options
12421 @cindex M68hc1x options
12423 These are the @samp{-m} options defined for the 68hc11 and 68hc12
12424 microcontrollers.  The default values for these options depends on
12425 which style of microcontroller was selected when the compiler was configured;
12426 the defaults for the most common choices are given below.
12428 @table @gcctabopt
12429 @item -m6811
12430 @itemx -m68hc11
12431 @opindex m6811
12432 @opindex m68hc11
12433 Generate output for a 68HC11.  This is the default
12434 when the compiler is configured for 68HC11-based systems.
12436 @item -m6812
12437 @itemx -m68hc12
12438 @opindex m6812
12439 @opindex m68hc12
12440 Generate output for a 68HC12.  This is the default
12441 when the compiler is configured for 68HC12-based systems.
12443 @item -m68S12
12444 @itemx -m68hcs12
12445 @opindex m68S12
12446 @opindex m68hcs12
12447 Generate output for a 68HCS12.
12449 @item -mauto-incdec
12450 @opindex mauto-incdec
12451 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
12452 addressing modes.
12454 @item -minmax
12455 @itemx -nominmax
12456 @opindex minmax
12457 @opindex mnominmax
12458 Enable the use of 68HC12 min and max instructions.
12460 @item -mlong-calls
12461 @itemx -mno-long-calls
12462 @opindex mlong-calls
12463 @opindex mno-long-calls
12464 Treat all calls as being far away (near).  If calls are assumed to be
12465 far away, the compiler will use the @code{call} instruction to
12466 call a function and the @code{rtc} instruction for returning.
12468 @item -mshort
12469 @opindex mshort
12470 Consider type @code{int} to be 16 bits wide, like @code{short int}.
12472 @item -msoft-reg-count=@var{count}
12473 @opindex msoft-reg-count
12474 Specify the number of pseudo-soft registers which are used for the
12475 code generation.  The maximum number is 32.  Using more pseudo-soft
12476 register may or may not result in better code depending on the program.
12477 The default is 4 for 68HC11 and 2 for 68HC12.
12479 @end table
12481 @node MCore Options
12482 @subsection MCore Options
12483 @cindex MCore options
12485 These are the @samp{-m} options defined for the Motorola M*Core
12486 processors.
12488 @table @gcctabopt
12490 @item -mhardlit
12491 @itemx -mno-hardlit
12492 @opindex mhardlit
12493 @opindex mno-hardlit
12494 Inline constants into the code stream if it can be done in two
12495 instructions or less.
12497 @item -mdiv
12498 @itemx -mno-div
12499 @opindex mdiv
12500 @opindex mno-div
12501 Use the divide instruction.  (Enabled by default).
12503 @item -mrelax-immediate
12504 @itemx -mno-relax-immediate
12505 @opindex mrelax-immediate
12506 @opindex mno-relax-immediate
12507 Allow arbitrary sized immediates in bit operations.
12509 @item -mwide-bitfields
12510 @itemx -mno-wide-bitfields
12511 @opindex mwide-bitfields
12512 @opindex mno-wide-bitfields
12513 Always treat bit-fields as int-sized.
12515 @item -m4byte-functions
12516 @itemx -mno-4byte-functions
12517 @opindex m4byte-functions
12518 @opindex mno-4byte-functions
12519 Force all functions to be aligned to a four byte boundary.
12521 @item -mcallgraph-data
12522 @itemx -mno-callgraph-data
12523 @opindex mcallgraph-data
12524 @opindex mno-callgraph-data
12525 Emit callgraph information.
12527 @item -mslow-bytes
12528 @itemx -mno-slow-bytes
12529 @opindex mslow-bytes
12530 @opindex mno-slow-bytes
12531 Prefer word access when reading byte quantities.
12533 @item -mlittle-endian
12534 @itemx -mbig-endian
12535 @opindex mlittle-endian
12536 @opindex mbig-endian
12537 Generate code for a little endian target.
12539 @item -m210
12540 @itemx -m340
12541 @opindex m210
12542 @opindex m340
12543 Generate code for the 210 processor.
12545 @item -mno-lsim
12546 @opindex no-lsim
12547 Assume that run-time support has been provided and so omit the
12548 simulator library (@file{libsim.a)} from the linker command line.
12550 @item -mstack-increment=@var{size}
12551 @opindex mstack-increment
12552 Set the maximum amount for a single stack increment operation.  Large
12553 values can increase the speed of programs which contain functions
12554 that need a large amount of stack space, but they can also trigger a
12555 segmentation fault if the stack is extended too much.  The default
12556 value is 0x1000.
12558 @end table
12560 @node MIPS Options
12561 @subsection MIPS Options
12562 @cindex MIPS options
12564 @table @gcctabopt
12566 @item -EB
12567 @opindex EB
12568 Generate big-endian code.
12570 @item -EL
12571 @opindex EL
12572 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
12573 configurations.
12575 @item -march=@var{arch}
12576 @opindex march
12577 Generate code that will run on @var{arch}, which can be the name of a
12578 generic MIPS ISA, or the name of a particular processor.
12579 The ISA names are:
12580 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
12581 @samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
12582 The processor names are:
12583 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
12584 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
12585 @samp{5kc}, @samp{5kf},
12586 @samp{20kc},
12587 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
12588 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
12589 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
12590 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
12591 @samp{loongson2e}, @samp{loongson2f},
12592 @samp{m4k},
12593 @samp{octeon},
12594 @samp{orion},
12595 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
12596 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
12597 @samp{rm7000}, @samp{rm9000},
12598 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
12599 @samp{sb1},
12600 @samp{sr71000},
12601 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
12602 @samp{vr5000}, @samp{vr5400}, @samp{vr5500}
12603 and @samp{xlr}.
12604 The special value @samp{from-abi} selects the
12605 most compatible architecture for the selected ABI (that is,
12606 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
12608 Native Linux/GNU toolchains also support the value @samp{native},
12609 which selects the best architecture option for the host processor.
12610 @option{-march=native} has no effect if GCC does not recognize
12611 the processor.
12613 In processor names, a final @samp{000} can be abbreviated as @samp{k}
12614 (for example, @samp{-march=r2k}).  Prefixes are optional, and
12615 @samp{vr} may be written @samp{r}.
12617 Names of the form @samp{@var{n}f2_1} refer to processors with
12618 FPUs clocked at half the rate of the core, names of the form
12619 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
12620 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
12621 processors with FPUs clocked a ratio of 3:2 with respect to the core.
12622 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
12623 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
12624 accepted as synonyms for @samp{@var{n}f1_1}.
12626 GCC defines two macros based on the value of this option.  The first
12627 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
12628 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
12629 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
12630 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
12631 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
12633 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
12634 above.  In other words, it will have the full prefix and will not
12635 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
12636 the macro names the resolved architecture (either @samp{"mips1"} or
12637 @samp{"mips3"}).  It names the default architecture when no
12638 @option{-march} option is given.
12640 @item -mtune=@var{arch}
12641 @opindex mtune
12642 Optimize for @var{arch}.  Among other things, this option controls
12643 the way instructions are scheduled, and the perceived cost of arithmetic
12644 operations.  The list of @var{arch} values is the same as for
12645 @option{-march}.
12647 When this option is not used, GCC will optimize for the processor
12648 specified by @option{-march}.  By using @option{-march} and
12649 @option{-mtune} together, it is possible to generate code that will
12650 run on a family of processors, but optimize the code for one
12651 particular member of that family.
12653 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
12654 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
12655 @samp{-march} ones described above.
12657 @item -mips1
12658 @opindex mips1
12659 Equivalent to @samp{-march=mips1}.
12661 @item -mips2
12662 @opindex mips2
12663 Equivalent to @samp{-march=mips2}.
12665 @item -mips3
12666 @opindex mips3
12667 Equivalent to @samp{-march=mips3}.
12669 @item -mips4
12670 @opindex mips4
12671 Equivalent to @samp{-march=mips4}.
12673 @item -mips32
12674 @opindex mips32
12675 Equivalent to @samp{-march=mips32}.
12677 @item -mips32r2
12678 @opindex mips32r2
12679 Equivalent to @samp{-march=mips32r2}.
12681 @item -mips64
12682 @opindex mips64
12683 Equivalent to @samp{-march=mips64}.
12685 @item -mips64r2
12686 @opindex mips64r2
12687 Equivalent to @samp{-march=mips64r2}.
12689 @item -mips16
12690 @itemx -mno-mips16
12691 @opindex mips16
12692 @opindex mno-mips16
12693 Generate (do not generate) MIPS16 code.  If GCC is targetting a
12694 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
12696 MIPS16 code generation can also be controlled on a per-function basis
12697 by means of @code{mips16} and @code{nomips16} attributes.  
12698 @xref{Function Attributes}, for more information.
12700 @item -mflip-mips16
12701 @opindex mflip-mips16
12702 Generate MIPS16 code on alternating functions.  This option is provided
12703 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
12704 not intended for ordinary use in compiling user code.
12706 @item -minterlink-mips16
12707 @itemx -mno-interlink-mips16
12708 @opindex minterlink-mips16
12709 @opindex mno-interlink-mips16
12710 Require (do not require) that non-MIPS16 code be link-compatible with
12711 MIPS16 code.
12713 For example, non-MIPS16 code cannot jump directly to MIPS16 code;
12714 it must either use a call or an indirect jump.  @option{-minterlink-mips16}
12715 therefore disables direct jumps unless GCC knows that the target of the
12716 jump is not MIPS16.
12718 @item -mabi=32
12719 @itemx -mabi=o64
12720 @itemx -mabi=n32
12721 @itemx -mabi=64
12722 @itemx -mabi=eabi
12723 @opindex mabi=32
12724 @opindex mabi=o64
12725 @opindex mabi=n32
12726 @opindex mabi=64
12727 @opindex mabi=eabi
12728 Generate code for the given ABI@.
12730 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
12731 generates 64-bit code when you select a 64-bit architecture, but you
12732 can use @option{-mgp32} to get 32-bit code instead.
12734 For information about the O64 ABI, see
12735 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
12737 GCC supports a variant of the o32 ABI in which floating-point registers
12738 are 64 rather than 32 bits wide.  You can select this combination with
12739 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @samp{mthc1}
12740 and @samp{mfhc1} instructions and is therefore only supported for
12741 MIPS32R2 processors.
12743 The register assignments for arguments and return values remain the
12744 same, but each scalar value is passed in a single 64-bit register
12745 rather than a pair of 32-bit registers.  For example, scalar
12746 floating-point values are returned in @samp{$f0} only, not a
12747 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
12748 remains the same, but all 64 bits are saved.
12750 @item -mabicalls
12751 @itemx -mno-abicalls
12752 @opindex mabicalls
12753 @opindex mno-abicalls
12754 Generate (do not generate) code that is suitable for SVR4-style
12755 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
12756 systems.
12758 @item -mshared
12759 @itemx -mno-shared
12760 Generate (do not generate) code that is fully position-independent,
12761 and that can therefore be linked into shared libraries.  This option
12762 only affects @option{-mabicalls}.
12764 All @option{-mabicalls} code has traditionally been position-independent,
12765 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
12766 as an extension, the GNU toolchain allows executables to use absolute
12767 accesses for locally-binding symbols.  It can also use shorter GP
12768 initialization sequences and generate direct calls to locally-defined
12769 functions.  This mode is selected by @option{-mno-shared}.
12771 @option{-mno-shared} depends on binutils 2.16 or higher and generates
12772 objects that can only be linked by the GNU linker.  However, the option
12773 does not affect the ABI of the final executable; it only affects the ABI
12774 of relocatable objects.  Using @option{-mno-shared} will generally make
12775 executables both smaller and quicker.
12777 @option{-mshared} is the default.
12779 @item -mplt
12780 @itemx -mno-plt
12781 @opindex mplt
12782 @opindex mno-plt
12783 Assume (do not assume) that the static and dynamic linkers
12784 support PLTs and copy relocations.  This option only affects
12785 @samp{-mno-shared -mabicalls}.  For the n64 ABI, this option
12786 has no effect without @samp{-msym32}.
12788 You can make @option{-mplt} the default by configuring
12789 GCC with @option{--with-mips-plt}.  The default is
12790 @option{-mno-plt} otherwise.
12792 @item -mxgot
12793 @itemx -mno-xgot
12794 @opindex mxgot
12795 @opindex mno-xgot
12796 Lift (do not lift) the usual restrictions on the size of the global
12797 offset table.
12799 GCC normally uses a single instruction to load values from the GOT@.
12800 While this is relatively efficient, it will only work if the GOT
12801 is smaller than about 64k.  Anything larger will cause the linker
12802 to report an error such as:
12804 @cindex relocation truncated to fit (MIPS)
12805 @smallexample
12806 relocation truncated to fit: R_MIPS_GOT16 foobar
12807 @end smallexample
12809 If this happens, you should recompile your code with @option{-mxgot}.
12810 It should then work with very large GOTs, although it will also be
12811 less efficient, since it will take three instructions to fetch the
12812 value of a global symbol.
12814 Note that some linkers can create multiple GOTs.  If you have such a
12815 linker, you should only need to use @option{-mxgot} when a single object
12816 file accesses more than 64k's worth of GOT entries.  Very few do.
12818 These options have no effect unless GCC is generating position
12819 independent code.
12821 @item -mgp32
12822 @opindex mgp32
12823 Assume that general-purpose registers are 32 bits wide.
12825 @item -mgp64
12826 @opindex mgp64
12827 Assume that general-purpose registers are 64 bits wide.
12829 @item -mfp32
12830 @opindex mfp32
12831 Assume that floating-point registers are 32 bits wide.
12833 @item -mfp64
12834 @opindex mfp64
12835 Assume that floating-point registers are 64 bits wide.
12837 @item -mhard-float
12838 @opindex mhard-float
12839 Use floating-point coprocessor instructions.
12841 @item -msoft-float
12842 @opindex msoft-float
12843 Do not use floating-point coprocessor instructions.  Implement
12844 floating-point calculations using library calls instead.
12846 @item -msingle-float
12847 @opindex msingle-float
12848 Assume that the floating-point coprocessor only supports single-precision
12849 operations.
12851 @item -mdouble-float
12852 @opindex mdouble-float
12853 Assume that the floating-point coprocessor supports double-precision
12854 operations.  This is the default.
12856 @item -mllsc
12857 @itemx -mno-llsc
12858 @opindex mllsc
12859 @opindex mno-llsc
12860 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
12861 implement atomic memory built-in functions.  When neither option is
12862 specified, GCC will use the instructions if the target architecture
12863 supports them.
12865 @option{-mllsc} is useful if the runtime environment can emulate the
12866 instructions and @option{-mno-llsc} can be useful when compiling for
12867 nonstandard ISAs.  You can make either option the default by
12868 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
12869 respectively.  @option{--with-llsc} is the default for some
12870 configurations; see the installation documentation for details.
12872 @item -mdsp
12873 @itemx -mno-dsp
12874 @opindex mdsp
12875 @opindex mno-dsp
12876 Use (do not use) revision 1 of the MIPS DSP ASE@.
12877 @xref{MIPS DSP Built-in Functions}.  This option defines the
12878 preprocessor macro @samp{__mips_dsp}.  It also defines
12879 @samp{__mips_dsp_rev} to 1.
12881 @item -mdspr2
12882 @itemx -mno-dspr2
12883 @opindex mdspr2
12884 @opindex mno-dspr2
12885 Use (do not use) revision 2 of the MIPS DSP ASE@.
12886 @xref{MIPS DSP Built-in Functions}.  This option defines the
12887 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
12888 It also defines @samp{__mips_dsp_rev} to 2.
12890 @item -msmartmips
12891 @itemx -mno-smartmips
12892 @opindex msmartmips
12893 @opindex mno-smartmips
12894 Use (do not use) the MIPS SmartMIPS ASE.
12896 @item -mpaired-single
12897 @itemx -mno-paired-single
12898 @opindex mpaired-single
12899 @opindex mno-paired-single
12900 Use (do not use) paired-single floating-point instructions.
12901 @xref{MIPS Paired-Single Support}.  This option requires
12902 hardware floating-point support to be enabled.
12904 @item -mdmx
12905 @itemx -mno-mdmx
12906 @opindex mdmx
12907 @opindex mno-mdmx
12908 Use (do not use) MIPS Digital Media Extension instructions.
12909 This option can only be used when generating 64-bit code and requires
12910 hardware floating-point support to be enabled.
12912 @item -mips3d
12913 @itemx -mno-mips3d
12914 @opindex mips3d
12915 @opindex mno-mips3d
12916 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
12917 The option @option{-mips3d} implies @option{-mpaired-single}.
12919 @item -mmt
12920 @itemx -mno-mt
12921 @opindex mmt
12922 @opindex mno-mt
12923 Use (do not use) MT Multithreading instructions.
12925 @item -mlong64
12926 @opindex mlong64
12927 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
12928 an explanation of the default and the way that the pointer size is
12929 determined.
12931 @item -mlong32
12932 @opindex mlong32
12933 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
12935 The default size of @code{int}s, @code{long}s and pointers depends on
12936 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
12937 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
12938 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
12939 or the same size as integer registers, whichever is smaller.
12941 @item -msym32
12942 @itemx -mno-sym32
12943 @opindex msym32
12944 @opindex mno-sym32
12945 Assume (do not assume) that all symbols have 32-bit values, regardless
12946 of the selected ABI@.  This option is useful in combination with
12947 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
12948 to generate shorter and faster references to symbolic addresses.
12950 @item -G @var{num}
12951 @opindex G
12952 Put definitions of externally-visible data in a small data section
12953 if that data is no bigger than @var{num} bytes.  GCC can then access
12954 the data more efficiently; see @option{-mgpopt} for details.
12956 The default @option{-G} option depends on the configuration.
12958 @item -mlocal-sdata
12959 @itemx -mno-local-sdata
12960 @opindex mlocal-sdata
12961 @opindex mno-local-sdata
12962 Extend (do not extend) the @option{-G} behavior to local data too,
12963 such as to static variables in C@.  @option{-mlocal-sdata} is the
12964 default for all configurations.
12966 If the linker complains that an application is using too much small data,
12967 you might want to try rebuilding the less performance-critical parts with
12968 @option{-mno-local-sdata}.  You might also want to build large
12969 libraries with @option{-mno-local-sdata}, so that the libraries leave
12970 more room for the main program.
12972 @item -mextern-sdata
12973 @itemx -mno-extern-sdata
12974 @opindex mextern-sdata
12975 @opindex mno-extern-sdata
12976 Assume (do not assume) that externally-defined data will be in
12977 a small data section if that data is within the @option{-G} limit.
12978 @option{-mextern-sdata} is the default for all configurations.
12980 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
12981 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
12982 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
12983 is placed in a small data section.  If @var{Var} is defined by another
12984 module, you must either compile that module with a high-enough
12985 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
12986 definition.  If @var{Var} is common, you must link the application
12987 with a high-enough @option{-G} setting.
12989 The easiest way of satisfying these restrictions is to compile
12990 and link every module with the same @option{-G} option.  However,
12991 you may wish to build a library that supports several different
12992 small data limits.  You can do this by compiling the library with
12993 the highest supported @option{-G} setting and additionally using
12994 @option{-mno-extern-sdata} to stop the library from making assumptions
12995 about externally-defined data.
12997 @item -mgpopt
12998 @itemx -mno-gpopt
12999 @opindex mgpopt
13000 @opindex mno-gpopt
13001 Use (do not use) GP-relative accesses for symbols that are known to be
13002 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
13003 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
13004 configurations.
13006 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
13007 might not hold the value of @code{_gp}.  For example, if the code is
13008 part of a library that might be used in a boot monitor, programs that
13009 call boot monitor routines will pass an unknown value in @code{$gp}.
13010 (In such situations, the boot monitor itself would usually be compiled
13011 with @option{-G0}.)
13013 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
13014 @option{-mno-extern-sdata}.
13016 @item -membedded-data
13017 @itemx -mno-embedded-data
13018 @opindex membedded-data
13019 @opindex mno-embedded-data
13020 Allocate variables to the read-only data section first if possible, then
13021 next in the small data section if possible, otherwise in data.  This gives
13022 slightly slower code than the default, but reduces the amount of RAM required
13023 when executing, and thus may be preferred for some embedded systems.
13025 @item -muninit-const-in-rodata
13026 @itemx -mno-uninit-const-in-rodata
13027 @opindex muninit-const-in-rodata
13028 @opindex mno-uninit-const-in-rodata
13029 Put uninitialized @code{const} variables in the read-only data section.
13030 This option is only meaningful in conjunction with @option{-membedded-data}.
13032 @item -mcode-readable=@var{setting}
13033 @opindex mcode-readable
13034 Specify whether GCC may generate code that reads from executable sections.
13035 There are three possible settings:
13037 @table @gcctabopt
13038 @item -mcode-readable=yes
13039 Instructions may freely access executable sections.  This is the
13040 default setting.
13042 @item -mcode-readable=pcrel
13043 MIPS16 PC-relative load instructions can access executable sections,
13044 but other instructions must not do so.  This option is useful on 4KSc
13045 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
13046 It is also useful on processors that can be configured to have a dual
13047 instruction/data SRAM interface and that, like the M4K, automatically
13048 redirect PC-relative loads to the instruction RAM.
13050 @item -mcode-readable=no
13051 Instructions must not access executable sections.  This option can be
13052 useful on targets that are configured to have a dual instruction/data
13053 SRAM interface but that (unlike the M4K) do not automatically redirect
13054 PC-relative loads to the instruction RAM.
13055 @end table
13057 @item -msplit-addresses
13058 @itemx -mno-split-addresses
13059 @opindex msplit-addresses
13060 @opindex mno-split-addresses
13061 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
13062 relocation operators.  This option has been superseded by
13063 @option{-mexplicit-relocs} but is retained for backwards compatibility.
13065 @item -mexplicit-relocs
13066 @itemx -mno-explicit-relocs
13067 @opindex mexplicit-relocs
13068 @opindex mno-explicit-relocs
13069 Use (do not use) assembler relocation operators when dealing with symbolic
13070 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
13071 is to use assembler macros instead.
13073 @option{-mexplicit-relocs} is the default if GCC was configured
13074 to use an assembler that supports relocation operators.
13076 @item -mcheck-zero-division
13077 @itemx -mno-check-zero-division
13078 @opindex mcheck-zero-division
13079 @opindex mno-check-zero-division
13080 Trap (do not trap) on integer division by zero.
13082 The default is @option{-mcheck-zero-division}.
13084 @item -mdivide-traps
13085 @itemx -mdivide-breaks
13086 @opindex mdivide-traps
13087 @opindex mdivide-breaks
13088 MIPS systems check for division by zero by generating either a
13089 conditional trap or a break instruction.  Using traps results in
13090 smaller code, but is only supported on MIPS II and later.  Also, some
13091 versions of the Linux kernel have a bug that prevents trap from
13092 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
13093 allow conditional traps on architectures that support them and
13094 @option{-mdivide-breaks} to force the use of breaks.
13096 The default is usually @option{-mdivide-traps}, but this can be
13097 overridden at configure time using @option{--with-divide=breaks}.
13098 Divide-by-zero checks can be completely disabled using
13099 @option{-mno-check-zero-division}.
13101 @item -mmemcpy
13102 @itemx -mno-memcpy
13103 @opindex mmemcpy
13104 @opindex mno-memcpy
13105 Force (do not force) the use of @code{memcpy()} for non-trivial block
13106 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
13107 most constant-sized copies.
13109 @item -mlong-calls
13110 @itemx -mno-long-calls
13111 @opindex mlong-calls
13112 @opindex mno-long-calls
13113 Disable (do not disable) use of the @code{jal} instruction.  Calling
13114 functions using @code{jal} is more efficient but requires the caller
13115 and callee to be in the same 256 megabyte segment.
13117 This option has no effect on abicalls code.  The default is
13118 @option{-mno-long-calls}.
13120 @item -mmad
13121 @itemx -mno-mad
13122 @opindex mmad
13123 @opindex mno-mad
13124 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
13125 instructions, as provided by the R4650 ISA@.
13127 @item -mfused-madd
13128 @itemx -mno-fused-madd
13129 @opindex mfused-madd
13130 @opindex mno-fused-madd
13131 Enable (disable) use of the floating point multiply-accumulate
13132 instructions, when they are available.  The default is
13133 @option{-mfused-madd}.
13135 When multiply-accumulate instructions are used, the intermediate
13136 product is calculated to infinite precision and is not subject to
13137 the FCSR Flush to Zero bit.  This may be undesirable in some
13138 circumstances.
13140 @item -nocpp
13141 @opindex nocpp
13142 Tell the MIPS assembler to not run its preprocessor over user
13143 assembler files (with a @samp{.s} suffix) when assembling them.
13145 @item -mfix-r4000
13146 @itemx -mno-fix-r4000
13147 @opindex mfix-r4000
13148 @opindex mno-fix-r4000
13149 Work around certain R4000 CPU errata:
13150 @itemize @minus
13151 @item
13152 A double-word or a variable shift may give an incorrect result if executed
13153 immediately after starting an integer division.
13154 @item
13155 A double-word or a variable shift may give an incorrect result if executed
13156 while an integer multiplication is in progress.
13157 @item
13158 An integer division may give an incorrect result if started in a delay slot
13159 of a taken branch or a jump.
13160 @end itemize
13162 @item -mfix-r4400
13163 @itemx -mno-fix-r4400
13164 @opindex mfix-r4400
13165 @opindex mno-fix-r4400
13166 Work around certain R4400 CPU errata:
13167 @itemize @minus
13168 @item
13169 A double-word or a variable shift may give an incorrect result if executed
13170 immediately after starting an integer division.
13171 @end itemize
13173 @item -mfix-r10000
13174 @itemx -mno-fix-r10000
13175 @opindex mfix-r10000
13176 @opindex mno-fix-r10000
13177 Work around certain R10000 errata:
13178 @itemize @minus
13179 @item
13180 @code{ll}/@code{sc} sequences may not behave atomically on revisions
13181 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
13182 @end itemize
13184 This option can only be used if the target architecture supports
13185 branch-likely instructions.  @option{-mfix-r10000} is the default when
13186 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
13187 otherwise.
13189 @item -mfix-vr4120
13190 @itemx -mno-fix-vr4120
13191 @opindex mfix-vr4120
13192 Work around certain VR4120 errata:
13193 @itemize @minus
13194 @item
13195 @code{dmultu} does not always produce the correct result.
13196 @item
13197 @code{div} and @code{ddiv} do not always produce the correct result if one
13198 of the operands is negative.
13199 @end itemize
13200 The workarounds for the division errata rely on special functions in
13201 @file{libgcc.a}.  At present, these functions are only provided by
13202 the @code{mips64vr*-elf} configurations.
13204 Other VR4120 errata require a nop to be inserted between certain pairs of
13205 instructions.  These errata are handled by the assembler, not by GCC itself.
13207 @item -mfix-vr4130
13208 @opindex mfix-vr4130
13209 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
13210 workarounds are implemented by the assembler rather than by GCC,
13211 although GCC will avoid using @code{mflo} and @code{mfhi} if the
13212 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
13213 instructions are available instead.
13215 @item -mfix-sb1
13216 @itemx -mno-fix-sb1
13217 @opindex mfix-sb1
13218 Work around certain SB-1 CPU core errata.
13219 (This flag currently works around the SB-1 revision 2
13220 ``F1'' and ``F2'' floating point errata.)
13222 @item -mr10k-cache-barrier=@var{setting}
13223 @opindex mr10k-cache-barrier
13224 Specify whether GCC should insert cache barriers to avoid the
13225 side-effects of speculation on R10K processors.
13227 In common with many processors, the R10K tries to predict the outcome
13228 of a conditional branch and speculatively executes instructions from
13229 the ``taken'' branch.  It later aborts these instructions if the
13230 predicted outcome was wrong.  However, on the R10K, even aborted
13231 instructions can have side effects.
13233 This problem only affects kernel stores and, depending on the system,
13234 kernel loads.  As an example, a speculatively-executed store may load
13235 the target memory into cache and mark the cache line as dirty, even if
13236 the store itself is later aborted.  If a DMA operation writes to the
13237 same area of memory before the ``dirty'' line is flushed, the cached
13238 data will overwrite the DMA-ed data.  See the R10K processor manual
13239 for a full description, including other potential problems.
13241 One workaround is to insert cache barrier instructions before every memory
13242 access that might be speculatively executed and that might have side
13243 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
13244 controls GCC's implementation of this workaround.  It assumes that
13245 aborted accesses to any byte in the following regions will not have
13246 side effects:
13248 @enumerate
13249 @item
13250 the memory occupied by the current function's stack frame;
13252 @item
13253 the memory occupied by an incoming stack argument;
13255 @item
13256 the memory occupied by an object with a link-time-constant address.
13257 @end enumerate
13259 It is the kernel's responsibility to ensure that speculative
13260 accesses to these regions are indeed safe.
13262 If the input program contains a function declaration such as:
13264 @smallexample
13265 void foo (void);
13266 @end smallexample
13268 then the implementation of @code{foo} must allow @code{j foo} and
13269 @code{jal foo} to be executed speculatively.  GCC honors this
13270 restriction for functions it compiles itself.  It expects non-GCC
13271 functions (such as hand-written assembly code) to do the same.
13273 The option has three forms:
13275 @table @gcctabopt
13276 @item -mr10k-cache-barrier=load-store
13277 Insert a cache barrier before a load or store that might be
13278 speculatively executed and that might have side effects even
13279 if aborted.
13281 @item -mr10k-cache-barrier=store
13282 Insert a cache barrier before a store that might be speculatively
13283 executed and that might have side effects even if aborted.
13285 @item -mr10k-cache-barrier=none
13286 Disable the insertion of cache barriers.  This is the default setting.
13287 @end table
13289 @item -mflush-func=@var{func}
13290 @itemx -mno-flush-func
13291 @opindex mflush-func
13292 Specifies the function to call to flush the I and D caches, or to not
13293 call any such function.  If called, the function must take the same
13294 arguments as the common @code{_flush_func()}, that is, the address of the
13295 memory range for which the cache is being flushed, the size of the
13296 memory range, and the number 3 (to flush both caches).  The default
13297 depends on the target GCC was configured for, but commonly is either
13298 @samp{_flush_func} or @samp{__cpu_flush}.
13300 @item mbranch-cost=@var{num}
13301 @opindex mbranch-cost
13302 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13303 This cost is only a heuristic and is not guaranteed to produce
13304 consistent results across releases.  A zero cost redundantly selects
13305 the default, which is based on the @option{-mtune} setting.
13307 @item -mbranch-likely
13308 @itemx -mno-branch-likely
13309 @opindex mbranch-likely
13310 @opindex mno-branch-likely
13311 Enable or disable use of Branch Likely instructions, regardless of the
13312 default for the selected architecture.  By default, Branch Likely
13313 instructions may be generated if they are supported by the selected
13314 architecture.  An exception is for the MIPS32 and MIPS64 architectures
13315 and processors which implement those architectures; for those, Branch
13316 Likely instructions will not be generated by default because the MIPS32
13317 and MIPS64 architectures specifically deprecate their use.
13319 @item -mfp-exceptions
13320 @itemx -mno-fp-exceptions
13321 @opindex mfp-exceptions
13322 Specifies whether FP exceptions are enabled.  This affects how we schedule
13323 FP instructions for some processors.  The default is that FP exceptions are
13324 enabled.
13326 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
13327 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
13328 FP pipe.
13330 @item -mvr4130-align
13331 @itemx -mno-vr4130-align
13332 @opindex mvr4130-align
13333 The VR4130 pipeline is two-way superscalar, but can only issue two
13334 instructions together if the first one is 8-byte aligned.  When this
13335 option is enabled, GCC will align pairs of instructions that it
13336 thinks should execute in parallel.
13338 This option only has an effect when optimizing for the VR4130.
13339 It normally makes code faster, but at the expense of making it bigger.
13340 It is enabled by default at optimization level @option{-O3}.
13341 @end table
13343 @node MMIX Options
13344 @subsection MMIX Options
13345 @cindex MMIX Options
13347 These options are defined for the MMIX:
13349 @table @gcctabopt
13350 @item -mlibfuncs
13351 @itemx -mno-libfuncs
13352 @opindex mlibfuncs
13353 @opindex mno-libfuncs
13354 Specify that intrinsic library functions are being compiled, passing all
13355 values in registers, no matter the size.
13357 @item -mepsilon
13358 @itemx -mno-epsilon
13359 @opindex mepsilon
13360 @opindex mno-epsilon
13361 Generate floating-point comparison instructions that compare with respect
13362 to the @code{rE} epsilon register.
13364 @item -mabi=mmixware
13365 @itemx -mabi=gnu
13366 @opindex mabi-mmixware
13367 @opindex mabi=gnu
13368 Generate code that passes function parameters and return values that (in
13369 the called function) are seen as registers @code{$0} and up, as opposed to
13370 the GNU ABI which uses global registers @code{$231} and up.
13372 @item -mzero-extend
13373 @itemx -mno-zero-extend
13374 @opindex mzero-extend
13375 @opindex mno-zero-extend
13376 When reading data from memory in sizes shorter than 64 bits, use (do not
13377 use) zero-extending load instructions by default, rather than
13378 sign-extending ones.
13380 @item -mknuthdiv
13381 @itemx -mno-knuthdiv
13382 @opindex mknuthdiv
13383 @opindex mno-knuthdiv
13384 Make the result of a division yielding a remainder have the same sign as
13385 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
13386 remainder follows the sign of the dividend.  Both methods are
13387 arithmetically valid, the latter being almost exclusively used.
13389 @item -mtoplevel-symbols
13390 @itemx -mno-toplevel-symbols
13391 @opindex mtoplevel-symbols
13392 @opindex mno-toplevel-symbols
13393 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
13394 code can be used with the @code{PREFIX} assembly directive.
13396 @item -melf
13397 @opindex melf
13398 Generate an executable in the ELF format, rather than the default
13399 @samp{mmo} format used by the @command{mmix} simulator.
13401 @item -mbranch-predict
13402 @itemx -mno-branch-predict
13403 @opindex mbranch-predict
13404 @opindex mno-branch-predict
13405 Use (do not use) the probable-branch instructions, when static branch
13406 prediction indicates a probable branch.
13408 @item -mbase-addresses
13409 @itemx -mno-base-addresses
13410 @opindex mbase-addresses
13411 @opindex mno-base-addresses
13412 Generate (do not generate) code that uses @emph{base addresses}.  Using a
13413 base address automatically generates a request (handled by the assembler
13414 and the linker) for a constant to be set up in a global register.  The
13415 register is used for one or more base address requests within the range 0
13416 to 255 from the value held in the register.  The generally leads to short
13417 and fast code, but the number of different data items that can be
13418 addressed is limited.  This means that a program that uses lots of static
13419 data may require @option{-mno-base-addresses}.
13421 @item -msingle-exit
13422 @itemx -mno-single-exit
13423 @opindex msingle-exit
13424 @opindex mno-single-exit
13425 Force (do not force) generated code to have a single exit point in each
13426 function.
13427 @end table
13429 @node MN10300 Options
13430 @subsection MN10300 Options
13431 @cindex MN10300 options
13433 These @option{-m} options are defined for Matsushita MN10300 architectures:
13435 @table @gcctabopt
13436 @item -mmult-bug
13437 @opindex mmult-bug
13438 Generate code to avoid bugs in the multiply instructions for the MN10300
13439 processors.  This is the default.
13441 @item -mno-mult-bug
13442 @opindex mno-mult-bug
13443 Do not generate code to avoid bugs in the multiply instructions for the
13444 MN10300 processors.
13446 @item -mam33
13447 @opindex mam33
13448 Generate code which uses features specific to the AM33 processor.
13450 @item -mno-am33
13451 @opindex mno-am33
13452 Do not generate code which uses features specific to the AM33 processor.  This
13453 is the default.
13455 @item -mreturn-pointer-on-d0
13456 @opindex mreturn-pointer-on-d0
13457 When generating a function which returns a pointer, return the pointer
13458 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
13459 only in a0, and attempts to call such functions without a prototype
13460 would result in errors.  Note that this option is on by default; use
13461 @option{-mno-return-pointer-on-d0} to disable it.
13463 @item -mno-crt0
13464 @opindex mno-crt0
13465 Do not link in the C run-time initialization object file.
13467 @item -mrelax
13468 @opindex mrelax
13469 Indicate to the linker that it should perform a relaxation optimization pass
13470 to shorten branches, calls and absolute memory addresses.  This option only
13471 has an effect when used on the command line for the final link step.
13473 This option makes symbolic debugging impossible.
13474 @end table
13476 @node PDP-11 Options
13477 @subsection PDP-11 Options
13478 @cindex PDP-11 Options
13480 These options are defined for the PDP-11:
13482 @table @gcctabopt
13483 @item -mfpu
13484 @opindex mfpu
13485 Use hardware FPP floating point.  This is the default.  (FIS floating
13486 point on the PDP-11/40 is not supported.)
13488 @item -msoft-float
13489 @opindex msoft-float
13490 Do not use hardware floating point.
13492 @item -mac0
13493 @opindex mac0
13494 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
13496 @item -mno-ac0
13497 @opindex mno-ac0
13498 Return floating-point results in memory.  This is the default.
13500 @item -m40
13501 @opindex m40
13502 Generate code for a PDP-11/40.
13504 @item -m45
13505 @opindex m45
13506 Generate code for a PDP-11/45.  This is the default.
13508 @item -m10
13509 @opindex m10
13510 Generate code for a PDP-11/10.
13512 @item -mbcopy-builtin
13513 @opindex bcopy-builtin
13514 Use inline @code{movmemhi} patterns for copying memory.  This is the
13515 default.
13517 @item -mbcopy
13518 @opindex mbcopy
13519 Do not use inline @code{movmemhi} patterns for copying memory.
13521 @item -mint16
13522 @itemx -mno-int32
13523 @opindex mint16
13524 @opindex mno-int32
13525 Use 16-bit @code{int}.  This is the default.
13527 @item -mint32
13528 @itemx -mno-int16
13529 @opindex mint32
13530 @opindex mno-int16
13531 Use 32-bit @code{int}.
13533 @item -mfloat64
13534 @itemx -mno-float32
13535 @opindex mfloat64
13536 @opindex mno-float32
13537 Use 64-bit @code{float}.  This is the default.
13539 @item -mfloat32
13540 @itemx -mno-float64
13541 @opindex mfloat32
13542 @opindex mno-float64
13543 Use 32-bit @code{float}.
13545 @item -mabshi
13546 @opindex mabshi
13547 Use @code{abshi2} pattern.  This is the default.
13549 @item -mno-abshi
13550 @opindex mno-abshi
13551 Do not use @code{abshi2} pattern.
13553 @item -mbranch-expensive
13554 @opindex mbranch-expensive
13555 Pretend that branches are expensive.  This is for experimenting with
13556 code generation only.
13558 @item -mbranch-cheap
13559 @opindex mbranch-cheap
13560 Do not pretend that branches are expensive.  This is the default.
13562 @item -msplit
13563 @opindex msplit
13564 Generate code for a system with split I&D@.
13566 @item -mno-split
13567 @opindex mno-split
13568 Generate code for a system without split I&D@.  This is the default.
13570 @item -munix-asm
13571 @opindex munix-asm
13572 Use Unix assembler syntax.  This is the default when configured for
13573 @samp{pdp11-*-bsd}.
13575 @item -mdec-asm
13576 @opindex mdec-asm
13577 Use DEC assembler syntax.  This is the default when configured for any
13578 PDP-11 target other than @samp{pdp11-*-bsd}.
13579 @end table
13581 @node picoChip Options
13582 @subsection picoChip Options
13583 @cindex picoChip options
13585 These @samp{-m} options are defined for picoChip implementations:
13587 @table @gcctabopt
13589 @item -mae=@var{ae_type}
13590 @opindex mcpu
13591 Set the instruction set, register set, and instruction scheduling
13592 parameters for array element type @var{ae_type}.  Supported values
13593 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
13595 @option{-mae=ANY} selects a completely generic AE type.  Code
13596 generated with this option will run on any of the other AE types.  The
13597 code will not be as efficient as it would be if compiled for a specific
13598 AE type, and some types of operation (e.g., multiplication) will not
13599 work properly on all types of AE.
13601 @option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
13602 for compiled code, and is the default.
13604 @option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
13605 option may suffer from poor performance of byte (char) manipulation,
13606 since the DSP AE does not provide hardware support for byte load/stores.
13608 @item -msymbol-as-address
13609 Enable the compiler to directly use a symbol name as an address in a
13610 load/store instruction, without first loading it into a
13611 register.  Typically, the use of this option will generate larger
13612 programs, which run faster than when the option isn't used.  However, the
13613 results vary from program to program, so it is left as a user option,
13614 rather than being permanently enabled.
13616 @item -mno-inefficient-warnings
13617 Disables warnings about the generation of inefficient code.  These
13618 warnings can be generated, for example, when compiling code which
13619 performs byte-level memory operations on the MAC AE type.  The MAC AE has
13620 no hardware support for byte-level memory operations, so all byte
13621 load/stores must be synthesized from word load/store operations.  This is
13622 inefficient and a warning will be generated indicating to the programmer
13623 that they should rewrite the code to avoid byte operations, or to target
13624 an AE type which has the necessary hardware support.  This option enables
13625 the warning to be turned off.
13627 @end table
13629 @node PowerPC Options
13630 @subsection PowerPC Options
13631 @cindex PowerPC options
13633 These are listed under @xref{RS/6000 and PowerPC Options}.
13635 @node RS/6000 and PowerPC Options
13636 @subsection IBM RS/6000 and PowerPC Options
13637 @cindex RS/6000 and PowerPC Options
13638 @cindex IBM RS/6000 and PowerPC Options
13640 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
13641 @table @gcctabopt
13642 @item -mpower
13643 @itemx -mno-power
13644 @itemx -mpower2
13645 @itemx -mno-power2
13646 @itemx -mpowerpc
13647 @itemx -mno-powerpc
13648 @itemx -mpowerpc-gpopt
13649 @itemx -mno-powerpc-gpopt
13650 @itemx -mpowerpc-gfxopt
13651 @itemx -mno-powerpc-gfxopt
13652 @itemx -mpowerpc64
13653 @itemx -mno-powerpc64
13654 @itemx -mmfcrf
13655 @itemx -mno-mfcrf
13656 @itemx -mpopcntb
13657 @itemx -mno-popcntb
13658 @itemx -mfprnd
13659 @itemx -mno-fprnd
13660 @itemx -mcmpb
13661 @itemx -mno-cmpb
13662 @itemx -mmfpgpr
13663 @itemx -mno-mfpgpr
13664 @itemx -mhard-dfp
13665 @itemx -mno-hard-dfp
13666 @opindex mpower
13667 @opindex mno-power
13668 @opindex mpower2
13669 @opindex mno-power2
13670 @opindex mpowerpc
13671 @opindex mno-powerpc
13672 @opindex mpowerpc-gpopt
13673 @opindex mno-powerpc-gpopt
13674 @opindex mpowerpc-gfxopt
13675 @opindex mno-powerpc-gfxopt
13676 @opindex mpowerpc64
13677 @opindex mno-powerpc64
13678 @opindex mmfcrf
13679 @opindex mno-mfcrf
13680 @opindex mpopcntb
13681 @opindex mno-popcntb
13682 @opindex mfprnd
13683 @opindex mno-fprnd
13684 @opindex mcmpb
13685 @opindex mno-cmpb
13686 @opindex mmfpgpr
13687 @opindex mno-mfpgpr
13688 @opindex mhard-dfp
13689 @opindex mno-hard-dfp
13690 GCC supports two related instruction set architectures for the
13691 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
13692 instructions supported by the @samp{rios} chip set used in the original
13693 RS/6000 systems and the @dfn{PowerPC} instruction set is the
13694 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
13695 the IBM 4xx, 6xx, and follow-on microprocessors.
13697 Neither architecture is a subset of the other.  However there is a
13698 large common subset of instructions supported by both.  An MQ
13699 register is included in processors supporting the POWER architecture.
13701 You use these options to specify which instructions are available on the
13702 processor you are using.  The default value of these options is
13703 determined when configuring GCC@.  Specifying the
13704 @option{-mcpu=@var{cpu_type}} overrides the specification of these
13705 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
13706 rather than the options listed above.
13708 The @option{-mpower} option allows GCC to generate instructions that
13709 are found only in the POWER architecture and to use the MQ register.
13710 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
13711 to generate instructions that are present in the POWER2 architecture but
13712 not the original POWER architecture.
13714 The @option{-mpowerpc} option allows GCC to generate instructions that
13715 are found only in the 32-bit subset of the PowerPC architecture.
13716 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
13717 GCC to use the optional PowerPC architecture instructions in the
13718 General Purpose group, including floating-point square root.  Specifying
13719 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
13720 use the optional PowerPC architecture instructions in the Graphics
13721 group, including floating-point select.
13723 The @option{-mmfcrf} option allows GCC to generate the move from
13724 condition register field instruction implemented on the POWER4
13725 processor and other processors that support the PowerPC V2.01
13726 architecture.
13727 The @option{-mpopcntb} option allows GCC to generate the popcount and
13728 double precision FP reciprocal estimate instruction implemented on the
13729 POWER5 processor and other processors that support the PowerPC V2.02
13730 architecture.
13731 The @option{-mfprnd} option allows GCC to generate the FP round to
13732 integer instructions implemented on the POWER5+ processor and other
13733 processors that support the PowerPC V2.03 architecture.
13734 The @option{-mcmpb} option allows GCC to generate the compare bytes
13735 instruction implemented on the POWER6 processor and other processors
13736 that support the PowerPC V2.05 architecture.
13737 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
13738 general purpose register instructions implemented on the POWER6X
13739 processor and other processors that support the extended PowerPC V2.05
13740 architecture.
13741 The @option{-mhard-dfp} option allows GCC to generate the decimal floating
13742 point instructions implemented on some POWER processors.
13744 The @option{-mpowerpc64} option allows GCC to generate the additional
13745 64-bit instructions that are found in the full PowerPC64 architecture
13746 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
13747 @option{-mno-powerpc64}.
13749 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
13750 will use only the instructions in the common subset of both
13751 architectures plus some special AIX common-mode calls, and will not use
13752 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
13753 permits GCC to use any instruction from either architecture and to
13754 allow use of the MQ register; specify this for the Motorola MPC601.
13756 @item -mnew-mnemonics
13757 @itemx -mold-mnemonics
13758 @opindex mnew-mnemonics
13759 @opindex mold-mnemonics
13760 Select which mnemonics to use in the generated assembler code.  With
13761 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
13762 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
13763 assembler mnemonics defined for the POWER architecture.  Instructions
13764 defined in only one architecture have only one mnemonic; GCC uses that
13765 mnemonic irrespective of which of these options is specified.
13767 GCC defaults to the mnemonics appropriate for the architecture in
13768 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
13769 value of these option.  Unless you are building a cross-compiler, you
13770 should normally not specify either @option{-mnew-mnemonics} or
13771 @option{-mold-mnemonics}, but should instead accept the default.
13773 @item -mcpu=@var{cpu_type}
13774 @opindex mcpu
13775 Set architecture type, register usage, choice of mnemonics, and
13776 instruction scheduling parameters for machine type @var{cpu_type}.
13777 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
13778 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
13779 @samp{505}, @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
13780 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
13781 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
13782 @samp{860}, @samp{970}, @samp{8540}, @samp{e300c2}, @samp{e300c3},
13783 @samp{e500mc}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
13784 @samp{power}, @samp{power2}, @samp{power3}, @samp{power4},
13785 @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x}, @samp{power7}
13786 @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
13787 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
13789 @option{-mcpu=common} selects a completely generic processor.  Code
13790 generated under this option will run on any POWER or PowerPC processor.
13791 GCC will use only the instructions in the common subset of both
13792 architectures, and will not use the MQ register.  GCC assumes a generic
13793 processor model for scheduling purposes.
13795 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
13796 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
13797 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
13798 types, with an appropriate, generic processor model assumed for
13799 scheduling purposes.
13801 The other options specify a specific processor.  Code generated under
13802 those options will run best on that processor, and may not run at all on
13803 others.
13805 The @option{-mcpu} options automatically enable or disable the
13806 following options:
13808 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
13809 -mnew-mnemonics  -mpopcntb  -mpower  -mpower2  -mpowerpc64 @gol
13810 -mpowerpc-gpopt  -mpowerpc-gfxopt  -msingle-float -mdouble-float @gol
13811 -msimple-fpu -mstring  -mmulhw  -mdlmzb  -mmfpgpr}
13813 The particular options set for any particular CPU will vary between
13814 compiler versions, depending on what setting seems to produce optimal
13815 code for that CPU; it doesn't necessarily reflect the actual hardware's
13816 capabilities.  If you wish to set an individual option to a particular
13817 value, you may specify it after the @option{-mcpu} option, like
13818 @samp{-mcpu=970 -mno-altivec}.
13820 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
13821 not enabled or disabled by the @option{-mcpu} option at present because
13822 AIX does not have full support for these options.  You may still
13823 enable or disable them individually if you're sure it'll work in your
13824 environment.
13826 @item -mtune=@var{cpu_type}
13827 @opindex mtune
13828 Set the instruction scheduling parameters for machine type
13829 @var{cpu_type}, but do not set the architecture type, register usage, or
13830 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
13831 values for @var{cpu_type} are used for @option{-mtune} as for
13832 @option{-mcpu}.  If both are specified, the code generated will use the
13833 architecture, registers, and mnemonics set by @option{-mcpu}, but the
13834 scheduling parameters set by @option{-mtune}.
13836 @item -mswdiv
13837 @itemx -mno-swdiv
13838 @opindex mswdiv
13839 @opindex mno-swdiv
13840 Generate code to compute division as reciprocal estimate and iterative
13841 refinement, creating opportunities for increased throughput.  This
13842 feature requires: optional PowerPC Graphics instruction set for single
13843 precision and FRE instruction for double precision, assuming divides
13844 cannot generate user-visible traps, and the domain values not include
13845 Infinities, denormals or zero denominator.
13847 @item -maltivec
13848 @itemx -mno-altivec
13849 @opindex maltivec
13850 @opindex mno-altivec
13851 Generate code that uses (does not use) AltiVec instructions, and also
13852 enable the use of built-in functions that allow more direct access to
13853 the AltiVec instruction set.  You may also need to set
13854 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
13855 enhancements.
13857 @item -mvrsave
13858 @itemx -mno-vrsave
13859 @opindex mvrsave
13860 @opindex mno-vrsave
13861 Generate VRSAVE instructions when generating AltiVec code.
13863 @item -mgen-cell-microcode
13864 @opindex mgen-cell-microcode
13865 Generate Cell microcode instructions
13867 @item -mwarn-cell-microcode
13868 @opindex mwarn-cell-microcode
13869 Warning when a Cell microcode instruction is going to emitted.  An example
13870 of a Cell microcode instruction is a variable shift.
13872 @item -msecure-plt
13873 @opindex msecure-plt
13874 Generate code that allows ld and ld.so to build executables and shared
13875 libraries with non-exec .plt and .got sections.  This is a PowerPC
13876 32-bit SYSV ABI option.
13878 @item -mbss-plt
13879 @opindex mbss-plt
13880 Generate code that uses a BSS .plt section that ld.so fills in, and
13881 requires .plt and .got sections that are both writable and executable.
13882 This is a PowerPC 32-bit SYSV ABI option.
13884 @item -misel
13885 @itemx -mno-isel
13886 @opindex misel
13887 @opindex mno-isel
13888 This switch enables or disables the generation of ISEL instructions.
13890 @item -misel=@var{yes/no}
13891 This switch has been deprecated.  Use @option{-misel} and
13892 @option{-mno-isel} instead.
13894 @item -mspe
13895 @itemx -mno-spe
13896 @opindex mspe
13897 @opindex mno-spe
13898 This switch enables or disables the generation of SPE simd
13899 instructions.
13901 @item -mpaired
13902 @itemx -mno-paired
13903 @opindex mpaired
13904 @opindex mno-paired
13905 This switch enables or disables the generation of PAIRED simd
13906 instructions.
13908 @item -mspe=@var{yes/no}
13909 This option has been deprecated.  Use @option{-mspe} and
13910 @option{-mno-spe} instead.
13912 @item -mfloat-gprs=@var{yes/single/double/no}
13913 @itemx -mfloat-gprs
13914 @opindex mfloat-gprs
13915 This switch enables or disables the generation of floating point
13916 operations on the general purpose registers for architectures that
13917 support it.
13919 The argument @var{yes} or @var{single} enables the use of
13920 single-precision floating point operations.
13922 The argument @var{double} enables the use of single and
13923 double-precision floating point operations.
13925 The argument @var{no} disables floating point operations on the
13926 general purpose registers.
13928 This option is currently only available on the MPC854x.
13930 @item -m32
13931 @itemx -m64
13932 @opindex m32
13933 @opindex m64
13934 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
13935 targets (including GNU/Linux).  The 32-bit environment sets int, long
13936 and pointer to 32 bits and generates code that runs on any PowerPC
13937 variant.  The 64-bit environment sets int to 32 bits and long and
13938 pointer to 64 bits, and generates code for PowerPC64, as for
13939 @option{-mpowerpc64}.
13941 @item -mfull-toc
13942 @itemx -mno-fp-in-toc
13943 @itemx -mno-sum-in-toc
13944 @itemx -mminimal-toc
13945 @opindex mfull-toc
13946 @opindex mno-fp-in-toc
13947 @opindex mno-sum-in-toc
13948 @opindex mminimal-toc
13949 Modify generation of the TOC (Table Of Contents), which is created for
13950 every executable file.  The @option{-mfull-toc} option is selected by
13951 default.  In that case, GCC will allocate at least one TOC entry for
13952 each unique non-automatic variable reference in your program.  GCC
13953 will also place floating-point constants in the TOC@.  However, only
13954 16,384 entries are available in the TOC@.
13956 If you receive a linker error message that saying you have overflowed
13957 the available TOC space, you can reduce the amount of TOC space used
13958 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
13959 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
13960 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
13961 generate code to calculate the sum of an address and a constant at
13962 run-time instead of putting that sum into the TOC@.  You may specify one
13963 or both of these options.  Each causes GCC to produce very slightly
13964 slower and larger code at the expense of conserving TOC space.
13966 If you still run out of space in the TOC even when you specify both of
13967 these options, specify @option{-mminimal-toc} instead.  This option causes
13968 GCC to make only one TOC entry for every file.  When you specify this
13969 option, GCC will produce code that is slower and larger but which
13970 uses extremely little TOC space.  You may wish to use this option
13971 only on files that contain less frequently executed code.
13973 @item -maix64
13974 @itemx -maix32
13975 @opindex maix64
13976 @opindex maix32
13977 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
13978 @code{long} type, and the infrastructure needed to support them.
13979 Specifying @option{-maix64} implies @option{-mpowerpc64} and
13980 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
13981 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
13983 @item -mxl-compat
13984 @itemx -mno-xl-compat
13985 @opindex mxl-compat
13986 @opindex mno-xl-compat
13987 Produce code that conforms more closely to IBM XL compiler semantics
13988 when using AIX-compatible ABI@.  Pass floating-point arguments to
13989 prototyped functions beyond the register save area (RSA) on the stack
13990 in addition to argument FPRs.  Do not assume that most significant
13991 double in 128-bit long double value is properly rounded when comparing
13992 values and converting to double.  Use XL symbol names for long double
13993 support routines.
13995 The AIX calling convention was extended but not initially documented to
13996 handle an obscure K&R C case of calling a function that takes the
13997 address of its arguments with fewer arguments than declared.  IBM XL
13998 compilers access floating point arguments which do not fit in the
13999 RSA from the stack when a subroutine is compiled without
14000 optimization.  Because always storing floating-point arguments on the
14001 stack is inefficient and rarely needed, this option is not enabled by
14002 default and only is necessary when calling subroutines compiled by IBM
14003 XL compilers without optimization.
14005 @item -mpe
14006 @opindex mpe
14007 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
14008 application written to use message passing with special startup code to
14009 enable the application to run.  The system must have PE installed in the
14010 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
14011 must be overridden with the @option{-specs=} option to specify the
14012 appropriate directory location.  The Parallel Environment does not
14013 support threads, so the @option{-mpe} option and the @option{-pthread}
14014 option are incompatible.
14016 @item -malign-natural
14017 @itemx -malign-power
14018 @opindex malign-natural
14019 @opindex malign-power
14020 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
14021 @option{-malign-natural} overrides the ABI-defined alignment of larger
14022 types, such as floating-point doubles, on their natural size-based boundary.
14023 The option @option{-malign-power} instructs GCC to follow the ABI-specified
14024 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
14026 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
14027 is not supported.
14029 @item -msoft-float
14030 @itemx -mhard-float
14031 @opindex msoft-float
14032 @opindex mhard-float
14033 Generate code that does not use (uses) the floating-point register set.
14034 Software floating point emulation is provided if you use the
14035 @option{-msoft-float} option, and pass the option to GCC when linking.
14037 @item -msingle-float
14038 @itemx -mdouble-float
14039 @opindex msingle-float
14040 @opindex mdouble-float
14041 Generate code for single or double-precision floating point operations. 
14042 @option{-mdouble-float} implies @option{-msingle-float}. 
14044 @item -msimple-fpu
14045 @opindex msimple-fpu
14046 Do not generate sqrt and div instructions for hardware floating point unit.
14048 @item -mfpu
14049 @opindex mfpu
14050 Specify type of floating point unit.  Valid values are @var{sp_lite} 
14051 (equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
14052 to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
14053 and @var{dp_full} (equivalent to -mdouble-float).
14055 @item -mxilinx-fpu
14056 @opindex mxilinx-fpu
14057 Perform optimizations for floating point unit on Xilinx PPC 405/440.
14059 @item -mmultiple
14060 @itemx -mno-multiple
14061 @opindex mmultiple
14062 @opindex mno-multiple
14063 Generate code that uses (does not use) the load multiple word
14064 instructions and the store multiple word instructions.  These
14065 instructions are generated by default on POWER systems, and not
14066 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
14067 endian PowerPC systems, since those instructions do not work when the
14068 processor is in little endian mode.  The exceptions are PPC740 and
14069 PPC750 which permit the instructions usage in little endian mode.
14071 @item -mstring
14072 @itemx -mno-string
14073 @opindex mstring
14074 @opindex mno-string
14075 Generate code that uses (does not use) the load string instructions
14076 and the store string word instructions to save multiple registers and
14077 do small block moves.  These instructions are generated by default on
14078 POWER systems, and not generated on PowerPC systems.  Do not use
14079 @option{-mstring} on little endian PowerPC systems, since those
14080 instructions do not work when the processor is in little endian mode.
14081 The exceptions are PPC740 and PPC750 which permit the instructions
14082 usage in little endian mode.
14084 @item -mupdate
14085 @itemx -mno-update
14086 @opindex mupdate
14087 @opindex mno-update
14088 Generate code that uses (does not use) the load or store instructions
14089 that update the base register to the address of the calculated memory
14090 location.  These instructions are generated by default.  If you use
14091 @option{-mno-update}, there is a small window between the time that the
14092 stack pointer is updated and the address of the previous frame is
14093 stored, which means code that walks the stack frame across interrupts or
14094 signals may get corrupted data.
14096 @item -mavoid-indexed-addresses
14097 @item -mno-avoid-indexed-addresses
14098 @opindex mavoid-indexed-addresses
14099 @opindex mno-avoid-indexed-addresses
14100 Generate code that tries to avoid (not avoid) the use of indexed load
14101 or store instructions. These instructions can incur a performance
14102 penalty on Power6 processors in certain situations, such as when
14103 stepping through large arrays that cross a 16M boundary.  This option
14104 is enabled by default when targetting Power6 and disabled otherwise.
14106 @item -mfused-madd
14107 @itemx -mno-fused-madd
14108 @opindex mfused-madd
14109 @opindex mno-fused-madd
14110 Generate code that uses (does not use) the floating point multiply and
14111 accumulate instructions.  These instructions are generated by default if
14112 hardware floating is used.
14114 @item -mmulhw
14115 @itemx -mno-mulhw
14116 @opindex mmulhw
14117 @opindex mno-mulhw
14118 Generate code that uses (does not use) the half-word multiply and
14119 multiply-accumulate instructions on the IBM 405, 440 and 464 processors.
14120 These instructions are generated by default when targetting those
14121 processors.
14123 @item -mdlmzb
14124 @itemx -mno-dlmzb
14125 @opindex mdlmzb
14126 @opindex mno-dlmzb
14127 Generate code that uses (does not use) the string-search @samp{dlmzb}
14128 instruction on the IBM 405, 440 and 464 processors.  This instruction is
14129 generated by default when targetting those processors.
14131 @item -mno-bit-align
14132 @itemx -mbit-align
14133 @opindex mno-bit-align
14134 @opindex mbit-align
14135 On System V.4 and embedded PowerPC systems do not (do) force structures
14136 and unions that contain bit-fields to be aligned to the base type of the
14137 bit-field.
14139 For example, by default a structure containing nothing but 8
14140 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
14141 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
14142 the structure would be aligned to a 1 byte boundary and be one byte in
14143 size.
14145 @item -mno-strict-align
14146 @itemx -mstrict-align
14147 @opindex mno-strict-align
14148 @opindex mstrict-align
14149 On System V.4 and embedded PowerPC systems do not (do) assume that
14150 unaligned memory references will be handled by the system.
14152 @item -mrelocatable
14153 @itemx -mno-relocatable
14154 @opindex mrelocatable
14155 @opindex mno-relocatable
14156 On embedded PowerPC systems generate code that allows (does not allow)
14157 the program to be relocated to a different address at runtime.  If you
14158 use @option{-mrelocatable} on any module, all objects linked together must
14159 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
14161 @item -mrelocatable-lib
14162 @itemx -mno-relocatable-lib
14163 @opindex mrelocatable-lib
14164 @opindex mno-relocatable-lib
14165 On embedded PowerPC systems generate code that allows (does not allow)
14166 the program to be relocated to a different address at runtime.  Modules
14167 compiled with @option{-mrelocatable-lib} can be linked with either modules
14168 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
14169 with modules compiled with the @option{-mrelocatable} options.
14171 @item -mno-toc
14172 @itemx -mtoc
14173 @opindex mno-toc
14174 @opindex mtoc
14175 On System V.4 and embedded PowerPC systems do not (do) assume that
14176 register 2 contains a pointer to a global area pointing to the addresses
14177 used in the program.
14179 @item -mlittle
14180 @itemx -mlittle-endian
14181 @opindex mlittle
14182 @opindex mlittle-endian
14183 On System V.4 and embedded PowerPC systems compile code for the
14184 processor in little endian mode.  The @option{-mlittle-endian} option is
14185 the same as @option{-mlittle}.
14187 @item -mbig
14188 @itemx -mbig-endian
14189 @opindex mbig
14190 @opindex mbig-endian
14191 On System V.4 and embedded PowerPC systems compile code for the
14192 processor in big endian mode.  The @option{-mbig-endian} option is
14193 the same as @option{-mbig}.
14195 @item -mdynamic-no-pic
14196 @opindex mdynamic-no-pic
14197 On Darwin and Mac OS X systems, compile code so that it is not
14198 relocatable, but that its external references are relocatable.  The
14199 resulting code is suitable for applications, but not shared
14200 libraries.
14202 @item -mprioritize-restricted-insns=@var{priority}
14203 @opindex mprioritize-restricted-insns
14204 This option controls the priority that is assigned to
14205 dispatch-slot restricted instructions during the second scheduling
14206 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
14207 @var{no/highest/second-highest} priority to dispatch slot restricted
14208 instructions.
14210 @item -msched-costly-dep=@var{dependence_type}
14211 @opindex msched-costly-dep
14212 This option controls which dependences are considered costly
14213 by the target during instruction scheduling.  The argument
14214 @var{dependence_type} takes one of the following values:
14215 @var{no}: no dependence is costly,
14216 @var{all}: all dependences are costly,
14217 @var{true_store_to_load}: a true dependence from store to load is costly,
14218 @var{store_to_load}: any dependence from store to load is costly,
14219 @var{number}: any dependence which latency >= @var{number} is costly.
14221 @item -minsert-sched-nops=@var{scheme}
14222 @opindex minsert-sched-nops
14223 This option controls which nop insertion scheme will be used during
14224 the second scheduling pass.  The argument @var{scheme} takes one of the
14225 following values:
14226 @var{no}: Don't insert nops.
14227 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
14228 according to the scheduler's grouping.
14229 @var{regroup_exact}: Insert nops to force costly dependent insns into
14230 separate groups.  Insert exactly as many nops as needed to force an insn
14231 to a new group, according to the estimated processor grouping.
14232 @var{number}: Insert nops to force costly dependent insns into
14233 separate groups.  Insert @var{number} nops to force an insn to a new group.
14235 @item -mcall-sysv
14236 @opindex mcall-sysv
14237 On System V.4 and embedded PowerPC systems compile code using calling
14238 conventions that adheres to the March 1995 draft of the System V
14239 Application Binary Interface, PowerPC processor supplement.  This is the
14240 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
14242 @item -mcall-sysv-eabi
14243 @itemx -mcall-eabi
14244 @opindex mcall-sysv-eabi
14245 @opindex mcall-eabi
14246 Specify both @option{-mcall-sysv} and @option{-meabi} options.
14248 @item -mcall-sysv-noeabi
14249 @opindex mcall-sysv-noeabi
14250 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
14252 @item -mcall-aixdesc
14253 @opindex m
14254 On System V.4 and embedded PowerPC systems compile code for the AIX
14255 operating system.
14257 @item -mcall-linux
14258 @opindex mcall-linux
14259 On System V.4 and embedded PowerPC systems compile code for the
14260 Linux-based GNU system.
14262 @item -mcall-gnu
14263 @opindex mcall-gnu
14264 On System V.4 and embedded PowerPC systems compile code for the
14265 Hurd-based GNU system.
14267 @item -mcall-freebsd
14268 @opindex mcall-freebsd
14269 On System V.4 and embedded PowerPC systems compile code for the
14270 FreeBSD operating system.
14272 @item -mcall-netbsd
14273 @opindex mcall-netbsd
14274 On System V.4 and embedded PowerPC systems compile code for the
14275 NetBSD operating system.
14277 @item -mcall-openbsd
14278 @opindex mcall-netbsd
14279 On System V.4 and embedded PowerPC systems compile code for the
14280 OpenBSD operating system.
14282 @item -maix-struct-return
14283 @opindex maix-struct-return
14284 Return all structures in memory (as specified by the AIX ABI)@.
14286 @item -msvr4-struct-return
14287 @opindex msvr4-struct-return
14288 Return structures smaller than 8 bytes in registers (as specified by the
14289 SVR4 ABI)@.
14291 @item -mabi=@var{abi-type}
14292 @opindex mabi
14293 Extend the current ABI with a particular extension, or remove such extension.
14294 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
14295 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
14297 @item -mabi=spe
14298 @opindex mabi=spe
14299 Extend the current ABI with SPE ABI extensions.  This does not change
14300 the default ABI, instead it adds the SPE ABI extensions to the current
14301 ABI@.
14303 @item -mabi=no-spe
14304 @opindex mabi=no-spe
14305 Disable Booke SPE ABI extensions for the current ABI@.
14307 @item -mabi=ibmlongdouble
14308 @opindex mabi=ibmlongdouble
14309 Change the current ABI to use IBM extended precision long double.
14310 This is a PowerPC 32-bit SYSV ABI option.
14312 @item -mabi=ieeelongdouble
14313 @opindex mabi=ieeelongdouble
14314 Change the current ABI to use IEEE extended precision long double.
14315 This is a PowerPC 32-bit Linux ABI option.
14317 @item -mprototype
14318 @itemx -mno-prototype
14319 @opindex mprototype
14320 @opindex mno-prototype
14321 On System V.4 and embedded PowerPC systems assume that all calls to
14322 variable argument functions are properly prototyped.  Otherwise, the
14323 compiler must insert an instruction before every non prototyped call to
14324 set or clear bit 6 of the condition code register (@var{CR}) to
14325 indicate whether floating point values were passed in the floating point
14326 registers in case the function takes a variable arguments.  With
14327 @option{-mprototype}, only calls to prototyped variable argument functions
14328 will set or clear the bit.
14330 @item -msim
14331 @opindex msim
14332 On embedded PowerPC systems, assume that the startup module is called
14333 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
14334 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
14335 configurations.
14337 @item -mmvme
14338 @opindex mmvme
14339 On embedded PowerPC systems, assume that the startup module is called
14340 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
14341 @file{libc.a}.
14343 @item -mads
14344 @opindex mads
14345 On embedded PowerPC systems, assume that the startup module is called
14346 @file{crt0.o} and the standard C libraries are @file{libads.a} and
14347 @file{libc.a}.
14349 @item -myellowknife
14350 @opindex myellowknife
14351 On embedded PowerPC systems, assume that the startup module is called
14352 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
14353 @file{libc.a}.
14355 @item -mvxworks
14356 @opindex mvxworks
14357 On System V.4 and embedded PowerPC systems, specify that you are
14358 compiling for a VxWorks system.
14360 @item -memb
14361 @opindex memb
14362 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
14363 header to indicate that @samp{eabi} extended relocations are used.
14365 @item -meabi
14366 @itemx -mno-eabi
14367 @opindex meabi
14368 @opindex mno-eabi
14369 On System V.4 and embedded PowerPC systems do (do not) adhere to the
14370 Embedded Applications Binary Interface (eabi) which is a set of
14371 modifications to the System V.4 specifications.  Selecting @option{-meabi}
14372 means that the stack is aligned to an 8 byte boundary, a function
14373 @code{__eabi} is called to from @code{main} to set up the eabi
14374 environment, and the @option{-msdata} option can use both @code{r2} and
14375 @code{r13} to point to two separate small data areas.  Selecting
14376 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
14377 do not call an initialization function from @code{main}, and the
14378 @option{-msdata} option will only use @code{r13} to point to a single
14379 small data area.  The @option{-meabi} option is on by default if you
14380 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
14382 @item -msdata=eabi
14383 @opindex msdata=eabi
14384 On System V.4 and embedded PowerPC systems, put small initialized
14385 @code{const} global and static data in the @samp{.sdata2} section, which
14386 is pointed to by register @code{r2}.  Put small initialized
14387 non-@code{const} global and static data in the @samp{.sdata} section,
14388 which is pointed to by register @code{r13}.  Put small uninitialized
14389 global and static data in the @samp{.sbss} section, which is adjacent to
14390 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
14391 incompatible with the @option{-mrelocatable} option.  The
14392 @option{-msdata=eabi} option also sets the @option{-memb} option.
14394 @item -msdata=sysv
14395 @opindex msdata=sysv
14396 On System V.4 and embedded PowerPC systems, put small global and static
14397 data in the @samp{.sdata} section, which is pointed to by register
14398 @code{r13}.  Put small uninitialized global and static data in the
14399 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
14400 The @option{-msdata=sysv} option is incompatible with the
14401 @option{-mrelocatable} option.
14403 @item -msdata=default
14404 @itemx -msdata
14405 @opindex msdata=default
14406 @opindex msdata
14407 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
14408 compile code the same as @option{-msdata=eabi}, otherwise compile code the
14409 same as @option{-msdata=sysv}.
14411 @item -msdata=data
14412 @opindex msdata=data
14413 On System V.4 and embedded PowerPC systems, put small global
14414 data in the @samp{.sdata} section.  Put small uninitialized global
14415 data in the @samp{.sbss} section.  Do not use register @code{r13}
14416 to address small data however.  This is the default behavior unless
14417 other @option{-msdata} options are used.
14419 @item -msdata=none
14420 @itemx -mno-sdata
14421 @opindex msdata=none
14422 @opindex mno-sdata
14423 On embedded PowerPC systems, put all initialized global and static data
14424 in the @samp{.data} section, and all uninitialized data in the
14425 @samp{.bss} section.
14427 @item -G @var{num}
14428 @opindex G
14429 @cindex smaller data references (PowerPC)
14430 @cindex .sdata/.sdata2 references (PowerPC)
14431 On embedded PowerPC systems, put global and static items less than or
14432 equal to @var{num} bytes into the small data or bss sections instead of
14433 the normal data or bss section.  By default, @var{num} is 8.  The
14434 @option{-G @var{num}} switch is also passed to the linker.
14435 All modules should be compiled with the same @option{-G @var{num}} value.
14437 @item -mregnames
14438 @itemx -mno-regnames
14439 @opindex mregnames
14440 @opindex mno-regnames
14441 On System V.4 and embedded PowerPC systems do (do not) emit register
14442 names in the assembly language output using symbolic forms.
14444 @item -mlongcall
14445 @itemx -mno-longcall
14446 @opindex mlongcall
14447 @opindex mno-longcall
14448 By default assume that all calls are far away so that a longer more
14449 expensive calling sequence is required.  This is required for calls
14450 further than 32 megabytes (33,554,432 bytes) from the current location.
14451 A short call will be generated if the compiler knows
14452 the call cannot be that far away.  This setting can be overridden by
14453 the @code{shortcall} function attribute, or by @code{#pragma
14454 longcall(0)}.
14456 Some linkers are capable of detecting out-of-range calls and generating
14457 glue code on the fly.  On these systems, long calls are unnecessary and
14458 generate slower code.  As of this writing, the AIX linker can do this,
14459 as can the GNU linker for PowerPC/64.  It is planned to add this feature
14460 to the GNU linker for 32-bit PowerPC systems as well.
14462 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
14463 callee, L42'', plus a ``branch island'' (glue code).  The two target
14464 addresses represent the callee and the ``branch island''.  The
14465 Darwin/PPC linker will prefer the first address and generate a ``bl
14466 callee'' if the PPC ``bl'' instruction will reach the callee directly;
14467 otherwise, the linker will generate ``bl L42'' to call the ``branch
14468 island''.  The ``branch island'' is appended to the body of the
14469 calling function; it computes the full 32-bit address of the callee
14470 and jumps to it.
14472 On Mach-O (Darwin) systems, this option directs the compiler emit to
14473 the glue for every direct call, and the Darwin linker decides whether
14474 to use or discard it.
14476 In the future, we may cause GCC to ignore all longcall specifications
14477 when the linker is known to generate glue.
14479 @item -mtls-markers
14480 @itemx -mno-tls-markers
14481 @opindex mtls-markers
14482 @opindex mno-tls-markers
14483 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
14484 specifying the function argument.  The relocation allows ld to
14485 reliably associate function call with argument setup instructions for
14486 TLS optimization, which in turn allows gcc to better schedule the
14487 sequence.
14489 @item -pthread
14490 @opindex pthread
14491 Adds support for multithreading with the @dfn{pthreads} library.
14492 This option sets flags for both the preprocessor and linker.
14494 @end table
14496 @node S/390 and zSeries Options
14497 @subsection S/390 and zSeries Options
14498 @cindex S/390 and zSeries Options
14500 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
14502 @table @gcctabopt
14503 @item -mhard-float
14504 @itemx -msoft-float
14505 @opindex mhard-float
14506 @opindex msoft-float
14507 Use (do not use) the hardware floating-point instructions and registers
14508 for floating-point operations.  When @option{-msoft-float} is specified,
14509 functions in @file{libgcc.a} will be used to perform floating-point
14510 operations.  When @option{-mhard-float} is specified, the compiler
14511 generates IEEE floating-point instructions.  This is the default.
14513 @item -mhard-dfp
14514 @itemx -mno-hard-dfp
14515 @opindex mhard-dfp
14516 @opindex mno-hard-dfp
14517 Use (do not use) the hardware decimal-floating-point instructions for
14518 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
14519 specified, functions in @file{libgcc.a} will be used to perform
14520 decimal-floating-point operations.  When @option{-mhard-dfp} is
14521 specified, the compiler generates decimal-floating-point hardware
14522 instructions.  This is the default for @option{-march=z9-ec} or higher.
14524 @item -mlong-double-64
14525 @itemx -mlong-double-128
14526 @opindex mlong-double-64
14527 @opindex mlong-double-128
14528 These switches control the size of @code{long double} type. A size
14529 of 64bit makes the @code{long double} type equivalent to the @code{double}
14530 type. This is the default.
14532 @item -mbackchain
14533 @itemx -mno-backchain
14534 @opindex mbackchain
14535 @opindex mno-backchain
14536 Store (do not store) the address of the caller's frame as backchain pointer
14537 into the callee's stack frame.
14538 A backchain may be needed to allow debugging using tools that do not understand
14539 DWARF-2 call frame information.
14540 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
14541 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
14542 the backchain is placed into the topmost word of the 96/160 byte register
14543 save area.
14545 In general, code compiled with @option{-mbackchain} is call-compatible with
14546 code compiled with @option{-mmo-backchain}; however, use of the backchain
14547 for debugging purposes usually requires that the whole binary is built with
14548 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
14549 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
14550 to build a linux kernel use @option{-msoft-float}.
14552 The default is to not maintain the backchain.
14554 @item -mpacked-stack
14555 @itemx -mno-packed-stack
14556 @opindex mpacked-stack
14557 @opindex mno-packed-stack
14558 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
14559 specified, the compiler uses the all fields of the 96/160 byte register save
14560 area only for their default purpose; unused fields still take up stack space.
14561 When @option{-mpacked-stack} is specified, register save slots are densely
14562 packed at the top of the register save area; unused space is reused for other
14563 purposes, allowing for more efficient use of the available stack space.
14564 However, when @option{-mbackchain} is also in effect, the topmost word of
14565 the save area is always used to store the backchain, and the return address
14566 register is always saved two words below the backchain.
14568 As long as the stack frame backchain is not used, code generated with
14569 @option{-mpacked-stack} is call-compatible with code generated with
14570 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
14571 S/390 or zSeries generated code that uses the stack frame backchain at run
14572 time, not just for debugging purposes.  Such code is not call-compatible
14573 with code compiled with @option{-mpacked-stack}.  Also, note that the
14574 combination of @option{-mbackchain},
14575 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
14576 to build a linux kernel use @option{-msoft-float}.
14578 The default is to not use the packed stack layout.
14580 @item -msmall-exec
14581 @itemx -mno-small-exec
14582 @opindex msmall-exec
14583 @opindex mno-small-exec
14584 Generate (or do not generate) code using the @code{bras} instruction
14585 to do subroutine calls.
14586 This only works reliably if the total executable size does not
14587 exceed 64k.  The default is to use the @code{basr} instruction instead,
14588 which does not have this limitation.
14590 @item -m64
14591 @itemx -m31
14592 @opindex m64
14593 @opindex m31
14594 When @option{-m31} is specified, generate code compliant to the
14595 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
14596 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
14597 particular to generate 64-bit instructions.  For the @samp{s390}
14598 targets, the default is @option{-m31}, while the @samp{s390x}
14599 targets default to @option{-m64}.
14601 @item -mzarch
14602 @itemx -mesa
14603 @opindex mzarch
14604 @opindex mesa
14605 When @option{-mzarch} is specified, generate code using the
14606 instructions available on z/Architecture.
14607 When @option{-mesa} is specified, generate code using the
14608 instructions available on ESA/390.  Note that @option{-mesa} is
14609 not possible with @option{-m64}.
14610 When generating code compliant to the GNU/Linux for S/390 ABI,
14611 the default is @option{-mesa}.  When generating code compliant
14612 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
14614 @item -mmvcle
14615 @itemx -mno-mvcle
14616 @opindex mmvcle
14617 @opindex mno-mvcle
14618 Generate (or do not generate) code using the @code{mvcle} instruction
14619 to perform block moves.  When @option{-mno-mvcle} is specified,
14620 use a @code{mvc} loop instead.  This is the default unless optimizing for
14621 size.
14623 @item -mdebug
14624 @itemx -mno-debug
14625 @opindex mdebug
14626 @opindex mno-debug
14627 Print (or do not print) additional debug information when compiling.
14628 The default is to not print debug information.
14630 @item -march=@var{cpu-type}
14631 @opindex march
14632 Generate code that will run on @var{cpu-type}, which is the name of a system
14633 representing a certain processor type.  Possible values for
14634 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
14635 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
14636 When generating code using the instructions available on z/Architecture,
14637 the default is @option{-march=z900}.  Otherwise, the default is
14638 @option{-march=g5}.
14640 @item -mtune=@var{cpu-type}
14641 @opindex mtune
14642 Tune to @var{cpu-type} everything applicable about the generated code,
14643 except for the ABI and the set of available instructions.
14644 The list of @var{cpu-type} values is the same as for @option{-march}.
14645 The default is the value used for @option{-march}.
14647 @item -mtpf-trace
14648 @itemx -mno-tpf-trace
14649 @opindex mtpf-trace
14650 @opindex mno-tpf-trace
14651 Generate code that adds (does not add) in TPF OS specific branches to trace
14652 routines in the operating system.  This option is off by default, even
14653 when compiling for the TPF OS@.
14655 @item -mfused-madd
14656 @itemx -mno-fused-madd
14657 @opindex mfused-madd
14658 @opindex mno-fused-madd
14659 Generate code that uses (does not use) the floating point multiply and
14660 accumulate instructions.  These instructions are generated by default if
14661 hardware floating point is used.
14663 @item -mwarn-framesize=@var{framesize}
14664 @opindex mwarn-framesize
14665 Emit a warning if the current function exceeds the given frame size.  Because
14666 this is a compile time check it doesn't need to be a real problem when the program
14667 runs.  It is intended to identify functions which most probably cause
14668 a stack overflow.  It is useful to be used in an environment with limited stack
14669 size e.g.@: the linux kernel.
14671 @item -mwarn-dynamicstack
14672 @opindex mwarn-dynamicstack
14673 Emit a warning if the function calls alloca or uses dynamically
14674 sized arrays.  This is generally a bad idea with a limited stack size.
14676 @item -mstack-guard=@var{stack-guard}
14677 @itemx -mstack-size=@var{stack-size}
14678 @opindex mstack-guard
14679 @opindex mstack-size
14680 If these options are provided the s390 back end emits additional instructions in
14681 the function prologue which trigger a trap if the stack size is @var{stack-guard}
14682 bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
14683 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
14684 the frame size of the compiled function is chosen.
14685 These options are intended to be used to help debugging stack overflow problems.
14686 The additionally emitted code causes only little overhead and hence can also be
14687 used in production like systems without greater performance degradation.  The given
14688 values have to be exact powers of 2 and @var{stack-size} has to be greater than
14689 @var{stack-guard} without exceeding 64k.
14690 In order to be efficient the extra code makes the assumption that the stack starts
14691 at an address aligned to the value given by @var{stack-size}.
14692 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
14693 @end table
14695 @node Score Options
14696 @subsection Score Options
14697 @cindex Score Options
14699 These options are defined for Score implementations:
14701 @table @gcctabopt
14702 @item -meb
14703 @opindex meb
14704 Compile code for big endian mode.  This is the default.
14706 @item -mel
14707 @opindex mel
14708 Compile code for little endian mode. 
14710 @item -mnhwloop
14711 @opindex mnhwloop
14712 Disable generate bcnz instruction.
14714 @item -muls
14715 @opindex muls
14716 Enable generate unaligned load and store instruction.
14718 @item -mmac
14719 @opindex mmac
14720 Enable the use of multiply-accumulate instructions. Disabled by default. 
14722 @item -mscore5
14723 @opindex mscore5
14724 Specify the SCORE5 as the target architecture.
14726 @item -mscore5u
14727 @opindex mscore5u
14728 Specify the SCORE5U of the target architecture.
14730 @item -mscore7
14731 @opindex mscore7
14732 Specify the SCORE7 as the target architecture. This is the default.
14734 @item -mscore7d
14735 @opindex mscore7d
14736 Specify the SCORE7D as the target architecture.
14737 @end table
14739 @node SH Options
14740 @subsection SH Options
14742 These @samp{-m} options are defined for the SH implementations:
14744 @table @gcctabopt
14745 @item -m1
14746 @opindex m1
14747 Generate code for the SH1.
14749 @item -m2
14750 @opindex m2
14751 Generate code for the SH2.
14753 @item -m2e
14754 Generate code for the SH2e.
14756 @item -m3
14757 @opindex m3
14758 Generate code for the SH3.
14760 @item -m3e
14761 @opindex m3e
14762 Generate code for the SH3e.
14764 @item -m4-nofpu
14765 @opindex m4-nofpu
14766 Generate code for the SH4 without a floating-point unit.
14768 @item -m4-single-only
14769 @opindex m4-single-only
14770 Generate code for the SH4 with a floating-point unit that only
14771 supports single-precision arithmetic.
14773 @item -m4-single
14774 @opindex m4-single
14775 Generate code for the SH4 assuming the floating-point unit is in
14776 single-precision mode by default.
14778 @item -m4
14779 @opindex m4
14780 Generate code for the SH4.
14782 @item -m4a-nofpu
14783 @opindex m4a-nofpu
14784 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
14785 floating-point unit is not used.
14787 @item -m4a-single-only
14788 @opindex m4a-single-only
14789 Generate code for the SH4a, in such a way that no double-precision
14790 floating point operations are used.
14792 @item -m4a-single
14793 @opindex m4a-single
14794 Generate code for the SH4a assuming the floating-point unit is in
14795 single-precision mode by default.
14797 @item -m4a
14798 @opindex m4a
14799 Generate code for the SH4a.
14801 @item -m4al
14802 @opindex m4al
14803 Same as @option{-m4a-nofpu}, except that it implicitly passes
14804 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
14805 instructions at the moment.
14807 @item -mb
14808 @opindex mb
14809 Compile code for the processor in big endian mode.
14811 @item -ml
14812 @opindex ml
14813 Compile code for the processor in little endian mode.
14815 @item -mdalign
14816 @opindex mdalign
14817 Align doubles at 64-bit boundaries.  Note that this changes the calling
14818 conventions, and thus some functions from the standard C library will
14819 not work unless you recompile it first with @option{-mdalign}.
14821 @item -mrelax
14822 @opindex mrelax
14823 Shorten some address references at link time, when possible; uses the
14824 linker option @option{-relax}.
14826 @item -mbigtable
14827 @opindex mbigtable
14828 Use 32-bit offsets in @code{switch} tables.  The default is to use
14829 16-bit offsets.
14831 @item -mbitops
14832 @opindex mbitops
14833 Enable the use of bit manipulation instructions on SH2A.
14835 @item -mfmovd
14836 @opindex mfmovd
14837 Enable the use of the instruction @code{fmovd}.
14839 @item -mhitachi
14840 @opindex mhitachi
14841 Comply with the calling conventions defined by Renesas.
14843 @item -mrenesas
14844 @opindex mhitachi
14845 Comply with the calling conventions defined by Renesas.
14847 @item -mno-renesas
14848 @opindex mhitachi
14849 Comply with the calling conventions defined for GCC before the Renesas
14850 conventions were available.  This option is the default for all
14851 targets of the SH toolchain except for @samp{sh-symbianelf}.
14853 @item -mnomacsave
14854 @opindex mnomacsave
14855 Mark the @code{MAC} register as call-clobbered, even if
14856 @option{-mhitachi} is given.
14858 @item -mieee
14859 @opindex mieee
14860 Increase IEEE-compliance of floating-point code.
14861 At the moment, this is equivalent to @option{-fno-finite-math-only}.
14862 When generating 16 bit SH opcodes, getting IEEE-conforming results for
14863 comparisons of NANs / infinities incurs extra overhead in every
14864 floating point comparison, therefore the default is set to
14865 @option{-ffinite-math-only}.
14867 @item -minline-ic_invalidate
14868 @opindex minline-ic_invalidate
14869 Inline code to invalidate instruction cache entries after setting up
14870 nested function trampolines.
14871 This option has no effect if -musermode is in effect and the selected
14872 code generation option (e.g. -m4) does not allow the use of the icbi
14873 instruction.
14874 If the selected code generation option does not allow the use of the icbi
14875 instruction, and -musermode is not in effect, the inlined code will
14876 manipulate the instruction cache address array directly with an associative
14877 write.  This not only requires privileged mode, but it will also
14878 fail if the cache line had been mapped via the TLB and has become unmapped.
14880 @item -misize
14881 @opindex misize
14882 Dump instruction size and location in the assembly code.
14884 @item -mpadstruct
14885 @opindex mpadstruct
14886 This option is deprecated.  It pads structures to multiple of 4 bytes,
14887 which is incompatible with the SH ABI@.
14889 @item -mspace
14890 @opindex mspace
14891 Optimize for space instead of speed.  Implied by @option{-Os}.
14893 @item -mprefergot
14894 @opindex mprefergot
14895 When generating position-independent code, emit function calls using
14896 the Global Offset Table instead of the Procedure Linkage Table.
14898 @item -musermode
14899 @opindex musermode
14900 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
14901 if the inlined code would not work in user mode.
14902 This is the default when the target is @code{sh-*-linux*}.
14904 @item -multcost=@var{number}
14905 @opindex multcost=@var{number}
14906 Set the cost to assume for a multiply insn.
14908 @item -mdiv=@var{strategy}
14909 @opindex mdiv=@var{strategy}
14910 Set the division strategy to use for SHmedia code.  @var{strategy} must be
14911 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
14912 inv:call2, inv:fp .
14913 "fp" performs the operation in floating point.  This has a very high latency,
14914 but needs only a few instructions, so it might be a good choice if
14915 your code has enough easily exploitable ILP to allow the compiler to
14916 schedule the floating point instructions together with other instructions.
14917 Division by zero causes a floating point exception.
14918 "inv" uses integer operations to calculate the inverse of the divisor,
14919 and then multiplies the dividend with the inverse.  This strategy allows
14920 cse and hoisting of the inverse calculation.  Division by zero calculates
14921 an unspecified result, but does not trap.
14922 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
14923 have been found, or if the entire operation has been hoisted to the same
14924 place, the last stages of the inverse calculation are intertwined with the
14925 final multiply to reduce the overall latency, at the expense of using a few
14926 more instructions, and thus offering fewer scheduling opportunities with
14927 other code.
14928 "call" calls a library function that usually implements the inv:minlat
14929 strategy.
14930 This gives high code density for m5-*media-nofpu compilations.
14931 "call2" uses a different entry point of the same library function, where it
14932 assumes that a pointer to a lookup table has already been set up, which
14933 exposes the pointer load to cse / code hoisting optimizations.
14934 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
14935 code generation, but if the code stays unoptimized, revert to the "call",
14936 "call2", or "fp" strategies, respectively.  Note that the
14937 potentially-trapping side effect of division by zero is carried by a
14938 separate instruction, so it is possible that all the integer instructions
14939 are hoisted out, but the marker for the side effect stays where it is.
14940 A recombination to fp operations or a call is not possible in that case.
14941 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
14942 that the inverse calculation was nor separated from the multiply, they speed
14943 up division where the dividend fits into 20 bits (plus sign where applicable),
14944 by inserting a test to skip a number of operations in this case; this test
14945 slows down the case of larger dividends.  inv20u assumes the case of a such
14946 a small dividend to be unlikely, and inv20l assumes it to be likely.
14948 @item -mdivsi3_libfunc=@var{name}
14949 @opindex mdivsi3_libfunc=@var{name}
14950 Set the name of the library function used for 32 bit signed division to
14951 @var{name}.  This only affect the name used in the call and inv:call
14952 division strategies, and the compiler will still expect the same
14953 sets of input/output/clobbered registers as if this option was not present.
14955 @item -mfixed-range=@var{register-range}
14956 @opindex mfixed-range
14957 Generate code treating the given register range as fixed registers.
14958 A fixed register is one that the register allocator can not use.  This is
14959 useful when compiling kernel code.  A register range is specified as
14960 two registers separated by a dash.  Multiple register ranges can be
14961 specified separated by a comma.
14963 @item -madjust-unroll
14964 @opindex madjust-unroll
14965 Throttle unrolling to avoid thrashing target registers.
14966 This option only has an effect if the gcc code base supports the
14967 TARGET_ADJUST_UNROLL_MAX target hook.
14969 @item -mindexed-addressing
14970 @opindex mindexed-addressing
14971 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
14972 This is only safe if the hardware and/or OS implement 32 bit wrap-around
14973 semantics for the indexed addressing mode.  The architecture allows the
14974 implementation of processors with 64 bit MMU, which the OS could use to
14975 get 32 bit addressing, but since no current hardware implementation supports
14976 this or any other way to make the indexed addressing mode safe to use in
14977 the 32 bit ABI, the default is -mno-indexed-addressing.
14979 @item -mgettrcost=@var{number}
14980 @opindex mgettrcost=@var{number}
14981 Set the cost assumed for the gettr instruction to @var{number}.
14982 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
14984 @item -mpt-fixed
14985 @opindex mpt-fixed
14986 Assume pt* instructions won't trap.  This will generally generate better
14987 scheduled code, but is unsafe on current hardware.  The current architecture
14988 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
14989 This has the unintentional effect of making it unsafe to schedule ptabs /
14990 ptrel before a branch, or hoist it out of a loop.  For example,
14991 __do_global_ctors, a part of libgcc that runs constructors at program
14992 startup, calls functions in a list which is delimited by @minus{}1.  With the
14993 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
14994 That means that all the constructors will be run a bit quicker, but when
14995 the loop comes to the end of the list, the program crashes because ptabs
14996 loads @minus{}1 into a target register.  Since this option is unsafe for any
14997 hardware implementing the current architecture specification, the default
14998 is -mno-pt-fixed.  Unless the user specifies a specific cost with
14999 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
15000 this deters register allocation using target registers for storing
15001 ordinary integers.
15003 @item -minvalid-symbols
15004 @opindex minvalid-symbols
15005 Assume symbols might be invalid.  Ordinary function symbols generated by
15006 the compiler will always be valid to load with movi/shori/ptabs or
15007 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
15008 to generate symbols that will cause ptabs / ptrel to trap.
15009 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
15010 It will then prevent cross-basic-block cse, hoisting and most scheduling
15011 of symbol loads.  The default is @option{-mno-invalid-symbols}.
15012 @end table
15014 @node SPARC Options
15015 @subsection SPARC Options
15016 @cindex SPARC options
15018 These @samp{-m} options are supported on the SPARC:
15020 @table @gcctabopt
15021 @item -mno-app-regs
15022 @itemx -mapp-regs
15023 @opindex mno-app-regs
15024 @opindex mapp-regs
15025 Specify @option{-mapp-regs} to generate output using the global registers
15026 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
15027 is the default.
15029 To be fully SVR4 ABI compliant at the cost of some performance loss,
15030 specify @option{-mno-app-regs}.  You should compile libraries and system
15031 software with this option.
15033 @item -mfpu
15034 @itemx -mhard-float
15035 @opindex mfpu
15036 @opindex mhard-float
15037 Generate output containing floating point instructions.  This is the
15038 default.
15040 @item -mno-fpu
15041 @itemx -msoft-float
15042 @opindex mno-fpu
15043 @opindex msoft-float
15044 Generate output containing library calls for floating point.
15045 @strong{Warning:} the requisite libraries are not available for all SPARC
15046 targets.  Normally the facilities of the machine's usual C compiler are
15047 used, but this cannot be done directly in cross-compilation.  You must make
15048 your own arrangements to provide suitable library functions for
15049 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
15050 @samp{sparclite-*-*} do provide software floating point support.
15052 @option{-msoft-float} changes the calling convention in the output file;
15053 therefore, it is only useful if you compile @emph{all} of a program with
15054 this option.  In particular, you need to compile @file{libgcc.a}, the
15055 library that comes with GCC, with @option{-msoft-float} in order for
15056 this to work.
15058 @item -mhard-quad-float
15059 @opindex mhard-quad-float
15060 Generate output containing quad-word (long double) floating point
15061 instructions.
15063 @item -msoft-quad-float
15064 @opindex msoft-quad-float
15065 Generate output containing library calls for quad-word (long double)
15066 floating point instructions.  The functions called are those specified
15067 in the SPARC ABI@.  This is the default.
15069 As of this writing, there are no SPARC implementations that have hardware
15070 support for the quad-word floating point instructions.  They all invoke
15071 a trap handler for one of these instructions, and then the trap handler
15072 emulates the effect of the instruction.  Because of the trap handler overhead,
15073 this is much slower than calling the ABI library routines.  Thus the
15074 @option{-msoft-quad-float} option is the default.
15076 @item -mno-unaligned-doubles
15077 @itemx -munaligned-doubles
15078 @opindex mno-unaligned-doubles
15079 @opindex munaligned-doubles
15080 Assume that doubles have 8 byte alignment.  This is the default.
15082 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
15083 alignment only if they are contained in another type, or if they have an
15084 absolute address.  Otherwise, it assumes they have 4 byte alignment.
15085 Specifying this option avoids some rare compatibility problems with code
15086 generated by other compilers.  It is not the default because it results
15087 in a performance loss, especially for floating point code.
15089 @item -mno-faster-structs
15090 @itemx -mfaster-structs
15091 @opindex mno-faster-structs
15092 @opindex mfaster-structs
15093 With @option{-mfaster-structs}, the compiler assumes that structures
15094 should have 8 byte alignment.  This enables the use of pairs of
15095 @code{ldd} and @code{std} instructions for copies in structure
15096 assignment, in place of twice as many @code{ld} and @code{st} pairs.
15097 However, the use of this changed alignment directly violates the SPARC
15098 ABI@.  Thus, it's intended only for use on targets where the developer
15099 acknowledges that their resulting code will not be directly in line with
15100 the rules of the ABI@.
15102 @item -mimpure-text
15103 @opindex mimpure-text
15104 @option{-mimpure-text}, used in addition to @option{-shared}, tells
15105 the compiler to not pass @option{-z text} to the linker when linking a
15106 shared object.  Using this option, you can link position-dependent
15107 code into a shared object.
15109 @option{-mimpure-text} suppresses the ``relocations remain against
15110 allocatable but non-writable sections'' linker error message.
15111 However, the necessary relocations will trigger copy-on-write, and the
15112 shared object is not actually shared across processes.  Instead of
15113 using @option{-mimpure-text}, you should compile all source code with
15114 @option{-fpic} or @option{-fPIC}.
15116 This option is only available on SunOS and Solaris.
15118 @item -mcpu=@var{cpu_type}
15119 @opindex mcpu
15120 Set the instruction set, register set, and instruction scheduling parameters
15121 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
15122 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
15123 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
15124 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
15125 @samp{ultrasparc3}, @samp{niagara} and @samp{niagara2}.
15127 Default instruction scheduling parameters are used for values that select
15128 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
15129 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
15131 Here is a list of each supported architecture and their supported
15132 implementations.
15134 @smallexample
15135     v7:             cypress
15136     v8:             supersparc, hypersparc
15137     sparclite:      f930, f934, sparclite86x
15138     sparclet:       tsc701
15139     v9:             ultrasparc, ultrasparc3, niagara, niagara2
15140 @end smallexample
15142 By default (unless configured otherwise), GCC generates code for the V7
15143 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
15144 additionally optimizes it for the Cypress CY7C602 chip, as used in the
15145 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
15146 SPARCStation 1, 2, IPX etc.
15148 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
15149 architecture.  The only difference from V7 code is that the compiler emits
15150 the integer multiply and integer divide instructions which exist in SPARC-V8
15151 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
15152 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
15153 2000 series.
15155 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
15156 the SPARC architecture.  This adds the integer multiply, integer divide step
15157 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
15158 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
15159 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
15160 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
15161 MB86934 chip, which is the more recent SPARClite with FPU@.
15163 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
15164 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
15165 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
15166 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
15167 optimizes it for the TEMIC SPARClet chip.
15169 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
15170 architecture.  This adds 64-bit integer and floating-point move instructions,
15171 3 additional floating-point condition code registers and conditional move
15172 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
15173 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
15174 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
15175 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
15176 @option{-mcpu=niagara}, the compiler additionally optimizes it for
15177 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
15178 additionally optimizes it for Sun UltraSPARC T2 chips.
15180 @item -mtune=@var{cpu_type}
15181 @opindex mtune
15182 Set the instruction scheduling parameters for machine type
15183 @var{cpu_type}, but do not set the instruction set or register set that the
15184 option @option{-mcpu=@var{cpu_type}} would.
15186 The same values for @option{-mcpu=@var{cpu_type}} can be used for
15187 @option{-mtune=@var{cpu_type}}, but the only useful values are those
15188 that select a particular cpu implementation.  Those are @samp{cypress},
15189 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
15190 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
15191 @samp{ultrasparc3}, @samp{niagara}, and @samp{niagara2}.
15193 @item -mv8plus
15194 @itemx -mno-v8plus
15195 @opindex mv8plus
15196 @opindex mno-v8plus
15197 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
15198 difference from the V8 ABI is that the global and out registers are
15199 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
15200 mode for all SPARC-V9 processors.
15202 @item -mvis
15203 @itemx -mno-vis
15204 @opindex mvis
15205 @opindex mno-vis
15206 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
15207 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
15208 @end table
15210 These @samp{-m} options are supported in addition to the above
15211 on SPARC-V9 processors in 64-bit environments:
15213 @table @gcctabopt
15214 @item -mlittle-endian
15215 @opindex mlittle-endian
15216 Generate code for a processor running in little-endian mode.  It is only
15217 available for a few configurations and most notably not on Solaris and Linux.
15219 @item -m32
15220 @itemx -m64
15221 @opindex m32
15222 @opindex m64
15223 Generate code for a 32-bit or 64-bit environment.
15224 The 32-bit environment sets int, long and pointer to 32 bits.
15225 The 64-bit environment sets int to 32 bits and long and pointer
15226 to 64 bits.
15228 @item -mcmodel=medlow
15229 @opindex mcmodel=medlow
15230 Generate code for the Medium/Low code model: 64-bit addresses, programs
15231 must be linked in the low 32 bits of memory.  Programs can be statically
15232 or dynamically linked.
15234 @item -mcmodel=medmid
15235 @opindex mcmodel=medmid
15236 Generate code for the Medium/Middle code model: 64-bit addresses, programs
15237 must be linked in the low 44 bits of memory, the text and data segments must
15238 be less than 2GB in size and the data segment must be located within 2GB of
15239 the text segment.
15241 @item -mcmodel=medany
15242 @opindex mcmodel=medany
15243 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
15244 may be linked anywhere in memory, the text and data segments must be less
15245 than 2GB in size and the data segment must be located within 2GB of the
15246 text segment.
15248 @item -mcmodel=embmedany
15249 @opindex mcmodel=embmedany
15250 Generate code for the Medium/Anywhere code model for embedded systems:
15251 64-bit addresses, the text and data segments must be less than 2GB in
15252 size, both starting anywhere in memory (determined at link time).  The
15253 global register %g4 points to the base of the data segment.  Programs
15254 are statically linked and PIC is not supported.
15256 @item -mstack-bias
15257 @itemx -mno-stack-bias
15258 @opindex mstack-bias
15259 @opindex mno-stack-bias
15260 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
15261 frame pointer if present, are offset by @minus{}2047 which must be added back
15262 when making stack frame references.  This is the default in 64-bit mode.
15263 Otherwise, assume no such offset is present.
15264 @end table
15266 These switches are supported in addition to the above on Solaris:
15268 @table @gcctabopt
15269 @item -threads
15270 @opindex threads
15271 Add support for multithreading using the Solaris threads library.  This
15272 option sets flags for both the preprocessor and linker.  This option does
15273 not affect the thread safety of object code produced by the compiler or
15274 that of libraries supplied with it.
15276 @item -pthreads
15277 @opindex pthreads
15278 Add support for multithreading using the POSIX threads library.  This
15279 option sets flags for both the preprocessor and linker.  This option does
15280 not affect the thread safety of object code produced  by the compiler or
15281 that of libraries supplied with it.
15283 @item -pthread
15284 @opindex pthread
15285 This is a synonym for @option{-pthreads}.
15286 @end table
15288 @node SPU Options
15289 @subsection SPU Options
15290 @cindex SPU options
15292 These @samp{-m} options are supported on the SPU:
15294 @table @gcctabopt
15295 @item -mwarn-reloc
15296 @itemx -merror-reloc
15297 @opindex mwarn-reloc
15298 @opindex merror-reloc
15300 The loader for SPU does not handle dynamic relocations.  By default, GCC
15301 will give an error when it generates code that requires a dynamic
15302 relocation.  @option{-mno-error-reloc} disables the error,
15303 @option{-mwarn-reloc} will generate a warning instead.
15305 @item -msafe-dma
15306 @itemx -munsafe-dma
15307 @opindex msafe-dma
15308 @opindex munsafe-dma
15310 Instructions which initiate or test completion of DMA must not be
15311 reordered with respect to loads and stores of the memory which is being
15312 accessed.  Users typically address this problem using the volatile
15313 keyword, but that can lead to inefficient code in places where the
15314 memory is known to not change.  Rather than mark the memory as volatile
15315 we treat the DMA instructions as potentially effecting all memory.  With
15316 @option{-munsafe-dma} users must use the volatile keyword to protect
15317 memory accesses.
15319 @item -mbranch-hints
15320 @opindex mbranch-hints
15322 By default, GCC will generate a branch hint instruction to avoid
15323 pipeline stalls for always taken or probably taken branches.  A hint
15324 will not be generated closer than 8 instructions away from its branch.
15325 There is little reason to disable them, except for debugging purposes,
15326 or to make an object a little bit smaller.
15328 @item -msmall-mem
15329 @itemx -mlarge-mem
15330 @opindex msmall-mem
15331 @opindex mlarge-mem
15333 By default, GCC generates code assuming that addresses are never larger
15334 than 18 bits.  With @option{-mlarge-mem} code is generated that assumes
15335 a full 32 bit address.
15337 @item -mstdmain
15338 @opindex mstdmain
15340 By default, GCC links against startup code that assumes the SPU-style
15341 main function interface (which has an unconventional parameter list).
15342 With @option{-mstdmain}, GCC will link your program against startup
15343 code that assumes a C99-style interface to @code{main}, including a
15344 local copy of @code{argv} strings.
15346 @item -mfixed-range=@var{register-range}
15347 @opindex mfixed-range
15348 Generate code treating the given register range as fixed registers.
15349 A fixed register is one that the register allocator can not use.  This is
15350 useful when compiling kernel code.  A register range is specified as
15351 two registers separated by a dash.  Multiple register ranges can be
15352 specified separated by a comma.
15354 @item -mdual-nops
15355 @itemx -mdual-nops=@var{n}
15356 @opindex mdual-nops
15357 By default, GCC will insert nops to increase dual issue when it expects
15358 it to increase performance.  @var{n} can be a value from 0 to 10.  A
15359 smaller @var{n} will insert fewer nops.  10 is the default, 0 is the
15360 same as @option{-mno-dual-nops}.  Disabled with @option{-Os}.
15362 @item -mhint-max-nops=@var{n}
15363 @opindex mhint-max-nops
15364 Maximum number of nops to insert for a branch hint.  A branch hint must
15365 be at least 8 instructions away from the branch it is effecting.  GCC
15366 will insert up to @var{n} nops to enforce this, otherwise it will not
15367 generate the branch hint.
15369 @item -mhint-max-distance=@var{n}
15370 @opindex mhint-max-distance
15371 The encoding of the branch hint instruction limits the hint to be within
15372 256 instructions of the branch it is effecting.  By default, GCC makes
15373 sure it is within 125. 
15375 @item -msafe-hints
15376 @opindex msafe-hints
15377 Work around a hardware bug which causes the SPU to stall indefinitely.
15378 By default, GCC will insert the @code{hbrp} instruction to make sure
15379 this stall won't happen.
15381 @end table
15383 @node System V Options
15384 @subsection Options for System V
15386 These additional options are available on System V Release 4 for
15387 compatibility with other compilers on those systems:
15389 @table @gcctabopt
15390 @item -G
15391 @opindex G
15392 Create a shared object.
15393 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
15395 @item -Qy
15396 @opindex Qy
15397 Identify the versions of each tool used by the compiler, in a
15398 @code{.ident} assembler directive in the output.
15400 @item -Qn
15401 @opindex Qn
15402 Refrain from adding @code{.ident} directives to the output file (this is
15403 the default).
15405 @item -YP,@var{dirs}
15406 @opindex YP
15407 Search the directories @var{dirs}, and no others, for libraries
15408 specified with @option{-l}.
15410 @item -Ym,@var{dir}
15411 @opindex Ym
15412 Look in the directory @var{dir} to find the M4 preprocessor.
15413 The assembler uses this option.
15414 @c This is supposed to go with a -Yd for predefined M4 macro files, but
15415 @c the generic assembler that comes with Solaris takes just -Ym.
15416 @end table
15418 @node V850 Options
15419 @subsection V850 Options
15420 @cindex V850 Options
15422 These @samp{-m} options are defined for V850 implementations:
15424 @table @gcctabopt
15425 @item -mlong-calls
15426 @itemx -mno-long-calls
15427 @opindex mlong-calls
15428 @opindex mno-long-calls
15429 Treat all calls as being far away (near).  If calls are assumed to be
15430 far away, the compiler will always load the functions address up into a
15431 register, and call indirect through the pointer.
15433 @item -mno-ep
15434 @itemx -mep
15435 @opindex mno-ep
15436 @opindex mep
15437 Do not optimize (do optimize) basic blocks that use the same index
15438 pointer 4 or more times to copy pointer into the @code{ep} register, and
15439 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
15440 option is on by default if you optimize.
15442 @item -mno-prolog-function
15443 @itemx -mprolog-function
15444 @opindex mno-prolog-function
15445 @opindex mprolog-function
15446 Do not use (do use) external functions to save and restore registers
15447 at the prologue and epilogue of a function.  The external functions
15448 are slower, but use less code space if more than one function saves
15449 the same number of registers.  The @option{-mprolog-function} option
15450 is on by default if you optimize.
15452 @item -mspace
15453 @opindex mspace
15454 Try to make the code as small as possible.  At present, this just turns
15455 on the @option{-mep} and @option{-mprolog-function} options.
15457 @item -mtda=@var{n}
15458 @opindex mtda
15459 Put static or global variables whose size is @var{n} bytes or less into
15460 the tiny data area that register @code{ep} points to.  The tiny data
15461 area can hold up to 256 bytes in total (128 bytes for byte references).
15463 @item -msda=@var{n}
15464 @opindex msda
15465 Put static or global variables whose size is @var{n} bytes or less into
15466 the small data area that register @code{gp} points to.  The small data
15467 area can hold up to 64 kilobytes.
15469 @item -mzda=@var{n}
15470 @opindex mzda
15471 Put static or global variables whose size is @var{n} bytes or less into
15472 the first 32 kilobytes of memory.
15474 @item -mv850
15475 @opindex mv850
15476 Specify that the target processor is the V850.
15478 @item -mbig-switch
15479 @opindex mbig-switch
15480 Generate code suitable for big switch tables.  Use this option only if
15481 the assembler/linker complain about out of range branches within a switch
15482 table.
15484 @item -mapp-regs
15485 @opindex mapp-regs
15486 This option will cause r2 and r5 to be used in the code generated by
15487 the compiler.  This setting is the default.
15489 @item -mno-app-regs
15490 @opindex mno-app-regs
15491 This option will cause r2 and r5 to be treated as fixed registers.
15493 @item -mv850e1
15494 @opindex mv850e1
15495 Specify that the target processor is the V850E1.  The preprocessor
15496 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
15497 this option is used.
15499 @item -mv850e
15500 @opindex mv850e
15501 Specify that the target processor is the V850E@.  The preprocessor
15502 constant @samp{__v850e__} will be defined if this option is used.
15504 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
15505 are defined then a default target processor will be chosen and the
15506 relevant @samp{__v850*__} preprocessor constant will be defined.
15508 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
15509 defined, regardless of which processor variant is the target.
15511 @item -mdisable-callt
15512 @opindex mdisable-callt
15513 This option will suppress generation of the CALLT instruction for the
15514 v850e and v850e1 flavors of the v850 architecture.  The default is
15515 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
15517 @end table
15519 @node VAX Options
15520 @subsection VAX Options
15521 @cindex VAX options
15523 These @samp{-m} options are defined for the VAX:
15525 @table @gcctabopt
15526 @item -munix
15527 @opindex munix
15528 Do not output certain jump instructions (@code{aobleq} and so on)
15529 that the Unix assembler for the VAX cannot handle across long
15530 ranges.
15532 @item -mgnu
15533 @opindex mgnu
15534 Do output those jump instructions, on the assumption that you
15535 will assemble with the GNU assembler.
15537 @item -mg
15538 @opindex mg
15539 Output code for g-format floating point numbers instead of d-format.
15540 @end table
15542 @node VxWorks Options
15543 @subsection VxWorks Options
15544 @cindex VxWorks Options
15546 The options in this section are defined for all VxWorks targets.
15547 Options specific to the target hardware are listed with the other
15548 options for that target.
15550 @table @gcctabopt
15551 @item -mrtp
15552 @opindex mrtp
15553 GCC can generate code for both VxWorks kernels and real time processes
15554 (RTPs).  This option switches from the former to the latter.  It also
15555 defines the preprocessor macro @code{__RTP__}.
15557 @item -non-static
15558 @opindex non-static
15559 Link an RTP executable against shared libraries rather than static
15560 libraries.  The options @option{-static} and @option{-shared} can
15561 also be used for RTPs (@pxref{Link Options}); @option{-static}
15562 is the default.
15564 @item -Bstatic
15565 @itemx -Bdynamic
15566 @opindex Bstatic
15567 @opindex Bdynamic
15568 These options are passed down to the linker.  They are defined for
15569 compatibility with Diab.
15571 @item -Xbind-lazy
15572 @opindex Xbind-lazy
15573 Enable lazy binding of function calls.  This option is equivalent to
15574 @option{-Wl,-z,now} and is defined for compatibility with Diab.
15576 @item -Xbind-now
15577 @opindex Xbind-now
15578 Disable lazy binding of function calls.  This option is the default and
15579 is defined for compatibility with Diab.
15580 @end table
15582 @node x86-64 Options
15583 @subsection x86-64 Options
15584 @cindex x86-64 options
15586 These are listed under @xref{i386 and x86-64 Options}.
15588 @node i386 and x86-64 Windows Options
15589 @subsection i386 and x86-64 Windows Options
15590 @cindex i386 and x86-64 Windows Options
15592 These additional options are available for Windows targets:
15594 @table @gcctabopt
15595 @item -mconsole
15596 @opindex mconsole
15597 This option is available for Cygwin and MinGW targets.  It
15598 specifies that a console application is to be generated, by
15599 instructing the linker to set the PE header subsystem type
15600 required for console applications.
15601 This is the default behavior for Cygwin and MinGW targets.
15603 @item -mcygwin
15604 @opindex mcygwin
15605 This option is available for Cygwin targets.  It specifies that
15606 the Cygwin internal interface is to be used for predefined
15607 preprocessor macros, C runtime libraries and related linker
15608 paths and options.  For Cygwin targets this is the default behavior.
15609 This option is deprecated and will be removed in a future release.
15611 @item -mno-cygwin
15612 @opindex mno-cygwin
15613 This option is available for Cygwin targets.  It specifies that
15614 the MinGW internal interface is to be used instead of Cygwin's, by
15615 setting MinGW-related predefined macros and linker paths and default
15616 library options.
15617 This option is deprecated and will be removed in a future release.
15619 @item -mdll
15620 @opindex mdll
15621 This option is available for Cygwin and MinGW targets.  It
15622 specifies that a DLL - a dynamic link library - is to be
15623 generated, enabling the selection of the required runtime
15624 startup object and entry point.
15626 @item -mnop-fun-dllimport
15627 @opindex mnop-fun-dllimport
15628 This option is available for Cygwin and MinGW targets.  It
15629 specifies that the dllimport attribute should be ignored.
15631 @item -mthread
15632 @opindex mthread
15633 This option is available for MinGW targets. It specifies
15634 that MinGW-specific thread support is to be used.
15636 @item -municode
15637 @opindex municode
15638 This option is available for mingw-w64 targets.  It specifies
15639 that the UNICODE macro is getting pre-defined and that the
15640 unicode capable runtime startup code is choosen.
15642 @item -mwin32
15643 @opindex mwin32
15644 This option is available for Cygwin and MinGW targets.  It
15645 specifies that the typical Windows pre-defined macros are to
15646 be set in the pre-processor, but does not influence the choice
15647 of runtime library/startup code.
15649 @item -mwindows
15650 @opindex mwindows
15651 This option is available for Cygwin and MinGW targets.  It
15652 specifies that a GUI application is to be generated by
15653 instructing the linker to set the PE header subsystem type
15654 appropriately.
15655 @end table
15657 See also under @ref{i386 and x86-64 Options} for standard options.
15659 @node Xstormy16 Options
15660 @subsection Xstormy16 Options
15661 @cindex Xstormy16 Options
15663 These options are defined for Xstormy16:
15665 @table @gcctabopt
15666 @item -msim
15667 @opindex msim
15668 Choose startup files and linker script suitable for the simulator.
15669 @end table
15671 @node Xtensa Options
15672 @subsection Xtensa Options
15673 @cindex Xtensa Options
15675 These options are supported for Xtensa targets:
15677 @table @gcctabopt
15678 @item -mconst16
15679 @itemx -mno-const16
15680 @opindex mconst16
15681 @opindex mno-const16
15682 Enable or disable use of @code{CONST16} instructions for loading
15683 constant values.  The @code{CONST16} instruction is currently not a
15684 standard option from Tensilica.  When enabled, @code{CONST16}
15685 instructions are always used in place of the standard @code{L32R}
15686 instructions.  The use of @code{CONST16} is enabled by default only if
15687 the @code{L32R} instruction is not available.
15689 @item -mfused-madd
15690 @itemx -mno-fused-madd
15691 @opindex mfused-madd
15692 @opindex mno-fused-madd
15693 Enable or disable use of fused multiply/add and multiply/subtract
15694 instructions in the floating-point option.  This has no effect if the
15695 floating-point option is not also enabled.  Disabling fused multiply/add
15696 and multiply/subtract instructions forces the compiler to use separate
15697 instructions for the multiply and add/subtract operations.  This may be
15698 desirable in some cases where strict IEEE 754-compliant results are
15699 required: the fused multiply add/subtract instructions do not round the
15700 intermediate result, thereby producing results with @emph{more} bits of
15701 precision than specified by the IEEE standard.  Disabling fused multiply
15702 add/subtract instructions also ensures that the program output is not
15703 sensitive to the compiler's ability to combine multiply and add/subtract
15704 operations.
15706 @item -mserialize-volatile
15707 @itemx -mno-serialize-volatile
15708 @opindex mserialize-volatile
15709 @opindex mno-serialize-volatile
15710 When this option is enabled, GCC inserts @code{MEMW} instructions before
15711 @code{volatile} memory references to guarantee sequential consistency.
15712 The default is @option{-mserialize-volatile}.  Use
15713 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
15715 @item -mtext-section-literals
15716 @itemx -mno-text-section-literals
15717 @opindex mtext-section-literals
15718 @opindex mno-text-section-literals
15719 Control the treatment of literal pools.  The default is
15720 @option{-mno-text-section-literals}, which places literals in a separate
15721 section in the output file.  This allows the literal pool to be placed
15722 in a data RAM/ROM, and it also allows the linker to combine literal
15723 pools from separate object files to remove redundant literals and
15724 improve code size.  With @option{-mtext-section-literals}, the literals
15725 are interspersed in the text section in order to keep them as close as
15726 possible to their references.  This may be necessary for large assembly
15727 files.
15729 @item -mtarget-align
15730 @itemx -mno-target-align
15731 @opindex mtarget-align
15732 @opindex mno-target-align
15733 When this option is enabled, GCC instructs the assembler to
15734 automatically align instructions to reduce branch penalties at the
15735 expense of some code density.  The assembler attempts to widen density
15736 instructions to align branch targets and the instructions following call
15737 instructions.  If there are not enough preceding safe density
15738 instructions to align a target, no widening will be performed.  The
15739 default is @option{-mtarget-align}.  These options do not affect the
15740 treatment of auto-aligned instructions like @code{LOOP}, which the
15741 assembler will always align, either by widening density instructions or
15742 by inserting no-op instructions.
15744 @item -mlongcalls
15745 @itemx -mno-longcalls
15746 @opindex mlongcalls
15747 @opindex mno-longcalls
15748 When this option is enabled, GCC instructs the assembler to translate
15749 direct calls to indirect calls unless it can determine that the target
15750 of a direct call is in the range allowed by the call instruction.  This
15751 translation typically occurs for calls to functions in other source
15752 files.  Specifically, the assembler translates a direct @code{CALL}
15753 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
15754 The default is @option{-mno-longcalls}.  This option should be used in
15755 programs where the call target can potentially be out of range.  This
15756 option is implemented in the assembler, not the compiler, so the
15757 assembly code generated by GCC will still show direct call
15758 instructions---look at the disassembled object code to see the actual
15759 instructions.  Note that the assembler will use an indirect call for
15760 every cross-file call, not just those that really will be out of range.
15761 @end table
15763 @node zSeries Options
15764 @subsection zSeries Options
15765 @cindex zSeries options
15767 These are listed under @xref{S/390 and zSeries Options}.
15769 @node Code Gen Options
15770 @section Options for Code Generation Conventions
15771 @cindex code generation conventions
15772 @cindex options, code generation
15773 @cindex run-time options
15775 These machine-independent options control the interface conventions
15776 used in code generation.
15778 Most of them have both positive and negative forms; the negative form
15779 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
15780 one of the forms is listed---the one which is not the default.  You
15781 can figure out the other form by either removing @samp{no-} or adding
15784 @table @gcctabopt
15785 @item -fbounds-check
15786 @opindex fbounds-check
15787 For front-ends that support it, generate additional code to check that
15788 indices used to access arrays are within the declared range.  This is
15789 currently only supported by the Java and Fortran front-ends, where
15790 this option defaults to true and false respectively.
15792 @item -ftrapv
15793 @opindex ftrapv
15794 This option generates traps for signed overflow on addition, subtraction,
15795 multiplication operations.
15797 @item -fwrapv
15798 @opindex fwrapv
15799 This option instructs the compiler to assume that signed arithmetic
15800 overflow of addition, subtraction and multiplication wraps around
15801 using twos-complement representation.  This flag enables some optimizations
15802 and disables others.  This option is enabled by default for the Java
15803 front-end, as required by the Java language specification.
15805 @item -fexceptions
15806 @opindex fexceptions
15807 Enable exception handling.  Generates extra code needed to propagate
15808 exceptions.  For some targets, this implies GCC will generate frame
15809 unwind information for all functions, which can produce significant data
15810 size overhead, although it does not affect execution.  If you do not
15811 specify this option, GCC will enable it by default for languages like
15812 C++ which normally require exception handling, and disable it for
15813 languages like C that do not normally require it.  However, you may need
15814 to enable this option when compiling C code that needs to interoperate
15815 properly with exception handlers written in C++.  You may also wish to
15816 disable this option if you are compiling older C++ programs that don't
15817 use exception handling.
15819 @item -fnon-call-exceptions
15820 @opindex fnon-call-exceptions
15821 Generate code that allows trapping instructions to throw exceptions.
15822 Note that this requires platform-specific runtime support that does
15823 not exist everywhere.  Moreover, it only allows @emph{trapping}
15824 instructions to throw exceptions, i.e.@: memory references or floating
15825 point instructions.  It does not allow exceptions to be thrown from
15826 arbitrary signal handlers such as @code{SIGALRM}.
15828 @item -funwind-tables
15829 @opindex funwind-tables
15830 Similar to @option{-fexceptions}, except that it will just generate any needed
15831 static data, but will not affect the generated code in any other way.
15832 You will normally not enable this option; instead, a language processor
15833 that needs this handling would enable it on your behalf.
15835 @item -fasynchronous-unwind-tables
15836 @opindex fasynchronous-unwind-tables
15837 Generate unwind table in dwarf2 format, if supported by target machine.  The
15838 table is exact at each instruction boundary, so it can be used for stack
15839 unwinding from asynchronous events (such as debugger or garbage collector).
15841 @item -fpcc-struct-return
15842 @opindex fpcc-struct-return
15843 Return ``short'' @code{struct} and @code{union} values in memory like
15844 longer ones, rather than in registers.  This convention is less
15845 efficient, but it has the advantage of allowing intercallability between
15846 GCC-compiled files and files compiled with other compilers, particularly
15847 the Portable C Compiler (pcc).
15849 The precise convention for returning structures in memory depends
15850 on the target configuration macros.
15852 Short structures and unions are those whose size and alignment match
15853 that of some integer type.
15855 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
15856 switch is not binary compatible with code compiled with the
15857 @option{-freg-struct-return} switch.
15858 Use it to conform to a non-default application binary interface.
15860 @item -freg-struct-return
15861 @opindex freg-struct-return
15862 Return @code{struct} and @code{union} values in registers when possible.
15863 This is more efficient for small structures than
15864 @option{-fpcc-struct-return}.
15866 If you specify neither @option{-fpcc-struct-return} nor
15867 @option{-freg-struct-return}, GCC defaults to whichever convention is
15868 standard for the target.  If there is no standard convention, GCC
15869 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
15870 the principal compiler.  In those cases, we can choose the standard, and
15871 we chose the more efficient register return alternative.
15873 @strong{Warning:} code compiled with the @option{-freg-struct-return}
15874 switch is not binary compatible with code compiled with the
15875 @option{-fpcc-struct-return} switch.
15876 Use it to conform to a non-default application binary interface.
15878 @item -fshort-enums
15879 @opindex fshort-enums
15880 Allocate to an @code{enum} type only as many bytes as it needs for the
15881 declared range of possible values.  Specifically, the @code{enum} type
15882 will be equivalent to the smallest integer type which has enough room.
15884 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
15885 code that is not binary compatible with code generated without that switch.
15886 Use it to conform to a non-default application binary interface.
15888 @item -fshort-double
15889 @opindex fshort-double
15890 Use the same size for @code{double} as for @code{float}.
15892 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
15893 code that is not binary compatible with code generated without that switch.
15894 Use it to conform to a non-default application binary interface.
15896 @item -fshort-wchar
15897 @opindex fshort-wchar
15898 Override the underlying type for @samp{wchar_t} to be @samp{short
15899 unsigned int} instead of the default for the target.  This option is
15900 useful for building programs to run under WINE@.
15902 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
15903 code that is not binary compatible with code generated without that switch.
15904 Use it to conform to a non-default application binary interface.
15906 @item -fno-common
15907 @opindex fno-common
15908 In C code, controls the placement of uninitialized global variables.
15909 Unix C compilers have traditionally permitted multiple definitions of
15910 such variables in different compilation units by placing the variables
15911 in a common block.  
15912 This is the behavior specified by @option{-fcommon}, and is the default 
15913 for GCC on most targets.  
15914 On the other hand, this behavior is not required by ISO C, and on some
15915 targets may carry a speed or code size penalty on variable references.
15916 The @option{-fno-common} option specifies that the compiler should place 
15917 uninitialized global variables in the data section of the object file,
15918 rather than generating them as common blocks.
15919 This has the effect that if the same variable is declared 
15920 (without @code{extern}) in two different compilations,
15921 you will get a multiple-definition error when you link them.
15922 In this case, you must compile with @option{-fcommon} instead.  
15923 Compiling with @option{-fno-common} is useful on targets for which 
15924 it provides better performance, or if you wish to verify that the
15925 program will work on other systems which always treat uninitialized
15926 variable declarations this way.
15928 @item -fno-ident
15929 @opindex fno-ident
15930 Ignore the @samp{#ident} directive.
15932 @item -finhibit-size-directive
15933 @opindex finhibit-size-directive
15934 Don't output a @code{.size} assembler directive, or anything else that
15935 would cause trouble if the function is split in the middle, and the
15936 two halves are placed at locations far apart in memory.  This option is
15937 used when compiling @file{crtstuff.c}; you should not need to use it
15938 for anything else.
15940 @item -fverbose-asm
15941 @opindex fverbose-asm
15942 Put extra commentary information in the generated assembly code to
15943 make it more readable.  This option is generally only of use to those
15944 who actually need to read the generated assembly code (perhaps while
15945 debugging the compiler itself).
15947 @option{-fno-verbose-asm}, the default, causes the
15948 extra information to be omitted and is useful when comparing two assembler
15949 files.
15951 @item -frecord-gcc-switches
15952 @opindex frecord-gcc-switches
15953 This switch causes the command line that was used to invoke the
15954 compiler to be recorded into the object file that is being created.
15955 This switch is only implemented on some targets and the exact format
15956 of the recording is target and binary file format dependent, but it
15957 usually takes the form of a section containing ASCII text.  This
15958 switch is related to the @option{-fverbose-asm} switch, but that
15959 switch only records information in the assembler output file as
15960 comments, so it never reaches the object file.
15962 @item -fpic
15963 @opindex fpic
15964 @cindex global offset table
15965 @cindex PIC
15966 Generate position-independent code (PIC) suitable for use in a shared
15967 library, if supported for the target machine.  Such code accesses all
15968 constant addresses through a global offset table (GOT)@.  The dynamic
15969 loader resolves the GOT entries when the program starts (the dynamic
15970 loader is not part of GCC; it is part of the operating system).  If
15971 the GOT size for the linked executable exceeds a machine-specific
15972 maximum size, you get an error message from the linker indicating that
15973 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
15974 instead.  (These maximums are 8k on the SPARC and 32k
15975 on the m68k and RS/6000.  The 386 has no such limit.)
15977 Position-independent code requires special support, and therefore works
15978 only on certain machines.  For the 386, GCC supports PIC for System V
15979 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
15980 position-independent.
15982 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15983 are defined to 1.
15985 @item -fPIC
15986 @opindex fPIC
15987 If supported for the target machine, emit position-independent code,
15988 suitable for dynamic linking and avoiding any limit on the size of the
15989 global offset table.  This option makes a difference on the m68k,
15990 PowerPC and SPARC@.
15992 Position-independent code requires special support, and therefore works
15993 only on certain machines.
15995 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15996 are defined to 2.
15998 @item -fpie
15999 @itemx -fPIE
16000 @opindex fpie
16001 @opindex fPIE
16002 These options are similar to @option{-fpic} and @option{-fPIC}, but
16003 generated position independent code can be only linked into executables.
16004 Usually these options are used when @option{-pie} GCC option will be
16005 used during linking.
16007 @option{-fpie} and @option{-fPIE} both define the macros
16008 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
16009 for @option{-fpie} and 2 for @option{-fPIE}.
16011 @item -fno-jump-tables
16012 @opindex fno-jump-tables
16013 Do not use jump tables for switch statements even where it would be
16014 more efficient than other code generation strategies.  This option is
16015 of use in conjunction with @option{-fpic} or @option{-fPIC} for
16016 building code which forms part of a dynamic linker and cannot
16017 reference the address of a jump table.  On some targets, jump tables
16018 do not require a GOT and this option is not needed.
16020 @item -ffixed-@var{reg}
16021 @opindex ffixed
16022 Treat the register named @var{reg} as a fixed register; generated code
16023 should never refer to it (except perhaps as a stack pointer, frame
16024 pointer or in some other fixed role).
16026 @var{reg} must be the name of a register.  The register names accepted
16027 are machine-specific and are defined in the @code{REGISTER_NAMES}
16028 macro in the machine description macro file.
16030 This flag does not have a negative form, because it specifies a
16031 three-way choice.
16033 @item -fcall-used-@var{reg}
16034 @opindex fcall-used
16035 Treat the register named @var{reg} as an allocable register that is
16036 clobbered by function calls.  It may be allocated for temporaries or
16037 variables that do not live across a call.  Functions compiled this way
16038 will not save and restore the register @var{reg}.
16040 It is an error to used this flag with the frame pointer or stack pointer.
16041 Use of this flag for other registers that have fixed pervasive roles in
16042 the machine's execution model will produce disastrous results.
16044 This flag does not have a negative form, because it specifies a
16045 three-way choice.
16047 @item -fcall-saved-@var{reg}
16048 @opindex fcall-saved
16049 Treat the register named @var{reg} as an allocable register saved by
16050 functions.  It may be allocated even for temporaries or variables that
16051 live across a call.  Functions compiled this way will save and restore
16052 the register @var{reg} if they use it.
16054 It is an error to used this flag with the frame pointer or stack pointer.
16055 Use of this flag for other registers that have fixed pervasive roles in
16056 the machine's execution model will produce disastrous results.
16058 A different sort of disaster will result from the use of this flag for
16059 a register in which function values may be returned.
16061 This flag does not have a negative form, because it specifies a
16062 three-way choice.
16064 @item -fpack-struct[=@var{n}]
16065 @opindex fpack-struct
16066 Without a value specified, pack all structure members together without
16067 holes.  When a value is specified (which must be a small power of two), pack
16068 structure members according to this value, representing the maximum
16069 alignment (that is, objects with default alignment requirements larger than
16070 this will be output potentially unaligned at the next fitting location.
16072 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
16073 code that is not binary compatible with code generated without that switch.
16074 Additionally, it makes the code suboptimal.
16075 Use it to conform to a non-default application binary interface.
16077 @item -finstrument-functions
16078 @opindex finstrument-functions
16079 Generate instrumentation calls for entry and exit to functions.  Just
16080 after function entry and just before function exit, the following
16081 profiling functions will be called with the address of the current
16082 function and its call site.  (On some platforms,
16083 @code{__builtin_return_address} does not work beyond the current
16084 function, so the call site information may not be available to the
16085 profiling functions otherwise.)
16087 @smallexample
16088 void __cyg_profile_func_enter (void *this_fn,
16089                                void *call_site);
16090 void __cyg_profile_func_exit  (void *this_fn,
16091                                void *call_site);
16092 @end smallexample
16094 The first argument is the address of the start of the current function,
16095 which may be looked up exactly in the symbol table.
16097 This instrumentation is also done for functions expanded inline in other
16098 functions.  The profiling calls will indicate where, conceptually, the
16099 inline function is entered and exited.  This means that addressable
16100 versions of such functions must be available.  If all your uses of a
16101 function are expanded inline, this may mean an additional expansion of
16102 code size.  If you use @samp{extern inline} in your C code, an
16103 addressable version of such functions must be provided.  (This is
16104 normally the case anyways, but if you get lucky and the optimizer always
16105 expands the functions inline, you might have gotten away without
16106 providing static copies.)
16108 A function may be given the attribute @code{no_instrument_function}, in
16109 which case this instrumentation will not be done.  This can be used, for
16110 example, for the profiling functions listed above, high-priority
16111 interrupt routines, and any functions from which the profiling functions
16112 cannot safely be called (perhaps signal handlers, if the profiling
16113 routines generate output or allocate memory).
16115 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
16116 @opindex finstrument-functions-exclude-file-list
16118 Set the list of functions that are excluded from instrumentation (see
16119 the description of @code{-finstrument-functions}).  If the file that
16120 contains a function definition matches with one of @var{file}, then
16121 that function is not instrumented.  The match is done on substrings:
16122 if the @var{file} parameter is a substring of the file name, it is
16123 considered to be a match.
16125 For example,
16126 @code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys}
16127 will exclude any inline function defined in files whose pathnames
16128 contain @code{/bits/stl} or @code{include/sys}.
16130 If, for some reason, you want to include letter @code{','} in one of
16131 @var{sym}, write @code{'\,'}. For example,
16132 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
16133 (note the single quote surrounding the option).
16135 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
16136 @opindex finstrument-functions-exclude-function-list
16138 This is similar to @code{-finstrument-functions-exclude-file-list},
16139 but this option sets the list of function names to be excluded from
16140 instrumentation.  The function name to be matched is its user-visible
16141 name, such as @code{vector<int> blah(const vector<int> &)}, not the
16142 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
16143 match is done on substrings: if the @var{sym} parameter is a substring
16144 of the function name, it is considered to be a match.  For C99 and C++
16145 extended identifiers, the function name must be given in UTF-8, not
16146 using universal character names.
16148 @item -fstack-check
16149 @opindex fstack-check
16150 Generate code to verify that you do not go beyond the boundary of the
16151 stack.  You should specify this flag if you are running in an
16152 environment with multiple threads, but only rarely need to specify it in
16153 a single-threaded environment since stack overflow is automatically
16154 detected on nearly all systems if there is only one stack.
16156 Note that this switch does not actually cause checking to be done; the
16157 operating system or the language runtime must do that.  The switch causes
16158 generation of code to ensure that they see the stack being extended.
16160 You can additionally specify a string parameter: @code{no} means no
16161 checking, @code{generic} means force the use of old-style checking,
16162 @code{specific} means use the best checking method and is equivalent
16163 to bare @option{-fstack-check}.
16165 Old-style checking is a generic mechanism that requires no specific
16166 target support in the compiler but comes with the following drawbacks:
16168 @enumerate
16169 @item
16170 Modified allocation strategy for large objects: they will always be
16171 allocated dynamically if their size exceeds a fixed threshold.
16173 @item
16174 Fixed limit on the size of the static frame of functions: when it is
16175 topped by a particular function, stack checking is not reliable and
16176 a warning is issued by the compiler.
16178 @item
16179 Inefficiency: because of both the modified allocation strategy and the
16180 generic implementation, the performances of the code are hampered.
16181 @end enumerate
16183 Note that old-style stack checking is also the fallback method for
16184 @code{specific} if no target support has been added in the compiler.
16186 @item -fstack-limit-register=@var{reg}
16187 @itemx -fstack-limit-symbol=@var{sym}
16188 @itemx -fno-stack-limit
16189 @opindex fstack-limit-register
16190 @opindex fstack-limit-symbol
16191 @opindex fno-stack-limit
16192 Generate code to ensure that the stack does not grow beyond a certain value,
16193 either the value of a register or the address of a symbol.  If the stack
16194 would grow beyond the value, a signal is raised.  For most targets,
16195 the signal is raised before the stack overruns the boundary, so
16196 it is possible to catch the signal without taking special precautions.
16198 For instance, if the stack starts at absolute address @samp{0x80000000}
16199 and grows downwards, you can use the flags
16200 @option{-fstack-limit-symbol=__stack_limit} and
16201 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
16202 of 128KB@.  Note that this may only work with the GNU linker.
16204 @cindex aliasing of parameters
16205 @cindex parameters, aliased
16206 @item -fargument-alias
16207 @itemx -fargument-noalias
16208 @itemx -fargument-noalias-global
16209 @itemx -fargument-noalias-anything
16210 @opindex fargument-alias
16211 @opindex fargument-noalias
16212 @opindex fargument-noalias-global
16213 @opindex fargument-noalias-anything
16214 Specify the possible relationships among parameters and between
16215 parameters and global data.
16217 @option{-fargument-alias} specifies that arguments (parameters) may
16218 alias each other and may alias global storage.@*
16219 @option{-fargument-noalias} specifies that arguments do not alias
16220 each other, but may alias global storage.@*
16221 @option{-fargument-noalias-global} specifies that arguments do not
16222 alias each other and do not alias global storage.
16223 @option{-fargument-noalias-anything} specifies that arguments do not
16224 alias any other storage.
16226 Each language will automatically use whatever option is required by
16227 the language standard.  You should not need to use these options yourself.
16229 @item -fleading-underscore
16230 @opindex fleading-underscore
16231 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
16232 change the way C symbols are represented in the object file.  One use
16233 is to help link with legacy assembly code.
16235 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
16236 generate code that is not binary compatible with code generated without that
16237 switch.  Use it to conform to a non-default application binary interface.
16238 Not all targets provide complete support for this switch.
16240 @item -ftls-model=@var{model}
16241 @opindex ftls-model
16242 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
16243 The @var{model} argument should be one of @code{global-dynamic},
16244 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
16246 The default without @option{-fpic} is @code{initial-exec}; with
16247 @option{-fpic} the default is @code{global-dynamic}.
16249 @item -fvisibility=@var{default|internal|hidden|protected}
16250 @opindex fvisibility
16251 Set the default ELF image symbol visibility to the specified option---all
16252 symbols will be marked with this unless overridden within the code.
16253 Using this feature can very substantially improve linking and
16254 load times of shared object libraries, produce more optimized
16255 code, provide near-perfect API export and prevent symbol clashes.
16256 It is @strong{strongly} recommended that you use this in any shared objects
16257 you distribute.
16259 Despite the nomenclature, @code{default} always means public ie;
16260 available to be linked against from outside the shared object.
16261 @code{protected} and @code{internal} are pretty useless in real-world
16262 usage so the only other commonly used option will be @code{hidden}.
16263 The default if @option{-fvisibility} isn't specified is
16264 @code{default}, i.e., make every
16265 symbol public---this causes the same behavior as previous versions of
16266 GCC@.
16268 A good explanation of the benefits offered by ensuring ELF
16269 symbols have the correct visibility is given by ``How To Write
16270 Shared Libraries'' by Ulrich Drepper (which can be found at
16271 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
16272 solution made possible by this option to marking things hidden when
16273 the default is public is to make the default hidden and mark things
16274 public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
16275 and @code{__attribute__ ((visibility("default")))} instead of
16276 @code{__declspec(dllexport)} you get almost identical semantics with
16277 identical syntax.  This is a great boon to those working with
16278 cross-platform projects.
16280 For those adding visibility support to existing code, you may find
16281 @samp{#pragma GCC visibility} of use.  This works by you enclosing
16282 the declarations you wish to set visibility for with (for example)
16283 @samp{#pragma GCC visibility push(hidden)} and
16284 @samp{#pragma GCC visibility pop}.
16285 Bear in mind that symbol visibility should be viewed @strong{as
16286 part of the API interface contract} and thus all new code should
16287 always specify visibility when it is not the default ie; declarations
16288 only for use within the local DSO should @strong{always} be marked explicitly
16289 as hidden as so to avoid PLT indirection overheads---making this
16290 abundantly clear also aids readability and self-documentation of the code.
16291 Note that due to ISO C++ specification requirements, operator new and
16292 operator delete must always be of default visibility.
16294 Be aware that headers from outside your project, in particular system
16295 headers and headers from any other library you use, may not be
16296 expecting to be compiled with visibility other than the default.  You
16297 may need to explicitly say @samp{#pragma GCC visibility push(default)}
16298 before including any such headers.
16300 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
16301 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
16302 no modifications.  However, this means that calls to @samp{extern}
16303 functions with no explicit visibility will use the PLT, so it is more
16304 effective to use @samp{__attribute ((visibility))} and/or
16305 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
16306 declarations should be treated as hidden.
16308 Note that @samp{-fvisibility} does affect C++ vague linkage
16309 entities. This means that, for instance, an exception class that will
16310 be thrown between DSOs must be explicitly marked with default
16311 visibility so that the @samp{type_info} nodes will be unified between
16312 the DSOs.
16314 An overview of these techniques, their benefits and how to use them
16315 is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
16317 @end table
16319 @c man end
16321 @node Environment Variables
16322 @section Environment Variables Affecting GCC
16323 @cindex environment variables
16325 @c man begin ENVIRONMENT
16326 This section describes several environment variables that affect how GCC
16327 operates.  Some of them work by specifying directories or prefixes to use
16328 when searching for various kinds of files.  Some are used to specify other
16329 aspects of the compilation environment.
16331 Note that you can also specify places to search using options such as
16332 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
16333 take precedence over places specified using environment variables, which
16334 in turn take precedence over those specified by the configuration of GCC@.
16335 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
16336 GNU Compiler Collection (GCC) Internals}.
16338 @table @env
16339 @item LANG
16340 @itemx LC_CTYPE
16341 @c @itemx LC_COLLATE
16342 @itemx LC_MESSAGES
16343 @c @itemx LC_MONETARY
16344 @c @itemx LC_NUMERIC
16345 @c @itemx LC_TIME
16346 @itemx LC_ALL
16347 @findex LANG
16348 @findex LC_CTYPE
16349 @c @findex LC_COLLATE
16350 @findex LC_MESSAGES
16351 @c @findex LC_MONETARY
16352 @c @findex LC_NUMERIC
16353 @c @findex LC_TIME
16354 @findex LC_ALL
16355 @cindex locale
16356 These environment variables control the way that GCC uses
16357 localization information that allow GCC to work with different
16358 national conventions.  GCC inspects the locale categories
16359 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
16360 so.  These locale categories can be set to any value supported by your
16361 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
16362 Kingdom encoded in UTF-8.
16364 The @env{LC_CTYPE} environment variable specifies character
16365 classification.  GCC uses it to determine the character boundaries in
16366 a string; this is needed for some multibyte encodings that contain quote
16367 and escape characters that would otherwise be interpreted as a string
16368 end or escape.
16370 The @env{LC_MESSAGES} environment variable specifies the language to
16371 use in diagnostic messages.
16373 If the @env{LC_ALL} environment variable is set, it overrides the value
16374 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
16375 and @env{LC_MESSAGES} default to the value of the @env{LANG}
16376 environment variable.  If none of these variables are set, GCC
16377 defaults to traditional C English behavior.
16379 @item TMPDIR
16380 @findex TMPDIR
16381 If @env{TMPDIR} is set, it specifies the directory to use for temporary
16382 files.  GCC uses temporary files to hold the output of one stage of
16383 compilation which is to be used as input to the next stage: for example,
16384 the output of the preprocessor, which is the input to the compiler
16385 proper.
16387 @item GCC_EXEC_PREFIX
16388 @findex GCC_EXEC_PREFIX
16389 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
16390 names of the subprograms executed by the compiler.  No slash is added
16391 when this prefix is combined with the name of a subprogram, but you can
16392 specify a prefix that ends with a slash if you wish.
16394 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
16395 an appropriate prefix to use based on the pathname it was invoked with.
16397 If GCC cannot find the subprogram using the specified prefix, it
16398 tries looking in the usual places for the subprogram.
16400 The default value of @env{GCC_EXEC_PREFIX} is
16401 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
16402 the installed compiler. In many cases @var{prefix} is the value
16403 of @code{prefix} when you ran the @file{configure} script.
16405 Other prefixes specified with @option{-B} take precedence over this prefix.
16407 This prefix is also used for finding files such as @file{crt0.o} that are
16408 used for linking.
16410 In addition, the prefix is used in an unusual way in finding the
16411 directories to search for header files.  For each of the standard
16412 directories whose name normally begins with @samp{/usr/local/lib/gcc}
16413 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
16414 replacing that beginning with the specified prefix to produce an
16415 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
16416 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
16417 These alternate directories are searched first; the standard directories
16418 come next. If a standard directory begins with the configured
16419 @var{prefix} then the value of @var{prefix} is replaced by
16420 @env{GCC_EXEC_PREFIX} when looking for header files.
16422 @item COMPILER_PATH
16423 @findex COMPILER_PATH
16424 The value of @env{COMPILER_PATH} is a colon-separated list of
16425 directories, much like @env{PATH}.  GCC tries the directories thus
16426 specified when searching for subprograms, if it can't find the
16427 subprograms using @env{GCC_EXEC_PREFIX}.
16429 @item LIBRARY_PATH
16430 @findex LIBRARY_PATH
16431 The value of @env{LIBRARY_PATH} is a colon-separated list of
16432 directories, much like @env{PATH}.  When configured as a native compiler,
16433 GCC tries the directories thus specified when searching for special
16434 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
16435 using GCC also uses these directories when searching for ordinary
16436 libraries for the @option{-l} option (but directories specified with
16437 @option{-L} come first).
16439 @item LANG
16440 @findex LANG
16441 @cindex locale definition
16442 This variable is used to pass locale information to the compiler.  One way in
16443 which this information is used is to determine the character set to be used
16444 when character literals, string literals and comments are parsed in C and C++.
16445 When the compiler is configured to allow multibyte characters,
16446 the following values for @env{LANG} are recognized:
16448 @table @samp
16449 @item C-JIS
16450 Recognize JIS characters.
16451 @item C-SJIS
16452 Recognize SJIS characters.
16453 @item C-EUCJP
16454 Recognize EUCJP characters.
16455 @end table
16457 If @env{LANG} is not defined, or if it has some other value, then the
16458 compiler will use mblen and mbtowc as defined by the default locale to
16459 recognize and translate multibyte characters.
16460 @end table
16462 @noindent
16463 Some additional environments variables affect the behavior of the
16464 preprocessor.
16466 @include cppenv.texi
16468 @c man end
16470 @node Precompiled Headers
16471 @section Using Precompiled Headers
16472 @cindex precompiled headers
16473 @cindex speed of compilation
16475 Often large projects have many header files that are included in every
16476 source file.  The time the compiler takes to process these header files
16477 over and over again can account for nearly all of the time required to
16478 build the project.  To make builds faster, GCC allows users to
16479 `precompile' a header file; then, if builds can use the precompiled
16480 header file they will be much faster.
16482 To create a precompiled header file, simply compile it as you would any
16483 other file, if necessary using the @option{-x} option to make the driver
16484 treat it as a C or C++ header file.  You will probably want to use a
16485 tool like @command{make} to keep the precompiled header up-to-date when
16486 the headers it contains change.
16488 A precompiled header file will be searched for when @code{#include} is
16489 seen in the compilation.  As it searches for the included file
16490 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
16491 compiler looks for a precompiled header in each directory just before it
16492 looks for the include file in that directory.  The name searched for is
16493 the name specified in the @code{#include} with @samp{.gch} appended.  If
16494 the precompiled header file can't be used, it is ignored.
16496 For instance, if you have @code{#include "all.h"}, and you have
16497 @file{all.h.gch} in the same directory as @file{all.h}, then the
16498 precompiled header file will be used if possible, and the original
16499 header will be used otherwise.
16501 Alternatively, you might decide to put the precompiled header file in a
16502 directory and use @option{-I} to ensure that directory is searched
16503 before (or instead of) the directory containing the original header.
16504 Then, if you want to check that the precompiled header file is always
16505 used, you can put a file of the same name as the original header in this
16506 directory containing an @code{#error} command.
16508 This also works with @option{-include}.  So yet another way to use
16509 precompiled headers, good for projects not designed with precompiled
16510 header files in mind, is to simply take most of the header files used by
16511 a project, include them from another header file, precompile that header
16512 file, and @option{-include} the precompiled header.  If the header files
16513 have guards against multiple inclusion, they will be skipped because
16514 they've already been included (in the precompiled header).
16516 If you need to precompile the same header file for different
16517 languages, targets, or compiler options, you can instead make a
16518 @emph{directory} named like @file{all.h.gch}, and put each precompiled
16519 header in the directory, perhaps using @option{-o}.  It doesn't matter
16520 what you call the files in the directory, every precompiled header in
16521 the directory will be considered.  The first precompiled header
16522 encountered in the directory that is valid for this compilation will
16523 be used; they're searched in no particular order.
16525 There are many other possibilities, limited only by your imagination,
16526 good sense, and the constraints of your build system.
16528 A precompiled header file can be used only when these conditions apply:
16530 @itemize
16531 @item
16532 Only one precompiled header can be used in a particular compilation.
16534 @item
16535 A precompiled header can't be used once the first C token is seen.  You
16536 can have preprocessor directives before a precompiled header; you can
16537 even include a precompiled header from inside another header, so long as
16538 there are no C tokens before the @code{#include}.
16540 @item
16541 The precompiled header file must be produced for the same language as
16542 the current compilation.  You can't use a C precompiled header for a C++
16543 compilation.
16545 @item
16546 The precompiled header file must have been produced by the same compiler
16547 binary as the current compilation is using.
16549 @item
16550 Any macros defined before the precompiled header is included must
16551 either be defined in the same way as when the precompiled header was
16552 generated, or must not affect the precompiled header, which usually
16553 means that they don't appear in the precompiled header at all.
16555 The @option{-D} option is one way to define a macro before a
16556 precompiled header is included; using a @code{#define} can also do it.
16557 There are also some options that define macros implicitly, like
16558 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
16559 defined this way.
16561 @item If debugging information is output when using the precompiled
16562 header, using @option{-g} or similar, the same kind of debugging information
16563 must have been output when building the precompiled header.  However,
16564 a precompiled header built using @option{-g} can be used in a compilation
16565 when no debugging information is being output.
16567 @item The same @option{-m} options must generally be used when building
16568 and using the precompiled header.  @xref{Submodel Options},
16569 for any cases where this rule is relaxed.
16571 @item Each of the following options must be the same when building and using
16572 the precompiled header:
16574 @gccoptlist{-fexceptions}
16576 @item
16577 Some other command-line options starting with @option{-f},
16578 @option{-p}, or @option{-O} must be defined in the same way as when
16579 the precompiled header was generated.  At present, it's not clear
16580 which options are safe to change and which are not; the safest choice
16581 is to use exactly the same options when generating and using the
16582 precompiled header.  The following are known to be safe:
16584 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
16585 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
16586 -fsched-verbose=<number>  -fschedule-insns  -fvisibility= @gol
16587 -pedantic-errors}
16589 @end itemize
16591 For all of these except the last, the compiler will automatically
16592 ignore the precompiled header if the conditions aren't met.  If you
16593 find an option combination that doesn't work and doesn't cause the
16594 precompiled header to be ignored, please consider filing a bug report,
16595 see @ref{Bugs}.
16597 If you do use differing options when generating and using the
16598 precompiled header, the actual behavior will be a mixture of the
16599 behavior for the options.  For instance, if you use @option{-g} to
16600 generate the precompiled header but not when using it, you may or may
16601 not get debugging information for routines in the precompiled header.