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.
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, 2011
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:
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.
35 @c Set file name and title for the man page.
37 @settitle GNU project C and C++ compiler
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}.
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}.
57 For instructions on reporting bugs, see
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@.
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
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.
120 @xref{Option Index}, for an index to GCC's options.
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
132 * Language Independent Options:: Controlling how diagnostics should be
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
149 * Environment Variables:: Env vars that affect GCC.
150 * Precompiled Headers:: Compiling a header once, and using it many times.
156 @section Option Summary
158 Here is a summary of all the options, grouped by type. Explanations are
159 in the following sections.
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} -fallow-parameterless-variadic-functions @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
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
217 -fobjc-std=objc1 @gol
218 -freplace-objc-classes @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++11-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} -Wno-free-nonheap-object -Wjump-misses-init @gol
248 -Wignored-qualifiers @gol
249 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
250 -Winit-self -Winline -Wmaybe-uninitialized @gol
251 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
252 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
253 -Wlogical-op -Wlong-long @gol
254 -Wmain -Wmaybe-uninitialized -Wmissing-braces -Wmissing-field-initializers @gol
255 -Wmissing-format-attribute -Wmissing-include-dirs @gol
257 -Wno-multichar -Wnonnull -Wno-overflow @gol
258 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
259 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
260 -Wpointer-arith -Wno-pointer-to-int-cast @gol
261 -Wredundant-decls @gol
262 -Wreturn-type -Wsequence-point -Wshadow @gol
263 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
264 -Wstack-usage=@var{len} -Wstrict-aliasing -Wstrict-aliasing=n @gol
265 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
266 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
267 -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
268 -Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
269 -Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
270 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
271 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
272 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
273 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
274 -Wvariadic-macros -Wvector-operation-performance -Wvla
275 -Wvolatile-register-var -Wwrite-strings}
277 @item C and Objective-C-only Warning Options
278 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
279 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
280 -Wold-style-declaration -Wold-style-definition @gol
281 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
282 -Wdeclaration-after-statement -Wpointer-sign}
284 @item Debugging Options
285 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
286 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
287 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
288 -fdisable-ipa-@var{pass_name} @gol
289 -fdisable-rtl-@var{pass_name} @gol
290 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
291 -fdisable-tree-@var{pass_name} @gol
292 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
293 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
294 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
295 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
296 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
298 -fdump-statistics @gol
300 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
301 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
302 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
304 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
305 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
306 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
307 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
308 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
309 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
310 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
311 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
312 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
313 -fdump-tree-nrv -fdump-tree-vect @gol
314 -fdump-tree-sink @gol
315 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
316 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
317 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
318 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
319 -ftree-vectorizer-verbose=@var{n} @gol
320 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
321 -fdump-final-insns=@var{file} @gol
322 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
323 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
324 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
325 -fenable-@var{kind}-@var{pass} @gol
326 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
327 -fdebug-types-section @gol
328 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
329 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
330 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
331 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
332 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
333 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
334 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
335 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
336 -gvms -gxcoff -gxcoff+ @gol
337 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
338 -fdebug-prefix-map=@var{old}=@var{new} @gol
339 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
340 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
341 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
342 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
343 -print-prog-name=@var{program} -print-search-dirs -Q @gol
344 -print-sysroot -print-sysroot-headers-suffix @gol
345 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
347 @item Optimization Options
348 @xref{Optimize Options,,Options that Control Optimization}.
349 @gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
350 -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
351 -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
352 -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
353 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
354 -fcompare-elim -fcprop-registers -fcrossjumping @gol
355 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
356 -fcx-limited-range @gol
357 -fdata-sections -fdce -fdce -fdelayed-branch @gol
358 -fdelete-null-pointer-checks -fdse -fdevirtualize -fdse @gol
359 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
360 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
361 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
362 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
363 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
364 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
365 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
366 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
367 -fira-algorithm=@var{algorithm} @gol
368 -fira-region=@var{region} @gol
369 -fira-loop-pressure -fno-ira-share-save-slots @gol
370 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
371 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
372 -floop-block -floop-flatten -floop-interchange -floop-strip-mine @gol
373 -floop-parallelize-all -flto -flto-compression-level @gol
374 -flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
375 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
376 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
377 -fno-default-inline @gol
378 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
379 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
380 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
381 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
382 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
383 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
384 -fprefetch-loop-arrays @gol
385 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
386 -fprofile-generate=@var{path} @gol
387 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
388 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
389 -freorder-blocks-and-partition -freorder-functions @gol
390 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
391 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
392 -fsched-spec-load -fsched-spec-load-dangerous @gol
393 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
394 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
395 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
396 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
397 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
398 -fselective-scheduling -fselective-scheduling2 @gol
399 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
400 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
401 -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol
402 -fstack-protector-all -fstrict-aliasing -fstrict-overflow @gol
403 -fthread-jumps -ftracer -ftree-bit-ccp @gol
404 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
405 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
406 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
407 -ftree-loop-if-convert-stores -ftree-loop-im @gol
408 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
409 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
410 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
411 -ftree-sink -ftree-sra -ftree-switch-conversion -ftree-tail-merge @gol
412 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
413 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
414 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
415 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
416 -fwhole-program -fwpa -fuse-linker-plugin @gol
417 --param @var{name}=@var{value}
418 -O -O0 -O1 -O2 -O3 -Os -Ofast}
420 @item Preprocessor Options
421 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
422 @gccoptlist{-A@var{question}=@var{answer} @gol
423 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
424 -C -dD -dI -dM -dN @gol
425 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
426 -idirafter @var{dir} @gol
427 -include @var{file} -imacros @var{file} @gol
428 -iprefix @var{file} -iwithprefix @var{dir} @gol
429 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
430 -imultilib @var{dir} -isysroot @var{dir} @gol
431 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
432 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
433 -remap -trigraphs -undef -U@var{macro} @gol
434 -Wp,@var{option} -Xpreprocessor @var{option}}
436 @item Assembler Option
437 @xref{Assembler Options,,Passing Options to the Assembler}.
438 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
441 @xref{Link Options,,Options for Linking}.
442 @gccoptlist{@var{object-file-name} -l@var{library} @gol
443 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
444 -s -static -static-libgcc -static-libstdc++ -shared @gol
445 -shared-libgcc -symbolic @gol
446 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
449 @item Directory Options
450 @xref{Directory Options,,Options for Directory Search}.
451 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
452 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
455 @item Machine Dependent Options
456 @xref{Submodel Options,,Hardware Models and Configurations}.
457 @c This list is ordered alphanumerically by subsection name.
458 @c Try and put the significant identifier (CPU or system) first,
459 @c so users have a clue at guessing where the ones they want will be.
462 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
463 -mabi=@var{name} @gol
464 -mapcs-stack-check -mno-apcs-stack-check @gol
465 -mapcs-float -mno-apcs-float @gol
466 -mapcs-reentrant -mno-apcs-reentrant @gol
467 -msched-prolog -mno-sched-prolog @gol
468 -mlittle-endian -mbig-endian -mwords-little-endian @gol
469 -mfloat-abi=@var{name} -mfpe @gol
470 -mfp16-format=@var{name}
471 -mthumb-interwork -mno-thumb-interwork @gol
472 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
473 -mstructure-size-boundary=@var{n} @gol
474 -mabort-on-noreturn @gol
475 -mlong-calls -mno-long-calls @gol
476 -msingle-pic-base -mno-single-pic-base @gol
477 -mpic-register=@var{reg} @gol
478 -mnop-fun-dllimport @gol
479 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
480 -mpoke-function-name @gol
482 -mtpcs-frame -mtpcs-leaf-frame @gol
483 -mcaller-super-interworking -mcallee-super-interworking @gol
484 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
485 -mword-relocations @gol
486 -mfix-cortex-m3-ldrd}
489 @gccoptlist{-mmcu=@var{mcu} -mno-interrupts @gol
490 -mcall-prologues -mtiny-stack -mint8 -mstrict-X}
492 @emph{Blackfin Options}
493 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
494 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
495 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
496 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
497 -mno-id-shared-library -mshared-library-id=@var{n} @gol
498 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
499 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
500 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
504 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
505 -msim -msdata=@var{sdata-type}}
508 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
509 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
510 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
511 -mstack-align -mdata-align -mconst-align @gol
512 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
513 -melf -maout -melinux -mlinux -sim -sim2 @gol
514 -mmul-bug-workaround -mno-mul-bug-workaround}
516 @emph{Darwin Options}
517 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
518 -arch_only -bind_at_load -bundle -bundle_loader @gol
519 -client_name -compatibility_version -current_version @gol
521 -dependency-file -dylib_file -dylinker_install_name @gol
522 -dynamic -dynamiclib -exported_symbols_list @gol
523 -filelist -flat_namespace -force_cpusubtype_ALL @gol
524 -force_flat_namespace -headerpad_max_install_names @gol
526 -image_base -init -install_name -keep_private_externs @gol
527 -multi_module -multiply_defined -multiply_defined_unused @gol
528 -noall_load -no_dead_strip_inits_and_terms @gol
529 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
530 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
531 -private_bundle -read_only_relocs -sectalign @gol
532 -sectobjectsymbols -whyload -seg1addr @gol
533 -sectcreate -sectobjectsymbols -sectorder @gol
534 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
535 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
536 -segprot -segs_read_only_addr -segs_read_write_addr @gol
537 -single_module -static -sub_library -sub_umbrella @gol
538 -twolevel_namespace -umbrella -undefined @gol
539 -unexported_symbols_list -weak_reference_mismatches @gol
540 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
541 -mkernel -mone-byte-bool}
543 @emph{DEC Alpha Options}
544 @gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
545 -mieee -mieee-with-inexact -mieee-conformant @gol
546 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
547 -mtrap-precision=@var{mode} -mbuild-constants @gol
548 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
549 -mbwx -mmax -mfix -mcix @gol
550 -mfloat-vax -mfloat-ieee @gol
551 -mexplicit-relocs -msmall-data -mlarge-data @gol
552 -msmall-text -mlarge-text @gol
553 -mmemory-latency=@var{time}}
555 @emph{DEC Alpha/VMS Options}
556 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
559 @gccoptlist{-msmall-model -mno-lsim}
562 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
563 -mhard-float -msoft-float @gol
564 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
565 -mdouble -mno-double @gol
566 -mmedia -mno-media -mmuladd -mno-muladd @gol
567 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
568 -mlinked-fp -mlong-calls -malign-labels @gol
569 -mlibrary-pic -macc-4 -macc-8 @gol
570 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
571 -moptimize-membar -mno-optimize-membar @gol
572 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
573 -mvliw-branch -mno-vliw-branch @gol
574 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
575 -mno-nested-cond-exec -mtomcat-stats @gol
579 @emph{GNU/Linux Options}
580 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
581 -tno-android-cc -tno-android-ld}
583 @emph{H8/300 Options}
584 @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
587 @gccoptlist{-march=@var{architecture-type} @gol
588 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
589 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
590 -mfixed-range=@var{register-range} @gol
591 -mjump-in-delay -mlinker-opt -mlong-calls @gol
592 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
593 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
594 -mno-jump-in-delay -mno-long-load-store @gol
595 -mno-portable-runtime -mno-soft-float @gol
596 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
597 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
598 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
599 -munix=@var{unix-std} -nolibdld -static -threads}
601 @emph{i386 and x86-64 Options}
602 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
603 -mfpmath=@var{unit} @gol
604 -masm=@var{dialect} -mno-fancy-math-387 @gol
605 -mno-fp-ret-in-387 -msoft-float @gol
606 -mno-wide-multiply -mrtd -malign-double @gol
607 -mpreferred-stack-boundary=@var{num} @gol
608 -mincoming-stack-boundary=@var{num} @gol
609 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
610 -mrecip -mrecip=@var{opt} @gol
612 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
613 -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
614 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
615 -mbmi2 -mlwp -mthreads -mno-align-stringops -minline-all-stringops @gol
616 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
617 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
618 -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
619 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
620 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
621 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
622 -mcmodel=@var{code-model} -mabi=@var{name} @gol
623 -m32 -m64 -mx32 -mlarge-data-threshold=@var{num} @gol
624 -msse2avx -mfentry -m8bit-idiv @gol
625 -mavx256-split-unaligned-load -mavx256-split-unaligned-store}
627 @emph{i386 and x86-64 Windows Options}
628 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
629 -mnop-fun-dllimport -mthread @gol
630 -municode -mwin32 -mwindows -fno-set-stack-executable}
633 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
634 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
635 -mconstant-gp -mauto-pic -mfused-madd @gol
636 -minline-float-divide-min-latency @gol
637 -minline-float-divide-max-throughput @gol
638 -mno-inline-float-divide @gol
639 -minline-int-divide-min-latency @gol
640 -minline-int-divide-max-throughput @gol
641 -mno-inline-int-divide @gol
642 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
643 -mno-inline-sqrt @gol
644 -mdwarf2-asm -mearly-stop-bits @gol
645 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
646 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
647 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
648 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
649 -msched-spec-ldc -msched-spec-control-ldc @gol
650 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
651 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
652 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
653 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
655 @emph{IA-64/VMS Options}
656 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
659 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
660 -msign-extend-enabled -muser-enabled}
662 @emph{M32R/D Options}
663 @gccoptlist{-m32r2 -m32rx -m32r @gol
665 -malign-loops -mno-align-loops @gol
666 -missue-rate=@var{number} @gol
667 -mbranch-cost=@var{number} @gol
668 -mmodel=@var{code-size-model-type} @gol
669 -msdata=@var{sdata-type} @gol
670 -mno-flush-func -mflush-func=@var{name} @gol
671 -mno-flush-trap -mflush-trap=@var{number} @gol
675 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
677 @emph{M680x0 Options}
678 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
679 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
680 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
681 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
682 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
683 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
684 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
685 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
689 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
690 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
691 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
692 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
693 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
696 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
697 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
698 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
699 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
702 @emph{MicroBlaze Options}
703 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
704 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
705 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
706 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
707 -mxl-mode-@var{app-model}}
710 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
711 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
712 -mips64 -mips64r2 @gol
713 -mips16 -mno-mips16 -mflip-mips16 @gol
714 -minterlink-mips16 -mno-interlink-mips16 @gol
715 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
716 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
717 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
718 -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
719 -mfpu=@var{fpu-type} @gol
720 -msmartmips -mno-smartmips @gol
721 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
722 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
723 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
724 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
725 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
726 -membedded-data -mno-embedded-data @gol
727 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
728 -mcode-readable=@var{setting} @gol
729 -msplit-addresses -mno-split-addresses @gol
730 -mexplicit-relocs -mno-explicit-relocs @gol
731 -mcheck-zero-division -mno-check-zero-division @gol
732 -mdivide-traps -mdivide-breaks @gol
733 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
734 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
735 -mfix-24k -mno-fix-24k @gol
736 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
737 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
738 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
739 -mflush-func=@var{func} -mno-flush-func @gol
740 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
741 -mfp-exceptions -mno-fp-exceptions @gol
742 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
743 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
746 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
747 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
748 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
749 -mno-base-addresses -msingle-exit -mno-single-exit}
751 @emph{MN10300 Options}
752 @gccoptlist{-mmult-bug -mno-mult-bug @gol
753 -mno-am33 -mam33 -mam33-2 -mam34 @gol
754 -mtune=@var{cpu-type} @gol
755 -mreturn-pointer-on-d0 @gol
756 -mno-crt0 -mrelax -mliw -msetlb}
758 @emph{PDP-11 Options}
759 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
760 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
761 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
762 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
763 -mbranch-expensive -mbranch-cheap @gol
764 -munix-asm -mdec-asm}
766 @emph{picoChip Options}
767 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
768 -msymbol-as-address -mno-inefficient-warnings}
770 @emph{PowerPC Options}
771 See RS/6000 and PowerPC Options.
773 @emph{RS/6000 and PowerPC Options}
774 @gccoptlist{-mcpu=@var{cpu-type} @gol
775 -mtune=@var{cpu-type} @gol
776 -mcmodel=@var{code-model} @gol
777 -mpower -mno-power -mpower2 -mno-power2 @gol
778 -mpowerpc -mpowerpc64 -mno-powerpc @gol
779 -maltivec -mno-altivec @gol
780 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
781 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
782 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
783 -mfprnd -mno-fprnd @gol
784 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
785 -mnew-mnemonics -mold-mnemonics @gol
786 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
787 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
788 -malign-power -malign-natural @gol
789 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
790 -msingle-float -mdouble-float -msimple-fpu @gol
791 -mstring -mno-string -mupdate -mno-update @gol
792 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
793 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
794 -mstrict-align -mno-strict-align -mrelocatable @gol
795 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
796 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
797 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
798 -mprioritize-restricted-insns=@var{priority} @gol
799 -msched-costly-dep=@var{dependence_type} @gol
800 -minsert-sched-nops=@var{scheme} @gol
801 -mcall-sysv -mcall-netbsd @gol
802 -maix-struct-return -msvr4-struct-return @gol
803 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
804 -mblock-move-inline-limit=@var{num} @gol
805 -misel -mno-isel @gol
806 -misel=yes -misel=no @gol
808 -mspe=yes -mspe=no @gol
810 -mgen-cell-microcode -mwarn-cell-microcode @gol
811 -mvrsave -mno-vrsave @gol
812 -mmulhw -mno-mulhw @gol
813 -mdlmzb -mno-dlmzb @gol
814 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
815 -mprototype -mno-prototype @gol
816 -msim -mmvme -mads -myellowknife -memb -msdata @gol
817 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
818 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
819 -mno-recip-precision @gol
820 -mveclibabi=@var{type} -mfriz -mno-friz @gol
821 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
822 -msave-toc-indirect -mno-save-toc-indirect}
825 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
827 -mbig-endian-data -mlittle-endian-data @gol
830 -mas100-syntax -mno-as100-syntax@gol
832 -mmax-constant-size=@gol
835 -msave-acc-in-interrupts}
837 @emph{S/390 and zSeries Options}
838 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
839 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
840 -mlong-double-64 -mlong-double-128 @gol
841 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
842 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
843 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
844 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
845 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
848 @gccoptlist{-meb -mel @gol
852 -mscore5 -mscore5u -mscore7 -mscore7d}
855 @gccoptlist{-m1 -m2 -m2e @gol
856 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
858 -m4-nofpu -m4-single-only -m4-single -m4 @gol
859 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
860 -m5-64media -m5-64media-nofpu @gol
861 -m5-32media -m5-32media-nofpu @gol
862 -m5-compact -m5-compact-nofpu @gol
863 -mb -ml -mdalign -mrelax @gol
864 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
865 -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol
866 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
867 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
868 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
869 -maccumulate-outgoing-args -minvalid-symbols}
871 @emph{Solaris 2 Options}
872 @gccoptlist{-mimpure-text -mno-impure-text @gol
876 @gccoptlist{-mcpu=@var{cpu-type} @gol
877 -mtune=@var{cpu-type} @gol
878 -mcmodel=@var{code-model} @gol
879 -m32 -m64 -mapp-regs -mno-app-regs @gol
880 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
881 -mfpu -mno-fpu -mhard-float -msoft-float @gol
882 -mhard-quad-float -msoft-quad-float @gol
884 -mstack-bias -mno-stack-bias @gol
885 -munaligned-doubles -mno-unaligned-doubles @gol
886 -mv8plus -mno-v8plus -mvis -mno-vis @gol
887 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
888 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
892 @gccoptlist{-mwarn-reloc -merror-reloc @gol
893 -msafe-dma -munsafe-dma @gol
895 -msmall-mem -mlarge-mem -mstdmain @gol
896 -mfixed-range=@var{register-range} @gol
898 -maddress-space-conversion -mno-address-space-conversion @gol
899 -mcache-size=@var{cache-size} @gol
900 -matomic-updates -mno-atomic-updates}
902 @emph{System V Options}
903 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
906 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
907 -mprolog-function -mno-prolog-function -mspace @gol
908 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
909 -mapp-regs -mno-app-regs @gol
910 -mdisable-callt -mno-disable-callt @gol
913 -mv850e1 -mv850es @gol
918 @gccoptlist{-mg -mgnu -munix}
920 @emph{VxWorks Options}
921 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
922 -Xbind-lazy -Xbind-now}
924 @emph{x86-64 Options}
925 See i386 and x86-64 Options.
927 @emph{Xstormy16 Options}
930 @emph{Xtensa Options}
931 @gccoptlist{-mconst16 -mno-const16 @gol
932 -mfused-madd -mno-fused-madd @gol
934 -mserialize-volatile -mno-serialize-volatile @gol
935 -mtext-section-literals -mno-text-section-literals @gol
936 -mtarget-align -mno-target-align @gol
937 -mlongcalls -mno-longcalls}
939 @emph{zSeries Options}
940 See S/390 and zSeries Options.
942 @item Code Generation Options
943 @xref{Code Gen Options,,Options for Code Generation Conventions}.
944 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
945 -ffixed-@var{reg} -fexceptions @gol
946 -fnon-call-exceptions -funwind-tables @gol
947 -fasynchronous-unwind-tables @gol
948 -finhibit-size-directive -finstrument-functions @gol
949 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
950 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
951 -fno-common -fno-ident @gol
952 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
953 -fno-jump-tables @gol
954 -frecord-gcc-switches @gol
955 -freg-struct-return -fshort-enums @gol
956 -fshort-double -fshort-wchar @gol
957 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
958 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
959 -fno-stack-limit -fsplit-stack @gol
960 -fleading-underscore -ftls-model=@var{model} @gol
961 -ftrapv -fwrapv -fbounds-check @gol
962 -fvisibility -fstrict-volatile-bitfields}
966 * Overall Options:: Controlling the kind of output:
967 an executable, object files, assembler files,
968 or preprocessed source.
969 * C Dialect Options:: Controlling the variant of C language compiled.
970 * C++ Dialect Options:: Variations on C++.
971 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
973 * Language Independent Options:: Controlling how diagnostics should be
975 * Warning Options:: How picky should the compiler be?
976 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
977 * Optimize Options:: How much optimization?
978 * Preprocessor Options:: Controlling header files and macro definitions.
979 Also, getting dependency information for Make.
980 * Assembler Options:: Passing options to the assembler.
981 * Link Options:: Specifying libraries and so on.
982 * Directory Options:: Where to find header files and libraries.
983 Where to find the compiler executable files.
984 * Spec Files:: How to pass switches to sub-processes.
985 * Target Options:: Running a cross-compiler, or an old version of GCC.
988 @node Overall Options
989 @section Options Controlling the Kind of Output
991 Compilation can involve up to four stages: preprocessing, compilation
992 proper, assembly and linking, always in that order. GCC is capable of
993 preprocessing and compiling several files either into several
994 assembler input files, or into one assembler input file; then each
995 assembler input file produces an object file, and linking combines all
996 the object files (those newly compiled, and those specified as input)
997 into an executable file.
999 @cindex file name suffix
1000 For any given input file, the file name suffix determines what kind of
1001 compilation is done:
1005 C source code which must be preprocessed.
1008 C source code which should not be preprocessed.
1011 C++ source code which should not be preprocessed.
1014 Objective-C source code. Note that you must link with the @file{libobjc}
1015 library to make an Objective-C program work.
1018 Objective-C source code which should not be preprocessed.
1022 Objective-C++ source code. Note that you must link with the @file{libobjc}
1023 library to make an Objective-C++ program work. Note that @samp{.M} refers
1024 to a literal capital M@.
1026 @item @var{file}.mii
1027 Objective-C++ source code which should not be preprocessed.
1030 C, C++, Objective-C or Objective-C++ header file to be turned into a
1031 precompiled header (default), or C, C++ header file to be turned into an
1032 Ada spec (via the @option{-fdump-ada-spec} switch).
1035 @itemx @var{file}.cp
1036 @itemx @var{file}.cxx
1037 @itemx @var{file}.cpp
1038 @itemx @var{file}.CPP
1039 @itemx @var{file}.c++
1041 C++ source code which must be preprocessed. Note that in @samp{.cxx},
1042 the last two letters must both be literally @samp{x}. Likewise,
1043 @samp{.C} refers to a literal capital C@.
1047 Objective-C++ source code which must be preprocessed.
1049 @item @var{file}.mii
1050 Objective-C++ source code which should not be preprocessed.
1054 @itemx @var{file}.hp
1055 @itemx @var{file}.hxx
1056 @itemx @var{file}.hpp
1057 @itemx @var{file}.HPP
1058 @itemx @var{file}.h++
1059 @itemx @var{file}.tcc
1060 C++ header file to be turned into a precompiled header or Ada spec.
1063 @itemx @var{file}.for
1064 @itemx @var{file}.ftn
1065 Fixed form Fortran source code which should not be preprocessed.
1068 @itemx @var{file}.FOR
1069 @itemx @var{file}.fpp
1070 @itemx @var{file}.FPP
1071 @itemx @var{file}.FTN
1072 Fixed form Fortran source code which must be preprocessed (with the traditional
1075 @item @var{file}.f90
1076 @itemx @var{file}.f95
1077 @itemx @var{file}.f03
1078 @itemx @var{file}.f08
1079 Free form Fortran source code which should not be preprocessed.
1081 @item @var{file}.F90
1082 @itemx @var{file}.F95
1083 @itemx @var{file}.F03
1084 @itemx @var{file}.F08
1085 Free form Fortran source code which must be preprocessed (with the
1086 traditional preprocessor).
1091 @c FIXME: Descriptions of Java file types.
1097 @item @var{file}.ads
1098 Ada source code file which contains a library unit declaration (a
1099 declaration of a package, subprogram, or generic, or a generic
1100 instantiation), or a library unit renaming declaration (a package,
1101 generic, or subprogram renaming declaration). Such files are also
1104 @item @var{file}.adb
1105 Ada source code file containing a library unit body (a subprogram or
1106 package body). Such files are also called @dfn{bodies}.
1108 @c GCC also knows about some suffixes for languages not yet included:
1119 @itemx @var{file}.sx
1120 Assembler code which must be preprocessed.
1123 An object file to be fed straight into linking.
1124 Any file name with no recognized suffix is treated this way.
1128 You can specify the input language explicitly with the @option{-x} option:
1131 @item -x @var{language}
1132 Specify explicitly the @var{language} for the following input files
1133 (rather than letting the compiler choose a default based on the file
1134 name suffix). This option applies to all following input files until
1135 the next @option{-x} option. Possible values for @var{language} are:
1137 c c-header cpp-output
1138 c++ c++-header c++-cpp-output
1139 objective-c objective-c-header objective-c-cpp-output
1140 objective-c++ objective-c++-header objective-c++-cpp-output
1141 assembler assembler-with-cpp
1143 f77 f77-cpp-input f95 f95-cpp-input
1149 Turn off any specification of a language, so that subsequent files are
1150 handled according to their file name suffixes (as they are if @option{-x}
1151 has not been used at all).
1153 @item -pass-exit-codes
1154 @opindex pass-exit-codes
1155 Normally the @command{gcc} program will exit with the code of 1 if any
1156 phase of the compiler returns a non-success return code. If you specify
1157 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1158 numerically highest error produced by any phase that returned an error
1159 indication. The C, C++, and Fortran frontends return 4, if an internal
1160 compiler error is encountered.
1163 If you only want some of the stages of compilation, you can use
1164 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1165 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1166 @command{gcc} is to stop. Note that some combinations (for example,
1167 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1172 Compile or assemble the source files, but do not link. The linking
1173 stage simply is not done. The ultimate output is in the form of an
1174 object file for each source file.
1176 By default, the object file name for a source file is made by replacing
1177 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1179 Unrecognized input files, not requiring compilation or assembly, are
1184 Stop after the stage of compilation proper; do not assemble. The output
1185 is in the form of an assembler code file for each non-assembler input
1188 By default, the assembler file name for a source file is made by
1189 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1191 Input files that don't require compilation are ignored.
1195 Stop after the preprocessing stage; do not run the compiler proper. The
1196 output is in the form of preprocessed source code, which is sent to the
1199 Input files which don't require preprocessing are ignored.
1201 @cindex output file option
1204 Place output in file @var{file}. This applies regardless to whatever
1205 sort of output is being produced, whether it be an executable file,
1206 an object file, an assembler file or preprocessed C code.
1208 If @option{-o} is not specified, the default is to put an executable
1209 file in @file{a.out}, the object file for
1210 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1211 assembler file in @file{@var{source}.s}, a precompiled header file in
1212 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1217 Print (on standard error output) the commands executed to run the stages
1218 of compilation. Also print the version number of the compiler driver
1219 program and of the preprocessor and the compiler proper.
1223 Like @option{-v} except the commands are not executed and arguments
1224 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1225 This is useful for shell scripts to capture the driver-generated command lines.
1229 Use pipes rather than temporary files for communication between the
1230 various stages of compilation. This fails to work on some systems where
1231 the assembler is unable to read from a pipe; but the GNU assembler has
1236 Print (on the standard output) a description of the command line options
1237 understood by @command{gcc}. If the @option{-v} option is also specified
1238 then @option{--help} will also be passed on to the various processes
1239 invoked by @command{gcc}, so that they can display the command line options
1240 they accept. If the @option{-Wextra} option has also been specified
1241 (prior to the @option{--help} option), then command line options which
1242 have no documentation associated with them will also be displayed.
1245 @opindex target-help
1246 Print (on the standard output) a description of target-specific command
1247 line options for each tool. For some targets extra target-specific
1248 information may also be printed.
1250 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1251 Print (on the standard output) a description of the command line
1252 options understood by the compiler that fit into all specified classes
1253 and qualifiers. These are the supported classes:
1256 @item @samp{optimizers}
1257 This will display all of the optimization options supported by the
1260 @item @samp{warnings}
1261 This will display all of the options controlling warning messages
1262 produced by the compiler.
1265 This will display target-specific options. Unlike the
1266 @option{--target-help} option however, target-specific options of the
1267 linker and assembler will not be displayed. This is because those
1268 tools do not currently support the extended @option{--help=} syntax.
1271 This will display the values recognized by the @option{--param}
1274 @item @var{language}
1275 This will display the options supported for @var{language}, where
1276 @var{language} is the name of one of the languages supported in this
1280 This will display the options that are common to all languages.
1283 These are the supported qualifiers:
1286 @item @samp{undocumented}
1287 Display only those options which are undocumented.
1290 Display options which take an argument that appears after an equal
1291 sign in the same continuous piece of text, such as:
1292 @samp{--help=target}.
1294 @item @samp{separate}
1295 Display options which take an argument that appears as a separate word
1296 following the original option, such as: @samp{-o output-file}.
1299 Thus for example to display all the undocumented target-specific
1300 switches supported by the compiler the following can be used:
1303 --help=target,undocumented
1306 The sense of a qualifier can be inverted by prefixing it with the
1307 @samp{^} character, so for example to display all binary warning
1308 options (i.e., ones that are either on or off and that do not take an
1309 argument), which have a description the following can be used:
1312 --help=warnings,^joined,^undocumented
1315 The argument to @option{--help=} should not consist solely of inverted
1318 Combining several classes is possible, although this usually
1319 restricts the output by so much that there is nothing to display. One
1320 case where it does work however is when one of the classes is
1321 @var{target}. So for example to display all the target-specific
1322 optimization options the following can be used:
1325 --help=target,optimizers
1328 The @option{--help=} option can be repeated on the command line. Each
1329 successive use will display its requested class of options, skipping
1330 those that have already been displayed.
1332 If the @option{-Q} option appears on the command line before the
1333 @option{--help=} option, then the descriptive text displayed by
1334 @option{--help=} is changed. Instead of describing the displayed
1335 options, an indication is given as to whether the option is enabled,
1336 disabled or set to a specific value (assuming that the compiler
1337 knows this at the point where the @option{--help=} option is used).
1339 Here is a truncated example from the ARM port of @command{gcc}:
1342 % gcc -Q -mabi=2 --help=target -c
1343 The following options are target specific:
1345 -mabort-on-noreturn [disabled]
1349 The output is sensitive to the effects of previous command line
1350 options, so for example it is possible to find out which optimizations
1351 are enabled at @option{-O2} by using:
1354 -Q -O2 --help=optimizers
1357 Alternatively you can discover which binary optimizations are enabled
1358 by @option{-O3} by using:
1361 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1362 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1363 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1366 @item -no-canonical-prefixes
1367 @opindex no-canonical-prefixes
1368 Do not expand any symbolic links, resolve references to @samp{/../}
1369 or @samp{/./}, or make the path absolute when generating a relative
1374 Display the version number and copyrights of the invoked GCC@.
1378 Invoke all subcommands under a wrapper program. The name of the
1379 wrapper program and its parameters are passed as a comma separated
1383 gcc -c t.c -wrapper gdb,--args
1386 This will invoke all subprograms of @command{gcc} under
1387 @samp{gdb --args}, thus the invocation of @command{cc1} will be
1388 @samp{gdb --args cc1 @dots{}}.
1390 @item -fplugin=@var{name}.so
1391 Load the plugin code in file @var{name}.so, assumed to be a
1392 shared object to be dlopen'd by the compiler. The base name of
1393 the shared object file is used to identify the plugin for the
1394 purposes of argument parsing (See
1395 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1396 Each plugin should define the callback functions specified in the
1399 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1400 Define an argument called @var{key} with a value of @var{value}
1401 for the plugin called @var{name}.
1403 @item -fdump-ada-spec@r{[}-slim@r{]}
1404 For C and C++ source and include files, generate corresponding Ada
1405 specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1406 GNAT User's Guide}, which provides detailed documentation on this feature.
1408 @item -fdump-go-spec=@var{file}
1409 For input files in any language, generate corresponding Go
1410 declarations in @var{file}. This generates Go @code{const},
1411 @code{type}, @code{var}, and @code{func} declarations which may be a
1412 useful way to start writing a Go interface to code written in some
1415 @include @value{srcdir}/../libiberty/at-file.texi
1419 @section Compiling C++ Programs
1421 @cindex suffixes for C++ source
1422 @cindex C++ source file suffixes
1423 C++ source files conventionally use one of the suffixes @samp{.C},
1424 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1425 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1426 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1427 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1428 files with these names and compiles them as C++ programs even if you
1429 call the compiler the same way as for compiling C programs (usually
1430 with the name @command{gcc}).
1434 However, the use of @command{gcc} does not add the C++ library.
1435 @command{g++} is a program that calls GCC and treats @samp{.c},
1436 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1437 files unless @option{-x} is used, and automatically specifies linking
1438 against the C++ library. This program is also useful when
1439 precompiling a C header file with a @samp{.h} extension for use in C++
1440 compilations. On many systems, @command{g++} is also installed with
1441 the name @command{c++}.
1443 @cindex invoking @command{g++}
1444 When you compile C++ programs, you may specify many of the same
1445 command-line options that you use for compiling programs in any
1446 language; or command-line options meaningful for C and related
1447 languages; or options that are meaningful only for C++ programs.
1448 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1449 explanations of options for languages related to C@.
1450 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1451 explanations of options that are meaningful only for C++ programs.
1453 @node C Dialect Options
1454 @section Options Controlling C Dialect
1455 @cindex dialect options
1456 @cindex language dialect options
1457 @cindex options, dialect
1459 The following options control the dialect of C (or languages derived
1460 from C, such as C++, Objective-C and Objective-C++) that the compiler
1464 @cindex ANSI support
1468 In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
1469 equivalent to @samp{-std=c++98}.
1471 This turns off certain features of GCC that are incompatible with ISO
1472 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1473 such as the @code{asm} and @code{typeof} keywords, and
1474 predefined macros such as @code{unix} and @code{vax} that identify the
1475 type of system you are using. It also enables the undesirable and
1476 rarely used ISO trigraph feature. For the C compiler,
1477 it disables recognition of C++ style @samp{//} comments as well as
1478 the @code{inline} keyword.
1480 The alternate keywords @code{__asm__}, @code{__extension__},
1481 @code{__inline__} and @code{__typeof__} continue to work despite
1482 @option{-ansi}. You would not want to use them in an ISO C program, of
1483 course, but it is useful to put them in header files that might be included
1484 in compilations done with @option{-ansi}. Alternate predefined macros
1485 such as @code{__unix__} and @code{__vax__} are also available, with or
1486 without @option{-ansi}.
1488 The @option{-ansi} option does not cause non-ISO programs to be
1489 rejected gratuitously. For that, @option{-pedantic} is required in
1490 addition to @option{-ansi}. @xref{Warning Options}.
1492 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1493 option is used. Some header files may notice this macro and refrain
1494 from declaring certain functions or defining certain macros that the
1495 ISO standard doesn't call for; this is to avoid interfering with any
1496 programs that might use these names for other things.
1498 Functions that would normally be built in but do not have semantics
1499 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1500 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1501 built-in functions provided by GCC}, for details of the functions
1506 Determine the language standard. @xref{Standards,,Language Standards
1507 Supported by GCC}, for details of these standard versions. This option
1508 is currently only supported when compiling C or C++.
1510 The compiler can accept several base standards, such as @samp{c90} or
1511 @samp{c++98}, and GNU dialects of those standards, such as
1512 @samp{gnu90} or @samp{gnu++98}. By specifying a base standard, the
1513 compiler will accept all programs following that standard and those
1514 using GNU extensions that do not contradict it. For example,
1515 @samp{-std=c90} turns off certain features of GCC that are
1516 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1517 keywords, but not other GNU extensions that do not have a meaning in
1518 ISO C90, such as omitting the middle term of a @code{?:}
1519 expression. On the other hand, by specifying a GNU dialect of a
1520 standard, all features the compiler support are enabled, even when
1521 those features change the meaning of the base standard and some
1522 strict-conforming programs may be rejected. The particular standard
1523 is used by @option{-pedantic} to identify which features are GNU
1524 extensions given that version of the standard. For example
1525 @samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
1526 comments, while @samp{-std=gnu99 -pedantic} would not.
1528 A value for this option must be provided; possible values are
1534 Support all ISO C90 programs (certain GNU extensions that conflict
1535 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1537 @item iso9899:199409
1538 ISO C90 as modified in amendment 1.
1544 ISO C99. Note that this standard is not yet fully supported; see
1545 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1546 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1549 ISO C1X, the draft of the next revision of the ISO C standard.
1550 Support is limited and experimental and features enabled by this
1551 option may be changed or removed if changed in or removed from the
1556 GNU dialect of ISO C90 (including some C99 features). This
1557 is the default for C code.
1561 GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
1562 this will become the default. The name @samp{gnu9x} is deprecated.
1565 GNU dialect of ISO C1X. Support is limited and experimental and
1566 features enabled by this option may be changed or removed if changed
1567 in or removed from the standard draft.
1570 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1574 GNU dialect of @option{-std=c++98}. This is the default for
1578 The 2011 ISO C++ standard plus amendments. Support for C++11 is still
1579 experimental, and may change in incompatible ways in future releases.
1582 GNU dialect of @option{-std=c++11}. Support for C++11 is still
1583 experimental, and may change in incompatible ways in future releases.
1586 @item -fgnu89-inline
1587 @opindex fgnu89-inline
1588 The option @option{-fgnu89-inline} tells GCC to use the traditional
1589 GNU semantics for @code{inline} functions when in C99 mode.
1590 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1591 is accepted and ignored by GCC versions 4.1.3 up to but not including
1592 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1593 C99 mode. Using this option is roughly equivalent to adding the
1594 @code{gnu_inline} function attribute to all inline functions
1595 (@pxref{Function Attributes}).
1597 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1598 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1599 specifies the default behavior). This option was first supported in
1600 GCC 4.3. This option is not supported in @option{-std=c90} or
1601 @option{-std=gnu90} mode.
1603 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1604 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1605 in effect for @code{inline} functions. @xref{Common Predefined
1606 Macros,,,cpp,The C Preprocessor}.
1608 @item -aux-info @var{filename}
1610 Output to the given filename prototyped declarations for all functions
1611 declared and/or defined in a translation unit, including those in header
1612 files. This option is silently ignored in any language other than C@.
1614 Besides declarations, the file indicates, in comments, the origin of
1615 each declaration (source file and line), whether the declaration was
1616 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1617 @samp{O} for old, respectively, in the first character after the line
1618 number and the colon), and whether it came from a declaration or a
1619 definition (@samp{C} or @samp{F}, respectively, in the following
1620 character). In the case of function definitions, a K&R-style list of
1621 arguments followed by their declarations is also provided, inside
1622 comments, after the declaration.
1624 @item -fallow-parameterless-variadic-functions
1625 Accept variadic functions without named parameters.
1627 Although it is possible to define such a function, this is not very
1628 useful as it is not possible to read the arguments. This is only
1629 supported for C as this construct is allowed by C++.
1633 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1634 keyword, so that code can use these words as identifiers. You can use
1635 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1636 instead. @option{-ansi} implies @option{-fno-asm}.
1638 In C++, this switch only affects the @code{typeof} keyword, since
1639 @code{asm} and @code{inline} are standard keywords. You may want to
1640 use the @option{-fno-gnu-keywords} flag instead, which has the same
1641 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1642 switch only affects the @code{asm} and @code{typeof} keywords, since
1643 @code{inline} is a standard keyword in ISO C99.
1646 @itemx -fno-builtin-@var{function}
1647 @opindex fno-builtin
1648 @cindex built-in functions
1649 Don't recognize built-in functions that do not begin with
1650 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1651 functions provided by GCC}, for details of the functions affected,
1652 including those which are not built-in functions when @option{-ansi} or
1653 @option{-std} options for strict ISO C conformance are used because they
1654 do not have an ISO standard meaning.
1656 GCC normally generates special code to handle certain built-in functions
1657 more efficiently; for instance, calls to @code{alloca} may become single
1658 instructions that adjust the stack directly, and calls to @code{memcpy}
1659 may become inline copy loops. The resulting code is often both smaller
1660 and faster, but since the function calls no longer appear as such, you
1661 cannot set a breakpoint on those calls, nor can you change the behavior
1662 of the functions by linking with a different library. In addition,
1663 when a function is recognized as a built-in function, GCC may use
1664 information about that function to warn about problems with calls to
1665 that function, or to generate more efficient code, even if the
1666 resulting code still contains calls to that function. For example,
1667 warnings are given with @option{-Wformat} for bad calls to
1668 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1669 known not to modify global memory.
1671 With the @option{-fno-builtin-@var{function}} option
1672 only the built-in function @var{function} is
1673 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1674 function is named that is not built-in in this version of GCC, this
1675 option is ignored. There is no corresponding
1676 @option{-fbuiltin-@var{function}} option; if you wish to enable
1677 built-in functions selectively when using @option{-fno-builtin} or
1678 @option{-ffreestanding}, you may define macros such as:
1681 #define abs(n) __builtin_abs ((n))
1682 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1687 @cindex hosted environment
1689 Assert that compilation takes place in a hosted environment. This implies
1690 @option{-fbuiltin}. A hosted environment is one in which the
1691 entire standard library is available, and in which @code{main} has a return
1692 type of @code{int}. Examples are nearly everything except a kernel.
1693 This is equivalent to @option{-fno-freestanding}.
1695 @item -ffreestanding
1696 @opindex ffreestanding
1697 @cindex hosted environment
1699 Assert that compilation takes place in a freestanding environment. This
1700 implies @option{-fno-builtin}. A freestanding environment
1701 is one in which the standard library may not exist, and program startup may
1702 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1703 This is equivalent to @option{-fno-hosted}.
1705 @xref{Standards,,Language Standards Supported by GCC}, for details of
1706 freestanding and hosted environments.
1710 @cindex OpenMP parallel
1711 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1712 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1713 compiler generates parallel code according to the OpenMP Application
1714 Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
1715 implies @option{-pthread}, and thus is only supported on targets that
1716 have support for @option{-pthread}.
1718 @item -fms-extensions
1719 @opindex fms-extensions
1720 Accept some non-standard constructs used in Microsoft header files.
1722 In C++ code, this allows member names in structures to be similar
1723 to previous types declarations.
1732 Some cases of unnamed fields in structures and unions are only
1733 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1734 fields within structs/unions}, for details.
1736 @item -fplan9-extensions
1737 Accept some non-standard constructs used in Plan 9 code.
1739 This enables @option{-fms-extensions}, permits passing pointers to
1740 structures with anonymous fields to functions which expect pointers to
1741 elements of the type of the field, and permits referring to anonymous
1742 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1743 struct/union fields within structs/unions}, for details. This is only
1744 supported for C, not C++.
1748 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1749 options for strict ISO C conformance) implies @option{-trigraphs}.
1751 @item -no-integrated-cpp
1752 @opindex no-integrated-cpp
1753 Performs a compilation in two passes: preprocessing and compiling. This
1754 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1755 @option{-B} option. The user supplied compilation step can then add in
1756 an additional preprocessing step after normal preprocessing but before
1757 compiling. The default is to use the integrated cpp (internal cpp)
1759 The semantics of this option will change if "cc1", "cc1plus", and
1760 "cc1obj" are merged.
1762 @cindex traditional C language
1763 @cindex C language, traditional
1765 @itemx -traditional-cpp
1766 @opindex traditional-cpp
1767 @opindex traditional
1768 Formerly, these options caused GCC to attempt to emulate a pre-standard
1769 C compiler. They are now only supported with the @option{-E} switch.
1770 The preprocessor continues to support a pre-standard mode. See the GNU
1771 CPP manual for details.
1773 @item -fcond-mismatch
1774 @opindex fcond-mismatch
1775 Allow conditional expressions with mismatched types in the second and
1776 third arguments. The value of such an expression is void. This option
1777 is not supported for C++.
1779 @item -flax-vector-conversions
1780 @opindex flax-vector-conversions
1781 Allow implicit conversions between vectors with differing numbers of
1782 elements and/or incompatible element types. This option should not be
1785 @item -funsigned-char
1786 @opindex funsigned-char
1787 Let the type @code{char} be unsigned, like @code{unsigned char}.
1789 Each kind of machine has a default for what @code{char} should
1790 be. It is either like @code{unsigned char} by default or like
1791 @code{signed char} by default.
1793 Ideally, a portable program should always use @code{signed char} or
1794 @code{unsigned char} when it depends on the signedness of an object.
1795 But many programs have been written to use plain @code{char} and
1796 expect it to be signed, or expect it to be unsigned, depending on the
1797 machines they were written for. This option, and its inverse, let you
1798 make such a program work with the opposite default.
1800 The type @code{char} is always a distinct type from each of
1801 @code{signed char} or @code{unsigned char}, even though its behavior
1802 is always just like one of those two.
1805 @opindex fsigned-char
1806 Let the type @code{char} be signed, like @code{signed char}.
1808 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1809 the negative form of @option{-funsigned-char}. Likewise, the option
1810 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1812 @item -fsigned-bitfields
1813 @itemx -funsigned-bitfields
1814 @itemx -fno-signed-bitfields
1815 @itemx -fno-unsigned-bitfields
1816 @opindex fsigned-bitfields
1817 @opindex funsigned-bitfields
1818 @opindex fno-signed-bitfields
1819 @opindex fno-unsigned-bitfields
1820 These options control whether a bit-field is signed or unsigned, when the
1821 declaration does not use either @code{signed} or @code{unsigned}. By
1822 default, such a bit-field is signed, because this is consistent: the
1823 basic integer types such as @code{int} are signed types.
1826 @node C++ Dialect Options
1827 @section Options Controlling C++ Dialect
1829 @cindex compiler options, C++
1830 @cindex C++ options, command line
1831 @cindex options, C++
1832 This section describes the command-line options that are only meaningful
1833 for C++ programs; but you can also use most of the GNU compiler options
1834 regardless of what language your program is in. For example, you
1835 might compile a file @code{firstClass.C} like this:
1838 g++ -g -frepo -O -c firstClass.C
1842 In this example, only @option{-frepo} is an option meant
1843 only for C++ programs; you can use the other options with any
1844 language supported by GCC@.
1846 Here is a list of options that are @emph{only} for compiling C++ programs:
1850 @item -fabi-version=@var{n}
1851 @opindex fabi-version
1852 Use version @var{n} of the C++ ABI@. Version 2 is the version of the
1853 C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1854 the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1855 the version that conforms most closely to the C++ ABI specification.
1856 Therefore, the ABI obtained using version 0 will change as ABI bugs
1859 The default is version 2.
1861 Version 3 corrects an error in mangling a constant address as a
1864 Version 4 implements a standard mangling for vector types.
1866 Version 5 corrects the mangling of attribute const/volatile on
1867 function pointer types, decltype of a plain decl, and use of a
1868 function parameter in the declaration of another parameter.
1870 Version 6 corrects the promotion behavior of C++11 scoped enums.
1872 See also @option{-Wabi}.
1874 @item -fno-access-control
1875 @opindex fno-access-control
1876 Turn off all access checking. This switch is mainly useful for working
1877 around bugs in the access control code.
1881 Check that the pointer returned by @code{operator new} is non-null
1882 before attempting to modify the storage allocated. This check is
1883 normally unnecessary because the C++ standard specifies that
1884 @code{operator new} will only return @code{0} if it is declared
1885 @samp{throw()}, in which case the compiler will always check the
1886 return value even without this option. In all other cases, when
1887 @code{operator new} has a non-empty exception specification, memory
1888 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1889 @samp{new (nothrow)}.
1891 @item -fconserve-space
1892 @opindex fconserve-space
1893 Put uninitialized or runtime-initialized global variables into the
1894 common segment, as C does. This saves space in the executable at the
1895 cost of not diagnosing duplicate definitions. If you compile with this
1896 flag and your program mysteriously crashes after @code{main()} has
1897 completed, you may have an object that is being destroyed twice because
1898 two definitions were merged.
1900 This option is no longer useful on most targets, now that support has
1901 been added for putting variables into BSS without making them common.
1903 @item -fconstexpr-depth=@var{n}
1904 @opindex fconstexpr-depth
1905 Set the maximum nested evaluation depth for C++11 constexpr functions
1906 to @var{n}. A limit is needed to detect endless recursion during
1907 constant expression evaluation. The minimum specified by the standard
1910 @item -fdeduce-init-list
1911 @opindex fdeduce-init-list
1912 Enable deduction of a template type parameter as
1913 std::initializer_list from a brace-enclosed initializer list, i.e.
1916 template <class T> auto forward(T t) -> decltype (realfn (t))
1923 forward(@{1,2@}); // call forward<std::initializer_list<int>>
1927 This deduction was implemented as a possible extension to the
1928 originally proposed semantics for the C++11 standard, but was not part
1929 of the final standard, so it is disabled by default. This option is
1930 deprecated, and may be removed in a future version of G++.
1932 @item -ffriend-injection
1933 @opindex ffriend-injection
1934 Inject friend functions into the enclosing namespace, so that they are
1935 visible outside the scope of the class in which they are declared.
1936 Friend functions were documented to work this way in the old Annotated
1937 C++ Reference Manual, and versions of G++ before 4.1 always worked
1938 that way. However, in ISO C++ a friend function which is not declared
1939 in an enclosing scope can only be found using argument dependent
1940 lookup. This option causes friends to be injected as they were in
1943 This option is for compatibility, and may be removed in a future
1946 @item -fno-elide-constructors
1947 @opindex fno-elide-constructors
1948 The C++ standard allows an implementation to omit creating a temporary
1949 which is only used to initialize another object of the same type.
1950 Specifying this option disables that optimization, and forces G++ to
1951 call the copy constructor in all cases.
1953 @item -fno-enforce-eh-specs
1954 @opindex fno-enforce-eh-specs
1955 Don't generate code to check for violation of exception specifications
1956 at runtime. This option violates the C++ standard, but may be useful
1957 for reducing code size in production builds, much like defining
1958 @samp{NDEBUG}. This does not give user code permission to throw
1959 exceptions in violation of the exception specifications; the compiler
1960 will still optimize based on the specifications, so throwing an
1961 unexpected exception will result in undefined behavior.
1964 @itemx -fno-for-scope
1966 @opindex fno-for-scope
1967 If @option{-ffor-scope} is specified, the scope of variables declared in
1968 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1969 as specified by the C++ standard.
1970 If @option{-fno-for-scope} is specified, the scope of variables declared in
1971 a @i{for-init-statement} extends to the end of the enclosing scope,
1972 as was the case in old versions of G++, and other (traditional)
1973 implementations of C++.
1975 The default if neither flag is given to follow the standard,
1976 but to allow and give a warning for old-style code that would
1977 otherwise be invalid, or have different behavior.
1979 @item -fno-gnu-keywords
1980 @opindex fno-gnu-keywords
1981 Do not recognize @code{typeof} as a keyword, so that code can use this
1982 word as an identifier. You can use the keyword @code{__typeof__} instead.
1983 @option{-ansi} implies @option{-fno-gnu-keywords}.
1985 @item -fno-implicit-templates
1986 @opindex fno-implicit-templates
1987 Never emit code for non-inline templates which are instantiated
1988 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1989 @xref{Template Instantiation}, for more information.
1991 @item -fno-implicit-inline-templates
1992 @opindex fno-implicit-inline-templates
1993 Don't emit code for implicit instantiations of inline templates, either.
1994 The default is to handle inlines differently so that compiles with and
1995 without optimization will need the same set of explicit instantiations.
1997 @item -fno-implement-inlines
1998 @opindex fno-implement-inlines
1999 To save space, do not emit out-of-line copies of inline functions
2000 controlled by @samp{#pragma implementation}. This will cause linker
2001 errors if these functions are not inlined everywhere they are called.
2003 @item -fms-extensions
2004 @opindex fms-extensions
2005 Disable pedantic warnings about constructs used in MFC, such as implicit
2006 int and getting a pointer to member function via non-standard syntax.
2008 @item -fno-nonansi-builtins
2009 @opindex fno-nonansi-builtins
2010 Disable built-in declarations of functions that are not mandated by
2011 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2012 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2015 @opindex fnothrow-opt
2016 Treat a @code{throw()} exception specification as though it were a
2017 @code{noexcept} specification to reduce or eliminate the text size
2018 overhead relative to a function with no exception specification. If
2019 the function has local variables of types with non-trivial
2020 destructors, the exception specification will actually make the
2021 function smaller because the EH cleanups for those variables can be
2022 optimized away. The semantic effect is that an exception thrown out of
2023 a function with such an exception specification will result in a call
2024 to @code{terminate} rather than @code{unexpected}.
2026 @item -fno-operator-names
2027 @opindex fno-operator-names
2028 Do not treat the operator name keywords @code{and}, @code{bitand},
2029 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2030 synonyms as keywords.
2032 @item -fno-optional-diags
2033 @opindex fno-optional-diags
2034 Disable diagnostics that the standard says a compiler does not need to
2035 issue. Currently, the only such diagnostic issued by G++ is the one for
2036 a name having multiple meanings within a class.
2039 @opindex fpermissive
2040 Downgrade some diagnostics about nonconformant code from errors to
2041 warnings. Thus, using @option{-fpermissive} will allow some
2042 nonconforming code to compile.
2044 @item -fno-pretty-templates
2045 @opindex fno-pretty-templates
2046 When an error message refers to a specialization of a function
2047 template, the compiler will normally print the signature of the
2048 template followed by the template arguments and any typedefs or
2049 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2050 rather than @code{void f(int)}) so that it's clear which template is
2051 involved. When an error message refers to a specialization of a class
2052 template, the compiler will omit any template arguments which match
2053 the default template arguments for that template. If either of these
2054 behaviors make it harder to understand the error message rather than
2055 easier, using @option{-fno-pretty-templates} will disable them.
2059 Enable automatic template instantiation at link time. This option also
2060 implies @option{-fno-implicit-templates}. @xref{Template
2061 Instantiation}, for more information.
2065 Disable generation of information about every class with virtual
2066 functions for use by the C++ runtime type identification features
2067 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
2068 of the language, you can save some space by using this flag. Note that
2069 exception handling uses the same information, but it will generate it as
2070 needed. The @samp{dynamic_cast} operator can still be used for casts that
2071 do not require runtime type information, i.e.@: casts to @code{void *} or to
2072 unambiguous base classes.
2076 Emit statistics about front-end processing at the end of the compilation.
2077 This information is generally only useful to the G++ development team.
2079 @item -fstrict-enums
2080 @opindex fstrict-enums
2081 Allow the compiler to optimize using the assumption that a value of
2082 enumeration type can only be one of the values of the enumeration (as
2083 defined in the C++ standard; basically, a value which can be
2084 represented in the minimum number of bits needed to represent all the
2085 enumerators). This assumption may not be valid if the program uses a
2086 cast to convert an arbitrary integer value to the enumeration type.
2088 @item -ftemplate-depth=@var{n}
2089 @opindex ftemplate-depth
2090 Set the maximum instantiation depth for template classes to @var{n}.
2091 A limit on the template instantiation depth is needed to detect
2092 endless recursions during template class instantiation. ANSI/ISO C++
2093 conforming programs must not rely on a maximum depth greater than 17
2094 (changed to 1024 in C++11). The default value is 900, as the compiler
2095 can run out of stack space before hitting 1024 in some situations.
2097 @item -fno-threadsafe-statics
2098 @opindex fno-threadsafe-statics
2099 Do not emit the extra code to use the routines specified in the C++
2100 ABI for thread-safe initialization of local statics. You can use this
2101 option to reduce code size slightly in code that doesn't need to be
2104 @item -fuse-cxa-atexit
2105 @opindex fuse-cxa-atexit
2106 Register destructors for objects with static storage duration with the
2107 @code{__cxa_atexit} function rather than the @code{atexit} function.
2108 This option is required for fully standards-compliant handling of static
2109 destructors, but will only work if your C library supports
2110 @code{__cxa_atexit}.
2112 @item -fno-use-cxa-get-exception-ptr
2113 @opindex fno-use-cxa-get-exception-ptr
2114 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2115 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
2116 if the runtime routine is not available.
2118 @item -fvisibility-inlines-hidden
2119 @opindex fvisibility-inlines-hidden
2120 This switch declares that the user does not attempt to compare
2121 pointers to inline functions or methods where the addresses of the two functions
2122 were taken in different shared objects.
2124 The effect of this is that GCC may, effectively, mark inline methods with
2125 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2126 appear in the export table of a DSO and do not require a PLT indirection
2127 when used within the DSO@. Enabling this option can have a dramatic effect
2128 on load and link times of a DSO as it massively reduces the size of the
2129 dynamic export table when the library makes heavy use of templates.
2131 The behavior of this switch is not quite the same as marking the
2132 methods as hidden directly, because it does not affect static variables
2133 local to the function or cause the compiler to deduce that
2134 the function is defined in only one shared object.
2136 You may mark a method as having a visibility explicitly to negate the
2137 effect of the switch for that method. For example, if you do want to
2138 compare pointers to a particular inline method, you might mark it as
2139 having default visibility. Marking the enclosing class with explicit
2140 visibility will have no effect.
2142 Explicitly instantiated inline methods are unaffected by this option
2143 as their linkage might otherwise cross a shared library boundary.
2144 @xref{Template Instantiation}.
2146 @item -fvisibility-ms-compat
2147 @opindex fvisibility-ms-compat
2148 This flag attempts to use visibility settings to make GCC's C++
2149 linkage model compatible with that of Microsoft Visual Studio.
2151 The flag makes these changes to GCC's linkage model:
2155 It sets the default visibility to @code{hidden}, like
2156 @option{-fvisibility=hidden}.
2159 Types, but not their members, are not hidden by default.
2162 The One Definition Rule is relaxed for types without explicit
2163 visibility specifications which are defined in more than one different
2164 shared object: those declarations are permitted if they would have
2165 been permitted when this option was not used.
2168 In new code it is better to use @option{-fvisibility=hidden} and
2169 export those classes which are intended to be externally visible.
2170 Unfortunately it is possible for code to rely, perhaps accidentally,
2171 on the Visual Studio behavior.
2173 Among the consequences of these changes are that static data members
2174 of the same type with the same name but defined in different shared
2175 objects will be different, so changing one will not change the other;
2176 and that pointers to function members defined in different shared
2177 objects may not compare equal. When this flag is given, it is a
2178 violation of the ODR to define types with the same name differently.
2182 Do not use weak symbol support, even if it is provided by the linker.
2183 By default, G++ will use weak symbols if they are available. This
2184 option exists only for testing, and should not be used by end-users;
2185 it will result in inferior code and has no benefits. This option may
2186 be removed in a future release of G++.
2190 Do not search for header files in the standard directories specific to
2191 C++, but do still search the other standard directories. (This option
2192 is used when building the C++ library.)
2195 In addition, these optimization, warning, and code generation options
2196 have meanings only for C++ programs:
2199 @item -fno-default-inline
2200 @opindex fno-default-inline
2201 Do not assume @samp{inline} for functions defined inside a class scope.
2202 @xref{Optimize Options,,Options That Control Optimization}. Note that these
2203 functions will have linkage like inline functions; they just won't be
2206 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2209 Warn when G++ generates code that is probably not compatible with the
2210 vendor-neutral C++ ABI@. Although an effort has been made to warn about
2211 all such cases, there are probably some cases that are not warned about,
2212 even though G++ is generating incompatible code. There may also be
2213 cases where warnings are emitted even though the code that is generated
2216 You should rewrite your code to avoid these warnings if you are
2217 concerned about the fact that code generated by G++ may not be binary
2218 compatible with code generated by other compilers.
2220 The known incompatibilities in @option{-fabi-version=2} (the default) include:
2225 A template with a non-type template parameter of reference type is
2226 mangled incorrectly:
2229 template <int &> struct S @{@};
2233 This is fixed in @option{-fabi-version=3}.
2236 SIMD vector types declared using @code{__attribute ((vector_size))} are
2237 mangled in a non-standard way that does not allow for overloading of
2238 functions taking vectors of different sizes.
2240 The mangling is changed in @option{-fabi-version=4}.
2243 The known incompatibilities in @option{-fabi-version=1} include:
2248 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2249 pack data into the same byte as a base class. For example:
2252 struct A @{ virtual void f(); int f1 : 1; @};
2253 struct B : public A @{ int f2 : 1; @};
2257 In this case, G++ will place @code{B::f2} into the same byte
2258 as@code{A::f1}; other compilers will not. You can avoid this problem
2259 by explicitly padding @code{A} so that its size is a multiple of the
2260 byte size on your platform; that will cause G++ and other compilers to
2261 layout @code{B} identically.
2264 Incorrect handling of tail-padding for virtual bases. G++ does not use
2265 tail padding when laying out virtual bases. For example:
2268 struct A @{ virtual void f(); char c1; @};
2269 struct B @{ B(); char c2; @};
2270 struct C : public A, public virtual B @{@};
2274 In this case, G++ will not place @code{B} into the tail-padding for
2275 @code{A}; other compilers will. You can avoid this problem by
2276 explicitly padding @code{A} so that its size is a multiple of its
2277 alignment (ignoring virtual base classes); that will cause G++ and other
2278 compilers to layout @code{C} identically.
2281 Incorrect handling of bit-fields with declared widths greater than that
2282 of their underlying types, when the bit-fields appear in a union. For
2286 union U @{ int i : 4096; @};
2290 Assuming that an @code{int} does not have 4096 bits, G++ will make the
2291 union too small by the number of bits in an @code{int}.
2294 Empty classes can be placed at incorrect offsets. For example:
2304 struct C : public B, public A @{@};
2308 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2309 it should be placed at offset zero. G++ mistakenly believes that the
2310 @code{A} data member of @code{B} is already at offset zero.
2313 Names of template functions whose types involve @code{typename} or
2314 template template parameters can be mangled incorrectly.
2317 template <typename Q>
2318 void f(typename Q::X) @{@}
2320 template <template <typename> class Q>
2321 void f(typename Q<int>::X) @{@}
2325 Instantiations of these templates may be mangled incorrectly.
2329 It also warns psABI related changes. The known psABI changes at this
2335 For SYSV/x86-64, when passing union with long double, it is changed to
2336 pass in memory as specified in psABI. For example:
2346 @code{union U} will always be passed in memory.
2350 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2351 @opindex Wctor-dtor-privacy
2352 @opindex Wno-ctor-dtor-privacy
2353 Warn when a class seems unusable because all the constructors or
2354 destructors in that class are private, and it has neither friends nor
2355 public static member functions.
2357 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2358 @opindex Wdelete-non-virtual-dtor
2359 @opindex Wno-delete-non-virtual-dtor
2360 Warn when @samp{delete} is used to destroy an instance of a class which
2361 has virtual functions and non-virtual destructor. It is unsafe to delete
2362 an instance of a derived class through a pointer to a base class if the
2363 base class does not have a virtual destructor. This warning is enabled
2366 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
2368 @opindex Wno-narrowing
2369 With -std=c++11, suppress the diagnostic required by the standard for
2370 narrowing conversions within @samp{@{ @}}, e.g.
2373 int i = @{ 2.2 @}; // error: narrowing from double to int
2376 This flag can be useful for compiling valid C++98 code in C++11 mode.
2378 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2380 @opindex Wno-noexcept
2381 Warn when a noexcept-expression evaluates to false because of a call
2382 to a function that does not have a non-throwing exception
2383 specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2384 the compiler to never throw an exception.
2386 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2387 @opindex Wnon-virtual-dtor
2388 @opindex Wno-non-virtual-dtor
2389 Warn when a class has virtual functions and accessible non-virtual
2390 destructor, in which case it would be possible but unsafe to delete
2391 an instance of a derived class through a pointer to the base class.
2392 This warning is also enabled if -Weffc++ is specified.
2394 @item -Wreorder @r{(C++ and Objective-C++ only)}
2396 @opindex Wno-reorder
2397 @cindex reordering, warning
2398 @cindex warning for reordering of member initializers
2399 Warn when the order of member initializers given in the code does not
2400 match the order in which they must be executed. For instance:
2406 A(): j (0), i (1) @{ @}
2410 The compiler will rearrange the member initializers for @samp{i}
2411 and @samp{j} to match the declaration order of the members, emitting
2412 a warning to that effect. This warning is enabled by @option{-Wall}.
2415 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2418 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2421 Warn about violations of the following style guidelines from Scott Meyers'
2422 @cite{Effective C++} book:
2426 Item 11: Define a copy constructor and an assignment operator for classes
2427 with dynamically allocated memory.
2430 Item 12: Prefer initialization to assignment in constructors.
2433 Item 14: Make destructors virtual in base classes.
2436 Item 15: Have @code{operator=} return a reference to @code{*this}.
2439 Item 23: Don't try to return a reference when you must return an object.
2443 Also warn about violations of the following style guidelines from
2444 Scott Meyers' @cite{More Effective C++} book:
2448 Item 6: Distinguish between prefix and postfix forms of increment and
2449 decrement operators.
2452 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2456 When selecting this option, be aware that the standard library
2457 headers do not obey all of these guidelines; use @samp{grep -v}
2458 to filter out those warnings.
2460 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2461 @opindex Wstrict-null-sentinel
2462 @opindex Wno-strict-null-sentinel
2463 Warn also about the use of an uncasted @code{NULL} as sentinel. When
2464 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2465 to @code{__null}. Although it is a null pointer constant not a null pointer,
2466 it is guaranteed to be of the same size as a pointer. But this use is
2467 not portable across different compilers.
2469 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2470 @opindex Wno-non-template-friend
2471 @opindex Wnon-template-friend
2472 Disable warnings when non-templatized friend functions are declared
2473 within a template. Since the advent of explicit template specification
2474 support in G++, if the name of the friend is an unqualified-id (i.e.,
2475 @samp{friend foo(int)}), the C++ language specification demands that the
2476 friend declare or define an ordinary, nontemplate function. (Section
2477 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2478 could be interpreted as a particular specialization of a templatized
2479 function. Because this non-conforming behavior is no longer the default
2480 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2481 check existing code for potential trouble spots and is on by default.
2482 This new compiler behavior can be turned off with
2483 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2484 but disables the helpful warning.
2486 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2487 @opindex Wold-style-cast
2488 @opindex Wno-old-style-cast
2489 Warn if an old-style (C-style) cast to a non-void type is used within
2490 a C++ program. The new-style casts (@samp{dynamic_cast},
2491 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2492 less vulnerable to unintended effects and much easier to search for.
2494 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2495 @opindex Woverloaded-virtual
2496 @opindex Wno-overloaded-virtual
2497 @cindex overloaded virtual function, warning
2498 @cindex warning for overloaded virtual function
2499 Warn when a function declaration hides virtual functions from a
2500 base class. For example, in:
2507 struct B: public A @{
2512 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2520 will fail to compile.
2522 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2523 @opindex Wno-pmf-conversions
2524 @opindex Wpmf-conversions
2525 Disable the diagnostic for converting a bound pointer to member function
2528 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2529 @opindex Wsign-promo
2530 @opindex Wno-sign-promo
2531 Warn when overload resolution chooses a promotion from unsigned or
2532 enumerated type to a signed type, over a conversion to an unsigned type of
2533 the same size. Previous versions of G++ would try to preserve
2534 unsignedness, but the standard mandates the current behavior.
2539 A& operator = (int);
2549 In this example, G++ will synthesize a default @samp{A& operator =
2550 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2553 @node Objective-C and Objective-C++ Dialect Options
2554 @section Options Controlling Objective-C and Objective-C++ Dialects
2556 @cindex compiler options, Objective-C and Objective-C++
2557 @cindex Objective-C and Objective-C++ options, command line
2558 @cindex options, Objective-C and Objective-C++
2559 (NOTE: This manual does not describe the Objective-C and Objective-C++
2560 languages themselves. @xref{Standards,,Language Standards
2561 Supported by GCC}, for references.)
2563 This section describes the command-line options that are only meaningful
2564 for Objective-C and Objective-C++ programs, but you can also use most of
2565 the language-independent GNU compiler options.
2566 For example, you might compile a file @code{some_class.m} like this:
2569 gcc -g -fgnu-runtime -O -c some_class.m
2573 In this example, @option{-fgnu-runtime} is an option meant only for
2574 Objective-C and Objective-C++ programs; you can use the other options with
2575 any language supported by GCC@.
2577 Note that since Objective-C is an extension of the C language, Objective-C
2578 compilations may also use options specific to the C front-end (e.g.,
2579 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2580 C++-specific options (e.g., @option{-Wabi}).
2582 Here is a list of options that are @emph{only} for compiling Objective-C
2583 and Objective-C++ programs:
2586 @item -fconstant-string-class=@var{class-name}
2587 @opindex fconstant-string-class
2588 Use @var{class-name} as the name of the class to instantiate for each
2589 literal string specified with the syntax @code{@@"@dots{}"}. The default
2590 class name is @code{NXConstantString} if the GNU runtime is being used, and
2591 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2592 @option{-fconstant-cfstrings} option, if also present, will override the
2593 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2594 to be laid out as constant CoreFoundation strings.
2597 @opindex fgnu-runtime
2598 Generate object code compatible with the standard GNU Objective-C
2599 runtime. This is the default for most types of systems.
2601 @item -fnext-runtime
2602 @opindex fnext-runtime
2603 Generate output compatible with the NeXT runtime. This is the default
2604 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2605 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2608 @item -fno-nil-receivers
2609 @opindex fno-nil-receivers
2610 Assume that all Objective-C message dispatches (@code{[receiver
2611 message:arg]}) in this translation unit ensure that the receiver is
2612 not @code{nil}. This allows for more efficient entry points in the
2613 runtime to be used. This option is only available in conjunction with
2614 the NeXT runtime and ABI version 0 or 1.
2616 @item -fobjc-abi-version=@var{n}
2617 @opindex fobjc-abi-version
2618 Use version @var{n} of the Objective-C ABI for the selected runtime.
2619 This option is currently supported only for the NeXT runtime. In that
2620 case, Version 0 is the traditional (32-bit) ABI without support for
2621 properties and other Objective-C 2.0 additions. Version 1 is the
2622 traditional (32-bit) ABI with support for properties and other
2623 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2624 nothing is specified, the default is Version 0 on 32-bit target
2625 machines, and Version 2 on 64-bit target machines.
2627 @item -fobjc-call-cxx-cdtors
2628 @opindex fobjc-call-cxx-cdtors
2629 For each Objective-C class, check if any of its instance variables is a
2630 C++ object with a non-trivial default constructor. If so, synthesize a
2631 special @code{- (id) .cxx_construct} instance method that will run
2632 non-trivial default constructors on any such instance variables, in order,
2633 and then return @code{self}. Similarly, check if any instance variable
2634 is a C++ object with a non-trivial destructor, and if so, synthesize a
2635 special @code{- (void) .cxx_destruct} method that will run
2636 all such default destructors, in reverse order.
2638 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2639 methods thusly generated will only operate on instance variables
2640 declared in the current Objective-C class, and not those inherited
2641 from superclasses. It is the responsibility of the Objective-C
2642 runtime to invoke all such methods in an object's inheritance
2643 hierarchy. The @code{- (id) .cxx_construct} methods will be invoked
2644 by the runtime immediately after a new object instance is allocated;
2645 the @code{- (void) .cxx_destruct} methods will be invoked immediately
2646 before the runtime deallocates an object instance.
2648 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2649 support for invoking the @code{- (id) .cxx_construct} and
2650 @code{- (void) .cxx_destruct} methods.
2652 @item -fobjc-direct-dispatch
2653 @opindex fobjc-direct-dispatch
2654 Allow fast jumps to the message dispatcher. On Darwin this is
2655 accomplished via the comm page.
2657 @item -fobjc-exceptions
2658 @opindex fobjc-exceptions
2659 Enable syntactic support for structured exception handling in
2660 Objective-C, similar to what is offered by C++ and Java. This option
2661 is required to use the Objective-C keywords @code{@@try},
2662 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2663 @code{@@synchronized}. This option is available with both the GNU
2664 runtime and the NeXT runtime (but not available in conjunction with
2665 the NeXT runtime on Mac OS X 10.2 and earlier).
2669 Enable garbage collection (GC) in Objective-C and Objective-C++
2670 programs. This option is only available with the NeXT runtime; the
2671 GNU runtime has a different garbage collection implementation that
2672 does not require special compiler flags.
2674 @item -fobjc-nilcheck
2675 @opindex fobjc-nilcheck
2676 For the NeXT runtime with version 2 of the ABI, check for a nil
2677 receiver in method invocations before doing the actual method call.
2678 This is the default and can be disabled using
2679 @option{-fno-objc-nilcheck}. Class methods and super calls are never
2680 checked for nil in this way no matter what this flag is set to.
2681 Currently this flag does nothing when the GNU runtime, or an older
2682 version of the NeXT runtime ABI, is used.
2684 @item -fobjc-std=objc1
2686 Conform to the language syntax of Objective-C 1.0, the language
2687 recognized by GCC 4.0. This only affects the Objective-C additions to
2688 the C/C++ language; it does not affect conformance to C/C++ standards,
2689 which is controlled by the separate C/C++ dialect option flags. When
2690 this option is used with the Objective-C or Objective-C++ compiler,
2691 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2692 This is useful if you need to make sure that your Objective-C code can
2693 be compiled with older versions of GCC.
2695 @item -freplace-objc-classes
2696 @opindex freplace-objc-classes
2697 Emit a special marker instructing @command{ld(1)} not to statically link in
2698 the resulting object file, and allow @command{dyld(1)} to load it in at
2699 run time instead. This is used in conjunction with the Fix-and-Continue
2700 debugging mode, where the object file in question may be recompiled and
2701 dynamically reloaded in the course of program execution, without the need
2702 to restart the program itself. Currently, Fix-and-Continue functionality
2703 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2708 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2709 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2710 compile time) with static class references that get initialized at load time,
2711 which improves run-time performance. Specifying the @option{-fzero-link} flag
2712 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2713 to be retained. This is useful in Zero-Link debugging mode, since it allows
2714 for individual class implementations to be modified during program execution.
2715 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2716 regardless of command line options.
2720 Dump interface declarations for all classes seen in the source file to a
2721 file named @file{@var{sourcename}.decl}.
2723 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2724 @opindex Wassign-intercept
2725 @opindex Wno-assign-intercept
2726 Warn whenever an Objective-C assignment is being intercepted by the
2729 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2730 @opindex Wno-protocol
2732 If a class is declared to implement a protocol, a warning is issued for
2733 every method in the protocol that is not implemented by the class. The
2734 default behavior is to issue a warning for every method not explicitly
2735 implemented in the class, even if a method implementation is inherited
2736 from the superclass. If you use the @option{-Wno-protocol} option, then
2737 methods inherited from the superclass are considered to be implemented,
2738 and no warning is issued for them.
2740 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2742 @opindex Wno-selector
2743 Warn if multiple methods of different types for the same selector are
2744 found during compilation. The check is performed on the list of methods
2745 in the final stage of compilation. Additionally, a check is performed
2746 for each selector appearing in a @code{@@selector(@dots{})}
2747 expression, and a corresponding method for that selector has been found
2748 during compilation. Because these checks scan the method table only at
2749 the end of compilation, these warnings are not produced if the final
2750 stage of compilation is not reached, for example because an error is
2751 found during compilation, or because the @option{-fsyntax-only} option is
2754 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2755 @opindex Wstrict-selector-match
2756 @opindex Wno-strict-selector-match
2757 Warn if multiple methods with differing argument and/or return types are
2758 found for a given selector when attempting to send a message using this
2759 selector to a receiver of type @code{id} or @code{Class}. When this flag
2760 is off (which is the default behavior), the compiler will omit such warnings
2761 if any differences found are confined to types which share the same size
2764 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2765 @opindex Wundeclared-selector
2766 @opindex Wno-undeclared-selector
2767 Warn if a @code{@@selector(@dots{})} expression referring to an
2768 undeclared selector is found. A selector is considered undeclared if no
2769 method with that name has been declared before the
2770 @code{@@selector(@dots{})} expression, either explicitly in an
2771 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2772 an @code{@@implementation} section. This option always performs its
2773 checks as soon as a @code{@@selector(@dots{})} expression is found,
2774 while @option{-Wselector} only performs its checks in the final stage of
2775 compilation. This also enforces the coding style convention
2776 that methods and selectors must be declared before being used.
2778 @item -print-objc-runtime-info
2779 @opindex print-objc-runtime-info
2780 Generate C header describing the largest structure that is passed by
2785 @node Language Independent Options
2786 @section Options to Control Diagnostic Messages Formatting
2787 @cindex options to control diagnostics formatting
2788 @cindex diagnostic messages
2789 @cindex message formatting
2791 Traditionally, diagnostic messages have been formatted irrespective of
2792 the output device's aspect (e.g.@: its width, @dots{}). The options described
2793 below can be used to control the diagnostic messages formatting
2794 algorithm, e.g.@: how many characters per line, how often source location
2795 information should be reported. Right now, only the C++ front end can
2796 honor these options. However it is expected, in the near future, that
2797 the remaining front ends would be able to digest them correctly.
2800 @item -fmessage-length=@var{n}
2801 @opindex fmessage-length
2802 Try to format error messages so that they fit on lines of about @var{n}
2803 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2804 the front ends supported by GCC@. If @var{n} is zero, then no
2805 line-wrapping will be done; each error message will appear on a single
2808 @opindex fdiagnostics-show-location
2809 @item -fdiagnostics-show-location=once
2810 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2811 reporter to emit @emph{once} source location information; that is, in
2812 case the message is too long to fit on a single physical line and has to
2813 be wrapped, the source location won't be emitted (as prefix) again,
2814 over and over, in subsequent continuation lines. This is the default
2817 @item -fdiagnostics-show-location=every-line
2818 Only meaningful in line-wrapping mode. Instructs the diagnostic
2819 messages reporter to emit the same source location information (as
2820 prefix) for physical lines that result from the process of breaking
2821 a message which is too long to fit on a single line.
2823 @item -fno-diagnostics-show-option
2824 @opindex fno-diagnostics-show-option
2825 @opindex fdiagnostics-show-option
2826 By default, each diagnostic emitted includes text which indicates the
2827 command line option that directly controls the diagnostic (if such an
2828 option is known to the diagnostic machinery). Specifying the
2829 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
2831 @item -Wcoverage-mismatch
2832 @opindex Wcoverage-mismatch
2833 Warn if feedback profiles do not match when using the
2834 @option{-fprofile-use} option.
2835 If a source file was changed between @option{-fprofile-gen} and
2836 @option{-fprofile-use}, the files with the profile feedback can fail
2837 to match the source file and GCC can not use the profile feedback
2838 information. By default, this warning is enabled and is treated as an
2839 error. @option{-Wno-coverage-mismatch} can be used to disable the
2840 warning or @option{-Wno-error=coverage-mismatch} can be used to
2841 disable the error. Disable the error for this warning can result in
2842 poorly optimized code, so disabling the error is useful only in the
2843 case of very minor changes such as bug fixes to an existing code-base.
2844 Completely disabling the warning is not recommended.
2848 @node Warning Options
2849 @section Options to Request or Suppress Warnings
2850 @cindex options to control warnings
2851 @cindex warning messages
2852 @cindex messages, warning
2853 @cindex suppressing warnings
2855 Warnings are diagnostic messages that report constructions which
2856 are not inherently erroneous but which are risky or suggest there
2857 may have been an error.
2859 The following language-independent options do not enable specific
2860 warnings but control the kinds of diagnostics produced by GCC.
2863 @cindex syntax checking
2865 @opindex fsyntax-only
2866 Check the code for syntax errors, but don't do anything beyond that.
2868 @item -fmax-errors=@var{n}
2869 @opindex fmax-errors
2870 Limits the maximum number of error messages to @var{n}, at which point
2871 GCC bails out rather than attempting to continue processing the source
2872 code. If @var{n} is 0 (the default), there is no limit on the number
2873 of error messages produced. If @option{-Wfatal-errors} is also
2874 specified, then @option{-Wfatal-errors} takes precedence over this
2879 Inhibit all warning messages.
2884 Make all warnings into errors.
2889 Make the specified warning into an error. The specifier for a warning
2890 is appended, for example @option{-Werror=switch} turns the warnings
2891 controlled by @option{-Wswitch} into errors. This switch takes a
2892 negative form, to be used to negate @option{-Werror} for specific
2893 warnings, for example @option{-Wno-error=switch} makes
2894 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
2897 The warning message for each controllable warning includes the
2898 option which controls the warning. That option can then be used with
2899 @option{-Werror=} and @option{-Wno-error=} as described above.
2900 (Printing of the option in the warning message can be disabled using the
2901 @option{-fno-diagnostics-show-option} flag.)
2903 Note that specifying @option{-Werror=}@var{foo} automatically implies
2904 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
2907 @item -Wfatal-errors
2908 @opindex Wfatal-errors
2909 @opindex Wno-fatal-errors
2910 This option causes the compiler to abort compilation on the first error
2911 occurred rather than trying to keep going and printing further error
2916 You can request many specific warnings with options beginning
2917 @samp{-W}, for example @option{-Wimplicit} to request warnings on
2918 implicit declarations. Each of these specific warning options also
2919 has a negative form beginning @samp{-Wno-} to turn off warnings; for
2920 example, @option{-Wno-implicit}. This manual lists only one of the
2921 two forms, whichever is not the default. For further,
2922 language-specific options also refer to @ref{C++ Dialect Options} and
2923 @ref{Objective-C and Objective-C++ Dialect Options}.
2925 When an unrecognized warning option is requested (e.g.,
2926 @option{-Wunknown-warning}), GCC will emit a diagnostic stating
2927 that the option is not recognized. However, if the @option{-Wno-} form
2928 is used, the behavior is slightly different: No diagnostic will be
2929 produced for @option{-Wno-unknown-warning} unless other diagnostics
2930 are being produced. This allows the use of new @option{-Wno-} options
2931 with old compilers, but if something goes wrong, the compiler will
2932 warn that an unrecognized option was used.
2937 Issue all the warnings demanded by strict ISO C and ISO C++;
2938 reject all programs that use forbidden extensions, and some other
2939 programs that do not follow ISO C and ISO C++. For ISO C, follows the
2940 version of the ISO C standard specified by any @option{-std} option used.
2942 Valid ISO C and ISO C++ programs should compile properly with or without
2943 this option (though a rare few will require @option{-ansi} or a
2944 @option{-std} option specifying the required version of ISO C)@. However,
2945 without this option, certain GNU extensions and traditional C and C++
2946 features are supported as well. With this option, they are rejected.
2948 @option{-pedantic} does not cause warning messages for use of the
2949 alternate keywords whose names begin and end with @samp{__}. Pedantic
2950 warnings are also disabled in the expression that follows
2951 @code{__extension__}. However, only system header files should use
2952 these escape routes; application programs should avoid them.
2953 @xref{Alternate Keywords}.
2955 Some users try to use @option{-pedantic} to check programs for strict ISO
2956 C conformance. They soon find that it does not do quite what they want:
2957 it finds some non-ISO practices, but not all---only those for which
2958 ISO C @emph{requires} a diagnostic, and some others for which
2959 diagnostics have been added.
2961 A feature to report any failure to conform to ISO C might be useful in
2962 some instances, but would require considerable additional work and would
2963 be quite different from @option{-pedantic}. We don't have plans to
2964 support such a feature in the near future.
2966 Where the standard specified with @option{-std} represents a GNU
2967 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
2968 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2969 extended dialect is based. Warnings from @option{-pedantic} are given
2970 where they are required by the base standard. (It would not make sense
2971 for such warnings to be given only for features not in the specified GNU
2972 C dialect, since by definition the GNU dialects of C include all
2973 features the compiler supports with the given option, and there would be
2974 nothing to warn about.)
2976 @item -pedantic-errors
2977 @opindex pedantic-errors
2978 Like @option{-pedantic}, except that errors are produced rather than
2984 This enables all the warnings about constructions that some users
2985 consider questionable, and that are easy to avoid (or modify to
2986 prevent the warning), even in conjunction with macros. This also
2987 enables some language-specific warnings described in @ref{C++ Dialect
2988 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2990 @option{-Wall} turns on the following warning flags:
2992 @gccoptlist{-Waddress @gol
2993 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
2995 -Wchar-subscripts @gol
2996 -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
2997 -Wimplicit-int @r{(C and Objective-C only)} @gol
2998 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3001 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3002 -Wmaybe-uninitialized @gol
3003 -Wmissing-braces @gol
3009 -Wsequence-point @gol
3010 -Wsign-compare @r{(only in C++)} @gol
3011 -Wstrict-aliasing @gol
3012 -Wstrict-overflow=1 @gol
3015 -Wuninitialized @gol
3016 -Wunknown-pragmas @gol
3017 -Wunused-function @gol
3020 -Wunused-variable @gol
3021 -Wvolatile-register-var @gol
3024 Note that some warning flags are not implied by @option{-Wall}. Some of
3025 them warn about constructions that users generally do not consider
3026 questionable, but which occasionally you might wish to check for;
3027 others warn about constructions that are necessary or hard to avoid in
3028 some cases, and there is no simple way to modify the code to suppress
3029 the warning. Some of them are enabled by @option{-Wextra} but many of
3030 them must be enabled individually.
3036 This enables some extra warning flags that are not enabled by
3037 @option{-Wall}. (This option used to be called @option{-W}. The older
3038 name is still supported, but the newer name is more descriptive.)
3040 @gccoptlist{-Wclobbered @gol
3042 -Wignored-qualifiers @gol
3043 -Wmissing-field-initializers @gol
3044 -Wmissing-parameter-type @r{(C only)} @gol
3045 -Wold-style-declaration @r{(C only)} @gol
3046 -Woverride-init @gol
3049 -Wuninitialized @gol
3050 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3051 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3054 The option @option{-Wextra} also prints warning messages for the
3060 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3061 @samp{>}, or @samp{>=}.
3064 (C++ only) An enumerator and a non-enumerator both appear in a
3065 conditional expression.
3068 (C++ only) Ambiguous virtual bases.
3071 (C++ only) Subscripting an array which has been declared @samp{register}.
3074 (C++ only) Taking the address of a variable which has been declared
3078 (C++ only) A base class is not initialized in a derived class' copy
3083 @item -Wchar-subscripts
3084 @opindex Wchar-subscripts
3085 @opindex Wno-char-subscripts
3086 Warn if an array subscript has type @code{char}. This is a common cause
3087 of error, as programmers often forget that this type is signed on some
3089 This warning is enabled by @option{-Wall}.
3093 @opindex Wno-comment
3094 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3095 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3096 This warning is enabled by @option{-Wall}.
3099 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3101 Suppress warning messages emitted by @code{#warning} directives.
3103 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3104 @opindex Wdouble-promotion
3105 @opindex Wno-double-promotion
3106 Give a warning when a value of type @code{float} is implicitly
3107 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3108 floating-point unit implement @code{float} in hardware, but emulate
3109 @code{double} in software. On such a machine, doing computations
3110 using @code{double} values is much more expensive because of the
3111 overhead required for software emulation.
3113 It is easy to accidentally do computations with @code{double} because
3114 floating-point literals are implicitly of type @code{double}. For
3118 float area(float radius)
3120 return 3.14159 * radius * radius;
3124 the compiler will perform the entire computation with @code{double}
3125 because the floating-point literal is a @code{double}.
3130 @opindex ffreestanding
3131 @opindex fno-builtin
3132 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3133 the arguments supplied have types appropriate to the format string
3134 specified, and that the conversions specified in the format string make
3135 sense. This includes standard functions, and others specified by format
3136 attributes (@pxref{Function Attributes}), in the @code{printf},
3137 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3138 not in the C standard) families (or other target-specific families).
3139 Which functions are checked without format attributes having been
3140 specified depends on the standard version selected, and such checks of
3141 functions without the attribute specified are disabled by
3142 @option{-ffreestanding} or @option{-fno-builtin}.
3144 The formats are checked against the format features supported by GNU
3145 libc version 2.2. These include all ISO C90 and C99 features, as well
3146 as features from the Single Unix Specification and some BSD and GNU
3147 extensions. Other library implementations may not support all these
3148 features; GCC does not support warning about features that go beyond a
3149 particular library's limitations. However, if @option{-pedantic} is used
3150 with @option{-Wformat}, warnings will be given about format features not
3151 in the selected standard version (but not for @code{strfmon} formats,
3152 since those are not in any version of the C standard). @xref{C Dialect
3153 Options,,Options Controlling C Dialect}.
3155 Since @option{-Wformat} also checks for null format arguments for
3156 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
3158 @option{-Wformat} is included in @option{-Wall}. For more control over some
3159 aspects of format checking, the options @option{-Wformat-y2k},
3160 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
3161 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
3162 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
3165 @opindex Wformat-y2k
3166 @opindex Wno-format-y2k
3167 If @option{-Wformat} is specified, also warn about @code{strftime}
3168 formats which may yield only a two-digit year.
3170 @item -Wno-format-contains-nul
3171 @opindex Wno-format-contains-nul
3172 @opindex Wformat-contains-nul
3173 If @option{-Wformat} is specified, do not warn about format strings that
3176 @item -Wno-format-extra-args
3177 @opindex Wno-format-extra-args
3178 @opindex Wformat-extra-args
3179 If @option{-Wformat} is specified, do not warn about excess arguments to a
3180 @code{printf} or @code{scanf} format function. The C standard specifies
3181 that such arguments are ignored.
3183 Where the unused arguments lie between used arguments that are
3184 specified with @samp{$} operand number specifications, normally
3185 warnings are still given, since the implementation could not know what
3186 type to pass to @code{va_arg} to skip the unused arguments. However,
3187 in the case of @code{scanf} formats, this option will suppress the
3188 warning if the unused arguments are all pointers, since the Single
3189 Unix Specification says that such unused arguments are allowed.
3191 @item -Wno-format-zero-length
3192 @opindex Wno-format-zero-length
3193 @opindex Wformat-zero-length
3194 If @option{-Wformat} is specified, do not warn about zero-length formats.
3195 The C standard specifies that zero-length formats are allowed.
3197 @item -Wformat-nonliteral
3198 @opindex Wformat-nonliteral
3199 @opindex Wno-format-nonliteral
3200 If @option{-Wformat} is specified, also warn if the format string is not a
3201 string literal and so cannot be checked, unless the format function
3202 takes its format arguments as a @code{va_list}.
3204 @item -Wformat-security
3205 @opindex Wformat-security
3206 @opindex Wno-format-security
3207 If @option{-Wformat} is specified, also warn about uses of format
3208 functions that represent possible security problems. At present, this
3209 warns about calls to @code{printf} and @code{scanf} functions where the
3210 format string is not a string literal and there are no format arguments,
3211 as in @code{printf (foo);}. This may be a security hole if the format
3212 string came from untrusted input and contains @samp{%n}. (This is
3213 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3214 in future warnings may be added to @option{-Wformat-security} that are not
3215 included in @option{-Wformat-nonliteral}.)
3219 @opindex Wno-format=2
3220 Enable @option{-Wformat} plus format checks not included in
3221 @option{-Wformat}. Currently equivalent to @samp{-Wformat
3222 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
3226 @opindex Wno-nonnull
3227 Warn about passing a null pointer for arguments marked as
3228 requiring a non-null value by the @code{nonnull} function attribute.
3230 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3231 can be disabled with the @option{-Wno-nonnull} option.
3233 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3235 @opindex Wno-init-self
3236 Warn about uninitialized variables which are initialized with themselves.
3237 Note this option can only be used with the @option{-Wuninitialized} option.
3239 For example, GCC will warn about @code{i} being uninitialized in the
3240 following snippet only when @option{-Winit-self} has been specified:
3251 @item -Wimplicit-int @r{(C and Objective-C only)}
3252 @opindex Wimplicit-int
3253 @opindex Wno-implicit-int
3254 Warn when a declaration does not specify a type.
3255 This warning is enabled by @option{-Wall}.
3257 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3258 @opindex Wimplicit-function-declaration
3259 @opindex Wno-implicit-function-declaration
3260 Give a warning whenever a function is used before being declared. In
3261 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3262 enabled by default and it is made into an error by
3263 @option{-pedantic-errors}. This warning is also enabled by
3266 @item -Wimplicit @r{(C and Objective-C only)}
3268 @opindex Wno-implicit
3269 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3270 This warning is enabled by @option{-Wall}.
3272 @item -Wignored-qualifiers @r{(C and C++ only)}
3273 @opindex Wignored-qualifiers
3274 @opindex Wno-ignored-qualifiers
3275 Warn if the return type of a function has a type qualifier
3276 such as @code{const}. For ISO C such a type qualifier has no effect,
3277 since the value returned by a function is not an lvalue.
3278 For C++, the warning is only emitted for scalar types or @code{void}.
3279 ISO C prohibits qualified @code{void} return types on function
3280 definitions, so such return types always receive a warning
3281 even without this option.
3283 This warning is also enabled by @option{-Wextra}.
3288 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3289 a function with external linkage, returning int, taking either zero
3290 arguments, two, or three arguments of appropriate types. This warning
3291 is enabled by default in C++ and is enabled by either @option{-Wall}
3292 or @option{-pedantic}.
3294 @item -Wmissing-braces
3295 @opindex Wmissing-braces
3296 @opindex Wno-missing-braces
3297 Warn if an aggregate or union initializer is not fully bracketed. In
3298 the following example, the initializer for @samp{a} is not fully
3299 bracketed, but that for @samp{b} is fully bracketed.
3302 int a[2][2] = @{ 0, 1, 2, 3 @};
3303 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3306 This warning is enabled by @option{-Wall}.
3308 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3309 @opindex Wmissing-include-dirs
3310 @opindex Wno-missing-include-dirs
3311 Warn if a user-supplied include directory does not exist.
3314 @opindex Wparentheses
3315 @opindex Wno-parentheses
3316 Warn if parentheses are omitted in certain contexts, such
3317 as when there is an assignment in a context where a truth value
3318 is expected, or when operators are nested whose precedence people
3319 often get confused about.
3321 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3322 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3323 interpretation from that of ordinary mathematical notation.
3325 Also warn about constructions where there may be confusion to which
3326 @code{if} statement an @code{else} branch belongs. Here is an example of
3341 In C/C++, every @code{else} branch belongs to the innermost possible
3342 @code{if} statement, which in this example is @code{if (b)}. This is
3343 often not what the programmer expected, as illustrated in the above
3344 example by indentation the programmer chose. When there is the
3345 potential for this confusion, GCC will issue a warning when this flag
3346 is specified. To eliminate the warning, add explicit braces around
3347 the innermost @code{if} statement so there is no way the @code{else}
3348 could belong to the enclosing @code{if}. The resulting code would
3365 Also warn for dangerous uses of the
3366 ?: with omitted middle operand GNU extension. When the condition
3367 in the ?: operator is a boolean expression the omitted value will
3368 be always 1. Often the user expects it to be a value computed
3369 inside the conditional expression instead.
3371 This warning is enabled by @option{-Wall}.
3373 @item -Wsequence-point
3374 @opindex Wsequence-point
3375 @opindex Wno-sequence-point
3376 Warn about code that may have undefined semantics because of violations
3377 of sequence point rules in the C and C++ standards.
3379 The C and C++ standards defines the order in which expressions in a C/C++
3380 program are evaluated in terms of @dfn{sequence points}, which represent
3381 a partial ordering between the execution of parts of the program: those
3382 executed before the sequence point, and those executed after it. These
3383 occur after the evaluation of a full expression (one which is not part
3384 of a larger expression), after the evaluation of the first operand of a
3385 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3386 function is called (but after the evaluation of its arguments and the
3387 expression denoting the called function), and in certain other places.
3388 Other than as expressed by the sequence point rules, the order of
3389 evaluation of subexpressions of an expression is not specified. All
3390 these rules describe only a partial order rather than a total order,
3391 since, for example, if two functions are called within one expression
3392 with no sequence point between them, the order in which the functions
3393 are called is not specified. However, the standards committee have
3394 ruled that function calls do not overlap.
3396 It is not specified when between sequence points modifications to the
3397 values of objects take effect. Programs whose behavior depends on this
3398 have undefined behavior; the C and C++ standards specify that ``Between
3399 the previous and next sequence point an object shall have its stored
3400 value modified at most once by the evaluation of an expression.
3401 Furthermore, the prior value shall be read only to determine the value
3402 to be stored.''. If a program breaks these rules, the results on any
3403 particular implementation are entirely unpredictable.
3405 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3406 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3407 diagnosed by this option, and it may give an occasional false positive
3408 result, but in general it has been found fairly effective at detecting
3409 this sort of problem in programs.
3411 The standard is worded confusingly, therefore there is some debate
3412 over the precise meaning of the sequence point rules in subtle cases.
3413 Links to discussions of the problem, including proposed formal
3414 definitions, may be found on the GCC readings page, at
3415 @uref{http://gcc.gnu.org/@/readings.html}.
3417 This warning is enabled by @option{-Wall} for C and C++.
3420 @opindex Wreturn-type
3421 @opindex Wno-return-type
3422 Warn whenever a function is defined with a return-type that defaults
3423 to @code{int}. Also warn about any @code{return} statement with no
3424 return-value in a function whose return-type is not @code{void}
3425 (falling off the end of the function body is considered returning
3426 without a value), and about a @code{return} statement with an
3427 expression in a function whose return-type is @code{void}.
3429 For C++, a function without return type always produces a diagnostic
3430 message, even when @option{-Wno-return-type} is specified. The only
3431 exceptions are @samp{main} and functions defined in system headers.
3433 This warning is enabled by @option{-Wall}.
3438 Warn whenever a @code{switch} statement has an index of enumerated type
3439 and lacks a @code{case} for one or more of the named codes of that
3440 enumeration. (The presence of a @code{default} label prevents this
3441 warning.) @code{case} labels outside the enumeration range also
3442 provoke warnings when this option is used (even if there is a
3443 @code{default} label).
3444 This warning is enabled by @option{-Wall}.
3446 @item -Wswitch-default
3447 @opindex Wswitch-default
3448 @opindex Wno-switch-default
3449 Warn whenever a @code{switch} statement does not have a @code{default}
3453 @opindex Wswitch-enum
3454 @opindex Wno-switch-enum
3455 Warn whenever a @code{switch} statement has an index of enumerated type
3456 and lacks a @code{case} for one or more of the named codes of that
3457 enumeration. @code{case} labels outside the enumeration range also
3458 provoke warnings when this option is used. The only difference
3459 between @option{-Wswitch} and this option is that this option gives a
3460 warning about an omitted enumeration code even if there is a
3461 @code{default} label.
3463 @item -Wsync-nand @r{(C and C++ only)}
3465 @opindex Wno-sync-nand
3466 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3467 built-in functions are used. These functions changed semantics in GCC 4.4.
3471 @opindex Wno-trigraphs
3472 Warn if any trigraphs are encountered that might change the meaning of
3473 the program (trigraphs within comments are not warned about).
3474 This warning is enabled by @option{-Wall}.
3476 @item -Wunused-but-set-parameter
3477 @opindex Wunused-but-set-parameter
3478 @opindex Wno-unused-but-set-parameter
3479 Warn whenever a function parameter is assigned to, but otherwise unused
3480 (aside from its declaration).
3482 To suppress this warning use the @samp{unused} attribute
3483 (@pxref{Variable Attributes}).
3485 This warning is also enabled by @option{-Wunused} together with
3488 @item -Wunused-but-set-variable
3489 @opindex Wunused-but-set-variable
3490 @opindex Wno-unused-but-set-variable
3491 Warn whenever a local variable is assigned to, but otherwise unused
3492 (aside from its declaration).
3493 This warning is enabled by @option{-Wall}.
3495 To suppress this warning use the @samp{unused} attribute
3496 (@pxref{Variable Attributes}).
3498 This warning is also enabled by @option{-Wunused}, which is enabled
3501 @item -Wunused-function
3502 @opindex Wunused-function
3503 @opindex Wno-unused-function
3504 Warn whenever a static function is declared but not defined or a
3505 non-inline static function is unused.
3506 This warning is enabled by @option{-Wall}.
3508 @item -Wunused-label
3509 @opindex Wunused-label
3510 @opindex Wno-unused-label
3511 Warn whenever a label is declared but not used.
3512 This warning is enabled by @option{-Wall}.
3514 To suppress this warning use the @samp{unused} attribute
3515 (@pxref{Variable Attributes}).
3517 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
3518 @opindex Wunused-local-typedefs
3519 Warn when a typedef locally defined in a function is not used.
3521 @item -Wunused-parameter
3522 @opindex Wunused-parameter
3523 @opindex Wno-unused-parameter
3524 Warn whenever a function parameter is unused aside from its declaration.
3526 To suppress this warning use the @samp{unused} attribute
3527 (@pxref{Variable Attributes}).
3529 @item -Wno-unused-result
3530 @opindex Wunused-result
3531 @opindex Wno-unused-result
3532 Do not warn if a caller of a function marked with attribute
3533 @code{warn_unused_result} (@pxref{Variable Attributes}) does not use
3534 its return value. The default is @option{-Wunused-result}.
3536 @item -Wunused-variable
3537 @opindex Wunused-variable
3538 @opindex Wno-unused-variable
3539 Warn whenever a local variable or non-constant static variable is unused
3540 aside from its declaration.
3541 This warning is enabled by @option{-Wall}.
3543 To suppress this warning use the @samp{unused} attribute
3544 (@pxref{Variable Attributes}).
3546 @item -Wunused-value
3547 @opindex Wunused-value
3548 @opindex Wno-unused-value
3549 Warn whenever a statement computes a result that is explicitly not
3550 used. To suppress this warning cast the unused expression to
3551 @samp{void}. This includes an expression-statement or the left-hand
3552 side of a comma expression that contains no side effects. For example,
3553 an expression such as @samp{x[i,j]} will cause a warning, while
3554 @samp{x[(void)i,j]} will not.
3556 This warning is enabled by @option{-Wall}.
3561 All the above @option{-Wunused} options combined.
3563 In order to get a warning about an unused function parameter, you must
3564 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3565 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3567 @item -Wuninitialized
3568 @opindex Wuninitialized
3569 @opindex Wno-uninitialized
3570 Warn if an automatic variable is used without first being initialized
3571 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3572 warn if a non-static reference or non-static @samp{const} member
3573 appears in a class without constructors.
3575 If you want to warn about code which uses the uninitialized value of the
3576 variable in its own initializer, use the @option{-Winit-self} option.
3578 These warnings occur for individual uninitialized or clobbered
3579 elements of structure, union or array variables as well as for
3580 variables which are uninitialized or clobbered as a whole. They do
3581 not occur for variables or elements declared @code{volatile}. Because
3582 these warnings depend on optimization, the exact variables or elements
3583 for which there are warnings will depend on the precise optimization
3584 options and version of GCC used.
3586 Note that there may be no warning about a variable that is used only
3587 to compute a value that itself is never used, because such
3588 computations may be deleted by data flow analysis before the warnings
3591 @item -Wmaybe-uninitialized
3592 @opindex Wmaybe-uninitialized
3593 @opindex Wno-maybe-uninitialized
3594 For an automatic variable, if there exists a path from the function
3595 entry to a use of the variable that is initialized, but there exist
3596 some other paths the variable is not initialized, the compiler will
3597 emit a warning if it can not prove the uninitialized paths do not
3598 happen at runtime. These warnings are made optional because GCC is
3599 not smart enough to see all the reasons why the code might be correct
3600 despite appearing to have an error. Here is one example of how
3621 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3622 always initialized, but GCC doesn't know this. To suppress the
3623 warning, the user needs to provide a default case with assert(0) or
3626 @cindex @code{longjmp} warnings
3627 This option also warns when a non-volatile automatic variable might be
3628 changed by a call to @code{longjmp}. These warnings as well are possible
3629 only in optimizing compilation.
3631 The compiler sees only the calls to @code{setjmp}. It cannot know
3632 where @code{longjmp} will be called; in fact, a signal handler could
3633 call it at any point in the code. As a result, you may get a warning
3634 even when there is in fact no problem because @code{longjmp} cannot
3635 in fact be called at the place which would cause a problem.
3637 Some spurious warnings can be avoided if you declare all the functions
3638 you use that never return as @code{noreturn}. @xref{Function
3641 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3643 @item -Wunknown-pragmas
3644 @opindex Wunknown-pragmas
3645 @opindex Wno-unknown-pragmas
3646 @cindex warning for unknown pragmas
3647 @cindex unknown pragmas, warning
3648 @cindex pragmas, warning of unknown
3649 Warn when a #pragma directive is encountered which is not understood by
3650 GCC@. If this command line option is used, warnings will even be issued
3651 for unknown pragmas in system header files. This is not the case if
3652 the warnings were only enabled by the @option{-Wall} command line option.
3655 @opindex Wno-pragmas
3657 Do not warn about misuses of pragmas, such as incorrect parameters,
3658 invalid syntax, or conflicts between pragmas. See also
3659 @samp{-Wunknown-pragmas}.
3661 @item -Wstrict-aliasing
3662 @opindex Wstrict-aliasing
3663 @opindex Wno-strict-aliasing
3664 This option is only active when @option{-fstrict-aliasing} is active.
3665 It warns about code which might break the strict aliasing rules that the
3666 compiler is using for optimization. The warning does not catch all
3667 cases, but does attempt to catch the more common pitfalls. It is
3668 included in @option{-Wall}.
3669 It is equivalent to @option{-Wstrict-aliasing=3}
3671 @item -Wstrict-aliasing=n
3672 @opindex Wstrict-aliasing=n
3673 @opindex Wno-strict-aliasing=n
3674 This option is only active when @option{-fstrict-aliasing} is active.
3675 It warns about code which might break the strict aliasing rules that the
3676 compiler is using for optimization.
3677 Higher levels correspond to higher accuracy (fewer false positives).
3678 Higher levels also correspond to more effort, similar to the way -O works.
3679 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3682 Level 1: Most aggressive, quick, least accurate.
3683 Possibly useful when higher levels
3684 do not warn but -fstrict-aliasing still breaks the code, as it has very few
3685 false negatives. However, it has many false positives.
3686 Warns for all pointer conversions between possibly incompatible types,
3687 even if never dereferenced. Runs in the frontend only.
3689 Level 2: Aggressive, quick, not too precise.
3690 May still have many false positives (not as many as level 1 though),
3691 and few false negatives (but possibly more than level 1).
3692 Unlike level 1, it only warns when an address is taken. Warns about
3693 incomplete types. Runs in the frontend only.
3695 Level 3 (default for @option{-Wstrict-aliasing}):
3696 Should have very few false positives and few false
3697 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
3698 Takes care of the common pun+dereference pattern in the frontend:
3699 @code{*(int*)&some_float}.
3700 If optimization is enabled, it also runs in the backend, where it deals
3701 with multiple statement cases using flow-sensitive points-to information.
3702 Only warns when the converted pointer is dereferenced.
3703 Does not warn about incomplete types.
3705 @item -Wstrict-overflow
3706 @itemx -Wstrict-overflow=@var{n}
3707 @opindex Wstrict-overflow
3708 @opindex Wno-strict-overflow
3709 This option is only active when @option{-fstrict-overflow} is active.
3710 It warns about cases where the compiler optimizes based on the
3711 assumption that signed overflow does not occur. Note that it does not
3712 warn about all cases where the code might overflow: it only warns
3713 about cases where the compiler implements some optimization. Thus
3714 this warning depends on the optimization level.
3716 An optimization which assumes that signed overflow does not occur is
3717 perfectly safe if the values of the variables involved are such that
3718 overflow never does, in fact, occur. Therefore this warning can
3719 easily give a false positive: a warning about code which is not
3720 actually a problem. To help focus on important issues, several
3721 warning levels are defined. No warnings are issued for the use of
3722 undefined signed overflow when estimating how many iterations a loop
3723 will require, in particular when determining whether a loop will be
3727 @item -Wstrict-overflow=1
3728 Warn about cases which are both questionable and easy to avoid. For
3729 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3730 compiler will simplify this to @code{1}. This level of
3731 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3732 are not, and must be explicitly requested.
3734 @item -Wstrict-overflow=2
3735 Also warn about other cases where a comparison is simplified to a
3736 constant. For example: @code{abs (x) >= 0}. This can only be
3737 simplified when @option{-fstrict-overflow} is in effect, because
3738 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3739 zero. @option{-Wstrict-overflow} (with no level) is the same as
3740 @option{-Wstrict-overflow=2}.
3742 @item -Wstrict-overflow=3
3743 Also warn about other cases where a comparison is simplified. For
3744 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3746 @item -Wstrict-overflow=4
3747 Also warn about other simplifications not covered by the above cases.
3748 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3750 @item -Wstrict-overflow=5
3751 Also warn about cases where the compiler reduces the magnitude of a
3752 constant involved in a comparison. For example: @code{x + 2 > y} will
3753 be simplified to @code{x + 1 >= y}. This is reported only at the
3754 highest warning level because this simplification applies to many
3755 comparisons, so this warning level will give a very large number of
3759 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]}
3760 @opindex Wsuggest-attribute=
3761 @opindex Wno-suggest-attribute=
3762 Warn for cases where adding an attribute may be beneficial. The
3763 attributes currently supported are listed below.
3766 @item -Wsuggest-attribute=pure
3767 @itemx -Wsuggest-attribute=const
3768 @itemx -Wsuggest-attribute=noreturn
3769 @opindex Wsuggest-attribute=pure
3770 @opindex Wno-suggest-attribute=pure
3771 @opindex Wsuggest-attribute=const
3772 @opindex Wno-suggest-attribute=const
3773 @opindex Wsuggest-attribute=noreturn
3774 @opindex Wno-suggest-attribute=noreturn
3776 Warn about functions which might be candidates for attributes
3777 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
3778 functions visible in other compilation units or (in the case of @code{pure} and
3779 @code{const}) if it cannot prove that the function returns normally. A function
3780 returns normally if it doesn't contain an infinite loop nor returns abnormally
3781 by throwing, calling @code{abort()} or trapping. This analysis requires option
3782 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
3783 higher. Higher optimization levels improve the accuracy of the analysis.
3786 @item -Warray-bounds
3787 @opindex Wno-array-bounds
3788 @opindex Warray-bounds
3789 This option is only active when @option{-ftree-vrp} is active
3790 (default for @option{-O2} and above). It warns about subscripts to arrays
3791 that are always out of bounds. This warning is enabled by @option{-Wall}.
3793 @item -Wno-div-by-zero
3794 @opindex Wno-div-by-zero
3795 @opindex Wdiv-by-zero
3796 Do not warn about compile-time integer division by zero. Floating point
3797 division by zero is not warned about, as it can be a legitimate way of
3798 obtaining infinities and NaNs.
3800 @item -Wsystem-headers
3801 @opindex Wsystem-headers
3802 @opindex Wno-system-headers
3803 @cindex warnings from system headers
3804 @cindex system headers, warnings from
3805 Print warning messages for constructs found in system header files.
3806 Warnings from system headers are normally suppressed, on the assumption
3807 that they usually do not indicate real problems and would only make the
3808 compiler output harder to read. Using this command line option tells
3809 GCC to emit warnings from system headers as if they occurred in user
3810 code. However, note that using @option{-Wall} in conjunction with this
3811 option will @emph{not} warn about unknown pragmas in system
3812 headers---for that, @option{-Wunknown-pragmas} must also be used.
3815 @opindex Wtrampolines
3816 @opindex Wno-trampolines
3817 Warn about trampolines generated for pointers to nested functions.
3819 A trampoline is a small piece of data or code that is created at run
3820 time on the stack when the address of a nested function is taken, and
3821 is used to call the nested function indirectly. For some targets, it
3822 is made up of data only and thus requires no special treatment. But,
3823 for most targets, it is made up of code and thus requires the stack
3824 to be made executable in order for the program to work properly.
3827 @opindex Wfloat-equal
3828 @opindex Wno-float-equal
3829 Warn if floating point values are used in equality comparisons.
3831 The idea behind this is that sometimes it is convenient (for the
3832 programmer) to consider floating-point values as approximations to
3833 infinitely precise real numbers. If you are doing this, then you need
3834 to compute (by analyzing the code, or in some other way) the maximum or
3835 likely maximum error that the computation introduces, and allow for it
3836 when performing comparisons (and when producing output, but that's a
3837 different problem). In particular, instead of testing for equality, you
3838 would check to see whether the two values have ranges that overlap; and
3839 this is done with the relational operators, so equality comparisons are
3842 @item -Wtraditional @r{(C and Objective-C only)}
3843 @opindex Wtraditional
3844 @opindex Wno-traditional
3845 Warn about certain constructs that behave differently in traditional and
3846 ISO C@. Also warn about ISO C constructs that have no traditional C
3847 equivalent, and/or problematic constructs which should be avoided.
3851 Macro parameters that appear within string literals in the macro body.
3852 In traditional C macro replacement takes place within string literals,
3853 but does not in ISO C@.
3856 In traditional C, some preprocessor directives did not exist.
3857 Traditional preprocessors would only consider a line to be a directive
3858 if the @samp{#} appeared in column 1 on the line. Therefore
3859 @option{-Wtraditional} warns about directives that traditional C
3860 understands but would ignore because the @samp{#} does not appear as the
3861 first character on the line. It also suggests you hide directives like
3862 @samp{#pragma} not understood by traditional C by indenting them. Some
3863 traditional implementations would not recognize @samp{#elif}, so it
3864 suggests avoiding it altogether.
3867 A function-like macro that appears without arguments.
3870 The unary plus operator.
3873 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3874 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
3875 constants.) Note, these suffixes appear in macros defined in the system
3876 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3877 Use of these macros in user code might normally lead to spurious
3878 warnings, however GCC's integrated preprocessor has enough context to
3879 avoid warning in these cases.
3882 A function declared external in one block and then used after the end of
3886 A @code{switch} statement has an operand of type @code{long}.
3889 A non-@code{static} function declaration follows a @code{static} one.
3890 This construct is not accepted by some traditional C compilers.
3893 The ISO type of an integer constant has a different width or
3894 signedness from its traditional type. This warning is only issued if
3895 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
3896 typically represent bit patterns, are not warned about.
3899 Usage of ISO string concatenation is detected.
3902 Initialization of automatic aggregates.
3905 Identifier conflicts with labels. Traditional C lacks a separate
3906 namespace for labels.
3909 Initialization of unions. If the initializer is zero, the warning is
3910 omitted. This is done under the assumption that the zero initializer in
3911 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3912 initializer warnings and relies on default initialization to zero in the
3916 Conversions by prototypes between fixed/floating point values and vice
3917 versa. The absence of these prototypes when compiling with traditional
3918 C would cause serious problems. This is a subset of the possible
3919 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3922 Use of ISO C style function definitions. This warning intentionally is
3923 @emph{not} issued for prototype declarations or variadic functions
3924 because these ISO C features will appear in your code when using
3925 libiberty's traditional C compatibility macros, @code{PARAMS} and
3926 @code{VPARAMS}. This warning is also bypassed for nested functions
3927 because that feature is already a GCC extension and thus not relevant to
3928 traditional C compatibility.
3931 @item -Wtraditional-conversion @r{(C and Objective-C only)}
3932 @opindex Wtraditional-conversion
3933 @opindex Wno-traditional-conversion
3934 Warn if a prototype causes a type conversion that is different from what
3935 would happen to the same argument in the absence of a prototype. This
3936 includes conversions of fixed point to floating and vice versa, and
3937 conversions changing the width or signedness of a fixed point argument
3938 except when the same as the default promotion.
3940 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
3941 @opindex Wdeclaration-after-statement
3942 @opindex Wno-declaration-after-statement
3943 Warn when a declaration is found after a statement in a block. This
3944 construct, known from C++, was introduced with ISO C99 and is by default
3945 allowed in GCC@. It is not supported by ISO C90 and was not supported by
3946 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3951 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3953 @item -Wno-endif-labels
3954 @opindex Wno-endif-labels
3955 @opindex Wendif-labels
3956 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3961 Warn whenever a local variable or type declaration shadows another variable,
3962 parameter, type, or class member (in C++), or whenever a built-in function
3963 is shadowed. Note that in C++, the compiler will not warn if a local variable
3964 shadows a struct/class/enum, but will warn if it shadows an explicit typedef.
3966 @item -Wlarger-than=@var{len}
3967 @opindex Wlarger-than=@var{len}
3968 @opindex Wlarger-than-@var{len}
3969 Warn whenever an object of larger than @var{len} bytes is defined.
3971 @item -Wframe-larger-than=@var{len}
3972 @opindex Wframe-larger-than
3973 Warn if the size of a function frame is larger than @var{len} bytes.
3974 The computation done to determine the stack frame size is approximate
3975 and not conservative.
3976 The actual requirements may be somewhat greater than @var{len}
3977 even if you do not get a warning. In addition, any space allocated
3978 via @code{alloca}, variable-length arrays, or related constructs
3979 is not included by the compiler when determining
3980 whether or not to issue a warning.
3982 @item -Wno-free-nonheap-object
3983 @opindex Wno-free-nonheap-object
3984 @opindex Wfree-nonheap-object
3985 Do not warn when attempting to free an object which was not allocated
3988 @item -Wstack-usage=@var{len}
3989 @opindex Wstack-usage
3990 Warn if the stack usage of a function might be larger than @var{len} bytes.
3991 The computation done to determine the stack usage is conservative.
3992 Any space allocated via @code{alloca}, variable-length arrays, or related
3993 constructs is included by the compiler when determining whether or not to
3996 The message is in keeping with the output of @option{-fstack-usage}.
4000 If the stack usage is fully static but exceeds the specified amount, it's:
4003 warning: stack usage is 1120 bytes
4006 If the stack usage is (partly) dynamic but bounded, it's:
4009 warning: stack usage might be 1648 bytes
4012 If the stack usage is (partly) dynamic and not bounded, it's:
4015 warning: stack usage might be unbounded
4019 @item -Wunsafe-loop-optimizations
4020 @opindex Wunsafe-loop-optimizations
4021 @opindex Wno-unsafe-loop-optimizations
4022 Warn if the loop cannot be optimized because the compiler could not
4023 assume anything on the bounds of the loop indices. With
4024 @option{-funsafe-loop-optimizations} warn if the compiler made
4027 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4028 @opindex Wno-pedantic-ms-format
4029 @opindex Wpedantic-ms-format
4030 Disables the warnings about non-ISO @code{printf} / @code{scanf} format
4031 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
4032 depending on the MS runtime, when you are using the options @option{-Wformat}
4033 and @option{-pedantic} without gnu-extensions.
4035 @item -Wpointer-arith
4036 @opindex Wpointer-arith
4037 @opindex Wno-pointer-arith
4038 Warn about anything that depends on the ``size of'' a function type or
4039 of @code{void}. GNU C assigns these types a size of 1, for
4040 convenience in calculations with @code{void *} pointers and pointers
4041 to functions. In C++, warn also when an arithmetic operation involves
4042 @code{NULL}. This warning is also enabled by @option{-pedantic}.
4045 @opindex Wtype-limits
4046 @opindex Wno-type-limits
4047 Warn if a comparison is always true or always false due to the limited
4048 range of the data type, but do not warn for constant expressions. For
4049 example, warn if an unsigned variable is compared against zero with
4050 @samp{<} or @samp{>=}. This warning is also enabled by
4053 @item -Wbad-function-cast @r{(C and Objective-C only)}
4054 @opindex Wbad-function-cast
4055 @opindex Wno-bad-function-cast
4056 Warn whenever a function call is cast to a non-matching type.
4057 For example, warn if @code{int malloc()} is cast to @code{anything *}.
4059 @item -Wc++-compat @r{(C and Objective-C only)}
4060 Warn about ISO C constructs that are outside of the common subset of
4061 ISO C and ISO C++, e.g.@: request for implicit conversion from
4062 @code{void *} to a pointer to non-@code{void} type.
4064 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4065 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
4066 ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that will become keywords
4067 in ISO C++ 2011. This warning is enabled by @option{-Wall}.
4071 @opindex Wno-cast-qual
4072 Warn whenever a pointer is cast so as to remove a type qualifier from
4073 the target type. For example, warn if a @code{const char *} is cast
4074 to an ordinary @code{char *}.
4076 Also warn when making a cast which introduces a type qualifier in an
4077 unsafe way. For example, casting @code{char **} to @code{const char **}
4078 is unsafe, as in this example:
4081 /* p is char ** value. */
4082 const char **q = (const char **) p;
4083 /* Assignment of readonly string to const char * is OK. */
4085 /* Now char** pointer points to read-only memory. */
4090 @opindex Wcast-align
4091 @opindex Wno-cast-align
4092 Warn whenever a pointer is cast such that the required alignment of the
4093 target is increased. For example, warn if a @code{char *} is cast to
4094 an @code{int *} on machines where integers can only be accessed at
4095 two- or four-byte boundaries.
4097 @item -Wwrite-strings
4098 @opindex Wwrite-strings
4099 @opindex Wno-write-strings
4100 When compiling C, give string constants the type @code{const
4101 char[@var{length}]} so that copying the address of one into a
4102 non-@code{const} @code{char *} pointer will get a warning. These
4103 warnings will help you find at compile time code that can try to write
4104 into a string constant, but only if you have been very careful about
4105 using @code{const} in declarations and prototypes. Otherwise, it will
4106 just be a nuisance. This is why we did not make @option{-Wall} request
4109 When compiling C++, warn about the deprecated conversion from string
4110 literals to @code{char *}. This warning is enabled by default for C++
4115 @opindex Wno-clobbered
4116 Warn for variables that might be changed by @samp{longjmp} or
4117 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
4120 @opindex Wconversion
4121 @opindex Wno-conversion
4122 Warn for implicit conversions that may alter a value. This includes
4123 conversions between real and integer, like @code{abs (x)} when
4124 @code{x} is @code{double}; conversions between signed and unsigned,
4125 like @code{unsigned ui = -1}; and conversions to smaller types, like
4126 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4127 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4128 changed by the conversion like in @code{abs (2.0)}. Warnings about
4129 conversions between signed and unsigned integers can be disabled by
4130 using @option{-Wno-sign-conversion}.
4132 For C++, also warn for confusing overload resolution for user-defined
4133 conversions; and conversions that will never use a type conversion
4134 operator: conversions to @code{void}, the same type, a base class or a
4135 reference to them. Warnings about conversions between signed and
4136 unsigned integers are disabled by default in C++ unless
4137 @option{-Wsign-conversion} is explicitly enabled.
4139 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4140 @opindex Wconversion-null
4141 @opindex Wno-conversion-null
4142 Do not warn for conversions between @code{NULL} and non-pointer
4143 types. @option{-Wconversion-null} is enabled by default.
4146 @opindex Wempty-body
4147 @opindex Wno-empty-body
4148 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
4149 while} statement. This warning is also enabled by @option{-Wextra}.
4151 @item -Wenum-compare
4152 @opindex Wenum-compare
4153 @opindex Wno-enum-compare
4154 Warn about a comparison between values of different enum types. In C++
4155 this warning is enabled by default. In C this warning is enabled by
4158 @item -Wjump-misses-init @r{(C, Objective-C only)}
4159 @opindex Wjump-misses-init
4160 @opindex Wno-jump-misses-init
4161 Warn if a @code{goto} statement or a @code{switch} statement jumps
4162 forward across the initialization of a variable, or jumps backward to a
4163 label after the variable has been initialized. This only warns about
4164 variables which are initialized when they are declared. This warning is
4165 only supported for C and Objective C; in C++ this sort of branch is an
4168 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
4169 can be disabled with the @option{-Wno-jump-misses-init} option.
4171 @item -Wsign-compare
4172 @opindex Wsign-compare
4173 @opindex Wno-sign-compare
4174 @cindex warning for comparison of signed and unsigned values
4175 @cindex comparison of signed and unsigned values, warning
4176 @cindex signed and unsigned values, comparison warning
4177 Warn when a comparison between signed and unsigned values could produce
4178 an incorrect result when the signed value is converted to unsigned.
4179 This warning is also enabled by @option{-Wextra}; to get the other warnings
4180 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
4182 @item -Wsign-conversion
4183 @opindex Wsign-conversion
4184 @opindex Wno-sign-conversion
4185 Warn for implicit conversions that may change the sign of an integer
4186 value, like assigning a signed integer expression to an unsigned
4187 integer variable. An explicit cast silences the warning. In C, this
4188 option is enabled also by @option{-Wconversion}.
4192 @opindex Wno-address
4193 Warn about suspicious uses of memory addresses. These include using
4194 the address of a function in a conditional expression, such as
4195 @code{void func(void); if (func)}, and comparisons against the memory
4196 address of a string literal, such as @code{if (x == "abc")}. Such
4197 uses typically indicate a programmer error: the address of a function
4198 always evaluates to true, so their use in a conditional usually
4199 indicate that the programmer forgot the parentheses in a function
4200 call; and comparisons against string literals result in unspecified
4201 behavior and are not portable in C, so they usually indicate that the
4202 programmer intended to use @code{strcmp}. This warning is enabled by
4206 @opindex Wlogical-op
4207 @opindex Wno-logical-op
4208 Warn about suspicious uses of logical operators in expressions.
4209 This includes using logical operators in contexts where a
4210 bit-wise operator is likely to be expected.
4212 @item -Waggregate-return
4213 @opindex Waggregate-return
4214 @opindex Wno-aggregate-return
4215 Warn if any functions that return structures or unions are defined or
4216 called. (In languages where you can return an array, this also elicits
4219 @item -Wno-attributes
4220 @opindex Wno-attributes
4221 @opindex Wattributes
4222 Do not warn if an unexpected @code{__attribute__} is used, such as
4223 unrecognized attributes, function attributes applied to variables,
4224 etc. This will not stop errors for incorrect use of supported
4227 @item -Wno-builtin-macro-redefined
4228 @opindex Wno-builtin-macro-redefined
4229 @opindex Wbuiltin-macro-redefined
4230 Do not warn if certain built-in macros are redefined. This suppresses
4231 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4232 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4234 @item -Wstrict-prototypes @r{(C and Objective-C only)}
4235 @opindex Wstrict-prototypes
4236 @opindex Wno-strict-prototypes
4237 Warn if a function is declared or defined without specifying the
4238 argument types. (An old-style function definition is permitted without
4239 a warning if preceded by a declaration which specifies the argument
4242 @item -Wold-style-declaration @r{(C and Objective-C only)}
4243 @opindex Wold-style-declaration
4244 @opindex Wno-old-style-declaration
4245 Warn for obsolescent usages, according to the C Standard, in a
4246 declaration. For example, warn if storage-class specifiers like
4247 @code{static} are not the first things in a declaration. This warning
4248 is also enabled by @option{-Wextra}.
4250 @item -Wold-style-definition @r{(C and Objective-C only)}
4251 @opindex Wold-style-definition
4252 @opindex Wno-old-style-definition
4253 Warn if an old-style function definition is used. A warning is given
4254 even if there is a previous prototype.
4256 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
4257 @opindex Wmissing-parameter-type
4258 @opindex Wno-missing-parameter-type
4259 A function parameter is declared without a type specifier in K&R-style
4266 This warning is also enabled by @option{-Wextra}.
4268 @item -Wmissing-prototypes @r{(C and Objective-C only)}
4269 @opindex Wmissing-prototypes
4270 @opindex Wno-missing-prototypes
4271 Warn if a global function is defined without a previous prototype
4272 declaration. This warning is issued even if the definition itself
4273 provides a prototype. The aim is to detect global functions that fail
4274 to be declared in header files.
4276 @item -Wmissing-declarations
4277 @opindex Wmissing-declarations
4278 @opindex Wno-missing-declarations
4279 Warn if a global function is defined without a previous declaration.
4280 Do so even if the definition itself provides a prototype.
4281 Use this option to detect global functions that are not declared in
4282 header files. In C++, no warnings are issued for function templates,
4283 or for inline functions, or for functions in anonymous namespaces.
4285 @item -Wmissing-field-initializers
4286 @opindex Wmissing-field-initializers
4287 @opindex Wno-missing-field-initializers
4291 Warn if a structure's initializer has some fields missing. For
4292 example, the following code would cause such a warning, because
4293 @code{x.h} is implicitly zero:
4296 struct s @{ int f, g, h; @};
4297 struct s x = @{ 3, 4 @};
4300 This option does not warn about designated initializers, so the following
4301 modification would not trigger a warning:
4304 struct s @{ int f, g, h; @};
4305 struct s x = @{ .f = 3, .g = 4 @};
4308 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
4309 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
4311 @item -Wmissing-format-attribute
4312 @opindex Wmissing-format-attribute
4313 @opindex Wno-missing-format-attribute
4316 Warn about function pointers which might be candidates for @code{format}
4317 attributes. Note these are only possible candidates, not absolute ones.
4318 GCC will guess that function pointers with @code{format} attributes that
4319 are used in assignment, initialization, parameter passing or return
4320 statements should have a corresponding @code{format} attribute in the
4321 resulting type. I.e.@: the left-hand side of the assignment or
4322 initialization, the type of the parameter variable, or the return type
4323 of the containing function respectively should also have a @code{format}
4324 attribute to avoid the warning.
4326 GCC will also warn about function definitions which might be
4327 candidates for @code{format} attributes. Again, these are only
4328 possible candidates. GCC will guess that @code{format} attributes
4329 might be appropriate for any function that calls a function like
4330 @code{vprintf} or @code{vscanf}, but this might not always be the
4331 case, and some functions for which @code{format} attributes are
4332 appropriate may not be detected.
4334 @item -Wno-multichar
4335 @opindex Wno-multichar
4337 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4338 Usually they indicate a typo in the user's code, as they have
4339 implementation-defined values, and should not be used in portable code.
4341 @item -Wnormalized=<none|id|nfc|nfkc>
4342 @opindex Wnormalized=
4345 @cindex character set, input normalization
4346 In ISO C and ISO C++, two identifiers are different if they are
4347 different sequences of characters. However, sometimes when characters
4348 outside the basic ASCII character set are used, you can have two
4349 different character sequences that look the same. To avoid confusion,
4350 the ISO 10646 standard sets out some @dfn{normalization rules} which
4351 when applied ensure that two sequences that look the same are turned into
4352 the same sequence. GCC can warn you if you are using identifiers which
4353 have not been normalized; this option controls that warning.
4355 There are four levels of warning that GCC supports. The default is
4356 @option{-Wnormalized=nfc}, which warns about any identifier which is
4357 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4358 recommended form for most uses.
4360 Unfortunately, there are some characters which ISO C and ISO C++ allow
4361 in identifiers that when turned into NFC aren't allowable as
4362 identifiers. That is, there's no way to use these symbols in portable
4363 ISO C or C++ and have all your identifiers in NFC@.
4364 @option{-Wnormalized=id} suppresses the warning for these characters.
4365 It is hoped that future versions of the standards involved will correct
4366 this, which is why this option is not the default.
4368 You can switch the warning off for all characters by writing
4369 @option{-Wnormalized=none}. You would only want to do this if you
4370 were using some other normalization scheme (like ``D''), because
4371 otherwise you can easily create bugs that are literally impossible to see.
4373 Some characters in ISO 10646 have distinct meanings but look identical
4374 in some fonts or display methodologies, especially once formatting has
4375 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4376 LETTER N'', will display just like a regular @code{n} which has been
4377 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
4378 normalization scheme to convert all these into a standard form as
4379 well, and GCC will warn if your code is not in NFKC if you use
4380 @option{-Wnormalized=nfkc}. This warning is comparable to warning
4381 about every identifier that contains the letter O because it might be
4382 confused with the digit 0, and so is not the default, but may be
4383 useful as a local coding convention if the programming environment is
4384 unable to be fixed to display these characters distinctly.
4386 @item -Wno-deprecated
4387 @opindex Wno-deprecated
4388 @opindex Wdeprecated
4389 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4391 @item -Wno-deprecated-declarations
4392 @opindex Wno-deprecated-declarations
4393 @opindex Wdeprecated-declarations
4394 Do not warn about uses of functions (@pxref{Function Attributes}),
4395 variables (@pxref{Variable Attributes}), and types (@pxref{Type
4396 Attributes}) marked as deprecated by using the @code{deprecated}
4400 @opindex Wno-overflow
4402 Do not warn about compile-time overflow in constant expressions.
4404 @item -Woverride-init @r{(C and Objective-C only)}
4405 @opindex Woverride-init
4406 @opindex Wno-override-init
4410 Warn if an initialized field without side effects is overridden when
4411 using designated initializers (@pxref{Designated Inits, , Designated
4414 This warning is included in @option{-Wextra}. To get other
4415 @option{-Wextra} warnings without this one, use @samp{-Wextra
4416 -Wno-override-init}.
4421 Warn if a structure is given the packed attribute, but the packed
4422 attribute has no effect on the layout or size of the structure.
4423 Such structures may be mis-aligned for little benefit. For
4424 instance, in this code, the variable @code{f.x} in @code{struct bar}
4425 will be misaligned even though @code{struct bar} does not itself
4426 have the packed attribute:
4433 @} __attribute__((packed));
4441 @item -Wpacked-bitfield-compat
4442 @opindex Wpacked-bitfield-compat
4443 @opindex Wno-packed-bitfield-compat
4444 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4445 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
4446 the change can lead to differences in the structure layout. GCC
4447 informs you when the offset of such a field has changed in GCC 4.4.
4448 For example there is no longer a 4-bit padding between field @code{a}
4449 and @code{b} in this structure:
4456 @} __attribute__ ((packed));
4459 This warning is enabled by default. Use
4460 @option{-Wno-packed-bitfield-compat} to disable this warning.
4465 Warn if padding is included in a structure, either to align an element
4466 of the structure or to align the whole structure. Sometimes when this
4467 happens it is possible to rearrange the fields of the structure to
4468 reduce the padding and so make the structure smaller.
4470 @item -Wredundant-decls
4471 @opindex Wredundant-decls
4472 @opindex Wno-redundant-decls
4473 Warn if anything is declared more than once in the same scope, even in
4474 cases where multiple declaration is valid and changes nothing.
4476 @item -Wnested-externs @r{(C and Objective-C only)}
4477 @opindex Wnested-externs
4478 @opindex Wno-nested-externs
4479 Warn if an @code{extern} declaration is encountered within a function.
4484 Warn if a function can not be inlined and it was declared as inline.
4485 Even with this option, the compiler will not warn about failures to
4486 inline functions declared in system headers.
4488 The compiler uses a variety of heuristics to determine whether or not
4489 to inline a function. For example, the compiler takes into account
4490 the size of the function being inlined and the amount of inlining
4491 that has already been done in the current function. Therefore,
4492 seemingly insignificant changes in the source program can cause the
4493 warnings produced by @option{-Winline} to appear or disappear.
4495 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4496 @opindex Wno-invalid-offsetof
4497 @opindex Winvalid-offsetof
4498 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4499 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
4500 to a non-POD type is undefined. In existing C++ implementations,
4501 however, @samp{offsetof} typically gives meaningful results even when
4502 applied to certain kinds of non-POD types. (Such as a simple
4503 @samp{struct} that fails to be a POD type only by virtue of having a
4504 constructor.) This flag is for users who are aware that they are
4505 writing nonportable code and who have deliberately chosen to ignore the
4508 The restrictions on @samp{offsetof} may be relaxed in a future version
4509 of the C++ standard.
4511 @item -Wno-int-to-pointer-cast
4512 @opindex Wno-int-to-pointer-cast
4513 @opindex Wint-to-pointer-cast
4514 Suppress warnings from casts to pointer type of an integer of a
4515 different size. In C++, casting to a pointer type of smaller size is
4516 an error. @option{Wint-to-pointer-cast} is enabled by default.
4519 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4520 @opindex Wno-pointer-to-int-cast
4521 @opindex Wpointer-to-int-cast
4522 Suppress warnings from casts from a pointer to an integer type of a
4526 @opindex Winvalid-pch
4527 @opindex Wno-invalid-pch
4528 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4529 the search path but can't be used.
4533 @opindex Wno-long-long
4534 Warn if @samp{long long} type is used. This is enabled by either
4535 @option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4536 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
4538 @item -Wvariadic-macros
4539 @opindex Wvariadic-macros
4540 @opindex Wno-variadic-macros
4541 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4542 alternate syntax when in pedantic ISO C99 mode. This is default.
4543 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4545 @item -Wvector-operation-performance
4546 @opindex Wvector-operation-performance
4547 @opindex Wno-vector-operation-performance
4548 Warn if vector operation is not implemented via SIMD capabilities of the
4549 architecture. Mainly useful for the performance tuning.
4550 Vector operation can be implemented @code{piecewise} which means that the
4551 scalar operation is performed on every vector element;
4552 @code{in parallel} which means that the vector operation is implemented
4553 using scalars of wider type, which normally is more performance efficient;
4554 and @code{as a single scalar} which means that vector fits into a
4560 Warn if variable length array is used in the code.
4561 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
4562 the variable length array.
4564 @item -Wvolatile-register-var
4565 @opindex Wvolatile-register-var
4566 @opindex Wno-volatile-register-var
4567 Warn if a register variable is declared volatile. The volatile
4568 modifier does not inhibit all optimizations that may eliminate reads
4569 and/or writes to register variables. This warning is enabled by
4572 @item -Wdisabled-optimization
4573 @opindex Wdisabled-optimization
4574 @opindex Wno-disabled-optimization
4575 Warn if a requested optimization pass is disabled. This warning does
4576 not generally indicate that there is anything wrong with your code; it
4577 merely indicates that GCC's optimizers were unable to handle the code
4578 effectively. Often, the problem is that your code is too big or too
4579 complex; GCC will refuse to optimize programs when the optimization
4580 itself is likely to take inordinate amounts of time.
4582 @item -Wpointer-sign @r{(C and Objective-C only)}
4583 @opindex Wpointer-sign
4584 @opindex Wno-pointer-sign
4585 Warn for pointer argument passing or assignment with different signedness.
4586 This option is only supported for C and Objective-C@. It is implied by
4587 @option{-Wall} and by @option{-pedantic}, which can be disabled with
4588 @option{-Wno-pointer-sign}.
4590 @item -Wstack-protector
4591 @opindex Wstack-protector
4592 @opindex Wno-stack-protector
4593 This option is only active when @option{-fstack-protector} is active. It
4594 warns about functions that will not be protected against stack smashing.
4597 @opindex Wno-mudflap
4598 Suppress warnings about constructs that cannot be instrumented by
4601 @item -Woverlength-strings
4602 @opindex Woverlength-strings
4603 @opindex Wno-overlength-strings
4604 Warn about string constants which are longer than the ``minimum
4605 maximum'' length specified in the C standard. Modern compilers
4606 generally allow string constants which are much longer than the
4607 standard's minimum limit, but very portable programs should avoid
4608 using longer strings.
4610 The limit applies @emph{after} string constant concatenation, and does
4611 not count the trailing NUL@. In C90, the limit was 509 characters; in
4612 C99, it was raised to 4095. C++98 does not specify a normative
4613 minimum maximum, so we do not diagnose overlength strings in C++@.
4615 This option is implied by @option{-pedantic}, and can be disabled with
4616 @option{-Wno-overlength-strings}.
4618 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
4619 @opindex Wunsuffixed-float-constants
4621 GCC will issue a warning for any floating constant that does not have
4622 a suffix. When used together with @option{-Wsystem-headers} it will
4623 warn about such constants in system header files. This can be useful
4624 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4625 from the decimal floating-point extension to C99.
4628 @node Debugging Options
4629 @section Options for Debugging Your Program or GCC
4630 @cindex options, debugging
4631 @cindex debugging information options
4633 GCC has various special options that are used for debugging
4634 either your program or GCC:
4639 Produce debugging information in the operating system's native format
4640 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
4643 On most systems that use stabs format, @option{-g} enables use of extra
4644 debugging information that only GDB can use; this extra information
4645 makes debugging work better in GDB but will probably make other debuggers
4647 refuse to read the program. If you want to control for certain whether
4648 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4649 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4651 GCC allows you to use @option{-g} with
4652 @option{-O}. The shortcuts taken by optimized code may occasionally
4653 produce surprising results: some variables you declared may not exist
4654 at all; flow of control may briefly move where you did not expect it;
4655 some statements may not be executed because they compute constant
4656 results or their values were already at hand; some statements may
4657 execute in different places because they were moved out of loops.
4659 Nevertheless it proves possible to debug optimized output. This makes
4660 it reasonable to use the optimizer for programs that might have bugs.
4662 The following options are useful when GCC is generated with the
4663 capability for more than one debugging format.
4667 Produce debugging information for use by GDB@. This means to use the
4668 most expressive format available (DWARF 2, stabs, or the native format
4669 if neither of those are supported), including GDB extensions if at all
4674 Produce debugging information in stabs format (if that is supported),
4675 without GDB extensions. This is the format used by DBX on most BSD
4676 systems. On MIPS, Alpha and System V Release 4 systems this option
4677 produces stabs debugging output which is not understood by DBX or SDB@.
4678 On System V Release 4 systems this option requires the GNU assembler.
4680 @item -feliminate-unused-debug-symbols
4681 @opindex feliminate-unused-debug-symbols
4682 Produce debugging information in stabs format (if that is supported),
4683 for only symbols that are actually used.
4685 @item -femit-class-debug-always
4686 Instead of emitting debugging information for a C++ class in only one
4687 object file, emit it in all object files using the class. This option
4688 should be used only with debuggers that are unable to handle the way GCC
4689 normally emits debugging information for classes because using this
4690 option will increase the size of debugging information by as much as a
4693 @item -fno-debug-types-section
4694 @opindex fno-debug-types-section
4695 @opindex fdebug-types-section
4696 By default when using DWARF v4 or higher type DIEs will be put into
4697 their own .debug_types section instead of making them part of the
4698 .debug_info section. It is more efficient to put them in a separate
4699 comdat sections since the linker will then be able to remove duplicates.
4700 But not all DWARF consumers support .debug_types sections yet.
4704 Produce debugging information in stabs format (if that is supported),
4705 using GNU extensions understood only by the GNU debugger (GDB)@. The
4706 use of these extensions is likely to make other debuggers crash or
4707 refuse to read the program.
4711 Produce debugging information in COFF format (if that is supported).
4712 This is the format used by SDB on most System V systems prior to
4717 Produce debugging information in XCOFF format (if that is supported).
4718 This is the format used by the DBX debugger on IBM RS/6000 systems.
4722 Produce debugging information in XCOFF format (if that is supported),
4723 using GNU extensions understood only by the GNU debugger (GDB)@. The
4724 use of these extensions is likely to make other debuggers crash or
4725 refuse to read the program, and may cause assemblers other than the GNU
4726 assembler (GAS) to fail with an error.
4728 @item -gdwarf-@var{version}
4729 @opindex gdwarf-@var{version}
4730 Produce debugging information in DWARF format (if that is
4731 supported). This is the format used by DBX on IRIX 6. The value
4732 of @var{version} may be either 2, 3 or 4; the default version is 2.
4734 Note that with DWARF version 2 some ports require, and will always
4735 use, some non-conflicting DWARF 3 extensions in the unwind tables.
4737 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
4738 for maximum benefit.
4740 @item -grecord-gcc-switches
4741 @opindex grecord-gcc-switches
4742 This switch causes the command line options, that were used to invoke the
4743 compiler and may affect code generation, to be appended to the
4744 DW_AT_producer attribute in DWARF debugging information. The options
4745 are concatenated with spaces separating them from each other and from
4746 the compiler version. See also @option{-frecord-gcc-switches} for another
4747 way of storing compiler options into the object file.
4749 @item -gno-record-gcc-switches
4750 @opindex gno-record-gcc-switches
4751 Disallow appending command line options to the DW_AT_producer attribute
4752 in DWARF debugging information. This is the default.
4754 @item -gstrict-dwarf
4755 @opindex gstrict-dwarf
4756 Disallow using extensions of later DWARF standard version than selected
4757 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
4758 DWARF extensions from later standard versions is allowed.
4760 @item -gno-strict-dwarf
4761 @opindex gno-strict-dwarf
4762 Allow using extensions of later DWARF standard version than selected with
4763 @option{-gdwarf-@var{version}}.
4767 Produce debugging information in VMS debug format (if that is
4768 supported). This is the format used by DEBUG on VMS systems.
4771 @itemx -ggdb@var{level}
4772 @itemx -gstabs@var{level}
4773 @itemx -gcoff@var{level}
4774 @itemx -gxcoff@var{level}
4775 @itemx -gvms@var{level}
4776 Request debugging information and also use @var{level} to specify how
4777 much information. The default level is 2.
4779 Level 0 produces no debug information at all. Thus, @option{-g0} negates
4782 Level 1 produces minimal information, enough for making backtraces in
4783 parts of the program that you don't plan to debug. This includes
4784 descriptions of functions and external variables, but no information
4785 about local variables and no line numbers.
4787 Level 3 includes extra information, such as all the macro definitions
4788 present in the program. Some debuggers support macro expansion when
4789 you use @option{-g3}.
4791 @option{-gdwarf-2} does not accept a concatenated debug level, because
4792 GCC used to support an option @option{-gdwarf} that meant to generate
4793 debug information in version 1 of the DWARF format (which is very
4794 different from version 2), and it would have been too confusing. That
4795 debug format is long obsolete, but the option cannot be changed now.
4796 Instead use an additional @option{-g@var{level}} option to change the
4797 debug level for DWARF.
4801 Turn off generation of debug info, if leaving out this option would have
4802 generated it, or turn it on at level 2 otherwise. The position of this
4803 argument in the command line does not matter, it takes effect after all
4804 other options are processed, and it does so only once, no matter how
4805 many times it is given. This is mainly intended to be used with
4806 @option{-fcompare-debug}.
4808 @item -fdump-final-insns@r{[}=@var{file}@r{]}
4809 @opindex fdump-final-insns
4810 Dump the final internal representation (RTL) to @var{file}. If the
4811 optional argument is omitted (or if @var{file} is @code{.}), the name
4812 of the dump file will be determined by appending @code{.gkd} to the
4813 compilation output file name.
4815 @item -fcompare-debug@r{[}=@var{opts}@r{]}
4816 @opindex fcompare-debug
4817 @opindex fno-compare-debug
4818 If no error occurs during compilation, run the compiler a second time,
4819 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
4820 passed to the second compilation. Dump the final internal
4821 representation in both compilations, and print an error if they differ.
4823 If the equal sign is omitted, the default @option{-gtoggle} is used.
4825 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
4826 and nonzero, implicitly enables @option{-fcompare-debug}. If
4827 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
4828 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
4831 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
4832 is equivalent to @option{-fno-compare-debug}, which disables the dumping
4833 of the final representation and the second compilation, preventing even
4834 @env{GCC_COMPARE_DEBUG} from taking effect.
4836 To verify full coverage during @option{-fcompare-debug} testing, set
4837 @env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
4838 which GCC will reject as an invalid option in any actual compilation
4839 (rather than preprocessing, assembly or linking). To get just a
4840 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
4841 not overridden} will do.
4843 @item -fcompare-debug-second
4844 @opindex fcompare-debug-second
4845 This option is implicitly passed to the compiler for the second
4846 compilation requested by @option{-fcompare-debug}, along with options to
4847 silence warnings, and omitting other options that would cause
4848 side-effect compiler outputs to files or to the standard output. Dump
4849 files and preserved temporary files are renamed so as to contain the
4850 @code{.gk} additional extension during the second compilation, to avoid
4851 overwriting those generated by the first.
4853 When this option is passed to the compiler driver, it causes the
4854 @emph{first} compilation to be skipped, which makes it useful for little
4855 other than debugging the compiler proper.
4857 @item -feliminate-dwarf2-dups
4858 @opindex feliminate-dwarf2-dups
4859 Compress DWARF2 debugging information by eliminating duplicated
4860 information about each symbol. This option only makes sense when
4861 generating DWARF2 debugging information with @option{-gdwarf-2}.
4863 @item -femit-struct-debug-baseonly
4864 Emit debug information for struct-like types
4865 only when the base name of the compilation source file
4866 matches the base name of file in which the struct was defined.
4868 This option substantially reduces the size of debugging information,
4869 but at significant potential loss in type information to the debugger.
4870 See @option{-femit-struct-debug-reduced} for a less aggressive option.
4871 See @option{-femit-struct-debug-detailed} for more detailed control.
4873 This option works only with DWARF 2.
4875 @item -femit-struct-debug-reduced
4876 Emit debug information for struct-like types
4877 only when the base name of the compilation source file
4878 matches the base name of file in which the type was defined,
4879 unless the struct is a template or defined in a system header.
4881 This option significantly reduces the size of debugging information,
4882 with some potential loss in type information to the debugger.
4883 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4884 See @option{-femit-struct-debug-detailed} for more detailed control.
4886 This option works only with DWARF 2.
4888 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4889 Specify the struct-like types
4890 for which the compiler will generate debug information.
4891 The intent is to reduce duplicate struct debug information
4892 between different object files within the same program.
4894 This option is a detailed version of
4895 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4896 which will serve for most needs.
4898 A specification has the syntax@*
4899 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4901 The optional first word limits the specification to
4902 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4903 A struct type is used directly when it is the type of a variable, member.
4904 Indirect uses arise through pointers to structs.
4905 That is, when use of an incomplete struct would be legal, the use is indirect.
4907 @samp{struct one direct; struct two * indirect;}.
4909 The optional second word limits the specification to
4910 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4911 Generic structs are a bit complicated to explain.
4912 For C++, these are non-explicit specializations of template classes,
4913 or non-template classes within the above.
4914 Other programming languages have generics,
4915 but @samp{-femit-struct-debug-detailed} does not yet implement them.
4917 The third word specifies the source files for those
4918 structs for which the compiler will emit debug information.
4919 The values @samp{none} and @samp{any} have the normal meaning.
4920 The value @samp{base} means that
4921 the base of name of the file in which the type declaration appears
4922 must match the base of the name of the main compilation file.
4923 In practice, this means that
4924 types declared in @file{foo.c} and @file{foo.h} will have debug information,
4925 but types declared in other header will not.
4926 The value @samp{sys} means those types satisfying @samp{base}
4927 or declared in system or compiler headers.
4929 You may need to experiment to determine the best settings for your application.
4931 The default is @samp{-femit-struct-debug-detailed=all}.
4933 This option works only with DWARF 2.
4935 @item -fno-merge-debug-strings
4936 @opindex fmerge-debug-strings
4937 @opindex fno-merge-debug-strings
4938 Direct the linker to not merge together strings in the debugging
4939 information which are identical in different object files. Merging is
4940 not supported by all assemblers or linkers. Merging decreases the size
4941 of the debug information in the output file at the cost of increasing
4942 link processing time. Merging is enabled by default.
4944 @item -fdebug-prefix-map=@var{old}=@var{new}
4945 @opindex fdebug-prefix-map
4946 When compiling files in directory @file{@var{old}}, record debugging
4947 information describing them as in @file{@var{new}} instead.
4949 @item -fno-dwarf2-cfi-asm
4950 @opindex fdwarf2-cfi-asm
4951 @opindex fno-dwarf2-cfi-asm
4952 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
4953 instead of using GAS @code{.cfi_*} directives.
4955 @cindex @command{prof}
4958 Generate extra code to write profile information suitable for the
4959 analysis program @command{prof}. You must use this option when compiling
4960 the source files you want data about, and you must also use it when
4963 @cindex @command{gprof}
4966 Generate extra code to write profile information suitable for the
4967 analysis program @command{gprof}. You must use this option when compiling
4968 the source files you want data about, and you must also use it when
4973 Makes the compiler print out each function name as it is compiled, and
4974 print some statistics about each pass when it finishes.
4977 @opindex ftime-report
4978 Makes the compiler print some statistics about the time consumed by each
4979 pass when it finishes.
4982 @opindex fmem-report
4983 Makes the compiler print some statistics about permanent memory
4984 allocation when it finishes.
4986 @item -fpre-ipa-mem-report
4987 @opindex fpre-ipa-mem-report
4988 @item -fpost-ipa-mem-report
4989 @opindex fpost-ipa-mem-report
4990 Makes the compiler print some statistics about permanent memory
4991 allocation before or after interprocedural optimization.
4994 @opindex fstack-usage
4995 Makes the compiler output stack usage information for the program, on a
4996 per-function basis. The filename for the dump is made by appending
4997 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
4998 the output file, if explicitly specified and it is not an executable,
4999 otherwise it is the basename of the source file. An entry is made up
5004 The name of the function.
5008 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
5011 The qualifier @code{static} means that the function manipulates the stack
5012 statically: a fixed number of bytes are allocated for the frame on function
5013 entry and released on function exit; no stack adjustments are otherwise made
5014 in the function. The second field is this fixed number of bytes.
5016 The qualifier @code{dynamic} means that the function manipulates the stack
5017 dynamically: in addition to the static allocation described above, stack
5018 adjustments are made in the body of the function, for example to push/pop
5019 arguments around function calls. If the qualifier @code{bounded} is also
5020 present, the amount of these adjustments is bounded at compile-time and
5021 the second field is an upper bound of the total amount of stack used by
5022 the function. If it is not present, the amount of these adjustments is
5023 not bounded at compile-time and the second field only represents the
5026 @item -fprofile-arcs
5027 @opindex fprofile-arcs
5028 Add code so that program flow @dfn{arcs} are instrumented. During
5029 execution the program records how many times each branch and call is
5030 executed and how many times it is taken or returns. When the compiled
5031 program exits it saves this data to a file called
5032 @file{@var{auxname}.gcda} for each source file. The data may be used for
5033 profile-directed optimizations (@option{-fbranch-probabilities}), or for
5034 test coverage analysis (@option{-ftest-coverage}). Each object file's
5035 @var{auxname} is generated from the name of the output file, if
5036 explicitly specified and it is not the final executable, otherwise it is
5037 the basename of the source file. In both cases any suffix is removed
5038 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
5039 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
5040 @xref{Cross-profiling}.
5042 @cindex @command{gcov}
5046 This option is used to compile and link code instrumented for coverage
5047 analysis. The option is a synonym for @option{-fprofile-arcs}
5048 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
5049 linking). See the documentation for those options for more details.
5054 Compile the source files with @option{-fprofile-arcs} plus optimization
5055 and code generation options. For test coverage analysis, use the
5056 additional @option{-ftest-coverage} option. You do not need to profile
5057 every source file in a program.
5060 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
5061 (the latter implies the former).
5064 Run the program on a representative workload to generate the arc profile
5065 information. This may be repeated any number of times. You can run
5066 concurrent instances of your program, and provided that the file system
5067 supports locking, the data files will be correctly updated. Also
5068 @code{fork} calls are detected and correctly handled (double counting
5072 For profile-directed optimizations, compile the source files again with
5073 the same optimization and code generation options plus
5074 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
5075 Control Optimization}).
5078 For test coverage analysis, use @command{gcov} to produce human readable
5079 information from the @file{.gcno} and @file{.gcda} files. Refer to the
5080 @command{gcov} documentation for further information.
5084 With @option{-fprofile-arcs}, for each function of your program GCC
5085 creates a program flow graph, then finds a spanning tree for the graph.
5086 Only arcs that are not on the spanning tree have to be instrumented: the
5087 compiler adds code to count the number of times that these arcs are
5088 executed. When an arc is the only exit or only entrance to a block, the
5089 instrumentation code can be added to the block; otherwise, a new basic
5090 block must be created to hold the instrumentation code.
5093 @item -ftest-coverage
5094 @opindex ftest-coverage
5095 Produce a notes file that the @command{gcov} code-coverage utility
5096 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
5097 show program coverage. Each source file's note file is called
5098 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
5099 above for a description of @var{auxname} and instructions on how to
5100 generate test coverage data. Coverage data will match the source files
5101 more closely, if you do not optimize.
5103 @item -fdbg-cnt-list
5104 @opindex fdbg-cnt-list
5105 Print the name and the counter upper bound for all debug counters.
5108 @item -fdbg-cnt=@var{counter-value-list}
5110 Set the internal debug counter upper bound. @var{counter-value-list}
5111 is a comma-separated list of @var{name}:@var{value} pairs
5112 which sets the upper bound of each debug counter @var{name} to @var{value}.
5113 All debug counters have the initial upper bound of @var{UINT_MAX},
5114 thus dbg_cnt() returns true always unless the upper bound is set by this option.
5115 e.g. With -fdbg-cnt=dce:10,tail_call:0
5116 dbg_cnt(dce) will return true only for first 10 invocations
5118 @itemx -fenable-@var{kind}-@var{pass}
5119 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
5123 This is a set of debugging options that are used to explicitly disable/enable
5124 optimization passes. For compiler users, regular options for enabling/disabling
5125 passes should be used instead.
5129 @item -fdisable-ipa-@var{pass}
5130 Disable ipa pass @var{pass}. @var{pass} is the pass name. If the same pass is
5131 statically invoked in the compiler multiple times, the pass name should be
5132 appended with a sequential number starting from 1.
5134 @item -fdisable-rtl-@var{pass}
5135 @item -fdisable-rtl-@var{pass}=@var{range-list}
5136 Disable rtl pass @var{pass}. @var{pass} is the pass name. If the same pass is
5137 statically invoked in the compiler multiple times, the pass name should be
5138 appended with a sequential number starting from 1. @var{range-list} is a comma
5139 seperated list of function ranges or assembler names. Each range is a number
5140 pair seperated by a colon. The range is inclusive in both ends. If the range
5141 is trivial, the number pair can be simplified as a single number. If the
5142 function's cgraph node's @var{uid} is falling within one of the specified ranges,
5143 the @var{pass} is disabled for that function. The @var{uid} is shown in the
5144 function header of a dump file, and the pass names can be dumped by using
5145 option @option{-fdump-passes}.
5147 @item -fdisable-tree-@var{pass}
5148 @item -fdisable-tree-@var{pass}=@var{range-list}
5149 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
5152 @item -fenable-ipa-@var{pass}
5153 Enable ipa pass @var{pass}. @var{pass} is the pass name. If the same pass is
5154 statically invoked in the compiler multiple times, the pass name should be
5155 appended with a sequential number starting from 1.
5157 @item -fenable-rtl-@var{pass}
5158 @item -fenable-rtl-@var{pass}=@var{range-list}
5159 Enable rtl pass @var{pass}. See @option{-fdisable-rtl} for option argument
5160 description and examples.
5162 @item -fenable-tree-@var{pass}
5163 @item -fenable-tree-@var{pass}=@var{range-list}
5164 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
5165 of option arguments.
5169 # disable ccp1 for all functions
5171 # disable complete unroll for function whose cgraph node uid is 1
5172 -fenable-tree-cunroll=1
5173 # disable gcse2 for functions at the following ranges [1,1],
5174 # [300,400], and [400,1000]
5175 # disable gcse2 for functions foo and foo2
5176 -fdisable-rtl-gcse2=foo,foo2
5177 # disable early inlining
5178 -fdisable-tree-einline
5179 # disable ipa inlining
5180 -fdisable-ipa-inline
5181 # enable tree full unroll
5182 -fenable-tree-unroll
5188 @item -d@var{letters}
5189 @itemx -fdump-rtl-@var{pass}
5191 Says to make debugging dumps during compilation at times specified by
5192 @var{letters}. This is used for debugging the RTL-based passes of the
5193 compiler. The file names for most of the dumps are made by appending
5194 a pass number and a word to the @var{dumpname}, and the files are
5195 created in the directory of the output file. Note that the pass
5196 number is computed statically as passes get registered into the pass
5197 manager. Thus the numbering is not related to the dynamic order of
5198 execution of passes. In particular, a pass installed by a plugin
5199 could have a number over 200 even if it executed quite early.
5200 @var{dumpname} is generated from the name of the output file, if
5201 explicitly specified and it is not an executable, otherwise it is the
5202 basename of the source file. These switches may have different effects
5203 when @option{-E} is used for preprocessing.
5205 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
5206 @option{-d} option @var{letters}. Here are the possible
5207 letters for use in @var{pass} and @var{letters}, and their meanings:
5211 @item -fdump-rtl-alignments
5212 @opindex fdump-rtl-alignments
5213 Dump after branch alignments have been computed.
5215 @item -fdump-rtl-asmcons
5216 @opindex fdump-rtl-asmcons
5217 Dump after fixing rtl statements that have unsatisfied in/out constraints.
5219 @item -fdump-rtl-auto_inc_dec
5220 @opindex fdump-rtl-auto_inc_dec
5221 Dump after auto-inc-dec discovery. This pass is only run on
5222 architectures that have auto inc or auto dec instructions.
5224 @item -fdump-rtl-barriers
5225 @opindex fdump-rtl-barriers
5226 Dump after cleaning up the barrier instructions.
5228 @item -fdump-rtl-bbpart
5229 @opindex fdump-rtl-bbpart
5230 Dump after partitioning hot and cold basic blocks.
5232 @item -fdump-rtl-bbro
5233 @opindex fdump-rtl-bbro
5234 Dump after block reordering.
5236 @item -fdump-rtl-btl1
5237 @itemx -fdump-rtl-btl2
5238 @opindex fdump-rtl-btl2
5239 @opindex fdump-rtl-btl2
5240 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
5241 after the two branch
5242 target load optimization passes.
5244 @item -fdump-rtl-bypass
5245 @opindex fdump-rtl-bypass
5246 Dump after jump bypassing and control flow optimizations.
5248 @item -fdump-rtl-combine
5249 @opindex fdump-rtl-combine
5250 Dump after the RTL instruction combination pass.
5252 @item -fdump-rtl-compgotos
5253 @opindex fdump-rtl-compgotos
5254 Dump after duplicating the computed gotos.
5256 @item -fdump-rtl-ce1
5257 @itemx -fdump-rtl-ce2
5258 @itemx -fdump-rtl-ce3
5259 @opindex fdump-rtl-ce1
5260 @opindex fdump-rtl-ce2
5261 @opindex fdump-rtl-ce3
5262 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
5263 @option{-fdump-rtl-ce3} enable dumping after the three
5264 if conversion passes.
5266 @itemx -fdump-rtl-cprop_hardreg
5267 @opindex fdump-rtl-cprop_hardreg
5268 Dump after hard register copy propagation.
5270 @itemx -fdump-rtl-csa
5271 @opindex fdump-rtl-csa
5272 Dump after combining stack adjustments.
5274 @item -fdump-rtl-cse1
5275 @itemx -fdump-rtl-cse2
5276 @opindex fdump-rtl-cse1
5277 @opindex fdump-rtl-cse2
5278 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
5279 the two common sub-expression elimination passes.
5281 @itemx -fdump-rtl-dce
5282 @opindex fdump-rtl-dce
5283 Dump after the standalone dead code elimination passes.
5285 @itemx -fdump-rtl-dbr
5286 @opindex fdump-rtl-dbr
5287 Dump after delayed branch scheduling.
5289 @item -fdump-rtl-dce1
5290 @itemx -fdump-rtl-dce2
5291 @opindex fdump-rtl-dce1
5292 @opindex fdump-rtl-dce2
5293 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
5294 the two dead store elimination passes.
5297 @opindex fdump-rtl-eh
5298 Dump after finalization of EH handling code.
5300 @item -fdump-rtl-eh_ranges
5301 @opindex fdump-rtl-eh_ranges
5302 Dump after conversion of EH handling range regions.
5304 @item -fdump-rtl-expand
5305 @opindex fdump-rtl-expand
5306 Dump after RTL generation.
5308 @item -fdump-rtl-fwprop1
5309 @itemx -fdump-rtl-fwprop2
5310 @opindex fdump-rtl-fwprop1
5311 @opindex fdump-rtl-fwprop2
5312 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
5313 dumping after the two forward propagation passes.
5315 @item -fdump-rtl-gcse1
5316 @itemx -fdump-rtl-gcse2
5317 @opindex fdump-rtl-gcse1
5318 @opindex fdump-rtl-gcse2
5319 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
5320 after global common subexpression elimination.
5322 @item -fdump-rtl-init-regs
5323 @opindex fdump-rtl-init-regs
5324 Dump after the initialization of the registers.
5326 @item -fdump-rtl-initvals
5327 @opindex fdump-rtl-initvals
5328 Dump after the computation of the initial value sets.
5330 @itemx -fdump-rtl-into_cfglayout
5331 @opindex fdump-rtl-into_cfglayout
5332 Dump after converting to cfglayout mode.
5334 @item -fdump-rtl-ira
5335 @opindex fdump-rtl-ira
5336 Dump after iterated register allocation.
5338 @item -fdump-rtl-jump
5339 @opindex fdump-rtl-jump
5340 Dump after the second jump optimization.
5342 @item -fdump-rtl-loop2
5343 @opindex fdump-rtl-loop2
5344 @option{-fdump-rtl-loop2} enables dumping after the rtl
5345 loop optimization passes.
5347 @item -fdump-rtl-mach
5348 @opindex fdump-rtl-mach
5349 Dump after performing the machine dependent reorganization pass, if that
5352 @item -fdump-rtl-mode_sw
5353 @opindex fdump-rtl-mode_sw
5354 Dump after removing redundant mode switches.
5356 @item -fdump-rtl-rnreg
5357 @opindex fdump-rtl-rnreg
5358 Dump after register renumbering.
5360 @itemx -fdump-rtl-outof_cfglayout
5361 @opindex fdump-rtl-outof_cfglayout
5362 Dump after converting from cfglayout mode.
5364 @item -fdump-rtl-peephole2
5365 @opindex fdump-rtl-peephole2
5366 Dump after the peephole pass.
5368 @item -fdump-rtl-postreload
5369 @opindex fdump-rtl-postreload
5370 Dump after post-reload optimizations.
5372 @itemx -fdump-rtl-pro_and_epilogue
5373 @opindex fdump-rtl-pro_and_epilogue
5374 Dump after generating the function pro and epilogues.
5376 @item -fdump-rtl-regmove
5377 @opindex fdump-rtl-regmove
5378 Dump after the register move pass.
5380 @item -fdump-rtl-sched1
5381 @itemx -fdump-rtl-sched2
5382 @opindex fdump-rtl-sched1
5383 @opindex fdump-rtl-sched2
5384 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
5385 after the basic block scheduling passes.
5387 @item -fdump-rtl-see
5388 @opindex fdump-rtl-see
5389 Dump after sign extension elimination.
5391 @item -fdump-rtl-seqabstr
5392 @opindex fdump-rtl-seqabstr
5393 Dump after common sequence discovery.
5395 @item -fdump-rtl-shorten
5396 @opindex fdump-rtl-shorten
5397 Dump after shortening branches.
5399 @item -fdump-rtl-sibling
5400 @opindex fdump-rtl-sibling
5401 Dump after sibling call optimizations.
5403 @item -fdump-rtl-split1
5404 @itemx -fdump-rtl-split2
5405 @itemx -fdump-rtl-split3
5406 @itemx -fdump-rtl-split4
5407 @itemx -fdump-rtl-split5
5408 @opindex fdump-rtl-split1
5409 @opindex fdump-rtl-split2
5410 @opindex fdump-rtl-split3
5411 @opindex fdump-rtl-split4
5412 @opindex fdump-rtl-split5
5413 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
5414 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
5415 @option{-fdump-rtl-split5} enable dumping after five rounds of
5416 instruction splitting.
5418 @item -fdump-rtl-sms
5419 @opindex fdump-rtl-sms
5420 Dump after modulo scheduling. This pass is only run on some
5423 @item -fdump-rtl-stack
5424 @opindex fdump-rtl-stack
5425 Dump after conversion from GCC's "flat register file" registers to the
5426 x87's stack-like registers. This pass is only run on x86 variants.
5428 @item -fdump-rtl-subreg1
5429 @itemx -fdump-rtl-subreg2
5430 @opindex fdump-rtl-subreg1
5431 @opindex fdump-rtl-subreg2
5432 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
5433 the two subreg expansion passes.
5435 @item -fdump-rtl-unshare
5436 @opindex fdump-rtl-unshare
5437 Dump after all rtl has been unshared.
5439 @item -fdump-rtl-vartrack
5440 @opindex fdump-rtl-vartrack
5441 Dump after variable tracking.
5443 @item -fdump-rtl-vregs
5444 @opindex fdump-rtl-vregs
5445 Dump after converting virtual registers to hard registers.
5447 @item -fdump-rtl-web
5448 @opindex fdump-rtl-web
5449 Dump after live range splitting.
5451 @item -fdump-rtl-regclass
5452 @itemx -fdump-rtl-subregs_of_mode_init
5453 @itemx -fdump-rtl-subregs_of_mode_finish
5454 @itemx -fdump-rtl-dfinit
5455 @itemx -fdump-rtl-dfinish
5456 @opindex fdump-rtl-regclass
5457 @opindex fdump-rtl-subregs_of_mode_init
5458 @opindex fdump-rtl-subregs_of_mode_finish
5459 @opindex fdump-rtl-dfinit
5460 @opindex fdump-rtl-dfinish
5461 These dumps are defined but always produce empty files.
5463 @item -fdump-rtl-all
5464 @opindex fdump-rtl-all
5465 Produce all the dumps listed above.
5469 Annotate the assembler output with miscellaneous debugging information.
5473 Dump all macro definitions, at the end of preprocessing, in addition to
5478 Produce a core dump whenever an error occurs.
5482 Print statistics on memory usage, at the end of the run, to
5487 Annotate the assembler output with a comment indicating which
5488 pattern and alternative was used. The length of each instruction is
5493 Dump the RTL in the assembler output as a comment before each instruction.
5494 Also turns on @option{-dp} annotation.
5498 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5499 dump a representation of the control flow graph suitable for viewing with VCG
5500 to @file{@var{file}.@var{pass}.vcg}.
5504 Just generate RTL for a function instead of compiling it. Usually used
5505 with @option{-fdump-rtl-expand}.
5509 @opindex fdump-noaddr
5510 When doing debugging dumps, suppress address output. This makes it more
5511 feasible to use diff on debugging dumps for compiler invocations with
5512 different compiler binaries and/or different
5513 text / bss / data / heap / stack / dso start locations.
5515 @item -fdump-unnumbered
5516 @opindex fdump-unnumbered
5517 When doing debugging dumps, suppress instruction numbers and address output.
5518 This makes it more feasible to use diff on debugging dumps for compiler
5519 invocations with different options, in particular with and without
5522 @item -fdump-unnumbered-links
5523 @opindex fdump-unnumbered-links
5524 When doing debugging dumps (see @option{-d} option above), suppress
5525 instruction numbers for the links to the previous and next instructions
5528 @item -fdump-translation-unit @r{(C++ only)}
5529 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
5530 @opindex fdump-translation-unit
5531 Dump a representation of the tree structure for the entire translation
5532 unit to a file. The file name is made by appending @file{.tu} to the
5533 source file name, and the file is created in the same directory as the
5534 output file. If the @samp{-@var{options}} form is used, @var{options}
5535 controls the details of the dump as described for the
5536 @option{-fdump-tree} options.
5538 @item -fdump-class-hierarchy @r{(C++ only)}
5539 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
5540 @opindex fdump-class-hierarchy
5541 Dump a representation of each class's hierarchy and virtual function
5542 table layout to a file. The file name is made by appending
5543 @file{.class} to the source file name, and the file is created in the
5544 same directory as the output file. If the @samp{-@var{options}} form
5545 is used, @var{options} controls the details of the dump as described
5546 for the @option{-fdump-tree} options.
5548 @item -fdump-ipa-@var{switch}
5550 Control the dumping at various stages of inter-procedural analysis
5551 language tree to a file. The file name is generated by appending a
5552 switch specific suffix to the source file name, and the file is created
5553 in the same directory as the output file. The following dumps are
5558 Enables all inter-procedural analysis dumps.
5561 Dumps information about call-graph optimization, unused function removal,
5562 and inlining decisions.
5565 Dump after function inlining.
5570 @opindex fdump-passes
5571 Dump the list of optimization passes that are turned on and off by
5572 the current command line options.
5574 @item -fdump-statistics-@var{option}
5575 @opindex fdump-statistics
5576 Enable and control dumping of pass statistics in a separate file. The
5577 file name is generated by appending a suffix ending in
5578 @samp{.statistics} to the source file name, and the file is created in
5579 the same directory as the output file. If the @samp{-@var{option}}
5580 form is used, @samp{-stats} will cause counters to be summed over the
5581 whole compilation unit while @samp{-details} will dump every event as
5582 the passes generate them. The default with no option is to sum
5583 counters for each function compiled.
5585 @item -fdump-tree-@var{switch}
5586 @itemx -fdump-tree-@var{switch}-@var{options}
5588 Control the dumping at various stages of processing the intermediate
5589 language tree to a file. The file name is generated by appending a
5590 switch specific suffix to the source file name, and the file is
5591 created in the same directory as the output file. If the
5592 @samp{-@var{options}} form is used, @var{options} is a list of
5593 @samp{-} separated options that control the details of the dump. Not
5594 all options are applicable to all dumps, those which are not
5595 meaningful will be ignored. The following options are available
5599 Print the address of each node. Usually this is not meaningful as it
5600 changes according to the environment and source file. Its primary use
5601 is for tying up a dump file with a debug environment.
5603 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5604 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
5605 use working backward from mangled names in the assembly file.
5607 Inhibit dumping of members of a scope or body of a function merely
5608 because that scope has been reached. Only dump such items when they
5609 are directly reachable by some other path. When dumping pretty-printed
5610 trees, this option inhibits dumping the bodies of control structures.
5612 Print a raw representation of the tree. By default, trees are
5613 pretty-printed into a C-like representation.
5615 Enable more detailed dumps (not honored by every dump option).
5617 Enable dumping various statistics about the pass (not honored by every dump
5620 Enable showing basic block boundaries (disabled in raw dumps).
5622 Enable showing virtual operands for every statement.
5624 Enable showing line numbers for statements.
5626 Enable showing the unique ID (@code{DECL_UID}) for each variable.
5628 Enable showing the tree dump for each statement.
5630 Enable showing the EH region number holding each statement.
5632 Enable showing scalar evolution analysis details.
5634 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5635 and @option{lineno}.
5638 The following tree dumps are possible:
5642 @opindex fdump-tree-original
5643 Dump before any tree based optimization, to @file{@var{file}.original}.
5646 @opindex fdump-tree-optimized
5647 Dump after all tree based optimization, to @file{@var{file}.optimized}.
5650 @opindex fdump-tree-gimple
5651 Dump each function before and after the gimplification pass to a file. The
5652 file name is made by appending @file{.gimple} to the source file name.
5655 @opindex fdump-tree-cfg
5656 Dump the control flow graph of each function to a file. The file name is
5657 made by appending @file{.cfg} to the source file name.
5660 @opindex fdump-tree-vcg
5661 Dump the control flow graph of each function to a file in VCG format. The
5662 file name is made by appending @file{.vcg} to the source file name. Note
5663 that if the file contains more than one function, the generated file cannot
5664 be used directly by VCG@. You will need to cut and paste each function's
5665 graph into its own separate file first.
5668 @opindex fdump-tree-ch
5669 Dump each function after copying loop headers. The file name is made by
5670 appending @file{.ch} to the source file name.
5673 @opindex fdump-tree-ssa
5674 Dump SSA related information to a file. The file name is made by appending
5675 @file{.ssa} to the source file name.
5678 @opindex fdump-tree-alias
5679 Dump aliasing information for each function. The file name is made by
5680 appending @file{.alias} to the source file name.
5683 @opindex fdump-tree-ccp
5684 Dump each function after CCP@. The file name is made by appending
5685 @file{.ccp} to the source file name.
5688 @opindex fdump-tree-storeccp
5689 Dump each function after STORE-CCP@. The file name is made by appending
5690 @file{.storeccp} to the source file name.
5693 @opindex fdump-tree-pre
5694 Dump trees after partial redundancy elimination. The file name is made
5695 by appending @file{.pre} to the source file name.
5698 @opindex fdump-tree-fre
5699 Dump trees after full redundancy elimination. The file name is made
5700 by appending @file{.fre} to the source file name.
5703 @opindex fdump-tree-copyprop
5704 Dump trees after copy propagation. The file name is made
5705 by appending @file{.copyprop} to the source file name.
5707 @item store_copyprop
5708 @opindex fdump-tree-store_copyprop
5709 Dump trees after store copy-propagation. The file name is made
5710 by appending @file{.store_copyprop} to the source file name.
5713 @opindex fdump-tree-dce
5714 Dump each function after dead code elimination. The file name is made by
5715 appending @file{.dce} to the source file name.
5718 @opindex fdump-tree-mudflap
5719 Dump each function after adding mudflap instrumentation. The file name is
5720 made by appending @file{.mudflap} to the source file name.
5723 @opindex fdump-tree-sra
5724 Dump each function after performing scalar replacement of aggregates. The
5725 file name is made by appending @file{.sra} to the source file name.
5728 @opindex fdump-tree-sink
5729 Dump each function after performing code sinking. The file name is made
5730 by appending @file{.sink} to the source file name.
5733 @opindex fdump-tree-dom
5734 Dump each function after applying dominator tree optimizations. The file
5735 name is made by appending @file{.dom} to the source file name.
5738 @opindex fdump-tree-dse
5739 Dump each function after applying dead store elimination. The file
5740 name is made by appending @file{.dse} to the source file name.
5743 @opindex fdump-tree-phiopt
5744 Dump each function after optimizing PHI nodes into straightline code. The file
5745 name is made by appending @file{.phiopt} to the source file name.
5748 @opindex fdump-tree-forwprop
5749 Dump each function after forward propagating single use variables. The file
5750 name is made by appending @file{.forwprop} to the source file name.
5753 @opindex fdump-tree-copyrename
5754 Dump each function after applying the copy rename optimization. The file
5755 name is made by appending @file{.copyrename} to the source file name.
5758 @opindex fdump-tree-nrv
5759 Dump each function after applying the named return value optimization on
5760 generic trees. The file name is made by appending @file{.nrv} to the source
5764 @opindex fdump-tree-vect
5765 Dump each function after applying vectorization of loops. The file name is
5766 made by appending @file{.vect} to the source file name.
5769 @opindex fdump-tree-slp
5770 Dump each function after applying vectorization of basic blocks. The file name
5771 is made by appending @file{.slp} to the source file name.
5774 @opindex fdump-tree-vrp
5775 Dump each function after Value Range Propagation (VRP). The file name
5776 is made by appending @file{.vrp} to the source file name.
5779 @opindex fdump-tree-all
5780 Enable all the available tree dumps with the flags provided in this option.
5783 @item -ftree-vectorizer-verbose=@var{n}
5784 @opindex ftree-vectorizer-verbose
5785 This option controls the amount of debugging output the vectorizer prints.
5786 This information is written to standard error, unless
5787 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
5788 in which case it is output to the usual dump listing file, @file{.vect}.
5789 For @var{n}=0 no diagnostic information is reported.
5790 If @var{n}=1 the vectorizer reports each loop that got vectorized,
5791 and the total number of loops that got vectorized.
5792 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
5793 the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
5794 inner-most, single-bb, single-entry/exit loops. This is the same verbosity
5795 level that @option{-fdump-tree-vect-stats} uses.
5796 Higher verbosity levels mean either more information dumped for each
5797 reported loop, or same amount of information reported for more loops:
5798 if @var{n}=3, vectorizer cost model information is reported.
5799 If @var{n}=4, alignment related information is added to the reports.
5800 If @var{n}=5, data-references related information (e.g.@: memory dependences,
5801 memory access-patterns) is added to the reports.
5802 If @var{n}=6, the vectorizer reports also non-vectorized inner-most loops
5803 that did not pass the first analysis phase (i.e., may not be countable, or
5804 may have complicated control-flow).
5805 If @var{n}=7, the vectorizer reports also non-vectorized nested loops.
5806 If @var{n}=8, SLP related information is added to the reports.
5807 For @var{n}=9, all the information the vectorizer generates during its
5808 analysis and transformation is reported. This is the same verbosity level
5809 that @option{-fdump-tree-vect-details} uses.
5811 @item -frandom-seed=@var{string}
5812 @opindex frandom-seed
5813 This option provides a seed that GCC uses when it would otherwise use
5814 random numbers. It is used to generate certain symbol names
5815 that have to be different in every compiled file. It is also used to
5816 place unique stamps in coverage data files and the object files that
5817 produce them. You can use the @option{-frandom-seed} option to produce
5818 reproducibly identical object files.
5820 The @var{string} should be different for every file you compile.
5822 @item -fsched-verbose=@var{n}
5823 @opindex fsched-verbose
5824 On targets that use instruction scheduling, this option controls the
5825 amount of debugging output the scheduler prints. This information is
5826 written to standard error, unless @option{-fdump-rtl-sched1} or
5827 @option{-fdump-rtl-sched2} is specified, in which case it is output
5828 to the usual dump listing file, @file{.sched1} or @file{.sched2}
5829 respectively. However for @var{n} greater than nine, the output is
5830 always printed to standard error.
5832 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
5833 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
5834 For @var{n} greater than one, it also output basic block probabilities,
5835 detailed ready list information and unit/insn info. For @var{n} greater
5836 than two, it includes RTL at abort point, control-flow and regions info.
5837 And for @var{n} over four, @option{-fsched-verbose} also includes
5841 @itemx -save-temps=cwd
5843 Store the usual ``temporary'' intermediate files permanently; place them
5844 in the current directory and name them based on the source file. Thus,
5845 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
5846 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
5847 preprocessed @file{foo.i} output file even though the compiler now
5848 normally uses an integrated preprocessor.
5850 When used in combination with the @option{-x} command line option,
5851 @option{-save-temps} is sensible enough to avoid over writing an
5852 input source file with the same extension as an intermediate file.
5853 The corresponding intermediate file may be obtained by renaming the
5854 source file before using @option{-save-temps}.
5856 If you invoke GCC in parallel, compiling several different source
5857 files that share a common base name in different subdirectories or the
5858 same source file compiled for multiple output destinations, it is
5859 likely that the different parallel compilers will interfere with each
5860 other, and overwrite the temporary files. For instance:
5863 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
5864 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
5867 may result in @file{foo.i} and @file{foo.o} being written to
5868 simultaneously by both compilers.
5870 @item -save-temps=obj
5871 @opindex save-temps=obj
5872 Store the usual ``temporary'' intermediate files permanently. If the
5873 @option{-o} option is used, the temporary files are based on the
5874 object file. If the @option{-o} option is not used, the
5875 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
5880 gcc -save-temps=obj -c foo.c
5881 gcc -save-temps=obj -c bar.c -o dir/xbar.o
5882 gcc -save-temps=obj foobar.c -o dir2/yfoobar
5885 would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
5886 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
5887 @file{dir2/yfoobar.o}.
5889 @item -time@r{[}=@var{file}@r{]}
5891 Report the CPU time taken by each subprocess in the compilation
5892 sequence. For C source files, this is the compiler proper and assembler
5893 (plus the linker if linking is done).
5895 Without the specification of an output file, the output looks like this:
5902 The first number on each line is the ``user time'', that is time spent
5903 executing the program itself. The second number is ``system time'',
5904 time spent executing operating system routines on behalf of the program.
5905 Both numbers are in seconds.
5907 With the specification of an output file, the output is appended to the
5908 named file, and it looks like this:
5911 0.12 0.01 cc1 @var{options}
5912 0.00 0.01 as @var{options}
5915 The ``user time'' and the ``system time'' are moved before the program
5916 name, and the options passed to the program are displayed, so that one
5917 can later tell what file was being compiled, and with which options.
5919 @item -fvar-tracking
5920 @opindex fvar-tracking
5921 Run variable tracking pass. It computes where variables are stored at each
5922 position in code. Better debugging information is then generated
5923 (if the debugging information format supports this information).
5925 It is enabled by default when compiling with optimization (@option{-Os},
5926 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5927 the debug info format supports it.
5929 @item -fvar-tracking-assignments
5930 @opindex fvar-tracking-assignments
5931 @opindex fno-var-tracking-assignments
5932 Annotate assignments to user variables early in the compilation and
5933 attempt to carry the annotations over throughout the compilation all the
5934 way to the end, in an attempt to improve debug information while
5935 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
5937 It can be enabled even if var-tracking is disabled, in which case
5938 annotations will be created and maintained, but discarded at the end.
5940 @item -fvar-tracking-assignments-toggle
5941 @opindex fvar-tracking-assignments-toggle
5942 @opindex fno-var-tracking-assignments-toggle
5943 Toggle @option{-fvar-tracking-assignments}, in the same way that
5944 @option{-gtoggle} toggles @option{-g}.
5946 @item -print-file-name=@var{library}
5947 @opindex print-file-name
5948 Print the full absolute name of the library file @var{library} that
5949 would be used when linking---and don't do anything else. With this
5950 option, GCC does not compile or link anything; it just prints the
5953 @item -print-multi-directory
5954 @opindex print-multi-directory
5955 Print the directory name corresponding to the multilib selected by any
5956 other switches present in the command line. This directory is supposed
5957 to exist in @env{GCC_EXEC_PREFIX}.
5959 @item -print-multi-lib
5960 @opindex print-multi-lib
5961 Print the mapping from multilib directory names to compiler switches
5962 that enable them. The directory name is separated from the switches by
5963 @samp{;}, and each switch starts with an @samp{@@} instead of the
5964 @samp{-}, without spaces between multiple switches. This is supposed to
5965 ease shell-processing.
5967 @item -print-multi-os-directory
5968 @opindex print-multi-os-directory
5969 Print the path to OS libraries for the selected
5970 multilib, relative to some @file{lib} subdirectory. If OS libraries are
5971 present in the @file{lib} subdirectory and no multilibs are used, this is
5972 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
5973 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
5974 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
5975 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
5977 @item -print-prog-name=@var{program}
5978 @opindex print-prog-name
5979 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
5981 @item -print-libgcc-file-name
5982 @opindex print-libgcc-file-name
5983 Same as @option{-print-file-name=libgcc.a}.
5985 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
5986 but you do want to link with @file{libgcc.a}. You can do
5989 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
5992 @item -print-search-dirs
5993 @opindex print-search-dirs
5994 Print the name of the configured installation directory and a list of
5995 program and library directories @command{gcc} will search---and don't do anything else.
5997 This is useful when @command{gcc} prints the error message
5998 @samp{installation problem, cannot exec cpp0: No such file or directory}.
5999 To resolve this you either need to put @file{cpp0} and the other compiler
6000 components where @command{gcc} expects to find them, or you can set the environment
6001 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
6002 Don't forget the trailing @samp{/}.
6003 @xref{Environment Variables}.
6005 @item -print-sysroot
6006 @opindex print-sysroot
6007 Print the target sysroot directory that will be used during
6008 compilation. This is the target sysroot specified either at configure
6009 time or using the @option{--sysroot} option, possibly with an extra
6010 suffix that depends on compilation options. If no target sysroot is
6011 specified, the option prints nothing.
6013 @item -print-sysroot-headers-suffix
6014 @opindex print-sysroot-headers-suffix
6015 Print the suffix added to the target sysroot when searching for
6016 headers, or give an error if the compiler is not configured with such
6017 a suffix---and don't do anything else.
6020 @opindex dumpmachine
6021 Print the compiler's target machine (for example,
6022 @samp{i686-pc-linux-gnu})---and don't do anything else.
6025 @opindex dumpversion
6026 Print the compiler version (for example, @samp{3.0})---and don't do
6031 Print the compiler's built-in specs---and don't do anything else. (This
6032 is used when GCC itself is being built.) @xref{Spec Files}.
6034 @item -feliminate-unused-debug-types
6035 @opindex feliminate-unused-debug-types
6036 Normally, when producing DWARF2 output, GCC will emit debugging
6037 information for all types declared in a compilation
6038 unit, regardless of whether or not they are actually used
6039 in that compilation unit. Sometimes this is useful, such as
6040 if, in the debugger, you want to cast a value to a type that is
6041 not actually used in your program (but is declared). More often,
6042 however, this results in a significant amount of wasted space.
6043 With this option, GCC will avoid producing debug symbol output
6044 for types that are nowhere used in the source file being compiled.
6047 @node Optimize Options
6048 @section Options That Control Optimization
6049 @cindex optimize options
6050 @cindex options, optimization
6052 These options control various sorts of optimizations.
6054 Without any optimization option, the compiler's goal is to reduce the
6055 cost of compilation and to make debugging produce the expected
6056 results. Statements are independent: if you stop the program with a
6057 breakpoint between statements, you can then assign a new value to any
6058 variable or change the program counter to any other statement in the
6059 function and get exactly the results you would expect from the source
6062 Turning on optimization flags makes the compiler attempt to improve
6063 the performance and/or code size at the expense of compilation time
6064 and possibly the ability to debug the program.
6066 The compiler performs optimization based on the knowledge it has of the
6067 program. Compiling multiple files at once to a single output file mode allows
6068 the compiler to use information gained from all of the files when compiling
6071 Not all optimizations are controlled directly by a flag. Only
6072 optimizations that have a flag are listed in this section.
6074 Most optimizations are only enabled if an @option{-O} level is set on
6075 the command line. Otherwise they are disabled, even if individual
6076 optimization flags are specified.
6078 Depending on the target and how GCC was configured, a slightly different
6079 set of optimizations may be enabled at each @option{-O} level than
6080 those listed here. You can invoke GCC with @samp{-Q --help=optimizers}
6081 to find out the exact set of optimizations that are enabled at each level.
6082 @xref{Overall Options}, for examples.
6089 Optimize. Optimizing compilation takes somewhat more time, and a lot
6090 more memory for a large function.
6092 With @option{-O}, the compiler tries to reduce code size and execution
6093 time, without performing any optimizations that take a great deal of
6096 @option{-O} turns on the following optimization flags:
6100 -fcprop-registers @gol
6103 -fdelayed-branch @gol
6105 -fguess-branch-probability @gol
6106 -fif-conversion2 @gol
6107 -fif-conversion @gol
6108 -fipa-pure-const @gol
6110 -fipa-reference @gol
6112 -fsplit-wide-types @gol
6114 -ftree-builtin-call-dce @gol
6117 -ftree-copyrename @gol
6119 -ftree-dominator-opts @gol
6121 -ftree-forwprop @gol
6129 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6130 where doing so does not interfere with debugging.
6134 Optimize even more. GCC performs nearly all supported optimizations
6135 that do not involve a space-speed tradeoff.
6136 As compared to @option{-O}, this option increases both compilation time
6137 and the performance of the generated code.
6139 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6140 also turns on the following optimization flags:
6141 @gccoptlist{-fthread-jumps @gol
6142 -falign-functions -falign-jumps @gol
6143 -falign-loops -falign-labels @gol
6146 -fcse-follow-jumps -fcse-skip-blocks @gol
6147 -fdelete-null-pointer-checks @gol
6149 -fexpensive-optimizations @gol
6150 -fgcse -fgcse-lm @gol
6151 -finline-small-functions @gol
6152 -findirect-inlining @gol
6154 -foptimize-sibling-calls @gol
6155 -fpartial-inlining @gol
6158 -freorder-blocks -freorder-functions @gol
6159 -frerun-cse-after-loop @gol
6160 -fsched-interblock -fsched-spec @gol
6161 -fschedule-insns -fschedule-insns2 @gol
6162 -fstrict-aliasing -fstrict-overflow @gol
6163 -ftree-switch-conversion -ftree-tail-merge @gol
6167 Please note the warning under @option{-fgcse} about
6168 invoking @option{-O2} on programs that use computed gotos.
6172 Optimize yet more. @option{-O3} turns on all optimizations specified
6173 by @option{-O2} and also turns on the @option{-finline-functions},
6174 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6175 @option{-fgcse-after-reload}, @option{-ftree-vectorize} and
6176 @option{-fipa-cp-clone} options.
6180 Reduce compilation time and make debugging produce the expected
6181 results. This is the default.
6185 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6186 do not typically increase code size. It also performs further
6187 optimizations designed to reduce code size.
6189 @option{-Os} disables the following optimization flags:
6190 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6191 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
6192 -fprefetch-loop-arrays -ftree-vect-loop-version}
6196 Disregard strict standards compliance. @option{-Ofast} enables all
6197 @option{-O3} optimizations. It also enables optimizations that are not
6198 valid for all standard compliant programs.
6199 It turns on @option{-ffast-math} and the Fortran-specific
6200 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6202 If you use multiple @option{-O} options, with or without level numbers,
6203 the last such option is the one that is effective.
6206 Options of the form @option{-f@var{flag}} specify machine-independent
6207 flags. Most flags have both positive and negative forms; the negative
6208 form of @option{-ffoo} would be @option{-fno-foo}. In the table
6209 below, only one of the forms is listed---the one you typically will
6210 use. You can figure out the other form by either removing @samp{no-}
6213 The following options control specific optimizations. They are either
6214 activated by @option{-O} options or are related to ones that are. You
6215 can use the following flags in the rare cases when ``fine-tuning'' of
6216 optimizations to be performed is desired.
6219 @item -fno-default-inline
6220 @opindex fno-default-inline
6221 Do not make member functions inline by default merely because they are
6222 defined inside the class scope (C++ only). Otherwise, when you specify
6223 @w{@option{-O}}, member functions defined inside class scope are compiled
6224 inline by default; i.e., you don't need to add @samp{inline} in front of
6225 the member function name.
6227 @item -fno-defer-pop
6228 @opindex fno-defer-pop
6229 Always pop the arguments to each function call as soon as that function
6230 returns. For machines which must pop arguments after a function call,
6231 the compiler normally lets arguments accumulate on the stack for several
6232 function calls and pops them all at once.
6234 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6236 @item -fforward-propagate
6237 @opindex fforward-propagate
6238 Perform a forward propagation pass on RTL@. The pass tries to combine two
6239 instructions and checks if the result can be simplified. If loop unrolling
6240 is active, two passes are performed and the second is scheduled after
6243 This option is enabled by default at optimization levels @option{-O},
6244 @option{-O2}, @option{-O3}, @option{-Os}.
6246 @item -ffp-contract=@var{style}
6247 @opindex ffp-contract
6248 @option{-ffp-contract=off} disables floating-point expression contraction.
6249 @option{-ffp-contract=fast} enables floating-point expression contraction
6250 such as forming of fused multiply-add operations if the target has
6251 native support for them.
6252 @option{-ffp-contract=on} enables floating-point expression contraction
6253 if allowed by the language standard. This is currently not implemented
6254 and treated equal to @option{-ffp-contract=off}.
6256 The default is @option{-ffp-contract=fast}.
6258 @item -fomit-frame-pointer
6259 @opindex fomit-frame-pointer
6260 Don't keep the frame pointer in a register for functions that
6261 don't need one. This avoids the instructions to save, set up and
6262 restore frame pointers; it also makes an extra register available
6263 in many functions. @strong{It also makes debugging impossible on
6266 On some machines, such as the VAX, this flag has no effect, because
6267 the standard calling sequence automatically handles the frame pointer
6268 and nothing is saved by pretending it doesn't exist. The
6269 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6270 whether a target machine supports this flag. @xref{Registers,,Register
6271 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6273 Starting with GCC version 4.6, the default setting (when not optimizing for
6274 size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to
6275 @option{-fomit-frame-pointer}. The default can be reverted to
6276 @option{-fno-omit-frame-pointer} by configuring GCC with the
6277 @option{--enable-frame-pointer} configure option.
6279 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6281 @item -foptimize-sibling-calls
6282 @opindex foptimize-sibling-calls
6283 Optimize sibling and tail recursive calls.
6285 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6289 Don't pay attention to the @code{inline} keyword. Normally this option
6290 is used to keep the compiler from expanding any functions inline.
6291 Note that if you are not optimizing, no functions can be expanded inline.
6293 @item -finline-small-functions
6294 @opindex finline-small-functions
6295 Integrate functions into their callers when their body is smaller than expected
6296 function call code (so overall size of program gets smaller). The compiler
6297 heuristically decides which functions are simple enough to be worth integrating
6300 Enabled at level @option{-O2}.
6302 @item -findirect-inlining
6303 @opindex findirect-inlining
6304 Inline also indirect calls that are discovered to be known at compile
6305 time thanks to previous inlining. This option has any effect only
6306 when inlining itself is turned on by the @option{-finline-functions}
6307 or @option{-finline-small-functions} options.
6309 Enabled at level @option{-O2}.
6311 @item -finline-functions
6312 @opindex finline-functions
6313 Integrate all simple functions into their callers. The compiler
6314 heuristically decides which functions are simple enough to be worth
6315 integrating in this way.
6317 If all calls to a given function are integrated, and the function is
6318 declared @code{static}, then the function is normally not output as
6319 assembler code in its own right.
6321 Enabled at level @option{-O3}.
6323 @item -finline-functions-called-once
6324 @opindex finline-functions-called-once
6325 Consider all @code{static} functions called once for inlining into their
6326 caller even if they are not marked @code{inline}. If a call to a given
6327 function is integrated, then the function is not output as assembler code
6330 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6332 @item -fearly-inlining
6333 @opindex fearly-inlining
6334 Inline functions marked by @code{always_inline} and functions whose body seems
6335 smaller than the function call overhead early before doing
6336 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6337 makes profiling significantly cheaper and usually inlining faster on programs
6338 having large chains of nested wrapper functions.
6344 Perform interprocedural scalar replacement of aggregates, removal of
6345 unused parameters and replacement of parameters passed by reference
6346 by parameters passed by value.
6348 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6350 @item -finline-limit=@var{n}
6351 @opindex finline-limit
6352 By default, GCC limits the size of functions that can be inlined. This flag
6353 allows coarse control of this limit. @var{n} is the size of functions that
6354 can be inlined in number of pseudo instructions.
6356 Inlining is actually controlled by a number of parameters, which may be
6357 specified individually by using @option{--param @var{name}=@var{value}}.
6358 The @option{-finline-limit=@var{n}} option sets some of these parameters
6362 @item max-inline-insns-single
6363 is set to @var{n}/2.
6364 @item max-inline-insns-auto
6365 is set to @var{n}/2.
6368 See below for a documentation of the individual
6369 parameters controlling inlining and for the defaults of these parameters.
6371 @emph{Note:} there may be no value to @option{-finline-limit} that results
6372 in default behavior.
6374 @emph{Note:} pseudo instruction represents, in this particular context, an
6375 abstract measurement of function's size. In no way does it represent a count
6376 of assembly instructions and as such its exact meaning might change from one
6377 release to an another.
6379 @item -fno-keep-inline-dllexport
6380 @opindex -fno-keep-inline-dllexport
6381 This is a more fine-grained version of @option{-fkeep-inline-functions},
6382 which applies only to functions that are declared using the @code{dllexport}
6383 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6386 @item -fkeep-inline-functions
6387 @opindex fkeep-inline-functions
6388 In C, emit @code{static} functions that are declared @code{inline}
6389 into the object file, even if the function has been inlined into all
6390 of its callers. This switch does not affect functions using the
6391 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6392 inline functions into the object file.
6394 @item -fkeep-static-consts
6395 @opindex fkeep-static-consts
6396 Emit variables declared @code{static const} when optimization isn't turned
6397 on, even if the variables aren't referenced.
6399 GCC enables this option by default. If you want to force the compiler to
6400 check if the variable was referenced, regardless of whether or not
6401 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6403 @item -fmerge-constants
6404 @opindex fmerge-constants
6405 Attempt to merge identical constants (string constants and floating point
6406 constants) across compilation units.
6408 This option is the default for optimized compilation if the assembler and
6409 linker support it. Use @option{-fno-merge-constants} to inhibit this
6412 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6414 @item -fmerge-all-constants
6415 @opindex fmerge-all-constants
6416 Attempt to merge identical constants and identical variables.
6418 This option implies @option{-fmerge-constants}. In addition to
6419 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6420 arrays or initialized constant variables with integral or floating point
6421 types. Languages like C or C++ require each variable, including multiple
6422 instances of the same variable in recursive calls, to have distinct locations,
6423 so using this option will result in non-conforming
6426 @item -fmodulo-sched
6427 @opindex fmodulo-sched
6428 Perform swing modulo scheduling immediately before the first scheduling
6429 pass. This pass looks at innermost loops and reorders their
6430 instructions by overlapping different iterations.
6432 @item -fmodulo-sched-allow-regmoves
6433 @opindex fmodulo-sched-allow-regmoves
6434 Perform more aggressive SMS based modulo scheduling with register moves
6435 allowed. By setting this flag certain anti-dependences edges will be
6436 deleted which will trigger the generation of reg-moves based on the
6437 life-range analysis. This option is effective only with
6438 @option{-fmodulo-sched} enabled.
6440 @item -fno-branch-count-reg
6441 @opindex fno-branch-count-reg
6442 Do not use ``decrement and branch'' instructions on a count register,
6443 but instead generate a sequence of instructions that decrement a
6444 register, compare it against zero, then branch based upon the result.
6445 This option is only meaningful on architectures that support such
6446 instructions, which include x86, PowerPC, IA-64 and S/390.
6448 The default is @option{-fbranch-count-reg}.
6450 @item -fno-function-cse
6451 @opindex fno-function-cse
6452 Do not put function addresses in registers; make each instruction that
6453 calls a constant function contain the function's address explicitly.
6455 This option results in less efficient code, but some strange hacks
6456 that alter the assembler output may be confused by the optimizations
6457 performed when this option is not used.
6459 The default is @option{-ffunction-cse}
6461 @item -fno-zero-initialized-in-bss
6462 @opindex fno-zero-initialized-in-bss
6463 If the target supports a BSS section, GCC by default puts variables that
6464 are initialized to zero into BSS@. This can save space in the resulting
6467 This option turns off this behavior because some programs explicitly
6468 rely on variables going to the data section. E.g., so that the
6469 resulting executable can find the beginning of that section and/or make
6470 assumptions based on that.
6472 The default is @option{-fzero-initialized-in-bss}.
6474 @item -fmudflap -fmudflapth -fmudflapir
6478 @cindex bounds checking
6480 For front-ends that support it (C and C++), instrument all risky
6481 pointer/array dereferencing operations, some standard library
6482 string/heap functions, and some other associated constructs with
6483 range/validity tests. Modules so instrumented should be immune to
6484 buffer overflows, invalid heap use, and some other classes of C/C++
6485 programming errors. The instrumentation relies on a separate runtime
6486 library (@file{libmudflap}), which will be linked into a program if
6487 @option{-fmudflap} is given at link time. Run-time behavior of the
6488 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
6489 environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
6492 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
6493 link if your program is multi-threaded. Use @option{-fmudflapir}, in
6494 addition to @option{-fmudflap} or @option{-fmudflapth}, if
6495 instrumentation should ignore pointer reads. This produces less
6496 instrumentation (and therefore faster execution) and still provides
6497 some protection against outright memory corrupting writes, but allows
6498 erroneously read data to propagate within a program.
6500 @item -fthread-jumps
6501 @opindex fthread-jumps
6502 Perform optimizations where we check to see if a jump branches to a
6503 location where another comparison subsumed by the first is found. If
6504 so, the first branch is redirected to either the destination of the
6505 second branch or a point immediately following it, depending on whether
6506 the condition is known to be true or false.
6508 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6510 @item -fsplit-wide-types
6511 @opindex fsplit-wide-types
6512 When using a type that occupies multiple registers, such as @code{long
6513 long} on a 32-bit system, split the registers apart and allocate them
6514 independently. This normally generates better code for those types,
6515 but may make debugging more difficult.
6517 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6520 @item -fcse-follow-jumps
6521 @opindex fcse-follow-jumps
6522 In common subexpression elimination (CSE), scan through jump instructions
6523 when the target of the jump is not reached by any other path. For
6524 example, when CSE encounters an @code{if} statement with an
6525 @code{else} clause, CSE will follow the jump when the condition
6528 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6530 @item -fcse-skip-blocks
6531 @opindex fcse-skip-blocks
6532 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6533 follow jumps which conditionally skip over blocks. When CSE
6534 encounters a simple @code{if} statement with no else clause,
6535 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6536 body of the @code{if}.
6538 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6540 @item -frerun-cse-after-loop
6541 @opindex frerun-cse-after-loop
6542 Re-run common subexpression elimination after loop optimizations has been
6545 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6549 Perform a global common subexpression elimination pass.
6550 This pass also performs global constant and copy propagation.
6552 @emph{Note:} When compiling a program using computed gotos, a GCC
6553 extension, you may get better runtime performance if you disable
6554 the global common subexpression elimination pass by adding
6555 @option{-fno-gcse} to the command line.
6557 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6561 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
6562 attempt to move loads which are only killed by stores into themselves. This
6563 allows a loop containing a load/store sequence to be changed to a load outside
6564 the loop, and a copy/store within the loop.
6566 Enabled by default when gcse is enabled.
6570 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6571 global common subexpression elimination. This pass will attempt to move
6572 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6573 loops containing a load/store sequence can be changed to a load before
6574 the loop and a store after the loop.
6576 Not enabled at any optimization level.
6580 When @option{-fgcse-las} is enabled, the global common subexpression
6581 elimination pass eliminates redundant loads that come after stores to the
6582 same memory location (both partial and full redundancies).
6584 Not enabled at any optimization level.
6586 @item -fgcse-after-reload
6587 @opindex fgcse-after-reload
6588 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6589 pass is performed after reload. The purpose of this pass is to cleanup
6592 @item -funsafe-loop-optimizations
6593 @opindex funsafe-loop-optimizations
6594 If given, the loop optimizer will assume that loop indices do not
6595 overflow, and that the loops with nontrivial exit condition are not
6596 infinite. This enables a wider range of loop optimizations even if
6597 the loop optimizer itself cannot prove that these assumptions are valid.
6598 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
6599 if it finds this kind of loop.
6601 @item -fcrossjumping
6602 @opindex fcrossjumping
6603 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
6604 resulting code may or may not perform better than without cross-jumping.
6606 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6608 @item -fauto-inc-dec
6609 @opindex fauto-inc-dec
6610 Combine increments or decrements of addresses with memory accesses.
6611 This pass is always skipped on architectures that do not have
6612 instructions to support this. Enabled by default at @option{-O} and
6613 higher on architectures that support this.
6617 Perform dead code elimination (DCE) on RTL@.
6618 Enabled by default at @option{-O} and higher.
6622 Perform dead store elimination (DSE) on RTL@.
6623 Enabled by default at @option{-O} and higher.
6625 @item -fif-conversion
6626 @opindex fif-conversion
6627 Attempt to transform conditional jumps into branch-less equivalents. This
6628 include use of conditional moves, min, max, set flags and abs instructions, and
6629 some tricks doable by standard arithmetics. The use of conditional execution
6630 on chips where it is available is controlled by @code{if-conversion2}.
6632 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6634 @item -fif-conversion2
6635 @opindex fif-conversion2
6636 Use conditional execution (where available) to transform conditional jumps into
6637 branch-less equivalents.
6639 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6641 @item -fdelete-null-pointer-checks
6642 @opindex fdelete-null-pointer-checks
6643 Assume that programs cannot safely dereference null pointers, and that
6644 no code or data element resides there. This enables simple constant
6645 folding optimizations at all optimization levels. In addition, other
6646 optimization passes in GCC use this flag to control global dataflow
6647 analyses that eliminate useless checks for null pointers; these assume
6648 that if a pointer is checked after it has already been dereferenced,
6651 Note however that in some environments this assumption is not true.
6652 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6653 for programs which depend on that behavior.
6655 Some targets, especially embedded ones, disable this option at all levels.
6656 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
6657 @option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
6658 are enabled independently at different optimization levels.
6660 @item -fdevirtualize
6661 @opindex fdevirtualize
6662 Attempt to convert calls to virtual functions to direct calls. This
6663 is done both within a procedure and interprocedurally as part of
6664 indirect inlining (@code{-findirect-inlining}) and interprocedural constant
6665 propagation (@option{-fipa-cp}).
6666 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6668 @item -fexpensive-optimizations
6669 @opindex fexpensive-optimizations
6670 Perform a number of minor optimizations that are relatively expensive.
6672 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6674 @item -foptimize-register-move
6676 @opindex foptimize-register-move
6678 Attempt to reassign register numbers in move instructions and as
6679 operands of other simple instructions in order to maximize the amount of
6680 register tying. This is especially helpful on machines with two-operand
6683 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
6686 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6688 @item -fira-algorithm=@var{algorithm}
6689 Use specified coloring algorithm for the integrated register
6690 allocator. The @var{algorithm} argument should be @code{priority} or
6691 @code{CB}. The first algorithm specifies Chow's priority coloring,
6692 the second one specifies Chaitin-Briggs coloring. The second
6693 algorithm can be unimplemented for some architectures. If it is
6694 implemented, it is the default because Chaitin-Briggs coloring as a
6695 rule generates a better code.
6697 @item -fira-region=@var{region}
6698 Use specified regions for the integrated register allocator. The
6699 @var{region} argument should be one of @code{all}, @code{mixed}, or
6700 @code{one}. The first value means using all loops as register
6701 allocation regions, the second value which is the default means using
6702 all loops except for loops with small register pressure as the
6703 regions, and third one means using all function as a single region.
6704 The first value can give best result for machines with small size and
6705 irregular register set, the third one results in faster and generates
6706 decent code and the smallest size code, and the default value usually
6707 give the best results in most cases and for most architectures.
6709 @item -fira-loop-pressure
6710 @opindex fira-loop-pressure
6711 Use IRA to evaluate register pressure in loops for decision to move
6712 loop invariants. Usage of this option usually results in generation
6713 of faster and smaller code on machines with big register files (>= 32
6714 registers) but it can slow compiler down.
6716 This option is enabled at level @option{-O3} for some targets.
6718 @item -fno-ira-share-save-slots
6719 @opindex fno-ira-share-save-slots
6720 Switch off sharing stack slots used for saving call used hard
6721 registers living through a call. Each hard register will get a
6722 separate stack slot and as a result function stack frame will be
6725 @item -fno-ira-share-spill-slots
6726 @opindex fno-ira-share-spill-slots
6727 Switch off sharing stack slots allocated for pseudo-registers. Each
6728 pseudo-register which did not get a hard register will get a separate
6729 stack slot and as a result function stack frame will be bigger.
6731 @item -fira-verbose=@var{n}
6732 @opindex fira-verbose
6733 Set up how verbose dump file for the integrated register allocator
6734 will be. Default value is 5. If the value is greater or equal to 10,
6735 the dump file will be stderr as if the value were @var{n} minus 10.
6737 @item -fdelayed-branch
6738 @opindex fdelayed-branch
6739 If supported for the target machine, attempt to reorder instructions
6740 to exploit instruction slots available after delayed branch
6743 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6745 @item -fschedule-insns
6746 @opindex fschedule-insns
6747 If supported for the target machine, attempt to reorder instructions to
6748 eliminate execution stalls due to required data being unavailable. This
6749 helps machines that have slow floating point or memory load instructions
6750 by allowing other instructions to be issued until the result of the load
6751 or floating point instruction is required.
6753 Enabled at levels @option{-O2}, @option{-O3}.
6755 @item -fschedule-insns2
6756 @opindex fschedule-insns2
6757 Similar to @option{-fschedule-insns}, but requests an additional pass of
6758 instruction scheduling after register allocation has been done. This is
6759 especially useful on machines with a relatively small number of
6760 registers and where memory load instructions take more than one cycle.
6762 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6764 @item -fno-sched-interblock
6765 @opindex fno-sched-interblock
6766 Don't schedule instructions across basic blocks. This is normally
6767 enabled by default when scheduling before register allocation, i.e.@:
6768 with @option{-fschedule-insns} or at @option{-O2} or higher.
6770 @item -fno-sched-spec
6771 @opindex fno-sched-spec
6772 Don't allow speculative motion of non-load instructions. This is normally
6773 enabled by default when scheduling before register allocation, i.e.@:
6774 with @option{-fschedule-insns} or at @option{-O2} or higher.
6776 @item -fsched-pressure
6777 @opindex fsched-pressure
6778 Enable register pressure sensitive insn scheduling before the register
6779 allocation. This only makes sense when scheduling before register
6780 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
6781 @option{-O2} or higher. Usage of this option can improve the
6782 generated code and decrease its size by preventing register pressure
6783 increase above the number of available hard registers and as a
6784 consequence register spills in the register allocation.
6786 @item -fsched-spec-load
6787 @opindex fsched-spec-load
6788 Allow speculative motion of some load instructions. This only makes
6789 sense when scheduling before register allocation, i.e.@: with
6790 @option{-fschedule-insns} or at @option{-O2} or higher.
6792 @item -fsched-spec-load-dangerous
6793 @opindex fsched-spec-load-dangerous
6794 Allow speculative motion of more load instructions. This only makes
6795 sense when scheduling before register allocation, i.e.@: with
6796 @option{-fschedule-insns} or at @option{-O2} or higher.
6798 @item -fsched-stalled-insns
6799 @itemx -fsched-stalled-insns=@var{n}
6800 @opindex fsched-stalled-insns
6801 Define how many insns (if any) can be moved prematurely from the queue
6802 of stalled insns into the ready list, during the second scheduling pass.
6803 @option{-fno-sched-stalled-insns} means that no insns will be moved
6804 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6805 on how many queued insns can be moved prematurely.
6806 @option{-fsched-stalled-insns} without a value is equivalent to
6807 @option{-fsched-stalled-insns=1}.
6809 @item -fsched-stalled-insns-dep
6810 @itemx -fsched-stalled-insns-dep=@var{n}
6811 @opindex fsched-stalled-insns-dep
6812 Define how many insn groups (cycles) will be examined for a dependency
6813 on a stalled insn that is candidate for premature removal from the queue
6814 of stalled insns. This has an effect only during the second scheduling pass,
6815 and only if @option{-fsched-stalled-insns} is used.
6816 @option{-fno-sched-stalled-insns-dep} is equivalent to
6817 @option{-fsched-stalled-insns-dep=0}.
6818 @option{-fsched-stalled-insns-dep} without a value is equivalent to
6819 @option{-fsched-stalled-insns-dep=1}.
6821 @item -fsched2-use-superblocks
6822 @opindex fsched2-use-superblocks
6823 When scheduling after register allocation, do use superblock scheduling
6824 algorithm. Superblock scheduling allows motion across basic block boundaries
6825 resulting on faster schedules. This option is experimental, as not all machine
6826 descriptions used by GCC model the CPU closely enough to avoid unreliable
6827 results from the algorithm.
6829 This only makes sense when scheduling after register allocation, i.e.@: with
6830 @option{-fschedule-insns2} or at @option{-O2} or higher.
6832 @item -fsched-group-heuristic
6833 @opindex fsched-group-heuristic
6834 Enable the group heuristic in the scheduler. This heuristic favors
6835 the instruction that belongs to a schedule group. This is enabled
6836 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6837 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6839 @item -fsched-critical-path-heuristic
6840 @opindex fsched-critical-path-heuristic
6841 Enable the critical-path heuristic in the scheduler. This heuristic favors
6842 instructions on the critical path. This is enabled by default when
6843 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6844 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6846 @item -fsched-spec-insn-heuristic
6847 @opindex fsched-spec-insn-heuristic
6848 Enable the speculative instruction heuristic in the scheduler. This
6849 heuristic favors speculative instructions with greater dependency weakness.
6850 This is enabled by default when scheduling is enabled, i.e.@:
6851 with @option{-fschedule-insns} or @option{-fschedule-insns2}
6852 or at @option{-O2} or higher.
6854 @item -fsched-rank-heuristic
6855 @opindex fsched-rank-heuristic
6856 Enable the rank heuristic in the scheduler. This heuristic favors
6857 the instruction belonging to a basic block with greater size or frequency.
6858 This is enabled by default when scheduling is enabled, i.e.@:
6859 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6860 at @option{-O2} or higher.
6862 @item -fsched-last-insn-heuristic
6863 @opindex fsched-last-insn-heuristic
6864 Enable the last-instruction heuristic in the scheduler. This heuristic
6865 favors the instruction that is less dependent on the last instruction
6866 scheduled. This is enabled by default when scheduling is enabled,
6867 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6868 at @option{-O2} or higher.
6870 @item -fsched-dep-count-heuristic
6871 @opindex fsched-dep-count-heuristic
6872 Enable the dependent-count heuristic in the scheduler. This heuristic
6873 favors the instruction that has more instructions depending on it.
6874 This is enabled by default when scheduling is enabled, i.e.@:
6875 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6876 at @option{-O2} or higher.
6878 @item -freschedule-modulo-scheduled-loops
6879 @opindex freschedule-modulo-scheduled-loops
6880 The modulo scheduling comes before the traditional scheduling, if a loop
6881 was modulo scheduled we may want to prevent the later scheduling passes
6882 from changing its schedule, we use this option to control that.
6884 @item -fselective-scheduling
6885 @opindex fselective-scheduling
6886 Schedule instructions using selective scheduling algorithm. Selective
6887 scheduling runs instead of the first scheduler pass.
6889 @item -fselective-scheduling2
6890 @opindex fselective-scheduling2
6891 Schedule instructions using selective scheduling algorithm. Selective
6892 scheduling runs instead of the second scheduler pass.
6894 @item -fsel-sched-pipelining
6895 @opindex fsel-sched-pipelining
6896 Enable software pipelining of innermost loops during selective scheduling.
6897 This option has no effect until one of @option{-fselective-scheduling} or
6898 @option{-fselective-scheduling2} is turned on.
6900 @item -fsel-sched-pipelining-outer-loops
6901 @opindex fsel-sched-pipelining-outer-loops
6902 When pipelining loops during selective scheduling, also pipeline outer loops.
6903 This option has no effect until @option{-fsel-sched-pipelining} is turned on.
6906 @opindex fshrink-wrap
6907 Emit function prologues only before parts of the function that need it,
6908 rather than at the top of the function. This flag is enabled by default at
6909 @option{-O} and higher.
6911 @item -fcaller-saves
6912 @opindex fcaller-saves
6913 Enable values to be allocated in registers that will be clobbered by
6914 function calls, by emitting extra instructions to save and restore the
6915 registers around such calls. Such allocation is done only when it
6916 seems to result in better code than would otherwise be produced.
6918 This option is always enabled by default on certain machines, usually
6919 those which have no call-preserved registers to use instead.
6921 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6923 @item -fcombine-stack-adjustments
6924 @opindex fcombine-stack-adjustments
6925 Tracks stack adjustments (pushes and pops) and stack memory references
6926 and then tries to find ways to combine them.
6928 Enabled by default at @option{-O1} and higher.
6930 @item -fconserve-stack
6931 @opindex fconserve-stack
6932 Attempt to minimize stack usage. The compiler will attempt to use less
6933 stack space, even if that makes the program slower. This option
6934 implies setting the @option{large-stack-frame} parameter to 100
6935 and the @option{large-stack-frame-growth} parameter to 400.
6937 @item -ftree-reassoc
6938 @opindex ftree-reassoc
6939 Perform reassociation on trees. This flag is enabled by default
6940 at @option{-O} and higher.
6944 Perform partial redundancy elimination (PRE) on trees. This flag is
6945 enabled by default at @option{-O2} and @option{-O3}.
6947 @item -ftree-forwprop
6948 @opindex ftree-forwprop
6949 Perform forward propagation on trees. This flag is enabled by default
6950 at @option{-O} and higher.
6954 Perform full redundancy elimination (FRE) on trees. The difference
6955 between FRE and PRE is that FRE only considers expressions
6956 that are computed on all paths leading to the redundant computation.
6957 This analysis is faster than PRE, though it exposes fewer redundancies.
6958 This flag is enabled by default at @option{-O} and higher.
6960 @item -ftree-phiprop
6961 @opindex ftree-phiprop
6962 Perform hoisting of loads from conditional pointers on trees. This
6963 pass is enabled by default at @option{-O} and higher.
6965 @item -ftree-copy-prop
6966 @opindex ftree-copy-prop
6967 Perform copy propagation on trees. This pass eliminates unnecessary
6968 copy operations. This flag is enabled by default at @option{-O} and
6971 @item -fipa-pure-const
6972 @opindex fipa-pure-const
6973 Discover which functions are pure or constant.
6974 Enabled by default at @option{-O} and higher.
6976 @item -fipa-reference
6977 @opindex fipa-reference
6978 Discover which static variables do not escape cannot escape the
6980 Enabled by default at @option{-O} and higher.
6984 Perform interprocedural pointer analysis and interprocedural modification
6985 and reference analysis. This option can cause excessive memory and
6986 compile-time usage on large compilation units. It is not enabled by
6987 default at any optimization level.
6990 @opindex fipa-profile
6991 Perform interprocedural profile propagation. The functions called only from
6992 cold functions are marked as cold. Also functions executed once (such as
6993 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
6994 functions and loop less parts of functions executed once are then optimized for
6996 Enabled by default at @option{-O} and higher.
7000 Perform interprocedural constant propagation.
7001 This optimization analyzes the program to determine when values passed
7002 to functions are constants and then optimizes accordingly.
7003 This optimization can substantially increase performance
7004 if the application has constants passed to functions.
7005 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7007 @item -fipa-cp-clone
7008 @opindex fipa-cp-clone
7009 Perform function cloning to make interprocedural constant propagation stronger.
7010 When enabled, interprocedural constant propagation will perform function cloning
7011 when externally visible function can be called with constant arguments.
7012 Because this optimization can create multiple copies of functions,
7013 it may significantly increase code size
7014 (see @option{--param ipcp-unit-growth=@var{value}}).
7015 This flag is enabled by default at @option{-O3}.
7017 @item -fipa-matrix-reorg
7018 @opindex fipa-matrix-reorg
7019 Perform matrix flattening and transposing.
7020 Matrix flattening tries to replace an @math{m}-dimensional matrix
7021 with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
7022 This reduces the level of indirection needed for accessing the elements
7023 of the matrix. The second optimization is matrix transposing that
7024 attempts to change the order of the matrix's dimensions in order to
7025 improve cache locality.
7026 Both optimizations need the @option{-fwhole-program} flag.
7027 Transposing is enabled only if profiling information is available.
7031 Perform forward store motion on trees. This flag is
7032 enabled by default at @option{-O} and higher.
7034 @item -ftree-bit-ccp
7035 @opindex ftree-bit-ccp
7036 Perform sparse conditional bit constant propagation on trees and propagate
7037 pointer alignment information.
7038 This pass only operates on local scalar variables and is enabled by default
7039 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7043 Perform sparse conditional constant propagation (CCP) on trees. This
7044 pass only operates on local scalar variables and is enabled by default
7045 at @option{-O} and higher.
7047 @item -ftree-switch-conversion
7048 Perform conversion of simple initializations in a switch to
7049 initializations from a scalar array. This flag is enabled by default
7050 at @option{-O2} and higher.
7052 @item -ftree-tail-merge
7053 Look for identical code sequences. When found, replace one with a jump to the
7054 other. This optimization is known as tail merging or cross jumping. This flag
7055 is enabled by default at @option{-O2} and higher. The run time of this pass can
7056 be limited using @option{max-tail-merge-comparisons} parameter and
7057 @option{max-tail-merge-iterations} parameter.
7061 Perform dead code elimination (DCE) on trees. This flag is enabled by
7062 default at @option{-O} and higher.
7064 @item -ftree-builtin-call-dce
7065 @opindex ftree-builtin-call-dce
7066 Perform conditional dead code elimination (DCE) for calls to builtin functions
7067 that may set @code{errno} but are otherwise side-effect free. This flag is
7068 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7071 @item -ftree-dominator-opts
7072 @opindex ftree-dominator-opts
7073 Perform a variety of simple scalar cleanups (constant/copy
7074 propagation, redundancy elimination, range propagation and expression
7075 simplification) based on a dominator tree traversal. This also
7076 performs jump threading (to reduce jumps to jumps). This flag is
7077 enabled by default at @option{-O} and higher.
7081 Perform dead store elimination (DSE) on trees. A dead store is a store into
7082 a memory location which will later be overwritten by another store without
7083 any intervening loads. In this case the earlier store can be deleted. This
7084 flag is enabled by default at @option{-O} and higher.
7088 Perform loop header copying on trees. This is beneficial since it increases
7089 effectiveness of code motion optimizations. It also saves one jump. This flag
7090 is enabled by default at @option{-O} and higher. It is not enabled
7091 for @option{-Os}, since it usually increases code size.
7093 @item -ftree-loop-optimize
7094 @opindex ftree-loop-optimize
7095 Perform loop optimizations on trees. This flag is enabled by default
7096 at @option{-O} and higher.
7098 @item -ftree-loop-linear
7099 @opindex ftree-loop-linear
7100 Perform loop interchange transformations on tree. Same as
7101 @option{-floop-interchange}. To use this code transformation, GCC has
7102 to be configured with @option{--with-ppl} and @option{--with-cloog} to
7103 enable the Graphite loop transformation infrastructure.
7105 @item -floop-interchange
7106 @opindex floop-interchange
7107 Perform loop interchange transformations on loops. Interchanging two
7108 nested loops switches the inner and outer loops. For example, given a
7113 A(J, I) = A(J, I) * C
7117 loop interchange will transform the loop as if the user had written:
7121 A(J, I) = A(J, I) * C
7125 which can be beneficial when @code{N} is larger than the caches,
7126 because in Fortran, the elements of an array are stored in memory
7127 contiguously by column, and the original loop iterates over rows,
7128 potentially creating at each access a cache miss. This optimization
7129 applies to all the languages supported by GCC and is not limited to
7130 Fortran. To use this code transformation, GCC has to be configured
7131 with @option{--with-ppl} and @option{--with-cloog} to enable the
7132 Graphite loop transformation infrastructure.
7134 @item -floop-strip-mine
7135 @opindex floop-strip-mine
7136 Perform loop strip mining transformations on loops. Strip mining
7137 splits a loop into two nested loops. The outer loop has strides
7138 equal to the strip size and the inner loop has strides of the
7139 original loop within a strip. The strip length can be changed
7140 using the @option{loop-block-tile-size} parameter. For example,
7147 loop strip mining will transform the loop as if the user had written:
7150 DO I = II, min (II + 50, N)
7155 This optimization applies to all the languages supported by GCC and is
7156 not limited to Fortran. To use this code transformation, GCC has to
7157 be configured with @option{--with-ppl} and @option{--with-cloog} to
7158 enable the Graphite loop transformation infrastructure.
7161 @opindex floop-block
7162 Perform loop blocking transformations on loops. Blocking strip mines
7163 each loop in the loop nest such that the memory accesses of the
7164 element loops fit inside caches. The strip length can be changed
7165 using the @option{loop-block-tile-size} parameter. For example, given
7170 A(J, I) = B(I) + C(J)
7174 loop blocking will transform the loop as if the user had written:
7178 DO I = II, min (II + 50, N)
7179 DO J = JJ, min (JJ + 50, M)
7180 A(J, I) = B(I) + C(J)
7186 which can be beneficial when @code{M} is larger than the caches,
7187 because the innermost loop will iterate over a smaller amount of data
7188 that can be kept in the caches. This optimization applies to all the
7189 languages supported by GCC and is not limited to Fortran. To use this
7190 code transformation, GCC has to be configured with @option{--with-ppl}
7191 and @option{--with-cloog} to enable the Graphite loop transformation
7194 @item -fgraphite-identity
7195 @opindex fgraphite-identity
7196 Enable the identity transformation for graphite. For every SCoP we generate
7197 the polyhedral representation and transform it back to gimple. Using
7198 @option{-fgraphite-identity} we can check the costs or benefits of the
7199 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7200 are also performed by the code generator CLooG, like index splitting and
7201 dead code elimination in loops.
7203 @item -floop-flatten
7204 @opindex floop-flatten
7205 Removes the loop nesting structure: transforms the loop nest into a
7206 single loop. This transformation can be useful to vectorize all the
7207 levels of the loop nest.
7209 @item -floop-parallelize-all
7210 @opindex floop-parallelize-all
7211 Use the Graphite data dependence analysis to identify loops that can
7212 be parallelized. Parallelize all the loops that can be analyzed to
7213 not contain loop carried dependences without checking that it is
7214 profitable to parallelize the loops.
7216 @item -fcheck-data-deps
7217 @opindex fcheck-data-deps
7218 Compare the results of several data dependence analyzers. This option
7219 is used for debugging the data dependence analyzers.
7221 @item -ftree-loop-if-convert
7222 Attempt to transform conditional jumps in the innermost loops to
7223 branch-less equivalents. The intent is to remove control-flow from
7224 the innermost loops in order to improve the ability of the
7225 vectorization pass to handle these loops. This is enabled by default
7226 if vectorization is enabled.
7228 @item -ftree-loop-if-convert-stores
7229 Attempt to also if-convert conditional jumps containing memory writes.
7230 This transformation can be unsafe for multi-threaded programs as it
7231 transforms conditional memory writes into unconditional memory writes.
7234 for (i = 0; i < N; i++)
7238 would be transformed to
7240 for (i = 0; i < N; i++)
7241 A[i] = cond ? expr : A[i];
7243 potentially producing data races.
7245 @item -ftree-loop-distribution
7246 Perform loop distribution. This flag can improve cache performance on
7247 big loop bodies and allow further loop optimizations, like
7248 parallelization or vectorization, to take place. For example, the loop
7265 @item -ftree-loop-distribute-patterns
7266 Perform loop distribution of patterns that can be code generated with
7267 calls to a library. This flag is enabled by default at @option{-O3}.
7269 This pass distributes the initialization loops and generates a call to
7270 memset zero. For example, the loop
7286 and the initialization loop is transformed into a call to memset zero.
7288 @item -ftree-loop-im
7289 @opindex ftree-loop-im
7290 Perform loop invariant motion on trees. This pass moves only invariants that
7291 would be hard to handle at RTL level (function calls, operations that expand to
7292 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7293 operands of conditions that are invariant out of the loop, so that we can use
7294 just trivial invariantness analysis in loop unswitching. The pass also includes
7297 @item -ftree-loop-ivcanon
7298 @opindex ftree-loop-ivcanon
7299 Create a canonical counter for number of iterations in the loop for that
7300 determining number of iterations requires complicated analysis. Later
7301 optimizations then may determine the number easily. Useful especially
7302 in connection with unrolling.
7306 Perform induction variable optimizations (strength reduction, induction
7307 variable merging and induction variable elimination) on trees.
7309 @item -ftree-parallelize-loops=n
7310 @opindex ftree-parallelize-loops
7311 Parallelize loops, i.e., split their iteration space to run in n threads.
7312 This is only possible for loops whose iterations are independent
7313 and can be arbitrarily reordered. The optimization is only
7314 profitable on multiprocessor machines, for loops that are CPU-intensive,
7315 rather than constrained e.g.@: by memory bandwidth. This option
7316 implies @option{-pthread}, and thus is only supported on targets
7317 that have support for @option{-pthread}.
7321 Perform function-local points-to analysis on trees. This flag is
7322 enabled by default at @option{-O} and higher.
7326 Perform scalar replacement of aggregates. This pass replaces structure
7327 references with scalars to prevent committing structures to memory too
7328 early. This flag is enabled by default at @option{-O} and higher.
7330 @item -ftree-copyrename
7331 @opindex ftree-copyrename
7332 Perform copy renaming on trees. This pass attempts to rename compiler
7333 temporaries to other variables at copy locations, usually resulting in
7334 variable names which more closely resemble the original variables. This flag
7335 is enabled by default at @option{-O} and higher.
7339 Perform temporary expression replacement during the SSA->normal phase. Single
7340 use/single def temporaries are replaced at their use location with their
7341 defining expression. This results in non-GIMPLE code, but gives the expanders
7342 much more complex trees to work on resulting in better RTL generation. This is
7343 enabled by default at @option{-O} and higher.
7345 @item -ftree-vectorize
7346 @opindex ftree-vectorize
7347 Perform loop vectorization on trees. This flag is enabled by default at
7350 @item -ftree-slp-vectorize
7351 @opindex ftree-slp-vectorize
7352 Perform basic block vectorization on trees. This flag is enabled by default at
7353 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7355 @item -ftree-vect-loop-version
7356 @opindex ftree-vect-loop-version
7357 Perform loop versioning when doing loop vectorization on trees. When a loop
7358 appears to be vectorizable except that data alignment or data dependence cannot
7359 be determined at compile time then vectorized and non-vectorized versions of
7360 the loop are generated along with runtime checks for alignment or dependence
7361 to control which version is executed. This option is enabled by default
7362 except at level @option{-Os} where it is disabled.
7364 @item -fvect-cost-model
7365 @opindex fvect-cost-model
7366 Enable cost model for vectorization.
7370 Perform Value Range Propagation on trees. This is similar to the
7371 constant propagation pass, but instead of values, ranges of values are
7372 propagated. This allows the optimizers to remove unnecessary range
7373 checks like array bound checks and null pointer checks. This is
7374 enabled by default at @option{-O2} and higher. Null pointer check
7375 elimination is only done if @option{-fdelete-null-pointer-checks} is
7380 Perform tail duplication to enlarge superblock size. This transformation
7381 simplifies the control flow of the function allowing other optimizations to do
7384 @item -funroll-loops
7385 @opindex funroll-loops
7386 Unroll loops whose number of iterations can be determined at compile
7387 time or upon entry to the loop. @option{-funroll-loops} implies
7388 @option{-frerun-cse-after-loop}. This option makes code larger,
7389 and may or may not make it run faster.
7391 @item -funroll-all-loops
7392 @opindex funroll-all-loops
7393 Unroll all loops, even if their number of iterations is uncertain when
7394 the loop is entered. This usually makes programs run more slowly.
7395 @option{-funroll-all-loops} implies the same options as
7396 @option{-funroll-loops},
7398 @item -fsplit-ivs-in-unroller
7399 @opindex fsplit-ivs-in-unroller
7400 Enables expressing of values of induction variables in later iterations
7401 of the unrolled loop using the value in the first iteration. This breaks
7402 long dependency chains, thus improving efficiency of the scheduling passes.
7404 Combination of @option{-fweb} and CSE is often sufficient to obtain the
7405 same effect. However in cases the loop body is more complicated than
7406 a single basic block, this is not reliable. It also does not work at all
7407 on some of the architectures due to restrictions in the CSE pass.
7409 This optimization is enabled by default.
7411 @item -fvariable-expansion-in-unroller
7412 @opindex fvariable-expansion-in-unroller
7413 With this option, the compiler will create multiple copies of some
7414 local variables when unrolling a loop which can result in superior code.
7416 @item -fpartial-inlining
7417 @opindex fpartial-inlining
7418 Inline parts of functions. This option has any effect only
7419 when inlining itself is turned on by the @option{-finline-functions}
7420 or @option{-finline-small-functions} options.
7422 Enabled at level @option{-O2}.
7424 @item -fpredictive-commoning
7425 @opindex fpredictive-commoning
7426 Perform predictive commoning optimization, i.e., reusing computations
7427 (especially memory loads and stores) performed in previous
7428 iterations of loops.
7430 This option is enabled at level @option{-O3}.
7432 @item -fprefetch-loop-arrays
7433 @opindex fprefetch-loop-arrays
7434 If supported by the target machine, generate instructions to prefetch
7435 memory to improve the performance of loops that access large arrays.
7437 This option may generate better or worse code; results are highly
7438 dependent on the structure of loops within the source code.
7440 Disabled at level @option{-Os}.
7443 @itemx -fno-peephole2
7444 @opindex fno-peephole
7445 @opindex fno-peephole2
7446 Disable any machine-specific peephole optimizations. The difference
7447 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7448 are implemented in the compiler; some targets use one, some use the
7449 other, a few use both.
7451 @option{-fpeephole} is enabled by default.
7452 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7454 @item -fno-guess-branch-probability
7455 @opindex fno-guess-branch-probability
7456 Do not guess branch probabilities using heuristics.
7458 GCC will use heuristics to guess branch probabilities if they are
7459 not provided by profiling feedback (@option{-fprofile-arcs}). These
7460 heuristics are based on the control flow graph. If some branch probabilities
7461 are specified by @samp{__builtin_expect}, then the heuristics will be
7462 used to guess branch probabilities for the rest of the control flow graph,
7463 taking the @samp{__builtin_expect} info into account. The interactions
7464 between the heuristics and @samp{__builtin_expect} can be complex, and in
7465 some cases, it may be useful to disable the heuristics so that the effects
7466 of @samp{__builtin_expect} are easier to understand.
7468 The default is @option{-fguess-branch-probability} at levels
7469 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7471 @item -freorder-blocks
7472 @opindex freorder-blocks
7473 Reorder basic blocks in the compiled function in order to reduce number of
7474 taken branches and improve code locality.
7476 Enabled at levels @option{-O2}, @option{-O3}.
7478 @item -freorder-blocks-and-partition
7479 @opindex freorder-blocks-and-partition
7480 In addition to reordering basic blocks in the compiled function, in order
7481 to reduce number of taken branches, partitions hot and cold basic blocks
7482 into separate sections of the assembly and .o files, to improve
7483 paging and cache locality performance.
7485 This optimization is automatically turned off in the presence of
7486 exception handling, for linkonce sections, for functions with a user-defined
7487 section attribute and on any architecture that does not support named
7490 @item -freorder-functions
7491 @opindex freorder-functions
7492 Reorder functions in the object file in order to
7493 improve code locality. This is implemented by using special
7494 subsections @code{.text.hot} for most frequently executed functions and
7495 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7496 the linker so object file format must support named sections and linker must
7497 place them in a reasonable way.
7499 Also profile feedback must be available in to make this option effective. See
7500 @option{-fprofile-arcs} for details.
7502 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7504 @item -fstrict-aliasing
7505 @opindex fstrict-aliasing
7506 Allow the compiler to assume the strictest aliasing rules applicable to
7507 the language being compiled. For C (and C++), this activates
7508 optimizations based on the type of expressions. In particular, an
7509 object of one type is assumed never to reside at the same address as an
7510 object of a different type, unless the types are almost the same. For
7511 example, an @code{unsigned int} can alias an @code{int}, but not a
7512 @code{void*} or a @code{double}. A character type may alias any other
7515 @anchor{Type-punning}Pay special attention to code like this:
7528 The practice of reading from a different union member than the one most
7529 recently written to (called ``type-punning'') is common. Even with
7530 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7531 is accessed through the union type. So, the code above will work as
7532 expected. @xref{Structures unions enumerations and bit-fields
7533 implementation}. However, this code might not:
7544 Similarly, access by taking the address, casting the resulting pointer
7545 and dereferencing the result has undefined behavior, even if the cast
7546 uses a union type, e.g.:
7550 return ((union a_union *) &d)->i;
7554 The @option{-fstrict-aliasing} option is enabled at levels
7555 @option{-O2}, @option{-O3}, @option{-Os}.
7557 @item -fstrict-overflow
7558 @opindex fstrict-overflow
7559 Allow the compiler to assume strict signed overflow rules, depending
7560 on the language being compiled. For C (and C++) this means that
7561 overflow when doing arithmetic with signed numbers is undefined, which
7562 means that the compiler may assume that it will not happen. This
7563 permits various optimizations. For example, the compiler will assume
7564 that an expression like @code{i + 10 > i} will always be true for
7565 signed @code{i}. This assumption is only valid if signed overflow is
7566 undefined, as the expression is false if @code{i + 10} overflows when
7567 using twos complement arithmetic. When this option is in effect any
7568 attempt to determine whether an operation on signed numbers will
7569 overflow must be written carefully to not actually involve overflow.
7571 This option also allows the compiler to assume strict pointer
7572 semantics: given a pointer to an object, if adding an offset to that
7573 pointer does not produce a pointer to the same object, the addition is
7574 undefined. This permits the compiler to conclude that @code{p + u >
7575 p} is always true for a pointer @code{p} and unsigned integer
7576 @code{u}. This assumption is only valid because pointer wraparound is
7577 undefined, as the expression is false if @code{p + u} overflows using
7578 twos complement arithmetic.
7580 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7581 that integer signed overflow is fully defined: it wraps. When
7582 @option{-fwrapv} is used, there is no difference between
7583 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7584 integers. With @option{-fwrapv} certain types of overflow are
7585 permitted. For example, if the compiler gets an overflow when doing
7586 arithmetic on constants, the overflowed value can still be used with
7587 @option{-fwrapv}, but not otherwise.
7589 The @option{-fstrict-overflow} option is enabled at levels
7590 @option{-O2}, @option{-O3}, @option{-Os}.
7592 @item -falign-functions
7593 @itemx -falign-functions=@var{n}
7594 @opindex falign-functions
7595 Align the start of functions to the next power-of-two greater than
7596 @var{n}, skipping up to @var{n} bytes. For instance,
7597 @option{-falign-functions=32} aligns functions to the next 32-byte
7598 boundary, but @option{-falign-functions=24} would align to the next
7599 32-byte boundary only if this can be done by skipping 23 bytes or less.
7601 @option{-fno-align-functions} and @option{-falign-functions=1} are
7602 equivalent and mean that functions will not be aligned.
7604 Some assemblers only support this flag when @var{n} is a power of two;
7605 in that case, it is rounded up.
7607 If @var{n} is not specified or is zero, use a machine-dependent default.
7609 Enabled at levels @option{-O2}, @option{-O3}.
7611 @item -falign-labels
7612 @itemx -falign-labels=@var{n}
7613 @opindex falign-labels
7614 Align all branch targets to a power-of-two boundary, skipping up to
7615 @var{n} bytes like @option{-falign-functions}. This option can easily
7616 make code slower, because it must insert dummy operations for when the
7617 branch target is reached in the usual flow of the code.
7619 @option{-fno-align-labels} and @option{-falign-labels=1} are
7620 equivalent and mean that labels will not be aligned.
7622 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7623 are greater than this value, then their values are used instead.
7625 If @var{n} is not specified or is zero, use a machine-dependent default
7626 which is very likely to be @samp{1}, meaning no alignment.
7628 Enabled at levels @option{-O2}, @option{-O3}.
7631 @itemx -falign-loops=@var{n}
7632 @opindex falign-loops
7633 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7634 like @option{-falign-functions}. The hope is that the loop will be
7635 executed many times, which will make up for any execution of the dummy
7638 @option{-fno-align-loops} and @option{-falign-loops=1} are
7639 equivalent and mean that loops will not be aligned.
7641 If @var{n} is not specified or is zero, use a machine-dependent default.
7643 Enabled at levels @option{-O2}, @option{-O3}.
7646 @itemx -falign-jumps=@var{n}
7647 @opindex falign-jumps
7648 Align branch targets to a power-of-two boundary, for branch targets
7649 where the targets can only be reached by jumping, skipping up to @var{n}
7650 bytes like @option{-falign-functions}. In this case, no dummy operations
7653 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7654 equivalent and mean that loops will not be aligned.
7656 If @var{n} is not specified or is zero, use a machine-dependent default.
7658 Enabled at levels @option{-O2}, @option{-O3}.
7660 @item -funit-at-a-time
7661 @opindex funit-at-a-time
7662 This option is left for compatibility reasons. @option{-funit-at-a-time}
7663 has no effect, while @option{-fno-unit-at-a-time} implies
7664 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7668 @item -fno-toplevel-reorder
7669 @opindex fno-toplevel-reorder
7670 Do not reorder top-level functions, variables, and @code{asm}
7671 statements. Output them in the same order that they appear in the
7672 input file. When this option is used, unreferenced static variables
7673 will not be removed. This option is intended to support existing code
7674 which relies on a particular ordering. For new code, it is better to
7677 Enabled at level @option{-O0}. When disabled explicitly, it also imply
7678 @option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
7683 Constructs webs as commonly used for register allocation purposes and assign
7684 each web individual pseudo register. This allows the register allocation pass
7685 to operate on pseudos directly, but also strengthens several other optimization
7686 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
7687 however, make debugging impossible, since variables will no longer stay in a
7690 Enabled by default with @option{-funroll-loops}.
7692 @item -fwhole-program
7693 @opindex fwhole-program
7694 Assume that the current compilation unit represents the whole program being
7695 compiled. All public functions and variables with the exception of @code{main}
7696 and those merged by attribute @code{externally_visible} become static functions
7697 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.
7698 While this option is equivalent to proper use of the @code{static} keyword for
7699 programs consisting of a single file, in combination with option
7700 @option{-flto} this flag can be used to
7701 compile many smaller scale programs since the functions and variables become
7702 local for the whole combined compilation unit, not for the single source file
7705 This option implies @option{-fwhole-file} for Fortran programs.
7707 @item -flto[=@var{n}]
7709 This option runs the standard link-time optimizer. When invoked
7710 with source code, it generates GIMPLE (one of GCC's internal
7711 representations) and writes it to special ELF sections in the object
7712 file. When the object files are linked together, all the function
7713 bodies are read from these ELF sections and instantiated as if they
7714 had been part of the same translation unit.
7716 To use the link-timer optimizer, @option{-flto} needs to be specified at
7717 compile time and during the final link. For example,
7720 gcc -c -O2 -flto foo.c
7721 gcc -c -O2 -flto bar.c
7722 gcc -o myprog -flto -O2 foo.o bar.o
7725 The first two invocations to GCC will save a bytecode representation
7726 of GIMPLE into special ELF sections inside @file{foo.o} and
7727 @file{bar.o}. The final invocation will read the GIMPLE bytecode from
7728 @file{foo.o} and @file{bar.o}, merge the two files into a single
7729 internal image, and compile the result as usual. Since both
7730 @file{foo.o} and @file{bar.o} are merged into a single image, this
7731 causes all the inter-procedural analyses and optimizations in GCC to
7732 work across the two files as if they were a single one. This means,
7733 for example, that the inliner will be able to inline functions in
7734 @file{bar.o} into functions in @file{foo.o} and vice-versa.
7736 Another (simpler) way to enable link-time optimization is,
7739 gcc -o myprog -flto -O2 foo.c bar.c
7742 The above will generate bytecode for @file{foo.c} and @file{bar.c},
7743 merge them together into a single GIMPLE representation and optimize
7744 them as usual to produce @file{myprog}.
7746 The only important thing to keep in mind is that to enable link-time
7747 optimizations the @option{-flto} flag needs to be passed to both the
7748 compile and the link commands.
7750 To make whole program optimization effective, it is necessary to make
7751 certain whole program assumptions. The compiler needs to know
7752 what functions and variables can be accessed by libraries and runtime
7753 outside of the link time optimized unit. When supported by the linker,
7754 the linker plugin (see @option{-fuse-linker-plugin}) passes to the
7755 compiler information about used and externally visible symbols. When
7756 the linker plugin is not available, @option{-fwhole-program} should be
7757 used to allow the compiler to make these assumptions, which will lead
7758 to more aggressive optimization decisions.
7760 Note that when a file is compiled with @option{-flto}, the generated
7761 object file will be larger than a regular object file because it will
7762 contain GIMPLE bytecodes and the usual final code. This means that
7763 object files with LTO information can be linked as a normal object
7764 file. So, in the previous example, if the final link is done with
7767 gcc -o myprog foo.o bar.o
7770 The only difference will be that no inter-procedural optimizations
7771 will be applied to produce @file{myprog}. The two object files
7772 @file{foo.o} and @file{bar.o} will be simply sent to the regular
7775 Additionally, the optimization flags used to compile individual files
7776 are not necessarily related to those used at link-time. For instance,
7779 gcc -c -O0 -flto foo.c
7780 gcc -c -O0 -flto bar.c
7781 gcc -o myprog -flto -O3 foo.o bar.o
7784 This will produce individual object files with unoptimized assembler
7785 code, but the resulting binary @file{myprog} will be optimized at
7786 @option{-O3}. Now, if the final binary is generated without
7787 @option{-flto}, then @file{myprog} will not be optimized.
7789 When producing the final binary with @option{-flto}, GCC will only
7790 apply link-time optimizations to those files that contain bytecode.
7791 Therefore, you can mix and match object files and libraries with
7792 GIMPLE bytecodes and final object code. GCC will automatically select
7793 which files to optimize in LTO mode and which files to link without
7796 There are some code generation flags that GCC will preserve when
7797 generating bytecodes, as they need to be used during the final link
7798 stage. Currently, the following options are saved into the GIMPLE
7799 bytecode files: @option{-fPIC}, @option{-fcommon} and all the
7800 @option{-m} target flags.
7802 At link time, these options are read-in and reapplied. Note that the
7803 current implementation makes no attempt at recognizing conflicting
7804 values for these options. If two or more files have a conflicting
7805 value (e.g., one file is compiled with @option{-fPIC} and another
7806 isn't), the compiler will simply use the last value read from the
7807 bytecode files. It is recommended, then, that all the files
7808 participating in the same link be compiled with the same options.
7810 Another feature of LTO is that it is possible to apply interprocedural
7811 optimizations on files written in different languages. This requires
7812 some support in the language front end. Currently, the C, C++ and
7813 Fortran front ends are capable of emitting GIMPLE bytecodes, so
7814 something like this should work
7819 gfortran -c -flto baz.f90
7820 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
7823 Notice that the final link is done with @command{g++} to get the C++
7824 runtime libraries and @option{-lgfortran} is added to get the Fortran
7825 runtime libraries. In general, when mixing languages in LTO mode, you
7826 should use the same link command used when mixing languages in a
7827 regular (non-LTO) compilation. This means that if your build process
7828 was mixing languages before, all you need to add is @option{-flto} to
7829 all the compile and link commands.
7831 If LTO encounters objects with C linkage declared with incompatible
7832 types in separate translation units to be linked together (undefined
7833 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
7834 issued. The behavior is still undefined at runtime.
7836 If object files containing GIMPLE bytecode are stored in a library archive, say
7837 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
7838 are using a linker with linker plugin support. To enable this feature, use
7839 the flag @option{-fuse-linker-plugin} at link-time:
7842 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
7845 With the linker plugin enabled, the linker will extract the needed
7846 GIMPLE files from @file{libfoo.a} and pass them on to the running GCC
7847 to make them part of the aggregated GIMPLE image to be optimized.
7849 If you are not using a linker with linker plugin support and/or do not
7850 enable linker plugin then the objects inside @file{libfoo.a}
7851 will be extracted and linked as usual, but they will not participate
7852 in the LTO optimization process.
7854 Link time optimizations do not require the presence of the whole program to
7855 operate. If the program does not require any symbols to be exported, it is
7856 possible to combine @option{-flto} and with @option{-fwhole-program} to allow
7857 the interprocedural optimizers to use more aggressive assumptions which may
7858 lead to improved optimization opportunities.
7859 Use of @option{-fwhole-program} is not needed when linker plugin is
7860 active (see @option{-fuse-linker-plugin}).
7862 Regarding portability: the current implementation of LTO makes no
7863 attempt at generating bytecode that can be ported between different
7864 types of hosts. The bytecode files are versioned and there is a
7865 strict version check, so bytecode files generated in one version of
7866 GCC will not work with an older/newer version of GCC.
7868 Link time optimization does not play well with generating debugging
7869 information. Combining @option{-flto} with
7870 @option{-g} is currently experimental and expected to produce wrong
7873 If you specify the optional @var{n}, the optimization and code
7874 generation done at link time is executed in parallel using @var{n}
7875 parallel jobs by utilizing an installed @command{make} program. The
7876 environment variable @env{MAKE} may be used to override the program
7877 used. The default value for @var{n} is 1.
7879 You can also specify @option{-flto=jobserver} to use GNU make's
7880 job server mode to determine the number of parallel jobs. This
7881 is useful when the Makefile calling GCC is already executing in parallel.
7882 The parent Makefile will need a @samp{+} prepended to the command recipe
7883 for this to work. This will likely only work if @env{MAKE} is
7886 This option is disabled by default.
7888 @item -flto-partition=@var{alg}
7889 @opindex flto-partition
7890 Specify the partitioning algorithm used by the link time optimizer.
7891 The value is either @code{1to1} to specify a partitioning mirroring
7892 the original source files or @code{balanced} to specify partitioning
7893 into equally sized chunks (whenever possible). Specifying @code{none}
7894 as an algorithm disables partitioning and streaming completely. The
7895 default value is @code{balanced}.
7897 @item -flto-compression-level=@var{n}
7898 This option specifies the level of compression used for intermediate
7899 language written to LTO object files, and is only meaningful in
7900 conjunction with LTO mode (@option{-flto}). Valid
7901 values are 0 (no compression) to 9 (maximum compression). Values
7902 outside this range are clamped to either 0 or 9. If the option is not
7903 given, a default balanced compression setting is used.
7906 Prints a report with internal details on the workings of the link-time
7907 optimizer. The contents of this report vary from version to version,
7908 it is meant to be useful to GCC developers when processing object
7909 files in LTO mode (via @option{-flto}).
7911 Disabled by default.
7913 @item -fuse-linker-plugin
7914 Enables the use of a linker plugin during link time optimization. This
7915 option relies on plugin support in the linker, which is available in gold
7916 or in GNU ld 2.21 or newer.
7918 This option enables the extraction of object files with GIMPLE bytecode out
7919 of library archives. This improves the quality of optimization by exposing
7920 more code to the link time optimizer. This information specifies what
7921 symbols can be accessed externally (by non-LTO object or during dynamic
7922 linking). Resulting code quality improvements on binaries (and shared
7923 libraries that use hidden visibility) are similar to @code{-fwhole-program}.
7924 See @option{-flto} for a description of the effect of this flag and how to
7927 Enabled by default when LTO support in GCC is enabled and GCC was compiled
7928 with a linker supporting plugins (GNU ld 2.21 or newer or gold).
7930 @item -ffat-lto-objects
7931 @opindex ffat-lto-objects
7932 Fat LTO objects are object files that contain both the intermediate language
7933 and the object code. This makes them useable for both LTO linking and normal
7934 linking. This option makes effect only with @option{-flto} and is ignored
7937 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
7938 requires the complete toolchain to be aware of LTO. It requires a linker with
7939 linker plugin support for basic functionality. Additionally, nm, ar and ranlib
7940 need to support linker plugins to allow a full-featured build environment
7941 (capable of building static libraries etc).
7943 The default is @option{-ffat-lto-objects} but this default is intended to
7944 change in future releases when linker plugin enabled environments become more
7946 @item -fcompare-elim
7947 @opindex fcompare-elim
7948 After register allocation and post-register allocation instruction splitting,
7949 identify arithmetic instructions that compute processor flags similar to a
7950 comparison operation based on that arithmetic. If possible, eliminate the
7951 explicit comparison operation.
7953 This pass only applies to certain targets that cannot explicitly represent
7954 the comparison operation before register allocation is complete.
7956 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7958 @item -fcprop-registers
7959 @opindex fcprop-registers
7960 After register allocation and post-register allocation instruction splitting,
7961 we perform a copy-propagation pass to try to reduce scheduling dependencies
7962 and occasionally eliminate the copy.
7964 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7966 @item -fprofile-correction
7967 @opindex fprofile-correction
7968 Profiles collected using an instrumented binary for multi-threaded programs may
7969 be inconsistent due to missed counter updates. When this option is specified,
7970 GCC will use heuristics to correct or smooth out such inconsistencies. By
7971 default, GCC will emit an error message when an inconsistent profile is detected.
7973 @item -fprofile-dir=@var{path}
7974 @opindex fprofile-dir
7976 Set the directory to search for the profile data files in to @var{path}.
7977 This option affects only the profile data generated by
7978 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
7979 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
7980 and its related options. Both absolute and relative paths can be used.
7981 By default, GCC will use the current directory as @var{path}, thus the
7982 profile data file will appear in the same directory as the object file.
7984 @item -fprofile-generate
7985 @itemx -fprofile-generate=@var{path}
7986 @opindex fprofile-generate
7988 Enable options usually used for instrumenting application to produce
7989 profile useful for later recompilation with profile feedback based
7990 optimization. You must use @option{-fprofile-generate} both when
7991 compiling and when linking your program.
7993 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
7995 If @var{path} is specified, GCC will look at the @var{path} to find
7996 the profile feedback data files. See @option{-fprofile-dir}.
7999 @itemx -fprofile-use=@var{path}
8000 @opindex fprofile-use
8001 Enable profile feedback directed optimizations, and optimizations
8002 generally profitable only with profile feedback available.
8004 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
8005 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
8007 By default, GCC emits an error message if the feedback profiles do not
8008 match the source code. This error can be turned into a warning by using
8009 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8012 If @var{path} is specified, GCC will look at the @var{path} to find
8013 the profile feedback data files. See @option{-fprofile-dir}.
8016 The following options control compiler behavior regarding floating
8017 point arithmetic. These options trade off between speed and
8018 correctness. All must be specifically enabled.
8022 @opindex ffloat-store
8023 Do not store floating point variables in registers, and inhibit other
8024 options that might change whether a floating point value is taken from a
8027 @cindex floating point precision
8028 This option prevents undesirable excess precision on machines such as
8029 the 68000 where the floating registers (of the 68881) keep more
8030 precision than a @code{double} is supposed to have. Similarly for the
8031 x86 architecture. For most programs, the excess precision does only
8032 good, but a few programs rely on the precise definition of IEEE floating
8033 point. Use @option{-ffloat-store} for such programs, after modifying
8034 them to store all pertinent intermediate computations into variables.
8036 @item -fexcess-precision=@var{style}
8037 @opindex fexcess-precision
8038 This option allows further control over excess precision on machines
8039 where floating-point registers have more precision than the IEEE
8040 @code{float} and @code{double} types and the processor does not
8041 support operations rounding to those types. By default,
8042 @option{-fexcess-precision=fast} is in effect; this means that
8043 operations are carried out in the precision of the registers and that
8044 it is unpredictable when rounding to the types specified in the source
8045 code takes place. When compiling C, if
8046 @option{-fexcess-precision=standard} is specified then excess
8047 precision will follow the rules specified in ISO C99; in particular,
8048 both casts and assignments cause values to be rounded to their
8049 semantic types (whereas @option{-ffloat-store} only affects
8050 assignments). This option is enabled by default for C if a strict
8051 conformance option such as @option{-std=c99} is used.
8054 @option{-fexcess-precision=standard} is not implemented for languages
8055 other than C, and has no effect if
8056 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8057 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8058 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8059 semantics apply without excess precision, and in the latter, rounding
8064 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8065 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8066 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8068 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8070 This option is not turned on by any @option{-O} option besides
8071 @option{-Ofast} since it can result in incorrect output for programs
8072 which depend on an exact implementation of IEEE or ISO rules/specifications
8073 for math functions. It may, however, yield faster code for programs
8074 that do not require the guarantees of these specifications.
8076 @item -fno-math-errno
8077 @opindex fno-math-errno
8078 Do not set ERRNO after calling math functions that are executed
8079 with a single instruction, e.g., sqrt. A program that relies on
8080 IEEE exceptions for math error handling may want to use this flag
8081 for speed while maintaining IEEE arithmetic compatibility.
8083 This option is not turned on by any @option{-O} option since
8084 it can result in incorrect output for programs which depend on
8085 an exact implementation of IEEE or ISO rules/specifications for
8086 math functions. It may, however, yield faster code for programs
8087 that do not require the guarantees of these specifications.
8089 The default is @option{-fmath-errno}.
8091 On Darwin systems, the math library never sets @code{errno}. There is
8092 therefore no reason for the compiler to consider the possibility that
8093 it might, and @option{-fno-math-errno} is the default.
8095 @item -funsafe-math-optimizations
8096 @opindex funsafe-math-optimizations
8098 Allow optimizations for floating-point arithmetic that (a) assume
8099 that arguments and results are valid and (b) may violate IEEE or
8100 ANSI standards. When used at link-time, it may include libraries
8101 or startup files that change the default FPU control word or other
8102 similar optimizations.
8104 This option is not turned on by any @option{-O} option since
8105 it can result in incorrect output for programs which depend on
8106 an exact implementation of IEEE or ISO rules/specifications for
8107 math functions. It may, however, yield faster code for programs
8108 that do not require the guarantees of these specifications.
8109 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8110 @option{-fassociative-math} and @option{-freciprocal-math}.
8112 The default is @option{-fno-unsafe-math-optimizations}.
8114 @item -fassociative-math
8115 @opindex fassociative-math
8117 Allow re-association of operands in series of floating-point operations.
8118 This violates the ISO C and C++ language standard by possibly changing
8119 computation result. NOTE: re-ordering may change the sign of zero as
8120 well as ignore NaNs and inhibit or create underflow or overflow (and
8121 thus cannot be used on a code which relies on rounding behavior like
8122 @code{(x + 2**52) - 2**52)}. May also reorder floating-point comparisons
8123 and thus may not be used when ordered comparisons are required.
8124 This option requires that both @option{-fno-signed-zeros} and
8125 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8126 much sense with @option{-frounding-math}. For Fortran the option
8127 is automatically enabled when both @option{-fno-signed-zeros} and
8128 @option{-fno-trapping-math} are in effect.
8130 The default is @option{-fno-associative-math}.
8132 @item -freciprocal-math
8133 @opindex freciprocal-math
8135 Allow the reciprocal of a value to be used instead of dividing by
8136 the value if this enables optimizations. For example @code{x / y}
8137 can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
8138 is subject to common subexpression elimination. Note that this loses
8139 precision and increases the number of flops operating on the value.
8141 The default is @option{-fno-reciprocal-math}.
8143 @item -ffinite-math-only
8144 @opindex ffinite-math-only
8145 Allow optimizations for floating-point arithmetic that assume
8146 that arguments and results are not NaNs or +-Infs.
8148 This option is not turned on by any @option{-O} option since
8149 it can result in incorrect output for programs which depend on
8150 an exact implementation of IEEE or ISO rules/specifications for
8151 math functions. It may, however, yield faster code for programs
8152 that do not require the guarantees of these specifications.
8154 The default is @option{-fno-finite-math-only}.
8156 @item -fno-signed-zeros
8157 @opindex fno-signed-zeros
8158 Allow optimizations for floating point arithmetic that ignore the
8159 signedness of zero. IEEE arithmetic specifies the behavior of
8160 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8161 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8162 This option implies that the sign of a zero result isn't significant.
8164 The default is @option{-fsigned-zeros}.
8166 @item -fno-trapping-math
8167 @opindex fno-trapping-math
8168 Compile code assuming that floating-point operations cannot generate
8169 user-visible traps. These traps include division by zero, overflow,
8170 underflow, inexact result and invalid operation. This option requires
8171 that @option{-fno-signaling-nans} be in effect. Setting this option may
8172 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8174 This option should never be turned on by any @option{-O} option since
8175 it can result in incorrect output for programs which depend on
8176 an exact implementation of IEEE or ISO rules/specifications for
8179 The default is @option{-ftrapping-math}.
8181 @item -frounding-math
8182 @opindex frounding-math
8183 Disable transformations and optimizations that assume default floating
8184 point rounding behavior. This is round-to-zero for all floating point
8185 to integer conversions, and round-to-nearest for all other arithmetic
8186 truncations. This option should be specified for programs that change
8187 the FP rounding mode dynamically, or that may be executed with a
8188 non-default rounding mode. This option disables constant folding of
8189 floating point expressions at compile-time (which may be affected by
8190 rounding mode) and arithmetic transformations that are unsafe in the
8191 presence of sign-dependent rounding modes.
8193 The default is @option{-fno-rounding-math}.
8195 This option is experimental and does not currently guarantee to
8196 disable all GCC optimizations that are affected by rounding mode.
8197 Future versions of GCC may provide finer control of this setting
8198 using C99's @code{FENV_ACCESS} pragma. This command line option
8199 will be used to specify the default state for @code{FENV_ACCESS}.
8201 @item -fsignaling-nans
8202 @opindex fsignaling-nans
8203 Compile code assuming that IEEE signaling NaNs may generate user-visible
8204 traps during floating-point operations. Setting this option disables
8205 optimizations that may change the number of exceptions visible with
8206 signaling NaNs. This option implies @option{-ftrapping-math}.
8208 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8211 The default is @option{-fno-signaling-nans}.
8213 This option is experimental and does not currently guarantee to
8214 disable all GCC optimizations that affect signaling NaN behavior.
8216 @item -fsingle-precision-constant
8217 @opindex fsingle-precision-constant
8218 Treat floating point constant as single precision constant instead of
8219 implicitly converting it to double precision constant.
8221 @item -fcx-limited-range
8222 @opindex fcx-limited-range
8223 When enabled, this option states that a range reduction step is not
8224 needed when performing complex division. Also, there is no checking
8225 whether the result of a complex multiplication or division is @code{NaN
8226 + I*NaN}, with an attempt to rescue the situation in that case. The
8227 default is @option{-fno-cx-limited-range}, but is enabled by
8228 @option{-ffast-math}.
8230 This option controls the default setting of the ISO C99
8231 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8234 @item -fcx-fortran-rules
8235 @opindex fcx-fortran-rules
8236 Complex multiplication and division follow Fortran rules. Range
8237 reduction is done as part of complex division, but there is no checking
8238 whether the result of a complex multiplication or division is @code{NaN
8239 + I*NaN}, with an attempt to rescue the situation in that case.
8241 The default is @option{-fno-cx-fortran-rules}.
8245 The following options control optimizations that may improve
8246 performance, but are not enabled by any @option{-O} options. This
8247 section includes experimental options that may produce broken code.
8250 @item -fbranch-probabilities
8251 @opindex fbranch-probabilities
8252 After running a program compiled with @option{-fprofile-arcs}
8253 (@pxref{Debugging Options,, Options for Debugging Your Program or
8254 @command{gcc}}), you can compile it a second time using
8255 @option{-fbranch-probabilities}, to improve optimizations based on
8256 the number of times each branch was taken. When the program
8257 compiled with @option{-fprofile-arcs} exits it saves arc execution
8258 counts to a file called @file{@var{sourcename}.gcda} for each source
8259 file. The information in this data file is very dependent on the
8260 structure of the generated code, so you must use the same source code
8261 and the same optimization options for both compilations.
8263 With @option{-fbranch-probabilities}, GCC puts a
8264 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8265 These can be used to improve optimization. Currently, they are only
8266 used in one place: in @file{reorg.c}, instead of guessing which path a
8267 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8268 exactly determine which path is taken more often.
8270 @item -fprofile-values
8271 @opindex fprofile-values
8272 If combined with @option{-fprofile-arcs}, it adds code so that some
8273 data about values of expressions in the program is gathered.
8275 With @option{-fbranch-probabilities}, it reads back the data gathered
8276 from profiling values of expressions for usage in optimizations.
8278 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8282 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
8283 a code to gather information about values of expressions.
8285 With @option{-fbranch-probabilities}, it reads back the data gathered
8286 and actually performs the optimizations based on them.
8287 Currently the optimizations include specialization of division operation
8288 using the knowledge about the value of the denominator.
8290 @item -frename-registers
8291 @opindex frename-registers
8292 Attempt to avoid false dependencies in scheduled code by making use
8293 of registers left over after register allocation. This optimization
8294 will most benefit processors with lots of registers. Depending on the
8295 debug information format adopted by the target, however, it can
8296 make debugging impossible, since variables will no longer stay in
8297 a ``home register''.
8299 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8303 Perform tail duplication to enlarge superblock size. This transformation
8304 simplifies the control flow of the function allowing other optimizations to do
8307 Enabled with @option{-fprofile-use}.
8309 @item -funroll-loops
8310 @opindex funroll-loops
8311 Unroll loops whose number of iterations can be determined at compile time or
8312 upon entry to the loop. @option{-funroll-loops} implies
8313 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8314 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8315 small constant number of iterations). This option makes code larger, and may
8316 or may not make it run faster.
8318 Enabled with @option{-fprofile-use}.
8320 @item -funroll-all-loops
8321 @opindex funroll-all-loops
8322 Unroll all loops, even if their number of iterations is uncertain when
8323 the loop is entered. This usually makes programs run more slowly.
8324 @option{-funroll-all-loops} implies the same options as
8325 @option{-funroll-loops}.
8328 @opindex fpeel-loops
8329 Peels the loops for that there is enough information that they do not
8330 roll much (from profile feedback). It also turns on complete loop peeling
8331 (i.e.@: complete removal of loops with small constant number of iterations).
8333 Enabled with @option{-fprofile-use}.
8335 @item -fmove-loop-invariants
8336 @opindex fmove-loop-invariants
8337 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8338 at level @option{-O1}
8340 @item -funswitch-loops
8341 @opindex funswitch-loops
8342 Move branches with loop invariant conditions out of the loop, with duplicates
8343 of the loop on both branches (modified according to result of the condition).
8345 @item -ffunction-sections
8346 @itemx -fdata-sections
8347 @opindex ffunction-sections
8348 @opindex fdata-sections
8349 Place each function or data item into its own section in the output
8350 file if the target supports arbitrary sections. The name of the
8351 function or the name of the data item determines the section's name
8354 Use these options on systems where the linker can perform optimizations
8355 to improve locality of reference in the instruction space. Most systems
8356 using the ELF object format and SPARC processors running Solaris 2 have
8357 linkers with such optimizations. AIX may have these optimizations in
8360 Only use these options when there are significant benefits from doing
8361 so. When you specify these options, the assembler and linker will
8362 create larger object and executable files and will also be slower.
8363 You will not be able to use @code{gprof} on all systems if you
8364 specify this option and you may have problems with debugging if
8365 you specify both this option and @option{-g}.
8367 @item -fbranch-target-load-optimize
8368 @opindex fbranch-target-load-optimize
8369 Perform branch target register load optimization before prologue / epilogue
8371 The use of target registers can typically be exposed only during reload,
8372 thus hoisting loads out of loops and doing inter-block scheduling needs
8373 a separate optimization pass.
8375 @item -fbranch-target-load-optimize2
8376 @opindex fbranch-target-load-optimize2
8377 Perform branch target register load optimization after prologue / epilogue
8380 @item -fbtr-bb-exclusive
8381 @opindex fbtr-bb-exclusive
8382 When performing branch target register load optimization, don't reuse
8383 branch target registers in within any basic block.
8385 @item -fstack-protector
8386 @opindex fstack-protector
8387 Emit extra code to check for buffer overflows, such as stack smashing
8388 attacks. This is done by adding a guard variable to functions with
8389 vulnerable objects. This includes functions that call alloca, and
8390 functions with buffers larger than 8 bytes. The guards are initialized
8391 when a function is entered and then checked when the function exits.
8392 If a guard check fails, an error message is printed and the program exits.
8394 @item -fstack-protector-all
8395 @opindex fstack-protector-all
8396 Like @option{-fstack-protector} except that all functions are protected.
8398 @item -fsection-anchors
8399 @opindex fsection-anchors
8400 Try to reduce the number of symbolic address calculations by using
8401 shared ``anchor'' symbols to address nearby objects. This transformation
8402 can help to reduce the number of GOT entries and GOT accesses on some
8405 For example, the implementation of the following function @code{foo}:
8409 int foo (void) @{ return a + b + c; @}
8412 would usually calculate the addresses of all three variables, but if you
8413 compile it with @option{-fsection-anchors}, it will access the variables
8414 from a common anchor point instead. The effect is similar to the
8415 following pseudocode (which isn't valid C):
8420 register int *xr = &x;
8421 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8425 Not all targets support this option.
8427 @item --param @var{name}=@var{value}
8429 In some places, GCC uses various constants to control the amount of
8430 optimization that is done. For example, GCC will not inline functions
8431 that contain more that a certain number of instructions. You can
8432 control some of these constants on the command-line using the
8433 @option{--param} option.
8435 The names of specific parameters, and the meaning of the values, are
8436 tied to the internals of the compiler, and are subject to change
8437 without notice in future releases.
8439 In each case, the @var{value} is an integer. The allowable choices for
8440 @var{name} are given in the following table:
8443 @item predictable-branch-outcome
8444 When branch is predicted to be taken with probability lower than this threshold
8445 (in percent), then it is considered well predictable. The default is 10.
8447 @item max-crossjump-edges
8448 The maximum number of incoming edges to consider for crossjumping.
8449 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8450 the number of edges incoming to each block. Increasing values mean
8451 more aggressive optimization, making the compile time increase with
8452 probably small improvement in executable size.
8454 @item min-crossjump-insns
8455 The minimum number of instructions which must be matched at the end
8456 of two blocks before crossjumping will be performed on them. This
8457 value is ignored in the case where all instructions in the block being
8458 crossjumped from are matched. The default value is 5.
8460 @item max-grow-copy-bb-insns
8461 The maximum code size expansion factor when copying basic blocks
8462 instead of jumping. The expansion is relative to a jump instruction.
8463 The default value is 8.
8465 @item max-goto-duplication-insns
8466 The maximum number of instructions to duplicate to a block that jumps
8467 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8468 passes, GCC factors computed gotos early in the compilation process,
8469 and unfactors them as late as possible. Only computed jumps at the
8470 end of a basic blocks with no more than max-goto-duplication-insns are
8471 unfactored. The default value is 8.
8473 @item max-delay-slot-insn-search
8474 The maximum number of instructions to consider when looking for an
8475 instruction to fill a delay slot. If more than this arbitrary number of
8476 instructions is searched, the time savings from filling the delay slot
8477 will be minimal so stop searching. Increasing values mean more
8478 aggressive optimization, making the compile time increase with probably
8479 small improvement in executable run time.
8481 @item max-delay-slot-live-search
8482 When trying to fill delay slots, the maximum number of instructions to
8483 consider when searching for a block with valid live register
8484 information. Increasing this arbitrarily chosen value means more
8485 aggressive optimization, increasing the compile time. This parameter
8486 should be removed when the delay slot code is rewritten to maintain the
8489 @item max-gcse-memory
8490 The approximate maximum amount of memory that will be allocated in
8491 order to perform the global common subexpression elimination
8492 optimization. If more memory than specified is required, the
8493 optimization will not be done.
8495 @item max-gcse-insertion-ratio
8496 If the ratio of expression insertions to deletions is larger than this value
8497 for any expression, then RTL PRE will insert or remove the expression and thus
8498 leave partially redundant computations in the instruction stream. The default value is 20.
8500 @item max-pending-list-length
8501 The maximum number of pending dependencies scheduling will allow
8502 before flushing the current state and starting over. Large functions
8503 with few branches or calls can create excessively large lists which
8504 needlessly consume memory and resources.
8506 @item max-modulo-backtrack-attempts
8507 The maximum number of backtrack attempts the scheduler should make
8508 when modulo scheduling a loop. Larger values can exponentially increase
8511 @item max-inline-insns-single
8512 Several parameters control the tree inliner used in gcc.
8513 This number sets the maximum number of instructions (counted in GCC's
8514 internal representation) in a single function that the tree inliner
8515 will consider for inlining. This only affects functions declared
8516 inline and methods implemented in a class declaration (C++).
8517 The default value is 400.
8519 @item max-inline-insns-auto
8520 When you use @option{-finline-functions} (included in @option{-O3}),
8521 a lot of functions that would otherwise not be considered for inlining
8522 by the compiler will be investigated. To those functions, a different
8523 (more restrictive) limit compared to functions declared inline can
8525 The default value is 40.
8527 @item large-function-insns
8528 The limit specifying really large functions. For functions larger than this
8529 limit after inlining, inlining is constrained by
8530 @option{--param large-function-growth}. This parameter is useful primarily
8531 to avoid extreme compilation time caused by non-linear algorithms used by the
8533 The default value is 2700.
8535 @item large-function-growth
8536 Specifies maximal growth of large function caused by inlining in percents.
8537 The default value is 100 which limits large function growth to 2.0 times
8540 @item large-unit-insns
8541 The limit specifying large translation unit. Growth caused by inlining of
8542 units larger than this limit is limited by @option{--param inline-unit-growth}.
8543 For small units this might be too tight (consider unit consisting of function A
8544 that is inline and B that just calls A three time. If B is small relative to
8545 A, the growth of unit is 300\% and yet such inlining is very sane. For very
8546 large units consisting of small inlineable functions however the overall unit
8547 growth limit is needed to avoid exponential explosion of code size. Thus for
8548 smaller units, the size is increased to @option{--param large-unit-insns}
8549 before applying @option{--param inline-unit-growth}. The default is 10000
8551 @item inline-unit-growth
8552 Specifies maximal overall growth of the compilation unit caused by inlining.
8553 The default value is 30 which limits unit growth to 1.3 times the original
8556 @item ipcp-unit-growth
8557 Specifies maximal overall growth of the compilation unit caused by
8558 interprocedural constant propagation. The default value is 10 which limits
8559 unit growth to 1.1 times the original size.
8561 @item large-stack-frame
8562 The limit specifying large stack frames. While inlining the algorithm is trying
8563 to not grow past this limit too much. Default value is 256 bytes.
8565 @item large-stack-frame-growth
8566 Specifies maximal growth of large stack frames caused by inlining in percents.
8567 The default value is 1000 which limits large stack frame growth to 11 times
8570 @item max-inline-insns-recursive
8571 @itemx max-inline-insns-recursive-auto
8572 Specifies maximum number of instructions out-of-line copy of self recursive inline
8573 function can grow into by performing recursive inlining.
8575 For functions declared inline @option{--param max-inline-insns-recursive} is
8576 taken into account. For function not declared inline, recursive inlining
8577 happens only when @option{-finline-functions} (included in @option{-O3}) is
8578 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
8579 default value is 450.
8581 @item max-inline-recursive-depth
8582 @itemx max-inline-recursive-depth-auto
8583 Specifies maximum recursion depth used by the recursive inlining.
8585 For functions declared inline @option{--param max-inline-recursive-depth} is
8586 taken into account. For function not declared inline, recursive inlining
8587 happens only when @option{-finline-functions} (included in @option{-O3}) is
8588 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
8591 @item min-inline-recursive-probability
8592 Recursive inlining is profitable only for function having deep recursion
8593 in average and can hurt for function having little recursion depth by
8594 increasing the prologue size or complexity of function body to other
8597 When profile feedback is available (see @option{-fprofile-generate}) the actual
8598 recursion depth can be guessed from probability that function will recurse via
8599 given call expression. This parameter limits inlining only to call expression
8600 whose probability exceeds given threshold (in percents). The default value is
8603 @item early-inlining-insns
8604 Specify growth that early inliner can make. In effect it increases amount of
8605 inlining for code having large abstraction penalty. The default value is 10.
8607 @item max-early-inliner-iterations
8608 @itemx max-early-inliner-iterations
8609 Limit of iterations of early inliner. This basically bounds number of nested
8610 indirect calls early inliner can resolve. Deeper chains are still handled by
8613 @item comdat-sharing-probability
8614 @itemx comdat-sharing-probability
8615 Probability (in percent) that C++ inline function with comdat visibility
8616 will be shared across multiple compilation units. The default value is 20.
8618 @item min-vect-loop-bound
8619 The minimum number of iterations under which a loop will not get vectorized
8620 when @option{-ftree-vectorize} is used. The number of iterations after
8621 vectorization needs to be greater than the value specified by this option
8622 to allow vectorization. The default value is 0.
8624 @item gcse-cost-distance-ratio
8625 Scaling factor in calculation of maximum distance an expression
8626 can be moved by GCSE optimizations. This is currently supported only in the
8627 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
8628 will be with simple expressions, i.e., the expressions which have cost
8629 less than @option{gcse-unrestricted-cost}. Specifying 0 will disable
8630 hoisting of simple expressions. The default value is 10.
8632 @item gcse-unrestricted-cost
8633 Cost, roughly measured as the cost of a single typical machine
8634 instruction, at which GCSE optimizations will not constrain
8635 the distance an expression can travel. This is currently
8636 supported only in the code hoisting pass. The lesser the cost,
8637 the more aggressive code hoisting will be. Specifying 0 will
8638 allow all expressions to travel unrestricted distances.
8639 The default value is 3.
8641 @item max-hoist-depth
8642 The depth of search in the dominator tree for expressions to hoist.
8643 This is used to avoid quadratic behavior in hoisting algorithm.
8644 The value of 0 will avoid limiting the search, but may slow down compilation
8645 of huge functions. The default value is 30.
8647 @item max-tail-merge-comparisons
8648 The maximum amount of similar bbs to compare a bb with. This is used to
8649 avoid quadratic behaviour in tree tail merging. The default value is 10.
8651 @item max-tail-merge-iterations
8652 The maximum amount of iterations of the pass over the function. This is used to
8653 limit run time in tree tail merging. The default value is 2.
8655 @item max-unrolled-insns
8656 The maximum number of instructions that a loop should have if that loop
8657 is unrolled, and if the loop is unrolled, it determines how many times
8658 the loop code is unrolled.
8660 @item max-average-unrolled-insns
8661 The maximum number of instructions biased by probabilities of their execution
8662 that a loop should have if that loop is unrolled, and if the loop is unrolled,
8663 it determines how many times the loop code is unrolled.
8665 @item max-unroll-times
8666 The maximum number of unrollings of a single loop.
8668 @item max-peeled-insns
8669 The maximum number of instructions that a loop should have if that loop
8670 is peeled, and if the loop is peeled, it determines how many times
8671 the loop code is peeled.
8673 @item max-peel-times
8674 The maximum number of peelings of a single loop.
8676 @item max-completely-peeled-insns
8677 The maximum number of insns of a completely peeled loop.
8679 @item max-completely-peel-times
8680 The maximum number of iterations of a loop to be suitable for complete peeling.
8682 @item max-completely-peel-loop-nest-depth
8683 The maximum depth of a loop nest suitable for complete peeling.
8685 @item max-unswitch-insns
8686 The maximum number of insns of an unswitched loop.
8688 @item max-unswitch-level
8689 The maximum number of branches unswitched in a single loop.
8692 The minimum cost of an expensive expression in the loop invariant motion.
8694 @item iv-consider-all-candidates-bound
8695 Bound on number of candidates for induction variables below that
8696 all candidates are considered for each use in induction variable
8697 optimizations. Only the most relevant candidates are considered
8698 if there are more candidates, to avoid quadratic time complexity.
8700 @item iv-max-considered-uses
8701 The induction variable optimizations give up on loops that contain more
8702 induction variable uses.
8704 @item iv-always-prune-cand-set-bound
8705 If number of candidates in the set is smaller than this value,
8706 we always try to remove unnecessary ivs from the set during its
8707 optimization when a new iv is added to the set.
8709 @item scev-max-expr-size
8710 Bound on size of expressions used in the scalar evolutions analyzer.
8711 Large expressions slow the analyzer.
8713 @item scev-max-expr-complexity
8714 Bound on the complexity of the expressions in the scalar evolutions analyzer.
8715 Complex expressions slow the analyzer.
8717 @item omega-max-vars
8718 The maximum number of variables in an Omega constraint system.
8719 The default value is 128.
8721 @item omega-max-geqs
8722 The maximum number of inequalities in an Omega constraint system.
8723 The default value is 256.
8726 The maximum number of equalities in an Omega constraint system.
8727 The default value is 128.
8729 @item omega-max-wild-cards
8730 The maximum number of wildcard variables that the Omega solver will
8731 be able to insert. The default value is 18.
8733 @item omega-hash-table-size
8734 The size of the hash table in the Omega solver. The default value is
8737 @item omega-max-keys
8738 The maximal number of keys used by the Omega solver. The default
8741 @item omega-eliminate-redundant-constraints
8742 When set to 1, use expensive methods to eliminate all redundant
8743 constraints. The default value is 0.
8745 @item vect-max-version-for-alignment-checks
8746 The maximum number of runtime checks that can be performed when
8747 doing loop versioning for alignment in the vectorizer. See option
8748 ftree-vect-loop-version for more information.
8750 @item vect-max-version-for-alias-checks
8751 The maximum number of runtime checks that can be performed when
8752 doing loop versioning for alias in the vectorizer. See option
8753 ftree-vect-loop-version for more information.
8755 @item max-iterations-to-track
8757 The maximum number of iterations of a loop the brute force algorithm
8758 for analysis of # of iterations of the loop tries to evaluate.
8760 @item hot-bb-count-fraction
8761 Select fraction of the maximal count of repetitions of basic block in program
8762 given basic block needs to have to be considered hot.
8764 @item hot-bb-frequency-fraction
8765 Select fraction of the entry block frequency of executions of basic block in
8766 function given basic block needs to have to be considered hot.
8768 @item max-predicted-iterations
8769 The maximum number of loop iterations we predict statically. This is useful
8770 in cases where function contain single loop with known bound and other loop
8771 with unknown. We predict the known number of iterations correctly, while
8772 the unknown number of iterations average to roughly 10. This means that the
8773 loop without bounds would appear artificially cold relative to the other one.
8775 @item align-threshold
8777 Select fraction of the maximal frequency of executions of basic block in
8778 function given basic block will get aligned.
8780 @item align-loop-iterations
8782 A loop expected to iterate at lest the selected number of iterations will get
8785 @item tracer-dynamic-coverage
8786 @itemx tracer-dynamic-coverage-feedback
8788 This value is used to limit superblock formation once the given percentage of
8789 executed instructions is covered. This limits unnecessary code size
8792 The @option{tracer-dynamic-coverage-feedback} is used only when profile
8793 feedback is available. The real profiles (as opposed to statically estimated
8794 ones) are much less balanced allowing the threshold to be larger value.
8796 @item tracer-max-code-growth
8797 Stop tail duplication once code growth has reached given percentage. This is
8798 rather hokey argument, as most of the duplicates will be eliminated later in
8799 cross jumping, so it may be set to much higher values than is the desired code
8802 @item tracer-min-branch-ratio
8804 Stop reverse growth when the reverse probability of best edge is less than this
8805 threshold (in percent).
8807 @item tracer-min-branch-ratio
8808 @itemx tracer-min-branch-ratio-feedback
8810 Stop forward growth if the best edge do have probability lower than this
8813 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
8814 compilation for profile feedback and one for compilation without. The value
8815 for compilation with profile feedback needs to be more conservative (higher) in
8816 order to make tracer effective.
8818 @item max-cse-path-length
8820 Maximum number of basic blocks on path that cse considers. The default is 10.
8823 The maximum instructions CSE process before flushing. The default is 1000.
8825 @item ggc-min-expand
8827 GCC uses a garbage collector to manage its own memory allocation. This
8828 parameter specifies the minimum percentage by which the garbage
8829 collector's heap should be allowed to expand between collections.
8830 Tuning this may improve compilation speed; it has no effect on code
8833 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
8834 RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
8835 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
8836 GCC is not able to calculate RAM on a particular platform, the lower
8837 bound of 30% is used. Setting this parameter and
8838 @option{ggc-min-heapsize} to zero causes a full collection to occur at
8839 every opportunity. This is extremely slow, but can be useful for
8842 @item ggc-min-heapsize
8844 Minimum size of the garbage collector's heap before it begins bothering
8845 to collect garbage. The first collection occurs after the heap expands
8846 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
8847 tuning this may improve compilation speed, and has no effect on code
8850 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
8851 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
8852 with a lower bound of 4096 (four megabytes) and an upper bound of
8853 131072 (128 megabytes). If GCC is not able to calculate RAM on a
8854 particular platform, the lower bound is used. Setting this parameter
8855 very large effectively disables garbage collection. Setting this
8856 parameter and @option{ggc-min-expand} to zero causes a full collection
8857 to occur at every opportunity.
8859 @item max-reload-search-insns
8860 The maximum number of instruction reload should look backward for equivalent
8861 register. Increasing values mean more aggressive optimization, making the
8862 compile time increase with probably slightly better performance. The default
8865 @item max-cselib-memory-locations
8866 The maximum number of memory locations cselib should take into account.
8867 Increasing values mean more aggressive optimization, making the compile time
8868 increase with probably slightly better performance. The default value is 500.
8870 @item reorder-blocks-duplicate
8871 @itemx reorder-blocks-duplicate-feedback
8873 Used by basic block reordering pass to decide whether to use unconditional
8874 branch or duplicate the code on its destination. Code is duplicated when its
8875 estimated size is smaller than this value multiplied by the estimated size of
8876 unconditional jump in the hot spots of the program.
8878 The @option{reorder-block-duplicate-feedback} is used only when profile
8879 feedback is available and may be set to higher values than
8880 @option{reorder-block-duplicate} since information about the hot spots is more
8883 @item max-sched-ready-insns
8884 The maximum number of instructions ready to be issued the scheduler should
8885 consider at any given time during the first scheduling pass. Increasing
8886 values mean more thorough searches, making the compilation time increase
8887 with probably little benefit. The default value is 100.
8889 @item max-sched-region-blocks
8890 The maximum number of blocks in a region to be considered for
8891 interblock scheduling. The default value is 10.
8893 @item max-pipeline-region-blocks
8894 The maximum number of blocks in a region to be considered for
8895 pipelining in the selective scheduler. The default value is 15.
8897 @item max-sched-region-insns
8898 The maximum number of insns in a region to be considered for
8899 interblock scheduling. The default value is 100.
8901 @item max-pipeline-region-insns
8902 The maximum number of insns in a region to be considered for
8903 pipelining in the selective scheduler. The default value is 200.
8906 The minimum probability (in percents) of reaching a source block
8907 for interblock speculative scheduling. The default value is 40.
8909 @item max-sched-extend-regions-iters
8910 The maximum number of iterations through CFG to extend regions.
8911 0 - disable region extension,
8912 N - do at most N iterations.
8913 The default value is 0.
8915 @item max-sched-insn-conflict-delay
8916 The maximum conflict delay for an insn to be considered for speculative motion.
8917 The default value is 3.
8919 @item sched-spec-prob-cutoff
8920 The minimal probability of speculation success (in percents), so that
8921 speculative insn will be scheduled.
8922 The default value is 40.
8924 @item sched-mem-true-dep-cost
8925 Minimal distance (in CPU cycles) between store and load targeting same
8926 memory locations. The default value is 1.
8928 @item selsched-max-lookahead
8929 The maximum size of the lookahead window of selective scheduling. It is a
8930 depth of search for available instructions.
8931 The default value is 50.
8933 @item selsched-max-sched-times
8934 The maximum number of times that an instruction will be scheduled during
8935 selective scheduling. This is the limit on the number of iterations
8936 through which the instruction may be pipelined. The default value is 2.
8938 @item selsched-max-insns-to-rename
8939 The maximum number of best instructions in the ready list that are considered
8940 for renaming in the selective scheduler. The default value is 2.
8943 The minimum value of stage count that swing modulo scheduler will
8944 generate. The default value is 2.
8946 @item max-last-value-rtl
8947 The maximum size measured as number of RTLs that can be recorded in an expression
8948 in combiner for a pseudo register as last known value of that register. The default
8951 @item integer-share-limit
8952 Small integer constants can use a shared data structure, reducing the
8953 compiler's memory usage and increasing its speed. This sets the maximum
8954 value of a shared integer constant. The default value is 256.
8956 @item min-virtual-mappings
8957 Specifies the minimum number of virtual mappings in the incremental
8958 SSA updater that should be registered to trigger the virtual mappings
8959 heuristic defined by virtual-mappings-ratio. The default value is
8962 @item virtual-mappings-ratio
8963 If the number of virtual mappings is virtual-mappings-ratio bigger
8964 than the number of virtual symbols to be updated, then the incremental
8965 SSA updater switches to a full update for those symbols. The default
8968 @item ssp-buffer-size
8969 The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
8970 protection when @option{-fstack-protection} is used.
8972 @item max-jump-thread-duplication-stmts
8973 Maximum number of statements allowed in a block that needs to be
8974 duplicated when threading jumps.
8976 @item max-fields-for-field-sensitive
8977 Maximum number of fields in a structure we will treat in
8978 a field sensitive manner during pointer analysis. The default is zero
8979 for -O0, and -O1 and 100 for -Os, -O2, and -O3.
8981 @item prefetch-latency
8982 Estimate on average number of instructions that are executed before
8983 prefetch finishes. The distance we prefetch ahead is proportional
8984 to this constant. Increasing this number may also lead to less
8985 streams being prefetched (see @option{simultaneous-prefetches}).
8987 @item simultaneous-prefetches
8988 Maximum number of prefetches that can run at the same time.
8990 @item l1-cache-line-size
8991 The size of cache line in L1 cache, in bytes.
8994 The size of L1 cache, in kilobytes.
8997 The size of L2 cache, in kilobytes.
8999 @item min-insn-to-prefetch-ratio
9000 The minimum ratio between the number of instructions and the
9001 number of prefetches to enable prefetching in a loop.
9003 @item prefetch-min-insn-to-mem-ratio
9004 The minimum ratio between the number of instructions and the
9005 number of memory references to enable prefetching in a loop.
9007 @item use-canonical-types
9008 Whether the compiler should use the ``canonical'' type system. By
9009 default, this should always be 1, which uses a more efficient internal
9010 mechanism for comparing types in C++ and Objective-C++. However, if
9011 bugs in the canonical type system are causing compilation failures,
9012 set this value to 0 to disable canonical types.
9014 @item switch-conversion-max-branch-ratio
9015 Switch initialization conversion will refuse to create arrays that are
9016 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9017 branches in the switch.
9019 @item max-partial-antic-length
9020 Maximum length of the partial antic set computed during the tree
9021 partial redundancy elimination optimization (@option{-ftree-pre}) when
9022 optimizing at @option{-O3} and above. For some sorts of source code
9023 the enhanced partial redundancy elimination optimization can run away,
9024 consuming all of the memory available on the host machine. This
9025 parameter sets a limit on the length of the sets that are computed,
9026 which prevents the runaway behavior. Setting a value of 0 for
9027 this parameter will allow an unlimited set length.
9029 @item sccvn-max-scc-size
9030 Maximum size of a strongly connected component (SCC) during SCCVN
9031 processing. If this limit is hit, SCCVN processing for the whole
9032 function will not be done and optimizations depending on it will
9033 be disabled. The default maximum SCC size is 10000.
9035 @item ira-max-loops-num
9036 IRA uses a regional register allocation by default. If a function
9037 contains loops more than number given by the parameter, only at most
9038 given number of the most frequently executed loops will form regions
9039 for the regional register allocation. The default value of the
9042 @item ira-max-conflict-table-size
9043 Although IRA uses a sophisticated algorithm of compression conflict
9044 table, the table can be still big for huge functions. If the conflict
9045 table for a function could be more than size in MB given by the
9046 parameter, the conflict table is not built and faster, simpler, and
9047 lower quality register allocation algorithm will be used. The
9048 algorithm do not use pseudo-register conflicts. The default value of
9049 the parameter is 2000.
9051 @item ira-loop-reserved-regs
9052 IRA can be used to evaluate more accurate register pressure in loops
9053 for decision to move loop invariants (see @option{-O3}). The number
9054 of available registers reserved for some other purposes is described
9055 by this parameter. The default value of the parameter is 2 which is
9056 minimal number of registers needed for execution of typical
9057 instruction. This value is the best found from numerous experiments.
9059 @item loop-invariant-max-bbs-in-loop
9060 Loop invariant motion can be very expensive, both in compile time and
9061 in amount of needed compile time memory, with very large loops. Loops
9062 with more basic blocks than this parameter won't have loop invariant
9063 motion optimization performed on them. The default value of the
9064 parameter is 1000 for -O1 and 10000 for -O2 and above.
9066 @item max-vartrack-size
9067 Sets a maximum number of hash table slots to use during variable
9068 tracking dataflow analysis of any function. If this limit is exceeded
9069 with variable tracking at assignments enabled, analysis for that
9070 function is retried without it, after removing all debug insns from
9071 the function. If the limit is exceeded even without debug insns, var
9072 tracking analysis is completely disabled for the function. Setting
9073 the parameter to zero makes it unlimited.
9075 @item max-vartrack-expr-depth
9076 Sets a maximum number of recursion levels when attempting to map
9077 variable names or debug temporaries to value expressions. This trades
9078 compile time for more complete debug information. If this is set too
9079 low, value expressions that are available and could be represented in
9080 debug information may end up not being used; setting this higher may
9081 enable the compiler to find more complex debug expressions, but compile
9082 time and memory use may grow. The default is 12.
9084 @item min-nondebug-insn-uid
9085 Use uids starting at this parameter for nondebug insns. The range below
9086 the parameter is reserved exclusively for debug insns created by
9087 @option{-fvar-tracking-assignments}, but debug insns may get
9088 (non-overlapping) uids above it if the reserved range is exhausted.
9090 @item ipa-sra-ptr-growth-factor
9091 IPA-SRA will replace a pointer to an aggregate with one or more new
9092 parameters only when their cumulative size is less or equal to
9093 @option{ipa-sra-ptr-growth-factor} times the size of the original
9096 @item graphite-max-nb-scop-params
9097 To avoid exponential effects in the Graphite loop transforms, the
9098 number of parameters in a Static Control Part (SCoP) is bounded. The
9099 default value is 10 parameters. A variable whose value is unknown at
9100 compile time and defined outside a SCoP is a parameter of the SCoP.
9102 @item graphite-max-bbs-per-function
9103 To avoid exponential effects in the detection of SCoPs, the size of
9104 the functions analyzed by Graphite is bounded. The default value is
9107 @item loop-block-tile-size
9108 Loop blocking or strip mining transforms, enabled with
9109 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9110 loop in the loop nest by a given number of iterations. The strip
9111 length can be changed using the @option{loop-block-tile-size}
9112 parameter. The default value is 51 iterations.
9114 @item ipa-cp-value-list-size
9115 IPA-CP attempts to track all possible values and types passed to a function's
9116 parameter in order to propagate them and perform devirtualization.
9117 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9118 stores per one formal parameter of a function.
9120 @item lto-partitions
9121 Specify desired number of partitions produced during WHOPR compilation.
9122 The number of partitions should exceed the number of CPUs used for compilation.
9123 The default value is 32.
9125 @item lto-minpartition
9126 Size of minimal partition for WHOPR (in estimated instructions).
9127 This prevents expenses of splitting very small programs into too many
9130 @item cxx-max-namespaces-for-diagnostic-help
9131 The maximum number of namespaces to consult for suggestions when C++
9132 name lookup fails for an identifier. The default is 1000.
9134 @item sink-frequency-threshold
9135 The maximum relative execution frequency (in percents) of the target block
9136 relative to a statement's original block to allow statement sinking of a
9137 statement. Larger numbers result in more aggressive statement sinking.
9138 The default value is 75. A small positive adjustment is applied for
9139 statements with memory operands as those are even more profitable so sink.
9141 @item max-stores-to-sink
9142 The maximum number of conditional stores paires that can be sunk. Set to 0
9143 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9144 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9146 @item allow-store-data-races
9147 Allow optimizers to introduce new data races on stores.
9148 Set to 1 to allow, otherwise to 0. This option is enabled by default
9149 unless implicitly set by the @option{-fmemory-model=} option.
9151 @item case-values-threshold
9152 The smallest number of different values for which it is best to use a
9153 jump-table instead of a tree of conditional branches. If the value is
9154 0, use the default for the machine. The default is 0.
9156 @item tree-reassoc-width
9157 Set the maximum number of instructions executed in parallel in
9158 reassociated tree. This parameter overrides target dependent
9159 heuristics used by default if has non zero value.
9164 @node Preprocessor Options
9165 @section Options Controlling the Preprocessor
9166 @cindex preprocessor options
9167 @cindex options, preprocessor
9169 These options control the C preprocessor, which is run on each C source
9170 file before actual compilation.
9172 If you use the @option{-E} option, nothing is done except preprocessing.
9173 Some of these options make sense only together with @option{-E} because
9174 they cause the preprocessor output to be unsuitable for actual
9178 @item -Wp,@var{option}
9180 You can use @option{-Wp,@var{option}} to bypass the compiler driver
9181 and pass @var{option} directly through to the preprocessor. If
9182 @var{option} contains commas, it is split into multiple options at the
9183 commas. However, many options are modified, translated or interpreted
9184 by the compiler driver before being passed to the preprocessor, and
9185 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
9186 interface is undocumented and subject to change, so whenever possible
9187 you should avoid using @option{-Wp} and let the driver handle the
9190 @item -Xpreprocessor @var{option}
9191 @opindex Xpreprocessor
9192 Pass @var{option} as an option to the preprocessor. You can use this to
9193 supply system-specific preprocessor options which GCC does not know how to
9196 If you want to pass an option that takes an argument, you must use
9197 @option{-Xpreprocessor} twice, once for the option and once for the argument.
9200 @include cppopts.texi
9202 @node Assembler Options
9203 @section Passing Options to the Assembler
9205 @c prevent bad page break with this line
9206 You can pass options to the assembler.
9209 @item -Wa,@var{option}
9211 Pass @var{option} as an option to the assembler. If @var{option}
9212 contains commas, it is split into multiple options at the commas.
9214 @item -Xassembler @var{option}
9216 Pass @var{option} as an option to the assembler. You can use this to
9217 supply system-specific assembler options which GCC does not know how to
9220 If you want to pass an option that takes an argument, you must use
9221 @option{-Xassembler} twice, once for the option and once for the argument.
9226 @section Options for Linking
9227 @cindex link options
9228 @cindex options, linking
9230 These options come into play when the compiler links object files into
9231 an executable output file. They are meaningless if the compiler is
9232 not doing a link step.
9236 @item @var{object-file-name}
9237 A file name that does not end in a special recognized suffix is
9238 considered to name an object file or library. (Object files are
9239 distinguished from libraries by the linker according to the file
9240 contents.) If linking is done, these object files are used as input
9249 If any of these options is used, then the linker is not run, and
9250 object file names should not be used as arguments. @xref{Overall
9254 @item -l@var{library}
9255 @itemx -l @var{library}
9257 Search the library named @var{library} when linking. (The second
9258 alternative with the library as a separate argument is only for
9259 POSIX compliance and is not recommended.)
9261 It makes a difference where in the command you write this option; the
9262 linker searches and processes libraries and object files in the order they
9263 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
9264 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
9265 to functions in @samp{z}, those functions may not be loaded.
9267 The linker searches a standard list of directories for the library,
9268 which is actually a file named @file{lib@var{library}.a}. The linker
9269 then uses this file as if it had been specified precisely by name.
9271 The directories searched include several standard system directories
9272 plus any that you specify with @option{-L}.
9274 Normally the files found this way are library files---archive files
9275 whose members are object files. The linker handles an archive file by
9276 scanning through it for members which define symbols that have so far
9277 been referenced but not defined. But if the file that is found is an
9278 ordinary object file, it is linked in the usual fashion. The only
9279 difference between using an @option{-l} option and specifying a file name
9280 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
9281 and searches several directories.
9285 You need this special case of the @option{-l} option in order to
9286 link an Objective-C or Objective-C++ program.
9289 @opindex nostartfiles
9290 Do not use the standard system startup files when linking.
9291 The standard system libraries are used normally, unless @option{-nostdlib}
9292 or @option{-nodefaultlibs} is used.
9294 @item -nodefaultlibs
9295 @opindex nodefaultlibs
9296 Do not use the standard system libraries when linking.
9297 Only the libraries you specify will be passed to the linker, options
9298 specifying linkage of the system libraries, such as @code{-static-libgcc}
9299 or @code{-shared-libgcc}, will be ignored.
9300 The standard startup files are used normally, unless @option{-nostartfiles}
9301 is used. The compiler may generate calls to @code{memcmp},
9302 @code{memset}, @code{memcpy} and @code{memmove}.
9303 These entries are usually resolved by entries in
9304 libc. These entry points should be supplied through some other
9305 mechanism when this option is specified.
9309 Do not use the standard system startup files or libraries when linking.
9310 No startup files and only the libraries you specify will be passed to
9311 the linker, options specifying linkage of the system libraries, such as
9312 @code{-static-libgcc} or @code{-shared-libgcc}, will be ignored.
9313 The compiler may generate calls to @code{memcmp}, @code{memset},
9314 @code{memcpy} and @code{memmove}.
9315 These entries are usually resolved by entries in
9316 libc. These entry points should be supplied through some other
9317 mechanism when this option is specified.
9319 @cindex @option{-lgcc}, use with @option{-nostdlib}
9320 @cindex @option{-nostdlib} and unresolved references
9321 @cindex unresolved references and @option{-nostdlib}
9322 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
9323 @cindex @option{-nodefaultlibs} and unresolved references
9324 @cindex unresolved references and @option{-nodefaultlibs}
9325 One of the standard libraries bypassed by @option{-nostdlib} and
9326 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
9327 that GCC uses to overcome shortcomings of particular machines, or special
9328 needs for some languages.
9329 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
9330 Collection (GCC) Internals},
9331 for more discussion of @file{libgcc.a}.)
9332 In most cases, you need @file{libgcc.a} even when you want to avoid
9333 other standard libraries. In other words, when you specify @option{-nostdlib}
9334 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
9335 This ensures that you have no unresolved references to internal GCC
9336 library subroutines. (For example, @samp{__main}, used to ensure C++
9337 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
9338 GNU Compiler Collection (GCC) Internals}.)
9342 Produce a position independent executable on targets which support it.
9343 For predictable results, you must also specify the same set of options
9344 that were used to generate code (@option{-fpie}, @option{-fPIE},
9345 or model suboptions) when you specify this option.
9349 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
9350 that support it. This instructs the linker to add all symbols, not
9351 only used ones, to the dynamic symbol table. This option is needed
9352 for some uses of @code{dlopen} or to allow obtaining backtraces
9353 from within a program.
9357 Remove all symbol table and relocation information from the executable.
9361 On systems that support dynamic linking, this prevents linking with the shared
9362 libraries. On other systems, this option has no effect.
9366 Produce a shared object which can then be linked with other objects to
9367 form an executable. Not all systems support this option. For predictable
9368 results, you must also specify the same set of options that were used to
9369 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
9370 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
9371 needs to build supplementary stub code for constructors to work. On
9372 multi-libbed systems, @samp{gcc -shared} must select the correct support
9373 libraries to link against. Failing to supply the correct flags may lead
9374 to subtle defects. Supplying them in cases where they are not necessary
9377 @item -shared-libgcc
9378 @itemx -static-libgcc
9379 @opindex shared-libgcc
9380 @opindex static-libgcc
9381 On systems that provide @file{libgcc} as a shared library, these options
9382 force the use of either the shared or static version respectively.
9383 If no shared version of @file{libgcc} was built when the compiler was
9384 configured, these options have no effect.
9386 There are several situations in which an application should use the
9387 shared @file{libgcc} instead of the static version. The most common
9388 of these is when the application wishes to throw and catch exceptions
9389 across different shared libraries. In that case, each of the libraries
9390 as well as the application itself should use the shared @file{libgcc}.
9392 Therefore, the G++ and GCJ drivers automatically add
9393 @option{-shared-libgcc} whenever you build a shared library or a main
9394 executable, because C++ and Java programs typically use exceptions, so
9395 this is the right thing to do.
9397 If, instead, you use the GCC driver to create shared libraries, you may
9398 find that they will not always be linked with the shared @file{libgcc}.
9399 If GCC finds, at its configuration time, that you have a non-GNU linker
9400 or a GNU linker that does not support option @option{--eh-frame-hdr},
9401 it will link the shared version of @file{libgcc} into shared libraries
9402 by default. Otherwise, it will take advantage of the linker and optimize
9403 away the linking with the shared version of @file{libgcc}, linking with
9404 the static version of libgcc by default. This allows exceptions to
9405 propagate through such shared libraries, without incurring relocation
9406 costs at library load time.
9408 However, if a library or main executable is supposed to throw or catch
9409 exceptions, you must link it using the G++ or GCJ driver, as appropriate
9410 for the languages used in the program, or using the option
9411 @option{-shared-libgcc}, such that it is linked with the shared
9414 @item -static-libstdc++
9415 When the @command{g++} program is used to link a C++ program, it will
9416 normally automatically link against @option{libstdc++}. If
9417 @file{libstdc++} is available as a shared library, and the
9418 @option{-static} option is not used, then this will link against the
9419 shared version of @file{libstdc++}. That is normally fine. However, it
9420 is sometimes useful to freeze the version of @file{libstdc++} used by
9421 the program without going all the way to a fully static link. The
9422 @option{-static-libstdc++} option directs the @command{g++} driver to
9423 link @file{libstdc++} statically, without necessarily linking other
9424 libraries statically.
9428 Bind references to global symbols when building a shared object. Warn
9429 about any unresolved references (unless overridden by the link editor
9430 option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
9433 @item -T @var{script}
9435 @cindex linker script
9436 Use @var{script} as the linker script. This option is supported by most
9437 systems using the GNU linker. On some targets, such as bare-board
9438 targets without an operating system, the @option{-T} option may be required
9439 when linking to avoid references to undefined symbols.
9441 @item -Xlinker @var{option}
9443 Pass @var{option} as an option to the linker. You can use this to
9444 supply system-specific linker options which GCC does not know how to
9447 If you want to pass an option that takes a separate argument, you must use
9448 @option{-Xlinker} twice, once for the option and once for the argument.
9449 For example, to pass @option{-assert definitions}, you must write
9450 @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
9451 @option{-Xlinker "-assert definitions"}, because this passes the entire
9452 string as a single argument, which is not what the linker expects.
9454 When using the GNU linker, it is usually more convenient to pass
9455 arguments to linker options using the @option{@var{option}=@var{value}}
9456 syntax than as separate arguments. For example, you can specify
9457 @samp{-Xlinker -Map=output.map} rather than
9458 @samp{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
9459 this syntax for command-line options.
9461 @item -Wl,@var{option}
9463 Pass @var{option} as an option to the linker. If @var{option} contains
9464 commas, it is split into multiple options at the commas. You can use this
9465 syntax to pass an argument to the option.
9466 For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
9467 linker. When using the GNU linker, you can also get the same effect with
9468 @samp{-Wl,-Map=output.map}.
9470 @item -u @var{symbol}
9472 Pretend the symbol @var{symbol} is undefined, to force linking of
9473 library modules to define it. You can use @option{-u} multiple times with
9474 different symbols to force loading of additional library modules.
9477 @node Directory Options
9478 @section Options for Directory Search
9479 @cindex directory options
9480 @cindex options, directory search
9483 These options specify directories to search for header files, for
9484 libraries and for parts of the compiler:
9489 Add the directory @var{dir} to the head of the list of directories to be
9490 searched for header files. This can be used to override a system header
9491 file, substituting your own version, since these directories are
9492 searched before the system header file directories. However, you should
9493 not use this option to add directories that contain vendor-supplied
9494 system header files (use @option{-isystem} for that). If you use more than
9495 one @option{-I} option, the directories are scanned in left-to-right
9496 order; the standard system directories come after.
9498 If a standard system include directory, or a directory specified with
9499 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
9500 option will be ignored. The directory will still be searched but as a
9501 system directory at its normal position in the system include chain.
9502 This is to ensure that GCC's procedure to fix buggy system headers and
9503 the ordering for the include_next directive are not inadvertently changed.
9504 If you really need to change the search order for system directories,
9505 use the @option{-nostdinc} and/or @option{-isystem} options.
9507 @item -iplugindir=@var{dir}
9508 Set the directory to search for plugins which are passed
9509 by @option{-fplugin=@var{name}} instead of
9510 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
9511 to be used by the user, but only passed by the driver.
9513 @item -iquote@var{dir}
9515 Add the directory @var{dir} to the head of the list of directories to
9516 be searched for header files only for the case of @samp{#include
9517 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
9518 otherwise just like @option{-I}.
9522 Add directory @var{dir} to the list of directories to be searched
9525 @item -B@var{prefix}
9527 This option specifies where to find the executables, libraries,
9528 include files, and data files of the compiler itself.
9530 The compiler driver program runs one or more of the subprograms
9531 @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
9532 @var{prefix} as a prefix for each program it tries to run, both with and
9533 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
9535 For each subprogram to be run, the compiler driver first tries the
9536 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
9537 was not specified, the driver tries two standard prefixes, which are
9538 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
9539 those results in a file name that is found, the unmodified program
9540 name is searched for using the directories specified in your
9541 @env{PATH} environment variable.
9543 The compiler will check to see if the path provided by the @option{-B}
9544 refers to a directory, and if necessary it will add a directory
9545 separator character at the end of the path.
9547 @option{-B} prefixes that effectively specify directory names also apply
9548 to libraries in the linker, because the compiler translates these
9549 options into @option{-L} options for the linker. They also apply to
9550 includes files in the preprocessor, because the compiler translates these
9551 options into @option{-isystem} options for the preprocessor. In this case,
9552 the compiler appends @samp{include} to the prefix.
9554 The run-time support file @file{libgcc.a} can also be searched for using
9555 the @option{-B} prefix, if needed. If it is not found there, the two
9556 standard prefixes above are tried, and that is all. The file is left
9557 out of the link if it is not found by those means.
9559 Another way to specify a prefix much like the @option{-B} prefix is to use
9560 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
9563 As a special kludge, if the path provided by @option{-B} is
9564 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
9565 9, then it will be replaced by @file{[dir/]include}. This is to help
9566 with boot-strapping the compiler.
9568 @item -specs=@var{file}
9570 Process @var{file} after the compiler reads in the standard @file{specs}
9571 file, in order to override the defaults that the @file{gcc} driver
9572 program uses when determining what switches to pass to @file{cc1},
9573 @file{cc1plus}, @file{as}, @file{ld}, etc. More than one
9574 @option{-specs=@var{file}} can be specified on the command line, and they
9575 are processed in order, from left to right.
9577 @item --sysroot=@var{dir}
9579 Use @var{dir} as the logical root directory for headers and libraries.
9580 For example, if the compiler would normally search for headers in
9581 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
9582 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
9584 If you use both this option and the @option{-isysroot} option, then
9585 the @option{--sysroot} option will apply to libraries, but the
9586 @option{-isysroot} option will apply to header files.
9588 The GNU linker (beginning with version 2.16) has the necessary support
9589 for this option. If your linker does not support this option, the
9590 header file aspect of @option{--sysroot} will still work, but the
9591 library aspect will not.
9595 This option has been deprecated. Please use @option{-iquote} instead for
9596 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
9597 Any directories you specify with @option{-I} options before the @option{-I-}
9598 option are searched only for the case of @samp{#include "@var{file}"};
9599 they are not searched for @samp{#include <@var{file}>}.
9601 If additional directories are specified with @option{-I} options after
9602 the @option{-I-}, these directories are searched for all @samp{#include}
9603 directives. (Ordinarily @emph{all} @option{-I} directories are used
9606 In addition, the @option{-I-} option inhibits the use of the current
9607 directory (where the current input file came from) as the first search
9608 directory for @samp{#include "@var{file}"}. There is no way to
9609 override this effect of @option{-I-}. With @option{-I.} you can specify
9610 searching the directory which was current when the compiler was
9611 invoked. That is not exactly the same as what the preprocessor does
9612 by default, but it is often satisfactory.
9614 @option{-I-} does not inhibit the use of the standard system directories
9615 for header files. Thus, @option{-I-} and @option{-nostdinc} are
9622 @section Specifying subprocesses and the switches to pass to them
9625 @command{gcc} is a driver program. It performs its job by invoking a
9626 sequence of other programs to do the work of compiling, assembling and
9627 linking. GCC interprets its command-line parameters and uses these to
9628 deduce which programs it should invoke, and which command-line options
9629 it ought to place on their command lines. This behavior is controlled
9630 by @dfn{spec strings}. In most cases there is one spec string for each
9631 program that GCC can invoke, but a few programs have multiple spec
9632 strings to control their behavior. The spec strings built into GCC can
9633 be overridden by using the @option{-specs=} command-line switch to specify
9636 @dfn{Spec files} are plaintext files that are used to construct spec
9637 strings. They consist of a sequence of directives separated by blank
9638 lines. The type of directive is determined by the first non-whitespace
9639 character on the line and it can be one of the following:
9642 @item %@var{command}
9643 Issues a @var{command} to the spec file processor. The commands that can
9647 @item %include <@var{file}>
9648 @cindex @code{%include}
9649 Search for @var{file} and insert its text at the current point in the
9652 @item %include_noerr <@var{file}>
9653 @cindex @code{%include_noerr}
9654 Just like @samp{%include}, but do not generate an error message if the include
9655 file cannot be found.
9657 @item %rename @var{old_name} @var{new_name}
9658 @cindex @code{%rename}
9659 Rename the spec string @var{old_name} to @var{new_name}.
9663 @item *[@var{spec_name}]:
9664 This tells the compiler to create, override or delete the named spec
9665 string. All lines after this directive up to the next directive or
9666 blank line are considered to be the text for the spec string. If this
9667 results in an empty string then the spec will be deleted. (Or, if the
9668 spec did not exist, then nothing will happen.) Otherwise, if the spec
9669 does not currently exist a new spec will be created. If the spec does
9670 exist then its contents will be overridden by the text of this
9671 directive, unless the first character of that text is the @samp{+}
9672 character, in which case the text will be appended to the spec.
9674 @item [@var{suffix}]:
9675 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
9676 and up to the next directive or blank line are considered to make up the
9677 spec string for the indicated suffix. When the compiler encounters an
9678 input file with the named suffix, it will processes the spec string in
9679 order to work out how to compile that file. For example:
9686 This says that any input file whose name ends in @samp{.ZZ} should be
9687 passed to the program @samp{z-compile}, which should be invoked with the
9688 command-line switch @option{-input} and with the result of performing the
9689 @samp{%i} substitution. (See below.)
9691 As an alternative to providing a spec string, the text that follows a
9692 suffix directive can be one of the following:
9695 @item @@@var{language}
9696 This says that the suffix is an alias for a known @var{language}. This is
9697 similar to using the @option{-x} command-line switch to GCC to specify a
9698 language explicitly. For example:
9705 Says that .ZZ files are, in fact, C++ source files.
9708 This causes an error messages saying:
9711 @var{name} compiler not installed on this system.
9715 GCC already has an extensive list of suffixes built into it.
9716 This directive will add an entry to the end of the list of suffixes, but
9717 since the list is searched from the end backwards, it is effectively
9718 possible to override earlier entries using this technique.
9722 GCC has the following spec strings built into it. Spec files can
9723 override these strings or create their own. Note that individual
9724 targets can also add their own spec strings to this list.
9727 asm Options to pass to the assembler
9728 asm_final Options to pass to the assembler post-processor
9729 cpp Options to pass to the C preprocessor
9730 cc1 Options to pass to the C compiler
9731 cc1plus Options to pass to the C++ compiler
9732 endfile Object files to include at the end of the link
9733 link Options to pass to the linker
9734 lib Libraries to include on the command line to the linker
9735 libgcc Decides which GCC support library to pass to the linker
9736 linker Sets the name of the linker
9737 predefines Defines to be passed to the C preprocessor
9738 signed_char Defines to pass to CPP to say whether @code{char} is signed
9740 startfile Object files to include at the start of the link
9743 Here is a small example of a spec file:
9749 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
9752 This example renames the spec called @samp{lib} to @samp{old_lib} and
9753 then overrides the previous definition of @samp{lib} with a new one.
9754 The new definition adds in some extra command-line options before
9755 including the text of the old definition.
9757 @dfn{Spec strings} are a list of command-line options to be passed to their
9758 corresponding program. In addition, the spec strings can contain
9759 @samp{%}-prefixed sequences to substitute variable text or to
9760 conditionally insert text into the command line. Using these constructs
9761 it is possible to generate quite complex command lines.
9763 Here is a table of all defined @samp{%}-sequences for spec
9764 strings. Note that spaces are not generated automatically around the
9765 results of expanding these sequences. Therefore you can concatenate them
9766 together or combine them with constant text in a single argument.
9770 Substitute one @samp{%} into the program name or argument.
9773 Substitute the name of the input file being processed.
9776 Substitute the basename of the input file being processed.
9777 This is the substring up to (and not including) the last period
9778 and not including the directory.
9781 This is the same as @samp{%b}, but include the file suffix (text after
9785 Marks the argument containing or following the @samp{%d} as a
9786 temporary file name, so that that file will be deleted if GCC exits
9787 successfully. Unlike @samp{%g}, this contributes no text to the
9790 @item %g@var{suffix}
9791 Substitute a file name that has suffix @var{suffix} and is chosen
9792 once per compilation, and mark the argument in the same way as
9793 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
9794 name is now chosen in a way that is hard to predict even when previously
9795 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
9796 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
9797 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
9798 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
9799 was simply substituted with a file name chosen once per compilation,
9800 without regard to any appended suffix (which was therefore treated
9801 just like ordinary text), making such attacks more likely to succeed.
9803 @item %u@var{suffix}
9804 Like @samp{%g}, but generates a new temporary file name even if
9805 @samp{%u@var{suffix}} was already seen.
9807 @item %U@var{suffix}
9808 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
9809 new one if there is no such last file name. In the absence of any
9810 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
9811 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
9812 would involve the generation of two distinct file names, one
9813 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
9814 simply substituted with a file name chosen for the previous @samp{%u},
9815 without regard to any appended suffix.
9817 @item %j@var{suffix}
9818 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
9819 writable, and if save-temps is off; otherwise, substitute the name
9820 of a temporary file, just like @samp{%u}. This temporary file is not
9821 meant for communication between processes, but rather as a junk
9824 @item %|@var{suffix}
9825 @itemx %m@var{suffix}
9826 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
9827 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
9828 all. These are the two most common ways to instruct a program that it
9829 should read from standard input or write to standard output. If you
9830 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
9831 construct: see for example @file{f/lang-specs.h}.
9833 @item %.@var{SUFFIX}
9834 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
9835 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
9836 terminated by the next space or %.
9839 Marks the argument containing or following the @samp{%w} as the
9840 designated output file of this compilation. This puts the argument
9841 into the sequence of arguments that @samp{%o} will substitute later.
9844 Substitutes the names of all the output files, with spaces
9845 automatically placed around them. You should write spaces
9846 around the @samp{%o} as well or the results are undefined.
9847 @samp{%o} is for use in the specs for running the linker.
9848 Input files whose names have no recognized suffix are not compiled
9849 at all, but they are included among the output files, so they will
9853 Substitutes the suffix for object files. Note that this is
9854 handled specially when it immediately follows @samp{%g, %u, or %U},
9855 because of the need for those to form complete file names. The
9856 handling is such that @samp{%O} is treated exactly as if it had already
9857 been substituted, except that @samp{%g, %u, and %U} do not currently
9858 support additional @var{suffix} characters following @samp{%O} as they would
9859 following, for example, @samp{.o}.
9862 Substitutes the standard macro predefinitions for the
9863 current target machine. Use this when running @code{cpp}.
9866 Like @samp{%p}, but puts @samp{__} before and after the name of each
9867 predefined macro, except for macros that start with @samp{__} or with
9868 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
9872 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
9873 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
9874 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
9875 and @option{-imultilib} as necessary.
9878 Current argument is the name of a library or startup file of some sort.
9879 Search for that file in a standard list of directories and substitute
9880 the full name found. The current working directory is included in the
9881 list of directories scanned.
9884 Current argument is the name of a linker script. Search for that file
9885 in the current list of directories to scan for libraries. If the file
9886 is located insert a @option{--script} option into the command line
9887 followed by the full path name found. If the file is not found then
9888 generate an error message. Note: the current working directory is not
9892 Print @var{str} as an error message. @var{str} is terminated by a newline.
9893 Use this when inconsistent options are detected.
9896 Substitute the contents of spec string @var{name} at this point.
9898 @item %x@{@var{option}@}
9899 Accumulate an option for @samp{%X}.
9902 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
9906 Output the accumulated assembler options specified by @option{-Wa}.
9909 Output the accumulated preprocessor options specified by @option{-Wp}.
9912 Process the @code{asm} spec. This is used to compute the
9913 switches to be passed to the assembler.
9916 Process the @code{asm_final} spec. This is a spec string for
9917 passing switches to an assembler post-processor, if such a program is
9921 Process the @code{link} spec. This is the spec for computing the
9922 command line passed to the linker. Typically it will make use of the
9923 @samp{%L %G %S %D and %E} sequences.
9926 Dump out a @option{-L} option for each directory that GCC believes might
9927 contain startup files. If the target supports multilibs then the
9928 current multilib directory will be prepended to each of these paths.
9931 Process the @code{lib} spec. This is a spec string for deciding which
9932 libraries should be included on the command line to the linker.
9935 Process the @code{libgcc} spec. This is a spec string for deciding
9936 which GCC support library should be included on the command line to the linker.
9939 Process the @code{startfile} spec. This is a spec for deciding which
9940 object files should be the first ones passed to the linker. Typically
9941 this might be a file named @file{crt0.o}.
9944 Process the @code{endfile} spec. This is a spec string that specifies
9945 the last object files that will be passed to the linker.
9948 Process the @code{cpp} spec. This is used to construct the arguments
9949 to be passed to the C preprocessor.
9952 Process the @code{cc1} spec. This is used to construct the options to be
9953 passed to the actual C compiler (@samp{cc1}).
9956 Process the @code{cc1plus} spec. This is used to construct the options to be
9957 passed to the actual C++ compiler (@samp{cc1plus}).
9960 Substitute the variable part of a matched option. See below.
9961 Note that each comma in the substituted string is replaced by
9965 Remove all occurrences of @code{-S} from the command line. Note---this
9966 command is position dependent. @samp{%} commands in the spec string
9967 before this one will see @code{-S}, @samp{%} commands in the spec string
9968 after this one will not.
9970 @item %:@var{function}(@var{args})
9971 Call the named function @var{function}, passing it @var{args}.
9972 @var{args} is first processed as a nested spec string, then split
9973 into an argument vector in the usual fashion. The function returns
9974 a string which is processed as if it had appeared literally as part
9975 of the current spec.
9977 The following built-in spec functions are provided:
9981 The @code{getenv} spec function takes two arguments: an environment
9982 variable name and a string. If the environment variable is not
9983 defined, a fatal error is issued. Otherwise, the return value is the
9984 value of the environment variable concatenated with the string. For
9985 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
9988 %:getenv(TOPDIR /include)
9991 expands to @file{/path/to/top/include}.
9993 @item @code{if-exists}
9994 The @code{if-exists} spec function takes one argument, an absolute
9995 pathname to a file. If the file exists, @code{if-exists} returns the
9996 pathname. Here is a small example of its usage:
10000 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
10003 @item @code{if-exists-else}
10004 The @code{if-exists-else} spec function is similar to the @code{if-exists}
10005 spec function, except that it takes two arguments. The first argument is
10006 an absolute pathname to a file. If the file exists, @code{if-exists-else}
10007 returns the pathname. If it does not exist, it returns the second argument.
10008 This way, @code{if-exists-else} can be used to select one file or another,
10009 based on the existence of the first. Here is a small example of its usage:
10013 crt0%O%s %:if-exists(crti%O%s) \
10014 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
10017 @item @code{replace-outfile}
10018 The @code{replace-outfile} spec function takes two arguments. It looks for the
10019 first argument in the outfiles array and replaces it with the second argument. Here
10020 is a small example of its usage:
10023 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
10026 @item @code{remove-outfile}
10027 The @code{remove-outfile} spec function takes one argument. It looks for the
10028 first argument in the outfiles array and removes it. Here is a small example
10032 %:remove-outfile(-lm)
10035 @item @code{pass-through-libs}
10036 The @code{pass-through-libs} spec function takes any number of arguments. It
10037 finds any @option{-l} options and any non-options ending in ".a" (which it
10038 assumes are the names of linker input library archive files) and returns a
10039 result containing all the found arguments each prepended by
10040 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
10041 intended to be passed to the LTO linker plugin.
10044 %:pass-through-libs(%G %L %G)
10047 @item @code{print-asm-header}
10048 The @code{print-asm-header} function takes no arguments and simply
10049 prints a banner like:
10055 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
10058 It is used to separate compiler options from assembler options
10059 in the @option{--target-help} output.
10062 @item %@{@code{S}@}
10063 Substitutes the @code{-S} switch, if that switch was given to GCC@.
10064 If that switch was not specified, this substitutes nothing. Note that
10065 the leading dash is omitted when specifying this option, and it is
10066 automatically inserted if the substitution is performed. Thus the spec
10067 string @samp{%@{foo@}} would match the command-line option @option{-foo}
10068 and would output the command line option @option{-foo}.
10070 @item %W@{@code{S}@}
10071 Like %@{@code{S}@} but mark last argument supplied within as a file to be
10072 deleted on failure.
10074 @item %@{@code{S}*@}
10075 Substitutes all the switches specified to GCC whose names start
10076 with @code{-S}, but which also take an argument. This is used for
10077 switches like @option{-o}, @option{-D}, @option{-I}, etc.
10078 GCC considers @option{-o foo} as being
10079 one switch whose names starts with @samp{o}. %@{o*@} would substitute this
10080 text, including the space. Thus two arguments would be generated.
10082 @item %@{@code{S}*&@code{T}*@}
10083 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
10084 (the order of @code{S} and @code{T} in the spec is not significant).
10085 There can be any number of ampersand-separated variables; for each the
10086 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
10088 @item %@{@code{S}:@code{X}@}
10089 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
10091 @item %@{!@code{S}:@code{X}@}
10092 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
10094 @item %@{@code{S}*:@code{X}@}
10095 Substitutes @code{X} if one or more switches whose names start with
10096 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
10097 once, no matter how many such switches appeared. However, if @code{%*}
10098 appears somewhere in @code{X}, then @code{X} will be substituted once
10099 for each matching switch, with the @code{%*} replaced by the part of
10100 that switch that matched the @code{*}.
10102 @item %@{.@code{S}:@code{X}@}
10103 Substitutes @code{X}, if processing a file with suffix @code{S}.
10105 @item %@{!.@code{S}:@code{X}@}
10106 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
10108 @item %@{,@code{S}:@code{X}@}
10109 Substitutes @code{X}, if processing a file for language @code{S}.
10111 @item %@{!,@code{S}:@code{X}@}
10112 Substitutes @code{X}, if not processing a file for language @code{S}.
10114 @item %@{@code{S}|@code{P}:@code{X}@}
10115 Substitutes @code{X} if either @code{-S} or @code{-P} was given to
10116 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
10117 @code{*} sequences as well, although they have a stronger binding than
10118 the @samp{|}. If @code{%*} appears in @code{X}, all of the
10119 alternatives must be starred, and only the first matching alternative
10122 For example, a spec string like this:
10125 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
10128 will output the following command-line options from the following input
10129 command-line options:
10134 -d fred.c -foo -baz -boggle
10135 -d jim.d -bar -baz -boggle
10138 @item %@{S:X; T:Y; :D@}
10140 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
10141 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
10142 be as many clauses as you need. This may be combined with @code{.},
10143 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
10148 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
10149 construct may contain other nested @samp{%} constructs or spaces, or
10150 even newlines. They are processed as usual, as described above.
10151 Trailing white space in @code{X} is ignored. White space may also
10152 appear anywhere on the left side of the colon in these constructs,
10153 except between @code{.} or @code{*} and the corresponding word.
10155 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
10156 handled specifically in these constructs. If another value of
10157 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
10158 @option{-W} switch is found later in the command line, the earlier
10159 switch value is ignored, except with @{@code{S}*@} where @code{S} is
10160 just one letter, which passes all matching options.
10162 The character @samp{|} at the beginning of the predicate text is used to
10163 indicate that a command should be piped to the following command, but
10164 only if @option{-pipe} is specified.
10166 It is built into GCC which switches take arguments and which do not.
10167 (You might think it would be useful to generalize this to allow each
10168 compiler's spec to say which switches take arguments. But this cannot
10169 be done in a consistent fashion. GCC cannot even decide which input
10170 files have been specified without knowing which switches take arguments,
10171 and it must know which input files to compile in order to tell which
10174 GCC also knows implicitly that arguments starting in @option{-l} are to be
10175 treated as compiler output files, and passed to the linker in their
10176 proper position among the other output files.
10178 @c man begin OPTIONS
10180 @node Target Options
10181 @section Specifying Target Machine and Compiler Version
10182 @cindex target options
10183 @cindex cross compiling
10184 @cindex specifying machine version
10185 @cindex specifying compiler version and target machine
10186 @cindex compiler version, specifying
10187 @cindex target machine, specifying
10189 The usual way to run GCC is to run the executable called @command{gcc}, or
10190 @command{@var{machine}-gcc} when cross-compiling, or
10191 @command{@var{machine}-gcc-@var{version}} to run a version other than the
10192 one that was installed last.
10194 @node Submodel Options
10195 @section Hardware Models and Configurations
10196 @cindex submodel options
10197 @cindex specifying hardware config
10198 @cindex hardware models and configurations, specifying
10199 @cindex machine dependent options
10201 Each target machine types can have its own
10202 special options, starting with @samp{-m}, to choose among various
10203 hardware models or configurations---for example, 68010 vs 68020,
10204 floating coprocessor or none. A single installed version of the
10205 compiler can compile for any model or configuration, according to the
10208 Some configurations of the compiler also support additional special
10209 options, usually for compatibility with other compilers on the same
10212 @c This list is ordered alphanumerically by subsection name.
10213 @c It should be the same order and spelling as these options are listed
10214 @c in Machine Dependent Options
10219 * Blackfin Options::
10223 * DEC Alpha Options::
10224 * DEC Alpha/VMS Options::
10227 * GNU/Linux Options::
10230 * i386 and x86-64 Options::
10231 * i386 and x86-64 Windows Options::
10233 * IA-64/VMS Options::
10240 * MicroBlaze Options::
10243 * MN10300 Options::
10245 * picoChip Options::
10246 * PowerPC Options::
10247 * RS/6000 and PowerPC Options::
10249 * S/390 and zSeries Options::
10252 * Solaris 2 Options::
10255 * System V Options::
10258 * VxWorks Options::
10260 * Xstormy16 Options::
10262 * zSeries Options::
10266 @subsection ARM Options
10267 @cindex ARM options
10269 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
10273 @item -mabi=@var{name}
10275 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
10276 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
10279 @opindex mapcs-frame
10280 Generate a stack frame that is compliant with the ARM Procedure Call
10281 Standard for all functions, even if this is not strictly necessary for
10282 correct execution of the code. Specifying @option{-fomit-frame-pointer}
10283 with this option will cause the stack frames not to be generated for
10284 leaf functions. The default is @option{-mno-apcs-frame}.
10288 This is a synonym for @option{-mapcs-frame}.
10291 @c not currently implemented
10292 @item -mapcs-stack-check
10293 @opindex mapcs-stack-check
10294 Generate code to check the amount of stack space available upon entry to
10295 every function (that actually uses some stack space). If there is
10296 insufficient space available then either the function
10297 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
10298 called, depending upon the amount of stack space required. The run time
10299 system is required to provide these functions. The default is
10300 @option{-mno-apcs-stack-check}, since this produces smaller code.
10302 @c not currently implemented
10304 @opindex mapcs-float
10305 Pass floating point arguments using the float point registers. This is
10306 one of the variants of the APCS@. This option is recommended if the
10307 target hardware has a floating point unit or if a lot of floating point
10308 arithmetic is going to be performed by the code. The default is
10309 @option{-mno-apcs-float}, since integer only code is slightly increased in
10310 size if @option{-mapcs-float} is used.
10312 @c not currently implemented
10313 @item -mapcs-reentrant
10314 @opindex mapcs-reentrant
10315 Generate reentrant, position independent code. The default is
10316 @option{-mno-apcs-reentrant}.
10319 @item -mthumb-interwork
10320 @opindex mthumb-interwork
10321 Generate code which supports calling between the ARM and Thumb
10322 instruction sets. Without this option, on pre-v5 architectures, the
10323 two instruction sets cannot be reliably used inside one program. The
10324 default is @option{-mno-thumb-interwork}, since slightly larger code
10325 is generated when @option{-mthumb-interwork} is specified. In AAPCS
10326 configurations this option is meaningless.
10328 @item -mno-sched-prolog
10329 @opindex mno-sched-prolog
10330 Prevent the reordering of instructions in the function prolog, or the
10331 merging of those instruction with the instructions in the function's
10332 body. This means that all functions will start with a recognizable set
10333 of instructions (or in fact one of a choice from a small set of
10334 different function prologues), and this information can be used to
10335 locate the start if functions inside an executable piece of code. The
10336 default is @option{-msched-prolog}.
10338 @item -mfloat-abi=@var{name}
10339 @opindex mfloat-abi
10340 Specifies which floating-point ABI to use. Permissible values
10341 are: @samp{soft}, @samp{softfp} and @samp{hard}.
10343 Specifying @samp{soft} causes GCC to generate output containing
10344 library calls for floating-point operations.
10345 @samp{softfp} allows the generation of code using hardware floating-point
10346 instructions, but still uses the soft-float calling conventions.
10347 @samp{hard} allows generation of floating-point instructions
10348 and uses FPU-specific calling conventions.
10350 The default depends on the specific target configuration. Note that
10351 the hard-float and soft-float ABIs are not link-compatible; you must
10352 compile your entire program with the same ABI, and link with a
10353 compatible set of libraries.
10355 @item -mlittle-endian
10356 @opindex mlittle-endian
10357 Generate code for a processor running in little-endian mode. This is
10358 the default for all standard configurations.
10361 @opindex mbig-endian
10362 Generate code for a processor running in big-endian mode; the default is
10363 to compile code for a little-endian processor.
10365 @item -mwords-little-endian
10366 @opindex mwords-little-endian
10367 This option only applies when generating code for big-endian processors.
10368 Generate code for a little-endian word order but a big-endian byte
10369 order. That is, a byte order of the form @samp{32107654}. Note: this
10370 option should only be used if you require compatibility with code for
10371 big-endian ARM processors generated by versions of the compiler prior to
10372 2.8. This option is now deprecated.
10374 @item -mcpu=@var{name}
10376 This specifies the name of the target ARM processor. GCC uses this name
10377 to determine what kind of instructions it can emit when generating
10378 assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
10379 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
10380 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
10381 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
10382 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
10384 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
10385 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
10386 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
10387 @samp{strongarm1110},
10388 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
10389 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
10390 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
10391 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
10392 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
10393 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
10394 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
10395 @samp{cortex-a5}, @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a15},
10396 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
10397 @samp{cortex-m4}, @samp{cortex-m3},
10400 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
10401 @samp{fa526}, @samp{fa626},
10402 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}.
10405 @option{-mcpu=generic-@var{arch}} is also permissible, and is
10406 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
10407 See @option{-mtune} for more information.
10409 @option{-mcpu=native} causes the compiler to auto-detect the CPU
10410 of the build computer. At present, this feature is only supported on
10411 Linux, and not all architectures are recognised. If the auto-detect is
10412 unsuccessful the option has no effect.
10414 @item -mtune=@var{name}
10416 This option is very similar to the @option{-mcpu=} option, except that
10417 instead of specifying the actual target processor type, and hence
10418 restricting which instructions can be used, it specifies that GCC should
10419 tune the performance of the code as if the target were of the type
10420 specified in this option, but still choosing the instructions that it
10421 will generate based on the CPU specified by a @option{-mcpu=} option.
10422 For some ARM implementations better performance can be obtained by using
10425 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
10426 performance for a blend of processors within architecture @var{arch}.
10427 The aim is to generate code that run well on the current most popular
10428 processors, balancing between optimizations that benefit some CPUs in the
10429 range, and avoiding performance pitfalls of other CPUs. The effects of
10430 this option may change in future GCC versions as CPU models come and go.
10432 @option{-mtune=native} causes the compiler to auto-detect the CPU
10433 of the build computer. At present, this feature is only supported on
10434 Linux, and not all architectures are recognised. If the auto-detect is
10435 unsuccessful the option has no effect.
10437 @item -march=@var{name}
10439 This specifies the name of the target ARM architecture. GCC uses this
10440 name to determine what kind of instructions it can emit when generating
10441 assembly code. This option can be used in conjunction with or instead
10442 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
10443 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
10444 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
10445 @samp{armv6}, @samp{armv6j},
10446 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
10447 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
10448 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
10450 @option{-march=native} causes the compiler to auto-detect the architecture
10451 of the build computer. At present, this feature is only supported on
10452 Linux, and not all architectures are recognised. If the auto-detect is
10453 unsuccessful the option has no effect.
10455 @item -mfpu=@var{name}
10456 @itemx -mfpe=@var{number}
10457 @itemx -mfp=@var{number}
10461 This specifies what floating point hardware (or hardware emulation) is
10462 available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
10463 @samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-fp16},
10464 @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, @samp{vfpv3xd-fp16},
10465 @samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, @samp{vfpv4-d16},
10466 @samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
10467 @option{-mfp} and @option{-mfpe} are synonyms for
10468 @option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions
10471 If @option{-msoft-float} is specified this specifies the format of
10472 floating point values.
10474 If the selected floating-point hardware includes the NEON extension
10475 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
10476 operations will not be used by GCC's auto-vectorization pass unless
10477 @option{-funsafe-math-optimizations} is also specified. This is
10478 because NEON hardware does not fully implement the IEEE 754 standard for
10479 floating-point arithmetic (in particular denormal values are treated as
10480 zero), so the use of NEON instructions may lead to a loss of precision.
10482 @item -mfp16-format=@var{name}
10483 @opindex mfp16-format
10484 Specify the format of the @code{__fp16} half-precision floating-point type.
10485 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
10486 the default is @samp{none}, in which case the @code{__fp16} type is not
10487 defined. @xref{Half-Precision}, for more information.
10489 @item -mstructure-size-boundary=@var{n}
10490 @opindex mstructure-size-boundary
10491 The size of all structures and unions will be rounded up to a multiple
10492 of the number of bits set by this option. Permissible values are 8, 32
10493 and 64. The default value varies for different toolchains. For the COFF
10494 targeted toolchain the default value is 8. A value of 64 is only allowed
10495 if the underlying ABI supports it.
10497 Specifying the larger number can produce faster, more efficient code, but
10498 can also increase the size of the program. Different values are potentially
10499 incompatible. Code compiled with one value cannot necessarily expect to
10500 work with code or libraries compiled with another value, if they exchange
10501 information using structures or unions.
10503 @item -mabort-on-noreturn
10504 @opindex mabort-on-noreturn
10505 Generate a call to the function @code{abort} at the end of a
10506 @code{noreturn} function. It will be executed if the function tries to
10510 @itemx -mno-long-calls
10511 @opindex mlong-calls
10512 @opindex mno-long-calls
10513 Tells the compiler to perform function calls by first loading the
10514 address of the function into a register and then performing a subroutine
10515 call on this register. This switch is needed if the target function
10516 will lie outside of the 64 megabyte addressing range of the offset based
10517 version of subroutine call instruction.
10519 Even if this switch is enabled, not all function calls will be turned
10520 into long calls. The heuristic is that static functions, functions
10521 which have the @samp{short-call} attribute, functions that are inside
10522 the scope of a @samp{#pragma no_long_calls} directive and functions whose
10523 definitions have already been compiled within the current compilation
10524 unit, will not be turned into long calls. The exception to this rule is
10525 that weak function definitions, functions with the @samp{long-call}
10526 attribute or the @samp{section} attribute, and functions that are within
10527 the scope of a @samp{#pragma long_calls} directive, will always be
10528 turned into long calls.
10530 This feature is not enabled by default. Specifying
10531 @option{-mno-long-calls} will restore the default behavior, as will
10532 placing the function calls within the scope of a @samp{#pragma
10533 long_calls_off} directive. Note these switches have no effect on how
10534 the compiler generates code to handle function calls via function
10537 @item -msingle-pic-base
10538 @opindex msingle-pic-base
10539 Treat the register used for PIC addressing as read-only, rather than
10540 loading it in the prologue for each function. The run-time system is
10541 responsible for initializing this register with an appropriate value
10542 before execution begins.
10544 @item -mpic-register=@var{reg}
10545 @opindex mpic-register
10546 Specify the register to be used for PIC addressing. The default is R10
10547 unless stack-checking is enabled, when R9 is used.
10549 @item -mcirrus-fix-invalid-insns
10550 @opindex mcirrus-fix-invalid-insns
10551 @opindex mno-cirrus-fix-invalid-insns
10552 Insert NOPs into the instruction stream to in order to work around
10553 problems with invalid Maverick instruction combinations. This option
10554 is only valid if the @option{-mcpu=ep9312} option has been used to
10555 enable generation of instructions for the Cirrus Maverick floating
10556 point co-processor. This option is not enabled by default, since the
10557 problem is only present in older Maverick implementations. The default
10558 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
10561 @item -mpoke-function-name
10562 @opindex mpoke-function-name
10563 Write the name of each function into the text section, directly
10564 preceding the function prologue. The generated code is similar to this:
10568 .ascii "arm_poke_function_name", 0
10571 .word 0xff000000 + (t1 - t0)
10572 arm_poke_function_name
10574 stmfd sp!, @{fp, ip, lr, pc@}
10578 When performing a stack backtrace, code can inspect the value of
10579 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
10580 location @code{pc - 12} and the top 8 bits are set, then we know that
10581 there is a function name embedded immediately preceding this location
10582 and has length @code{((pc[-3]) & 0xff000000)}.
10589 Select between generating code that executes in ARM and Thumb
10590 states. The default for most configurations is to generate code
10591 that executes in ARM state, but the default can be changed by
10592 configuring GCC with the @option{--with-mode=}@var{state}
10596 @opindex mtpcs-frame
10597 Generate a stack frame that is compliant with the Thumb Procedure Call
10598 Standard for all non-leaf functions. (A leaf function is one that does
10599 not call any other functions.) The default is @option{-mno-tpcs-frame}.
10601 @item -mtpcs-leaf-frame
10602 @opindex mtpcs-leaf-frame
10603 Generate a stack frame that is compliant with the Thumb Procedure Call
10604 Standard for all leaf functions. (A leaf function is one that does
10605 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
10607 @item -mcallee-super-interworking
10608 @opindex mcallee-super-interworking
10609 Gives all externally visible functions in the file being compiled an ARM
10610 instruction set header which switches to Thumb mode before executing the
10611 rest of the function. This allows these functions to be called from
10612 non-interworking code. This option is not valid in AAPCS configurations
10613 because interworking is enabled by default.
10615 @item -mcaller-super-interworking
10616 @opindex mcaller-super-interworking
10617 Allows calls via function pointers (including virtual functions) to
10618 execute correctly regardless of whether the target code has been
10619 compiled for interworking or not. There is a small overhead in the cost
10620 of executing a function pointer if this option is enabled. This option
10621 is not valid in AAPCS configurations because interworking is enabled
10624 @item -mtp=@var{name}
10626 Specify the access model for the thread local storage pointer. The valid
10627 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
10628 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
10629 (supported in the arm6k architecture), and @option{auto}, which uses the
10630 best available method for the selected processor. The default setting is
10633 @item -mtls-dialect=@var{dialect}
10634 @opindex mtls-dialect
10635 Specify the dialect to use for accessing thread local storage. Two
10636 dialects are supported --- @option{gnu} and @option{gnu2}. The
10637 @option{gnu} dialect selects the original GNU scheme for supporting
10638 local and global dynamic TLS models. The @option{gnu2} dialect
10639 selects the GNU descriptor scheme, which provides better performance
10640 for shared libraries. The GNU descriptor scheme is compatible with
10641 the original scheme, but does require new assembler, linker and
10642 library support. Initial and local exec TLS models are unaffected by
10643 this option and always use the original scheme.
10645 @item -mword-relocations
10646 @opindex mword-relocations
10647 Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
10648 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
10649 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
10652 @item -mfix-cortex-m3-ldrd
10653 @opindex mfix-cortex-m3-ldrd
10654 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
10655 with overlapping destination and base registers are used. This option avoids
10656 generating these instructions. This option is enabled by default when
10657 @option{-mcpu=cortex-m3} is specified.
10662 @subsection AVR Options
10663 @cindex AVR Options
10665 These options are defined for AVR implementations:
10668 @item -mmcu=@var{mcu}
10670 Specify ATMEL AVR instruction set or MCU type.
10672 Instruction set avr1 is for the minimal AVR core, not supported by the C
10673 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
10674 attiny11, attiny12, attiny15, attiny28).
10676 Instruction set avr2 (default) is for the classic AVR core with up to
10677 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
10678 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
10679 at90c8534, at90s8535).
10681 Instruction set avr3 is for the classic AVR core with up to 128K program
10682 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
10684 Instruction set avr4 is for the enhanced AVR core with up to 8K program
10685 memory space (MCU types: atmega8, atmega83, atmega85).
10687 Instruction set avr5 is for the enhanced AVR core with up to 128K program
10688 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
10689 atmega64, atmega128, at43usb355, at94k).
10691 @item -mno-interrupts
10692 @opindex mno-interrupts
10693 Generated code is not compatible with hardware interrupts.
10694 Code size will be smaller.
10696 @item -mcall-prologues
10697 @opindex mcall-prologues
10698 Functions prologues/epilogues expanded as call to appropriate
10699 subroutines. Code size will be smaller.
10702 @opindex mtiny-stack
10703 Change only the low 8 bits of the stack pointer.
10707 Assume int to be 8 bit integer. This affects the sizes of all types: A
10708 char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
10709 and long long will be 4 bytes. Please note that this option does not
10710 comply to the C standards, but it will provide you with smaller code
10715 Use register @code{X} in a way proposed by the hardware. This means
10716 that @code{X} will only be used in indirect, post-increment or
10717 pre-decrement addressing.
10719 Without this option, the @code{X} register may be used in the same way
10720 as @code{Y} or @code{Z} which then is emulated by additional
10722 For example, loading a value with @code{X+const} addressing with a
10723 small @code{const <= 63} to a register @var{Rn} will be printed as
10731 @subsubsection @code{EIND} and Devices with more than 128k Bytes of Flash
10733 Pointers in the implementation are 16 bits wide.
10734 The address of a function or label is represented as word address so
10735 that indirect jumps and calls can address any code address in the
10736 range of 64k words.
10738 In order to faciliate indirect jump on devices with more than 128k
10739 bytes of program memory space, there is a special function register called
10740 @code{EIND} that serves as most significant part of the target address
10741 when @code{EICALL} or @code{EIJMP} instructions are used.
10743 Indirect jumps and calls on these devices are handled as follows and
10744 are subject to some limitations:
10749 The compiler never sets @code{EIND}.
10752 The startup code from libgcc never sets @code{EIND}.
10753 Notice that startup code is a blend of code from libgcc and avr-libc.
10754 For the impact of avr-libc on @code{EIND}, see the
10755 @w{@uref{http://nongnu.org/avr-libc/user-manual,avr-libc user manual}}.
10758 The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
10759 instructions or might read @code{EIND} directly.
10762 The compiler assumes that @code{EIND} never changes during the startup
10763 code or run of the application. In particular, @code{EIND} is not
10764 saved/restored in function or interrupt service routine
10768 It is legitimate for user-specific startup code to set up @code{EIND}
10769 early, for example by means of initialization code located in
10770 section @code{.init3}, and thus prior to general startup code that
10771 initializes RAM and calls constructors.
10774 For indirect calls to functions and computed goto, the linker will
10775 generate @emph{stubs}. Stubs are jump pads sometimes also called
10776 @emph{trampolines}. Thus, the indirect call/jump will jump to such a stub.
10777 The stub contains a direct jump to the desired address.
10780 Stubs will be generated automatically by the linker if
10781 the following two conditions are met:
10784 @item The address of a label is taken by means of the @code{gs} modifier
10785 (short for @emph{generate stubs}) like so:
10787 LDI r24, lo8(gs(@var{func}))
10788 LDI r25, hi8(gs(@var{func}))
10790 @item The final location of that label is in a code segment
10791 @emph{outside} the segment where the stubs are located.
10795 The compiler will emit such @code{gs} modifiers for code labels in the
10796 following situations:
10798 @item Taking address of a function or code label.
10799 @item Computed goto.
10800 @item If prologue-save function is used, see @option{-mcall-prologues}
10801 command line option.
10802 @item Switch/case dispatch tables. If you do not want such dispatch
10803 tables you can specify the @option{-fno-jump-tables} command line option.
10804 @item C and C++ constructors/destructors called during startup/shutdown.
10805 @item If the tools hit a @code{gs()} modifier explained above.
10809 The default linker script is arranged for code with @code{EIND = 0}.
10810 If code is supposed to work for a setup with @code{EIND != 0}, a custom
10811 linker script has to be used in order to place the sections whose
10812 name start with @code{.trampolines} into the segment where @code{EIND}
10816 Jumping to non-symbolic addresses like so is @emph{not} supported:
10821 /* Call function at word address 0x2 */
10822 return ((int(*)(void)) 0x2)();
10826 Instead, a stub has to be set up:
10831 extern int func_4 (void);
10833 /* Call function at byte address 0x4 */
10838 and the application be linked with @code{-Wl,--defsym,func_4=0x4}.
10839 Alternatively, @code{func_4} can be defined in the linker script.
10842 @node Blackfin Options
10843 @subsection Blackfin Options
10844 @cindex Blackfin Options
10847 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
10849 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
10850 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
10851 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
10852 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
10853 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
10854 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
10855 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
10856 @samp{bf561}, @samp{bf592}.
10857 The optional @var{sirevision} specifies the silicon revision of the target
10858 Blackfin processor. Any workarounds available for the targeted silicon revision
10859 will be enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
10860 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
10861 will be enabled. The @code{__SILICON_REVISION__} macro is defined to two
10862 hexadecimal digits representing the major and minor numbers in the silicon
10863 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
10864 is not defined. If @var{sirevision} is @samp{any}, the
10865 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
10866 If this optional @var{sirevision} is not used, GCC assumes the latest known
10867 silicon revision of the targeted Blackfin processor.
10869 Support for @samp{bf561} is incomplete. For @samp{bf561},
10870 Only the processor macro is defined.
10871 Without this option, @samp{bf532} is used as the processor by default.
10872 The corresponding predefined processor macros for @var{cpu} is to
10873 be defined. And for @samp{bfin-elf} toolchain, this causes the hardware BSP
10874 provided by libgloss to be linked in if @option{-msim} is not given.
10878 Specifies that the program will be run on the simulator. This causes
10879 the simulator BSP provided by libgloss to be linked in. This option
10880 has effect only for @samp{bfin-elf} toolchain.
10881 Certain other options, such as @option{-mid-shared-library} and
10882 @option{-mfdpic}, imply @option{-msim}.
10884 @item -momit-leaf-frame-pointer
10885 @opindex momit-leaf-frame-pointer
10886 Don't keep the frame pointer in a register for leaf functions. This
10887 avoids the instructions to save, set up and restore frame pointers and
10888 makes an extra register available in leaf functions. The option
10889 @option{-fomit-frame-pointer} removes the frame pointer for all functions
10890 which might make debugging harder.
10892 @item -mspecld-anomaly
10893 @opindex mspecld-anomaly
10894 When enabled, the compiler will ensure that the generated code does not
10895 contain speculative loads after jump instructions. If this option is used,
10896 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
10898 @item -mno-specld-anomaly
10899 @opindex mno-specld-anomaly
10900 Don't generate extra code to prevent speculative loads from occurring.
10902 @item -mcsync-anomaly
10903 @opindex mcsync-anomaly
10904 When enabled, the compiler will ensure that the generated code does not
10905 contain CSYNC or SSYNC instructions too soon after conditional branches.
10906 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
10908 @item -mno-csync-anomaly
10909 @opindex mno-csync-anomaly
10910 Don't generate extra code to prevent CSYNC or SSYNC instructions from
10911 occurring too soon after a conditional branch.
10915 When enabled, the compiler is free to take advantage of the knowledge that
10916 the entire program fits into the low 64k of memory.
10919 @opindex mno-low-64k
10920 Assume that the program is arbitrarily large. This is the default.
10922 @item -mstack-check-l1
10923 @opindex mstack-check-l1
10924 Do stack checking using information placed into L1 scratchpad memory by the
10927 @item -mid-shared-library
10928 @opindex mid-shared-library
10929 Generate code that supports shared libraries via the library ID method.
10930 This allows for execute in place and shared libraries in an environment
10931 without virtual memory management. This option implies @option{-fPIC}.
10932 With a @samp{bfin-elf} target, this option implies @option{-msim}.
10934 @item -mno-id-shared-library
10935 @opindex mno-id-shared-library
10936 Generate code that doesn't assume ID based shared libraries are being used.
10937 This is the default.
10939 @item -mleaf-id-shared-library
10940 @opindex mleaf-id-shared-library
10941 Generate code that supports shared libraries via the library ID method,
10942 but assumes that this library or executable won't link against any other
10943 ID shared libraries. That allows the compiler to use faster code for jumps
10946 @item -mno-leaf-id-shared-library
10947 @opindex mno-leaf-id-shared-library
10948 Do not assume that the code being compiled won't link against any ID shared
10949 libraries. Slower code will be generated for jump and call insns.
10951 @item -mshared-library-id=n
10952 @opindex mshared-library-id
10953 Specified the identification number of the ID based shared library being
10954 compiled. Specifying a value of 0 will generate more compact code, specifying
10955 other values will force the allocation of that number to the current
10956 library but is no more space or time efficient than omitting this option.
10960 Generate code that allows the data segment to be located in a different
10961 area of memory from the text segment. This allows for execute in place in
10962 an environment without virtual memory management by eliminating relocations
10963 against the text section.
10965 @item -mno-sep-data
10966 @opindex mno-sep-data
10967 Generate code that assumes that the data segment follows the text segment.
10968 This is the default.
10971 @itemx -mno-long-calls
10972 @opindex mlong-calls
10973 @opindex mno-long-calls
10974 Tells the compiler to perform function calls by first loading the
10975 address of the function into a register and then performing a subroutine
10976 call on this register. This switch is needed if the target function
10977 will lie outside of the 24 bit addressing range of the offset based
10978 version of subroutine call instruction.
10980 This feature is not enabled by default. Specifying
10981 @option{-mno-long-calls} will restore the default behavior. Note these
10982 switches have no effect on how the compiler generates code to handle
10983 function calls via function pointers.
10987 Link with the fast floating-point library. This library relaxes some of
10988 the IEEE floating-point standard's rules for checking inputs against
10989 Not-a-Number (NAN), in the interest of performance.
10992 @opindex minline-plt
10993 Enable inlining of PLT entries in function calls to functions that are
10994 not known to bind locally. It has no effect without @option{-mfdpic}.
10997 @opindex mmulticore
10998 Build standalone application for multicore Blackfin processor. Proper
10999 start files and link scripts will be used to support multicore.
11000 This option defines @code{__BFIN_MULTICORE}. It can only be used with
11001 @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
11002 @option{-mcorea} or @option{-mcoreb}. If it's used without
11003 @option{-mcorea} or @option{-mcoreb}, single application/dual core
11004 programming model is used. In this model, the main function of Core B
11005 should be named as coreb_main. If it's used with @option{-mcorea} or
11006 @option{-mcoreb}, one application per core programming model is used.
11007 If this option is not used, single core application programming
11012 Build standalone application for Core A of BF561 when using
11013 one application per core programming model. Proper start files
11014 and link scripts will be used to support Core A. This option
11015 defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
11019 Build standalone application for Core B of BF561 when using
11020 one application per core programming model. Proper start files
11021 and link scripts will be used to support Core B. This option
11022 defines @code{__BFIN_COREB}. When this option is used, coreb_main
11023 should be used instead of main. It must be used with
11024 @option{-mmulticore}.
11028 Build standalone application for SDRAM. Proper start files and
11029 link scripts will be used to put the application into SDRAM.
11030 Loader should initialize SDRAM before loading the application
11031 into SDRAM. This option defines @code{__BFIN_SDRAM}.
11035 Assume that ICPLBs are enabled at runtime. This has an effect on certain
11036 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
11037 are enabled; for standalone applications the default is off.
11041 @subsection C6X Options
11042 @cindex C6X Options
11045 @item -march=@var{name}
11047 This specifies the name of the target architecture. GCC uses this
11048 name to determine what kind of instructions it can emit when generating
11049 assembly code. Permissible names are: @samp{c62x},
11050 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
11053 @opindex mbig-endian
11054 Generate code for a big endian target.
11056 @item -mlittle-endian
11057 @opindex mlittle-endian
11058 Generate code for a little endian target. This is the default.
11062 Choose startup files and linker script suitable for the simulator.
11064 @item -msdata=default
11065 @opindex msdata=default
11066 Put small global and static data in the @samp{.neardata} section,
11067 which is pointed to by register @code{B14}. Put small uninitialized
11068 global and static data in the @samp{.bss} section, which is adjacent
11069 to the @samp{.neardata} section. Put small read-only data into the
11070 @samp{.rodata} section. The corresponding sections used for large
11071 pieces of data are @samp{.fardata}, @samp{.far} and @samp{.const}.
11074 @opindex msdata=all
11075 Put all data, not just small objets, into the sections reserved for
11076 small data, and use addressing relative to the @code{B14} register to
11080 @opindex msdata=none
11081 Make no use of the sections reserved for small data, and use absolute
11082 addresses to access all data. Put all initialized global and static
11083 data in the @samp{.fardata} section, and all uninitialized data in the
11084 @samp{.far} section. Put all constant data into the @samp{.const}
11089 @subsection CRIS Options
11090 @cindex CRIS Options
11092 These options are defined specifically for the CRIS ports.
11095 @item -march=@var{architecture-type}
11096 @itemx -mcpu=@var{architecture-type}
11099 Generate code for the specified architecture. The choices for
11100 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
11101 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
11102 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
11105 @item -mtune=@var{architecture-type}
11107 Tune to @var{architecture-type} everything applicable about the generated
11108 code, except for the ABI and the set of available instructions. The
11109 choices for @var{architecture-type} are the same as for
11110 @option{-march=@var{architecture-type}}.
11112 @item -mmax-stack-frame=@var{n}
11113 @opindex mmax-stack-frame
11114 Warn when the stack frame of a function exceeds @var{n} bytes.
11120 The options @option{-metrax4} and @option{-metrax100} are synonyms for
11121 @option{-march=v3} and @option{-march=v8} respectively.
11123 @item -mmul-bug-workaround
11124 @itemx -mno-mul-bug-workaround
11125 @opindex mmul-bug-workaround
11126 @opindex mno-mul-bug-workaround
11127 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
11128 models where it applies. This option is active by default.
11132 Enable CRIS-specific verbose debug-related information in the assembly
11133 code. This option also has the effect to turn off the @samp{#NO_APP}
11134 formatted-code indicator to the assembler at the beginning of the
11139 Do not use condition-code results from previous instruction; always emit
11140 compare and test instructions before use of condition codes.
11142 @item -mno-side-effects
11143 @opindex mno-side-effects
11144 Do not emit instructions with side-effects in addressing modes other than
11147 @item -mstack-align
11148 @itemx -mno-stack-align
11149 @itemx -mdata-align
11150 @itemx -mno-data-align
11151 @itemx -mconst-align
11152 @itemx -mno-const-align
11153 @opindex mstack-align
11154 @opindex mno-stack-align
11155 @opindex mdata-align
11156 @opindex mno-data-align
11157 @opindex mconst-align
11158 @opindex mno-const-align
11159 These options (no-options) arranges (eliminate arrangements) for the
11160 stack-frame, individual data and constants to be aligned for the maximum
11161 single data access size for the chosen CPU model. The default is to
11162 arrange for 32-bit alignment. ABI details such as structure layout are
11163 not affected by these options.
11171 Similar to the stack- data- and const-align options above, these options
11172 arrange for stack-frame, writable data and constants to all be 32-bit,
11173 16-bit or 8-bit aligned. The default is 32-bit alignment.
11175 @item -mno-prologue-epilogue
11176 @itemx -mprologue-epilogue
11177 @opindex mno-prologue-epilogue
11178 @opindex mprologue-epilogue
11179 With @option{-mno-prologue-epilogue}, the normal function prologue and
11180 epilogue that sets up the stack-frame are omitted and no return
11181 instructions or return sequences are generated in the code. Use this
11182 option only together with visual inspection of the compiled code: no
11183 warnings or errors are generated when call-saved registers must be saved,
11184 or storage for local variable needs to be allocated.
11188 @opindex mno-gotplt
11190 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
11191 instruction sequences that load addresses for functions from the PLT part
11192 of the GOT rather than (traditional on other architectures) calls to the
11193 PLT@. The default is @option{-mgotplt}.
11197 Legacy no-op option only recognized with the cris-axis-elf and
11198 cris-axis-linux-gnu targets.
11202 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
11206 This option, recognized for the cris-axis-elf arranges
11207 to link with input-output functions from a simulator library. Code,
11208 initialized data and zero-initialized data are allocated consecutively.
11212 Like @option{-sim}, but pass linker options to locate initialized data at
11213 0x40000000 and zero-initialized data at 0x80000000.
11216 @node Darwin Options
11217 @subsection Darwin Options
11218 @cindex Darwin options
11220 These options are defined for all architectures running the Darwin operating
11223 FSF GCC on Darwin does not create ``fat'' object files; it will create
11224 an object file for the single architecture that it was built to
11225 target. Apple's GCC on Darwin does create ``fat'' files if multiple
11226 @option{-arch} options are used; it does so by running the compiler or
11227 linker multiple times and joining the results together with
11230 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
11231 @samp{i686}) is determined by the flags that specify the ISA
11232 that GCC is targetting, like @option{-mcpu} or @option{-march}. The
11233 @option{-force_cpusubtype_ALL} option can be used to override this.
11235 The Darwin tools vary in their behavior when presented with an ISA
11236 mismatch. The assembler, @file{as}, will only permit instructions to
11237 be used that are valid for the subtype of the file it is generating,
11238 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
11239 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
11240 and print an error if asked to create a shared library with a less
11241 restrictive subtype than its input files (for instance, trying to put
11242 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
11243 for executables, @file{ld}, will quietly give the executable the most
11244 restrictive subtype of any of its input files.
11249 Add the framework directory @var{dir} to the head of the list of
11250 directories to be searched for header files. These directories are
11251 interleaved with those specified by @option{-I} options and are
11252 scanned in a left-to-right order.
11254 A framework directory is a directory with frameworks in it. A
11255 framework is a directory with a @samp{"Headers"} and/or
11256 @samp{"PrivateHeaders"} directory contained directly in it that ends
11257 in @samp{".framework"}. The name of a framework is the name of this
11258 directory excluding the @samp{".framework"}. Headers associated with
11259 the framework are found in one of those two directories, with
11260 @samp{"Headers"} being searched first. A subframework is a framework
11261 directory that is in a framework's @samp{"Frameworks"} directory.
11262 Includes of subframework headers can only appear in a header of a
11263 framework that contains the subframework, or in a sibling subframework
11264 header. Two subframeworks are siblings if they occur in the same
11265 framework. A subframework should not have the same name as a
11266 framework, a warning will be issued if this is violated. Currently a
11267 subframework cannot have subframeworks, in the future, the mechanism
11268 may be extended to support this. The standard frameworks can be found
11269 in @samp{"/System/Library/Frameworks"} and
11270 @samp{"/Library/Frameworks"}. An example include looks like
11271 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
11272 the name of the framework and header.h is found in the
11273 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
11275 @item -iframework@var{dir}
11276 @opindex iframework
11277 Like @option{-F} except the directory is a treated as a system
11278 directory. The main difference between this @option{-iframework} and
11279 @option{-F} is that with @option{-iframework} the compiler does not
11280 warn about constructs contained within header files found via
11281 @var{dir}. This option is valid only for the C family of languages.
11285 Emit debugging information for symbols that are used. For STABS
11286 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
11287 This is by default ON@.
11291 Emit debugging information for all symbols and types.
11293 @item -mmacosx-version-min=@var{version}
11294 The earliest version of MacOS X that this executable will run on
11295 is @var{version}. Typical values of @var{version} include @code{10.1},
11296 @code{10.2}, and @code{10.3.9}.
11298 If the compiler was built to use the system's headers by default,
11299 then the default for this option is the system version on which the
11300 compiler is running, otherwise the default is to make choices which
11301 are compatible with as many systems and code bases as possible.
11305 Enable kernel development mode. The @option{-mkernel} option sets
11306 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
11307 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
11308 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
11309 applicable. This mode also sets @option{-mno-altivec},
11310 @option{-msoft-float}, @option{-fno-builtin} and
11311 @option{-mlong-branch} for PowerPC targets.
11313 @item -mone-byte-bool
11314 @opindex mone-byte-bool
11315 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
11316 By default @samp{sizeof(bool)} is @samp{4} when compiling for
11317 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
11318 option has no effect on x86.
11320 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
11321 to generate code that is not binary compatible with code generated
11322 without that switch. Using this switch may require recompiling all
11323 other modules in a program, including system libraries. Use this
11324 switch to conform to a non-default data model.
11326 @item -mfix-and-continue
11327 @itemx -ffix-and-continue
11328 @itemx -findirect-data
11329 @opindex mfix-and-continue
11330 @opindex ffix-and-continue
11331 @opindex findirect-data
11332 Generate code suitable for fast turn around development. Needed to
11333 enable gdb to dynamically load @code{.o} files into already running
11334 programs. @option{-findirect-data} and @option{-ffix-and-continue}
11335 are provided for backwards compatibility.
11339 Loads all members of static archive libraries.
11340 See man ld(1) for more information.
11342 @item -arch_errors_fatal
11343 @opindex arch_errors_fatal
11344 Cause the errors having to do with files that have the wrong architecture
11347 @item -bind_at_load
11348 @opindex bind_at_load
11349 Causes the output file to be marked such that the dynamic linker will
11350 bind all undefined references when the file is loaded or launched.
11354 Produce a Mach-o bundle format file.
11355 See man ld(1) for more information.
11357 @item -bundle_loader @var{executable}
11358 @opindex bundle_loader
11359 This option specifies the @var{executable} that will be loading the build
11360 output file being linked. See man ld(1) for more information.
11363 @opindex dynamiclib
11364 When passed this option, GCC will produce a dynamic library instead of
11365 an executable when linking, using the Darwin @file{libtool} command.
11367 @item -force_cpusubtype_ALL
11368 @opindex force_cpusubtype_ALL
11369 This causes GCC's output file to have the @var{ALL} subtype, instead of
11370 one controlled by the @option{-mcpu} or @option{-march} option.
11372 @item -allowable_client @var{client_name}
11373 @itemx -client_name
11374 @itemx -compatibility_version
11375 @itemx -current_version
11377 @itemx -dependency-file
11379 @itemx -dylinker_install_name
11381 @itemx -exported_symbols_list
11384 @itemx -flat_namespace
11385 @itemx -force_flat_namespace
11386 @itemx -headerpad_max_install_names
11389 @itemx -install_name
11390 @itemx -keep_private_externs
11391 @itemx -multi_module
11392 @itemx -multiply_defined
11393 @itemx -multiply_defined_unused
11396 @itemx -no_dead_strip_inits_and_terms
11397 @itemx -nofixprebinding
11398 @itemx -nomultidefs
11400 @itemx -noseglinkedit
11401 @itemx -pagezero_size
11403 @itemx -prebind_all_twolevel_modules
11404 @itemx -private_bundle
11406 @itemx -read_only_relocs
11408 @itemx -sectobjectsymbols
11412 @itemx -sectobjectsymbols
11415 @itemx -segs_read_only_addr
11417 @itemx -segs_read_write_addr
11418 @itemx -seg_addr_table
11419 @itemx -seg_addr_table_filename
11420 @itemx -seglinkedit
11422 @itemx -segs_read_only_addr
11423 @itemx -segs_read_write_addr
11424 @itemx -single_module
11426 @itemx -sub_library
11428 @itemx -sub_umbrella
11429 @itemx -twolevel_namespace
11432 @itemx -unexported_symbols_list
11433 @itemx -weak_reference_mismatches
11434 @itemx -whatsloaded
11435 @opindex allowable_client
11436 @opindex client_name
11437 @opindex compatibility_version
11438 @opindex current_version
11439 @opindex dead_strip
11440 @opindex dependency-file
11441 @opindex dylib_file
11442 @opindex dylinker_install_name
11444 @opindex exported_symbols_list
11446 @opindex flat_namespace
11447 @opindex force_flat_namespace
11448 @opindex headerpad_max_install_names
11449 @opindex image_base
11451 @opindex install_name
11452 @opindex keep_private_externs
11453 @opindex multi_module
11454 @opindex multiply_defined
11455 @opindex multiply_defined_unused
11456 @opindex noall_load
11457 @opindex no_dead_strip_inits_and_terms
11458 @opindex nofixprebinding
11459 @opindex nomultidefs
11461 @opindex noseglinkedit
11462 @opindex pagezero_size
11464 @opindex prebind_all_twolevel_modules
11465 @opindex private_bundle
11466 @opindex read_only_relocs
11468 @opindex sectobjectsymbols
11471 @opindex sectcreate
11472 @opindex sectobjectsymbols
11475 @opindex segs_read_only_addr
11476 @opindex segs_read_write_addr
11477 @opindex seg_addr_table
11478 @opindex seg_addr_table_filename
11479 @opindex seglinkedit
11481 @opindex segs_read_only_addr
11482 @opindex segs_read_write_addr
11483 @opindex single_module
11485 @opindex sub_library
11486 @opindex sub_umbrella
11487 @opindex twolevel_namespace
11490 @opindex unexported_symbols_list
11491 @opindex weak_reference_mismatches
11492 @opindex whatsloaded
11493 These options are passed to the Darwin linker. The Darwin linker man page
11494 describes them in detail.
11497 @node DEC Alpha Options
11498 @subsection DEC Alpha Options
11500 These @samp{-m} options are defined for the DEC Alpha implementations:
11503 @item -mno-soft-float
11504 @itemx -msoft-float
11505 @opindex mno-soft-float
11506 @opindex msoft-float
11507 Use (do not use) the hardware floating-point instructions for
11508 floating-point operations. When @option{-msoft-float} is specified,
11509 functions in @file{libgcc.a} will be used to perform floating-point
11510 operations. Unless they are replaced by routines that emulate the
11511 floating-point operations, or compiled in such a way as to call such
11512 emulations routines, these routines will issue floating-point
11513 operations. If you are compiling for an Alpha without floating-point
11514 operations, you must ensure that the library is built so as not to call
11517 Note that Alpha implementations without floating-point operations are
11518 required to have floating-point registers.
11521 @itemx -mno-fp-regs
11523 @opindex mno-fp-regs
11524 Generate code that uses (does not use) the floating-point register set.
11525 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
11526 register set is not used, floating point operands are passed in integer
11527 registers as if they were integers and floating-point results are passed
11528 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
11529 so any function with a floating-point argument or return value called by code
11530 compiled with @option{-mno-fp-regs} must also be compiled with that
11533 A typical use of this option is building a kernel that does not use,
11534 and hence need not save and restore, any floating-point registers.
11538 The Alpha architecture implements floating-point hardware optimized for
11539 maximum performance. It is mostly compliant with the IEEE floating
11540 point standard. However, for full compliance, software assistance is
11541 required. This option generates code fully IEEE compliant code
11542 @emph{except} that the @var{inexact-flag} is not maintained (see below).
11543 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
11544 defined during compilation. The resulting code is less efficient but is
11545 able to correctly support denormalized numbers and exceptional IEEE
11546 values such as not-a-number and plus/minus infinity. Other Alpha
11547 compilers call this option @option{-ieee_with_no_inexact}.
11549 @item -mieee-with-inexact
11550 @opindex mieee-with-inexact
11551 This is like @option{-mieee} except the generated code also maintains
11552 the IEEE @var{inexact-flag}. Turning on this option causes the
11553 generated code to implement fully-compliant IEEE math. In addition to
11554 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
11555 macro. On some Alpha implementations the resulting code may execute
11556 significantly slower than the code generated by default. Since there is
11557 very little code that depends on the @var{inexact-flag}, you should
11558 normally not specify this option. Other Alpha compilers call this
11559 option @option{-ieee_with_inexact}.
11561 @item -mfp-trap-mode=@var{trap-mode}
11562 @opindex mfp-trap-mode
11563 This option controls what floating-point related traps are enabled.
11564 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
11565 The trap mode can be set to one of four values:
11569 This is the default (normal) setting. The only traps that are enabled
11570 are the ones that cannot be disabled in software (e.g., division by zero
11574 In addition to the traps enabled by @samp{n}, underflow traps are enabled
11578 Like @samp{u}, but the instructions are marked to be safe for software
11579 completion (see Alpha architecture manual for details).
11582 Like @samp{su}, but inexact traps are enabled as well.
11585 @item -mfp-rounding-mode=@var{rounding-mode}
11586 @opindex mfp-rounding-mode
11587 Selects the IEEE rounding mode. Other Alpha compilers call this option
11588 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
11593 Normal IEEE rounding mode. Floating point numbers are rounded towards
11594 the nearest machine number or towards the even machine number in case
11598 Round towards minus infinity.
11601 Chopped rounding mode. Floating point numbers are rounded towards zero.
11604 Dynamic rounding mode. A field in the floating point control register
11605 (@var{fpcr}, see Alpha architecture reference manual) controls the
11606 rounding mode in effect. The C library initializes this register for
11607 rounding towards plus infinity. Thus, unless your program modifies the
11608 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
11611 @item -mtrap-precision=@var{trap-precision}
11612 @opindex mtrap-precision
11613 In the Alpha architecture, floating point traps are imprecise. This
11614 means without software assistance it is impossible to recover from a
11615 floating trap and program execution normally needs to be terminated.
11616 GCC can generate code that can assist operating system trap handlers
11617 in determining the exact location that caused a floating point trap.
11618 Depending on the requirements of an application, different levels of
11619 precisions can be selected:
11623 Program precision. This option is the default and means a trap handler
11624 can only identify which program caused a floating point exception.
11627 Function precision. The trap handler can determine the function that
11628 caused a floating point exception.
11631 Instruction precision. The trap handler can determine the exact
11632 instruction that caused a floating point exception.
11635 Other Alpha compilers provide the equivalent options called
11636 @option{-scope_safe} and @option{-resumption_safe}.
11638 @item -mieee-conformant
11639 @opindex mieee-conformant
11640 This option marks the generated code as IEEE conformant. You must not
11641 use this option unless you also specify @option{-mtrap-precision=i} and either
11642 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
11643 is to emit the line @samp{.eflag 48} in the function prologue of the
11644 generated assembly file. Under DEC Unix, this has the effect that
11645 IEEE-conformant math library routines will be linked in.
11647 @item -mbuild-constants
11648 @opindex mbuild-constants
11649 Normally GCC examines a 32- or 64-bit integer constant to
11650 see if it can construct it from smaller constants in two or three
11651 instructions. If it cannot, it will output the constant as a literal and
11652 generate code to load it from the data segment at runtime.
11654 Use this option to require GCC to construct @emph{all} integer constants
11655 using code, even if it takes more instructions (the maximum is six).
11657 You would typically use this option to build a shared library dynamic
11658 loader. Itself a shared library, it must relocate itself in memory
11659 before it can find the variables and constants in its own data segment.
11665 Select whether to generate code to be assembled by the vendor-supplied
11666 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
11684 Indicate whether GCC should generate code to use the optional BWX,
11685 CIX, FIX and MAX instruction sets. The default is to use the instruction
11686 sets supported by the CPU type specified via @option{-mcpu=} option or that
11687 of the CPU on which GCC was built if none was specified.
11690 @itemx -mfloat-ieee
11691 @opindex mfloat-vax
11692 @opindex mfloat-ieee
11693 Generate code that uses (does not use) VAX F and G floating point
11694 arithmetic instead of IEEE single and double precision.
11696 @item -mexplicit-relocs
11697 @itemx -mno-explicit-relocs
11698 @opindex mexplicit-relocs
11699 @opindex mno-explicit-relocs
11700 Older Alpha assemblers provided no way to generate symbol relocations
11701 except via assembler macros. Use of these macros does not allow
11702 optimal instruction scheduling. GNU binutils as of version 2.12
11703 supports a new syntax that allows the compiler to explicitly mark
11704 which relocations should apply to which instructions. This option
11705 is mostly useful for debugging, as GCC detects the capabilities of
11706 the assembler when it is built and sets the default accordingly.
11709 @itemx -mlarge-data
11710 @opindex msmall-data
11711 @opindex mlarge-data
11712 When @option{-mexplicit-relocs} is in effect, static data is
11713 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
11714 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
11715 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
11716 16-bit relocations off of the @code{$gp} register. This limits the
11717 size of the small data area to 64KB, but allows the variables to be
11718 directly accessed via a single instruction.
11720 The default is @option{-mlarge-data}. With this option the data area
11721 is limited to just below 2GB@. Programs that require more than 2GB of
11722 data must use @code{malloc} or @code{mmap} to allocate the data in the
11723 heap instead of in the program's data segment.
11725 When generating code for shared libraries, @option{-fpic} implies
11726 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
11729 @itemx -mlarge-text
11730 @opindex msmall-text
11731 @opindex mlarge-text
11732 When @option{-msmall-text} is used, the compiler assumes that the
11733 code of the entire program (or shared library) fits in 4MB, and is
11734 thus reachable with a branch instruction. When @option{-msmall-data}
11735 is used, the compiler can assume that all local symbols share the
11736 same @code{$gp} value, and thus reduce the number of instructions
11737 required for a function call from 4 to 1.
11739 The default is @option{-mlarge-text}.
11741 @item -mcpu=@var{cpu_type}
11743 Set the instruction set and instruction scheduling parameters for
11744 machine type @var{cpu_type}. You can specify either the @samp{EV}
11745 style name or the corresponding chip number. GCC supports scheduling
11746 parameters for the EV4, EV5 and EV6 family of processors and will
11747 choose the default values for the instruction set from the processor
11748 you specify. If you do not specify a processor type, GCC will default
11749 to the processor on which the compiler was built.
11751 Supported values for @var{cpu_type} are
11757 Schedules as an EV4 and has no instruction set extensions.
11761 Schedules as an EV5 and has no instruction set extensions.
11765 Schedules as an EV5 and supports the BWX extension.
11770 Schedules as an EV5 and supports the BWX and MAX extensions.
11774 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
11778 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
11781 Native toolchains also support the value @samp{native},
11782 which selects the best architecture option for the host processor.
11783 @option{-mcpu=native} has no effect if GCC does not recognize
11786 @item -mtune=@var{cpu_type}
11788 Set only the instruction scheduling parameters for machine type
11789 @var{cpu_type}. The instruction set is not changed.
11791 Native toolchains also support the value @samp{native},
11792 which selects the best architecture option for the host processor.
11793 @option{-mtune=native} has no effect if GCC does not recognize
11796 @item -mmemory-latency=@var{time}
11797 @opindex mmemory-latency
11798 Sets the latency the scheduler should assume for typical memory
11799 references as seen by the application. This number is highly
11800 dependent on the memory access patterns used by the application
11801 and the size of the external cache on the machine.
11803 Valid options for @var{time} are
11807 A decimal number representing clock cycles.
11813 The compiler contains estimates of the number of clock cycles for
11814 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
11815 (also called Dcache, Scache, and Bcache), as well as to main memory.
11816 Note that L3 is only valid for EV5.
11821 @node DEC Alpha/VMS Options
11822 @subsection DEC Alpha/VMS Options
11824 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
11827 @item -mvms-return-codes
11828 @opindex mvms-return-codes
11829 Return VMS condition codes from main. The default is to return POSIX
11830 style condition (e.g.@: error) codes.
11832 @item -mdebug-main=@var{prefix}
11833 @opindex mdebug-main=@var{prefix}
11834 Flag the first routine whose name starts with @var{prefix} as the main
11835 routine for the debugger.
11839 Default to 64bit memory allocation routines.
11843 @subsection FR30 Options
11844 @cindex FR30 Options
11846 These options are defined specifically for the FR30 port.
11850 @item -msmall-model
11851 @opindex msmall-model
11852 Use the small address space model. This can produce smaller code, but
11853 it does assume that all symbolic values and addresses will fit into a
11858 Assume that run-time support has been provided and so there is no need
11859 to include the simulator library (@file{libsim.a}) on the linker
11865 @subsection FRV Options
11866 @cindex FRV Options
11872 Only use the first 32 general purpose registers.
11877 Use all 64 general purpose registers.
11882 Use only the first 32 floating point registers.
11887 Use all 64 floating point registers
11890 @opindex mhard-float
11892 Use hardware instructions for floating point operations.
11895 @opindex msoft-float
11897 Use library routines for floating point operations.
11902 Dynamically allocate condition code registers.
11907 Do not try to dynamically allocate condition code registers, only
11908 use @code{icc0} and @code{fcc0}.
11913 Change ABI to use double word insns.
11918 Do not use double word instructions.
11923 Use floating point double instructions.
11926 @opindex mno-double
11928 Do not use floating point double instructions.
11933 Use media instructions.
11938 Do not use media instructions.
11943 Use multiply and add/subtract instructions.
11946 @opindex mno-muladd
11948 Do not use multiply and add/subtract instructions.
11953 Select the FDPIC ABI, that uses function descriptors to represent
11954 pointers to functions. Without any PIC/PIE-related options, it
11955 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
11956 assumes GOT entries and small data are within a 12-bit range from the
11957 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
11958 are computed with 32 bits.
11959 With a @samp{bfin-elf} target, this option implies @option{-msim}.
11962 @opindex minline-plt
11964 Enable inlining of PLT entries in function calls to functions that are
11965 not known to bind locally. It has no effect without @option{-mfdpic}.
11966 It's enabled by default if optimizing for speed and compiling for
11967 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
11968 optimization option such as @option{-O3} or above is present in the
11974 Assume a large TLS segment when generating thread-local code.
11979 Do not assume a large TLS segment when generating thread-local code.
11984 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
11985 that is known to be in read-only sections. It's enabled by default,
11986 except for @option{-fpic} or @option{-fpie}: even though it may help
11987 make the global offset table smaller, it trades 1 instruction for 4.
11988 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
11989 one of which may be shared by multiple symbols, and it avoids the need
11990 for a GOT entry for the referenced symbol, so it's more likely to be a
11991 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
11993 @item -multilib-library-pic
11994 @opindex multilib-library-pic
11996 Link with the (library, not FD) pic libraries. It's implied by
11997 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
11998 @option{-fpic} without @option{-mfdpic}. You should never have to use
12002 @opindex mlinked-fp
12004 Follow the EABI requirement of always creating a frame pointer whenever
12005 a stack frame is allocated. This option is enabled by default and can
12006 be disabled with @option{-mno-linked-fp}.
12009 @opindex mlong-calls
12011 Use indirect addressing to call functions outside the current
12012 compilation unit. This allows the functions to be placed anywhere
12013 within the 32-bit address space.
12015 @item -malign-labels
12016 @opindex malign-labels
12018 Try to align labels to an 8-byte boundary by inserting nops into the
12019 previous packet. This option only has an effect when VLIW packing
12020 is enabled. It doesn't create new packets; it merely adds nops to
12023 @item -mlibrary-pic
12024 @opindex mlibrary-pic
12026 Generate position-independent EABI code.
12031 Use only the first four media accumulator registers.
12036 Use all eight media accumulator registers.
12041 Pack VLIW instructions.
12046 Do not pack VLIW instructions.
12049 @opindex mno-eflags
12051 Do not mark ABI switches in e_flags.
12054 @opindex mcond-move
12056 Enable the use of conditional-move instructions (default).
12058 This switch is mainly for debugging the compiler and will likely be removed
12059 in a future version.
12061 @item -mno-cond-move
12062 @opindex mno-cond-move
12064 Disable the use of conditional-move instructions.
12066 This switch is mainly for debugging the compiler and will likely be removed
12067 in a future version.
12072 Enable the use of conditional set instructions (default).
12074 This switch is mainly for debugging the compiler and will likely be removed
12075 in a future version.
12080 Disable the use of conditional set instructions.
12082 This switch is mainly for debugging the compiler and will likely be removed
12083 in a future version.
12086 @opindex mcond-exec
12088 Enable the use of conditional execution (default).
12090 This switch is mainly for debugging the compiler and will likely be removed
12091 in a future version.
12093 @item -mno-cond-exec
12094 @opindex mno-cond-exec
12096 Disable the use of conditional execution.
12098 This switch is mainly for debugging the compiler and will likely be removed
12099 in a future version.
12101 @item -mvliw-branch
12102 @opindex mvliw-branch
12104 Run a pass to pack branches into VLIW instructions (default).
12106 This switch is mainly for debugging the compiler and will likely be removed
12107 in a future version.
12109 @item -mno-vliw-branch
12110 @opindex mno-vliw-branch
12112 Do not run a pass to pack branches into VLIW instructions.
12114 This switch is mainly for debugging the compiler and will likely be removed
12115 in a future version.
12117 @item -mmulti-cond-exec
12118 @opindex mmulti-cond-exec
12120 Enable optimization of @code{&&} and @code{||} in conditional execution
12123 This switch is mainly for debugging the compiler and will likely be removed
12124 in a future version.
12126 @item -mno-multi-cond-exec
12127 @opindex mno-multi-cond-exec
12129 Disable optimization of @code{&&} and @code{||} in conditional execution.
12131 This switch is mainly for debugging the compiler and will likely be removed
12132 in a future version.
12134 @item -mnested-cond-exec
12135 @opindex mnested-cond-exec
12137 Enable nested conditional execution optimizations (default).
12139 This switch is mainly for debugging the compiler and will likely be removed
12140 in a future version.
12142 @item -mno-nested-cond-exec
12143 @opindex mno-nested-cond-exec
12145 Disable nested conditional execution optimizations.
12147 This switch is mainly for debugging the compiler and will likely be removed
12148 in a future version.
12150 @item -moptimize-membar
12151 @opindex moptimize-membar
12153 This switch removes redundant @code{membar} instructions from the
12154 compiler generated code. It is enabled by default.
12156 @item -mno-optimize-membar
12157 @opindex mno-optimize-membar
12159 This switch disables the automatic removal of redundant @code{membar}
12160 instructions from the generated code.
12162 @item -mtomcat-stats
12163 @opindex mtomcat-stats
12165 Cause gas to print out tomcat statistics.
12167 @item -mcpu=@var{cpu}
12170 Select the processor type for which to generate code. Possible values are
12171 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
12172 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
12176 @node GNU/Linux Options
12177 @subsection GNU/Linux Options
12179 These @samp{-m} options are defined for GNU/Linux targets:
12184 Use the GNU C library. This is the default except
12185 on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
12189 Use uClibc C library. This is the default on
12190 @samp{*-*-linux-*uclibc*} targets.
12194 Use Bionic C library. This is the default on
12195 @samp{*-*-linux-*android*} targets.
12199 Compile code compatible with Android platform. This is the default on
12200 @samp{*-*-linux-*android*} targets.
12202 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
12203 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
12204 this option makes the GCC driver pass Android-specific options to the linker.
12205 Finally, this option causes the preprocessor macro @code{__ANDROID__}
12208 @item -tno-android-cc
12209 @opindex tno-android-cc
12210 Disable compilation effects of @option{-mandroid}, i.e., do not enable
12211 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
12212 @option{-fno-rtti} by default.
12214 @item -tno-android-ld
12215 @opindex tno-android-ld
12216 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
12217 linking options to the linker.
12221 @node H8/300 Options
12222 @subsection H8/300 Options
12224 These @samp{-m} options are defined for the H8/300 implementations:
12229 Shorten some address references at link time, when possible; uses the
12230 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
12231 ld, Using ld}, for a fuller description.
12235 Generate code for the H8/300H@.
12239 Generate code for the H8S@.
12243 Generate code for the H8S and H8/300H in the normal mode. This switch
12244 must be used either with @option{-mh} or @option{-ms}.
12248 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
12252 Make @code{int} data 32 bits by default.
12255 @opindex malign-300
12256 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
12257 The default for the H8/300H and H8S is to align longs and floats on 4
12259 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
12260 This option has no effect on the H8/300.
12264 @subsection HPPA Options
12265 @cindex HPPA Options
12267 These @samp{-m} options are defined for the HPPA family of computers:
12270 @item -march=@var{architecture-type}
12272 Generate code for the specified architecture. The choices for
12273 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
12274 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
12275 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
12276 architecture option for your machine. Code compiled for lower numbered
12277 architectures will run on higher numbered architectures, but not the
12280 @item -mpa-risc-1-0
12281 @itemx -mpa-risc-1-1
12282 @itemx -mpa-risc-2-0
12283 @opindex mpa-risc-1-0
12284 @opindex mpa-risc-1-1
12285 @opindex mpa-risc-2-0
12286 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
12289 @opindex mbig-switch
12290 Generate code suitable for big switch tables. Use this option only if
12291 the assembler/linker complain about out of range branches within a switch
12294 @item -mjump-in-delay
12295 @opindex mjump-in-delay
12296 Fill delay slots of function calls with unconditional jump instructions
12297 by modifying the return pointer for the function call to be the target
12298 of the conditional jump.
12300 @item -mdisable-fpregs
12301 @opindex mdisable-fpregs
12302 Prevent floating point registers from being used in any manner. This is
12303 necessary for compiling kernels which perform lazy context switching of
12304 floating point registers. If you use this option and attempt to perform
12305 floating point operations, the compiler will abort.
12307 @item -mdisable-indexing
12308 @opindex mdisable-indexing
12309 Prevent the compiler from using indexing address modes. This avoids some
12310 rather obscure problems when compiling MIG generated code under MACH@.
12312 @item -mno-space-regs
12313 @opindex mno-space-regs
12314 Generate code that assumes the target has no space registers. This allows
12315 GCC to generate faster indirect calls and use unscaled index address modes.
12317 Such code is suitable for level 0 PA systems and kernels.
12319 @item -mfast-indirect-calls
12320 @opindex mfast-indirect-calls
12321 Generate code that assumes calls never cross space boundaries. This
12322 allows GCC to emit code which performs faster indirect calls.
12324 This option will not work in the presence of shared libraries or nested
12327 @item -mfixed-range=@var{register-range}
12328 @opindex mfixed-range
12329 Generate code treating the given register range as fixed registers.
12330 A fixed register is one that the register allocator can not use. This is
12331 useful when compiling kernel code. A register range is specified as
12332 two registers separated by a dash. Multiple register ranges can be
12333 specified separated by a comma.
12335 @item -mlong-load-store
12336 @opindex mlong-load-store
12337 Generate 3-instruction load and store sequences as sometimes required by
12338 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
12341 @item -mportable-runtime
12342 @opindex mportable-runtime
12343 Use the portable calling conventions proposed by HP for ELF systems.
12347 Enable the use of assembler directives only GAS understands.
12349 @item -mschedule=@var{cpu-type}
12351 Schedule code according to the constraints for the machine type
12352 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
12353 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
12354 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
12355 proper scheduling option for your machine. The default scheduling is
12359 @opindex mlinker-opt
12360 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
12361 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
12362 linkers in which they give bogus error messages when linking some programs.
12365 @opindex msoft-float
12366 Generate output containing library calls for floating point.
12367 @strong{Warning:} the requisite libraries are not available for all HPPA
12368 targets. Normally the facilities of the machine's usual C compiler are
12369 used, but this cannot be done directly in cross-compilation. You must make
12370 your own arrangements to provide suitable library functions for
12373 @option{-msoft-float} changes the calling convention in the output file;
12374 therefore, it is only useful if you compile @emph{all} of a program with
12375 this option. In particular, you need to compile @file{libgcc.a}, the
12376 library that comes with GCC, with @option{-msoft-float} in order for
12381 Generate the predefine, @code{_SIO}, for server IO@. The default is
12382 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
12383 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
12384 options are available under HP-UX and HI-UX@.
12388 Use GNU ld specific options. This passes @option{-shared} to ld when
12389 building a shared library. It is the default when GCC is configured,
12390 explicitly or implicitly, with the GNU linker. This option does not
12391 have any affect on which ld is called, it only changes what parameters
12392 are passed to that ld. The ld that is called is determined by the
12393 @option{--with-ld} configure option, GCC's program search path, and
12394 finally by the user's @env{PATH}. The linker used by GCC can be printed
12395 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
12396 on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
12400 Use HP ld specific options. This passes @option{-b} to ld when building
12401 a shared library and passes @option{+Accept TypeMismatch} to ld on all
12402 links. It is the default when GCC is configured, explicitly or
12403 implicitly, with the HP linker. This option does not have any affect on
12404 which ld is called, it only changes what parameters are passed to that
12405 ld. The ld that is called is determined by the @option{--with-ld}
12406 configure option, GCC's program search path, and finally by the user's
12407 @env{PATH}. The linker used by GCC can be printed using @samp{which
12408 `gcc -print-prog-name=ld`}. This option is only available on the 64 bit
12409 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
12412 @opindex mno-long-calls
12413 Generate code that uses long call sequences. This ensures that a call
12414 is always able to reach linker generated stubs. The default is to generate
12415 long calls only when the distance from the call site to the beginning
12416 of the function or translation unit, as the case may be, exceeds a
12417 predefined limit set by the branch type being used. The limits for
12418 normal calls are 7,600,000 and 240,000 bytes, respectively for the
12419 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
12422 Distances are measured from the beginning of functions when using the
12423 @option{-ffunction-sections} option, or when using the @option{-mgas}
12424 and @option{-mno-portable-runtime} options together under HP-UX with
12427 It is normally not desirable to use this option as it will degrade
12428 performance. However, it may be useful in large applications,
12429 particularly when partial linking is used to build the application.
12431 The types of long calls used depends on the capabilities of the
12432 assembler and linker, and the type of code being generated. The
12433 impact on systems that support long absolute calls, and long pic
12434 symbol-difference or pc-relative calls should be relatively small.
12435 However, an indirect call is used on 32-bit ELF systems in pic code
12436 and it is quite long.
12438 @item -munix=@var{unix-std}
12440 Generate compiler predefines and select a startfile for the specified
12441 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
12442 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
12443 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
12444 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
12445 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
12448 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
12449 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
12450 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
12451 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
12452 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
12453 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
12455 It is @emph{important} to note that this option changes the interfaces
12456 for various library routines. It also affects the operational behavior
12457 of the C library. Thus, @emph{extreme} care is needed in using this
12460 Library code that is intended to operate with more than one UNIX
12461 standard must test, set and restore the variable @var{__xpg4_extended_mask}
12462 as appropriate. Most GNU software doesn't provide this capability.
12466 Suppress the generation of link options to search libdld.sl when the
12467 @option{-static} option is specified on HP-UX 10 and later.
12471 The HP-UX implementation of setlocale in libc has a dependency on
12472 libdld.sl. There isn't an archive version of libdld.sl. Thus,
12473 when the @option{-static} option is specified, special link options
12474 are needed to resolve this dependency.
12476 On HP-UX 10 and later, the GCC driver adds the necessary options to
12477 link with libdld.sl when the @option{-static} option is specified.
12478 This causes the resulting binary to be dynamic. On the 64-bit port,
12479 the linkers generate dynamic binaries by default in any case. The
12480 @option{-nolibdld} option can be used to prevent the GCC driver from
12481 adding these link options.
12485 Add support for multithreading with the @dfn{dce thread} library
12486 under HP-UX@. This option sets flags for both the preprocessor and
12490 @node i386 and x86-64 Options
12491 @subsection Intel 386 and AMD x86-64 Options
12492 @cindex i386 Options
12493 @cindex x86-64 Options
12494 @cindex Intel 386 Options
12495 @cindex AMD x86-64 Options
12497 These @samp{-m} options are defined for the i386 and x86-64 family of
12501 @item -mtune=@var{cpu-type}
12503 Tune to @var{cpu-type} everything applicable about the generated code, except
12504 for the ABI and the set of available instructions. The choices for
12505 @var{cpu-type} are:
12508 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
12509 If you know the CPU on which your code will run, then you should use
12510 the corresponding @option{-mtune} option instead of
12511 @option{-mtune=generic}. But, if you do not know exactly what CPU users
12512 of your application will have, then you should use this option.
12514 As new processors are deployed in the marketplace, the behavior of this
12515 option will change. Therefore, if you upgrade to a newer version of
12516 GCC, the code generated option will change to reflect the processors
12517 that were most common when that version of GCC was released.
12519 There is no @option{-march=generic} option because @option{-march}
12520 indicates the instruction set the compiler can use, and there is no
12521 generic instruction set applicable to all processors. In contrast,
12522 @option{-mtune} indicates the processor (or, in this case, collection of
12523 processors) for which the code is optimized.
12525 This selects the CPU to tune for at compilation time by determining
12526 the processor type of the compiling machine. Using @option{-mtune=native}
12527 will produce code optimized for the local machine under the constraints
12528 of the selected instruction set. Using @option{-march=native} will
12529 enable all instruction subsets supported by the local machine (hence
12530 the result might not run on different machines).
12532 Original Intel's i386 CPU@.
12534 Intel's i486 CPU@. (No scheduling is implemented for this chip.)
12535 @item i586, pentium
12536 Intel Pentium CPU with no MMX support.
12538 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
12540 Intel PentiumPro CPU@.
12542 Same as @code{generic}, but when used as @code{march} option, PentiumPro
12543 instruction set will be used, so the code will run on all i686 family chips.
12545 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
12546 @item pentium3, pentium3m
12547 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
12550 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
12551 support. Used by Centrino notebooks.
12552 @item pentium4, pentium4m
12553 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
12555 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
12558 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
12559 SSE2 and SSE3 instruction set support.
12561 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12562 instruction set support.
12564 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
12565 and SSE4.2 instruction set support.
12567 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
12568 SSE4.1, SSE4.2, AVX, AES and PCLMUL instruction set support.
12570 Intel Core CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
12571 SSE4.1, SSE4.2, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction
12574 Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12575 instruction set support.
12577 AMD K6 CPU with MMX instruction set support.
12579 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
12580 @item athlon, athlon-tbird
12581 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
12583 @item athlon-4, athlon-xp, athlon-mp
12584 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
12585 instruction set support.
12586 @item k8, opteron, athlon64, athlon-fx
12587 AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
12588 MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit instruction set extensions.)
12589 @item k8-sse3, opteron-sse3, athlon64-sse3
12590 Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
12591 @item amdfam10, barcelona
12592 AMD Family 10h core based CPUs with x86-64 instruction set support. (This
12593 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
12594 instruction set extensions.)
12596 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
12599 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
12600 instruction set support.
12602 Via C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
12603 implemented for this chip.)
12605 Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
12606 implemented for this chip.)
12608 Embedded AMD CPU with MMX and 3DNow!@: instruction set support.
12611 While picking a specific @var{cpu-type} will schedule things appropriately
12612 for that particular chip, the compiler will not generate any code that
12613 does not run on the i386 without the @option{-march=@var{cpu-type}} option
12616 @item -march=@var{cpu-type}
12618 Generate instructions for the machine type @var{cpu-type}. The choices
12619 for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
12620 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
12622 @item -mcpu=@var{cpu-type}
12624 A deprecated synonym for @option{-mtune}.
12626 @item -mfpmath=@var{unit}
12628 Generate floating point arithmetics for selected unit @var{unit}. The choices
12629 for @var{unit} are:
12633 Use the standard 387 floating point coprocessor present majority of chips and
12634 emulated otherwise. Code compiled with this option will run almost everywhere.
12635 The temporary results are computed in 80bit precision instead of precision
12636 specified by the type resulting in slightly different results compared to most
12637 of other chips. See @option{-ffloat-store} for more detailed description.
12639 This is the default choice for i386 compiler.
12642 Use scalar floating point instructions present in the SSE instruction set.
12643 This instruction set is supported by Pentium3 and newer chips, in the AMD line
12644 by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
12645 instruction set supports only single precision arithmetics, thus the double and
12646 extended precision arithmetics is still done using 387. Later version, present
12647 only in Pentium4 and the future AMD x86-64 chips supports double precision
12650 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
12651 or @option{-msse2} switches to enable SSE extensions and make this option
12652 effective. For the x86-64 compiler, these extensions are enabled by default.
12654 The resulting code should be considerably faster in the majority of cases and avoid
12655 the numerical instability problems of 387 code, but may break some existing
12656 code that expects temporaries to be 80bit.
12658 This is the default choice for the x86-64 compiler.
12663 Attempt to utilize both instruction sets at once. This effectively double the
12664 amount of available registers and on chips with separate execution units for
12665 387 and SSE the execution resources too. Use this option with care, as it is
12666 still experimental, because the GCC register allocator does not model separate
12667 functional units well resulting in instable performance.
12670 @item -masm=@var{dialect}
12671 @opindex masm=@var{dialect}
12672 Output asm instructions using selected @var{dialect}. Supported
12673 choices are @samp{intel} or @samp{att} (the default one). Darwin does
12674 not support @samp{intel}.
12677 @itemx -mno-ieee-fp
12679 @opindex mno-ieee-fp
12680 Control whether or not the compiler uses IEEE floating point
12681 comparisons. These handle correctly the case where the result of a
12682 comparison is unordered.
12685 @opindex msoft-float
12686 Generate output containing library calls for floating point.
12687 @strong{Warning:} the requisite libraries are not part of GCC@.
12688 Normally the facilities of the machine's usual C compiler are used, but
12689 this can't be done directly in cross-compilation. You must make your
12690 own arrangements to provide suitable library functions for
12693 On machines where a function returns floating point results in the 80387
12694 register stack, some floating point opcodes may be emitted even if
12695 @option{-msoft-float} is used.
12697 @item -mno-fp-ret-in-387
12698 @opindex mno-fp-ret-in-387
12699 Do not use the FPU registers for return values of functions.
12701 The usual calling convention has functions return values of types
12702 @code{float} and @code{double} in an FPU register, even if there
12703 is no FPU@. The idea is that the operating system should emulate
12706 The option @option{-mno-fp-ret-in-387} causes such values to be returned
12707 in ordinary CPU registers instead.
12709 @item -mno-fancy-math-387
12710 @opindex mno-fancy-math-387
12711 Some 387 emulators do not support the @code{sin}, @code{cos} and
12712 @code{sqrt} instructions for the 387. Specify this option to avoid
12713 generating those instructions. This option is the default on FreeBSD,
12714 OpenBSD and NetBSD@. This option is overridden when @option{-march}
12715 indicates that the target CPU will always have an FPU and so the
12716 instruction will not need emulation. As of revision 2.6.1, these
12717 instructions are not generated unless you also use the
12718 @option{-funsafe-math-optimizations} switch.
12720 @item -malign-double
12721 @itemx -mno-align-double
12722 @opindex malign-double
12723 @opindex mno-align-double
12724 Control whether GCC aligns @code{double}, @code{long double}, and
12725 @code{long long} variables on a two word boundary or a one word
12726 boundary. Aligning @code{double} variables on a two word boundary will
12727 produce code that runs somewhat faster on a @samp{Pentium} at the
12728 expense of more memory.
12730 On x86-64, @option{-malign-double} is enabled by default.
12732 @strong{Warning:} if you use the @option{-malign-double} switch,
12733 structures containing the above types will be aligned differently than
12734 the published application binary interface specifications for the 386
12735 and will not be binary compatible with structures in code compiled
12736 without that switch.
12738 @item -m96bit-long-double
12739 @itemx -m128bit-long-double
12740 @opindex m96bit-long-double
12741 @opindex m128bit-long-double
12742 These switches control the size of @code{long double} type. The i386
12743 application binary interface specifies the size to be 96 bits,
12744 so @option{-m96bit-long-double} is the default in 32 bit mode.
12746 Modern architectures (Pentium and newer) would prefer @code{long double}
12747 to be aligned to an 8 or 16 byte boundary. In arrays or structures
12748 conforming to the ABI, this would not be possible. So specifying a
12749 @option{-m128bit-long-double} will align @code{long double}
12750 to a 16 byte boundary by padding the @code{long double} with an additional
12753 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
12754 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
12756 Notice that neither of these options enable any extra precision over the x87
12757 standard of 80 bits for a @code{long double}.
12759 @strong{Warning:} if you override the default value for your target ABI, the
12760 structures and arrays containing @code{long double} variables will change
12761 their size as well as function calling convention for function taking
12762 @code{long double} will be modified. Hence they will not be binary
12763 compatible with arrays or structures in code compiled without that switch.
12765 @item -mlarge-data-threshold=@var{number}
12766 @opindex mlarge-data-threshold=@var{number}
12767 When @option{-mcmodel=medium} is specified, the data greater than
12768 @var{threshold} are placed in large data section. This value must be the
12769 same across all object linked into the binary and defaults to 65535.
12773 Use a different function-calling convention, in which functions that
12774 take a fixed number of arguments return with the @code{ret} @var{num}
12775 instruction, which pops their arguments while returning. This saves one
12776 instruction in the caller since there is no need to pop the arguments
12779 You can specify that an individual function is called with this calling
12780 sequence with the function attribute @samp{stdcall}. You can also
12781 override the @option{-mrtd} option by using the function attribute
12782 @samp{cdecl}. @xref{Function Attributes}.
12784 @strong{Warning:} this calling convention is incompatible with the one
12785 normally used on Unix, so you cannot use it if you need to call
12786 libraries compiled with the Unix compiler.
12788 Also, you must provide function prototypes for all functions that
12789 take variable numbers of arguments (including @code{printf});
12790 otherwise incorrect code will be generated for calls to those
12793 In addition, seriously incorrect code will result if you call a
12794 function with too many arguments. (Normally, extra arguments are
12795 harmlessly ignored.)
12797 @item -mregparm=@var{num}
12799 Control how many registers are used to pass integer arguments. By
12800 default, no registers are used to pass arguments, and at most 3
12801 registers can be used. You can control this behavior for a specific
12802 function by using the function attribute @samp{regparm}.
12803 @xref{Function Attributes}.
12805 @strong{Warning:} if you use this switch, and
12806 @var{num} is nonzero, then you must build all modules with the same
12807 value, including any libraries. This includes the system libraries and
12811 @opindex msseregparm
12812 Use SSE register passing conventions for float and double arguments
12813 and return values. You can control this behavior for a specific
12814 function by using the function attribute @samp{sseregparm}.
12815 @xref{Function Attributes}.
12817 @strong{Warning:} if you use this switch then you must build all
12818 modules with the same value, including any libraries. This includes
12819 the system libraries and startup modules.
12821 @item -mvect8-ret-in-mem
12822 @opindex mvect8-ret-in-mem
12823 Return 8-byte vectors in memory instead of MMX registers. This is the
12824 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
12825 Studio compilers until version 12. Later compiler versions (starting
12826 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
12827 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
12828 you need to remain compatible with existing code produced by those
12829 previous compiler versions or older versions of GCC.
12838 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
12839 is specified, the significands of results of floating-point operations are
12840 rounded to 24 bits (single precision); @option{-mpc64} rounds the
12841 significands of results of floating-point operations to 53 bits (double
12842 precision) and @option{-mpc80} rounds the significands of results of
12843 floating-point operations to 64 bits (extended double precision), which is
12844 the default. When this option is used, floating-point operations in higher
12845 precisions are not available to the programmer without setting the FPU
12846 control word explicitly.
12848 Setting the rounding of floating-point operations to less than the default
12849 80 bits can speed some programs by 2% or more. Note that some mathematical
12850 libraries assume that extended precision (80 bit) floating-point operations
12851 are enabled by default; routines in such libraries could suffer significant
12852 loss of accuracy, typically through so-called "catastrophic cancellation",
12853 when this option is used to set the precision to less than extended precision.
12855 @item -mstackrealign
12856 @opindex mstackrealign
12857 Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
12858 option will generate an alternate prologue and epilogue that realigns the
12859 runtime stack if necessary. This supports mixing legacy codes that keep
12860 a 4-byte aligned stack with modern codes that keep a 16-byte stack for
12861 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
12862 applicable to individual functions.
12864 @item -mpreferred-stack-boundary=@var{num}
12865 @opindex mpreferred-stack-boundary
12866 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
12867 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
12868 the default is 4 (16 bytes or 128 bits).
12870 @item -mincoming-stack-boundary=@var{num}
12871 @opindex mincoming-stack-boundary
12872 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
12873 boundary. If @option{-mincoming-stack-boundary} is not specified,
12874 the one specified by @option{-mpreferred-stack-boundary} will be used.
12876 On Pentium and PentiumPro, @code{double} and @code{long double} values
12877 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
12878 suffer significant run time performance penalties. On Pentium III, the
12879 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
12880 properly if it is not 16 byte aligned.
12882 To ensure proper alignment of this values on the stack, the stack boundary
12883 must be as aligned as that required by any value stored on the stack.
12884 Further, every function must be generated such that it keeps the stack
12885 aligned. Thus calling a function compiled with a higher preferred
12886 stack boundary from a function compiled with a lower preferred stack
12887 boundary will most likely misalign the stack. It is recommended that
12888 libraries that use callbacks always use the default setting.
12890 This extra alignment does consume extra stack space, and generally
12891 increases code size. Code that is sensitive to stack space usage, such
12892 as embedded systems and operating system kernels, may want to reduce the
12893 preferred alignment to @option{-mpreferred-stack-boundary=2}.
12922 @itemx -mno-fsgsbase
12958 These switches enable or disable the use of instructions in the MMX, SSE,
12959 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, F16C,
12960 FMA, SSE4A, FMA4, XOP, LWP, ABM, BMI, BMI2, LZCNT or 3DNow!
12961 @: extended instruction sets.
12962 These extensions are also available as built-in functions: see
12963 @ref{X86 Built-in Functions}, for details of the functions enabled and
12964 disabled by these switches.
12966 To have SSE/SSE2 instructions generated automatically from floating-point
12967 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
12969 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
12970 generates new AVX instructions or AVX equivalence for all SSEx instructions
12973 These options will enable GCC to use these extended instructions in
12974 generated code, even without @option{-mfpmath=sse}. Applications which
12975 perform runtime CPU detection must compile separate files for each
12976 supported architecture, using the appropriate flags. In particular,
12977 the file containing the CPU detection code should be compiled without
12982 This option instructs GCC to emit a @code{cld} instruction in the prologue
12983 of functions that use string instructions. String instructions depend on
12984 the DF flag to select between autoincrement or autodecrement mode. While the
12985 ABI specifies the DF flag to be cleared on function entry, some operating
12986 systems violate this specification by not clearing the DF flag in their
12987 exception dispatchers. The exception handler can be invoked with the DF flag
12988 set which leads to wrong direction mode, when string instructions are used.
12989 This option can be enabled by default on 32-bit x86 targets by configuring
12990 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
12991 instructions can be suppressed with the @option{-mno-cld} compiler option
12995 @opindex mvzeroupper
12996 This option instructs GCC to emit a @code{vzeroupper} instruction
12997 before a transfer of control flow out of the function to minimize
12998 AVX to SSE transition penalty as well as remove unnecessary zeroupper
13003 This option will enable GCC to use CMPXCHG16B instruction in generated code.
13004 CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
13005 data types. This is useful for high resolution counters that could be updated
13006 by multiple processors (or cores). This instruction is generated as part of
13007 atomic built-in functions: see @ref{Atomic Builtins} for details.
13011 This option will enable GCC to use SAHF instruction in generated 64-bit code.
13012 Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
13013 by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
13014 SAHF are load and store instructions, respectively, for certain status flags.
13015 In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
13016 or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
13020 This option will enable GCC to use movbe instruction to implement
13021 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
13025 This option will enable built-in functions, @code{__builtin_ia32_crc32qi},
13026 @code{__builtin_ia32_crc32hi}. @code{__builtin_ia32_crc32si} and
13027 @code{__builtin_ia32_crc32di} to generate the crc32 machine instruction.
13031 This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
13032 vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
13033 to increase precision instead of DIVSS and SQRTSS (and their vectorized
13034 variants) for single precision floating point arguments. These instructions
13035 are generated only when @option{-funsafe-math-optimizations} is enabled
13036 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
13037 Note that while the throughput of the sequence is higher than the throughput
13038 of the non-reciprocal instruction, the precision of the sequence can be
13039 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
13041 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of RSQRTSS
13042 (or RSQRTPS) already with @option{-ffast-math} (or the above option
13043 combination), and doesn't need @option{-mrecip}.
13045 Also note that GCC emits the above sequence with additional Newton-Raphson step
13046 for vectorized single float division and vectorized @code{sqrtf(@var{x})}
13047 already with @option{-ffast-math} (or the above option combination), and
13048 doesn't need @option{-mrecip}.
13050 @item -mrecip=@var{opt}
13051 @opindex mrecip=opt
13052 This option allows to control which reciprocal estimate instructions
13053 may be used. @var{opt} is a comma separated list of options, that may
13054 be preceded by a @code{!} to invert the option:
13055 @code{all}: enable all estimate instructions,
13056 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
13057 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip},
13058 @code{div}: enable the approximation for scalar division,
13059 @code{vec-div}: enable the approximation for vectorized division,
13060 @code{sqrt}: enable the approximation for scalar square root,
13061 @code{vec-sqrt}: enable the approximation for vectorized square root.
13063 So for example, @option{-mrecip=all,!sqrt} would enable
13064 all of the reciprocal approximations, except for square root.
13066 @item -mveclibabi=@var{type}
13067 @opindex mveclibabi
13068 Specifies the ABI type to use for vectorizing intrinsics using an
13069 external library. Supported types are @code{svml} for the Intel short
13070 vector math library and @code{acml} for the AMD math core library style
13071 of interfacing. GCC will currently emit calls to @code{vmldExp2},
13072 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
13073 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
13074 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
13075 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
13076 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
13077 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
13078 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
13079 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
13080 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
13081 function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
13082 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
13083 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
13084 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
13085 @code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
13086 when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
13087 @option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
13088 compatible library will have to be specified at link time.
13090 @item -mabi=@var{name}
13092 Generate code for the specified calling convention. Permissible values
13093 are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
13094 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
13095 ABI when targeting Windows. On all other systems, the default is the
13096 SYSV ABI. You can control this behavior for a specific function by
13097 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
13098 @xref{Function Attributes}.
13100 @item -mtls-dialect=@var{type}
13101 @opindex mtls-dialect
13102 Generate code to access thread-local storage using the @samp{gnu} or
13103 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
13104 @samp{gnu2} is more efficient, but it may add compile- and run-time
13105 requirements that cannot be satisfied on all systems.
13108 @itemx -mno-push-args
13109 @opindex mpush-args
13110 @opindex mno-push-args
13111 Use PUSH operations to store outgoing parameters. This method is shorter
13112 and usually equally fast as method using SUB/MOV operations and is enabled
13113 by default. In some cases disabling it may improve performance because of
13114 improved scheduling and reduced dependencies.
13116 @item -maccumulate-outgoing-args
13117 @opindex maccumulate-outgoing-args
13118 If enabled, the maximum amount of space required for outgoing arguments will be
13119 computed in the function prologue. This is faster on most modern CPUs
13120 because of reduced dependencies, improved scheduling and reduced stack usage
13121 when preferred stack boundary is not equal to 2. The drawback is a notable
13122 increase in code size. This switch implies @option{-mno-push-args}.
13126 Support thread-safe exception handling on @samp{Mingw32}. Code that relies
13127 on thread-safe exception handling must compile and link all code with the
13128 @option{-mthreads} option. When compiling, @option{-mthreads} defines
13129 @option{-D_MT}; when linking, it links in a special thread helper library
13130 @option{-lmingwthrd} which cleans up per thread exception handling data.
13132 @item -mno-align-stringops
13133 @opindex mno-align-stringops
13134 Do not align destination of inlined string operations. This switch reduces
13135 code size and improves performance in case the destination is already aligned,
13136 but GCC doesn't know about it.
13138 @item -minline-all-stringops
13139 @opindex minline-all-stringops
13140 By default GCC inlines string operations only when destination is known to be
13141 aligned at least to 4 byte boundary. This enables more inlining, increase code
13142 size, but may improve performance of code that depends on fast memcpy, strlen
13143 and memset for short lengths.
13145 @item -minline-stringops-dynamically
13146 @opindex minline-stringops-dynamically
13147 For string operation of unknown size, inline runtime checks so for small
13148 blocks inline code is used, while for large blocks library call is used.
13150 @item -mstringop-strategy=@var{alg}
13151 @opindex mstringop-strategy=@var{alg}
13152 Overwrite internal decision heuristic about particular algorithm to inline
13153 string operation with. The allowed values are @code{rep_byte},
13154 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
13155 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
13156 expanding inline loop, @code{libcall} for always expanding library call.
13158 @item -momit-leaf-frame-pointer
13159 @opindex momit-leaf-frame-pointer
13160 Don't keep the frame pointer in a register for leaf functions. This
13161 avoids the instructions to save, set up and restore frame pointers and
13162 makes an extra register available in leaf functions. The option
13163 @option{-fomit-frame-pointer} removes the frame pointer for all functions
13164 which might make debugging harder.
13166 @item -mtls-direct-seg-refs
13167 @itemx -mno-tls-direct-seg-refs
13168 @opindex mtls-direct-seg-refs
13169 Controls whether TLS variables may be accessed with offsets from the
13170 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
13171 or whether the thread base pointer must be added. Whether or not this
13172 is legal depends on the operating system, and whether it maps the
13173 segment to cover the entire TLS area.
13175 For systems that use GNU libc, the default is on.
13178 @itemx -mno-sse2avx
13180 Specify that the assembler should encode SSE instructions with VEX
13181 prefix. The option @option{-mavx} turns this on by default.
13186 If profiling is active @option{-pg} put the profiling
13187 counter call before prologue.
13188 Note: On x86 architectures the attribute @code{ms_hook_prologue}
13189 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
13192 @itemx -mno-8bit-idiv
13194 On some processors, like Intel Atom, 8bit unsigned integer divide is
13195 much faster than 32bit/64bit integer divide. This option will generate a
13196 runt-time check. If both dividend and divisor are within range of 0
13197 to 255, 8bit unsigned integer divide will be used instead of
13198 32bit/64bit integer divide.
13200 @item -mavx256-split-unaligned-load
13201 @item -mavx256-split-unaligned-store
13202 @opindex avx256-split-unaligned-load
13203 @opindex avx256-split-unaligned-store
13204 Split 32-byte AVX unaligned load and store.
13208 These @samp{-m} switches are supported in addition to the above
13209 on AMD x86-64 processors in 64-bit environments.
13218 Generate code for a 32-bit or 64-bit environment.
13219 The @option{-m32} option sets int, long and pointer to 32 bits and
13220 generates code that runs on any i386 system.
13221 The @option{-m64} option sets int to 32 bits and long and pointer
13222 to 64 bits and generates code for AMD's x86-64 architecture.
13223 The @option{-mx32} option sets int, long and pointer to 32 bits and
13224 generates code for AMD's x86-64 architecture.
13225 For darwin only the @option{-m64} option turns off the @option{-fno-pic}
13226 and @option{-mdynamic-no-pic} options.
13228 @item -mno-red-zone
13229 @opindex mno-red-zone
13230 Do not use a so called red zone for x86-64 code. The red zone is mandated
13231 by the x86-64 ABI, it is a 128-byte area beyond the location of the
13232 stack pointer that will not be modified by signal or interrupt handlers
13233 and therefore can be used for temporary data without adjusting the stack
13234 pointer. The flag @option{-mno-red-zone} disables this red zone.
13236 @item -mcmodel=small
13237 @opindex mcmodel=small
13238 Generate code for the small code model: the program and its symbols must
13239 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
13240 Programs can be statically or dynamically linked. This is the default
13243 @item -mcmodel=kernel
13244 @opindex mcmodel=kernel
13245 Generate code for the kernel code model. The kernel runs in the
13246 negative 2 GB of the address space.
13247 This model has to be used for Linux kernel code.
13249 @item -mcmodel=medium
13250 @opindex mcmodel=medium
13251 Generate code for the medium model: The program is linked in the lower 2
13252 GB of the address space. Small symbols are also placed there. Symbols
13253 with sizes larger than @option{-mlarge-data-threshold} are put into
13254 large data or bss sections and can be located above 2GB. Programs can
13255 be statically or dynamically linked.
13257 @item -mcmodel=large
13258 @opindex mcmodel=large
13259 Generate code for the large model: This model makes no assumptions
13260 about addresses and sizes of sections.
13263 @node i386 and x86-64 Windows Options
13264 @subsection i386 and x86-64 Windows Options
13265 @cindex i386 and x86-64 Windows Options
13267 These additional options are available for Windows targets:
13272 This option is available for Cygwin and MinGW targets. It
13273 specifies that a console application is to be generated, by
13274 instructing the linker to set the PE header subsystem type
13275 required for console applications.
13276 This is the default behavior for Cygwin and MinGW targets.
13280 This option is available for Cygwin and MinGW targets. It
13281 specifies that a DLL - a dynamic link library - is to be
13282 generated, enabling the selection of the required runtime
13283 startup object and entry point.
13285 @item -mnop-fun-dllimport
13286 @opindex mnop-fun-dllimport
13287 This option is available for Cygwin and MinGW targets. It
13288 specifies that the dllimport attribute should be ignored.
13292 This option is available for MinGW targets. It specifies
13293 that MinGW-specific thread support is to be used.
13297 This option is available for mingw-w64 targets. It specifies
13298 that the UNICODE macro is getting pre-defined and that the
13299 unicode capable runtime startup code is chosen.
13303 This option is available for Cygwin and MinGW targets. It
13304 specifies that the typical Windows pre-defined macros are to
13305 be set in the pre-processor, but does not influence the choice
13306 of runtime library/startup code.
13310 This option is available for Cygwin and MinGW targets. It
13311 specifies that a GUI application is to be generated by
13312 instructing the linker to set the PE header subsystem type
13315 @item -fno-set-stack-executable
13316 @opindex fno-set-stack-executable
13317 This option is available for MinGW targets. It specifies that
13318 the executable flag for stack used by nested functions isn't
13319 set. This is necessary for binaries running in kernel mode of
13320 Windows, as there the user32 API, which is used to set executable
13321 privileges, isn't available.
13323 @item -mpe-aligned-commons
13324 @opindex mpe-aligned-commons
13325 This option is available for Cygwin and MinGW targets. It
13326 specifies that the GNU extension to the PE file format that
13327 permits the correct alignment of COMMON variables should be
13328 used when generating code. It will be enabled by default if
13329 GCC detects that the target assembler found during configuration
13330 supports the feature.
13333 See also under @ref{i386 and x86-64 Options} for standard options.
13335 @node IA-64 Options
13336 @subsection IA-64 Options
13337 @cindex IA-64 Options
13339 These are the @samp{-m} options defined for the Intel IA-64 architecture.
13343 @opindex mbig-endian
13344 Generate code for a big endian target. This is the default for HP-UX@.
13346 @item -mlittle-endian
13347 @opindex mlittle-endian
13348 Generate code for a little endian target. This is the default for AIX5
13354 @opindex mno-gnu-as
13355 Generate (or don't) code for the GNU assembler. This is the default.
13356 @c Also, this is the default if the configure option @option{--with-gnu-as}
13362 @opindex mno-gnu-ld
13363 Generate (or don't) code for the GNU linker. This is the default.
13364 @c Also, this is the default if the configure option @option{--with-gnu-ld}
13369 Generate code that does not use a global pointer register. The result
13370 is not position independent code, and violates the IA-64 ABI@.
13372 @item -mvolatile-asm-stop
13373 @itemx -mno-volatile-asm-stop
13374 @opindex mvolatile-asm-stop
13375 @opindex mno-volatile-asm-stop
13376 Generate (or don't) a stop bit immediately before and after volatile asm
13379 @item -mregister-names
13380 @itemx -mno-register-names
13381 @opindex mregister-names
13382 @opindex mno-register-names
13383 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
13384 the stacked registers. This may make assembler output more readable.
13390 Disable (or enable) optimizations that use the small data section. This may
13391 be useful for working around optimizer bugs.
13393 @item -mconstant-gp
13394 @opindex mconstant-gp
13395 Generate code that uses a single constant global pointer value. This is
13396 useful when compiling kernel code.
13400 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
13401 This is useful when compiling firmware code.
13403 @item -minline-float-divide-min-latency
13404 @opindex minline-float-divide-min-latency
13405 Generate code for inline divides of floating point values
13406 using the minimum latency algorithm.
13408 @item -minline-float-divide-max-throughput
13409 @opindex minline-float-divide-max-throughput
13410 Generate code for inline divides of floating point values
13411 using the maximum throughput algorithm.
13413 @item -mno-inline-float-divide
13414 @opindex mno-inline-float-divide
13415 Do not generate inline code for divides of floating point values.
13417 @item -minline-int-divide-min-latency
13418 @opindex minline-int-divide-min-latency
13419 Generate code for inline divides of integer values
13420 using the minimum latency algorithm.
13422 @item -minline-int-divide-max-throughput
13423 @opindex minline-int-divide-max-throughput
13424 Generate code for inline divides of integer values
13425 using the maximum throughput algorithm.
13427 @item -mno-inline-int-divide
13428 @opindex mno-inline-int-divide
13429 Do not generate inline code for divides of integer values.
13431 @item -minline-sqrt-min-latency
13432 @opindex minline-sqrt-min-latency
13433 Generate code for inline square roots
13434 using the minimum latency algorithm.
13436 @item -minline-sqrt-max-throughput
13437 @opindex minline-sqrt-max-throughput
13438 Generate code for inline square roots
13439 using the maximum throughput algorithm.
13441 @item -mno-inline-sqrt
13442 @opindex mno-inline-sqrt
13443 Do not generate inline code for sqrt.
13446 @itemx -mno-fused-madd
13447 @opindex mfused-madd
13448 @opindex mno-fused-madd
13449 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
13450 instructions. The default is to use these instructions.
13452 @item -mno-dwarf2-asm
13453 @itemx -mdwarf2-asm
13454 @opindex mno-dwarf2-asm
13455 @opindex mdwarf2-asm
13456 Don't (or do) generate assembler code for the DWARF2 line number debugging
13457 info. This may be useful when not using the GNU assembler.
13459 @item -mearly-stop-bits
13460 @itemx -mno-early-stop-bits
13461 @opindex mearly-stop-bits
13462 @opindex mno-early-stop-bits
13463 Allow stop bits to be placed earlier than immediately preceding the
13464 instruction that triggered the stop bit. This can improve instruction
13465 scheduling, but does not always do so.
13467 @item -mfixed-range=@var{register-range}
13468 @opindex mfixed-range
13469 Generate code treating the given register range as fixed registers.
13470 A fixed register is one that the register allocator can not use. This is
13471 useful when compiling kernel code. A register range is specified as
13472 two registers separated by a dash. Multiple register ranges can be
13473 specified separated by a comma.
13475 @item -mtls-size=@var{tls-size}
13477 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
13480 @item -mtune=@var{cpu-type}
13482 Tune the instruction scheduling for a particular CPU, Valid values are
13483 itanium, itanium1, merced, itanium2, and mckinley.
13489 Generate code for a 32-bit or 64-bit environment.
13490 The 32-bit environment sets int, long and pointer to 32 bits.
13491 The 64-bit environment sets int to 32 bits and long and pointer
13492 to 64 bits. These are HP-UX specific flags.
13494 @item -mno-sched-br-data-spec
13495 @itemx -msched-br-data-spec
13496 @opindex mno-sched-br-data-spec
13497 @opindex msched-br-data-spec
13498 (Dis/En)able data speculative scheduling before reload.
13499 This will result in generation of the ld.a instructions and
13500 the corresponding check instructions (ld.c / chk.a).
13501 The default is 'disable'.
13503 @item -msched-ar-data-spec
13504 @itemx -mno-sched-ar-data-spec
13505 @opindex msched-ar-data-spec
13506 @opindex mno-sched-ar-data-spec
13507 (En/Dis)able data speculative scheduling after reload.
13508 This will result in generation of the ld.a instructions and
13509 the corresponding check instructions (ld.c / chk.a).
13510 The default is 'enable'.
13512 @item -mno-sched-control-spec
13513 @itemx -msched-control-spec
13514 @opindex mno-sched-control-spec
13515 @opindex msched-control-spec
13516 (Dis/En)able control speculative scheduling. This feature is
13517 available only during region scheduling (i.e.@: before reload).
13518 This will result in generation of the ld.s instructions and
13519 the corresponding check instructions chk.s .
13520 The default is 'disable'.
13522 @item -msched-br-in-data-spec
13523 @itemx -mno-sched-br-in-data-spec
13524 @opindex msched-br-in-data-spec
13525 @opindex mno-sched-br-in-data-spec
13526 (En/Dis)able speculative scheduling of the instructions that
13527 are dependent on the data speculative loads before reload.
13528 This is effective only with @option{-msched-br-data-spec} enabled.
13529 The default is 'enable'.
13531 @item -msched-ar-in-data-spec
13532 @itemx -mno-sched-ar-in-data-spec
13533 @opindex msched-ar-in-data-spec
13534 @opindex mno-sched-ar-in-data-spec
13535 (En/Dis)able speculative scheduling of the instructions that
13536 are dependent on the data speculative loads after reload.
13537 This is effective only with @option{-msched-ar-data-spec} enabled.
13538 The default is 'enable'.
13540 @item -msched-in-control-spec
13541 @itemx -mno-sched-in-control-spec
13542 @opindex msched-in-control-spec
13543 @opindex mno-sched-in-control-spec
13544 (En/Dis)able speculative scheduling of the instructions that
13545 are dependent on the control speculative loads.
13546 This is effective only with @option{-msched-control-spec} enabled.
13547 The default is 'enable'.
13549 @item -mno-sched-prefer-non-data-spec-insns
13550 @itemx -msched-prefer-non-data-spec-insns
13551 @opindex mno-sched-prefer-non-data-spec-insns
13552 @opindex msched-prefer-non-data-spec-insns
13553 If enabled, data speculative instructions will be chosen for schedule
13554 only if there are no other choices at the moment. This will make
13555 the use of the data speculation much more conservative.
13556 The default is 'disable'.
13558 @item -mno-sched-prefer-non-control-spec-insns
13559 @itemx -msched-prefer-non-control-spec-insns
13560 @opindex mno-sched-prefer-non-control-spec-insns
13561 @opindex msched-prefer-non-control-spec-insns
13562 If enabled, control speculative instructions will be chosen for schedule
13563 only if there are no other choices at the moment. This will make
13564 the use of the control speculation much more conservative.
13565 The default is 'disable'.
13567 @item -mno-sched-count-spec-in-critical-path
13568 @itemx -msched-count-spec-in-critical-path
13569 @opindex mno-sched-count-spec-in-critical-path
13570 @opindex msched-count-spec-in-critical-path
13571 If enabled, speculative dependencies will be considered during
13572 computation of the instructions priorities. This will make the use of the
13573 speculation a bit more conservative.
13574 The default is 'disable'.
13576 @item -msched-spec-ldc
13577 @opindex msched-spec-ldc
13578 Use a simple data speculation check. This option is on by default.
13580 @item -msched-control-spec-ldc
13581 @opindex msched-spec-ldc
13582 Use a simple check for control speculation. This option is on by default.
13584 @item -msched-stop-bits-after-every-cycle
13585 @opindex msched-stop-bits-after-every-cycle
13586 Place a stop bit after every cycle when scheduling. This option is on
13589 @item -msched-fp-mem-deps-zero-cost
13590 @opindex msched-fp-mem-deps-zero-cost
13591 Assume that floating-point stores and loads are not likely to cause a conflict
13592 when placed into the same instruction group. This option is disabled by
13595 @item -msel-sched-dont-check-control-spec
13596 @opindex msel-sched-dont-check-control-spec
13597 Generate checks for control speculation in selective scheduling.
13598 This flag is disabled by default.
13600 @item -msched-max-memory-insns=@var{max-insns}
13601 @opindex msched-max-memory-insns
13602 Limit on the number of memory insns per instruction group, giving lower
13603 priority to subsequent memory insns attempting to schedule in the same
13604 instruction group. Frequently useful to prevent cache bank conflicts.
13605 The default value is 1.
13607 @item -msched-max-memory-insns-hard-limit
13608 @opindex msched-max-memory-insns-hard-limit
13609 Disallow more than `msched-max-memory-insns' in instruction group.
13610 Otherwise, limit is `soft' meaning that we would prefer non-memory operations
13611 when limit is reached but may still schedule memory operations.
13615 @node IA-64/VMS Options
13616 @subsection IA-64/VMS Options
13618 These @samp{-m} options are defined for the IA-64/VMS implementations:
13621 @item -mvms-return-codes
13622 @opindex mvms-return-codes
13623 Return VMS condition codes from main. The default is to return POSIX
13624 style condition (e.g.@ error) codes.
13626 @item -mdebug-main=@var{prefix}
13627 @opindex mdebug-main=@var{prefix}
13628 Flag the first routine whose name starts with @var{prefix} as the main
13629 routine for the debugger.
13633 Default to 64bit memory allocation routines.
13637 @subsection LM32 Options
13638 @cindex LM32 options
13640 These @option{-m} options are defined for the Lattice Mico32 architecture:
13643 @item -mbarrel-shift-enabled
13644 @opindex mbarrel-shift-enabled
13645 Enable barrel-shift instructions.
13647 @item -mdivide-enabled
13648 @opindex mdivide-enabled
13649 Enable divide and modulus instructions.
13651 @item -mmultiply-enabled
13652 @opindex multiply-enabled
13653 Enable multiply instructions.
13655 @item -msign-extend-enabled
13656 @opindex msign-extend-enabled
13657 Enable sign extend instructions.
13659 @item -muser-enabled
13660 @opindex muser-enabled
13661 Enable user-defined instructions.
13666 @subsection M32C Options
13667 @cindex M32C options
13670 @item -mcpu=@var{name}
13672 Select the CPU for which code is generated. @var{name} may be one of
13673 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
13674 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
13675 the M32C/80 series.
13679 Specifies that the program will be run on the simulator. This causes
13680 an alternate runtime library to be linked in which supports, for
13681 example, file I/O@. You must not use this option when generating
13682 programs that will run on real hardware; you must provide your own
13683 runtime library for whatever I/O functions are needed.
13685 @item -memregs=@var{number}
13687 Specifies the number of memory-based pseudo-registers GCC will use
13688 during code generation. These pseudo-registers will be used like real
13689 registers, so there is a tradeoff between GCC's ability to fit the
13690 code into available registers, and the performance penalty of using
13691 memory instead of registers. Note that all modules in a program must
13692 be compiled with the same value for this option. Because of that, you
13693 must not use this option with the default runtime libraries gcc
13698 @node M32R/D Options
13699 @subsection M32R/D Options
13700 @cindex M32R/D options
13702 These @option{-m} options are defined for Renesas M32R/D architectures:
13707 Generate code for the M32R/2@.
13711 Generate code for the M32R/X@.
13715 Generate code for the M32R@. This is the default.
13717 @item -mmodel=small
13718 @opindex mmodel=small
13719 Assume all objects live in the lower 16MB of memory (so that their addresses
13720 can be loaded with the @code{ld24} instruction), and assume all subroutines
13721 are reachable with the @code{bl} instruction.
13722 This is the default.
13724 The addressability of a particular object can be set with the
13725 @code{model} attribute.
13727 @item -mmodel=medium
13728 @opindex mmodel=medium
13729 Assume objects may be anywhere in the 32-bit address space (the compiler
13730 will generate @code{seth/add3} instructions to load their addresses), and
13731 assume all subroutines are reachable with the @code{bl} instruction.
13733 @item -mmodel=large
13734 @opindex mmodel=large
13735 Assume objects may be anywhere in the 32-bit address space (the compiler
13736 will generate @code{seth/add3} instructions to load their addresses), and
13737 assume subroutines may not be reachable with the @code{bl} instruction
13738 (the compiler will generate the much slower @code{seth/add3/jl}
13739 instruction sequence).
13742 @opindex msdata=none
13743 Disable use of the small data area. Variables will be put into
13744 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
13745 @code{section} attribute has been specified).
13746 This is the default.
13748 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
13749 Objects may be explicitly put in the small data area with the
13750 @code{section} attribute using one of these sections.
13752 @item -msdata=sdata
13753 @opindex msdata=sdata
13754 Put small global and static data in the small data area, but do not
13755 generate special code to reference them.
13758 @opindex msdata=use
13759 Put small global and static data in the small data area, and generate
13760 special instructions to reference them.
13764 @cindex smaller data references
13765 Put global and static objects less than or equal to @var{num} bytes
13766 into the small data or bss sections instead of the normal data or bss
13767 sections. The default value of @var{num} is 8.
13768 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
13769 for this option to have any effect.
13771 All modules should be compiled with the same @option{-G @var{num}} value.
13772 Compiling with different values of @var{num} may or may not work; if it
13773 doesn't the linker will give an error message---incorrect code will not be
13778 Makes the M32R specific code in the compiler display some statistics
13779 that might help in debugging programs.
13781 @item -malign-loops
13782 @opindex malign-loops
13783 Align all loops to a 32-byte boundary.
13785 @item -mno-align-loops
13786 @opindex mno-align-loops
13787 Do not enforce a 32-byte alignment for loops. This is the default.
13789 @item -missue-rate=@var{number}
13790 @opindex missue-rate=@var{number}
13791 Issue @var{number} instructions per cycle. @var{number} can only be 1
13794 @item -mbranch-cost=@var{number}
13795 @opindex mbranch-cost=@var{number}
13796 @var{number} can only be 1 or 2. If it is 1 then branches will be
13797 preferred over conditional code, if it is 2, then the opposite will
13800 @item -mflush-trap=@var{number}
13801 @opindex mflush-trap=@var{number}
13802 Specifies the trap number to use to flush the cache. The default is
13803 12. Valid numbers are between 0 and 15 inclusive.
13805 @item -mno-flush-trap
13806 @opindex mno-flush-trap
13807 Specifies that the cache cannot be flushed by using a trap.
13809 @item -mflush-func=@var{name}
13810 @opindex mflush-func=@var{name}
13811 Specifies the name of the operating system function to call to flush
13812 the cache. The default is @emph{_flush_cache}, but a function call
13813 will only be used if a trap is not available.
13815 @item -mno-flush-func
13816 @opindex mno-flush-func
13817 Indicates that there is no OS function for flushing the cache.
13821 @node M680x0 Options
13822 @subsection M680x0 Options
13823 @cindex M680x0 options
13825 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
13826 The default settings depend on which architecture was selected when
13827 the compiler was configured; the defaults for the most common choices
13831 @item -march=@var{arch}
13833 Generate code for a specific M680x0 or ColdFire instruction set
13834 architecture. Permissible values of @var{arch} for M680x0
13835 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
13836 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
13837 architectures are selected according to Freescale's ISA classification
13838 and the permissible values are: @samp{isaa}, @samp{isaaplus},
13839 @samp{isab} and @samp{isac}.
13841 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
13842 code for a ColdFire target. The @var{arch} in this macro is one of the
13843 @option{-march} arguments given above.
13845 When used together, @option{-march} and @option{-mtune} select code
13846 that runs on a family of similar processors but that is optimized
13847 for a particular microarchitecture.
13849 @item -mcpu=@var{cpu}
13851 Generate code for a specific M680x0 or ColdFire processor.
13852 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
13853 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
13854 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
13855 below, which also classifies the CPUs into families:
13857 @multitable @columnfractions 0.20 0.80
13858 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
13859 @item @samp{51} @tab @samp{51} @samp{51ac} @samp{51cn} @samp{51em} @samp{51qe}
13860 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
13861 @item @samp{5206e} @tab @samp{5206e}
13862 @item @samp{5208} @tab @samp{5207} @samp{5208}
13863 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
13864 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
13865 @item @samp{5216} @tab @samp{5214} @samp{5216}
13866 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
13867 @item @samp{5225} @tab @samp{5224} @samp{5225}
13868 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
13869 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
13870 @item @samp{5249} @tab @samp{5249}
13871 @item @samp{5250} @tab @samp{5250}
13872 @item @samp{5271} @tab @samp{5270} @samp{5271}
13873 @item @samp{5272} @tab @samp{5272}
13874 @item @samp{5275} @tab @samp{5274} @samp{5275}
13875 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
13876 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
13877 @item @samp{5307} @tab @samp{5307}
13878 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
13879 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
13880 @item @samp{5407} @tab @samp{5407}
13881 @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}
13884 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
13885 @var{arch} is compatible with @var{cpu}. Other combinations of
13886 @option{-mcpu} and @option{-march} are rejected.
13888 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
13889 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
13890 where the value of @var{family} is given by the table above.
13892 @item -mtune=@var{tune}
13894 Tune the code for a particular microarchitecture, within the
13895 constraints set by @option{-march} and @option{-mcpu}.
13896 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
13897 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
13898 and @samp{cpu32}. The ColdFire microarchitectures
13899 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
13901 You can also use @option{-mtune=68020-40} for code that needs
13902 to run relatively well on 68020, 68030 and 68040 targets.
13903 @option{-mtune=68020-60} is similar but includes 68060 targets
13904 as well. These two options select the same tuning decisions as
13905 @option{-m68020-40} and @option{-m68020-60} respectively.
13907 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
13908 when tuning for 680x0 architecture @var{arch}. It also defines
13909 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
13910 option is used. If gcc is tuning for a range of architectures,
13911 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
13912 it defines the macros for every architecture in the range.
13914 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
13915 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
13916 of the arguments given above.
13922 Generate output for a 68000. This is the default
13923 when the compiler is configured for 68000-based systems.
13924 It is equivalent to @option{-march=68000}.
13926 Use this option for microcontrollers with a 68000 or EC000 core,
13927 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
13931 Generate output for a 68010. This is the default
13932 when the compiler is configured for 68010-based systems.
13933 It is equivalent to @option{-march=68010}.
13939 Generate output for a 68020. This is the default
13940 when the compiler is configured for 68020-based systems.
13941 It is equivalent to @option{-march=68020}.
13945 Generate output for a 68030. This is the default when the compiler is
13946 configured for 68030-based systems. It is equivalent to
13947 @option{-march=68030}.
13951 Generate output for a 68040. This is the default when the compiler is
13952 configured for 68040-based systems. It is equivalent to
13953 @option{-march=68040}.
13955 This option inhibits the use of 68881/68882 instructions that have to be
13956 emulated by software on the 68040. Use this option if your 68040 does not
13957 have code to emulate those instructions.
13961 Generate output for a 68060. This is the default when the compiler is
13962 configured for 68060-based systems. It is equivalent to
13963 @option{-march=68060}.
13965 This option inhibits the use of 68020 and 68881/68882 instructions that
13966 have to be emulated by software on the 68060. Use this option if your 68060
13967 does not have code to emulate those instructions.
13971 Generate output for a CPU32. This is the default
13972 when the compiler is configured for CPU32-based systems.
13973 It is equivalent to @option{-march=cpu32}.
13975 Use this option for microcontrollers with a
13976 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
13977 68336, 68340, 68341, 68349 and 68360.
13981 Generate output for a 520X ColdFire CPU@. This is the default
13982 when the compiler is configured for 520X-based systems.
13983 It is equivalent to @option{-mcpu=5206}, and is now deprecated
13984 in favor of that option.
13986 Use this option for microcontroller with a 5200 core, including
13987 the MCF5202, MCF5203, MCF5204 and MCF5206.
13991 Generate output for a 5206e ColdFire CPU@. The option is now
13992 deprecated in favor of the equivalent @option{-mcpu=5206e}.
13996 Generate output for a member of the ColdFire 528X family.
13997 The option is now deprecated in favor of the equivalent
13998 @option{-mcpu=528x}.
14002 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
14003 in favor of the equivalent @option{-mcpu=5307}.
14007 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
14008 in favor of the equivalent @option{-mcpu=5407}.
14012 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
14013 This includes use of hardware floating point instructions.
14014 The option is equivalent to @option{-mcpu=547x}, and is now
14015 deprecated in favor of that option.
14019 Generate output for a 68040, without using any of the new instructions.
14020 This results in code which can run relatively efficiently on either a
14021 68020/68881 or a 68030 or a 68040. The generated code does use the
14022 68881 instructions that are emulated on the 68040.
14024 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
14028 Generate output for a 68060, without using any of the new instructions.
14029 This results in code which can run relatively efficiently on either a
14030 68020/68881 or a 68030 or a 68040. The generated code does use the
14031 68881 instructions that are emulated on the 68060.
14033 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
14037 @opindex mhard-float
14039 Generate floating-point instructions. This is the default for 68020
14040 and above, and for ColdFire devices that have an FPU@. It defines the
14041 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
14042 on ColdFire targets.
14045 @opindex msoft-float
14046 Do not generate floating-point instructions; use library calls instead.
14047 This is the default for 68000, 68010, and 68832 targets. It is also
14048 the default for ColdFire devices that have no FPU.
14054 Generate (do not generate) ColdFire hardware divide and remainder
14055 instructions. If @option{-march} is used without @option{-mcpu},
14056 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
14057 architectures. Otherwise, the default is taken from the target CPU
14058 (either the default CPU, or the one specified by @option{-mcpu}). For
14059 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
14060 @option{-mcpu=5206e}.
14062 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
14066 Consider type @code{int} to be 16 bits wide, like @code{short int}.
14067 Additionally, parameters passed on the stack are also aligned to a
14068 16-bit boundary even on targets whose API mandates promotion to 32-bit.
14072 Do not consider type @code{int} to be 16 bits wide. This is the default.
14075 @itemx -mno-bitfield
14076 @opindex mnobitfield
14077 @opindex mno-bitfield
14078 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
14079 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
14083 Do use the bit-field instructions. The @option{-m68020} option implies
14084 @option{-mbitfield}. This is the default if you use a configuration
14085 designed for a 68020.
14089 Use a different function-calling convention, in which functions
14090 that take a fixed number of arguments return with the @code{rtd}
14091 instruction, which pops their arguments while returning. This
14092 saves one instruction in the caller since there is no need to pop
14093 the arguments there.
14095 This calling convention is incompatible with the one normally
14096 used on Unix, so you cannot use it if you need to call libraries
14097 compiled with the Unix compiler.
14099 Also, you must provide function prototypes for all functions that
14100 take variable numbers of arguments (including @code{printf});
14101 otherwise incorrect code will be generated for calls to those
14104 In addition, seriously incorrect code will result if you call a
14105 function with too many arguments. (Normally, extra arguments are
14106 harmlessly ignored.)
14108 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
14109 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
14113 Do not use the calling conventions selected by @option{-mrtd}.
14114 This is the default.
14117 @itemx -mno-align-int
14118 @opindex malign-int
14119 @opindex mno-align-int
14120 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
14121 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
14122 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
14123 Aligning variables on 32-bit boundaries produces code that runs somewhat
14124 faster on processors with 32-bit busses at the expense of more memory.
14126 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
14127 align structures containing the above types differently than
14128 most published application binary interface specifications for the m68k.
14132 Use the pc-relative addressing mode of the 68000 directly, instead of
14133 using a global offset table. At present, this option implies @option{-fpic},
14134 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
14135 not presently supported with @option{-mpcrel}, though this could be supported for
14136 68020 and higher processors.
14138 @item -mno-strict-align
14139 @itemx -mstrict-align
14140 @opindex mno-strict-align
14141 @opindex mstrict-align
14142 Do not (do) assume that unaligned memory references will be handled by
14146 Generate code that allows the data segment to be located in a different
14147 area of memory from the text segment. This allows for execute in place in
14148 an environment without virtual memory management. This option implies
14151 @item -mno-sep-data
14152 Generate code that assumes that the data segment follows the text segment.
14153 This is the default.
14155 @item -mid-shared-library
14156 Generate code that supports shared libraries via the library ID method.
14157 This allows for execute in place and shared libraries in an environment
14158 without virtual memory management. This option implies @option{-fPIC}.
14160 @item -mno-id-shared-library
14161 Generate code that doesn't assume ID based shared libraries are being used.
14162 This is the default.
14164 @item -mshared-library-id=n
14165 Specified the identification number of the ID based shared library being
14166 compiled. Specifying a value of 0 will generate more compact code, specifying
14167 other values will force the allocation of that number to the current
14168 library but is no more space or time efficient than omitting this option.
14174 When generating position-independent code for ColdFire, generate code
14175 that works if the GOT has more than 8192 entries. This code is
14176 larger and slower than code generated without this option. On M680x0
14177 processors, this option is not needed; @option{-fPIC} suffices.
14179 GCC normally uses a single instruction to load values from the GOT@.
14180 While this is relatively efficient, it only works if the GOT
14181 is smaller than about 64k. Anything larger causes the linker
14182 to report an error such as:
14184 @cindex relocation truncated to fit (ColdFire)
14186 relocation truncated to fit: R_68K_GOT16O foobar
14189 If this happens, you should recompile your code with @option{-mxgot}.
14190 It should then work with very large GOTs. However, code generated with
14191 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
14192 the value of a global symbol.
14194 Note that some linkers, including newer versions of the GNU linker,
14195 can create multiple GOTs and sort GOT entries. If you have such a linker,
14196 you should only need to use @option{-mxgot} when compiling a single
14197 object file that accesses more than 8192 GOT entries. Very few do.
14199 These options have no effect unless GCC is generating
14200 position-independent code.
14204 @node MCore Options
14205 @subsection MCore Options
14206 @cindex MCore options
14208 These are the @samp{-m} options defined for the Motorola M*Core
14214 @itemx -mno-hardlit
14216 @opindex mno-hardlit
14217 Inline constants into the code stream if it can be done in two
14218 instructions or less.
14224 Use the divide instruction. (Enabled by default).
14226 @item -mrelax-immediate
14227 @itemx -mno-relax-immediate
14228 @opindex mrelax-immediate
14229 @opindex mno-relax-immediate
14230 Allow arbitrary sized immediates in bit operations.
14232 @item -mwide-bitfields
14233 @itemx -mno-wide-bitfields
14234 @opindex mwide-bitfields
14235 @opindex mno-wide-bitfields
14236 Always treat bit-fields as int-sized.
14238 @item -m4byte-functions
14239 @itemx -mno-4byte-functions
14240 @opindex m4byte-functions
14241 @opindex mno-4byte-functions
14242 Force all functions to be aligned to a four byte boundary.
14244 @item -mcallgraph-data
14245 @itemx -mno-callgraph-data
14246 @opindex mcallgraph-data
14247 @opindex mno-callgraph-data
14248 Emit callgraph information.
14251 @itemx -mno-slow-bytes
14252 @opindex mslow-bytes
14253 @opindex mno-slow-bytes
14254 Prefer word access when reading byte quantities.
14256 @item -mlittle-endian
14257 @itemx -mbig-endian
14258 @opindex mlittle-endian
14259 @opindex mbig-endian
14260 Generate code for a little endian target.
14266 Generate code for the 210 processor.
14270 Assume that run-time support has been provided and so omit the
14271 simulator library (@file{libsim.a)} from the linker command line.
14273 @item -mstack-increment=@var{size}
14274 @opindex mstack-increment
14275 Set the maximum amount for a single stack increment operation. Large
14276 values can increase the speed of programs which contain functions
14277 that need a large amount of stack space, but they can also trigger a
14278 segmentation fault if the stack is extended too much. The default
14284 @subsection MeP Options
14285 @cindex MeP options
14291 Enables the @code{abs} instruction, which is the absolute difference
14292 between two registers.
14296 Enables all the optional instructions - average, multiply, divide, bit
14297 operations, leading zero, absolute difference, min/max, clip, and
14303 Enables the @code{ave} instruction, which computes the average of two
14306 @item -mbased=@var{n}
14308 Variables of size @var{n} bytes or smaller will be placed in the
14309 @code{.based} section by default. Based variables use the @code{$tp}
14310 register as a base register, and there is a 128 byte limit to the
14311 @code{.based} section.
14315 Enables the bit operation instructions - bit test (@code{btstm}), set
14316 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
14317 test-and-set (@code{tas}).
14319 @item -mc=@var{name}
14321 Selects which section constant data will be placed in. @var{name} may
14322 be @code{tiny}, @code{near}, or @code{far}.
14326 Enables the @code{clip} instruction. Note that @code{-mclip} is not
14327 useful unless you also provide @code{-mminmax}.
14329 @item -mconfig=@var{name}
14331 Selects one of the build-in core configurations. Each MeP chip has
14332 one or more modules in it; each module has a core CPU and a variety of
14333 coprocessors, optional instructions, and peripherals. The
14334 @code{MeP-Integrator} tool, not part of GCC, provides these
14335 configurations through this option; using this option is the same as
14336 using all the corresponding command line options. The default
14337 configuration is @code{default}.
14341 Enables the coprocessor instructions. By default, this is a 32-bit
14342 coprocessor. Note that the coprocessor is normally enabled via the
14343 @code{-mconfig=} option.
14347 Enables the 32-bit coprocessor's instructions.
14351 Enables the 64-bit coprocessor's instructions.
14355 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
14359 Causes constant variables to be placed in the @code{.near} section.
14363 Enables the @code{div} and @code{divu} instructions.
14367 Generate big-endian code.
14371 Generate little-endian code.
14373 @item -mio-volatile
14374 @opindex mio-volatile
14375 Tells the compiler that any variable marked with the @code{io}
14376 attribute is to be considered volatile.
14380 Causes variables to be assigned to the @code{.far} section by default.
14384 Enables the @code{leadz} (leading zero) instruction.
14388 Causes variables to be assigned to the @code{.near} section by default.
14392 Enables the @code{min} and @code{max} instructions.
14396 Enables the multiplication and multiply-accumulate instructions.
14400 Disables all the optional instructions enabled by @code{-mall-opts}.
14404 Enables the @code{repeat} and @code{erepeat} instructions, used for
14405 low-overhead looping.
14409 Causes all variables to default to the @code{.tiny} section. Note
14410 that there is a 65536 byte limit to this section. Accesses to these
14411 variables use the @code{%gp} base register.
14415 Enables the saturation instructions. Note that the compiler does not
14416 currently generate these itself, but this option is included for
14417 compatibility with other tools, like @code{as}.
14421 Link the SDRAM-based runtime instead of the default ROM-based runtime.
14425 Link the simulator runtime libraries.
14429 Link the simulator runtime libraries, excluding built-in support
14430 for reset and exception vectors and tables.
14434 Causes all functions to default to the @code{.far} section. Without
14435 this option, functions default to the @code{.near} section.
14437 @item -mtiny=@var{n}
14439 Variables that are @var{n} bytes or smaller will be allocated to the
14440 @code{.tiny} section. These variables use the @code{$gp} base
14441 register. The default for this option is 4, but note that there's a
14442 65536 byte limit to the @code{.tiny} section.
14446 @node MicroBlaze Options
14447 @subsection MicroBlaze Options
14448 @cindex MicroBlaze Options
14453 @opindex msoft-float
14454 Use software emulation for floating point (default).
14457 @opindex mhard-float
14458 Use hardware floating point instructions.
14462 Do not optimize block moves, use @code{memcpy}.
14464 @item -mno-clearbss
14465 @opindex mno-clearbss
14466 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
14468 @item -mcpu=@var{cpu-type}
14470 Use features of and schedule code for given CPU.
14471 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
14472 where @var{X} is a major version, @var{YY} is the minor version, and
14473 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
14474 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
14476 @item -mxl-soft-mul
14477 @opindex mxl-soft-mul
14478 Use software multiply emulation (default).
14480 @item -mxl-soft-div
14481 @opindex mxl-soft-div
14482 Use software emulation for divides (default).
14484 @item -mxl-barrel-shift
14485 @opindex mxl-barrel-shift
14486 Use the hardware barrel shifter.
14488 @item -mxl-pattern-compare
14489 @opindex mxl-pattern-compare
14490 Use pattern compare instructions.
14492 @item -msmall-divides
14493 @opindex msmall-divides
14494 Use table lookup optimization for small signed integer divisions.
14496 @item -mxl-stack-check
14497 @opindex mxl-stack-check
14498 This option is deprecated. Use -fstack-check instead.
14501 @opindex mxl-gp-opt
14502 Use GP relative sdata/sbss sections.
14504 @item -mxl-multiply-high
14505 @opindex mxl-multiply-high
14506 Use multiply high instructions for high part of 32x32 multiply.
14508 @item -mxl-float-convert
14509 @opindex mxl-float-convert
14510 Use hardware floating point conversion instructions.
14512 @item -mxl-float-sqrt
14513 @opindex mxl-float-sqrt
14514 Use hardware floating point square root instruction.
14516 @item -mxl-mode-@var{app-model}
14517 Select application model @var{app-model}. Valid models are
14520 normal executable (default), uses startup code @file{crt0.o}.
14523 for use with Xilinx Microprocessor Debugger (XMD) based
14524 software intrusive debug agent called xmdstub. This uses startup file
14525 @file{crt1.o} and sets the start address of the program to be 0x800.
14528 for applications that are loaded using a bootloader.
14529 This model uses startup file @file{crt2.o} which does not contain a processor
14530 reset vector handler. This is suitable for transferring control on a
14531 processor reset to the bootloader rather than the application.
14534 for applications that do not require any of the
14535 MicroBlaze vectors. This option may be useful for applications running
14536 within a monitoring application. This model uses @file{crt3.o} as a startup file.
14539 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
14540 @option{-mxl-mode-@var{app-model}}.
14545 @subsection MIPS Options
14546 @cindex MIPS options
14552 Generate big-endian code.
14556 Generate little-endian code. This is the default for @samp{mips*el-*-*}
14559 @item -march=@var{arch}
14561 Generate code that will run on @var{arch}, which can be the name of a
14562 generic MIPS ISA, or the name of a particular processor.
14564 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
14565 @samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
14566 The processor names are:
14567 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
14568 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
14569 @samp{5kc}, @samp{5kf},
14571 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
14572 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
14573 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
14574 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
14575 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
14576 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
14580 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
14581 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
14582 @samp{rm7000}, @samp{rm9000},
14583 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
14586 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
14587 @samp{vr5000}, @samp{vr5400}, @samp{vr5500}
14589 The special value @samp{from-abi} selects the
14590 most compatible architecture for the selected ABI (that is,
14591 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
14593 Native Linux/GNU and IRIX toolchains also support the value @samp{native},
14594 which selects the best architecture option for the host processor.
14595 @option{-march=native} has no effect if GCC does not recognize
14598 In processor names, a final @samp{000} can be abbreviated as @samp{k}
14599 (for example, @samp{-march=r2k}). Prefixes are optional, and
14600 @samp{vr} may be written @samp{r}.
14602 Names of the form @samp{@var{n}f2_1} refer to processors with
14603 FPUs clocked at half the rate of the core, names of the form
14604 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
14605 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
14606 processors with FPUs clocked a ratio of 3:2 with respect to the core.
14607 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
14608 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
14609 accepted as synonyms for @samp{@var{n}f1_1}.
14611 GCC defines two macros based on the value of this option. The first
14612 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
14613 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
14614 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
14615 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
14616 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
14618 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
14619 above. In other words, it will have the full prefix and will not
14620 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
14621 the macro names the resolved architecture (either @samp{"mips1"} or
14622 @samp{"mips3"}). It names the default architecture when no
14623 @option{-march} option is given.
14625 @item -mtune=@var{arch}
14627 Optimize for @var{arch}. Among other things, this option controls
14628 the way instructions are scheduled, and the perceived cost of arithmetic
14629 operations. The list of @var{arch} values is the same as for
14632 When this option is not used, GCC will optimize for the processor
14633 specified by @option{-march}. By using @option{-march} and
14634 @option{-mtune} together, it is possible to generate code that will
14635 run on a family of processors, but optimize the code for one
14636 particular member of that family.
14638 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
14639 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
14640 @samp{-march} ones described above.
14644 Equivalent to @samp{-march=mips1}.
14648 Equivalent to @samp{-march=mips2}.
14652 Equivalent to @samp{-march=mips3}.
14656 Equivalent to @samp{-march=mips4}.
14660 Equivalent to @samp{-march=mips32}.
14664 Equivalent to @samp{-march=mips32r2}.
14668 Equivalent to @samp{-march=mips64}.
14672 Equivalent to @samp{-march=mips64r2}.
14677 @opindex mno-mips16
14678 Generate (do not generate) MIPS16 code. If GCC is targetting a
14679 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
14681 MIPS16 code generation can also be controlled on a per-function basis
14682 by means of @code{mips16} and @code{nomips16} attributes.
14683 @xref{Function Attributes}, for more information.
14685 @item -mflip-mips16
14686 @opindex mflip-mips16
14687 Generate MIPS16 code on alternating functions. This option is provided
14688 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
14689 not intended for ordinary use in compiling user code.
14691 @item -minterlink-mips16
14692 @itemx -mno-interlink-mips16
14693 @opindex minterlink-mips16
14694 @opindex mno-interlink-mips16
14695 Require (do not require) that non-MIPS16 code be link-compatible with
14698 For example, non-MIPS16 code cannot jump directly to MIPS16 code;
14699 it must either use a call or an indirect jump. @option{-minterlink-mips16}
14700 therefore disables direct jumps unless GCC knows that the target of the
14701 jump is not MIPS16.
14713 Generate code for the given ABI@.
14715 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
14716 generates 64-bit code when you select a 64-bit architecture, but you
14717 can use @option{-mgp32} to get 32-bit code instead.
14719 For information about the O64 ABI, see
14720 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
14722 GCC supports a variant of the o32 ABI in which floating-point registers
14723 are 64 rather than 32 bits wide. You can select this combination with
14724 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
14725 and @samp{mfhc1} instructions and is therefore only supported for
14726 MIPS32R2 processors.
14728 The register assignments for arguments and return values remain the
14729 same, but each scalar value is passed in a single 64-bit register
14730 rather than a pair of 32-bit registers. For example, scalar
14731 floating-point values are returned in @samp{$f0} only, not a
14732 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
14733 remains the same, but all 64 bits are saved.
14736 @itemx -mno-abicalls
14738 @opindex mno-abicalls
14739 Generate (do not generate) code that is suitable for SVR4-style
14740 dynamic objects. @option{-mabicalls} is the default for SVR4-based
14745 Generate (do not generate) code that is fully position-independent,
14746 and that can therefore be linked into shared libraries. This option
14747 only affects @option{-mabicalls}.
14749 All @option{-mabicalls} code has traditionally been position-independent,
14750 regardless of options like @option{-fPIC} and @option{-fpic}. However,
14751 as an extension, the GNU toolchain allows executables to use absolute
14752 accesses for locally-binding symbols. It can also use shorter GP
14753 initialization sequences and generate direct calls to locally-defined
14754 functions. This mode is selected by @option{-mno-shared}.
14756 @option{-mno-shared} depends on binutils 2.16 or higher and generates
14757 objects that can only be linked by the GNU linker. However, the option
14758 does not affect the ABI of the final executable; it only affects the ABI
14759 of relocatable objects. Using @option{-mno-shared} will generally make
14760 executables both smaller and quicker.
14762 @option{-mshared} is the default.
14768 Assume (do not assume) that the static and dynamic linkers
14769 support PLTs and copy relocations. This option only affects
14770 @samp{-mno-shared -mabicalls}. For the n64 ABI, this option
14771 has no effect without @samp{-msym32}.
14773 You can make @option{-mplt} the default by configuring
14774 GCC with @option{--with-mips-plt}. The default is
14775 @option{-mno-plt} otherwise.
14781 Lift (do not lift) the usual restrictions on the size of the global
14784 GCC normally uses a single instruction to load values from the GOT@.
14785 While this is relatively efficient, it will only work if the GOT
14786 is smaller than about 64k. Anything larger will cause the linker
14787 to report an error such as:
14789 @cindex relocation truncated to fit (MIPS)
14791 relocation truncated to fit: R_MIPS_GOT16 foobar
14794 If this happens, you should recompile your code with @option{-mxgot}.
14795 It should then work with very large GOTs, although it will also be
14796 less efficient, since it will take three instructions to fetch the
14797 value of a global symbol.
14799 Note that some linkers can create multiple GOTs. If you have such a
14800 linker, you should only need to use @option{-mxgot} when a single object
14801 file accesses more than 64k's worth of GOT entries. Very few do.
14803 These options have no effect unless GCC is generating position
14808 Assume that general-purpose registers are 32 bits wide.
14812 Assume that general-purpose registers are 64 bits wide.
14816 Assume that floating-point registers are 32 bits wide.
14820 Assume that floating-point registers are 64 bits wide.
14823 @opindex mhard-float
14824 Use floating-point coprocessor instructions.
14827 @opindex msoft-float
14828 Do not use floating-point coprocessor instructions. Implement
14829 floating-point calculations using library calls instead.
14831 @item -msingle-float
14832 @opindex msingle-float
14833 Assume that the floating-point coprocessor only supports single-precision
14836 @item -mdouble-float
14837 @opindex mdouble-float
14838 Assume that the floating-point coprocessor supports double-precision
14839 operations. This is the default.
14845 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
14846 implement atomic memory built-in functions. When neither option is
14847 specified, GCC will use the instructions if the target architecture
14850 @option{-mllsc} is useful if the runtime environment can emulate the
14851 instructions and @option{-mno-llsc} can be useful when compiling for
14852 nonstandard ISAs. You can make either option the default by
14853 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
14854 respectively. @option{--with-llsc} is the default for some
14855 configurations; see the installation documentation for details.
14861 Use (do not use) revision 1 of the MIPS DSP ASE@.
14862 @xref{MIPS DSP Built-in Functions}. This option defines the
14863 preprocessor macro @samp{__mips_dsp}. It also defines
14864 @samp{__mips_dsp_rev} to 1.
14870 Use (do not use) revision 2 of the MIPS DSP ASE@.
14871 @xref{MIPS DSP Built-in Functions}. This option defines the
14872 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
14873 It also defines @samp{__mips_dsp_rev} to 2.
14876 @itemx -mno-smartmips
14877 @opindex msmartmips
14878 @opindex mno-smartmips
14879 Use (do not use) the MIPS SmartMIPS ASE.
14881 @item -mpaired-single
14882 @itemx -mno-paired-single
14883 @opindex mpaired-single
14884 @opindex mno-paired-single
14885 Use (do not use) paired-single floating-point instructions.
14886 @xref{MIPS Paired-Single Support}. This option requires
14887 hardware floating-point support to be enabled.
14893 Use (do not use) MIPS Digital Media Extension instructions.
14894 This option can only be used when generating 64-bit code and requires
14895 hardware floating-point support to be enabled.
14900 @opindex mno-mips3d
14901 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
14902 The option @option{-mips3d} implies @option{-mpaired-single}.
14908 Use (do not use) MT Multithreading instructions.
14912 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
14913 an explanation of the default and the way that the pointer size is
14918 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
14920 The default size of @code{int}s, @code{long}s and pointers depends on
14921 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
14922 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
14923 32-bit @code{long}s. Pointers are the same size as @code{long}s,
14924 or the same size as integer registers, whichever is smaller.
14930 Assume (do not assume) that all symbols have 32-bit values, regardless
14931 of the selected ABI@. This option is useful in combination with
14932 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
14933 to generate shorter and faster references to symbolic addresses.
14937 Put definitions of externally-visible data in a small data section
14938 if that data is no bigger than @var{num} bytes. GCC can then access
14939 the data more efficiently; see @option{-mgpopt} for details.
14941 The default @option{-G} option depends on the configuration.
14943 @item -mlocal-sdata
14944 @itemx -mno-local-sdata
14945 @opindex mlocal-sdata
14946 @opindex mno-local-sdata
14947 Extend (do not extend) the @option{-G} behavior to local data too,
14948 such as to static variables in C@. @option{-mlocal-sdata} is the
14949 default for all configurations.
14951 If the linker complains that an application is using too much small data,
14952 you might want to try rebuilding the less performance-critical parts with
14953 @option{-mno-local-sdata}. You might also want to build large
14954 libraries with @option{-mno-local-sdata}, so that the libraries leave
14955 more room for the main program.
14957 @item -mextern-sdata
14958 @itemx -mno-extern-sdata
14959 @opindex mextern-sdata
14960 @opindex mno-extern-sdata
14961 Assume (do not assume) that externally-defined data will be in
14962 a small data section if that data is within the @option{-G} limit.
14963 @option{-mextern-sdata} is the default for all configurations.
14965 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
14966 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
14967 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
14968 is placed in a small data section. If @var{Var} is defined by another
14969 module, you must either compile that module with a high-enough
14970 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
14971 definition. If @var{Var} is common, you must link the application
14972 with a high-enough @option{-G} setting.
14974 The easiest way of satisfying these restrictions is to compile
14975 and link every module with the same @option{-G} option. However,
14976 you may wish to build a library that supports several different
14977 small data limits. You can do this by compiling the library with
14978 the highest supported @option{-G} setting and additionally using
14979 @option{-mno-extern-sdata} to stop the library from making assumptions
14980 about externally-defined data.
14986 Use (do not use) GP-relative accesses for symbols that are known to be
14987 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
14988 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
14991 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
14992 might not hold the value of @code{_gp}. For example, if the code is
14993 part of a library that might be used in a boot monitor, programs that
14994 call boot monitor routines will pass an unknown value in @code{$gp}.
14995 (In such situations, the boot monitor itself would usually be compiled
14996 with @option{-G0}.)
14998 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
14999 @option{-mno-extern-sdata}.
15001 @item -membedded-data
15002 @itemx -mno-embedded-data
15003 @opindex membedded-data
15004 @opindex mno-embedded-data
15005 Allocate variables to the read-only data section first if possible, then
15006 next in the small data section if possible, otherwise in data. This gives
15007 slightly slower code than the default, but reduces the amount of RAM required
15008 when executing, and thus may be preferred for some embedded systems.
15010 @item -muninit-const-in-rodata
15011 @itemx -mno-uninit-const-in-rodata
15012 @opindex muninit-const-in-rodata
15013 @opindex mno-uninit-const-in-rodata
15014 Put uninitialized @code{const} variables in the read-only data section.
15015 This option is only meaningful in conjunction with @option{-membedded-data}.
15017 @item -mcode-readable=@var{setting}
15018 @opindex mcode-readable
15019 Specify whether GCC may generate code that reads from executable sections.
15020 There are three possible settings:
15023 @item -mcode-readable=yes
15024 Instructions may freely access executable sections. This is the
15027 @item -mcode-readable=pcrel
15028 MIPS16 PC-relative load instructions can access executable sections,
15029 but other instructions must not do so. This option is useful on 4KSc
15030 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
15031 It is also useful on processors that can be configured to have a dual
15032 instruction/data SRAM interface and that, like the M4K, automatically
15033 redirect PC-relative loads to the instruction RAM.
15035 @item -mcode-readable=no
15036 Instructions must not access executable sections. This option can be
15037 useful on targets that are configured to have a dual instruction/data
15038 SRAM interface but that (unlike the M4K) do not automatically redirect
15039 PC-relative loads to the instruction RAM.
15042 @item -msplit-addresses
15043 @itemx -mno-split-addresses
15044 @opindex msplit-addresses
15045 @opindex mno-split-addresses
15046 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
15047 relocation operators. This option has been superseded by
15048 @option{-mexplicit-relocs} but is retained for backwards compatibility.
15050 @item -mexplicit-relocs
15051 @itemx -mno-explicit-relocs
15052 @opindex mexplicit-relocs
15053 @opindex mno-explicit-relocs
15054 Use (do not use) assembler relocation operators when dealing with symbolic
15055 addresses. The alternative, selected by @option{-mno-explicit-relocs},
15056 is to use assembler macros instead.
15058 @option{-mexplicit-relocs} is the default if GCC was configured
15059 to use an assembler that supports relocation operators.
15061 @item -mcheck-zero-division
15062 @itemx -mno-check-zero-division
15063 @opindex mcheck-zero-division
15064 @opindex mno-check-zero-division
15065 Trap (do not trap) on integer division by zero.
15067 The default is @option{-mcheck-zero-division}.
15069 @item -mdivide-traps
15070 @itemx -mdivide-breaks
15071 @opindex mdivide-traps
15072 @opindex mdivide-breaks
15073 MIPS systems check for division by zero by generating either a
15074 conditional trap or a break instruction. Using traps results in
15075 smaller code, but is only supported on MIPS II and later. Also, some
15076 versions of the Linux kernel have a bug that prevents trap from
15077 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
15078 allow conditional traps on architectures that support them and
15079 @option{-mdivide-breaks} to force the use of breaks.
15081 The default is usually @option{-mdivide-traps}, but this can be
15082 overridden at configure time using @option{--with-divide=breaks}.
15083 Divide-by-zero checks can be completely disabled using
15084 @option{-mno-check-zero-division}.
15089 @opindex mno-memcpy
15090 Force (do not force) the use of @code{memcpy()} for non-trivial block
15091 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
15092 most constant-sized copies.
15095 @itemx -mno-long-calls
15096 @opindex mlong-calls
15097 @opindex mno-long-calls
15098 Disable (do not disable) use of the @code{jal} instruction. Calling
15099 functions using @code{jal} is more efficient but requires the caller
15100 and callee to be in the same 256 megabyte segment.
15102 This option has no effect on abicalls code. The default is
15103 @option{-mno-long-calls}.
15109 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
15110 instructions, as provided by the R4650 ISA@.
15113 @itemx -mno-fused-madd
15114 @opindex mfused-madd
15115 @opindex mno-fused-madd
15116 Enable (disable) use of the floating point multiply-accumulate
15117 instructions, when they are available. The default is
15118 @option{-mfused-madd}.
15120 When multiply-accumulate instructions are used, the intermediate
15121 product is calculated to infinite precision and is not subject to
15122 the FCSR Flush to Zero bit. This may be undesirable in some
15127 Tell the MIPS assembler to not run its preprocessor over user
15128 assembler files (with a @samp{.s} suffix) when assembling them.
15133 @opindex mno-fix-24k
15134 Work around the 24K E48 (lost data on stores during refill) errata.
15135 The workarounds are implemented by the assembler rather than by GCC.
15138 @itemx -mno-fix-r4000
15139 @opindex mfix-r4000
15140 @opindex mno-fix-r4000
15141 Work around certain R4000 CPU errata:
15144 A double-word or a variable shift may give an incorrect result if executed
15145 immediately after starting an integer division.
15147 A double-word or a variable shift may give an incorrect result if executed
15148 while an integer multiplication is in progress.
15150 An integer division may give an incorrect result if started in a delay slot
15151 of a taken branch or a jump.
15155 @itemx -mno-fix-r4400
15156 @opindex mfix-r4400
15157 @opindex mno-fix-r4400
15158 Work around certain R4400 CPU errata:
15161 A double-word or a variable shift may give an incorrect result if executed
15162 immediately after starting an integer division.
15166 @itemx -mno-fix-r10000
15167 @opindex mfix-r10000
15168 @opindex mno-fix-r10000
15169 Work around certain R10000 errata:
15172 @code{ll}/@code{sc} sequences may not behave atomically on revisions
15173 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
15176 This option can only be used if the target architecture supports
15177 branch-likely instructions. @option{-mfix-r10000} is the default when
15178 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
15182 @itemx -mno-fix-vr4120
15183 @opindex mfix-vr4120
15184 Work around certain VR4120 errata:
15187 @code{dmultu} does not always produce the correct result.
15189 @code{div} and @code{ddiv} do not always produce the correct result if one
15190 of the operands is negative.
15192 The workarounds for the division errata rely on special functions in
15193 @file{libgcc.a}. At present, these functions are only provided by
15194 the @code{mips64vr*-elf} configurations.
15196 Other VR4120 errata require a nop to be inserted between certain pairs of
15197 instructions. These errata are handled by the assembler, not by GCC itself.
15200 @opindex mfix-vr4130
15201 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
15202 workarounds are implemented by the assembler rather than by GCC,
15203 although GCC will avoid using @code{mflo} and @code{mfhi} if the
15204 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
15205 instructions are available instead.
15208 @itemx -mno-fix-sb1
15210 Work around certain SB-1 CPU core errata.
15211 (This flag currently works around the SB-1 revision 2
15212 ``F1'' and ``F2'' floating point errata.)
15214 @item -mr10k-cache-barrier=@var{setting}
15215 @opindex mr10k-cache-barrier
15216 Specify whether GCC should insert cache barriers to avoid the
15217 side-effects of speculation on R10K processors.
15219 In common with many processors, the R10K tries to predict the outcome
15220 of a conditional branch and speculatively executes instructions from
15221 the ``taken'' branch. It later aborts these instructions if the
15222 predicted outcome was wrong. However, on the R10K, even aborted
15223 instructions can have side effects.
15225 This problem only affects kernel stores and, depending on the system,
15226 kernel loads. As an example, a speculatively-executed store may load
15227 the target memory into cache and mark the cache line as dirty, even if
15228 the store itself is later aborted. If a DMA operation writes to the
15229 same area of memory before the ``dirty'' line is flushed, the cached
15230 data will overwrite the DMA-ed data. See the R10K processor manual
15231 for a full description, including other potential problems.
15233 One workaround is to insert cache barrier instructions before every memory
15234 access that might be speculatively executed and that might have side
15235 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
15236 controls GCC's implementation of this workaround. It assumes that
15237 aborted accesses to any byte in the following regions will not have
15242 the memory occupied by the current function's stack frame;
15245 the memory occupied by an incoming stack argument;
15248 the memory occupied by an object with a link-time-constant address.
15251 It is the kernel's responsibility to ensure that speculative
15252 accesses to these regions are indeed safe.
15254 If the input program contains a function declaration such as:
15260 then the implementation of @code{foo} must allow @code{j foo} and
15261 @code{jal foo} to be executed speculatively. GCC honors this
15262 restriction for functions it compiles itself. It expects non-GCC
15263 functions (such as hand-written assembly code) to do the same.
15265 The option has three forms:
15268 @item -mr10k-cache-barrier=load-store
15269 Insert a cache barrier before a load or store that might be
15270 speculatively executed and that might have side effects even
15273 @item -mr10k-cache-barrier=store
15274 Insert a cache barrier before a store that might be speculatively
15275 executed and that might have side effects even if aborted.
15277 @item -mr10k-cache-barrier=none
15278 Disable the insertion of cache barriers. This is the default setting.
15281 @item -mflush-func=@var{func}
15282 @itemx -mno-flush-func
15283 @opindex mflush-func
15284 Specifies the function to call to flush the I and D caches, or to not
15285 call any such function. If called, the function must take the same
15286 arguments as the common @code{_flush_func()}, that is, the address of the
15287 memory range for which the cache is being flushed, the size of the
15288 memory range, and the number 3 (to flush both caches). The default
15289 depends on the target GCC was configured for, but commonly is either
15290 @samp{_flush_func} or @samp{__cpu_flush}.
15292 @item mbranch-cost=@var{num}
15293 @opindex mbranch-cost
15294 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15295 This cost is only a heuristic and is not guaranteed to produce
15296 consistent results across releases. A zero cost redundantly selects
15297 the default, which is based on the @option{-mtune} setting.
15299 @item -mbranch-likely
15300 @itemx -mno-branch-likely
15301 @opindex mbranch-likely
15302 @opindex mno-branch-likely
15303 Enable or disable use of Branch Likely instructions, regardless of the
15304 default for the selected architecture. By default, Branch Likely
15305 instructions may be generated if they are supported by the selected
15306 architecture. An exception is for the MIPS32 and MIPS64 architectures
15307 and processors which implement those architectures; for those, Branch
15308 Likely instructions will not be generated by default because the MIPS32
15309 and MIPS64 architectures specifically deprecate their use.
15311 @item -mfp-exceptions
15312 @itemx -mno-fp-exceptions
15313 @opindex mfp-exceptions
15314 Specifies whether FP exceptions are enabled. This affects how we schedule
15315 FP instructions for some processors. The default is that FP exceptions are
15318 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
15319 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
15322 @item -mvr4130-align
15323 @itemx -mno-vr4130-align
15324 @opindex mvr4130-align
15325 The VR4130 pipeline is two-way superscalar, but can only issue two
15326 instructions together if the first one is 8-byte aligned. When this
15327 option is enabled, GCC will align pairs of instructions that it
15328 thinks should execute in parallel.
15330 This option only has an effect when optimizing for the VR4130.
15331 It normally makes code faster, but at the expense of making it bigger.
15332 It is enabled by default at optimization level @option{-O3}.
15337 Enable (disable) generation of @code{synci} instructions on
15338 architectures that support it. The @code{synci} instructions (if
15339 enabled) will be generated when @code{__builtin___clear_cache()} is
15342 This option defaults to @code{-mno-synci}, but the default can be
15343 overridden by configuring with @code{--with-synci}.
15345 When compiling code for single processor systems, it is generally safe
15346 to use @code{synci}. However, on many multi-core (SMP) systems, it
15347 will not invalidate the instruction caches on all cores and may lead
15348 to undefined behavior.
15350 @item -mrelax-pic-calls
15351 @itemx -mno-relax-pic-calls
15352 @opindex mrelax-pic-calls
15353 Try to turn PIC calls that are normally dispatched via register
15354 @code{$25} into direct calls. This is only possible if the linker can
15355 resolve the destination at link-time and if the destination is within
15356 range for a direct call.
15358 @option{-mrelax-pic-calls} is the default if GCC was configured to use
15359 an assembler and a linker that supports the @code{.reloc} assembly
15360 directive and @code{-mexplicit-relocs} is in effect. With
15361 @code{-mno-explicit-relocs}, this optimization can be performed by the
15362 assembler and the linker alone without help from the compiler.
15364 @item -mmcount-ra-address
15365 @itemx -mno-mcount-ra-address
15366 @opindex mmcount-ra-address
15367 @opindex mno-mcount-ra-address
15368 Emit (do not emit) code that allows @code{_mcount} to modify the
15369 calling function's return address. When enabled, this option extends
15370 the usual @code{_mcount} interface with a new @var{ra-address}
15371 parameter, which has type @code{intptr_t *} and is passed in register
15372 @code{$12}. @code{_mcount} can then modify the return address by
15373 doing both of the following:
15376 Returning the new address in register @code{$31}.
15378 Storing the new address in @code{*@var{ra-address}},
15379 if @var{ra-address} is nonnull.
15382 The default is @option{-mno-mcount-ra-address}.
15387 @subsection MMIX Options
15388 @cindex MMIX Options
15390 These options are defined for the MMIX:
15394 @itemx -mno-libfuncs
15396 @opindex mno-libfuncs
15397 Specify that intrinsic library functions are being compiled, passing all
15398 values in registers, no matter the size.
15401 @itemx -mno-epsilon
15403 @opindex mno-epsilon
15404 Generate floating-point comparison instructions that compare with respect
15405 to the @code{rE} epsilon register.
15407 @item -mabi=mmixware
15409 @opindex mabi=mmixware
15411 Generate code that passes function parameters and return values that (in
15412 the called function) are seen as registers @code{$0} and up, as opposed to
15413 the GNU ABI which uses global registers @code{$231} and up.
15415 @item -mzero-extend
15416 @itemx -mno-zero-extend
15417 @opindex mzero-extend
15418 @opindex mno-zero-extend
15419 When reading data from memory in sizes shorter than 64 bits, use (do not
15420 use) zero-extending load instructions by default, rather than
15421 sign-extending ones.
15424 @itemx -mno-knuthdiv
15426 @opindex mno-knuthdiv
15427 Make the result of a division yielding a remainder have the same sign as
15428 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
15429 remainder follows the sign of the dividend. Both methods are
15430 arithmetically valid, the latter being almost exclusively used.
15432 @item -mtoplevel-symbols
15433 @itemx -mno-toplevel-symbols
15434 @opindex mtoplevel-symbols
15435 @opindex mno-toplevel-symbols
15436 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
15437 code can be used with the @code{PREFIX} assembly directive.
15441 Generate an executable in the ELF format, rather than the default
15442 @samp{mmo} format used by the @command{mmix} simulator.
15444 @item -mbranch-predict
15445 @itemx -mno-branch-predict
15446 @opindex mbranch-predict
15447 @opindex mno-branch-predict
15448 Use (do not use) the probable-branch instructions, when static branch
15449 prediction indicates a probable branch.
15451 @item -mbase-addresses
15452 @itemx -mno-base-addresses
15453 @opindex mbase-addresses
15454 @opindex mno-base-addresses
15455 Generate (do not generate) code that uses @emph{base addresses}. Using a
15456 base address automatically generates a request (handled by the assembler
15457 and the linker) for a constant to be set up in a global register. The
15458 register is used for one or more base address requests within the range 0
15459 to 255 from the value held in the register. The generally leads to short
15460 and fast code, but the number of different data items that can be
15461 addressed is limited. This means that a program that uses lots of static
15462 data may require @option{-mno-base-addresses}.
15464 @item -msingle-exit
15465 @itemx -mno-single-exit
15466 @opindex msingle-exit
15467 @opindex mno-single-exit
15468 Force (do not force) generated code to have a single exit point in each
15472 @node MN10300 Options
15473 @subsection MN10300 Options
15474 @cindex MN10300 options
15476 These @option{-m} options are defined for Matsushita MN10300 architectures:
15481 Generate code to avoid bugs in the multiply instructions for the MN10300
15482 processors. This is the default.
15484 @item -mno-mult-bug
15485 @opindex mno-mult-bug
15486 Do not generate code to avoid bugs in the multiply instructions for the
15487 MN10300 processors.
15491 Generate code which uses features specific to the AM33 processor.
15495 Do not generate code which uses features specific to the AM33 processor. This
15500 Generate code which uses features specific to the AM33/2.0 processor.
15504 Generate code which uses features specific to the AM34 processor.
15506 @item -mtune=@var{cpu-type}
15508 Use the timing characteristics of the indicated CPU type when
15509 scheduling instructions. This does not change the targeted processor
15510 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
15511 @samp{am33-2} or @samp{am34}.
15513 @item -mreturn-pointer-on-d0
15514 @opindex mreturn-pointer-on-d0
15515 When generating a function which returns a pointer, return the pointer
15516 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
15517 only in a0, and attempts to call such functions without a prototype
15518 would result in errors. Note that this option is on by default; use
15519 @option{-mno-return-pointer-on-d0} to disable it.
15523 Do not link in the C run-time initialization object file.
15527 Indicate to the linker that it should perform a relaxation optimization pass
15528 to shorten branches, calls and absolute memory addresses. This option only
15529 has an effect when used on the command line for the final link step.
15531 This option makes symbolic debugging impossible.
15535 Allow the compiler to generate @emph{Long Instruction Word}
15536 instructions if the target is the @samp{AM33} or later. This is the
15537 default. This option defines the preprocessor macro @samp{__LIW__}.
15541 Do not allow the compiler to generate @emph{Long Instruction Word}
15542 instructions. This option defines the preprocessor macro
15547 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
15548 instructions if the target is the @samp{AM33} or later. This is the
15549 default. This option defines the preprocessor macro @samp{__SETLB__}.
15553 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
15554 instructions. This option defines the preprocessor macro
15555 @samp{__NO_SETLB__}.
15559 @node PDP-11 Options
15560 @subsection PDP-11 Options
15561 @cindex PDP-11 Options
15563 These options are defined for the PDP-11:
15568 Use hardware FPP floating point. This is the default. (FIS floating
15569 point on the PDP-11/40 is not supported.)
15572 @opindex msoft-float
15573 Do not use hardware floating point.
15577 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
15581 Return floating-point results in memory. This is the default.
15585 Generate code for a PDP-11/40.
15589 Generate code for a PDP-11/45. This is the default.
15593 Generate code for a PDP-11/10.
15595 @item -mbcopy-builtin
15596 @opindex mbcopy-builtin
15597 Use inline @code{movmemhi} patterns for copying memory. This is the
15602 Do not use inline @code{movmemhi} patterns for copying memory.
15608 Use 16-bit @code{int}. This is the default.
15614 Use 32-bit @code{int}.
15617 @itemx -mno-float32
15619 @opindex mno-float32
15620 Use 64-bit @code{float}. This is the default.
15623 @itemx -mno-float64
15625 @opindex mno-float64
15626 Use 32-bit @code{float}.
15630 Use @code{abshi2} pattern. This is the default.
15634 Do not use @code{abshi2} pattern.
15636 @item -mbranch-expensive
15637 @opindex mbranch-expensive
15638 Pretend that branches are expensive. This is for experimenting with
15639 code generation only.
15641 @item -mbranch-cheap
15642 @opindex mbranch-cheap
15643 Do not pretend that branches are expensive. This is the default.
15647 Use Unix assembler syntax. This is the default when configured for
15648 @samp{pdp11-*-bsd}.
15652 Use DEC assembler syntax. This is the default when configured for any
15653 PDP-11 target other than @samp{pdp11-*-bsd}.
15656 @node picoChip Options
15657 @subsection picoChip Options
15658 @cindex picoChip options
15660 These @samp{-m} options are defined for picoChip implementations:
15664 @item -mae=@var{ae_type}
15666 Set the instruction set, register set, and instruction scheduling
15667 parameters for array element type @var{ae_type}. Supported values
15668 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
15670 @option{-mae=ANY} selects a completely generic AE type. Code
15671 generated with this option will run on any of the other AE types. The
15672 code will not be as efficient as it would be if compiled for a specific
15673 AE type, and some types of operation (e.g., multiplication) will not
15674 work properly on all types of AE.
15676 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
15677 for compiled code, and is the default.
15679 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
15680 option may suffer from poor performance of byte (char) manipulation,
15681 since the DSP AE does not provide hardware support for byte load/stores.
15683 @item -msymbol-as-address
15684 Enable the compiler to directly use a symbol name as an address in a
15685 load/store instruction, without first loading it into a
15686 register. Typically, the use of this option will generate larger
15687 programs, which run faster than when the option isn't used. However, the
15688 results vary from program to program, so it is left as a user option,
15689 rather than being permanently enabled.
15691 @item -mno-inefficient-warnings
15692 Disables warnings about the generation of inefficient code. These
15693 warnings can be generated, for example, when compiling code which
15694 performs byte-level memory operations on the MAC AE type. The MAC AE has
15695 no hardware support for byte-level memory operations, so all byte
15696 load/stores must be synthesized from word load/store operations. This is
15697 inefficient and a warning will be generated indicating to the programmer
15698 that they should rewrite the code to avoid byte operations, or to target
15699 an AE type which has the necessary hardware support. This option enables
15700 the warning to be turned off.
15704 @node PowerPC Options
15705 @subsection PowerPC Options
15706 @cindex PowerPC options
15708 These are listed under @xref{RS/6000 and PowerPC Options}.
15710 @node RS/6000 and PowerPC Options
15711 @subsection IBM RS/6000 and PowerPC Options
15712 @cindex RS/6000 and PowerPC Options
15713 @cindex IBM RS/6000 and PowerPC Options
15715 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
15722 @itemx -mno-powerpc
15723 @itemx -mpowerpc-gpopt
15724 @itemx -mno-powerpc-gpopt
15725 @itemx -mpowerpc-gfxopt
15726 @itemx -mno-powerpc-gfxopt
15729 @itemx -mno-powerpc64
15733 @itemx -mno-popcntb
15735 @itemx -mno-popcntd
15744 @itemx -mno-hard-dfp
15748 @opindex mno-power2
15750 @opindex mno-powerpc
15751 @opindex mpowerpc-gpopt
15752 @opindex mno-powerpc-gpopt
15753 @opindex mpowerpc-gfxopt
15754 @opindex mno-powerpc-gfxopt
15755 @opindex mpowerpc64
15756 @opindex mno-powerpc64
15760 @opindex mno-popcntb
15762 @opindex mno-popcntd
15768 @opindex mno-mfpgpr
15770 @opindex mno-hard-dfp
15771 GCC supports two related instruction set architectures for the
15772 RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
15773 instructions supported by the @samp{rios} chip set used in the original
15774 RS/6000 systems and the @dfn{PowerPC} instruction set is the
15775 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
15776 the IBM 4xx, 6xx, and follow-on microprocessors.
15778 Neither architecture is a subset of the other. However there is a
15779 large common subset of instructions supported by both. An MQ
15780 register is included in processors supporting the POWER architecture.
15782 You use these options to specify which instructions are available on the
15783 processor you are using. The default value of these options is
15784 determined when configuring GCC@. Specifying the
15785 @option{-mcpu=@var{cpu_type}} overrides the specification of these
15786 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
15787 rather than the options listed above.
15789 The @option{-mpower} option allows GCC to generate instructions that
15790 are found only in the POWER architecture and to use the MQ register.
15791 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
15792 to generate instructions that are present in the POWER2 architecture but
15793 not the original POWER architecture.
15795 The @option{-mpowerpc} option allows GCC to generate instructions that
15796 are found only in the 32-bit subset of the PowerPC architecture.
15797 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
15798 GCC to use the optional PowerPC architecture instructions in the
15799 General Purpose group, including floating-point square root. Specifying
15800 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
15801 use the optional PowerPC architecture instructions in the Graphics
15802 group, including floating-point select.
15804 The @option{-mmfcrf} option allows GCC to generate the move from
15805 condition register field instruction implemented on the POWER4
15806 processor and other processors that support the PowerPC V2.01
15808 The @option{-mpopcntb} option allows GCC to generate the popcount and
15809 double precision FP reciprocal estimate instruction implemented on the
15810 POWER5 processor and other processors that support the PowerPC V2.02
15812 The @option{-mpopcntd} option allows GCC to generate the popcount
15813 instruction implemented on the POWER7 processor and other processors
15814 that support the PowerPC V2.06 architecture.
15815 The @option{-mfprnd} option allows GCC to generate the FP round to
15816 integer instructions implemented on the POWER5+ processor and other
15817 processors that support the PowerPC V2.03 architecture.
15818 The @option{-mcmpb} option allows GCC to generate the compare bytes
15819 instruction implemented on the POWER6 processor and other processors
15820 that support the PowerPC V2.05 architecture.
15821 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
15822 general purpose register instructions implemented on the POWER6X
15823 processor and other processors that support the extended PowerPC V2.05
15825 The @option{-mhard-dfp} option allows GCC to generate the decimal floating
15826 point instructions implemented on some POWER processors.
15828 The @option{-mpowerpc64} option allows GCC to generate the additional
15829 64-bit instructions that are found in the full PowerPC64 architecture
15830 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
15831 @option{-mno-powerpc64}.
15833 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
15834 will use only the instructions in the common subset of both
15835 architectures plus some special AIX common-mode calls, and will not use
15836 the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
15837 permits GCC to use any instruction from either architecture and to
15838 allow use of the MQ register; specify this for the Motorola MPC601.
15840 @item -mnew-mnemonics
15841 @itemx -mold-mnemonics
15842 @opindex mnew-mnemonics
15843 @opindex mold-mnemonics
15844 Select which mnemonics to use in the generated assembler code. With
15845 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
15846 the PowerPC architecture. With @option{-mold-mnemonics} it uses the
15847 assembler mnemonics defined for the POWER architecture. Instructions
15848 defined in only one architecture have only one mnemonic; GCC uses that
15849 mnemonic irrespective of which of these options is specified.
15851 GCC defaults to the mnemonics appropriate for the architecture in
15852 use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
15853 value of these option. Unless you are building a cross-compiler, you
15854 should normally not specify either @option{-mnew-mnemonics} or
15855 @option{-mold-mnemonics}, but should instead accept the default.
15857 @item -mcpu=@var{cpu_type}
15859 Set architecture type, register usage, choice of mnemonics, and
15860 instruction scheduling parameters for machine type @var{cpu_type}.
15861 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
15862 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
15863 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
15864 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
15865 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
15866 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
15867 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
15868 @samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
15869 @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
15870 @samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
15871 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
15873 @option{-mcpu=common} selects a completely generic processor. Code
15874 generated under this option will run on any POWER or PowerPC processor.
15875 GCC will use only the instructions in the common subset of both
15876 architectures, and will not use the MQ register. GCC assumes a generic
15877 processor model for scheduling purposes.
15879 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
15880 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
15881 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
15882 types, with an appropriate, generic processor model assumed for
15883 scheduling purposes.
15885 The other options specify a specific processor. Code generated under
15886 those options will run best on that processor, and may not run at all on
15889 The @option{-mcpu} options automatically enable or disable the
15892 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
15893 -mnew-mnemonics -mpopcntb -mpopcntd -mpower -mpower2 -mpowerpc64 @gol
15894 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
15895 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx}
15897 The particular options set for any particular CPU will vary between
15898 compiler versions, depending on what setting seems to produce optimal
15899 code for that CPU; it doesn't necessarily reflect the actual hardware's
15900 capabilities. If you wish to set an individual option to a particular
15901 value, you may specify it after the @option{-mcpu} option, like
15902 @samp{-mcpu=970 -mno-altivec}.
15904 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
15905 not enabled or disabled by the @option{-mcpu} option at present because
15906 AIX does not have full support for these options. You may still
15907 enable or disable them individually if you're sure it'll work in your
15910 @item -mtune=@var{cpu_type}
15912 Set the instruction scheduling parameters for machine type
15913 @var{cpu_type}, but do not set the architecture type, register usage, or
15914 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
15915 values for @var{cpu_type} are used for @option{-mtune} as for
15916 @option{-mcpu}. If both are specified, the code generated will use the
15917 architecture, registers, and mnemonics set by @option{-mcpu}, but the
15918 scheduling parameters set by @option{-mtune}.
15920 @item -mcmodel=small
15921 @opindex mcmodel=small
15922 Generate PowerPC64 code for the small model: The TOC is limited to
15925 @item -mcmodel=medium
15926 @opindex mcmodel=medium
15927 Generate PowerPC64 code for the medium model: The TOC and other static
15928 data may be up to a total of 4G in size.
15930 @item -mcmodel=large
15931 @opindex mcmodel=large
15932 Generate PowerPC64 code for the large model: The TOC may be up to 4G
15933 in size. Other data and code is only limited by the 64-bit address
15937 @itemx -mno-altivec
15939 @opindex mno-altivec
15940 Generate code that uses (does not use) AltiVec instructions, and also
15941 enable the use of built-in functions that allow more direct access to
15942 the AltiVec instruction set. You may also need to set
15943 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
15949 @opindex mno-vrsave
15950 Generate VRSAVE instructions when generating AltiVec code.
15952 @item -mgen-cell-microcode
15953 @opindex mgen-cell-microcode
15954 Generate Cell microcode instructions
15956 @item -mwarn-cell-microcode
15957 @opindex mwarn-cell-microcode
15958 Warning when a Cell microcode instruction is going to emitted. An example
15959 of a Cell microcode instruction is a variable shift.
15962 @opindex msecure-plt
15963 Generate code that allows ld and ld.so to build executables and shared
15964 libraries with non-exec .plt and .got sections. This is a PowerPC
15965 32-bit SYSV ABI option.
15969 Generate code that uses a BSS .plt section that ld.so fills in, and
15970 requires .plt and .got sections that are both writable and executable.
15971 This is a PowerPC 32-bit SYSV ABI option.
15977 This switch enables or disables the generation of ISEL instructions.
15979 @item -misel=@var{yes/no}
15980 This switch has been deprecated. Use @option{-misel} and
15981 @option{-mno-isel} instead.
15987 This switch enables or disables the generation of SPE simd
15993 @opindex mno-paired
15994 This switch enables or disables the generation of PAIRED simd
15997 @item -mspe=@var{yes/no}
15998 This option has been deprecated. Use @option{-mspe} and
15999 @option{-mno-spe} instead.
16005 Generate code that uses (does not use) vector/scalar (VSX)
16006 instructions, and also enable the use of built-in functions that allow
16007 more direct access to the VSX instruction set.
16009 @item -mfloat-gprs=@var{yes/single/double/no}
16010 @itemx -mfloat-gprs
16011 @opindex mfloat-gprs
16012 This switch enables or disables the generation of floating point
16013 operations on the general purpose registers for architectures that
16016 The argument @var{yes} or @var{single} enables the use of
16017 single-precision floating point operations.
16019 The argument @var{double} enables the use of single and
16020 double-precision floating point operations.
16022 The argument @var{no} disables floating point operations on the
16023 general purpose registers.
16025 This option is currently only available on the MPC854x.
16031 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
16032 targets (including GNU/Linux). The 32-bit environment sets int, long
16033 and pointer to 32 bits and generates code that runs on any PowerPC
16034 variant. The 64-bit environment sets int to 32 bits and long and
16035 pointer to 64 bits, and generates code for PowerPC64, as for
16036 @option{-mpowerpc64}.
16039 @itemx -mno-fp-in-toc
16040 @itemx -mno-sum-in-toc
16041 @itemx -mminimal-toc
16043 @opindex mno-fp-in-toc
16044 @opindex mno-sum-in-toc
16045 @opindex mminimal-toc
16046 Modify generation of the TOC (Table Of Contents), which is created for
16047 every executable file. The @option{-mfull-toc} option is selected by
16048 default. In that case, GCC will allocate at least one TOC entry for
16049 each unique non-automatic variable reference in your program. GCC
16050 will also place floating-point constants in the TOC@. However, only
16051 16,384 entries are available in the TOC@.
16053 If you receive a linker error message that saying you have overflowed
16054 the available TOC space, you can reduce the amount of TOC space used
16055 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
16056 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
16057 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
16058 generate code to calculate the sum of an address and a constant at
16059 run-time instead of putting that sum into the TOC@. You may specify one
16060 or both of these options. Each causes GCC to produce very slightly
16061 slower and larger code at the expense of conserving TOC space.
16063 If you still run out of space in the TOC even when you specify both of
16064 these options, specify @option{-mminimal-toc} instead. This option causes
16065 GCC to make only one TOC entry for every file. When you specify this
16066 option, GCC will produce code that is slower and larger but which
16067 uses extremely little TOC space. You may wish to use this option
16068 only on files that contain less frequently executed code.
16074 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
16075 @code{long} type, and the infrastructure needed to support them.
16076 Specifying @option{-maix64} implies @option{-mpowerpc64} and
16077 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
16078 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
16081 @itemx -mno-xl-compat
16082 @opindex mxl-compat
16083 @opindex mno-xl-compat
16084 Produce code that conforms more closely to IBM XL compiler semantics
16085 when using AIX-compatible ABI@. Pass floating-point arguments to
16086 prototyped functions beyond the register save area (RSA) on the stack
16087 in addition to argument FPRs. Do not assume that most significant
16088 double in 128-bit long double value is properly rounded when comparing
16089 values and converting to double. Use XL symbol names for long double
16092 The AIX calling convention was extended but not initially documented to
16093 handle an obscure K&R C case of calling a function that takes the
16094 address of its arguments with fewer arguments than declared. IBM XL
16095 compilers access floating point arguments which do not fit in the
16096 RSA from the stack when a subroutine is compiled without
16097 optimization. Because always storing floating-point arguments on the
16098 stack is inefficient and rarely needed, this option is not enabled by
16099 default and only is necessary when calling subroutines compiled by IBM
16100 XL compilers without optimization.
16104 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
16105 application written to use message passing with special startup code to
16106 enable the application to run. The system must have PE installed in the
16107 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
16108 must be overridden with the @option{-specs=} option to specify the
16109 appropriate directory location. The Parallel Environment does not
16110 support threads, so the @option{-mpe} option and the @option{-pthread}
16111 option are incompatible.
16113 @item -malign-natural
16114 @itemx -malign-power
16115 @opindex malign-natural
16116 @opindex malign-power
16117 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
16118 @option{-malign-natural} overrides the ABI-defined alignment of larger
16119 types, such as floating-point doubles, on their natural size-based boundary.
16120 The option @option{-malign-power} instructs GCC to follow the ABI-specified
16121 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
16123 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
16127 @itemx -mhard-float
16128 @opindex msoft-float
16129 @opindex mhard-float
16130 Generate code that does not use (uses) the floating-point register set.
16131 Software floating point emulation is provided if you use the
16132 @option{-msoft-float} option, and pass the option to GCC when linking.
16134 @item -msingle-float
16135 @itemx -mdouble-float
16136 @opindex msingle-float
16137 @opindex mdouble-float
16138 Generate code for single or double-precision floating point operations.
16139 @option{-mdouble-float} implies @option{-msingle-float}.
16142 @opindex msimple-fpu
16143 Do not generate sqrt and div instructions for hardware floating point unit.
16147 Specify type of floating point unit. Valid values are @var{sp_lite}
16148 (equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
16149 to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
16150 and @var{dp_full} (equivalent to -mdouble-float).
16153 @opindex mxilinx-fpu
16154 Perform optimizations for floating point unit on Xilinx PPC 405/440.
16157 @itemx -mno-multiple
16159 @opindex mno-multiple
16160 Generate code that uses (does not use) the load multiple word
16161 instructions and the store multiple word instructions. These
16162 instructions are generated by default on POWER systems, and not
16163 generated on PowerPC systems. Do not use @option{-mmultiple} on little
16164 endian PowerPC systems, since those instructions do not work when the
16165 processor is in little endian mode. The exceptions are PPC740 and
16166 PPC750 which permit the instructions usage in little endian mode.
16171 @opindex mno-string
16172 Generate code that uses (does not use) the load string instructions
16173 and the store string word instructions to save multiple registers and
16174 do small block moves. These instructions are generated by default on
16175 POWER systems, and not generated on PowerPC systems. Do not use
16176 @option{-mstring} on little endian PowerPC systems, since those
16177 instructions do not work when the processor is in little endian mode.
16178 The exceptions are PPC740 and PPC750 which permit the instructions
16179 usage in little endian mode.
16184 @opindex mno-update
16185 Generate code that uses (does not use) the load or store instructions
16186 that update the base register to the address of the calculated memory
16187 location. These instructions are generated by default. If you use
16188 @option{-mno-update}, there is a small window between the time that the
16189 stack pointer is updated and the address of the previous frame is
16190 stored, which means code that walks the stack frame across interrupts or
16191 signals may get corrupted data.
16193 @item -mavoid-indexed-addresses
16194 @itemx -mno-avoid-indexed-addresses
16195 @opindex mavoid-indexed-addresses
16196 @opindex mno-avoid-indexed-addresses
16197 Generate code that tries to avoid (not avoid) the use of indexed load
16198 or store instructions. These instructions can incur a performance
16199 penalty on Power6 processors in certain situations, such as when
16200 stepping through large arrays that cross a 16M boundary. This option
16201 is enabled by default when targetting Power6 and disabled otherwise.
16204 @itemx -mno-fused-madd
16205 @opindex mfused-madd
16206 @opindex mno-fused-madd
16207 Generate code that uses (does not use) the floating point multiply and
16208 accumulate instructions. These instructions are generated by default
16209 if hardware floating point is used. The machine dependent
16210 @option{-mfused-madd} option is now mapped to the machine independent
16211 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
16212 mapped to @option{-ffp-contract=off}.
16218 Generate code that uses (does not use) the half-word multiply and
16219 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
16220 These instructions are generated by default when targetting those
16227 Generate code that uses (does not use) the string-search @samp{dlmzb}
16228 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
16229 generated by default when targetting those processors.
16231 @item -mno-bit-align
16233 @opindex mno-bit-align
16234 @opindex mbit-align
16235 On System V.4 and embedded PowerPC systems do not (do) force structures
16236 and unions that contain bit-fields to be aligned to the base type of the
16239 For example, by default a structure containing nothing but 8
16240 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
16241 boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
16242 the structure would be aligned to a 1 byte boundary and be one byte in
16245 @item -mno-strict-align
16246 @itemx -mstrict-align
16247 @opindex mno-strict-align
16248 @opindex mstrict-align
16249 On System V.4 and embedded PowerPC systems do not (do) assume that
16250 unaligned memory references will be handled by the system.
16252 @item -mrelocatable
16253 @itemx -mno-relocatable
16254 @opindex mrelocatable
16255 @opindex mno-relocatable
16256 Generate code that allows (does not allow) a static executable to be
16257 relocated to a different address at runtime. A simple embedded
16258 PowerPC system loader should relocate the entire contents of
16259 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
16260 a table of 32-bit addresses generated by this option. For this to
16261 work, all objects linked together must be compiled with
16262 @option{-mrelocatable} or @option{-mrelocatable-lib}.
16263 @option{-mrelocatable} code aligns the stack to an 8 byte boundary.
16265 @item -mrelocatable-lib
16266 @itemx -mno-relocatable-lib
16267 @opindex mrelocatable-lib
16268 @opindex mno-relocatable-lib
16269 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
16270 @code{.fixup} section to allow static executables to be relocated at
16271 runtime, but @option{-mrelocatable-lib} does not use the smaller stack
16272 alignment of @option{-mrelocatable}. Objects compiled with
16273 @option{-mrelocatable-lib} may be linked with objects compiled with
16274 any combination of the @option{-mrelocatable} options.
16280 On System V.4 and embedded PowerPC systems do not (do) assume that
16281 register 2 contains a pointer to a global area pointing to the addresses
16282 used in the program.
16285 @itemx -mlittle-endian
16287 @opindex mlittle-endian
16288 On System V.4 and embedded PowerPC systems compile code for the
16289 processor in little endian mode. The @option{-mlittle-endian} option is
16290 the same as @option{-mlittle}.
16293 @itemx -mbig-endian
16295 @opindex mbig-endian
16296 On System V.4 and embedded PowerPC systems compile code for the
16297 processor in big endian mode. The @option{-mbig-endian} option is
16298 the same as @option{-mbig}.
16300 @item -mdynamic-no-pic
16301 @opindex mdynamic-no-pic
16302 On Darwin and Mac OS X systems, compile code so that it is not
16303 relocatable, but that its external references are relocatable. The
16304 resulting code is suitable for applications, but not shared
16307 @item -msingle-pic-base
16308 @opindex msingle-pic-base
16309 Treat the register used for PIC addressing as read-only, rather than
16310 loading it in the prologue for each function. The run-time system is
16311 responsible for initializing this register with an appropriate value
16312 before execution begins.
16314 @item -mprioritize-restricted-insns=@var{priority}
16315 @opindex mprioritize-restricted-insns
16316 This option controls the priority that is assigned to
16317 dispatch-slot restricted instructions during the second scheduling
16318 pass. The argument @var{priority} takes the value @var{0/1/2} to assign
16319 @var{no/highest/second-highest} priority to dispatch slot restricted
16322 @item -msched-costly-dep=@var{dependence_type}
16323 @opindex msched-costly-dep
16324 This option controls which dependences are considered costly
16325 by the target during instruction scheduling. The argument
16326 @var{dependence_type} takes one of the following values:
16327 @var{no}: no dependence is costly,
16328 @var{all}: all dependences are costly,
16329 @var{true_store_to_load}: a true dependence from store to load is costly,
16330 @var{store_to_load}: any dependence from store to load is costly,
16331 @var{number}: any dependence which latency >= @var{number} is costly.
16333 @item -minsert-sched-nops=@var{scheme}
16334 @opindex minsert-sched-nops
16335 This option controls which nop insertion scheme will be used during
16336 the second scheduling pass. The argument @var{scheme} takes one of the
16338 @var{no}: Don't insert nops.
16339 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
16340 according to the scheduler's grouping.
16341 @var{regroup_exact}: Insert nops to force costly dependent insns into
16342 separate groups. Insert exactly as many nops as needed to force an insn
16343 to a new group, according to the estimated processor grouping.
16344 @var{number}: Insert nops to force costly dependent insns into
16345 separate groups. Insert @var{number} nops to force an insn to a new group.
16348 @opindex mcall-sysv
16349 On System V.4 and embedded PowerPC systems compile code using calling
16350 conventions that adheres to the March 1995 draft of the System V
16351 Application Binary Interface, PowerPC processor supplement. This is the
16352 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
16354 @item -mcall-sysv-eabi
16356 @opindex mcall-sysv-eabi
16357 @opindex mcall-eabi
16358 Specify both @option{-mcall-sysv} and @option{-meabi} options.
16360 @item -mcall-sysv-noeabi
16361 @opindex mcall-sysv-noeabi
16362 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
16364 @item -mcall-aixdesc
16366 On System V.4 and embedded PowerPC systems compile code for the AIX
16370 @opindex mcall-linux
16371 On System V.4 and embedded PowerPC systems compile code for the
16372 Linux-based GNU system.
16374 @item -mcall-freebsd
16375 @opindex mcall-freebsd
16376 On System V.4 and embedded PowerPC systems compile code for the
16377 FreeBSD operating system.
16379 @item -mcall-netbsd
16380 @opindex mcall-netbsd
16381 On System V.4 and embedded PowerPC systems compile code for the
16382 NetBSD operating system.
16384 @item -mcall-openbsd
16385 @opindex mcall-netbsd
16386 On System V.4 and embedded PowerPC systems compile code for the
16387 OpenBSD operating system.
16389 @item -maix-struct-return
16390 @opindex maix-struct-return
16391 Return all structures in memory (as specified by the AIX ABI)@.
16393 @item -msvr4-struct-return
16394 @opindex msvr4-struct-return
16395 Return structures smaller than 8 bytes in registers (as specified by the
16398 @item -mabi=@var{abi-type}
16400 Extend the current ABI with a particular extension, or remove such extension.
16401 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
16402 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
16406 Extend the current ABI with SPE ABI extensions. This does not change
16407 the default ABI, instead it adds the SPE ABI extensions to the current
16411 @opindex mabi=no-spe
16412 Disable Booke SPE ABI extensions for the current ABI@.
16414 @item -mabi=ibmlongdouble
16415 @opindex mabi=ibmlongdouble
16416 Change the current ABI to use IBM extended precision long double.
16417 This is a PowerPC 32-bit SYSV ABI option.
16419 @item -mabi=ieeelongdouble
16420 @opindex mabi=ieeelongdouble
16421 Change the current ABI to use IEEE extended precision long double.
16422 This is a PowerPC 32-bit Linux ABI option.
16425 @itemx -mno-prototype
16426 @opindex mprototype
16427 @opindex mno-prototype
16428 On System V.4 and embedded PowerPC systems assume that all calls to
16429 variable argument functions are properly prototyped. Otherwise, the
16430 compiler must insert an instruction before every non prototyped call to
16431 set or clear bit 6 of the condition code register (@var{CR}) to
16432 indicate whether floating point values were passed in the floating point
16433 registers in case the function takes a variable arguments. With
16434 @option{-mprototype}, only calls to prototyped variable argument functions
16435 will set or clear the bit.
16439 On embedded PowerPC systems, assume that the startup module is called
16440 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
16441 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
16446 On embedded PowerPC systems, assume that the startup module is called
16447 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
16452 On embedded PowerPC systems, assume that the startup module is called
16453 @file{crt0.o} and the standard C libraries are @file{libads.a} and
16456 @item -myellowknife
16457 @opindex myellowknife
16458 On embedded PowerPC systems, assume that the startup module is called
16459 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
16464 On System V.4 and embedded PowerPC systems, specify that you are
16465 compiling for a VxWorks system.
16469 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
16470 header to indicate that @samp{eabi} extended relocations are used.
16476 On System V.4 and embedded PowerPC systems do (do not) adhere to the
16477 Embedded Applications Binary Interface (eabi) which is a set of
16478 modifications to the System V.4 specifications. Selecting @option{-meabi}
16479 means that the stack is aligned to an 8 byte boundary, a function
16480 @code{__eabi} is called to from @code{main} to set up the eabi
16481 environment, and the @option{-msdata} option can use both @code{r2} and
16482 @code{r13} to point to two separate small data areas. Selecting
16483 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
16484 do not call an initialization function from @code{main}, and the
16485 @option{-msdata} option will only use @code{r13} to point to a single
16486 small data area. The @option{-meabi} option is on by default if you
16487 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
16490 @opindex msdata=eabi
16491 On System V.4 and embedded PowerPC systems, put small initialized
16492 @code{const} global and static data in the @samp{.sdata2} section, which
16493 is pointed to by register @code{r2}. Put small initialized
16494 non-@code{const} global and static data in the @samp{.sdata} section,
16495 which is pointed to by register @code{r13}. Put small uninitialized
16496 global and static data in the @samp{.sbss} section, which is adjacent to
16497 the @samp{.sdata} section. The @option{-msdata=eabi} option is
16498 incompatible with the @option{-mrelocatable} option. The
16499 @option{-msdata=eabi} option also sets the @option{-memb} option.
16502 @opindex msdata=sysv
16503 On System V.4 and embedded PowerPC systems, put small global and static
16504 data in the @samp{.sdata} section, which is pointed to by register
16505 @code{r13}. Put small uninitialized global and static data in the
16506 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
16507 The @option{-msdata=sysv} option is incompatible with the
16508 @option{-mrelocatable} option.
16510 @item -msdata=default
16512 @opindex msdata=default
16514 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
16515 compile code the same as @option{-msdata=eabi}, otherwise compile code the
16516 same as @option{-msdata=sysv}.
16519 @opindex msdata=data
16520 On System V.4 and embedded PowerPC systems, put small global
16521 data in the @samp{.sdata} section. Put small uninitialized global
16522 data in the @samp{.sbss} section. Do not use register @code{r13}
16523 to address small data however. This is the default behavior unless
16524 other @option{-msdata} options are used.
16528 @opindex msdata=none
16530 On embedded PowerPC systems, put all initialized global and static data
16531 in the @samp{.data} section, and all uninitialized data in the
16532 @samp{.bss} section.
16534 @item -mblock-move-inline-limit=@var{num}
16535 @opindex mblock-move-inline-limit
16536 Inline all block moves (such as calls to @code{memcpy} or structure
16537 copies) less than or equal to @var{num} bytes. The minimum value for
16538 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
16539 targets. The default value is target-specific.
16543 @cindex smaller data references (PowerPC)
16544 @cindex .sdata/.sdata2 references (PowerPC)
16545 On embedded PowerPC systems, put global and static items less than or
16546 equal to @var{num} bytes into the small data or bss sections instead of
16547 the normal data or bss section. By default, @var{num} is 8. The
16548 @option{-G @var{num}} switch is also passed to the linker.
16549 All modules should be compiled with the same @option{-G @var{num}} value.
16552 @itemx -mno-regnames
16554 @opindex mno-regnames
16555 On System V.4 and embedded PowerPC systems do (do not) emit register
16556 names in the assembly language output using symbolic forms.
16559 @itemx -mno-longcall
16561 @opindex mno-longcall
16562 By default assume that all calls are far away so that a longer more
16563 expensive calling sequence is required. This is required for calls
16564 further than 32 megabytes (33,554,432 bytes) from the current location.
16565 A short call will be generated if the compiler knows
16566 the call cannot be that far away. This setting can be overridden by
16567 the @code{shortcall} function attribute, or by @code{#pragma
16570 Some linkers are capable of detecting out-of-range calls and generating
16571 glue code on the fly. On these systems, long calls are unnecessary and
16572 generate slower code. As of this writing, the AIX linker can do this,
16573 as can the GNU linker for PowerPC/64. It is planned to add this feature
16574 to the GNU linker for 32-bit PowerPC systems as well.
16576 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
16577 callee, L42'', plus a ``branch island'' (glue code). The two target
16578 addresses represent the callee and the ``branch island''. The
16579 Darwin/PPC linker will prefer the first address and generate a ``bl
16580 callee'' if the PPC ``bl'' instruction will reach the callee directly;
16581 otherwise, the linker will generate ``bl L42'' to call the ``branch
16582 island''. The ``branch island'' is appended to the body of the
16583 calling function; it computes the full 32-bit address of the callee
16586 On Mach-O (Darwin) systems, this option directs the compiler emit to
16587 the glue for every direct call, and the Darwin linker decides whether
16588 to use or discard it.
16590 In the future, we may cause GCC to ignore all longcall specifications
16591 when the linker is known to generate glue.
16593 @item -mtls-markers
16594 @itemx -mno-tls-markers
16595 @opindex mtls-markers
16596 @opindex mno-tls-markers
16597 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
16598 specifying the function argument. The relocation allows ld to
16599 reliably associate function call with argument setup instructions for
16600 TLS optimization, which in turn allows gcc to better schedule the
16605 Adds support for multithreading with the @dfn{pthreads} library.
16606 This option sets flags for both the preprocessor and linker.
16611 This option will enable GCC to use the reciprocal estimate and
16612 reciprocal square root estimate instructions with additional
16613 Newton-Raphson steps to increase precision instead of doing a divide or
16614 square root and divide for floating point arguments. You should use
16615 the @option{-ffast-math} option when using @option{-mrecip} (or at
16616 least @option{-funsafe-math-optimizations},
16617 @option{-finite-math-only}, @option{-freciprocal-math} and
16618 @option{-fno-trapping-math}). Note that while the throughput of the
16619 sequence is generally higher than the throughput of the non-reciprocal
16620 instruction, the precision of the sequence can be decreased by up to 2
16621 ulp (i.e. the inverse of 1.0 equals 0.99999994) for reciprocal square
16624 @item -mrecip=@var{opt}
16625 @opindex mrecip=opt
16626 This option allows to control which reciprocal estimate instructions
16627 may be used. @var{opt} is a comma separated list of options, that may
16628 be preceded by a @code{!} to invert the option:
16629 @code{all}: enable all estimate instructions,
16630 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
16631 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
16632 @code{div}: enable the reciprocal approximation instructions for both single and double precision;
16633 @code{divf}: enable the single precision reciprocal approximation instructions;
16634 @code{divd}: enable the double precision reciprocal approximation instructions;
16635 @code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
16636 @code{rsqrtf}: enable the single precision reciprocal square root approximation instructions;
16637 @code{rsqrtd}: enable the double precision reciprocal square root approximation instructions;
16639 So for example, @option{-mrecip=all,!rsqrtd} would enable the
16640 all of the reciprocal estimate instructions, except for the
16641 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
16642 which handle the double precision reciprocal square root calculations.
16644 @item -mrecip-precision
16645 @itemx -mno-recip-precision
16646 @opindex mrecip-precision
16647 Assume (do not assume) that the reciprocal estimate instructions
16648 provide higher precision estimates than is mandated by the powerpc
16649 ABI. Selecting @option{-mcpu=power6} or @option{-mcpu=power7}
16650 automatically selects @option{-mrecip-precision}. The double
16651 precision square root estimate instructions are not generated by
16652 default on low precision machines, since they do not provide an
16653 estimate that converges after three steps.
16655 @item -mveclibabi=@var{type}
16656 @opindex mveclibabi
16657 Specifies the ABI type to use for vectorizing intrinsics using an
16658 external library. The only type supported at present is @code{mass},
16659 which specifies to use IBM's Mathematical Acceleration Subsystem
16660 (MASS) libraries for vectorizing intrinsics using external libraries.
16661 GCC will currently emit calls to @code{acosd2}, @code{acosf4},
16662 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
16663 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
16664 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
16665 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
16666 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
16667 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
16668 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
16669 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
16670 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
16671 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
16672 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
16673 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
16674 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
16675 for power7. Both @option{-ftree-vectorize} and
16676 @option{-funsafe-math-optimizations} have to be enabled. The MASS
16677 libraries will have to be specified at link time.
16682 Generate (do not generate) the @code{friz} instruction when the
16683 @option{-funsafe-math-optimizations} option is used to optimize
16684 rounding a floating point value to 64-bit integer and back to floating
16685 point. The @code{friz} instruction does not return the same value if
16686 the floating point number is too large to fit in an integer.
16688 @item -mpointers-to-nested-functions
16689 @itemx -mno-pointers-to-nested-functions
16690 @opindex mpointers-to-nested-functions
16691 Generate (do not generate) code to load up the static chain register
16692 (@var{r11}) when calling through a pointer on AIX and 64-bit Linux
16693 systems where a function pointer points to a 3 word descriptor giving
16694 the function address, TOC value to be loaded in register @var{r2}, and
16695 static chain value to be loaded in register @var{r11}. The
16696 @option{-mpointers-to-nested-functions} is on by default. You will
16697 not be able to call through pointers to nested functions or pointers
16698 to functions compiled in other languages that use the static chain if
16699 you use the @option{-mno-pointers-to-nested-functions}.
16701 @item -msave-toc-indirect
16702 @itemx -mno-save-toc-indirect
16703 @opindex msave-toc-indirect
16704 Generate (do not generate) code to save the TOC value in the reserved
16705 stack location in the function prologue if the function calls through
16706 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
16707 saved in the prologue, it is saved just before the call through the
16708 pointer. The @option{-mno-save-toc-indirect} option is the default.
16712 @subsection RX Options
16715 These command line options are defined for RX targets:
16718 @item -m64bit-doubles
16719 @itemx -m32bit-doubles
16720 @opindex m64bit-doubles
16721 @opindex m32bit-doubles
16722 Make the @code{double} data type be 64-bits (@option{-m64bit-doubles})
16723 or 32-bits (@option{-m32bit-doubles}) in size. The default is
16724 @option{-m32bit-doubles}. @emph{Note} RX floating point hardware only
16725 works on 32-bit values, which is why the default is
16726 @option{-m32bit-doubles}.
16732 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
16733 floating point hardware. The default is enabled for the @var{RX600}
16734 series and disabled for the @var{RX200} series.
16736 Floating point instructions will only be generated for 32-bit floating
16737 point values however, so if the @option{-m64bit-doubles} option is in
16738 use then the FPU hardware will not be used for doubles.
16740 @emph{Note} If the @option{-fpu} option is enabled then
16741 @option{-funsafe-math-optimizations} is also enabled automatically.
16742 This is because the RX FPU instructions are themselves unsafe.
16744 @item -mcpu=@var{name}
16746 Selects the type of RX CPU to be targeted. Currently three types are
16747 supported, the generic @var{RX600} and @var{RX200} series hardware and
16748 the specific @var{RX610} CPU. The default is @var{RX600}.
16750 The only difference between @var{RX600} and @var{RX610} is that the
16751 @var{RX610} does not support the @code{MVTIPL} instruction.
16753 The @var{RX200} series does not have a hardware floating point unit
16754 and so @option{-nofpu} is enabled by default when this type is
16757 @item -mbig-endian-data
16758 @itemx -mlittle-endian-data
16759 @opindex mbig-endian-data
16760 @opindex mlittle-endian-data
16761 Store data (but not code) in the big-endian format. The default is
16762 @option{-mlittle-endian-data}, i.e.@: to store data in the little endian
16765 @item -msmall-data-limit=@var{N}
16766 @opindex msmall-data-limit
16767 Specifies the maximum size in bytes of global and static variables
16768 which can be placed into the small data area. Using the small data
16769 area can lead to smaller and faster code, but the size of area is
16770 limited and it is up to the programmer to ensure that the area does
16771 not overflow. Also when the small data area is used one of the RX's
16772 registers (usually @code{r13}) is reserved for use pointing to this
16773 area, so it is no longer available for use by the compiler. This
16774 could result in slower and/or larger code if variables which once
16775 could have been held in the reserved register are now pushed onto the
16778 Note, common variables (variables which have not been initialised) and
16779 constants are not placed into the small data area as they are assigned
16780 to other sections in the output executable.
16782 The default value is zero, which disables this feature. Note, this
16783 feature is not enabled by default with higher optimization levels
16784 (@option{-O2} etc) because of the potentially detrimental effects of
16785 reserving a register. It is up to the programmer to experiment and
16786 discover whether this feature is of benefit to their program. See the
16787 description of the @option{-mpid} option for a description of how the
16788 actual register to hold the small data area pointer is chosen.
16794 Use the simulator runtime. The default is to use the libgloss board
16797 @item -mas100-syntax
16798 @itemx -mno-as100-syntax
16799 @opindex mas100-syntax
16800 @opindex mno-as100-syntax
16801 When generating assembler output use a syntax that is compatible with
16802 Renesas's AS100 assembler. This syntax can also be handled by the GAS
16803 assembler but it has some restrictions so generating it is not the
16806 @item -mmax-constant-size=@var{N}
16807 @opindex mmax-constant-size
16808 Specifies the maximum size, in bytes, of a constant that can be used as
16809 an operand in a RX instruction. Although the RX instruction set does
16810 allow constants of up to 4 bytes in length to be used in instructions,
16811 a longer value equates to a longer instruction. Thus in some
16812 circumstances it can be beneficial to restrict the size of constants
16813 that are used in instructions. Constants that are too big are instead
16814 placed into a constant pool and referenced via register indirection.
16816 The value @var{N} can be between 0 and 4. A value of 0 (the default)
16817 or 4 means that constants of any size are allowed.
16821 Enable linker relaxation. Linker relaxation is a process whereby the
16822 linker will attempt to reduce the size of a program by finding shorter
16823 versions of various instructions. Disabled by default.
16825 @item -mint-register=@var{N}
16826 @opindex mint-register
16827 Specify the number of registers to reserve for fast interrupt handler
16828 functions. The value @var{N} can be between 0 and 4. A value of 1
16829 means that register @code{r13} will be reserved for the exclusive use
16830 of fast interrupt handlers. A value of 2 reserves @code{r13} and
16831 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
16832 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
16833 A value of 0, the default, does not reserve any registers.
16835 @item -msave-acc-in-interrupts
16836 @opindex msave-acc-in-interrupts
16837 Specifies that interrupt handler functions should preserve the
16838 accumulator register. This is only necessary if normal code might use
16839 the accumulator register, for example because it performs 64-bit
16840 multiplications. The default is to ignore the accumulator as this
16841 makes the interrupt handlers faster.
16847 Enables the generation of position independent data. When enabled any
16848 access to constant data will done via an offset from a base address
16849 held in a register. This allows the location of constant data to be
16850 determined at run-time without requiring the executable to be
16851 relocated, which is a benefit to embedded applications with tight
16852 memory constraints. Data that can be modified is not affected by this
16855 Note, using this feature reserves a register, usually @code{r13}, for
16856 the constant data base address. This can result in slower and/or
16857 larger code, especially in complicated functions.
16859 The actual register chosen to hold the constant data base address
16860 depends upon whether the @option{-msmall-data-limit} and/or the
16861 @option{-mint-register} command line options are enabled. Starting
16862 with register @code{r13} and proceeding downwards, registers are
16863 allocated first to satisfy the requirements of @option{-mint-register},
16864 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
16865 is possible for the small data area register to be @code{r8} if both
16866 @option{-mint-register=4} and @option{-mpid} are specified on the
16869 By default this feature is not enabled. The default can be restored
16870 via the @option{-mno-pid} command line option.
16874 @emph{Note:} The generic GCC command line @option{-ffixed-@var{reg}}
16875 has special significance to the RX port when used with the
16876 @code{interrupt} function attribute. This attribute indicates a
16877 function intended to process fast interrupts. GCC will will ensure
16878 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
16879 and/or @code{r13} and only provided that the normal use of the
16880 corresponding registers have been restricted via the
16881 @option{-ffixed-@var{reg}} or @option{-mint-register} command line
16884 @node S/390 and zSeries Options
16885 @subsection S/390 and zSeries Options
16886 @cindex S/390 and zSeries Options
16888 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
16892 @itemx -msoft-float
16893 @opindex mhard-float
16894 @opindex msoft-float
16895 Use (do not use) the hardware floating-point instructions and registers
16896 for floating-point operations. When @option{-msoft-float} is specified,
16897 functions in @file{libgcc.a} will be used to perform floating-point
16898 operations. When @option{-mhard-float} is specified, the compiler
16899 generates IEEE floating-point instructions. This is the default.
16902 @itemx -mno-hard-dfp
16904 @opindex mno-hard-dfp
16905 Use (do not use) the hardware decimal-floating-point instructions for
16906 decimal-floating-point operations. When @option{-mno-hard-dfp} is
16907 specified, functions in @file{libgcc.a} will be used to perform
16908 decimal-floating-point operations. When @option{-mhard-dfp} is
16909 specified, the compiler generates decimal-floating-point hardware
16910 instructions. This is the default for @option{-march=z9-ec} or higher.
16912 @item -mlong-double-64
16913 @itemx -mlong-double-128
16914 @opindex mlong-double-64
16915 @opindex mlong-double-128
16916 These switches control the size of @code{long double} type. A size
16917 of 64bit makes the @code{long double} type equivalent to the @code{double}
16918 type. This is the default.
16921 @itemx -mno-backchain
16922 @opindex mbackchain
16923 @opindex mno-backchain
16924 Store (do not store) the address of the caller's frame as backchain pointer
16925 into the callee's stack frame.
16926 A backchain may be needed to allow debugging using tools that do not understand
16927 DWARF-2 call frame information.
16928 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
16929 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
16930 the backchain is placed into the topmost word of the 96/160 byte register
16933 In general, code compiled with @option{-mbackchain} is call-compatible with
16934 code compiled with @option{-mmo-backchain}; however, use of the backchain
16935 for debugging purposes usually requires that the whole binary is built with
16936 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
16937 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
16938 to build a linux kernel use @option{-msoft-float}.
16940 The default is to not maintain the backchain.
16942 @item -mpacked-stack
16943 @itemx -mno-packed-stack
16944 @opindex mpacked-stack
16945 @opindex mno-packed-stack
16946 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
16947 specified, the compiler uses the all fields of the 96/160 byte register save
16948 area only for their default purpose; unused fields still take up stack space.
16949 When @option{-mpacked-stack} is specified, register save slots are densely
16950 packed at the top of the register save area; unused space is reused for other
16951 purposes, allowing for more efficient use of the available stack space.
16952 However, when @option{-mbackchain} is also in effect, the topmost word of
16953 the save area is always used to store the backchain, and the return address
16954 register is always saved two words below the backchain.
16956 As long as the stack frame backchain is not used, code generated with
16957 @option{-mpacked-stack} is call-compatible with code generated with
16958 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
16959 S/390 or zSeries generated code that uses the stack frame backchain at run
16960 time, not just for debugging purposes. Such code is not call-compatible
16961 with code compiled with @option{-mpacked-stack}. Also, note that the
16962 combination of @option{-mbackchain},
16963 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
16964 to build a linux kernel use @option{-msoft-float}.
16966 The default is to not use the packed stack layout.
16969 @itemx -mno-small-exec
16970 @opindex msmall-exec
16971 @opindex mno-small-exec
16972 Generate (or do not generate) code using the @code{bras} instruction
16973 to do subroutine calls.
16974 This only works reliably if the total executable size does not
16975 exceed 64k. The default is to use the @code{basr} instruction instead,
16976 which does not have this limitation.
16982 When @option{-m31} is specified, generate code compliant to the
16983 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
16984 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
16985 particular to generate 64-bit instructions. For the @samp{s390}
16986 targets, the default is @option{-m31}, while the @samp{s390x}
16987 targets default to @option{-m64}.
16993 When @option{-mzarch} is specified, generate code using the
16994 instructions available on z/Architecture.
16995 When @option{-mesa} is specified, generate code using the
16996 instructions available on ESA/390. Note that @option{-mesa} is
16997 not possible with @option{-m64}.
16998 When generating code compliant to the GNU/Linux for S/390 ABI,
16999 the default is @option{-mesa}. When generating code compliant
17000 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
17006 Generate (or do not generate) code using the @code{mvcle} instruction
17007 to perform block moves. When @option{-mno-mvcle} is specified,
17008 use a @code{mvc} loop instead. This is the default unless optimizing for
17015 Print (or do not print) additional debug information when compiling.
17016 The default is to not print debug information.
17018 @item -march=@var{cpu-type}
17020 Generate code that will run on @var{cpu-type}, which is the name of a system
17021 representing a certain processor type. Possible values for
17022 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
17023 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
17024 When generating code using the instructions available on z/Architecture,
17025 the default is @option{-march=z900}. Otherwise, the default is
17026 @option{-march=g5}.
17028 @item -mtune=@var{cpu-type}
17030 Tune to @var{cpu-type} everything applicable about the generated code,
17031 except for the ABI and the set of available instructions.
17032 The list of @var{cpu-type} values is the same as for @option{-march}.
17033 The default is the value used for @option{-march}.
17036 @itemx -mno-tpf-trace
17037 @opindex mtpf-trace
17038 @opindex mno-tpf-trace
17039 Generate code that adds (does not add) in TPF OS specific branches to trace
17040 routines in the operating system. This option is off by default, even
17041 when compiling for the TPF OS@.
17044 @itemx -mno-fused-madd
17045 @opindex mfused-madd
17046 @opindex mno-fused-madd
17047 Generate code that uses (does not use) the floating point multiply and
17048 accumulate instructions. These instructions are generated by default if
17049 hardware floating point is used.
17051 @item -mwarn-framesize=@var{framesize}
17052 @opindex mwarn-framesize
17053 Emit a warning if the current function exceeds the given frame size. Because
17054 this is a compile time check it doesn't need to be a real problem when the program
17055 runs. It is intended to identify functions which most probably cause
17056 a stack overflow. It is useful to be used in an environment with limited stack
17057 size e.g.@: the linux kernel.
17059 @item -mwarn-dynamicstack
17060 @opindex mwarn-dynamicstack
17061 Emit a warning if the function calls alloca or uses dynamically
17062 sized arrays. This is generally a bad idea with a limited stack size.
17064 @item -mstack-guard=@var{stack-guard}
17065 @itemx -mstack-size=@var{stack-size}
17066 @opindex mstack-guard
17067 @opindex mstack-size
17068 If these options are provided the s390 back end emits additional instructions in
17069 the function prologue which trigger a trap if the stack size is @var{stack-guard}
17070 bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
17071 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
17072 the frame size of the compiled function is chosen.
17073 These options are intended to be used to help debugging stack overflow problems.
17074 The additionally emitted code causes only little overhead and hence can also be
17075 used in production like systems without greater performance degradation. The given
17076 values have to be exact powers of 2 and @var{stack-size} has to be greater than
17077 @var{stack-guard} without exceeding 64k.
17078 In order to be efficient the extra code makes the assumption that the stack starts
17079 at an address aligned to the value given by @var{stack-size}.
17080 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
17083 @node Score Options
17084 @subsection Score Options
17085 @cindex Score Options
17087 These options are defined for Score implementations:
17092 Compile code for big endian mode. This is the default.
17096 Compile code for little endian mode.
17100 Disable generate bcnz instruction.
17104 Enable generate unaligned load and store instruction.
17108 Enable the use of multiply-accumulate instructions. Disabled by default.
17112 Specify the SCORE5 as the target architecture.
17116 Specify the SCORE5U of the target architecture.
17120 Specify the SCORE7 as the target architecture. This is the default.
17124 Specify the SCORE7D as the target architecture.
17128 @subsection SH Options
17130 These @samp{-m} options are defined for the SH implementations:
17135 Generate code for the SH1.
17139 Generate code for the SH2.
17142 Generate code for the SH2e.
17146 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
17147 that the floating-point unit is not used.
17149 @item -m2a-single-only
17150 @opindex m2a-single-only
17151 Generate code for the SH2a-FPU, in such a way that no double-precision
17152 floating point operations are used.
17155 @opindex m2a-single
17156 Generate code for the SH2a-FPU assuming the floating-point unit is in
17157 single-precision mode by default.
17161 Generate code for the SH2a-FPU assuming the floating-point unit is in
17162 double-precision mode by default.
17166 Generate code for the SH3.
17170 Generate code for the SH3e.
17174 Generate code for the SH4 without a floating-point unit.
17176 @item -m4-single-only
17177 @opindex m4-single-only
17178 Generate code for the SH4 with a floating-point unit that only
17179 supports single-precision arithmetic.
17183 Generate code for the SH4 assuming the floating-point unit is in
17184 single-precision mode by default.
17188 Generate code for the SH4.
17192 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
17193 floating-point unit is not used.
17195 @item -m4a-single-only
17196 @opindex m4a-single-only
17197 Generate code for the SH4a, in such a way that no double-precision
17198 floating point operations are used.
17201 @opindex m4a-single
17202 Generate code for the SH4a assuming the floating-point unit is in
17203 single-precision mode by default.
17207 Generate code for the SH4a.
17211 Same as @option{-m4a-nofpu}, except that it implicitly passes
17212 @option{-dsp} to the assembler. GCC doesn't generate any DSP
17213 instructions at the moment.
17217 Compile code for the processor in big endian mode.
17221 Compile code for the processor in little endian mode.
17225 Align doubles at 64-bit boundaries. Note that this changes the calling
17226 conventions, and thus some functions from the standard C library will
17227 not work unless you recompile it first with @option{-mdalign}.
17231 Shorten some address references at link time, when possible; uses the
17232 linker option @option{-relax}.
17236 Use 32-bit offsets in @code{switch} tables. The default is to use
17241 Enable the use of bit manipulation instructions on SH2A.
17245 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
17246 alignment constraints.
17250 Comply with the calling conventions defined by Renesas.
17254 Comply with the calling conventions defined by Renesas.
17258 Comply with the calling conventions defined for GCC before the Renesas
17259 conventions were available. This option is the default for all
17260 targets of the SH toolchain.
17263 @opindex mnomacsave
17264 Mark the @code{MAC} register as call-clobbered, even if
17265 @option{-mhitachi} is given.
17269 Increase IEEE-compliance of floating-point code.
17270 At the moment, this is equivalent to @option{-fno-finite-math-only}.
17271 When generating 16 bit SH opcodes, getting IEEE-conforming results for
17272 comparisons of NANs / infinities incurs extra overhead in every
17273 floating point comparison, therefore the default is set to
17274 @option{-ffinite-math-only}.
17276 @item -minline-ic_invalidate
17277 @opindex minline-ic_invalidate
17278 Inline code to invalidate instruction cache entries after setting up
17279 nested function trampolines.
17280 This option has no effect if -musermode is in effect and the selected
17281 code generation option (e.g. -m4) does not allow the use of the icbi
17283 If the selected code generation option does not allow the use of the icbi
17284 instruction, and -musermode is not in effect, the inlined code will
17285 manipulate the instruction cache address array directly with an associative
17286 write. This not only requires privileged mode, but it will also
17287 fail if the cache line had been mapped via the TLB and has become unmapped.
17291 Dump instruction size and location in the assembly code.
17294 @opindex mpadstruct
17295 This option is deprecated. It pads structures to multiple of 4 bytes,
17296 which is incompatible with the SH ABI@.
17300 Optimize for space instead of speed. Implied by @option{-Os}.
17303 @opindex mprefergot
17304 When generating position-independent code, emit function calls using
17305 the Global Offset Table instead of the Procedure Linkage Table.
17309 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
17310 if the inlined code would not work in user mode.
17311 This is the default when the target is @code{sh-*-linux*}.
17313 @item -multcost=@var{number}
17314 @opindex multcost=@var{number}
17315 Set the cost to assume for a multiply insn.
17317 @item -mdiv=@var{strategy}
17318 @opindex mdiv=@var{strategy}
17319 Set the division strategy to use for SHmedia code. @var{strategy} must be
17320 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
17321 inv:call2, inv:fp .
17322 "fp" performs the operation in floating point. This has a very high latency,
17323 but needs only a few instructions, so it might be a good choice if
17324 your code has enough easily exploitable ILP to allow the compiler to
17325 schedule the floating point instructions together with other instructions.
17326 Division by zero causes a floating point exception.
17327 "inv" uses integer operations to calculate the inverse of the divisor,
17328 and then multiplies the dividend with the inverse. This strategy allows
17329 cse and hoisting of the inverse calculation. Division by zero calculates
17330 an unspecified result, but does not trap.
17331 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
17332 have been found, or if the entire operation has been hoisted to the same
17333 place, the last stages of the inverse calculation are intertwined with the
17334 final multiply to reduce the overall latency, at the expense of using a few
17335 more instructions, and thus offering fewer scheduling opportunities with
17337 "call" calls a library function that usually implements the inv:minlat
17339 This gives high code density for m5-*media-nofpu compilations.
17340 "call2" uses a different entry point of the same library function, where it
17341 assumes that a pointer to a lookup table has already been set up, which
17342 exposes the pointer load to cse / code hoisting optimizations.
17343 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
17344 code generation, but if the code stays unoptimized, revert to the "call",
17345 "call2", or "fp" strategies, respectively. Note that the
17346 potentially-trapping side effect of division by zero is carried by a
17347 separate instruction, so it is possible that all the integer instructions
17348 are hoisted out, but the marker for the side effect stays where it is.
17349 A recombination to fp operations or a call is not possible in that case.
17350 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
17351 that the inverse calculation was nor separated from the multiply, they speed
17352 up division where the dividend fits into 20 bits (plus sign where applicable),
17353 by inserting a test to skip a number of operations in this case; this test
17354 slows down the case of larger dividends. inv20u assumes the case of a such
17355 a small dividend to be unlikely, and inv20l assumes it to be likely.
17357 @item -maccumulate-outgoing-args
17358 @opindex maccumulate-outgoing-args
17359 Reserve space once for outgoing arguments in the function prologue rather
17360 than around each call. Generally beneficial for performance and size. Also
17361 needed for unwinding to avoid changing the stack frame around conditional code.
17363 @item -mdivsi3_libfunc=@var{name}
17364 @opindex mdivsi3_libfunc=@var{name}
17365 Set the name of the library function used for 32 bit signed division to
17366 @var{name}. This only affect the name used in the call and inv:call
17367 division strategies, and the compiler will still expect the same
17368 sets of input/output/clobbered registers as if this option was not present.
17370 @item -mfixed-range=@var{register-range}
17371 @opindex mfixed-range
17372 Generate code treating the given register range as fixed registers.
17373 A fixed register is one that the register allocator can not use. This is
17374 useful when compiling kernel code. A register range is specified as
17375 two registers separated by a dash. Multiple register ranges can be
17376 specified separated by a comma.
17378 @item -madjust-unroll
17379 @opindex madjust-unroll
17380 Throttle unrolling to avoid thrashing target registers.
17381 This option only has an effect if the gcc code base supports the
17382 TARGET_ADJUST_UNROLL_MAX target hook.
17384 @item -mindexed-addressing
17385 @opindex mindexed-addressing
17386 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
17387 This is only safe if the hardware and/or OS implement 32 bit wrap-around
17388 semantics for the indexed addressing mode. The architecture allows the
17389 implementation of processors with 64 bit MMU, which the OS could use to
17390 get 32 bit addressing, but since no current hardware implementation supports
17391 this or any other way to make the indexed addressing mode safe to use in
17392 the 32 bit ABI, the default is -mno-indexed-addressing.
17394 @item -mgettrcost=@var{number}
17395 @opindex mgettrcost=@var{number}
17396 Set the cost assumed for the gettr instruction to @var{number}.
17397 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
17401 Assume pt* instructions won't trap. This will generally generate better
17402 scheduled code, but is unsafe on current hardware. The current architecture
17403 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
17404 This has the unintentional effect of making it unsafe to schedule ptabs /
17405 ptrel before a branch, or hoist it out of a loop. For example,
17406 __do_global_ctors, a part of libgcc that runs constructors at program
17407 startup, calls functions in a list which is delimited by @minus{}1. With the
17408 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
17409 That means that all the constructors will be run a bit quicker, but when
17410 the loop comes to the end of the list, the program crashes because ptabs
17411 loads @minus{}1 into a target register. Since this option is unsafe for any
17412 hardware implementing the current architecture specification, the default
17413 is -mno-pt-fixed. Unless the user specifies a specific cost with
17414 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
17415 this deters register allocation using target registers for storing
17418 @item -minvalid-symbols
17419 @opindex minvalid-symbols
17420 Assume symbols might be invalid. Ordinary function symbols generated by
17421 the compiler will always be valid to load with movi/shori/ptabs or
17422 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
17423 to generate symbols that will cause ptabs / ptrel to trap.
17424 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
17425 It will then prevent cross-basic-block cse, hoisting and most scheduling
17426 of symbol loads. The default is @option{-mno-invalid-symbols}.
17429 @node Solaris 2 Options
17430 @subsection Solaris 2 Options
17431 @cindex Solaris 2 options
17433 These @samp{-m} options are supported on Solaris 2:
17436 @item -mimpure-text
17437 @opindex mimpure-text
17438 @option{-mimpure-text}, used in addition to @option{-shared}, tells
17439 the compiler to not pass @option{-z text} to the linker when linking a
17440 shared object. Using this option, you can link position-dependent
17441 code into a shared object.
17443 @option{-mimpure-text} suppresses the ``relocations remain against
17444 allocatable but non-writable sections'' linker error message.
17445 However, the necessary relocations will trigger copy-on-write, and the
17446 shared object is not actually shared across processes. Instead of
17447 using @option{-mimpure-text}, you should compile all source code with
17448 @option{-fpic} or @option{-fPIC}.
17452 These switches are supported in addition to the above on Solaris 2:
17457 Add support for multithreading using the POSIX threads library. This
17458 option sets flags for both the preprocessor and linker. This option does
17459 not affect the thread safety of object code produced by the compiler or
17460 that of libraries supplied with it.
17464 This is a synonym for @option{-pthreads}.
17467 @node SPARC Options
17468 @subsection SPARC Options
17469 @cindex SPARC options
17471 These @samp{-m} options are supported on the SPARC:
17474 @item -mno-app-regs
17476 @opindex mno-app-regs
17478 Specify @option{-mapp-regs} to generate output using the global registers
17479 2 through 4, which the SPARC SVR4 ABI reserves for applications. This
17482 To be fully SVR4 ABI compliant at the cost of some performance loss,
17483 specify @option{-mno-app-regs}. You should compile libraries and system
17484 software with this option.
17490 With @option{-mflat}, the compiler does not generate save/restore instructions
17491 and uses a ``flat'' or single register window model. This model is compatible
17492 with the regular register window model. The local registers and the input
17493 registers (0--5) are still treated as ``call-saved'' registers and will be
17494 saved on the stack as needed.
17496 With @option{-mno-flat} (the default), the compiler generates save/restore
17497 instructions (except for leaf functions). This is the normal operating mode.
17500 @itemx -mhard-float
17502 @opindex mhard-float
17503 Generate output containing floating point instructions. This is the
17507 @itemx -msoft-float
17509 @opindex msoft-float
17510 Generate output containing library calls for floating point.
17511 @strong{Warning:} the requisite libraries are not available for all SPARC
17512 targets. Normally the facilities of the machine's usual C compiler are
17513 used, but this cannot be done directly in cross-compilation. You must make
17514 your own arrangements to provide suitable library functions for
17515 cross-compilation. The embedded targets @samp{sparc-*-aout} and
17516 @samp{sparclite-*-*} do provide software floating point support.
17518 @option{-msoft-float} changes the calling convention in the output file;
17519 therefore, it is only useful if you compile @emph{all} of a program with
17520 this option. In particular, you need to compile @file{libgcc.a}, the
17521 library that comes with GCC, with @option{-msoft-float} in order for
17524 @item -mhard-quad-float
17525 @opindex mhard-quad-float
17526 Generate output containing quad-word (long double) floating point
17529 @item -msoft-quad-float
17530 @opindex msoft-quad-float
17531 Generate output containing library calls for quad-word (long double)
17532 floating point instructions. The functions called are those specified
17533 in the SPARC ABI@. This is the default.
17535 As of this writing, there are no SPARC implementations that have hardware
17536 support for the quad-word floating point instructions. They all invoke
17537 a trap handler for one of these instructions, and then the trap handler
17538 emulates the effect of the instruction. Because of the trap handler overhead,
17539 this is much slower than calling the ABI library routines. Thus the
17540 @option{-msoft-quad-float} option is the default.
17542 @item -mno-unaligned-doubles
17543 @itemx -munaligned-doubles
17544 @opindex mno-unaligned-doubles
17545 @opindex munaligned-doubles
17546 Assume that doubles have 8 byte alignment. This is the default.
17548 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
17549 alignment only if they are contained in another type, or if they have an
17550 absolute address. Otherwise, it assumes they have 4 byte alignment.
17551 Specifying this option avoids some rare compatibility problems with code
17552 generated by other compilers. It is not the default because it results
17553 in a performance loss, especially for floating point code.
17555 @item -mno-faster-structs
17556 @itemx -mfaster-structs
17557 @opindex mno-faster-structs
17558 @opindex mfaster-structs
17559 With @option{-mfaster-structs}, the compiler assumes that structures
17560 should have 8 byte alignment. This enables the use of pairs of
17561 @code{ldd} and @code{std} instructions for copies in structure
17562 assignment, in place of twice as many @code{ld} and @code{st} pairs.
17563 However, the use of this changed alignment directly violates the SPARC
17564 ABI@. Thus, it's intended only for use on targets where the developer
17565 acknowledges that their resulting code will not be directly in line with
17566 the rules of the ABI@.
17568 @item -mcpu=@var{cpu_type}
17570 Set the instruction set, register set, and instruction scheduling parameters
17571 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
17572 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
17573 @samp{leon}, @samp{sparclite}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
17574 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
17575 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
17576 and @samp{niagara4}.
17578 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
17579 which selects the best architecture option for the host processor.
17580 @option{-mcpu=native} has no effect if GCC does not recognize
17583 Default instruction scheduling parameters are used for values that select
17584 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
17585 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
17587 Here is a list of each supported architecture and their supported
17592 v8: supersparc, hypersparc, leon
17593 sparclite: f930, f934, sparclite86x
17595 v9: ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
17598 By default (unless configured otherwise), GCC generates code for the V7
17599 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
17600 additionally optimizes it for the Cypress CY7C602 chip, as used in the
17601 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
17602 SPARCStation 1, 2, IPX etc.
17604 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
17605 architecture. The only difference from V7 code is that the compiler emits
17606 the integer multiply and integer divide instructions which exist in SPARC-V8
17607 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
17608 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
17611 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
17612 the SPARC architecture. This adds the integer multiply, integer divide step
17613 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
17614 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
17615 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
17616 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
17617 MB86934 chip, which is the more recent SPARClite with FPU@.
17619 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
17620 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
17621 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
17622 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
17623 optimizes it for the TEMIC SPARClet chip.
17625 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
17626 architecture. This adds 64-bit integer and floating-point move instructions,
17627 3 additional floating-point condition code registers and conditional move
17628 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
17629 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
17630 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
17631 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
17632 @option{-mcpu=niagara}, the compiler additionally optimizes it for
17633 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
17634 additionally optimizes it for Sun UltraSPARC T2 chips. With
17635 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
17636 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
17637 additionally optimizes it for Sun UltraSPARC T4 chips.
17639 @item -mtune=@var{cpu_type}
17641 Set the instruction scheduling parameters for machine type
17642 @var{cpu_type}, but do not set the instruction set or register set that the
17643 option @option{-mcpu=@var{cpu_type}} would.
17645 The same values for @option{-mcpu=@var{cpu_type}} can be used for
17646 @option{-mtune=@var{cpu_type}}, but the only useful values are those
17647 that select a particular CPU implementation. Those are @samp{cypress},
17648 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{f930}, @samp{f934},
17649 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, @samp{ultrasparc3},
17650 @samp{niagara}, @samp{niagara2}, @samp{niagara3} and @samp{niagara4}. With
17651 native Solaris and GNU/Linux toolchains, @samp{native} can also be used.
17656 @opindex mno-v8plus
17657 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
17658 difference from the V8 ABI is that the global and out registers are
17659 considered 64-bit wide. This is enabled by default on Solaris in 32-bit
17660 mode for all SPARC-V9 processors.
17666 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
17667 Visual Instruction Set extensions. The default is @option{-mno-vis}.
17673 With @option{-mvis2}, GCC generates code that takes advantage of
17674 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
17675 default is @option{-mvis2} when targetting a cpu that supports such
17676 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
17677 also sets @option{-mvis}.
17683 With @option{-mvis3}, GCC generates code that takes advantage of
17684 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
17685 default is @option{-mvis3} when targetting a cpu that supports such
17686 instructions, such as niagara-3 and later. Setting @option{-mvis3}
17687 also sets @option{-mvis2} and @option{-mvis}.
17693 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
17694 population count instruction. The default is @option{-mpopc}
17695 when targetting a cpu that supports such instructions, such as Niagara-2 and
17702 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
17703 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
17704 when targetting a cpu that supports such instructions, such as Niagara-3 and
17708 @opindex mfix-at697f
17709 Enable the documented workaround for the single erratum of the Atmel AT697F
17710 processor (which corresponds to erratum #13 of the AT697E processor).
17713 These @samp{-m} options are supported in addition to the above
17714 on SPARC-V9 processors in 64-bit environments:
17717 @item -mlittle-endian
17718 @opindex mlittle-endian
17719 Generate code for a processor running in little-endian mode. It is only
17720 available for a few configurations and most notably not on Solaris and Linux.
17726 Generate code for a 32-bit or 64-bit environment.
17727 The 32-bit environment sets int, long and pointer to 32 bits.
17728 The 64-bit environment sets int to 32 bits and long and pointer
17731 @item -mcmodel=medlow
17732 @opindex mcmodel=medlow
17733 Generate code for the Medium/Low code model: 64-bit addresses, programs
17734 must be linked in the low 32 bits of memory. Programs can be statically
17735 or dynamically linked.
17737 @item -mcmodel=medmid
17738 @opindex mcmodel=medmid
17739 Generate code for the Medium/Middle code model: 64-bit addresses, programs
17740 must be linked in the low 44 bits of memory, the text and data segments must
17741 be less than 2GB in size and the data segment must be located within 2GB of
17744 @item -mcmodel=medany
17745 @opindex mcmodel=medany
17746 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
17747 may be linked anywhere in memory, the text and data segments must be less
17748 than 2GB in size and the data segment must be located within 2GB of the
17751 @item -mcmodel=embmedany
17752 @opindex mcmodel=embmedany
17753 Generate code for the Medium/Anywhere code model for embedded systems:
17754 64-bit addresses, the text and data segments must be less than 2GB in
17755 size, both starting anywhere in memory (determined at link time). The
17756 global register %g4 points to the base of the data segment. Programs
17757 are statically linked and PIC is not supported.
17760 @itemx -mno-stack-bias
17761 @opindex mstack-bias
17762 @opindex mno-stack-bias
17763 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
17764 frame pointer if present, are offset by @minus{}2047 which must be added back
17765 when making stack frame references. This is the default in 64-bit mode.
17766 Otherwise, assume no such offset is present.
17770 @subsection SPU Options
17771 @cindex SPU options
17773 These @samp{-m} options are supported on the SPU:
17777 @itemx -merror-reloc
17778 @opindex mwarn-reloc
17779 @opindex merror-reloc
17781 The loader for SPU does not handle dynamic relocations. By default, GCC
17782 will give an error when it generates code that requires a dynamic
17783 relocation. @option{-mno-error-reloc} disables the error,
17784 @option{-mwarn-reloc} will generate a warning instead.
17787 @itemx -munsafe-dma
17789 @opindex munsafe-dma
17791 Instructions which initiate or test completion of DMA must not be
17792 reordered with respect to loads and stores of the memory which is being
17793 accessed. Users typically address this problem using the volatile
17794 keyword, but that can lead to inefficient code in places where the
17795 memory is known to not change. Rather than mark the memory as volatile
17796 we treat the DMA instructions as potentially effecting all memory. With
17797 @option{-munsafe-dma} users must use the volatile keyword to protect
17800 @item -mbranch-hints
17801 @opindex mbranch-hints
17803 By default, GCC will generate a branch hint instruction to avoid
17804 pipeline stalls for always taken or probably taken branches. A hint
17805 will not be generated closer than 8 instructions away from its branch.
17806 There is little reason to disable them, except for debugging purposes,
17807 or to make an object a little bit smaller.
17811 @opindex msmall-mem
17812 @opindex mlarge-mem
17814 By default, GCC generates code assuming that addresses are never larger
17815 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
17816 a full 32 bit address.
17821 By default, GCC links against startup code that assumes the SPU-style
17822 main function interface (which has an unconventional parameter list).
17823 With @option{-mstdmain}, GCC will link your program against startup
17824 code that assumes a C99-style interface to @code{main}, including a
17825 local copy of @code{argv} strings.
17827 @item -mfixed-range=@var{register-range}
17828 @opindex mfixed-range
17829 Generate code treating the given register range as fixed registers.
17830 A fixed register is one that the register allocator can not use. This is
17831 useful when compiling kernel code. A register range is specified as
17832 two registers separated by a dash. Multiple register ranges can be
17833 specified separated by a comma.
17839 Compile code assuming that pointers to the PPU address space accessed
17840 via the @code{__ea} named address space qualifier are either 32 or 64
17841 bits wide. The default is 32 bits. As this is an ABI changing option,
17842 all object code in an executable must be compiled with the same setting.
17844 @item -maddress-space-conversion
17845 @itemx -mno-address-space-conversion
17846 @opindex maddress-space-conversion
17847 @opindex mno-address-space-conversion
17848 Allow/disallow treating the @code{__ea} address space as superset
17849 of the generic address space. This enables explicit type casts
17850 between @code{__ea} and generic pointer as well as implicit
17851 conversions of generic pointers to @code{__ea} pointers. The
17852 default is to allow address space pointer conversions.
17854 @item -mcache-size=@var{cache-size}
17855 @opindex mcache-size
17856 This option controls the version of libgcc that the compiler links to an
17857 executable and selects a software-managed cache for accessing variables
17858 in the @code{__ea} address space with a particular cache size. Possible
17859 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
17860 and @samp{128}. The default cache size is 64KB.
17862 @item -matomic-updates
17863 @itemx -mno-atomic-updates
17864 @opindex matomic-updates
17865 @opindex mno-atomic-updates
17866 This option controls the version of libgcc that the compiler links to an
17867 executable and selects whether atomic updates to the software-managed
17868 cache of PPU-side variables are used. If you use atomic updates, changes
17869 to a PPU variable from SPU code using the @code{__ea} named address space
17870 qualifier will not interfere with changes to other PPU variables residing
17871 in the same cache line from PPU code. If you do not use atomic updates,
17872 such interference may occur; however, writing back cache lines will be
17873 more efficient. The default behavior is to use atomic updates.
17876 @itemx -mdual-nops=@var{n}
17877 @opindex mdual-nops
17878 By default, GCC will insert nops to increase dual issue when it expects
17879 it to increase performance. @var{n} can be a value from 0 to 10. A
17880 smaller @var{n} will insert fewer nops. 10 is the default, 0 is the
17881 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
17883 @item -mhint-max-nops=@var{n}
17884 @opindex mhint-max-nops
17885 Maximum number of nops to insert for a branch hint. A branch hint must
17886 be at least 8 instructions away from the branch it is effecting. GCC
17887 will insert up to @var{n} nops to enforce this, otherwise it will not
17888 generate the branch hint.
17890 @item -mhint-max-distance=@var{n}
17891 @opindex mhint-max-distance
17892 The encoding of the branch hint instruction limits the hint to be within
17893 256 instructions of the branch it is effecting. By default, GCC makes
17894 sure it is within 125.
17897 @opindex msafe-hints
17898 Work around a hardware bug which causes the SPU to stall indefinitely.
17899 By default, GCC will insert the @code{hbrp} instruction to make sure
17900 this stall won't happen.
17904 @node System V Options
17905 @subsection Options for System V
17907 These additional options are available on System V Release 4 for
17908 compatibility with other compilers on those systems:
17913 Create a shared object.
17914 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
17918 Identify the versions of each tool used by the compiler, in a
17919 @code{.ident} assembler directive in the output.
17923 Refrain from adding @code{.ident} directives to the output file (this is
17926 @item -YP,@var{dirs}
17928 Search the directories @var{dirs}, and no others, for libraries
17929 specified with @option{-l}.
17931 @item -Ym,@var{dir}
17933 Look in the directory @var{dir} to find the M4 preprocessor.
17934 The assembler uses this option.
17935 @c This is supposed to go with a -Yd for predefined M4 macro files, but
17936 @c the generic assembler that comes with Solaris takes just -Ym.
17940 @subsection V850 Options
17941 @cindex V850 Options
17943 These @samp{-m} options are defined for V850 implementations:
17947 @itemx -mno-long-calls
17948 @opindex mlong-calls
17949 @opindex mno-long-calls
17950 Treat all calls as being far away (near). If calls are assumed to be
17951 far away, the compiler will always load the functions address up into a
17952 register, and call indirect through the pointer.
17958 Do not optimize (do optimize) basic blocks that use the same index
17959 pointer 4 or more times to copy pointer into the @code{ep} register, and
17960 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
17961 option is on by default if you optimize.
17963 @item -mno-prolog-function
17964 @itemx -mprolog-function
17965 @opindex mno-prolog-function
17966 @opindex mprolog-function
17967 Do not use (do use) external functions to save and restore registers
17968 at the prologue and epilogue of a function. The external functions
17969 are slower, but use less code space if more than one function saves
17970 the same number of registers. The @option{-mprolog-function} option
17971 is on by default if you optimize.
17975 Try to make the code as small as possible. At present, this just turns
17976 on the @option{-mep} and @option{-mprolog-function} options.
17978 @item -mtda=@var{n}
17980 Put static or global variables whose size is @var{n} bytes or less into
17981 the tiny data area that register @code{ep} points to. The tiny data
17982 area can hold up to 256 bytes in total (128 bytes for byte references).
17984 @item -msda=@var{n}
17986 Put static or global variables whose size is @var{n} bytes or less into
17987 the small data area that register @code{gp} points to. The small data
17988 area can hold up to 64 kilobytes.
17990 @item -mzda=@var{n}
17992 Put static or global variables whose size is @var{n} bytes or less into
17993 the first 32 kilobytes of memory.
17997 Specify that the target processor is the V850.
18000 @opindex mbig-switch
18001 Generate code suitable for big switch tables. Use this option only if
18002 the assembler/linker complain about out of range branches within a switch
18007 This option will cause r2 and r5 to be used in the code generated by
18008 the compiler. This setting is the default.
18010 @item -mno-app-regs
18011 @opindex mno-app-regs
18012 This option will cause r2 and r5 to be treated as fixed registers.
18016 Specify that the target processor is the V850E2V3. The preprocessor
18017 constants @samp{__v850e2v3__} will be defined if
18018 this option is used.
18022 Specify that the target processor is the V850E2. The preprocessor
18023 constants @samp{__v850e2__} will be defined if this option is used.
18027 Specify that the target processor is the V850E1. The preprocessor
18028 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
18029 this option is used.
18033 Specify that the target processor is the V850ES. This is an alias for
18034 the @option{-mv850e1} option.
18038 Specify that the target processor is the V850E@. The preprocessor
18039 constant @samp{__v850e__} will be defined if this option is used.
18041 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
18042 nor @option{-mv850e2} nor @option{-mv850e2v3}
18043 are defined then a default target processor will be chosen and the
18044 relevant @samp{__v850*__} preprocessor constant will be defined.
18046 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
18047 defined, regardless of which processor variant is the target.
18049 @item -mdisable-callt
18050 @opindex mdisable-callt
18051 This option will suppress generation of the CALLT instruction for the
18052 v850e, v850e1, v850e2 and v850e2v3 flavors of the v850 architecture. The default is
18053 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
18058 @subsection VAX Options
18059 @cindex VAX options
18061 These @samp{-m} options are defined for the VAX:
18066 Do not output certain jump instructions (@code{aobleq} and so on)
18067 that the Unix assembler for the VAX cannot handle across long
18072 Do output those jump instructions, on the assumption that you
18073 will assemble with the GNU assembler.
18077 Output code for g-format floating point numbers instead of d-format.
18080 @node VxWorks Options
18081 @subsection VxWorks Options
18082 @cindex VxWorks Options
18084 The options in this section are defined for all VxWorks targets.
18085 Options specific to the target hardware are listed with the other
18086 options for that target.
18091 GCC can generate code for both VxWorks kernels and real time processes
18092 (RTPs). This option switches from the former to the latter. It also
18093 defines the preprocessor macro @code{__RTP__}.
18096 @opindex non-static
18097 Link an RTP executable against shared libraries rather than static
18098 libraries. The options @option{-static} and @option{-shared} can
18099 also be used for RTPs (@pxref{Link Options}); @option{-static}
18106 These options are passed down to the linker. They are defined for
18107 compatibility with Diab.
18110 @opindex Xbind-lazy
18111 Enable lazy binding of function calls. This option is equivalent to
18112 @option{-Wl,-z,now} and is defined for compatibility with Diab.
18116 Disable lazy binding of function calls. This option is the default and
18117 is defined for compatibility with Diab.
18120 @node x86-64 Options
18121 @subsection x86-64 Options
18122 @cindex x86-64 options
18124 These are listed under @xref{i386 and x86-64 Options}.
18126 @node Xstormy16 Options
18127 @subsection Xstormy16 Options
18128 @cindex Xstormy16 Options
18130 These options are defined for Xstormy16:
18135 Choose startup files and linker script suitable for the simulator.
18138 @node Xtensa Options
18139 @subsection Xtensa Options
18140 @cindex Xtensa Options
18142 These options are supported for Xtensa targets:
18146 @itemx -mno-const16
18148 @opindex mno-const16
18149 Enable or disable use of @code{CONST16} instructions for loading
18150 constant values. The @code{CONST16} instruction is currently not a
18151 standard option from Tensilica. When enabled, @code{CONST16}
18152 instructions are always used in place of the standard @code{L32R}
18153 instructions. The use of @code{CONST16} is enabled by default only if
18154 the @code{L32R} instruction is not available.
18157 @itemx -mno-fused-madd
18158 @opindex mfused-madd
18159 @opindex mno-fused-madd
18160 Enable or disable use of fused multiply/add and multiply/subtract
18161 instructions in the floating-point option. This has no effect if the
18162 floating-point option is not also enabled. Disabling fused multiply/add
18163 and multiply/subtract instructions forces the compiler to use separate
18164 instructions for the multiply and add/subtract operations. This may be
18165 desirable in some cases where strict IEEE 754-compliant results are
18166 required: the fused multiply add/subtract instructions do not round the
18167 intermediate result, thereby producing results with @emph{more} bits of
18168 precision than specified by the IEEE standard. Disabling fused multiply
18169 add/subtract instructions also ensures that the program output is not
18170 sensitive to the compiler's ability to combine multiply and add/subtract
18173 @item -mserialize-volatile
18174 @itemx -mno-serialize-volatile
18175 @opindex mserialize-volatile
18176 @opindex mno-serialize-volatile
18177 When this option is enabled, GCC inserts @code{MEMW} instructions before
18178 @code{volatile} memory references to guarantee sequential consistency.
18179 The default is @option{-mserialize-volatile}. Use
18180 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
18182 @item -mforce-no-pic
18183 @opindex mforce-no-pic
18184 For targets, like GNU/Linux, where all user-mode Xtensa code must be
18185 position-independent code (PIC), this option disables PIC for compiling
18188 @item -mtext-section-literals
18189 @itemx -mno-text-section-literals
18190 @opindex mtext-section-literals
18191 @opindex mno-text-section-literals
18192 Control the treatment of literal pools. The default is
18193 @option{-mno-text-section-literals}, which places literals in a separate
18194 section in the output file. This allows the literal pool to be placed
18195 in a data RAM/ROM, and it also allows the linker to combine literal
18196 pools from separate object files to remove redundant literals and
18197 improve code size. With @option{-mtext-section-literals}, the literals
18198 are interspersed in the text section in order to keep them as close as
18199 possible to their references. This may be necessary for large assembly
18202 @item -mtarget-align
18203 @itemx -mno-target-align
18204 @opindex mtarget-align
18205 @opindex mno-target-align
18206 When this option is enabled, GCC instructs the assembler to
18207 automatically align instructions to reduce branch penalties at the
18208 expense of some code density. The assembler attempts to widen density
18209 instructions to align branch targets and the instructions following call
18210 instructions. If there are not enough preceding safe density
18211 instructions to align a target, no widening will be performed. The
18212 default is @option{-mtarget-align}. These options do not affect the
18213 treatment of auto-aligned instructions like @code{LOOP}, which the
18214 assembler will always align, either by widening density instructions or
18215 by inserting no-op instructions.
18218 @itemx -mno-longcalls
18219 @opindex mlongcalls
18220 @opindex mno-longcalls
18221 When this option is enabled, GCC instructs the assembler to translate
18222 direct calls to indirect calls unless it can determine that the target
18223 of a direct call is in the range allowed by the call instruction. This
18224 translation typically occurs for calls to functions in other source
18225 files. Specifically, the assembler translates a direct @code{CALL}
18226 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
18227 The default is @option{-mno-longcalls}. This option should be used in
18228 programs where the call target can potentially be out of range. This
18229 option is implemented in the assembler, not the compiler, so the
18230 assembly code generated by GCC will still show direct call
18231 instructions---look at the disassembled object code to see the actual
18232 instructions. Note that the assembler will use an indirect call for
18233 every cross-file call, not just those that really will be out of range.
18236 @node zSeries Options
18237 @subsection zSeries Options
18238 @cindex zSeries options
18240 These are listed under @xref{S/390 and zSeries Options}.
18242 @node Code Gen Options
18243 @section Options for Code Generation Conventions
18244 @cindex code generation conventions
18245 @cindex options, code generation
18246 @cindex run-time options
18248 These machine-independent options control the interface conventions
18249 used in code generation.
18251 Most of them have both positive and negative forms; the negative form
18252 of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
18253 one of the forms is listed---the one which is not the default. You
18254 can figure out the other form by either removing @samp{no-} or adding
18258 @item -fbounds-check
18259 @opindex fbounds-check
18260 For front-ends that support it, generate additional code to check that
18261 indices used to access arrays are within the declared range. This is
18262 currently only supported by the Java and Fortran front-ends, where
18263 this option defaults to true and false respectively.
18267 This option generates traps for signed overflow on addition, subtraction,
18268 multiplication operations.
18272 This option instructs the compiler to assume that signed arithmetic
18273 overflow of addition, subtraction and multiplication wraps around
18274 using twos-complement representation. This flag enables some optimizations
18275 and disables others. This option is enabled by default for the Java
18276 front-end, as required by the Java language specification.
18279 @opindex fexceptions
18280 Enable exception handling. Generates extra code needed to propagate
18281 exceptions. For some targets, this implies GCC will generate frame
18282 unwind information for all functions, which can produce significant data
18283 size overhead, although it does not affect execution. If you do not
18284 specify this option, GCC will enable it by default for languages like
18285 C++ which normally require exception handling, and disable it for
18286 languages like C that do not normally require it. However, you may need
18287 to enable this option when compiling C code that needs to interoperate
18288 properly with exception handlers written in C++. You may also wish to
18289 disable this option if you are compiling older C++ programs that don't
18290 use exception handling.
18292 @item -fnon-call-exceptions
18293 @opindex fnon-call-exceptions
18294 Generate code that allows trapping instructions to throw exceptions.
18295 Note that this requires platform-specific runtime support that does
18296 not exist everywhere. Moreover, it only allows @emph{trapping}
18297 instructions to throw exceptions, i.e.@: memory references or floating
18298 point instructions. It does not allow exceptions to be thrown from
18299 arbitrary signal handlers such as @code{SIGALRM}.
18301 @item -funwind-tables
18302 @opindex funwind-tables
18303 Similar to @option{-fexceptions}, except that it will just generate any needed
18304 static data, but will not affect the generated code in any other way.
18305 You will normally not enable this option; instead, a language processor
18306 that needs this handling would enable it on your behalf.
18308 @item -fasynchronous-unwind-tables
18309 @opindex fasynchronous-unwind-tables
18310 Generate unwind table in dwarf2 format, if supported by target machine. The
18311 table is exact at each instruction boundary, so it can be used for stack
18312 unwinding from asynchronous events (such as debugger or garbage collector).
18314 @item -fpcc-struct-return
18315 @opindex fpcc-struct-return
18316 Return ``short'' @code{struct} and @code{union} values in memory like
18317 longer ones, rather than in registers. This convention is less
18318 efficient, but it has the advantage of allowing intercallability between
18319 GCC-compiled files and files compiled with other compilers, particularly
18320 the Portable C Compiler (pcc).
18322 The precise convention for returning structures in memory depends
18323 on the target configuration macros.
18325 Short structures and unions are those whose size and alignment match
18326 that of some integer type.
18328 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18329 switch is not binary compatible with code compiled with the
18330 @option{-freg-struct-return} switch.
18331 Use it to conform to a non-default application binary interface.
18333 @item -freg-struct-return
18334 @opindex freg-struct-return
18335 Return @code{struct} and @code{union} values in registers when possible.
18336 This is more efficient for small structures than
18337 @option{-fpcc-struct-return}.
18339 If you specify neither @option{-fpcc-struct-return} nor
18340 @option{-freg-struct-return}, GCC defaults to whichever convention is
18341 standard for the target. If there is no standard convention, GCC
18342 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18343 the principal compiler. In those cases, we can choose the standard, and
18344 we chose the more efficient register return alternative.
18346 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18347 switch is not binary compatible with code compiled with the
18348 @option{-fpcc-struct-return} switch.
18349 Use it to conform to a non-default application binary interface.
18351 @item -fshort-enums
18352 @opindex fshort-enums
18353 Allocate to an @code{enum} type only as many bytes as it needs for the
18354 declared range of possible values. Specifically, the @code{enum} type
18355 will be equivalent to the smallest integer type which has enough room.
18357 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18358 code that is not binary compatible with code generated without that switch.
18359 Use it to conform to a non-default application binary interface.
18361 @item -fshort-double
18362 @opindex fshort-double
18363 Use the same size for @code{double} as for @code{float}.
18365 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
18366 code that is not binary compatible with code generated without that switch.
18367 Use it to conform to a non-default application binary interface.
18369 @item -fshort-wchar
18370 @opindex fshort-wchar
18371 Override the underlying type for @samp{wchar_t} to be @samp{short
18372 unsigned int} instead of the default for the target. This option is
18373 useful for building programs to run under WINE@.
18375 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18376 code that is not binary compatible with code generated without that switch.
18377 Use it to conform to a non-default application binary interface.
18380 @opindex fno-common
18381 In C code, controls the placement of uninitialized global variables.
18382 Unix C compilers have traditionally permitted multiple definitions of
18383 such variables in different compilation units by placing the variables
18385 This is the behavior specified by @option{-fcommon}, and is the default
18386 for GCC on most targets.
18387 On the other hand, this behavior is not required by ISO C, and on some
18388 targets may carry a speed or code size penalty on variable references.
18389 The @option{-fno-common} option specifies that the compiler should place
18390 uninitialized global variables in the data section of the object file,
18391 rather than generating them as common blocks.
18392 This has the effect that if the same variable is declared
18393 (without @code{extern}) in two different compilations,
18394 you will get a multiple-definition error when you link them.
18395 In this case, you must compile with @option{-fcommon} instead.
18396 Compiling with @option{-fno-common} is useful on targets for which
18397 it provides better performance, or if you wish to verify that the
18398 program will work on other systems which always treat uninitialized
18399 variable declarations this way.
18403 Ignore the @samp{#ident} directive.
18405 @item -finhibit-size-directive
18406 @opindex finhibit-size-directive
18407 Don't output a @code{.size} assembler directive, or anything else that
18408 would cause trouble if the function is split in the middle, and the
18409 two halves are placed at locations far apart in memory. This option is
18410 used when compiling @file{crtstuff.c}; you should not need to use it
18413 @item -fverbose-asm
18414 @opindex fverbose-asm
18415 Put extra commentary information in the generated assembly code to
18416 make it more readable. This option is generally only of use to those
18417 who actually need to read the generated assembly code (perhaps while
18418 debugging the compiler itself).
18420 @option{-fno-verbose-asm}, the default, causes the
18421 extra information to be omitted and is useful when comparing two assembler
18424 @item -frecord-gcc-switches
18425 @opindex frecord-gcc-switches
18426 This switch causes the command line that was used to invoke the
18427 compiler to be recorded into the object file that is being created.
18428 This switch is only implemented on some targets and the exact format
18429 of the recording is target and binary file format dependent, but it
18430 usually takes the form of a section containing ASCII text. This
18431 switch is related to the @option{-fverbose-asm} switch, but that
18432 switch only records information in the assembler output file as
18433 comments, so it never reaches the object file.
18434 See also @option{-grecord-gcc-switches} for another
18435 way of storing compiler options into the object file.
18439 @cindex global offset table
18441 Generate position-independent code (PIC) suitable for use in a shared
18442 library, if supported for the target machine. Such code accesses all
18443 constant addresses through a global offset table (GOT)@. The dynamic
18444 loader resolves the GOT entries when the program starts (the dynamic
18445 loader is not part of GCC; it is part of the operating system). If
18446 the GOT size for the linked executable exceeds a machine-specific
18447 maximum size, you get an error message from the linker indicating that
18448 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18449 instead. (These maximums are 8k on the SPARC and 32k
18450 on the m68k and RS/6000. The 386 has no such limit.)
18452 Position-independent code requires special support, and therefore works
18453 only on certain machines. For the 386, GCC supports PIC for System V
18454 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
18455 position-independent.
18457 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18462 If supported for the target machine, emit position-independent code,
18463 suitable for dynamic linking and avoiding any limit on the size of the
18464 global offset table. This option makes a difference on the m68k,
18465 PowerPC and SPARC@.
18467 Position-independent code requires special support, and therefore works
18468 only on certain machines.
18470 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18477 These options are similar to @option{-fpic} and @option{-fPIC}, but
18478 generated position independent code can be only linked into executables.
18479 Usually these options are used when @option{-pie} GCC option will be
18480 used during linking.
18482 @option{-fpie} and @option{-fPIE} both define the macros
18483 @code{__pie__} and @code{__PIE__}. The macros have the value 1
18484 for @option{-fpie} and 2 for @option{-fPIE}.
18486 @item -fno-jump-tables
18487 @opindex fno-jump-tables
18488 Do not use jump tables for switch statements even where it would be
18489 more efficient than other code generation strategies. This option is
18490 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18491 building code which forms part of a dynamic linker and cannot
18492 reference the address of a jump table. On some targets, jump tables
18493 do not require a GOT and this option is not needed.
18495 @item -ffixed-@var{reg}
18497 Treat the register named @var{reg} as a fixed register; generated code
18498 should never refer to it (except perhaps as a stack pointer, frame
18499 pointer or in some other fixed role).
18501 @var{reg} must be the name of a register. The register names accepted
18502 are machine-specific and are defined in the @code{REGISTER_NAMES}
18503 macro in the machine description macro file.
18505 This flag does not have a negative form, because it specifies a
18508 @item -fcall-used-@var{reg}
18509 @opindex fcall-used
18510 Treat the register named @var{reg} as an allocable register that is
18511 clobbered by function calls. It may be allocated for temporaries or
18512 variables that do not live across a call. Functions compiled this way
18513 will not save and restore the register @var{reg}.
18515 It is an error to used this flag with the frame pointer or stack pointer.
18516 Use of this flag for other registers that have fixed pervasive roles in
18517 the machine's execution model will produce disastrous results.
18519 This flag does not have a negative form, because it specifies a
18522 @item -fcall-saved-@var{reg}
18523 @opindex fcall-saved
18524 Treat the register named @var{reg} as an allocable register saved by
18525 functions. It may be allocated even for temporaries or variables that
18526 live across a call. Functions compiled this way will save and restore
18527 the register @var{reg} if they use it.
18529 It is an error to used this flag with the frame pointer or stack pointer.
18530 Use of this flag for other registers that have fixed pervasive roles in
18531 the machine's execution model will produce disastrous results.
18533 A different sort of disaster will result from the use of this flag for
18534 a register in which function values may be returned.
18536 This flag does not have a negative form, because it specifies a
18539 @item -fpack-struct[=@var{n}]
18540 @opindex fpack-struct
18541 Without a value specified, pack all structure members together without
18542 holes. When a value is specified (which must be a small power of two), pack
18543 structure members according to this value, representing the maximum
18544 alignment (that is, objects with default alignment requirements larger than
18545 this will be output potentially unaligned at the next fitting location.
18547 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18548 code that is not binary compatible with code generated without that switch.
18549 Additionally, it makes the code suboptimal.
18550 Use it to conform to a non-default application binary interface.
18552 @item -finstrument-functions
18553 @opindex finstrument-functions
18554 Generate instrumentation calls for entry and exit to functions. Just
18555 after function entry and just before function exit, the following
18556 profiling functions will be called with the address of the current
18557 function and its call site. (On some platforms,
18558 @code{__builtin_return_address} does not work beyond the current
18559 function, so the call site information may not be available to the
18560 profiling functions otherwise.)
18563 void __cyg_profile_func_enter (void *this_fn,
18565 void __cyg_profile_func_exit (void *this_fn,
18569 The first argument is the address of the start of the current function,
18570 which may be looked up exactly in the symbol table.
18572 This instrumentation is also done for functions expanded inline in other
18573 functions. The profiling calls will indicate where, conceptually, the
18574 inline function is entered and exited. This means that addressable
18575 versions of such functions must be available. If all your uses of a
18576 function are expanded inline, this may mean an additional expansion of
18577 code size. If you use @samp{extern inline} in your C code, an
18578 addressable version of such functions must be provided. (This is
18579 normally the case anyways, but if you get lucky and the optimizer always
18580 expands the functions inline, you might have gotten away without
18581 providing static copies.)
18583 A function may be given the attribute @code{no_instrument_function}, in
18584 which case this instrumentation will not be done. This can be used, for
18585 example, for the profiling functions listed above, high-priority
18586 interrupt routines, and any functions from which the profiling functions
18587 cannot safely be called (perhaps signal handlers, if the profiling
18588 routines generate output or allocate memory).
18590 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
18591 @opindex finstrument-functions-exclude-file-list
18593 Set the list of functions that are excluded from instrumentation (see
18594 the description of @code{-finstrument-functions}). If the file that
18595 contains a function definition matches with one of @var{file}, then
18596 that function is not instrumented. The match is done on substrings:
18597 if the @var{file} parameter is a substring of the file name, it is
18598 considered to be a match.
18603 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
18607 will exclude any inline function defined in files whose pathnames
18608 contain @code{/bits/stl} or @code{include/sys}.
18610 If, for some reason, you want to include letter @code{','} in one of
18611 @var{sym}, write @code{'\,'}. For example,
18612 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
18613 (note the single quote surrounding the option).
18615 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
18616 @opindex finstrument-functions-exclude-function-list
18618 This is similar to @code{-finstrument-functions-exclude-file-list},
18619 but this option sets the list of function names to be excluded from
18620 instrumentation. The function name to be matched is its user-visible
18621 name, such as @code{vector<int> blah(const vector<int> &)}, not the
18622 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
18623 match is done on substrings: if the @var{sym} parameter is a substring
18624 of the function name, it is considered to be a match. For C99 and C++
18625 extended identifiers, the function name must be given in UTF-8, not
18626 using universal character names.
18628 @item -fstack-check
18629 @opindex fstack-check
18630 Generate code to verify that you do not go beyond the boundary of the
18631 stack. You should specify this flag if you are running in an
18632 environment with multiple threads, but only rarely need to specify it in
18633 a single-threaded environment since stack overflow is automatically
18634 detected on nearly all systems if there is only one stack.
18636 Note that this switch does not actually cause checking to be done; the
18637 operating system or the language runtime must do that. The switch causes
18638 generation of code to ensure that they see the stack being extended.
18640 You can additionally specify a string parameter: @code{no} means no
18641 checking, @code{generic} means force the use of old-style checking,
18642 @code{specific} means use the best checking method and is equivalent
18643 to bare @option{-fstack-check}.
18645 Old-style checking is a generic mechanism that requires no specific
18646 target support in the compiler but comes with the following drawbacks:
18650 Modified allocation strategy for large objects: they will always be
18651 allocated dynamically if their size exceeds a fixed threshold.
18654 Fixed limit on the size of the static frame of functions: when it is
18655 topped by a particular function, stack checking is not reliable and
18656 a warning is issued by the compiler.
18659 Inefficiency: because of both the modified allocation strategy and the
18660 generic implementation, the performances of the code are hampered.
18663 Note that old-style stack checking is also the fallback method for
18664 @code{specific} if no target support has been added in the compiler.
18666 @item -fstack-limit-register=@var{reg}
18667 @itemx -fstack-limit-symbol=@var{sym}
18668 @itemx -fno-stack-limit
18669 @opindex fstack-limit-register
18670 @opindex fstack-limit-symbol
18671 @opindex fno-stack-limit
18672 Generate code to ensure that the stack does not grow beyond a certain value,
18673 either the value of a register or the address of a symbol. If the stack
18674 would grow beyond the value, a signal is raised. For most targets,
18675 the signal is raised before the stack overruns the boundary, so
18676 it is possible to catch the signal without taking special precautions.
18678 For instance, if the stack starts at absolute address @samp{0x80000000}
18679 and grows downwards, you can use the flags
18680 @option{-fstack-limit-symbol=__stack_limit} and
18681 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
18682 of 128KB@. Note that this may only work with the GNU linker.
18684 @item -fsplit-stack
18685 @opindex fsplit-stack
18686 Generate code to automatically split the stack before it overflows.
18687 The resulting program has a discontiguous stack which can only
18688 overflow if the program is unable to allocate any more memory. This
18689 is most useful when running threaded programs, as it is no longer
18690 necessary to calculate a good stack size to use for each thread. This
18691 is currently only implemented for the i386 and x86_64 backends running
18694 When code compiled with @option{-fsplit-stack} calls code compiled
18695 without @option{-fsplit-stack}, there may not be much stack space
18696 available for the latter code to run. If compiling all code,
18697 including library code, with @option{-fsplit-stack} is not an option,
18698 then the linker can fix up these calls so that the code compiled
18699 without @option{-fsplit-stack} always has a large stack. Support for
18700 this is implemented in the gold linker in GNU binutils release 2.21
18703 @item -fleading-underscore
18704 @opindex fleading-underscore
18705 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18706 change the way C symbols are represented in the object file. One use
18707 is to help link with legacy assembly code.
18709 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18710 generate code that is not binary compatible with code generated without that
18711 switch. Use it to conform to a non-default application binary interface.
18712 Not all targets provide complete support for this switch.
18714 @item -ftls-model=@var{model}
18715 @opindex ftls-model
18716 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18717 The @var{model} argument should be one of @code{global-dynamic},
18718 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
18720 The default without @option{-fpic} is @code{initial-exec}; with
18721 @option{-fpic} the default is @code{global-dynamic}.
18723 @item -fvisibility=@var{default|internal|hidden|protected}
18724 @opindex fvisibility
18725 Set the default ELF image symbol visibility to the specified option---all
18726 symbols will be marked with this unless overridden within the code.
18727 Using this feature can very substantially improve linking and
18728 load times of shared object libraries, produce more optimized
18729 code, provide near-perfect API export and prevent symbol clashes.
18730 It is @strong{strongly} recommended that you use this in any shared objects
18733 Despite the nomenclature, @code{default} always means public; i.e.,
18734 available to be linked against from outside the shared object.
18735 @code{protected} and @code{internal} are pretty useless in real-world
18736 usage so the only other commonly used option will be @code{hidden}.
18737 The default if @option{-fvisibility} isn't specified is
18738 @code{default}, i.e., make every
18739 symbol public---this causes the same behavior as previous versions of
18742 A good explanation of the benefits offered by ensuring ELF
18743 symbols have the correct visibility is given by ``How To Write
18744 Shared Libraries'' by Ulrich Drepper (which can be found at
18745 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
18746 solution made possible by this option to marking things hidden when
18747 the default is public is to make the default hidden and mark things
18748 public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
18749 and @code{__attribute__ ((visibility("default")))} instead of
18750 @code{__declspec(dllexport)} you get almost identical semantics with
18751 identical syntax. This is a great boon to those working with
18752 cross-platform projects.
18754 For those adding visibility support to existing code, you may find
18755 @samp{#pragma GCC visibility} of use. This works by you enclosing
18756 the declarations you wish to set visibility for with (for example)
18757 @samp{#pragma GCC visibility push(hidden)} and
18758 @samp{#pragma GCC visibility pop}.
18759 Bear in mind that symbol visibility should be viewed @strong{as
18760 part of the API interface contract} and thus all new code should
18761 always specify visibility when it is not the default; i.e., declarations
18762 only for use within the local DSO should @strong{always} be marked explicitly
18763 as hidden as so to avoid PLT indirection overheads---making this
18764 abundantly clear also aids readability and self-documentation of the code.
18765 Note that due to ISO C++ specification requirements, operator new and
18766 operator delete must always be of default visibility.
18768 Be aware that headers from outside your project, in particular system
18769 headers and headers from any other library you use, may not be
18770 expecting to be compiled with visibility other than the default. You
18771 may need to explicitly say @samp{#pragma GCC visibility push(default)}
18772 before including any such headers.
18774 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
18775 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
18776 no modifications. However, this means that calls to @samp{extern}
18777 functions with no explicit visibility will use the PLT, so it is more
18778 effective to use @samp{__attribute ((visibility))} and/or
18779 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
18780 declarations should be treated as hidden.
18782 Note that @samp{-fvisibility} does affect C++ vague linkage
18783 entities. This means that, for instance, an exception class that will
18784 be thrown between DSOs must be explicitly marked with default
18785 visibility so that the @samp{type_info} nodes will be unified between
18788 An overview of these techniques, their benefits and how to use them
18789 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
18791 @item -fstrict-volatile-bitfields
18792 @opindex fstrict-volatile-bitfields
18793 This option should be used if accesses to volatile bitfields (or other
18794 structure fields, although the compiler usually honors those types
18795 anyway) should use a single access of the width of the
18796 field's type, aligned to a natural alignment if possible. For
18797 example, targets with memory-mapped peripheral registers might require
18798 all such accesses to be 16 bits wide; with this flag the user could
18799 declare all peripheral bitfields as ``unsigned short'' (assuming short
18800 is 16 bits on these targets) to force GCC to use 16 bit accesses
18801 instead of, perhaps, a more efficient 32 bit access.
18803 If this option is disabled, the compiler will use the most efficient
18804 instruction. In the previous example, that might be a 32-bit load
18805 instruction, even though that will access bytes that do not contain
18806 any portion of the bitfield, or memory-mapped registers unrelated to
18807 the one being updated.
18809 If the target requires strict alignment, and honoring the field
18810 type would require violating this alignment, a warning is issued.
18811 If the field has @code{packed} attribute, the access is done without
18812 honoring the field type. If the field doesn't have @code{packed}
18813 attribute, the access is done honoring the field type. In both cases,
18814 GCC assumes that the user knows something about the target hardware
18815 that it is unaware of.
18817 The default value of this option is determined by the application binary
18818 interface for the target processor.
18824 @node Environment Variables
18825 @section Environment Variables Affecting GCC
18826 @cindex environment variables
18828 @c man begin ENVIRONMENT
18829 This section describes several environment variables that affect how GCC
18830 operates. Some of them work by specifying directories or prefixes to use
18831 when searching for various kinds of files. Some are used to specify other
18832 aspects of the compilation environment.
18834 Note that you can also specify places to search using options such as
18835 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
18836 take precedence over places specified using environment variables, which
18837 in turn take precedence over those specified by the configuration of GCC@.
18838 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
18839 GNU Compiler Collection (GCC) Internals}.
18844 @c @itemx LC_COLLATE
18846 @c @itemx LC_MONETARY
18847 @c @itemx LC_NUMERIC
18852 @c @findex LC_COLLATE
18853 @findex LC_MESSAGES
18854 @c @findex LC_MONETARY
18855 @c @findex LC_NUMERIC
18859 These environment variables control the way that GCC uses
18860 localization information that allow GCC to work with different
18861 national conventions. GCC inspects the locale categories
18862 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
18863 so. These locale categories can be set to any value supported by your
18864 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
18865 Kingdom encoded in UTF-8.
18867 The @env{LC_CTYPE} environment variable specifies character
18868 classification. GCC uses it to determine the character boundaries in
18869 a string; this is needed for some multibyte encodings that contain quote
18870 and escape characters that would otherwise be interpreted as a string
18873 The @env{LC_MESSAGES} environment variable specifies the language to
18874 use in diagnostic messages.
18876 If the @env{LC_ALL} environment variable is set, it overrides the value
18877 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
18878 and @env{LC_MESSAGES} default to the value of the @env{LANG}
18879 environment variable. If none of these variables are set, GCC
18880 defaults to traditional C English behavior.
18884 If @env{TMPDIR} is set, it specifies the directory to use for temporary
18885 files. GCC uses temporary files to hold the output of one stage of
18886 compilation which is to be used as input to the next stage: for example,
18887 the output of the preprocessor, which is the input to the compiler
18890 @item GCC_COMPARE_DEBUG
18891 @findex GCC_COMPARE_DEBUG
18892 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
18893 @option{-fcompare-debug} to the compiler driver. See the documentation
18894 of this option for more details.
18896 @item GCC_EXEC_PREFIX
18897 @findex GCC_EXEC_PREFIX
18898 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
18899 names of the subprograms executed by the compiler. No slash is added
18900 when this prefix is combined with the name of a subprogram, but you can
18901 specify a prefix that ends with a slash if you wish.
18903 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
18904 an appropriate prefix to use based on the pathname it was invoked with.
18906 If GCC cannot find the subprogram using the specified prefix, it
18907 tries looking in the usual places for the subprogram.
18909 The default value of @env{GCC_EXEC_PREFIX} is
18910 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
18911 the installed compiler. In many cases @var{prefix} is the value
18912 of @code{prefix} when you ran the @file{configure} script.
18914 Other prefixes specified with @option{-B} take precedence over this prefix.
18916 This prefix is also used for finding files such as @file{crt0.o} that are
18919 In addition, the prefix is used in an unusual way in finding the
18920 directories to search for header files. For each of the standard
18921 directories whose name normally begins with @samp{/usr/local/lib/gcc}
18922 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
18923 replacing that beginning with the specified prefix to produce an
18924 alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
18925 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
18926 These alternate directories are searched first; the standard directories
18927 come next. If a standard directory begins with the configured
18928 @var{prefix} then the value of @var{prefix} is replaced by
18929 @env{GCC_EXEC_PREFIX} when looking for header files.
18931 @item COMPILER_PATH
18932 @findex COMPILER_PATH
18933 The value of @env{COMPILER_PATH} is a colon-separated list of
18934 directories, much like @env{PATH}. GCC tries the directories thus
18935 specified when searching for subprograms, if it can't find the
18936 subprograms using @env{GCC_EXEC_PREFIX}.
18939 @findex LIBRARY_PATH
18940 The value of @env{LIBRARY_PATH} is a colon-separated list of
18941 directories, much like @env{PATH}. When configured as a native compiler,
18942 GCC tries the directories thus specified when searching for special
18943 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
18944 using GCC also uses these directories when searching for ordinary
18945 libraries for the @option{-l} option (but directories specified with
18946 @option{-L} come first).
18950 @cindex locale definition
18951 This variable is used to pass locale information to the compiler. One way in
18952 which this information is used is to determine the character set to be used
18953 when character literals, string literals and comments are parsed in C and C++.
18954 When the compiler is configured to allow multibyte characters,
18955 the following values for @env{LANG} are recognized:
18959 Recognize JIS characters.
18961 Recognize SJIS characters.
18963 Recognize EUCJP characters.
18966 If @env{LANG} is not defined, or if it has some other value, then the
18967 compiler will use mblen and mbtowc as defined by the default locale to
18968 recognize and translate multibyte characters.
18972 Some additional environments variables affect the behavior of the
18975 @include cppenv.texi
18979 @node Precompiled Headers
18980 @section Using Precompiled Headers
18981 @cindex precompiled headers
18982 @cindex speed of compilation
18984 Often large projects have many header files that are included in every
18985 source file. The time the compiler takes to process these header files
18986 over and over again can account for nearly all of the time required to
18987 build the project. To make builds faster, GCC allows users to
18988 `precompile' a header file; then, if builds can use the precompiled
18989 header file they will be much faster.
18991 To create a precompiled header file, simply compile it as you would any
18992 other file, if necessary using the @option{-x} option to make the driver
18993 treat it as a C or C++ header file. You will probably want to use a
18994 tool like @command{make} to keep the precompiled header up-to-date when
18995 the headers it contains change.
18997 A precompiled header file will be searched for when @code{#include} is
18998 seen in the compilation. As it searches for the included file
18999 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
19000 compiler looks for a precompiled header in each directory just before it
19001 looks for the include file in that directory. The name searched for is
19002 the name specified in the @code{#include} with @samp{.gch} appended. If
19003 the precompiled header file can't be used, it is ignored.
19005 For instance, if you have @code{#include "all.h"}, and you have
19006 @file{all.h.gch} in the same directory as @file{all.h}, then the
19007 precompiled header file will be used if possible, and the original
19008 header will be used otherwise.
19010 Alternatively, you might decide to put the precompiled header file in a
19011 directory and use @option{-I} to ensure that directory is searched
19012 before (or instead of) the directory containing the original header.
19013 Then, if you want to check that the precompiled header file is always
19014 used, you can put a file of the same name as the original header in this
19015 directory containing an @code{#error} command.
19017 This also works with @option{-include}. So yet another way to use
19018 precompiled headers, good for projects not designed with precompiled
19019 header files in mind, is to simply take most of the header files used by
19020 a project, include them from another header file, precompile that header
19021 file, and @option{-include} the precompiled header. If the header files
19022 have guards against multiple inclusion, they will be skipped because
19023 they've already been included (in the precompiled header).
19025 If you need to precompile the same header file for different
19026 languages, targets, or compiler options, you can instead make a
19027 @emph{directory} named like @file{all.h.gch}, and put each precompiled
19028 header in the directory, perhaps using @option{-o}. It doesn't matter
19029 what you call the files in the directory, every precompiled header in
19030 the directory will be considered. The first precompiled header
19031 encountered in the directory that is valid for this compilation will
19032 be used; they're searched in no particular order.
19034 There are many other possibilities, limited only by your imagination,
19035 good sense, and the constraints of your build system.
19037 A precompiled header file can be used only when these conditions apply:
19041 Only one precompiled header can be used in a particular compilation.
19044 A precompiled header can't be used once the first C token is seen. You
19045 can have preprocessor directives before a precompiled header; you can
19046 even include a precompiled header from inside another header, so long as
19047 there are no C tokens before the @code{#include}.
19050 The precompiled header file must be produced for the same language as
19051 the current compilation. You can't use a C precompiled header for a C++
19055 The precompiled header file must have been produced by the same compiler
19056 binary as the current compilation is using.
19059 Any macros defined before the precompiled header is included must
19060 either be defined in the same way as when the precompiled header was
19061 generated, or must not affect the precompiled header, which usually
19062 means that they don't appear in the precompiled header at all.
19064 The @option{-D} option is one way to define a macro before a
19065 precompiled header is included; using a @code{#define} can also do it.
19066 There are also some options that define macros implicitly, like
19067 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
19070 @item If debugging information is output when using the precompiled
19071 header, using @option{-g} or similar, the same kind of debugging information
19072 must have been output when building the precompiled header. However,
19073 a precompiled header built using @option{-g} can be used in a compilation
19074 when no debugging information is being output.
19076 @item The same @option{-m} options must generally be used when building
19077 and using the precompiled header. @xref{Submodel Options},
19078 for any cases where this rule is relaxed.
19080 @item Each of the following options must be the same when building and using
19081 the precompiled header:
19083 @gccoptlist{-fexceptions}
19086 Some other command-line options starting with @option{-f},
19087 @option{-p}, or @option{-O} must be defined in the same way as when
19088 the precompiled header was generated. At present, it's not clear
19089 which options are safe to change and which are not; the safest choice
19090 is to use exactly the same options when generating and using the
19091 precompiled header. The following are known to be safe:
19093 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
19094 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
19095 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
19100 For all of these except the last, the compiler will automatically
19101 ignore the precompiled header if the conditions aren't met. If you
19102 find an option combination that doesn't work and doesn't cause the
19103 precompiled header to be ignored, please consider filing a bug report,
19106 If you do use differing options when generating and using the
19107 precompiled header, the actual behavior will be a mixture of the
19108 behavior for the options. For instance, if you use @option{-g} to
19109 generate the precompiled header but not when using it, you may or may
19110 not get debugging information for routines in the precompiled header.