Merge from trunk rev 172662.
[official-gcc.git] / gcc / doc / invoke.texi
blobab420b01fb5caff21100ab4074d2a334d85c0288
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, 2010, 2011
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, 2010
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.3 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}  -no-canonical-prefixes  @gol
165 -pipe  -pass-exit-codes  @gol
166 -x @var{language}  -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  @gol
167 --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg}  @gol
168 -fdump-ada-spec@r{[}-slim@r{]} -fdump-go-spec=@var{file}}
170 @item C Language Options
171 @xref{C Dialect Options,,Options Controlling C Dialect}.
172 @gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
173 -aux-info @var{filename} @gol
174 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
175 -fhosted  -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
176 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
177 -fallow-single-precision  -fcond-mismatch -flax-vector-conversions @gol
178 -fsigned-bitfields  -fsigned-char @gol
179 -funsigned-bitfields  -funsigned-char}
181 @item C++ Language Options
182 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
183 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
184 -fconserve-space  -fconstexpr-depth=@var{n}  -ffriend-injection @gol
185 -fno-elide-constructors @gol
186 -fno-enforce-eh-specs @gol
187 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
188 -fno-implicit-templates @gol
189 -fno-implicit-inline-templates @gol
190 -fno-implement-inlines  -fms-extensions @gol
191 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
192 -fno-optional-diags  -fpermissive @gol
193 -fno-pretty-templates @gol
194 -frepo  -fno-rtti  -fstats  -ftemplate-depth=@var{n} @gol
195 -fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
196 -fno-default-inline  -fvisibility-inlines-hidden @gol
197 -fvisibility-ms-compat @gol
198 -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
199 -Wnoexcept -Wnon-virtual-dtor  -Wreorder @gol
200 -Weffc++  -Wstrict-null-sentinel @gol
201 -Wno-non-template-friend  -Wold-style-cast @gol
202 -Woverloaded-virtual  -Wno-pmf-conversions @gol
203 -Wsign-promo}
205 @item Objective-C and Objective-C++ Language Options
206 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
207 Objective-C and Objective-C++ Dialects}.
208 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
209 -fgnu-runtime  -fnext-runtime @gol
210 -fno-nil-receivers @gol
211 -fobjc-abi-version=@var{n} @gol
212 -fobjc-call-cxx-cdtors @gol
213 -fobjc-direct-dispatch @gol
214 -fobjc-exceptions @gol
215 -fobjc-gc @gol
216 -fobjc-nilcheck @gol
217 -fobjc-std=objc1 @gol
218 -freplace-objc-classes @gol
219 -fzero-link @gol
220 -gen-decls @gol
221 -Wassign-intercept @gol
222 -Wno-protocol  -Wselector @gol
223 -Wstrict-selector-match @gol
224 -Wundeclared-selector}
226 @item Language Independent Options
227 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
228 @gccoptlist{-fmessage-length=@var{n}  @gol
229 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
230 -fno-diagnostics-show-option}
232 @item Warning Options
233 @xref{Warning Options,,Options to Request or Suppress Warnings}.
234 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -pedantic @gol
235 -pedantic-errors @gol
236 -w  -Wextra  -Wall  -Waddress  -Waggregate-return  -Warray-bounds @gol
237 -Wno-attributes -Wno-builtin-macro-redefined @gol
238 -Wc++-compat -Wc++0x-compat -Wcast-align  -Wcast-qual  @gol
239 -Wchar-subscripts -Wclobbered  -Wcomment @gol
240 -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
241 -Wno-deprecated-declarations -Wdisabled-optimization  @gol
242 -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
243 -Wno-endif-labels -Werror  -Werror=* @gol
244 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
245 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
246 -Wformat-security  -Wformat-y2k @gol
247 -Wframe-larger-than=@var{len} -Wjump-misses-init -Wignored-qualifiers @gol
248 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
249 -Winit-self  -Winline @gol
250 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
251 -Winvalid-pch -Wlarger-than=@var{len}  -Wunsafe-loop-optimizations @gol
252 -Wlogical-op -Wlong-long @gol
253 -Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
254 -Wmissing-format-attribute  -Wmissing-include-dirs @gol
255 -Wno-mudflap @gol
256 -Wno-multichar  -Wnonnull  -Wno-overflow @gol
257 -Woverlength-strings  -Wpacked  -Wpacked-bitfield-compat  -Wpadded @gol
258 -Wparentheses  -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
259 -Wpointer-arith  -Wno-pointer-to-int-cast @gol
260 -Wredundant-decls @gol
261 -Wreturn-type  -Wsequence-point  -Wshadow @gol
262 -Wsign-compare  -Wsign-conversion  -Wstack-protector @gol
263 -Wstrict-aliasing -Wstrict-aliasing=n @gol
264 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
265 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
266 -Wswitch  -Wswitch-default  -Wswitch-enum -Wsync-nand @gol
267 -Wsystem-headers  -Wtrampolines  -Wtrigraphs  -Wtype-limits  -Wundef @gol
268 -Wuninitialized  -Wunknown-pragmas  -Wno-pragmas @gol
269 -Wunsuffixed-float-constants  -Wunused  -Wunused-function @gol
270 -Wunused-label  -Wunused-parameter -Wno-unused-result -Wunused-value @gol
271 -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable @gol
272 -Wvariadic-macros -Wvla -Wvolatile-register-var  -Wwrite-strings}
274 @item C and Objective-C-only Warning Options
275 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
276 -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
277 -Wold-style-declaration  -Wold-style-definition @gol
278 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
279 -Wdeclaration-after-statement -Wpointer-sign}
281 @item Debugging Options
282 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
283 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
284 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
285 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
286 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
287 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
288 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
289 -fdump-statistics @gol
290 -fdump-tree-all @gol
291 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
292 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
293 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
294 -fdump-tree-ch @gol
295 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
296 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
297 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
298 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
299 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
300 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
301 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
302 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
303 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
304 -fdump-tree-nrv -fdump-tree-vect @gol
305 -fdump-tree-sink @gol
306 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
307 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
308 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
309 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
310 -ftree-vectorizer-verbose=@var{n} @gol
311 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
312 -fdump-final-insns=@var{file} @gol
313 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
314 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
315 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
316 -fdebug-types-section @gol
317 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
318 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
319 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
320 -fstack-usage  -ftest-coverage  -ftime-report -fvar-tracking @gol
321 -fvar-tracking-assignments  -fvar-tracking-assignments-toggle @gol
322 -g  -g@var{level}  -gtoggle  -gcoff  -gdwarf-@var{version} @gol
323 -ggdb  -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
324 -gvms  -gxcoff  -gxcoff+ @gol
325 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
326 -fdebug-prefix-map=@var{old}=@var{new} @gol
327 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
328 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
329 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
330 -print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
331 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
332 -print-sysroot -print-sysroot-headers-suffix @gol
333 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
335 @item Optimization Options
336 @xref{Optimize Options,,Options that Control Optimization}.
337 @gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
338 -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
339 -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
340 -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
341 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
342 -fcompare-elim -fcprop-registers -fcrossjumping @gol
343 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
344 -fcx-limited-range @gol
345 -fdata-sections -fdce -fdce -fdelayed-branch @gol
346 -fdelete-null-pointer-checks -fdse -fdevirtualize -fdse @gol
347 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffast-math @gol
348 -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
349 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
350 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
351 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
352 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
353 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
354 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
355 -fira-algorithm=@var{algorithm} @gol
356 -fira-region=@var{region} @gol
357 -fira-loop-pressure -fno-ira-share-save-slots @gol
358 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
359 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
360 -floop-block -floop-flatten -floop-interchange -floop-strip-mine @gol
361 -floop-parallelize-all -flto -flto-compression-level @gol
362 -flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
363 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
364 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
365 -fno-default-inline @gol
366 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
367 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
368 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
369 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
370 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
371 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
372 -fprefetch-loop-arrays @gol
373 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
374 -fprofile-generate=@var{path} @gol
375 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
376 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
377 -freorder-blocks-and-partition -freorder-functions @gol
378 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
379 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
380 -fsched-spec-load -fsched-spec-load-dangerous @gol
381 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
382 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
383 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
384 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
385 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
386 -fselective-scheduling -fselective-scheduling2 @gol
387 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
388 -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
389 -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
390 -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
391 -ftree-bit-ccp @gol
392 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
393 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
394 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
395 -ftree-loop-if-convert-stores -ftree-loop-im @gol
396 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
397 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
398 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
399 -ftree-sink -ftree-sra -ftree-switch-conversion @gol
400 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
401 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
402 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
403 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
404 -fwhole-program -fwpa -fuse-linker-plugin @gol
405 --param @var{name}=@var{value}
406 -O  -O0  -O1  -O2  -O3  -Os -Ofast}
408 @item Preprocessor Options
409 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
410 @gccoptlist{-A@var{question}=@var{answer} @gol
411 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
412 -C  -dD  -dI  -dM  -dN @gol
413 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
414 -idirafter @var{dir} @gol
415 -include @var{file}  -imacros @var{file} @gol
416 -iprefix @var{file}  -iwithprefix @var{dir} @gol
417 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
418 -imultilib @var{dir} -isysroot @var{dir} @gol
419 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
420 -P  -fworking-directory  -remap @gol
421 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
422 -Xpreprocessor @var{option}}
424 @item Assembler Option
425 @xref{Assembler Options,,Passing Options to the Assembler}.
426 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
428 @item Linker Options
429 @xref{Link Options,,Options for Linking}.
430 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
431 -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
432 -s  -static  -static-libgcc  -static-libstdc++ -shared  @gol
433 -shared-libgcc  -symbolic @gol
434 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
435 -u @var{symbol}}
437 @item Directory Options
438 @xref{Directory Options,,Options for Directory Search}.
439 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
440 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
441 --sysroot=@var{dir}}
443 @item Machine Dependent Options
444 @xref{Submodel Options,,Hardware Models and Configurations}.
445 @c This list is ordered alphanumerically by subsection name.
446 @c Try and put the significant identifier (CPU or system) first,
447 @c so users have a clue at guessing where the ones they want will be.
449 @emph{ARM Options}
450 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
451 -mabi=@var{name} @gol
452 -mapcs-stack-check  -mno-apcs-stack-check @gol
453 -mapcs-float  -mno-apcs-float @gol
454 -mapcs-reentrant  -mno-apcs-reentrant @gol
455 -msched-prolog  -mno-sched-prolog @gol
456 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
457 -mfloat-abi=@var{name}  -mfpe @gol
458 -mfp16-format=@var{name}
459 -mthumb-interwork  -mno-thumb-interwork @gol
460 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
461 -mstructure-size-boundary=@var{n} @gol
462 -mabort-on-noreturn @gol
463 -mlong-calls  -mno-long-calls @gol
464 -msingle-pic-base  -mno-single-pic-base @gol
465 -mpic-register=@var{reg} @gol
466 -mnop-fun-dllimport @gol
467 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
468 -mpoke-function-name @gol
469 -mthumb  -marm @gol
470 -mtpcs-frame  -mtpcs-leaf-frame @gol
471 -mcaller-super-interworking  -mcallee-super-interworking @gol
472 -mtp=@var{name} @gol
473 -mword-relocations @gol
474 -mfix-cortex-m3-ldrd}
476 @emph{AVR Options}
477 @gccoptlist{-mmcu=@var{mcu}  -mno-interrupts @gol
478 -mcall-prologues  -mtiny-stack  -mint8}
480 @emph{Blackfin Options}
481 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
482 -msim -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
483 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
484 -mlow-64k -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
485 -mno-id-shared-library  -mshared-library-id=@var{n} @gol
486 -mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
487 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
488 -mfast-fp -minline-plt -mmulticore  -mcorea  -mcoreb  -msdram @gol
489 -micplb}
491 @emph{CRIS Options}
492 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
493 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
494 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
495 -mstack-align  -mdata-align  -mconst-align @gol
496 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
497 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
498 -mmul-bug-workaround  -mno-mul-bug-workaround}
500 @emph{Darwin Options}
501 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
502 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
503 -client_name  -compatibility_version  -current_version @gol
504 -dead_strip @gol
505 -dependency-file  -dylib_file  -dylinker_install_name @gol
506 -dynamic  -dynamiclib  -exported_symbols_list @gol
507 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
508 -force_flat_namespace  -headerpad_max_install_names @gol
509 -iframework @gol
510 -image_base  -init  -install_name  -keep_private_externs @gol
511 -multi_module  -multiply_defined  -multiply_defined_unused @gol
512 -noall_load   -no_dead_strip_inits_and_terms @gol
513 -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
514 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
515 -private_bundle  -read_only_relocs  -sectalign @gol
516 -sectobjectsymbols  -whyload  -seg1addr @gol
517 -sectcreate  -sectobjectsymbols  -sectorder @gol
518 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
519 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
520 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
521 -single_module  -static  -sub_library  -sub_umbrella @gol
522 -twolevel_namespace  -umbrella  -undefined @gol
523 -unexported_symbols_list  -weak_reference_mismatches @gol
524 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
525 -mkernel -mone-byte-bool}
527 @emph{DEC Alpha Options}
528 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
529 -mieee  -mieee-with-inexact  -mieee-conformant @gol
530 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
531 -mtrap-precision=@var{mode}  -mbuild-constants @gol
532 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
533 -mbwx  -mmax  -mfix  -mcix @gol
534 -mfloat-vax  -mfloat-ieee @gol
535 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
536 -msmall-text  -mlarge-text @gol
537 -mmemory-latency=@var{time}}
539 @emph{DEC Alpha/VMS Options}
540 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
542 @emph{FR30 Options}
543 @gccoptlist{-msmall-model -mno-lsim}
545 @emph{FRV Options}
546 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
547 -mhard-float  -msoft-float @gol
548 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
549 -mdouble  -mno-double @gol
550 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
551 -mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
552 -mlinked-fp  -mlong-calls  -malign-labels @gol
553 -mlibrary-pic  -macc-4  -macc-8 @gol
554 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
555 -moptimize-membar -mno-optimize-membar @gol
556 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
557 -mvliw-branch  -mno-vliw-branch @gol
558 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
559 -mno-nested-cond-exec  -mtomcat-stats @gol
560 -mTLS -mtls @gol
561 -mcpu=@var{cpu}}
563 @emph{GNU/Linux Options}
564 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
565 -tno-android-cc -tno-android-ld}
567 @emph{H8/300 Options}
568 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
570 @emph{HPPA Options}
571 @gccoptlist{-march=@var{architecture-type} @gol
572 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
573 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
574 -mfixed-range=@var{register-range} @gol
575 -mjump-in-delay -mlinker-opt -mlong-calls @gol
576 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
577 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
578 -mno-jump-in-delay  -mno-long-load-store @gol
579 -mno-portable-runtime  -mno-soft-float @gol
580 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
581 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
582 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
583 -munix=@var{unix-std}  -nolibdld  -static  -threads}
585 @emph{i386 and x86-64 Options}
586 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
587 -mfpmath=@var{unit} @gol
588 -masm=@var{dialect}  -mno-fancy-math-387 @gol
589 -mno-fp-ret-in-387  -msoft-float @gol
590 -mno-wide-multiply  -mrtd  -malign-double @gol
591 -mpreferred-stack-boundary=@var{num} @gol
592 -mincoming-stack-boundary=@var{num} @gol
593 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip -mvzeroupper @gol
594 -mmmx  -msse  -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
595 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfused-madd @gol
596 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlwp @gol
597 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
598 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
599 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
600 -m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
601 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
602 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
603 -momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
604 -mcmodel=@var{code-model} -mabi=@var{name} @gol
605 -m32  -m64 -mlarge-data-threshold=@var{num} @gol
606 -msse2avx -mfentry -m8bit-idiv @gol
607 -mavx256-split-unaligned-load -mavx256-split-unaligned-store}
609 @emph{i386 and x86-64 Windows Options}
610 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
611 -mnop-fun-dllimport -mthread @gol
612 -municode -mwin32 -mwindows -fno-set-stack-executable}
614 @emph{IA-64 Options}
615 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
616 -mvolatile-asm-stop  -mregister-names  -msdata -mno-sdata @gol
617 -mconstant-gp  -mauto-pic  -mfused-madd @gol
618 -minline-float-divide-min-latency @gol
619 -minline-float-divide-max-throughput @gol
620 -mno-inline-float-divide @gol
621 -minline-int-divide-min-latency @gol
622 -minline-int-divide-max-throughput  @gol
623 -mno-inline-int-divide @gol
624 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
625 -mno-inline-sqrt @gol
626 -mdwarf2-asm -mearly-stop-bits @gol
627 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
628 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
629 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
630 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
631 -msched-spec-ldc -msched-spec-control-ldc @gol
632 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
633 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
634 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
635 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
637 @emph{IA-64/VMS Options}
638 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
640 @emph{LM32 Options}
641 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
642 -msign-extend-enabled -muser-enabled}
644 @emph{M32R/D Options}
645 @gccoptlist{-m32r2 -m32rx -m32r @gol
646 -mdebug @gol
647 -malign-loops -mno-align-loops @gol
648 -missue-rate=@var{number} @gol
649 -mbranch-cost=@var{number} @gol
650 -mmodel=@var{code-size-model-type} @gol
651 -msdata=@var{sdata-type} @gol
652 -mno-flush-func -mflush-func=@var{name} @gol
653 -mno-flush-trap -mflush-trap=@var{number} @gol
654 -G @var{num}}
656 @emph{M32C Options}
657 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
659 @emph{M680x0 Options}
660 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
661 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
662 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
663 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
664 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
665 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
666 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
667 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
668 -mxgot -mno-xgot}
670 @emph{MCore Options}
671 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
672 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
673 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
674 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
675 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
677 @emph{MeP Options}
678 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
679 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
680 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
681 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
682 -mtiny=@var{n}}
684 @emph{MicroBlaze Options}
685 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
686 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
687 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
688 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
689 -mxl-mode-@var{app-model}}
691 @emph{MIPS Options}
692 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
693 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2 @gol
694 -mips64  -mips64r2 @gol
695 -mips16  -mno-mips16  -mflip-mips16 @gol
696 -minterlink-mips16  -mno-interlink-mips16 @gol
697 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
698 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
699 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
700 -msingle-float  -mdouble-float  -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
701 -mfpu=@var{fpu-type} @gol
702 -msmartmips  -mno-smartmips @gol
703 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
704 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
705 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
706 -G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
707 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
708 -membedded-data  -mno-embedded-data @gol
709 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
710 -mcode-readable=@var{setting} @gol
711 -msplit-addresses  -mno-split-addresses @gol
712 -mexplicit-relocs  -mno-explicit-relocs @gol
713 -mcheck-zero-division  -mno-check-zero-division @gol
714 -mdivide-traps  -mdivide-breaks @gol
715 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
716 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
717 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
718 -mfix-r10000 -mno-fix-r10000  -mfix-vr4120  -mno-fix-vr4120 @gol
719 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
720 -mflush-func=@var{func}  -mno-flush-func @gol
721 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
722 -mfp-exceptions -mno-fp-exceptions @gol
723 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
724 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
726 @emph{MMIX Options}
727 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
728 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
729 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
730 -mno-base-addresses  -msingle-exit  -mno-single-exit}
732 @emph{MN10300 Options}
733 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
734 -mno-am33 -mam33 -mam33-2 -mam34 @gol
735 -mtune=@var{cpu-type} @gol
736 -mreturn-pointer-on-d0 @gol
737 -mno-crt0  -mrelax -mliw -msetlb}
739 @emph{PDP-11 Options}
740 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
741 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
742 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
743 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
744 -mbranch-expensive  -mbranch-cheap @gol
745 -munix-asm  -mdec-asm}
747 @emph{picoChip Options}
748 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
749 -msymbol-as-address -mno-inefficient-warnings}
751 @emph{PowerPC Options}
752 See RS/6000 and PowerPC Options.
754 @emph{RS/6000 and PowerPC Options}
755 @gccoptlist{-mcpu=@var{cpu-type} @gol
756 -mtune=@var{cpu-type} @gol
757 -mcmodel=@var{code-model} @gol
758 -mpower  -mno-power  -mpower2  -mno-power2 @gol
759 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
760 -maltivec  -mno-altivec @gol
761 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
762 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
763 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb -mpopcntd -mno-popcntd @gol
764 -mfprnd  -mno-fprnd @gol
765 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
766 -mnew-mnemonics  -mold-mnemonics @gol
767 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
768 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
769 -malign-power  -malign-natural @gol
770 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
771 -msingle-float -mdouble-float -msimple-fpu @gol
772 -mstring  -mno-string  -mupdate  -mno-update @gol
773 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
774 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
775 -mstrict-align  -mno-strict-align  -mrelocatable @gol
776 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
777 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
778 -mdynamic-no-pic  -maltivec -mswdiv  -msingle-pic-base @gol
779 -mprioritize-restricted-insns=@var{priority} @gol
780 -msched-costly-dep=@var{dependence_type} @gol
781 -minsert-sched-nops=@var{scheme} @gol
782 -mcall-sysv  -mcall-netbsd @gol
783 -maix-struct-return  -msvr4-struct-return @gol
784 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
785 -mblock-move-inline-limit=@var{num} @gol
786 -misel -mno-isel @gol
787 -misel=yes  -misel=no @gol
788 -mspe -mno-spe @gol
789 -mspe=yes  -mspe=no @gol
790 -mpaired @gol
791 -mgen-cell-microcode -mwarn-cell-microcode @gol
792 -mvrsave -mno-vrsave @gol
793 -mmulhw -mno-mulhw @gol
794 -mdlmzb -mno-dlmzb @gol
795 -mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
796 -mprototype  -mno-prototype @gol
797 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
798 -msdata=@var{opt}  -mvxworks  -G @var{num}  -pthread @gol
799 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
800 -mno-recip-precision @gol
801 -mveclibabi=@var{type} -mfriz -mno-friz}
803 @emph{RX Options}
804 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
805 -mcpu=@gol
806 -mbig-endian-data -mlittle-endian-data @gol
807 -msmall-data @gol
808 -msim  -mno-sim@gol
809 -mas100-syntax -mno-as100-syntax@gol
810 -mrelax@gol
811 -mmax-constant-size=@gol
812 -mint-register=@gol
813 -msave-acc-in-interrupts}
815 @emph{S/390 and zSeries Options}
816 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
817 -mhard-float  -msoft-float  -mhard-dfp -mno-hard-dfp @gol
818 -mlong-double-64 -mlong-double-128 @gol
819 -mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
820 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
821 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
822 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
823 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
825 @emph{Score Options}
826 @gccoptlist{-meb -mel @gol
827 -mnhwloop @gol
828 -muls @gol
829 -mmac @gol
830 -mscore5 -mscore5u -mscore7 -mscore7d}
832 @emph{SH Options}
833 @gccoptlist{-m1  -m2  -m2e @gol
834 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
835 -m3  -m3e @gol
836 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
837 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
838 -m5-64media  -m5-64media-nofpu @gol
839 -m5-32media  -m5-32media-nofpu @gol
840 -m5-compact  -m5-compact-nofpu @gol
841 -mb  -ml  -mdalign  -mrelax @gol
842 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
843 -mieee  -mbitops  -misize  -minline-ic_invalidate -mpadstruct  -mspace @gol
844 -mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
845 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
846 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
847 -maccumulate-outgoing-args -minvalid-symbols}
849 @emph{Solaris 2 Options}
850 @gccoptlist{-mimpure-text  -mno-impure-text @gol
851 -pthreads -pthread}
853 @emph{SPARC Options}
854 @gccoptlist{-mcpu=@var{cpu-type} @gol
855 -mtune=@var{cpu-type} @gol
856 -mcmodel=@var{code-model} @gol
857 -m32  -m64  -mapp-regs  -mno-app-regs @gol
858 -mfaster-structs  -mno-faster-structs @gol
859 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
860 -mhard-quad-float  -msoft-quad-float @gol
861 -mlittle-endian @gol
862 -mstack-bias  -mno-stack-bias @gol
863 -munaligned-doubles  -mno-unaligned-doubles @gol
864 -mv8plus  -mno-v8plus  -mvis  -mno-vis}
866 @emph{SPU Options}
867 @gccoptlist{-mwarn-reloc -merror-reloc @gol
868 -msafe-dma -munsafe-dma @gol
869 -mbranch-hints @gol
870 -msmall-mem -mlarge-mem -mstdmain @gol
871 -mfixed-range=@var{register-range} @gol
872 -mea32 -mea64 @gol
873 -maddress-space-conversion -mno-address-space-conversion @gol
874 -mcache-size=@var{cache-size} @gol
875 -matomic-updates -mno-atomic-updates}
877 @emph{System V Options}
878 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
880 @emph{V850 Options}
881 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
882 -mprolog-function  -mno-prolog-function  -mspace @gol
883 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
884 -mapp-regs  -mno-app-regs @gol
885 -mdisable-callt  -mno-disable-callt @gol
886 -mv850e2v3 @gol
887 -mv850e2 @gol
888 -mv850e1 -mv850es @gol
889 -mv850e @gol
890 -mv850  -mbig-switch}
892 @emph{VAX Options}
893 @gccoptlist{-mg  -mgnu  -munix}
895 @emph{VxWorks Options}
896 @gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
897 -Xbind-lazy  -Xbind-now}
899 @emph{x86-64 Options}
900 See i386 and x86-64 Options.
902 @emph{Xstormy16 Options}
903 @gccoptlist{-msim}
905 @emph{Xtensa Options}
906 @gccoptlist{-mconst16 -mno-const16 @gol
907 -mfused-madd  -mno-fused-madd @gol
908 -mforce-no-pic @gol
909 -mserialize-volatile  -mno-serialize-volatile @gol
910 -mtext-section-literals  -mno-text-section-literals @gol
911 -mtarget-align  -mno-target-align @gol
912 -mlongcalls  -mno-longcalls}
914 @emph{zSeries Options}
915 See S/390 and zSeries Options.
917 @item Code Generation Options
918 @xref{Code Gen Options,,Options for Code Generation Conventions}.
919 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
920 -ffixed-@var{reg}  -fexceptions @gol
921 -fnon-call-exceptions  -funwind-tables @gol
922 -fasynchronous-unwind-tables @gol
923 -finhibit-size-directive  -finstrument-functions @gol
924 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
925 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
926 -fno-common  -fno-ident @gol
927 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
928 -fno-jump-tables @gol
929 -frecord-gcc-switches @gol
930 -freg-struct-return  -fshort-enums @gol
931 -fshort-double  -fshort-wchar @gol
932 -fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
933 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
934 -fno-stack-limit -fsplit-stack @gol
935 -fleading-underscore  -ftls-model=@var{model} @gol
936 -ftrapv  -fwrapv  -fbounds-check @gol
937 -fvisibility -fstrict-volatile-bitfields}
938 @end table
940 @menu
941 * Overall Options::     Controlling the kind of output:
942                         an executable, object files, assembler files,
943                         or preprocessed source.
944 * C Dialect Options::   Controlling the variant of C language compiled.
945 * C++ Dialect Options:: Variations on C++.
946 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
947                         and Objective-C++.
948 * Language Independent Options:: Controlling how diagnostics should be
949                         formatted.
950 * Warning Options::     How picky should the compiler be?
951 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
952 * Optimize Options::    How much optimization?
953 * Preprocessor Options:: Controlling header files and macro definitions.
954                          Also, getting dependency information for Make.
955 * Assembler Options::   Passing options to the assembler.
956 * Link Options::        Specifying libraries and so on.
957 * Directory Options::   Where to find header files and libraries.
958                         Where to find the compiler executable files.
959 * Spec Files::          How to pass switches to sub-processes.
960 * Target Options::      Running a cross-compiler, or an old version of GCC.
961 @end menu
963 @node Overall Options
964 @section Options Controlling the Kind of Output
966 Compilation can involve up to four stages: preprocessing, compilation
967 proper, assembly and linking, always in that order.  GCC is capable of
968 preprocessing and compiling several files either into several
969 assembler input files, or into one assembler input file; then each
970 assembler input file produces an object file, and linking combines all
971 the object files (those newly compiled, and those specified as input)
972 into an executable file.
974 @cindex file name suffix
975 For any given input file, the file name suffix determines what kind of
976 compilation is done:
978 @table @gcctabopt
979 @item @var{file}.c
980 C source code which must be preprocessed.
982 @item @var{file}.i
983 C source code which should not be preprocessed.
985 @item @var{file}.ii
986 C++ source code which should not be preprocessed.
988 @item @var{file}.m
989 Objective-C source code.  Note that you must link with the @file{libobjc}
990 library to make an Objective-C program work.
992 @item @var{file}.mi
993 Objective-C source code which should not be preprocessed.
995 @item @var{file}.mm
996 @itemx @var{file}.M
997 Objective-C++ source code.  Note that you must link with the @file{libobjc}
998 library to make an Objective-C++ program work.  Note that @samp{.M} refers
999 to a literal capital M@.
1001 @item @var{file}.mii
1002 Objective-C++ source code which should not be preprocessed.
1004 @item @var{file}.h
1005 C, C++, Objective-C or Objective-C++ header file to be turned into a
1006 precompiled header (default), or C, C++ header file to be turned into an
1007 Ada spec (via the @option{-fdump-ada-spec} switch).
1009 @item @var{file}.cc
1010 @itemx @var{file}.cp
1011 @itemx @var{file}.cxx
1012 @itemx @var{file}.cpp
1013 @itemx @var{file}.CPP
1014 @itemx @var{file}.c++
1015 @itemx @var{file}.C
1016 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
1017 the last two letters must both be literally @samp{x}.  Likewise,
1018 @samp{.C} refers to a literal capital C@.
1020 @item @var{file}.mm
1021 @itemx @var{file}.M
1022 Objective-C++ source code which must be preprocessed.
1024 @item @var{file}.mii
1025 Objective-C++ source code which should not be preprocessed.
1027 @item @var{file}.hh
1028 @itemx @var{file}.H
1029 @itemx @var{file}.hp
1030 @itemx @var{file}.hxx
1031 @itemx @var{file}.hpp
1032 @itemx @var{file}.HPP
1033 @itemx @var{file}.h++
1034 @itemx @var{file}.tcc
1035 C++ header file to be turned into a precompiled header or Ada spec.
1037 @item @var{file}.f
1038 @itemx @var{file}.for
1039 @itemx @var{file}.ftn
1040 Fixed form Fortran source code which should not be preprocessed.
1042 @item @var{file}.F
1043 @itemx @var{file}.FOR
1044 @itemx @var{file}.fpp
1045 @itemx @var{file}.FPP
1046 @itemx @var{file}.FTN
1047 Fixed form Fortran source code which must be preprocessed (with the traditional
1048 preprocessor).
1050 @item @var{file}.f90
1051 @itemx @var{file}.f95
1052 @itemx @var{file}.f03
1053 @itemx @var{file}.f08
1054 Free form Fortran source code which should not be preprocessed.
1056 @item @var{file}.F90
1057 @itemx @var{file}.F95
1058 @itemx @var{file}.F03
1059 @itemx @var{file}.F08
1060 Free form Fortran source code which must be preprocessed (with the
1061 traditional preprocessor).
1063 @item @var{file}.go
1064 Go source code.
1066 @c FIXME: Descriptions of Java file types.
1067 @c @var{file}.java
1068 @c @var{file}.class
1069 @c @var{file}.zip
1070 @c @var{file}.jar
1072 @item @var{file}.ads
1073 Ada source code file which contains a library unit declaration (a
1074 declaration of a package, subprogram, or generic, or a generic
1075 instantiation), or a library unit renaming declaration (a package,
1076 generic, or subprogram renaming declaration).  Such files are also
1077 called @dfn{specs}.
1079 @item @var{file}.adb
1080 Ada source code file containing a library unit body (a subprogram or
1081 package body).  Such files are also called @dfn{bodies}.
1083 @c GCC also knows about some suffixes for languages not yet included:
1084 @c Pascal:
1085 @c @var{file}.p
1086 @c @var{file}.pas
1087 @c Ratfor:
1088 @c @var{file}.r
1090 @item @var{file}.s
1091 Assembler code.
1093 @item @var{file}.S
1094 @itemx @var{file}.sx
1095 Assembler code which must be preprocessed.
1097 @item @var{other}
1098 An object file to be fed straight into linking.
1099 Any file name with no recognized suffix is treated this way.
1100 @end table
1102 @opindex x
1103 You can specify the input language explicitly with the @option{-x} option:
1105 @table @gcctabopt
1106 @item -x @var{language}
1107 Specify explicitly the @var{language} for the following input files
1108 (rather than letting the compiler choose a default based on the file
1109 name suffix).  This option applies to all following input files until
1110 the next @option{-x} option.  Possible values for @var{language} are:
1111 @smallexample
1112 c  c-header  cpp-output
1113 c++  c++-header  c++-cpp-output
1114 objective-c  objective-c-header  objective-c-cpp-output
1115 objective-c++ objective-c++-header objective-c++-cpp-output
1116 assembler  assembler-with-cpp
1118 f77  f77-cpp-input f95  f95-cpp-input
1120 java
1121 @end smallexample
1123 @item -x none
1124 Turn off any specification of a language, so that subsequent files are
1125 handled according to their file name suffixes (as they are if @option{-x}
1126 has not been used at all).
1128 @item -pass-exit-codes
1129 @opindex pass-exit-codes
1130 Normally the @command{gcc} program will exit with the code of 1 if any
1131 phase of the compiler returns a non-success return code.  If you specify
1132 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1133 numerically highest error produced by any phase that returned an error
1134 indication.  The C, C++, and Fortran frontends return 4, if an internal
1135 compiler error is encountered.
1136 @end table
1138 If you only want some of the stages of compilation, you can use
1139 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1140 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1141 @command{gcc} is to stop.  Note that some combinations (for example,
1142 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1144 @table @gcctabopt
1145 @item -c
1146 @opindex c
1147 Compile or assemble the source files, but do not link.  The linking
1148 stage simply is not done.  The ultimate output is in the form of an
1149 object file for each source file.
1151 By default, the object file name for a source file is made by replacing
1152 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1154 Unrecognized input files, not requiring compilation or assembly, are
1155 ignored.
1157 @item -S
1158 @opindex S
1159 Stop after the stage of compilation proper; do not assemble.  The output
1160 is in the form of an assembler code file for each non-assembler input
1161 file specified.
1163 By default, the assembler file name for a source file is made by
1164 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1166 Input files that don't require compilation are ignored.
1168 @item -E
1169 @opindex E
1170 Stop after the preprocessing stage; do not run the compiler proper.  The
1171 output is in the form of preprocessed source code, which is sent to the
1172 standard output.
1174 Input files which don't require preprocessing are ignored.
1176 @cindex output file option
1177 @item -o @var{file}
1178 @opindex o
1179 Place output in file @var{file}.  This applies regardless to whatever
1180 sort of output is being produced, whether it be an executable file,
1181 an object file, an assembler file or preprocessed C code.
1183 If @option{-o} is not specified, the default is to put an executable
1184 file in @file{a.out}, the object file for
1185 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1186 assembler file in @file{@var{source}.s}, a precompiled header file in
1187 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1188 standard output.
1190 @item -v
1191 @opindex v
1192 Print (on standard error output) the commands executed to run the stages
1193 of compilation.  Also print the version number of the compiler driver
1194 program and of the preprocessor and the compiler proper.
1196 @item -###
1197 @opindex ###
1198 Like @option{-v} except the commands are not executed and arguments
1199 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1200 This is useful for shell scripts to capture the driver-generated command lines.
1202 @item -pipe
1203 @opindex pipe
1204 Use pipes rather than temporary files for communication between the
1205 various stages of compilation.  This fails to work on some systems where
1206 the assembler is unable to read from a pipe; but the GNU assembler has
1207 no trouble.
1209 @item --help
1210 @opindex help
1211 Print (on the standard output) a description of the command line options
1212 understood by @command{gcc}.  If the @option{-v} option is also specified
1213 then @option{--help} will also be passed on to the various processes
1214 invoked by @command{gcc}, so that they can display the command line options
1215 they accept.  If the @option{-Wextra} option has also been specified
1216 (prior to the @option{--help} option), then command line options which
1217 have no documentation associated with them will also be displayed.
1219 @item --target-help
1220 @opindex target-help
1221 Print (on the standard output) a description of target-specific command
1222 line options for each tool.  For some targets extra target-specific
1223 information may also be printed.
1225 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1226 Print (on the standard output) a description of the command line
1227 options understood by the compiler that fit into all specified classes
1228 and qualifiers.  These are the supported classes:
1230 @table @asis
1231 @item @samp{optimizers}
1232 This will display all of the optimization options supported by the
1233 compiler.
1235 @item @samp{warnings}
1236 This will display all of the options controlling warning messages
1237 produced by the compiler.
1239 @item @samp{target}
1240 This will display target-specific options.  Unlike the
1241 @option{--target-help} option however, target-specific options of the
1242 linker and assembler will not be displayed.  This is because those
1243 tools do not currently support the extended @option{--help=} syntax.
1245 @item @samp{params}
1246 This will display the values recognized by the @option{--param}
1247 option.
1249 @item @var{language}
1250 This will display the options supported for @var{language}, where
1251 @var{language} is the name of one of the languages supported in this
1252 version of GCC.
1254 @item @samp{common}
1255 This will display the options that are common to all languages.
1256 @end table
1258 These are the supported qualifiers:
1260 @table @asis
1261 @item @samp{undocumented}
1262 Display only those options which are undocumented.
1264 @item @samp{joined}
1265 Display options which take an argument that appears after an equal
1266 sign in the same continuous piece of text, such as:
1267 @samp{--help=target}.
1269 @item @samp{separate}
1270 Display options which take an argument that appears as a separate word
1271 following the original option, such as: @samp{-o output-file}.
1272 @end table
1274 Thus for example to display all the undocumented target-specific
1275 switches supported by the compiler the following can be used:
1277 @smallexample
1278 --help=target,undocumented
1279 @end smallexample
1281 The sense of a qualifier can be inverted by prefixing it with the
1282 @samp{^} character, so for example to display all binary warning
1283 options (i.e., ones that are either on or off and that do not take an
1284 argument), which have a description the following can be used:
1286 @smallexample
1287 --help=warnings,^joined,^undocumented
1288 @end smallexample
1290 The argument to @option{--help=} should not consist solely of inverted
1291 qualifiers.
1293 Combining several classes is possible, although this usually
1294 restricts the output by so much that there is nothing to display.  One
1295 case where it does work however is when one of the classes is
1296 @var{target}.  So for example to display all the target-specific
1297 optimization options the following can be used:
1299 @smallexample
1300 --help=target,optimizers
1301 @end smallexample
1303 The @option{--help=} option can be repeated on the command line.  Each
1304 successive use will display its requested class of options, skipping
1305 those that have already been displayed.
1307 If the @option{-Q} option appears on the command line before the
1308 @option{--help=} option, then the descriptive text displayed by
1309 @option{--help=} is changed.  Instead of describing the displayed
1310 options, an indication is given as to whether the option is enabled,
1311 disabled or set to a specific value (assuming that the compiler
1312 knows this at the point where the @option{--help=} option is used).
1314 Here is a truncated example from the ARM port of @command{gcc}:
1316 @smallexample
1317   % gcc -Q -mabi=2 --help=target -c
1318   The following options are target specific:
1319   -mabi=                                2
1320   -mabort-on-noreturn                   [disabled]
1321   -mapcs                                [disabled]
1322 @end smallexample
1324 The output is sensitive to the effects of previous command line
1325 options, so for example it is possible to find out which optimizations
1326 are enabled at @option{-O2} by using:
1328 @smallexample
1329 -Q -O2 --help=optimizers
1330 @end smallexample
1332 Alternatively you can discover which binary optimizations are enabled
1333 by @option{-O3} by using:
1335 @smallexample
1336 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1337 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1338 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1339 @end smallexample
1341 @item -canonical-prefixes
1342 @opindex canonical-prefixes
1343 Always expand any symbolic links, resolve references to @samp{/../}
1344 or @samp{/./}, and make the path absolute when generating a relative
1345 prefix.
1347 @item -no-canonical-prefixes
1348 @opindex no-canonical-prefixes
1349 Never expand any symbolic links, resolve references to @samp{/../}
1350 or @samp{/./}, or make the path absolute when generating a relative
1351 prefix.  If neither @option{-canonical-prefixes} nor
1352 @option{-canonical-prefixes} is given, GCC tries to set an appropriate
1353 default by looking for a target-specific subdirectory alongside the
1354 directory containing the compiler driver.
1356 @item --version
1357 @opindex version
1358 Display the version number and copyrights of the invoked GCC@.
1360 @item -wrapper
1361 @opindex wrapper
1362 Invoke all subcommands under a wrapper program.  The name of the
1363 wrapper program and its parameters are passed as a comma separated
1364 list.
1366 @smallexample
1367 gcc -c t.c -wrapper gdb,--args
1368 @end smallexample
1370 This will invoke all subprograms of @command{gcc} under
1371 @samp{gdb --args}, thus the invocation of @command{cc1} will be
1372 @samp{gdb --args cc1 @dots{}}.
1374 @item -fplugin=@var{name}.so
1375 Load the plugin code in file @var{name}.so, assumed to be a
1376 shared object to be dlopen'd by the compiler.  The base name of
1377 the shared object file is used to identify the plugin for the
1378 purposes of argument parsing (See
1379 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1380 Each plugin should define the callback functions specified in the
1381 Plugins API.
1383 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1384 Define an argument called @var{key} with a value of @var{value}
1385 for the plugin called @var{name}.
1387 @item -fdump-ada-spec@r{[}-slim@r{]}
1388 For C and C++ source and include files, generate corresponding Ada
1389 specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1390 GNAT User's Guide}, which provides detailed documentation on this feature.
1392 @item -fdump-go-spec=@var{file}
1393 For input files in any language, generate corresponding Go
1394 declarations in @var{file}.  This generates Go @code{const},
1395 @code{type}, @code{var}, and @code{func} declarations which may be a
1396 useful way to start writing a Go interface to code written in some
1397 other language.
1399 @include @value{srcdir}/../libiberty/at-file.texi
1400 @end table
1402 @node Invoking G++
1403 @section Compiling C++ Programs
1405 @cindex suffixes for C++ source
1406 @cindex C++ source file suffixes
1407 C++ source files conventionally use one of the suffixes @samp{.C},
1408 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1409 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1410 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1411 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1412 files with these names and compiles them as C++ programs even if you
1413 call the compiler the same way as for compiling C programs (usually
1414 with the name @command{gcc}).
1416 @findex g++
1417 @findex c++
1418 However, the use of @command{gcc} does not add the C++ library.
1419 @command{g++} is a program that calls GCC and treats @samp{.c},
1420 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1421 files unless @option{-x} is used, and automatically specifies linking
1422 against the C++ library.  This program is also useful when
1423 precompiling a C header file with a @samp{.h} extension for use in C++
1424 compilations.  On many systems, @command{g++} is also installed with
1425 the name @command{c++}.
1427 @cindex invoking @command{g++}
1428 When you compile C++ programs, you may specify many of the same
1429 command-line options that you use for compiling programs in any
1430 language; or command-line options meaningful for C and related
1431 languages; or options that are meaningful only for C++ programs.
1432 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1433 explanations of options for languages related to C@.
1434 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1435 explanations of options that are meaningful only for C++ programs.
1437 @node C Dialect Options
1438 @section Options Controlling C Dialect
1439 @cindex dialect options
1440 @cindex language dialect options
1441 @cindex options, dialect
1443 The following options control the dialect of C (or languages derived
1444 from C, such as C++, Objective-C and Objective-C++) that the compiler
1445 accepts:
1447 @table @gcctabopt
1448 @cindex ANSI support
1449 @cindex ISO support
1450 @item -ansi
1451 @opindex ansi
1452 In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
1453 equivalent to @samp{-std=c++98}.
1455 This turns off certain features of GCC that are incompatible with ISO
1456 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1457 such as the @code{asm} and @code{typeof} keywords, and
1458 predefined macros such as @code{unix} and @code{vax} that identify the
1459 type of system you are using.  It also enables the undesirable and
1460 rarely used ISO trigraph feature.  For the C compiler,
1461 it disables recognition of C++ style @samp{//} comments as well as
1462 the @code{inline} keyword.
1464 The alternate keywords @code{__asm__}, @code{__extension__},
1465 @code{__inline__} and @code{__typeof__} continue to work despite
1466 @option{-ansi}.  You would not want to use them in an ISO C program, of
1467 course, but it is useful to put them in header files that might be included
1468 in compilations done with @option{-ansi}.  Alternate predefined macros
1469 such as @code{__unix__} and @code{__vax__} are also available, with or
1470 without @option{-ansi}.
1472 The @option{-ansi} option does not cause non-ISO programs to be
1473 rejected gratuitously.  For that, @option{-pedantic} is required in
1474 addition to @option{-ansi}.  @xref{Warning Options}.
1476 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1477 option is used.  Some header files may notice this macro and refrain
1478 from declaring certain functions or defining certain macros that the
1479 ISO standard doesn't call for; this is to avoid interfering with any
1480 programs that might use these names for other things.
1482 Functions that would normally be built in but do not have semantics
1483 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1484 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1485 built-in functions provided by GCC}, for details of the functions
1486 affected.
1488 @item -std=
1489 @opindex std
1490 Determine the language standard. @xref{Standards,,Language Standards
1491 Supported by GCC}, for details of these standard versions.  This option
1492 is currently only supported when compiling C or C++.
1494 The compiler can accept several base standards, such as @samp{c90} or
1495 @samp{c++98}, and GNU dialects of those standards, such as
1496 @samp{gnu90} or @samp{gnu++98}.  By specifying a base standard, the
1497 compiler will accept all programs following that standard and those
1498 using GNU extensions that do not contradict it.  For example,
1499 @samp{-std=c90} turns off certain features of GCC that are
1500 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1501 keywords, but not other GNU extensions that do not have a meaning in
1502 ISO C90, such as omitting the middle term of a @code{?:}
1503 expression. On the other hand, by specifying a GNU dialect of a
1504 standard, all features the compiler support are enabled, even when
1505 those features change the meaning of the base standard and some
1506 strict-conforming programs may be rejected.  The particular standard
1507 is used by @option{-pedantic} to identify which features are GNU
1508 extensions given that version of the standard. For example
1509 @samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
1510 comments, while @samp{-std=gnu99 -pedantic} would not.
1512 A value for this option must be provided; possible values are
1514 @table @samp
1515 @item c90
1516 @itemx c89
1517 @itemx iso9899:1990
1518 Support all ISO C90 programs (certain GNU extensions that conflict
1519 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1521 @item iso9899:199409
1522 ISO C90 as modified in amendment 1.
1524 @item c99
1525 @itemx c9x
1526 @itemx iso9899:1999
1527 @itemx iso9899:199x
1528 ISO C99.  Note that this standard is not yet fully supported; see
1529 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1530 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1532 @item c1x
1533 ISO C1X, the draft of the next revision of the ISO C standard.
1534 Support is limited and experimental and features enabled by this
1535 option may be changed or removed if changed in or removed from the
1536 standard draft.
1538 @item gnu90
1539 @itemx gnu89
1540 GNU dialect of ISO C90 (including some C99 features). This
1541 is the default for C code.
1543 @item gnu99
1544 @itemx gnu9x
1545 GNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC,
1546 this will become the default.  The name @samp{gnu9x} is deprecated.
1548 @item gnu1x
1549 GNU dialect of ISO C1X.  Support is limited and experimental and
1550 features enabled by this option may be changed or removed if changed
1551 in or removed from the standard draft.
1553 @item c++98
1554 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1555 C++ code.
1557 @item gnu++98
1558 GNU dialect of @option{-std=c++98}.  This is the default for
1559 C++ code.
1561 @item c++0x
1562 The working draft of the upcoming ISO C++0x standard. This option
1563 enables experimental features that are likely to be included in
1564 C++0x. The working draft is constantly changing, and any feature that is
1565 enabled by this flag may be removed from future versions of GCC if it is
1566 not part of the C++0x standard.
1568 @item gnu++0x
1569 GNU dialect of @option{-std=c++0x}. This option enables
1570 experimental features that may be removed in future versions of GCC.
1571 @end table
1573 @item -fgnu89-inline
1574 @opindex fgnu89-inline
1575 The option @option{-fgnu89-inline} tells GCC to use the traditional
1576 GNU semantics for @code{inline} functions when in C99 mode.
1577 @xref{Inline,,An Inline Function is As Fast As a Macro}.  This option
1578 is accepted and ignored by GCC versions 4.1.3 up to but not including
1579 4.3.  In GCC versions 4.3 and later it changes the behavior of GCC in
1580 C99 mode.  Using this option is roughly equivalent to adding the
1581 @code{gnu_inline} function attribute to all inline functions
1582 (@pxref{Function Attributes}).
1584 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1585 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1586 specifies the default behavior).  This option was first supported in
1587 GCC 4.3.  This option is not supported in @option{-std=c90} or
1588 @option{-std=gnu90} mode.
1590 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1591 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1592 in effect for @code{inline} functions.  @xref{Common Predefined
1593 Macros,,,cpp,The C Preprocessor}.
1595 @item -aux-info @var{filename}
1596 @opindex aux-info
1597 Output to the given filename prototyped declarations for all functions
1598 declared and/or defined in a translation unit, including those in header
1599 files.  This option is silently ignored in any language other than C@.
1601 Besides declarations, the file indicates, in comments, the origin of
1602 each declaration (source file and line), whether the declaration was
1603 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1604 @samp{O} for old, respectively, in the first character after the line
1605 number and the colon), and whether it came from a declaration or a
1606 definition (@samp{C} or @samp{F}, respectively, in the following
1607 character).  In the case of function definitions, a K&R-style list of
1608 arguments followed by their declarations is also provided, inside
1609 comments, after the declaration.
1611 @item -fno-asm
1612 @opindex fno-asm
1613 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1614 keyword, so that code can use these words as identifiers.  You can use
1615 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1616 instead.  @option{-ansi} implies @option{-fno-asm}.
1618 In C++, this switch only affects the @code{typeof} keyword, since
1619 @code{asm} and @code{inline} are standard keywords.  You may want to
1620 use the @option{-fno-gnu-keywords} flag instead, which has the same
1621 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1622 switch only affects the @code{asm} and @code{typeof} keywords, since
1623 @code{inline} is a standard keyword in ISO C99.
1625 @item -fno-builtin
1626 @itemx -fno-builtin-@var{function}
1627 @opindex fno-builtin
1628 @cindex built-in functions
1629 Don't recognize built-in functions that do not begin with
1630 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1631 functions provided by GCC}, for details of the functions affected,
1632 including those which are not built-in functions when @option{-ansi} or
1633 @option{-std} options for strict ISO C conformance are used because they
1634 do not have an ISO standard meaning.
1636 GCC normally generates special code to handle certain built-in functions
1637 more efficiently; for instance, calls to @code{alloca} may become single
1638 instructions that adjust the stack directly, and calls to @code{memcpy}
1639 may become inline copy loops.  The resulting code is often both smaller
1640 and faster, but since the function calls no longer appear as such, you
1641 cannot set a breakpoint on those calls, nor can you change the behavior
1642 of the functions by linking with a different library.  In addition,
1643 when a function is recognized as a built-in function, GCC may use
1644 information about that function to warn about problems with calls to
1645 that function, or to generate more efficient code, even if the
1646 resulting code still contains calls to that function.  For example,
1647 warnings are given with @option{-Wformat} for bad calls to
1648 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1649 known not to modify global memory.
1651 With the @option{-fno-builtin-@var{function}} option
1652 only the built-in function @var{function} is
1653 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1654 function is named that is not built-in in this version of GCC, this
1655 option is ignored.  There is no corresponding
1656 @option{-fbuiltin-@var{function}} option; if you wish to enable
1657 built-in functions selectively when using @option{-fno-builtin} or
1658 @option{-ffreestanding}, you may define macros such as:
1660 @smallexample
1661 #define abs(n)          __builtin_abs ((n))
1662 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1663 @end smallexample
1665 @item -fhosted
1666 @opindex fhosted
1667 @cindex hosted environment
1669 Assert that compilation takes place in a hosted environment.  This implies
1670 @option{-fbuiltin}.  A hosted environment is one in which the
1671 entire standard library is available, and in which @code{main} has a return
1672 type of @code{int}.  Examples are nearly everything except a kernel.
1673 This is equivalent to @option{-fno-freestanding}.
1675 @item -ffreestanding
1676 @opindex ffreestanding
1677 @cindex hosted environment
1679 Assert that compilation takes place in a freestanding environment.  This
1680 implies @option{-fno-builtin}.  A freestanding environment
1681 is one in which the standard library may not exist, and program startup may
1682 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1683 This is equivalent to @option{-fno-hosted}.
1685 @xref{Standards,,Language Standards Supported by GCC}, for details of
1686 freestanding and hosted environments.
1688 @item -fopenmp
1689 @opindex fopenmp
1690 @cindex OpenMP parallel
1691 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1692 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1693 compiler generates parallel code according to the OpenMP Application
1694 Program Interface v3.0 @w{@uref{http://www.openmp.org/}}.  This option
1695 implies @option{-pthread}, and thus is only supported on targets that
1696 have support for @option{-pthread}.
1698 @item -fms-extensions
1699 @opindex fms-extensions
1700 Accept some non-standard constructs used in Microsoft header files.
1702 In C++ code, this allows member names in structures to be similar
1703 to previous types declarations.
1705 @smallexample
1706 typedef int UOW;
1707 struct ABC @{
1708   UOW UOW;
1710 @end smallexample
1712 Some cases of unnamed fields in structures and unions are only
1713 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1714 fields within structs/unions}, for details.
1716 @item -fplan9-extensions
1717 Accept some non-standard constructs used in Plan 9 code.
1719 This enables @option{-fms-extensions}, permits passing pointers to
1720 structures with anonymous fields to functions which expect pointers to
1721 elements of the type of the field, and permits referring to anonymous
1722 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
1723 struct/union fields within structs/unions}, for details.  This is only
1724 supported for C, not C++.
1726 @item -trigraphs
1727 @opindex trigraphs
1728 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1729 options for strict ISO C conformance) implies @option{-trigraphs}.
1731 @item -no-integrated-cpp
1732 @opindex no-integrated-cpp
1733 Performs a compilation in two passes: preprocessing and compiling.  This
1734 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1735 @option{-B} option.  The user supplied compilation step can then add in
1736 an additional preprocessing step after normal preprocessing but before
1737 compiling.  The default is to use the integrated cpp (internal cpp)
1739 The semantics of this option will change if "cc1", "cc1plus", and
1740 "cc1obj" are merged.
1742 @cindex traditional C language
1743 @cindex C language, traditional
1744 @item -traditional
1745 @itemx -traditional-cpp
1746 @opindex traditional-cpp
1747 @opindex traditional
1748 Formerly, these options caused GCC to attempt to emulate a pre-standard
1749 C compiler.  They are now only supported with the @option{-E} switch.
1750 The preprocessor continues to support a pre-standard mode.  See the GNU
1751 CPP manual for details.
1753 @item -fcond-mismatch
1754 @opindex fcond-mismatch
1755 Allow conditional expressions with mismatched types in the second and
1756 third arguments.  The value of such an expression is void.  This option
1757 is not supported for C++.
1759 @item -flax-vector-conversions
1760 @opindex flax-vector-conversions
1761 Allow implicit conversions between vectors with differing numbers of
1762 elements and/or incompatible element types.  This option should not be
1763 used for new code.
1765 @item -funsigned-char
1766 @opindex funsigned-char
1767 Let the type @code{char} be unsigned, like @code{unsigned char}.
1769 Each kind of machine has a default for what @code{char} should
1770 be.  It is either like @code{unsigned char} by default or like
1771 @code{signed char} by default.
1773 Ideally, a portable program should always use @code{signed char} or
1774 @code{unsigned char} when it depends on the signedness of an object.
1775 But many programs have been written to use plain @code{char} and
1776 expect it to be signed, or expect it to be unsigned, depending on the
1777 machines they were written for.  This option, and its inverse, let you
1778 make such a program work with the opposite default.
1780 The type @code{char} is always a distinct type from each of
1781 @code{signed char} or @code{unsigned char}, even though its behavior
1782 is always just like one of those two.
1784 @item -fsigned-char
1785 @opindex fsigned-char
1786 Let the type @code{char} be signed, like @code{signed char}.
1788 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1789 the negative form of @option{-funsigned-char}.  Likewise, the option
1790 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1792 @item -fsigned-bitfields
1793 @itemx -funsigned-bitfields
1794 @itemx -fno-signed-bitfields
1795 @itemx -fno-unsigned-bitfields
1796 @opindex fsigned-bitfields
1797 @opindex funsigned-bitfields
1798 @opindex fno-signed-bitfields
1799 @opindex fno-unsigned-bitfields
1800 These options control whether a bit-field is signed or unsigned, when the
1801 declaration does not use either @code{signed} or @code{unsigned}.  By
1802 default, such a bit-field is signed, because this is consistent: the
1803 basic integer types such as @code{int} are signed types.
1804 @end table
1806 @node C++ Dialect Options
1807 @section Options Controlling C++ Dialect
1809 @cindex compiler options, C++
1810 @cindex C++ options, command line
1811 @cindex options, C++
1812 This section describes the command-line options that are only meaningful
1813 for C++ programs; but you can also use most of the GNU compiler options
1814 regardless of what language your program is in.  For example, you
1815 might compile a file @code{firstClass.C} like this:
1817 @smallexample
1818 g++ -g -frepo -O -c firstClass.C
1819 @end smallexample
1821 @noindent
1822 In this example, only @option{-frepo} is an option meant
1823 only for C++ programs; you can use the other options with any
1824 language supported by GCC@.
1826 Here is a list of options that are @emph{only} for compiling C++ programs:
1828 @table @gcctabopt
1830 @item -fabi-version=@var{n}
1831 @opindex fabi-version
1832 Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1833 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1834 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1835 the version that conforms most closely to the C++ ABI specification.
1836 Therefore, the ABI obtained using version 0 will change as ABI bugs
1837 are fixed.
1839 The default is version 2.
1841 Version 3 corrects an error in mangling a constant address as a
1842 template argument.
1844 Version 4 implements a standard mangling for vector types.
1846 Version 5 corrects the mangling of attribute const/volatile on
1847 function pointer types, decltype of a plain decl, and use of a
1848 function parameter in the declaration of another parameter.
1850 See also @option{-Wabi}.
1852 @item -fno-access-control
1853 @opindex fno-access-control
1854 Turn off all access checking.  This switch is mainly useful for working
1855 around bugs in the access control code.
1857 @item -fcheck-new
1858 @opindex fcheck-new
1859 Check that the pointer returned by @code{operator new} is non-null
1860 before attempting to modify the storage allocated.  This check is
1861 normally unnecessary because the C++ standard specifies that
1862 @code{operator new} will only return @code{0} if it is declared
1863 @samp{throw()}, in which case the compiler will always check the
1864 return value even without this option.  In all other cases, when
1865 @code{operator new} has a non-empty exception specification, memory
1866 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1867 @samp{new (nothrow)}.
1869 @item -fconserve-space
1870 @opindex fconserve-space
1871 Put uninitialized or runtime-initialized global variables into the
1872 common segment, as C does.  This saves space in the executable at the
1873 cost of not diagnosing duplicate definitions.  If you compile with this
1874 flag and your program mysteriously crashes after @code{main()} has
1875 completed, you may have an object that is being destroyed twice because
1876 two definitions were merged.
1878 This option is no longer useful on most targets, now that support has
1879 been added for putting variables into BSS without making them common.
1881 @item -fconstexpr-depth=@var{n}
1882 @opindex fconstexpr-depth
1883 Set the maximum nested evaluation depth for C++0x constexpr functions
1884 to @var{n}.  A limit is needed to detect endless recursion during
1885 constant expression evaluation.  The minimum specified by the standard
1886 is 512.
1888 @item -fno-deduce-init-list
1889 @opindex fno-deduce-init-list
1890 Disable deduction of a template type parameter as
1891 std::initializer_list from a brace-enclosed initializer list, i.e.
1893 @smallexample
1894 template <class T> auto forward(T t) -> decltype (realfn (t))
1896   return realfn (t);
1899 void f()
1901   forward(@{1,2@}); // call forward<std::initializer_list<int>>
1903 @end smallexample
1905 This option is present because this deduction is an extension to the
1906 current specification in the C++0x working draft, and there was
1907 some concern about potential overload resolution problems.
1909 @item -ffriend-injection
1910 @opindex ffriend-injection
1911 Inject friend functions into the enclosing namespace, so that they are
1912 visible outside the scope of the class in which they are declared.
1913 Friend functions were documented to work this way in the old Annotated
1914 C++ Reference Manual, and versions of G++ before 4.1 always worked
1915 that way.  However, in ISO C++ a friend function which is not declared
1916 in an enclosing scope can only be found using argument dependent
1917 lookup.  This option causes friends to be injected as they were in
1918 earlier releases.
1920 This option is for compatibility, and may be removed in a future
1921 release of G++.
1923 @item -fno-elide-constructors
1924 @opindex fno-elide-constructors
1925 The C++ standard allows an implementation to omit creating a temporary
1926 which is only used to initialize another object of the same type.
1927 Specifying this option disables that optimization, and forces G++ to
1928 call the copy constructor in all cases.
1930 @item -fno-enforce-eh-specs
1931 @opindex fno-enforce-eh-specs
1932 Don't generate code to check for violation of exception specifications
1933 at runtime.  This option violates the C++ standard, but may be useful
1934 for reducing code size in production builds, much like defining
1935 @samp{NDEBUG}.  This does not give user code permission to throw
1936 exceptions in violation of the exception specifications; the compiler
1937 will still optimize based on the specifications, so throwing an
1938 unexpected exception will result in undefined behavior.
1940 @item -ffor-scope
1941 @itemx -fno-for-scope
1942 @opindex ffor-scope
1943 @opindex fno-for-scope
1944 If @option{-ffor-scope} is specified, the scope of variables declared in
1945 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1946 as specified by the C++ standard.
1947 If @option{-fno-for-scope} is specified, the scope of variables declared in
1948 a @i{for-init-statement} extends to the end of the enclosing scope,
1949 as was the case in old versions of G++, and other (traditional)
1950 implementations of C++.
1952 The default if neither flag is given to follow the standard,
1953 but to allow and give a warning for old-style code that would
1954 otherwise be invalid, or have different behavior.
1956 @item -fno-gnu-keywords
1957 @opindex fno-gnu-keywords
1958 Do not recognize @code{typeof} as a keyword, so that code can use this
1959 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1960 @option{-ansi} implies @option{-fno-gnu-keywords}.
1962 @item -fno-implicit-templates
1963 @opindex fno-implicit-templates
1964 Never emit code for non-inline templates which are instantiated
1965 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1966 @xref{Template Instantiation}, for more information.
1968 @item -fno-implicit-inline-templates
1969 @opindex fno-implicit-inline-templates
1970 Don't emit code for implicit instantiations of inline templates, either.
1971 The default is to handle inlines differently so that compiles with and
1972 without optimization will need the same set of explicit instantiations.
1974 @item -fno-implement-inlines
1975 @opindex fno-implement-inlines
1976 To save space, do not emit out-of-line copies of inline functions
1977 controlled by @samp{#pragma implementation}.  This will cause linker
1978 errors if these functions are not inlined everywhere they are called.
1980 @item -fms-extensions
1981 @opindex fms-extensions
1982 Disable pedantic warnings about constructs used in MFC, such as implicit
1983 int and getting a pointer to member function via non-standard syntax.
1985 @item -fno-nonansi-builtins
1986 @opindex fno-nonansi-builtins
1987 Disable built-in declarations of functions that are not mandated by
1988 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1989 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1991 @item -fnothrow-opt
1992 @opindex fnothrow-opt
1993 Treat a @code{throw()} exception specification as though it were a
1994 @code{noexcept} specification to reduce or eliminate the text size
1995 overhead relative to a function with no exception specification.  If
1996 the function has local variables of types with non-trivial
1997 destructors, the exception specification will actually make the
1998 function smaller because the EH cleanups for those variables can be
1999 optimized away.  The semantic effect is that an exception thrown out of
2000 a function with such an exception specification will result in a call
2001 to @code{terminate} rather than @code{unexpected}.
2003 @item -fno-operator-names
2004 @opindex fno-operator-names
2005 Do not treat the operator name keywords @code{and}, @code{bitand},
2006 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2007 synonyms as keywords.
2009 @item -fno-optional-diags
2010 @opindex fno-optional-diags
2011 Disable diagnostics that the standard says a compiler does not need to
2012 issue.  Currently, the only such diagnostic issued by G++ is the one for
2013 a name having multiple meanings within a class.
2015 @item -fpermissive
2016 @opindex fpermissive
2017 Downgrade some diagnostics about nonconformant code from errors to
2018 warnings.  Thus, using @option{-fpermissive} will allow some
2019 nonconforming code to compile.
2021 @item -fno-pretty-templates
2022 @opindex fno-pretty-templates
2023 When an error message refers to a specialization of a function
2024 template, the compiler will normally print the signature of the
2025 template followed by the template arguments and any typedefs or
2026 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2027 rather than @code{void f(int)}) so that it's clear which template is
2028 involved.  When an error message refers to a specialization of a class
2029 template, the compiler will omit any template arguments which match
2030 the default template arguments for that template.  If either of these
2031 behaviors make it harder to understand the error message rather than
2032 easier, using @option{-fno-pretty-templates} will disable them.
2034 @item -frepo
2035 @opindex frepo
2036 Enable automatic template instantiation at link time.  This option also
2037 implies @option{-fno-implicit-templates}.  @xref{Template
2038 Instantiation}, for more information.
2040 @item -fno-rtti
2041 @opindex fno-rtti
2042 Disable generation of information about every class with virtual
2043 functions for use by the C++ runtime type identification features
2044 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
2045 of the language, you can save some space by using this flag.  Note that
2046 exception handling uses the same information, but it will generate it as
2047 needed. The @samp{dynamic_cast} operator can still be used for casts that
2048 do not require runtime type information, i.e.@: casts to @code{void *} or to
2049 unambiguous base classes.
2051 @item -fstats
2052 @opindex fstats
2053 Emit statistics about front-end processing at the end of the compilation.
2054 This information is generally only useful to the G++ development team.
2056 @item -fstrict-enums
2057 @opindex fstrict-enums
2058 Allow the compiler to optimize using the assumption that a value of
2059 enumeration type can only be one of the values of the enumeration (as
2060 defined in the C++ standard; basically, a value which can be
2061 represented in the minimum number of bits needed to represent all the
2062 enumerators).  This assumption may not be valid if the program uses a
2063 cast to convert an arbitrary integer value to the enumeration type.
2065 @item -ftemplate-depth=@var{n}
2066 @opindex ftemplate-depth
2067 Set the maximum instantiation depth for template classes to @var{n}.
2068 A limit on the template instantiation depth is needed to detect
2069 endless recursions during template class instantiation.  ANSI/ISO C++
2070 conforming programs must not rely on a maximum depth greater than 17
2071 (changed to 1024 in C++0x).
2073 @item -fno-threadsafe-statics
2074 @opindex fno-threadsafe-statics
2075 Do not emit the extra code to use the routines specified in the C++
2076 ABI for thread-safe initialization of local statics.  You can use this
2077 option to reduce code size slightly in code that doesn't need to be
2078 thread-safe.
2080 @item -fuse-cxa-atexit
2081 @opindex fuse-cxa-atexit
2082 Register destructors for objects with static storage duration with the
2083 @code{__cxa_atexit} function rather than the @code{atexit} function.
2084 This option is required for fully standards-compliant handling of static
2085 destructors, but will only work if your C library supports
2086 @code{__cxa_atexit}.
2088 @item -fno-use-cxa-get-exception-ptr
2089 @opindex fno-use-cxa-get-exception-ptr
2090 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2091 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
2092 if the runtime routine is not available.
2094 @item -fvisibility-inlines-hidden
2095 @opindex fvisibility-inlines-hidden
2096 This switch declares that the user does not attempt to compare
2097 pointers to inline methods where the addresses of the two functions
2098 were taken in different shared objects.
2100 The effect of this is that GCC may, effectively, mark inline methods with
2101 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2102 appear in the export table of a DSO and do not require a PLT indirection
2103 when used within the DSO@.  Enabling this option can have a dramatic effect
2104 on load and link times of a DSO as it massively reduces the size of the
2105 dynamic export table when the library makes heavy use of templates.
2107 The behavior of this switch is not quite the same as marking the
2108 methods as hidden directly, because it does not affect static variables
2109 local to the function or cause the compiler to deduce that
2110 the function is defined in only one shared object.
2112 You may mark a method as having a visibility explicitly to negate the
2113 effect of the switch for that method.  For example, if you do want to
2114 compare pointers to a particular inline method, you might mark it as
2115 having default visibility.  Marking the enclosing class with explicit
2116 visibility will have no effect.
2118 Explicitly instantiated inline methods are unaffected by this option
2119 as their linkage might otherwise cross a shared library boundary.
2120 @xref{Template Instantiation}.
2122 @item -fvisibility-ms-compat
2123 @opindex fvisibility-ms-compat
2124 This flag attempts to use visibility settings to make GCC's C++
2125 linkage model compatible with that of Microsoft Visual Studio.
2127 The flag makes these changes to GCC's linkage model:
2129 @enumerate
2130 @item
2131 It sets the default visibility to @code{hidden}, like
2132 @option{-fvisibility=hidden}.
2134 @item
2135 Types, but not their members, are not hidden by default.
2137 @item
2138 The One Definition Rule is relaxed for types without explicit
2139 visibility specifications which are defined in more than one different
2140 shared object: those declarations are permitted if they would have
2141 been permitted when this option was not used.
2142 @end enumerate
2144 In new code it is better to use @option{-fvisibility=hidden} and
2145 export those classes which are intended to be externally visible.
2146 Unfortunately it is possible for code to rely, perhaps accidentally,
2147 on the Visual Studio behavior.
2149 Among the consequences of these changes are that static data members
2150 of the same type with the same name but defined in different shared
2151 objects will be different, so changing one will not change the other;
2152 and that pointers to function members defined in different shared
2153 objects may not compare equal.  When this flag is given, it is a
2154 violation of the ODR to define types with the same name differently.
2156 @item -fno-weak
2157 @opindex fno-weak
2158 Do not use weak symbol support, even if it is provided by the linker.
2159 By default, G++ will use weak symbols if they are available.  This
2160 option exists only for testing, and should not be used by end-users;
2161 it will result in inferior code and has no benefits.  This option may
2162 be removed in a future release of G++.
2164 @item -nostdinc++
2165 @opindex nostdinc++
2166 Do not search for header files in the standard directories specific to
2167 C++, but do still search the other standard directories.  (This option
2168 is used when building the C++ library.)
2169 @end table
2171 In addition, these optimization, warning, and code generation options
2172 have meanings only for C++ programs:
2174 @table @gcctabopt
2175 @item -fno-default-inline
2176 @opindex fno-default-inline
2177 Do not assume @samp{inline} for functions defined inside a class scope.
2178 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
2179 functions will have linkage like inline functions; they just won't be
2180 inlined by default.
2182 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2183 @opindex Wabi
2184 @opindex Wno-abi
2185 Warn when G++ generates code that is probably not compatible with the
2186 vendor-neutral C++ ABI@.  Although an effort has been made to warn about
2187 all such cases, there are probably some cases that are not warned about,
2188 even though G++ is generating incompatible code.  There may also be
2189 cases where warnings are emitted even though the code that is generated
2190 will be compatible.
2192 You should rewrite your code to avoid these warnings if you are
2193 concerned about the fact that code generated by G++ may not be binary
2194 compatible with code generated by other compilers.
2196 The known incompatibilities in @option{-fabi-version=2} (the default) include:
2198 @itemize @bullet
2200 @item
2201 A template with a non-type template parameter of reference type is
2202 mangled incorrectly:
2203 @smallexample
2204 extern int N;
2205 template <int &> struct S @{@};
2206 void n (S<N>) @{2@}
2207 @end smallexample
2209 This is fixed in @option{-fabi-version=3}.
2211 @item
2212 SIMD vector types declared using @code{__attribute ((vector_size))} are
2213 mangled in a non-standard way that does not allow for overloading of
2214 functions taking vectors of different sizes.
2216 The mangling is changed in @option{-fabi-version=4}.
2217 @end itemize
2219 The known incompatibilities in @option{-fabi-version=1} include:
2221 @itemize @bullet
2223 @item
2224 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
2225 pack data into the same byte as a base class.  For example:
2227 @smallexample
2228 struct A @{ virtual void f(); int f1 : 1; @};
2229 struct B : public A @{ int f2 : 1; @};
2230 @end smallexample
2232 @noindent
2233 In this case, G++ will place @code{B::f2} into the same byte
2234 as@code{A::f1}; other compilers will not.  You can avoid this problem
2235 by explicitly padding @code{A} so that its size is a multiple of the
2236 byte size on your platform; that will cause G++ and other compilers to
2237 layout @code{B} identically.
2239 @item
2240 Incorrect handling of tail-padding for virtual bases.  G++ does not use
2241 tail padding when laying out virtual bases.  For example:
2243 @smallexample
2244 struct A @{ virtual void f(); char c1; @};
2245 struct B @{ B(); char c2; @};
2246 struct C : public A, public virtual B @{@};
2247 @end smallexample
2249 @noindent
2250 In this case, G++ will not place @code{B} into the tail-padding for
2251 @code{A}; other compilers will.  You can avoid this problem by
2252 explicitly padding @code{A} so that its size is a multiple of its
2253 alignment (ignoring virtual base classes); that will cause G++ and other
2254 compilers to layout @code{C} identically.
2256 @item
2257 Incorrect handling of bit-fields with declared widths greater than that
2258 of their underlying types, when the bit-fields appear in a union.  For
2259 example:
2261 @smallexample
2262 union U @{ int i : 4096; @};
2263 @end smallexample
2265 @noindent
2266 Assuming that an @code{int} does not have 4096 bits, G++ will make the
2267 union too small by the number of bits in an @code{int}.
2269 @item
2270 Empty classes can be placed at incorrect offsets.  For example:
2272 @smallexample
2273 struct A @{@};
2275 struct B @{
2276   A a;
2277   virtual void f ();
2280 struct C : public B, public A @{@};
2281 @end smallexample
2283 @noindent
2284 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2285 it should be placed at offset zero.  G++ mistakenly believes that the
2286 @code{A} data member of @code{B} is already at offset zero.
2288 @item
2289 Names of template functions whose types involve @code{typename} or
2290 template template parameters can be mangled incorrectly.
2292 @smallexample
2293 template <typename Q>
2294 void f(typename Q::X) @{@}
2296 template <template <typename> class Q>
2297 void f(typename Q<int>::X) @{@}
2298 @end smallexample
2300 @noindent
2301 Instantiations of these templates may be mangled incorrectly.
2303 @end itemize
2305 It also warns psABI related changes.  The known psABI changes at this
2306 point include:
2308 @itemize @bullet
2310 @item
2311 For SYSV/x86-64, when passing union with long double, it is changed to
2312 pass in memory as specified in psABI.  For example:
2314 @smallexample
2315 union U @{
2316   long double ld;
2317   int i;
2319 @end smallexample
2321 @noindent
2322 @code{union U} will always be passed in memory.
2324 @end itemize
2326 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2327 @opindex Wctor-dtor-privacy
2328 @opindex Wno-ctor-dtor-privacy
2329 Warn when a class seems unusable because all the constructors or
2330 destructors in that class are private, and it has neither friends nor
2331 public static member functions.
2333 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2334 @opindex Wnoexcept
2335 @opindex Wno-noexcept
2336 Warn when a noexcept-expression evaluates to false because of a call
2337 to a function that does not have a non-throwing exception
2338 specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2339 the compiler to never throw an exception.
2341 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2342 @opindex Wnon-virtual-dtor
2343 @opindex Wno-non-virtual-dtor
2344 Warn when a class has virtual functions and accessible non-virtual
2345 destructor, in which case it would be possible but unsafe to delete
2346 an instance of a derived class through a pointer to the base class.
2347 This warning is also enabled if -Weffc++ is specified.
2349 @item -Wreorder @r{(C++ and Objective-C++ only)}
2350 @opindex Wreorder
2351 @opindex Wno-reorder
2352 @cindex reordering, warning
2353 @cindex warning for reordering of member initializers
2354 Warn when the order of member initializers given in the code does not
2355 match the order in which they must be executed.  For instance:
2357 @smallexample
2358 struct A @{
2359   int i;
2360   int j;
2361   A(): j (0), i (1) @{ @}
2363 @end smallexample
2365 The compiler will rearrange the member initializers for @samp{i}
2366 and @samp{j} to match the declaration order of the members, emitting
2367 a warning to that effect.  This warning is enabled by @option{-Wall}.
2368 @end table
2370 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2372 @table @gcctabopt
2373 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2374 @opindex Weffc++
2375 @opindex Wno-effc++
2376 Warn about violations of the following style guidelines from Scott Meyers'
2377 @cite{Effective C++} book:
2379 @itemize @bullet
2380 @item
2381 Item 11:  Define a copy constructor and an assignment operator for classes
2382 with dynamically allocated memory.
2384 @item
2385 Item 12:  Prefer initialization to assignment in constructors.
2387 @item
2388 Item 14:  Make destructors virtual in base classes.
2390 @item
2391 Item 15:  Have @code{operator=} return a reference to @code{*this}.
2393 @item
2394 Item 23:  Don't try to return a reference when you must return an object.
2396 @end itemize
2398 Also warn about violations of the following style guidelines from
2399 Scott Meyers' @cite{More Effective C++} book:
2401 @itemize @bullet
2402 @item
2403 Item 6:  Distinguish between prefix and postfix forms of increment and
2404 decrement operators.
2406 @item
2407 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
2409 @end itemize
2411 When selecting this option, be aware that the standard library
2412 headers do not obey all of these guidelines; use @samp{grep -v}
2413 to filter out those warnings.
2415 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2416 @opindex Wstrict-null-sentinel
2417 @opindex Wno-strict-null-sentinel
2418 Warn also about the use of an uncasted @code{NULL} as sentinel.  When
2419 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2420 to @code{__null}.  Although it is a null pointer constant not a null pointer,
2421 it is guaranteed to be of the same size as a pointer.  But this use is
2422 not portable across different compilers.
2424 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2425 @opindex Wno-non-template-friend
2426 @opindex Wnon-template-friend
2427 Disable warnings when non-templatized friend functions are declared
2428 within a template.  Since the advent of explicit template specification
2429 support in G++, if the name of the friend is an unqualified-id (i.e.,
2430 @samp{friend foo(int)}), the C++ language specification demands that the
2431 friend declare or define an ordinary, nontemplate function.  (Section
2432 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
2433 could be interpreted as a particular specialization of a templatized
2434 function.  Because this non-conforming behavior is no longer the default
2435 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2436 check existing code for potential trouble spots and is on by default.
2437 This new compiler behavior can be turned off with
2438 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2439 but disables the helpful warning.
2441 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2442 @opindex Wold-style-cast
2443 @opindex Wno-old-style-cast
2444 Warn if an old-style (C-style) cast to a non-void type is used within
2445 a C++ program.  The new-style casts (@samp{dynamic_cast},
2446 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2447 less vulnerable to unintended effects and much easier to search for.
2449 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2450 @opindex Woverloaded-virtual
2451 @opindex Wno-overloaded-virtual
2452 @cindex overloaded virtual function, warning
2453 @cindex warning for overloaded virtual function
2454 Warn when a function declaration hides virtual functions from a
2455 base class.  For example, in:
2457 @smallexample
2458 struct A @{
2459   virtual void f();
2462 struct B: public A @{
2463   void f(int);
2465 @end smallexample
2467 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2468 like:
2470 @smallexample
2471 B* b;
2472 b->f();
2473 @end smallexample
2475 will fail to compile.
2477 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2478 @opindex Wno-pmf-conversions
2479 @opindex Wpmf-conversions
2480 Disable the diagnostic for converting a bound pointer to member function
2481 to a plain pointer.
2483 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2484 @opindex Wsign-promo
2485 @opindex Wno-sign-promo
2486 Warn when overload resolution chooses a promotion from unsigned or
2487 enumerated type to a signed type, over a conversion to an unsigned type of
2488 the same size.  Previous versions of G++ would try to preserve
2489 unsignedness, but the standard mandates the current behavior.
2491 @smallexample
2492 struct A @{
2493   operator int ();
2494   A& operator = (int);
2497 main ()
2499   A a,b;
2500   a = b;
2502 @end smallexample
2504 In this example, G++ will synthesize a default @samp{A& operator =
2505 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2506 @end table
2508 @node Objective-C and Objective-C++ Dialect Options
2509 @section Options Controlling Objective-C and Objective-C++ Dialects
2511 @cindex compiler options, Objective-C and Objective-C++
2512 @cindex Objective-C and Objective-C++ options, command line
2513 @cindex options, Objective-C and Objective-C++
2514 (NOTE: This manual does not describe the Objective-C and Objective-C++
2515 languages themselves.  @xref{Standards,,Language Standards
2516 Supported by GCC}, for references.)
2518 This section describes the command-line options that are only meaningful
2519 for Objective-C and Objective-C++ programs, but you can also use most of
2520 the language-independent GNU compiler options.
2521 For example, you might compile a file @code{some_class.m} like this:
2523 @smallexample
2524 gcc -g -fgnu-runtime -O -c some_class.m
2525 @end smallexample
2527 @noindent
2528 In this example, @option{-fgnu-runtime} is an option meant only for
2529 Objective-C and Objective-C++ programs; you can use the other options with
2530 any language supported by GCC@.
2532 Note that since Objective-C is an extension of the C language, Objective-C
2533 compilations may also use options specific to the C front-end (e.g.,
2534 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
2535 C++-specific options (e.g., @option{-Wabi}).
2537 Here is a list of options that are @emph{only} for compiling Objective-C
2538 and Objective-C++ programs:
2540 @table @gcctabopt
2541 @item -fconstant-string-class=@var{class-name}
2542 @opindex fconstant-string-class
2543 Use @var{class-name} as the name of the class to instantiate for each
2544 literal string specified with the syntax @code{@@"@dots{}"}.  The default
2545 class name is @code{NXConstantString} if the GNU runtime is being used, and
2546 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
2547 @option{-fconstant-cfstrings} option, if also present, will override the
2548 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2549 to be laid out as constant CoreFoundation strings.
2551 @item -fgnu-runtime
2552 @opindex fgnu-runtime
2553 Generate object code compatible with the standard GNU Objective-C
2554 runtime.  This is the default for most types of systems.
2556 @item -fnext-runtime
2557 @opindex fnext-runtime
2558 Generate output compatible with the NeXT runtime.  This is the default
2559 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
2560 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2561 used.
2563 @item -fno-nil-receivers
2564 @opindex fno-nil-receivers
2565 Assume that all Objective-C message dispatches (@code{[receiver
2566 message:arg]}) in this translation unit ensure that the receiver is
2567 not @code{nil}.  This allows for more efficient entry points in the
2568 runtime to be used.  This option is only available in conjunction with
2569 the NeXT runtime and ABI version 0 or 1.
2571 @item -fobjc-abi-version=@var{n}
2572 @opindex fobjc-abi-version
2573 Use version @var{n} of the Objective-C ABI for the selected runtime.
2574 This option is currently supported only for the NeXT runtime.  In that
2575 case, Version 0 is the traditional (32-bit) ABI without support for
2576 properties and other Objective-C 2.0 additions.  Version 1 is the
2577 traditional (32-bit) ABI with support for properties and other
2578 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
2579 nothing is specified, the default is Version 0 on 32-bit target
2580 machines, and Version 2 on 64-bit target machines.
2582 @item -fobjc-call-cxx-cdtors
2583 @opindex fobjc-call-cxx-cdtors
2584 For each Objective-C class, check if any of its instance variables is a
2585 C++ object with a non-trivial default constructor.  If so, synthesize a
2586 special @code{- (id) .cxx_construct} instance method that will run
2587 non-trivial default constructors on any such instance variables, in order,
2588 and then return @code{self}.  Similarly, check if any instance variable
2589 is a C++ object with a non-trivial destructor, and if so, synthesize a
2590 special @code{- (void) .cxx_destruct} method that will run
2591 all such default destructors, in reverse order.
2593 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2594 methods thusly generated will only operate on instance variables
2595 declared in the current Objective-C class, and not those inherited
2596 from superclasses.  It is the responsibility of the Objective-C
2597 runtime to invoke all such methods in an object's inheritance
2598 hierarchy.  The @code{- (id) .cxx_construct} methods will be invoked
2599 by the runtime immediately after a new object instance is allocated;
2600 the @code{- (void) .cxx_destruct} methods will be invoked immediately
2601 before the runtime deallocates an object instance.
2603 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2604 support for invoking the @code{- (id) .cxx_construct} and
2605 @code{- (void) .cxx_destruct} methods.
2607 @item -fobjc-direct-dispatch
2608 @opindex fobjc-direct-dispatch
2609 Allow fast jumps to the message dispatcher.  On Darwin this is
2610 accomplished via the comm page.
2612 @item -fobjc-exceptions
2613 @opindex fobjc-exceptions
2614 Enable syntactic support for structured exception handling in
2615 Objective-C, similar to what is offered by C++ and Java.  This option
2616 is required to use the Objective-C keywords @code{@@try},
2617 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2618 @code{@@synchronized}.  This option is available with both the GNU
2619 runtime and the NeXT runtime (but not available in conjunction with
2620 the NeXT runtime on Mac OS X 10.2 and earlier).
2622 @item -fobjc-gc
2623 @opindex fobjc-gc
2624 Enable garbage collection (GC) in Objective-C and Objective-C++
2625 programs.  This option is only available with the NeXT runtime; the
2626 GNU runtime has a different garbage collection implementation that
2627 does not require special compiler flags.
2629 @item -fobjc-nilcheck
2630 @opindex fobjc-nilcheck
2631 For the NeXT runtime with version 2 of the ABI, check for a nil
2632 receiver in method invocations before doing the actual method call.
2633 This is the default and can be disabled using
2634 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
2635 checked for nil in this way no matter what this flag is set to.
2636 Currently this flag does nothing when the GNU runtime, or an older
2637 version of the NeXT runtime ABI, is used.
2639 @item -fobjc-std=objc1
2640 @opindex fobjc-std
2641 Conform to the language syntax of Objective-C 1.0, the language
2642 recognized by GCC 4.0.  This only affects the Objective-C additions to
2643 the C/C++ language; it does not affect conformance to C/C++ standards,
2644 which is controlled by the separate C/C++ dialect option flags.  When
2645 this option is used with the Objective-C or Objective-C++ compiler,
2646 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2647 This is useful if you need to make sure that your Objective-C code can
2648 be compiled with older versions of GCC.
2650 @item -freplace-objc-classes
2651 @opindex freplace-objc-classes
2652 Emit a special marker instructing @command{ld(1)} not to statically link in
2653 the resulting object file, and allow @command{dyld(1)} to load it in at
2654 run time instead.  This is used in conjunction with the Fix-and-Continue
2655 debugging mode, where the object file in question may be recompiled and
2656 dynamically reloaded in the course of program execution, without the need
2657 to restart the program itself.  Currently, Fix-and-Continue functionality
2658 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2659 and later.
2661 @item -fzero-link
2662 @opindex fzero-link
2663 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2664 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2665 compile time) with static class references that get initialized at load time,
2666 which improves run-time performance.  Specifying the @option{-fzero-link} flag
2667 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2668 to be retained.  This is useful in Zero-Link debugging mode, since it allows
2669 for individual class implementations to be modified during program execution.
2670 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2671 regardless of command line options.
2673 @item -gen-decls
2674 @opindex gen-decls
2675 Dump interface declarations for all classes seen in the source file to a
2676 file named @file{@var{sourcename}.decl}.
2678 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2679 @opindex Wassign-intercept
2680 @opindex Wno-assign-intercept
2681 Warn whenever an Objective-C assignment is being intercepted by the
2682 garbage collector.
2684 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2685 @opindex Wno-protocol
2686 @opindex Wprotocol
2687 If a class is declared to implement a protocol, a warning is issued for
2688 every method in the protocol that is not implemented by the class.  The
2689 default behavior is to issue a warning for every method not explicitly
2690 implemented in the class, even if a method implementation is inherited
2691 from the superclass.  If you use the @option{-Wno-protocol} option, then
2692 methods inherited from the superclass are considered to be implemented,
2693 and no warning is issued for them.
2695 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2696 @opindex Wselector
2697 @opindex Wno-selector
2698 Warn if multiple methods of different types for the same selector are
2699 found during compilation.  The check is performed on the list of methods
2700 in the final stage of compilation.  Additionally, a check is performed
2701 for each selector appearing in a @code{@@selector(@dots{})}
2702 expression, and a corresponding method for that selector has been found
2703 during compilation.  Because these checks scan the method table only at
2704 the end of compilation, these warnings are not produced if the final
2705 stage of compilation is not reached, for example because an error is
2706 found during compilation, or because the @option{-fsyntax-only} option is
2707 being used.
2709 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2710 @opindex Wstrict-selector-match
2711 @opindex Wno-strict-selector-match
2712 Warn if multiple methods with differing argument and/or return types are
2713 found for a given selector when attempting to send a message using this
2714 selector to a receiver of type @code{id} or @code{Class}.  When this flag
2715 is off (which is the default behavior), the compiler will omit such warnings
2716 if any differences found are confined to types which share the same size
2717 and alignment.
2719 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2720 @opindex Wundeclared-selector
2721 @opindex Wno-undeclared-selector
2722 Warn if a @code{@@selector(@dots{})} expression referring to an
2723 undeclared selector is found.  A selector is considered undeclared if no
2724 method with that name has been declared before the
2725 @code{@@selector(@dots{})} expression, either explicitly in an
2726 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2727 an @code{@@implementation} section.  This option always performs its
2728 checks as soon as a @code{@@selector(@dots{})} expression is found,
2729 while @option{-Wselector} only performs its checks in the final stage of
2730 compilation.  This also enforces the coding style convention
2731 that methods and selectors must be declared before being used.
2733 @item -print-objc-runtime-info
2734 @opindex print-objc-runtime-info
2735 Generate C header describing the largest structure that is passed by
2736 value, if any.
2738 @end table
2740 @node Language Independent Options
2741 @section Options to Control Diagnostic Messages Formatting
2742 @cindex options to control diagnostics formatting
2743 @cindex diagnostic messages
2744 @cindex message formatting
2746 Traditionally, diagnostic messages have been formatted irrespective of
2747 the output device's aspect (e.g.@: its width, @dots{}).  The options described
2748 below can be used to control the diagnostic messages formatting
2749 algorithm, e.g.@: how many characters per line, how often source location
2750 information should be reported.  Right now, only the C++ front end can
2751 honor these options.  However it is expected, in the near future, that
2752 the remaining front ends would be able to digest them correctly.
2754 @table @gcctabopt
2755 @item -fmessage-length=@var{n}
2756 @opindex fmessage-length
2757 Try to format error messages so that they fit on lines of about @var{n}
2758 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2759 the front ends supported by GCC@.  If @var{n} is zero, then no
2760 line-wrapping will be done; each error message will appear on a single
2761 line.
2763 @opindex fdiagnostics-show-location
2764 @item -fdiagnostics-show-location=once
2765 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2766 reporter to emit @emph{once} source location information; that is, in
2767 case the message is too long to fit on a single physical line and has to
2768 be wrapped, the source location won't be emitted (as prefix) again,
2769 over and over, in subsequent continuation lines.  This is the default
2770 behavior.
2772 @item -fdiagnostics-show-location=every-line
2773 Only meaningful in line-wrapping mode.  Instructs the diagnostic
2774 messages reporter to emit the same source location information (as
2775 prefix) for physical lines that result from the process of breaking
2776 a message which is too long to fit on a single line.
2778 @item -fno-diagnostics-show-option
2779 @opindex fno-diagnostics-show-option
2780 @opindex fdiagnostics-show-option
2781 By default, each diagnostic emitted includes text which indicates the
2782 command line option that directly controls the diagnostic (if such an
2783 option is known to the diagnostic machinery).  Specifying the
2784 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
2786 @item -Wcoverage-mismatch
2787 @opindex Wcoverage-mismatch
2788 Warn if feedback profiles do not match when using the
2789 @option{-fprofile-use} option.
2790 If a source file was changed between @option{-fprofile-gen} and
2791 @option{-fprofile-use}, the files with the profile feedback can fail
2792 to match the source file and GCC can not use the profile feedback
2793 information.  By default, this warning is enabled and is treated as an
2794 error.  @option{-Wno-coverage-mismatch} can be used to disable the
2795 warning or @option{-Wno-error=coverage-mismatch} can be used to
2796 disable the error.  Disable the error for this warning can result in
2797 poorly optimized code, so disabling the error is useful only in the
2798 case of very minor changes such as bug fixes to an existing code-base.
2799 Completely disabling the warning is not recommended.
2801 @end table
2803 @node Warning Options
2804 @section Options to Request or Suppress Warnings
2805 @cindex options to control warnings
2806 @cindex warning messages
2807 @cindex messages, warning
2808 @cindex suppressing warnings
2810 Warnings are diagnostic messages that report constructions which
2811 are not inherently erroneous but which are risky or suggest there
2812 may have been an error.
2814 The following language-independent options do not enable specific
2815 warnings but control the kinds of diagnostics produced by GCC.
2817 @table @gcctabopt
2818 @cindex syntax checking
2819 @item -fsyntax-only
2820 @opindex fsyntax-only
2821 Check the code for syntax errors, but don't do anything beyond that.
2823 @item -fmax-errors=@var{n}
2824 @opindex fmax-errors
2825 Limits the maximum number of error messages to @var{n}, at which point
2826 GCC bails out rather than attempting to continue processing the source
2827 code.  If @var{n} is 0 (the default), there is no limit on the number
2828 of error messages produced.  If @option{-Wfatal-errors} is also
2829 specified, then @option{-Wfatal-errors} takes precedence over this
2830 option.
2832 @item -w
2833 @opindex w
2834 Inhibit all warning messages.
2836 @item -Werror
2837 @opindex Werror
2838 @opindex Wno-error
2839 Make all warnings into errors.
2841 @item -Werror=
2842 @opindex Werror=
2843 @opindex Wno-error=
2844 Make the specified warning into an error.  The specifier for a warning
2845 is appended, for example @option{-Werror=switch} turns the warnings
2846 controlled by @option{-Wswitch} into errors.  This switch takes a
2847 negative form, to be used to negate @option{-Werror} for specific
2848 warnings, for example @option{-Wno-error=switch} makes
2849 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
2850 is in effect.
2852 The warning message for each controllable warning includes the
2853 option which controls the warning.  That option can then be used with
2854 @option{-Werror=} and @option{-Wno-error=} as described above.
2855 (Printing of the option in the warning message can be disabled using the
2856 @option{-fno-diagnostics-show-option} flag.)
2858 Note that specifying @option{-Werror=}@var{foo} automatically implies
2859 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
2860 imply anything.
2862 @item -Wfatal-errors
2863 @opindex Wfatal-errors
2864 @opindex Wno-fatal-errors
2865 This option causes the compiler to abort compilation on the first error
2866 occurred rather than trying to keep going and printing further error
2867 messages.
2869 @end table
2871 You can request many specific warnings with options beginning
2872 @samp{-W}, for example @option{-Wimplicit} to request warnings on
2873 implicit declarations.  Each of these specific warning options also
2874 has a negative form beginning @samp{-Wno-} to turn off warnings; for
2875 example, @option{-Wno-implicit}.  This manual lists only one of the
2876 two forms, whichever is not the default.  For further,
2877 language-specific options also refer to @ref{C++ Dialect Options} and
2878 @ref{Objective-C and Objective-C++ Dialect Options}.
2880 When an unrecognized warning option is requested (e.g.,
2881 @option{-Wunknown-warning}), GCC will emit a diagnostic stating
2882 that the option is not recognized.  However, if the @option{-Wno-} form
2883 is used, the behavior is slightly different: No diagnostic will be
2884 produced for @option{-Wno-unknown-warning} unless other diagnostics
2885 are being produced.  This allows the use of new @option{-Wno-} options
2886 with old compilers, but if something goes wrong, the compiler will
2887 warn that an unrecognized option was used.
2889 @table @gcctabopt
2890 @item -pedantic
2891 @opindex pedantic
2892 Issue all the warnings demanded by strict ISO C and ISO C++;
2893 reject all programs that use forbidden extensions, and some other
2894 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2895 version of the ISO C standard specified by any @option{-std} option used.
2897 Valid ISO C and ISO C++ programs should compile properly with or without
2898 this option (though a rare few will require @option{-ansi} or a
2899 @option{-std} option specifying the required version of ISO C)@.  However,
2900 without this option, certain GNU extensions and traditional C and C++
2901 features are supported as well.  With this option, they are rejected.
2903 @option{-pedantic} does not cause warning messages for use of the
2904 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2905 warnings are also disabled in the expression that follows
2906 @code{__extension__}.  However, only system header files should use
2907 these escape routes; application programs should avoid them.
2908 @xref{Alternate Keywords}.
2910 Some users try to use @option{-pedantic} to check programs for strict ISO
2911 C conformance.  They soon find that it does not do quite what they want:
2912 it finds some non-ISO practices, but not all---only those for which
2913 ISO C @emph{requires} a diagnostic, and some others for which
2914 diagnostics have been added.
2916 A feature to report any failure to conform to ISO C might be useful in
2917 some instances, but would require considerable additional work and would
2918 be quite different from @option{-pedantic}.  We don't have plans to
2919 support such a feature in the near future.
2921 Where the standard specified with @option{-std} represents a GNU
2922 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
2923 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2924 extended dialect is based.  Warnings from @option{-pedantic} are given
2925 where they are required by the base standard.  (It would not make sense
2926 for such warnings to be given only for features not in the specified GNU
2927 C dialect, since by definition the GNU dialects of C include all
2928 features the compiler supports with the given option, and there would be
2929 nothing to warn about.)
2931 @item -pedantic-errors
2932 @opindex pedantic-errors
2933 Like @option{-pedantic}, except that errors are produced rather than
2934 warnings.
2936 @item -Wall
2937 @opindex Wall
2938 @opindex Wno-all
2939 This enables all the warnings about constructions that some users
2940 consider questionable, and that are easy to avoid (or modify to
2941 prevent the warning), even in conjunction with macros.  This also
2942 enables some language-specific warnings described in @ref{C++ Dialect
2943 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2945 @option{-Wall} turns on the following warning flags:
2947 @gccoptlist{-Waddress   @gol
2948 -Warray-bounds @r{(only with} @option{-O2}@r{)}  @gol
2949 -Wc++0x-compat  @gol
2950 -Wchar-subscripts  @gol
2951 -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
2952 -Wimplicit-int @r{(C and Objective-C only)} @gol
2953 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
2954 -Wcomment  @gol
2955 -Wformat   @gol
2956 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
2957 -Wmissing-braces  @gol
2958 -Wnonnull  @gol
2959 -Wparentheses  @gol
2960 -Wpointer-sign  @gol
2961 -Wreorder   @gol
2962 -Wreturn-type  @gol
2963 -Wsequence-point  @gol
2964 -Wsign-compare @r{(only in C++)}  @gol
2965 -Wstrict-aliasing  @gol
2966 -Wstrict-overflow=1  @gol
2967 -Wswitch  @gol
2968 -Wtrigraphs  @gol
2969 -Wuninitialized  @gol
2970 -Wunknown-pragmas  @gol
2971 -Wunused-function  @gol
2972 -Wunused-label     @gol
2973 -Wunused-value     @gol
2974 -Wunused-variable  @gol
2975 -Wvolatile-register-var @gol
2978 Note that some warning flags are not implied by @option{-Wall}.  Some of
2979 them warn about constructions that users generally do not consider
2980 questionable, but which occasionally you might wish to check for;
2981 others warn about constructions that are necessary or hard to avoid in
2982 some cases, and there is no simple way to modify the code to suppress
2983 the warning. Some of them are enabled by @option{-Wextra} but many of
2984 them must be enabled individually.
2986 @item -Wextra
2987 @opindex W
2988 @opindex Wextra
2989 @opindex Wno-extra
2990 This enables some extra warning flags that are not enabled by
2991 @option{-Wall}. (This option used to be called @option{-W}.  The older
2992 name is still supported, but the newer name is more descriptive.)
2994 @gccoptlist{-Wclobbered  @gol
2995 -Wempty-body  @gol
2996 -Wignored-qualifiers @gol
2997 -Wmissing-field-initializers  @gol
2998 -Wmissing-parameter-type @r{(C only)}  @gol
2999 -Wold-style-declaration @r{(C only)}  @gol
3000 -Woverride-init  @gol
3001 -Wsign-compare  @gol
3002 -Wtype-limits  @gol
3003 -Wuninitialized  @gol
3004 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3005 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}  @gol
3008 The option @option{-Wextra} also prints warning messages for the
3009 following cases:
3011 @itemize @bullet
3013 @item
3014 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3015 @samp{>}, or @samp{>=}.
3017 @item
3018 (C++ only) An enumerator and a non-enumerator both appear in a
3019 conditional expression.
3021 @item
3022 (C++ only) Ambiguous virtual bases.
3024 @item
3025 (C++ only) Subscripting an array which has been declared @samp{register}.
3027 @item
3028 (C++ only) Taking the address of a variable which has been declared
3029 @samp{register}.
3031 @item
3032 (C++ only) A base class is not initialized in a derived class' copy
3033 constructor.
3035 @end itemize
3037 @item -Wchar-subscripts
3038 @opindex Wchar-subscripts
3039 @opindex Wno-char-subscripts
3040 Warn if an array subscript has type @code{char}.  This is a common cause
3041 of error, as programmers often forget that this type is signed on some
3042 machines.
3043 This warning is enabled by @option{-Wall}.
3045 @item -Wcomment
3046 @opindex Wcomment
3047 @opindex Wno-comment
3048 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3049 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3050 This warning is enabled by @option{-Wall}.
3052 @item -Wno-cpp
3053 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3055 Suppress warning messages emitted by @code{#warning} directives.
3057 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3058 @opindex Wdouble-promotion
3059 @opindex Wno-double-promotion
3060 Give a warning when a value of type @code{float} is implicitly
3061 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
3062 floating-point unit implement @code{float} in hardware, but emulate
3063 @code{double} in software.  On such a machine, doing computations
3064 using @code{double} values is much more expensive because of the
3065 overhead required for software emulation.  
3067 It is easy to accidentally do computations with @code{double} because
3068 floating-point literals are implicitly of type @code{double}.  For
3069 example, in:
3070 @smallexample
3071 @group
3072 float area(float radius)
3074    return 3.14159 * radius * radius;        
3076 @end group
3077 @end smallexample
3078 the compiler will perform the entire computation with @code{double}
3079 because the floating-point literal is a @code{double}.
3081 @item -Wformat
3082 @opindex Wformat
3083 @opindex Wno-format
3084 @opindex ffreestanding
3085 @opindex fno-builtin
3086 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3087 the arguments supplied have types appropriate to the format string
3088 specified, and that the conversions specified in the format string make
3089 sense.  This includes standard functions, and others specified by format
3090 attributes (@pxref{Function Attributes}), in the @code{printf},
3091 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3092 not in the C standard) families (or other target-specific families).
3093 Which functions are checked without format attributes having been
3094 specified depends on the standard version selected, and such checks of
3095 functions without the attribute specified are disabled by
3096 @option{-ffreestanding} or @option{-fno-builtin}.
3098 The formats are checked against the format features supported by GNU
3099 libc version 2.2.  These include all ISO C90 and C99 features, as well
3100 as features from the Single Unix Specification and some BSD and GNU
3101 extensions.  Other library implementations may not support all these
3102 features; GCC does not support warning about features that go beyond a
3103 particular library's limitations.  However, if @option{-pedantic} is used
3104 with @option{-Wformat}, warnings will be given about format features not
3105 in the selected standard version (but not for @code{strfmon} formats,
3106 since those are not in any version of the C standard).  @xref{C Dialect
3107 Options,,Options Controlling C Dialect}.
3109 Since @option{-Wformat} also checks for null format arguments for
3110 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
3112 @option{-Wformat} is included in @option{-Wall}.  For more control over some
3113 aspects of format checking, the options @option{-Wformat-y2k},
3114 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
3115 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
3116 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
3118 @item -Wformat-y2k
3119 @opindex Wformat-y2k
3120 @opindex Wno-format-y2k
3121 If @option{-Wformat} is specified, also warn about @code{strftime}
3122 formats which may yield only a two-digit year.
3124 @item -Wno-format-contains-nul
3125 @opindex Wno-format-contains-nul
3126 @opindex Wformat-contains-nul
3127 If @option{-Wformat} is specified, do not warn about format strings that
3128 contain NUL bytes.
3130 @item -Wno-format-extra-args
3131 @opindex Wno-format-extra-args
3132 @opindex Wformat-extra-args
3133 If @option{-Wformat} is specified, do not warn about excess arguments to a
3134 @code{printf} or @code{scanf} format function.  The C standard specifies
3135 that such arguments are ignored.
3137 Where the unused arguments lie between used arguments that are
3138 specified with @samp{$} operand number specifications, normally
3139 warnings are still given, since the implementation could not know what
3140 type to pass to @code{va_arg} to skip the unused arguments.  However,
3141 in the case of @code{scanf} formats, this option will suppress the
3142 warning if the unused arguments are all pointers, since the Single
3143 Unix Specification says that such unused arguments are allowed.
3145 @item -Wno-format-zero-length @r{(C and Objective-C only)}
3146 @opindex Wno-format-zero-length
3147 @opindex Wformat-zero-length
3148 If @option{-Wformat} is specified, do not warn about zero-length formats.
3149 The C standard specifies that zero-length formats are allowed.
3151 @item -Wformat-nonliteral
3152 @opindex Wformat-nonliteral
3153 @opindex Wno-format-nonliteral
3154 If @option{-Wformat} is specified, also warn if the format string is not a
3155 string literal and so cannot be checked, unless the format function
3156 takes its format arguments as a @code{va_list}.
3158 @item -Wformat-security
3159 @opindex Wformat-security
3160 @opindex Wno-format-security
3161 If @option{-Wformat} is specified, also warn about uses of format
3162 functions that represent possible security problems.  At present, this
3163 warns about calls to @code{printf} and @code{scanf} functions where the
3164 format string is not a string literal and there are no format arguments,
3165 as in @code{printf (foo);}.  This may be a security hole if the format
3166 string came from untrusted input and contains @samp{%n}.  (This is
3167 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3168 in future warnings may be added to @option{-Wformat-security} that are not
3169 included in @option{-Wformat-nonliteral}.)
3171 @item -Wformat=2
3172 @opindex Wformat=2
3173 @opindex Wno-format=2
3174 Enable @option{-Wformat} plus format checks not included in
3175 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
3176 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
3178 @item -Wnonnull @r{(C and Objective-C only)}
3179 @opindex Wnonnull
3180 @opindex Wno-nonnull
3181 Warn about passing a null pointer for arguments marked as
3182 requiring a non-null value by the @code{nonnull} function attribute.
3184 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
3185 can be disabled with the @option{-Wno-nonnull} option.
3187 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3188 @opindex Winit-self
3189 @opindex Wno-init-self
3190 Warn about uninitialized variables which are initialized with themselves.
3191 Note this option can only be used with the @option{-Wuninitialized} option.
3193 For example, GCC will warn about @code{i} being uninitialized in the
3194 following snippet only when @option{-Winit-self} has been specified:
3195 @smallexample
3196 @group
3197 int f()
3199   int i = i;
3200   return i;
3202 @end group
3203 @end smallexample
3205 @item -Wimplicit-int @r{(C and Objective-C only)}
3206 @opindex Wimplicit-int
3207 @opindex Wno-implicit-int
3208 Warn when a declaration does not specify a type.
3209 This warning is enabled by @option{-Wall}.
3211 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3212 @opindex Wimplicit-function-declaration
3213 @opindex Wno-implicit-function-declaration
3214 Give a warning whenever a function is used before being declared. In
3215 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3216 enabled by default and it is made into an error by
3217 @option{-pedantic-errors}. This warning is also enabled by
3218 @option{-Wall}.
3220 @item -Wimplicit @r{(C and Objective-C only)}
3221 @opindex Wimplicit
3222 @opindex Wno-implicit
3223 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3224 This warning is enabled by @option{-Wall}.
3226 @item -Wignored-qualifiers @r{(C and C++ only)}
3227 @opindex Wignored-qualifiers
3228 @opindex Wno-ignored-qualifiers
3229 Warn if the return type of a function has a type qualifier
3230 such as @code{const}.  For ISO C such a type qualifier has no effect,
3231 since the value returned by a function is not an lvalue.
3232 For C++, the warning is only emitted for scalar types or @code{void}.
3233 ISO C prohibits qualified @code{void} return types on function
3234 definitions, so such return types always receive a warning
3235 even without this option.
3237 This warning is also enabled by @option{-Wextra}.
3239 @item -Wmain
3240 @opindex Wmain
3241 @opindex Wno-main
3242 Warn if the type of @samp{main} is suspicious.  @samp{main} should be
3243 a function with external linkage, returning int, taking either zero
3244 arguments, two, or three arguments of appropriate types.  This warning
3245 is enabled by default in C++ and is enabled by either @option{-Wall}
3246 or @option{-pedantic}.
3248 @item -Wmissing-braces
3249 @opindex Wmissing-braces
3250 @opindex Wno-missing-braces
3251 Warn if an aggregate or union initializer is not fully bracketed.  In
3252 the following example, the initializer for @samp{a} is not fully
3253 bracketed, but that for @samp{b} is fully bracketed.
3255 @smallexample
3256 int a[2][2] = @{ 0, 1, 2, 3 @};
3257 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3258 @end smallexample
3260 This warning is enabled by @option{-Wall}.
3262 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3263 @opindex Wmissing-include-dirs
3264 @opindex Wno-missing-include-dirs
3265 Warn if a user-supplied include directory does not exist.
3267 @item -Wparentheses
3268 @opindex Wparentheses
3269 @opindex Wno-parentheses
3270 Warn if parentheses are omitted in certain contexts, such
3271 as when there is an assignment in a context where a truth value
3272 is expected, or when operators are nested whose precedence people
3273 often get confused about.
3275 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3276 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3277 interpretation from that of ordinary mathematical notation.
3279 Also warn about constructions where there may be confusion to which
3280 @code{if} statement an @code{else} branch belongs.  Here is an example of
3281 such a case:
3283 @smallexample
3284 @group
3286   if (a)
3287     if (b)
3288       foo ();
3289   else
3290     bar ();
3292 @end group
3293 @end smallexample
3295 In C/C++, every @code{else} branch belongs to the innermost possible
3296 @code{if} statement, which in this example is @code{if (b)}.  This is
3297 often not what the programmer expected, as illustrated in the above
3298 example by indentation the programmer chose.  When there is the
3299 potential for this confusion, GCC will issue a warning when this flag
3300 is specified.  To eliminate the warning, add explicit braces around
3301 the innermost @code{if} statement so there is no way the @code{else}
3302 could belong to the enclosing @code{if}.  The resulting code would
3303 look like this:
3305 @smallexample
3306 @group
3308   if (a)
3309     @{
3310       if (b)
3311         foo ();
3312       else
3313         bar ();
3314     @}
3316 @end group
3317 @end smallexample
3319 Also warn for dangerous uses of the 
3320 ?: with omitted middle operand GNU extension. When the condition
3321 in the ?: operator is a boolean expression the omitted value will
3322 be always 1. Often the user expects it to be a value computed
3323 inside the conditional expression instead. 
3325 This warning is enabled by @option{-Wall}.
3327 @item -Wsequence-point
3328 @opindex Wsequence-point
3329 @opindex Wno-sequence-point
3330 Warn about code that may have undefined semantics because of violations
3331 of sequence point rules in the C and C++ standards.
3333 The C and C++ standards defines the order in which expressions in a C/C++
3334 program are evaluated in terms of @dfn{sequence points}, which represent
3335 a partial ordering between the execution of parts of the program: those
3336 executed before the sequence point, and those executed after it.  These
3337 occur after the evaluation of a full expression (one which is not part
3338 of a larger expression), after the evaluation of the first operand of a
3339 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3340 function is called (but after the evaluation of its arguments and the
3341 expression denoting the called function), and in certain other places.
3342 Other than as expressed by the sequence point rules, the order of
3343 evaluation of subexpressions of an expression is not specified.  All
3344 these rules describe only a partial order rather than a total order,
3345 since, for example, if two functions are called within one expression
3346 with no sequence point between them, the order in which the functions
3347 are called is not specified.  However, the standards committee have
3348 ruled that function calls do not overlap.
3350 It is not specified when between sequence points modifications to the
3351 values of objects take effect.  Programs whose behavior depends on this
3352 have undefined behavior; the C and C++ standards specify that ``Between
3353 the previous and next sequence point an object shall have its stored
3354 value modified at most once by the evaluation of an expression.
3355 Furthermore, the prior value shall be read only to determine the value
3356 to be stored.''.  If a program breaks these rules, the results on any
3357 particular implementation are entirely unpredictable.
3359 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3360 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
3361 diagnosed by this option, and it may give an occasional false positive
3362 result, but in general it has been found fairly effective at detecting
3363 this sort of problem in programs.
3365 The standard is worded confusingly, therefore there is some debate
3366 over the precise meaning of the sequence point rules in subtle cases.
3367 Links to discussions of the problem, including proposed formal
3368 definitions, may be found on the GCC readings page, at
3369 @uref{http://gcc.gnu.org/@/readings.html}.
3371 This warning is enabled by @option{-Wall} for C and C++.
3373 @item -Wreturn-type
3374 @opindex Wreturn-type
3375 @opindex Wno-return-type
3376 Warn whenever a function is defined with a return-type that defaults
3377 to @code{int}.  Also warn about any @code{return} statement with no
3378 return-value in a function whose return-type is not @code{void}
3379 (falling off the end of the function body is considered returning
3380 without a value), and about a @code{return} statement with an
3381 expression in a function whose return-type is @code{void}.
3383 For C++, a function without return type always produces a diagnostic
3384 message, even when @option{-Wno-return-type} is specified.  The only
3385 exceptions are @samp{main} and functions defined in system headers.
3387 This warning is enabled by @option{-Wall}.
3389 @item -Wswitch
3390 @opindex Wswitch
3391 @opindex Wno-switch
3392 Warn whenever a @code{switch} statement has an index of enumerated type
3393 and lacks a @code{case} for one or more of the named codes of that
3394 enumeration.  (The presence of a @code{default} label prevents this
3395 warning.)  @code{case} labels outside the enumeration range also
3396 provoke warnings when this option is used (even if there is a
3397 @code{default} label).
3398 This warning is enabled by @option{-Wall}.
3400 @item -Wswitch-default
3401 @opindex Wswitch-default
3402 @opindex Wno-switch-default
3403 Warn whenever a @code{switch} statement does not have a @code{default}
3404 case.
3406 @item -Wswitch-enum
3407 @opindex Wswitch-enum
3408 @opindex Wno-switch-enum
3409 Warn whenever a @code{switch} statement has an index of enumerated type
3410 and lacks a @code{case} for one or more of the named codes of that
3411 enumeration.  @code{case} labels outside the enumeration range also
3412 provoke warnings when this option is used.  The only difference
3413 between @option{-Wswitch} and this option is that this option gives a
3414 warning about an omitted enumeration code even if there is a
3415 @code{default} label.
3417 @item -Wsync-nand @r{(C and C++ only)}
3418 @opindex Wsync-nand
3419 @opindex Wno-sync-nand
3420 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3421 built-in functions are used.  These functions changed semantics in GCC 4.4.
3423 @item -Wtrigraphs
3424 @opindex Wtrigraphs
3425 @opindex Wno-trigraphs
3426 Warn if any trigraphs are encountered that might change the meaning of
3427 the program (trigraphs within comments are not warned about).
3428 This warning is enabled by @option{-Wall}.
3430 @item -Wunused-but-set-parameter
3431 @opindex Wunused-but-set-parameter
3432 @opindex Wno-unused-but-set-parameter
3433 Warn whenever a function parameter is assigned to, but otherwise unused
3434 (aside from its declaration).
3436 To suppress this warning use the @samp{unused} attribute
3437 (@pxref{Variable Attributes}).
3439 This warning is also enabled by @option{-Wunused} together with
3440 @option{-Wextra}.
3442 @item -Wunused-but-set-variable
3443 @opindex Wunused-but-set-variable
3444 @opindex Wno-unused-but-set-variable
3445 Warn whenever a local variable is assigned to, but otherwise unused
3446 (aside from its declaration).
3447 This warning is enabled by @option{-Wall}.
3449 To suppress this warning use the @samp{unused} attribute
3450 (@pxref{Variable Attributes}).
3452 This warning is also enabled by @option{-Wunused}, which is enabled
3453 by @option{-Wall}.
3455 @item -Wunused-function
3456 @opindex Wunused-function
3457 @opindex Wno-unused-function
3458 Warn whenever a static function is declared but not defined or a
3459 non-inline static function is unused.
3460 This warning is enabled by @option{-Wall}.
3462 @item -Wunused-label
3463 @opindex Wunused-label
3464 @opindex Wno-unused-label
3465 Warn whenever a label is declared but not used.
3466 This warning is enabled by @option{-Wall}.
3468 To suppress this warning use the @samp{unused} attribute
3469 (@pxref{Variable Attributes}).
3471 @item -Wunused-parameter
3472 @opindex Wunused-parameter
3473 @opindex Wno-unused-parameter
3474 Warn whenever a function parameter is unused aside from its declaration.
3476 To suppress this warning use the @samp{unused} attribute
3477 (@pxref{Variable Attributes}).
3479 @item -Wno-unused-result
3480 @opindex Wunused-result
3481 @opindex Wno-unused-result
3482 Do not warn if a caller of a function marked with attribute
3483 @code{warn_unused_result} (@pxref{Variable Attributes}) does not use
3484 its return value. The default is @option{-Wunused-result}.
3486 @item -Wunused-variable
3487 @opindex Wunused-variable
3488 @opindex Wno-unused-variable
3489 Warn whenever a local variable or non-constant static variable is unused
3490 aside from its declaration.
3491 This warning is enabled by @option{-Wall}.
3493 To suppress this warning use the @samp{unused} attribute
3494 (@pxref{Variable Attributes}).
3496 @item -Wunused-value
3497 @opindex Wunused-value
3498 @opindex Wno-unused-value
3499 Warn whenever a statement computes a result that is explicitly not
3500 used. To suppress this warning cast the unused expression to
3501 @samp{void}. This includes an expression-statement or the left-hand
3502 side of a comma expression that contains no side effects. For example,
3503 an expression such as @samp{x[i,j]} will cause a warning, while
3504 @samp{x[(void)i,j]} will not.
3506 This warning is enabled by @option{-Wall}.
3508 @item -Wunused
3509 @opindex Wunused
3510 @opindex Wno-unused
3511 All the above @option{-Wunused} options combined.
3513 In order to get a warning about an unused function parameter, you must
3514 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3515 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3517 @item -Wuninitialized
3518 @opindex Wuninitialized
3519 @opindex Wno-uninitialized
3520 Warn if an automatic variable is used without first being initialized
3521 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3522 warn if a non-static reference or non-static @samp{const} member
3523 appears in a class without constructors.
3525 If you want to warn about code which uses the uninitialized value of the
3526 variable in its own initializer, use the @option{-Winit-self} option.
3528 These warnings occur for individual uninitialized or clobbered
3529 elements of structure, union or array variables as well as for
3530 variables which are uninitialized or clobbered as a whole.  They do
3531 not occur for variables or elements declared @code{volatile}.  Because
3532 these warnings depend on optimization, the exact variables or elements
3533 for which there are warnings will depend on the precise optimization
3534 options and version of GCC used.
3536 Note that there may be no warning about a variable that is used only
3537 to compute a value that itself is never used, because such
3538 computations may be deleted by data flow analysis before the warnings
3539 are printed.
3541 These warnings are made optional because GCC is not smart
3542 enough to see all the reasons why the code might be correct
3543 despite appearing to have an error.  Here is one example of how
3544 this can happen:
3546 @smallexample
3547 @group
3549   int x;
3550   switch (y)
3551     @{
3552     case 1: x = 1;
3553       break;
3554     case 2: x = 4;
3555       break;
3556     case 3: x = 5;
3557     @}
3558   foo (x);
3560 @end group
3561 @end smallexample
3563 @noindent
3564 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3565 always initialized, but GCC doesn't know this.  Here is
3566 another common case:
3568 @smallexample
3570   int save_y;
3571   if (change_y) save_y = y, y = new_y;
3572   @dots{}
3573   if (change_y) y = save_y;
3575 @end smallexample
3577 @noindent
3578 This has no bug because @code{save_y} is used only if it is set.
3580 @cindex @code{longjmp} warnings
3581 This option also warns when a non-volatile automatic variable might be
3582 changed by a call to @code{longjmp}.  These warnings as well are possible
3583 only in optimizing compilation.
3585 The compiler sees only the calls to @code{setjmp}.  It cannot know
3586 where @code{longjmp} will be called; in fact, a signal handler could
3587 call it at any point in the code.  As a result, you may get a warning
3588 even when there is in fact no problem because @code{longjmp} cannot
3589 in fact be called at the place which would cause a problem.
3591 Some spurious warnings can be avoided if you declare all the functions
3592 you use that never return as @code{noreturn}.  @xref{Function
3593 Attributes}.
3595 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3597 @item -Wunknown-pragmas
3598 @opindex Wunknown-pragmas
3599 @opindex Wno-unknown-pragmas
3600 @cindex warning for unknown pragmas
3601 @cindex unknown pragmas, warning
3602 @cindex pragmas, warning of unknown
3603 Warn when a #pragma directive is encountered which is not understood by
3604 GCC@.  If this command line option is used, warnings will even be issued
3605 for unknown pragmas in system header files.  This is not the case if
3606 the warnings were only enabled by the @option{-Wall} command line option.
3608 @item -Wno-pragmas
3609 @opindex Wno-pragmas
3610 @opindex Wpragmas
3611 Do not warn about misuses of pragmas, such as incorrect parameters,
3612 invalid syntax, or conflicts between pragmas.  See also
3613 @samp{-Wunknown-pragmas}.
3615 @item -Wstrict-aliasing
3616 @opindex Wstrict-aliasing
3617 @opindex Wno-strict-aliasing
3618 This option is only active when @option{-fstrict-aliasing} is active.
3619 It warns about code which might break the strict aliasing rules that the
3620 compiler is using for optimization.  The warning does not catch all
3621 cases, but does attempt to catch the more common pitfalls.  It is
3622 included in @option{-Wall}.
3623 It is equivalent to @option{-Wstrict-aliasing=3}
3625 @item -Wstrict-aliasing=n
3626 @opindex Wstrict-aliasing=n
3627 @opindex Wno-strict-aliasing=n
3628 This option is only active when @option{-fstrict-aliasing} is active.
3629 It warns about code which might break the strict aliasing rules that the
3630 compiler is using for optimization.
3631 Higher levels correspond to higher accuracy (fewer false positives).
3632 Higher levels also correspond to more effort, similar to the way -O works.
3633 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3634 with n=3.
3636 Level 1: Most aggressive, quick, least accurate.
3637 Possibly useful when higher levels
3638 do not warn but -fstrict-aliasing still breaks the code, as it has very few
3639 false negatives.  However, it has many false positives.
3640 Warns for all pointer conversions between possibly incompatible types,
3641 even if never dereferenced.  Runs in the frontend only.
3643 Level 2: Aggressive, quick, not too precise.
3644 May still have many false positives (not as many as level 1 though),
3645 and few false negatives (but possibly more than level 1).
3646 Unlike level 1, it only warns when an address is taken.  Warns about
3647 incomplete types.  Runs in the frontend only.
3649 Level 3 (default for @option{-Wstrict-aliasing}):
3650 Should have very few false positives and few false
3651 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
3652 Takes care of the common pun+dereference pattern in the frontend:
3653 @code{*(int*)&some_float}.
3654 If optimization is enabled, it also runs in the backend, where it deals
3655 with multiple statement cases using flow-sensitive points-to information.
3656 Only warns when the converted pointer is dereferenced.
3657 Does not warn about incomplete types.
3659 @item -Wstrict-overflow
3660 @itemx -Wstrict-overflow=@var{n}
3661 @opindex Wstrict-overflow
3662 @opindex Wno-strict-overflow
3663 This option is only active when @option{-fstrict-overflow} is active.
3664 It warns about cases where the compiler optimizes based on the
3665 assumption that signed overflow does not occur.  Note that it does not
3666 warn about all cases where the code might overflow: it only warns
3667 about cases where the compiler implements some optimization.  Thus
3668 this warning depends on the optimization level.
3670 An optimization which assumes that signed overflow does not occur is
3671 perfectly safe if the values of the variables involved are such that
3672 overflow never does, in fact, occur.  Therefore this warning can
3673 easily give a false positive: a warning about code which is not
3674 actually a problem.  To help focus on important issues, several
3675 warning levels are defined.  No warnings are issued for the use of
3676 undefined signed overflow when estimating how many iterations a loop
3677 will require, in particular when determining whether a loop will be
3678 executed at all.
3680 @table @gcctabopt
3681 @item -Wstrict-overflow=1
3682 Warn about cases which are both questionable and easy to avoid.  For
3683 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3684 compiler will simplify this to @code{1}.  This level of
3685 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3686 are not, and must be explicitly requested.
3688 @item -Wstrict-overflow=2
3689 Also warn about other cases where a comparison is simplified to a
3690 constant.  For example: @code{abs (x) >= 0}.  This can only be
3691 simplified when @option{-fstrict-overflow} is in effect, because
3692 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3693 zero.  @option{-Wstrict-overflow} (with no level) is the same as
3694 @option{-Wstrict-overflow=2}.
3696 @item -Wstrict-overflow=3
3697 Also warn about other cases where a comparison is simplified.  For
3698 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3700 @item -Wstrict-overflow=4
3701 Also warn about other simplifications not covered by the above cases.
3702 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3704 @item -Wstrict-overflow=5
3705 Also warn about cases where the compiler reduces the magnitude of a
3706 constant involved in a comparison.  For example: @code{x + 2 > y} will
3707 be simplified to @code{x + 1 >= y}.  This is reported only at the
3708 highest warning level because this simplification applies to many
3709 comparisons, so this warning level will give a very large number of
3710 false positives.
3711 @end table
3713 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]}
3714 @opindex Wsuggest-attribute=
3715 @opindex Wno-suggest-attribute=
3716 Warn for cases where adding an attribute may be beneficial. The
3717 attributes currently supported are listed below.
3719 @table @gcctabopt
3720 @item -Wsuggest-attribute=pure
3721 @itemx -Wsuggest-attribute=const
3722 @itemx -Wsuggest-attribute=noreturn
3723 @opindex Wsuggest-attribute=pure
3724 @opindex Wno-suggest-attribute=pure
3725 @opindex Wsuggest-attribute=const
3726 @opindex Wno-suggest-attribute=const
3727 @opindex Wsuggest-attribute=noreturn
3728 @opindex Wno-suggest-attribute=noreturn
3730 Warn about functions which might be candidates for attributes
3731 @code{pure}, @code{const} or @code{noreturn}.  The compiler only warns for
3732 functions visible in other compilation units or (in the case of @code{pure} and
3733 @code{const}) if it cannot prove that the function returns normally. A function
3734 returns normally if it doesn't contain an infinite loop nor returns abnormally
3735 by throwing, calling @code{abort()} or trapping.  This analysis requires option
3736 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
3737 higher.  Higher optimization levels improve the accuracy of the analysis.
3738 @end table
3740 @item -Warray-bounds
3741 @opindex Wno-array-bounds
3742 @opindex Warray-bounds
3743 This option is only active when @option{-ftree-vrp} is active
3744 (default for @option{-O2} and above). It warns about subscripts to arrays
3745 that are always out of bounds. This warning is enabled by @option{-Wall}.
3747 @item -Wno-div-by-zero
3748 @opindex Wno-div-by-zero
3749 @opindex Wdiv-by-zero
3750 Do not warn about compile-time integer division by zero.  Floating point
3751 division by zero is not warned about, as it can be a legitimate way of
3752 obtaining infinities and NaNs.
3754 @item -Wsystem-headers
3755 @opindex Wsystem-headers
3756 @opindex Wno-system-headers
3757 @cindex warnings from system headers
3758 @cindex system headers, warnings from
3759 Print warning messages for constructs found in system header files.
3760 Warnings from system headers are normally suppressed, on the assumption
3761 that they usually do not indicate real problems and would only make the
3762 compiler output harder to read.  Using this command line option tells
3763 GCC to emit warnings from system headers as if they occurred in user
3764 code.  However, note that using @option{-Wall} in conjunction with this
3765 option will @emph{not} warn about unknown pragmas in system
3766 headers---for that, @option{-Wunknown-pragmas} must also be used.
3768 @item -Wtrampolines
3769 @opindex Wtrampolines
3770 @opindex Wno-trampolines
3771  Warn about trampolines generated for pointers to nested functions.
3773  A trampoline is a small piece of data or code that is created at run
3774  time on the stack when the address of a nested function is taken, and
3775  is used to call the nested function indirectly.  For some targets, it
3776  is made up of data only and thus requires no special treatment.  But,
3777  for most targets, it is made up of code and thus requires the stack
3778  to be made executable in order for the program to work properly.
3780 @item -Wfloat-equal
3781 @opindex Wfloat-equal
3782 @opindex Wno-float-equal
3783 Warn if floating point values are used in equality comparisons.
3785 The idea behind this is that sometimes it is convenient (for the
3786 programmer) to consider floating-point values as approximations to
3787 infinitely precise real numbers.  If you are doing this, then you need
3788 to compute (by analyzing the code, or in some other way) the maximum or
3789 likely maximum error that the computation introduces, and allow for it
3790 when performing comparisons (and when producing output, but that's a
3791 different problem).  In particular, instead of testing for equality, you
3792 would check to see whether the two values have ranges that overlap; and
3793 this is done with the relational operators, so equality comparisons are
3794 probably mistaken.
3796 @item -Wtraditional @r{(C and Objective-C only)}
3797 @opindex Wtraditional
3798 @opindex Wno-traditional
3799 Warn about certain constructs that behave differently in traditional and
3800 ISO C@.  Also warn about ISO C constructs that have no traditional C
3801 equivalent, and/or problematic constructs which should be avoided.
3803 @itemize @bullet
3804 @item
3805 Macro parameters that appear within string literals in the macro body.
3806 In traditional C macro replacement takes place within string literals,
3807 but does not in ISO C@.
3809 @item
3810 In traditional C, some preprocessor directives did not exist.
3811 Traditional preprocessors would only consider a line to be a directive
3812 if the @samp{#} appeared in column 1 on the line.  Therefore
3813 @option{-Wtraditional} warns about directives that traditional C
3814 understands but would ignore because the @samp{#} does not appear as the
3815 first character on the line.  It also suggests you hide directives like
3816 @samp{#pragma} not understood by traditional C by indenting them.  Some
3817 traditional implementations would not recognize @samp{#elif}, so it
3818 suggests avoiding it altogether.
3820 @item
3821 A function-like macro that appears without arguments.
3823 @item
3824 The unary plus operator.
3826 @item
3827 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3828 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
3829 constants.)  Note, these suffixes appear in macros defined in the system
3830 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3831 Use of these macros in user code might normally lead to spurious
3832 warnings, however GCC's integrated preprocessor has enough context to
3833 avoid warning in these cases.
3835 @item
3836 A function declared external in one block and then used after the end of
3837 the block.
3839 @item
3840 A @code{switch} statement has an operand of type @code{long}.
3842 @item
3843 A non-@code{static} function declaration follows a @code{static} one.
3844 This construct is not accepted by some traditional C compilers.
3846 @item
3847 The ISO type of an integer constant has a different width or
3848 signedness from its traditional type.  This warning is only issued if
3849 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
3850 typically represent bit patterns, are not warned about.
3852 @item
3853 Usage of ISO string concatenation is detected.
3855 @item
3856 Initialization of automatic aggregates.
3858 @item
3859 Identifier conflicts with labels.  Traditional C lacks a separate
3860 namespace for labels.
3862 @item
3863 Initialization of unions.  If the initializer is zero, the warning is
3864 omitted.  This is done under the assumption that the zero initializer in
3865 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3866 initializer warnings and relies on default initialization to zero in the
3867 traditional C case.
3869 @item
3870 Conversions by prototypes between fixed/floating point values and vice
3871 versa.  The absence of these prototypes when compiling with traditional
3872 C would cause serious problems.  This is a subset of the possible
3873 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3875 @item
3876 Use of ISO C style function definitions.  This warning intentionally is
3877 @emph{not} issued for prototype declarations or variadic functions
3878 because these ISO C features will appear in your code when using
3879 libiberty's traditional C compatibility macros, @code{PARAMS} and
3880 @code{VPARAMS}.  This warning is also bypassed for nested functions
3881 because that feature is already a GCC extension and thus not relevant to
3882 traditional C compatibility.
3883 @end itemize
3885 @item -Wtraditional-conversion @r{(C and Objective-C only)}
3886 @opindex Wtraditional-conversion
3887 @opindex Wno-traditional-conversion
3888 Warn if a prototype causes a type conversion that is different from what
3889 would happen to the same argument in the absence of a prototype.  This
3890 includes conversions of fixed point to floating and vice versa, and
3891 conversions changing the width or signedness of a fixed point argument
3892 except when the same as the default promotion.
3894 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
3895 @opindex Wdeclaration-after-statement
3896 @opindex Wno-declaration-after-statement
3897 Warn when a declaration is found after a statement in a block.  This
3898 construct, known from C++, was introduced with ISO C99 and is by default
3899 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
3900 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
3902 @item -Wundef
3903 @opindex Wundef
3904 @opindex Wno-undef
3905 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3907 @item -Wno-endif-labels
3908 @opindex Wno-endif-labels
3909 @opindex Wendif-labels
3910 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3912 @item -Wshadow
3913 @opindex Wshadow
3914 @opindex Wno-shadow
3915 Warn whenever a local variable or type declaration shadows another variable,
3916 parameter, type, or class member (in C++), or whenever a built-in function
3917 is shadowed. Note that in C++, the compiler will not warn if a local variable
3918 shadows a struct/class/enum, but will warn if it shadows an explicit typedef.
3920 @item -Wlarger-than=@var{len}
3921 @opindex Wlarger-than=@var{len}
3922 @opindex Wlarger-than-@var{len}
3923 Warn whenever an object of larger than @var{len} bytes is defined.
3925 @item -Wframe-larger-than=@var{len}
3926 @opindex Wframe-larger-than
3927 Warn if the size of a function frame is larger than @var{len} bytes.
3928 The computation done to determine the stack frame size is approximate
3929 and not conservative.
3930 The actual requirements may be somewhat greater than @var{len}
3931 even if you do not get a warning.  In addition, any space allocated
3932 via @code{alloca}, variable-length arrays, or related constructs
3933 is not included by the compiler when determining
3934 whether or not to issue a warning.
3936 @item -Wunsafe-loop-optimizations
3937 @opindex Wunsafe-loop-optimizations
3938 @opindex Wno-unsafe-loop-optimizations
3939 Warn if the loop cannot be optimized because the compiler could not
3940 assume anything on the bounds of the loop indices.  With
3941 @option{-funsafe-loop-optimizations} warn if the compiler made
3942 such assumptions.
3944 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
3945 @opindex Wno-pedantic-ms-format
3946 @opindex Wpedantic-ms-format
3947 Disables the warnings about non-ISO @code{printf} / @code{scanf} format
3948 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
3949 depending on the MS runtime, when you are using the options @option{-Wformat}
3950 and @option{-pedantic} without gnu-extensions.
3952 @item -Wpointer-arith
3953 @opindex Wpointer-arith
3954 @opindex Wno-pointer-arith
3955 Warn about anything that depends on the ``size of'' a function type or
3956 of @code{void}.  GNU C assigns these types a size of 1, for
3957 convenience in calculations with @code{void *} pointers and pointers
3958 to functions.  In C++, warn also when an arithmetic operation involves
3959 @code{NULL}.  This warning is also enabled by @option{-pedantic}.
3961 @item -Wtype-limits
3962 @opindex Wtype-limits
3963 @opindex Wno-type-limits
3964 Warn if a comparison is always true or always false due to the limited
3965 range of the data type, but do not warn for constant expressions.  For
3966 example, warn if an unsigned variable is compared against zero with
3967 @samp{<} or @samp{>=}.  This warning is also enabled by
3968 @option{-Wextra}.
3970 @item -Wbad-function-cast @r{(C and Objective-C only)}
3971 @opindex Wbad-function-cast
3972 @opindex Wno-bad-function-cast
3973 Warn whenever a function call is cast to a non-matching type.
3974 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3976 @item -Wc++-compat @r{(C and Objective-C only)}
3977 Warn about ISO C constructs that are outside of the common subset of
3978 ISO C and ISO C++, e.g.@: request for implicit conversion from
3979 @code{void *} to a pointer to non-@code{void} type.
3981 @item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3982 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3983 ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
3984 in ISO C++ 200x.  This warning is enabled by @option{-Wall}.
3986 @item -Wcast-qual
3987 @opindex Wcast-qual
3988 @opindex Wno-cast-qual
3989 Warn whenever a pointer is cast so as to remove a type qualifier from
3990 the target type.  For example, warn if a @code{const char *} is cast
3991 to an ordinary @code{char *}.
3993 Also warn when making a cast which introduces a type qualifier in an
3994 unsafe way.  For example, casting @code{char **} to @code{const char **}
3995 is unsafe, as in this example:
3997 @smallexample
3998   /* p is char ** value.  */
3999   const char **q = (const char **) p;
4000   /* Assignment of readonly string to const char * is OK.  */
4001   *q = "string";
4002   /* Now char** pointer points to read-only memory.  */
4003   **p = 'b';
4004 @end smallexample
4006 @item -Wcast-align
4007 @opindex Wcast-align
4008 @opindex Wno-cast-align
4009 Warn whenever a pointer is cast such that the required alignment of the
4010 target is increased.  For example, warn if a @code{char *} is cast to
4011 an @code{int *} on machines where integers can only be accessed at
4012 two- or four-byte boundaries.
4014 @item -Wwrite-strings
4015 @opindex Wwrite-strings
4016 @opindex Wno-write-strings
4017 When compiling C, give string constants the type @code{const
4018 char[@var{length}]} so that copying the address of one into a
4019 non-@code{const} @code{char *} pointer will get a warning.  These
4020 warnings will help you find at compile time code that can try to write
4021 into a string constant, but only if you have been very careful about
4022 using @code{const} in declarations and prototypes.  Otherwise, it will
4023 just be a nuisance. This is why we did not make @option{-Wall} request
4024 these warnings.
4026 When compiling C++, warn about the deprecated conversion from string
4027 literals to @code{char *}.  This warning is enabled by default for C++
4028 programs.
4030 @item -Wclobbered
4031 @opindex Wclobbered
4032 @opindex Wno-clobbered
4033 Warn for variables that might be changed by @samp{longjmp} or
4034 @samp{vfork}.  This warning is also enabled by @option{-Wextra}.
4036 @item -Wconversion
4037 @opindex Wconversion
4038 @opindex Wno-conversion
4039 Warn for implicit conversions that may alter a value. This includes
4040 conversions between real and integer, like @code{abs (x)} when
4041 @code{x} is @code{double}; conversions between signed and unsigned,
4042 like @code{unsigned ui = -1}; and conversions to smaller types, like
4043 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4044 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4045 changed by the conversion like in @code{abs (2.0)}.  Warnings about
4046 conversions between signed and unsigned integers can be disabled by
4047 using @option{-Wno-sign-conversion}.
4049 For C++, also warn for confusing overload resolution for user-defined
4050 conversions; and conversions that will never use a type conversion
4051 operator: conversions to @code{void}, the same type, a base class or a
4052 reference to them. Warnings about conversions between signed and
4053 unsigned integers are disabled by default in C++ unless
4054 @option{-Wsign-conversion} is explicitly enabled.
4056 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4057 @opindex Wconversion-null
4058 @opindex Wno-conversion-null
4059 Do not warn for conversions between @code{NULL} and non-pointer
4060 types. @option{-Wconversion-null} is enabled by default.
4062 @item -Wempty-body
4063 @opindex Wempty-body
4064 @opindex Wno-empty-body
4065 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
4066 while} statement.  This warning is also enabled by @option{-Wextra}.
4068 @item -Wenum-compare
4069 @opindex Wenum-compare
4070 @opindex Wno-enum-compare
4071 Warn about a comparison between values of different enum types. In C++
4072 this warning is enabled by default.  In C this warning is enabled by
4073 @option{-Wall}.
4075 @item -Wjump-misses-init @r{(C, Objective-C only)}
4076 @opindex Wjump-misses-init
4077 @opindex Wno-jump-misses-init
4078 Warn if a @code{goto} statement or a @code{switch} statement jumps
4079 forward across the initialization of a variable, or jumps backward to a
4080 label after the variable has been initialized.  This only warns about
4081 variables which are initialized when they are declared.  This warning is
4082 only supported for C and Objective C; in C++ this sort of branch is an
4083 error in any case.
4085 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
4086 can be disabled with the @option{-Wno-jump-misses-init} option.
4088 @item -Wsign-compare
4089 @opindex Wsign-compare
4090 @opindex Wno-sign-compare
4091 @cindex warning for comparison of signed and unsigned values
4092 @cindex comparison of signed and unsigned values, warning
4093 @cindex signed and unsigned values, comparison warning
4094 Warn when a comparison between signed and unsigned values could produce
4095 an incorrect result when the signed value is converted to unsigned.
4096 This warning is also enabled by @option{-Wextra}; to get the other warnings
4097 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
4099 @item -Wsign-conversion
4100 @opindex Wsign-conversion
4101 @opindex Wno-sign-conversion
4102 Warn for implicit conversions that may change the sign of an integer
4103 value, like assigning a signed integer expression to an unsigned
4104 integer variable. An explicit cast silences the warning. In C, this
4105 option is enabled also by @option{-Wconversion}.
4107 @item -Waddress
4108 @opindex Waddress
4109 @opindex Wno-address
4110 Warn about suspicious uses of memory addresses. These include using
4111 the address of a function in a conditional expression, such as
4112 @code{void func(void); if (func)}, and comparisons against the memory
4113 address of a string literal, such as @code{if (x == "abc")}.  Such
4114 uses typically indicate a programmer error: the address of a function
4115 always evaluates to true, so their use in a conditional usually
4116 indicate that the programmer forgot the parentheses in a function
4117 call; and comparisons against string literals result in unspecified
4118 behavior and are not portable in C, so they usually indicate that the
4119 programmer intended to use @code{strcmp}.  This warning is enabled by
4120 @option{-Wall}.
4122 @item -Wlogical-op
4123 @opindex Wlogical-op
4124 @opindex Wno-logical-op
4125 Warn about suspicious uses of logical operators in expressions.
4126 This includes using logical operators in contexts where a
4127 bit-wise operator is likely to be expected.
4129 @item -Waggregate-return
4130 @opindex Waggregate-return
4131 @opindex Wno-aggregate-return
4132 Warn if any functions that return structures or unions are defined or
4133 called.  (In languages where you can return an array, this also elicits
4134 a warning.)
4136 @item -Wno-attributes
4137 @opindex Wno-attributes
4138 @opindex Wattributes
4139 Do not warn if an unexpected @code{__attribute__} is used, such as
4140 unrecognized attributes, function attributes applied to variables,
4141 etc.  This will not stop errors for incorrect use of supported
4142 attributes.
4144 @item -Wno-builtin-macro-redefined
4145 @opindex Wno-builtin-macro-redefined
4146 @opindex Wbuiltin-macro-redefined
4147 Do not warn if certain built-in macros are redefined.  This suppresses
4148 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4149 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4151 @item -Wstrict-prototypes @r{(C and Objective-C only)}
4152 @opindex Wstrict-prototypes
4153 @opindex Wno-strict-prototypes
4154 Warn if a function is declared or defined without specifying the
4155 argument types.  (An old-style function definition is permitted without
4156 a warning if preceded by a declaration which specifies the argument
4157 types.)
4159 @item -Wold-style-declaration @r{(C and Objective-C only)}
4160 @opindex Wold-style-declaration
4161 @opindex Wno-old-style-declaration
4162 Warn for obsolescent usages, according to the C Standard, in a
4163 declaration. For example, warn if storage-class specifiers like
4164 @code{static} are not the first things in a declaration.  This warning
4165 is also enabled by @option{-Wextra}.
4167 @item -Wold-style-definition @r{(C and Objective-C only)}
4168 @opindex Wold-style-definition
4169 @opindex Wno-old-style-definition
4170 Warn if an old-style function definition is used.  A warning is given
4171 even if there is a previous prototype.
4173 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
4174 @opindex Wmissing-parameter-type
4175 @opindex Wno-missing-parameter-type
4176 A function parameter is declared without a type specifier in K&R-style
4177 functions:
4179 @smallexample
4180 void foo(bar) @{ @}
4181 @end smallexample
4183 This warning is also enabled by @option{-Wextra}.
4185 @item -Wmissing-prototypes @r{(C and Objective-C only)}
4186 @opindex Wmissing-prototypes
4187 @opindex Wno-missing-prototypes
4188 Warn if a global function is defined without a previous prototype
4189 declaration.  This warning is issued even if the definition itself
4190 provides a prototype.  The aim is to detect global functions that fail
4191 to be declared in header files.
4193 @item -Wmissing-declarations
4194 @opindex Wmissing-declarations
4195 @opindex Wno-missing-declarations
4196 Warn if a global function is defined without a previous declaration.
4197 Do so even if the definition itself provides a prototype.
4198 Use this option to detect global functions that are not declared in
4199 header files.  In C++, no warnings are issued for function templates,
4200 or for inline functions, or for functions in anonymous namespaces.
4202 @item -Wmissing-field-initializers
4203 @opindex Wmissing-field-initializers
4204 @opindex Wno-missing-field-initializers
4205 @opindex W
4206 @opindex Wextra
4207 @opindex Wno-extra
4208 Warn if a structure's initializer has some fields missing.  For
4209 example, the following code would cause such a warning, because
4210 @code{x.h} is implicitly zero:
4212 @smallexample
4213 struct s @{ int f, g, h; @};
4214 struct s x = @{ 3, 4 @};
4215 @end smallexample
4217 This option does not warn about designated initializers, so the following
4218 modification would not trigger a warning:
4220 @smallexample
4221 struct s @{ int f, g, h; @};
4222 struct s x = @{ .f = 3, .g = 4 @};
4223 @end smallexample
4225 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
4226 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
4228 @item -Wmissing-format-attribute
4229 @opindex Wmissing-format-attribute
4230 @opindex Wno-missing-format-attribute
4231 @opindex Wformat
4232 @opindex Wno-format
4233 Warn about function pointers which might be candidates for @code{format}
4234 attributes.  Note these are only possible candidates, not absolute ones.
4235 GCC will guess that function pointers with @code{format} attributes that
4236 are used in assignment, initialization, parameter passing or return
4237 statements should have a corresponding @code{format} attribute in the
4238 resulting type.  I.e.@: the left-hand side of the assignment or
4239 initialization, the type of the parameter variable, or the return type
4240 of the containing function respectively should also have a @code{format}
4241 attribute to avoid the warning.
4243 GCC will also warn about function definitions which might be
4244 candidates for @code{format} attributes.  Again, these are only
4245 possible candidates.  GCC will guess that @code{format} attributes
4246 might be appropriate for any function that calls a function like
4247 @code{vprintf} or @code{vscanf}, but this might not always be the
4248 case, and some functions for which @code{format} attributes are
4249 appropriate may not be detected.
4251 @item -Wno-multichar
4252 @opindex Wno-multichar
4253 @opindex Wmultichar
4254 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4255 Usually they indicate a typo in the user's code, as they have
4256 implementation-defined values, and should not be used in portable code.
4258 @item -Wnormalized=<none|id|nfc|nfkc>
4259 @opindex Wnormalized=
4260 @cindex NFC
4261 @cindex NFKC
4262 @cindex character set, input normalization
4263 In ISO C and ISO C++, two identifiers are different if they are
4264 different sequences of characters.  However, sometimes when characters
4265 outside the basic ASCII character set are used, you can have two
4266 different character sequences that look the same.  To avoid confusion,
4267 the ISO 10646 standard sets out some @dfn{normalization rules} which
4268 when applied ensure that two sequences that look the same are turned into
4269 the same sequence.  GCC can warn you if you are using identifiers which
4270 have not been normalized; this option controls that warning.
4272 There are four levels of warning that GCC supports.  The default is
4273 @option{-Wnormalized=nfc}, which warns about any identifier which is
4274 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
4275 recommended form for most uses.
4277 Unfortunately, there are some characters which ISO C and ISO C++ allow
4278 in identifiers that when turned into NFC aren't allowable as
4279 identifiers.  That is, there's no way to use these symbols in portable
4280 ISO C or C++ and have all your identifiers in NFC@.
4281 @option{-Wnormalized=id} suppresses the warning for these characters.
4282 It is hoped that future versions of the standards involved will correct
4283 this, which is why this option is not the default.
4285 You can switch the warning off for all characters by writing
4286 @option{-Wnormalized=none}.  You would only want to do this if you
4287 were using some other normalization scheme (like ``D''), because
4288 otherwise you can easily create bugs that are literally impossible to see.
4290 Some characters in ISO 10646 have distinct meanings but look identical
4291 in some fonts or display methodologies, especially once formatting has
4292 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4293 LETTER N'', will display just like a regular @code{n} which has been
4294 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
4295 normalization scheme to convert all these into a standard form as
4296 well, and GCC will warn if your code is not in NFKC if you use
4297 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
4298 about every identifier that contains the letter O because it might be
4299 confused with the digit 0, and so is not the default, but may be
4300 useful as a local coding convention if the programming environment is
4301 unable to be fixed to display these characters distinctly.
4303 @item -Wno-deprecated
4304 @opindex Wno-deprecated
4305 @opindex Wdeprecated
4306 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
4308 @item -Wno-deprecated-declarations
4309 @opindex Wno-deprecated-declarations
4310 @opindex Wdeprecated-declarations
4311 Do not warn about uses of functions (@pxref{Function Attributes}),
4312 variables (@pxref{Variable Attributes}), and types (@pxref{Type
4313 Attributes}) marked as deprecated by using the @code{deprecated}
4314 attribute.
4316 @item -Wno-overflow
4317 @opindex Wno-overflow
4318 @opindex Woverflow
4319 Do not warn about compile-time overflow in constant expressions.
4321 @item -Woverride-init @r{(C and Objective-C only)}
4322 @opindex Woverride-init
4323 @opindex Wno-override-init
4324 @opindex W
4325 @opindex Wextra
4326 @opindex Wno-extra
4327 Warn if an initialized field without side effects is overridden when
4328 using designated initializers (@pxref{Designated Inits, , Designated
4329 Initializers}).
4331 This warning is included in @option{-Wextra}.  To get other
4332 @option{-Wextra} warnings without this one, use @samp{-Wextra
4333 -Wno-override-init}.
4335 @item -Wpacked
4336 @opindex Wpacked
4337 @opindex Wno-packed
4338 Warn if a structure is given the packed attribute, but the packed
4339 attribute has no effect on the layout or size of the structure.
4340 Such structures may be mis-aligned for little benefit.  For
4341 instance, in this code, the variable @code{f.x} in @code{struct bar}
4342 will be misaligned even though @code{struct bar} does not itself
4343 have the packed attribute:
4345 @smallexample
4346 @group
4347 struct foo @{
4348   int x;
4349   char a, b, c, d;
4350 @} __attribute__((packed));
4351 struct bar @{
4352   char z;
4353   struct foo f;
4355 @end group
4356 @end smallexample
4358 @item -Wpacked-bitfield-compat
4359 @opindex Wpacked-bitfield-compat
4360 @opindex Wno-packed-bitfield-compat
4361 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4362 on bit-fields of type @code{char}.  This has been fixed in GCC 4.4 but
4363 the change can lead to differences in the structure layout.  GCC
4364 informs you when the offset of such a field has changed in GCC 4.4.
4365 For example there is no longer a 4-bit padding between field @code{a}
4366 and @code{b} in this structure:
4368 @smallexample
4369 struct foo
4371   char a:4;
4372   char b:8;
4373 @} __attribute__ ((packed));
4374 @end smallexample
4376 This warning is enabled by default.  Use
4377 @option{-Wno-packed-bitfield-compat} to disable this warning.
4379 @item -Wpadded
4380 @opindex Wpadded
4381 @opindex Wno-padded
4382 Warn if padding is included in a structure, either to align an element
4383 of the structure or to align the whole structure.  Sometimes when this
4384 happens it is possible to rearrange the fields of the structure to
4385 reduce the padding and so make the structure smaller.
4387 @item -Wredundant-decls
4388 @opindex Wredundant-decls
4389 @opindex Wno-redundant-decls
4390 Warn if anything is declared more than once in the same scope, even in
4391 cases where multiple declaration is valid and changes nothing.
4393 @item -Wnested-externs @r{(C and Objective-C only)}
4394 @opindex Wnested-externs
4395 @opindex Wno-nested-externs
4396 Warn if an @code{extern} declaration is encountered within a function.
4398 @item -Winline
4399 @opindex Winline
4400 @opindex Wno-inline
4401 Warn if a function can not be inlined and it was declared as inline.
4402 Even with this option, the compiler will not warn about failures to
4403 inline functions declared in system headers.
4405 The compiler uses a variety of heuristics to determine whether or not
4406 to inline a function.  For example, the compiler takes into account
4407 the size of the function being inlined and the amount of inlining
4408 that has already been done in the current function.  Therefore,
4409 seemingly insignificant changes in the source program can cause the
4410 warnings produced by @option{-Winline} to appear or disappear.
4412 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4413 @opindex Wno-invalid-offsetof
4414 @opindex Winvalid-offsetof
4415 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4416 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
4417 to a non-POD type is undefined.  In existing C++ implementations,
4418 however, @samp{offsetof} typically gives meaningful results even when
4419 applied to certain kinds of non-POD types. (Such as a simple
4420 @samp{struct} that fails to be a POD type only by virtue of having a
4421 constructor.)  This flag is for users who are aware that they are
4422 writing nonportable code and who have deliberately chosen to ignore the
4423 warning about it.
4425 The restrictions on @samp{offsetof} may be relaxed in a future version
4426 of the C++ standard.
4428 @item -Wno-int-to-pointer-cast
4429 @opindex Wno-int-to-pointer-cast
4430 @opindex Wint-to-pointer-cast
4431 Suppress warnings from casts to pointer type of an integer of a
4432 different size. In C++, casting to a pointer type of smaller size is
4433 an error. @option{Wint-to-pointer-cast} is enabled by default.
4436 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4437 @opindex Wno-pointer-to-int-cast
4438 @opindex Wpointer-to-int-cast
4439 Suppress warnings from casts from a pointer to an integer type of a
4440 different size.
4442 @item -Winvalid-pch
4443 @opindex Winvalid-pch
4444 @opindex Wno-invalid-pch
4445 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4446 the search path but can't be used.
4448 @item -Wlong-long
4449 @opindex Wlong-long
4450 @opindex Wno-long-long
4451 Warn if @samp{long long} type is used.  This is enabled by either
4452 @option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4453 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
4455 @item -Wvariadic-macros
4456 @opindex Wvariadic-macros
4457 @opindex Wno-variadic-macros
4458 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4459 alternate syntax when in pedantic ISO C99 mode.  This is default.
4460 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4462 @item -Wvla
4463 @opindex Wvla
4464 @opindex Wno-vla
4465 Warn if variable length array is used in the code.
4466 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
4467 the variable length array.
4469 @item -Wvolatile-register-var
4470 @opindex Wvolatile-register-var
4471 @opindex Wno-volatile-register-var
4472 Warn if a register variable is declared volatile.  The volatile
4473 modifier does not inhibit all optimizations that may eliminate reads
4474 and/or writes to register variables.  This warning is enabled by
4475 @option{-Wall}.
4477 @item -Wdisabled-optimization
4478 @opindex Wdisabled-optimization
4479 @opindex Wno-disabled-optimization
4480 Warn if a requested optimization pass is disabled.  This warning does
4481 not generally indicate that there is anything wrong with your code; it
4482 merely indicates that GCC's optimizers were unable to handle the code
4483 effectively.  Often, the problem is that your code is too big or too
4484 complex; GCC will refuse to optimize programs when the optimization
4485 itself is likely to take inordinate amounts of time.
4487 @item -Wpointer-sign @r{(C and Objective-C only)}
4488 @opindex Wpointer-sign
4489 @opindex Wno-pointer-sign
4490 Warn for pointer argument passing or assignment with different signedness.
4491 This option is only supported for C and Objective-C@.  It is implied by
4492 @option{-Wall} and by @option{-pedantic}, which can be disabled with
4493 @option{-Wno-pointer-sign}.
4495 @item -Wstack-protector
4496 @opindex Wstack-protector
4497 @opindex Wno-stack-protector
4498 This option is only active when @option{-fstack-protector} is active.  It
4499 warns about functions that will not be protected against stack smashing.
4501 @item -Wno-mudflap
4502 @opindex Wno-mudflap
4503 Suppress warnings about constructs that cannot be instrumented by
4504 @option{-fmudflap}.
4506 @item -Woverlength-strings
4507 @opindex Woverlength-strings
4508 @opindex Wno-overlength-strings
4509 Warn about string constants which are longer than the ``minimum
4510 maximum'' length specified in the C standard.  Modern compilers
4511 generally allow string constants which are much longer than the
4512 standard's minimum limit, but very portable programs should avoid
4513 using longer strings.
4515 The limit applies @emph{after} string constant concatenation, and does
4516 not count the trailing NUL@.  In C90, the limit was 509 characters; in
4517 C99, it was raised to 4095.  C++98 does not specify a normative
4518 minimum maximum, so we do not diagnose overlength strings in C++@.
4520 This option is implied by @option{-pedantic}, and can be disabled with
4521 @option{-Wno-overlength-strings}.
4523 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
4524 @opindex Wunsuffixed-float-constants
4526 GCC will issue a warning for any floating constant that does not have
4527 a suffix.  When used together with @option{-Wsystem-headers} it will
4528 warn about such constants in system header files.  This can be useful
4529 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4530 from the decimal floating-point extension to C99.
4531 @end table
4533 @node Debugging Options
4534 @section Options for Debugging Your Program or GCC
4535 @cindex options, debugging
4536 @cindex debugging information options
4538 GCC has various special options that are used for debugging
4539 either your program or GCC:
4541 @table @gcctabopt
4542 @item -g
4543 @opindex g
4544 Produce debugging information in the operating system's native format
4545 (stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
4546 information.
4548 On most systems that use stabs format, @option{-g} enables use of extra
4549 debugging information that only GDB can use; this extra information
4550 makes debugging work better in GDB but will probably make other debuggers
4551 crash or
4552 refuse to read the program.  If you want to control for certain whether
4553 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4554 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4556 GCC allows you to use @option{-g} with
4557 @option{-O}.  The shortcuts taken by optimized code may occasionally
4558 produce surprising results: some variables you declared may not exist
4559 at all; flow of control may briefly move where you did not expect it;
4560 some statements may not be executed because they compute constant
4561 results or their values were already at hand; some statements may
4562 execute in different places because they were moved out of loops.
4564 Nevertheless it proves possible to debug optimized output.  This makes
4565 it reasonable to use the optimizer for programs that might have bugs.
4567 The following options are useful when GCC is generated with the
4568 capability for more than one debugging format.
4570 @item -ggdb
4571 @opindex ggdb
4572 Produce debugging information for use by GDB@.  This means to use the
4573 most expressive format available (DWARF 2, stabs, or the native format
4574 if neither of those are supported), including GDB extensions if at all
4575 possible.
4577 @item -gstabs
4578 @opindex gstabs
4579 Produce debugging information in stabs format (if that is supported),
4580 without GDB extensions.  This is the format used by DBX on most BSD
4581 systems.  On MIPS, Alpha and System V Release 4 systems this option
4582 produces stabs debugging output which is not understood by DBX or SDB@.
4583 On System V Release 4 systems this option requires the GNU assembler.
4585 @item -feliminate-unused-debug-symbols
4586 @opindex feliminate-unused-debug-symbols
4587 Produce debugging information in stabs format (if that is supported),
4588 for only symbols that are actually used.
4590 @item -femit-class-debug-always
4591 Instead of emitting debugging information for a C++ class in only one
4592 object file, emit it in all object files using the class.  This option
4593 should be used only with debuggers that are unable to handle the way GCC
4594 normally emits debugging information for classes because using this
4595 option will increase the size of debugging information by as much as a
4596 factor of two.
4598 @item -fno-debug-types-section
4599 @opindex fno-debug-types-section
4600 @opindex fdebug-types-section
4601 By default when using DWARF v4 or higher type DIEs will be put into
4602 their own .debug_types section instead of making them part of the
4603 .debug_info section.  It is more efficient to put them in a separate
4604 comdat sections since the linker will then be able to remove duplicates.
4605 But not all DWARF consumers support .debug_types sections yet.
4607 @item -gstabs+
4608 @opindex gstabs+
4609 Produce debugging information in stabs format (if that is supported),
4610 using GNU extensions understood only by the GNU debugger (GDB)@.  The
4611 use of these extensions is likely to make other debuggers crash or
4612 refuse to read the program.
4614 @item -gcoff
4615 @opindex gcoff
4616 Produce debugging information in COFF format (if that is supported).
4617 This is the format used by SDB on most System V systems prior to
4618 System V Release 4.
4620 @item -gxcoff
4621 @opindex gxcoff
4622 Produce debugging information in XCOFF format (if that is supported).
4623 This is the format used by the DBX debugger on IBM RS/6000 systems.
4625 @item -gxcoff+
4626 @opindex gxcoff+
4627 Produce debugging information in XCOFF format (if that is supported),
4628 using GNU extensions understood only by the GNU debugger (GDB)@.  The
4629 use of these extensions is likely to make other debuggers crash or
4630 refuse to read the program, and may cause assemblers other than the GNU
4631 assembler (GAS) to fail with an error.
4633 @item -gdwarf-@var{version}
4634 @opindex gdwarf-@var{version}
4635 Produce debugging information in DWARF format (if that is
4636 supported).  This is the format used by DBX on IRIX 6.  The value
4637 of @var{version} may be either 2, 3 or 4; the default version is 2.
4639 Note that with DWARF version 2 some ports require, and will always
4640 use, some non-conflicting DWARF 3 extensions in the unwind tables.
4642 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
4643 for maximum benefit.
4645 @item -gstrict-dwarf
4646 @opindex gstrict-dwarf
4647 Disallow using extensions of later DWARF standard version than selected
4648 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
4649 DWARF extensions from later standard versions is allowed.
4651 @item -gno-strict-dwarf
4652 @opindex gno-strict-dwarf
4653 Allow using extensions of later DWARF standard version than selected with
4654 @option{-gdwarf-@var{version}}.
4656 @item -gvms
4657 @opindex gvms
4658 Produce debugging information in VMS debug format (if that is
4659 supported).  This is the format used by DEBUG on VMS systems.
4661 @item -g@var{level}
4662 @itemx -ggdb@var{level}
4663 @itemx -gstabs@var{level}
4664 @itemx -gcoff@var{level}
4665 @itemx -gxcoff@var{level}
4666 @itemx -gvms@var{level}
4667 Request debugging information and also use @var{level} to specify how
4668 much information.  The default level is 2.
4670 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
4671 @option{-g}.
4673 Level 1 produces minimal information, enough for making backtraces in
4674 parts of the program that you don't plan to debug.  This includes
4675 descriptions of functions and external variables, but no information
4676 about local variables and no line numbers.
4678 Level 3 includes extra information, such as all the macro definitions
4679 present in the program.  Some debuggers support macro expansion when
4680 you use @option{-g3}.
4682 @option{-gdwarf-2} does not accept a concatenated debug level, because
4683 GCC used to support an option @option{-gdwarf} that meant to generate
4684 debug information in version 1 of the DWARF format (which is very
4685 different from version 2), and it would have been too confusing.  That
4686 debug format is long obsolete, but the option cannot be changed now.
4687 Instead use an additional @option{-g@var{level}} option to change the
4688 debug level for DWARF.
4690 @item -gtoggle
4691 @opindex gtoggle
4692 Turn off generation of debug info, if leaving out this option would have
4693 generated it, or turn it on at level 2 otherwise.  The position of this
4694 argument in the command line does not matter, it takes effect after all
4695 other options are processed, and it does so only once, no matter how
4696 many times it is given.  This is mainly intended to be used with
4697 @option{-fcompare-debug}.
4699 @item -fdump-final-insns@r{[}=@var{file}@r{]}
4700 @opindex fdump-final-insns
4701 Dump the final internal representation (RTL) to @var{file}.  If the
4702 optional argument is omitted (or if @var{file} is @code{.}), the name
4703 of the dump file will be determined by appending @code{.gkd} to the
4704 compilation output file name.
4706 @item -fcompare-debug@r{[}=@var{opts}@r{]}
4707 @opindex fcompare-debug
4708 @opindex fno-compare-debug
4709 If no error occurs during compilation, run the compiler a second time,
4710 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
4711 passed to the second compilation.  Dump the final internal
4712 representation in both compilations, and print an error if they differ.
4714 If the equal sign is omitted, the default @option{-gtoggle} is used.
4716 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
4717 and nonzero, implicitly enables @option{-fcompare-debug}.  If
4718 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
4719 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
4720 is used.
4722 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
4723 is equivalent to @option{-fno-compare-debug}, which disables the dumping
4724 of the final representation and the second compilation, preventing even
4725 @env{GCC_COMPARE_DEBUG} from taking effect.
4727 To verify full coverage during @option{-fcompare-debug} testing, set
4728 @env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
4729 which GCC will reject as an invalid option in any actual compilation
4730 (rather than preprocessing, assembly or linking).  To get just a
4731 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
4732 not overridden} will do.
4734 @item -fcompare-debug-second
4735 @opindex fcompare-debug-second
4736 This option is implicitly passed to the compiler for the second
4737 compilation requested by @option{-fcompare-debug}, along with options to
4738 silence warnings, and omitting other options that would cause
4739 side-effect compiler outputs to files or to the standard output.  Dump
4740 files and preserved temporary files are renamed so as to contain the
4741 @code{.gk} additional extension during the second compilation, to avoid
4742 overwriting those generated by the first.
4744 When this option is passed to the compiler driver, it causes the
4745 @emph{first} compilation to be skipped, which makes it useful for little
4746 other than debugging the compiler proper.
4748 @item -feliminate-dwarf2-dups
4749 @opindex feliminate-dwarf2-dups
4750 Compress DWARF2 debugging information by eliminating duplicated
4751 information about each symbol.  This option only makes sense when
4752 generating DWARF2 debugging information with @option{-gdwarf-2}.
4754 @item -femit-struct-debug-baseonly
4755 Emit debug information for struct-like types
4756 only when the base name of the compilation source file
4757 matches the base name of file in which the struct was defined.
4759 This option substantially reduces the size of debugging information,
4760 but at significant potential loss in type information to the debugger.
4761 See @option{-femit-struct-debug-reduced} for a less aggressive option.
4762 See @option{-femit-struct-debug-detailed} for more detailed control.
4764 This option works only with DWARF 2.
4766 @item -femit-struct-debug-reduced
4767 Emit debug information for struct-like types
4768 only when the base name of the compilation source file
4769 matches the base name of file in which the type was defined,
4770 unless the struct is a template or defined in a system header.
4772 This option significantly reduces the size of debugging information,
4773 with some potential loss in type information to the debugger.
4774 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4775 See @option{-femit-struct-debug-detailed} for more detailed control.
4777 This option works only with DWARF 2.
4779 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4780 Specify the struct-like types
4781 for which the compiler will generate debug information.
4782 The intent is to reduce duplicate struct debug information
4783 between different object files within the same program.
4785 This option is a detailed version of
4786 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4787 which will serve for most needs.
4789 A specification has the syntax@*
4790 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4792 The optional first word limits the specification to
4793 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4794 A struct type is used directly when it is the type of a variable, member.
4795 Indirect uses arise through pointers to structs.
4796 That is, when use of an incomplete struct would be legal, the use is indirect.
4797 An example is
4798 @samp{struct one direct; struct two * indirect;}.
4800 The optional second word limits the specification to
4801 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4802 Generic structs are a bit complicated to explain.
4803 For C++, these are non-explicit specializations of template classes,
4804 or non-template classes within the above.
4805 Other programming languages have generics,
4806 but @samp{-femit-struct-debug-detailed} does not yet implement them.
4808 The third word specifies the source files for those
4809 structs for which the compiler will emit debug information.
4810 The values @samp{none} and @samp{any} have the normal meaning.
4811 The value @samp{base} means that
4812 the base of name of the file in which the type declaration appears
4813 must match the base of the name of the main compilation file.
4814 In practice, this means that
4815 types declared in @file{foo.c} and @file{foo.h} will have debug information,
4816 but types declared in other header will not.
4817 The value @samp{sys} means those types satisfying @samp{base}
4818 or declared in system or compiler headers.
4820 You may need to experiment to determine the best settings for your application.
4822 The default is @samp{-femit-struct-debug-detailed=all}.
4824 This option works only with DWARF 2.
4826 @item -fno-merge-debug-strings
4827 @opindex fmerge-debug-strings
4828 @opindex fno-merge-debug-strings
4829 Direct the linker to not merge together strings in the debugging
4830 information which are identical in different object files.  Merging is
4831 not supported by all assemblers or linkers.  Merging decreases the size
4832 of the debug information in the output file at the cost of increasing
4833 link processing time.  Merging is enabled by default.
4835 @item -fdebug-prefix-map=@var{old}=@var{new}
4836 @opindex fdebug-prefix-map
4837 When compiling files in directory @file{@var{old}}, record debugging
4838 information describing them as in @file{@var{new}} instead.
4840 @item -fno-dwarf2-cfi-asm
4841 @opindex fdwarf2-cfi-asm
4842 @opindex fno-dwarf2-cfi-asm
4843 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
4844 instead of using GAS @code{.cfi_*} directives.
4846 @cindex @command{prof}
4847 @item -p
4848 @opindex p
4849 Generate extra code to write profile information suitable for the
4850 analysis program @command{prof}.  You must use this option when compiling
4851 the source files you want data about, and you must also use it when
4852 linking.
4854 @cindex @command{gprof}
4855 @item -pg
4856 @opindex pg
4857 Generate extra code to write profile information suitable for the
4858 analysis program @command{gprof}.  You must use this option when compiling
4859 the source files you want data about, and you must also use it when
4860 linking.
4862 @item -Q
4863 @opindex Q
4864 Makes the compiler print out each function name as it is compiled, and
4865 print some statistics about each pass when it finishes.
4867 @item -ftime-report
4868 @opindex ftime-report
4869 Makes the compiler print some statistics about the time consumed by each
4870 pass when it finishes.
4872 @item -fmem-report
4873 @opindex fmem-report
4874 Makes the compiler print some statistics about permanent memory
4875 allocation when it finishes.
4877 @item -fpre-ipa-mem-report
4878 @opindex fpre-ipa-mem-report
4879 @item -fpost-ipa-mem-report
4880 @opindex fpost-ipa-mem-report
4881 Makes the compiler print some statistics about permanent memory
4882 allocation before or after interprocedural optimization.
4884 @item -fstack-usage
4885 @opindex fstack-usage
4886 Makes the compiler output stack usage information for the program, on a
4887 per-function basis.  The filename for the dump is made by appending
4888 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
4889 the output file, if explicitly specified and it is not an executable,
4890 otherwise it is the basename of the source file.  An entry is made up
4891 of three fields:
4893 @itemize
4894 @item
4895 The name of the function.
4896 @item
4897 A number of bytes.
4898 @item
4899 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
4900 @end itemize
4902 The qualifier @code{static} means that the function manipulates the stack
4903 statically: a fixed number of bytes are allocated for the frame on function
4904 entry and released on function exit; no stack adjustments are otherwise made
4905 in the function.  The second field is this fixed number of bytes.
4907 The qualifier @code{dynamic} means that the function manipulates the stack
4908 dynamically: in addition to the static allocation described above, stack
4909 adjustments are made in the body of the function, for example to push/pop
4910 arguments around function calls.  If the qualifier @code{bounded} is also
4911 present, the amount of these adjustments is bounded at compile-time and
4912 the second field is an upper bound of the total amount of stack used by
4913 the function.  If it is not present, the amount of these adjustments is
4914 not bounded at compile-time and the second field only represents the
4915 bounded part.
4917 @item -fprofile-arcs
4918 @opindex fprofile-arcs
4919 Add code so that program flow @dfn{arcs} are instrumented.  During
4920 execution the program records how many times each branch and call is
4921 executed and how many times it is taken or returns.  When the compiled
4922 program exits it saves this data to a file called
4923 @file{@var{auxname}.gcda} for each source file.  The data may be used for
4924 profile-directed optimizations (@option{-fbranch-probabilities}), or for
4925 test coverage analysis (@option{-ftest-coverage}).  Each object file's
4926 @var{auxname} is generated from the name of the output file, if
4927 explicitly specified and it is not the final executable, otherwise it is
4928 the basename of the source file.  In both cases any suffix is removed
4929 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
4930 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
4931 @xref{Cross-profiling}.
4933 @cindex @command{gcov}
4934 @item --coverage
4935 @opindex coverage
4937 This option is used to compile and link code instrumented for coverage
4938 analysis.  The option is a synonym for @option{-fprofile-arcs}
4939 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4940 linking).  See the documentation for those options for more details.
4942 @itemize
4944 @item
4945 Compile the source files with @option{-fprofile-arcs} plus optimization
4946 and code generation options.  For test coverage analysis, use the
4947 additional @option{-ftest-coverage} option.  You do not need to profile
4948 every source file in a program.
4950 @item
4951 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4952 (the latter implies the former).
4954 @item
4955 Run the program on a representative workload to generate the arc profile
4956 information.  This may be repeated any number of times.  You can run
4957 concurrent instances of your program, and provided that the file system
4958 supports locking, the data files will be correctly updated.  Also
4959 @code{fork} calls are detected and correctly handled (double counting
4960 will not happen).
4962 @item
4963 For profile-directed optimizations, compile the source files again with
4964 the same optimization and code generation options plus
4965 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
4966 Control Optimization}).
4968 @item
4969 For test coverage analysis, use @command{gcov} to produce human readable
4970 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
4971 @command{gcov} documentation for further information.
4973 @end itemize
4975 With @option{-fprofile-arcs}, for each function of your program GCC
4976 creates a program flow graph, then finds a spanning tree for the graph.
4977 Only arcs that are not on the spanning tree have to be instrumented: the
4978 compiler adds code to count the number of times that these arcs are
4979 executed.  When an arc is the only exit or only entrance to a block, the
4980 instrumentation code can be added to the block; otherwise, a new basic
4981 block must be created to hold the instrumentation code.
4983 @need 2000
4984 @item -ftest-coverage
4985 @opindex ftest-coverage
4986 Produce a notes file that the @command{gcov} code-coverage utility
4987 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
4988 show program coverage.  Each source file's note file is called
4989 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
4990 above for a description of @var{auxname} and instructions on how to
4991 generate test coverage data.  Coverage data will match the source files
4992 more closely, if you do not optimize.
4994 @item -fdbg-cnt-list
4995 @opindex fdbg-cnt-list
4996 Print the name and the counter upper bound for all debug counters.
4998 @item -fdbg-cnt=@var{counter-value-list}
4999 @opindex fdbg-cnt
5000 Set the internal debug counter upper bound.  @var{counter-value-list}
5001 is a comma-separated list of @var{name}:@var{value} pairs
5002 which sets the upper bound of each debug counter @var{name} to @var{value}.
5003 All debug counters have the initial upper bound of @var{UINT_MAX},
5004 thus dbg_cnt() returns true always unless the upper bound is set by this option.
5005 e.g. With -fdbg-cnt=dce:10,tail_call:0
5006 dbg_cnt(dce) will return true only for first 10 invocations
5007 and dbg_cnt(tail_call) will return false always.
5009 @item -d@var{letters}
5010 @itemx -fdump-rtl-@var{pass}
5011 @opindex d
5012 Says to make debugging dumps during compilation at times specified by
5013 @var{letters}.  This is used for debugging the RTL-based passes of the
5014 compiler.  The file names for most of the dumps are made by appending
5015 a pass number and a word to the @var{dumpname}, and the files are
5016 created in the directory of the output file.  Note that the pass
5017 number is computed statically as passes get registered into the pass
5018 manager.  Thus the numbering is not related to the dynamic order of
5019 execution of passes.  In particular, a pass installed by a plugin
5020 could have a number over 200 even if it executed quite early.
5021 @var{dumpname} is generated from the name of the output file, if
5022 explicitly specified and it is not an executable, otherwise it is the
5023 basename of the source file. These switches may have different effects
5024 when @option{-E} is used for preprocessing.
5026 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
5027 @option{-d} option @var{letters}.  Here are the possible
5028 letters for use in @var{pass} and @var{letters}, and their meanings:
5030 @table @gcctabopt
5032 @item -fdump-rtl-alignments
5033 @opindex fdump-rtl-alignments
5034 Dump after branch alignments have been computed.
5036 @item -fdump-rtl-asmcons
5037 @opindex fdump-rtl-asmcons
5038 Dump after fixing rtl statements that have unsatisfied in/out constraints.
5040 @item -fdump-rtl-auto_inc_dec
5041 @opindex fdump-rtl-auto_inc_dec
5042 Dump after auto-inc-dec discovery.  This pass is only run on
5043 architectures that have auto inc or auto dec instructions.
5045 @item -fdump-rtl-barriers
5046 @opindex fdump-rtl-barriers
5047 Dump after cleaning up the barrier instructions.
5049 @item -fdump-rtl-bbpart
5050 @opindex fdump-rtl-bbpart
5051 Dump after partitioning hot and cold basic blocks.
5053 @item -fdump-rtl-bbro
5054 @opindex fdump-rtl-bbro
5055 Dump after block reordering.
5057 @item -fdump-rtl-btl1
5058 @itemx -fdump-rtl-btl2
5059 @opindex fdump-rtl-btl2
5060 @opindex fdump-rtl-btl2
5061 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
5062 after the two branch
5063 target load optimization passes.
5065 @item -fdump-rtl-bypass
5066 @opindex fdump-rtl-bypass
5067 Dump after jump bypassing and control flow optimizations.
5069 @item -fdump-rtl-combine
5070 @opindex fdump-rtl-combine
5071 Dump after the RTL instruction combination pass.
5073 @item -fdump-rtl-compgotos
5074 @opindex fdump-rtl-compgotos
5075 Dump after duplicating the computed gotos.
5077 @item -fdump-rtl-ce1
5078 @itemx -fdump-rtl-ce2
5079 @itemx -fdump-rtl-ce3
5080 @opindex fdump-rtl-ce1
5081 @opindex fdump-rtl-ce2
5082 @opindex fdump-rtl-ce3
5083 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
5084 @option{-fdump-rtl-ce3} enable dumping after the three
5085 if conversion passes.
5087 @itemx -fdump-rtl-cprop_hardreg
5088 @opindex fdump-rtl-cprop_hardreg
5089 Dump after hard register copy propagation.
5091 @itemx -fdump-rtl-csa
5092 @opindex fdump-rtl-csa
5093 Dump after combining stack adjustments.
5095 @item -fdump-rtl-cse1
5096 @itemx -fdump-rtl-cse2
5097 @opindex fdump-rtl-cse1
5098 @opindex fdump-rtl-cse2
5099 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
5100 the two common sub-expression elimination passes.
5102 @itemx -fdump-rtl-dce
5103 @opindex fdump-rtl-dce
5104 Dump after the standalone dead code elimination passes.
5106 @itemx -fdump-rtl-dbr
5107 @opindex fdump-rtl-dbr
5108 Dump after delayed branch scheduling.
5110 @item -fdump-rtl-dce1
5111 @itemx -fdump-rtl-dce2
5112 @opindex fdump-rtl-dce1
5113 @opindex fdump-rtl-dce2
5114 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
5115 the two dead store elimination passes.
5117 @item -fdump-rtl-eh
5118 @opindex fdump-rtl-eh
5119 Dump after finalization of EH handling code.
5121 @item -fdump-rtl-eh_ranges
5122 @opindex fdump-rtl-eh_ranges
5123 Dump after conversion of EH handling range regions.
5125 @item -fdump-rtl-expand
5126 @opindex fdump-rtl-expand
5127 Dump after RTL generation.
5129 @item -fdump-rtl-fwprop1
5130 @itemx -fdump-rtl-fwprop2
5131 @opindex fdump-rtl-fwprop1
5132 @opindex fdump-rtl-fwprop2
5133 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
5134 dumping after the two forward propagation passes.
5136 @item -fdump-rtl-gcse1
5137 @itemx -fdump-rtl-gcse2
5138 @opindex fdump-rtl-gcse1
5139 @opindex fdump-rtl-gcse2
5140 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
5141 after global common subexpression elimination.
5143 @item -fdump-rtl-init-regs
5144 @opindex fdump-rtl-init-regs
5145 Dump after the initialization of the registers.
5147 @item -fdump-rtl-initvals
5148 @opindex fdump-rtl-initvals
5149 Dump after the computation of the initial value sets.
5151 @itemx -fdump-rtl-into_cfglayout
5152 @opindex fdump-rtl-into_cfglayout
5153 Dump after converting to cfglayout mode.
5155 @item -fdump-rtl-ira
5156 @opindex fdump-rtl-ira
5157 Dump after iterated register allocation.
5159 @item -fdump-rtl-jump
5160 @opindex fdump-rtl-jump
5161 Dump after the second jump optimization.
5163 @item -fdump-rtl-loop2
5164 @opindex fdump-rtl-loop2
5165 @option{-fdump-rtl-loop2} enables dumping after the rtl
5166 loop optimization passes.
5168 @item -fdump-rtl-mach
5169 @opindex fdump-rtl-mach
5170 Dump after performing the machine dependent reorganization pass, if that
5171 pass exists.
5173 @item -fdump-rtl-mode_sw
5174 @opindex fdump-rtl-mode_sw
5175 Dump after removing redundant mode switches.
5177 @item -fdump-rtl-rnreg
5178 @opindex fdump-rtl-rnreg
5179 Dump after register renumbering.
5181 @itemx -fdump-rtl-outof_cfglayout
5182 @opindex fdump-rtl-outof_cfglayout
5183 Dump after converting from cfglayout mode.
5185 @item -fdump-rtl-peephole2
5186 @opindex fdump-rtl-peephole2
5187 Dump after the peephole pass.
5189 @item -fdump-rtl-postreload
5190 @opindex fdump-rtl-postreload
5191 Dump after post-reload optimizations.
5193 @itemx -fdump-rtl-pro_and_epilogue
5194 @opindex fdump-rtl-pro_and_epilogue
5195 Dump after generating the function pro and epilogues.
5197 @item -fdump-rtl-regmove
5198 @opindex fdump-rtl-regmove
5199 Dump after the register move pass.
5201 @item -fdump-rtl-sched1
5202 @itemx -fdump-rtl-sched2
5203 @opindex fdump-rtl-sched1
5204 @opindex fdump-rtl-sched2
5205 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
5206 after the basic block scheduling passes.
5208 @item -fdump-rtl-see
5209 @opindex fdump-rtl-see
5210 Dump after sign extension elimination.
5212 @item -fdump-rtl-seqabstr
5213 @opindex fdump-rtl-seqabstr
5214 Dump after common sequence discovery.
5216 @item -fdump-rtl-shorten
5217 @opindex fdump-rtl-shorten
5218 Dump after shortening branches.
5220 @item -fdump-rtl-sibling
5221 @opindex fdump-rtl-sibling
5222 Dump after sibling call optimizations.
5224 @item -fdump-rtl-split1
5225 @itemx -fdump-rtl-split2
5226 @itemx -fdump-rtl-split3
5227 @itemx -fdump-rtl-split4
5228 @itemx -fdump-rtl-split5
5229 @opindex fdump-rtl-split1
5230 @opindex fdump-rtl-split2
5231 @opindex fdump-rtl-split3
5232 @opindex fdump-rtl-split4
5233 @opindex fdump-rtl-split5
5234 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
5235 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
5236 @option{-fdump-rtl-split5} enable dumping after five rounds of
5237 instruction splitting.
5239 @item -fdump-rtl-sms
5240 @opindex fdump-rtl-sms
5241 Dump after modulo scheduling.  This pass is only run on some
5242 architectures.
5244 @item -fdump-rtl-stack
5245 @opindex fdump-rtl-stack
5246 Dump after conversion from GCC's "flat register file" registers to the
5247 x87's stack-like registers.  This pass is only run on x86 variants.
5249 @item -fdump-rtl-subreg1
5250 @itemx -fdump-rtl-subreg2
5251 @opindex fdump-rtl-subreg1
5252 @opindex fdump-rtl-subreg2
5253 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
5254 the two subreg expansion passes.
5256 @item -fdump-rtl-unshare
5257 @opindex fdump-rtl-unshare
5258 Dump after all rtl has been unshared.
5260 @item -fdump-rtl-vartrack
5261 @opindex fdump-rtl-vartrack
5262 Dump after variable tracking.
5264 @item -fdump-rtl-vregs
5265 @opindex fdump-rtl-vregs
5266 Dump after converting virtual registers to hard registers.
5268 @item -fdump-rtl-web
5269 @opindex fdump-rtl-web
5270 Dump after live range splitting.
5272 @item -fdump-rtl-regclass
5273 @itemx -fdump-rtl-subregs_of_mode_init
5274 @itemx -fdump-rtl-subregs_of_mode_finish
5275 @itemx -fdump-rtl-dfinit
5276 @itemx -fdump-rtl-dfinish
5277 @opindex fdump-rtl-regclass
5278 @opindex fdump-rtl-subregs_of_mode_init
5279 @opindex fdump-rtl-subregs_of_mode_finish
5280 @opindex fdump-rtl-dfinit
5281 @opindex fdump-rtl-dfinish
5282 These dumps are defined but always produce empty files.
5284 @item -fdump-rtl-all
5285 @opindex fdump-rtl-all
5286 Produce all the dumps listed above.
5288 @item -dA
5289 @opindex dA
5290 Annotate the assembler output with miscellaneous debugging information.
5292 @item -dD
5293 @opindex dD
5294 Dump all macro definitions, at the end of preprocessing, in addition to
5295 normal output.
5297 @item -dH
5298 @opindex dH
5299 Produce a core dump whenever an error occurs.
5301 @item -dm
5302 @opindex dm
5303 Print statistics on memory usage, at the end of the run, to
5304 standard error.
5306 @item -dp
5307 @opindex dp
5308 Annotate the assembler output with a comment indicating which
5309 pattern and alternative was used.  The length of each instruction is
5310 also printed.
5312 @item -dP
5313 @opindex dP
5314 Dump the RTL in the assembler output as a comment before each instruction.
5315 Also turns on @option{-dp} annotation.
5317 @item -dv
5318 @opindex dv
5319 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5320 dump a representation of the control flow graph suitable for viewing with VCG
5321 to @file{@var{file}.@var{pass}.vcg}.
5323 @item -dx
5324 @opindex dx
5325 Just generate RTL for a function instead of compiling it.  Usually used
5326 with @option{-fdump-rtl-expand}.
5327 @end table
5329 @item -fdump-noaddr
5330 @opindex fdump-noaddr
5331 When doing debugging dumps, suppress address output.  This makes it more
5332 feasible to use diff on debugging dumps for compiler invocations with
5333 different compiler binaries and/or different
5334 text / bss / data / heap / stack / dso start locations.
5336 @item -fdump-unnumbered
5337 @opindex fdump-unnumbered
5338 When doing debugging dumps, suppress instruction numbers and address output.
5339 This makes it more feasible to use diff on debugging dumps for compiler
5340 invocations with different options, in particular with and without
5341 @option{-g}.
5343 @item -fdump-unnumbered-links
5344 @opindex fdump-unnumbered-links
5345 When doing debugging dumps (see @option{-d} option above), suppress
5346 instruction numbers for the links to the previous and next instructions
5347 in a sequence.
5349 @item -fdump-translation-unit @r{(C++ only)}
5350 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
5351 @opindex fdump-translation-unit
5352 Dump a representation of the tree structure for the entire translation
5353 unit to a file.  The file name is made by appending @file{.tu} to the
5354 source file name, and the file is created in the same directory as the
5355 output file.  If the @samp{-@var{options}} form is used, @var{options}
5356 controls the details of the dump as described for the
5357 @option{-fdump-tree} options.
5359 @item -fdump-class-hierarchy @r{(C++ only)}
5360 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
5361 @opindex fdump-class-hierarchy
5362 Dump a representation of each class's hierarchy and virtual function
5363 table layout to a file.  The file name is made by appending
5364 @file{.class} to the source file name, and the file is created in the
5365 same directory as the output file.  If the @samp{-@var{options}} form
5366 is used, @var{options} controls the details of the dump as described
5367 for the @option{-fdump-tree} options.
5369 @item -fdump-ipa-@var{switch}
5370 @opindex fdump-ipa
5371 Control the dumping at various stages of inter-procedural analysis
5372 language tree to a file.  The file name is generated by appending a
5373 switch specific suffix to the source file name, and the file is created
5374 in the same directory as the output file.  The following dumps are
5375 possible:
5377 @table @samp
5378 @item all
5379 Enables all inter-procedural analysis dumps.
5381 @item cgraph
5382 Dumps information about call-graph optimization, unused function removal,
5383 and inlining decisions.
5385 @item inline
5386 Dump after function inlining.
5388 @end table
5390 @item -fdump-statistics-@var{option}
5391 @opindex fdump-statistics
5392 Enable and control dumping of pass statistics in a separate file.  The
5393 file name is generated by appending a suffix ending in
5394 @samp{.statistics} to the source file name, and the file is created in
5395 the same directory as the output file.  If the @samp{-@var{option}}
5396 form is used, @samp{-stats} will cause counters to be summed over the
5397 whole compilation unit while @samp{-details} will dump every event as
5398 the passes generate them.  The default with no option is to sum
5399 counters for each function compiled.
5401 @item -fdump-tree-@var{switch}
5402 @itemx -fdump-tree-@var{switch}-@var{options}
5403 @opindex fdump-tree
5404 Control the dumping at various stages of processing the intermediate
5405 language tree to a file.  The file name is generated by appending a
5406 switch specific suffix to the source file name, and the file is
5407 created in the same directory as the output file.  If the
5408 @samp{-@var{options}} form is used, @var{options} is a list of
5409 @samp{-} separated options that control the details of the dump.  Not
5410 all options are applicable to all dumps, those which are not
5411 meaningful will be ignored.  The following options are available
5413 @table @samp
5414 @item address
5415 Print the address of each node.  Usually this is not meaningful as it
5416 changes according to the environment and source file.  Its primary use
5417 is for tying up a dump file with a debug environment.
5418 @item asmname
5419 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5420 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
5421 use working backward from mangled names in the assembly file.
5422 @item slim
5423 Inhibit dumping of members of a scope or body of a function merely
5424 because that scope has been reached.  Only dump such items when they
5425 are directly reachable by some other path.  When dumping pretty-printed
5426 trees, this option inhibits dumping the bodies of control structures.
5427 @item raw
5428 Print a raw representation of the tree.  By default, trees are
5429 pretty-printed into a C-like representation.
5430 @item details
5431 Enable more detailed dumps (not honored by every dump option).
5432 @item stats
5433 Enable dumping various statistics about the pass (not honored by every dump
5434 option).
5435 @item blocks
5436 Enable showing basic block boundaries (disabled in raw dumps).
5437 @item vops
5438 Enable showing virtual operands for every statement.
5439 @item lineno
5440 Enable showing line numbers for statements.
5441 @item uid
5442 Enable showing the unique ID (@code{DECL_UID}) for each variable.
5443 @item verbose
5444 Enable showing the tree dump for each statement.
5445 @item eh
5446 Enable showing the EH region number holding each statement.
5447 @item all
5448 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5449 and @option{lineno}.
5450 @end table
5452 The following tree dumps are possible:
5453 @table @samp
5455 @item original
5456 @opindex fdump-tree-original
5457 Dump before any tree based optimization, to @file{@var{file}.original}.
5459 @item optimized
5460 @opindex fdump-tree-optimized
5461 Dump after all tree based optimization, to @file{@var{file}.optimized}.
5463 @item gimple
5464 @opindex fdump-tree-gimple
5465 Dump each function before and after the gimplification pass to a file.  The
5466 file name is made by appending @file{.gimple} to the source file name.
5468 @item cfg
5469 @opindex fdump-tree-cfg
5470 Dump the control flow graph of each function to a file.  The file name is
5471 made by appending @file{.cfg} to the source file name.
5473 @item vcg
5474 @opindex fdump-tree-vcg
5475 Dump the control flow graph of each function to a file in VCG format.  The
5476 file name is made by appending @file{.vcg} to the source file name.  Note
5477 that if the file contains more than one function, the generated file cannot
5478 be used directly by VCG@.  You will need to cut and paste each function's
5479 graph into its own separate file first.
5481 @item ch
5482 @opindex fdump-tree-ch
5483 Dump each function after copying loop headers.  The file name is made by
5484 appending @file{.ch} to the source file name.
5486 @item ssa
5487 @opindex fdump-tree-ssa
5488 Dump SSA related information to a file.  The file name is made by appending
5489 @file{.ssa} to the source file name.
5491 @item alias
5492 @opindex fdump-tree-alias
5493 Dump aliasing information for each function.  The file name is made by
5494 appending @file{.alias} to the source file name.
5496 @item ccp
5497 @opindex fdump-tree-ccp
5498 Dump each function after CCP@.  The file name is made by appending
5499 @file{.ccp} to the source file name.
5501 @item storeccp
5502 @opindex fdump-tree-storeccp
5503 Dump each function after STORE-CCP@.  The file name is made by appending
5504 @file{.storeccp} to the source file name.
5506 @item pre
5507 @opindex fdump-tree-pre
5508 Dump trees after partial redundancy elimination.  The file name is made
5509 by appending @file{.pre} to the source file name.
5511 @item fre
5512 @opindex fdump-tree-fre
5513 Dump trees after full redundancy elimination.  The file name is made
5514 by appending @file{.fre} to the source file name.
5516 @item copyprop
5517 @opindex fdump-tree-copyprop
5518 Dump trees after copy propagation.  The file name is made
5519 by appending @file{.copyprop} to the source file name.
5521 @item store_copyprop
5522 @opindex fdump-tree-store_copyprop
5523 Dump trees after store copy-propagation.  The file name is made
5524 by appending @file{.store_copyprop} to the source file name.
5526 @item dce
5527 @opindex fdump-tree-dce
5528 Dump each function after dead code elimination.  The file name is made by
5529 appending @file{.dce} to the source file name.
5531 @item mudflap
5532 @opindex fdump-tree-mudflap
5533 Dump each function after adding mudflap instrumentation.  The file name is
5534 made by appending @file{.mudflap} to the source file name.
5536 @item sra
5537 @opindex fdump-tree-sra
5538 Dump each function after performing scalar replacement of aggregates.  The
5539 file name is made by appending @file{.sra} to the source file name.
5541 @item sink
5542 @opindex fdump-tree-sink
5543 Dump each function after performing code sinking.  The file name is made
5544 by appending @file{.sink} to the source file name.
5546 @item dom
5547 @opindex fdump-tree-dom
5548 Dump each function after applying dominator tree optimizations.  The file
5549 name is made by appending @file{.dom} to the source file name.
5551 @item dse
5552 @opindex fdump-tree-dse
5553 Dump each function after applying dead store elimination.  The file
5554 name is made by appending @file{.dse} to the source file name.
5556 @item phiopt
5557 @opindex fdump-tree-phiopt
5558 Dump each function after optimizing PHI nodes into straightline code.  The file
5559 name is made by appending @file{.phiopt} to the source file name.
5561 @item forwprop
5562 @opindex fdump-tree-forwprop
5563 Dump each function after forward propagating single use variables.  The file
5564 name is made by appending @file{.forwprop} to the source file name.
5566 @item copyrename
5567 @opindex fdump-tree-copyrename
5568 Dump each function after applying the copy rename optimization.  The file
5569 name is made by appending @file{.copyrename} to the source file name.
5571 @item nrv
5572 @opindex fdump-tree-nrv
5573 Dump each function after applying the named return value optimization on
5574 generic trees.  The file name is made by appending @file{.nrv} to the source
5575 file name.
5577 @item vect
5578 @opindex fdump-tree-vect
5579 Dump each function after applying vectorization of loops.  The file name is
5580 made by appending @file{.vect} to the source file name.
5582 @item slp
5583 @opindex fdump-tree-slp
5584 Dump each function after applying vectorization of basic blocks.  The file name
5585 is made by appending @file{.slp} to the source file name.
5587 @item vrp
5588 @opindex fdump-tree-vrp
5589 Dump each function after Value Range Propagation (VRP).  The file name
5590 is made by appending @file{.vrp} to the source file name.
5592 @item all
5593 @opindex fdump-tree-all
5594 Enable all the available tree dumps with the flags provided in this option.
5595 @end table
5597 @item -ftree-vectorizer-verbose=@var{n}
5598 @opindex ftree-vectorizer-verbose
5599 This option controls the amount of debugging output the vectorizer prints.
5600 This information is written to standard error, unless
5601 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
5602 in which case it is output to the usual dump listing file, @file{.vect}.
5603 For @var{n}=0 no diagnostic information is reported.
5604 If @var{n}=1 the vectorizer reports each loop that got vectorized,
5605 and the total number of loops that got vectorized.
5606 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
5607 the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
5608 inner-most, single-bb, single-entry/exit loops.  This is the same verbosity
5609 level that @option{-fdump-tree-vect-stats} uses.
5610 Higher verbosity levels mean either more information dumped for each
5611 reported loop, or same amount of information reported for more loops:
5612 if @var{n}=3, vectorizer cost model information is reported.
5613 If @var{n}=4, alignment related information is added to the reports.
5614 If @var{n}=5, data-references related information (e.g.@: memory dependences,
5615 memory access-patterns) is added to the reports.
5616 If @var{n}=6, the vectorizer reports also non-vectorized inner-most loops
5617 that did not pass the first analysis phase (i.e., may not be countable, or
5618 may have complicated control-flow).
5619 If @var{n}=7, the vectorizer reports also non-vectorized nested loops.
5620 If @var{n}=8, SLP related information is added to the reports.
5621 For @var{n}=9, all the information the vectorizer generates during its
5622 analysis and transformation is reported.  This is the same verbosity level
5623 that @option{-fdump-tree-vect-details} uses.
5625 @item -frandom-seed=@var{string}
5626 @opindex frandom-seed
5627 This option provides a seed that GCC uses when it would otherwise use
5628 random numbers.  It is used to generate certain symbol names
5629 that have to be different in every compiled file.  It is also used to
5630 place unique stamps in coverage data files and the object files that
5631 produce them.  You can use the @option{-frandom-seed} option to produce
5632 reproducibly identical object files.
5634 The @var{string} should be different for every file you compile.
5636 @item -fsched-verbose=@var{n}
5637 @opindex fsched-verbose
5638 On targets that use instruction scheduling, this option controls the
5639 amount of debugging output the scheduler prints.  This information is
5640 written to standard error, unless @option{-fdump-rtl-sched1} or
5641 @option{-fdump-rtl-sched2} is specified, in which case it is output
5642 to the usual dump listing file, @file{.sched1} or @file{.sched2}
5643 respectively.  However for @var{n} greater than nine, the output is
5644 always printed to standard error.
5646 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
5647 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
5648 For @var{n} greater than one, it also output basic block probabilities,
5649 detailed ready list information and unit/insn info.  For @var{n} greater
5650 than two, it includes RTL at abort point, control-flow and regions info.
5651 And for @var{n} over four, @option{-fsched-verbose} also includes
5652 dependence info.
5654 @item -save-temps
5655 @itemx -save-temps=cwd
5656 @opindex save-temps
5657 Store the usual ``temporary'' intermediate files permanently; place them
5658 in the current directory and name them based on the source file.  Thus,
5659 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
5660 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
5661 preprocessed @file{foo.i} output file even though the compiler now
5662 normally uses an integrated preprocessor.
5664 When used in combination with the @option{-x} command line option,
5665 @option{-save-temps} is sensible enough to avoid over writing an
5666 input source file with the same extension as an intermediate file.
5667 The corresponding intermediate file may be obtained by renaming the
5668 source file before using @option{-save-temps}.
5670 If you invoke GCC in parallel, compiling several different source
5671 files that share a common base name in different subdirectories or the
5672 same source file compiled for multiple output destinations, it is
5673 likely that the different parallel compilers will interfere with each
5674 other, and overwrite the temporary files.  For instance:
5676 @smallexample
5677 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
5678 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
5679 @end smallexample
5681 may result in @file{foo.i} and @file{foo.o} being written to
5682 simultaneously by both compilers.
5684 @item -save-temps=obj
5685 @opindex save-temps=obj
5686 Store the usual ``temporary'' intermediate files permanently.  If the
5687 @option{-o} option is used, the temporary files are based on the
5688 object file.  If the @option{-o} option is not used, the
5689 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
5691 For example:
5693 @smallexample
5694 gcc -save-temps=obj -c foo.c
5695 gcc -save-temps=obj -c bar.c -o dir/xbar.o
5696 gcc -save-temps=obj foobar.c -o dir2/yfoobar
5697 @end smallexample
5699 would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
5700 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
5701 @file{dir2/yfoobar.o}.
5703 @item -time@r{[}=@var{file}@r{]}
5704 @opindex time
5705 Report the CPU time taken by each subprocess in the compilation
5706 sequence.  For C source files, this is the compiler proper and assembler
5707 (plus the linker if linking is done).
5709 Without the specification of an output file, the output looks like this:
5711 @smallexample
5712 # cc1 0.12 0.01
5713 # as 0.00 0.01
5714 @end smallexample
5716 The first number on each line is the ``user time'', that is time spent
5717 executing the program itself.  The second number is ``system time'',
5718 time spent executing operating system routines on behalf of the program.
5719 Both numbers are in seconds.
5721 With the specification of an output file, the output is appended to the
5722 named file, and it looks like this:
5724 @smallexample
5725 0.12 0.01 cc1 @var{options}
5726 0.00 0.01 as @var{options}
5727 @end smallexample
5729 The ``user time'' and the ``system time'' are moved before the program
5730 name, and the options passed to the program are displayed, so that one
5731 can later tell what file was being compiled, and with which options.
5733 @item -fvar-tracking
5734 @opindex fvar-tracking
5735 Run variable tracking pass.  It computes where variables are stored at each
5736 position in code.  Better debugging information is then generated
5737 (if the debugging information format supports this information).
5739 It is enabled by default when compiling with optimization (@option{-Os},
5740 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5741 the debug info format supports it.
5743 @item -fvar-tracking-assignments
5744 @opindex fvar-tracking-assignments
5745 @opindex fno-var-tracking-assignments
5746 Annotate assignments to user variables early in the compilation and
5747 attempt to carry the annotations over throughout the compilation all the
5748 way to the end, in an attempt to improve debug information while
5749 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
5751 It can be enabled even if var-tracking is disabled, in which case
5752 annotations will be created and maintained, but discarded at the end.
5754 @item -fvar-tracking-assignments-toggle
5755 @opindex fvar-tracking-assignments-toggle
5756 @opindex fno-var-tracking-assignments-toggle
5757 Toggle @option{-fvar-tracking-assignments}, in the same way that
5758 @option{-gtoggle} toggles @option{-g}.
5760 @item -print-file-name=@var{library}
5761 @opindex print-file-name
5762 Print the full absolute name of the library file @var{library} that
5763 would be used when linking---and don't do anything else.  With this
5764 option, GCC does not compile or link anything; it just prints the
5765 file name.
5767 @item -print-multi-directory
5768 @opindex print-multi-directory
5769 Print the directory name corresponding to the multilib selected by any
5770 other switches present in the command line.  This directory is supposed
5771 to exist in @env{GCC_EXEC_PREFIX}.
5773 @item -print-multi-lib
5774 @opindex print-multi-lib
5775 Print the mapping from multilib directory names to compiler switches
5776 that enable them.  The directory name is separated from the switches by
5777 @samp{;}, and each switch starts with an @samp{@@} instead of the
5778 @samp{-}, without spaces between multiple switches.  This is supposed to
5779 ease shell-processing.
5781 @item -print-multi-os-directory
5782 @opindex print-multi-os-directory
5783 Print the path to OS libraries for the selected
5784 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
5785 present in the @file{lib} subdirectory and no multilibs are used, this is
5786 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
5787 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
5788 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
5789 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
5791 @item -print-prog-name=@var{program}
5792 @opindex print-prog-name
5793 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
5795 @item -print-libgcc-file-name
5796 @opindex print-libgcc-file-name
5797 Same as @option{-print-file-name=libgcc.a}.
5799 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
5800 but you do want to link with @file{libgcc.a}.  You can do
5802 @smallexample
5803 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
5804 @end smallexample
5806 @item -print-search-dirs
5807 @opindex print-search-dirs
5808 Print the name of the configured installation directory and a list of
5809 program and library directories @command{gcc} will search---and don't do anything else.
5811 This is useful when @command{gcc} prints the error message
5812 @samp{installation problem, cannot exec cpp0: No such file or directory}.
5813 To resolve this you either need to put @file{cpp0} and the other compiler
5814 components where @command{gcc} expects to find them, or you can set the environment
5815 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
5816 Don't forget the trailing @samp{/}.
5817 @xref{Environment Variables}.
5819 @item -print-sysroot
5820 @opindex print-sysroot
5821 Print the target sysroot directory that will be used during
5822 compilation.  This is the target sysroot specified either at configure
5823 time or using the @option{--sysroot} option, possibly with an extra
5824 suffix that depends on compilation options.  If no target sysroot is
5825 specified, the option prints nothing.
5827 @item -print-sysroot-headers-suffix
5828 @opindex print-sysroot-headers-suffix
5829 Print the suffix added to the target sysroot when searching for
5830 headers, or give an error if the compiler is not configured with such
5831 a suffix---and don't do anything else.
5833 @item -dumpmachine
5834 @opindex dumpmachine
5835 Print the compiler's target machine (for example,
5836 @samp{i686-pc-linux-gnu})---and don't do anything else.
5838 @item -dumpversion
5839 @opindex dumpversion
5840 Print the compiler version (for example, @samp{3.0})---and don't do
5841 anything else.
5843 @item -dumpspecs
5844 @opindex dumpspecs
5845 Print the compiler's built-in specs---and don't do anything else.  (This
5846 is used when GCC itself is being built.)  @xref{Spec Files}.
5848 @item -feliminate-unused-debug-types
5849 @opindex feliminate-unused-debug-types
5850 Normally, when producing DWARF2 output, GCC will emit debugging
5851 information for all types declared in a compilation
5852 unit, regardless of whether or not they are actually used
5853 in that compilation unit.  Sometimes this is useful, such as
5854 if, in the debugger, you want to cast a value to a type that is
5855 not actually used in your program (but is declared).  More often,
5856 however, this results in a significant amount of wasted space.
5857 With this option, GCC will avoid producing debug symbol output
5858 for types that are nowhere used in the source file being compiled.
5859 @end table
5861 @node Optimize Options
5862 @section Options That Control Optimization
5863 @cindex optimize options
5864 @cindex options, optimization
5866 These options control various sorts of optimizations.
5868 Without any optimization option, the compiler's goal is to reduce the
5869 cost of compilation and to make debugging produce the expected
5870 results.  Statements are independent: if you stop the program with a
5871 breakpoint between statements, you can then assign a new value to any
5872 variable or change the program counter to any other statement in the
5873 function and get exactly the results you would expect from the source
5874 code.
5876 Turning on optimization flags makes the compiler attempt to improve
5877 the performance and/or code size at the expense of compilation time
5878 and possibly the ability to debug the program.
5880 The compiler performs optimization based on the knowledge it has of the
5881 program.  Compiling multiple files at once to a single output file mode allows
5882 the compiler to use information gained from all of the files when compiling
5883 each of them.
5885 Not all optimizations are controlled directly by a flag.  Only
5886 optimizations that have a flag are listed in this section.
5888 Most optimizations are only enabled if an @option{-O} level is set on
5889 the command line.  Otherwise they are disabled, even if individual             
5890 optimization flags are specified.
5892 Depending on the target and how GCC was configured, a slightly different
5893 set of optimizations may be enabled at each @option{-O} level than
5894 those listed here.  You can invoke GCC with @samp{-Q --help=optimizers}
5895 to find out the exact set of optimizations that are enabled at each level.
5896 @xref{Overall Options}, for examples.
5898 @table @gcctabopt
5899 @item -O
5900 @itemx -O1
5901 @opindex O
5902 @opindex O1
5903 Optimize.  Optimizing compilation takes somewhat more time, and a lot
5904 more memory for a large function.
5906 With @option{-O}, the compiler tries to reduce code size and execution
5907 time, without performing any optimizations that take a great deal of
5908 compilation time.
5910 @option{-O} turns on the following optimization flags:
5911 @gccoptlist{
5912 -fauto-inc-dec @gol
5913 -fcompare-elim @gol
5914 -fcprop-registers @gol
5915 -fdce @gol
5916 -fdefer-pop @gol
5917 -fdelayed-branch @gol
5918 -fdse @gol
5919 -fguess-branch-probability @gol
5920 -fif-conversion2 @gol
5921 -fif-conversion @gol
5922 -fipa-pure-const @gol
5923 -fipa-profile @gol
5924 -fipa-reference @gol
5925 -fmerge-constants
5926 -fsplit-wide-types @gol
5927 -ftree-bit-ccp @gol
5928 -ftree-builtin-call-dce @gol
5929 -ftree-ccp @gol
5930 -ftree-ch @gol
5931 -ftree-copyrename @gol
5932 -ftree-dce @gol
5933 -ftree-dominator-opts @gol
5934 -ftree-dse @gol
5935 -ftree-forwprop @gol
5936 -ftree-fre @gol
5937 -ftree-phiprop @gol
5938 -ftree-sra @gol
5939 -ftree-pta @gol
5940 -ftree-ter @gol
5941 -funit-at-a-time}
5943 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
5944 where doing so does not interfere with debugging.
5946 @item -O2
5947 @opindex O2
5948 Optimize even more.  GCC performs nearly all supported optimizations
5949 that do not involve a space-speed tradeoff.
5950 As compared to @option{-O}, this option increases both compilation time
5951 and the performance of the generated code.
5953 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
5954 also turns on the following optimization flags:
5955 @gccoptlist{-fthread-jumps @gol
5956 -falign-functions  -falign-jumps @gol
5957 -falign-loops  -falign-labels @gol
5958 -fcaller-saves @gol
5959 -fcrossjumping @gol
5960 -fcse-follow-jumps  -fcse-skip-blocks @gol
5961 -fdelete-null-pointer-checks @gol
5962 -fdevirtualize @gol
5963 -fexpensive-optimizations @gol
5964 -fgcse  -fgcse-lm  @gol
5965 -finline-small-functions @gol
5966 -findirect-inlining @gol
5967 -fipa-sra @gol
5968 -foptimize-sibling-calls @gol
5969 -fpartial-inlining @gol
5970 -fpeephole2 @gol
5971 -fregmove @gol
5972 -freorder-blocks  -freorder-functions @gol
5973 -frerun-cse-after-loop  @gol
5974 -fsched-interblock  -fsched-spec @gol
5975 -fschedule-insns  -fschedule-insns2 @gol
5976 -fstrict-aliasing -fstrict-overflow @gol
5977 -ftree-switch-conversion @gol
5978 -ftree-pre @gol
5979 -ftree-vrp}
5981 Please note the warning under @option{-fgcse} about
5982 invoking @option{-O2} on programs that use computed gotos.
5984 @item -O3
5985 @opindex O3
5986 Optimize yet more.  @option{-O3} turns on all optimizations specified
5987 by @option{-O2} and also turns on the @option{-finline-functions},
5988 @option{-funswitch-loops}, @option{-fpredictive-commoning},
5989 @option{-fgcse-after-reload}, @option{-ftree-vectorize} and
5990 @option{-fipa-cp-clone} options.
5992 @item -O0
5993 @opindex O0
5994 Reduce compilation time and make debugging produce the expected
5995 results.  This is the default.
5997 @item -Os
5998 @opindex Os
5999 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
6000 do not typically increase code size.  It also performs further
6001 optimizations designed to reduce code size.
6003 @option{-Os} disables the following optimization flags:
6004 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
6005 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
6006 -fprefetch-loop-arrays  -ftree-vect-loop-version}
6008 @item -Ofast
6009 @opindex Ofast
6010 Disregard strict standards compliance.  @option{-Ofast} enables all
6011 @option{-O3} optimizations.  It also enables optimizations that are not
6012 valid for all standard compliant programs.
6013 It turns on @option{-ffast-math}.
6015 If you use multiple @option{-O} options, with or without level numbers,
6016 the last such option is the one that is effective.
6017 @end table
6019 Options of the form @option{-f@var{flag}} specify machine-independent
6020 flags.  Most flags have both positive and negative forms; the negative
6021 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
6022 below, only one of the forms is listed---the one you typically will
6023 use.  You can figure out the other form by either removing @samp{no-}
6024 or adding it.
6026 The following options control specific optimizations.  They are either
6027 activated by @option{-O} options or are related to ones that are.  You
6028 can use the following flags in the rare cases when ``fine-tuning'' of
6029 optimizations to be performed is desired.
6031 @table @gcctabopt
6032 @item -fno-default-inline
6033 @opindex fno-default-inline
6034 Do not make member functions inline by default merely because they are
6035 defined inside the class scope (C++ only).  Otherwise, when you specify
6036 @w{@option{-O}}, member functions defined inside class scope are compiled
6037 inline by default; i.e., you don't need to add @samp{inline} in front of
6038 the member function name.
6040 @item -fno-defer-pop
6041 @opindex fno-defer-pop
6042 Always pop the arguments to each function call as soon as that function
6043 returns.  For machines which must pop arguments after a function call,
6044 the compiler normally lets arguments accumulate on the stack for several
6045 function calls and pops them all at once.
6047 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6049 @item -fforward-propagate
6050 @opindex fforward-propagate
6051 Perform a forward propagation pass on RTL@.  The pass tries to combine two
6052 instructions and checks if the result can be simplified.  If loop unrolling
6053 is active, two passes are performed and the second is scheduled after
6054 loop unrolling.
6056 This option is enabled by default at optimization levels @option{-O},
6057 @option{-O2}, @option{-O3}, @option{-Os}.
6059 @item -ffp-contract=@var{style}
6060 @opindex ffp-contract
6061 @option{-ffp-contract=off} disables floating-point expression contraction.
6062 @option{-ffp-contract=fast} enables floating-point expression contraction
6063 such as forming of fused multiply-add operations if the target has
6064 native support for them.
6065 @option{-ffp-contract=on} enables floating-point expression contraction
6066 if allowed by the language standard.  This is currently not implemented
6067 and treated equal to @option{-ffp-contract=off}.
6069 The default is @option{-ffp-contract=fast}.
6071 @item -fomit-frame-pointer
6072 @opindex fomit-frame-pointer
6073 Don't keep the frame pointer in a register for functions that
6074 don't need one.  This avoids the instructions to save, set up and
6075 restore frame pointers; it also makes an extra register available
6076 in many functions.  @strong{It also makes debugging impossible on
6077 some machines.}
6079 On some machines, such as the VAX, this flag has no effect, because
6080 the standard calling sequence automatically handles the frame pointer
6081 and nothing is saved by pretending it doesn't exist.  The
6082 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6083 whether a target machine supports this flag.  @xref{Registers,,Register
6084 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6086 Starting with GCC version 4.6, the default setting (when not optimizing for
6087 size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to
6088 @option{-fomit-frame-pointer}.  The default can be reverted to
6089 @option{-fno-omit-frame-pointer} by configuring GCC with the
6090 @option{--enable-frame-pointer} configure option.
6092 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6094 @item -foptimize-sibling-calls
6095 @opindex foptimize-sibling-calls
6096 Optimize sibling and tail recursive calls.
6098 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6100 @item -fno-inline
6101 @opindex fno-inline
6102 Don't pay attention to the @code{inline} keyword.  Normally this option
6103 is used to keep the compiler from expanding any functions inline.
6104 Note that if you are not optimizing, no functions can be expanded inline.
6106 @item -finline-small-functions
6107 @opindex finline-small-functions
6108 Integrate functions into their callers when their body is smaller than expected
6109 function call code (so overall size of program gets smaller).  The compiler
6110 heuristically decides which functions are simple enough to be worth integrating
6111 in this way.
6113 Enabled at level @option{-O2}.
6115 @item -findirect-inlining
6116 @opindex findirect-inlining
6117 Inline also indirect calls that are discovered to be known at compile
6118 time thanks to previous inlining.  This option has any effect only
6119 when inlining itself is turned on by the @option{-finline-functions}
6120 or @option{-finline-small-functions} options.
6122 Enabled at level @option{-O2}.
6124 @item -finline-functions
6125 @opindex finline-functions
6126 Integrate all simple functions into their callers.  The compiler
6127 heuristically decides which functions are simple enough to be worth
6128 integrating in this way.
6130 If all calls to a given function are integrated, and the function is
6131 declared @code{static}, then the function is normally not output as
6132 assembler code in its own right.
6134 Enabled at level @option{-O3}.
6136 @item -finline-functions-called-once
6137 @opindex finline-functions-called-once
6138 Consider all @code{static} functions called once for inlining into their
6139 caller even if they are not marked @code{inline}.  If a call to a given
6140 function is integrated, then the function is not output as assembler code
6141 in its own right.
6143 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6145 @item -fearly-inlining
6146 @opindex fearly-inlining
6147 Inline functions marked by @code{always_inline} and functions whose body seems
6148 smaller than the function call overhead early before doing
6149 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
6150 makes profiling significantly cheaper and usually inlining faster on programs
6151 having large chains of nested wrapper functions.
6153 Enabled by default.
6155 @item -fipa-sra
6156 @opindex fipa-sra
6157 Perform interprocedural scalar replacement of aggregates, removal of
6158 unused parameters and replacement of parameters passed by reference
6159 by parameters passed by value.
6161 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6163 @item -finline-limit=@var{n}
6164 @opindex finline-limit
6165 By default, GCC limits the size of functions that can be inlined.  This flag
6166 allows coarse control of this limit.  @var{n} is the size of functions that
6167 can be inlined in number of pseudo instructions.
6169 Inlining is actually controlled by a number of parameters, which may be
6170 specified individually by using @option{--param @var{name}=@var{value}}.
6171 The @option{-finline-limit=@var{n}} option sets some of these parameters
6172 as follows:
6174 @table @gcctabopt
6175 @item max-inline-insns-single
6176 is set to @var{n}/2.
6177 @item max-inline-insns-auto
6178 is set to @var{n}/2.
6179 @end table
6181 See below for a documentation of the individual
6182 parameters controlling inlining and for the defaults of these parameters.
6184 @emph{Note:} there may be no value to @option{-finline-limit} that results
6185 in default behavior.
6187 @emph{Note:} pseudo instruction represents, in this particular context, an
6188 abstract measurement of function's size.  In no way does it represent a count
6189 of assembly instructions and as such its exact meaning might change from one
6190 release to an another.
6192 @item -fno-keep-inline-dllexport
6193 @opindex -fno-keep-inline-dllexport
6194 This is a more fine-grained version of @option{-fkeep-inline-functions},
6195 which applies only to functions that are declared using the @code{dllexport}
6196 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6197 Functions}.)
6199 @item -fkeep-inline-functions
6200 @opindex fkeep-inline-functions
6201 In C, emit @code{static} functions that are declared @code{inline}
6202 into the object file, even if the function has been inlined into all
6203 of its callers.  This switch does not affect functions using the
6204 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
6205 inline functions into the object file.
6207 @item -fkeep-static-consts
6208 @opindex fkeep-static-consts
6209 Emit variables declared @code{static const} when optimization isn't turned
6210 on, even if the variables aren't referenced.
6212 GCC enables this option by default.  If you want to force the compiler to
6213 check if the variable was referenced, regardless of whether or not
6214 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6216 @item -fmerge-constants
6217 @opindex fmerge-constants
6218 Attempt to merge identical constants (string constants and floating point
6219 constants) across compilation units.
6221 This option is the default for optimized compilation if the assembler and
6222 linker support it.  Use @option{-fno-merge-constants} to inhibit this
6223 behavior.
6225 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6227 @item -fmerge-all-constants
6228 @opindex fmerge-all-constants
6229 Attempt to merge identical constants and identical variables.
6231 This option implies @option{-fmerge-constants}.  In addition to
6232 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6233 arrays or initialized constant variables with integral or floating point
6234 types.  Languages like C or C++ require each variable, including multiple
6235 instances of the same variable in recursive calls, to have distinct locations,
6236 so using this option will result in non-conforming
6237 behavior.
6239 @item -fmodulo-sched
6240 @opindex fmodulo-sched
6241 Perform swing modulo scheduling immediately before the first scheduling
6242 pass.  This pass looks at innermost loops and reorders their
6243 instructions by overlapping different iterations.
6245 @item -fmodulo-sched-allow-regmoves
6246 @opindex fmodulo-sched-allow-regmoves
6247 Perform more aggressive SMS based modulo scheduling with register moves
6248 allowed.  By setting this flag certain anti-dependences edges will be
6249 deleted which will trigger the generation of reg-moves based on the
6250 life-range analysis.  This option is effective only with
6251 @option{-fmodulo-sched} enabled.
6253 @item -fno-branch-count-reg
6254 @opindex fno-branch-count-reg
6255 Do not use ``decrement and branch'' instructions on a count register,
6256 but instead generate a sequence of instructions that decrement a
6257 register, compare it against zero, then branch based upon the result.
6258 This option is only meaningful on architectures that support such
6259 instructions, which include x86, PowerPC, IA-64 and S/390.
6261 The default is @option{-fbranch-count-reg}.
6263 @item -fno-function-cse
6264 @opindex fno-function-cse
6265 Do not put function addresses in registers; make each instruction that
6266 calls a constant function contain the function's address explicitly.
6268 This option results in less efficient code, but some strange hacks
6269 that alter the assembler output may be confused by the optimizations
6270 performed when this option is not used.
6272 The default is @option{-ffunction-cse}
6274 @item -fno-zero-initialized-in-bss
6275 @opindex fno-zero-initialized-in-bss
6276 If the target supports a BSS section, GCC by default puts variables that
6277 are initialized to zero into BSS@.  This can save space in the resulting
6278 code.
6280 This option turns off this behavior because some programs explicitly
6281 rely on variables going to the data section.  E.g., so that the
6282 resulting executable can find the beginning of that section and/or make
6283 assumptions based on that.
6285 The default is @option{-fzero-initialized-in-bss}.
6287 @item -fmudflap -fmudflapth -fmudflapir
6288 @opindex fmudflap
6289 @opindex fmudflapth
6290 @opindex fmudflapir
6291 @cindex bounds checking
6292 @cindex mudflap
6293 For front-ends that support it (C and C++), instrument all risky
6294 pointer/array dereferencing operations, some standard library
6295 string/heap functions, and some other associated constructs with
6296 range/validity tests.  Modules so instrumented should be immune to
6297 buffer overflows, invalid heap use, and some other classes of C/C++
6298 programming errors.  The instrumentation relies on a separate runtime
6299 library (@file{libmudflap}), which will be linked into a program if
6300 @option{-fmudflap} is given at link time.  Run-time behavior of the
6301 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
6302 environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
6303 for its options.
6305 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
6306 link if your program is multi-threaded.  Use @option{-fmudflapir}, in
6307 addition to @option{-fmudflap} or @option{-fmudflapth}, if
6308 instrumentation should ignore pointer reads.  This produces less
6309 instrumentation (and therefore faster execution) and still provides
6310 some protection against outright memory corrupting writes, but allows
6311 erroneously read data to propagate within a program.
6313 @item -fthread-jumps
6314 @opindex fthread-jumps
6315 Perform optimizations where we check to see if a jump branches to a
6316 location where another comparison subsumed by the first is found.  If
6317 so, the first branch is redirected to either the destination of the
6318 second branch or a point immediately following it, depending on whether
6319 the condition is known to be true or false.
6321 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6323 @item -fsplit-wide-types
6324 @opindex fsplit-wide-types
6325 When using a type that occupies multiple registers, such as @code{long
6326 long} on a 32-bit system, split the registers apart and allocate them
6327 independently.  This normally generates better code for those types,
6328 but may make debugging more difficult.
6330 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6331 @option{-Os}.
6333 @item -fcse-follow-jumps
6334 @opindex fcse-follow-jumps
6335 In common subexpression elimination (CSE), scan through jump instructions
6336 when the target of the jump is not reached by any other path.  For
6337 example, when CSE encounters an @code{if} statement with an
6338 @code{else} clause, CSE will follow the jump when the condition
6339 tested is false.
6341 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6343 @item -fcse-skip-blocks
6344 @opindex fcse-skip-blocks
6345 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6346 follow jumps which conditionally skip over blocks.  When CSE
6347 encounters a simple @code{if} statement with no else clause,
6348 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6349 body of the @code{if}.
6351 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6353 @item -frerun-cse-after-loop
6354 @opindex frerun-cse-after-loop
6355 Re-run common subexpression elimination after loop optimizations has been
6356 performed.
6358 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6360 @item -fgcse
6361 @opindex fgcse
6362 Perform a global common subexpression elimination pass.
6363 This pass also performs global constant and copy propagation.
6365 @emph{Note:} When compiling a program using computed gotos, a GCC
6366 extension, you may get better runtime performance if you disable
6367 the global common subexpression elimination pass by adding
6368 @option{-fno-gcse} to the command line.
6370 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6372 @item -fgcse-lm
6373 @opindex fgcse-lm
6374 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
6375 attempt to move loads which are only killed by stores into themselves.  This
6376 allows a loop containing a load/store sequence to be changed to a load outside
6377 the loop, and a copy/store within the loop.
6379 Enabled by default when gcse is enabled.
6381 @item -fgcse-sm
6382 @opindex fgcse-sm
6383 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6384 global common subexpression elimination.  This pass will attempt to move
6385 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
6386 loops containing a load/store sequence can be changed to a load before
6387 the loop and a store after the loop.
6389 Not enabled at any optimization level.
6391 @item -fgcse-las
6392 @opindex fgcse-las
6393 When @option{-fgcse-las} is enabled, the global common subexpression
6394 elimination pass eliminates redundant loads that come after stores to the
6395 same memory location (both partial and full redundancies).
6397 Not enabled at any optimization level.
6399 @item -fgcse-after-reload
6400 @opindex fgcse-after-reload
6401 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6402 pass is performed after reload.  The purpose of this pass is to cleanup
6403 redundant spilling.
6405 @item -funsafe-loop-optimizations
6406 @opindex funsafe-loop-optimizations
6407 If given, the loop optimizer will assume that loop indices do not
6408 overflow, and that the loops with nontrivial exit condition are not
6409 infinite.  This enables a wider range of loop optimizations even if
6410 the loop optimizer itself cannot prove that these assumptions are valid.
6411 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
6412 if it finds this kind of loop.
6414 @item -fcrossjumping
6415 @opindex fcrossjumping
6416 Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
6417 resulting code may or may not perform better than without cross-jumping.
6419 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6421 @item -fauto-inc-dec
6422 @opindex fauto-inc-dec
6423 Combine increments or decrements of addresses with memory accesses.
6424 This pass is always skipped on architectures that do not have
6425 instructions to support this.  Enabled by default at @option{-O} and
6426 higher on architectures that support this.
6428 @item -fdce
6429 @opindex fdce
6430 Perform dead code elimination (DCE) on RTL@.
6431 Enabled by default at @option{-O} and higher.
6433 @item -fdse
6434 @opindex fdse
6435 Perform dead store elimination (DSE) on RTL@.
6436 Enabled by default at @option{-O} and higher.
6438 @item -fif-conversion
6439 @opindex fif-conversion
6440 Attempt to transform conditional jumps into branch-less equivalents.  This
6441 include use of conditional moves, min, max, set flags and abs instructions, and
6442 some tricks doable by standard arithmetics.  The use of conditional execution
6443 on chips where it is available is controlled by @code{if-conversion2}.
6445 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6447 @item -fif-conversion2
6448 @opindex fif-conversion2
6449 Use conditional execution (where available) to transform conditional jumps into
6450 branch-less equivalents.
6452 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6454 @item -fdelete-null-pointer-checks
6455 @opindex fdelete-null-pointer-checks
6456 Assume that programs cannot safely dereference null pointers, and that
6457 no code or data element resides there.  This enables simple constant
6458 folding optimizations at all optimization levels.  In addition, other
6459 optimization passes in GCC use this flag to control global dataflow
6460 analyses that eliminate useless checks for null pointers; these assume
6461 that if a pointer is checked after it has already been dereferenced,
6462 it cannot be null.
6464 Note however that in some environments this assumption is not true.
6465 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6466 for programs which depend on that behavior.
6468 Some targets, especially embedded ones, disable this option at all levels.
6469 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
6470 @option{-O2}, @option{-O3}, @option{-Os}.  Passes that use the information
6471 are enabled independently at different optimization levels.
6473 @item -fdevirtualize
6474 @opindex fdevirtualize
6475 Attempt to convert calls to virtual functions to direct calls.  This
6476 is done both within a procedure and interprocedurally as part of
6477 indirect inlining (@code{-findirect-inlining}) and interprocedural constant
6478 propagation (@option{-fipa-cp}).
6479 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6481 @item -fexpensive-optimizations
6482 @opindex fexpensive-optimizations
6483 Perform a number of minor optimizations that are relatively expensive.
6485 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6487 @item -foptimize-register-move
6488 @itemx -fregmove
6489 @opindex foptimize-register-move
6490 @opindex fregmove
6491 Attempt to reassign register numbers in move instructions and as
6492 operands of other simple instructions in order to maximize the amount of
6493 register tying.  This is especially helpful on machines with two-operand
6494 instructions.
6496 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
6497 optimization.
6499 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6501 @item -fira-algorithm=@var{algorithm}
6502 Use specified coloring algorithm for the integrated register
6503 allocator.  The @var{algorithm} argument should be @code{priority} or
6504 @code{CB}.  The first algorithm specifies Chow's priority coloring,
6505 the second one specifies Chaitin-Briggs coloring.  The second
6506 algorithm can be unimplemented for some architectures.  If it is
6507 implemented, it is the default because Chaitin-Briggs coloring as a
6508 rule generates a better code.
6510 @item -fira-region=@var{region}
6511 Use specified regions for the integrated register allocator.  The
6512 @var{region} argument should be one of @code{all}, @code{mixed}, or
6513 @code{one}.  The first value means using all loops as register
6514 allocation regions, the second value which is the default means using
6515 all loops except for loops with small register pressure as the
6516 regions, and third one means using all function as a single region.
6517 The first value can give best result for machines with small size and
6518 irregular register set, the third one results in faster and generates
6519 decent code and the smallest size code, and the default value usually
6520 give the best results in most cases and for most architectures.
6522 @item -fira-loop-pressure
6523 @opindex fira-loop-pressure
6524 Use IRA to evaluate register pressure in loops for decision to move
6525 loop invariants.  Usage of this option usually results in generation
6526 of faster and smaller code on machines with big register files (>= 32
6527 registers) but it can slow compiler down.
6529 This option is enabled at level @option{-O3} for some targets.
6531 @item -fno-ira-share-save-slots
6532 @opindex fno-ira-share-save-slots
6533 Switch off sharing stack slots used for saving call used hard
6534 registers living through a call.  Each hard register will get a
6535 separate stack slot and as a result function stack frame will be
6536 bigger.
6538 @item -fno-ira-share-spill-slots
6539 @opindex fno-ira-share-spill-slots
6540 Switch off sharing stack slots allocated for pseudo-registers.  Each
6541 pseudo-register which did not get a hard register will get a separate
6542 stack slot and as a result function stack frame will be bigger.
6544 @item -fira-verbose=@var{n}
6545 @opindex fira-verbose
6546 Set up how verbose dump file for the integrated register allocator
6547 will be.  Default value is 5.  If the value is greater or equal to 10,
6548 the dump file will be stderr as if the value were @var{n} minus 10.
6550 @item -fdelayed-branch
6551 @opindex fdelayed-branch
6552 If supported for the target machine, attempt to reorder instructions
6553 to exploit instruction slots available after delayed branch
6554 instructions.
6556 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6558 @item -fschedule-insns
6559 @opindex fschedule-insns
6560 If supported for the target machine, attempt to reorder instructions to
6561 eliminate execution stalls due to required data being unavailable.  This
6562 helps machines that have slow floating point or memory load instructions
6563 by allowing other instructions to be issued until the result of the load
6564 or floating point instruction is required.
6566 Enabled at levels @option{-O2}, @option{-O3}.
6568 @item -fschedule-insns2
6569 @opindex fschedule-insns2
6570 Similar to @option{-fschedule-insns}, but requests an additional pass of
6571 instruction scheduling after register allocation has been done.  This is
6572 especially useful on machines with a relatively small number of
6573 registers and where memory load instructions take more than one cycle.
6575 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6577 @item -fno-sched-interblock
6578 @opindex fno-sched-interblock
6579 Don't schedule instructions across basic blocks.  This is normally
6580 enabled by default when scheduling before register allocation, i.e.@:
6581 with @option{-fschedule-insns} or at @option{-O2} or higher.
6583 @item -fno-sched-spec
6584 @opindex fno-sched-spec
6585 Don't allow speculative motion of non-load instructions.  This is normally
6586 enabled by default when scheduling before register allocation, i.e.@:
6587 with @option{-fschedule-insns} or at @option{-O2} or higher.
6589 @item -fsched-pressure
6590 @opindex fsched-pressure
6591 Enable register pressure sensitive insn scheduling before the register
6592 allocation.  This only makes sense when scheduling before register
6593 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
6594 @option{-O2} or higher.  Usage of this option can improve the
6595 generated code and decrease its size by preventing register pressure
6596 increase above the number of available hard registers and as a
6597 consequence register spills in the register allocation.
6599 @item -fsched-spec-load
6600 @opindex fsched-spec-load
6601 Allow speculative motion of some load instructions.  This only makes
6602 sense when scheduling before register allocation, i.e.@: with
6603 @option{-fschedule-insns} or at @option{-O2} or higher.
6605 @item -fsched-spec-load-dangerous
6606 @opindex fsched-spec-load-dangerous
6607 Allow speculative motion of more load instructions.  This only makes
6608 sense when scheduling before register allocation, i.e.@: with
6609 @option{-fschedule-insns} or at @option{-O2} or higher.
6611 @item -fsched-stalled-insns
6612 @itemx -fsched-stalled-insns=@var{n}
6613 @opindex fsched-stalled-insns
6614 Define how many insns (if any) can be moved prematurely from the queue
6615 of stalled insns into the ready list, during the second scheduling pass.
6616 @option{-fno-sched-stalled-insns} means that no insns will be moved
6617 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6618 on how many queued insns can be moved prematurely.
6619 @option{-fsched-stalled-insns} without a value is equivalent to
6620 @option{-fsched-stalled-insns=1}.
6622 @item -fsched-stalled-insns-dep
6623 @itemx -fsched-stalled-insns-dep=@var{n}
6624 @opindex fsched-stalled-insns-dep
6625 Define how many insn groups (cycles) will be examined for a dependency
6626 on a stalled insn that is candidate for premature removal from the queue
6627 of stalled insns.  This has an effect only during the second scheduling pass,
6628 and only if @option{-fsched-stalled-insns} is used.
6629 @option{-fno-sched-stalled-insns-dep} is equivalent to
6630 @option{-fsched-stalled-insns-dep=0}.
6631 @option{-fsched-stalled-insns-dep} without a value is equivalent to
6632 @option{-fsched-stalled-insns-dep=1}.
6634 @item -fsched2-use-superblocks
6635 @opindex fsched2-use-superblocks
6636 When scheduling after register allocation, do use superblock scheduling
6637 algorithm.  Superblock scheduling allows motion across basic block boundaries
6638 resulting on faster schedules.  This option is experimental, as not all machine
6639 descriptions used by GCC model the CPU closely enough to avoid unreliable
6640 results from the algorithm.
6642 This only makes sense when scheduling after register allocation, i.e.@: with
6643 @option{-fschedule-insns2} or at @option{-O2} or higher.
6645 @item -fsched-group-heuristic
6646 @opindex fsched-group-heuristic
6647 Enable the group heuristic in the scheduler.  This heuristic favors 
6648 the instruction that belongs to a schedule group.  This is enabled 
6649 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 
6650 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6652 @item -fsched-critical-path-heuristic
6653 @opindex fsched-critical-path-heuristic
6654 Enable the critical-path heuristic in the scheduler.  This heuristic favors 
6655 instructions on the critical path.  This is enabled by default when 
6656 scheduling is enabled, i.e.@: with @option{-fschedule-insns} 
6657 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6659 @item -fsched-spec-insn-heuristic
6660 @opindex fsched-spec-insn-heuristic
6661 Enable the speculative instruction heuristic in the scheduler.  This 
6662 heuristic favors speculative instructions with greater dependency weakness.  
6663 This is enabled by default when scheduling is enabled, i.e.@: 
6664 with @option{-fschedule-insns} or @option{-fschedule-insns2} 
6665 or at @option{-O2} or higher.
6667 @item -fsched-rank-heuristic
6668 @opindex fsched-rank-heuristic
6669 Enable the rank heuristic in the scheduler.  This heuristic favors 
6670 the instruction belonging to a basic block with greater size or frequency.  
6671 This is enabled by default when scheduling is enabled, i.e.@: 
6672 with @option{-fschedule-insns} or @option{-fschedule-insns2} or 
6673 at @option{-O2} or higher.
6675 @item -fsched-last-insn-heuristic
6676 @opindex fsched-last-insn-heuristic
6677 Enable the last-instruction heuristic in the scheduler.  This heuristic 
6678 favors the instruction that is less dependent on the last instruction
6679 scheduled.  This is enabled by default when scheduling is enabled, 
6680 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 
6681 at @option{-O2} or higher.
6683 @item -fsched-dep-count-heuristic
6684 @opindex fsched-dep-count-heuristic
6685 Enable the dependent-count heuristic in the scheduler.  This heuristic 
6686 favors the instruction that has more instructions depending on it.  
6687 This is enabled by default when scheduling is enabled, i.e.@: 
6688 with @option{-fschedule-insns} or @option{-fschedule-insns2} or 
6689 at @option{-O2} or higher.
6691 @item -freschedule-modulo-scheduled-loops
6692 @opindex freschedule-modulo-scheduled-loops
6693 The modulo scheduling comes before the traditional scheduling, if a loop
6694 was modulo scheduled we may want to prevent the later scheduling passes
6695 from changing its schedule, we use this option to control that.
6697 @item -fselective-scheduling
6698 @opindex fselective-scheduling
6699 Schedule instructions using selective scheduling algorithm.  Selective
6700 scheduling runs instead of the first scheduler pass.
6702 @item -fselective-scheduling2
6703 @opindex fselective-scheduling2
6704 Schedule instructions using selective scheduling algorithm.  Selective
6705 scheduling runs instead of the second scheduler pass.
6707 @item -fsel-sched-pipelining
6708 @opindex fsel-sched-pipelining
6709 Enable software pipelining of innermost loops during selective scheduling.
6710 This option has no effect until one of @option{-fselective-scheduling} or
6711 @option{-fselective-scheduling2} is turned on.
6713 @item -fsel-sched-pipelining-outer-loops
6714 @opindex fsel-sched-pipelining-outer-loops
6715 When pipelining loops during selective scheduling, also pipeline outer loops.
6716 This option has no effect until @option{-fsel-sched-pipelining} is turned on.
6718 @item -fcaller-saves
6719 @opindex fcaller-saves
6720 Enable values to be allocated in registers that will be clobbered by
6721 function calls, by emitting extra instructions to save and restore the
6722 registers around such calls.  Such allocation is done only when it
6723 seems to result in better code than would otherwise be produced.
6725 This option is always enabled by default on certain machines, usually
6726 those which have no call-preserved registers to use instead.
6728 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6730 @item -fcombine-stack-adjustments
6731 @opindex fcombine-stack-adjustments
6732 Tracks stack adjustments (pushes and pops) and stack memory references
6733 and then tries to find ways to combine them.
6735 Enabled by default at @option{-O1} and higher.
6737 @item -fconserve-stack
6738 @opindex fconserve-stack
6739 Attempt to minimize stack usage.  The compiler will attempt to use less
6740 stack space, even if that makes the program slower.  This option
6741 implies setting the @option{large-stack-frame} parameter to 100
6742 and the @option{large-stack-frame-growth} parameter to 400.
6744 @item -ftree-reassoc
6745 @opindex ftree-reassoc
6746 Perform reassociation on trees.  This flag is enabled by default
6747 at @option{-O} and higher.
6749 @item -ftree-pre
6750 @opindex ftree-pre
6751 Perform partial redundancy elimination (PRE) on trees.  This flag is
6752 enabled by default at @option{-O2} and @option{-O3}.
6754 @item -ftree-forwprop
6755 @opindex ftree-forwprop
6756 Perform forward propagation on trees.  This flag is enabled by default
6757 at @option{-O} and higher.
6759 @item -ftree-fre
6760 @opindex ftree-fre
6761 Perform full redundancy elimination (FRE) on trees.  The difference
6762 between FRE and PRE is that FRE only considers expressions
6763 that are computed on all paths leading to the redundant computation.
6764 This analysis is faster than PRE, though it exposes fewer redundancies.
6765 This flag is enabled by default at @option{-O} and higher.
6767 @item -ftree-phiprop
6768 @opindex ftree-phiprop
6769 Perform hoisting of loads from conditional pointers on trees.  This
6770 pass is enabled by default at @option{-O} and higher.
6772 @item -ftree-copy-prop
6773 @opindex ftree-copy-prop
6774 Perform copy propagation on trees.  This pass eliminates unnecessary
6775 copy operations.  This flag is enabled by default at @option{-O} and
6776 higher.
6778 @item -fipa-pure-const
6779 @opindex fipa-pure-const
6780 Discover which functions are pure or constant.
6781 Enabled by default at @option{-O} and higher.
6783 @item -fipa-reference
6784 @opindex fipa-reference
6785 Discover which static variables do not escape cannot escape the
6786 compilation unit.
6787 Enabled by default at @option{-O} and higher.
6789 @item -fipa-pta
6790 @opindex fipa-pta
6791 Perform interprocedural pointer analysis and interprocedural modification
6792 and reference analysis.  This option can cause excessive memory and
6793 compile-time usage on large compilation units.  It is not enabled by
6794 default at any optimization level.
6796 @item -fipa-profile
6797 @opindex fipa-profile
6798 Perform interprocedural profile propagation.  The functions called only from
6799 cold functions are marked as cold. Also functions executed once (such as
6800 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
6801 functions and loop less parts of functions executed once are then optimized for
6802 size.
6803 Enabled by default at @option{-O} and higher.
6805 @item -fipa-cp
6806 @opindex fipa-cp
6807 Perform interprocedural constant propagation.
6808 This optimization analyzes the program to determine when values passed
6809 to functions are constants and then optimizes accordingly.
6810 This optimization can substantially increase performance
6811 if the application has constants passed to functions.
6812 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
6814 @item -fipa-cp-clone
6815 @opindex fipa-cp-clone
6816 Perform function cloning to make interprocedural constant propagation stronger.
6817 When enabled, interprocedural constant propagation will perform function cloning
6818 when externally visible function can be called with constant arguments.
6819 Because this optimization can create multiple copies of functions,
6820 it may significantly increase code size
6821 (see @option{--param ipcp-unit-growth=@var{value}}).
6822 This flag is enabled by default at @option{-O3}.
6824 @item -fipa-matrix-reorg
6825 @opindex fipa-matrix-reorg
6826 Perform matrix flattening and transposing.
6827 Matrix flattening tries to replace an @math{m}-dimensional matrix
6828 with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
6829 This reduces the level of indirection needed for accessing the elements
6830 of the matrix. The second optimization is matrix transposing that
6831 attempts to change the order of the matrix's dimensions in order to
6832 improve cache locality.
6833 Both optimizations need the @option{-fwhole-program} flag.
6834 Transposing is enabled only if profiling information is available.
6836 @item -ftree-sink
6837 @opindex ftree-sink
6838 Perform forward store motion  on trees.  This flag is
6839 enabled by default at @option{-O} and higher.
6841 @item -ftree-bit-ccp
6842 @opindex ftree-bit-ccp
6843 Perform sparse conditional bit constant propagation on trees and propagate
6844 pointer alignment information.
6845 This pass only operates on local scalar variables and is enabled by default
6846 at @option{-O} and higher.  It requires that @option{-ftree-ccp} is enabled.
6848 @item -ftree-ccp
6849 @opindex ftree-ccp
6850 Perform sparse conditional constant propagation (CCP) on trees.  This
6851 pass only operates on local scalar variables and is enabled by default
6852 at @option{-O} and higher.
6854 @item -ftree-switch-conversion
6855 Perform conversion of simple initializations in a switch to
6856 initializations from a scalar array.  This flag is enabled by default
6857 at @option{-O2} and higher.
6859 @item -ftree-dce
6860 @opindex ftree-dce
6861 Perform dead code elimination (DCE) on trees.  This flag is enabled by
6862 default at @option{-O} and higher.
6864 @item -ftree-builtin-call-dce
6865 @opindex ftree-builtin-call-dce
6866 Perform conditional dead code elimination (DCE) for calls to builtin functions
6867 that may set @code{errno} but are otherwise side-effect free.  This flag is
6868 enabled by default at @option{-O2} and higher if @option{-Os} is not also
6869 specified.
6871 @item -ftree-dominator-opts
6872 @opindex ftree-dominator-opts
6873 Perform a variety of simple scalar cleanups (constant/copy
6874 propagation, redundancy elimination, range propagation and expression
6875 simplification) based on a dominator tree traversal.  This also
6876 performs jump threading (to reduce jumps to jumps). This flag is
6877 enabled by default at @option{-O} and higher.
6879 @item -ftree-dse
6880 @opindex ftree-dse
6881 Perform dead store elimination (DSE) on trees.  A dead store is a store into
6882 a memory location which will later be overwritten by another store without
6883 any intervening loads.  In this case the earlier store can be deleted.  This
6884 flag is enabled by default at @option{-O} and higher.
6886 @item -ftree-ch
6887 @opindex ftree-ch
6888 Perform loop header copying on trees.  This is beneficial since it increases
6889 effectiveness of code motion optimizations.  It also saves one jump.  This flag
6890 is enabled by default at @option{-O} and higher.  It is not enabled
6891 for @option{-Os}, since it usually increases code size.
6893 @item -ftree-loop-optimize
6894 @opindex ftree-loop-optimize
6895 Perform loop optimizations on trees.  This flag is enabled by default
6896 at @option{-O} and higher.
6898 @item -ftree-loop-linear
6899 @opindex ftree-loop-linear
6900 Perform loop interchange transformations on tree.  Same as
6901 @option{-floop-interchange}.  To use this code transformation, GCC has
6902 to be configured with @option{--with-ppl} and @option{--with-cloog} to
6903 enable the Graphite loop transformation infrastructure.
6905 @item -floop-interchange
6906 @opindex floop-interchange
6907 Perform loop interchange transformations on loops.  Interchanging two
6908 nested loops switches the inner and outer loops.  For example, given a
6909 loop like:
6910 @smallexample
6911 DO J = 1, M
6912   DO I = 1, N
6913     A(J, I) = A(J, I) * C
6914   ENDDO
6915 ENDDO
6916 @end smallexample
6917 loop interchange will transform the loop as if the user had written:
6918 @smallexample
6919 DO I = 1, N
6920   DO J = 1, M
6921     A(J, I) = A(J, I) * C
6922   ENDDO
6923 ENDDO
6924 @end smallexample
6925 which can be beneficial when @code{N} is larger than the caches,
6926 because in Fortran, the elements of an array are stored in memory
6927 contiguously by column, and the original loop iterates over rows,
6928 potentially creating at each access a cache miss.  This optimization
6929 applies to all the languages supported by GCC and is not limited to
6930 Fortran.  To use this code transformation, GCC has to be configured
6931 with @option{--with-ppl} and @option{--with-cloog} to enable the
6932 Graphite loop transformation infrastructure.
6934 @item -floop-strip-mine
6935 @opindex floop-strip-mine
6936 Perform loop strip mining transformations on loops.  Strip mining
6937 splits a loop into two nested loops.  The outer loop has strides
6938 equal to the strip size and the inner loop has strides of the
6939 original loop within a strip.  The strip length can be changed
6940 using the @option{loop-block-tile-size} parameter.  For example,
6941 given a loop like:
6942 @smallexample
6943 DO I = 1, N
6944   A(I) = A(I) + C
6945 ENDDO
6946 @end smallexample
6947 loop strip mining will transform the loop as if the user had written:
6948 @smallexample
6949 DO II = 1, N, 51
6950   DO I = II, min (II + 50, N)
6951     A(I) = A(I) + C
6952   ENDDO
6953 ENDDO
6954 @end smallexample
6955 This optimization applies to all the languages supported by GCC and is
6956 not limited to Fortran.  To use this code transformation, GCC has to
6957 be configured with @option{--with-ppl} and @option{--with-cloog} to
6958 enable the Graphite loop transformation infrastructure.
6960 @item -floop-block
6961 @opindex floop-block
6962 Perform loop blocking transformations on loops.  Blocking strip mines
6963 each loop in the loop nest such that the memory accesses of the
6964 element loops fit inside caches.  The strip length can be changed
6965 using the @option{loop-block-tile-size} parameter.  For example, given
6966 a loop like:
6967 @smallexample
6968 DO I = 1, N
6969   DO J = 1, M
6970     A(J, I) = B(I) + C(J)
6971   ENDDO
6972 ENDDO
6973 @end smallexample
6974 loop blocking will transform the loop as if the user had written:
6975 @smallexample
6976 DO II = 1, N, 51
6977   DO JJ = 1, M, 51
6978     DO I = II, min (II + 50, N)
6979       DO J = JJ, min (JJ + 50, M)
6980         A(J, I) = B(I) + C(J)
6981       ENDDO
6982     ENDDO
6983   ENDDO
6984 ENDDO
6985 @end smallexample
6986 which can be beneficial when @code{M} is larger than the caches,
6987 because the innermost loop will iterate over a smaller amount of data
6988 that can be kept in the caches.  This optimization applies to all the
6989 languages supported by GCC and is not limited to Fortran.  To use this
6990 code transformation, GCC has to be configured with @option{--with-ppl}
6991 and @option{--with-cloog} to enable the Graphite loop transformation
6992 infrastructure.
6994 @item -fgraphite-identity
6995 @opindex fgraphite-identity
6996 Enable the identity transformation for graphite.  For every SCoP we generate
6997 the polyhedral representation and transform it back to gimple.  Using
6998 @option{-fgraphite-identity} we can check the costs or benefits of the
6999 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
7000 are also performed by the code generator CLooG, like index splitting and
7001 dead code elimination in loops.
7003 @item -floop-flatten
7004 @opindex floop-flatten
7005 Removes the loop nesting structure: transforms the loop nest into a
7006 single loop.  This transformation can be useful to vectorize all the
7007 levels of the loop nest.
7009 @item -floop-parallelize-all
7010 @opindex floop-parallelize-all
7011 Use the Graphite data dependence analysis to identify loops that can
7012 be parallelized.  Parallelize all the loops that can be analyzed to
7013 not contain loop carried dependences without checking that it is
7014 profitable to parallelize the loops.
7016 @item -fcheck-data-deps
7017 @opindex fcheck-data-deps
7018 Compare the results of several data dependence analyzers.  This option
7019 is used for debugging the data dependence analyzers.
7021 @item -ftree-loop-if-convert
7022 Attempt to transform conditional jumps in the innermost loops to
7023 branch-less equivalents.  The intent is to remove control-flow from
7024 the innermost loops in order to improve the ability of the
7025 vectorization pass to handle these loops.  This is enabled by default
7026 if vectorization is enabled.
7028 @item -ftree-loop-if-convert-stores
7029 Attempt to also if-convert conditional jumps containing memory writes.
7030 This transformation can be unsafe for multi-threaded programs as it
7031 transforms conditional memory writes into unconditional memory writes.
7032 For example,
7033 @smallexample
7034 for (i = 0; i < N; i++)
7035   if (cond)
7036     A[i] = expr;
7037 @end smallexample
7038 would be transformed to
7039 @smallexample
7040 for (i = 0; i < N; i++)
7041   A[i] = cond ? expr : A[i];
7042 @end smallexample
7043 potentially producing data races.
7045 @item -ftree-loop-distribution
7046 Perform loop distribution.  This flag can improve cache performance on
7047 big loop bodies and allow further loop optimizations, like
7048 parallelization or vectorization, to take place.  For example, the loop
7049 @smallexample
7050 DO I = 1, N
7051   A(I) = B(I) + C
7052   D(I) = E(I) * F
7053 ENDDO
7054 @end smallexample
7055 is transformed to
7056 @smallexample
7057 DO I = 1, N
7058    A(I) = B(I) + C
7059 ENDDO
7060 DO I = 1, N
7061    D(I) = E(I) * F
7062 ENDDO
7063 @end smallexample
7065 @item -ftree-loop-distribute-patterns
7066 Perform loop distribution of patterns that can be code generated with
7067 calls to a library.  This flag is enabled by default at @option{-O3}.
7069 This pass distributes the initialization loops and generates a call to
7070 memset zero.  For example, the loop
7071 @smallexample
7072 DO I = 1, N
7073   A(I) = 0
7074   B(I) = A(I) + I
7075 ENDDO
7076 @end smallexample
7077 is transformed to
7078 @smallexample
7079 DO I = 1, N
7080    A(I) = 0
7081 ENDDO
7082 DO I = 1, N
7083    B(I) = A(I) + I
7084 ENDDO
7085 @end smallexample
7086 and the initialization loop is transformed into a call to memset zero.
7088 @item -ftree-loop-im
7089 @opindex ftree-loop-im
7090 Perform loop invariant motion on trees.  This pass moves only invariants that
7091 would be hard to handle at RTL level (function calls, operations that expand to
7092 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
7093 operands of conditions that are invariant out of the loop, so that we can use
7094 just trivial invariantness analysis in loop unswitching.  The pass also includes
7095 store motion.
7097 @item -ftree-loop-ivcanon
7098 @opindex ftree-loop-ivcanon
7099 Create a canonical counter for number of iterations in the loop for that
7100 determining number of iterations requires complicated analysis.  Later
7101 optimizations then may determine the number easily.  Useful especially
7102 in connection with unrolling.
7104 @item -fivopts
7105 @opindex fivopts
7106 Perform induction variable optimizations (strength reduction, induction
7107 variable merging and induction variable elimination) on trees.
7109 @item -ftree-parallelize-loops=n
7110 @opindex ftree-parallelize-loops
7111 Parallelize loops, i.e., split their iteration space to run in n threads.
7112 This is only possible for loops whose iterations are independent
7113 and can be arbitrarily reordered.  The optimization is only
7114 profitable on multiprocessor machines, for loops that are CPU-intensive,
7115 rather than constrained e.g.@: by memory bandwidth.  This option
7116 implies @option{-pthread}, and thus is only supported on targets
7117 that have support for @option{-pthread}.
7119 @item -ftree-pta
7120 @opindex ftree-pta
7121 Perform function-local points-to analysis on trees.  This flag is
7122 enabled by default at @option{-O} and higher.
7124 @item -ftree-sra
7125 @opindex ftree-sra
7126 Perform scalar replacement of aggregates.  This pass replaces structure
7127 references with scalars to prevent committing structures to memory too
7128 early.  This flag is enabled by default at @option{-O} and higher.
7130 @item -ftree-copyrename
7131 @opindex ftree-copyrename
7132 Perform copy renaming on trees.  This pass attempts to rename compiler
7133 temporaries to other variables at copy locations, usually resulting in
7134 variable names which more closely resemble the original variables.  This flag
7135 is enabled by default at @option{-O} and higher.
7137 @item -ftree-ter
7138 @opindex ftree-ter
7139 Perform temporary expression replacement during the SSA->normal phase.  Single
7140 use/single def temporaries are replaced at their use location with their
7141 defining expression.  This results in non-GIMPLE code, but gives the expanders
7142 much more complex trees to work on resulting in better RTL generation.  This is
7143 enabled by default at @option{-O} and higher.
7145 @item -ftree-vectorize
7146 @opindex ftree-vectorize
7147 Perform loop vectorization on trees. This flag is enabled by default at
7148 @option{-O3}.
7150 @item -ftree-slp-vectorize
7151 @opindex ftree-slp-vectorize
7152 Perform basic block vectorization on trees. This flag is enabled by default at
7153 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7155 @item -ftree-vect-loop-version
7156 @opindex ftree-vect-loop-version
7157 Perform loop versioning when doing loop vectorization on trees.  When a loop
7158 appears to be vectorizable except that data alignment or data dependence cannot
7159 be determined at compile time then vectorized and non-vectorized versions of
7160 the loop are generated along with runtime checks for alignment or dependence
7161 to control which version is executed.  This option is enabled by default
7162 except at level @option{-Os} where it is disabled.
7164 @item -fvect-cost-model
7165 @opindex fvect-cost-model
7166 Enable cost model for vectorization.
7168 @item -ftree-vrp
7169 @opindex ftree-vrp
7170 Perform Value Range Propagation on trees.  This is similar to the
7171 constant propagation pass, but instead of values, ranges of values are
7172 propagated.  This allows the optimizers to remove unnecessary range
7173 checks like array bound checks and null pointer checks.  This is
7174 enabled by default at @option{-O2} and higher.  Null pointer check
7175 elimination is only done if @option{-fdelete-null-pointer-checks} is
7176 enabled.
7178 @item -ftracer
7179 @opindex ftracer
7180 Perform tail duplication to enlarge superblock size.  This transformation
7181 simplifies the control flow of the function allowing other optimizations to do
7182 better job.
7184 @item -funroll-loops
7185 @opindex funroll-loops
7186 Unroll loops whose number of iterations can be determined at compile
7187 time or upon entry to the loop.  @option{-funroll-loops} implies
7188 @option{-frerun-cse-after-loop}.  This option makes code larger,
7189 and may or may not make it run faster.
7191 @item -funroll-all-loops
7192 @opindex funroll-all-loops
7193 Unroll all loops, even if their number of iterations is uncertain when
7194 the loop is entered.  This usually makes programs run more slowly.
7195 @option{-funroll-all-loops} implies the same options as
7196 @option{-funroll-loops},
7198 @item -fsplit-ivs-in-unroller
7199 @opindex fsplit-ivs-in-unroller
7200 Enables expressing of values of induction variables in later iterations
7201 of the unrolled loop using the value in the first iteration.  This breaks
7202 long dependency chains, thus improving efficiency of the scheduling passes.
7204 Combination of @option{-fweb} and CSE is often sufficient to obtain the
7205 same effect.  However in cases the loop body is more complicated than
7206 a single basic block, this is not reliable.  It also does not work at all
7207 on some of the architectures due to restrictions in the CSE pass.
7209 This optimization is enabled by default.
7211 @item -fvariable-expansion-in-unroller
7212 @opindex fvariable-expansion-in-unroller
7213 With this option, the compiler will create multiple copies of some
7214 local variables when unrolling a loop which can result in superior code.
7216 @item -fpartial-inlining
7217 @opindex fpartial-inlining
7218 Inline parts of functions.  This option has any effect only
7219 when inlining itself is turned on by the @option{-finline-functions}
7220 or @option{-finline-small-functions} options.
7222 Enabled at level @option{-O2}.
7224 @item -fpredictive-commoning
7225 @opindex fpredictive-commoning
7226 Perform predictive commoning optimization, i.e., reusing computations
7227 (especially memory loads and stores) performed in previous
7228 iterations of loops.
7230 This option is enabled at level @option{-O3}.
7232 @item -fprefetch-loop-arrays
7233 @opindex fprefetch-loop-arrays
7234 If supported by the target machine, generate instructions to prefetch
7235 memory to improve the performance of loops that access large arrays.
7237 This option may generate better or worse code; results are highly
7238 dependent on the structure of loops within the source code.
7240 Disabled at level @option{-Os}.
7242 @item -fno-peephole
7243 @itemx -fno-peephole2
7244 @opindex fno-peephole
7245 @opindex fno-peephole2
7246 Disable any machine-specific peephole optimizations.  The difference
7247 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7248 are implemented in the compiler; some targets use one, some use the
7249 other, a few use both.
7251 @option{-fpeephole} is enabled by default.
7252 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7254 @item -fno-guess-branch-probability
7255 @opindex fno-guess-branch-probability
7256 Do not guess branch probabilities using heuristics.
7258 GCC will use heuristics to guess branch probabilities if they are
7259 not provided by profiling feedback (@option{-fprofile-arcs}).  These
7260 heuristics are based on the control flow graph.  If some branch probabilities
7261 are specified by @samp{__builtin_expect}, then the heuristics will be
7262 used to guess branch probabilities for the rest of the control flow graph,
7263 taking the @samp{__builtin_expect} info into account.  The interactions
7264 between the heuristics and @samp{__builtin_expect} can be complex, and in
7265 some cases, it may be useful to disable the heuristics so that the effects
7266 of @samp{__builtin_expect} are easier to understand.
7268 The default is @option{-fguess-branch-probability} at levels
7269 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7271 @item -freorder-blocks
7272 @opindex freorder-blocks
7273 Reorder basic blocks in the compiled function in order to reduce number of
7274 taken branches and improve code locality.
7276 Enabled at levels @option{-O2}, @option{-O3}.
7278 @item -freorder-blocks-and-partition
7279 @opindex freorder-blocks-and-partition
7280 In addition to reordering basic blocks in the compiled function, in order
7281 to reduce number of taken branches, partitions hot and cold basic blocks
7282 into separate sections of the assembly and .o files, to improve
7283 paging and cache locality performance.
7285 This optimization is automatically turned off in the presence of
7286 exception handling, for linkonce sections, for functions with a user-defined
7287 section attribute and on any architecture that does not support named
7288 sections.
7290 @item -freorder-functions
7291 @opindex freorder-functions
7292 Reorder functions in the object file in order to
7293 improve code locality.  This is implemented by using special
7294 subsections @code{.text.hot} for most frequently executed functions and
7295 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
7296 the linker so object file format must support named sections and linker must
7297 place them in a reasonable way.
7299 Also profile feedback must be available in to make this option effective.  See
7300 @option{-fprofile-arcs} for details.
7302 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7304 @item -fstrict-aliasing
7305 @opindex fstrict-aliasing
7306 Allow the compiler to assume the strictest aliasing rules applicable to
7307 the language being compiled.  For C (and C++), this activates
7308 optimizations based on the type of expressions.  In particular, an
7309 object of one type is assumed never to reside at the same address as an
7310 object of a different type, unless the types are almost the same.  For
7311 example, an @code{unsigned int} can alias an @code{int}, but not a
7312 @code{void*} or a @code{double}.  A character type may alias any other
7313 type.
7315 @anchor{Type-punning}Pay special attention to code like this:
7316 @smallexample
7317 union a_union @{
7318   int i;
7319   double d;
7322 int f() @{
7323   union a_union t;
7324   t.d = 3.0;
7325   return t.i;
7327 @end smallexample
7328 The practice of reading from a different union member than the one most
7329 recently written to (called ``type-punning'') is common.  Even with
7330 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7331 is accessed through the union type.  So, the code above will work as
7332 expected.  @xref{Structures unions enumerations and bit-fields
7333 implementation}.  However, this code might not:
7334 @smallexample
7335 int f() @{
7336   union a_union t;
7337   int* ip;
7338   t.d = 3.0;
7339   ip = &t.i;
7340   return *ip;
7342 @end smallexample
7344 Similarly, access by taking the address, casting the resulting pointer
7345 and dereferencing the result has undefined behavior, even if the cast
7346 uses a union type, e.g.:
7347 @smallexample
7348 int f() @{
7349   double d = 3.0;
7350   return ((union a_union *) &d)->i;
7352 @end smallexample
7354 The @option{-fstrict-aliasing} option is enabled at levels
7355 @option{-O2}, @option{-O3}, @option{-Os}.
7357 @item -fstrict-overflow
7358 @opindex fstrict-overflow
7359 Allow the compiler to assume strict signed overflow rules, depending
7360 on the language being compiled.  For C (and C++) this means that
7361 overflow when doing arithmetic with signed numbers is undefined, which
7362 means that the compiler may assume that it will not happen.  This
7363 permits various optimizations.  For example, the compiler will assume
7364 that an expression like @code{i + 10 > i} will always be true for
7365 signed @code{i}.  This assumption is only valid if signed overflow is
7366 undefined, as the expression is false if @code{i + 10} overflows when
7367 using twos complement arithmetic.  When this option is in effect any
7368 attempt to determine whether an operation on signed numbers will
7369 overflow must be written carefully to not actually involve overflow.
7371 This option also allows the compiler to assume strict pointer
7372 semantics: given a pointer to an object, if adding an offset to that
7373 pointer does not produce a pointer to the same object, the addition is
7374 undefined.  This permits the compiler to conclude that @code{p + u >
7375 p} is always true for a pointer @code{p} and unsigned integer
7376 @code{u}.  This assumption is only valid because pointer wraparound is
7377 undefined, as the expression is false if @code{p + u} overflows using
7378 twos complement arithmetic.
7380 See also the @option{-fwrapv} option.  Using @option{-fwrapv} means
7381 that integer signed overflow is fully defined: it wraps.  When
7382 @option{-fwrapv} is used, there is no difference between
7383 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7384 integers.  With @option{-fwrapv} certain types of overflow are
7385 permitted.  For example, if the compiler gets an overflow when doing
7386 arithmetic on constants, the overflowed value can still be used with
7387 @option{-fwrapv}, but not otherwise.
7389 The @option{-fstrict-overflow} option is enabled at levels
7390 @option{-O2}, @option{-O3}, @option{-Os}.
7392 @item -falign-functions
7393 @itemx -falign-functions=@var{n}
7394 @opindex falign-functions
7395 Align the start of functions to the next power-of-two greater than
7396 @var{n}, skipping up to @var{n} bytes.  For instance,
7397 @option{-falign-functions=32} aligns functions to the next 32-byte
7398 boundary, but @option{-falign-functions=24} would align to the next
7399 32-byte boundary only if this can be done by skipping 23 bytes or less.
7401 @option{-fno-align-functions} and @option{-falign-functions=1} are
7402 equivalent and mean that functions will not be aligned.
7404 Some assemblers only support this flag when @var{n} is a power of two;
7405 in that case, it is rounded up.
7407 If @var{n} is not specified or is zero, use a machine-dependent default.
7409 Enabled at levels @option{-O2}, @option{-O3}.
7411 @item -falign-labels
7412 @itemx -falign-labels=@var{n}
7413 @opindex falign-labels
7414 Align all branch targets to a power-of-two boundary, skipping up to
7415 @var{n} bytes like @option{-falign-functions}.  This option can easily
7416 make code slower, because it must insert dummy operations for when the
7417 branch target is reached in the usual flow of the code.
7419 @option{-fno-align-labels} and @option{-falign-labels=1} are
7420 equivalent and mean that labels will not be aligned.
7422 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7423 are greater than this value, then their values are used instead.
7425 If @var{n} is not specified or is zero, use a machine-dependent default
7426 which is very likely to be @samp{1}, meaning no alignment.
7428 Enabled at levels @option{-O2}, @option{-O3}.
7430 @item -falign-loops
7431 @itemx -falign-loops=@var{n}
7432 @opindex falign-loops
7433 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7434 like @option{-falign-functions}.  The hope is that the loop will be
7435 executed many times, which will make up for any execution of the dummy
7436 operations.
7438 @option{-fno-align-loops} and @option{-falign-loops=1} are
7439 equivalent and mean that loops will not be aligned.
7441 If @var{n} is not specified or is zero, use a machine-dependent default.
7443 Enabled at levels @option{-O2}, @option{-O3}.
7445 @item -falign-jumps
7446 @itemx -falign-jumps=@var{n}
7447 @opindex falign-jumps
7448 Align branch targets to a power-of-two boundary, for branch targets
7449 where the targets can only be reached by jumping, skipping up to @var{n}
7450 bytes like @option{-falign-functions}.  In this case, no dummy operations
7451 need be executed.
7453 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7454 equivalent and mean that loops will not be aligned.
7456 If @var{n} is not specified or is zero, use a machine-dependent default.
7458 Enabled at levels @option{-O2}, @option{-O3}.
7460 @item -funit-at-a-time
7461 @opindex funit-at-a-time
7462 This option is left for compatibility reasons. @option{-funit-at-a-time}
7463 has no effect, while @option{-fno-unit-at-a-time} implies
7464 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7466 Enabled by default.
7468 @item -fno-toplevel-reorder
7469 @opindex fno-toplevel-reorder
7470 Do not reorder top-level functions, variables, and @code{asm}
7471 statements.  Output them in the same order that they appear in the
7472 input file.  When this option is used, unreferenced static variables
7473 will not be removed.  This option is intended to support existing code
7474 which relies on a particular ordering.  For new code, it is better to
7475 use attributes.
7477 Enabled at level @option{-O0}.  When disabled explicitly, it also imply
7478 @option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
7479 targets.
7481 @item -fweb
7482 @opindex fweb
7483 Constructs webs as commonly used for register allocation purposes and assign
7484 each web individual pseudo register.  This allows the register allocation pass
7485 to operate on pseudos directly, but also strengthens several other optimization
7486 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
7487 however, make debugging impossible, since variables will no longer stay in a
7488 ``home register''.
7490 Enabled by default with @option{-funroll-loops}.
7492 @item -fwhole-program
7493 @opindex fwhole-program
7494 Assume that the current compilation unit represents the whole program being
7495 compiled.  All public functions and variables with the exception of @code{main}
7496 and those merged by attribute @code{externally_visible} become static functions
7497 and in effect are optimized more aggressively by interprocedural optimizers. If @command{gold} is used as the linker plugin, @code{externally_visible} attributes are automatically added to functions (not variable yet due to a current @command{gold} issue) that are accessed outside of LTO objects according to resolution file produced by @command{gold}.  For other linkers that cannot generate resolution file, explicit @code{externally_visible} attributes are still necessary.
7498 While this option is equivalent to proper use of the @code{static} keyword for
7499 programs consisting of a single file, in combination with option
7500 @option{-flto} this flag can be used to
7501 compile many smaller scale programs since the functions and variables become
7502 local for the whole combined compilation unit, not for the single source file
7503 itself.
7505 This option implies @option{-fwhole-file} for Fortran programs.
7507 @item -flto[=@var{n}]
7508 @opindex flto
7509 This option runs the standard link-time optimizer.  When invoked
7510 with source code, it generates GIMPLE (one of GCC's internal
7511 representations) and writes it to special ELF sections in the object
7512 file.  When the object files are linked together, all the function
7513 bodies are read from these ELF sections and instantiated as if they
7514 had been part of the same translation unit.
7516 To use the link-timer optimizer, @option{-flto} needs to be specified at
7517 compile time and during the final link.  For example,
7519 @smallexample
7520 gcc -c -O2 -flto foo.c
7521 gcc -c -O2 -flto bar.c
7522 gcc -o myprog -flto -O2 foo.o bar.o
7523 @end smallexample
7525 The first two invocations to GCC will save a bytecode representation
7526 of GIMPLE into special ELF sections inside @file{foo.o} and
7527 @file{bar.o}.  The final invocation will read the GIMPLE bytecode from
7528 @file{foo.o} and @file{bar.o}, merge the two files into a single
7529 internal image, and compile the result as usual.  Since both
7530 @file{foo.o} and @file{bar.o} are merged into a single image, this
7531 causes all the inter-procedural analyses and optimizations in GCC to
7532 work across the two files as if they were a single one.  This means,
7533 for example, that the inliner will be able to inline functions in
7534 @file{bar.o} into functions in @file{foo.o} and vice-versa.
7536 Another (simpler) way to enable link-time optimization is,
7538 @smallexample
7539 gcc -o myprog -flto -O2 foo.c bar.c
7540 @end smallexample
7542 The above will generate bytecode for @file{foo.c} and @file{bar.c},
7543 merge them together into a single GIMPLE representation and optimize
7544 them as usual to produce @file{myprog}.
7546 The only important thing to keep in mind is that to enable link-time
7547 optimizations the @option{-flto} flag needs to be passed to both the
7548 compile and the link commands.
7550 To make whole program optimization effective, it is necessary to make
7551 certain whole program assumptions.  The compiler needs to know
7552 what functions and variables can be accessed by libraries and runtime
7553 outside of the link time optimized unit.  When supported by the linker,
7554 the linker plugin (see @option{-fuse-linker-plugin}) passes to the
7555 compiler information about used and externally visible symbols.  When
7556 the linker plugin is not available, @option{-fwhole-program} should be
7557 used to allow the compiler to make these assumptions, which will lead
7558 to more aggressive optimization decisions.
7560 Note that when a file is compiled with @option{-flto}, the generated
7561 object file will be larger than a regular object file because it will
7562 contain GIMPLE bytecodes and the usual final code.  This means that
7563 object files with LTO information can be linked as a normal object
7564 file.  So, in the previous example, if the final link is done with
7566 @smallexample
7567 gcc -o myprog foo.o bar.o
7568 @end smallexample
7570 The only difference will be that no inter-procedural optimizations
7571 will be applied to produce @file{myprog}.  The two object files
7572 @file{foo.o} and @file{bar.o} will be simply sent to the regular
7573 linker.
7575 Additionally, the optimization flags used to compile individual files
7576 are not necessarily related to those used at link-time.  For instance,
7578 @smallexample
7579 gcc -c -O0 -flto foo.c
7580 gcc -c -O0 -flto bar.c
7581 gcc -o myprog -flto -O3 foo.o bar.o
7582 @end smallexample
7584 This will produce individual object files with unoptimized assembler
7585 code, but the resulting binary @file{myprog} will be optimized at
7586 @option{-O3}.  Now, if the final binary is generated without
7587 @option{-flto}, then @file{myprog} will not be optimized.
7589 When producing the final binary with @option{-flto}, GCC will only
7590 apply link-time optimizations to those files that contain bytecode.
7591 Therefore, you can mix and match object files and libraries with
7592 GIMPLE bytecodes and final object code.  GCC will automatically select
7593 which files to optimize in LTO mode and which files to link without
7594 further processing.
7596 There are some code generation flags that GCC will preserve when
7597 generating bytecodes, as they need to be used during the final link
7598 stage.  Currently, the following options are saved into the GIMPLE
7599 bytecode files: @option{-fPIC}, @option{-fcommon} and all the
7600 @option{-m} target flags.
7602 At link time, these options are read-in and reapplied.  Note that the
7603 current implementation makes no attempt at recognizing conflicting
7604 values for these options.  If two or more files have a conflicting
7605 value (e.g., one file is compiled with @option{-fPIC} and another
7606 isn't), the compiler will simply use the last value read from the
7607 bytecode files.  It is recommended, then, that all the files
7608 participating in the same link be compiled with the same options.
7610 Another feature of LTO is that it is possible to apply interprocedural
7611 optimizations on files written in different languages.  This requires
7612 some support in the language front end.  Currently, the C, C++ and
7613 Fortran front ends are capable of emitting GIMPLE bytecodes, so
7614 something like this should work
7616 @smallexample
7617 gcc -c -flto foo.c
7618 g++ -c -flto bar.cc
7619 gfortran -c -flto baz.f90
7620 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
7621 @end smallexample
7623 Notice that the final link is done with @command{g++} to get the C++
7624 runtime libraries and @option{-lgfortran} is added to get the Fortran
7625 runtime libraries.  In general, when mixing languages in LTO mode, you
7626 should use the same link command used when mixing languages in a
7627 regular (non-LTO) compilation.  This means that if your build process
7628 was mixing languages before, all you need to add is @option{-flto} to
7629 all the compile and link commands.
7631 If LTO encounters objects with C linkage declared with incompatible
7632 types in separate translation units to be linked together (undefined
7633 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
7634 issued.  The behavior is still undefined at runtime.
7636 If object files containing GIMPLE bytecode are stored in a library archive, say
7637 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
7638 are using a linker with linker plugin support.  To enable this feature, use
7639 the flag @option{-fuse-linker-plugin} at link-time:
7641 @smallexample
7642 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
7643 @end smallexample
7645 With the linker plugin enabled, the linker will extract the needed
7646 GIMPLE files from @file{libfoo.a} and pass them on to the running GCC
7647 to make them part of the aggregated GIMPLE image to be optimized.
7649 If you are not using a linker with linker plugin support and/or do not 
7650 enable linker plugin then the objects inside @file{libfoo.a}
7651 will be extracted and linked as usual, but they will not participate
7652 in the LTO optimization process.
7654 Link time optimizations do not require the presence of the whole program to
7655 operate.  If the program does not require any symbols to be exported, it is
7656 possible to combine @option{-flto} and with @option{-fwhole-program} to allow
7657 the interprocedural optimizers to use more aggressive assumptions which may
7658 lead to improved optimization opportunities. 
7659 Use of @option{-fwhole-program} is not needed when linker plugin is
7660 active (see @option{-fuse-linker-plugin}).
7662 Regarding portability: the current implementation of LTO makes no
7663 attempt at generating bytecode that can be ported between different
7664 types of hosts.  The bytecode files are versioned and there is a
7665 strict version check, so bytecode files generated in one version of
7666 GCC will not work with an older/newer version of GCC.
7668 Link time optimization does not play well with generating debugging
7669 information.  Combining @option{-flto} with
7670 @option{-g} is currently experimental and expected to produce wrong
7671 results.
7673 If you specify the optional @var{n}, the optimization and code
7674 generation done at link time is executed in parallel using @var{n}
7675 parallel jobs by utilizing an installed @command{make} program.  The
7676 environment variable @env{MAKE} may be used to override the program
7677 used.  The default value for @var{n} is 1.
7679 You can also specify @option{-flto=jobserver} to use GNU make's 
7680 job server mode to determine the number of parallel jobs. This 
7681 is useful when the Makefile calling GCC is already executing in parallel.
7682 The parent Makefile will need a @samp{+} prepended to the command recipe
7683 for this to work. This will likely only work if @env{MAKE} is 
7684 GNU make.
7686 This option is disabled by default.
7688 @item -flto-partition=@var{alg}
7689 @opindex flto-partition
7690 Specify the partitioning algorithm used by the link time optimizer.
7691 The value is either @code{1to1} to specify a partitioning mirroring
7692 the original source files or @code{balanced} to specify partitioning
7693 into equally sized chunks (whenever possible).  Specifying @code{none}
7694 as an algorithm disables partitioning and streaming completely. The
7695 default value is @code{balanced}.
7697 @item -flto-compression-level=@var{n}
7698 This option specifies the level of compression used for intermediate
7699 language written to LTO object files, and is only meaningful in
7700 conjunction with LTO mode (@option{-flto}).  Valid
7701 values are 0 (no compression) to 9 (maximum compression).  Values
7702 outside this range are clamped to either 0 or 9.  If the option is not
7703 given, a default balanced compression setting is used.
7705 @item -flto-report
7706 Prints a report with internal details on the workings of the link-time
7707 optimizer.  The contents of this report vary from version to version,
7708 it is meant to be useful to GCC developers when processing object
7709 files in LTO mode (via @option{-flto}).
7711 Disabled by default.
7713 @item -fuse-linker-plugin
7714 Enables the use of linker plugin during link time optimization.  This option
7715 relies on the linker plugin support in linker that is available in gold
7716 or in GNU ld 2.21 or newer.
7718 This option enables the extraction of object files with GIMPLE bytecode out of
7719 library archives. This improves the quality of optimization by exposing more
7720 code the link time optimizer.  This information specify what symbols 
7721 can be accessed externally (by non-LTO object or during dynamic linking).
7722 Resulting code quality improvements on binaries (and shared libraries that do
7723 use hidden visibility) is similar to @code{-fwhole-program}.  See
7724 @option{-flto} for a description on the effect of this flag and how to use it.
7726 Enabled by default when LTO support in GCC is enabled and GCC was compiled
7727 with a linker supporting plugins (GNU ld 2.21 or newer or gold).
7729 @item -fcompare-elim
7730 @opindex fcompare-elim
7731 After register allocation and post-register allocation instruction splitting,
7732 identify arithmetic instructions that compute processor flags similar to a
7733 comparison operation based on that arithmetic.  If possible, eliminate the
7734 explicit comparison operation.
7736 This pass only applies to certain targets that cannot explicitly represent
7737 the comparison operation before register allocation is complete.
7739 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7741 @item -fcprop-registers
7742 @opindex fcprop-registers
7743 After register allocation and post-register allocation instruction splitting,
7744 we perform a copy-propagation pass to try to reduce scheduling dependencies
7745 and occasionally eliminate the copy.
7747 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7749 @item -fprofile-correction
7750 @opindex fprofile-correction
7751 Profiles collected using an instrumented binary for multi-threaded programs may
7752 be inconsistent due to missed counter updates. When this option is specified,
7753 GCC will use heuristics to correct or smooth out such inconsistencies. By
7754 default, GCC will emit an error message when an inconsistent profile is detected.
7756 @item -fprofile-dir=@var{path}
7757 @opindex fprofile-dir
7759 Set the directory to search for the profile data files in to @var{path}.
7760 This option affects only the profile data generated by
7761 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
7762 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
7763 and its related options.
7764 By default, GCC will use the current directory as @var{path}, thus the
7765 profile data file will appear in the same directory as the object file.
7767 @item -fprofile-generate
7768 @itemx -fprofile-generate=@var{path}
7769 @opindex fprofile-generate
7771 Enable options usually used for instrumenting application to produce
7772 profile useful for later recompilation with profile feedback based
7773 optimization.  You must use @option{-fprofile-generate} both when
7774 compiling and when linking your program.
7776 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
7778 If @var{path} is specified, GCC will look at the @var{path} to find
7779 the profile feedback data files. See @option{-fprofile-dir}.
7781 @item -fprofile-use
7782 @itemx -fprofile-use=@var{path}
7783 @opindex fprofile-use
7784 Enable profile feedback directed optimizations, and optimizations
7785 generally profitable only with profile feedback available.
7787 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
7788 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
7790 By default, GCC emits an error message if the feedback profiles do not
7791 match the source code.  This error can be turned into a warning by using
7792 @option{-Wcoverage-mismatch}.  Note this may result in poorly optimized
7793 code.
7795 If @var{path} is specified, GCC will look at the @var{path} to find
7796 the profile feedback data files. See @option{-fprofile-dir}.
7797 @end table
7799 The following options control compiler behavior regarding floating
7800 point arithmetic.  These options trade off between speed and
7801 correctness.  All must be specifically enabled.
7803 @table @gcctabopt
7804 @item -ffloat-store
7805 @opindex ffloat-store
7806 Do not store floating point variables in registers, and inhibit other
7807 options that might change whether a floating point value is taken from a
7808 register or memory.
7810 @cindex floating point precision
7811 This option prevents undesirable excess precision on machines such as
7812 the 68000 where the floating registers (of the 68881) keep more
7813 precision than a @code{double} is supposed to have.  Similarly for the
7814 x86 architecture.  For most programs, the excess precision does only
7815 good, but a few programs rely on the precise definition of IEEE floating
7816 point.  Use @option{-ffloat-store} for such programs, after modifying
7817 them to store all pertinent intermediate computations into variables.
7819 @item -fexcess-precision=@var{style}
7820 @opindex fexcess-precision
7821 This option allows further control over excess precision on machines
7822 where floating-point registers have more precision than the IEEE
7823 @code{float} and @code{double} types and the processor does not
7824 support operations rounding to those types.  By default,
7825 @option{-fexcess-precision=fast} is in effect; this means that
7826 operations are carried out in the precision of the registers and that
7827 it is unpredictable when rounding to the types specified in the source
7828 code takes place.  When compiling C, if
7829 @option{-fexcess-precision=standard} is specified then excess
7830 precision will follow the rules specified in ISO C99; in particular,
7831 both casts and assignments cause values to be rounded to their
7832 semantic types (whereas @option{-ffloat-store} only affects
7833 assignments).  This option is enabled by default for C if a strict
7834 conformance option such as @option{-std=c99} is used.
7836 @opindex mfpmath
7837 @option{-fexcess-precision=standard} is not implemented for languages
7838 other than C, and has no effect if
7839 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
7840 specified.  On the x86, it also has no effect if @option{-mfpmath=sse}
7841 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
7842 semantics apply without excess precision, and in the latter, rounding
7843 is unpredictable.
7845 @item -ffast-math
7846 @opindex ffast-math
7847 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
7848 @option{-ffinite-math-only}, @option{-fno-rounding-math},
7849 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
7851 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
7853 This option is not turned on by any @option{-O} option besides
7854 @option{-Ofast} since it can result in incorrect output for programs
7855 which depend on an exact implementation of IEEE or ISO rules/specifications
7856 for math functions. It may, however, yield faster code for programs
7857 that do not require the guarantees of these specifications.
7859 @item -fno-math-errno
7860 @opindex fno-math-errno
7861 Do not set ERRNO after calling math functions that are executed
7862 with a single instruction, e.g., sqrt.  A program that relies on
7863 IEEE exceptions for math error handling may want to use this flag
7864 for speed while maintaining IEEE arithmetic compatibility.
7866 This option is not turned on by any @option{-O} option since
7867 it can result in incorrect output for programs which depend on
7868 an exact implementation of IEEE or ISO rules/specifications for
7869 math functions. It may, however, yield faster code for programs
7870 that do not require the guarantees of these specifications.
7872 The default is @option{-fmath-errno}.
7874 On Darwin systems, the math library never sets @code{errno}.  There is
7875 therefore no reason for the compiler to consider the possibility that
7876 it might, and @option{-fno-math-errno} is the default.
7878 @item -funsafe-math-optimizations
7879 @opindex funsafe-math-optimizations
7881 Allow optimizations for floating-point arithmetic that (a) assume
7882 that arguments and results are valid and (b) may violate IEEE or
7883 ANSI standards.  When used at link-time, it may include libraries
7884 or startup files that change the default FPU control word or other
7885 similar optimizations.
7887 This option is not turned on by any @option{-O} option since
7888 it can result in incorrect output for programs which depend on
7889 an exact implementation of IEEE or ISO rules/specifications for
7890 math functions. It may, however, yield faster code for programs
7891 that do not require the guarantees of these specifications.
7892 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
7893 @option{-fassociative-math} and @option{-freciprocal-math}.
7895 The default is @option{-fno-unsafe-math-optimizations}.
7897 @item -fassociative-math
7898 @opindex fassociative-math
7900 Allow re-association of operands in series of floating-point operations.
7901 This violates the ISO C and C++ language standard by possibly changing
7902 computation result.  NOTE: re-ordering may change the sign of zero as
7903 well as ignore NaNs and inhibit or create underflow or overflow (and
7904 thus cannot be used on a code which relies on rounding behavior like
7905 @code{(x + 2**52) - 2**52)}.  May also reorder floating-point comparisons
7906 and thus may not be used when ordered comparisons are required.
7907 This option requires that both @option{-fno-signed-zeros} and
7908 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
7909 much sense with @option{-frounding-math}. For Fortran the option
7910 is automatically enabled when both @option{-fno-signed-zeros} and
7911 @option{-fno-trapping-math} are in effect.
7913 The default is @option{-fno-associative-math}.
7915 @item -freciprocal-math
7916 @opindex freciprocal-math
7918 Allow the reciprocal of a value to be used instead of dividing by
7919 the value if this enables optimizations.  For example @code{x / y}
7920 can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
7921 is subject to common subexpression elimination.  Note that this loses
7922 precision and increases the number of flops operating on the value.
7924 The default is @option{-fno-reciprocal-math}.
7926 @item -ffinite-math-only
7927 @opindex ffinite-math-only
7928 Allow optimizations for floating-point arithmetic that assume
7929 that arguments and results are not NaNs or +-Infs.
7931 This option is not turned on by any @option{-O} option since
7932 it can result in incorrect output for programs which depend on
7933 an exact implementation of IEEE or ISO rules/specifications for
7934 math functions. It may, however, yield faster code for programs
7935 that do not require the guarantees of these specifications.
7937 The default is @option{-fno-finite-math-only}.
7939 @item -fno-signed-zeros
7940 @opindex fno-signed-zeros
7941 Allow optimizations for floating point arithmetic that ignore the
7942 signedness of zero.  IEEE arithmetic specifies the behavior of
7943 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
7944 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
7945 This option implies that the sign of a zero result isn't significant.
7947 The default is @option{-fsigned-zeros}.
7949 @item -fno-trapping-math
7950 @opindex fno-trapping-math
7951 Compile code assuming that floating-point operations cannot generate
7952 user-visible traps.  These traps include division by zero, overflow,
7953 underflow, inexact result and invalid operation.  This option requires
7954 that @option{-fno-signaling-nans} be in effect.  Setting this option may
7955 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
7957 This option should never be turned on by any @option{-O} option since
7958 it can result in incorrect output for programs which depend on
7959 an exact implementation of IEEE or ISO rules/specifications for
7960 math functions.
7962 The default is @option{-ftrapping-math}.
7964 @item -frounding-math
7965 @opindex frounding-math
7966 Disable transformations and optimizations that assume default floating
7967 point rounding behavior.  This is round-to-zero for all floating point
7968 to integer conversions, and round-to-nearest for all other arithmetic
7969 truncations.  This option should be specified for programs that change
7970 the FP rounding mode dynamically, or that may be executed with a
7971 non-default rounding mode.  This option disables constant folding of
7972 floating point expressions at compile-time (which may be affected by
7973 rounding mode) and arithmetic transformations that are unsafe in the
7974 presence of sign-dependent rounding modes.
7976 The default is @option{-fno-rounding-math}.
7978 This option is experimental and does not currently guarantee to
7979 disable all GCC optimizations that are affected by rounding mode.
7980 Future versions of GCC may provide finer control of this setting
7981 using C99's @code{FENV_ACCESS} pragma.  This command line option
7982 will be used to specify the default state for @code{FENV_ACCESS}.
7984 @item -fsignaling-nans
7985 @opindex fsignaling-nans
7986 Compile code assuming that IEEE signaling NaNs may generate user-visible
7987 traps during floating-point operations.  Setting this option disables
7988 optimizations that may change the number of exceptions visible with
7989 signaling NaNs.  This option implies @option{-ftrapping-math}.
7991 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
7992 be defined.
7994 The default is @option{-fno-signaling-nans}.
7996 This option is experimental and does not currently guarantee to
7997 disable all GCC optimizations that affect signaling NaN behavior.
7999 @item -fsingle-precision-constant
8000 @opindex fsingle-precision-constant
8001 Treat floating point constant as single precision constant instead of
8002 implicitly converting it to double precision constant.
8004 @item -fcx-limited-range
8005 @opindex fcx-limited-range
8006 When enabled, this option states that a range reduction step is not
8007 needed when performing complex division.  Also, there is no checking
8008 whether the result of a complex multiplication or division is @code{NaN
8009 + I*NaN}, with an attempt to rescue the situation in that case.  The
8010 default is @option{-fno-cx-limited-range}, but is enabled by
8011 @option{-ffast-math}.
8013 This option controls the default setting of the ISO C99
8014 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
8015 all languages.
8017 @item -fcx-fortran-rules
8018 @opindex fcx-fortran-rules
8019 Complex multiplication and division follow Fortran rules.  Range
8020 reduction is done as part of complex division, but there is no checking
8021 whether the result of a complex multiplication or division is @code{NaN
8022 + I*NaN}, with an attempt to rescue the situation in that case.
8024 The default is @option{-fno-cx-fortran-rules}.
8026 @end table
8028 The following options control optimizations that may improve
8029 performance, but are not enabled by any @option{-O} options.  This
8030 section includes experimental options that may produce broken code.
8032 @table @gcctabopt
8033 @item -fbranch-probabilities
8034 @opindex fbranch-probabilities
8035 After running a program compiled with @option{-fprofile-arcs}
8036 (@pxref{Debugging Options,, Options for Debugging Your Program or
8037 @command{gcc}}), you can compile it a second time using
8038 @option{-fbranch-probabilities}, to improve optimizations based on
8039 the number of times each branch was taken.  When the program
8040 compiled with @option{-fprofile-arcs} exits it saves arc execution
8041 counts to a file called @file{@var{sourcename}.gcda} for each source
8042 file.  The information in this data file is very dependent on the
8043 structure of the generated code, so you must use the same source code
8044 and the same optimization options for both compilations.
8046 With @option{-fbranch-probabilities}, GCC puts a
8047 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8048 These can be used to improve optimization.  Currently, they are only
8049 used in one place: in @file{reorg.c}, instead of guessing which path a
8050 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8051 exactly determine which path is taken more often.
8053 @item -fprofile-values
8054 @opindex fprofile-values
8055 If combined with @option{-fprofile-arcs}, it adds code so that some
8056 data about values of expressions in the program is gathered.
8058 With @option{-fbranch-probabilities}, it reads back the data gathered
8059 from profiling values of expressions for usage in optimizations.
8061 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8063 @item -fvpt
8064 @opindex fvpt
8065 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
8066 a code to gather information about values of expressions.
8068 With @option{-fbranch-probabilities}, it reads back the data gathered
8069 and actually performs the optimizations based on them.
8070 Currently the optimizations include specialization of division operation
8071 using the knowledge about the value of the denominator.
8073 @item -frename-registers
8074 @opindex frename-registers
8075 Attempt to avoid false dependencies in scheduled code by making use
8076 of registers left over after register allocation.  This optimization
8077 will most benefit processors with lots of registers.  Depending on the
8078 debug information format adopted by the target, however, it can
8079 make debugging impossible, since variables will no longer stay in
8080 a ``home register''.
8082 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8084 @item -ftracer
8085 @opindex ftracer
8086 Perform tail duplication to enlarge superblock size.  This transformation
8087 simplifies the control flow of the function allowing other optimizations to do
8088 better job.
8090 Enabled with @option{-fprofile-use}.
8092 @item -funroll-loops
8093 @opindex funroll-loops
8094 Unroll loops whose number of iterations can be determined at compile time or
8095 upon entry to the loop.  @option{-funroll-loops} implies
8096 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8097 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8098 small constant number of iterations).  This option makes code larger, and may
8099 or may not make it run faster.
8101 Enabled with @option{-fprofile-use}.
8103 @item -funroll-all-loops
8104 @opindex funroll-all-loops
8105 Unroll all loops, even if their number of iterations is uncertain when
8106 the loop is entered.  This usually makes programs run more slowly.
8107 @option{-funroll-all-loops} implies the same options as
8108 @option{-funroll-loops}.
8110 @item -fpeel-loops
8111 @opindex fpeel-loops
8112 Peels the loops for that there is enough information that they do not
8113 roll much (from profile feedback).  It also turns on complete loop peeling
8114 (i.e.@: complete removal of loops with small constant number of iterations).
8116 Enabled with @option{-fprofile-use}.
8118 @item -fmove-loop-invariants
8119 @opindex fmove-loop-invariants
8120 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
8121 at level @option{-O1}
8123 @item -funswitch-loops
8124 @opindex funswitch-loops
8125 Move branches with loop invariant conditions out of the loop, with duplicates
8126 of the loop on both branches (modified according to result of the condition).
8128 @item -ffunction-sections
8129 @itemx -fdata-sections
8130 @opindex ffunction-sections
8131 @opindex fdata-sections
8132 Place each function or data item into its own section in the output
8133 file if the target supports arbitrary sections.  The name of the
8134 function or the name of the data item determines the section's name
8135 in the output file.
8137 Use these options on systems where the linker can perform optimizations
8138 to improve locality of reference in the instruction space.  Most systems
8139 using the ELF object format and SPARC processors running Solaris 2 have
8140 linkers with such optimizations.  AIX may have these optimizations in
8141 the future.
8143 Only use these options when there are significant benefits from doing
8144 so.  When you specify these options, the assembler and linker will
8145 create larger object and executable files and will also be slower.
8146 You will not be able to use @code{gprof} on all systems if you
8147 specify this option and you may have problems with debugging if
8148 you specify both this option and @option{-g}.
8150 @item -fbranch-target-load-optimize
8151 @opindex fbranch-target-load-optimize
8152 Perform branch target register load optimization before prologue / epilogue
8153 threading.
8154 The use of target registers can typically be exposed only during reload,
8155 thus hoisting loads out of loops and doing inter-block scheduling needs
8156 a separate optimization pass.
8158 @item -fbranch-target-load-optimize2
8159 @opindex fbranch-target-load-optimize2
8160 Perform branch target register load optimization after prologue / epilogue
8161 threading.
8163 @item -fbtr-bb-exclusive
8164 @opindex fbtr-bb-exclusive
8165 When performing branch target register load optimization, don't reuse
8166 branch target registers in within any basic block.
8168 @item -fstack-protector
8169 @opindex fstack-protector
8170 Emit extra code to check for buffer overflows, such as stack smashing
8171 attacks.  This is done by adding a guard variable to functions with
8172 vulnerable objects.  This includes functions that call alloca, and
8173 functions with buffers larger than 8 bytes.  The guards are initialized
8174 when a function is entered and then checked when the function exits.
8175 If a guard check fails, an error message is printed and the program exits.
8177 @item -fstack-protector-all
8178 @opindex fstack-protector-all
8179 Like @option{-fstack-protector} except that all functions are protected.
8181 @item -fsection-anchors
8182 @opindex fsection-anchors
8183 Try to reduce the number of symbolic address calculations by using
8184 shared ``anchor'' symbols to address nearby objects.  This transformation
8185 can help to reduce the number of GOT entries and GOT accesses on some
8186 targets.
8188 For example, the implementation of the following function @code{foo}:
8190 @smallexample
8191 static int a, b, c;
8192 int foo (void) @{ return a + b + c; @}
8193 @end smallexample
8195 would usually calculate the addresses of all three variables, but if you
8196 compile it with @option{-fsection-anchors}, it will access the variables
8197 from a common anchor point instead.  The effect is similar to the
8198 following pseudocode (which isn't valid C):
8200 @smallexample
8201 int foo (void)
8203   register int *xr = &x;
8204   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8206 @end smallexample
8208 Not all targets support this option.
8210 @item --param @var{name}=@var{value}
8211 @opindex param
8212 In some places, GCC uses various constants to control the amount of
8213 optimization that is done.  For example, GCC will not inline functions
8214 that contain more that a certain number of instructions.  You can
8215 control some of these constants on the command-line using the
8216 @option{--param} option.
8218 The names of specific parameters, and the meaning of the values, are
8219 tied to the internals of the compiler, and are subject to change
8220 without notice in future releases.
8222 In each case, the @var{value} is an integer.  The allowable choices for
8223 @var{name} are given in the following table:
8225 @table @gcctabopt
8226 @item predictable-branch-outcome
8227 When branch is predicted to be taken with probability lower than this threshold
8228 (in percent), then it is considered well predictable. The default is 10.
8230 @item max-crossjump-edges
8231 The maximum number of incoming edges to consider for crossjumping.
8232 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8233 the number of edges incoming to each block.  Increasing values mean
8234 more aggressive optimization, making the compile time increase with
8235 probably small improvement in executable size.
8237 @item min-crossjump-insns
8238 The minimum number of instructions which must be matched at the end
8239 of two blocks before crossjumping will be performed on them.  This
8240 value is ignored in the case where all instructions in the block being
8241 crossjumped from are matched.  The default value is 5.
8243 @item max-grow-copy-bb-insns
8244 The maximum code size expansion factor when copying basic blocks
8245 instead of jumping.  The expansion is relative to a jump instruction.
8246 The default value is 8.
8248 @item max-goto-duplication-insns
8249 The maximum number of instructions to duplicate to a block that jumps
8250 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
8251 passes, GCC factors computed gotos early in the compilation process,
8252 and unfactors them as late as possible.  Only computed jumps at the
8253 end of a basic blocks with no more than max-goto-duplication-insns are
8254 unfactored.  The default value is 8.
8256 @item max-delay-slot-insn-search
8257 The maximum number of instructions to consider when looking for an
8258 instruction to fill a delay slot.  If more than this arbitrary number of
8259 instructions is searched, the time savings from filling the delay slot
8260 will be minimal so stop searching.  Increasing values mean more
8261 aggressive optimization, making the compile time increase with probably
8262 small improvement in executable run time.
8264 @item max-delay-slot-live-search
8265 When trying to fill delay slots, the maximum number of instructions to
8266 consider when searching for a block with valid live register
8267 information.  Increasing this arbitrarily chosen value means more
8268 aggressive optimization, increasing the compile time.  This parameter
8269 should be removed when the delay slot code is rewritten to maintain the
8270 control-flow graph.
8272 @item max-gcse-memory
8273 The approximate maximum amount of memory that will be allocated in
8274 order to perform the global common subexpression elimination
8275 optimization.  If more memory than specified is required, the
8276 optimization will not be done.
8278 @item max-gcse-insertion-ratio
8279 If the ratio of expression insertions to deletions is larger than this value
8280 for any expression, then RTL PRE will insert or remove the expression and thus
8281 leave partially redundant computations in the instruction stream.  The default value is 20.
8283 @item max-pending-list-length
8284 The maximum number of pending dependencies scheduling will allow
8285 before flushing the current state and starting over.  Large functions
8286 with few branches or calls can create excessively large lists which
8287 needlessly consume memory and resources.
8289 @item max-inline-insns-single
8290 Several parameters control the tree inliner used in gcc.
8291 This number sets the maximum number of instructions (counted in GCC's
8292 internal representation) in a single function that the tree inliner
8293 will consider for inlining.  This only affects functions declared
8294 inline and methods implemented in a class declaration (C++).
8295 The default value is 400.
8297 @item max-inline-insns-auto
8298 When you use @option{-finline-functions} (included in @option{-O3}),
8299 a lot of functions that would otherwise not be considered for inlining
8300 by the compiler will be investigated.  To those functions, a different
8301 (more restrictive) limit compared to functions declared inline can
8302 be applied.
8303 The default value is 40.
8305 @item large-function-insns
8306 The limit specifying really large functions.  For functions larger than this
8307 limit after inlining, inlining is constrained by
8308 @option{--param large-function-growth}.  This parameter is useful primarily
8309 to avoid extreme compilation time caused by non-linear algorithms used by the
8310 backend.
8311 The default value is 2700.
8313 @item large-function-growth
8314 Specifies maximal growth of large function caused by inlining in percents.
8315 The default value is 100 which limits large function growth to 2.0 times
8316 the original size.
8318 @item large-unit-insns
8319 The limit specifying large translation unit.  Growth caused by inlining of
8320 units larger than this limit is limited by @option{--param inline-unit-growth}.
8321 For small units this might be too tight (consider unit consisting of function A
8322 that is inline and B that just calls A three time.  If B is small relative to
8323 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
8324 large units consisting of small inlineable functions however the overall unit
8325 growth limit is needed to avoid exponential explosion of code size.  Thus for
8326 smaller units, the size is increased to @option{--param large-unit-insns}
8327 before applying @option{--param inline-unit-growth}.  The default is 10000
8329 @item inline-unit-growth
8330 Specifies maximal overall growth of the compilation unit caused by inlining.
8331 The default value is 30 which limits unit growth to 1.3 times the original
8332 size.
8334 @item ipcp-unit-growth
8335 Specifies maximal overall growth of the compilation unit caused by
8336 interprocedural constant propagation.  The default value is 10 which limits
8337 unit growth to 1.1 times the original size.
8339 @item large-stack-frame
8340 The limit specifying large stack frames.  While inlining the algorithm is trying
8341 to not grow past this limit too much.  Default value is 256 bytes.
8343 @item large-stack-frame-growth
8344 Specifies maximal growth of large stack frames caused by inlining in percents.
8345 The default value is 1000 which limits large stack frame growth to 11 times
8346 the original size.
8348 @item max-inline-insns-recursive
8349 @itemx max-inline-insns-recursive-auto
8350 Specifies maximum number of instructions out-of-line copy of self recursive inline
8351 function can grow into by performing recursive inlining.
8353 For functions declared inline @option{--param max-inline-insns-recursive} is
8354 taken into account.  For function not declared inline, recursive inlining
8355 happens only when @option{-finline-functions} (included in @option{-O3}) is
8356 enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
8357 default value is 450.
8359 @item max-inline-recursive-depth
8360 @itemx max-inline-recursive-depth-auto
8361 Specifies maximum recursion depth used by the recursive inlining.
8363 For functions declared inline @option{--param max-inline-recursive-depth} is
8364 taken into account.  For function not declared inline, recursive inlining
8365 happens only when @option{-finline-functions} (included in @option{-O3}) is
8366 enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
8367 default value is 8.
8369 @item min-inline-recursive-probability
8370 Recursive inlining is profitable only for function having deep recursion
8371 in average and can hurt for function having little recursion depth by
8372 increasing the prologue size or complexity of function body to other
8373 optimizers.
8375 When profile feedback is available (see @option{-fprofile-generate}) the actual
8376 recursion depth can be guessed from probability that function will recurse via
8377 given call expression.  This parameter limits inlining only to call expression
8378 whose probability exceeds given threshold (in percents).  The default value is
8381 @item early-inlining-insns
8382 Specify growth that early inliner can make.  In effect it increases amount of
8383 inlining for code having large abstraction penalty.  The default value is 10.
8385 @item max-early-inliner-iterations
8386 @itemx max-early-inliner-iterations
8387 Limit of iterations of early inliner.  This basically bounds number of nested
8388 indirect calls early inliner can resolve.  Deeper chains are still handled by
8389 late inlining.
8391 @item comdat-sharing-probability
8392 @itemx comdat-sharing-probability
8393 Probability (in percent) that C++ inline function with comdat visibility
8394 will be shared across multiple compilation units.  The default value is 20.
8396 @item min-vect-loop-bound
8397 The minimum number of iterations under which a loop will not get vectorized
8398 when @option{-ftree-vectorize} is used.  The number of iterations after
8399 vectorization needs to be greater than the value specified by this option
8400 to allow vectorization.  The default value is 0.
8402 @item gcse-cost-distance-ratio
8403 Scaling factor in calculation of maximum distance an expression
8404 can be moved by GCSE optimizations.  This is currently supported only in the
8405 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
8406 will be with simple expressions, i.e., the expressions which have cost
8407 less than @option{gcse-unrestricted-cost}.  Specifying 0 will disable
8408 hoisting of simple expressions.  The default value is 10.
8410 @item gcse-unrestricted-cost
8411 Cost, roughly measured as the cost of a single typical machine
8412 instruction, at which GCSE optimizations will not constrain
8413 the distance an expression can travel.  This is currently
8414 supported only in the code hoisting pass.  The lesser the cost,
8415 the more aggressive code hoisting will be.  Specifying 0 will
8416 allow all expressions to travel unrestricted distances.
8417 The default value is 3.
8419 @item max-hoist-depth
8420 The depth of search in the dominator tree for expressions to hoist.
8421 This is used to avoid quadratic behavior in hoisting algorithm.
8422 The value of 0 will avoid limiting the search, but may slow down compilation
8423 of huge functions.  The default value is 30.
8425 @item max-unrolled-insns
8426 The maximum number of instructions that a loop should have if that loop
8427 is unrolled, and if the loop is unrolled, it determines how many times
8428 the loop code is unrolled.
8430 @item max-average-unrolled-insns
8431 The maximum number of instructions biased by probabilities of their execution
8432 that a loop should have if that loop is unrolled, and if the loop is unrolled,
8433 it determines how many times the loop code is unrolled.
8435 @item max-unroll-times
8436 The maximum number of unrollings of a single loop.
8438 @item max-peeled-insns
8439 The maximum number of instructions that a loop should have if that loop
8440 is peeled, and if the loop is peeled, it determines how many times
8441 the loop code is peeled.
8443 @item max-peel-times
8444 The maximum number of peelings of a single loop.
8446 @item max-completely-peeled-insns
8447 The maximum number of insns of a completely peeled loop.
8449 @item max-completely-peel-times
8450 The maximum number of iterations of a loop to be suitable for complete peeling.
8452 @item max-completely-peel-loop-nest-depth
8453 The maximum depth of a loop nest suitable for complete peeling.
8455 @item max-unswitch-insns
8456 The maximum number of insns of an unswitched loop.
8458 @item max-unswitch-level
8459 The maximum number of branches unswitched in a single loop.
8461 @item lim-expensive
8462 The minimum cost of an expensive expression in the loop invariant motion.
8464 @item iv-consider-all-candidates-bound
8465 Bound on number of candidates for induction variables below that
8466 all candidates are considered for each use in induction variable
8467 optimizations.  Only the most relevant candidates are considered
8468 if there are more candidates, to avoid quadratic time complexity.
8470 @item iv-max-considered-uses
8471 The induction variable optimizations give up on loops that contain more
8472 induction variable uses.
8474 @item iv-always-prune-cand-set-bound
8475 If number of candidates in the set is smaller than this value,
8476 we always try to remove unnecessary ivs from the set during its
8477 optimization when a new iv is added to the set.
8479 @item scev-max-expr-size
8480 Bound on size of expressions used in the scalar evolutions analyzer.
8481 Large expressions slow the analyzer.
8483 @item scev-max-expr-complexity
8484 Bound on the complexity of the expressions in the scalar evolutions analyzer.
8485 Complex expressions slow the analyzer.
8487 @item omega-max-vars
8488 The maximum number of variables in an Omega constraint system.
8489 The default value is 128.
8491 @item omega-max-geqs
8492 The maximum number of inequalities in an Omega constraint system.
8493 The default value is 256.
8495 @item omega-max-eqs
8496 The maximum number of equalities in an Omega constraint system.
8497 The default value is 128.
8499 @item omega-max-wild-cards
8500 The maximum number of wildcard variables that the Omega solver will
8501 be able to insert.  The default value is 18.
8503 @item omega-hash-table-size
8504 The size of the hash table in the Omega solver.  The default value is
8505 550.
8507 @item omega-max-keys
8508 The maximal number of keys used by the Omega solver.  The default
8509 value is 500.
8511 @item omega-eliminate-redundant-constraints
8512 When set to 1, use expensive methods to eliminate all redundant
8513 constraints.  The default value is 0.
8515 @item vect-max-version-for-alignment-checks
8516 The maximum number of runtime checks that can be performed when
8517 doing loop versioning for alignment in the vectorizer.  See option
8518 ftree-vect-loop-version for more information.
8520 @item vect-max-version-for-alias-checks
8521 The maximum number of runtime checks that can be performed when
8522 doing loop versioning for alias in the vectorizer.  See option
8523 ftree-vect-loop-version for more information.
8525 @item max-iterations-to-track
8527 The maximum number of iterations of a loop the brute force algorithm
8528 for analysis of # of iterations of the loop tries to evaluate.
8530 @item hot-bb-count-fraction
8531 Select fraction of the maximal count of repetitions of basic block in program
8532 given basic block needs to have to be considered hot.
8534 @item hot-bb-frequency-fraction
8535 Select fraction of the entry block frequency of executions of basic block in
8536 function given basic block needs to have to be considered hot.
8538 @item max-predicted-iterations
8539 The maximum number of loop iterations we predict statically.  This is useful
8540 in cases where function contain single loop with known bound and other loop
8541 with unknown.  We predict the known number of iterations correctly, while
8542 the unknown number of iterations average to roughly 10.  This means that the
8543 loop without bounds would appear artificially cold relative to the other one.
8545 @item align-threshold
8547 Select fraction of the maximal frequency of executions of basic block in
8548 function given basic block will get aligned.
8550 @item align-loop-iterations
8552 A loop expected to iterate at lest the selected number of iterations will get
8553 aligned.
8555 @item tracer-dynamic-coverage
8556 @itemx tracer-dynamic-coverage-feedback
8558 This value is used to limit superblock formation once the given percentage of
8559 executed instructions is covered.  This limits unnecessary code size
8560 expansion.
8562 The @option{tracer-dynamic-coverage-feedback} is used only when profile
8563 feedback is available.  The real profiles (as opposed to statically estimated
8564 ones) are much less balanced allowing the threshold to be larger value.
8566 @item tracer-max-code-growth
8567 Stop tail duplication once code growth has reached given percentage.  This is
8568 rather hokey argument, as most of the duplicates will be eliminated later in
8569 cross jumping, so it may be set to much higher values than is the desired code
8570 growth.
8572 @item tracer-min-branch-ratio
8574 Stop reverse growth when the reverse probability of best edge is less than this
8575 threshold (in percent).
8577 @item tracer-min-branch-ratio
8578 @itemx tracer-min-branch-ratio-feedback
8580 Stop forward growth if the best edge do have probability lower than this
8581 threshold.
8583 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
8584 compilation for profile feedback and one for compilation without.  The value
8585 for compilation with profile feedback needs to be more conservative (higher) in
8586 order to make tracer effective.
8588 @item max-cse-path-length
8590 Maximum number of basic blocks on path that cse considers.  The default is 10.
8592 @item max-cse-insns
8593 The maximum instructions CSE process before flushing. The default is 1000.
8595 @item ggc-min-expand
8597 GCC uses a garbage collector to manage its own memory allocation.  This
8598 parameter specifies the minimum percentage by which the garbage
8599 collector's heap should be allowed to expand between collections.
8600 Tuning this may improve compilation speed; it has no effect on code
8601 generation.
8603 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
8604 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
8605 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
8606 GCC is not able to calculate RAM on a particular platform, the lower
8607 bound of 30% is used.  Setting this parameter and
8608 @option{ggc-min-heapsize} to zero causes a full collection to occur at
8609 every opportunity.  This is extremely slow, but can be useful for
8610 debugging.
8612 @item ggc-min-heapsize
8614 Minimum size of the garbage collector's heap before it begins bothering
8615 to collect garbage.  The first collection occurs after the heap expands
8616 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
8617 tuning this may improve compilation speed, and has no effect on code
8618 generation.
8620 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
8621 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
8622 with a lower bound of 4096 (four megabytes) and an upper bound of
8623 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
8624 particular platform, the lower bound is used.  Setting this parameter
8625 very large effectively disables garbage collection.  Setting this
8626 parameter and @option{ggc-min-expand} to zero causes a full collection
8627 to occur at every opportunity.
8629 @item max-reload-search-insns
8630 The maximum number of instruction reload should look backward for equivalent
8631 register.  Increasing values mean more aggressive optimization, making the
8632 compile time increase with probably slightly better performance.  The default
8633 value is 100.
8635 @item max-cselib-memory-locations
8636 The maximum number of memory locations cselib should take into account.
8637 Increasing values mean more aggressive optimization, making the compile time
8638 increase with probably slightly better performance.  The default value is 500.
8640 @item reorder-blocks-duplicate
8641 @itemx reorder-blocks-duplicate-feedback
8643 Used by basic block reordering pass to decide whether to use unconditional
8644 branch or duplicate the code on its destination.  Code is duplicated when its
8645 estimated size is smaller than this value multiplied by the estimated size of
8646 unconditional jump in the hot spots of the program.
8648 The @option{reorder-block-duplicate-feedback} is used only when profile
8649 feedback is available and may be set to higher values than
8650 @option{reorder-block-duplicate} since information about the hot spots is more
8651 accurate.
8653 @item max-sched-ready-insns
8654 The maximum number of instructions ready to be issued the scheduler should
8655 consider at any given time during the first scheduling pass.  Increasing
8656 values mean more thorough searches, making the compilation time increase
8657 with probably little benefit.  The default value is 100.
8659 @item max-sched-region-blocks
8660 The maximum number of blocks in a region to be considered for
8661 interblock scheduling.  The default value is 10.
8663 @item max-pipeline-region-blocks
8664 The maximum number of blocks in a region to be considered for
8665 pipelining in the selective scheduler.  The default value is 15.
8667 @item max-sched-region-insns
8668 The maximum number of insns in a region to be considered for
8669 interblock scheduling.  The default value is 100.
8671 @item max-pipeline-region-insns
8672 The maximum number of insns in a region to be considered for
8673 pipelining in the selective scheduler.  The default value is 200.
8675 @item min-spec-prob
8676 The minimum probability (in percents) of reaching a source block
8677 for interblock speculative scheduling.  The default value is 40.
8679 @item max-sched-extend-regions-iters
8680 The maximum number of iterations through CFG to extend regions.
8681 0 - disable region extension,
8682 N - do at most N iterations.
8683 The default value is 0.
8685 @item max-sched-insn-conflict-delay
8686 The maximum conflict delay for an insn to be considered for speculative motion.
8687 The default value is 3.
8689 @item sched-spec-prob-cutoff
8690 The minimal probability of speculation success (in percents), so that
8691 speculative insn will be scheduled.
8692 The default value is 40.
8694 @item sched-mem-true-dep-cost
8695 Minimal distance (in CPU cycles) between store and load targeting same
8696 memory locations.  The default value is 1.
8698 @item selsched-max-lookahead
8699 The maximum size of the lookahead window of selective scheduling.  It is a
8700 depth of search for available instructions.
8701 The default value is 50.
8703 @item selsched-max-sched-times
8704 The maximum number of times that an instruction will be scheduled during
8705 selective scheduling.  This is the limit on the number of iterations
8706 through which the instruction may be pipelined.  The default value is 2.
8708 @item selsched-max-insns-to-rename
8709 The maximum number of best instructions in the ready list that are considered
8710 for renaming in the selective scheduler.  The default value is 2.
8712 @item sms-min-sc
8713 The minimum value of stage count that swing modulo scheduler will
8714 generate.  The default value is 2.
8716 @item max-last-value-rtl
8717 The maximum size measured as number of RTLs that can be recorded in an expression
8718 in combiner for a pseudo register as last known value of that register.  The default
8719 is 10000.
8721 @item integer-share-limit
8722 Small integer constants can use a shared data structure, reducing the
8723 compiler's memory usage and increasing its speed.  This sets the maximum
8724 value of a shared integer constant.  The default value is 256.
8726 @item min-virtual-mappings
8727 Specifies the minimum number of virtual mappings in the incremental
8728 SSA updater that should be registered to trigger the virtual mappings
8729 heuristic defined by virtual-mappings-ratio.  The default value is
8730 100.
8732 @item virtual-mappings-ratio
8733 If the number of virtual mappings is virtual-mappings-ratio bigger
8734 than the number of virtual symbols to be updated, then the incremental
8735 SSA updater switches to a full update for those symbols.  The default
8736 ratio is 3.
8738 @item ssp-buffer-size
8739 The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
8740 protection when @option{-fstack-protection} is used.
8742 @item max-jump-thread-duplication-stmts
8743 Maximum number of statements allowed in a block that needs to be
8744 duplicated when threading jumps.
8746 @item max-fields-for-field-sensitive
8747 Maximum number of fields in a structure we will treat in
8748 a field sensitive manner during pointer analysis.  The default is zero
8749 for -O0, and -O1 and 100 for -Os, -O2, and -O3.
8751 @item prefetch-latency
8752 Estimate on average number of instructions that are executed before
8753 prefetch finishes.  The distance we prefetch ahead is proportional
8754 to this constant.  Increasing this number may also lead to less
8755 streams being prefetched (see @option{simultaneous-prefetches}).
8757 @item simultaneous-prefetches
8758 Maximum number of prefetches that can run at the same time.
8760 @item l1-cache-line-size
8761 The size of cache line in L1 cache, in bytes.
8763 @item l1-cache-size
8764 The size of L1 cache, in kilobytes.
8766 @item l2-cache-size
8767 The size of L2 cache, in kilobytes.
8769 @item min-insn-to-prefetch-ratio
8770 The minimum ratio between the number of instructions and the
8771 number of prefetches to enable prefetching in a loop.
8773 @item prefetch-min-insn-to-mem-ratio
8774 The minimum ratio between the number of instructions and the
8775 number of memory references to enable prefetching in a loop.
8777 @item use-canonical-types
8778 Whether the compiler should use the ``canonical'' type system.  By
8779 default, this should always be 1, which uses a more efficient internal
8780 mechanism for comparing types in C++ and Objective-C++.  However, if
8781 bugs in the canonical type system are causing compilation failures,
8782 set this value to 0 to disable canonical types.
8784 @item switch-conversion-max-branch-ratio
8785 Switch initialization conversion will refuse to create arrays that are
8786 bigger than @option{switch-conversion-max-branch-ratio} times the number of
8787 branches in the switch.
8789 @item max-partial-antic-length
8790 Maximum length of the partial antic set computed during the tree
8791 partial redundancy elimination optimization (@option{-ftree-pre}) when
8792 optimizing at @option{-O3} and above.  For some sorts of source code
8793 the enhanced partial redundancy elimination optimization can run away,
8794 consuming all of the memory available on the host machine.  This
8795 parameter sets a limit on the length of the sets that are computed,
8796 which prevents the runaway behavior.  Setting a value of 0 for
8797 this parameter will allow an unlimited set length.
8799 @item sccvn-max-scc-size
8800 Maximum size of a strongly connected component (SCC) during SCCVN
8801 processing.  If this limit is hit, SCCVN processing for the whole
8802 function will not be done and optimizations depending on it will
8803 be disabled.  The default maximum SCC size is 10000.
8805 @item ira-max-loops-num
8806 IRA uses a regional register allocation by default.  If a function
8807 contains loops more than number given by the parameter, only at most
8808 given number of the most frequently executed loops will form regions
8809 for the regional register allocation.  The default value of the
8810 parameter is 100.
8812 @item ira-max-conflict-table-size
8813 Although IRA uses a sophisticated algorithm of compression conflict
8814 table, the table can be still big for huge functions.  If the conflict
8815 table for a function could be more than size in MB given by the
8816 parameter, the conflict table is not built and faster, simpler, and
8817 lower quality register allocation algorithm will be used.  The
8818 algorithm do not use pseudo-register conflicts.  The default value of
8819 the parameter is 2000.
8821 @item ira-loop-reserved-regs
8822 IRA can be used to evaluate more accurate register pressure in loops
8823 for decision to move loop invariants (see @option{-O3}).  The number
8824 of available registers reserved for some other purposes is described
8825 by this parameter.  The default value of the parameter is 2 which is
8826 minimal number of registers needed for execution of typical
8827 instruction.  This value is the best found from numerous experiments.
8829 @item loop-invariant-max-bbs-in-loop
8830 Loop invariant motion can be very expensive, both in compile time and
8831 in amount of needed compile time memory, with very large loops.  Loops
8832 with more basic blocks than this parameter won't have loop invariant
8833 motion optimization performed on them.  The default value of the
8834 parameter is 1000 for -O1 and 10000 for -O2 and above.
8836 @item max-vartrack-size
8837 Sets a maximum number of hash table slots to use during variable
8838 tracking dataflow analysis of any function.  If this limit is exceeded
8839 with variable tracking at assignments enabled, analysis for that
8840 function is retried without it, after removing all debug insns from
8841 the function.  If the limit is exceeded even without debug insns, var
8842 tracking analysis is completely disabled for the function.  Setting
8843 the parameter to zero makes it unlimited.
8845 @item min-nondebug-insn-uid
8846 Use uids starting at this parameter for nondebug insns.  The range below
8847 the parameter is reserved exclusively for debug insns created by
8848 @option{-fvar-tracking-assignments}, but debug insns may get
8849 (non-overlapping) uids above it if the reserved range is exhausted.
8851 @item ipa-sra-ptr-growth-factor
8852 IPA-SRA will replace a pointer to an aggregate with one or more new
8853 parameters only when their cumulative size is less or equal to
8854 @option{ipa-sra-ptr-growth-factor} times the size of the original
8855 pointer parameter.
8857 @item graphite-max-nb-scop-params
8858 To avoid exponential effects in the Graphite loop transforms, the
8859 number of parameters in a Static Control Part (SCoP) is bounded.  The
8860 default value is 10 parameters.  A variable whose value is unknown at
8861 compile time and defined outside a SCoP is a parameter of the SCoP.
8863 @item graphite-max-bbs-per-function
8864 To avoid exponential effects in the detection of SCoPs, the size of
8865 the functions analyzed by Graphite is bounded.  The default value is
8866 100 basic blocks.
8868 @item loop-block-tile-size
8869 Loop blocking or strip mining transforms, enabled with
8870 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
8871 loop in the loop nest by a given number of iterations.  The strip
8872 length can be changed using the @option{loop-block-tile-size}
8873 parameter.  The default value is 51 iterations.
8875 @item devirt-type-list-size
8876 IPA-CP attempts to track all possible types passed to a function's
8877 parameter in order to perform devirtualization.
8878 @option{devirt-type-list-size} is the maximum number of types it
8879 stores per a single formal parameter of a function.
8881 @item lto-partitions
8882 Specify desired number of partitions produced during WHOPR compilation.
8883 The number of partitions should exceed the number of CPUs used for compilation.
8884 The default value is 32.
8886 @item lto-minpartition
8887 Size of minimal partition for WHOPR (in estimated instructions).
8888 This prevents expenses of splitting very small programs into too many
8889 partitions.
8891 @item cxx-max-namespaces-for-diagnostic-help
8892 The maximum number of namespaces to consult for suggestions when C++
8893 name lookup fails for an identifier.  The default is 1000.
8895 @item max-stores-to-sink
8896 The maximum number of conditional stores paires that can be sunk.  Set to 0
8897 if either vectorization (@option{-ftree-vectorize}) or if-conversion
8898 (@option{-ftree-loop-if-convert}) is disabled.  The default is 2.
8900 @end table
8901 @end table
8903 @node Preprocessor Options
8904 @section Options Controlling the Preprocessor
8905 @cindex preprocessor options
8906 @cindex options, preprocessor
8908 These options control the C preprocessor, which is run on each C source
8909 file before actual compilation.
8911 If you use the @option{-E} option, nothing is done except preprocessing.
8912 Some of these options make sense only together with @option{-E} because
8913 they cause the preprocessor output to be unsuitable for actual
8914 compilation.
8916 @table @gcctabopt
8917 @item -Wp,@var{option}
8918 @opindex Wp
8919 You can use @option{-Wp,@var{option}} to bypass the compiler driver
8920 and pass @var{option} directly through to the preprocessor.  If
8921 @var{option} contains commas, it is split into multiple options at the
8922 commas.  However, many options are modified, translated or interpreted
8923 by the compiler driver before being passed to the preprocessor, and
8924 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
8925 interface is undocumented and subject to change, so whenever possible
8926 you should avoid using @option{-Wp} and let the driver handle the
8927 options instead.
8929 @item -Xpreprocessor @var{option}
8930 @opindex Xpreprocessor
8931 Pass @var{option} as an option to the preprocessor.  You can use this to
8932 supply system-specific preprocessor options which GCC does not know how to
8933 recognize.
8935 If you want to pass an option that takes an argument, you must use
8936 @option{-Xpreprocessor} twice, once for the option and once for the argument.
8937 @end table
8939 @include cppopts.texi
8941 @node Assembler Options
8942 @section Passing Options to the Assembler
8944 @c prevent bad page break with this line
8945 You can pass options to the assembler.
8947 @table @gcctabopt
8948 @item -Wa,@var{option}
8949 @opindex Wa
8950 Pass @var{option} as an option to the assembler.  If @var{option}
8951 contains commas, it is split into multiple options at the commas.
8953 @item -Xassembler @var{option}
8954 @opindex Xassembler
8955 Pass @var{option} as an option to the assembler.  You can use this to
8956 supply system-specific assembler options which GCC does not know how to
8957 recognize.
8959 If you want to pass an option that takes an argument, you must use
8960 @option{-Xassembler} twice, once for the option and once for the argument.
8962 @end table
8964 @node Link Options
8965 @section Options for Linking
8966 @cindex link options
8967 @cindex options, linking
8969 These options come into play when the compiler links object files into
8970 an executable output file.  They are meaningless if the compiler is
8971 not doing a link step.
8973 @table @gcctabopt
8974 @cindex file names
8975 @item @var{object-file-name}
8976 A file name that does not end in a special recognized suffix is
8977 considered to name an object file or library.  (Object files are
8978 distinguished from libraries by the linker according to the file
8979 contents.)  If linking is done, these object files are used as input
8980 to the linker.
8982 @item -c
8983 @itemx -S
8984 @itemx -E
8985 @opindex c
8986 @opindex S
8987 @opindex E
8988 If any of these options is used, then the linker is not run, and
8989 object file names should not be used as arguments.  @xref{Overall
8990 Options}.
8992 @cindex Libraries
8993 @item -l@var{library}
8994 @itemx -l @var{library}
8995 @opindex l
8996 Search the library named @var{library} when linking.  (The second
8997 alternative with the library as a separate argument is only for
8998 POSIX compliance and is not recommended.)
9000 It makes a difference where in the command you write this option; the
9001 linker searches and processes libraries and object files in the order they
9002 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
9003 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
9004 to functions in @samp{z}, those functions may not be loaded.
9006 The linker searches a standard list of directories for the library,
9007 which is actually a file named @file{lib@var{library}.a}.  The linker
9008 then uses this file as if it had been specified precisely by name.
9010 The directories searched include several standard system directories
9011 plus any that you specify with @option{-L}.
9013 Normally the files found this way are library files---archive files
9014 whose members are object files.  The linker handles an archive file by
9015 scanning through it for members which define symbols that have so far
9016 been referenced but not defined.  But if the file that is found is an
9017 ordinary object file, it is linked in the usual fashion.  The only
9018 difference between using an @option{-l} option and specifying a file name
9019 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
9020 and searches several directories.
9022 @item -lobjc
9023 @opindex lobjc
9024 You need this special case of the @option{-l} option in order to
9025 link an Objective-C or Objective-C++ program.
9027 @item -nostartfiles
9028 @opindex nostartfiles
9029 Do not use the standard system startup files when linking.
9030 The standard system libraries are used normally, unless @option{-nostdlib}
9031 or @option{-nodefaultlibs} is used.
9033 @item -nodefaultlibs
9034 @opindex nodefaultlibs
9035 Do not use the standard system libraries when linking.
9036 Only the libraries you specify will be passed to the linker, options
9037 specifying linkage of the system libraries, such as @code{-static-libgcc}
9038 or @code{-shared-libgcc}, will be ignored.
9039 The standard startup files are used normally, unless @option{-nostartfiles}
9040 is used.  The compiler may generate calls to @code{memcmp},
9041 @code{memset}, @code{memcpy} and @code{memmove}.
9042 These entries are usually resolved by entries in
9043 libc.  These entry points should be supplied through some other
9044 mechanism when this option is specified.
9046 @item -nostdlib
9047 @opindex nostdlib
9048 Do not use the standard system startup files or libraries when linking.
9049 No startup files and only the libraries you specify will be passed to
9050 the linker, options specifying linkage of the system libraries, such as
9051 @code{-static-libgcc} or @code{-shared-libgcc}, will be ignored.
9052 The compiler may generate calls to @code{memcmp}, @code{memset},
9053 @code{memcpy} and @code{memmove}.
9054 These entries are usually resolved by entries in
9055 libc.  These entry points should be supplied through some other
9056 mechanism when this option is specified.
9058 @cindex @option{-lgcc}, use with @option{-nostdlib}
9059 @cindex @option{-nostdlib} and unresolved references
9060 @cindex unresolved references and @option{-nostdlib}
9061 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
9062 @cindex @option{-nodefaultlibs} and unresolved references
9063 @cindex unresolved references and @option{-nodefaultlibs}
9064 One of the standard libraries bypassed by @option{-nostdlib} and
9065 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
9066 that GCC uses to overcome shortcomings of particular machines, or special
9067 needs for some languages.
9068 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
9069 Collection (GCC) Internals},
9070 for more discussion of @file{libgcc.a}.)
9071 In most cases, you need @file{libgcc.a} even when you want to avoid
9072 other standard libraries.  In other words, when you specify @option{-nostdlib}
9073 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
9074 This ensures that you have no unresolved references to internal GCC
9075 library subroutines.  (For example, @samp{__main}, used to ensure C++
9076 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
9077 GNU Compiler Collection (GCC) Internals}.)
9079 @item -pie
9080 @opindex pie
9081 Produce a position independent executable on targets which support it.
9082 For predictable results, you must also specify the same set of options
9083 that were used to generate code (@option{-fpie}, @option{-fPIE},
9084 or model suboptions) when you specify this option.
9086 @item -rdynamic
9087 @opindex rdynamic
9088 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
9089 that support it. This instructs the linker to add all symbols, not
9090 only used ones, to the dynamic symbol table. This option is needed
9091 for some uses of @code{dlopen} or to allow obtaining backtraces
9092 from within a program.
9094 @item -s
9095 @opindex s
9096 Remove all symbol table and relocation information from the executable.
9098 @item -static
9099 @opindex static
9100 On systems that support dynamic linking, this prevents linking with the shared
9101 libraries.  On other systems, this option has no effect.
9103 @item -shared
9104 @opindex shared
9105 Produce a shared object which can then be linked with other objects to
9106 form an executable.  Not all systems support this option.  For predictable
9107 results, you must also specify the same set of options that were used to
9108 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
9109 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
9110 needs to build supplementary stub code for constructors to work.  On
9111 multi-libbed systems, @samp{gcc -shared} must select the correct support
9112 libraries to link against.  Failing to supply the correct flags may lead
9113 to subtle defects.  Supplying them in cases where they are not necessary
9114 is innocuous.}
9116 @item -shared-libgcc
9117 @itemx -static-libgcc
9118 @opindex shared-libgcc
9119 @opindex static-libgcc
9120 On systems that provide @file{libgcc} as a shared library, these options
9121 force the use of either the shared or static version respectively.
9122 If no shared version of @file{libgcc} was built when the compiler was
9123 configured, these options have no effect.
9125 There are several situations in which an application should use the
9126 shared @file{libgcc} instead of the static version.  The most common
9127 of these is when the application wishes to throw and catch exceptions
9128 across different shared libraries.  In that case, each of the libraries
9129 as well as the application itself should use the shared @file{libgcc}.
9131 Therefore, the G++ and GCJ drivers automatically add
9132 @option{-shared-libgcc} whenever you build a shared library or a main
9133 executable, because C++ and Java programs typically use exceptions, so
9134 this is the right thing to do.
9136 If, instead, you use the GCC driver to create shared libraries, you may
9137 find that they will not always be linked with the shared @file{libgcc}.
9138 If GCC finds, at its configuration time, that you have a non-GNU linker
9139 or a GNU linker that does not support option @option{--eh-frame-hdr},
9140 it will link the shared version of @file{libgcc} into shared libraries
9141 by default.  Otherwise, it will take advantage of the linker and optimize
9142 away the linking with the shared version of @file{libgcc}, linking with
9143 the static version of libgcc by default.  This allows exceptions to
9144 propagate through such shared libraries, without incurring relocation
9145 costs at library load time.
9147 However, if a library or main executable is supposed to throw or catch
9148 exceptions, you must link it using the G++ or GCJ driver, as appropriate
9149 for the languages used in the program, or using the option
9150 @option{-shared-libgcc}, such that it is linked with the shared
9151 @file{libgcc}.
9153 @item -static-libstdc++
9154 When the @command{g++} program is used to link a C++ program, it will
9155 normally automatically link against @option{libstdc++}.  If
9156 @file{libstdc++} is available as a shared library, and the
9157 @option{-static} option is not used, then this will link against the
9158 shared version of @file{libstdc++}.  That is normally fine.  However, it
9159 is sometimes useful to freeze the version of @file{libstdc++} used by
9160 the program without going all the way to a fully static link.  The
9161 @option{-static-libstdc++} option directs the @command{g++} driver to
9162 link @file{libstdc++} statically, without necessarily linking other
9163 libraries statically.
9165 @item -symbolic
9166 @opindex symbolic
9167 Bind references to global symbols when building a shared object.  Warn
9168 about any unresolved references (unless overridden by the link editor
9169 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
9170 this option.
9172 @item -T @var{script}
9173 @opindex T
9174 @cindex linker script
9175 Use @var{script} as the linker script.  This option is supported by most
9176 systems using the GNU linker.  On some targets, such as bare-board
9177 targets without an operating system, the @option{-T} option may be required
9178 when linking to avoid references to undefined symbols.
9180 @item -Xlinker @var{option}
9181 @opindex Xlinker
9182 Pass @var{option} as an option to the linker.  You can use this to
9183 supply system-specific linker options which GCC does not know how to
9184 recognize.
9186 If you want to pass an option that takes a separate argument, you must use
9187 @option{-Xlinker} twice, once for the option and once for the argument.
9188 For example, to pass @option{-assert definitions}, you must write
9189 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
9190 @option{-Xlinker "-assert definitions"}, because this passes the entire
9191 string as a single argument, which is not what the linker expects.
9193 When using the GNU linker, it is usually more convenient to pass
9194 arguments to linker options using the @option{@var{option}=@var{value}}
9195 syntax than as separate arguments.  For example, you can specify
9196 @samp{-Xlinker -Map=output.map} rather than
9197 @samp{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
9198 this syntax for command-line options.
9200 @item -Wl,@var{option}
9201 @opindex Wl
9202 Pass @var{option} as an option to the linker.  If @var{option} contains
9203 commas, it is split into multiple options at the commas.  You can use this
9204 syntax to pass an argument to the option.
9205 For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
9206 linker.  When using the GNU linker, you can also get the same effect with
9207 @samp{-Wl,-Map=output.map}.
9209 @item -u @var{symbol}
9210 @opindex u
9211 Pretend the symbol @var{symbol} is undefined, to force linking of
9212 library modules to define it.  You can use @option{-u} multiple times with
9213 different symbols to force loading of additional library modules.
9214 @end table
9216 @node Directory Options
9217 @section Options for Directory Search
9218 @cindex directory options
9219 @cindex options, directory search
9220 @cindex search path
9222 These options specify directories to search for header files, for
9223 libraries and for parts of the compiler:
9225 @table @gcctabopt
9226 @item -I@var{dir}
9227 @opindex I
9228 Add the directory @var{dir} to the head of the list of directories to be
9229 searched for header files.  This can be used to override a system header
9230 file, substituting your own version, since these directories are
9231 searched before the system header file directories.  However, you should
9232 not use this option to add directories that contain vendor-supplied
9233 system header files (use @option{-isystem} for that).  If you use more than
9234 one @option{-I} option, the directories are scanned in left-to-right
9235 order; the standard system directories come after.
9237 If a standard system include directory, or a directory specified with
9238 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
9239 option will be ignored.  The directory will still be searched but as a
9240 system directory at its normal position in the system include chain.
9241 This is to ensure that GCC's procedure to fix buggy system headers and
9242 the ordering for the include_next directive are not inadvertently changed.
9243 If you really need to change the search order for system directories,
9244 use the @option{-nostdinc} and/or @option{-isystem} options.
9246 @item -iplugindir=@var{dir}
9247 Set the directory to search for plugins which are passed
9248 by @option{-fplugin=@var{name}} instead of
9249 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
9250 to be used by the user, but only passed by the driver.
9252 @item -iquote@var{dir}
9253 @opindex iquote
9254 Add the directory @var{dir} to the head of the list of directories to
9255 be searched for header files only for the case of @samp{#include
9256 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
9257 otherwise just like @option{-I}.
9259 @item -L@var{dir}
9260 @opindex L
9261 Add directory @var{dir} to the list of directories to be searched
9262 for @option{-l}.
9264 @item -B@var{prefix}
9265 @opindex B
9266 This option specifies where to find the executables, libraries,
9267 include files, and data files of the compiler itself.
9269 The compiler driver program runs one or more of the subprograms
9270 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
9271 @var{prefix} as a prefix for each program it tries to run, both with and
9272 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
9274 For each subprogram to be run, the compiler driver first tries the
9275 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
9276 was not specified, the driver tries two standard prefixes, which are
9277 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
9278 those results in a file name that is found, the unmodified program
9279 name is searched for using the directories specified in your
9280 @env{PATH} environment variable.
9282 The compiler will check to see if the path provided by the @option{-B}
9283 refers to a directory, and if necessary it will add a directory
9284 separator character at the end of the path.
9286 @option{-B} prefixes that effectively specify directory names also apply
9287 to libraries in the linker, because the compiler translates these
9288 options into @option{-L} options for the linker.  They also apply to
9289 includes files in the preprocessor, because the compiler translates these
9290 options into @option{-isystem} options for the preprocessor.  In this case,
9291 the compiler appends @samp{include} to the prefix.
9293 The run-time support file @file{libgcc.a} can also be searched for using
9294 the @option{-B} prefix, if needed.  If it is not found there, the two
9295 standard prefixes above are tried, and that is all.  The file is left
9296 out of the link if it is not found by those means.
9298 Another way to specify a prefix much like the @option{-B} prefix is to use
9299 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
9300 Variables}.
9302 As a special kludge, if the path provided by @option{-B} is
9303 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
9304 9, then it will be replaced by @file{[dir/]include}.  This is to help
9305 with boot-strapping the compiler.
9307 @item -specs=@var{file}
9308 @opindex specs
9309 Process @var{file} after the compiler reads in the standard @file{specs}
9310 file, in order to override the defaults that the @file{gcc} driver
9311 program uses when determining what switches to pass to @file{cc1},
9312 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
9313 @option{-specs=@var{file}} can be specified on the command line, and they
9314 are processed in order, from left to right.
9316 @item --sysroot=@var{dir}
9317 @opindex sysroot
9318 Use @var{dir} as the logical root directory for headers and libraries.
9319 For example, if the compiler would normally search for headers in
9320 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
9321 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
9323 If you use both this option and the @option{-isysroot} option, then
9324 the @option{--sysroot} option will apply to libraries, but the
9325 @option{-isysroot} option will apply to header files.
9327 The GNU linker (beginning with version 2.16) has the necessary support
9328 for this option.  If your linker does not support this option, the
9329 header file aspect of @option{--sysroot} will still work, but the
9330 library aspect will not.
9332 @item -I-
9333 @opindex I-
9334 This option has been deprecated.  Please use @option{-iquote} instead for
9335 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
9336 Any directories you specify with @option{-I} options before the @option{-I-}
9337 option are searched only for the case of @samp{#include "@var{file}"};
9338 they are not searched for @samp{#include <@var{file}>}.
9340 If additional directories are specified with @option{-I} options after
9341 the @option{-I-}, these directories are searched for all @samp{#include}
9342 directives.  (Ordinarily @emph{all} @option{-I} directories are used
9343 this way.)
9345 In addition, the @option{-I-} option inhibits the use of the current
9346 directory (where the current input file came from) as the first search
9347 directory for @samp{#include "@var{file}"}.  There is no way to
9348 override this effect of @option{-I-}.  With @option{-I.} you can specify
9349 searching the directory which was current when the compiler was
9350 invoked.  That is not exactly the same as what the preprocessor does
9351 by default, but it is often satisfactory.
9353 @option{-I-} does not inhibit the use of the standard system directories
9354 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
9355 independent.
9356 @end table
9358 @c man end
9360 @node Spec Files
9361 @section Specifying subprocesses and the switches to pass to them
9362 @cindex Spec Files
9364 @command{gcc} is a driver program.  It performs its job by invoking a
9365 sequence of other programs to do the work of compiling, assembling and
9366 linking.  GCC interprets its command-line parameters and uses these to
9367 deduce which programs it should invoke, and which command-line options
9368 it ought to place on their command lines.  This behavior is controlled
9369 by @dfn{spec strings}.  In most cases there is one spec string for each
9370 program that GCC can invoke, but a few programs have multiple spec
9371 strings to control their behavior.  The spec strings built into GCC can
9372 be overridden by using the @option{-specs=} command-line switch to specify
9373 a spec file.
9375 @dfn{Spec files} are plaintext files that are used to construct spec
9376 strings.  They consist of a sequence of directives separated by blank
9377 lines.  The type of directive is determined by the first non-whitespace
9378 character on the line and it can be one of the following:
9380 @table @code
9381 @item %@var{command}
9382 Issues a @var{command} to the spec file processor.  The commands that can
9383 appear here are:
9385 @table @code
9386 @item %include <@var{file}>
9387 @cindex @code{%include}
9388 Search for @var{file} and insert its text at the current point in the
9389 specs file.
9391 @item %include_noerr <@var{file}>
9392 @cindex @code{%include_noerr}
9393 Just like @samp{%include}, but do not generate an error message if the include
9394 file cannot be found.
9396 @item %rename @var{old_name} @var{new_name}
9397 @cindex @code{%rename}
9398 Rename the spec string @var{old_name} to @var{new_name}.
9400 @end table
9402 @item *[@var{spec_name}]:
9403 This tells the compiler to create, override or delete the named spec
9404 string.  All lines after this directive up to the next directive or
9405 blank line are considered to be the text for the spec string.  If this
9406 results in an empty string then the spec will be deleted.  (Or, if the
9407 spec did not exist, then nothing will happen.)  Otherwise, if the spec
9408 does not currently exist a new spec will be created.  If the spec does
9409 exist then its contents will be overridden by the text of this
9410 directive, unless the first character of that text is the @samp{+}
9411 character, in which case the text will be appended to the spec.
9413 @item [@var{suffix}]:
9414 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
9415 and up to the next directive or blank line are considered to make up the
9416 spec string for the indicated suffix.  When the compiler encounters an
9417 input file with the named suffix, it will processes the spec string in
9418 order to work out how to compile that file.  For example:
9420 @smallexample
9421 .ZZ:
9422 z-compile -input %i
9423 @end smallexample
9425 This says that any input file whose name ends in @samp{.ZZ} should be
9426 passed to the program @samp{z-compile}, which should be invoked with the
9427 command-line switch @option{-input} and with the result of performing the
9428 @samp{%i} substitution.  (See below.)
9430 As an alternative to providing a spec string, the text that follows a
9431 suffix directive can be one of the following:
9433 @table @code
9434 @item @@@var{language}
9435 This says that the suffix is an alias for a known @var{language}.  This is
9436 similar to using the @option{-x} command-line switch to GCC to specify a
9437 language explicitly.  For example:
9439 @smallexample
9440 .ZZ:
9441 @@c++
9442 @end smallexample
9444 Says that .ZZ files are, in fact, C++ source files.
9446 @item #@var{name}
9447 This causes an error messages saying:
9449 @smallexample
9450 @var{name} compiler not installed on this system.
9451 @end smallexample
9452 @end table
9454 GCC already has an extensive list of suffixes built into it.
9455 This directive will add an entry to the end of the list of suffixes, but
9456 since the list is searched from the end backwards, it is effectively
9457 possible to override earlier entries using this technique.
9459 @end table
9461 GCC has the following spec strings built into it.  Spec files can
9462 override these strings or create their own.  Note that individual
9463 targets can also add their own spec strings to this list.
9465 @smallexample
9466 asm          Options to pass to the assembler
9467 asm_final    Options to pass to the assembler post-processor
9468 cpp          Options to pass to the C preprocessor
9469 cc1          Options to pass to the C compiler
9470 cc1plus      Options to pass to the C++ compiler
9471 endfile      Object files to include at the end of the link
9472 link         Options to pass to the linker
9473 lib          Libraries to include on the command line to the linker
9474 libgcc       Decides which GCC support library to pass to the linker
9475 linker       Sets the name of the linker
9476 predefines   Defines to be passed to the C preprocessor
9477 signed_char  Defines to pass to CPP to say whether @code{char} is signed
9478              by default
9479 startfile    Object files to include at the start of the link
9480 @end smallexample
9482 Here is a small example of a spec file:
9484 @smallexample
9485 %rename lib                 old_lib
9487 *lib:
9488 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
9489 @end smallexample
9491 This example renames the spec called @samp{lib} to @samp{old_lib} and
9492 then overrides the previous definition of @samp{lib} with a new one.
9493 The new definition adds in some extra command-line options before
9494 including the text of the old definition.
9496 @dfn{Spec strings} are a list of command-line options to be passed to their
9497 corresponding program.  In addition, the spec strings can contain
9498 @samp{%}-prefixed sequences to substitute variable text or to
9499 conditionally insert text into the command line.  Using these constructs
9500 it is possible to generate quite complex command lines.
9502 Here is a table of all defined @samp{%}-sequences for spec
9503 strings.  Note that spaces are not generated automatically around the
9504 results of expanding these sequences.  Therefore you can concatenate them
9505 together or combine them with constant text in a single argument.
9507 @table @code
9508 @item %%
9509 Substitute one @samp{%} into the program name or argument.
9511 @item %i
9512 Substitute the name of the input file being processed.
9514 @item %b
9515 Substitute the basename of the input file being processed.
9516 This is the substring up to (and not including) the last period
9517 and not including the directory.
9519 @item %B
9520 This is the same as @samp{%b}, but include the file suffix (text after
9521 the last period).
9523 @item %d
9524 Marks the argument containing or following the @samp{%d} as a
9525 temporary file name, so that that file will be deleted if GCC exits
9526 successfully.  Unlike @samp{%g}, this contributes no text to the
9527 argument.
9529 @item %g@var{suffix}
9530 Substitute a file name that has suffix @var{suffix} and is chosen
9531 once per compilation, and mark the argument in the same way as
9532 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
9533 name is now chosen in a way that is hard to predict even when previously
9534 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
9535 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
9536 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
9537 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
9538 was simply substituted with a file name chosen once per compilation,
9539 without regard to any appended suffix (which was therefore treated
9540 just like ordinary text), making such attacks more likely to succeed.
9542 @item %u@var{suffix}
9543 Like @samp{%g}, but generates a new temporary file name even if
9544 @samp{%u@var{suffix}} was already seen.
9546 @item %U@var{suffix}
9547 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
9548 new one if there is no such last file name.  In the absence of any
9549 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
9550 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
9551 would involve the generation of two distinct file names, one
9552 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
9553 simply substituted with a file name chosen for the previous @samp{%u},
9554 without regard to any appended suffix.
9556 @item %j@var{suffix}
9557 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
9558 writable, and if save-temps is off; otherwise, substitute the name
9559 of a temporary file, just like @samp{%u}.  This temporary file is not
9560 meant for communication between processes, but rather as a junk
9561 disposal mechanism.
9563 @item %|@var{suffix}
9564 @itemx %m@var{suffix}
9565 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
9566 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
9567 all.  These are the two most common ways to instruct a program that it
9568 should read from standard input or write to standard output.  If you
9569 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
9570 construct: see for example @file{f/lang-specs.h}.
9572 @item %.@var{SUFFIX}
9573 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
9574 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
9575 terminated by the next space or %.
9577 @item %w
9578 Marks the argument containing or following the @samp{%w} as the
9579 designated output file of this compilation.  This puts the argument
9580 into the sequence of arguments that @samp{%o} will substitute later.
9582 @item %o
9583 Substitutes the names of all the output files, with spaces
9584 automatically placed around them.  You should write spaces
9585 around the @samp{%o} as well or the results are undefined.
9586 @samp{%o} is for use in the specs for running the linker.
9587 Input files whose names have no recognized suffix are not compiled
9588 at all, but they are included among the output files, so they will
9589 be linked.
9591 @item %O
9592 Substitutes the suffix for object files.  Note that this is
9593 handled specially when it immediately follows @samp{%g, %u, or %U},
9594 because of the need for those to form complete file names.  The
9595 handling is such that @samp{%O} is treated exactly as if it had already
9596 been substituted, except that @samp{%g, %u, and %U} do not currently
9597 support additional @var{suffix} characters following @samp{%O} as they would
9598 following, for example, @samp{.o}.
9600 @item %p
9601 Substitutes the standard macro predefinitions for the
9602 current target machine.  Use this when running @code{cpp}.
9604 @item %P
9605 Like @samp{%p}, but puts @samp{__} before and after the name of each
9606 predefined macro, except for macros that start with @samp{__} or with
9607 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
9610 @item %I
9611 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
9612 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
9613 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
9614 and @option{-imultilib} as necessary.
9616 @item %s
9617 Current argument is the name of a library or startup file of some sort.
9618 Search for that file in a standard list of directories and substitute
9619 the full name found.  The current working directory is included in the
9620 list of directories scanned.
9622 @item %T
9623 Current argument is the name of a linker script.  Search for that file
9624 in the current list of directories to scan for libraries. If the file
9625 is located insert a @option{--script} option into the command line
9626 followed by the full path name found.  If the file is not found then
9627 generate an error message.  Note: the current working directory is not
9628 searched.
9630 @item %e@var{str}
9631 Print @var{str} as an error message.  @var{str} is terminated by a newline.
9632 Use this when inconsistent options are detected.
9634 @item %(@var{name})
9635 Substitute the contents of spec string @var{name} at this point.
9637 @item %[@var{name}]
9638 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
9640 @item %x@{@var{option}@}
9641 Accumulate an option for @samp{%X}.
9643 @item %X
9644 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
9645 spec string.
9647 @item %Y
9648 Output the accumulated assembler options specified by @option{-Wa}.
9650 @item %Z
9651 Output the accumulated preprocessor options specified by @option{-Wp}.
9653 @item %a
9654 Process the @code{asm} spec.  This is used to compute the
9655 switches to be passed to the assembler.
9657 @item %A
9658 Process the @code{asm_final} spec.  This is a spec string for
9659 passing switches to an assembler post-processor, if such a program is
9660 needed.
9662 @item %l
9663 Process the @code{link} spec.  This is the spec for computing the
9664 command line passed to the linker.  Typically it will make use of the
9665 @samp{%L %G %S %D and %E} sequences.
9667 @item %D
9668 Dump out a @option{-L} option for each directory that GCC believes might
9669 contain startup files.  If the target supports multilibs then the
9670 current multilib directory will be prepended to each of these paths.
9672 @item %L
9673 Process the @code{lib} spec.  This is a spec string for deciding which
9674 libraries should be included on the command line to the linker.
9676 @item %G
9677 Process the @code{libgcc} spec.  This is a spec string for deciding
9678 which GCC support library should be included on the command line to the linker.
9680 @item %S
9681 Process the @code{startfile} spec.  This is a spec for deciding which
9682 object files should be the first ones passed to the linker.  Typically
9683 this might be a file named @file{crt0.o}.
9685 @item %E
9686 Process the @code{endfile} spec.  This is a spec string that specifies
9687 the last object files that will be passed to the linker.
9689 @item %C
9690 Process the @code{cpp} spec.  This is used to construct the arguments
9691 to be passed to the C preprocessor.
9693 @item %1
9694 Process the @code{cc1} spec.  This is used to construct the options to be
9695 passed to the actual C compiler (@samp{cc1}).
9697 @item %2
9698 Process the @code{cc1plus} spec.  This is used to construct the options to be
9699 passed to the actual C++ compiler (@samp{cc1plus}).
9701 @item %*
9702 Substitute the variable part of a matched option.  See below.
9703 Note that each comma in the substituted string is replaced by
9704 a single space.
9706 @item %<@code{S}
9707 Remove all occurrences of @code{-S} from the command line.  Note---this
9708 command is position dependent.  @samp{%} commands in the spec string
9709 before this one will see @code{-S}, @samp{%} commands in the spec string
9710 after this one will not.
9712 @item %:@var{function}(@var{args})
9713 Call the named function @var{function}, passing it @var{args}.
9714 @var{args} is first processed as a nested spec string, then split
9715 into an argument vector in the usual fashion.  The function returns
9716 a string which is processed as if it had appeared literally as part
9717 of the current spec.
9719 The following built-in spec functions are provided:
9721 @table @code
9722 @item @code{getenv}
9723 The @code{getenv} spec function takes two arguments: an environment
9724 variable name and a string.  If the environment variable is not
9725 defined, a fatal error is issued.  Otherwise, the return value is the
9726 value of the environment variable concatenated with the string.  For
9727 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
9729 @smallexample
9730 %:getenv(TOPDIR /include)
9731 @end smallexample
9733 expands to @file{/path/to/top/include}.
9735 @item @code{if-exists}
9736 The @code{if-exists} spec function takes one argument, an absolute
9737 pathname to a file.  If the file exists, @code{if-exists} returns the
9738 pathname.  Here is a small example of its usage:
9740 @smallexample
9741 *startfile:
9742 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
9743 @end smallexample
9745 @item @code{if-exists-else}
9746 The @code{if-exists-else} spec function is similar to the @code{if-exists}
9747 spec function, except that it takes two arguments.  The first argument is
9748 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
9749 returns the pathname.  If it does not exist, it returns the second argument.
9750 This way, @code{if-exists-else} can be used to select one file or another,
9751 based on the existence of the first.  Here is a small example of its usage:
9753 @smallexample
9754 *startfile:
9755 crt0%O%s %:if-exists(crti%O%s) \
9756 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
9757 @end smallexample
9759 @item @code{replace-outfile}
9760 The @code{replace-outfile} spec function takes two arguments.  It looks for the
9761 first argument in the outfiles array and replaces it with the second argument.  Here
9762 is a small example of its usage:
9764 @smallexample
9765 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
9766 @end smallexample
9768 @item @code{remove-outfile}
9769 The @code{remove-outfile} spec function takes one argument.  It looks for the
9770 first argument in the outfiles array and removes it.  Here is a small example
9771 its usage:
9773 @smallexample
9774 %:remove-outfile(-lm)
9775 @end smallexample
9777 @item @code{pass-through-libs}
9778 The @code{pass-through-libs} spec function takes any number of arguments.  It
9779 finds any @option{-l} options and any non-options ending in ".a" (which it
9780 assumes are the names of linker input library archive files) and returns a
9781 result containing all the found arguments each prepended by
9782 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
9783 intended to be passed to the LTO linker plugin.
9785 @smallexample
9786 %:pass-through-libs(%G %L %G)
9787 @end smallexample
9789 @item @code{print-asm-header}
9790 The @code{print-asm-header} function takes no arguments and simply
9791 prints a banner like:
9793 @smallexample
9794 Assembler options
9795 =================
9797 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
9798 @end smallexample
9800 It is used to separate compiler options from assembler options
9801 in the @option{--target-help} output.
9802 @end table
9804 @item %@{@code{S}@}
9805 Substitutes the @code{-S} switch, if that switch was given to GCC@.
9806 If that switch was not specified, this substitutes nothing.  Note that
9807 the leading dash is omitted when specifying this option, and it is
9808 automatically inserted if the substitution is performed.  Thus the spec
9809 string @samp{%@{foo@}} would match the command-line option @option{-foo}
9810 and would output the command line option @option{-foo}.
9812 @item %W@{@code{S}@}
9813 Like %@{@code{S}@} but mark last argument supplied within as a file to be
9814 deleted on failure.
9816 @item %@{@code{S}*@}
9817 Substitutes all the switches specified to GCC whose names start
9818 with @code{-S}, but which also take an argument.  This is used for
9819 switches like @option{-o}, @option{-D}, @option{-I}, etc.
9820 GCC considers @option{-o foo} as being
9821 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
9822 text, including the space.  Thus two arguments would be generated.
9824 @item %@{@code{S}*&@code{T}*@}
9825 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
9826 (the order of @code{S} and @code{T} in the spec is not significant).
9827 There can be any number of ampersand-separated variables; for each the
9828 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
9830 @item %@{@code{S}:@code{X}@}
9831 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
9833 @item %@{!@code{S}:@code{X}@}
9834 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
9836 @item %@{@code{S}*:@code{X}@}
9837 Substitutes @code{X} if one or more switches whose names start with
9838 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
9839 once, no matter how many such switches appeared.  However, if @code{%*}
9840 appears somewhere in @code{X}, then @code{X} will be substituted once
9841 for each matching switch, with the @code{%*} replaced by the part of
9842 that switch that matched the @code{*}.
9844 @item %@{.@code{S}:@code{X}@}
9845 Substitutes @code{X}, if processing a file with suffix @code{S}.
9847 @item %@{!.@code{S}:@code{X}@}
9848 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
9850 @item %@{,@code{S}:@code{X}@}
9851 Substitutes @code{X}, if processing a file for language @code{S}.
9853 @item %@{!,@code{S}:@code{X}@}
9854 Substitutes @code{X}, if not processing a file for language @code{S}.
9856 @item %@{@code{S}|@code{P}:@code{X}@}
9857 Substitutes @code{X} if either @code{-S} or @code{-P} was given to
9858 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
9859 @code{*} sequences as well, although they have a stronger binding than
9860 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
9861 alternatives must be starred, and only the first matching alternative
9862 is substituted.
9864 For example, a spec string like this:
9866 @smallexample
9867 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
9868 @end smallexample
9870 will output the following command-line options from the following input
9871 command-line options:
9873 @smallexample
9874 fred.c        -foo -baz
9875 jim.d         -bar -boggle
9876 -d fred.c     -foo -baz -boggle
9877 -d jim.d      -bar -baz -boggle
9878 @end smallexample
9880 @item %@{S:X; T:Y; :D@}
9882 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
9883 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
9884 be as many clauses as you need.  This may be combined with @code{.},
9885 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
9888 @end table
9890 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
9891 construct may contain other nested @samp{%} constructs or spaces, or
9892 even newlines.  They are processed as usual, as described above.
9893 Trailing white space in @code{X} is ignored.  White space may also
9894 appear anywhere on the left side of the colon in these constructs,
9895 except between @code{.} or @code{*} and the corresponding word.
9897 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
9898 handled specifically in these constructs.  If another value of
9899 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
9900 @option{-W} switch is found later in the command line, the earlier
9901 switch value is ignored, except with @{@code{S}*@} where @code{S} is
9902 just one letter, which passes all matching options.
9904 The character @samp{|} at the beginning of the predicate text is used to
9905 indicate that a command should be piped to the following command, but
9906 only if @option{-pipe} is specified.
9908 It is built into GCC which switches take arguments and which do not.
9909 (You might think it would be useful to generalize this to allow each
9910 compiler's spec to say which switches take arguments.  But this cannot
9911 be done in a consistent fashion.  GCC cannot even decide which input
9912 files have been specified without knowing which switches take arguments,
9913 and it must know which input files to compile in order to tell which
9914 compilers to run).
9916 GCC also knows implicitly that arguments starting in @option{-l} are to be
9917 treated as compiler output files, and passed to the linker in their
9918 proper position among the other output files.
9920 @c man begin OPTIONS
9922 @node Target Options
9923 @section Specifying Target Machine and Compiler Version
9924 @cindex target options
9925 @cindex cross compiling
9926 @cindex specifying machine version
9927 @cindex specifying compiler version and target machine
9928 @cindex compiler version, specifying
9929 @cindex target machine, specifying
9931 The usual way to run GCC is to run the executable called @command{gcc}, or
9932 @command{@var{machine}-gcc} when cross-compiling, or
9933 @command{@var{machine}-gcc-@var{version}} to run a version other than the
9934 one that was installed last.
9936 @node Submodel Options
9937 @section Hardware Models and Configurations
9938 @cindex submodel options
9939 @cindex specifying hardware config
9940 @cindex hardware models and configurations, specifying
9941 @cindex machine dependent options
9943 Each target machine types can have its own
9944 special options, starting with @samp{-m}, to choose among various
9945 hardware models or configurations---for example, 68010 vs 68020,
9946 floating coprocessor or none.  A single installed version of the
9947 compiler can compile for any model or configuration, according to the
9948 options specified.
9950 Some configurations of the compiler also support additional special
9951 options, usually for compatibility with other compilers on the same
9952 platform.
9954 @c This list is ordered alphanumerically by subsection name.
9955 @c It should be the same order and spelling as these options are listed
9956 @c in Machine Dependent Options
9958 @menu
9959 * ARM Options::
9960 * AVR Options::
9961 * Blackfin Options::
9962 * CRIS Options::
9963 * Darwin Options::
9964 * DEC Alpha Options::
9965 * DEC Alpha/VMS Options::
9966 * FR30 Options::
9967 * FRV Options::
9968 * GNU/Linux Options::
9969 * H8/300 Options::
9970 * HPPA Options::
9971 * i386 and x86-64 Options::
9972 * i386 and x86-64 Windows Options::
9973 * IA-64 Options::
9974 * IA-64/VMS Options::
9975 * LM32 Options::
9976 * M32C Options::
9977 * M32R/D Options::
9978 * M680x0 Options::
9979 * MCore Options::
9980 * MeP Options::
9981 * MicroBlaze Options::
9982 * MIPS Options::
9983 * MMIX Options::
9984 * MN10300 Options::
9985 * PDP-11 Options::
9986 * picoChip Options::
9987 * PowerPC Options::
9988 * RS/6000 and PowerPC Options::
9989 * RX Options::
9990 * S/390 and zSeries Options::
9991 * Score Options::
9992 * SH Options::
9993 * Solaris 2 Options::
9994 * SPARC Options::
9995 * SPU Options::
9996 * System V Options::
9997 * V850 Options::
9998 * VAX Options::
9999 * VxWorks Options::
10000 * x86-64 Options::
10001 * Xstormy16 Options::
10002 * Xtensa Options::
10003 * zSeries Options::
10004 @end menu
10006 @node ARM Options
10007 @subsection ARM Options
10008 @cindex ARM options
10010 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
10011 architectures:
10013 @table @gcctabopt
10014 @item -mabi=@var{name}
10015 @opindex mabi
10016 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
10017 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
10019 @item -mapcs-frame
10020 @opindex mapcs-frame
10021 Generate a stack frame that is compliant with the ARM Procedure Call
10022 Standard for all functions, even if this is not strictly necessary for
10023 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
10024 with this option will cause the stack frames not to be generated for
10025 leaf functions.  The default is @option{-mno-apcs-frame}.
10027 @item -mapcs
10028 @opindex mapcs
10029 This is a synonym for @option{-mapcs-frame}.
10031 @ignore
10032 @c not currently implemented
10033 @item -mapcs-stack-check
10034 @opindex mapcs-stack-check
10035 Generate code to check the amount of stack space available upon entry to
10036 every function (that actually uses some stack space).  If there is
10037 insufficient space available then either the function
10038 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
10039 called, depending upon the amount of stack space required.  The run time
10040 system is required to provide these functions.  The default is
10041 @option{-mno-apcs-stack-check}, since this produces smaller code.
10043 @c not currently implemented
10044 @item -mapcs-float
10045 @opindex mapcs-float
10046 Pass floating point arguments using the float point registers.  This is
10047 one of the variants of the APCS@.  This option is recommended if the
10048 target hardware has a floating point unit or if a lot of floating point
10049 arithmetic is going to be performed by the code.  The default is
10050 @option{-mno-apcs-float}, since integer only code is slightly increased in
10051 size if @option{-mapcs-float} is used.
10053 @c not currently implemented
10054 @item -mapcs-reentrant
10055 @opindex mapcs-reentrant
10056 Generate reentrant, position independent code.  The default is
10057 @option{-mno-apcs-reentrant}.
10058 @end ignore
10060 @item -mthumb-interwork
10061 @opindex mthumb-interwork
10062 Generate code which supports calling between the ARM and Thumb
10063 instruction sets.  Without this option the two instruction sets cannot
10064 be reliably used inside one program.  The default is
10065 @option{-mno-thumb-interwork}, since slightly larger code is generated
10066 when @option{-mthumb-interwork} is specified.
10068 @item -mno-sched-prolog
10069 @opindex mno-sched-prolog
10070 Prevent the reordering of instructions in the function prolog, or the
10071 merging of those instruction with the instructions in the function's
10072 body.  This means that all functions will start with a recognizable set
10073 of instructions (or in fact one of a choice from a small set of
10074 different function prologues), and this information can be used to
10075 locate the start if functions inside an executable piece of code.  The
10076 default is @option{-msched-prolog}.
10078 @item -mfloat-abi=@var{name}
10079 @opindex mfloat-abi
10080 Specifies which floating-point ABI to use.  Permissible values
10081 are: @samp{soft}, @samp{softfp} and @samp{hard}.
10083 Specifying @samp{soft} causes GCC to generate output containing
10084 library calls for floating-point operations.
10085 @samp{softfp} allows the generation of code using hardware floating-point
10086 instructions, but still uses the soft-float calling conventions.
10087 @samp{hard} allows generation of floating-point instructions
10088 and uses FPU-specific calling conventions.
10090 The default depends on the specific target configuration.  Note that
10091 the hard-float and soft-float ABIs are not link-compatible; you must
10092 compile your entire program with the same ABI, and link with a
10093 compatible set of libraries.
10095 @item -mlittle-endian
10096 @opindex mlittle-endian
10097 Generate code for a processor running in little-endian mode.  This is
10098 the default for all standard configurations.
10100 @item -mbig-endian
10101 @opindex mbig-endian
10102 Generate code for a processor running in big-endian mode; the default is
10103 to compile code for a little-endian processor.
10105 @item -mwords-little-endian
10106 @opindex mwords-little-endian
10107 This option only applies when generating code for big-endian processors.
10108 Generate code for a little-endian word order but a big-endian byte
10109 order.  That is, a byte order of the form @samp{32107654}.  Note: this
10110 option should only be used if you require compatibility with code for
10111 big-endian ARM processors generated by versions of the compiler prior to
10112 2.8.
10114 @item -mcpu=@var{name}
10115 @opindex mcpu
10116 This specifies the name of the target ARM processor.  GCC uses this name
10117 to determine what kind of instructions it can emit when generating
10118 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
10119 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
10120 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
10121 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
10122 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
10123 @samp{arm720},
10124 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
10125 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
10126 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
10127 @samp{strongarm1110},
10128 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
10129 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
10130 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
10131 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
10132 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
10133 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
10134 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
10135 @samp{cortex-a5}, @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a15},
10136 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m4}, @samp{cortex-m3},
10137 @samp{cortex-m1},
10138 @samp{cortex-m0},
10139 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
10141 @item -mtune=@var{name}
10142 @opindex mtune
10143 This option is very similar to the @option{-mcpu=} option, except that
10144 instead of specifying the actual target processor type, and hence
10145 restricting which instructions can be used, it specifies that GCC should
10146 tune the performance of the code as if the target were of the type
10147 specified in this option, but still choosing the instructions that it
10148 will generate based on the CPU specified by a @option{-mcpu=} option.
10149 For some ARM implementations better performance can be obtained by using
10150 this option.
10152 @item -march=@var{name}
10153 @opindex march
10154 This specifies the name of the target ARM architecture.  GCC uses this
10155 name to determine what kind of instructions it can emit when generating
10156 assembly code.  This option can be used in conjunction with or instead
10157 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
10158 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
10159 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
10160 @samp{armv6}, @samp{armv6j},
10161 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
10162 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
10163 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
10165 @item -mfpu=@var{name}
10166 @itemx -mfpe=@var{number}
10167 @itemx -mfp=@var{number}
10168 @opindex mfpu
10169 @opindex mfpe
10170 @opindex mfp
10171 This specifies what floating point hardware (or hardware emulation) is
10172 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
10173 @samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-fp16},
10174 @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, @samp{vfpv3xd-fp16},
10175 @samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, @samp{vfpv4-d16},
10176 @samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
10177 @option{-mfp} and @option{-mfpe} are synonyms for
10178 @option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions
10179 of GCC@.
10181 If @option{-msoft-float} is specified this specifies the format of
10182 floating point values.
10184 If the selected floating-point hardware includes the NEON extension
10185 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
10186 operations will not be used by GCC's auto-vectorization pass unless
10187 @option{-funsafe-math-optimizations} is also specified.  This is
10188 because NEON hardware does not fully implement the IEEE 754 standard for
10189 floating-point arithmetic (in particular denormal values are treated as
10190 zero), so the use of NEON instructions may lead to a loss of precision.
10192 @item -mfp16-format=@var{name}
10193 @opindex mfp16-format
10194 Specify the format of the @code{__fp16} half-precision floating-point type.
10195 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
10196 the default is @samp{none}, in which case the @code{__fp16} type is not
10197 defined.  @xref{Half-Precision}, for more information.
10199 @item -mstructure-size-boundary=@var{n}
10200 @opindex mstructure-size-boundary
10201 The size of all structures and unions will be rounded up to a multiple
10202 of the number of bits set by this option.  Permissible values are 8, 32
10203 and 64.  The default value varies for different toolchains.  For the COFF
10204 targeted toolchain the default value is 8.  A value of 64 is only allowed
10205 if the underlying ABI supports it.
10207 Specifying the larger number can produce faster, more efficient code, but
10208 can also increase the size of the program.  Different values are potentially
10209 incompatible.  Code compiled with one value cannot necessarily expect to
10210 work with code or libraries compiled with another value, if they exchange
10211 information using structures or unions.
10213 @item -mabort-on-noreturn
10214 @opindex mabort-on-noreturn
10215 Generate a call to the function @code{abort} at the end of a
10216 @code{noreturn} function.  It will be executed if the function tries to
10217 return.
10219 @item -mlong-calls
10220 @itemx -mno-long-calls
10221 @opindex mlong-calls
10222 @opindex mno-long-calls
10223 Tells the compiler to perform function calls by first loading the
10224 address of the function into a register and then performing a subroutine
10225 call on this register.  This switch is needed if the target function
10226 will lie outside of the 64 megabyte addressing range of the offset based
10227 version of subroutine call instruction.
10229 Even if this switch is enabled, not all function calls will be turned
10230 into long calls.  The heuristic is that static functions, functions
10231 which have the @samp{short-call} attribute, functions that are inside
10232 the scope of a @samp{#pragma no_long_calls} directive and functions whose
10233 definitions have already been compiled within the current compilation
10234 unit, will not be turned into long calls.  The exception to this rule is
10235 that weak function definitions, functions with the @samp{long-call}
10236 attribute or the @samp{section} attribute, and functions that are within
10237 the scope of a @samp{#pragma long_calls} directive, will always be
10238 turned into long calls.
10240 This feature is not enabled by default.  Specifying
10241 @option{-mno-long-calls} will restore the default behavior, as will
10242 placing the function calls within the scope of a @samp{#pragma
10243 long_calls_off} directive.  Note these switches have no effect on how
10244 the compiler generates code to handle function calls via function
10245 pointers.
10247 @item -msingle-pic-base
10248 @opindex msingle-pic-base
10249 Treat the register used for PIC addressing as read-only, rather than
10250 loading it in the prologue for each function.  The run-time system is
10251 responsible for initializing this register with an appropriate value
10252 before execution begins.
10254 @item -mpic-register=@var{reg}
10255 @opindex mpic-register
10256 Specify the register to be used for PIC addressing.  The default is R10
10257 unless stack-checking is enabled, when R9 is used.
10259 @item -mcirrus-fix-invalid-insns
10260 @opindex mcirrus-fix-invalid-insns
10261 @opindex mno-cirrus-fix-invalid-insns
10262 Insert NOPs into the instruction stream to in order to work around
10263 problems with invalid Maverick instruction combinations.  This option
10264 is only valid if the @option{-mcpu=ep9312} option has been used to
10265 enable generation of instructions for the Cirrus Maverick floating
10266 point co-processor.  This option is not enabled by default, since the
10267 problem is only present in older Maverick implementations.  The default
10268 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
10269 switch.
10271 @item -mpoke-function-name
10272 @opindex mpoke-function-name
10273 Write the name of each function into the text section, directly
10274 preceding the function prologue.  The generated code is similar to this:
10276 @smallexample
10277      t0
10278          .ascii "arm_poke_function_name", 0
10279          .align
10280      t1
10281          .word 0xff000000 + (t1 - t0)
10282      arm_poke_function_name
10283          mov     ip, sp
10284          stmfd   sp!, @{fp, ip, lr, pc@}
10285          sub     fp, ip, #4
10286 @end smallexample
10288 When performing a stack backtrace, code can inspect the value of
10289 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
10290 location @code{pc - 12} and the top 8 bits are set, then we know that
10291 there is a function name embedded immediately preceding this location
10292 and has length @code{((pc[-3]) & 0xff000000)}.
10294 @item -mthumb
10295 @opindex mthumb
10296 Generate code for the Thumb instruction set.  The default is to
10297 use the 32-bit ARM instruction set.
10298 This option automatically enables either 16-bit Thumb-1 or
10299 mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
10300 and @option{-march=@var{name}} options.  This option is not passed to the
10301 assembler. If you want to force assembler files to be interpreted as Thumb code,
10302 either add a @samp{.thumb} directive to the source or pass the @option{-mthumb}
10303 option directly to the assembler by prefixing it with @option{-Wa}.
10305 @item -mtpcs-frame
10306 @opindex mtpcs-frame
10307 Generate a stack frame that is compliant with the Thumb Procedure Call
10308 Standard for all non-leaf functions.  (A leaf function is one that does
10309 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
10311 @item -mtpcs-leaf-frame
10312 @opindex mtpcs-leaf-frame
10313 Generate a stack frame that is compliant with the Thumb Procedure Call
10314 Standard for all leaf functions.  (A leaf function is one that does
10315 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
10317 @item -mcallee-super-interworking
10318 @opindex mcallee-super-interworking
10319 Gives all externally visible functions in the file being compiled an ARM
10320 instruction set header which switches to Thumb mode before executing the
10321 rest of the function.  This allows these functions to be called from
10322 non-interworking code.  This option is not valid in AAPCS configurations
10323 because interworking is enabled by default.
10325 @item -mcaller-super-interworking
10326 @opindex mcaller-super-interworking
10327 Allows calls via function pointers (including virtual functions) to
10328 execute correctly regardless of whether the target code has been
10329 compiled for interworking or not.  There is a small overhead in the cost
10330 of executing a function pointer if this option is enabled.  This option
10331 is not valid in AAPCS configurations because interworking is enabled
10332 by default.
10334 @item -mtp=@var{name}
10335 @opindex mtp
10336 Specify the access model for the thread local storage pointer.  The valid
10337 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
10338 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
10339 (supported in the arm6k architecture), and @option{auto}, which uses the
10340 best available method for the selected processor.  The default setting is
10341 @option{auto}.
10343 @item -mword-relocations
10344 @opindex mword-relocations
10345 Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
10346 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
10347 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
10348 is specified.
10350 @item -mfix-cortex-m3-ldrd
10351 @opindex mfix-cortex-m3-ldrd
10352 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
10353 with overlapping destination and base registers are used.  This option avoids
10354 generating these instructions.  This option is enabled by default when
10355 @option{-mcpu=cortex-m3} is specified.
10357 @end table
10359 @node AVR Options
10360 @subsection AVR Options
10361 @cindex AVR Options
10363 These options are defined for AVR implementations:
10365 @table @gcctabopt
10366 @item -mmcu=@var{mcu}
10367 @opindex mmcu
10368 Specify ATMEL AVR instruction set or MCU type.
10370 Instruction set avr1 is for the minimal AVR core, not supported by the C
10371 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
10372 attiny11, attiny12, attiny15, attiny28).
10374 Instruction set avr2 (default) is for the classic AVR core with up to
10375 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
10376 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
10377 at90c8534, at90s8535).
10379 Instruction set avr3 is for the classic AVR core with up to 128K program
10380 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
10382 Instruction set avr4 is for the enhanced AVR core with up to 8K program
10383 memory space (MCU types: atmega8, atmega83, atmega85).
10385 Instruction set avr5 is for the enhanced AVR core with up to 128K program
10386 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
10387 atmega64, atmega128, at43usb355, at94k).
10389 @item -mno-interrupts
10390 @opindex mno-interrupts
10391 Generated code is not compatible with hardware interrupts.
10392 Code size will be smaller.
10394 @item -mcall-prologues
10395 @opindex mcall-prologues
10396 Functions prologues/epilogues expanded as call to appropriate
10397 subroutines.  Code size will be smaller.
10399 @item -mtiny-stack
10400 @opindex mtiny-stack
10401 Change only the low 8 bits of the stack pointer.
10403 @item -mint8
10404 @opindex mint8
10405 Assume int to be 8 bit integer.  This affects the sizes of all types: A
10406 char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
10407 and long long will be 4 bytes.  Please note that this option does not
10408 comply to the C standards, but it will provide you with smaller code
10409 size.
10410 @end table
10412 @node Blackfin Options
10413 @subsection Blackfin Options
10414 @cindex Blackfin Options
10416 @table @gcctabopt
10417 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
10418 @opindex mcpu=
10419 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
10420 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
10421 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
10422 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
10423 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
10424 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
10425 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
10426 @samp{bf561}.
10427 The optional @var{sirevision} specifies the silicon revision of the target
10428 Blackfin processor.  Any workarounds available for the targeted silicon revision
10429 will be enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
10430 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
10431 will be enabled.  The @code{__SILICON_REVISION__} macro is defined to two
10432 hexadecimal digits representing the major and minor numbers in the silicon
10433 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
10434 is not defined.  If @var{sirevision} is @samp{any}, the
10435 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
10436 If this optional @var{sirevision} is not used, GCC assumes the latest known
10437 silicon revision of the targeted Blackfin processor.
10439 Support for @samp{bf561} is incomplete.  For @samp{bf561},
10440 Only the processor macro is defined.
10441 Without this option, @samp{bf532} is used as the processor by default.
10442 The corresponding predefined processor macros for @var{cpu} is to
10443 be defined.  And for @samp{bfin-elf} toolchain, this causes the hardware BSP
10444 provided by libgloss to be linked in if @option{-msim} is not given.
10446 @item -msim
10447 @opindex msim
10448 Specifies that the program will be run on the simulator.  This causes
10449 the simulator BSP provided by libgloss to be linked in.  This option
10450 has effect only for @samp{bfin-elf} toolchain.
10451 Certain other options, such as @option{-mid-shared-library} and
10452 @option{-mfdpic}, imply @option{-msim}.
10454 @item -momit-leaf-frame-pointer
10455 @opindex momit-leaf-frame-pointer
10456 Don't keep the frame pointer in a register for leaf functions.  This
10457 avoids the instructions to save, set up and restore frame pointers and
10458 makes an extra register available in leaf functions.  The option
10459 @option{-fomit-frame-pointer} removes the frame pointer for all functions
10460 which might make debugging harder.
10462 @item -mspecld-anomaly
10463 @opindex mspecld-anomaly
10464 When enabled, the compiler will ensure that the generated code does not
10465 contain speculative loads after jump instructions. If this option is used,
10466 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
10468 @item -mno-specld-anomaly
10469 @opindex mno-specld-anomaly
10470 Don't generate extra code to prevent speculative loads from occurring.
10472 @item -mcsync-anomaly
10473 @opindex mcsync-anomaly
10474 When enabled, the compiler will ensure that the generated code does not
10475 contain CSYNC or SSYNC instructions too soon after conditional branches.
10476 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
10478 @item -mno-csync-anomaly
10479 @opindex mno-csync-anomaly
10480 Don't generate extra code to prevent CSYNC or SSYNC instructions from
10481 occurring too soon after a conditional branch.
10483 @item -mlow-64k
10484 @opindex mlow-64k
10485 When enabled, the compiler is free to take advantage of the knowledge that
10486 the entire program fits into the low 64k of memory.
10488 @item -mno-low-64k
10489 @opindex mno-low-64k
10490 Assume that the program is arbitrarily large.  This is the default.
10492 @item -mstack-check-l1
10493 @opindex mstack-check-l1
10494 Do stack checking using information placed into L1 scratchpad memory by the
10495 uClinux kernel.
10497 @item -mid-shared-library
10498 @opindex mid-shared-library
10499 Generate code that supports shared libraries via the library ID method.
10500 This allows for execute in place and shared libraries in an environment
10501 without virtual memory management.  This option implies @option{-fPIC}.
10502 With a @samp{bfin-elf} target, this option implies @option{-msim}.
10504 @item -mno-id-shared-library
10505 @opindex mno-id-shared-library
10506 Generate code that doesn't assume ID based shared libraries are being used.
10507 This is the default.
10509 @item -mleaf-id-shared-library
10510 @opindex mleaf-id-shared-library
10511 Generate code that supports shared libraries via the library ID method,
10512 but assumes that this library or executable won't link against any other
10513 ID shared libraries.  That allows the compiler to use faster code for jumps
10514 and calls.
10516 @item -mno-leaf-id-shared-library
10517 @opindex mno-leaf-id-shared-library
10518 Do not assume that the code being compiled won't link against any ID shared
10519 libraries.  Slower code will be generated for jump and call insns.
10521 @item -mshared-library-id=n
10522 @opindex mshared-library-id
10523 Specified the identification number of the ID based shared library being
10524 compiled.  Specifying a value of 0 will generate more compact code, specifying
10525 other values will force the allocation of that number to the current
10526 library but is no more space or time efficient than omitting this option.
10528 @item -msep-data
10529 @opindex msep-data
10530 Generate code that allows the data segment to be located in a different
10531 area of memory from the text segment.  This allows for execute in place in
10532 an environment without virtual memory management by eliminating relocations
10533 against the text section.
10535 @item -mno-sep-data
10536 @opindex mno-sep-data
10537 Generate code that assumes that the data segment follows the text segment.
10538 This is the default.
10540 @item -mlong-calls
10541 @itemx -mno-long-calls
10542 @opindex mlong-calls
10543 @opindex mno-long-calls
10544 Tells the compiler to perform function calls by first loading the
10545 address of the function into a register and then performing a subroutine
10546 call on this register.  This switch is needed if the target function
10547 will lie outside of the 24 bit addressing range of the offset based
10548 version of subroutine call instruction.
10550 This feature is not enabled by default.  Specifying
10551 @option{-mno-long-calls} will restore the default behavior.  Note these
10552 switches have no effect on how the compiler generates code to handle
10553 function calls via function pointers.
10555 @item -mfast-fp
10556 @opindex mfast-fp
10557 Link with the fast floating-point library. This library relaxes some of
10558 the IEEE floating-point standard's rules for checking inputs against
10559 Not-a-Number (NAN), in the interest of performance.
10561 @item -minline-plt
10562 @opindex minline-plt
10563 Enable inlining of PLT entries in function calls to functions that are
10564 not known to bind locally.  It has no effect without @option{-mfdpic}.
10566 @item -mmulticore
10567 @opindex mmulticore
10568 Build standalone application for multicore Blackfin processor. Proper
10569 start files and link scripts will be used to support multicore.
10570 This option defines @code{__BFIN_MULTICORE}. It can only be used with
10571 @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
10572 @option{-mcorea} or @option{-mcoreb}. If it's used without
10573 @option{-mcorea} or @option{-mcoreb}, single application/dual core
10574 programming model is used. In this model, the main function of Core B
10575 should be named as coreb_main. If it's used with @option{-mcorea} or
10576 @option{-mcoreb}, one application per core programming model is used.
10577 If this option is not used, single core application programming
10578 model is used.
10580 @item -mcorea
10581 @opindex mcorea
10582 Build standalone application for Core A of BF561 when using
10583 one application per core programming model. Proper start files
10584 and link scripts will be used to support Core A. This option
10585 defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
10587 @item -mcoreb
10588 @opindex mcoreb
10589 Build standalone application for Core B of BF561 when using
10590 one application per core programming model. Proper start files
10591 and link scripts will be used to support Core B. This option
10592 defines @code{__BFIN_COREB}. When this option is used, coreb_main
10593 should be used instead of main. It must be used with
10594 @option{-mmulticore}.
10596 @item -msdram
10597 @opindex msdram
10598 Build standalone application for SDRAM. Proper start files and
10599 link scripts will be used to put the application into SDRAM.
10600 Loader should initialize SDRAM before loading the application
10601 into SDRAM. This option defines @code{__BFIN_SDRAM}.
10603 @item -micplb
10604 @opindex micplb
10605 Assume that ICPLBs are enabled at runtime.  This has an effect on certain
10606 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
10607 are enabled; for standalone applications the default is off.
10608 @end table
10610 @node CRIS Options
10611 @subsection CRIS Options
10612 @cindex CRIS Options
10614 These options are defined specifically for the CRIS ports.
10616 @table @gcctabopt
10617 @item -march=@var{architecture-type}
10618 @itemx -mcpu=@var{architecture-type}
10619 @opindex march
10620 @opindex mcpu
10621 Generate code for the specified architecture.  The choices for
10622 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10623 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
10624 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10625 @samp{v10}.
10627 @item -mtune=@var{architecture-type}
10628 @opindex mtune
10629 Tune to @var{architecture-type} everything applicable about the generated
10630 code, except for the ABI and the set of available instructions.  The
10631 choices for @var{architecture-type} are the same as for
10632 @option{-march=@var{architecture-type}}.
10634 @item -mmax-stack-frame=@var{n}
10635 @opindex mmax-stack-frame
10636 Warn when the stack frame of a function exceeds @var{n} bytes.
10638 @item -metrax4
10639 @itemx -metrax100
10640 @opindex metrax4
10641 @opindex metrax100
10642 The options @option{-metrax4} and @option{-metrax100} are synonyms for
10643 @option{-march=v3} and @option{-march=v8} respectively.
10645 @item -mmul-bug-workaround
10646 @itemx -mno-mul-bug-workaround
10647 @opindex mmul-bug-workaround
10648 @opindex mno-mul-bug-workaround
10649 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
10650 models where it applies.  This option is active by default.
10652 @item -mpdebug
10653 @opindex mpdebug
10654 Enable CRIS-specific verbose debug-related information in the assembly
10655 code.  This option also has the effect to turn off the @samp{#NO_APP}
10656 formatted-code indicator to the assembler at the beginning of the
10657 assembly file.
10659 @item -mcc-init
10660 @opindex mcc-init
10661 Do not use condition-code results from previous instruction; always emit
10662 compare and test instructions before use of condition codes.
10664 @item -mno-side-effects
10665 @opindex mno-side-effects
10666 Do not emit instructions with side-effects in addressing modes other than
10667 post-increment.
10669 @item -mstack-align
10670 @itemx -mno-stack-align
10671 @itemx -mdata-align
10672 @itemx -mno-data-align
10673 @itemx -mconst-align
10674 @itemx -mno-const-align
10675 @opindex mstack-align
10676 @opindex mno-stack-align
10677 @opindex mdata-align
10678 @opindex mno-data-align
10679 @opindex mconst-align
10680 @opindex mno-const-align
10681 These options (no-options) arranges (eliminate arrangements) for the
10682 stack-frame, individual data and constants to be aligned for the maximum
10683 single data access size for the chosen CPU model.  The default is to
10684 arrange for 32-bit alignment.  ABI details such as structure layout are
10685 not affected by these options.
10687 @item -m32-bit
10688 @itemx -m16-bit
10689 @itemx -m8-bit
10690 @opindex m32-bit
10691 @opindex m16-bit
10692 @opindex m8-bit
10693 Similar to the stack- data- and const-align options above, these options
10694 arrange for stack-frame, writable data and constants to all be 32-bit,
10695 16-bit or 8-bit aligned.  The default is 32-bit alignment.
10697 @item -mno-prologue-epilogue
10698 @itemx -mprologue-epilogue
10699 @opindex mno-prologue-epilogue
10700 @opindex mprologue-epilogue
10701 With @option{-mno-prologue-epilogue}, the normal function prologue and
10702 epilogue that sets up the stack-frame are omitted and no return
10703 instructions or return sequences are generated in the code.  Use this
10704 option only together with visual inspection of the compiled code: no
10705 warnings or errors are generated when call-saved registers must be saved,
10706 or storage for local variable needs to be allocated.
10708 @item -mno-gotplt
10709 @itemx -mgotplt
10710 @opindex mno-gotplt
10711 @opindex mgotplt
10712 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10713 instruction sequences that load addresses for functions from the PLT part
10714 of the GOT rather than (traditional on other architectures) calls to the
10715 PLT@.  The default is @option{-mgotplt}.
10717 @item -melf
10718 @opindex melf
10719 Legacy no-op option only recognized with the cris-axis-elf and
10720 cris-axis-linux-gnu targets.
10722 @item -mlinux
10723 @opindex mlinux
10724 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10726 @item -sim
10727 @opindex sim
10728 This option, recognized for the cris-axis-elf arranges
10729 to link with input-output functions from a simulator library.  Code,
10730 initialized data and zero-initialized data are allocated consecutively.
10732 @item -sim2
10733 @opindex sim2
10734 Like @option{-sim}, but pass linker options to locate initialized data at
10735 0x40000000 and zero-initialized data at 0x80000000.
10736 @end table
10738 @node Darwin Options
10739 @subsection Darwin Options
10740 @cindex Darwin options
10742 These options are defined for all architectures running the Darwin operating
10743 system.
10745 FSF GCC on Darwin does not create ``fat'' object files; it will create
10746 an object file for the single architecture that it was built to
10747 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
10748 @option{-arch} options are used; it does so by running the compiler or
10749 linker multiple times and joining the results together with
10750 @file{lipo}.
10752 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
10753 @samp{i686}) is determined by the flags that specify the ISA
10754 that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
10755 @option{-force_cpusubtype_ALL} option can be used to override this.
10757 The Darwin tools vary in their behavior when presented with an ISA
10758 mismatch.  The assembler, @file{as}, will only permit instructions to
10759 be used that are valid for the subtype of the file it is generating,
10760 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
10761 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
10762 and print an error if asked to create a shared library with a less
10763 restrictive subtype than its input files (for instance, trying to put
10764 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
10765 for executables, @file{ld}, will quietly give the executable the most
10766 restrictive subtype of any of its input files.
10768 @table @gcctabopt
10769 @item -F@var{dir}
10770 @opindex F
10771 Add the framework directory @var{dir} to the head of the list of
10772 directories to be searched for header files.  These directories are
10773 interleaved with those specified by @option{-I} options and are
10774 scanned in a left-to-right order.
10776 A framework directory is a directory with frameworks in it.  A
10777 framework is a directory with a @samp{"Headers"} and/or
10778 @samp{"PrivateHeaders"} directory contained directly in it that ends
10779 in @samp{".framework"}.  The name of a framework is the name of this
10780 directory excluding the @samp{".framework"}.  Headers associated with
10781 the framework are found in one of those two directories, with
10782 @samp{"Headers"} being searched first.  A subframework is a framework
10783 directory that is in a framework's @samp{"Frameworks"} directory.
10784 Includes of subframework headers can only appear in a header of a
10785 framework that contains the subframework, or in a sibling subframework
10786 header.  Two subframeworks are siblings if they occur in the same
10787 framework.  A subframework should not have the same name as a
10788 framework, a warning will be issued if this is violated.  Currently a
10789 subframework cannot have subframeworks, in the future, the mechanism
10790 may be extended to support this.  The standard frameworks can be found
10791 in @samp{"/System/Library/Frameworks"} and
10792 @samp{"/Library/Frameworks"}.  An example include looks like
10793 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
10794 the name of the framework and header.h is found in the
10795 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
10797 @item -iframework@var{dir}
10798 @opindex iframework
10799 Like @option{-F} except the directory is a treated as a system
10800 directory.  The main difference between this @option{-iframework} and
10801 @option{-F} is that with @option{-iframework} the compiler does not
10802 warn about constructs contained within header files found via
10803 @var{dir}.  This option is valid only for the C family of languages.
10805 @item -gused
10806 @opindex gused
10807 Emit debugging information for symbols that are used.  For STABS
10808 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
10809 This is by default ON@.
10811 @item -gfull
10812 @opindex gfull
10813 Emit debugging information for all symbols and types.
10815 @item -mmacosx-version-min=@var{version}
10816 The earliest version of MacOS X that this executable will run on
10817 is @var{version}.  Typical values of @var{version} include @code{10.1},
10818 @code{10.2}, and @code{10.3.9}.
10820 If the compiler was built to use the system's headers by default,
10821 then the default for this option is the system version on which the
10822 compiler is running, otherwise the default is to make choices which
10823 are compatible with as many systems and code bases as possible.
10825 @item -mkernel
10826 @opindex mkernel
10827 Enable kernel development mode.  The @option{-mkernel} option sets
10828 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
10829 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
10830 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
10831 applicable.  This mode also sets @option{-mno-altivec},
10832 @option{-msoft-float}, @option{-fno-builtin} and
10833 @option{-mlong-branch} for PowerPC targets.
10835 @item -mone-byte-bool
10836 @opindex mone-byte-bool
10837 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
10838 By default @samp{sizeof(bool)} is @samp{4} when compiling for
10839 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
10840 option has no effect on x86.
10842 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
10843 to generate code that is not binary compatible with code generated
10844 without that switch.  Using this switch may require recompiling all
10845 other modules in a program, including system libraries.  Use this
10846 switch to conform to a non-default data model.
10848 @item -mfix-and-continue
10849 @itemx -ffix-and-continue
10850 @itemx -findirect-data
10851 @opindex mfix-and-continue
10852 @opindex ffix-and-continue
10853 @opindex findirect-data
10854 Generate code suitable for fast turn around development.  Needed to
10855 enable gdb to dynamically load @code{.o} files into already running
10856 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
10857 are provided for backwards compatibility.
10859 @item -all_load
10860 @opindex all_load
10861 Loads all members of static archive libraries.
10862 See man ld(1) for more information.
10864 @item -arch_errors_fatal
10865 @opindex arch_errors_fatal
10866 Cause the errors having to do with files that have the wrong architecture
10867 to be fatal.
10869 @item -bind_at_load
10870 @opindex bind_at_load
10871 Causes the output file to be marked such that the dynamic linker will
10872 bind all undefined references when the file is loaded or launched.
10874 @item -bundle
10875 @opindex bundle
10876 Produce a Mach-o bundle format file.
10877 See man ld(1) for more information.
10879 @item -bundle_loader @var{executable}
10880 @opindex bundle_loader
10881 This option specifies the @var{executable} that will be loading the build
10882 output file being linked.  See man ld(1) for more information.
10884 @item -dynamiclib
10885 @opindex dynamiclib
10886 When passed this option, GCC will produce a dynamic library instead of
10887 an executable when linking, using the Darwin @file{libtool} command.
10889 @item -force_cpusubtype_ALL
10890 @opindex force_cpusubtype_ALL
10891 This causes GCC's output file to have the @var{ALL} subtype, instead of
10892 one controlled by the @option{-mcpu} or @option{-march} option.
10894 @item -allowable_client  @var{client_name}
10895 @itemx -client_name
10896 @itemx -compatibility_version
10897 @itemx -current_version
10898 @itemx -dead_strip
10899 @itemx -dependency-file
10900 @itemx -dylib_file
10901 @itemx -dylinker_install_name
10902 @itemx -dynamic
10903 @itemx -exported_symbols_list
10904 @itemx -filelist
10905 @need 800
10906 @itemx -flat_namespace
10907 @itemx -force_flat_namespace
10908 @itemx -headerpad_max_install_names
10909 @itemx -image_base
10910 @itemx -init
10911 @itemx -install_name
10912 @itemx -keep_private_externs
10913 @itemx -multi_module
10914 @itemx -multiply_defined
10915 @itemx -multiply_defined_unused
10916 @need 800
10917 @itemx -noall_load
10918 @itemx -no_dead_strip_inits_and_terms
10919 @itemx -nofixprebinding
10920 @itemx -nomultidefs
10921 @itemx -noprebind
10922 @itemx -noseglinkedit
10923 @itemx -pagezero_size
10924 @itemx -prebind
10925 @itemx -prebind_all_twolevel_modules
10926 @itemx -private_bundle
10927 @need 800
10928 @itemx -read_only_relocs
10929 @itemx -sectalign
10930 @itemx -sectobjectsymbols
10931 @itemx -whyload
10932 @itemx -seg1addr
10933 @itemx -sectcreate
10934 @itemx -sectobjectsymbols
10935 @itemx -sectorder
10936 @itemx -segaddr
10937 @itemx -segs_read_only_addr
10938 @need 800
10939 @itemx -segs_read_write_addr
10940 @itemx -seg_addr_table
10941 @itemx -seg_addr_table_filename
10942 @itemx -seglinkedit
10943 @itemx -segprot
10944 @itemx -segs_read_only_addr
10945 @itemx -segs_read_write_addr
10946 @itemx -single_module
10947 @itemx -static
10948 @itemx -sub_library
10949 @need 800
10950 @itemx -sub_umbrella
10951 @itemx -twolevel_namespace
10952 @itemx -umbrella
10953 @itemx -undefined
10954 @itemx -unexported_symbols_list
10955 @itemx -weak_reference_mismatches
10956 @itemx -whatsloaded
10957 @opindex allowable_client
10958 @opindex client_name
10959 @opindex compatibility_version
10960 @opindex current_version
10961 @opindex dead_strip
10962 @opindex dependency-file
10963 @opindex dylib_file
10964 @opindex dylinker_install_name
10965 @opindex dynamic
10966 @opindex exported_symbols_list
10967 @opindex filelist
10968 @opindex flat_namespace
10969 @opindex force_flat_namespace
10970 @opindex headerpad_max_install_names
10971 @opindex image_base
10972 @opindex init
10973 @opindex install_name
10974 @opindex keep_private_externs
10975 @opindex multi_module
10976 @opindex multiply_defined
10977 @opindex multiply_defined_unused
10978 @opindex noall_load
10979 @opindex no_dead_strip_inits_and_terms
10980 @opindex nofixprebinding
10981 @opindex nomultidefs
10982 @opindex noprebind
10983 @opindex noseglinkedit
10984 @opindex pagezero_size
10985 @opindex prebind
10986 @opindex prebind_all_twolevel_modules
10987 @opindex private_bundle
10988 @opindex read_only_relocs
10989 @opindex sectalign
10990 @opindex sectobjectsymbols
10991 @opindex whyload
10992 @opindex seg1addr
10993 @opindex sectcreate
10994 @opindex sectobjectsymbols
10995 @opindex sectorder
10996 @opindex segaddr
10997 @opindex segs_read_only_addr
10998 @opindex segs_read_write_addr
10999 @opindex seg_addr_table
11000 @opindex seg_addr_table_filename
11001 @opindex seglinkedit
11002 @opindex segprot
11003 @opindex segs_read_only_addr
11004 @opindex segs_read_write_addr
11005 @opindex single_module
11006 @opindex static
11007 @opindex sub_library
11008 @opindex sub_umbrella
11009 @opindex twolevel_namespace
11010 @opindex umbrella
11011 @opindex undefined
11012 @opindex unexported_symbols_list
11013 @opindex weak_reference_mismatches
11014 @opindex whatsloaded
11015 These options are passed to the Darwin linker.  The Darwin linker man page
11016 describes them in detail.
11017 @end table
11019 @node DEC Alpha Options
11020 @subsection DEC Alpha Options
11022 These @samp{-m} options are defined for the DEC Alpha implementations:
11024 @table @gcctabopt
11025 @item -mno-soft-float
11026 @itemx -msoft-float
11027 @opindex mno-soft-float
11028 @opindex msoft-float
11029 Use (do not use) the hardware floating-point instructions for
11030 floating-point operations.  When @option{-msoft-float} is specified,
11031 functions in @file{libgcc.a} will be used to perform floating-point
11032 operations.  Unless they are replaced by routines that emulate the
11033 floating-point operations, or compiled in such a way as to call such
11034 emulations routines, these routines will issue floating-point
11035 operations.   If you are compiling for an Alpha without floating-point
11036 operations, you must ensure that the library is built so as not to call
11037 them.
11039 Note that Alpha implementations without floating-point operations are
11040 required to have floating-point registers.
11042 @item -mfp-reg
11043 @itemx -mno-fp-regs
11044 @opindex mfp-reg
11045 @opindex mno-fp-regs
11046 Generate code that uses (does not use) the floating-point register set.
11047 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
11048 register set is not used, floating point operands are passed in integer
11049 registers as if they were integers and floating-point results are passed
11050 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
11051 so any function with a floating-point argument or return value called by code
11052 compiled with @option{-mno-fp-regs} must also be compiled with that
11053 option.
11055 A typical use of this option is building a kernel that does not use,
11056 and hence need not save and restore, any floating-point registers.
11058 @item -mieee
11059 @opindex mieee
11060 The Alpha architecture implements floating-point hardware optimized for
11061 maximum performance.  It is mostly compliant with the IEEE floating
11062 point standard.  However, for full compliance, software assistance is
11063 required.  This option generates code fully IEEE compliant code
11064 @emph{except} that the @var{inexact-flag} is not maintained (see below).
11065 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
11066 defined during compilation.  The resulting code is less efficient but is
11067 able to correctly support denormalized numbers and exceptional IEEE
11068 values such as not-a-number and plus/minus infinity.  Other Alpha
11069 compilers call this option @option{-ieee_with_no_inexact}.
11071 @item -mieee-with-inexact
11072 @opindex mieee-with-inexact
11073 This is like @option{-mieee} except the generated code also maintains
11074 the IEEE @var{inexact-flag}.  Turning on this option causes the
11075 generated code to implement fully-compliant IEEE math.  In addition to
11076 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
11077 macro.  On some Alpha implementations the resulting code may execute
11078 significantly slower than the code generated by default.  Since there is
11079 very little code that depends on the @var{inexact-flag}, you should
11080 normally not specify this option.  Other Alpha compilers call this
11081 option @option{-ieee_with_inexact}.
11083 @item -mfp-trap-mode=@var{trap-mode}
11084 @opindex mfp-trap-mode
11085 This option controls what floating-point related traps are enabled.
11086 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
11087 The trap mode can be set to one of four values:
11089 @table @samp
11090 @item n
11091 This is the default (normal) setting.  The only traps that are enabled
11092 are the ones that cannot be disabled in software (e.g., division by zero
11093 trap).
11095 @item u
11096 In addition to the traps enabled by @samp{n}, underflow traps are enabled
11097 as well.
11099 @item su
11100 Like @samp{u}, but the instructions are marked to be safe for software
11101 completion (see Alpha architecture manual for details).
11103 @item sui
11104 Like @samp{su}, but inexact traps are enabled as well.
11105 @end table
11107 @item -mfp-rounding-mode=@var{rounding-mode}
11108 @opindex mfp-rounding-mode
11109 Selects the IEEE rounding mode.  Other Alpha compilers call this option
11110 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
11113 @table @samp
11114 @item n
11115 Normal IEEE rounding mode.  Floating point numbers are rounded towards
11116 the nearest machine number or towards the even machine number in case
11117 of a tie.
11119 @item m
11120 Round towards minus infinity.
11122 @item c
11123 Chopped rounding mode.  Floating point numbers are rounded towards zero.
11125 @item d
11126 Dynamic rounding mode.  A field in the floating point control register
11127 (@var{fpcr}, see Alpha architecture reference manual) controls the
11128 rounding mode in effect.  The C library initializes this register for
11129 rounding towards plus infinity.  Thus, unless your program modifies the
11130 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
11131 @end table
11133 @item -mtrap-precision=@var{trap-precision}
11134 @opindex mtrap-precision
11135 In the Alpha architecture, floating point traps are imprecise.  This
11136 means without software assistance it is impossible to recover from a
11137 floating trap and program execution normally needs to be terminated.
11138 GCC can generate code that can assist operating system trap handlers
11139 in determining the exact location that caused a floating point trap.
11140 Depending on the requirements of an application, different levels of
11141 precisions can be selected:
11143 @table @samp
11144 @item p
11145 Program precision.  This option is the default and means a trap handler
11146 can only identify which program caused a floating point exception.
11148 @item f
11149 Function precision.  The trap handler can determine the function that
11150 caused a floating point exception.
11152 @item i
11153 Instruction precision.  The trap handler can determine the exact
11154 instruction that caused a floating point exception.
11155 @end table
11157 Other Alpha compilers provide the equivalent options called
11158 @option{-scope_safe} and @option{-resumption_safe}.
11160 @item -mieee-conformant
11161 @opindex mieee-conformant
11162 This option marks the generated code as IEEE conformant.  You must not
11163 use this option unless you also specify @option{-mtrap-precision=i} and either
11164 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
11165 is to emit the line @samp{.eflag 48} in the function prologue of the
11166 generated assembly file.  Under DEC Unix, this has the effect that
11167 IEEE-conformant math library routines will be linked in.
11169 @item -mbuild-constants
11170 @opindex mbuild-constants
11171 Normally GCC examines a 32- or 64-bit integer constant to
11172 see if it can construct it from smaller constants in two or three
11173 instructions.  If it cannot, it will output the constant as a literal and
11174 generate code to load it from the data segment at runtime.
11176 Use this option to require GCC to construct @emph{all} integer constants
11177 using code, even if it takes more instructions (the maximum is six).
11179 You would typically use this option to build a shared library dynamic
11180 loader.  Itself a shared library, it must relocate itself in memory
11181 before it can find the variables and constants in its own data segment.
11183 @item -malpha-as
11184 @itemx -mgas
11185 @opindex malpha-as
11186 @opindex mgas
11187 Select whether to generate code to be assembled by the vendor-supplied
11188 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
11190 @item -mbwx
11191 @itemx -mno-bwx
11192 @itemx -mcix
11193 @itemx -mno-cix
11194 @itemx -mfix
11195 @itemx -mno-fix
11196 @itemx -mmax
11197 @itemx -mno-max
11198 @opindex mbwx
11199 @opindex mno-bwx
11200 @opindex mcix
11201 @opindex mno-cix
11202 @opindex mfix
11203 @opindex mno-fix
11204 @opindex mmax
11205 @opindex mno-max
11206 Indicate whether GCC should generate code to use the optional BWX,
11207 CIX, FIX and MAX instruction sets.  The default is to use the instruction
11208 sets supported by the CPU type specified via @option{-mcpu=} option or that
11209 of the CPU on which GCC was built if none was specified.
11211 @item -mfloat-vax
11212 @itemx -mfloat-ieee
11213 @opindex mfloat-vax
11214 @opindex mfloat-ieee
11215 Generate code that uses (does not use) VAX F and G floating point
11216 arithmetic instead of IEEE single and double precision.
11218 @item -mexplicit-relocs
11219 @itemx -mno-explicit-relocs
11220 @opindex mexplicit-relocs
11221 @opindex mno-explicit-relocs
11222 Older Alpha assemblers provided no way to generate symbol relocations
11223 except via assembler macros.  Use of these macros does not allow
11224 optimal instruction scheduling.  GNU binutils as of version 2.12
11225 supports a new syntax that allows the compiler to explicitly mark
11226 which relocations should apply to which instructions.  This option
11227 is mostly useful for debugging, as GCC detects the capabilities of
11228 the assembler when it is built and sets the default accordingly.
11230 @item -msmall-data
11231 @itemx -mlarge-data
11232 @opindex msmall-data
11233 @opindex mlarge-data
11234 When @option{-mexplicit-relocs} is in effect, static data is
11235 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
11236 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
11237 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
11238 16-bit relocations off of the @code{$gp} register.  This limits the
11239 size of the small data area to 64KB, but allows the variables to be
11240 directly accessed via a single instruction.
11242 The default is @option{-mlarge-data}.  With this option the data area
11243 is limited to just below 2GB@.  Programs that require more than 2GB of
11244 data must use @code{malloc} or @code{mmap} to allocate the data in the
11245 heap instead of in the program's data segment.
11247 When generating code for shared libraries, @option{-fpic} implies
11248 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
11250 @item -msmall-text
11251 @itemx -mlarge-text
11252 @opindex msmall-text
11253 @opindex mlarge-text
11254 When @option{-msmall-text} is used, the compiler assumes that the
11255 code of the entire program (or shared library) fits in 4MB, and is
11256 thus reachable with a branch instruction.  When @option{-msmall-data}
11257 is used, the compiler can assume that all local symbols share the
11258 same @code{$gp} value, and thus reduce the number of instructions
11259 required for a function call from 4 to 1.
11261 The default is @option{-mlarge-text}.
11263 @item -mcpu=@var{cpu_type}
11264 @opindex mcpu
11265 Set the instruction set and instruction scheduling parameters for
11266 machine type @var{cpu_type}.  You can specify either the @samp{EV}
11267 style name or the corresponding chip number.  GCC supports scheduling
11268 parameters for the EV4, EV5 and EV6 family of processors and will
11269 choose the default values for the instruction set from the processor
11270 you specify.  If you do not specify a processor type, GCC will default
11271 to the processor on which the compiler was built.
11273 Supported values for @var{cpu_type} are
11275 @table @samp
11276 @item ev4
11277 @itemx ev45
11278 @itemx 21064
11279 Schedules as an EV4 and has no instruction set extensions.
11281 @item ev5
11282 @itemx 21164
11283 Schedules as an EV5 and has no instruction set extensions.
11285 @item ev56
11286 @itemx 21164a
11287 Schedules as an EV5 and supports the BWX extension.
11289 @item pca56
11290 @itemx 21164pc
11291 @itemx 21164PC
11292 Schedules as an EV5 and supports the BWX and MAX extensions.
11294 @item ev6
11295 @itemx 21264
11296 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
11298 @item ev67
11299 @itemx 21264a
11300 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
11301 @end table
11303 Native Linux/GNU toolchains also support the value @samp{native},
11304 which selects the best architecture option for the host processor.
11305 @option{-mcpu=native} has no effect if GCC does not recognize
11306 the processor.
11308 @item -mtune=@var{cpu_type}
11309 @opindex mtune
11310 Set only the instruction scheduling parameters for machine type
11311 @var{cpu_type}.  The instruction set is not changed.
11313 Native Linux/GNU toolchains also support the value @samp{native},
11314 which selects the best architecture option for the host processor.
11315 @option{-mtune=native} has no effect if GCC does not recognize
11316 the processor.
11318 @item -mmemory-latency=@var{time}
11319 @opindex mmemory-latency
11320 Sets the latency the scheduler should assume for typical memory
11321 references as seen by the application.  This number is highly
11322 dependent on the memory access patterns used by the application
11323 and the size of the external cache on the machine.
11325 Valid options for @var{time} are
11327 @table @samp
11328 @item @var{number}
11329 A decimal number representing clock cycles.
11331 @item L1
11332 @itemx L2
11333 @itemx L3
11334 @itemx main
11335 The compiler contains estimates of the number of clock cycles for
11336 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
11337 (also called Dcache, Scache, and Bcache), as well as to main memory.
11338 Note that L3 is only valid for EV5.
11340 @end table
11341 @end table
11343 @node DEC Alpha/VMS Options
11344 @subsection DEC Alpha/VMS Options
11346 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
11348 @table @gcctabopt
11349 @item -mvms-return-codes
11350 @opindex mvms-return-codes
11351 Return VMS condition codes from main.  The default is to return POSIX
11352 style condition (e.g.@: error) codes.
11354 @item -mdebug-main=@var{prefix}
11355 @opindex mdebug-main=@var{prefix}
11356 Flag the first routine whose name starts with @var{prefix} as the main
11357 routine for the debugger.
11359 @item -mmalloc64
11360 @opindex mmalloc64
11361 Default to 64bit memory allocation routines.
11362 @end table
11364 @node FR30 Options
11365 @subsection FR30 Options
11366 @cindex FR30 Options
11368 These options are defined specifically for the FR30 port.
11370 @table @gcctabopt
11372 @item -msmall-model
11373 @opindex msmall-model
11374 Use the small address space model.  This can produce smaller code, but
11375 it does assume that all symbolic values and addresses will fit into a
11376 20-bit range.
11378 @item -mno-lsim
11379 @opindex mno-lsim
11380 Assume that run-time support has been provided and so there is no need
11381 to include the simulator library (@file{libsim.a}) on the linker
11382 command line.
11384 @end table
11386 @node FRV Options
11387 @subsection FRV Options
11388 @cindex FRV Options
11390 @table @gcctabopt
11391 @item -mgpr-32
11392 @opindex mgpr-32
11394 Only use the first 32 general purpose registers.
11396 @item -mgpr-64
11397 @opindex mgpr-64
11399 Use all 64 general purpose registers.
11401 @item -mfpr-32
11402 @opindex mfpr-32
11404 Use only the first 32 floating point registers.
11406 @item -mfpr-64
11407 @opindex mfpr-64
11409 Use all 64 floating point registers
11411 @item -mhard-float
11412 @opindex mhard-float
11414 Use hardware instructions for floating point operations.
11416 @item -msoft-float
11417 @opindex msoft-float
11419 Use library routines for floating point operations.
11421 @item -malloc-cc
11422 @opindex malloc-cc
11424 Dynamically allocate condition code registers.
11426 @item -mfixed-cc
11427 @opindex mfixed-cc
11429 Do not try to dynamically allocate condition code registers, only
11430 use @code{icc0} and @code{fcc0}.
11432 @item -mdword
11433 @opindex mdword
11435 Change ABI to use double word insns.
11437 @item -mno-dword
11438 @opindex mno-dword
11440 Do not use double word instructions.
11442 @item -mdouble
11443 @opindex mdouble
11445 Use floating point double instructions.
11447 @item -mno-double
11448 @opindex mno-double
11450 Do not use floating point double instructions.
11452 @item -mmedia
11453 @opindex mmedia
11455 Use media instructions.
11457 @item -mno-media
11458 @opindex mno-media
11460 Do not use media instructions.
11462 @item -mmuladd
11463 @opindex mmuladd
11465 Use multiply and add/subtract instructions.
11467 @item -mno-muladd
11468 @opindex mno-muladd
11470 Do not use multiply and add/subtract instructions.
11472 @item -mfdpic
11473 @opindex mfdpic
11475 Select the FDPIC ABI, that uses function descriptors to represent
11476 pointers to functions.  Without any PIC/PIE-related options, it
11477 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
11478 assumes GOT entries and small data are within a 12-bit range from the
11479 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
11480 are computed with 32 bits.
11481 With a @samp{bfin-elf} target, this option implies @option{-msim}.
11483 @item -minline-plt
11484 @opindex minline-plt
11486 Enable inlining of PLT entries in function calls to functions that are
11487 not known to bind locally.  It has no effect without @option{-mfdpic}.
11488 It's enabled by default if optimizing for speed and compiling for
11489 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
11490 optimization option such as @option{-O3} or above is present in the
11491 command line.
11493 @item -mTLS
11494 @opindex mTLS
11496 Assume a large TLS segment when generating thread-local code.
11498 @item -mtls
11499 @opindex mtls
11501 Do not assume a large TLS segment when generating thread-local code.
11503 @item -mgprel-ro
11504 @opindex mgprel-ro
11506 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
11507 that is known to be in read-only sections.  It's enabled by default,
11508 except for @option{-fpic} or @option{-fpie}: even though it may help
11509 make the global offset table smaller, it trades 1 instruction for 4.
11510 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
11511 one of which may be shared by multiple symbols, and it avoids the need
11512 for a GOT entry for the referenced symbol, so it's more likely to be a
11513 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
11515 @item -multilib-library-pic
11516 @opindex multilib-library-pic
11518 Link with the (library, not FD) pic libraries.  It's implied by
11519 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
11520 @option{-fpic} without @option{-mfdpic}.  You should never have to use
11521 it explicitly.
11523 @item -mlinked-fp
11524 @opindex mlinked-fp
11526 Follow the EABI requirement of always creating a frame pointer whenever
11527 a stack frame is allocated.  This option is enabled by default and can
11528 be disabled with @option{-mno-linked-fp}.
11530 @item -mlong-calls
11531 @opindex mlong-calls
11533 Use indirect addressing to call functions outside the current
11534 compilation unit.  This allows the functions to be placed anywhere
11535 within the 32-bit address space.
11537 @item -malign-labels
11538 @opindex malign-labels
11540 Try to align labels to an 8-byte boundary by inserting nops into the
11541 previous packet.  This option only has an effect when VLIW packing
11542 is enabled.  It doesn't create new packets; it merely adds nops to
11543 existing ones.
11545 @item -mlibrary-pic
11546 @opindex mlibrary-pic
11548 Generate position-independent EABI code.
11550 @item -macc-4
11551 @opindex macc-4
11553 Use only the first four media accumulator registers.
11555 @item -macc-8
11556 @opindex macc-8
11558 Use all eight media accumulator registers.
11560 @item -mpack
11561 @opindex mpack
11563 Pack VLIW instructions.
11565 @item -mno-pack
11566 @opindex mno-pack
11568 Do not pack VLIW instructions.
11570 @item -mno-eflags
11571 @opindex mno-eflags
11573 Do not mark ABI switches in e_flags.
11575 @item -mcond-move
11576 @opindex mcond-move
11578 Enable the use of conditional-move instructions (default).
11580 This switch is mainly for debugging the compiler and will likely be removed
11581 in a future version.
11583 @item -mno-cond-move
11584 @opindex mno-cond-move
11586 Disable the use of conditional-move instructions.
11588 This switch is mainly for debugging the compiler and will likely be removed
11589 in a future version.
11591 @item -mscc
11592 @opindex mscc
11594 Enable the use of conditional set instructions (default).
11596 This switch is mainly for debugging the compiler and will likely be removed
11597 in a future version.
11599 @item -mno-scc
11600 @opindex mno-scc
11602 Disable the use of conditional set instructions.
11604 This switch is mainly for debugging the compiler and will likely be removed
11605 in a future version.
11607 @item -mcond-exec
11608 @opindex mcond-exec
11610 Enable the use of conditional execution (default).
11612 This switch is mainly for debugging the compiler and will likely be removed
11613 in a future version.
11615 @item -mno-cond-exec
11616 @opindex mno-cond-exec
11618 Disable the use of conditional execution.
11620 This switch is mainly for debugging the compiler and will likely be removed
11621 in a future version.
11623 @item -mvliw-branch
11624 @opindex mvliw-branch
11626 Run a pass to pack branches into VLIW instructions (default).
11628 This switch is mainly for debugging the compiler and will likely be removed
11629 in a future version.
11631 @item -mno-vliw-branch
11632 @opindex mno-vliw-branch
11634 Do not run a pass to pack branches into VLIW instructions.
11636 This switch is mainly for debugging the compiler and will likely be removed
11637 in a future version.
11639 @item -mmulti-cond-exec
11640 @opindex mmulti-cond-exec
11642 Enable optimization of @code{&&} and @code{||} in conditional execution
11643 (default).
11645 This switch is mainly for debugging the compiler and will likely be removed
11646 in a future version.
11648 @item -mno-multi-cond-exec
11649 @opindex mno-multi-cond-exec
11651 Disable optimization of @code{&&} and @code{||} in conditional execution.
11653 This switch is mainly for debugging the compiler and will likely be removed
11654 in a future version.
11656 @item -mnested-cond-exec
11657 @opindex mnested-cond-exec
11659 Enable nested conditional execution optimizations (default).
11661 This switch is mainly for debugging the compiler and will likely be removed
11662 in a future version.
11664 @item -mno-nested-cond-exec
11665 @opindex mno-nested-cond-exec
11667 Disable nested conditional execution optimizations.
11669 This switch is mainly for debugging the compiler and will likely be removed
11670 in a future version.
11672 @item -moptimize-membar
11673 @opindex moptimize-membar
11675 This switch removes redundant @code{membar} instructions from the
11676 compiler generated code.  It is enabled by default.
11678 @item -mno-optimize-membar
11679 @opindex mno-optimize-membar
11681 This switch disables the automatic removal of redundant @code{membar}
11682 instructions from the generated code.
11684 @item -mtomcat-stats
11685 @opindex mtomcat-stats
11687 Cause gas to print out tomcat statistics.
11689 @item -mcpu=@var{cpu}
11690 @opindex mcpu
11692 Select the processor type for which to generate code.  Possible values are
11693 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
11694 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
11696 @end table
11698 @node GNU/Linux Options
11699 @subsection GNU/Linux Options
11701 These @samp{-m} options are defined for GNU/Linux targets:
11703 @table @gcctabopt
11704 @item -mglibc
11705 @opindex mglibc
11706 Use the GNU C library.  This is the default except
11707 on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
11709 @item -muclibc
11710 @opindex muclibc
11711 Use uClibc C library.  This is the default on
11712 @samp{*-*-linux-*uclibc*} targets.
11714 @item -mbionic
11715 @opindex mbionic
11716 Use Bionic C library.  This is the default on
11717 @samp{*-*-linux-*android*} targets.
11719 @item -mandroid
11720 @opindex mandroid
11721 Compile code compatible with Android platform.  This is the default on
11722 @samp{*-*-linux-*android*} targets.
11724 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
11725 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
11726 this option makes the GCC driver pass Android-specific options to the linker.
11727 Finally, this option causes the preprocessor macro @code{__ANDROID__}
11728 to be defined.
11730 @item -tno-android-cc
11731 @opindex tno-android-cc
11732 Disable compilation effects of @option{-mandroid}, i.e., do not enable
11733 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
11734 @option{-fno-rtti} by default.
11736 @item -tno-android-ld
11737 @opindex tno-android-ld
11738 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
11739 linking options to the linker.
11741 @end table
11743 @node H8/300 Options
11744 @subsection H8/300 Options
11746 These @samp{-m} options are defined for the H8/300 implementations:
11748 @table @gcctabopt
11749 @item -mrelax
11750 @opindex mrelax
11751 Shorten some address references at link time, when possible; uses the
11752 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
11753 ld, Using ld}, for a fuller description.
11755 @item -mh
11756 @opindex mh
11757 Generate code for the H8/300H@.
11759 @item -ms
11760 @opindex ms
11761 Generate code for the H8S@.
11763 @item -mn
11764 @opindex mn
11765 Generate code for the H8S and H8/300H in the normal mode.  This switch
11766 must be used either with @option{-mh} or @option{-ms}.
11768 @item -ms2600
11769 @opindex ms2600
11770 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
11772 @item -mint32
11773 @opindex mint32
11774 Make @code{int} data 32 bits by default.
11776 @item -malign-300
11777 @opindex malign-300
11778 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
11779 The default for the H8/300H and H8S is to align longs and floats on 4
11780 byte boundaries.
11781 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
11782 This option has no effect on the H8/300.
11783 @end table
11785 @node HPPA Options
11786 @subsection HPPA Options
11787 @cindex HPPA Options
11789 These @samp{-m} options are defined for the HPPA family of computers:
11791 @table @gcctabopt
11792 @item -march=@var{architecture-type}
11793 @opindex march
11794 Generate code for the specified architecture.  The choices for
11795 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
11796 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
11797 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
11798 architecture option for your machine.  Code compiled for lower numbered
11799 architectures will run on higher numbered architectures, but not the
11800 other way around.
11802 @item -mpa-risc-1-0
11803 @itemx -mpa-risc-1-1
11804 @itemx -mpa-risc-2-0
11805 @opindex mpa-risc-1-0
11806 @opindex mpa-risc-1-1
11807 @opindex mpa-risc-2-0
11808 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
11810 @item -mbig-switch
11811 @opindex mbig-switch
11812 Generate code suitable for big switch tables.  Use this option only if
11813 the assembler/linker complain about out of range branches within a switch
11814 table.
11816 @item -mjump-in-delay
11817 @opindex mjump-in-delay
11818 Fill delay slots of function calls with unconditional jump instructions
11819 by modifying the return pointer for the function call to be the target
11820 of the conditional jump.
11822 @item -mdisable-fpregs
11823 @opindex mdisable-fpregs
11824 Prevent floating point registers from being used in any manner.  This is
11825 necessary for compiling kernels which perform lazy context switching of
11826 floating point registers.  If you use this option and attempt to perform
11827 floating point operations, the compiler will abort.
11829 @item -mdisable-indexing
11830 @opindex mdisable-indexing
11831 Prevent the compiler from using indexing address modes.  This avoids some
11832 rather obscure problems when compiling MIG generated code under MACH@.
11834 @item -mno-space-regs
11835 @opindex mno-space-regs
11836 Generate code that assumes the target has no space registers.  This allows
11837 GCC to generate faster indirect calls and use unscaled index address modes.
11839 Such code is suitable for level 0 PA systems and kernels.
11841 @item -mfast-indirect-calls
11842 @opindex mfast-indirect-calls
11843 Generate code that assumes calls never cross space boundaries.  This
11844 allows GCC to emit code which performs faster indirect calls.
11846 This option will not work in the presence of shared libraries or nested
11847 functions.
11849 @item -mfixed-range=@var{register-range}
11850 @opindex mfixed-range
11851 Generate code treating the given register range as fixed registers.
11852 A fixed register is one that the register allocator can not use.  This is
11853 useful when compiling kernel code.  A register range is specified as
11854 two registers separated by a dash.  Multiple register ranges can be
11855 specified separated by a comma.
11857 @item -mlong-load-store
11858 @opindex mlong-load-store
11859 Generate 3-instruction load and store sequences as sometimes required by
11860 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
11861 the HP compilers.
11863 @item -mportable-runtime
11864 @opindex mportable-runtime
11865 Use the portable calling conventions proposed by HP for ELF systems.
11867 @item -mgas
11868 @opindex mgas
11869 Enable the use of assembler directives only GAS understands.
11871 @item -mschedule=@var{cpu-type}
11872 @opindex mschedule
11873 Schedule code according to the constraints for the machine type
11874 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
11875 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
11876 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
11877 proper scheduling option for your machine.  The default scheduling is
11878 @samp{8000}.
11880 @item -mlinker-opt
11881 @opindex mlinker-opt
11882 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
11883 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
11884 linkers in which they give bogus error messages when linking some programs.
11886 @item -msoft-float
11887 @opindex msoft-float
11888 Generate output containing library calls for floating point.
11889 @strong{Warning:} the requisite libraries are not available for all HPPA
11890 targets.  Normally the facilities of the machine's usual C compiler are
11891 used, but this cannot be done directly in cross-compilation.  You must make
11892 your own arrangements to provide suitable library functions for
11893 cross-compilation.
11895 @option{-msoft-float} changes the calling convention in the output file;
11896 therefore, it is only useful if you compile @emph{all} of a program with
11897 this option.  In particular, you need to compile @file{libgcc.a}, the
11898 library that comes with GCC, with @option{-msoft-float} in order for
11899 this to work.
11901 @item -msio
11902 @opindex msio
11903 Generate the predefine, @code{_SIO}, for server IO@.  The default is
11904 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
11905 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
11906 options are available under HP-UX and HI-UX@.
11908 @item -mgnu-ld
11909 @opindex mgnu-ld
11910 Use GNU ld specific options.  This passes @option{-shared} to ld when
11911 building a shared library.  It is the default when GCC is configured,
11912 explicitly or implicitly, with the GNU linker.  This option does not
11913 have any affect on which ld is called, it only changes what parameters
11914 are passed to that ld.  The ld that is called is determined by the
11915 @option{--with-ld} configure option, GCC's program search path, and
11916 finally by the user's @env{PATH}.  The linker used by GCC can be printed
11917 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
11918 on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
11920 @item -mhp-ld
11921 @opindex mhp-ld
11922 Use HP ld specific options.  This passes @option{-b} to ld when building
11923 a shared library and passes @option{+Accept TypeMismatch} to ld on all
11924 links.  It is the default when GCC is configured, explicitly or
11925 implicitly, with the HP linker.  This option does not have any affect on
11926 which ld is called, it only changes what parameters are passed to that
11927 ld.  The ld that is called is determined by the @option{--with-ld}
11928 configure option, GCC's program search path, and finally by the user's
11929 @env{PATH}.  The linker used by GCC can be printed using @samp{which
11930 `gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
11931 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
11933 @item -mlong-calls
11934 @opindex mno-long-calls
11935 Generate code that uses long call sequences.  This ensures that a call
11936 is always able to reach linker generated stubs.  The default is to generate
11937 long calls only when the distance from the call site to the beginning
11938 of the function or translation unit, as the case may be, exceeds a
11939 predefined limit set by the branch type being used.  The limits for
11940 normal calls are 7,600,000 and 240,000 bytes, respectively for the
11941 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
11942 240,000 bytes.
11944 Distances are measured from the beginning of functions when using the
11945 @option{-ffunction-sections} option, or when using the @option{-mgas}
11946 and @option{-mno-portable-runtime} options together under HP-UX with
11947 the SOM linker.
11949 It is normally not desirable to use this option as it will degrade
11950 performance.  However, it may be useful in large applications,
11951 particularly when partial linking is used to build the application.
11953 The types of long calls used depends on the capabilities of the
11954 assembler and linker, and the type of code being generated.  The
11955 impact on systems that support long absolute calls, and long pic
11956 symbol-difference or pc-relative calls should be relatively small.
11957 However, an indirect call is used on 32-bit ELF systems in pic code
11958 and it is quite long.
11960 @item -munix=@var{unix-std}
11961 @opindex march
11962 Generate compiler predefines and select a startfile for the specified
11963 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
11964 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
11965 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
11966 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
11967 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
11968 and later.
11970 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
11971 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
11972 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
11973 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
11974 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
11975 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
11977 It is @emph{important} to note that this option changes the interfaces
11978 for various library routines.  It also affects the operational behavior
11979 of the C library.  Thus, @emph{extreme} care is needed in using this
11980 option.
11982 Library code that is intended to operate with more than one UNIX
11983 standard must test, set and restore the variable @var{__xpg4_extended_mask}
11984 as appropriate.  Most GNU software doesn't provide this capability.
11986 @item -nolibdld
11987 @opindex nolibdld
11988 Suppress the generation of link options to search libdld.sl when the
11989 @option{-static} option is specified on HP-UX 10 and later.
11991 @item -static
11992 @opindex static
11993 The HP-UX implementation of setlocale in libc has a dependency on
11994 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
11995 when the @option{-static} option is specified, special link options
11996 are needed to resolve this dependency.
11998 On HP-UX 10 and later, the GCC driver adds the necessary options to
11999 link with libdld.sl when the @option{-static} option is specified.
12000 This causes the resulting binary to be dynamic.  On the 64-bit port,
12001 the linkers generate dynamic binaries by default in any case.  The
12002 @option{-nolibdld} option can be used to prevent the GCC driver from
12003 adding these link options.
12005 @item -threads
12006 @opindex threads
12007 Add support for multithreading with the @dfn{dce thread} library
12008 under HP-UX@.  This option sets flags for both the preprocessor and
12009 linker.
12010 @end table
12012 @node i386 and x86-64 Options
12013 @subsection Intel 386 and AMD x86-64 Options
12014 @cindex i386 Options
12015 @cindex x86-64 Options
12016 @cindex Intel 386 Options
12017 @cindex AMD x86-64 Options
12019 These @samp{-m} options are defined for the i386 and x86-64 family of
12020 computers:
12022 @table @gcctabopt
12023 @item -mtune=@var{cpu-type}
12024 @opindex mtune
12025 Tune to @var{cpu-type} everything applicable about the generated code, except
12026 for the ABI and the set of available instructions.  The choices for
12027 @var{cpu-type} are:
12028 @table @emph
12029 @item generic
12030 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
12031 If you know the CPU on which your code will run, then you should use
12032 the corresponding @option{-mtune} option instead of
12033 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
12034 of your application will have, then you should use this option.
12036 As new processors are deployed in the marketplace, the behavior of this
12037 option will change.  Therefore, if you upgrade to a newer version of
12038 GCC, the code generated option will change to reflect the processors
12039 that were most common when that version of GCC was released.
12041 There is no @option{-march=generic} option because @option{-march}
12042 indicates the instruction set the compiler can use, and there is no
12043 generic instruction set applicable to all processors.  In contrast,
12044 @option{-mtune} indicates the processor (or, in this case, collection of
12045 processors) for which the code is optimized.
12046 @item native
12047 This selects the CPU to tune for at compilation time by determining
12048 the processor type of the compiling machine.  Using @option{-mtune=native}
12049 will produce code optimized for the local machine under the constraints
12050 of the selected instruction set.  Using @option{-march=native} will
12051 enable all instruction subsets supported by the local machine (hence
12052 the result might not run on different machines).
12053 @item i386
12054 Original Intel's i386 CPU@.
12055 @item i486
12056 Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
12057 @item i586, pentium
12058 Intel Pentium CPU with no MMX support.
12059 @item pentium-mmx
12060 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
12061 @item pentiumpro
12062 Intel PentiumPro CPU@.
12063 @item i686
12064 Same as @code{generic}, but when used as @code{march} option, PentiumPro
12065 instruction set will be used, so the code will run on all i686 family chips.
12066 @item pentium2
12067 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
12068 @item pentium3, pentium3m
12069 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
12070 support.
12071 @item pentium-m
12072 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
12073 support.  Used by Centrino notebooks.
12074 @item pentium4, pentium4m
12075 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
12076 @item prescott
12077 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
12078 set support.
12079 @item nocona
12080 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
12081 SSE2 and SSE3 instruction set support.
12082 @item core2
12083 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12084 instruction set support.
12085 @item corei7
12086 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
12087 and SSE4.2 instruction set support.
12088 @item corei7-avx
12089 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
12090 SSE4.1, SSE4.2, AVX, AES and PCLMUL instruction set support.
12091 @item atom
12092 Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12093 instruction set support.
12094 @item k6
12095 AMD K6 CPU with MMX instruction set support.
12096 @item k6-2, k6-3
12097 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
12098 @item athlon, athlon-tbird
12099 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
12100 support.
12101 @item athlon-4, athlon-xp, athlon-mp
12102 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
12103 instruction set support.
12104 @item k8, opteron, athlon64, athlon-fx
12105 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
12106 MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit instruction set extensions.)
12107 @item k8-sse3, opteron-sse3, athlon64-sse3
12108 Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
12109 @item amdfam10, barcelona
12110 AMD Family 10h core based CPUs with x86-64 instruction set support.  (This
12111 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
12112 instruction set extensions.)
12113 @item winchip-c6
12114 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
12115 set support.
12116 @item winchip2
12117 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
12118 instruction set support.
12119 @item c3
12120 Via C3 CPU with MMX and 3DNow!@: instruction set support.  (No scheduling is
12121 implemented for this chip.)
12122 @item c3-2
12123 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
12124 implemented for this chip.)
12125 @item geode
12126 Embedded AMD CPU with MMX and 3DNow!@: instruction set support.
12127 @end table
12129 While picking a specific @var{cpu-type} will schedule things appropriately
12130 for that particular chip, the compiler will not generate any code that
12131 does not run on the i386 without the @option{-march=@var{cpu-type}} option
12132 being used.
12134 @item -march=@var{cpu-type}
12135 @opindex march
12136 Generate instructions for the machine type @var{cpu-type}.  The choices
12137 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
12138 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
12140 @item -mcpu=@var{cpu-type}
12141 @opindex mcpu
12142 A deprecated synonym for @option{-mtune}.
12144 @item -mfpmath=@var{unit}
12145 @opindex mfpmath
12146 Generate floating point arithmetics for selected unit @var{unit}.  The choices
12147 for @var{unit} are:
12149 @table @samp
12150 @item 387
12151 Use the standard 387 floating point coprocessor present majority of chips and
12152 emulated otherwise.  Code compiled with this option will run almost everywhere.
12153 The temporary results are computed in 80bit precision instead of precision
12154 specified by the type resulting in slightly different results compared to most
12155 of other chips.  See @option{-ffloat-store} for more detailed description.
12157 This is the default choice for i386 compiler.
12159 @item sse
12160 Use scalar floating point instructions present in the SSE instruction set.
12161 This instruction set is supported by Pentium3 and newer chips, in the AMD line
12162 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
12163 instruction set supports only single precision arithmetics, thus the double and
12164 extended precision arithmetics is still done using 387.  Later version, present
12165 only in Pentium4 and the future AMD x86-64 chips supports double precision
12166 arithmetics too.
12168 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
12169 or @option{-msse2} switches to enable SSE extensions and make this option
12170 effective.  For the x86-64 compiler, these extensions are enabled by default.
12172 The resulting code should be considerably faster in the majority of cases and avoid
12173 the numerical instability problems of 387 code, but may break some existing
12174 code that expects temporaries to be 80bit.
12176 This is the default choice for the x86-64 compiler.
12178 @item sse,387
12179 @itemx sse+387
12180 @itemx both
12181 Attempt to utilize both instruction sets at once.  This effectively double the
12182 amount of available registers and on chips with separate execution units for
12183 387 and SSE the execution resources too.  Use this option with care, as it is
12184 still experimental, because the GCC register allocator does not model separate
12185 functional units well resulting in instable performance.
12186 @end table
12188 @item -masm=@var{dialect}
12189 @opindex masm=@var{dialect}
12190 Output asm instructions using selected @var{dialect}.  Supported
12191 choices are @samp{intel} or @samp{att} (the default one).  Darwin does
12192 not support @samp{intel}.
12194 @item -mieee-fp
12195 @itemx -mno-ieee-fp
12196 @opindex mieee-fp
12197 @opindex mno-ieee-fp
12198 Control whether or not the compiler uses IEEE floating point
12199 comparisons.  These handle correctly the case where the result of a
12200 comparison is unordered.
12202 @item -msoft-float
12203 @opindex msoft-float
12204 Generate output containing library calls for floating point.
12205 @strong{Warning:} the requisite libraries are not part of GCC@.
12206 Normally the facilities of the machine's usual C compiler are used, but
12207 this can't be done directly in cross-compilation.  You must make your
12208 own arrangements to provide suitable library functions for
12209 cross-compilation.
12211 On machines where a function returns floating point results in the 80387
12212 register stack, some floating point opcodes may be emitted even if
12213 @option{-msoft-float} is used.
12215 @item -mno-fp-ret-in-387
12216 @opindex mno-fp-ret-in-387
12217 Do not use the FPU registers for return values of functions.
12219 The usual calling convention has functions return values of types
12220 @code{float} and @code{double} in an FPU register, even if there
12221 is no FPU@.  The idea is that the operating system should emulate
12222 an FPU@.
12224 The option @option{-mno-fp-ret-in-387} causes such values to be returned
12225 in ordinary CPU registers instead.
12227 @item -mno-fancy-math-387
12228 @opindex mno-fancy-math-387
12229 Some 387 emulators do not support the @code{sin}, @code{cos} and
12230 @code{sqrt} instructions for the 387.  Specify this option to avoid
12231 generating those instructions.  This option is the default on FreeBSD,
12232 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
12233 indicates that the target CPU will always have an FPU and so the
12234 instruction will not need emulation.  As of revision 2.6.1, these
12235 instructions are not generated unless you also use the
12236 @option{-funsafe-math-optimizations} switch.
12238 @item -malign-double
12239 @itemx -mno-align-double
12240 @opindex malign-double
12241 @opindex mno-align-double
12242 Control whether GCC aligns @code{double}, @code{long double}, and
12243 @code{long long} variables on a two word boundary or a one word
12244 boundary.  Aligning @code{double} variables on a two word boundary will
12245 produce code that runs somewhat faster on a @samp{Pentium} at the
12246 expense of more memory.
12248 On x86-64, @option{-malign-double} is enabled by default.
12250 @strong{Warning:} if you use the @option{-malign-double} switch,
12251 structures containing the above types will be aligned differently than
12252 the published application binary interface specifications for the 386
12253 and will not be binary compatible with structures in code compiled
12254 without that switch.
12256 @item -m96bit-long-double
12257 @itemx -m128bit-long-double
12258 @opindex m96bit-long-double
12259 @opindex m128bit-long-double
12260 These switches control the size of @code{long double} type.  The i386
12261 application binary interface specifies the size to be 96 bits,
12262 so @option{-m96bit-long-double} is the default in 32 bit mode.
12264 Modern architectures (Pentium and newer) would prefer @code{long double}
12265 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
12266 conforming to the ABI, this would not be possible.  So specifying a
12267 @option{-m128bit-long-double} will align @code{long double}
12268 to a 16 byte boundary by padding the @code{long double} with an additional
12269 32 bit zero.
12271 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
12272 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
12274 Notice that neither of these options enable any extra precision over the x87
12275 standard of 80 bits for a @code{long double}.
12277 @strong{Warning:} if you override the default value for your target ABI, the
12278 structures and arrays containing @code{long double} variables will change
12279 their size as well as function calling convention for function taking
12280 @code{long double} will be modified.  Hence they will not be binary
12281 compatible with arrays or structures in code compiled without that switch.
12283 @item -mlarge-data-threshold=@var{number}
12284 @opindex mlarge-data-threshold=@var{number}
12285 When @option{-mcmodel=medium} is specified, the data greater than
12286 @var{threshold} are placed in large data section.  This value must be the
12287 same across all object linked into the binary and defaults to 65535.
12289 @item -mrtd
12290 @opindex mrtd
12291 Use a different function-calling convention, in which functions that
12292 take a fixed number of arguments return with the @code{ret} @var{num}
12293 instruction, which pops their arguments while returning.  This saves one
12294 instruction in the caller since there is no need to pop the arguments
12295 there.
12297 You can specify that an individual function is called with this calling
12298 sequence with the function attribute @samp{stdcall}.  You can also
12299 override the @option{-mrtd} option by using the function attribute
12300 @samp{cdecl}.  @xref{Function Attributes}.
12302 @strong{Warning:} this calling convention is incompatible with the one
12303 normally used on Unix, so you cannot use it if you need to call
12304 libraries compiled with the Unix compiler.
12306 Also, you must provide function prototypes for all functions that
12307 take variable numbers of arguments (including @code{printf});
12308 otherwise incorrect code will be generated for calls to those
12309 functions.
12311 In addition, seriously incorrect code will result if you call a
12312 function with too many arguments.  (Normally, extra arguments are
12313 harmlessly ignored.)
12315 @item -mregparm=@var{num}
12316 @opindex mregparm
12317 Control how many registers are used to pass integer arguments.  By
12318 default, no registers are used to pass arguments, and at most 3
12319 registers can be used.  You can control this behavior for a specific
12320 function by using the function attribute @samp{regparm}.
12321 @xref{Function Attributes}.
12323 @strong{Warning:} if you use this switch, and
12324 @var{num} is nonzero, then you must build all modules with the same
12325 value, including any libraries.  This includes the system libraries and
12326 startup modules.
12328 @item -msseregparm
12329 @opindex msseregparm
12330 Use SSE register passing conventions for float and double arguments
12331 and return values.  You can control this behavior for a specific
12332 function by using the function attribute @samp{sseregparm}.
12333 @xref{Function Attributes}.
12335 @strong{Warning:} if you use this switch then you must build all
12336 modules with the same value, including any libraries.  This includes
12337 the system libraries and startup modules.
12339 @item -mvect8-ret-in-mem
12340 @opindex mvect8-ret-in-mem
12341 Return 8-byte vectors in memory instead of MMX registers.  This is the
12342 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
12343 Studio compilers until version 12.  Later compiler versions (starting
12344 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
12345 is the default on Solaris@tie{}10 and later.  @emph{Only} use this option if
12346 you need to remain compatible with existing code produced by those
12347 previous compiler versions or older versions of GCC.
12349 @item -mpc32
12350 @itemx -mpc64
12351 @itemx -mpc80
12352 @opindex mpc32
12353 @opindex mpc64
12354 @opindex mpc80
12356 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
12357 is specified, the significands of results of floating-point operations are
12358 rounded to 24 bits (single precision); @option{-mpc64} rounds the
12359 significands of results of floating-point operations to 53 bits (double
12360 precision) and @option{-mpc80} rounds the significands of results of
12361 floating-point operations to 64 bits (extended double precision), which is
12362 the default.  When this option is used, floating-point operations in higher
12363 precisions are not available to the programmer without setting the FPU
12364 control word explicitly.
12366 Setting the rounding of floating-point operations to less than the default
12367 80 bits can speed some programs by 2% or more.  Note that some mathematical
12368 libraries assume that extended precision (80 bit) floating-point operations
12369 are enabled by default; routines in such libraries could suffer significant
12370 loss of accuracy, typically through so-called "catastrophic cancellation",
12371 when this option is used to set the precision to less than extended precision.
12373 @item -mstackrealign
12374 @opindex mstackrealign
12375 Realign the stack at entry.  On the Intel x86, the @option{-mstackrealign}
12376 option will generate an alternate prologue and epilogue that realigns the
12377 runtime stack if necessary.  This supports mixing legacy codes that keep
12378 a 4-byte aligned stack with modern codes that keep a 16-byte stack for
12379 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
12380 applicable to individual functions.
12382 @item -mpreferred-stack-boundary=@var{num}
12383 @opindex mpreferred-stack-boundary
12384 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
12385 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
12386 the default is 4 (16 bytes or 128 bits).
12388 @item -mincoming-stack-boundary=@var{num}
12389 @opindex mincoming-stack-boundary
12390 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
12391 boundary.  If @option{-mincoming-stack-boundary} is not specified,
12392 the one specified by @option{-mpreferred-stack-boundary} will be used.
12394 On Pentium and PentiumPro, @code{double} and @code{long double} values
12395 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
12396 suffer significant run time performance penalties.  On Pentium III, the
12397 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
12398 properly if it is not 16 byte aligned.
12400 To ensure proper alignment of this values on the stack, the stack boundary
12401 must be as aligned as that required by any value stored on the stack.
12402 Further, every function must be generated such that it keeps the stack
12403 aligned.  Thus calling a function compiled with a higher preferred
12404 stack boundary from a function compiled with a lower preferred stack
12405 boundary will most likely misalign the stack.  It is recommended that
12406 libraries that use callbacks always use the default setting.
12408 This extra alignment does consume extra stack space, and generally
12409 increases code size.  Code that is sensitive to stack space usage, such
12410 as embedded systems and operating system kernels, may want to reduce the
12411 preferred alignment to @option{-mpreferred-stack-boundary=2}.
12413 @item -mmmx
12414 @itemx -mno-mmx
12415 @itemx -msse
12416 @itemx -mno-sse
12417 @itemx -msse2
12418 @itemx -mno-sse2
12419 @itemx -msse3
12420 @itemx -mno-sse3
12421 @itemx -mssse3
12422 @itemx -mno-ssse3
12423 @itemx -msse4.1
12424 @need 800
12425 @itemx -mno-sse4.1
12426 @itemx -msse4.2
12427 @itemx -mno-sse4.2
12428 @itemx -msse4
12429 @itemx -mno-sse4
12430 @itemx -mavx
12431 @itemx -mno-avx
12432 @itemx -maes
12433 @itemx -mno-aes
12434 @itemx -mpclmul
12435 @need 800
12436 @itemx -mno-pclmul
12437 @itemx -mfsgsbase
12438 @itemx -mno-fsgsbase
12439 @itemx -mrdrnd
12440 @itemx -mno-rdrnd
12441 @itemx -mf16c
12442 @itemx -mno-f16c
12443 @itemx -msse4a
12444 @itemx -mno-sse4a
12445 @itemx -mfma4
12446 @need 800
12447 @itemx -mno-fma4
12448 @itemx -mxop
12449 @itemx -mno-xop
12450 @itemx -mlwp
12451 @itemx -mno-lwp
12452 @itemx -m3dnow
12453 @itemx -mno-3dnow
12454 @itemx -mpopcnt
12455 @itemx -mno-popcnt
12456 @itemx -mabm
12457 @itemx -mno-abm
12458 @itemx -mbmi
12459 @itemx -mno-bmi
12460 @itemx -mtbm
12461 @itemx -mno-tbm
12462 @opindex mmmx
12463 @opindex mno-mmx
12464 @opindex msse
12465 @opindex mno-sse
12466 @opindex m3dnow
12467 @opindex mno-3dnow
12468 These switches enable or disable the use of instructions in the MMX,
12469 SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AES, PCLMUL, FSGSBASE, RDRND,
12470 F16C, SSE4A, FMA4, XOP, LWP, ABM, BMI, or 3DNow!@: extended instruction sets.
12471 These extensions are also available as built-in functions: see
12472 @ref{X86 Built-in Functions}, for details of the functions enabled and
12473 disabled by these switches.
12475 To have SSE/SSE2 instructions generated automatically from floating-point
12476 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
12478 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
12479 generates new AVX instructions or AVX equivalence for all SSEx instructions
12480 when needed.
12482 These options will enable GCC to use these extended instructions in
12483 generated code, even without @option{-mfpmath=sse}.  Applications which
12484 perform runtime CPU detection must compile separate files for each
12485 supported architecture, using the appropriate flags.  In particular,
12486 the file containing the CPU detection code should be compiled without
12487 these options.
12489 @item -mfused-madd
12490 @itemx -mno-fused-madd
12491 @opindex mfused-madd
12492 @opindex mno-fused-madd
12493 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
12494 instructions.  The default is to use these instructions.
12496 @item -mcld
12497 @opindex mcld
12498 This option instructs GCC to emit a @code{cld} instruction in the prologue
12499 of functions that use string instructions.  String instructions depend on
12500 the DF flag to select between autoincrement or autodecrement mode.  While the
12501 ABI specifies the DF flag to be cleared on function entry, some operating
12502 systems violate this specification by not clearing the DF flag in their
12503 exception dispatchers.  The exception handler can be invoked with the DF flag
12504 set which leads to wrong direction mode, when string instructions are used.
12505 This option can be enabled by default on 32-bit x86 targets by configuring
12506 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
12507 instructions can be suppressed with the @option{-mno-cld} compiler option
12508 in this case.
12510 @item -mvzeroupper
12511 @opindex mvzeroupper
12512 This option instructs GCC to emit a @code{vzeroupper} instruction
12513 before a transfer of control flow out of the function to minimize
12514 AVX to SSE transition penalty as well as remove unnecessary zeroupper 
12515 intrinsics.
12517 @item -mcx16
12518 @opindex mcx16
12519 This option will enable GCC to use CMPXCHG16B instruction in generated code.
12520 CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
12521 data types.  This is useful for high resolution counters that could be updated
12522 by multiple processors (or cores).  This instruction is generated as part of
12523 atomic built-in functions: see @ref{Atomic Builtins} for details.
12525 @item -msahf
12526 @opindex msahf
12527 This option will enable GCC to use SAHF instruction in generated 64-bit code.
12528 Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
12529 by AMD64 until introduction of Pentium 4 G1 step in December 2005.  LAHF and
12530 SAHF are load and store instructions, respectively, for certain status flags.
12531 In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
12532 or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
12534 @item -mmovbe
12535 @opindex mmovbe
12536 This option will enable GCC to use movbe instruction to implement
12537 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
12539 @item -mcrc32
12540 @opindex mcrc32
12541 This option will enable built-in functions, @code{__builtin_ia32_crc32qi},
12542 @code{__builtin_ia32_crc32hi}. @code{__builtin_ia32_crc32si} and
12543 @code{__builtin_ia32_crc32di} to generate the crc32 machine instruction.
12545 @item -mrecip
12546 @opindex mrecip
12547 This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
12548 vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
12549 to increase precision instead of DIVSS and SQRTSS (and their vectorized
12550 variants) for single precision floating point arguments.  These instructions
12551 are generated only when @option{-funsafe-math-optimizations} is enabled
12552 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
12553 Note that while the throughput of the sequence is higher than the throughput
12554 of the non-reciprocal instruction, the precision of the sequence can be
12555 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
12557 Note that GCC implements 1.0f/sqrtf(x) in terms of RSQRTSS (or RSQRTPS)
12558 already with @option{-ffast-math} (or the above option combination), and
12559 doesn't need @option{-mrecip}.
12561 @item -mveclibabi=@var{type}
12562 @opindex mveclibabi
12563 Specifies the ABI type to use for vectorizing intrinsics using an
12564 external library.  Supported types are @code{svml} for the Intel short
12565 vector math library and @code{acml} for the AMD math core library style
12566 of interfacing.  GCC will currently emit calls to @code{vmldExp2},
12567 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
12568 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
12569 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
12570 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
12571 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
12572 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
12573 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
12574 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
12575 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
12576 function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
12577 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
12578 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
12579 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
12580 @code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
12581 when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
12582 @option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
12583 compatible library will have to be specified at link time.
12585 @item -mabi=@var{name}
12586 @opindex mabi
12587 Generate code for the specified calling convention.  Permissible values
12588 are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
12589 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
12590 ABI when targeting Windows.  On all other systems, the default is the
12591 SYSV ABI.  You can control this behavior for a specific function by
12592 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
12593 @xref{Function Attributes}.
12595 @item -mpush-args
12596 @itemx -mno-push-args
12597 @opindex mpush-args
12598 @opindex mno-push-args
12599 Use PUSH operations to store outgoing parameters.  This method is shorter
12600 and usually equally fast as method using SUB/MOV operations and is enabled
12601 by default.  In some cases disabling it may improve performance because of
12602 improved scheduling and reduced dependencies.
12604 @item -maccumulate-outgoing-args
12605 @opindex maccumulate-outgoing-args
12606 If enabled, the maximum amount of space required for outgoing arguments will be
12607 computed in the function prologue.  This is faster on most modern CPUs
12608 because of reduced dependencies, improved scheduling and reduced stack usage
12609 when preferred stack boundary is not equal to 2.  The drawback is a notable
12610 increase in code size.  This switch implies @option{-mno-push-args}.
12612 @item -mthreads
12613 @opindex mthreads
12614 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
12615 on thread-safe exception handling must compile and link all code with the
12616 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
12617 @option{-D_MT}; when linking, it links in a special thread helper library
12618 @option{-lmingwthrd} which cleans up per thread exception handling data.
12620 @item -mno-align-stringops
12621 @opindex mno-align-stringops
12622 Do not align destination of inlined string operations.  This switch reduces
12623 code size and improves performance in case the destination is already aligned,
12624 but GCC doesn't know about it.
12626 @item -minline-all-stringops
12627 @opindex minline-all-stringops
12628 By default GCC inlines string operations only when destination is known to be
12629 aligned at least to 4 byte boundary.  This enables more inlining, increase code
12630 size, but may improve performance of code that depends on fast memcpy, strlen
12631 and memset for short lengths.
12633 @item -minline-stringops-dynamically
12634 @opindex minline-stringops-dynamically
12635 For string operation of unknown size, inline runtime checks so for small
12636 blocks inline code is used, while for large blocks library call is used.
12638 @item -mstringop-strategy=@var{alg}
12639 @opindex mstringop-strategy=@var{alg}
12640 Overwrite internal decision heuristic about particular algorithm to inline
12641 string operation with.  The allowed values are @code{rep_byte},
12642 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
12643 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
12644 expanding inline loop, @code{libcall} for always expanding library call.
12646 @item -momit-leaf-frame-pointer
12647 @opindex momit-leaf-frame-pointer
12648 Don't keep the frame pointer in a register for leaf functions.  This
12649 avoids the instructions to save, set up and restore frame pointers and
12650 makes an extra register available in leaf functions.  The option
12651 @option{-fomit-frame-pointer} removes the frame pointer for all functions
12652 which might make debugging harder.
12654 @item -mtls-direct-seg-refs
12655 @itemx -mno-tls-direct-seg-refs
12656 @opindex mtls-direct-seg-refs
12657 Controls whether TLS variables may be accessed with offsets from the
12658 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
12659 or whether the thread base pointer must be added.  Whether or not this
12660 is legal depends on the operating system, and whether it maps the
12661 segment to cover the entire TLS area.
12663 For systems that use GNU libc, the default is on.
12665 @item -msse2avx
12666 @itemx -mno-sse2avx
12667 @opindex msse2avx
12668 Specify that the assembler should encode SSE instructions with VEX
12669 prefix.  The option @option{-mavx} turns this on by default.
12671 @item -mfentry
12672 @itemx -mno-fentry
12673 @opindex mfentry
12674 If profiling is active @option{-pg} put the profiling
12675 counter call before prologue.
12676 Note: On x86 architectures the attribute @code{ms_hook_prologue}
12677 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
12679 @item -m8bit-idiv
12680 @itemx -mno-8bit-idiv
12681 @opindex 8bit-idiv
12682 On some processors, like Intel Atom, 8bit unsigned integer divide is
12683 much faster than 32bit/64bit integer divide.  This option will generate a
12684 runt-time check.  If both dividend and divisor are within range of 0
12685 to 255, 8bit unsigned integer divide will be used instead of
12686 32bit/64bit integer divide.
12688 @item -mavx256-split-unaligned-load
12689 @item -mavx256-split-unaligned-store
12690 @opindex avx256-split-unaligned-load
12691 @opindex avx256-split-unaligned-store
12692 Split 32-byte AVX unaligned load and store.
12694 @end table
12696 These @samp{-m} switches are supported in addition to the above
12697 on AMD x86-64 processors in 64-bit environments.
12699 @table @gcctabopt
12700 @item -m32
12701 @itemx -m64
12702 @opindex m32
12703 @opindex m64
12704 Generate code for a 32-bit or 64-bit environment.
12705 The 32-bit environment sets int, long and pointer to 32 bits and
12706 generates code that runs on any i386 system.
12707 The 64-bit environment sets int to 32 bits and long and pointer
12708 to 64 bits and generates code for AMD's x86-64 architecture. For
12709 darwin only the -m64 option turns off the @option{-fno-pic} and
12710 @option{-mdynamic-no-pic} options.
12712 @item -mno-red-zone
12713 @opindex mno-red-zone
12714 Do not use a so called red zone for x86-64 code.  The red zone is mandated
12715 by the x86-64 ABI, it is a 128-byte area beyond the location of the
12716 stack pointer that will not be modified by signal or interrupt handlers
12717 and therefore can be used for temporary data without adjusting the stack
12718 pointer.  The flag @option{-mno-red-zone} disables this red zone.
12720 @item -mcmodel=small
12721 @opindex mcmodel=small
12722 Generate code for the small code model: the program and its symbols must
12723 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
12724 Programs can be statically or dynamically linked.  This is the default
12725 code model.
12727 @item -mcmodel=kernel
12728 @opindex mcmodel=kernel
12729 Generate code for the kernel code model.  The kernel runs in the
12730 negative 2 GB of the address space.
12731 This model has to be used for Linux kernel code.
12733 @item -mcmodel=medium
12734 @opindex mcmodel=medium
12735 Generate code for the medium model: The program is linked in the lower 2
12736 GB of the address space.  Small symbols are also placed there.  Symbols
12737 with sizes larger than @option{-mlarge-data-threshold} are put into
12738 large data or bss sections and can be located above 2GB.  Programs can
12739 be statically or dynamically linked.
12741 @item -mcmodel=large
12742 @opindex mcmodel=large
12743 Generate code for the large model: This model makes no assumptions
12744 about addresses and sizes of sections.
12745 @end table
12747 @node i386 and x86-64 Windows Options
12748 @subsection i386 and x86-64 Windows Options
12749 @cindex i386 and x86-64 Windows Options
12751 These additional options are available for Windows targets:
12753 @table @gcctabopt
12754 @item -mconsole
12755 @opindex mconsole
12756 This option is available for Cygwin and MinGW targets.  It
12757 specifies that a console application is to be generated, by
12758 instructing the linker to set the PE header subsystem type
12759 required for console applications.
12760 This is the default behavior for Cygwin and MinGW targets.
12762 @item -mdll
12763 @opindex mdll
12764 This option is available for Cygwin and MinGW targets.  It
12765 specifies that a DLL - a dynamic link library - is to be
12766 generated, enabling the selection of the required runtime
12767 startup object and entry point.
12769 @item -mnop-fun-dllimport
12770 @opindex mnop-fun-dllimport
12771 This option is available for Cygwin and MinGW targets.  It
12772 specifies that the dllimport attribute should be ignored.
12774 @item -mthread
12775 @opindex mthread
12776 This option is available for MinGW targets. It specifies
12777 that MinGW-specific thread support is to be used.
12779 @item -municode
12780 @opindex municode
12781 This option is available for mingw-w64 targets.  It specifies
12782 that the UNICODE macro is getting pre-defined and that the
12783 unicode capable runtime startup code is chosen.
12785 @item -mwin32
12786 @opindex mwin32
12787 This option is available for Cygwin and MinGW targets.  It
12788 specifies that the typical Windows pre-defined macros are to
12789 be set in the pre-processor, but does not influence the choice
12790 of runtime library/startup code.
12792 @item -mwindows
12793 @opindex mwindows
12794 This option is available for Cygwin and MinGW targets.  It
12795 specifies that a GUI application is to be generated by
12796 instructing the linker to set the PE header subsystem type
12797 appropriately.
12799 @item -fno-set-stack-executable
12800 @opindex fno-set-stack-executable
12801 This option is available for MinGW targets. It specifies that
12802 the executable flag for stack used by nested functions isn't
12803 set. This is necessary for binaries running in kernel mode of
12804 Windows, as there the user32 API, which is used to set executable
12805 privileges, isn't available.
12807 @item -mpe-aligned-commons
12808 @opindex mpe-aligned-commons
12809 This option is available for Cygwin and MinGW targets.  It
12810 specifies that the GNU extension to the PE file format that
12811 permits the correct alignment of COMMON variables should be
12812 used when generating code.  It will be enabled by default if
12813 GCC detects that the target assembler found during configuration
12814 supports the feature.
12815 @end table
12817 See also under @ref{i386 and x86-64 Options} for standard options.
12819 @node IA-64 Options
12820 @subsection IA-64 Options
12821 @cindex IA-64 Options
12823 These are the @samp{-m} options defined for the Intel IA-64 architecture.
12825 @table @gcctabopt
12826 @item -mbig-endian
12827 @opindex mbig-endian
12828 Generate code for a big endian target.  This is the default for HP-UX@.
12830 @item -mlittle-endian
12831 @opindex mlittle-endian
12832 Generate code for a little endian target.  This is the default for AIX5
12833 and GNU/Linux.
12835 @item -mgnu-as
12836 @itemx -mno-gnu-as
12837 @opindex mgnu-as
12838 @opindex mno-gnu-as
12839 Generate (or don't) code for the GNU assembler.  This is the default.
12840 @c Also, this is the default if the configure option @option{--with-gnu-as}
12841 @c is used.
12843 @item -mgnu-ld
12844 @itemx -mno-gnu-ld
12845 @opindex mgnu-ld
12846 @opindex mno-gnu-ld
12847 Generate (or don't) code for the GNU linker.  This is the default.
12848 @c Also, this is the default if the configure option @option{--with-gnu-ld}
12849 @c is used.
12851 @item -mno-pic
12852 @opindex mno-pic
12853 Generate code that does not use a global pointer register.  The result
12854 is not position independent code, and violates the IA-64 ABI@.
12856 @item -mvolatile-asm-stop
12857 @itemx -mno-volatile-asm-stop
12858 @opindex mvolatile-asm-stop
12859 @opindex mno-volatile-asm-stop
12860 Generate (or don't) a stop bit immediately before and after volatile asm
12861 statements.
12863 @item -mregister-names
12864 @itemx -mno-register-names
12865 @opindex mregister-names
12866 @opindex mno-register-names
12867 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
12868 the stacked registers.  This may make assembler output more readable.
12870 @item -mno-sdata
12871 @itemx -msdata
12872 @opindex mno-sdata
12873 @opindex msdata
12874 Disable (or enable) optimizations that use the small data section.  This may
12875 be useful for working around optimizer bugs.
12877 @item -mconstant-gp
12878 @opindex mconstant-gp
12879 Generate code that uses a single constant global pointer value.  This is
12880 useful when compiling kernel code.
12882 @item -mauto-pic
12883 @opindex mauto-pic
12884 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
12885 This is useful when compiling firmware code.
12887 @item -minline-float-divide-min-latency
12888 @opindex minline-float-divide-min-latency
12889 Generate code for inline divides of floating point values
12890 using the minimum latency algorithm.
12892 @item -minline-float-divide-max-throughput
12893 @opindex minline-float-divide-max-throughput
12894 Generate code for inline divides of floating point values
12895 using the maximum throughput algorithm.
12897 @item -mno-inline-float-divide
12898 @opindex mno-inline-float-divide
12899 Do not generate inline code for divides of floating point values.
12901 @item -minline-int-divide-min-latency
12902 @opindex minline-int-divide-min-latency
12903 Generate code for inline divides of integer values
12904 using the minimum latency algorithm.
12906 @item -minline-int-divide-max-throughput
12907 @opindex minline-int-divide-max-throughput
12908 Generate code for inline divides of integer values
12909 using the maximum throughput algorithm.
12911 @item -mno-inline-int-divide
12912 @opindex mno-inline-int-divide
12913 Do not generate inline code for divides of integer values.
12915 @item -minline-sqrt-min-latency
12916 @opindex minline-sqrt-min-latency
12917 Generate code for inline square roots
12918 using the minimum latency algorithm.
12920 @item -minline-sqrt-max-throughput
12921 @opindex minline-sqrt-max-throughput
12922 Generate code for inline square roots
12923 using the maximum throughput algorithm.
12925 @item -mno-inline-sqrt
12926 @opindex mno-inline-sqrt
12927 Do not generate inline code for sqrt.
12929 @item -mfused-madd
12930 @itemx -mno-fused-madd
12931 @opindex mfused-madd
12932 @opindex mno-fused-madd
12933 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
12934 instructions.  The default is to use these instructions.
12936 @item -mno-dwarf2-asm
12937 @itemx -mdwarf2-asm
12938 @opindex mno-dwarf2-asm
12939 @opindex mdwarf2-asm
12940 Don't (or do) generate assembler code for the DWARF2 line number debugging
12941 info.  This may be useful when not using the GNU assembler.
12943 @item -mearly-stop-bits
12944 @itemx -mno-early-stop-bits
12945 @opindex mearly-stop-bits
12946 @opindex mno-early-stop-bits
12947 Allow stop bits to be placed earlier than immediately preceding the
12948 instruction that triggered the stop bit.  This can improve instruction
12949 scheduling, but does not always do so.
12951 @item -mfixed-range=@var{register-range}
12952 @opindex mfixed-range
12953 Generate code treating the given register range as fixed registers.
12954 A fixed register is one that the register allocator can not use.  This is
12955 useful when compiling kernel code.  A register range is specified as
12956 two registers separated by a dash.  Multiple register ranges can be
12957 specified separated by a comma.
12959 @item -mtls-size=@var{tls-size}
12960 @opindex mtls-size
12961 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
12964 @item -mtune=@var{cpu-type}
12965 @opindex mtune
12966 Tune the instruction scheduling for a particular CPU, Valid values are
12967 itanium, itanium1, merced, itanium2, and mckinley.
12969 @item -milp32
12970 @itemx -mlp64
12971 @opindex milp32
12972 @opindex mlp64
12973 Generate code for a 32-bit or 64-bit environment.
12974 The 32-bit environment sets int, long and pointer to 32 bits.
12975 The 64-bit environment sets int to 32 bits and long and pointer
12976 to 64 bits.  These are HP-UX specific flags.
12978 @item -mno-sched-br-data-spec
12979 @itemx -msched-br-data-spec
12980 @opindex mno-sched-br-data-spec
12981 @opindex msched-br-data-spec
12982 (Dis/En)able data speculative scheduling before reload.
12983 This will result in generation of the ld.a instructions and
12984 the corresponding check instructions (ld.c / chk.a).
12985 The default is 'disable'.
12987 @item -msched-ar-data-spec
12988 @itemx -mno-sched-ar-data-spec
12989 @opindex msched-ar-data-spec
12990 @opindex mno-sched-ar-data-spec
12991 (En/Dis)able data speculative scheduling after reload.
12992 This will result in generation of the ld.a instructions and
12993 the corresponding check instructions (ld.c / chk.a).
12994 The default is 'enable'.
12996 @item -mno-sched-control-spec
12997 @itemx -msched-control-spec
12998 @opindex mno-sched-control-spec
12999 @opindex msched-control-spec
13000 (Dis/En)able control speculative scheduling.  This feature is
13001 available only during region scheduling (i.e.@: before reload).
13002 This will result in generation of the ld.s instructions and
13003 the corresponding check instructions chk.s .
13004 The default is 'disable'.
13006 @item -msched-br-in-data-spec
13007 @itemx -mno-sched-br-in-data-spec
13008 @opindex msched-br-in-data-spec
13009 @opindex mno-sched-br-in-data-spec
13010 (En/Dis)able speculative scheduling of the instructions that
13011 are dependent on the data speculative loads before reload.
13012 This is effective only with @option{-msched-br-data-spec} enabled.
13013 The default is 'enable'.
13015 @item -msched-ar-in-data-spec
13016 @itemx -mno-sched-ar-in-data-spec
13017 @opindex msched-ar-in-data-spec
13018 @opindex mno-sched-ar-in-data-spec
13019 (En/Dis)able speculative scheduling of the instructions that
13020 are dependent on the data speculative loads after reload.
13021 This is effective only with @option{-msched-ar-data-spec} enabled.
13022 The default is 'enable'.
13024 @item -msched-in-control-spec
13025 @itemx -mno-sched-in-control-spec
13026 @opindex msched-in-control-spec
13027 @opindex mno-sched-in-control-spec
13028 (En/Dis)able speculative scheduling of the instructions that
13029 are dependent on the control speculative loads.
13030 This is effective only with @option{-msched-control-spec} enabled.
13031 The default is 'enable'.
13033 @item -mno-sched-prefer-non-data-spec-insns
13034 @itemx -msched-prefer-non-data-spec-insns
13035 @opindex mno-sched-prefer-non-data-spec-insns
13036 @opindex msched-prefer-non-data-spec-insns
13037 If enabled, data speculative instructions will be chosen for schedule
13038 only if there are no other choices at the moment.  This will make
13039 the use of the data speculation much more conservative.
13040 The default is 'disable'.
13042 @item -mno-sched-prefer-non-control-spec-insns
13043 @itemx -msched-prefer-non-control-spec-insns
13044 @opindex mno-sched-prefer-non-control-spec-insns
13045 @opindex msched-prefer-non-control-spec-insns
13046 If enabled, control speculative instructions will be chosen for schedule
13047 only if there are no other choices at the moment.  This will make
13048 the use of the control speculation much more conservative.
13049 The default is 'disable'.
13051 @item -mno-sched-count-spec-in-critical-path
13052 @itemx -msched-count-spec-in-critical-path
13053 @opindex mno-sched-count-spec-in-critical-path
13054 @opindex msched-count-spec-in-critical-path
13055 If enabled, speculative dependencies will be considered during
13056 computation of the instructions priorities.  This will make the use of the
13057 speculation a bit more conservative.
13058 The default is 'disable'.
13060 @item -msched-spec-ldc
13061 @opindex msched-spec-ldc
13062 Use a simple data speculation check.  This option is on by default.
13064 @item -msched-control-spec-ldc
13065 @opindex msched-spec-ldc
13066 Use a simple check for control speculation.  This option is on by default.
13068 @item -msched-stop-bits-after-every-cycle
13069 @opindex msched-stop-bits-after-every-cycle
13070 Place a stop bit after every cycle when scheduling.  This option is on
13071 by default.
13073 @item -msched-fp-mem-deps-zero-cost
13074 @opindex msched-fp-mem-deps-zero-cost
13075 Assume that floating-point stores and loads are not likely to cause a conflict
13076 when placed into the same instruction group.  This option is disabled by
13077 default.
13079 @item -msel-sched-dont-check-control-spec
13080 @opindex msel-sched-dont-check-control-spec
13081 Generate checks for control speculation in selective scheduling.
13082 This flag is disabled by default.
13084 @item -msched-max-memory-insns=@var{max-insns}
13085 @opindex msched-max-memory-insns
13086 Limit on the number of memory insns per instruction group, giving lower
13087 priority to subsequent memory insns attempting to schedule in the same
13088 instruction group. Frequently useful to prevent cache bank conflicts.
13089 The default value is 1.
13091 @item -msched-max-memory-insns-hard-limit
13092 @opindex msched-max-memory-insns-hard-limit
13093 Disallow more than `msched-max-memory-insns' in instruction group.
13094 Otherwise, limit is `soft' meaning that we would prefer non-memory operations
13095 when limit is reached but may still schedule memory operations.
13097 @end table
13099 @node IA-64/VMS Options
13100 @subsection IA-64/VMS Options
13102 These @samp{-m} options are defined for the IA-64/VMS implementations:
13104 @table @gcctabopt
13105 @item -mvms-return-codes
13106 @opindex mvms-return-codes
13107 Return VMS condition codes from main. The default is to return POSIX
13108 style condition (e.g.@ error) codes.
13110 @item -mdebug-main=@var{prefix}
13111 @opindex mdebug-main=@var{prefix}
13112 Flag the first routine whose name starts with @var{prefix} as the main
13113 routine for the debugger.
13115 @item -mmalloc64
13116 @opindex mmalloc64
13117 Default to 64bit memory allocation routines.
13118 @end table
13120 @node LM32 Options
13121 @subsection LM32 Options
13122 @cindex LM32 options
13124 These @option{-m} options are defined for the Lattice Mico32 architecture:
13126 @table @gcctabopt
13127 @item -mbarrel-shift-enabled
13128 @opindex mbarrel-shift-enabled
13129 Enable barrel-shift instructions.
13131 @item -mdivide-enabled
13132 @opindex mdivide-enabled
13133 Enable divide and modulus instructions.
13135 @item -mmultiply-enabled
13136 @opindex multiply-enabled
13137 Enable multiply instructions.
13139 @item -msign-extend-enabled
13140 @opindex msign-extend-enabled
13141 Enable sign extend instructions.
13143 @item -muser-enabled
13144 @opindex muser-enabled
13145 Enable user-defined instructions.
13147 @end table
13149 @node M32C Options
13150 @subsection M32C Options
13151 @cindex M32C options
13153 @table @gcctabopt
13154 @item -mcpu=@var{name}
13155 @opindex mcpu=
13156 Select the CPU for which code is generated.  @var{name} may be one of
13157 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
13158 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
13159 the M32C/80 series.
13161 @item -msim
13162 @opindex msim
13163 Specifies that the program will be run on the simulator.  This causes
13164 an alternate runtime library to be linked in which supports, for
13165 example, file I/O@.  You must not use this option when generating
13166 programs that will run on real hardware; you must provide your own
13167 runtime library for whatever I/O functions are needed.
13169 @item -memregs=@var{number}
13170 @opindex memregs=
13171 Specifies the number of memory-based pseudo-registers GCC will use
13172 during code generation.  These pseudo-registers will be used like real
13173 registers, so there is a tradeoff between GCC's ability to fit the
13174 code into available registers, and the performance penalty of using
13175 memory instead of registers.  Note that all modules in a program must
13176 be compiled with the same value for this option.  Because of that, you
13177 must not use this option with the default runtime libraries gcc
13178 builds.
13180 @end table
13182 @node M32R/D Options
13183 @subsection M32R/D Options
13184 @cindex M32R/D options
13186 These @option{-m} options are defined for Renesas M32R/D architectures:
13188 @table @gcctabopt
13189 @item -m32r2
13190 @opindex m32r2
13191 Generate code for the M32R/2@.
13193 @item -m32rx
13194 @opindex m32rx
13195 Generate code for the M32R/X@.
13197 @item -m32r
13198 @opindex m32r
13199 Generate code for the M32R@.  This is the default.
13201 @item -mmodel=small
13202 @opindex mmodel=small
13203 Assume all objects live in the lower 16MB of memory (so that their addresses
13204 can be loaded with the @code{ld24} instruction), and assume all subroutines
13205 are reachable with the @code{bl} instruction.
13206 This is the default.
13208 The addressability of a particular object can be set with the
13209 @code{model} attribute.
13211 @item -mmodel=medium
13212 @opindex mmodel=medium
13213 Assume objects may be anywhere in the 32-bit address space (the compiler
13214 will generate @code{seth/add3} instructions to load their addresses), and
13215 assume all subroutines are reachable with the @code{bl} instruction.
13217 @item -mmodel=large
13218 @opindex mmodel=large
13219 Assume objects may be anywhere in the 32-bit address space (the compiler
13220 will generate @code{seth/add3} instructions to load their addresses), and
13221 assume subroutines may not be reachable with the @code{bl} instruction
13222 (the compiler will generate the much slower @code{seth/add3/jl}
13223 instruction sequence).
13225 @item -msdata=none
13226 @opindex msdata=none
13227 Disable use of the small data area.  Variables will be put into
13228 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
13229 @code{section} attribute has been specified).
13230 This is the default.
13232 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
13233 Objects may be explicitly put in the small data area with the
13234 @code{section} attribute using one of these sections.
13236 @item -msdata=sdata
13237 @opindex msdata=sdata
13238 Put small global and static data in the small data area, but do not
13239 generate special code to reference them.
13241 @item -msdata=use
13242 @opindex msdata=use
13243 Put small global and static data in the small data area, and generate
13244 special instructions to reference them.
13246 @item -G @var{num}
13247 @opindex G
13248 @cindex smaller data references
13249 Put global and static objects less than or equal to @var{num} bytes
13250 into the small data or bss sections instead of the normal data or bss
13251 sections.  The default value of @var{num} is 8.
13252 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
13253 for this option to have any effect.
13255 All modules should be compiled with the same @option{-G @var{num}} value.
13256 Compiling with different values of @var{num} may or may not work; if it
13257 doesn't the linker will give an error message---incorrect code will not be
13258 generated.
13260 @item -mdebug
13261 @opindex mdebug
13262 Makes the M32R specific code in the compiler display some statistics
13263 that might help in debugging programs.
13265 @item -malign-loops
13266 @opindex malign-loops
13267 Align all loops to a 32-byte boundary.
13269 @item -mno-align-loops
13270 @opindex mno-align-loops
13271 Do not enforce a 32-byte alignment for loops.  This is the default.
13273 @item -missue-rate=@var{number}
13274 @opindex missue-rate=@var{number}
13275 Issue @var{number} instructions per cycle.  @var{number} can only be 1
13276 or 2.
13278 @item -mbranch-cost=@var{number}
13279 @opindex mbranch-cost=@var{number}
13280 @var{number} can only be 1 or 2.  If it is 1 then branches will be
13281 preferred over conditional code, if it is 2, then the opposite will
13282 apply.
13284 @item -mflush-trap=@var{number}
13285 @opindex mflush-trap=@var{number}
13286 Specifies the trap number to use to flush the cache.  The default is
13287 12.  Valid numbers are between 0 and 15 inclusive.
13289 @item -mno-flush-trap
13290 @opindex mno-flush-trap
13291 Specifies that the cache cannot be flushed by using a trap.
13293 @item -mflush-func=@var{name}
13294 @opindex mflush-func=@var{name}
13295 Specifies the name of the operating system function to call to flush
13296 the cache.  The default is @emph{_flush_cache}, but a function call
13297 will only be used if a trap is not available.
13299 @item -mno-flush-func
13300 @opindex mno-flush-func
13301 Indicates that there is no OS function for flushing the cache.
13303 @end table
13305 @node M680x0 Options
13306 @subsection M680x0 Options
13307 @cindex M680x0 options
13309 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
13310 The default settings depend on which architecture was selected when
13311 the compiler was configured; the defaults for the most common choices
13312 are given below.
13314 @table @gcctabopt
13315 @item -march=@var{arch}
13316 @opindex march
13317 Generate code for a specific M680x0 or ColdFire instruction set
13318 architecture.  Permissible values of @var{arch} for M680x0
13319 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
13320 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
13321 architectures are selected according to Freescale's ISA classification
13322 and the permissible values are: @samp{isaa}, @samp{isaaplus},
13323 @samp{isab} and @samp{isac}.
13325 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
13326 code for a ColdFire target.  The @var{arch} in this macro is one of the
13327 @option{-march} arguments given above.
13329 When used together, @option{-march} and @option{-mtune} select code
13330 that runs on a family of similar processors but that is optimized
13331 for a particular microarchitecture.
13333 @item -mcpu=@var{cpu}
13334 @opindex mcpu
13335 Generate code for a specific M680x0 or ColdFire processor.
13336 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
13337 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
13338 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
13339 below, which also classifies the CPUs into families:
13341 @multitable @columnfractions 0.20 0.80
13342 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
13343 @item @samp{51} @tab @samp{51} @samp{51ac} @samp{51cn} @samp{51em} @samp{51qe}
13344 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
13345 @item @samp{5206e} @tab @samp{5206e}
13346 @item @samp{5208} @tab @samp{5207} @samp{5208}
13347 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
13348 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
13349 @item @samp{5216} @tab @samp{5214} @samp{5216}
13350 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
13351 @item @samp{5225} @tab @samp{5224} @samp{5225}
13352 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
13353 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
13354 @item @samp{5249} @tab @samp{5249}
13355 @item @samp{5250} @tab @samp{5250}
13356 @item @samp{5271} @tab @samp{5270} @samp{5271}
13357 @item @samp{5272} @tab @samp{5272}
13358 @item @samp{5275} @tab @samp{5274} @samp{5275}
13359 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
13360 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
13361 @item @samp{5307} @tab @samp{5307}
13362 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
13363 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
13364 @item @samp{5407} @tab @samp{5407}
13365 @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}
13366 @end multitable
13368 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
13369 @var{arch} is compatible with @var{cpu}.  Other combinations of
13370 @option{-mcpu} and @option{-march} are rejected.
13372 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
13373 @var{cpu} is selected.  It also defines @samp{__mcf_family_@var{family}},
13374 where the value of @var{family} is given by the table above.
13376 @item -mtune=@var{tune}
13377 @opindex mtune
13378 Tune the code for a particular microarchitecture, within the
13379 constraints set by @option{-march} and @option{-mcpu}.
13380 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
13381 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
13382 and @samp{cpu32}.  The ColdFire microarchitectures
13383 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
13385 You can also use @option{-mtune=68020-40} for code that needs
13386 to run relatively well on 68020, 68030 and 68040 targets.
13387 @option{-mtune=68020-60} is similar but includes 68060 targets
13388 as well.  These two options select the same tuning decisions as
13389 @option{-m68020-40} and @option{-m68020-60} respectively.
13391 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
13392 when tuning for 680x0 architecture @var{arch}.  It also defines
13393 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
13394 option is used.  If gcc is tuning for a range of architectures,
13395 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
13396 it defines the macros for every architecture in the range.
13398 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
13399 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
13400 of the arguments given above.
13402 @item -m68000
13403 @itemx -mc68000
13404 @opindex m68000
13405 @opindex mc68000
13406 Generate output for a 68000.  This is the default
13407 when the compiler is configured for 68000-based systems.
13408 It is equivalent to @option{-march=68000}.
13410 Use this option for microcontrollers with a 68000 or EC000 core,
13411 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
13413 @item -m68010
13414 @opindex m68010
13415 Generate output for a 68010.  This is the default
13416 when the compiler is configured for 68010-based systems.
13417 It is equivalent to @option{-march=68010}.
13419 @item -m68020
13420 @itemx -mc68020
13421 @opindex m68020
13422 @opindex mc68020
13423 Generate output for a 68020.  This is the default
13424 when the compiler is configured for 68020-based systems.
13425 It is equivalent to @option{-march=68020}.
13427 @item -m68030
13428 @opindex m68030
13429 Generate output for a 68030.  This is the default when the compiler is
13430 configured for 68030-based systems.  It is equivalent to
13431 @option{-march=68030}.
13433 @item -m68040
13434 @opindex m68040
13435 Generate output for a 68040.  This is the default when the compiler is
13436 configured for 68040-based systems.  It is equivalent to
13437 @option{-march=68040}.
13439 This option inhibits the use of 68881/68882 instructions that have to be
13440 emulated by software on the 68040.  Use this option if your 68040 does not
13441 have code to emulate those instructions.
13443 @item -m68060
13444 @opindex m68060
13445 Generate output for a 68060.  This is the default when the compiler is
13446 configured for 68060-based systems.  It is equivalent to
13447 @option{-march=68060}.
13449 This option inhibits the use of 68020 and 68881/68882 instructions that
13450 have to be emulated by software on the 68060.  Use this option if your 68060
13451 does not have code to emulate those instructions.
13453 @item -mcpu32
13454 @opindex mcpu32
13455 Generate output for a CPU32.  This is the default
13456 when the compiler is configured for CPU32-based systems.
13457 It is equivalent to @option{-march=cpu32}.
13459 Use this option for microcontrollers with a
13460 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
13461 68336, 68340, 68341, 68349 and 68360.
13463 @item -m5200
13464 @opindex m5200
13465 Generate output for a 520X ColdFire CPU@.  This is the default
13466 when the compiler is configured for 520X-based systems.
13467 It is equivalent to @option{-mcpu=5206}, and is now deprecated
13468 in favor of that option.
13470 Use this option for microcontroller with a 5200 core, including
13471 the MCF5202, MCF5203, MCF5204 and MCF5206.
13473 @item -m5206e
13474 @opindex m5206e
13475 Generate output for a 5206e ColdFire CPU@.  The option is now
13476 deprecated in favor of the equivalent @option{-mcpu=5206e}.
13478 @item -m528x
13479 @opindex m528x
13480 Generate output for a member of the ColdFire 528X family.
13481 The option is now deprecated in favor of the equivalent
13482 @option{-mcpu=528x}.
13484 @item -m5307
13485 @opindex m5307
13486 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
13487 in favor of the equivalent @option{-mcpu=5307}.
13489 @item -m5407
13490 @opindex m5407
13491 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
13492 in favor of the equivalent @option{-mcpu=5407}.
13494 @item -mcfv4e
13495 @opindex mcfv4e
13496 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
13497 This includes use of hardware floating point instructions.
13498 The option is equivalent to @option{-mcpu=547x}, and is now
13499 deprecated in favor of that option.
13501 @item -m68020-40
13502 @opindex m68020-40
13503 Generate output for a 68040, without using any of the new instructions.
13504 This results in code which can run relatively efficiently on either a
13505 68020/68881 or a 68030 or a 68040.  The generated code does use the
13506 68881 instructions that are emulated on the 68040.
13508 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
13510 @item -m68020-60
13511 @opindex m68020-60
13512 Generate output for a 68060, without using any of the new instructions.
13513 This results in code which can run relatively efficiently on either a
13514 68020/68881 or a 68030 or a 68040.  The generated code does use the
13515 68881 instructions that are emulated on the 68060.
13517 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
13519 @item -mhard-float
13520 @itemx -m68881
13521 @opindex mhard-float
13522 @opindex m68881
13523 Generate floating-point instructions.  This is the default for 68020
13524 and above, and for ColdFire devices that have an FPU@.  It defines the
13525 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
13526 on ColdFire targets.
13528 @item -msoft-float
13529 @opindex msoft-float
13530 Do not generate floating-point instructions; use library calls instead.
13531 This is the default for 68000, 68010, and 68832 targets.  It is also
13532 the default for ColdFire devices that have no FPU.
13534 @item -mdiv
13535 @itemx -mno-div
13536 @opindex mdiv
13537 @opindex mno-div
13538 Generate (do not generate) ColdFire hardware divide and remainder
13539 instructions.  If @option{-march} is used without @option{-mcpu},
13540 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
13541 architectures.  Otherwise, the default is taken from the target CPU
13542 (either the default CPU, or the one specified by @option{-mcpu}).  For
13543 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
13544 @option{-mcpu=5206e}.
13546 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
13548 @item -mshort
13549 @opindex mshort
13550 Consider type @code{int} to be 16 bits wide, like @code{short int}.
13551 Additionally, parameters passed on the stack are also aligned to a
13552 16-bit boundary even on targets whose API mandates promotion to 32-bit.
13554 @item -mno-short
13555 @opindex mno-short
13556 Do not consider type @code{int} to be 16 bits wide.  This is the default.
13558 @item -mnobitfield
13559 @itemx -mno-bitfield
13560 @opindex mnobitfield
13561 @opindex mno-bitfield
13562 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
13563 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
13565 @item -mbitfield
13566 @opindex mbitfield
13567 Do use the bit-field instructions.  The @option{-m68020} option implies
13568 @option{-mbitfield}.  This is the default if you use a configuration
13569 designed for a 68020.
13571 @item -mrtd
13572 @opindex mrtd
13573 Use a different function-calling convention, in which functions
13574 that take a fixed number of arguments return with the @code{rtd}
13575 instruction, which pops their arguments while returning.  This
13576 saves one instruction in the caller since there is no need to pop
13577 the arguments there.
13579 This calling convention is incompatible with the one normally
13580 used on Unix, so you cannot use it if you need to call libraries
13581 compiled with the Unix compiler.
13583 Also, you must provide function prototypes for all functions that
13584 take variable numbers of arguments (including @code{printf});
13585 otherwise incorrect code will be generated for calls to those
13586 functions.
13588 In addition, seriously incorrect code will result if you call a
13589 function with too many arguments.  (Normally, extra arguments are
13590 harmlessly ignored.)
13592 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
13593 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
13595 @item -mno-rtd
13596 @opindex mno-rtd
13597 Do not use the calling conventions selected by @option{-mrtd}.
13598 This is the default.
13600 @item -malign-int
13601 @itemx -mno-align-int
13602 @opindex malign-int
13603 @opindex mno-align-int
13604 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
13605 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
13606 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
13607 Aligning variables on 32-bit boundaries produces code that runs somewhat
13608 faster on processors with 32-bit busses at the expense of more memory.
13610 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
13611 align structures containing the above types  differently than
13612 most published application binary interface specifications for the m68k.
13614 @item -mpcrel
13615 @opindex mpcrel
13616 Use the pc-relative addressing mode of the 68000 directly, instead of
13617 using a global offset table.  At present, this option implies @option{-fpic},
13618 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
13619 not presently supported with @option{-mpcrel}, though this could be supported for
13620 68020 and higher processors.
13622 @item -mno-strict-align
13623 @itemx -mstrict-align
13624 @opindex mno-strict-align
13625 @opindex mstrict-align
13626 Do not (do) assume that unaligned memory references will be handled by
13627 the system.
13629 @item -msep-data
13630 Generate code that allows the data segment to be located in a different
13631 area of memory from the text segment.  This allows for execute in place in
13632 an environment without virtual memory management.  This option implies
13633 @option{-fPIC}.
13635 @item -mno-sep-data
13636 Generate code that assumes that the data segment follows the text segment.
13637 This is the default.
13639 @item -mid-shared-library
13640 Generate code that supports shared libraries via the library ID method.
13641 This allows for execute in place and shared libraries in an environment
13642 without virtual memory management.  This option implies @option{-fPIC}.
13644 @item -mno-id-shared-library
13645 Generate code that doesn't assume ID based shared libraries are being used.
13646 This is the default.
13648 @item -mshared-library-id=n
13649 Specified the identification number of the ID based shared library being
13650 compiled.  Specifying a value of 0 will generate more compact code, specifying
13651 other values will force the allocation of that number to the current
13652 library but is no more space or time efficient than omitting this option.
13654 @item -mxgot
13655 @itemx -mno-xgot
13656 @opindex mxgot
13657 @opindex mno-xgot
13658 When generating position-independent code for ColdFire, generate code
13659 that works if the GOT has more than 8192 entries.  This code is
13660 larger and slower than code generated without this option.  On M680x0
13661 processors, this option is not needed; @option{-fPIC} suffices.
13663 GCC normally uses a single instruction to load values from the GOT@.
13664 While this is relatively efficient, it only works if the GOT
13665 is smaller than about 64k.  Anything larger causes the linker
13666 to report an error such as:
13668 @cindex relocation truncated to fit (ColdFire)
13669 @smallexample
13670 relocation truncated to fit: R_68K_GOT16O foobar
13671 @end smallexample
13673 If this happens, you should recompile your code with @option{-mxgot}.
13674 It should then work with very large GOTs.  However, code generated with
13675 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
13676 the value of a global symbol.
13678 Note that some linkers, including newer versions of the GNU linker,
13679 can create multiple GOTs and sort GOT entries.  If you have such a linker,
13680 you should only need to use @option{-mxgot} when compiling a single
13681 object file that accesses more than 8192 GOT entries.  Very few do.
13683 These options have no effect unless GCC is generating
13684 position-independent code.
13686 @end table
13688 @node MCore Options
13689 @subsection MCore Options
13690 @cindex MCore options
13692 These are the @samp{-m} options defined for the Motorola M*Core
13693 processors.
13695 @table @gcctabopt
13697 @item -mhardlit
13698 @itemx -mno-hardlit
13699 @opindex mhardlit
13700 @opindex mno-hardlit
13701 Inline constants into the code stream if it can be done in two
13702 instructions or less.
13704 @item -mdiv
13705 @itemx -mno-div
13706 @opindex mdiv
13707 @opindex mno-div
13708 Use the divide instruction.  (Enabled by default).
13710 @item -mrelax-immediate
13711 @itemx -mno-relax-immediate
13712 @opindex mrelax-immediate
13713 @opindex mno-relax-immediate
13714 Allow arbitrary sized immediates in bit operations.
13716 @item -mwide-bitfields
13717 @itemx -mno-wide-bitfields
13718 @opindex mwide-bitfields
13719 @opindex mno-wide-bitfields
13720 Always treat bit-fields as int-sized.
13722 @item -m4byte-functions
13723 @itemx -mno-4byte-functions
13724 @opindex m4byte-functions
13725 @opindex mno-4byte-functions
13726 Force all functions to be aligned to a four byte boundary.
13728 @item -mcallgraph-data
13729 @itemx -mno-callgraph-data
13730 @opindex mcallgraph-data
13731 @opindex mno-callgraph-data
13732 Emit callgraph information.
13734 @item -mslow-bytes
13735 @itemx -mno-slow-bytes
13736 @opindex mslow-bytes
13737 @opindex mno-slow-bytes
13738 Prefer word access when reading byte quantities.
13740 @item -mlittle-endian
13741 @itemx -mbig-endian
13742 @opindex mlittle-endian
13743 @opindex mbig-endian
13744 Generate code for a little endian target.
13746 @item -m210
13747 @itemx -m340
13748 @opindex m210
13749 @opindex m340
13750 Generate code for the 210 processor.
13752 @item -mno-lsim
13753 @opindex mno-lsim
13754 Assume that run-time support has been provided and so omit the
13755 simulator library (@file{libsim.a)} from the linker command line.
13757 @item -mstack-increment=@var{size}
13758 @opindex mstack-increment
13759 Set the maximum amount for a single stack increment operation.  Large
13760 values can increase the speed of programs which contain functions
13761 that need a large amount of stack space, but they can also trigger a
13762 segmentation fault if the stack is extended too much.  The default
13763 value is 0x1000.
13765 @end table
13767 @node MeP Options
13768 @subsection MeP Options
13769 @cindex MeP options
13771 @table @gcctabopt
13773 @item -mabsdiff
13774 @opindex mabsdiff
13775 Enables the @code{abs} instruction, which is the absolute difference
13776 between two registers.
13778 @item -mall-opts
13779 @opindex mall-opts
13780 Enables all the optional instructions - average, multiply, divide, bit
13781 operations, leading zero, absolute difference, min/max, clip, and
13782 saturation.
13785 @item -maverage
13786 @opindex maverage
13787 Enables the @code{ave} instruction, which computes the average of two
13788 registers.
13790 @item -mbased=@var{n}
13791 @opindex mbased=
13792 Variables of size @var{n} bytes or smaller will be placed in the
13793 @code{.based} section by default.  Based variables use the @code{$tp}
13794 register as a base register, and there is a 128 byte limit to the
13795 @code{.based} section.
13797 @item -mbitops
13798 @opindex mbitops
13799 Enables the bit operation instructions - bit test (@code{btstm}), set
13800 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
13801 test-and-set (@code{tas}).
13803 @item -mc=@var{name}
13804 @opindex mc=
13805 Selects which section constant data will be placed in.  @var{name} may
13806 be @code{tiny}, @code{near}, or @code{far}.
13808 @item -mclip
13809 @opindex mclip
13810 Enables the @code{clip} instruction.  Note that @code{-mclip} is not
13811 useful unless you also provide @code{-mminmax}.
13813 @item -mconfig=@var{name}
13814 @opindex mconfig=
13815 Selects one of the build-in core configurations.  Each MeP chip has
13816 one or more modules in it; each module has a core CPU and a variety of
13817 coprocessors, optional instructions, and peripherals.  The
13818 @code{MeP-Integrator} tool, not part of GCC, provides these
13819 configurations through this option; using this option is the same as
13820 using all the corresponding command line options.  The default
13821 configuration is @code{default}.
13823 @item -mcop
13824 @opindex mcop
13825 Enables the coprocessor instructions.  By default, this is a 32-bit
13826 coprocessor.  Note that the coprocessor is normally enabled via the
13827 @code{-mconfig=} option.
13829 @item -mcop32
13830 @opindex mcop32
13831 Enables the 32-bit coprocessor's instructions.
13833 @item -mcop64
13834 @opindex mcop64
13835 Enables the 64-bit coprocessor's instructions.
13837 @item -mivc2
13838 @opindex mivc2
13839 Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
13841 @item -mdc
13842 @opindex mdc
13843 Causes constant variables to be placed in the @code{.near} section.
13845 @item -mdiv
13846 @opindex mdiv
13847 Enables the @code{div} and @code{divu} instructions.
13849 @item -meb
13850 @opindex meb
13851 Generate big-endian code.
13853 @item -mel
13854 @opindex mel
13855 Generate little-endian code.
13857 @item -mio-volatile
13858 @opindex mio-volatile
13859 Tells the compiler that any variable marked with the @code{io}
13860 attribute is to be considered volatile.
13862 @item -ml
13863 @opindex ml
13864 Causes variables to be assigned to the @code{.far} section by default.
13866 @item -mleadz
13867 @opindex mleadz
13868 Enables the @code{leadz} (leading zero) instruction.
13870 @item -mm
13871 @opindex mm
13872 Causes variables to be assigned to the @code{.near} section by default.
13874 @item -mminmax
13875 @opindex mminmax
13876 Enables the @code{min} and @code{max} instructions.
13878 @item -mmult
13879 @opindex mmult
13880 Enables the multiplication and multiply-accumulate instructions.
13882 @item -mno-opts
13883 @opindex mno-opts
13884 Disables all the optional instructions enabled by @code{-mall-opts}.
13886 @item -mrepeat
13887 @opindex mrepeat
13888 Enables the @code{repeat} and @code{erepeat} instructions, used for
13889 low-overhead looping.
13891 @item -ms
13892 @opindex ms
13893 Causes all variables to default to the @code{.tiny} section.  Note
13894 that there is a 65536 byte limit to this section.  Accesses to these
13895 variables use the @code{%gp} base register.
13897 @item -msatur
13898 @opindex msatur
13899 Enables the saturation instructions.  Note that the compiler does not
13900 currently generate these itself, but this option is included for
13901 compatibility with other tools, like @code{as}.
13903 @item -msdram
13904 @opindex msdram
13905 Link the SDRAM-based runtime instead of the default ROM-based runtime.
13907 @item -msim
13908 @opindex msim
13909 Link the simulator runtime libraries.
13911 @item -msimnovec
13912 @opindex msimnovec
13913 Link the simulator runtime libraries, excluding built-in support
13914 for reset and exception vectors and tables.
13916 @item -mtf
13917 @opindex mtf
13918 Causes all functions to default to the @code{.far} section.  Without
13919 this option, functions default to the @code{.near} section.
13921 @item -mtiny=@var{n}
13922 @opindex mtiny=
13923 Variables that are @var{n} bytes or smaller will be allocated to the
13924 @code{.tiny} section.  These variables use the @code{$gp} base
13925 register.  The default for this option is 4, but note that there's a
13926 65536 byte limit to the @code{.tiny} section.
13928 @end table
13930 @node MicroBlaze Options
13931 @subsection MicroBlaze Options
13932 @cindex MicroBlaze Options
13934 @table @gcctabopt
13936 @item -msoft-float
13937 @opindex msoft-float
13938 Use software emulation for floating point (default).
13940 @item -mhard-float
13941 @opindex mhard-float
13942 Use hardware floating point instructions.
13944 @item -mmemcpy
13945 @opindex mmemcpy
13946 Do not optimize block moves, use @code{memcpy}.
13948 @item -mno-clearbss
13949 @opindex mno-clearbss
13950 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
13952 @item -mcpu=@var{cpu-type}
13953 @opindex mcpu=
13954 Use features of and schedule code for given CPU.
13955 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 
13956 where @var{X} is a major version, @var{YY} is the minor version, and 
13957 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
13958 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}. 
13960 @item -mxl-soft-mul
13961 @opindex mxl-soft-mul
13962 Use software multiply emulation (default).
13964 @item -mxl-soft-div
13965 @opindex mxl-soft-div
13966 Use software emulation for divides (default).
13968 @item -mxl-barrel-shift
13969 @opindex mxl-barrel-shift
13970 Use the hardware barrel shifter.
13972 @item -mxl-pattern-compare
13973 @opindex mxl-pattern-compare
13974 Use pattern compare instructions.
13976 @item -msmall-divides
13977 @opindex msmall-divides
13978 Use table lookup optimization for small signed integer divisions.
13980 @item -mxl-stack-check
13981 @opindex mxl-stack-check
13982 This option is deprecated.  Use -fstack-check instead.
13984 @item -mxl-gp-opt
13985 @opindex mxl-gp-opt
13986 Use GP relative sdata/sbss sections.
13988 @item -mxl-multiply-high
13989 @opindex mxl-multiply-high
13990 Use multiply high instructions for high part of 32x32 multiply.
13992 @item -mxl-float-convert
13993 @opindex mxl-float-convert
13994 Use hardware floating point conversion instructions.
13996 @item -mxl-float-sqrt
13997 @opindex mxl-float-sqrt
13998 Use hardware floating point square root instruction.
14000 @item -mxl-mode-@var{app-model}
14001 Select application model @var{app-model}.  Valid models are 
14002 @table @samp
14003 @item executable
14004 normal executable (default), uses startup code @file{crt0.o}.
14006 @item xmdstub
14007 for use with Xilinx Microprocessor Debugger (XMD) based 
14008 software intrusive debug agent called xmdstub. This uses startup file 
14009 @file{crt1.o} and sets the start address of the program to be 0x800.
14011 @item bootstrap
14012 for applications that are loaded using a bootloader.
14013 This model uses startup file @file{crt2.o} which does not contain a processor 
14014 reset vector handler. This is suitable for transferring control on a 
14015 processor reset to the bootloader rather than the application.
14017 @item novectors
14018 for applications that do not require any of the 
14019 MicroBlaze vectors. This option may be useful for applications running
14020 within a monitoring application. This model uses @file{crt3.o} as a startup file.
14021 @end table
14023 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 
14024 @option{-mxl-mode-@var{app-model}}.
14026 @end table
14028 @node MIPS Options
14029 @subsection MIPS Options
14030 @cindex MIPS options
14032 @table @gcctabopt
14034 @item -EB
14035 @opindex EB
14036 Generate big-endian code.
14038 @item -EL
14039 @opindex EL
14040 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
14041 configurations.
14043 @item -march=@var{arch}
14044 @opindex march
14045 Generate code that will run on @var{arch}, which can be the name of a
14046 generic MIPS ISA, or the name of a particular processor.
14047 The ISA names are:
14048 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
14049 @samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
14050 The processor names are:
14051 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
14052 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
14053 @samp{5kc}, @samp{5kf},
14054 @samp{20kc},
14055 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
14056 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
14057 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
14058 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
14059 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
14060 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
14061 @samp{m4k},
14062 @samp{octeon},
14063 @samp{orion},
14064 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
14065 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
14066 @samp{rm7000}, @samp{rm9000},
14067 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
14068 @samp{sb1},
14069 @samp{sr71000},
14070 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
14071 @samp{vr5000}, @samp{vr5400}, @samp{vr5500}
14072 and @samp{xlr}.
14073 The special value @samp{from-abi} selects the
14074 most compatible architecture for the selected ABI (that is,
14075 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
14077 Native Linux/GNU toolchains also support the value @samp{native},
14078 which selects the best architecture option for the host processor.
14079 @option{-march=native} has no effect if GCC does not recognize
14080 the processor.
14082 In processor names, a final @samp{000} can be abbreviated as @samp{k}
14083 (for example, @samp{-march=r2k}).  Prefixes are optional, and
14084 @samp{vr} may be written @samp{r}.
14086 Names of the form @samp{@var{n}f2_1} refer to processors with
14087 FPUs clocked at half the rate of the core, names of the form
14088 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
14089 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
14090 processors with FPUs clocked a ratio of 3:2 with respect to the core.
14091 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
14092 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
14093 accepted as synonyms for @samp{@var{n}f1_1}.
14095 GCC defines two macros based on the value of this option.  The first
14096 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
14097 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
14098 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
14099 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
14100 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
14102 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
14103 above.  In other words, it will have the full prefix and will not
14104 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
14105 the macro names the resolved architecture (either @samp{"mips1"} or
14106 @samp{"mips3"}).  It names the default architecture when no
14107 @option{-march} option is given.
14109 @item -mtune=@var{arch}
14110 @opindex mtune
14111 Optimize for @var{arch}.  Among other things, this option controls
14112 the way instructions are scheduled, and the perceived cost of arithmetic
14113 operations.  The list of @var{arch} values is the same as for
14114 @option{-march}.
14116 When this option is not used, GCC will optimize for the processor
14117 specified by @option{-march}.  By using @option{-march} and
14118 @option{-mtune} together, it is possible to generate code that will
14119 run on a family of processors, but optimize the code for one
14120 particular member of that family.
14122 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
14123 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
14124 @samp{-march} ones described above.
14126 @item -mips1
14127 @opindex mips1
14128 Equivalent to @samp{-march=mips1}.
14130 @item -mips2
14131 @opindex mips2
14132 Equivalent to @samp{-march=mips2}.
14134 @item -mips3
14135 @opindex mips3
14136 Equivalent to @samp{-march=mips3}.
14138 @item -mips4
14139 @opindex mips4
14140 Equivalent to @samp{-march=mips4}.
14142 @item -mips32
14143 @opindex mips32
14144 Equivalent to @samp{-march=mips32}.
14146 @item -mips32r2
14147 @opindex mips32r2
14148 Equivalent to @samp{-march=mips32r2}.
14150 @item -mips64
14151 @opindex mips64
14152 Equivalent to @samp{-march=mips64}.
14154 @item -mips64r2
14155 @opindex mips64r2
14156 Equivalent to @samp{-march=mips64r2}.
14158 @item -mips16
14159 @itemx -mno-mips16
14160 @opindex mips16
14161 @opindex mno-mips16
14162 Generate (do not generate) MIPS16 code.  If GCC is targetting a
14163 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
14165 MIPS16 code generation can also be controlled on a per-function basis
14166 by means of @code{mips16} and @code{nomips16} attributes.
14167 @xref{Function Attributes}, for more information.
14169 @item -mflip-mips16
14170 @opindex mflip-mips16
14171 Generate MIPS16 code on alternating functions.  This option is provided
14172 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
14173 not intended for ordinary use in compiling user code.
14175 @item -minterlink-mips16
14176 @itemx -mno-interlink-mips16
14177 @opindex minterlink-mips16
14178 @opindex mno-interlink-mips16
14179 Require (do not require) that non-MIPS16 code be link-compatible with
14180 MIPS16 code.
14182 For example, non-MIPS16 code cannot jump directly to MIPS16 code;
14183 it must either use a call or an indirect jump.  @option{-minterlink-mips16}
14184 therefore disables direct jumps unless GCC knows that the target of the
14185 jump is not MIPS16.
14187 @item -mabi=32
14188 @itemx -mabi=o64
14189 @itemx -mabi=n32
14190 @itemx -mabi=64
14191 @itemx -mabi=eabi
14192 @opindex mabi=32
14193 @opindex mabi=o64
14194 @opindex mabi=n32
14195 @opindex mabi=64
14196 @opindex mabi=eabi
14197 Generate code for the given ABI@.
14199 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
14200 generates 64-bit code when you select a 64-bit architecture, but you
14201 can use @option{-mgp32} to get 32-bit code instead.
14203 For information about the O64 ABI, see
14204 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
14206 GCC supports a variant of the o32 ABI in which floating-point registers
14207 are 64 rather than 32 bits wide.  You can select this combination with
14208 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @samp{mthc1}
14209 and @samp{mfhc1} instructions and is therefore only supported for
14210 MIPS32R2 processors.
14212 The register assignments for arguments and return values remain the
14213 same, but each scalar value is passed in a single 64-bit register
14214 rather than a pair of 32-bit registers.  For example, scalar
14215 floating-point values are returned in @samp{$f0} only, not a
14216 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
14217 remains the same, but all 64 bits are saved.
14219 @item -mabicalls
14220 @itemx -mno-abicalls
14221 @opindex mabicalls
14222 @opindex mno-abicalls
14223 Generate (do not generate) code that is suitable for SVR4-style
14224 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
14225 systems.
14227 @item -mshared
14228 @itemx -mno-shared
14229 Generate (do not generate) code that is fully position-independent,
14230 and that can therefore be linked into shared libraries.  This option
14231 only affects @option{-mabicalls}.
14233 All @option{-mabicalls} code has traditionally been position-independent,
14234 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
14235 as an extension, the GNU toolchain allows executables to use absolute
14236 accesses for locally-binding symbols.  It can also use shorter GP
14237 initialization sequences and generate direct calls to locally-defined
14238 functions.  This mode is selected by @option{-mno-shared}.
14240 @option{-mno-shared} depends on binutils 2.16 or higher and generates
14241 objects that can only be linked by the GNU linker.  However, the option
14242 does not affect the ABI of the final executable; it only affects the ABI
14243 of relocatable objects.  Using @option{-mno-shared} will generally make
14244 executables both smaller and quicker.
14246 @option{-mshared} is the default.
14248 @item -mplt
14249 @itemx -mno-plt
14250 @opindex mplt
14251 @opindex mno-plt
14252 Assume (do not assume) that the static and dynamic linkers
14253 support PLTs and copy relocations.  This option only affects
14254 @samp{-mno-shared -mabicalls}.  For the n64 ABI, this option
14255 has no effect without @samp{-msym32}.
14257 You can make @option{-mplt} the default by configuring
14258 GCC with @option{--with-mips-plt}.  The default is
14259 @option{-mno-plt} otherwise.
14261 @item -mxgot
14262 @itemx -mno-xgot
14263 @opindex mxgot
14264 @opindex mno-xgot
14265 Lift (do not lift) the usual restrictions on the size of the global
14266 offset table.
14268 GCC normally uses a single instruction to load values from the GOT@.
14269 While this is relatively efficient, it will only work if the GOT
14270 is smaller than about 64k.  Anything larger will cause the linker
14271 to report an error such as:
14273 @cindex relocation truncated to fit (MIPS)
14274 @smallexample
14275 relocation truncated to fit: R_MIPS_GOT16 foobar
14276 @end smallexample
14278 If this happens, you should recompile your code with @option{-mxgot}.
14279 It should then work with very large GOTs, although it will also be
14280 less efficient, since it will take three instructions to fetch the
14281 value of a global symbol.
14283 Note that some linkers can create multiple GOTs.  If you have such a
14284 linker, you should only need to use @option{-mxgot} when a single object
14285 file accesses more than 64k's worth of GOT entries.  Very few do.
14287 These options have no effect unless GCC is generating position
14288 independent code.
14290 @item -mgp32
14291 @opindex mgp32
14292 Assume that general-purpose registers are 32 bits wide.
14294 @item -mgp64
14295 @opindex mgp64
14296 Assume that general-purpose registers are 64 bits wide.
14298 @item -mfp32
14299 @opindex mfp32
14300 Assume that floating-point registers are 32 bits wide.
14302 @item -mfp64
14303 @opindex mfp64
14304 Assume that floating-point registers are 64 bits wide.
14306 @item -mhard-float
14307 @opindex mhard-float
14308 Use floating-point coprocessor instructions.
14310 @item -msoft-float
14311 @opindex msoft-float
14312 Do not use floating-point coprocessor instructions.  Implement
14313 floating-point calculations using library calls instead.
14315 @item -msingle-float
14316 @opindex msingle-float
14317 Assume that the floating-point coprocessor only supports single-precision
14318 operations.
14320 @item -mdouble-float
14321 @opindex mdouble-float
14322 Assume that the floating-point coprocessor supports double-precision
14323 operations.  This is the default.
14325 @item -mllsc
14326 @itemx -mno-llsc
14327 @opindex mllsc
14328 @opindex mno-llsc
14329 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
14330 implement atomic memory built-in functions.  When neither option is
14331 specified, GCC will use the instructions if the target architecture
14332 supports them.
14334 @option{-mllsc} is useful if the runtime environment can emulate the
14335 instructions and @option{-mno-llsc} can be useful when compiling for
14336 nonstandard ISAs.  You can make either option the default by
14337 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
14338 respectively.  @option{--with-llsc} is the default for some
14339 configurations; see the installation documentation for details.
14341 @item -mdsp
14342 @itemx -mno-dsp
14343 @opindex mdsp
14344 @opindex mno-dsp
14345 Use (do not use) revision 1 of the MIPS DSP ASE@.
14346 @xref{MIPS DSP Built-in Functions}.  This option defines the
14347 preprocessor macro @samp{__mips_dsp}.  It also defines
14348 @samp{__mips_dsp_rev} to 1.
14350 @item -mdspr2
14351 @itemx -mno-dspr2
14352 @opindex mdspr2
14353 @opindex mno-dspr2
14354 Use (do not use) revision 2 of the MIPS DSP ASE@.
14355 @xref{MIPS DSP Built-in Functions}.  This option defines the
14356 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
14357 It also defines @samp{__mips_dsp_rev} to 2.
14359 @item -msmartmips
14360 @itemx -mno-smartmips
14361 @opindex msmartmips
14362 @opindex mno-smartmips
14363 Use (do not use) the MIPS SmartMIPS ASE.
14365 @item -mpaired-single
14366 @itemx -mno-paired-single
14367 @opindex mpaired-single
14368 @opindex mno-paired-single
14369 Use (do not use) paired-single floating-point instructions.
14370 @xref{MIPS Paired-Single Support}.  This option requires
14371 hardware floating-point support to be enabled.
14373 @item -mdmx
14374 @itemx -mno-mdmx
14375 @opindex mdmx
14376 @opindex mno-mdmx
14377 Use (do not use) MIPS Digital Media Extension instructions.
14378 This option can only be used when generating 64-bit code and requires
14379 hardware floating-point support to be enabled.
14381 @item -mips3d
14382 @itemx -mno-mips3d
14383 @opindex mips3d
14384 @opindex mno-mips3d
14385 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
14386 The option @option{-mips3d} implies @option{-mpaired-single}.
14388 @item -mmt
14389 @itemx -mno-mt
14390 @opindex mmt
14391 @opindex mno-mt
14392 Use (do not use) MT Multithreading instructions.
14394 @item -mlong64
14395 @opindex mlong64
14396 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
14397 an explanation of the default and the way that the pointer size is
14398 determined.
14400 @item -mlong32
14401 @opindex mlong32
14402 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
14404 The default size of @code{int}s, @code{long}s and pointers depends on
14405 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
14406 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
14407 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
14408 or the same size as integer registers, whichever is smaller.
14410 @item -msym32
14411 @itemx -mno-sym32
14412 @opindex msym32
14413 @opindex mno-sym32
14414 Assume (do not assume) that all symbols have 32-bit values, regardless
14415 of the selected ABI@.  This option is useful in combination with
14416 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
14417 to generate shorter and faster references to symbolic addresses.
14419 @item -G @var{num}
14420 @opindex G
14421 Put definitions of externally-visible data in a small data section
14422 if that data is no bigger than @var{num} bytes.  GCC can then access
14423 the data more efficiently; see @option{-mgpopt} for details.
14425 The default @option{-G} option depends on the configuration.
14427 @item -mlocal-sdata
14428 @itemx -mno-local-sdata
14429 @opindex mlocal-sdata
14430 @opindex mno-local-sdata
14431 Extend (do not extend) the @option{-G} behavior to local data too,
14432 such as to static variables in C@.  @option{-mlocal-sdata} is the
14433 default for all configurations.
14435 If the linker complains that an application is using too much small data,
14436 you might want to try rebuilding the less performance-critical parts with
14437 @option{-mno-local-sdata}.  You might also want to build large
14438 libraries with @option{-mno-local-sdata}, so that the libraries leave
14439 more room for the main program.
14441 @item -mextern-sdata
14442 @itemx -mno-extern-sdata
14443 @opindex mextern-sdata
14444 @opindex mno-extern-sdata
14445 Assume (do not assume) that externally-defined data will be in
14446 a small data section if that data is within the @option{-G} limit.
14447 @option{-mextern-sdata} is the default for all configurations.
14449 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
14450 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
14451 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
14452 is placed in a small data section.  If @var{Var} is defined by another
14453 module, you must either compile that module with a high-enough
14454 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
14455 definition.  If @var{Var} is common, you must link the application
14456 with a high-enough @option{-G} setting.
14458 The easiest way of satisfying these restrictions is to compile
14459 and link every module with the same @option{-G} option.  However,
14460 you may wish to build a library that supports several different
14461 small data limits.  You can do this by compiling the library with
14462 the highest supported @option{-G} setting and additionally using
14463 @option{-mno-extern-sdata} to stop the library from making assumptions
14464 about externally-defined data.
14466 @item -mgpopt
14467 @itemx -mno-gpopt
14468 @opindex mgpopt
14469 @opindex mno-gpopt
14470 Use (do not use) GP-relative accesses for symbols that are known to be
14471 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
14472 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
14473 configurations.
14475 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
14476 might not hold the value of @code{_gp}.  For example, if the code is
14477 part of a library that might be used in a boot monitor, programs that
14478 call boot monitor routines will pass an unknown value in @code{$gp}.
14479 (In such situations, the boot monitor itself would usually be compiled
14480 with @option{-G0}.)
14482 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
14483 @option{-mno-extern-sdata}.
14485 @item -membedded-data
14486 @itemx -mno-embedded-data
14487 @opindex membedded-data
14488 @opindex mno-embedded-data
14489 Allocate variables to the read-only data section first if possible, then
14490 next in the small data section if possible, otherwise in data.  This gives
14491 slightly slower code than the default, but reduces the amount of RAM required
14492 when executing, and thus may be preferred for some embedded systems.
14494 @item -muninit-const-in-rodata
14495 @itemx -mno-uninit-const-in-rodata
14496 @opindex muninit-const-in-rodata
14497 @opindex mno-uninit-const-in-rodata
14498 Put uninitialized @code{const} variables in the read-only data section.
14499 This option is only meaningful in conjunction with @option{-membedded-data}.
14501 @item -mcode-readable=@var{setting}
14502 @opindex mcode-readable
14503 Specify whether GCC may generate code that reads from executable sections.
14504 There are three possible settings:
14506 @table @gcctabopt
14507 @item -mcode-readable=yes
14508 Instructions may freely access executable sections.  This is the
14509 default setting.
14511 @item -mcode-readable=pcrel
14512 MIPS16 PC-relative load instructions can access executable sections,
14513 but other instructions must not do so.  This option is useful on 4KSc
14514 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
14515 It is also useful on processors that can be configured to have a dual
14516 instruction/data SRAM interface and that, like the M4K, automatically
14517 redirect PC-relative loads to the instruction RAM.
14519 @item -mcode-readable=no
14520 Instructions must not access executable sections.  This option can be
14521 useful on targets that are configured to have a dual instruction/data
14522 SRAM interface but that (unlike the M4K) do not automatically redirect
14523 PC-relative loads to the instruction RAM.
14524 @end table
14526 @item -msplit-addresses
14527 @itemx -mno-split-addresses
14528 @opindex msplit-addresses
14529 @opindex mno-split-addresses
14530 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
14531 relocation operators.  This option has been superseded by
14532 @option{-mexplicit-relocs} but is retained for backwards compatibility.
14534 @item -mexplicit-relocs
14535 @itemx -mno-explicit-relocs
14536 @opindex mexplicit-relocs
14537 @opindex mno-explicit-relocs
14538 Use (do not use) assembler relocation operators when dealing with symbolic
14539 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
14540 is to use assembler macros instead.
14542 @option{-mexplicit-relocs} is the default if GCC was configured
14543 to use an assembler that supports relocation operators.
14545 @item -mcheck-zero-division
14546 @itemx -mno-check-zero-division
14547 @opindex mcheck-zero-division
14548 @opindex mno-check-zero-division
14549 Trap (do not trap) on integer division by zero.
14551 The default is @option{-mcheck-zero-division}.
14553 @item -mdivide-traps
14554 @itemx -mdivide-breaks
14555 @opindex mdivide-traps
14556 @opindex mdivide-breaks
14557 MIPS systems check for division by zero by generating either a
14558 conditional trap or a break instruction.  Using traps results in
14559 smaller code, but is only supported on MIPS II and later.  Also, some
14560 versions of the Linux kernel have a bug that prevents trap from
14561 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
14562 allow conditional traps on architectures that support them and
14563 @option{-mdivide-breaks} to force the use of breaks.
14565 The default is usually @option{-mdivide-traps}, but this can be
14566 overridden at configure time using @option{--with-divide=breaks}.
14567 Divide-by-zero checks can be completely disabled using
14568 @option{-mno-check-zero-division}.
14570 @item -mmemcpy
14571 @itemx -mno-memcpy
14572 @opindex mmemcpy
14573 @opindex mno-memcpy
14574 Force (do not force) the use of @code{memcpy()} for non-trivial block
14575 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
14576 most constant-sized copies.
14578 @item -mlong-calls
14579 @itemx -mno-long-calls
14580 @opindex mlong-calls
14581 @opindex mno-long-calls
14582 Disable (do not disable) use of the @code{jal} instruction.  Calling
14583 functions using @code{jal} is more efficient but requires the caller
14584 and callee to be in the same 256 megabyte segment.
14586 This option has no effect on abicalls code.  The default is
14587 @option{-mno-long-calls}.
14589 @item -mmad
14590 @itemx -mno-mad
14591 @opindex mmad
14592 @opindex mno-mad
14593 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
14594 instructions, as provided by the R4650 ISA@.
14596 @item -mfused-madd
14597 @itemx -mno-fused-madd
14598 @opindex mfused-madd
14599 @opindex mno-fused-madd
14600 Enable (disable) use of the floating point multiply-accumulate
14601 instructions, when they are available.  The default is
14602 @option{-mfused-madd}.
14604 When multiply-accumulate instructions are used, the intermediate
14605 product is calculated to infinite precision and is not subject to
14606 the FCSR Flush to Zero bit.  This may be undesirable in some
14607 circumstances.
14609 @item -nocpp
14610 @opindex nocpp
14611 Tell the MIPS assembler to not run its preprocessor over user
14612 assembler files (with a @samp{.s} suffix) when assembling them.
14614 @item -mfix-r4000
14615 @itemx -mno-fix-r4000
14616 @opindex mfix-r4000
14617 @opindex mno-fix-r4000
14618 Work around certain R4000 CPU errata:
14619 @itemize @minus
14620 @item
14621 A double-word or a variable shift may give an incorrect result if executed
14622 immediately after starting an integer division.
14623 @item
14624 A double-word or a variable shift may give an incorrect result if executed
14625 while an integer multiplication is in progress.
14626 @item
14627 An integer division may give an incorrect result if started in a delay slot
14628 of a taken branch or a jump.
14629 @end itemize
14631 @item -mfix-r4400
14632 @itemx -mno-fix-r4400
14633 @opindex mfix-r4400
14634 @opindex mno-fix-r4400
14635 Work around certain R4400 CPU errata:
14636 @itemize @minus
14637 @item
14638 A double-word or a variable shift may give an incorrect result if executed
14639 immediately after starting an integer division.
14640 @end itemize
14642 @item -mfix-r10000
14643 @itemx -mno-fix-r10000
14644 @opindex mfix-r10000
14645 @opindex mno-fix-r10000
14646 Work around certain R10000 errata:
14647 @itemize @minus
14648 @item
14649 @code{ll}/@code{sc} sequences may not behave atomically on revisions
14650 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
14651 @end itemize
14653 This option can only be used if the target architecture supports
14654 branch-likely instructions.  @option{-mfix-r10000} is the default when
14655 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
14656 otherwise.
14658 @item -mfix-vr4120
14659 @itemx -mno-fix-vr4120
14660 @opindex mfix-vr4120
14661 Work around certain VR4120 errata:
14662 @itemize @minus
14663 @item
14664 @code{dmultu} does not always produce the correct result.
14665 @item
14666 @code{div} and @code{ddiv} do not always produce the correct result if one
14667 of the operands is negative.
14668 @end itemize
14669 The workarounds for the division errata rely on special functions in
14670 @file{libgcc.a}.  At present, these functions are only provided by
14671 the @code{mips64vr*-elf} configurations.
14673 Other VR4120 errata require a nop to be inserted between certain pairs of
14674 instructions.  These errata are handled by the assembler, not by GCC itself.
14676 @item -mfix-vr4130
14677 @opindex mfix-vr4130
14678 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
14679 workarounds are implemented by the assembler rather than by GCC,
14680 although GCC will avoid using @code{mflo} and @code{mfhi} if the
14681 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
14682 instructions are available instead.
14684 @item -mfix-sb1
14685 @itemx -mno-fix-sb1
14686 @opindex mfix-sb1
14687 Work around certain SB-1 CPU core errata.
14688 (This flag currently works around the SB-1 revision 2
14689 ``F1'' and ``F2'' floating point errata.)
14691 @item -mr10k-cache-barrier=@var{setting}
14692 @opindex mr10k-cache-barrier
14693 Specify whether GCC should insert cache barriers to avoid the
14694 side-effects of speculation on R10K processors.
14696 In common with many processors, the R10K tries to predict the outcome
14697 of a conditional branch and speculatively executes instructions from
14698 the ``taken'' branch.  It later aborts these instructions if the
14699 predicted outcome was wrong.  However, on the R10K, even aborted
14700 instructions can have side effects.
14702 This problem only affects kernel stores and, depending on the system,
14703 kernel loads.  As an example, a speculatively-executed store may load
14704 the target memory into cache and mark the cache line as dirty, even if
14705 the store itself is later aborted.  If a DMA operation writes to the
14706 same area of memory before the ``dirty'' line is flushed, the cached
14707 data will overwrite the DMA-ed data.  See the R10K processor manual
14708 for a full description, including other potential problems.
14710 One workaround is to insert cache barrier instructions before every memory
14711 access that might be speculatively executed and that might have side
14712 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
14713 controls GCC's implementation of this workaround.  It assumes that
14714 aborted accesses to any byte in the following regions will not have
14715 side effects:
14717 @enumerate
14718 @item
14719 the memory occupied by the current function's stack frame;
14721 @item
14722 the memory occupied by an incoming stack argument;
14724 @item
14725 the memory occupied by an object with a link-time-constant address.
14726 @end enumerate
14728 It is the kernel's responsibility to ensure that speculative
14729 accesses to these regions are indeed safe.
14731 If the input program contains a function declaration such as:
14733 @smallexample
14734 void foo (void);
14735 @end smallexample
14737 then the implementation of @code{foo} must allow @code{j foo} and
14738 @code{jal foo} to be executed speculatively.  GCC honors this
14739 restriction for functions it compiles itself.  It expects non-GCC
14740 functions (such as hand-written assembly code) to do the same.
14742 The option has three forms:
14744 @table @gcctabopt
14745 @item -mr10k-cache-barrier=load-store
14746 Insert a cache barrier before a load or store that might be
14747 speculatively executed and that might have side effects even
14748 if aborted.
14750 @item -mr10k-cache-barrier=store
14751 Insert a cache barrier before a store that might be speculatively
14752 executed and that might have side effects even if aborted.
14754 @item -mr10k-cache-barrier=none
14755 Disable the insertion of cache barriers.  This is the default setting.
14756 @end table
14758 @item -mflush-func=@var{func}
14759 @itemx -mno-flush-func
14760 @opindex mflush-func
14761 Specifies the function to call to flush the I and D caches, or to not
14762 call any such function.  If called, the function must take the same
14763 arguments as the common @code{_flush_func()}, that is, the address of the
14764 memory range for which the cache is being flushed, the size of the
14765 memory range, and the number 3 (to flush both caches).  The default
14766 depends on the target GCC was configured for, but commonly is either
14767 @samp{_flush_func} or @samp{__cpu_flush}.
14769 @item mbranch-cost=@var{num}
14770 @opindex mbranch-cost
14771 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14772 This cost is only a heuristic and is not guaranteed to produce
14773 consistent results across releases.  A zero cost redundantly selects
14774 the default, which is based on the @option{-mtune} setting.
14776 @item -mbranch-likely
14777 @itemx -mno-branch-likely
14778 @opindex mbranch-likely
14779 @opindex mno-branch-likely
14780 Enable or disable use of Branch Likely instructions, regardless of the
14781 default for the selected architecture.  By default, Branch Likely
14782 instructions may be generated if they are supported by the selected
14783 architecture.  An exception is for the MIPS32 and MIPS64 architectures
14784 and processors which implement those architectures; for those, Branch
14785 Likely instructions will not be generated by default because the MIPS32
14786 and MIPS64 architectures specifically deprecate their use.
14788 @item -mfp-exceptions
14789 @itemx -mno-fp-exceptions
14790 @opindex mfp-exceptions
14791 Specifies whether FP exceptions are enabled.  This affects how we schedule
14792 FP instructions for some processors.  The default is that FP exceptions are
14793 enabled.
14795 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
14796 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
14797 FP pipe.
14799 @item -mvr4130-align
14800 @itemx -mno-vr4130-align
14801 @opindex mvr4130-align
14802 The VR4130 pipeline is two-way superscalar, but can only issue two
14803 instructions together if the first one is 8-byte aligned.  When this
14804 option is enabled, GCC will align pairs of instructions that it
14805 thinks should execute in parallel.
14807 This option only has an effect when optimizing for the VR4130.
14808 It normally makes code faster, but at the expense of making it bigger.
14809 It is enabled by default at optimization level @option{-O3}.
14811 @item -msynci
14812 @itemx -mno-synci
14813 @opindex msynci
14814 Enable (disable) generation of @code{synci} instructions on
14815 architectures that support it.  The @code{synci} instructions (if
14816 enabled) will be generated when @code{__builtin___clear_cache()} is
14817 compiled.
14819 This option defaults to @code{-mno-synci}, but the default can be
14820 overridden by configuring with @code{--with-synci}.
14822 When compiling code for single processor systems, it is generally safe
14823 to use @code{synci}.  However, on many multi-core (SMP) systems, it
14824 will not invalidate the instruction caches on all cores and may lead
14825 to undefined behavior.
14827 @item -mrelax-pic-calls
14828 @itemx -mno-relax-pic-calls
14829 @opindex mrelax-pic-calls
14830 Try to turn PIC calls that are normally dispatched via register
14831 @code{$25} into direct calls.  This is only possible if the linker can
14832 resolve the destination at link-time and if the destination is within
14833 range for a direct call.
14835 @option{-mrelax-pic-calls} is the default if GCC was configured to use
14836 an assembler and a linker that supports the @code{.reloc} assembly
14837 directive and @code{-mexplicit-relocs} is in effect.  With
14838 @code{-mno-explicit-relocs}, this optimization can be performed by the
14839 assembler and the linker alone without help from the compiler.
14841 @item -mmcount-ra-address
14842 @itemx -mno-mcount-ra-address
14843 @opindex mmcount-ra-address
14844 @opindex mno-mcount-ra-address
14845 Emit (do not emit) code that allows @code{_mcount} to modify the
14846 calling function's return address.  When enabled, this option extends
14847 the usual @code{_mcount} interface with a new @var{ra-address}
14848 parameter, which has type @code{intptr_t *} and is passed in register
14849 @code{$12}.  @code{_mcount} can then modify the return address by
14850 doing both of the following:
14851 @itemize
14852 @item
14853 Returning the new address in register @code{$31}.
14854 @item
14855 Storing the new address in @code{*@var{ra-address}},
14856 if @var{ra-address} is nonnull.
14857 @end itemize
14859 The default is @option{-mno-mcount-ra-address}.
14861 @end table
14863 @node MMIX Options
14864 @subsection MMIX Options
14865 @cindex MMIX Options
14867 These options are defined for the MMIX:
14869 @table @gcctabopt
14870 @item -mlibfuncs
14871 @itemx -mno-libfuncs
14872 @opindex mlibfuncs
14873 @opindex mno-libfuncs
14874 Specify that intrinsic library functions are being compiled, passing all
14875 values in registers, no matter the size.
14877 @item -mepsilon
14878 @itemx -mno-epsilon
14879 @opindex mepsilon
14880 @opindex mno-epsilon
14881 Generate floating-point comparison instructions that compare with respect
14882 to the @code{rE} epsilon register.
14884 @item -mabi=mmixware
14885 @itemx -mabi=gnu
14886 @opindex mabi=mmixware
14887 @opindex mabi=gnu
14888 Generate code that passes function parameters and return values that (in
14889 the called function) are seen as registers @code{$0} and up, as opposed to
14890 the GNU ABI which uses global registers @code{$231} and up.
14892 @item -mzero-extend
14893 @itemx -mno-zero-extend
14894 @opindex mzero-extend
14895 @opindex mno-zero-extend
14896 When reading data from memory in sizes shorter than 64 bits, use (do not
14897 use) zero-extending load instructions by default, rather than
14898 sign-extending ones.
14900 @item -mknuthdiv
14901 @itemx -mno-knuthdiv
14902 @opindex mknuthdiv
14903 @opindex mno-knuthdiv
14904 Make the result of a division yielding a remainder have the same sign as
14905 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
14906 remainder follows the sign of the dividend.  Both methods are
14907 arithmetically valid, the latter being almost exclusively used.
14909 @item -mtoplevel-symbols
14910 @itemx -mno-toplevel-symbols
14911 @opindex mtoplevel-symbols
14912 @opindex mno-toplevel-symbols
14913 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
14914 code can be used with the @code{PREFIX} assembly directive.
14916 @item -melf
14917 @opindex melf
14918 Generate an executable in the ELF format, rather than the default
14919 @samp{mmo} format used by the @command{mmix} simulator.
14921 @item -mbranch-predict
14922 @itemx -mno-branch-predict
14923 @opindex mbranch-predict
14924 @opindex mno-branch-predict
14925 Use (do not use) the probable-branch instructions, when static branch
14926 prediction indicates a probable branch.
14928 @item -mbase-addresses
14929 @itemx -mno-base-addresses
14930 @opindex mbase-addresses
14931 @opindex mno-base-addresses
14932 Generate (do not generate) code that uses @emph{base addresses}.  Using a
14933 base address automatically generates a request (handled by the assembler
14934 and the linker) for a constant to be set up in a global register.  The
14935 register is used for one or more base address requests within the range 0
14936 to 255 from the value held in the register.  The generally leads to short
14937 and fast code, but the number of different data items that can be
14938 addressed is limited.  This means that a program that uses lots of static
14939 data may require @option{-mno-base-addresses}.
14941 @item -msingle-exit
14942 @itemx -mno-single-exit
14943 @opindex msingle-exit
14944 @opindex mno-single-exit
14945 Force (do not force) generated code to have a single exit point in each
14946 function.
14947 @end table
14949 @node MN10300 Options
14950 @subsection MN10300 Options
14951 @cindex MN10300 options
14953 These @option{-m} options are defined for Matsushita MN10300 architectures:
14955 @table @gcctabopt
14956 @item -mmult-bug
14957 @opindex mmult-bug
14958 Generate code to avoid bugs in the multiply instructions for the MN10300
14959 processors.  This is the default.
14961 @item -mno-mult-bug
14962 @opindex mno-mult-bug
14963 Do not generate code to avoid bugs in the multiply instructions for the
14964 MN10300 processors.
14966 @item -mam33
14967 @opindex mam33
14968 Generate code which uses features specific to the AM33 processor.
14970 @item -mno-am33
14971 @opindex mno-am33
14972 Do not generate code which uses features specific to the AM33 processor.  This
14973 is the default.
14975 @item -mam33-2
14976 @opindex mam33-2
14977 Generate code which uses features specific to the AM33/2.0 processor.
14979 @item -mam34
14980 @opindex mam34
14981 Generate code which uses features specific to the AM34 processor.
14983 @item -mtune=@var{cpu-type}
14984 @opindex mtune
14985 Use the timing characteristics of the indicated CPU type when
14986 scheduling instructions.  This does not change the targeted processor
14987 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
14988 @samp{am33-2} or @samp{am34}.
14990 @item -mreturn-pointer-on-d0
14991 @opindex mreturn-pointer-on-d0
14992 When generating a function which returns a pointer, return the pointer
14993 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
14994 only in a0, and attempts to call such functions without a prototype
14995 would result in errors.  Note that this option is on by default; use
14996 @option{-mno-return-pointer-on-d0} to disable it.
14998 @item -mno-crt0
14999 @opindex mno-crt0
15000 Do not link in the C run-time initialization object file.
15002 @item -mrelax
15003 @opindex mrelax
15004 Indicate to the linker that it should perform a relaxation optimization pass
15005 to shorten branches, calls and absolute memory addresses.  This option only
15006 has an effect when used on the command line for the final link step.
15008 This option makes symbolic debugging impossible.
15010 @item -mliw
15011 @opindex mliw
15012 Allow the compiler to generate @emph{Long Instruction Word}
15013 instructions if the target is the @samp{AM33} or later.  This is the
15014 default.  This option defines the preprocessor macro @samp{__LIW__}.
15016 @item -mnoliw
15017 @opindex mnoliw
15018 Do not allow the compiler to generate @emph{Long Instruction Word}
15019 instructions.  This option defines the preprocessor macro
15020 @samp{__NO_LIW__}.
15022 @item -msetlb
15023 @opindex msetlb
15024 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
15025 instructions if the target is the @samp{AM33} or later.  This is the
15026 default.  This option defines the preprocessor macro @samp{__SETLB__}.
15028 @item -mnosetlb
15029 @opindex mnosetlb
15030 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
15031 instructions.  This option defines the preprocessor macro
15032 @samp{__NO_SETLB__}.
15034 @end table
15036 @node PDP-11 Options
15037 @subsection PDP-11 Options
15038 @cindex PDP-11 Options
15040 These options are defined for the PDP-11:
15042 @table @gcctabopt
15043 @item -mfpu
15044 @opindex mfpu
15045 Use hardware FPP floating point.  This is the default.  (FIS floating
15046 point on the PDP-11/40 is not supported.)
15048 @item -msoft-float
15049 @opindex msoft-float
15050 Do not use hardware floating point.
15052 @item -mac0
15053 @opindex mac0
15054 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
15056 @item -mno-ac0
15057 @opindex mno-ac0
15058 Return floating-point results in memory.  This is the default.
15060 @item -m40
15061 @opindex m40
15062 Generate code for a PDP-11/40.
15064 @item -m45
15065 @opindex m45
15066 Generate code for a PDP-11/45.  This is the default.
15068 @item -m10
15069 @opindex m10
15070 Generate code for a PDP-11/10.
15072 @item -mbcopy-builtin
15073 @opindex mbcopy-builtin
15074 Use inline @code{movmemhi} patterns for copying memory.  This is the
15075 default.
15077 @item -mbcopy
15078 @opindex mbcopy
15079 Do not use inline @code{movmemhi} patterns for copying memory.
15081 @item -mint16
15082 @itemx -mno-int32
15083 @opindex mint16
15084 @opindex mno-int32
15085 Use 16-bit @code{int}.  This is the default.
15087 @item -mint32
15088 @itemx -mno-int16
15089 @opindex mint32
15090 @opindex mno-int16
15091 Use 32-bit @code{int}.
15093 @item -mfloat64
15094 @itemx -mno-float32
15095 @opindex mfloat64
15096 @opindex mno-float32
15097 Use 64-bit @code{float}.  This is the default.
15099 @item -mfloat32
15100 @itemx -mno-float64
15101 @opindex mfloat32
15102 @opindex mno-float64
15103 Use 32-bit @code{float}.
15105 @item -mabshi
15106 @opindex mabshi
15107 Use @code{abshi2} pattern.  This is the default.
15109 @item -mno-abshi
15110 @opindex mno-abshi
15111 Do not use @code{abshi2} pattern.
15113 @item -mbranch-expensive
15114 @opindex mbranch-expensive
15115 Pretend that branches are expensive.  This is for experimenting with
15116 code generation only.
15118 @item -mbranch-cheap
15119 @opindex mbranch-cheap
15120 Do not pretend that branches are expensive.  This is the default.
15122 @item -munix-asm
15123 @opindex munix-asm
15124 Use Unix assembler syntax.  This is the default when configured for
15125 @samp{pdp11-*-bsd}.
15127 @item -mdec-asm
15128 @opindex mdec-asm
15129 Use DEC assembler syntax.  This is the default when configured for any
15130 PDP-11 target other than @samp{pdp11-*-bsd}.
15131 @end table
15133 @node picoChip Options
15134 @subsection picoChip Options
15135 @cindex picoChip options
15137 These @samp{-m} options are defined for picoChip implementations:
15139 @table @gcctabopt
15141 @item -mae=@var{ae_type}
15142 @opindex mcpu
15143 Set the instruction set, register set, and instruction scheduling
15144 parameters for array element type @var{ae_type}.  Supported values
15145 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
15147 @option{-mae=ANY} selects a completely generic AE type.  Code
15148 generated with this option will run on any of the other AE types.  The
15149 code will not be as efficient as it would be if compiled for a specific
15150 AE type, and some types of operation (e.g., multiplication) will not
15151 work properly on all types of AE.
15153 @option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
15154 for compiled code, and is the default.
15156 @option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
15157 option may suffer from poor performance of byte (char) manipulation,
15158 since the DSP AE does not provide hardware support for byte load/stores.
15160 @item -msymbol-as-address
15161 Enable the compiler to directly use a symbol name as an address in a
15162 load/store instruction, without first loading it into a
15163 register.  Typically, the use of this option will generate larger
15164 programs, which run faster than when the option isn't used.  However, the
15165 results vary from program to program, so it is left as a user option,
15166 rather than being permanently enabled.
15168 @item -mno-inefficient-warnings
15169 Disables warnings about the generation of inefficient code.  These
15170 warnings can be generated, for example, when compiling code which
15171 performs byte-level memory operations on the MAC AE type.  The MAC AE has
15172 no hardware support for byte-level memory operations, so all byte
15173 load/stores must be synthesized from word load/store operations.  This is
15174 inefficient and a warning will be generated indicating to the programmer
15175 that they should rewrite the code to avoid byte operations, or to target
15176 an AE type which has the necessary hardware support.  This option enables
15177 the warning to be turned off.
15179 @end table
15181 @node PowerPC Options
15182 @subsection PowerPC Options
15183 @cindex PowerPC options
15185 These are listed under @xref{RS/6000 and PowerPC Options}.
15187 @node RS/6000 and PowerPC Options
15188 @subsection IBM RS/6000 and PowerPC Options
15189 @cindex RS/6000 and PowerPC Options
15190 @cindex IBM RS/6000 and PowerPC Options
15192 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
15193 @table @gcctabopt
15194 @item -mpower
15195 @itemx -mno-power
15196 @itemx -mpower2
15197 @itemx -mno-power2
15198 @itemx -mpowerpc
15199 @itemx -mno-powerpc
15200 @itemx -mpowerpc-gpopt
15201 @itemx -mno-powerpc-gpopt
15202 @itemx -mpowerpc-gfxopt
15203 @itemx -mno-powerpc-gfxopt
15204 @need 800
15205 @itemx -mpowerpc64
15206 @itemx -mno-powerpc64
15207 @itemx -mmfcrf
15208 @itemx -mno-mfcrf
15209 @itemx -mpopcntb
15210 @itemx -mno-popcntb
15211 @itemx -mpopcntd
15212 @itemx -mno-popcntd
15213 @itemx -mfprnd
15214 @itemx -mno-fprnd
15215 @need 800
15216 @itemx -mcmpb
15217 @itemx -mno-cmpb
15218 @itemx -mmfpgpr
15219 @itemx -mno-mfpgpr
15220 @itemx -mhard-dfp
15221 @itemx -mno-hard-dfp
15222 @opindex mpower
15223 @opindex mno-power
15224 @opindex mpower2
15225 @opindex mno-power2
15226 @opindex mpowerpc
15227 @opindex mno-powerpc
15228 @opindex mpowerpc-gpopt
15229 @opindex mno-powerpc-gpopt
15230 @opindex mpowerpc-gfxopt
15231 @opindex mno-powerpc-gfxopt
15232 @opindex mpowerpc64
15233 @opindex mno-powerpc64
15234 @opindex mmfcrf
15235 @opindex mno-mfcrf
15236 @opindex mpopcntb
15237 @opindex mno-popcntb
15238 @opindex mpopcntd
15239 @opindex mno-popcntd
15240 @opindex mfprnd
15241 @opindex mno-fprnd
15242 @opindex mcmpb
15243 @opindex mno-cmpb
15244 @opindex mmfpgpr
15245 @opindex mno-mfpgpr
15246 @opindex mhard-dfp
15247 @opindex mno-hard-dfp
15248 GCC supports two related instruction set architectures for the
15249 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
15250 instructions supported by the @samp{rios} chip set used in the original
15251 RS/6000 systems and the @dfn{PowerPC} instruction set is the
15252 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
15253 the IBM 4xx, 6xx, and follow-on microprocessors.
15255 Neither architecture is a subset of the other.  However there is a
15256 large common subset of instructions supported by both.  An MQ
15257 register is included in processors supporting the POWER architecture.
15259 You use these options to specify which instructions are available on the
15260 processor you are using.  The default value of these options is
15261 determined when configuring GCC@.  Specifying the
15262 @option{-mcpu=@var{cpu_type}} overrides the specification of these
15263 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
15264 rather than the options listed above.
15266 The @option{-mpower} option allows GCC to generate instructions that
15267 are found only in the POWER architecture and to use the MQ register.
15268 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
15269 to generate instructions that are present in the POWER2 architecture but
15270 not the original POWER architecture.
15272 The @option{-mpowerpc} option allows GCC to generate instructions that
15273 are found only in the 32-bit subset of the PowerPC architecture.
15274 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
15275 GCC to use the optional PowerPC architecture instructions in the
15276 General Purpose group, including floating-point square root.  Specifying
15277 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
15278 use the optional PowerPC architecture instructions in the Graphics
15279 group, including floating-point select.
15281 The @option{-mmfcrf} option allows GCC to generate the move from
15282 condition register field instruction implemented on the POWER4
15283 processor and other processors that support the PowerPC V2.01
15284 architecture.
15285 The @option{-mpopcntb} option allows GCC to generate the popcount and
15286 double precision FP reciprocal estimate instruction implemented on the
15287 POWER5 processor and other processors that support the PowerPC V2.02
15288 architecture.
15289 The @option{-mpopcntd} option allows GCC to generate the popcount
15290 instruction implemented on the POWER7 processor and other processors
15291 that support the PowerPC V2.06 architecture.
15292 The @option{-mfprnd} option allows GCC to generate the FP round to
15293 integer instructions implemented on the POWER5+ processor and other
15294 processors that support the PowerPC V2.03 architecture.
15295 The @option{-mcmpb} option allows GCC to generate the compare bytes
15296 instruction implemented on the POWER6 processor and other processors
15297 that support the PowerPC V2.05 architecture.
15298 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
15299 general purpose register instructions implemented on the POWER6X
15300 processor and other processors that support the extended PowerPC V2.05
15301 architecture.
15302 The @option{-mhard-dfp} option allows GCC to generate the decimal floating
15303 point instructions implemented on some POWER processors.
15305 The @option{-mpowerpc64} option allows GCC to generate the additional
15306 64-bit instructions that are found in the full PowerPC64 architecture
15307 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
15308 @option{-mno-powerpc64}.
15310 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
15311 will use only the instructions in the common subset of both
15312 architectures plus some special AIX common-mode calls, and will not use
15313 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
15314 permits GCC to use any instruction from either architecture and to
15315 allow use of the MQ register; specify this for the Motorola MPC601.
15317 @item -mnew-mnemonics
15318 @itemx -mold-mnemonics
15319 @opindex mnew-mnemonics
15320 @opindex mold-mnemonics
15321 Select which mnemonics to use in the generated assembler code.  With
15322 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
15323 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
15324 assembler mnemonics defined for the POWER architecture.  Instructions
15325 defined in only one architecture have only one mnemonic; GCC uses that
15326 mnemonic irrespective of which of these options is specified.
15328 GCC defaults to the mnemonics appropriate for the architecture in
15329 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
15330 value of these option.  Unless you are building a cross-compiler, you
15331 should normally not specify either @option{-mnew-mnemonics} or
15332 @option{-mold-mnemonics}, but should instead accept the default.
15334 @item -mcpu=@var{cpu_type}
15335 @opindex mcpu
15336 Set architecture type, register usage, choice of mnemonics, and
15337 instruction scheduling parameters for machine type @var{cpu_type}.
15338 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
15339 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
15340 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
15341 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
15342 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
15343 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
15344 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
15345 @samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
15346 @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
15347 @samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
15348 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
15350 @option{-mcpu=common} selects a completely generic processor.  Code
15351 generated under this option will run on any POWER or PowerPC processor.
15352 GCC will use only the instructions in the common subset of both
15353 architectures, and will not use the MQ register.  GCC assumes a generic
15354 processor model for scheduling purposes.
15356 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
15357 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
15358 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
15359 types, with an appropriate, generic processor model assumed for
15360 scheduling purposes.
15362 The other options specify a specific processor.  Code generated under
15363 those options will run best on that processor, and may not run at all on
15364 others.
15366 The @option{-mcpu} options automatically enable or disable the
15367 following options:
15369 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
15370 -mnew-mnemonics  -mpopcntb -mpopcntd  -mpower  -mpower2  -mpowerpc64 @gol
15371 -mpowerpc-gpopt  -mpowerpc-gfxopt  -msingle-float -mdouble-float @gol
15372 -msimple-fpu -mstring  -mmulhw  -mdlmzb  -mmfpgpr -mvsx}
15374 The particular options set for any particular CPU will vary between
15375 compiler versions, depending on what setting seems to produce optimal
15376 code for that CPU; it doesn't necessarily reflect the actual hardware's
15377 capabilities.  If you wish to set an individual option to a particular
15378 value, you may specify it after the @option{-mcpu} option, like
15379 @samp{-mcpu=970 -mno-altivec}.
15381 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
15382 not enabled or disabled by the @option{-mcpu} option at present because
15383 AIX does not have full support for these options.  You may still
15384 enable or disable them individually if you're sure it'll work in your
15385 environment.
15387 @item -mtune=@var{cpu_type}
15388 @opindex mtune
15389 Set the instruction scheduling parameters for machine type
15390 @var{cpu_type}, but do not set the architecture type, register usage, or
15391 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
15392 values for @var{cpu_type} are used for @option{-mtune} as for
15393 @option{-mcpu}.  If both are specified, the code generated will use the
15394 architecture, registers, and mnemonics set by @option{-mcpu}, but the
15395 scheduling parameters set by @option{-mtune}.
15397 @item -mcmodel=small
15398 @opindex mcmodel=small
15399 Generate PowerPC64 code for the small model: The TOC is limited to
15400 64k.
15402 @item -mcmodel=medium
15403 @opindex mcmodel=medium
15404 Generate PowerPC64 code for the medium model: The TOC and other static
15405 data may be up to a total of 4G in size.
15407 @item -mcmodel=large
15408 @opindex mcmodel=large
15409 Generate PowerPC64 code for the large model: The TOC may be up to 4G
15410 in size.  Other data and code is only limited by the 64-bit address
15411 space.
15413 @item -maltivec
15414 @itemx -mno-altivec
15415 @opindex maltivec
15416 @opindex mno-altivec
15417 Generate code that uses (does not use) AltiVec instructions, and also
15418 enable the use of built-in functions that allow more direct access to
15419 the AltiVec instruction set.  You may also need to set
15420 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
15421 enhancements.
15423 @item -mvrsave
15424 @itemx -mno-vrsave
15425 @opindex mvrsave
15426 @opindex mno-vrsave
15427 Generate VRSAVE instructions when generating AltiVec code.
15429 @item -mgen-cell-microcode
15430 @opindex mgen-cell-microcode
15431 Generate Cell microcode instructions
15433 @item -mwarn-cell-microcode
15434 @opindex mwarn-cell-microcode
15435 Warning when a Cell microcode instruction is going to emitted.  An example
15436 of a Cell microcode instruction is a variable shift.
15438 @item -msecure-plt
15439 @opindex msecure-plt
15440 Generate code that allows ld and ld.so to build executables and shared
15441 libraries with non-exec .plt and .got sections.  This is a PowerPC
15442 32-bit SYSV ABI option.
15444 @item -mbss-plt
15445 @opindex mbss-plt
15446 Generate code that uses a BSS .plt section that ld.so fills in, and
15447 requires .plt and .got sections that are both writable and executable.
15448 This is a PowerPC 32-bit SYSV ABI option.
15450 @item -misel
15451 @itemx -mno-isel
15452 @opindex misel
15453 @opindex mno-isel
15454 This switch enables or disables the generation of ISEL instructions.
15456 @item -misel=@var{yes/no}
15457 This switch has been deprecated.  Use @option{-misel} and
15458 @option{-mno-isel} instead.
15460 @item -mspe
15461 @itemx -mno-spe
15462 @opindex mspe
15463 @opindex mno-spe
15464 This switch enables or disables the generation of SPE simd
15465 instructions.
15467 @item -mpaired
15468 @itemx -mno-paired
15469 @opindex mpaired
15470 @opindex mno-paired
15471 This switch enables or disables the generation of PAIRED simd
15472 instructions.
15474 @item -mspe=@var{yes/no}
15475 This option has been deprecated.  Use @option{-mspe} and
15476 @option{-mno-spe} instead.
15478 @item -mvsx
15479 @itemx -mno-vsx
15480 @opindex mvsx
15481 @opindex mno-vsx
15482 Generate code that uses (does not use) vector/scalar (VSX)
15483 instructions, and also enable the use of built-in functions that allow
15484 more direct access to the VSX instruction set.
15486 @item -mfloat-gprs=@var{yes/single/double/no}
15487 @itemx -mfloat-gprs
15488 @opindex mfloat-gprs
15489 This switch enables or disables the generation of floating point
15490 operations on the general purpose registers for architectures that
15491 support it.
15493 The argument @var{yes} or @var{single} enables the use of
15494 single-precision floating point operations.
15496 The argument @var{double} enables the use of single and
15497 double-precision floating point operations.
15499 The argument @var{no} disables floating point operations on the
15500 general purpose registers.
15502 This option is currently only available on the MPC854x.
15504 @item -m32
15505 @itemx -m64
15506 @opindex m32
15507 @opindex m64
15508 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
15509 targets (including GNU/Linux).  The 32-bit environment sets int, long
15510 and pointer to 32 bits and generates code that runs on any PowerPC
15511 variant.  The 64-bit environment sets int to 32 bits and long and
15512 pointer to 64 bits, and generates code for PowerPC64, as for
15513 @option{-mpowerpc64}.
15515 @item -mfull-toc
15516 @itemx -mno-fp-in-toc
15517 @itemx -mno-sum-in-toc
15518 @itemx -mminimal-toc
15519 @opindex mfull-toc
15520 @opindex mno-fp-in-toc
15521 @opindex mno-sum-in-toc
15522 @opindex mminimal-toc
15523 Modify generation of the TOC (Table Of Contents), which is created for
15524 every executable file.  The @option{-mfull-toc} option is selected by
15525 default.  In that case, GCC will allocate at least one TOC entry for
15526 each unique non-automatic variable reference in your program.  GCC
15527 will also place floating-point constants in the TOC@.  However, only
15528 16,384 entries are available in the TOC@.
15530 If you receive a linker error message that saying you have overflowed
15531 the available TOC space, you can reduce the amount of TOC space used
15532 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
15533 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
15534 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
15535 generate code to calculate the sum of an address and a constant at
15536 run-time instead of putting that sum into the TOC@.  You may specify one
15537 or both of these options.  Each causes GCC to produce very slightly
15538 slower and larger code at the expense of conserving TOC space.
15540 If you still run out of space in the TOC even when you specify both of
15541 these options, specify @option{-mminimal-toc} instead.  This option causes
15542 GCC to make only one TOC entry for every file.  When you specify this
15543 option, GCC will produce code that is slower and larger but which
15544 uses extremely little TOC space.  You may wish to use this option
15545 only on files that contain less frequently executed code.
15547 @item -maix64
15548 @itemx -maix32
15549 @opindex maix64
15550 @opindex maix32
15551 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
15552 @code{long} type, and the infrastructure needed to support them.
15553 Specifying @option{-maix64} implies @option{-mpowerpc64} and
15554 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
15555 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
15557 @item -mxl-compat
15558 @itemx -mno-xl-compat
15559 @opindex mxl-compat
15560 @opindex mno-xl-compat
15561 Produce code that conforms more closely to IBM XL compiler semantics
15562 when using AIX-compatible ABI@.  Pass floating-point arguments to
15563 prototyped functions beyond the register save area (RSA) on the stack
15564 in addition to argument FPRs.  Do not assume that most significant
15565 double in 128-bit long double value is properly rounded when comparing
15566 values and converting to double.  Use XL symbol names for long double
15567 support routines.
15569 The AIX calling convention was extended but not initially documented to
15570 handle an obscure K&R C case of calling a function that takes the
15571 address of its arguments with fewer arguments than declared.  IBM XL
15572 compilers access floating point arguments which do not fit in the
15573 RSA from the stack when a subroutine is compiled without
15574 optimization.  Because always storing floating-point arguments on the
15575 stack is inefficient and rarely needed, this option is not enabled by
15576 default and only is necessary when calling subroutines compiled by IBM
15577 XL compilers without optimization.
15579 @item -mpe
15580 @opindex mpe
15581 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
15582 application written to use message passing with special startup code to
15583 enable the application to run.  The system must have PE installed in the
15584 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
15585 must be overridden with the @option{-specs=} option to specify the
15586 appropriate directory location.  The Parallel Environment does not
15587 support threads, so the @option{-mpe} option and the @option{-pthread}
15588 option are incompatible.
15590 @item -malign-natural
15591 @itemx -malign-power
15592 @opindex malign-natural
15593 @opindex malign-power
15594 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
15595 @option{-malign-natural} overrides the ABI-defined alignment of larger
15596 types, such as floating-point doubles, on their natural size-based boundary.
15597 The option @option{-malign-power} instructs GCC to follow the ABI-specified
15598 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
15600 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
15601 is not supported.
15603 @item -msoft-float
15604 @itemx -mhard-float
15605 @opindex msoft-float
15606 @opindex mhard-float
15607 Generate code that does not use (uses) the floating-point register set.
15608 Software floating point emulation is provided if you use the
15609 @option{-msoft-float} option, and pass the option to GCC when linking.
15611 @item -msingle-float
15612 @itemx -mdouble-float
15613 @opindex msingle-float
15614 @opindex mdouble-float
15615 Generate code for single or double-precision floating point operations.
15616 @option{-mdouble-float} implies @option{-msingle-float}.
15618 @item -msimple-fpu
15619 @opindex msimple-fpu
15620 Do not generate sqrt and div instructions for hardware floating point unit.
15622 @item -mfpu
15623 @opindex mfpu
15624 Specify type of floating point unit.  Valid values are @var{sp_lite}
15625 (equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
15626 to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
15627 and @var{dp_full} (equivalent to -mdouble-float).
15629 @item -mxilinx-fpu
15630 @opindex mxilinx-fpu
15631 Perform optimizations for floating point unit on Xilinx PPC 405/440.
15633 @item -mmultiple
15634 @itemx -mno-multiple
15635 @opindex mmultiple
15636 @opindex mno-multiple
15637 Generate code that uses (does not use) the load multiple word
15638 instructions and the store multiple word instructions.  These
15639 instructions are generated by default on POWER systems, and not
15640 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
15641 endian PowerPC systems, since those instructions do not work when the
15642 processor is in little endian mode.  The exceptions are PPC740 and
15643 PPC750 which permit the instructions usage in little endian mode.
15645 @item -mstring
15646 @itemx -mno-string
15647 @opindex mstring
15648 @opindex mno-string
15649 Generate code that uses (does not use) the load string instructions
15650 and the store string word instructions to save multiple registers and
15651 do small block moves.  These instructions are generated by default on
15652 POWER systems, and not generated on PowerPC systems.  Do not use
15653 @option{-mstring} on little endian PowerPC systems, since those
15654 instructions do not work when the processor is in little endian mode.
15655 The exceptions are PPC740 and PPC750 which permit the instructions
15656 usage in little endian mode.
15658 @item -mupdate
15659 @itemx -mno-update
15660 @opindex mupdate
15661 @opindex mno-update
15662 Generate code that uses (does not use) the load or store instructions
15663 that update the base register to the address of the calculated memory
15664 location.  These instructions are generated by default.  If you use
15665 @option{-mno-update}, there is a small window between the time that the
15666 stack pointer is updated and the address of the previous frame is
15667 stored, which means code that walks the stack frame across interrupts or
15668 signals may get corrupted data.
15670 @item -mavoid-indexed-addresses
15671 @itemx -mno-avoid-indexed-addresses
15672 @opindex mavoid-indexed-addresses
15673 @opindex mno-avoid-indexed-addresses
15674 Generate code that tries to avoid (not avoid) the use of indexed load
15675 or store instructions. These instructions can incur a performance
15676 penalty on Power6 processors in certain situations, such as when
15677 stepping through large arrays that cross a 16M boundary.  This option
15678 is enabled by default when targetting Power6 and disabled otherwise.
15680 @item -mfused-madd
15681 @itemx -mno-fused-madd
15682 @opindex mfused-madd
15683 @opindex mno-fused-madd
15684 Generate code that uses (does not use) the floating point multiply and
15685 accumulate instructions.  These instructions are generated by default
15686 if hardware floating point is used.  The machine dependent
15687 @option{-mfused-madd} option is now mapped to the machine independent
15688 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
15689 mapped to @option{-ffp-contract=off}.
15691 @item -mmulhw
15692 @itemx -mno-mulhw
15693 @opindex mmulhw
15694 @opindex mno-mulhw
15695 Generate code that uses (does not use) the half-word multiply and
15696 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
15697 These instructions are generated by default when targetting those
15698 processors.
15700 @item -mdlmzb
15701 @itemx -mno-dlmzb
15702 @opindex mdlmzb
15703 @opindex mno-dlmzb
15704 Generate code that uses (does not use) the string-search @samp{dlmzb}
15705 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
15706 generated by default when targetting those processors.
15708 @item -mno-bit-align
15709 @itemx -mbit-align
15710 @opindex mno-bit-align
15711 @opindex mbit-align
15712 On System V.4 and embedded PowerPC systems do not (do) force structures
15713 and unions that contain bit-fields to be aligned to the base type of the
15714 bit-field.
15716 For example, by default a structure containing nothing but 8
15717 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
15718 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
15719 the structure would be aligned to a 1 byte boundary and be one byte in
15720 size.
15722 @item -mno-strict-align
15723 @itemx -mstrict-align
15724 @opindex mno-strict-align
15725 @opindex mstrict-align
15726 On System V.4 and embedded PowerPC systems do not (do) assume that
15727 unaligned memory references will be handled by the system.
15729 @item -mrelocatable
15730 @itemx -mno-relocatable
15731 @opindex mrelocatable
15732 @opindex mno-relocatable
15733 Generate code that allows (does not allow) a static executable to be
15734 relocated to a different address at runtime.  A simple embedded
15735 PowerPC system loader should relocate the entire contents of
15736 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
15737 a table of 32-bit addresses generated by this option.  For this to
15738 work, all objects linked together must be compiled with
15739 @option{-mrelocatable} or @option{-mrelocatable-lib}.
15740 @option{-mrelocatable} code aligns the stack to an 8 byte boundary.
15742 @item -mrelocatable-lib
15743 @itemx -mno-relocatable-lib
15744 @opindex mrelocatable-lib
15745 @opindex mno-relocatable-lib
15746 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
15747 @code{.fixup} section to allow static executables to be relocated at
15748 runtime, but @option{-mrelocatable-lib} does not use the smaller stack
15749 alignment of @option{-mrelocatable}.  Objects compiled with
15750 @option{-mrelocatable-lib} may be linked with objects compiled with
15751 any combination of the @option{-mrelocatable} options.
15753 @item -mno-toc
15754 @itemx -mtoc
15755 @opindex mno-toc
15756 @opindex mtoc
15757 On System V.4 and embedded PowerPC systems do not (do) assume that
15758 register 2 contains a pointer to a global area pointing to the addresses
15759 used in the program.
15761 @item -mlittle
15762 @itemx -mlittle-endian
15763 @opindex mlittle
15764 @opindex mlittle-endian
15765 On System V.4 and embedded PowerPC systems compile code for the
15766 processor in little endian mode.  The @option{-mlittle-endian} option is
15767 the same as @option{-mlittle}.
15769 @item -mbig
15770 @itemx -mbig-endian
15771 @opindex mbig
15772 @opindex mbig-endian
15773 On System V.4 and embedded PowerPC systems compile code for the
15774 processor in big endian mode.  The @option{-mbig-endian} option is
15775 the same as @option{-mbig}.
15777 @item -mdynamic-no-pic
15778 @opindex mdynamic-no-pic
15779 On Darwin and Mac OS X systems, compile code so that it is not
15780 relocatable, but that its external references are relocatable.  The
15781 resulting code is suitable for applications, but not shared
15782 libraries.
15784 @item -msingle-pic-base
15785 @opindex msingle-pic-base
15786 Treat the register used for PIC addressing as read-only, rather than
15787 loading it in the prologue for each function.  The run-time system is
15788 responsible for initializing this register with an appropriate value
15789 before execution begins.
15791 @item -mprioritize-restricted-insns=@var{priority}
15792 @opindex mprioritize-restricted-insns
15793 This option controls the priority that is assigned to
15794 dispatch-slot restricted instructions during the second scheduling
15795 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
15796 @var{no/highest/second-highest} priority to dispatch slot restricted
15797 instructions.
15799 @item -msched-costly-dep=@var{dependence_type}
15800 @opindex msched-costly-dep
15801 This option controls which dependences are considered costly
15802 by the target during instruction scheduling.  The argument
15803 @var{dependence_type} takes one of the following values:
15804 @var{no}: no dependence is costly,
15805 @var{all}: all dependences are costly,
15806 @var{true_store_to_load}: a true dependence from store to load is costly,
15807 @var{store_to_load}: any dependence from store to load is costly,
15808 @var{number}: any dependence which latency >= @var{number} is costly.
15810 @item -minsert-sched-nops=@var{scheme}
15811 @opindex minsert-sched-nops
15812 This option controls which nop insertion scheme will be used during
15813 the second scheduling pass.  The argument @var{scheme} takes one of the
15814 following values:
15815 @var{no}: Don't insert nops.
15816 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
15817 according to the scheduler's grouping.
15818 @var{regroup_exact}: Insert nops to force costly dependent insns into
15819 separate groups.  Insert exactly as many nops as needed to force an insn
15820 to a new group, according to the estimated processor grouping.
15821 @var{number}: Insert nops to force costly dependent insns into
15822 separate groups.  Insert @var{number} nops to force an insn to a new group.
15824 @item -mcall-sysv
15825 @opindex mcall-sysv
15826 On System V.4 and embedded PowerPC systems compile code using calling
15827 conventions that adheres to the March 1995 draft of the System V
15828 Application Binary Interface, PowerPC processor supplement.  This is the
15829 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
15831 @item -mcall-sysv-eabi
15832 @itemx -mcall-eabi
15833 @opindex mcall-sysv-eabi
15834 @opindex mcall-eabi
15835 Specify both @option{-mcall-sysv} and @option{-meabi} options.
15837 @item -mcall-sysv-noeabi
15838 @opindex mcall-sysv-noeabi
15839 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
15841 @item -mcall-aixdesc
15842 @opindex m
15843 On System V.4 and embedded PowerPC systems compile code for the AIX
15844 operating system.
15846 @item -mcall-linux
15847 @opindex mcall-linux
15848 On System V.4 and embedded PowerPC systems compile code for the
15849 Linux-based GNU system.
15851 @item -mcall-freebsd
15852 @opindex mcall-freebsd
15853 On System V.4 and embedded PowerPC systems compile code for the
15854 FreeBSD operating system.
15856 @item -mcall-netbsd
15857 @opindex mcall-netbsd
15858 On System V.4 and embedded PowerPC systems compile code for the
15859 NetBSD operating system.
15861 @item -mcall-openbsd
15862 @opindex mcall-netbsd
15863 On System V.4 and embedded PowerPC systems compile code for the
15864 OpenBSD operating system.
15866 @item -maix-struct-return
15867 @opindex maix-struct-return
15868 Return all structures in memory (as specified by the AIX ABI)@.
15870 @item -msvr4-struct-return
15871 @opindex msvr4-struct-return
15872 Return structures smaller than 8 bytes in registers (as specified by the
15873 SVR4 ABI)@.
15875 @item -mabi=@var{abi-type}
15876 @opindex mabi
15877 Extend the current ABI with a particular extension, or remove such extension.
15878 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
15879 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
15881 @item -mabi=spe
15882 @opindex mabi=spe
15883 Extend the current ABI with SPE ABI extensions.  This does not change
15884 the default ABI, instead it adds the SPE ABI extensions to the current
15885 ABI@.
15887 @item -mabi=no-spe
15888 @opindex mabi=no-spe
15889 Disable Booke SPE ABI extensions for the current ABI@.
15891 @item -mabi=ibmlongdouble
15892 @opindex mabi=ibmlongdouble
15893 Change the current ABI to use IBM extended precision long double.
15894 This is a PowerPC 32-bit SYSV ABI option.
15896 @item -mabi=ieeelongdouble
15897 @opindex mabi=ieeelongdouble
15898 Change the current ABI to use IEEE extended precision long double.
15899 This is a PowerPC 32-bit Linux ABI option.
15901 @item -mprototype
15902 @itemx -mno-prototype
15903 @opindex mprototype
15904 @opindex mno-prototype
15905 On System V.4 and embedded PowerPC systems assume that all calls to
15906 variable argument functions are properly prototyped.  Otherwise, the
15907 compiler must insert an instruction before every non prototyped call to
15908 set or clear bit 6 of the condition code register (@var{CR}) to
15909 indicate whether floating point values were passed in the floating point
15910 registers in case the function takes a variable arguments.  With
15911 @option{-mprototype}, only calls to prototyped variable argument functions
15912 will set or clear the bit.
15914 @item -msim
15915 @opindex msim
15916 On embedded PowerPC systems, assume that the startup module is called
15917 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
15918 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
15919 configurations.
15921 @item -mmvme
15922 @opindex mmvme
15923 On embedded PowerPC systems, assume that the startup module is called
15924 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
15925 @file{libc.a}.
15927 @item -mads
15928 @opindex mads
15929 On embedded PowerPC systems, assume that the startup module is called
15930 @file{crt0.o} and the standard C libraries are @file{libads.a} and
15931 @file{libc.a}.
15933 @item -myellowknife
15934 @opindex myellowknife
15935 On embedded PowerPC systems, assume that the startup module is called
15936 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
15937 @file{libc.a}.
15939 @item -mvxworks
15940 @opindex mvxworks
15941 On System V.4 and embedded PowerPC systems, specify that you are
15942 compiling for a VxWorks system.
15944 @item -memb
15945 @opindex memb
15946 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
15947 header to indicate that @samp{eabi} extended relocations are used.
15949 @item -meabi
15950 @itemx -mno-eabi
15951 @opindex meabi
15952 @opindex mno-eabi
15953 On System V.4 and embedded PowerPC systems do (do not) adhere to the
15954 Embedded Applications Binary Interface (eabi) which is a set of
15955 modifications to the System V.4 specifications.  Selecting @option{-meabi}
15956 means that the stack is aligned to an 8 byte boundary, a function
15957 @code{__eabi} is called to from @code{main} to set up the eabi
15958 environment, and the @option{-msdata} option can use both @code{r2} and
15959 @code{r13} to point to two separate small data areas.  Selecting
15960 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
15961 do not call an initialization function from @code{main}, and the
15962 @option{-msdata} option will only use @code{r13} to point to a single
15963 small data area.  The @option{-meabi} option is on by default if you
15964 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
15966 @item -msdata=eabi
15967 @opindex msdata=eabi
15968 On System V.4 and embedded PowerPC systems, put small initialized
15969 @code{const} global and static data in the @samp{.sdata2} section, which
15970 is pointed to by register @code{r2}.  Put small initialized
15971 non-@code{const} global and static data in the @samp{.sdata} section,
15972 which is pointed to by register @code{r13}.  Put small uninitialized
15973 global and static data in the @samp{.sbss} section, which is adjacent to
15974 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
15975 incompatible with the @option{-mrelocatable} option.  The
15976 @option{-msdata=eabi} option also sets the @option{-memb} option.
15978 @item -msdata=sysv
15979 @opindex msdata=sysv
15980 On System V.4 and embedded PowerPC systems, put small global and static
15981 data in the @samp{.sdata} section, which is pointed to by register
15982 @code{r13}.  Put small uninitialized global and static data in the
15983 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
15984 The @option{-msdata=sysv} option is incompatible with the
15985 @option{-mrelocatable} option.
15987 @item -msdata=default
15988 @itemx -msdata
15989 @opindex msdata=default
15990 @opindex msdata
15991 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
15992 compile code the same as @option{-msdata=eabi}, otherwise compile code the
15993 same as @option{-msdata=sysv}.
15995 @item -msdata=data
15996 @opindex msdata=data
15997 On System V.4 and embedded PowerPC systems, put small global
15998 data in the @samp{.sdata} section.  Put small uninitialized global
15999 data in the @samp{.sbss} section.  Do not use register @code{r13}
16000 to address small data however.  This is the default behavior unless
16001 other @option{-msdata} options are used.
16003 @item -msdata=none
16004 @itemx -mno-sdata
16005 @opindex msdata=none
16006 @opindex mno-sdata
16007 On embedded PowerPC systems, put all initialized global and static data
16008 in the @samp{.data} section, and all uninitialized data in the
16009 @samp{.bss} section.
16011 @item -mblock-move-inline-limit=@var{num}
16012 @opindex mblock-move-inline-limit
16013 Inline all block moves (such as calls to @code{memcpy} or structure
16014 copies) less than or equal to @var{num} bytes.  The minimum value for
16015 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
16016 targets.  The default value is target-specific.
16018 @item -G @var{num}
16019 @opindex G
16020 @cindex smaller data references (PowerPC)
16021 @cindex .sdata/.sdata2 references (PowerPC)
16022 On embedded PowerPC systems, put global and static items less than or
16023 equal to @var{num} bytes into the small data or bss sections instead of
16024 the normal data or bss section.  By default, @var{num} is 8.  The
16025 @option{-G @var{num}} switch is also passed to the linker.
16026 All modules should be compiled with the same @option{-G @var{num}} value.
16028 @item -mregnames
16029 @itemx -mno-regnames
16030 @opindex mregnames
16031 @opindex mno-regnames
16032 On System V.4 and embedded PowerPC systems do (do not) emit register
16033 names in the assembly language output using symbolic forms.
16035 @item -mlongcall
16036 @itemx -mno-longcall
16037 @opindex mlongcall
16038 @opindex mno-longcall
16039 By default assume that all calls are far away so that a longer more
16040 expensive calling sequence is required.  This is required for calls
16041 further than 32 megabytes (33,554,432 bytes) from the current location.
16042 A short call will be generated if the compiler knows
16043 the call cannot be that far away.  This setting can be overridden by
16044 the @code{shortcall} function attribute, or by @code{#pragma
16045 longcall(0)}.
16047 Some linkers are capable of detecting out-of-range calls and generating
16048 glue code on the fly.  On these systems, long calls are unnecessary and
16049 generate slower code.  As of this writing, the AIX linker can do this,
16050 as can the GNU linker for PowerPC/64.  It is planned to add this feature
16051 to the GNU linker for 32-bit PowerPC systems as well.
16053 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
16054 callee, L42'', plus a ``branch island'' (glue code).  The two target
16055 addresses represent the callee and the ``branch island''.  The
16056 Darwin/PPC linker will prefer the first address and generate a ``bl
16057 callee'' if the PPC ``bl'' instruction will reach the callee directly;
16058 otherwise, the linker will generate ``bl L42'' to call the ``branch
16059 island''.  The ``branch island'' is appended to the body of the
16060 calling function; it computes the full 32-bit address of the callee
16061 and jumps to it.
16063 On Mach-O (Darwin) systems, this option directs the compiler emit to
16064 the glue for every direct call, and the Darwin linker decides whether
16065 to use or discard it.
16067 In the future, we may cause GCC to ignore all longcall specifications
16068 when the linker is known to generate glue.
16070 @item -mtls-markers
16071 @itemx -mno-tls-markers
16072 @opindex mtls-markers
16073 @opindex mno-tls-markers
16074 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
16075 specifying the function argument.  The relocation allows ld to
16076 reliably associate function call with argument setup instructions for
16077 TLS optimization, which in turn allows gcc to better schedule the
16078 sequence.
16080 @item -pthread
16081 @opindex pthread
16082 Adds support for multithreading with the @dfn{pthreads} library.
16083 This option sets flags for both the preprocessor and linker.
16085 @item -mrecip
16086 @itemx -mno-recip
16087 @opindex mrecip
16088 This option will enable GCC to use the reciprocal estimate and
16089 reciprocal square root estimate instructions with additional
16090 Newton-Raphson steps to increase precision instead of doing a divide or
16091 square root and divide for floating point arguments.  You should use
16092 the @option{-ffast-math} option when using @option{-mrecip} (or at
16093 least @option{-funsafe-math-optimizations},
16094 @option{-finite-math-only}, @option{-freciprocal-math} and
16095 @option{-fno-trapping-math}).  Note that while the throughput of the
16096 sequence is generally higher than the throughput of the non-reciprocal
16097 instruction, the precision of the sequence can be decreased by up to 2
16098 ulp (i.e. the inverse of 1.0 equals 0.99999994) for reciprocal square
16099 roots.
16101 @item -mrecip=@var{opt}
16102 @opindex mrecip=opt
16103 This option allows to control which reciprocal estimate instructions
16104 may be used.  @var{opt} is a comma separated list of options, that may
16105 be preceded by a @code{!} to invert the option:
16106 @code{all}: enable all estimate instructions,
16107 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
16108 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
16109 @code{div}: enable the reciprocal approximation instructions for both single and double precision;
16110 @code{divf}: enable the single precision reciprocal approximation instructions;
16111 @code{divd}: enable the double precision reciprocal approximation instructions;
16112 @code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
16113 @code{rsqrtf}: enable the single precision reciprocal square root approximation instructions;
16114 @code{rsqrtd}: enable the double precision reciprocal square root approximation instructions;
16116 So for example, @option{-mrecip=all,!rsqrtd} would enable the
16117 all of the reciprocal estimate instructions, except for the
16118 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
16119 which handle the double precision reciprocal square root calculations.
16121 @item -mrecip-precision
16122 @itemx -mno-recip-precision
16123 @opindex mrecip-precision
16124 Assume (do not assume) that the reciprocal estimate instructions
16125 provide higher precision estimates than is mandated by the powerpc
16126 ABI.  Selecting @option{-mcpu=power6} or @option{-mcpu=power7}
16127 automatically selects @option{-mrecip-precision}.  The double
16128 precision square root estimate instructions are not generated by
16129 default on low precision machines, since they do not provide an
16130 estimate that converges after three steps.
16132 @item -mveclibabi=@var{type}
16133 @opindex mveclibabi
16134 Specifies the ABI type to use for vectorizing intrinsics using an
16135 external library.  The only type supported at present is @code{mass},
16136 which specifies to use IBM's Mathematical Acceleration Subsystem
16137 (MASS) libraries for vectorizing intrinsics using external libraries.
16138 GCC will currently emit calls to @code{acosd2}, @code{acosf4},
16139 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
16140 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
16141 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
16142 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
16143 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
16144 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
16145 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
16146 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
16147 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
16148 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
16149 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
16150 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
16151 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
16152 for power7.  Both @option{-ftree-vectorize} and
16153 @option{-funsafe-math-optimizations} have to be enabled.  The MASS
16154 libraries will have to be specified at link time.
16156 @item -mfriz
16157 @itemx -mno-friz
16158 @opindex mfriz
16159 Generate (do not generate) the @code{friz} instruction when the
16160 @option{-funsafe-math-optimizations} option is used to optimize
16161 rounding a floating point value to 64-bit integer and back to floating
16162 point.  The @code{friz} instruction does not return the same value if
16163 the floating point number is too large to fit in an integer.
16164 @end table
16166 @node RX Options
16167 @subsection RX Options
16168 @cindex RX Options
16170 These command line options are defined for RX targets:
16172 @table @gcctabopt
16173 @item -m64bit-doubles
16174 @itemx -m32bit-doubles
16175 @opindex m64bit-doubles
16176 @opindex m32bit-doubles
16177 Make the @code{double} data type be 64-bits (@option{-m64bit-doubles})
16178 or 32-bits (@option{-m32bit-doubles}) in size.  The default is
16179 @option{-m32bit-doubles}.  @emph{Note} RX floating point hardware only
16180 works on 32-bit values, which is why the default is
16181 @option{-m32bit-doubles}.
16183 @item -fpu
16184 @itemx -nofpu
16185 @opindex fpu
16186 @opindex nofpu
16187 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
16188 floating point hardware.  The default is enabled for the @var{RX600}
16189 series and disabled for the @var{RX200} series.
16191 Floating point instructions will only be generated for 32-bit floating
16192 point values however, so if the @option{-m64bit-doubles} option is in
16193 use then the FPU hardware will not be used for doubles.
16195 @emph{Note} If the @option{-fpu} option is enabled then
16196 @option{-funsafe-math-optimizations} is also enabled automatically.
16197 This is because the RX FPU instructions are themselves unsafe.
16199 @item -mcpu=@var{name}
16200 @opindex -mcpu
16201 Selects the type of RX CPU to be targeted.  Currently three types are
16202 supported, the generic @var{RX600} and @var{RX200} series hardware and
16203 the specific @var{RX610} CPU.  The default is @var{RX600}.
16205 The only difference between @var{RX600} and @var{RX610} is that the
16206 @var{RX610} does not support the @code{MVTIPL} instruction.
16208 The @var{RX200} series does not have a hardware floating point unit
16209 and so @option{-nofpu} is enabled by default when this type is
16210 selected.
16212 @item -mbig-endian-data
16213 @itemx -mlittle-endian-data
16214 @opindex mbig-endian-data
16215 @opindex mlittle-endian-data
16216 Store data (but not code) in the big-endian format.  The default is
16217 @option{-mlittle-endian-data}, i.e.@: to store data in the little endian
16218 format.
16220 @item -msmall-data-limit=@var{N}
16221 @opindex msmall-data-limit
16222 Specifies the maximum size in bytes of global and static variables
16223 which can be placed into the small data area.  Using the small data
16224 area can lead to smaller and faster code, but the size of area is
16225 limited and it is up to the programmer to ensure that the area does
16226 not overflow.  Also when the small data area is used one of the RX's
16227 registers (@code{r13}) is reserved for use pointing to this area, so
16228 it is no longer available for use by the compiler.  This could result
16229 in slower and/or larger code if variables which once could have been
16230 held in @code{r13} are now pushed onto the stack.
16232 Note, common variables (variables which have not been initialised) and
16233 constants are not placed into the small data area as they are assigned
16234 to other sections in the output executable.
16236 The default value is zero, which disables this feature.  Note, this
16237 feature is not enabled by default with higher optimization levels
16238 (@option{-O2} etc) because of the potentially detrimental effects of
16239 reserving register @code{r13}.  It is up to the programmer to
16240 experiment and discover whether this feature is of benefit to their
16241 program.
16243 @item -msim
16244 @itemx -mno-sim
16245 @opindex msim
16246 @opindex mno-sim
16247 Use the simulator runtime.  The default is to use the libgloss board
16248 specific runtime.
16250 @item -mas100-syntax
16251 @itemx -mno-as100-syntax
16252 @opindex mas100-syntax
16253 @opindex mno-as100-syntax
16254 When generating assembler output use a syntax that is compatible with
16255 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
16256 assembler but it has some restrictions so generating it is not the
16257 default option.
16259 @item -mmax-constant-size=@var{N}
16260 @opindex mmax-constant-size
16261 Specifies the maximum size, in bytes, of a constant that can be used as
16262 an operand in a RX instruction.  Although the RX instruction set does
16263 allow constants of up to 4 bytes in length to be used in instructions,
16264 a longer value equates to a longer instruction.  Thus in some
16265 circumstances it can be beneficial to restrict the size of constants
16266 that are used in instructions.  Constants that are too big are instead
16267 placed into a constant pool and referenced via register indirection.
16269 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
16270 or 4 means that constants of any size are allowed.
16272 @item -mrelax
16273 @opindex mrelax
16274 Enable linker relaxation.  Linker relaxation is a process whereby the
16275 linker will attempt to reduce the size of a program by finding shorter
16276 versions of various instructions.  Disabled by default.
16278 @item -mint-register=@var{N}
16279 @opindex mint-register
16280 Specify the number of registers to reserve for fast interrupt handler
16281 functions.  The value @var{N} can be between 0 and 4.  A value of 1
16282 means that register @code{r13} will be reserved for the exclusive use
16283 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
16284 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
16285 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
16286 A value of 0, the default, does not reserve any registers.
16288 @item -msave-acc-in-interrupts
16289 @opindex msave-acc-in-interrupts
16290 Specifies that interrupt handler functions should preserve the
16291 accumulator register.  This is only necessary if normal code might use
16292 the accumulator register, for example because it performs 64-bit
16293 multiplications.  The default is to ignore the accumulator as this
16294 makes the interrupt handlers faster.
16296 @end table
16298 @emph{Note:} The generic GCC command line @option{-ffixed-@var{reg}}
16299 has special significance to the RX port when used with the
16300 @code{interrupt} function attribute.  This attribute indicates a
16301 function intended to process fast interrupts.  GCC will will ensure
16302 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
16303 and/or @code{r13} and only provided that the normal use of the
16304 corresponding registers have been restricted via the
16305 @option{-ffixed-@var{reg}} or @option{-mint-register} command line
16306 options.
16308 @node S/390 and zSeries Options
16309 @subsection S/390 and zSeries Options
16310 @cindex S/390 and zSeries Options
16312 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
16314 @table @gcctabopt
16315 @item -mhard-float
16316 @itemx -msoft-float
16317 @opindex mhard-float
16318 @opindex msoft-float
16319 Use (do not use) the hardware floating-point instructions and registers
16320 for floating-point operations.  When @option{-msoft-float} is specified,
16321 functions in @file{libgcc.a} will be used to perform floating-point
16322 operations.  When @option{-mhard-float} is specified, the compiler
16323 generates IEEE floating-point instructions.  This is the default.
16325 @item -mhard-dfp
16326 @itemx -mno-hard-dfp
16327 @opindex mhard-dfp
16328 @opindex mno-hard-dfp
16329 Use (do not use) the hardware decimal-floating-point instructions for
16330 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
16331 specified, functions in @file{libgcc.a} will be used to perform
16332 decimal-floating-point operations.  When @option{-mhard-dfp} is
16333 specified, the compiler generates decimal-floating-point hardware
16334 instructions.  This is the default for @option{-march=z9-ec} or higher.
16336 @item -mlong-double-64
16337 @itemx -mlong-double-128
16338 @opindex mlong-double-64
16339 @opindex mlong-double-128
16340 These switches control the size of @code{long double} type. A size
16341 of 64bit makes the @code{long double} type equivalent to the @code{double}
16342 type. This is the default.
16344 @item -mbackchain
16345 @itemx -mno-backchain
16346 @opindex mbackchain
16347 @opindex mno-backchain
16348 Store (do not store) the address of the caller's frame as backchain pointer
16349 into the callee's stack frame.
16350 A backchain may be needed to allow debugging using tools that do not understand
16351 DWARF-2 call frame information.
16352 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
16353 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
16354 the backchain is placed into the topmost word of the 96/160 byte register
16355 save area.
16357 In general, code compiled with @option{-mbackchain} is call-compatible with
16358 code compiled with @option{-mmo-backchain}; however, use of the backchain
16359 for debugging purposes usually requires that the whole binary is built with
16360 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
16361 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
16362 to build a linux kernel use @option{-msoft-float}.
16364 The default is to not maintain the backchain.
16366 @item -mpacked-stack
16367 @itemx -mno-packed-stack
16368 @opindex mpacked-stack
16369 @opindex mno-packed-stack
16370 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
16371 specified, the compiler uses the all fields of the 96/160 byte register save
16372 area only for their default purpose; unused fields still take up stack space.
16373 When @option{-mpacked-stack} is specified, register save slots are densely
16374 packed at the top of the register save area; unused space is reused for other
16375 purposes, allowing for more efficient use of the available stack space.
16376 However, when @option{-mbackchain} is also in effect, the topmost word of
16377 the save area is always used to store the backchain, and the return address
16378 register is always saved two words below the backchain.
16380 As long as the stack frame backchain is not used, code generated with
16381 @option{-mpacked-stack} is call-compatible with code generated with
16382 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
16383 S/390 or zSeries generated code that uses the stack frame backchain at run
16384 time, not just for debugging purposes.  Such code is not call-compatible
16385 with code compiled with @option{-mpacked-stack}.  Also, note that the
16386 combination of @option{-mbackchain},
16387 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
16388 to build a linux kernel use @option{-msoft-float}.
16390 The default is to not use the packed stack layout.
16392 @item -msmall-exec
16393 @itemx -mno-small-exec
16394 @opindex msmall-exec
16395 @opindex mno-small-exec
16396 Generate (or do not generate) code using the @code{bras} instruction
16397 to do subroutine calls.
16398 This only works reliably if the total executable size does not
16399 exceed 64k.  The default is to use the @code{basr} instruction instead,
16400 which does not have this limitation.
16402 @item -m64
16403 @itemx -m31
16404 @opindex m64
16405 @opindex m31
16406 When @option{-m31} is specified, generate code compliant to the
16407 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
16408 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
16409 particular to generate 64-bit instructions.  For the @samp{s390}
16410 targets, the default is @option{-m31}, while the @samp{s390x}
16411 targets default to @option{-m64}.
16413 @item -mzarch
16414 @itemx -mesa
16415 @opindex mzarch
16416 @opindex mesa
16417 When @option{-mzarch} is specified, generate code using the
16418 instructions available on z/Architecture.
16419 When @option{-mesa} is specified, generate code using the
16420 instructions available on ESA/390.  Note that @option{-mesa} is
16421 not possible with @option{-m64}.
16422 When generating code compliant to the GNU/Linux for S/390 ABI,
16423 the default is @option{-mesa}.  When generating code compliant
16424 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
16426 @item -mmvcle
16427 @itemx -mno-mvcle
16428 @opindex mmvcle
16429 @opindex mno-mvcle
16430 Generate (or do not generate) code using the @code{mvcle} instruction
16431 to perform block moves.  When @option{-mno-mvcle} is specified,
16432 use a @code{mvc} loop instead.  This is the default unless optimizing for
16433 size.
16435 @item -mdebug
16436 @itemx -mno-debug
16437 @opindex mdebug
16438 @opindex mno-debug
16439 Print (or do not print) additional debug information when compiling.
16440 The default is to not print debug information.
16442 @item -march=@var{cpu-type}
16443 @opindex march
16444 Generate code that will run on @var{cpu-type}, which is the name of a system
16445 representing a certain processor type.  Possible values for
16446 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
16447 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
16448 When generating code using the instructions available on z/Architecture,
16449 the default is @option{-march=z900}.  Otherwise, the default is
16450 @option{-march=g5}.
16452 @item -mtune=@var{cpu-type}
16453 @opindex mtune
16454 Tune to @var{cpu-type} everything applicable about the generated code,
16455 except for the ABI and the set of available instructions.
16456 The list of @var{cpu-type} values is the same as for @option{-march}.
16457 The default is the value used for @option{-march}.
16459 @item -mtpf-trace
16460 @itemx -mno-tpf-trace
16461 @opindex mtpf-trace
16462 @opindex mno-tpf-trace
16463 Generate code that adds (does not add) in TPF OS specific branches to trace
16464 routines in the operating system.  This option is off by default, even
16465 when compiling for the TPF OS@.
16467 @item -mfused-madd
16468 @itemx -mno-fused-madd
16469 @opindex mfused-madd
16470 @opindex mno-fused-madd
16471 Generate code that uses (does not use) the floating point multiply and
16472 accumulate instructions.  These instructions are generated by default if
16473 hardware floating point is used.
16475 @item -mwarn-framesize=@var{framesize}
16476 @opindex mwarn-framesize
16477 Emit a warning if the current function exceeds the given frame size.  Because
16478 this is a compile time check it doesn't need to be a real problem when the program
16479 runs.  It is intended to identify functions which most probably cause
16480 a stack overflow.  It is useful to be used in an environment with limited stack
16481 size e.g.@: the linux kernel.
16483 @item -mwarn-dynamicstack
16484 @opindex mwarn-dynamicstack
16485 Emit a warning if the function calls alloca or uses dynamically
16486 sized arrays.  This is generally a bad idea with a limited stack size.
16488 @item -mstack-guard=@var{stack-guard}
16489 @itemx -mstack-size=@var{stack-size}
16490 @opindex mstack-guard
16491 @opindex mstack-size
16492 If these options are provided the s390 back end emits additional instructions in
16493 the function prologue which trigger a trap if the stack size is @var{stack-guard}
16494 bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
16495 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
16496 the frame size of the compiled function is chosen.
16497 These options are intended to be used to help debugging stack overflow problems.
16498 The additionally emitted code causes only little overhead and hence can also be
16499 used in production like systems without greater performance degradation.  The given
16500 values have to be exact powers of 2 and @var{stack-size} has to be greater than
16501 @var{stack-guard} without exceeding 64k.
16502 In order to be efficient the extra code makes the assumption that the stack starts
16503 at an address aligned to the value given by @var{stack-size}.
16504 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
16505 @end table
16507 @node Score Options
16508 @subsection Score Options
16509 @cindex Score Options
16511 These options are defined for Score implementations:
16513 @table @gcctabopt
16514 @item -meb
16515 @opindex meb
16516 Compile code for big endian mode.  This is the default.
16518 @item -mel
16519 @opindex mel
16520 Compile code for little endian mode.
16522 @item -mnhwloop
16523 @opindex mnhwloop
16524 Disable generate bcnz instruction.
16526 @item -muls
16527 @opindex muls
16528 Enable generate unaligned load and store instruction.
16530 @item -mmac
16531 @opindex mmac
16532 Enable the use of multiply-accumulate instructions. Disabled by default.
16534 @item -mscore5
16535 @opindex mscore5
16536 Specify the SCORE5 as the target architecture.
16538 @item -mscore5u
16539 @opindex mscore5u
16540 Specify the SCORE5U of the target architecture.
16542 @item -mscore7
16543 @opindex mscore7
16544 Specify the SCORE7 as the target architecture. This is the default.
16546 @item -mscore7d
16547 @opindex mscore7d
16548 Specify the SCORE7D as the target architecture.
16549 @end table
16551 @node SH Options
16552 @subsection SH Options
16554 These @samp{-m} options are defined for the SH implementations:
16556 @table @gcctabopt
16557 @item -m1
16558 @opindex m1
16559 Generate code for the SH1.
16561 @item -m2
16562 @opindex m2
16563 Generate code for the SH2.
16565 @item -m2e
16566 Generate code for the SH2e.
16568 @item -m2a-nofpu
16569 @opindex m2a-nofpu
16570 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
16571 that the floating-point unit is not used.
16573 @item -m2a-single-only
16574 @opindex m2a-single-only
16575 Generate code for the SH2a-FPU, in such a way that no double-precision
16576 floating point operations are used.
16578 @item -m2a-single
16579 @opindex m2a-single
16580 Generate code for the SH2a-FPU assuming the floating-point unit is in
16581 single-precision mode by default.
16583 @item -m2a
16584 @opindex m2a
16585 Generate code for the SH2a-FPU assuming the floating-point unit is in
16586 double-precision mode by default.
16588 @item -m3
16589 @opindex m3
16590 Generate code for the SH3.
16592 @item -m3e
16593 @opindex m3e
16594 Generate code for the SH3e.
16596 @item -m4-nofpu
16597 @opindex m4-nofpu
16598 Generate code for the SH4 without a floating-point unit.
16600 @item -m4-single-only
16601 @opindex m4-single-only
16602 Generate code for the SH4 with a floating-point unit that only
16603 supports single-precision arithmetic.
16605 @item -m4-single
16606 @opindex m4-single
16607 Generate code for the SH4 assuming the floating-point unit is in
16608 single-precision mode by default.
16610 @item -m4
16611 @opindex m4
16612 Generate code for the SH4.
16614 @item -m4a-nofpu
16615 @opindex m4a-nofpu
16616 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
16617 floating-point unit is not used.
16619 @item -m4a-single-only
16620 @opindex m4a-single-only
16621 Generate code for the SH4a, in such a way that no double-precision
16622 floating point operations are used.
16624 @item -m4a-single
16625 @opindex m4a-single
16626 Generate code for the SH4a assuming the floating-point unit is in
16627 single-precision mode by default.
16629 @item -m4a
16630 @opindex m4a
16631 Generate code for the SH4a.
16633 @item -m4al
16634 @opindex m4al
16635 Same as @option{-m4a-nofpu}, except that it implicitly passes
16636 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
16637 instructions at the moment.
16639 @item -mb
16640 @opindex mb
16641 Compile code for the processor in big endian mode.
16643 @item -ml
16644 @opindex ml
16645 Compile code for the processor in little endian mode.
16647 @item -mdalign
16648 @opindex mdalign
16649 Align doubles at 64-bit boundaries.  Note that this changes the calling
16650 conventions, and thus some functions from the standard C library will
16651 not work unless you recompile it first with @option{-mdalign}.
16653 @item -mrelax
16654 @opindex mrelax
16655 Shorten some address references at link time, when possible; uses the
16656 linker option @option{-relax}.
16658 @item -mbigtable
16659 @opindex mbigtable
16660 Use 32-bit offsets in @code{switch} tables.  The default is to use
16661 16-bit offsets.
16663 @item -mbitops
16664 @opindex mbitops
16665 Enable the use of bit manipulation instructions on SH2A.
16667 @item -mfmovd
16668 @opindex mfmovd
16669 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
16670 alignment constraints.
16672 @item -mhitachi
16673 @opindex mhitachi
16674 Comply with the calling conventions defined by Renesas.
16676 @item -mrenesas
16677 @opindex mhitachi
16678 Comply with the calling conventions defined by Renesas.
16680 @item -mno-renesas
16681 @opindex mhitachi
16682 Comply with the calling conventions defined for GCC before the Renesas
16683 conventions were available.  This option is the default for all
16684 targets of the SH toolchain.
16686 @item -mnomacsave
16687 @opindex mnomacsave
16688 Mark the @code{MAC} register as call-clobbered, even if
16689 @option{-mhitachi} is given.
16691 @item -mieee
16692 @opindex mieee
16693 Increase IEEE-compliance of floating-point code.
16694 At the moment, this is equivalent to @option{-fno-finite-math-only}.
16695 When generating 16 bit SH opcodes, getting IEEE-conforming results for
16696 comparisons of NANs / infinities incurs extra overhead in every
16697 floating point comparison, therefore the default is set to
16698 @option{-ffinite-math-only}.
16700 @item -minline-ic_invalidate
16701 @opindex minline-ic_invalidate
16702 Inline code to invalidate instruction cache entries after setting up
16703 nested function trampolines.
16704 This option has no effect if -musermode is in effect and the selected
16705 code generation option (e.g. -m4) does not allow the use of the icbi
16706 instruction.
16707 If the selected code generation option does not allow the use of the icbi
16708 instruction, and -musermode is not in effect, the inlined code will
16709 manipulate the instruction cache address array directly with an associative
16710 write.  This not only requires privileged mode, but it will also
16711 fail if the cache line had been mapped via the TLB and has become unmapped.
16713 @item -misize
16714 @opindex misize
16715 Dump instruction size and location in the assembly code.
16717 @item -mpadstruct
16718 @opindex mpadstruct
16719 This option is deprecated.  It pads structures to multiple of 4 bytes,
16720 which is incompatible with the SH ABI@.
16722 @item -mspace
16723 @opindex mspace
16724 Optimize for space instead of speed.  Implied by @option{-Os}.
16726 @item -mprefergot
16727 @opindex mprefergot
16728 When generating position-independent code, emit function calls using
16729 the Global Offset Table instead of the Procedure Linkage Table.
16731 @item -musermode
16732 @opindex musermode
16733 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
16734 if the inlined code would not work in user mode.
16735 This is the default when the target is @code{sh-*-linux*}.
16737 @item -multcost=@var{number}
16738 @opindex multcost=@var{number}
16739 Set the cost to assume for a multiply insn.
16741 @item -mdiv=@var{strategy}
16742 @opindex mdiv=@var{strategy}
16743 Set the division strategy to use for SHmedia code.  @var{strategy} must be
16744 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
16745 inv:call2, inv:fp .
16746 "fp" performs the operation in floating point.  This has a very high latency,
16747 but needs only a few instructions, so it might be a good choice if
16748 your code has enough easily exploitable ILP to allow the compiler to
16749 schedule the floating point instructions together with other instructions.
16750 Division by zero causes a floating point exception.
16751 "inv" uses integer operations to calculate the inverse of the divisor,
16752 and then multiplies the dividend with the inverse.  This strategy allows
16753 cse and hoisting of the inverse calculation.  Division by zero calculates
16754 an unspecified result, but does not trap.
16755 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
16756 have been found, or if the entire operation has been hoisted to the same
16757 place, the last stages of the inverse calculation are intertwined with the
16758 final multiply to reduce the overall latency, at the expense of using a few
16759 more instructions, and thus offering fewer scheduling opportunities with
16760 other code.
16761 "call" calls a library function that usually implements the inv:minlat
16762 strategy.
16763 This gives high code density for m5-*media-nofpu compilations.
16764 "call2" uses a different entry point of the same library function, where it
16765 assumes that a pointer to a lookup table has already been set up, which
16766 exposes the pointer load to cse / code hoisting optimizations.
16767 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
16768 code generation, but if the code stays unoptimized, revert to the "call",
16769 "call2", or "fp" strategies, respectively.  Note that the
16770 potentially-trapping side effect of division by zero is carried by a
16771 separate instruction, so it is possible that all the integer instructions
16772 are hoisted out, but the marker for the side effect stays where it is.
16773 A recombination to fp operations or a call is not possible in that case.
16774 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
16775 that the inverse calculation was nor separated from the multiply, they speed
16776 up division where the dividend fits into 20 bits (plus sign where applicable),
16777 by inserting a test to skip a number of operations in this case; this test
16778 slows down the case of larger dividends.  inv20u assumes the case of a such
16779 a small dividend to be unlikely, and inv20l assumes it to be likely.
16781 @item -maccumulate-outgoing-args
16782 @opindex maccumulate-outgoing-args
16783 Reserve space once for outgoing arguments in the function prologue rather 
16784 than around each call.  Generally beneficial for performance and size.  Also
16785 needed for unwinding to avoid changing the stack frame around conditional code.
16787 @item -mdivsi3_libfunc=@var{name}
16788 @opindex mdivsi3_libfunc=@var{name}
16789 Set the name of the library function used for 32 bit signed division to
16790 @var{name}.  This only affect the name used in the call and inv:call
16791 division strategies, and the compiler will still expect the same
16792 sets of input/output/clobbered registers as if this option was not present.
16794 @item -mfixed-range=@var{register-range}
16795 @opindex mfixed-range
16796 Generate code treating the given register range as fixed registers.
16797 A fixed register is one that the register allocator can not use.  This is
16798 useful when compiling kernel code.  A register range is specified as
16799 two registers separated by a dash.  Multiple register ranges can be
16800 specified separated by a comma.
16802 @item -madjust-unroll
16803 @opindex madjust-unroll
16804 Throttle unrolling to avoid thrashing target registers.
16805 This option only has an effect if the gcc code base supports the
16806 TARGET_ADJUST_UNROLL_MAX target hook.
16808 @item -mindexed-addressing
16809 @opindex mindexed-addressing
16810 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
16811 This is only safe if the hardware and/or OS implement 32 bit wrap-around
16812 semantics for the indexed addressing mode.  The architecture allows the
16813 implementation of processors with 64 bit MMU, which the OS could use to
16814 get 32 bit addressing, but since no current hardware implementation supports
16815 this or any other way to make the indexed addressing mode safe to use in
16816 the 32 bit ABI, the default is -mno-indexed-addressing.
16818 @item -mgettrcost=@var{number}
16819 @opindex mgettrcost=@var{number}
16820 Set the cost assumed for the gettr instruction to @var{number}.
16821 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
16823 @item -mpt-fixed
16824 @opindex mpt-fixed
16825 Assume pt* instructions won't trap.  This will generally generate better
16826 scheduled code, but is unsafe on current hardware.  The current architecture
16827 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
16828 This has the unintentional effect of making it unsafe to schedule ptabs /
16829 ptrel before a branch, or hoist it out of a loop.  For example,
16830 __do_global_ctors, a part of libgcc that runs constructors at program
16831 startup, calls functions in a list which is delimited by @minus{}1.  With the
16832 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
16833 That means that all the constructors will be run a bit quicker, but when
16834 the loop comes to the end of the list, the program crashes because ptabs
16835 loads @minus{}1 into a target register.  Since this option is unsafe for any
16836 hardware implementing the current architecture specification, the default
16837 is -mno-pt-fixed.  Unless the user specifies a specific cost with
16838 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
16839 this deters register allocation using target registers for storing
16840 ordinary integers.
16842 @item -minvalid-symbols
16843 @opindex minvalid-symbols
16844 Assume symbols might be invalid.  Ordinary function symbols generated by
16845 the compiler will always be valid to load with movi/shori/ptabs or
16846 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
16847 to generate symbols that will cause ptabs / ptrel to trap.
16848 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
16849 It will then prevent cross-basic-block cse, hoisting and most scheduling
16850 of symbol loads.  The default is @option{-mno-invalid-symbols}.
16851 @end table
16853 @node Solaris 2 Options
16854 @subsection Solaris 2 Options
16855 @cindex Solaris 2 options
16857 These @samp{-m} options are supported on Solaris 2:
16859 @table @gcctabopt
16860 @item -mimpure-text
16861 @opindex mimpure-text
16862 @option{-mimpure-text}, used in addition to @option{-shared}, tells
16863 the compiler to not pass @option{-z text} to the linker when linking a
16864 shared object.  Using this option, you can link position-dependent
16865 code into a shared object.
16867 @option{-mimpure-text} suppresses the ``relocations remain against
16868 allocatable but non-writable sections'' linker error message.
16869 However, the necessary relocations will trigger copy-on-write, and the
16870 shared object is not actually shared across processes.  Instead of
16871 using @option{-mimpure-text}, you should compile all source code with
16872 @option{-fpic} or @option{-fPIC}.
16874 @end table
16876 These switches are supported in addition to the above on Solaris 2:
16878 @table @gcctabopt
16879 @item -pthreads
16880 @opindex pthreads
16881 Add support for multithreading using the POSIX threads library.  This
16882 option sets flags for both the preprocessor and linker.  This option does
16883 not affect the thread safety of object code produced  by the compiler or
16884 that of libraries supplied with it.
16886 @item -pthread
16887 @opindex pthread
16888 This is a synonym for @option{-pthreads}.
16889 @end table
16891 @node SPARC Options
16892 @subsection SPARC Options
16893 @cindex SPARC options
16895 These @samp{-m} options are supported on the SPARC:
16897 @table @gcctabopt
16898 @item -mno-app-regs
16899 @itemx -mapp-regs
16900 @opindex mno-app-regs
16901 @opindex mapp-regs
16902 Specify @option{-mapp-regs} to generate output using the global registers
16903 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
16904 is the default.
16906 To be fully SVR4 ABI compliant at the cost of some performance loss,
16907 specify @option{-mno-app-regs}.  You should compile libraries and system
16908 software with this option.
16910 @item -mfpu
16911 @itemx -mhard-float
16912 @opindex mfpu
16913 @opindex mhard-float
16914 Generate output containing floating point instructions.  This is the
16915 default.
16917 @item -mno-fpu
16918 @itemx -msoft-float
16919 @opindex mno-fpu
16920 @opindex msoft-float
16921 Generate output containing library calls for floating point.
16922 @strong{Warning:} the requisite libraries are not available for all SPARC
16923 targets.  Normally the facilities of the machine's usual C compiler are
16924 used, but this cannot be done directly in cross-compilation.  You must make
16925 your own arrangements to provide suitable library functions for
16926 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
16927 @samp{sparclite-*-*} do provide software floating point support.
16929 @option{-msoft-float} changes the calling convention in the output file;
16930 therefore, it is only useful if you compile @emph{all} of a program with
16931 this option.  In particular, you need to compile @file{libgcc.a}, the
16932 library that comes with GCC, with @option{-msoft-float} in order for
16933 this to work.
16935 @item -mhard-quad-float
16936 @opindex mhard-quad-float
16937 Generate output containing quad-word (long double) floating point
16938 instructions.
16940 @item -msoft-quad-float
16941 @opindex msoft-quad-float
16942 Generate output containing library calls for quad-word (long double)
16943 floating point instructions.  The functions called are those specified
16944 in the SPARC ABI@.  This is the default.
16946 As of this writing, there are no SPARC implementations that have hardware
16947 support for the quad-word floating point instructions.  They all invoke
16948 a trap handler for one of these instructions, and then the trap handler
16949 emulates the effect of the instruction.  Because of the trap handler overhead,
16950 this is much slower than calling the ABI library routines.  Thus the
16951 @option{-msoft-quad-float} option is the default.
16953 @item -mno-unaligned-doubles
16954 @itemx -munaligned-doubles
16955 @opindex mno-unaligned-doubles
16956 @opindex munaligned-doubles
16957 Assume that doubles have 8 byte alignment.  This is the default.
16959 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
16960 alignment only if they are contained in another type, or if they have an
16961 absolute address.  Otherwise, it assumes they have 4 byte alignment.
16962 Specifying this option avoids some rare compatibility problems with code
16963 generated by other compilers.  It is not the default because it results
16964 in a performance loss, especially for floating point code.
16966 @item -mno-faster-structs
16967 @itemx -mfaster-structs
16968 @opindex mno-faster-structs
16969 @opindex mfaster-structs
16970 With @option{-mfaster-structs}, the compiler assumes that structures
16971 should have 8 byte alignment.  This enables the use of pairs of
16972 @code{ldd} and @code{std} instructions for copies in structure
16973 assignment, in place of twice as many @code{ld} and @code{st} pairs.
16974 However, the use of this changed alignment directly violates the SPARC
16975 ABI@.  Thus, it's intended only for use on targets where the developer
16976 acknowledges that their resulting code will not be directly in line with
16977 the rules of the ABI@.
16979 @item -mcpu=@var{cpu_type}
16980 @opindex mcpu
16981 Set the instruction set, register set, and instruction scheduling parameters
16982 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
16983 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
16984 @samp{leon}, @samp{sparclite}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
16985 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
16986 @samp{ultrasparc3}, @samp{niagara} and @samp{niagara2}.
16988 Default instruction scheduling parameters are used for values that select
16989 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
16990 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
16992 Here is a list of each supported architecture and their supported
16993 implementations.
16995 @smallexample
16996     v7:             cypress
16997     v8:             supersparc, hypersparc, leon
16998     sparclite:      f930, f934, sparclite86x
16999     sparclet:       tsc701
17000     v9:             ultrasparc, ultrasparc3, niagara, niagara2
17001 @end smallexample
17003 By default (unless configured otherwise), GCC generates code for the V7
17004 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
17005 additionally optimizes it for the Cypress CY7C602 chip, as used in the
17006 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
17007 SPARCStation 1, 2, IPX etc.
17009 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
17010 architecture.  The only difference from V7 code is that the compiler emits
17011 the integer multiply and integer divide instructions which exist in SPARC-V8
17012 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
17013 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
17014 2000 series.
17016 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
17017 the SPARC architecture.  This adds the integer multiply, integer divide step
17018 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
17019 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
17020 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
17021 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
17022 MB86934 chip, which is the more recent SPARClite with FPU@.
17024 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
17025 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
17026 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
17027 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
17028 optimizes it for the TEMIC SPARClet chip.
17030 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
17031 architecture.  This adds 64-bit integer and floating-point move instructions,
17032 3 additional floating-point condition code registers and conditional move
17033 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
17034 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
17035 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
17036 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
17037 @option{-mcpu=niagara}, the compiler additionally optimizes it for
17038 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
17039 additionally optimizes it for Sun UltraSPARC T2 chips.
17041 @item -mtune=@var{cpu_type}
17042 @opindex mtune
17043 Set the instruction scheduling parameters for machine type
17044 @var{cpu_type}, but do not set the instruction set or register set that the
17045 option @option{-mcpu=@var{cpu_type}} would.
17047 The same values for @option{-mcpu=@var{cpu_type}} can be used for
17048 @option{-mtune=@var{cpu_type}}, but the only useful values are those
17049 that select a particular CPU implementation.  Those are @samp{cypress},
17050 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{f930}, @samp{f934},
17051 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, @samp{ultrasparc3},
17052 @samp{niagara}, and @samp{niagara2}.
17054 @item -mv8plus
17055 @itemx -mno-v8plus
17056 @opindex mv8plus
17057 @opindex mno-v8plus
17058 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
17059 difference from the V8 ABI is that the global and out registers are
17060 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
17061 mode for all SPARC-V9 processors.
17063 @item -mvis
17064 @itemx -mno-vis
17065 @opindex mvis
17066 @opindex mno-vis
17067 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
17068 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
17069 @end table
17071 These @samp{-m} options are supported in addition to the above
17072 on SPARC-V9 processors in 64-bit environments:
17074 @table @gcctabopt
17075 @item -mlittle-endian
17076 @opindex mlittle-endian
17077 Generate code for a processor running in little-endian mode.  It is only
17078 available for a few configurations and most notably not on Solaris and Linux.
17080 @item -m32
17081 @itemx -m64
17082 @opindex m32
17083 @opindex m64
17084 Generate code for a 32-bit or 64-bit environment.
17085 The 32-bit environment sets int, long and pointer to 32 bits.
17086 The 64-bit environment sets int to 32 bits and long and pointer
17087 to 64 bits.
17089 @item -mcmodel=medlow
17090 @opindex mcmodel=medlow
17091 Generate code for the Medium/Low code model: 64-bit addresses, programs
17092 must be linked in the low 32 bits of memory.  Programs can be statically
17093 or dynamically linked.
17095 @item -mcmodel=medmid
17096 @opindex mcmodel=medmid
17097 Generate code for the Medium/Middle code model: 64-bit addresses, programs
17098 must be linked in the low 44 bits of memory, the text and data segments must
17099 be less than 2GB in size and the data segment must be located within 2GB of
17100 the text segment.
17102 @item -mcmodel=medany
17103 @opindex mcmodel=medany
17104 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
17105 may be linked anywhere in memory, the text and data segments must be less
17106 than 2GB in size and the data segment must be located within 2GB of the
17107 text segment.
17109 @item -mcmodel=embmedany
17110 @opindex mcmodel=embmedany
17111 Generate code for the Medium/Anywhere code model for embedded systems:
17112 64-bit addresses, the text and data segments must be less than 2GB in
17113 size, both starting anywhere in memory (determined at link time).  The
17114 global register %g4 points to the base of the data segment.  Programs
17115 are statically linked and PIC is not supported.
17117 @item -mstack-bias
17118 @itemx -mno-stack-bias
17119 @opindex mstack-bias
17120 @opindex mno-stack-bias
17121 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
17122 frame pointer if present, are offset by @minus{}2047 which must be added back
17123 when making stack frame references.  This is the default in 64-bit mode.
17124 Otherwise, assume no such offset is present.
17125 @end table
17127 @node SPU Options
17128 @subsection SPU Options
17129 @cindex SPU options
17131 These @samp{-m} options are supported on the SPU:
17133 @table @gcctabopt
17134 @item -mwarn-reloc
17135 @itemx -merror-reloc
17136 @opindex mwarn-reloc
17137 @opindex merror-reloc
17139 The loader for SPU does not handle dynamic relocations.  By default, GCC
17140 will give an error when it generates code that requires a dynamic
17141 relocation.  @option{-mno-error-reloc} disables the error,
17142 @option{-mwarn-reloc} will generate a warning instead.
17144 @item -msafe-dma
17145 @itemx -munsafe-dma
17146 @opindex msafe-dma
17147 @opindex munsafe-dma
17149 Instructions which initiate or test completion of DMA must not be
17150 reordered with respect to loads and stores of the memory which is being
17151 accessed.  Users typically address this problem using the volatile
17152 keyword, but that can lead to inefficient code in places where the
17153 memory is known to not change.  Rather than mark the memory as volatile
17154 we treat the DMA instructions as potentially effecting all memory.  With
17155 @option{-munsafe-dma} users must use the volatile keyword to protect
17156 memory accesses.
17158 @item -mbranch-hints
17159 @opindex mbranch-hints
17161 By default, GCC will generate a branch hint instruction to avoid
17162 pipeline stalls for always taken or probably taken branches.  A hint
17163 will not be generated closer than 8 instructions away from its branch.
17164 There is little reason to disable them, except for debugging purposes,
17165 or to make an object a little bit smaller.
17167 @item -msmall-mem
17168 @itemx -mlarge-mem
17169 @opindex msmall-mem
17170 @opindex mlarge-mem
17172 By default, GCC generates code assuming that addresses are never larger
17173 than 18 bits.  With @option{-mlarge-mem} code is generated that assumes
17174 a full 32 bit address.
17176 @item -mstdmain
17177 @opindex mstdmain
17179 By default, GCC links against startup code that assumes the SPU-style
17180 main function interface (which has an unconventional parameter list).
17181 With @option{-mstdmain}, GCC will link your program against startup
17182 code that assumes a C99-style interface to @code{main}, including a
17183 local copy of @code{argv} strings.
17185 @item -mfixed-range=@var{register-range}
17186 @opindex mfixed-range
17187 Generate code treating the given register range as fixed registers.
17188 A fixed register is one that the register allocator can not use.  This is
17189 useful when compiling kernel code.  A register range is specified as
17190 two registers separated by a dash.  Multiple register ranges can be
17191 specified separated by a comma.
17193 @item -mea32
17194 @itemx -mea64
17195 @opindex mea32
17196 @opindex mea64
17197 Compile code assuming that pointers to the PPU address space accessed
17198 via the @code{__ea} named address space qualifier are either 32 or 64
17199 bits wide.  The default is 32 bits.  As this is an ABI changing option,
17200 all object code in an executable must be compiled with the same setting.
17202 @item -maddress-space-conversion
17203 @itemx -mno-address-space-conversion
17204 @opindex maddress-space-conversion
17205 @opindex mno-address-space-conversion
17206 Allow/disallow treating the @code{__ea} address space as superset
17207 of the generic address space.  This enables explicit type casts
17208 between @code{__ea} and generic pointer as well as implicit
17209 conversions of generic pointers to @code{__ea} pointers.  The
17210 default is to allow address space pointer conversions.
17212 @item -mcache-size=@var{cache-size}
17213 @opindex mcache-size
17214 This option controls the version of libgcc that the compiler links to an
17215 executable and selects a software-managed cache for accessing variables
17216 in the @code{__ea} address space with a particular cache size.  Possible
17217 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
17218 and @samp{128}.  The default cache size is 64KB.
17220 @item -matomic-updates
17221 @itemx -mno-atomic-updates
17222 @opindex matomic-updates
17223 @opindex mno-atomic-updates
17224 This option controls the version of libgcc that the compiler links to an
17225 executable and selects whether atomic updates to the software-managed
17226 cache of PPU-side variables are used.  If you use atomic updates, changes
17227 to a PPU variable from SPU code using the @code{__ea} named address space
17228 qualifier will not interfere with changes to other PPU variables residing
17229 in the same cache line from PPU code.  If you do not use atomic updates,
17230 such interference may occur; however, writing back cache lines will be
17231 more efficient.  The default behavior is to use atomic updates.
17233 @item -mdual-nops
17234 @itemx -mdual-nops=@var{n}
17235 @opindex mdual-nops
17236 By default, GCC will insert nops to increase dual issue when it expects
17237 it to increase performance.  @var{n} can be a value from 0 to 10.  A
17238 smaller @var{n} will insert fewer nops.  10 is the default, 0 is the
17239 same as @option{-mno-dual-nops}.  Disabled with @option{-Os}.
17241 @item -mhint-max-nops=@var{n}
17242 @opindex mhint-max-nops
17243 Maximum number of nops to insert for a branch hint.  A branch hint must
17244 be at least 8 instructions away from the branch it is effecting.  GCC
17245 will insert up to @var{n} nops to enforce this, otherwise it will not
17246 generate the branch hint.
17248 @item -mhint-max-distance=@var{n}
17249 @opindex mhint-max-distance
17250 The encoding of the branch hint instruction limits the hint to be within
17251 256 instructions of the branch it is effecting.  By default, GCC makes
17252 sure it is within 125.
17254 @item -msafe-hints
17255 @opindex msafe-hints
17256 Work around a hardware bug which causes the SPU to stall indefinitely.
17257 By default, GCC will insert the @code{hbrp} instruction to make sure
17258 this stall won't happen.
17260 @end table
17262 @node System V Options
17263 @subsection Options for System V
17265 These additional options are available on System V Release 4 for
17266 compatibility with other compilers on those systems:
17268 @table @gcctabopt
17269 @item -G
17270 @opindex G
17271 Create a shared object.
17272 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
17274 @item -Qy
17275 @opindex Qy
17276 Identify the versions of each tool used by the compiler, in a
17277 @code{.ident} assembler directive in the output.
17279 @item -Qn
17280 @opindex Qn
17281 Refrain from adding @code{.ident} directives to the output file (this is
17282 the default).
17284 @item -YP,@var{dirs}
17285 @opindex YP
17286 Search the directories @var{dirs}, and no others, for libraries
17287 specified with @option{-l}.
17289 @item -Ym,@var{dir}
17290 @opindex Ym
17291 Look in the directory @var{dir} to find the M4 preprocessor.
17292 The assembler uses this option.
17293 @c This is supposed to go with a -Yd for predefined M4 macro files, but
17294 @c the generic assembler that comes with Solaris takes just -Ym.
17295 @end table
17297 @node V850 Options
17298 @subsection V850 Options
17299 @cindex V850 Options
17301 These @samp{-m} options are defined for V850 implementations:
17303 @table @gcctabopt
17304 @item -mlong-calls
17305 @itemx -mno-long-calls
17306 @opindex mlong-calls
17307 @opindex mno-long-calls
17308 Treat all calls as being far away (near).  If calls are assumed to be
17309 far away, the compiler will always load the functions address up into a
17310 register, and call indirect through the pointer.
17312 @item -mno-ep
17313 @itemx -mep
17314 @opindex mno-ep
17315 @opindex mep
17316 Do not optimize (do optimize) basic blocks that use the same index
17317 pointer 4 or more times to copy pointer into the @code{ep} register, and
17318 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
17319 option is on by default if you optimize.
17321 @item -mno-prolog-function
17322 @itemx -mprolog-function
17323 @opindex mno-prolog-function
17324 @opindex mprolog-function
17325 Do not use (do use) external functions to save and restore registers
17326 at the prologue and epilogue of a function.  The external functions
17327 are slower, but use less code space if more than one function saves
17328 the same number of registers.  The @option{-mprolog-function} option
17329 is on by default if you optimize.
17331 @item -mspace
17332 @opindex mspace
17333 Try to make the code as small as possible.  At present, this just turns
17334 on the @option{-mep} and @option{-mprolog-function} options.
17336 @item -mtda=@var{n}
17337 @opindex mtda
17338 Put static or global variables whose size is @var{n} bytes or less into
17339 the tiny data area that register @code{ep} points to.  The tiny data
17340 area can hold up to 256 bytes in total (128 bytes for byte references).
17342 @item -msda=@var{n}
17343 @opindex msda
17344 Put static or global variables whose size is @var{n} bytes or less into
17345 the small data area that register @code{gp} points to.  The small data
17346 area can hold up to 64 kilobytes.
17348 @item -mzda=@var{n}
17349 @opindex mzda
17350 Put static or global variables whose size is @var{n} bytes or less into
17351 the first 32 kilobytes of memory.
17353 @item -mv850
17354 @opindex mv850
17355 Specify that the target processor is the V850.
17357 @item -mbig-switch
17358 @opindex mbig-switch
17359 Generate code suitable for big switch tables.  Use this option only if
17360 the assembler/linker complain about out of range branches within a switch
17361 table.
17363 @item -mapp-regs
17364 @opindex mapp-regs
17365 This option will cause r2 and r5 to be used in the code generated by
17366 the compiler.  This setting is the default.
17368 @item -mno-app-regs
17369 @opindex mno-app-regs
17370 This option will cause r2 and r5 to be treated as fixed registers.
17372 @item -mv850e2v3
17373 @opindex mv850e2v3
17374 Specify that the target processor is the V850E2V3.  The preprocessor
17375 constants @samp{__v850e2v3__} will be defined if
17376 this option is used.
17378 @item -mv850e2
17379 @opindex mv850e2
17380 Specify that the target processor is the V850E2.  The preprocessor
17381 constants @samp{__v850e2__} will be defined if this option is used.
17383 @item -mv850e1
17384 @opindex mv850e1
17385 Specify that the target processor is the V850E1.  The preprocessor
17386 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
17387 this option is used.
17389 @item -mv850es
17390 @opindex mv850es
17391 Specify that the target processor is the V850ES.  This is an alias for
17392 the @option{-mv850e1} option.
17394 @item -mv850e
17395 @opindex mv850e
17396 Specify that the target processor is the V850E@.  The preprocessor
17397 constant @samp{__v850e__} will be defined if this option is used.
17399 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
17400 nor @option{-mv850e2} nor @option{-mv850e2v3}
17401 are defined then a default target processor will be chosen and the
17402 relevant @samp{__v850*__} preprocessor constant will be defined.
17404 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
17405 defined, regardless of which processor variant is the target.
17407 @item -mdisable-callt
17408 @opindex mdisable-callt
17409 This option will suppress generation of the CALLT instruction for the
17410 v850e, v850e1, v850e2 and v850e2v3 flavors of the v850 architecture.  The default is
17411 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
17413 @end table
17415 @node VAX Options
17416 @subsection VAX Options
17417 @cindex VAX options
17419 These @samp{-m} options are defined for the VAX:
17421 @table @gcctabopt
17422 @item -munix
17423 @opindex munix
17424 Do not output certain jump instructions (@code{aobleq} and so on)
17425 that the Unix assembler for the VAX cannot handle across long
17426 ranges.
17428 @item -mgnu
17429 @opindex mgnu
17430 Do output those jump instructions, on the assumption that you
17431 will assemble with the GNU assembler.
17433 @item -mg
17434 @opindex mg
17435 Output code for g-format floating point numbers instead of d-format.
17436 @end table
17438 @node VxWorks Options
17439 @subsection VxWorks Options
17440 @cindex VxWorks Options
17442 The options in this section are defined for all VxWorks targets.
17443 Options specific to the target hardware are listed with the other
17444 options for that target.
17446 @table @gcctabopt
17447 @item -mrtp
17448 @opindex mrtp
17449 GCC can generate code for both VxWorks kernels and real time processes
17450 (RTPs).  This option switches from the former to the latter.  It also
17451 defines the preprocessor macro @code{__RTP__}.
17453 @item -non-static
17454 @opindex non-static
17455 Link an RTP executable against shared libraries rather than static
17456 libraries.  The options @option{-static} and @option{-shared} can
17457 also be used for RTPs (@pxref{Link Options}); @option{-static}
17458 is the default.
17460 @item -Bstatic
17461 @itemx -Bdynamic
17462 @opindex Bstatic
17463 @opindex Bdynamic
17464 These options are passed down to the linker.  They are defined for
17465 compatibility with Diab.
17467 @item -Xbind-lazy
17468 @opindex Xbind-lazy
17469 Enable lazy binding of function calls.  This option is equivalent to
17470 @option{-Wl,-z,now} and is defined for compatibility with Diab.
17472 @item -Xbind-now
17473 @opindex Xbind-now
17474 Disable lazy binding of function calls.  This option is the default and
17475 is defined for compatibility with Diab.
17476 @end table
17478 @node x86-64 Options
17479 @subsection x86-64 Options
17480 @cindex x86-64 options
17482 These are listed under @xref{i386 and x86-64 Options}.
17484 @node Xstormy16 Options
17485 @subsection Xstormy16 Options
17486 @cindex Xstormy16 Options
17488 These options are defined for Xstormy16:
17490 @table @gcctabopt
17491 @item -msim
17492 @opindex msim
17493 Choose startup files and linker script suitable for the simulator.
17494 @end table
17496 @node Xtensa Options
17497 @subsection Xtensa Options
17498 @cindex Xtensa Options
17500 These options are supported for Xtensa targets:
17502 @table @gcctabopt
17503 @item -mconst16
17504 @itemx -mno-const16
17505 @opindex mconst16
17506 @opindex mno-const16
17507 Enable or disable use of @code{CONST16} instructions for loading
17508 constant values.  The @code{CONST16} instruction is currently not a
17509 standard option from Tensilica.  When enabled, @code{CONST16}
17510 instructions are always used in place of the standard @code{L32R}
17511 instructions.  The use of @code{CONST16} is enabled by default only if
17512 the @code{L32R} instruction is not available.
17514 @item -mfused-madd
17515 @itemx -mno-fused-madd
17516 @opindex mfused-madd
17517 @opindex mno-fused-madd
17518 Enable or disable use of fused multiply/add and multiply/subtract
17519 instructions in the floating-point option.  This has no effect if the
17520 floating-point option is not also enabled.  Disabling fused multiply/add
17521 and multiply/subtract instructions forces the compiler to use separate
17522 instructions for the multiply and add/subtract operations.  This may be
17523 desirable in some cases where strict IEEE 754-compliant results are
17524 required: the fused multiply add/subtract instructions do not round the
17525 intermediate result, thereby producing results with @emph{more} bits of
17526 precision than specified by the IEEE standard.  Disabling fused multiply
17527 add/subtract instructions also ensures that the program output is not
17528 sensitive to the compiler's ability to combine multiply and add/subtract
17529 operations.
17531 @item -mserialize-volatile
17532 @itemx -mno-serialize-volatile
17533 @opindex mserialize-volatile
17534 @opindex mno-serialize-volatile
17535 When this option is enabled, GCC inserts @code{MEMW} instructions before
17536 @code{volatile} memory references to guarantee sequential consistency.
17537 The default is @option{-mserialize-volatile}.  Use
17538 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
17540 @item -mforce-no-pic
17541 @opindex mforce-no-pic
17542 For targets, like GNU/Linux, where all user-mode Xtensa code must be
17543 position-independent code (PIC), this option disables PIC for compiling
17544 kernel code.
17546 @item -mtext-section-literals
17547 @itemx -mno-text-section-literals
17548 @opindex mtext-section-literals
17549 @opindex mno-text-section-literals
17550 Control the treatment of literal pools.  The default is
17551 @option{-mno-text-section-literals}, which places literals in a separate
17552 section in the output file.  This allows the literal pool to be placed
17553 in a data RAM/ROM, and it also allows the linker to combine literal
17554 pools from separate object files to remove redundant literals and
17555 improve code size.  With @option{-mtext-section-literals}, the literals
17556 are interspersed in the text section in order to keep them as close as
17557 possible to their references.  This may be necessary for large assembly
17558 files.
17560 @item -mtarget-align
17561 @itemx -mno-target-align
17562 @opindex mtarget-align
17563 @opindex mno-target-align
17564 When this option is enabled, GCC instructs the assembler to
17565 automatically align instructions to reduce branch penalties at the
17566 expense of some code density.  The assembler attempts to widen density
17567 instructions to align branch targets and the instructions following call
17568 instructions.  If there are not enough preceding safe density
17569 instructions to align a target, no widening will be performed.  The
17570 default is @option{-mtarget-align}.  These options do not affect the
17571 treatment of auto-aligned instructions like @code{LOOP}, which the
17572 assembler will always align, either by widening density instructions or
17573 by inserting no-op instructions.
17575 @item -mlongcalls
17576 @itemx -mno-longcalls
17577 @opindex mlongcalls
17578 @opindex mno-longcalls
17579 When this option is enabled, GCC instructs the assembler to translate
17580 direct calls to indirect calls unless it can determine that the target
17581 of a direct call is in the range allowed by the call instruction.  This
17582 translation typically occurs for calls to functions in other source
17583 files.  Specifically, the assembler translates a direct @code{CALL}
17584 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
17585 The default is @option{-mno-longcalls}.  This option should be used in
17586 programs where the call target can potentially be out of range.  This
17587 option is implemented in the assembler, not the compiler, so the
17588 assembly code generated by GCC will still show direct call
17589 instructions---look at the disassembled object code to see the actual
17590 instructions.  Note that the assembler will use an indirect call for
17591 every cross-file call, not just those that really will be out of range.
17592 @end table
17594 @node zSeries Options
17595 @subsection zSeries Options
17596 @cindex zSeries options
17598 These are listed under @xref{S/390 and zSeries Options}.
17600 @node Code Gen Options
17601 @section Options for Code Generation Conventions
17602 @cindex code generation conventions
17603 @cindex options, code generation
17604 @cindex run-time options
17606 These machine-independent options control the interface conventions
17607 used in code generation.
17609 Most of them have both positive and negative forms; the negative form
17610 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
17611 one of the forms is listed---the one which is not the default.  You
17612 can figure out the other form by either removing @samp{no-} or adding
17615 @table @gcctabopt
17616 @item -fbounds-check
17617 @opindex fbounds-check
17618 For front-ends that support it, generate additional code to check that
17619 indices used to access arrays are within the declared range.  This is
17620 currently only supported by the Java and Fortran front-ends, where
17621 this option defaults to true and false respectively.
17623 @item -ftrapv
17624 @opindex ftrapv
17625 This option generates traps for signed overflow on addition, subtraction,
17626 multiplication operations.
17628 @item -fwrapv
17629 @opindex fwrapv
17630 This option instructs the compiler to assume that signed arithmetic
17631 overflow of addition, subtraction and multiplication wraps around
17632 using twos-complement representation.  This flag enables some optimizations
17633 and disables others.  This option is enabled by default for the Java
17634 front-end, as required by the Java language specification.
17636 @item -fexceptions
17637 @opindex fexceptions
17638 Enable exception handling.  Generates extra code needed to propagate
17639 exceptions.  For some targets, this implies GCC will generate frame
17640 unwind information for all functions, which can produce significant data
17641 size overhead, although it does not affect execution.  If you do not
17642 specify this option, GCC will enable it by default for languages like
17643 C++ which normally require exception handling, and disable it for
17644 languages like C that do not normally require it.  However, you may need
17645 to enable this option when compiling C code that needs to interoperate
17646 properly with exception handlers written in C++.  You may also wish to
17647 disable this option if you are compiling older C++ programs that don't
17648 use exception handling.
17650 @item -fnon-call-exceptions
17651 @opindex fnon-call-exceptions
17652 Generate code that allows trapping instructions to throw exceptions.
17653 Note that this requires platform-specific runtime support that does
17654 not exist everywhere.  Moreover, it only allows @emph{trapping}
17655 instructions to throw exceptions, i.e.@: memory references or floating
17656 point instructions.  It does not allow exceptions to be thrown from
17657 arbitrary signal handlers such as @code{SIGALRM}.
17659 @item -funwind-tables
17660 @opindex funwind-tables
17661 Similar to @option{-fexceptions}, except that it will just generate any needed
17662 static data, but will not affect the generated code in any other way.
17663 You will normally not enable this option; instead, a language processor
17664 that needs this handling would enable it on your behalf.
17666 @item -fasynchronous-unwind-tables
17667 @opindex fasynchronous-unwind-tables
17668 Generate unwind table in dwarf2 format, if supported by target machine.  The
17669 table is exact at each instruction boundary, so it can be used for stack
17670 unwinding from asynchronous events (such as debugger or garbage collector).
17672 @item -fpcc-struct-return
17673 @opindex fpcc-struct-return
17674 Return ``short'' @code{struct} and @code{union} values in memory like
17675 longer ones, rather than in registers.  This convention is less
17676 efficient, but it has the advantage of allowing intercallability between
17677 GCC-compiled files and files compiled with other compilers, particularly
17678 the Portable C Compiler (pcc).
17680 The precise convention for returning structures in memory depends
17681 on the target configuration macros.
17683 Short structures and unions are those whose size and alignment match
17684 that of some integer type.
17686 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
17687 switch is not binary compatible with code compiled with the
17688 @option{-freg-struct-return} switch.
17689 Use it to conform to a non-default application binary interface.
17691 @item -freg-struct-return
17692 @opindex freg-struct-return
17693 Return @code{struct} and @code{union} values in registers when possible.
17694 This is more efficient for small structures than
17695 @option{-fpcc-struct-return}.
17697 If you specify neither @option{-fpcc-struct-return} nor
17698 @option{-freg-struct-return}, GCC defaults to whichever convention is
17699 standard for the target.  If there is no standard convention, GCC
17700 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
17701 the principal compiler.  In those cases, we can choose the standard, and
17702 we chose the more efficient register return alternative.
17704 @strong{Warning:} code compiled with the @option{-freg-struct-return}
17705 switch is not binary compatible with code compiled with the
17706 @option{-fpcc-struct-return} switch.
17707 Use it to conform to a non-default application binary interface.
17709 @item -fshort-enums
17710 @opindex fshort-enums
17711 Allocate to an @code{enum} type only as many bytes as it needs for the
17712 declared range of possible values.  Specifically, the @code{enum} type
17713 will be equivalent to the smallest integer type which has enough room.
17715 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
17716 code that is not binary compatible with code generated without that switch.
17717 Use it to conform to a non-default application binary interface.
17719 @item -fshort-double
17720 @opindex fshort-double
17721 Use the same size for @code{double} as for @code{float}.
17723 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
17724 code that is not binary compatible with code generated without that switch.
17725 Use it to conform to a non-default application binary interface.
17727 @item -fshort-wchar
17728 @opindex fshort-wchar
17729 Override the underlying type for @samp{wchar_t} to be @samp{short
17730 unsigned int} instead of the default for the target.  This option is
17731 useful for building programs to run under WINE@.
17733 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
17734 code that is not binary compatible with code generated without that switch.
17735 Use it to conform to a non-default application binary interface.
17737 @item -fno-common
17738 @opindex fno-common
17739 In C code, controls the placement of uninitialized global variables.
17740 Unix C compilers have traditionally permitted multiple definitions of
17741 such variables in different compilation units by placing the variables
17742 in a common block.
17743 This is the behavior specified by @option{-fcommon}, and is the default
17744 for GCC on most targets.
17745 On the other hand, this behavior is not required by ISO C, and on some
17746 targets may carry a speed or code size penalty on variable references.
17747 The @option{-fno-common} option specifies that the compiler should place
17748 uninitialized global variables in the data section of the object file,
17749 rather than generating them as common blocks.
17750 This has the effect that if the same variable is declared
17751 (without @code{extern}) in two different compilations,
17752 you will get a multiple-definition error when you link them.
17753 In this case, you must compile with @option{-fcommon} instead.
17754 Compiling with @option{-fno-common} is useful on targets for which
17755 it provides better performance, or if you wish to verify that the
17756 program will work on other systems which always treat uninitialized
17757 variable declarations this way.
17759 @item -fno-ident
17760 @opindex fno-ident
17761 Ignore the @samp{#ident} directive.
17763 @item -finhibit-size-directive
17764 @opindex finhibit-size-directive
17765 Don't output a @code{.size} assembler directive, or anything else that
17766 would cause trouble if the function is split in the middle, and the
17767 two halves are placed at locations far apart in memory.  This option is
17768 used when compiling @file{crtstuff.c}; you should not need to use it
17769 for anything else.
17771 @item -fverbose-asm
17772 @opindex fverbose-asm
17773 Put extra commentary information in the generated assembly code to
17774 make it more readable.  This option is generally only of use to those
17775 who actually need to read the generated assembly code (perhaps while
17776 debugging the compiler itself).
17778 @option{-fno-verbose-asm}, the default, causes the
17779 extra information to be omitted and is useful when comparing two assembler
17780 files.
17782 @item -frecord-gcc-switches
17783 @opindex frecord-gcc-switches
17784 This switch causes the command line that was used to invoke the
17785 compiler to be recorded into the object file that is being created.
17786 This switch is only implemented on some targets and the exact format
17787 of the recording is target and binary file format dependent, but it
17788 usually takes the form of a section containing ASCII text.  This
17789 switch is related to the @option{-fverbose-asm} switch, but that
17790 switch only records information in the assembler output file as
17791 comments, so it never reaches the object file.
17793 @item -fpic
17794 @opindex fpic
17795 @cindex global offset table
17796 @cindex PIC
17797 Generate position-independent code (PIC) suitable for use in a shared
17798 library, if supported for the target machine.  Such code accesses all
17799 constant addresses through a global offset table (GOT)@.  The dynamic
17800 loader resolves the GOT entries when the program starts (the dynamic
17801 loader is not part of GCC; it is part of the operating system).  If
17802 the GOT size for the linked executable exceeds a machine-specific
17803 maximum size, you get an error message from the linker indicating that
17804 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
17805 instead.  (These maximums are 8k on the SPARC and 32k
17806 on the m68k and RS/6000.  The 386 has no such limit.)
17808 Position-independent code requires special support, and therefore works
17809 only on certain machines.  For the 386, GCC supports PIC for System V
17810 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
17811 position-independent.
17813 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17814 are defined to 1.
17816 @item -fPIC
17817 @opindex fPIC
17818 If supported for the target machine, emit position-independent code,
17819 suitable for dynamic linking and avoiding any limit on the size of the
17820 global offset table.  This option makes a difference on the m68k,
17821 PowerPC and SPARC@.
17823 Position-independent code requires special support, and therefore works
17824 only on certain machines.
17826 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17827 are defined to 2.
17829 @item -fpie
17830 @itemx -fPIE
17831 @opindex fpie
17832 @opindex fPIE
17833 These options are similar to @option{-fpic} and @option{-fPIC}, but
17834 generated position independent code can be only linked into executables.
17835 Usually these options are used when @option{-pie} GCC option will be
17836 used during linking.
17838 @option{-fpie} and @option{-fPIE} both define the macros
17839 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
17840 for @option{-fpie} and 2 for @option{-fPIE}.
17842 @item -fno-jump-tables
17843 @opindex fno-jump-tables
17844 Do not use jump tables for switch statements even where it would be
17845 more efficient than other code generation strategies.  This option is
17846 of use in conjunction with @option{-fpic} or @option{-fPIC} for
17847 building code which forms part of a dynamic linker and cannot
17848 reference the address of a jump table.  On some targets, jump tables
17849 do not require a GOT and this option is not needed.
17851 @item -ffixed-@var{reg}
17852 @opindex ffixed
17853 Treat the register named @var{reg} as a fixed register; generated code
17854 should never refer to it (except perhaps as a stack pointer, frame
17855 pointer or in some other fixed role).
17857 @var{reg} must be the name of a register.  The register names accepted
17858 are machine-specific and are defined in the @code{REGISTER_NAMES}
17859 macro in the machine description macro file.
17861 This flag does not have a negative form, because it specifies a
17862 three-way choice.
17864 @item -fcall-used-@var{reg}
17865 @opindex fcall-used
17866 Treat the register named @var{reg} as an allocable register that is
17867 clobbered by function calls.  It may be allocated for temporaries or
17868 variables that do not live across a call.  Functions compiled this way
17869 will not save and restore the register @var{reg}.
17871 It is an error to used this flag with the frame pointer or stack pointer.
17872 Use of this flag for other registers that have fixed pervasive roles in
17873 the machine's execution model will produce disastrous results.
17875 This flag does not have a negative form, because it specifies a
17876 three-way choice.
17878 @item -fcall-saved-@var{reg}
17879 @opindex fcall-saved
17880 Treat the register named @var{reg} as an allocable register saved by
17881 functions.  It may be allocated even for temporaries or variables that
17882 live across a call.  Functions compiled this way will save and restore
17883 the register @var{reg} if they use it.
17885 It is an error to used this flag with the frame pointer or stack pointer.
17886 Use of this flag for other registers that have fixed pervasive roles in
17887 the machine's execution model will produce disastrous results.
17889 A different sort of disaster will result from the use of this flag for
17890 a register in which function values may be returned.
17892 This flag does not have a negative form, because it specifies a
17893 three-way choice.
17895 @item -fpack-struct[=@var{n}]
17896 @opindex fpack-struct
17897 Without a value specified, pack all structure members together without
17898 holes.  When a value is specified (which must be a small power of two), pack
17899 structure members according to this value, representing the maximum
17900 alignment (that is, objects with default alignment requirements larger than
17901 this will be output potentially unaligned at the next fitting location.
17903 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
17904 code that is not binary compatible with code generated without that switch.
17905 Additionally, it makes the code suboptimal.
17906 Use it to conform to a non-default application binary interface.
17908 @item -finstrument-functions
17909 @opindex finstrument-functions
17910 Generate instrumentation calls for entry and exit to functions.  Just
17911 after function entry and just before function exit, the following
17912 profiling functions will be called with the address of the current
17913 function and its call site.  (On some platforms,
17914 @code{__builtin_return_address} does not work beyond the current
17915 function, so the call site information may not be available to the
17916 profiling functions otherwise.)
17918 @smallexample
17919 void __cyg_profile_func_enter (void *this_fn,
17920                                void *call_site);
17921 void __cyg_profile_func_exit  (void *this_fn,
17922                                void *call_site);
17923 @end smallexample
17925 The first argument is the address of the start of the current function,
17926 which may be looked up exactly in the symbol table.
17928 This instrumentation is also done for functions expanded inline in other
17929 functions.  The profiling calls will indicate where, conceptually, the
17930 inline function is entered and exited.  This means that addressable
17931 versions of such functions must be available.  If all your uses of a
17932 function are expanded inline, this may mean an additional expansion of
17933 code size.  If you use @samp{extern inline} in your C code, an
17934 addressable version of such functions must be provided.  (This is
17935 normally the case anyways, but if you get lucky and the optimizer always
17936 expands the functions inline, you might have gotten away without
17937 providing static copies.)
17939 A function may be given the attribute @code{no_instrument_function}, in
17940 which case this instrumentation will not be done.  This can be used, for
17941 example, for the profiling functions listed above, high-priority
17942 interrupt routines, and any functions from which the profiling functions
17943 cannot safely be called (perhaps signal handlers, if the profiling
17944 routines generate output or allocate memory).
17946 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17947 @opindex finstrument-functions-exclude-file-list
17949 Set the list of functions that are excluded from instrumentation (see
17950 the description of @code{-finstrument-functions}).  If the file that
17951 contains a function definition matches with one of @var{file}, then
17952 that function is not instrumented.  The match is done on substrings:
17953 if the @var{file} parameter is a substring of the file name, it is
17954 considered to be a match.
17956 For example:
17958 @smallexample
17959 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17960 @end smallexample
17962 @noindent
17963 will exclude any inline function defined in files whose pathnames
17964 contain @code{/bits/stl} or @code{include/sys}.
17966 If, for some reason, you want to include letter @code{','} in one of
17967 @var{sym}, write @code{'\,'}. For example,
17968 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
17969 (note the single quote surrounding the option).
17971 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17972 @opindex finstrument-functions-exclude-function-list
17974 This is similar to @code{-finstrument-functions-exclude-file-list},
17975 but this option sets the list of function names to be excluded from
17976 instrumentation.  The function name to be matched is its user-visible
17977 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17978 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17979 match is done on substrings: if the @var{sym} parameter is a substring
17980 of the function name, it is considered to be a match.  For C99 and C++
17981 extended identifiers, the function name must be given in UTF-8, not
17982 using universal character names.
17984 @item -fstack-check
17985 @opindex fstack-check
17986 Generate code to verify that you do not go beyond the boundary of the
17987 stack.  You should specify this flag if you are running in an
17988 environment with multiple threads, but only rarely need to specify it in
17989 a single-threaded environment since stack overflow is automatically
17990 detected on nearly all systems if there is only one stack.
17992 Note that this switch does not actually cause checking to be done; the
17993 operating system or the language runtime must do that.  The switch causes
17994 generation of code to ensure that they see the stack being extended.
17996 You can additionally specify a string parameter: @code{no} means no
17997 checking, @code{generic} means force the use of old-style checking,
17998 @code{specific} means use the best checking method and is equivalent
17999 to bare @option{-fstack-check}.
18001 Old-style checking is a generic mechanism that requires no specific
18002 target support in the compiler but comes with the following drawbacks:
18004 @enumerate
18005 @item
18006 Modified allocation strategy for large objects: they will always be
18007 allocated dynamically if their size exceeds a fixed threshold.
18009 @item
18010 Fixed limit on the size of the static frame of functions: when it is
18011 topped by a particular function, stack checking is not reliable and
18012 a warning is issued by the compiler.
18014 @item
18015 Inefficiency: because of both the modified allocation strategy and the
18016 generic implementation, the performances of the code are hampered.
18017 @end enumerate
18019 Note that old-style stack checking is also the fallback method for
18020 @code{specific} if no target support has been added in the compiler.
18022 @item -fstack-limit-register=@var{reg}
18023 @itemx -fstack-limit-symbol=@var{sym}
18024 @itemx -fno-stack-limit
18025 @opindex fstack-limit-register
18026 @opindex fstack-limit-symbol
18027 @opindex fno-stack-limit
18028 Generate code to ensure that the stack does not grow beyond a certain value,
18029 either the value of a register or the address of a symbol.  If the stack
18030 would grow beyond the value, a signal is raised.  For most targets,
18031 the signal is raised before the stack overruns the boundary, so
18032 it is possible to catch the signal without taking special precautions.
18034 For instance, if the stack starts at absolute address @samp{0x80000000}
18035 and grows downwards, you can use the flags
18036 @option{-fstack-limit-symbol=__stack_limit} and
18037 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
18038 of 128KB@.  Note that this may only work with the GNU linker.
18040 @item -fsplit-stack
18041 @opindex fsplit-stack
18042 Generate code to automatically split the stack before it overflows.
18043 The resulting program has a discontiguous stack which can only
18044 overflow if the program is unable to allocate any more memory.  This
18045 is most useful when running threaded programs, as it is no longer
18046 necessary to calculate a good stack size to use for each thread.  This
18047 is currently only implemented for the i386 and x86_64 backends running
18048 GNU/Linux.
18050 When code compiled with @option{-fsplit-stack} calls code compiled
18051 without @option{-fsplit-stack}, there may not be much stack space
18052 available for the latter code to run.  If compiling all code,
18053 including library code, with @option{-fsplit-stack} is not an option,
18054 then the linker can fix up these calls so that the code compiled
18055 without @option{-fsplit-stack} always has a large stack.  Support for
18056 this is implemented in the gold linker in GNU binutils release 2.21
18057 and later.
18059 @item -fleading-underscore
18060 @opindex fleading-underscore
18061 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18062 change the way C symbols are represented in the object file.  One use
18063 is to help link with legacy assembly code.
18065 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18066 generate code that is not binary compatible with code generated without that
18067 switch.  Use it to conform to a non-default application binary interface.
18068 Not all targets provide complete support for this switch.
18070 @item -ftls-model=@var{model}
18071 @opindex ftls-model
18072 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18073 The @var{model} argument should be one of @code{global-dynamic},
18074 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
18076 The default without @option{-fpic} is @code{initial-exec}; with
18077 @option{-fpic} the default is @code{global-dynamic}.
18079 @item -fvisibility=@var{default|internal|hidden|protected}
18080 @opindex fvisibility
18081 Set the default ELF image symbol visibility to the specified option---all
18082 symbols will be marked with this unless overridden within the code.
18083 Using this feature can very substantially improve linking and
18084 load times of shared object libraries, produce more optimized
18085 code, provide near-perfect API export and prevent symbol clashes.
18086 It is @strong{strongly} recommended that you use this in any shared objects
18087 you distribute.
18089 Despite the nomenclature, @code{default} always means public; i.e.,
18090 available to be linked against from outside the shared object.
18091 @code{protected} and @code{internal} are pretty useless in real-world
18092 usage so the only other commonly used option will be @code{hidden}.
18093 The default if @option{-fvisibility} isn't specified is
18094 @code{default}, i.e., make every
18095 symbol public---this causes the same behavior as previous versions of
18096 GCC@.
18098 A good explanation of the benefits offered by ensuring ELF
18099 symbols have the correct visibility is given by ``How To Write
18100 Shared Libraries'' by Ulrich Drepper (which can be found at
18101 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
18102 solution made possible by this option to marking things hidden when
18103 the default is public is to make the default hidden and mark things
18104 public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
18105 and @code{__attribute__ ((visibility("default")))} instead of
18106 @code{__declspec(dllexport)} you get almost identical semantics with
18107 identical syntax.  This is a great boon to those working with
18108 cross-platform projects.
18110 For those adding visibility support to existing code, you may find
18111 @samp{#pragma GCC visibility} of use.  This works by you enclosing
18112 the declarations you wish to set visibility for with (for example)
18113 @samp{#pragma GCC visibility push(hidden)} and
18114 @samp{#pragma GCC visibility pop}.
18115 Bear in mind that symbol visibility should be viewed @strong{as
18116 part of the API interface contract} and thus all new code should
18117 always specify visibility when it is not the default; i.e., declarations
18118 only for use within the local DSO should @strong{always} be marked explicitly
18119 as hidden as so to avoid PLT indirection overheads---making this
18120 abundantly clear also aids readability and self-documentation of the code.
18121 Note that due to ISO C++ specification requirements, operator new and
18122 operator delete must always be of default visibility.
18124 Be aware that headers from outside your project, in particular system
18125 headers and headers from any other library you use, may not be
18126 expecting to be compiled with visibility other than the default.  You
18127 may need to explicitly say @samp{#pragma GCC visibility push(default)}
18128 before including any such headers.
18130 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
18131 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
18132 no modifications.  However, this means that calls to @samp{extern}
18133 functions with no explicit visibility will use the PLT, so it is more
18134 effective to use @samp{__attribute ((visibility))} and/or
18135 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
18136 declarations should be treated as hidden.
18138 Note that @samp{-fvisibility} does affect C++ vague linkage
18139 entities. This means that, for instance, an exception class that will
18140 be thrown between DSOs must be explicitly marked with default
18141 visibility so that the @samp{type_info} nodes will be unified between
18142 the DSOs.
18144 An overview of these techniques, their benefits and how to use them
18145 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
18147 @item -fstrict-volatile-bitfields
18148 @opindex fstrict-volatile-bitfields
18149 This option should be used if accesses to volatile bitfields (or other
18150 structure fields, although the compiler usually honors those types
18151 anyway) should use a single access of the width of the
18152 field's type, aligned to a natural alignment if possible.  For
18153 example, targets with memory-mapped peripheral registers might require
18154 all such accesses to be 16 bits wide; with this flag the user could
18155 declare all peripheral bitfields as ``unsigned short'' (assuming short
18156 is 16 bits on these targets) to force GCC to use 16 bit accesses
18157 instead of, perhaps, a more efficient 32 bit access.
18159 If this option is disabled, the compiler will use the most efficient
18160 instruction.  In the previous example, that might be a 32-bit load
18161 instruction, even though that will access bytes that do not contain
18162 any portion of the bitfield, or memory-mapped registers unrelated to
18163 the one being updated.
18165 If the target requires strict alignment, and honoring the field
18166 type would require violating this alignment, a warning is issued.
18167 If the field has @code{packed} attribute, the access is done without
18168 honoring the field type.  If the field doesn't have @code{packed}
18169 attribute, the access is done honoring the field type.  In both cases,
18170 GCC assumes that the user knows something about the target hardware
18171 that it is unaware of.
18173 The default value of this option is determined by the application binary
18174 interface for the target processor.
18176 @end table
18178 @c man end
18180 @node Environment Variables
18181 @section Environment Variables Affecting GCC
18182 @cindex environment variables
18184 @c man begin ENVIRONMENT
18185 This section describes several environment variables that affect how GCC
18186 operates.  Some of them work by specifying directories or prefixes to use
18187 when searching for various kinds of files.  Some are used to specify other
18188 aspects of the compilation environment.
18190 Note that you can also specify places to search using options such as
18191 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
18192 take precedence over places specified using environment variables, which
18193 in turn take precedence over those specified by the configuration of GCC@.
18194 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
18195 GNU Compiler Collection (GCC) Internals}.
18197 @table @env
18198 @item LANG
18199 @itemx LC_CTYPE
18200 @c @itemx LC_COLLATE
18201 @itemx LC_MESSAGES
18202 @c @itemx LC_MONETARY
18203 @c @itemx LC_NUMERIC
18204 @c @itemx LC_TIME
18205 @itemx LC_ALL
18206 @findex LANG
18207 @findex LC_CTYPE
18208 @c @findex LC_COLLATE
18209 @findex LC_MESSAGES
18210 @c @findex LC_MONETARY
18211 @c @findex LC_NUMERIC
18212 @c @findex LC_TIME
18213 @findex LC_ALL
18214 @cindex locale
18215 These environment variables control the way that GCC uses
18216 localization information that allow GCC to work with different
18217 national conventions.  GCC inspects the locale categories
18218 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
18219 so.  These locale categories can be set to any value supported by your
18220 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
18221 Kingdom encoded in UTF-8.
18223 The @env{LC_CTYPE} environment variable specifies character
18224 classification.  GCC uses it to determine the character boundaries in
18225 a string; this is needed for some multibyte encodings that contain quote
18226 and escape characters that would otherwise be interpreted as a string
18227 end or escape.
18229 The @env{LC_MESSAGES} environment variable specifies the language to
18230 use in diagnostic messages.
18232 If the @env{LC_ALL} environment variable is set, it overrides the value
18233 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
18234 and @env{LC_MESSAGES} default to the value of the @env{LANG}
18235 environment variable.  If none of these variables are set, GCC
18236 defaults to traditional C English behavior.
18238 @item TMPDIR
18239 @findex TMPDIR
18240 If @env{TMPDIR} is set, it specifies the directory to use for temporary
18241 files.  GCC uses temporary files to hold the output of one stage of
18242 compilation which is to be used as input to the next stage: for example,
18243 the output of the preprocessor, which is the input to the compiler
18244 proper.
18246 @item GCC_EXEC_PREFIX
18247 @findex GCC_EXEC_PREFIX
18248 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
18249 names of the subprograms executed by the compiler.  No slash is added
18250 when this prefix is combined with the name of a subprogram, but you can
18251 specify a prefix that ends with a slash if you wish.
18253 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
18254 an appropriate prefix to use based on the pathname it was invoked with.
18256 If GCC cannot find the subprogram using the specified prefix, it
18257 tries looking in the usual places for the subprogram.
18259 The default value of @env{GCC_EXEC_PREFIX} is
18260 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
18261 the installed compiler. In many cases @var{prefix} is the value
18262 of @code{prefix} when you ran the @file{configure} script.
18264 Other prefixes specified with @option{-B} take precedence over this prefix.
18266 This prefix is also used for finding files such as @file{crt0.o} that are
18267 used for linking.
18269 In addition, the prefix is used in an unusual way in finding the
18270 directories to search for header files.  For each of the standard
18271 directories whose name normally begins with @samp{/usr/local/lib/gcc}
18272 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
18273 replacing that beginning with the specified prefix to produce an
18274 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
18275 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
18276 These alternate directories are searched first; the standard directories
18277 come next. If a standard directory begins with the configured
18278 @var{prefix} then the value of @var{prefix} is replaced by
18279 @env{GCC_EXEC_PREFIX} when looking for header files.
18281 @item COMPILER_PATH
18282 @findex COMPILER_PATH
18283 The value of @env{COMPILER_PATH} is a colon-separated list of
18284 directories, much like @env{PATH}.  GCC tries the directories thus
18285 specified when searching for subprograms, if it can't find the
18286 subprograms using @env{GCC_EXEC_PREFIX}.
18288 @item LIBRARY_PATH
18289 @findex LIBRARY_PATH
18290 The value of @env{LIBRARY_PATH} is a colon-separated list of
18291 directories, much like @env{PATH}.  When configured as a native compiler,
18292 GCC tries the directories thus specified when searching for special
18293 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
18294 using GCC also uses these directories when searching for ordinary
18295 libraries for the @option{-l} option (but directories specified with
18296 @option{-L} come first).
18298 @item LANG
18299 @findex LANG
18300 @cindex locale definition
18301 This variable is used to pass locale information to the compiler.  One way in
18302 which this information is used is to determine the character set to be used
18303 when character literals, string literals and comments are parsed in C and C++.
18304 When the compiler is configured to allow multibyte characters,
18305 the following values for @env{LANG} are recognized:
18307 @table @samp
18308 @item C-JIS
18309 Recognize JIS characters.
18310 @item C-SJIS
18311 Recognize SJIS characters.
18312 @item C-EUCJP
18313 Recognize EUCJP characters.
18314 @end table
18316 If @env{LANG} is not defined, or if it has some other value, then the
18317 compiler will use mblen and mbtowc as defined by the default locale to
18318 recognize and translate multibyte characters.
18319 @end table
18321 @noindent
18322 Some additional environments variables affect the behavior of the
18323 preprocessor.
18325 @include cppenv.texi
18327 @c man end
18329 @node Precompiled Headers
18330 @section Using Precompiled Headers
18331 @cindex precompiled headers
18332 @cindex speed of compilation
18334 Often large projects have many header files that are included in every
18335 source file.  The time the compiler takes to process these header files
18336 over and over again can account for nearly all of the time required to
18337 build the project.  To make builds faster, GCC allows users to
18338 `precompile' a header file; then, if builds can use the precompiled
18339 header file they will be much faster.
18341 To create a precompiled header file, simply compile it as you would any
18342 other file, if necessary using the @option{-x} option to make the driver
18343 treat it as a C or C++ header file.  You will probably want to use a
18344 tool like @command{make} to keep the precompiled header up-to-date when
18345 the headers it contains change.
18347 A precompiled header file will be searched for when @code{#include} is
18348 seen in the compilation.  As it searches for the included file
18349 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
18350 compiler looks for a precompiled header in each directory just before it
18351 looks for the include file in that directory.  The name searched for is
18352 the name specified in the @code{#include} with @samp{.gch} appended.  If
18353 the precompiled header file can't be used, it is ignored.
18355 For instance, if you have @code{#include "all.h"}, and you have
18356 @file{all.h.gch} in the same directory as @file{all.h}, then the
18357 precompiled header file will be used if possible, and the original
18358 header will be used otherwise.
18360 Alternatively, you might decide to put the precompiled header file in a
18361 directory and use @option{-I} to ensure that directory is searched
18362 before (or instead of) the directory containing the original header.
18363 Then, if you want to check that the precompiled header file is always
18364 used, you can put a file of the same name as the original header in this
18365 directory containing an @code{#error} command.
18367 This also works with @option{-include}.  So yet another way to use
18368 precompiled headers, good for projects not designed with precompiled
18369 header files in mind, is to simply take most of the header files used by
18370 a project, include them from another header file, precompile that header
18371 file, and @option{-include} the precompiled header.  If the header files
18372 have guards against multiple inclusion, they will be skipped because
18373 they've already been included (in the precompiled header).
18375 If you need to precompile the same header file for different
18376 languages, targets, or compiler options, you can instead make a
18377 @emph{directory} named like @file{all.h.gch}, and put each precompiled
18378 header in the directory, perhaps using @option{-o}.  It doesn't matter
18379 what you call the files in the directory, every precompiled header in
18380 the directory will be considered.  The first precompiled header
18381 encountered in the directory that is valid for this compilation will
18382 be used; they're searched in no particular order.
18384 There are many other possibilities, limited only by your imagination,
18385 good sense, and the constraints of your build system.
18387 A precompiled header file can be used only when these conditions apply:
18389 @itemize
18390 @item
18391 Only one precompiled header can be used in a particular compilation.
18393 @item
18394 A precompiled header can't be used once the first C token is seen.  You
18395 can have preprocessor directives before a precompiled header; you can
18396 even include a precompiled header from inside another header, so long as
18397 there are no C tokens before the @code{#include}.
18399 @item
18400 The precompiled header file must be produced for the same language as
18401 the current compilation.  You can't use a C precompiled header for a C++
18402 compilation.
18404 @item
18405 The precompiled header file must have been produced by the same compiler
18406 binary as the current compilation is using.
18408 @item
18409 Any macros defined before the precompiled header is included must
18410 either be defined in the same way as when the precompiled header was
18411 generated, or must not affect the precompiled header, which usually
18412 means that they don't appear in the precompiled header at all.
18414 The @option{-D} option is one way to define a macro before a
18415 precompiled header is included; using a @code{#define} can also do it.
18416 There are also some options that define macros implicitly, like
18417 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
18418 defined this way.
18420 @item If debugging information is output when using the precompiled
18421 header, using @option{-g} or similar, the same kind of debugging information
18422 must have been output when building the precompiled header.  However,
18423 a precompiled header built using @option{-g} can be used in a compilation
18424 when no debugging information is being output.
18426 @item The same @option{-m} options must generally be used when building
18427 and using the precompiled header.  @xref{Submodel Options},
18428 for any cases where this rule is relaxed.
18430 @item Each of the following options must be the same when building and using
18431 the precompiled header:
18433 @gccoptlist{-fexceptions}
18435 @item
18436 Some other command-line options starting with @option{-f},
18437 @option{-p}, or @option{-O} must be defined in the same way as when
18438 the precompiled header was generated.  At present, it's not clear
18439 which options are safe to change and which are not; the safest choice
18440 is to use exactly the same options when generating and using the
18441 precompiled header.  The following are known to be safe:
18443 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
18444 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
18445 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
18446 -pedantic-errors}
18448 @end itemize
18450 For all of these except the last, the compiler will automatically
18451 ignore the precompiled header if the conditions aren't met.  If you
18452 find an option combination that doesn't work and doesn't cause the
18453 precompiled header to be ignored, please consider filing a bug report,
18454 see @ref{Bugs}.
18456 If you do use differing options when generating and using the
18457 precompiled header, the actual behavior will be a mixture of the
18458 behavior for the options.  For instance, if you use @option{-g} to
18459 generate the precompiled header but not when using it, you may or may
18460 not get debugging information for routines in the precompiled header.