1 @c Copyright (C) 1988-2013 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2013 Free Software Foundation, Inc.
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
21 (a) The FSF's Front-Cover Text is:
25 (b) The FSF's Back-Cover Text is:
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
31 @c Set file name and title for the man page.
33 @settitle GNU project C and C++ compiler
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
43 Only the most useful options are listed here; see below for the
44 remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
53 For instructions on reporting bugs, see
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
76 Other options are passed on to one stage of processing. Some options
77 control the preprocessor and others the compiler itself. Yet other
78 options control the assembler and linker; most of these are not
79 documented here, since you rarely need to use any of them.
81 @cindex C compilation options
82 Most of the command-line options that you can use with GCC are useful
83 for C programs; when an option is only useful with another language
84 (usually C++), the explanation says so explicitly. If the description
85 for a particular option does not mention a source language, you can use
86 that option with all supported languages.
88 @cindex C++ compilation options
89 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
90 options for compiling C++ programs.
92 @cindex grouping options
93 @cindex options, grouping
94 The @command{gcc} program accepts options and file names as operands. Many
95 options have multi-letter names; therefore multiple single-letter options
96 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
99 @cindex order of options
100 @cindex options, order
101 You can mix options and other arguments. For the most part, the order
102 you use doesn't matter. Order does matter when you use several
103 options of the same kind; for example, if you specify @option{-L} more
104 than once, the directories are searched in the order specified. Also,
105 the placement of the @option{-l} option is significant.
107 Many options have long names starting with @samp{-f} or with
108 @samp{-W}---for example,
109 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
110 these have both positive and negative forms; the negative form of
111 @option{-ffoo} is @option{-fno-foo}. This manual documents
112 only one of these two forms, whichever one is not the default.
116 @xref{Option Index}, for an index to GCC's options.
119 * Option Summary:: Brief list of all options, without explanations.
120 * Overall Options:: Controlling the kind of output:
121 an executable, object files, assembler files,
122 or preprocessed source.
123 * Invoking G++:: Compiling C++ programs.
124 * C Dialect Options:: Controlling the variant of C language compiled.
125 * C++ Dialect Options:: Variations on C++.
126 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
128 * Language Independent Options:: Controlling how diagnostics should be
130 * Warning Options:: How picky should the compiler be?
131 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
132 * Optimize Options:: How much optimization?
133 * Preprocessor Options:: Controlling header files and macro definitions.
134 Also, getting dependency information for Make.
135 * Assembler Options:: Passing options to the assembler.
136 * Link Options:: Specifying libraries and so on.
137 * Directory Options:: Where to find header files and libraries.
138 Where to find the compiler executable files.
139 * Spec Files:: How to pass switches to sub-processes.
140 * Target Options:: Running a cross-compiler, or an old version of GCC.
141 * Submodel Options:: Specifying minor hardware or convention variations,
142 such as 68010 vs 68020.
143 * Code Gen Options:: Specifying conventions for function calls, data layout
145 * Environment Variables:: Env vars that affect GCC.
146 * Precompiled Headers:: Compiling a header once, and using it many times.
152 @section Option Summary
154 Here is a summary of all the options, grouped by type. Explanations are
155 in the following sections.
158 @item Overall Options
159 @xref{Overall Options,,Options Controlling the Kind of Output}.
160 @gccoptlist{-c -S -E -o @var{file} -no-canonical-prefixes @gol
161 -pipe -pass-exit-codes @gol
162 -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
163 --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
164 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{arg} -fdump-go-spec=@var{file}}
166 @item C Language Options
167 @xref{C Dialect Options,,Options Controlling C Dialect}.
168 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
169 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
170 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
171 -fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
172 -trigraphs -traditional -traditional-cpp @gol
173 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
174 -fsigned-bitfields -fsigned-char @gol
175 -funsigned-bitfields -funsigned-char}
177 @item C++ Language Options
178 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
179 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
180 -fconstexpr-depth=@var{n} -ffriend-injection @gol
181 -fno-elide-constructors @gol
182 -fno-enforce-eh-specs @gol
183 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
184 -fno-implicit-templates @gol
185 -fno-implicit-inline-templates @gol
186 -fno-implement-inlines -fms-extensions @gol
187 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
188 -fno-optional-diags -fpermissive @gol
189 -fno-pretty-templates @gol
190 -frepo -fno-rtti -fstats -ftemplate-backtrace-limit=@var{n} @gol
191 -ftemplate-depth=@var{n} @gol
192 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
193 -fno-default-inline -fvisibility-inlines-hidden @gol
194 -fvisibility-ms-compat @gol
195 -fext-numeric-literals @gol
196 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
197 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol
198 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
199 -Weffc++ -Wstrict-null-sentinel @gol
200 -Wno-non-template-friend -Wold-style-cast @gol
201 -Woverloaded-virtual -Wno-pmf-conversions @gol
204 @item Objective-C and Objective-C++ Language Options
205 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
206 Objective-C and Objective-C++ Dialects}.
207 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
208 -fgnu-runtime -fnext-runtime @gol
209 -fno-nil-receivers @gol
210 -fobjc-abi-version=@var{n} @gol
211 -fobjc-call-cxx-cdtors @gol
212 -fobjc-direct-dispatch @gol
213 -fobjc-exceptions @gol
216 -fobjc-std=objc1 @gol
217 -freplace-objc-classes @gol
220 -Wassign-intercept @gol
221 -Wno-protocol -Wselector @gol
222 -Wstrict-selector-match @gol
223 -Wundeclared-selector}
225 @item Language Independent Options
226 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
227 @gccoptlist{-fmessage-length=@var{n} @gol
228 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
229 -fno-diagnostics-show-option -fno-diagnostics-show-caret}
231 @item Warning Options
232 @xref{Warning Options,,Options to Request or Suppress Warnings}.
233 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
234 -pedantic-errors @gol
235 -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
236 -Wno-attributes -Wno-builtin-macro-redefined @gol
237 -Wc++-compat -Wc++11-compat -Wcast-align -Wcast-qual @gol
238 -Wchar-subscripts -Wclobbered -Wcomment @gol
239 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
240 -Wno-deprecated-declarations -Wdisabled-optimization @gol
241 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
242 -Wno-endif-labels -Werror -Werror=* @gol
243 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
244 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
245 -Wformat-security -Wformat-y2k @gol
246 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
247 -Wignored-qualifiers @gol
248 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
249 -Winit-self -Winline -Wmaybe-uninitialized @gol
250 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
251 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
252 -Wlogical-op -Wlong-long @gol
253 -Wmain -Wmaybe-uninitialized -Wmissing-braces -Wmissing-field-initializers @gol
254 -Wmissing-include-dirs @gol
256 -Wno-multichar -Wnonnull -Wno-overflow @gol
257 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
258 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
259 -Wpointer-arith -Wno-pointer-to-int-cast @gol
260 -Wredundant-decls -Wno-return-local-addr @gol
261 -Wreturn-type -Wsequence-point -Wshadow @gol
262 -Wsign-compare -Wsign-conversion -Wsizeof-pointer-memaccess @gol
263 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
264 -Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
265 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
266 -Wmissing-format-attribute @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 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
275 -Wvla -Wvolatile-register-var -Wwrite-strings -Wzero-as-null-pointer-constant}
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 -fsanitize=@var{style} @gol
288 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
289 -fdisable-ipa-@var{pass_name} @gol
290 -fdisable-rtl-@var{pass_name} @gol
291 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
292 -fdisable-tree-@var{pass_name} @gol
293 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
294 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
295 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
296 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
297 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
299 -fdump-statistics @gol
301 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
302 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
303 -fdump-tree-cfg -fdump-tree-alias @gol
305 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
306 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
307 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
308 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
309 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
310 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
311 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
312 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
313 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
314 -fdump-tree-nrv -fdump-tree-vect @gol
315 -fdump-tree-sink @gol
316 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
317 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
318 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
319 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
320 -ftree-vectorizer-verbose=@var{n} @gol
321 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
322 -fdump-final-insns=@var{file} @gol
323 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
324 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
325 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
326 -fenable-@var{kind}-@var{pass} @gol
327 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
328 -fdebug-types-section -fmem-report-wpa @gol
329 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
331 -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
332 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
333 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
334 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
335 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
336 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
337 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
338 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
339 -gvms -gxcoff -gxcoff+ @gol
340 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
341 -fdebug-prefix-map=@var{old}=@var{new} @gol
342 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
343 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
344 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
345 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
346 -print-prog-name=@var{program} -print-search-dirs -Q @gol
347 -print-sysroot -print-sysroot-headers-suffix @gol
348 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
350 @item Optimization Options
351 @xref{Optimize Options,,Options that Control Optimization}.
352 @gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
353 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
354 -fassociative-math -fauto-inc-dec -fbranch-probabilities @gol
355 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
356 -fbtr-bb-exclusive -fcaller-saves @gol
357 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
358 -fcompare-elim -fcprop-registers -fcrossjumping @gol
359 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
360 -fcx-limited-range @gol
361 -fdata-sections -fdce -fdelayed-branch @gol
362 -fdelete-null-pointer-checks -fdevirtualize -fdse @gol
363 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
364 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
365 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
366 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
367 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
368 -fif-conversion2 -findirect-inlining @gol
369 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
370 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
371 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
372 -fira-algorithm=@var{algorithm} @gol
373 -fira-region=@var{region} -fira-hoist-pressure @gol
374 -fira-loop-pressure -fno-ira-share-save-slots @gol
375 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
376 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
377 -floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol
378 -floop-parallelize-all -flto -flto-compression-level @gol
379 -flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
380 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
381 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
382 -fno-default-inline @gol
383 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
384 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
385 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
386 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
387 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
388 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
389 -fprefetch-loop-arrays -fprofile-report @gol
390 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
391 -fprofile-generate=@var{path} @gol
392 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
393 -freciprocal-math -free -fregmove -frename-registers -freorder-blocks @gol
394 -freorder-blocks-and-partition -freorder-functions @gol
395 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
396 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
397 -fsched-spec-load -fsched-spec-load-dangerous @gol
398 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
399 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
400 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
401 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
402 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
403 -fselective-scheduling -fselective-scheduling2 @gol
404 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
405 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
406 -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol
407 -fstack-protector-all -fstrict-aliasing -fstrict-overflow @gol
408 -fthread-jumps -ftracer -ftree-bit-ccp @gol
409 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
410 -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
411 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
412 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
413 -ftree-loop-if-convert-stores -ftree-loop-im @gol
414 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
415 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
416 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
417 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
418 -ftree-switch-conversion -ftree-tail-merge @gol
419 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
420 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
421 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
422 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
423 -fwhole-program -fwpa -fuse-ld=@var{linker} -fuse-linker-plugin @gol
424 --param @var{name}=@var{value}
425 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
427 @item Preprocessor Options
428 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
429 @gccoptlist{-A@var{question}=@var{answer} @gol
430 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
431 -C -dD -dI -dM -dN @gol
432 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
433 -idirafter @var{dir} @gol
434 -include @var{file} -imacros @var{file} @gol
435 -iprefix @var{file} -iwithprefix @var{dir} @gol
436 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
437 -imultilib @var{dir} -isysroot @var{dir} @gol
438 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
439 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
440 -remap -trigraphs -undef -U@var{macro} @gol
441 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
443 @item Assembler Option
444 @xref{Assembler Options,,Passing Options to the Assembler}.
445 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
448 @xref{Link Options,,Options for Linking}.
449 @gccoptlist{@var{object-file-name} -l@var{library} @gol
450 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
451 -s -static -static-libgcc -static-libstdc++ @gol
452 -static-libasan -static-libtsan @gol
453 -shared -shared-libgcc -symbolic @gol
454 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
457 @item Directory Options
458 @xref{Directory Options,,Options for Directory Search}.
459 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
460 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
461 --sysroot=@var{dir} --no-sysroot-suffix}
463 @item Machine Dependent Options
464 @xref{Submodel Options,,Hardware Models and Configurations}.
465 @c This list is ordered alphanumerically by subsection name.
466 @c Try and put the significant identifier (CPU or system) first,
467 @c so users have a clue at guessing where the ones they want will be.
469 @emph{AArch64 Options}
470 @gccoptlist{-mbig-endian -mlittle-endian @gol
471 -mgeneral-regs-only @gol
472 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
474 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
475 -mtls-dialect=desc -mtls-dialect=traditional @gol
476 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
478 @emph{Adapteva Epiphany Options}
479 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
480 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
481 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
482 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
483 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
484 -msplit-vecmove-early -m1reg-@var{reg}}
487 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
488 -mabi=@var{name} @gol
489 -mapcs-stack-check -mno-apcs-stack-check @gol
490 -mapcs-float -mno-apcs-float @gol
491 -mapcs-reentrant -mno-apcs-reentrant @gol
492 -msched-prolog -mno-sched-prolog @gol
493 -mlittle-endian -mbig-endian -mwords-little-endian @gol
494 -mfloat-abi=@var{name} @gol
495 -mfp16-format=@var{name}
496 -mthumb-interwork -mno-thumb-interwork @gol
497 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
498 -mstructure-size-boundary=@var{n} @gol
499 -mabort-on-noreturn @gol
500 -mlong-calls -mno-long-calls @gol
501 -msingle-pic-base -mno-single-pic-base @gol
502 -mpic-register=@var{reg} @gol
503 -mnop-fun-dllimport @gol
504 -mpoke-function-name @gol
506 -mtpcs-frame -mtpcs-leaf-frame @gol
507 -mcaller-super-interworking -mcallee-super-interworking @gol
508 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
509 -mword-relocations @gol
510 -mfix-cortex-m3-ldrd @gol
514 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
515 -mcall-prologues -mint8 -mno-interrupts -mrelax @gol
516 -mstrict-X -mtiny-stack}
518 @emph{Blackfin Options}
519 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
520 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
521 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
522 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
523 -mno-id-shared-library -mshared-library-id=@var{n} @gol
524 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
525 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
526 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
530 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
531 -msim -msdata=@var{sdata-type}}
534 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
535 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
536 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
537 -mstack-align -mdata-align -mconst-align @gol
538 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
539 -melf -maout -melinux -mlinux -sim -sim2 @gol
540 -mmul-bug-workaround -mno-mul-bug-workaround}
543 @gccoptlist{-mmac @gol
544 -mcr16cplus -mcr16c @gol
545 -msim -mint32 -mbit-ops
546 -mdata-model=@var{model}}
548 @emph{Darwin Options}
549 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
550 -arch_only -bind_at_load -bundle -bundle_loader @gol
551 -client_name -compatibility_version -current_version @gol
553 -dependency-file -dylib_file -dylinker_install_name @gol
554 -dynamic -dynamiclib -exported_symbols_list @gol
555 -filelist -flat_namespace -force_cpusubtype_ALL @gol
556 -force_flat_namespace -headerpad_max_install_names @gol
558 -image_base -init -install_name -keep_private_externs @gol
559 -multi_module -multiply_defined -multiply_defined_unused @gol
560 -noall_load -no_dead_strip_inits_and_terms @gol
561 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
562 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
563 -private_bundle -read_only_relocs -sectalign @gol
564 -sectobjectsymbols -whyload -seg1addr @gol
565 -sectcreate -sectobjectsymbols -sectorder @gol
566 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
567 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
568 -segprot -segs_read_only_addr -segs_read_write_addr @gol
569 -single_module -static -sub_library -sub_umbrella @gol
570 -twolevel_namespace -umbrella -undefined @gol
571 -unexported_symbols_list -weak_reference_mismatches @gol
572 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
573 -mkernel -mone-byte-bool}
575 @emph{DEC Alpha Options}
576 @gccoptlist{-mno-fp-regs -msoft-float @gol
577 -mieee -mieee-with-inexact -mieee-conformant @gol
578 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
579 -mtrap-precision=@var{mode} -mbuild-constants @gol
580 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
581 -mbwx -mmax -mfix -mcix @gol
582 -mfloat-vax -mfloat-ieee @gol
583 -mexplicit-relocs -msmall-data -mlarge-data @gol
584 -msmall-text -mlarge-text @gol
585 -mmemory-latency=@var{time}}
588 @gccoptlist{-msmall-model -mno-lsim}
591 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
592 -mhard-float -msoft-float @gol
593 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
594 -mdouble -mno-double @gol
595 -mmedia -mno-media -mmuladd -mno-muladd @gol
596 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
597 -mlinked-fp -mlong-calls -malign-labels @gol
598 -mlibrary-pic -macc-4 -macc-8 @gol
599 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
600 -moptimize-membar -mno-optimize-membar @gol
601 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
602 -mvliw-branch -mno-vliw-branch @gol
603 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
604 -mno-nested-cond-exec -mtomcat-stats @gol
608 @emph{GNU/Linux Options}
609 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
610 -tno-android-cc -tno-android-ld}
612 @emph{H8/300 Options}
613 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
616 @gccoptlist{-march=@var{architecture-type} @gol
617 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
618 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
619 -mfixed-range=@var{register-range} @gol
620 -mjump-in-delay -mlinker-opt -mlong-calls @gol
621 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
622 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
623 -mno-jump-in-delay -mno-long-load-store @gol
624 -mno-portable-runtime -mno-soft-float @gol
625 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
626 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
627 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
628 -munix=@var{unix-std} -nolibdld -static -threads}
630 @emph{i386 and x86-64 Options}
631 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
632 -mfpmath=@var{unit} @gol
633 -masm=@var{dialect} -mno-fancy-math-387 @gol
634 -mno-fp-ret-in-387 -msoft-float @gol
635 -mno-wide-multiply -mrtd -malign-double @gol
636 -mpreferred-stack-boundary=@var{num} @gol
637 -mincoming-stack-boundary=@var{num} @gol
638 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
639 -mrecip -mrecip=@var{opt} @gol
640 -mvzeroupper -mprefer-avx128 @gol
641 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
642 -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
643 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
644 -mbmi2 -mrtm -mlwp -mthreads @gol
645 -mno-align-stringops -minline-all-stringops @gol
646 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
647 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
648 -m96bit-long-double -mlong-double-64 -mlong-double-80 @gol
649 -mregparm=@var{num} -msseregparm @gol
650 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
651 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
652 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
653 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
654 -m32 -m64 -mx32 -mlarge-data-threshold=@var{num} @gol
655 -msse2avx -mfentry -m8bit-idiv @gol
656 -mavx256-split-unaligned-load -mavx256-split-unaligned-store}
658 @emph{i386 and x86-64 Windows Options}
659 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
660 -mnop-fun-dllimport -mthread @gol
661 -municode -mwin32 -mwindows -fno-set-stack-executable}
664 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
665 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
666 -mconstant-gp -mauto-pic -mfused-madd @gol
667 -minline-float-divide-min-latency @gol
668 -minline-float-divide-max-throughput @gol
669 -mno-inline-float-divide @gol
670 -minline-int-divide-min-latency @gol
671 -minline-int-divide-max-throughput @gol
672 -mno-inline-int-divide @gol
673 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
674 -mno-inline-sqrt @gol
675 -mdwarf2-asm -mearly-stop-bits @gol
676 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
677 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
678 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
679 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
680 -msched-spec-ldc -msched-spec-control-ldc @gol
681 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
682 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
683 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
684 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
687 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
688 -msign-extend-enabled -muser-enabled}
690 @emph{M32R/D Options}
691 @gccoptlist{-m32r2 -m32rx -m32r @gol
693 -malign-loops -mno-align-loops @gol
694 -missue-rate=@var{number} @gol
695 -mbranch-cost=@var{number} @gol
696 -mmodel=@var{code-size-model-type} @gol
697 -msdata=@var{sdata-type} @gol
698 -mno-flush-func -mflush-func=@var{name} @gol
699 -mno-flush-trap -mflush-trap=@var{number} @gol
703 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
705 @emph{M680x0 Options}
706 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
707 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
708 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
709 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
710 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
711 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
712 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
713 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
717 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
718 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
719 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
720 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
721 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
724 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
725 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
726 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
727 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
730 @emph{MicroBlaze Options}
731 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
732 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
733 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
734 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
735 -mxl-mode-@var{app-model}}
738 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
739 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
740 -mips64 -mips64r2 @gol
741 -mips16 -mno-mips16 -mflip-mips16 @gol
742 -minterlink-mips16 -mno-interlink-mips16 @gol
743 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
744 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
745 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
746 -mno-float -msingle-float -mdouble-float @gol
747 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
749 -mfpu=@var{fpu-type} @gol
750 -msmartmips -mno-smartmips @gol
751 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
752 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
753 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
754 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
755 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
756 -membedded-data -mno-embedded-data @gol
757 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
758 -mcode-readable=@var{setting} @gol
759 -msplit-addresses -mno-split-addresses @gol
760 -mexplicit-relocs -mno-explicit-relocs @gol
761 -mcheck-zero-division -mno-check-zero-division @gol
762 -mdivide-traps -mdivide-breaks @gol
763 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
764 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
765 -mfix-24k -mno-fix-24k @gol
766 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
767 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
768 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
769 -mflush-func=@var{func} -mno-flush-func @gol
770 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
771 -mfp-exceptions -mno-fp-exceptions @gol
772 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
773 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
776 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
777 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
778 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
779 -mno-base-addresses -msingle-exit -mno-single-exit}
781 @emph{MN10300 Options}
782 @gccoptlist{-mmult-bug -mno-mult-bug @gol
783 -mno-am33 -mam33 -mam33-2 -mam34 @gol
784 -mtune=@var{cpu-type} @gol
785 -mreturn-pointer-on-d0 @gol
786 -mno-crt0 -mrelax -mliw -msetlb}
789 @gccoptlist{-meb -mel -mno-crt0}
791 @emph{PDP-11 Options}
792 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
793 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
794 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
795 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
796 -mbranch-expensive -mbranch-cheap @gol
797 -munix-asm -mdec-asm}
799 @emph{picoChip Options}
800 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
801 -msymbol-as-address -mno-inefficient-warnings}
803 @emph{PowerPC Options}
804 See RS/6000 and PowerPC Options.
807 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78}
809 @emph{RS/6000 and PowerPC Options}
810 @gccoptlist{-mcpu=@var{cpu-type} @gol
811 -mtune=@var{cpu-type} @gol
812 -mcmodel=@var{code-model} @gol
814 -maltivec -mno-altivec @gol
815 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
816 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
817 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
818 -mfprnd -mno-fprnd @gol
819 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
820 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
821 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
822 -malign-power -malign-natural @gol
823 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
824 -msingle-float -mdouble-float -msimple-fpu @gol
825 -mstring -mno-string -mupdate -mno-update @gol
826 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
827 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
828 -mstrict-align -mno-strict-align -mrelocatable @gol
829 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
830 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
831 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
832 -mprioritize-restricted-insns=@var{priority} @gol
833 -msched-costly-dep=@var{dependence_type} @gol
834 -minsert-sched-nops=@var{scheme} @gol
835 -mcall-sysv -mcall-netbsd @gol
836 -maix-struct-return -msvr4-struct-return @gol
837 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
838 -mblock-move-inline-limit=@var{num} @gol
839 -misel -mno-isel @gol
840 -misel=yes -misel=no @gol
842 -mspe=yes -mspe=no @gol
844 -mgen-cell-microcode -mwarn-cell-microcode @gol
845 -mvrsave -mno-vrsave @gol
846 -mmulhw -mno-mulhw @gol
847 -mdlmzb -mno-dlmzb @gol
848 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
849 -mprototype -mno-prototype @gol
850 -msim -mmvme -mads -myellowknife -memb -msdata @gol
851 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
852 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
853 -mno-recip-precision @gol
854 -mveclibabi=@var{type} -mfriz -mno-friz @gol
855 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
856 -msave-toc-indirect -mno-save-toc-indirect}
859 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
861 -mbig-endian-data -mlittle-endian-data @gol
864 -mas100-syntax -mno-as100-syntax@gol
866 -mmax-constant-size=@gol
869 -mno-warn-multiple-fast-interrupts@gol
870 -msave-acc-in-interrupts}
872 @emph{S/390 and zSeries Options}
873 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
874 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
875 -mlong-double-64 -mlong-double-128 @gol
876 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
877 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
878 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
879 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
880 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
883 @gccoptlist{-meb -mel @gol
887 -mscore5 -mscore5u -mscore7 -mscore7d}
890 @gccoptlist{-m1 -m2 -m2e @gol
891 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
893 -m4-nofpu -m4-single-only -m4-single -m4 @gol
894 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
895 -m5-64media -m5-64media-nofpu @gol
896 -m5-32media -m5-32media-nofpu @gol
897 -m5-compact -m5-compact-nofpu @gol
898 -mb -ml -mdalign -mrelax @gol
899 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
900 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
901 -mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
902 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
903 -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
904 -maccumulate-outgoing-args -minvalid-symbols @gol
905 -matomic-model=@var{atomic-model} @gol
906 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch -mcbranchdi -mcmpeqdi @gol
907 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
908 -mpretend-cmove -mtas}
910 @emph{Solaris 2 Options}
911 @gccoptlist{-mimpure-text -mno-impure-text @gol
915 @gccoptlist{-mcpu=@var{cpu-type} @gol
916 -mtune=@var{cpu-type} @gol
917 -mcmodel=@var{code-model} @gol
918 -mmemory-model=@var{mem-model} @gol
919 -m32 -m64 -mapp-regs -mno-app-regs @gol
920 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
921 -mfpu -mno-fpu -mhard-float -msoft-float @gol
922 -mhard-quad-float -msoft-quad-float @gol
924 -mstack-bias -mno-stack-bias @gol
925 -munaligned-doubles -mno-unaligned-doubles @gol
926 -mv8plus -mno-v8plus -mvis -mno-vis @gol
927 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
928 -mcbcond -mno-cbcond @gol
929 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
933 @gccoptlist{-mwarn-reloc -merror-reloc @gol
934 -msafe-dma -munsafe-dma @gol
936 -msmall-mem -mlarge-mem -mstdmain @gol
937 -mfixed-range=@var{register-range} @gol
939 -maddress-space-conversion -mno-address-space-conversion @gol
940 -mcache-size=@var{cache-size} @gol
941 -matomic-updates -mno-atomic-updates}
943 @emph{System V Options}
944 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
946 @emph{TILE-Gx Options}
947 @gccoptlist{-mcpu=@var{cpu} -m32 -m64 -mcmodel=@var{code-model}}
949 @emph{TILEPro Options}
950 @gccoptlist{-mcpu=@var{cpu} -m32}
953 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
954 -mprolog-function -mno-prolog-function -mspace @gol
955 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
956 -mapp-regs -mno-app-regs @gol
957 -mdisable-callt -mno-disable-callt @gol
960 -mv850e1 -mv850es @gol
965 @gccoptlist{-mg -mgnu -munix}
968 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
969 -mpointer-size=@var{size}}
971 @emph{VxWorks Options}
972 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
973 -Xbind-lazy -Xbind-now}
975 @emph{x86-64 Options}
976 See i386 and x86-64 Options.
978 @emph{Xstormy16 Options}
981 @emph{Xtensa Options}
982 @gccoptlist{-mconst16 -mno-const16 @gol
983 -mfused-madd -mno-fused-madd @gol
985 -mserialize-volatile -mno-serialize-volatile @gol
986 -mtext-section-literals -mno-text-section-literals @gol
987 -mtarget-align -mno-target-align @gol
988 -mlongcalls -mno-longcalls}
990 @emph{zSeries Options}
991 See S/390 and zSeries Options.
993 @item Code Generation Options
994 @xref{Code Gen Options,,Options for Code Generation Conventions}.
995 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
996 -ffixed-@var{reg} -fexceptions @gol
997 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
998 -fasynchronous-unwind-tables @gol
999 -finhibit-size-directive -finstrument-functions @gol
1000 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
1001 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
1002 -fno-common -fno-ident @gol
1003 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
1004 -fno-jump-tables @gol
1005 -frecord-gcc-switches @gol
1006 -freg-struct-return -fshort-enums @gol
1007 -fshort-double -fshort-wchar @gol
1008 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
1009 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
1010 -fno-stack-limit -fsplit-stack @gol
1011 -fleading-underscore -ftls-model=@var{model} @gol
1012 -fstack-reuse=@var{reuse_level} @gol
1013 -ftrapv -fwrapv -fbounds-check @gol
1014 -fvisibility -fstrict-volatile-bitfields -fsync-libcalls}
1018 * Overall Options:: Controlling the kind of output:
1019 an executable, object files, assembler files,
1020 or preprocessed source.
1021 * C Dialect Options:: Controlling the variant of C language compiled.
1022 * C++ Dialect Options:: Variations on C++.
1023 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
1025 * Language Independent Options:: Controlling how diagnostics should be
1027 * Warning Options:: How picky should the compiler be?
1028 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
1029 * Optimize Options:: How much optimization?
1030 * Preprocessor Options:: Controlling header files and macro definitions.
1031 Also, getting dependency information for Make.
1032 * Assembler Options:: Passing options to the assembler.
1033 * Link Options:: Specifying libraries and so on.
1034 * Directory Options:: Where to find header files and libraries.
1035 Where to find the compiler executable files.
1036 * Spec Files:: How to pass switches to sub-processes.
1037 * Target Options:: Running a cross-compiler, or an old version of GCC.
1040 @node Overall Options
1041 @section Options Controlling the Kind of Output
1043 Compilation can involve up to four stages: preprocessing, compilation
1044 proper, assembly and linking, always in that order. GCC is capable of
1045 preprocessing and compiling several files either into several
1046 assembler input files, or into one assembler input file; then each
1047 assembler input file produces an object file, and linking combines all
1048 the object files (those newly compiled, and those specified as input)
1049 into an executable file.
1051 @cindex file name suffix
1052 For any given input file, the file name suffix determines what kind of
1053 compilation is done:
1057 C source code that must be preprocessed.
1060 C source code that should not be preprocessed.
1063 C++ source code that should not be preprocessed.
1066 Objective-C source code. Note that you must link with the @file{libobjc}
1067 library to make an Objective-C program work.
1070 Objective-C source code that should not be preprocessed.
1074 Objective-C++ source code. Note that you must link with the @file{libobjc}
1075 library to make an Objective-C++ program work. Note that @samp{.M} refers
1076 to a literal capital M@.
1078 @item @var{file}.mii
1079 Objective-C++ source code that should not be preprocessed.
1082 C, C++, Objective-C or Objective-C++ header file to be turned into a
1083 precompiled header (default), or C, C++ header file to be turned into an
1084 Ada spec (via the @option{-fdump-ada-spec} switch).
1087 @itemx @var{file}.cp
1088 @itemx @var{file}.cxx
1089 @itemx @var{file}.cpp
1090 @itemx @var{file}.CPP
1091 @itemx @var{file}.c++
1093 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1094 the last two letters must both be literally @samp{x}. Likewise,
1095 @samp{.C} refers to a literal capital C@.
1099 Objective-C++ source code that must be preprocessed.
1101 @item @var{file}.mii
1102 Objective-C++ source code that should not be preprocessed.
1106 @itemx @var{file}.hp
1107 @itemx @var{file}.hxx
1108 @itemx @var{file}.hpp
1109 @itemx @var{file}.HPP
1110 @itemx @var{file}.h++
1111 @itemx @var{file}.tcc
1112 C++ header file to be turned into a precompiled header or Ada spec.
1115 @itemx @var{file}.for
1116 @itemx @var{file}.ftn
1117 Fixed form Fortran source code that should not be preprocessed.
1120 @itemx @var{file}.FOR
1121 @itemx @var{file}.fpp
1122 @itemx @var{file}.FPP
1123 @itemx @var{file}.FTN
1124 Fixed form Fortran source code that must be preprocessed (with the traditional
1127 @item @var{file}.f90
1128 @itemx @var{file}.f95
1129 @itemx @var{file}.f03
1130 @itemx @var{file}.f08
1131 Free form Fortran source code that should not be preprocessed.
1133 @item @var{file}.F90
1134 @itemx @var{file}.F95
1135 @itemx @var{file}.F03
1136 @itemx @var{file}.F08
1137 Free form Fortran source code that must be preprocessed (with the
1138 traditional preprocessor).
1143 @c FIXME: Descriptions of Java file types.
1149 @item @var{file}.ads
1150 Ada source code file that contains a library unit declaration (a
1151 declaration of a package, subprogram, or generic, or a generic
1152 instantiation), or a library unit renaming declaration (a package,
1153 generic, or subprogram renaming declaration). Such files are also
1156 @item @var{file}.adb
1157 Ada source code file containing a library unit body (a subprogram or
1158 package body). Such files are also called @dfn{bodies}.
1160 @c GCC also knows about some suffixes for languages not yet included:
1171 @itemx @var{file}.sx
1172 Assembler code that must be preprocessed.
1175 An object file to be fed straight into linking.
1176 Any file name with no recognized suffix is treated this way.
1180 You can specify the input language explicitly with the @option{-x} option:
1183 @item -x @var{language}
1184 Specify explicitly the @var{language} for the following input files
1185 (rather than letting the compiler choose a default based on the file
1186 name suffix). This option applies to all following input files until
1187 the next @option{-x} option. Possible values for @var{language} are:
1189 c c-header cpp-output
1190 c++ c++-header c++-cpp-output
1191 objective-c objective-c-header objective-c-cpp-output
1192 objective-c++ objective-c++-header objective-c++-cpp-output
1193 assembler assembler-with-cpp
1195 f77 f77-cpp-input f95 f95-cpp-input
1201 Turn off any specification of a language, so that subsequent files are
1202 handled according to their file name suffixes (as they are if @option{-x}
1203 has not been used at all).
1205 @item -pass-exit-codes
1206 @opindex pass-exit-codes
1207 Normally the @command{gcc} program exits with the code of 1 if any
1208 phase of the compiler returns a non-success return code. If you specify
1209 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1210 the numerically highest error produced by any phase returning an error
1211 indication. The C, C++, and Fortran front ends return 4 if an internal
1212 compiler error is encountered.
1215 If you only want some of the stages of compilation, you can use
1216 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1217 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1218 @command{gcc} is to stop. Note that some combinations (for example,
1219 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1224 Compile or assemble the source files, but do not link. The linking
1225 stage simply is not done. The ultimate output is in the form of an
1226 object file for each source file.
1228 By default, the object file name for a source file is made by replacing
1229 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1231 Unrecognized input files, not requiring compilation or assembly, are
1236 Stop after the stage of compilation proper; do not assemble. The output
1237 is in the form of an assembler code file for each non-assembler input
1240 By default, the assembler file name for a source file is made by
1241 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1243 Input files that don't require compilation are ignored.
1247 Stop after the preprocessing stage; do not run the compiler proper. The
1248 output is in the form of preprocessed source code, which is sent to the
1251 Input files that don't require preprocessing are ignored.
1253 @cindex output file option
1256 Place output in file @var{file}. This applies to whatever
1257 sort of output is being produced, whether it be an executable file,
1258 an object file, an assembler file or preprocessed C code.
1260 If @option{-o} is not specified, the default is to put an executable
1261 file in @file{a.out}, the object file for
1262 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1263 assembler file in @file{@var{source}.s}, a precompiled header file in
1264 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1269 Print (on standard error output) the commands executed to run the stages
1270 of compilation. Also print the version number of the compiler driver
1271 program and of the preprocessor and the compiler proper.
1275 Like @option{-v} except the commands are not executed and arguments
1276 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1277 This is useful for shell scripts to capture the driver-generated command lines.
1281 Use pipes rather than temporary files for communication between the
1282 various stages of compilation. This fails to work on some systems where
1283 the assembler is unable to read from a pipe; but the GNU assembler has
1288 Print (on the standard output) a description of the command-line options
1289 understood by @command{gcc}. If the @option{-v} option is also specified
1290 then @option{--help} is also passed on to the various processes
1291 invoked by @command{gcc}, so that they can display the command-line options
1292 they accept. If the @option{-Wextra} option has also been specified
1293 (prior to the @option{--help} option), then command-line options that
1294 have no documentation associated with them are also displayed.
1297 @opindex target-help
1298 Print (on the standard output) a description of target-specific command-line
1299 options for each tool. For some targets extra target-specific
1300 information may also be printed.
1302 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1303 Print (on the standard output) a description of the command-line
1304 options understood by the compiler that fit into all specified classes
1305 and qualifiers. These are the supported classes:
1308 @item @samp{optimizers}
1309 Display all of the optimization options supported by the
1312 @item @samp{warnings}
1313 Display all of the options controlling warning messages
1314 produced by the compiler.
1317 Display target-specific options. Unlike the
1318 @option{--target-help} option however, target-specific options of the
1319 linker and assembler are not displayed. This is because those
1320 tools do not currently support the extended @option{--help=} syntax.
1323 Display the values recognized by the @option{--param}
1326 @item @var{language}
1327 Display the options supported for @var{language}, where
1328 @var{language} is the name of one of the languages supported in this
1332 Display the options that are common to all languages.
1335 These are the supported qualifiers:
1338 @item @samp{undocumented}
1339 Display only those options that are undocumented.
1342 Display options taking an argument that appears after an equal
1343 sign in the same continuous piece of text, such as:
1344 @samp{--help=target}.
1346 @item @samp{separate}
1347 Display options taking an argument that appears as a separate word
1348 following the original option, such as: @samp{-o output-file}.
1351 Thus for example to display all the undocumented target-specific
1352 switches supported by the compiler, use:
1355 --help=target,undocumented
1358 The sense of a qualifier can be inverted by prefixing it with the
1359 @samp{^} character, so for example to display all binary warning
1360 options (i.e., ones that are either on or off and that do not take an
1361 argument) that have a description, use:
1364 --help=warnings,^joined,^undocumented
1367 The argument to @option{--help=} should not consist solely of inverted
1370 Combining several classes is possible, although this usually
1371 restricts the output so much that there is nothing to display. One
1372 case where it does work, however, is when one of the classes is
1373 @var{target}. For example, to display all the target-specific
1374 optimization options, use:
1377 --help=target,optimizers
1380 The @option{--help=} option can be repeated on the command line. Each
1381 successive use displays its requested class of options, skipping
1382 those that have already been displayed.
1384 If the @option{-Q} option appears on the command line before the
1385 @option{--help=} option, then the descriptive text displayed by
1386 @option{--help=} is changed. Instead of describing the displayed
1387 options, an indication is given as to whether the option is enabled,
1388 disabled or set to a specific value (assuming that the compiler
1389 knows this at the point where the @option{--help=} option is used).
1391 Here is a truncated example from the ARM port of @command{gcc}:
1394 % gcc -Q -mabi=2 --help=target -c
1395 The following options are target specific:
1397 -mabort-on-noreturn [disabled]
1401 The output is sensitive to the effects of previous command-line
1402 options, so for example it is possible to find out which optimizations
1403 are enabled at @option{-O2} by using:
1406 -Q -O2 --help=optimizers
1409 Alternatively you can discover which binary optimizations are enabled
1410 by @option{-O3} by using:
1413 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1414 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1415 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1418 @item -no-canonical-prefixes
1419 @opindex no-canonical-prefixes
1420 Do not expand any symbolic links, resolve references to @samp{/../}
1421 or @samp{/./}, or make the path absolute when generating a relative
1426 Display the version number and copyrights of the invoked GCC@.
1430 Invoke all subcommands under a wrapper program. The name of the
1431 wrapper program and its parameters are passed as a comma separated
1435 gcc -c t.c -wrapper gdb,--args
1439 This invokes all subprograms of @command{gcc} under
1440 @samp{gdb --args}, thus the invocation of @command{cc1} is
1441 @samp{gdb --args cc1 @dots{}}.
1443 @item -fplugin=@var{name}.so
1444 Load the plugin code in file @var{name}.so, assumed to be a
1445 shared object to be dlopen'd by the compiler. The base name of
1446 the shared object file is used to identify the plugin for the
1447 purposes of argument parsing (See
1448 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1449 Each plugin should define the callback functions specified in the
1452 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1453 Define an argument called @var{key} with a value of @var{value}
1454 for the plugin called @var{name}.
1456 @item -fdump-ada-spec@r{[}-slim@r{]}
1457 For C and C++ source and include files, generate corresponding Ada
1458 specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1459 GNAT User's Guide}, which provides detailed documentation on this feature.
1461 @item -fdump-go-spec=@var{file}
1462 For input files in any language, generate corresponding Go
1463 declarations in @var{file}. This generates Go @code{const},
1464 @code{type}, @code{var}, and @code{func} declarations which may be a
1465 useful way to start writing a Go interface to code written in some
1468 @include @value{srcdir}/../libiberty/at-file.texi
1472 @section Compiling C++ Programs
1474 @cindex suffixes for C++ source
1475 @cindex C++ source file suffixes
1476 C++ source files conventionally use one of the suffixes @samp{.C},
1477 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1478 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1479 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1480 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1481 files with these names and compiles them as C++ programs even if you
1482 call the compiler the same way as for compiling C programs (usually
1483 with the name @command{gcc}).
1487 However, the use of @command{gcc} does not add the C++ library.
1488 @command{g++} is a program that calls GCC and automatically specifies linking
1489 against the C++ library. It treats @samp{.c},
1490 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1491 files unless @option{-x} is used. This program is also useful when
1492 precompiling a C header file with a @samp{.h} extension for use in C++
1493 compilations. On many systems, @command{g++} is also installed with
1494 the name @command{c++}.
1496 @cindex invoking @command{g++}
1497 When you compile C++ programs, you may specify many of the same
1498 command-line options that you use for compiling programs in any
1499 language; or command-line options meaningful for C and related
1500 languages; or options that are meaningful only for C++ programs.
1501 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1502 explanations of options for languages related to C@.
1503 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1504 explanations of options that are meaningful only for C++ programs.
1506 @node C Dialect Options
1507 @section Options Controlling C Dialect
1508 @cindex dialect options
1509 @cindex language dialect options
1510 @cindex options, dialect
1512 The following options control the dialect of C (or languages derived
1513 from C, such as C++, Objective-C and Objective-C++) that the compiler
1517 @cindex ANSI support
1521 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1522 equivalent to @option{-std=c++98}.
1524 This turns off certain features of GCC that are incompatible with ISO
1525 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1526 such as the @code{asm} and @code{typeof} keywords, and
1527 predefined macros such as @code{unix} and @code{vax} that identify the
1528 type of system you are using. It also enables the undesirable and
1529 rarely used ISO trigraph feature. For the C compiler,
1530 it disables recognition of C++ style @samp{//} comments as well as
1531 the @code{inline} keyword.
1533 The alternate keywords @code{__asm__}, @code{__extension__},
1534 @code{__inline__} and @code{__typeof__} continue to work despite
1535 @option{-ansi}. You would not want to use them in an ISO C program, of
1536 course, but it is useful to put them in header files that might be included
1537 in compilations done with @option{-ansi}. Alternate predefined macros
1538 such as @code{__unix__} and @code{__vax__} are also available, with or
1539 without @option{-ansi}.
1541 The @option{-ansi} option does not cause non-ISO programs to be
1542 rejected gratuitously. For that, @option{-Wpedantic} is required in
1543 addition to @option{-ansi}. @xref{Warning Options}.
1545 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1546 option is used. Some header files may notice this macro and refrain
1547 from declaring certain functions or defining certain macros that the
1548 ISO standard doesn't call for; this is to avoid interfering with any
1549 programs that might use these names for other things.
1551 Functions that are normally built in but do not have semantics
1552 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1553 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1554 built-in functions provided by GCC}, for details of the functions
1559 Determine the language standard. @xref{Standards,,Language Standards
1560 Supported by GCC}, for details of these standard versions. This option
1561 is currently only supported when compiling C or C++.
1563 The compiler can accept several base standards, such as @samp{c90} or
1564 @samp{c++98}, and GNU dialects of those standards, such as
1565 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1566 compiler accepts all programs following that standard plus those
1567 using GNU extensions that do not contradict it. For example,
1568 @option{-std=c90} turns off certain features of GCC that are
1569 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1570 keywords, but not other GNU extensions that do not have a meaning in
1571 ISO C90, such as omitting the middle term of a @code{?:}
1572 expression. On the other hand, when a GNU dialect of a standard is
1573 specified, all features supported by the compiler are enabled, even when
1574 those features change the meaning of the base standard. As a result, some
1575 strict-conforming programs may be rejected. The particular standard
1576 is used by @option{-Wpedantic} to identify which features are GNU
1577 extensions given that version of the standard. For example
1578 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1579 comments, while @option{-std=gnu99 -Wpedantic} does not.
1581 A value for this option must be provided; possible values are
1587 Support all ISO C90 programs (certain GNU extensions that conflict
1588 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1590 @item iso9899:199409
1591 ISO C90 as modified in amendment 1.
1597 ISO C99. Note that this standard is not yet fully supported; see
1598 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1599 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1604 ISO C11, the 2011 revision of the ISO C standard.
1605 Support is incomplete and experimental. The name @samp{c1x} is
1610 GNU dialect of ISO C90 (including some C99 features). This
1611 is the default for C code.
1615 GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
1616 this will become the default. The name @samp{gnu9x} is deprecated.
1620 GNU dialect of ISO C11. Support is incomplete and experimental. The
1621 name @samp{gnu1x} is deprecated.
1625 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1626 additional defect reports. Same as @option{-ansi} for C++ code.
1630 GNU dialect of @option{-std=c++98}. This is the default for
1635 The 2011 ISO C++ standard plus amendments. Support for C++11 is still
1636 experimental, and may change in incompatible ways in future releases.
1637 The name @samp{c++0x} is deprecated.
1641 GNU dialect of @option{-std=c++11}. Support for C++11 is still
1642 experimental, and may change in incompatible ways in future releases.
1643 The name @samp{gnu++0x} is deprecated.
1646 The next revision of the ISO C++ standard, tentatively planned for
1647 2017. Support is highly experimental, and will almost certainly
1648 change in incompatible ways in future releases.
1651 GNU dialect of @option{-std=c++1y}. Support is highly experimental,
1652 and will almost certainly change in incompatible ways in future
1656 @item -fgnu89-inline
1657 @opindex fgnu89-inline
1658 The option @option{-fgnu89-inline} tells GCC to use the traditional
1659 GNU semantics for @code{inline} functions when in C99 mode.
1660 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1661 is accepted and ignored by GCC versions 4.1.3 up to but not including
1662 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1663 C99 mode. Using this option is roughly equivalent to adding the
1664 @code{gnu_inline} function attribute to all inline functions
1665 (@pxref{Function Attributes}).
1667 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1668 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1669 specifies the default behavior). This option was first supported in
1670 GCC 4.3. This option is not supported in @option{-std=c90} or
1671 @option{-std=gnu90} mode.
1673 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1674 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1675 in effect for @code{inline} functions. @xref{Common Predefined
1676 Macros,,,cpp,The C Preprocessor}.
1678 @item -aux-info @var{filename}
1680 Output to the given filename prototyped declarations for all functions
1681 declared and/or defined in a translation unit, including those in header
1682 files. This option is silently ignored in any language other than C@.
1684 Besides declarations, the file indicates, in comments, the origin of
1685 each declaration (source file and line), whether the declaration was
1686 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1687 @samp{O} for old, respectively, in the first character after the line
1688 number and the colon), and whether it came from a declaration or a
1689 definition (@samp{C} or @samp{F}, respectively, in the following
1690 character). In the case of function definitions, a K&R-style list of
1691 arguments followed by their declarations is also provided, inside
1692 comments, after the declaration.
1694 @item -fallow-parameterless-variadic-functions
1695 Accept variadic functions without named parameters.
1697 Although it is possible to define such a function, this is not very
1698 useful as it is not possible to read the arguments. This is only
1699 supported for C as this construct is allowed by C++.
1703 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1704 keyword, so that code can use these words as identifiers. You can use
1705 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1706 instead. @option{-ansi} implies @option{-fno-asm}.
1708 In C++, this switch only affects the @code{typeof} keyword, since
1709 @code{asm} and @code{inline} are standard keywords. You may want to
1710 use the @option{-fno-gnu-keywords} flag instead, which has the same
1711 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1712 switch only affects the @code{asm} and @code{typeof} keywords, since
1713 @code{inline} is a standard keyword in ISO C99.
1716 @itemx -fno-builtin-@var{function}
1717 @opindex fno-builtin
1718 @cindex built-in functions
1719 Don't recognize built-in functions that do not begin with
1720 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1721 functions provided by GCC}, for details of the functions affected,
1722 including those which are not built-in functions when @option{-ansi} or
1723 @option{-std} options for strict ISO C conformance are used because they
1724 do not have an ISO standard meaning.
1726 GCC normally generates special code to handle certain built-in functions
1727 more efficiently; for instance, calls to @code{alloca} may become single
1728 instructions which adjust the stack directly, and calls to @code{memcpy}
1729 may become inline copy loops. The resulting code is often both smaller
1730 and faster, but since the function calls no longer appear as such, you
1731 cannot set a breakpoint on those calls, nor can you change the behavior
1732 of the functions by linking with a different library. In addition,
1733 when a function is recognized as a built-in function, GCC may use
1734 information about that function to warn about problems with calls to
1735 that function, or to generate more efficient code, even if the
1736 resulting code still contains calls to that function. For example,
1737 warnings are given with @option{-Wformat} for bad calls to
1738 @code{printf} when @code{printf} is built in and @code{strlen} is
1739 known not to modify global memory.
1741 With the @option{-fno-builtin-@var{function}} option
1742 only the built-in function @var{function} is
1743 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1744 function is named that is not built-in in this version of GCC, this
1745 option is ignored. There is no corresponding
1746 @option{-fbuiltin-@var{function}} option; if you wish to enable
1747 built-in functions selectively when using @option{-fno-builtin} or
1748 @option{-ffreestanding}, you may define macros such as:
1751 #define abs(n) __builtin_abs ((n))
1752 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1757 @cindex hosted environment
1759 Assert that compilation targets a hosted environment. This implies
1760 @option{-fbuiltin}. A hosted environment is one in which the
1761 entire standard library is available, and in which @code{main} has a return
1762 type of @code{int}. Examples are nearly everything except a kernel.
1763 This is equivalent to @option{-fno-freestanding}.
1765 @item -ffreestanding
1766 @opindex ffreestanding
1767 @cindex hosted environment
1769 Assert that compilation targets a freestanding environment. This
1770 implies @option{-fno-builtin}. A freestanding environment
1771 is one in which the standard library may not exist, and program startup may
1772 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1773 This is equivalent to @option{-fno-hosted}.
1775 @xref{Standards,,Language Standards Supported by GCC}, for details of
1776 freestanding and hosted environments.
1780 @cindex OpenMP parallel
1781 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1782 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1783 compiler generates parallel code according to the OpenMP Application
1784 Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
1785 implies @option{-pthread}, and thus is only supported on targets that
1786 have support for @option{-pthread}.
1790 When the option @option{-fgnu-tm} is specified, the compiler
1791 generates code for the Linux variant of Intel's current Transactional
1792 Memory ABI specification document (Revision 1.1, May 6 2009). This is
1793 an experimental feature whose interface may change in future versions
1794 of GCC, as the official specification changes. Please note that not
1795 all architectures are supported for this feature.
1797 For more information on GCC's support for transactional memory,
1798 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1799 Transactional Memory Library}.
1801 Note that the transactional memory feature is not supported with
1802 non-call exceptions (@option{-fnon-call-exceptions}).
1804 @item -fms-extensions
1805 @opindex fms-extensions
1806 Accept some non-standard constructs used in Microsoft header files.
1808 In C++ code, this allows member names in structures to be similar
1809 to previous types declarations.
1818 Some cases of unnamed fields in structures and unions are only
1819 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1820 fields within structs/unions}, for details.
1822 @item -fplan9-extensions
1823 Accept some non-standard constructs used in Plan 9 code.
1825 This enables @option{-fms-extensions}, permits passing pointers to
1826 structures with anonymous fields to functions that expect pointers to
1827 elements of the type of the field, and permits referring to anonymous
1828 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1829 struct/union fields within structs/unions}, for details. This is only
1830 supported for C, not C++.
1834 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1835 options for strict ISO C conformance) implies @option{-trigraphs}.
1837 @cindex traditional C language
1838 @cindex C language, traditional
1840 @itemx -traditional-cpp
1841 @opindex traditional-cpp
1842 @opindex traditional
1843 Formerly, these options caused GCC to attempt to emulate a pre-standard
1844 C compiler. They are now only supported with the @option{-E} switch.
1845 The preprocessor continues to support a pre-standard mode. See the GNU
1846 CPP manual for details.
1848 @item -fcond-mismatch
1849 @opindex fcond-mismatch
1850 Allow conditional expressions with mismatched types in the second and
1851 third arguments. The value of such an expression is void. This option
1852 is not supported for C++.
1854 @item -flax-vector-conversions
1855 @opindex flax-vector-conversions
1856 Allow implicit conversions between vectors with differing numbers of
1857 elements and/or incompatible element types. This option should not be
1860 @item -funsigned-char
1861 @opindex funsigned-char
1862 Let the type @code{char} be unsigned, like @code{unsigned char}.
1864 Each kind of machine has a default for what @code{char} should
1865 be. It is either like @code{unsigned char} by default or like
1866 @code{signed char} by default.
1868 Ideally, a portable program should always use @code{signed char} or
1869 @code{unsigned char} when it depends on the signedness of an object.
1870 But many programs have been written to use plain @code{char} and
1871 expect it to be signed, or expect it to be unsigned, depending on the
1872 machines they were written for. This option, and its inverse, let you
1873 make such a program work with the opposite default.
1875 The type @code{char} is always a distinct type from each of
1876 @code{signed char} or @code{unsigned char}, even though its behavior
1877 is always just like one of those two.
1880 @opindex fsigned-char
1881 Let the type @code{char} be signed, like @code{signed char}.
1883 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1884 the negative form of @option{-funsigned-char}. Likewise, the option
1885 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1887 @item -fsigned-bitfields
1888 @itemx -funsigned-bitfields
1889 @itemx -fno-signed-bitfields
1890 @itemx -fno-unsigned-bitfields
1891 @opindex fsigned-bitfields
1892 @opindex funsigned-bitfields
1893 @opindex fno-signed-bitfields
1894 @opindex fno-unsigned-bitfields
1895 These options control whether a bit-field is signed or unsigned, when the
1896 declaration does not use either @code{signed} or @code{unsigned}. By
1897 default, such a bit-field is signed, because this is consistent: the
1898 basic integer types such as @code{int} are signed types.
1901 @node C++ Dialect Options
1902 @section Options Controlling C++ Dialect
1904 @cindex compiler options, C++
1905 @cindex C++ options, command-line
1906 @cindex options, C++
1907 This section describes the command-line options that are only meaningful
1908 for C++ programs. You can also use most of the GNU compiler options
1909 regardless of what language your program is in. For example, you
1910 might compile a file @code{firstClass.C} like this:
1913 g++ -g -frepo -O -c firstClass.C
1917 In this example, only @option{-frepo} is an option meant
1918 only for C++ programs; you can use the other options with any
1919 language supported by GCC@.
1921 Here is a list of options that are @emph{only} for compiling C++ programs:
1925 @item -fabi-version=@var{n}
1926 @opindex fabi-version
1927 Use version @var{n} of the C++ ABI@. The default is version 2.
1929 Version 0 refers to the version conforming most closely to
1930 the C++ ABI specification. Therefore, the ABI obtained using version 0
1931 will change in different versions of G++ as ABI bugs are fixed.
1933 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
1935 Version 2 is the version of the C++ ABI that first appeared in G++ 3.4.
1937 Version 3 corrects an error in mangling a constant address as a
1940 Version 4, which first appeared in G++ 4.5, implements a standard
1941 mangling for vector types.
1943 Version 5, which first appeared in G++ 4.6, corrects the mangling of
1944 attribute const/volatile on function pointer types, decltype of a
1945 plain decl, and use of a function parameter in the declaration of
1948 Version 6, which first appeared in G++ 4.7, corrects the promotion
1949 behavior of C++11 scoped enums and the mangling of template argument
1950 packs, const/static_cast, prefix ++ and --, and a class scope function
1951 used as a template argument.
1953 See also @option{-Wabi}.
1955 @item -fno-access-control
1956 @opindex fno-access-control
1957 Turn off all access checking. This switch is mainly useful for working
1958 around bugs in the access control code.
1962 Check that the pointer returned by @code{operator new} is non-null
1963 before attempting to modify the storage allocated. This check is
1964 normally unnecessary because the C++ standard specifies that
1965 @code{operator new} only returns @code{0} if it is declared
1966 @samp{throw()}, in which case the compiler always checks the
1967 return value even without this option. In all other cases, when
1968 @code{operator new} has a non-empty exception specification, memory
1969 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1970 @samp{new (nothrow)}.
1972 @item -fconstexpr-depth=@var{n}
1973 @opindex fconstexpr-depth
1974 Set the maximum nested evaluation depth for C++11 constexpr functions
1975 to @var{n}. A limit is needed to detect endless recursion during
1976 constant expression evaluation. The minimum specified by the standard
1979 @item -fdeduce-init-list
1980 @opindex fdeduce-init-list
1981 Enable deduction of a template type parameter as
1982 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
1985 template <class T> auto forward(T t) -> decltype (realfn (t))
1992 forward(@{1,2@}); // call forward<std::initializer_list<int>>
1996 This deduction was implemented as a possible extension to the
1997 originally proposed semantics for the C++11 standard, but was not part
1998 of the final standard, so it is disabled by default. This option is
1999 deprecated, and may be removed in a future version of G++.
2001 @item -ffriend-injection
2002 @opindex ffriend-injection
2003 Inject friend functions into the enclosing namespace, so that they are
2004 visible outside the scope of the class in which they are declared.
2005 Friend functions were documented to work this way in the old Annotated
2006 C++ Reference Manual, and versions of G++ before 4.1 always worked
2007 that way. However, in ISO C++ a friend function that is not declared
2008 in an enclosing scope can only be found using argument dependent
2009 lookup. This option causes friends to be injected as they were in
2012 This option is for compatibility, and may be removed in a future
2015 @item -fno-elide-constructors
2016 @opindex fno-elide-constructors
2017 The C++ standard allows an implementation to omit creating a temporary
2018 that is only used to initialize another object of the same type.
2019 Specifying this option disables that optimization, and forces G++ to
2020 call the copy constructor in all cases.
2022 @item -fno-enforce-eh-specs
2023 @opindex fno-enforce-eh-specs
2024 Don't generate code to check for violation of exception specifications
2025 at run time. This option violates the C++ standard, but may be useful
2026 for reducing code size in production builds, much like defining
2027 @samp{NDEBUG}. This does not give user code permission to throw
2028 exceptions in violation of the exception specifications; the compiler
2029 still optimizes based on the specifications, so throwing an
2030 unexpected exception results in undefined behavior at run time.
2032 @item -fextern-tls-init
2033 @itemx -fno-extern-tls-init
2034 @opindex fextern-tls-init
2035 @opindex fno-extern-tls-init
2036 The C++11 and OpenMP standards allow @samp{thread_local} and
2037 @samp{threadprivate} variables to have dynamic (runtime)
2038 initialization. To support this, any use of such a variable goes
2039 through a wrapper function that performs any necessary initialization.
2040 When the use and definition of the variable are in the same
2041 translation unit, this overhead can be optimized away, but when the
2042 use is in a different translation unit there is significant overhead
2043 even if the variable doesn't actually need dynamic initialization. If
2044 the programmer can be sure that no use of the variable in a
2045 non-defining TU needs to trigger dynamic initialization (either
2046 because the variable is statically initialized, or a use of the
2047 variable in the defining TU will be executed before any uses in
2048 another TU), they can avoid this overhead with the
2049 @option{-fno-extern-tls-init} option.
2051 On targets that support symbol aliases, the default is
2052 @option{-fextern-tls-init}. On targets that do not support symbol
2053 aliases, the default is @option{-fno-extern-tls-init}.
2056 @itemx -fno-for-scope
2058 @opindex fno-for-scope
2059 If @option{-ffor-scope} is specified, the scope of variables declared in
2060 a @i{for-init-statement} is limited to the @samp{for} loop itself,
2061 as specified by the C++ standard.
2062 If @option{-fno-for-scope} is specified, the scope of variables declared in
2063 a @i{for-init-statement} extends to the end of the enclosing scope,
2064 as was the case in old versions of G++, and other (traditional)
2065 implementations of C++.
2067 If neither flag is given, the default is to follow the standard,
2068 but to allow and give a warning for old-style code that would
2069 otherwise be invalid, or have different behavior.
2071 @item -fno-gnu-keywords
2072 @opindex fno-gnu-keywords
2073 Do not recognize @code{typeof} as a keyword, so that code can use this
2074 word as an identifier. You can use the keyword @code{__typeof__} instead.
2075 @option{-ansi} implies @option{-fno-gnu-keywords}.
2077 @item -fno-implicit-templates
2078 @opindex fno-implicit-templates
2079 Never emit code for non-inline templates that are instantiated
2080 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2081 @xref{Template Instantiation}, for more information.
2083 @item -fno-implicit-inline-templates
2084 @opindex fno-implicit-inline-templates
2085 Don't emit code for implicit instantiations of inline templates, either.
2086 The default is to handle inlines differently so that compiles with and
2087 without optimization need the same set of explicit instantiations.
2089 @item -fno-implement-inlines
2090 @opindex fno-implement-inlines
2091 To save space, do not emit out-of-line copies of inline functions
2092 controlled by @samp{#pragma implementation}. This causes linker
2093 errors if these functions are not inlined everywhere they are called.
2095 @item -fms-extensions
2096 @opindex fms-extensions
2097 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2098 int and getting a pointer to member function via non-standard syntax.
2100 @item -fno-nonansi-builtins
2101 @opindex fno-nonansi-builtins
2102 Disable built-in declarations of functions that are not mandated by
2103 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2104 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2107 @opindex fnothrow-opt
2108 Treat a @code{throw()} exception specification as if it were a
2109 @code{noexcept} specification to reduce or eliminate the text size
2110 overhead relative to a function with no exception specification. If
2111 the function has local variables of types with non-trivial
2112 destructors, the exception specification actually makes the
2113 function smaller because the EH cleanups for those variables can be
2114 optimized away. The semantic effect is that an exception thrown out of
2115 a function with such an exception specification results in a call
2116 to @code{terminate} rather than @code{unexpected}.
2118 @item -fno-operator-names
2119 @opindex fno-operator-names
2120 Do not treat the operator name keywords @code{and}, @code{bitand},
2121 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2122 synonyms as keywords.
2124 @item -fno-optional-diags
2125 @opindex fno-optional-diags
2126 Disable diagnostics that the standard says a compiler does not need to
2127 issue. Currently, the only such diagnostic issued by G++ is the one for
2128 a name having multiple meanings within a class.
2131 @opindex fpermissive
2132 Downgrade some diagnostics about nonconformant code from errors to
2133 warnings. Thus, using @option{-fpermissive} allows some
2134 nonconforming code to compile.
2136 @item -fno-pretty-templates
2137 @opindex fno-pretty-templates
2138 When an error message refers to a specialization of a function
2139 template, the compiler normally prints the signature of the
2140 template followed by the template arguments and any typedefs or
2141 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2142 rather than @code{void f(int)}) so that it's clear which template is
2143 involved. When an error message refers to a specialization of a class
2144 template, the compiler omits any template arguments that match
2145 the default template arguments for that template. If either of these
2146 behaviors make it harder to understand the error message rather than
2147 easier, you can use @option{-fno-pretty-templates} to disable them.
2151 Enable automatic template instantiation at link time. This option also
2152 implies @option{-fno-implicit-templates}. @xref{Template
2153 Instantiation}, for more information.
2157 Disable generation of information about every class with virtual
2158 functions for use by the C++ run-time type identification features
2159 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
2160 of the language, you can save some space by using this flag. Note that
2161 exception handling uses the same information, but G++ generates it as
2162 needed. The @samp{dynamic_cast} operator can still be used for casts that
2163 do not require run-time type information, i.e.@: casts to @code{void *} or to
2164 unambiguous base classes.
2168 Emit statistics about front-end processing at the end of the compilation.
2169 This information is generally only useful to the G++ development team.
2171 @item -fstrict-enums
2172 @opindex fstrict-enums
2173 Allow the compiler to optimize using the assumption that a value of
2174 enumerated type can only be one of the values of the enumeration (as
2175 defined in the C++ standard; basically, a value that can be
2176 represented in the minimum number of bits needed to represent all the
2177 enumerators). This assumption may not be valid if the program uses a
2178 cast to convert an arbitrary integer value to the enumerated type.
2180 @item -ftemplate-backtrace-limit=@var{n}
2181 @opindex ftemplate-backtrace-limit
2182 Set the maximum number of template instantiation notes for a single
2183 warning or error to @var{n}. The default value is 10.
2185 @item -ftemplate-depth=@var{n}
2186 @opindex ftemplate-depth
2187 Set the maximum instantiation depth for template classes to @var{n}.
2188 A limit on the template instantiation depth is needed to detect
2189 endless recursions during template class instantiation. ANSI/ISO C++
2190 conforming programs must not rely on a maximum depth greater than 17
2191 (changed to 1024 in C++11). The default value is 900, as the compiler
2192 can run out of stack space before hitting 1024 in some situations.
2194 @item -fno-threadsafe-statics
2195 @opindex fno-threadsafe-statics
2196 Do not emit the extra code to use the routines specified in the C++
2197 ABI for thread-safe initialization of local statics. You can use this
2198 option to reduce code size slightly in code that doesn't need to be
2201 @item -fuse-cxa-atexit
2202 @opindex fuse-cxa-atexit
2203 Register destructors for objects with static storage duration with the
2204 @code{__cxa_atexit} function rather than the @code{atexit} function.
2205 This option is required for fully standards-compliant handling of static
2206 destructors, but only works if your C library supports
2207 @code{__cxa_atexit}.
2209 @item -fno-use-cxa-get-exception-ptr
2210 @opindex fno-use-cxa-get-exception-ptr
2211 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2212 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2213 if the runtime routine is not available.
2215 @item -fvisibility-inlines-hidden
2216 @opindex fvisibility-inlines-hidden
2217 This switch declares that the user does not attempt to compare
2218 pointers to inline functions or methods where the addresses of the two functions
2219 are taken in different shared objects.
2221 The effect of this is that GCC may, effectively, mark inline methods with
2222 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2223 appear in the export table of a DSO and do not require a PLT indirection
2224 when used within the DSO@. Enabling this option can have a dramatic effect
2225 on load and link times of a DSO as it massively reduces the size of the
2226 dynamic export table when the library makes heavy use of templates.
2228 The behavior of this switch is not quite the same as marking the
2229 methods as hidden directly, because it does not affect static variables
2230 local to the function or cause the compiler to deduce that
2231 the function is defined in only one shared object.
2233 You may mark a method as having a visibility explicitly to negate the
2234 effect of the switch for that method. For example, if you do want to
2235 compare pointers to a particular inline method, you might mark it as
2236 having default visibility. Marking the enclosing class with explicit
2237 visibility has no effect.
2239 Explicitly instantiated inline methods are unaffected by this option
2240 as their linkage might otherwise cross a shared library boundary.
2241 @xref{Template Instantiation}.
2243 @item -fvisibility-ms-compat
2244 @opindex fvisibility-ms-compat
2245 This flag attempts to use visibility settings to make GCC's C++
2246 linkage model compatible with that of Microsoft Visual Studio.
2248 The flag makes these changes to GCC's linkage model:
2252 It sets the default visibility to @code{hidden}, like
2253 @option{-fvisibility=hidden}.
2256 Types, but not their members, are not hidden by default.
2259 The One Definition Rule is relaxed for types without explicit
2260 visibility specifications that are defined in more than one
2261 shared object: those declarations are permitted if they are
2262 permitted when this option is not used.
2265 In new code it is better to use @option{-fvisibility=hidden} and
2266 export those classes that are intended to be externally visible.
2267 Unfortunately it is possible for code to rely, perhaps accidentally,
2268 on the Visual Studio behavior.
2270 Among the consequences of these changes are that static data members
2271 of the same type with the same name but defined in different shared
2272 objects are different, so changing one does not change the other;
2273 and that pointers to function members defined in different shared
2274 objects may not compare equal. When this flag is given, it is a
2275 violation of the ODR to define types with the same name differently.
2279 Do not use weak symbol support, even if it is provided by the linker.
2280 By default, G++ uses weak symbols if they are available. This
2281 option exists only for testing, and should not be used by end-users;
2282 it results in inferior code and has no benefits. This option may
2283 be removed in a future release of G++.
2287 Do not search for header files in the standard directories specific to
2288 C++, but do still search the other standard directories. (This option
2289 is used when building the C++ library.)
2292 In addition, these optimization, warning, and code generation options
2293 have meanings only for C++ programs:
2296 @item -fno-default-inline
2297 @opindex fno-default-inline
2298 Do not assume @samp{inline} for functions defined inside a class scope.
2299 @xref{Optimize Options,,Options That Control Optimization}. Note that these
2300 functions have linkage like inline functions; they just aren't
2303 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2306 Warn when G++ generates code that is probably not compatible with the
2307 vendor-neutral C++ ABI@. Although an effort has been made to warn about
2308 all such cases, there are probably some cases that are not warned about,
2309 even though G++ is generating incompatible code. There may also be
2310 cases where warnings are emitted even though the code that is generated
2313 You should rewrite your code to avoid these warnings if you are
2314 concerned about the fact that code generated by G++ may not be binary
2315 compatible with code generated by other compilers.
2317 The known incompatibilities in @option{-fabi-version=2} (the default) include:
2322 A template with a non-type template parameter of reference type is
2323 mangled incorrectly:
2326 template <int &> struct S @{@};
2330 This is fixed in @option{-fabi-version=3}.
2333 SIMD vector types declared using @code{__attribute ((vector_size))} are
2334 mangled in a non-standard way that does not allow for overloading of
2335 functions taking vectors of different sizes.
2337 The mangling is changed in @option{-fabi-version=4}.
2340 The known incompatibilities in @option{-fabi-version=1} include:
2345 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2346 pack data into the same byte as a base class. For example:
2349 struct A @{ virtual void f(); int f1 : 1; @};
2350 struct B : public A @{ int f2 : 1; @};
2354 In this case, G++ places @code{B::f2} into the same byte
2355 as @code{A::f1}; other compilers do not. You can avoid this problem
2356 by explicitly padding @code{A} so that its size is a multiple of the
2357 byte size on your platform; that causes G++ and other compilers to
2358 lay out @code{B} identically.
2361 Incorrect handling of tail-padding for virtual bases. G++ does not use
2362 tail padding when laying out virtual bases. For example:
2365 struct A @{ virtual void f(); char c1; @};
2366 struct B @{ B(); char c2; @};
2367 struct C : public A, public virtual B @{@};
2371 In this case, G++ does not place @code{B} into the tail-padding for
2372 @code{A}; other compilers do. You can avoid this problem by
2373 explicitly padding @code{A} so that its size is a multiple of its
2374 alignment (ignoring virtual base classes); that causes G++ and other
2375 compilers to lay out @code{C} identically.
2378 Incorrect handling of bit-fields with declared widths greater than that
2379 of their underlying types, when the bit-fields appear in a union. For
2383 union U @{ int i : 4096; @};
2387 Assuming that an @code{int} does not have 4096 bits, G++ makes the
2388 union too small by the number of bits in an @code{int}.
2391 Empty classes can be placed at incorrect offsets. For example:
2401 struct C : public B, public A @{@};
2405 G++ places the @code{A} base class of @code{C} at a nonzero offset;
2406 it should be placed at offset zero. G++ mistakenly believes that the
2407 @code{A} data member of @code{B} is already at offset zero.
2410 Names of template functions whose types involve @code{typename} or
2411 template template parameters can be mangled incorrectly.
2414 template <typename Q>
2415 void f(typename Q::X) @{@}
2417 template <template <typename> class Q>
2418 void f(typename Q<int>::X) @{@}
2422 Instantiations of these templates may be mangled incorrectly.
2426 It also warns about psABI-related changes. The known psABI changes at this
2432 For SysV/x86-64, unions with @code{long double} members are
2433 passed in memory as specified in psABI. For example:
2443 @code{union U} is always passed in memory.
2447 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2448 @opindex Wctor-dtor-privacy
2449 @opindex Wno-ctor-dtor-privacy
2450 Warn when a class seems unusable because all the constructors or
2451 destructors in that class are private, and it has neither friends nor
2452 public static member functions.
2454 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2455 @opindex Wdelete-non-virtual-dtor
2456 @opindex Wno-delete-non-virtual-dtor
2457 Warn when @samp{delete} is used to destroy an instance of a class that
2458 has virtual functions and non-virtual destructor. It is unsafe to delete
2459 an instance of a derived class through a pointer to a base class if the
2460 base class does not have a virtual destructor. This warning is enabled
2463 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2464 @opindex Wliteral-suffix
2465 @opindex Wno-literal-suffix
2466 Warn when a string or character literal is followed by a ud-suffix which does
2467 not begin with an underscore. As a conforming extension, GCC treats such
2468 suffixes as separate preprocessing tokens in order to maintain backwards
2469 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2473 #define __STDC_FORMAT_MACROS
2474 #include <inttypes.h>
2479 printf("My int64: %"PRId64"\n", i64);
2483 In this case, @code{PRId64} is treated as a separate preprocessing token.
2485 This warning is enabled by default.
2487 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2489 @opindex Wno-narrowing
2490 Warn when a narrowing conversion prohibited by C++11 occurs within
2494 int i = @{ 2.2 @}; // error: narrowing from double to int
2497 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2499 With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic
2500 required by the standard. Note that this does not affect the meaning
2501 of well-formed code; narrowing conversions are still considered
2502 ill-formed in SFINAE context.
2504 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2506 @opindex Wno-noexcept
2507 Warn when a noexcept-expression evaluates to false because of a call
2508 to a function that does not have a non-throwing exception
2509 specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2510 the compiler to never throw an exception.
2512 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2513 @opindex Wnon-virtual-dtor
2514 @opindex Wno-non-virtual-dtor
2515 Warn when a class has virtual functions and an accessible non-virtual
2516 destructor, in which case it is possible but unsafe to delete
2517 an instance of a derived class through a pointer to the base class.
2518 This warning is also enabled if @option{-Weffc++} is specified.
2520 @item -Wreorder @r{(C++ and Objective-C++ only)}
2522 @opindex Wno-reorder
2523 @cindex reordering, warning
2524 @cindex warning for reordering of member initializers
2525 Warn when the order of member initializers given in the code does not
2526 match the order in which they must be executed. For instance:
2532 A(): j (0), i (1) @{ @}
2537 The compiler rearranges the member initializers for @samp{i}
2538 and @samp{j} to match the declaration order of the members, emitting
2539 a warning to that effect. This warning is enabled by @option{-Wall}.
2541 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2542 @opindex fext-numeric-literals
2543 @opindex fno-ext-numeric-literals
2544 Accept imaginary, fixed-point, or machine-defined
2545 literal number suffixes as GNU extensions.
2546 When this option is turned off these suffixes are treated
2547 as C++11 user-defined literal numeric suffixes.
2548 This is on by default for all pre-C++11 dialects and all GNU dialects:
2549 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2550 @option{-std=gnu++1y}.
2551 This option is off by default
2552 for ISO C++11 onwards (@option{-std=c++11}, ...).
2555 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2558 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2561 Warn about violations of the following style guidelines from Scott Meyers'
2562 @cite{Effective C++, Second Edition} book:
2566 Item 11: Define a copy constructor and an assignment operator for classes
2567 with dynamically-allocated memory.
2570 Item 12: Prefer initialization to assignment in constructors.
2573 Item 14: Make destructors virtual in base classes.
2576 Item 15: Have @code{operator=} return a reference to @code{*this}.
2579 Item 23: Don't try to return a reference when you must return an object.
2583 Also warn about violations of the following style guidelines from
2584 Scott Meyers' @cite{More Effective C++} book:
2588 Item 6: Distinguish between prefix and postfix forms of increment and
2589 decrement operators.
2592 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2596 When selecting this option, be aware that the standard library
2597 headers do not obey all of these guidelines; use @samp{grep -v}
2598 to filter out those warnings.
2600 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2601 @opindex Wstrict-null-sentinel
2602 @opindex Wno-strict-null-sentinel
2603 Warn about the use of an uncasted @code{NULL} as sentinel. When
2604 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2605 to @code{__null}. Although it is a null pointer constant rather than a
2606 null pointer, it is guaranteed to be of the same size as a pointer.
2607 But this use is not portable across different compilers.
2609 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2610 @opindex Wno-non-template-friend
2611 @opindex Wnon-template-friend
2612 Disable warnings when non-templatized friend functions are declared
2613 within a template. Since the advent of explicit template specification
2614 support in G++, if the name of the friend is an unqualified-id (i.e.,
2615 @samp{friend foo(int)}), the C++ language specification demands that the
2616 friend declare or define an ordinary, nontemplate function. (Section
2617 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2618 could be interpreted as a particular specialization of a templatized
2619 function. Because this non-conforming behavior is no longer the default
2620 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2621 check existing code for potential trouble spots and is on by default.
2622 This new compiler behavior can be turned off with
2623 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2624 but disables the helpful warning.
2626 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2627 @opindex Wold-style-cast
2628 @opindex Wno-old-style-cast
2629 Warn if an old-style (C-style) cast to a non-void type is used within
2630 a C++ program. The new-style casts (@samp{dynamic_cast},
2631 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2632 less vulnerable to unintended effects and much easier to search for.
2634 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2635 @opindex Woverloaded-virtual
2636 @opindex Wno-overloaded-virtual
2637 @cindex overloaded virtual function, warning
2638 @cindex warning for overloaded virtual function
2639 Warn when a function declaration hides virtual functions from a
2640 base class. For example, in:
2647 struct B: public A @{
2652 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2663 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2664 @opindex Wno-pmf-conversions
2665 @opindex Wpmf-conversions
2666 Disable the diagnostic for converting a bound pointer to member function
2669 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2670 @opindex Wsign-promo
2671 @opindex Wno-sign-promo
2672 Warn when overload resolution chooses a promotion from unsigned or
2673 enumerated type to a signed type, over a conversion to an unsigned type of
2674 the same size. Previous versions of G++ tried to preserve
2675 unsignedness, but the standard mandates the current behavior.
2678 @node Objective-C and Objective-C++ Dialect Options
2679 @section Options Controlling Objective-C and Objective-C++ Dialects
2681 @cindex compiler options, Objective-C and Objective-C++
2682 @cindex Objective-C and Objective-C++ options, command-line
2683 @cindex options, Objective-C and Objective-C++
2684 (NOTE: This manual does not describe the Objective-C and Objective-C++
2685 languages themselves. @xref{Standards,,Language Standards
2686 Supported by GCC}, for references.)
2688 This section describes the command-line options that are only meaningful
2689 for Objective-C and Objective-C++ programs. You can also use most of
2690 the language-independent GNU compiler options.
2691 For example, you might compile a file @code{some_class.m} like this:
2694 gcc -g -fgnu-runtime -O -c some_class.m
2698 In this example, @option{-fgnu-runtime} is an option meant only for
2699 Objective-C and Objective-C++ programs; you can use the other options with
2700 any language supported by GCC@.
2702 Note that since Objective-C is an extension of the C language, Objective-C
2703 compilations may also use options specific to the C front-end (e.g.,
2704 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2705 C++-specific options (e.g., @option{-Wabi}).
2707 Here is a list of options that are @emph{only} for compiling Objective-C
2708 and Objective-C++ programs:
2711 @item -fconstant-string-class=@var{class-name}
2712 @opindex fconstant-string-class
2713 Use @var{class-name} as the name of the class to instantiate for each
2714 literal string specified with the syntax @code{@@"@dots{}"}. The default
2715 class name is @code{NXConstantString} if the GNU runtime is being used, and
2716 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2717 @option{-fconstant-cfstrings} option, if also present, overrides the
2718 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2719 to be laid out as constant CoreFoundation strings.
2722 @opindex fgnu-runtime
2723 Generate object code compatible with the standard GNU Objective-C
2724 runtime. This is the default for most types of systems.
2726 @item -fnext-runtime
2727 @opindex fnext-runtime
2728 Generate output compatible with the NeXT runtime. This is the default
2729 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2730 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2733 @item -fno-nil-receivers
2734 @opindex fno-nil-receivers
2735 Assume that all Objective-C message dispatches (@code{[receiver
2736 message:arg]}) in this translation unit ensure that the receiver is
2737 not @code{nil}. This allows for more efficient entry points in the
2738 runtime to be used. This option is only available in conjunction with
2739 the NeXT runtime and ABI version 0 or 1.
2741 @item -fobjc-abi-version=@var{n}
2742 @opindex fobjc-abi-version
2743 Use version @var{n} of the Objective-C ABI for the selected runtime.
2744 This option is currently supported only for the NeXT runtime. In that
2745 case, Version 0 is the traditional (32-bit) ABI without support for
2746 properties and other Objective-C 2.0 additions. Version 1 is the
2747 traditional (32-bit) ABI with support for properties and other
2748 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2749 nothing is specified, the default is Version 0 on 32-bit target
2750 machines, and Version 2 on 64-bit target machines.
2752 @item -fobjc-call-cxx-cdtors
2753 @opindex fobjc-call-cxx-cdtors
2754 For each Objective-C class, check if any of its instance variables is a
2755 C++ object with a non-trivial default constructor. If so, synthesize a
2756 special @code{- (id) .cxx_construct} instance method which runs
2757 non-trivial default constructors on any such instance variables, in order,
2758 and then return @code{self}. Similarly, check if any instance variable
2759 is a C++ object with a non-trivial destructor, and if so, synthesize a
2760 special @code{- (void) .cxx_destruct} method which runs
2761 all such default destructors, in reverse order.
2763 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2764 methods thusly generated only operate on instance variables
2765 declared in the current Objective-C class, and not those inherited
2766 from superclasses. It is the responsibility of the Objective-C
2767 runtime to invoke all such methods in an object's inheritance
2768 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
2769 by the runtime immediately after a new object instance is allocated;
2770 the @code{- (void) .cxx_destruct} methods are invoked immediately
2771 before the runtime deallocates an object instance.
2773 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2774 support for invoking the @code{- (id) .cxx_construct} and
2775 @code{- (void) .cxx_destruct} methods.
2777 @item -fobjc-direct-dispatch
2778 @opindex fobjc-direct-dispatch
2779 Allow fast jumps to the message dispatcher. On Darwin this is
2780 accomplished via the comm page.
2782 @item -fobjc-exceptions
2783 @opindex fobjc-exceptions
2784 Enable syntactic support for structured exception handling in
2785 Objective-C, similar to what is offered by C++ and Java. This option
2786 is required to use the Objective-C keywords @code{@@try},
2787 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2788 @code{@@synchronized}. This option is available with both the GNU
2789 runtime and the NeXT runtime (but not available in conjunction with
2790 the NeXT runtime on Mac OS X 10.2 and earlier).
2794 Enable garbage collection (GC) in Objective-C and Objective-C++
2795 programs. This option is only available with the NeXT runtime; the
2796 GNU runtime has a different garbage collection implementation that
2797 does not require special compiler flags.
2799 @item -fobjc-nilcheck
2800 @opindex fobjc-nilcheck
2801 For the NeXT runtime with version 2 of the ABI, check for a nil
2802 receiver in method invocations before doing the actual method call.
2803 This is the default and can be disabled using
2804 @option{-fno-objc-nilcheck}. Class methods and super calls are never
2805 checked for nil in this way no matter what this flag is set to.
2806 Currently this flag does nothing when the GNU runtime, or an older
2807 version of the NeXT runtime ABI, is used.
2809 @item -fobjc-std=objc1
2811 Conform to the language syntax of Objective-C 1.0, the language
2812 recognized by GCC 4.0. This only affects the Objective-C additions to
2813 the C/C++ language; it does not affect conformance to C/C++ standards,
2814 which is controlled by the separate C/C++ dialect option flags. When
2815 this option is used with the Objective-C or Objective-C++ compiler,
2816 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2817 This is useful if you need to make sure that your Objective-C code can
2818 be compiled with older versions of GCC@.
2820 @item -freplace-objc-classes
2821 @opindex freplace-objc-classes
2822 Emit a special marker instructing @command{ld(1)} not to statically link in
2823 the resulting object file, and allow @command{dyld(1)} to load it in at
2824 run time instead. This is used in conjunction with the Fix-and-Continue
2825 debugging mode, where the object file in question may be recompiled and
2826 dynamically reloaded in the course of program execution, without the need
2827 to restart the program itself. Currently, Fix-and-Continue functionality
2828 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2833 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2834 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2835 compile time) with static class references that get initialized at load time,
2836 which improves run-time performance. Specifying the @option{-fzero-link} flag
2837 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2838 to be retained. This is useful in Zero-Link debugging mode, since it allows
2839 for individual class implementations to be modified during program execution.
2840 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2841 regardless of command-line options.
2845 Dump interface declarations for all classes seen in the source file to a
2846 file named @file{@var{sourcename}.decl}.
2848 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2849 @opindex Wassign-intercept
2850 @opindex Wno-assign-intercept
2851 Warn whenever an Objective-C assignment is being intercepted by the
2854 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2855 @opindex Wno-protocol
2857 If a class is declared to implement a protocol, a warning is issued for
2858 every method in the protocol that is not implemented by the class. The
2859 default behavior is to issue a warning for every method not explicitly
2860 implemented in the class, even if a method implementation is inherited
2861 from the superclass. If you use the @option{-Wno-protocol} option, then
2862 methods inherited from the superclass are considered to be implemented,
2863 and no warning is issued for them.
2865 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2867 @opindex Wno-selector
2868 Warn if multiple methods of different types for the same selector are
2869 found during compilation. The check is performed on the list of methods
2870 in the final stage of compilation. Additionally, a check is performed
2871 for each selector appearing in a @code{@@selector(@dots{})}
2872 expression, and a corresponding method for that selector has been found
2873 during compilation. Because these checks scan the method table only at
2874 the end of compilation, these warnings are not produced if the final
2875 stage of compilation is not reached, for example because an error is
2876 found during compilation, or because the @option{-fsyntax-only} option is
2879 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2880 @opindex Wstrict-selector-match
2881 @opindex Wno-strict-selector-match
2882 Warn if multiple methods with differing argument and/or return types are
2883 found for a given selector when attempting to send a message using this
2884 selector to a receiver of type @code{id} or @code{Class}. When this flag
2885 is off (which is the default behavior), the compiler omits such warnings
2886 if any differences found are confined to types that share the same size
2889 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2890 @opindex Wundeclared-selector
2891 @opindex Wno-undeclared-selector
2892 Warn if a @code{@@selector(@dots{})} expression referring to an
2893 undeclared selector is found. A selector is considered undeclared if no
2894 method with that name has been declared before the
2895 @code{@@selector(@dots{})} expression, either explicitly in an
2896 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2897 an @code{@@implementation} section. This option always performs its
2898 checks as soon as a @code{@@selector(@dots{})} expression is found,
2899 while @option{-Wselector} only performs its checks in the final stage of
2900 compilation. This also enforces the coding style convention
2901 that methods and selectors must be declared before being used.
2903 @item -print-objc-runtime-info
2904 @opindex print-objc-runtime-info
2905 Generate C header describing the largest structure that is passed by
2910 @node Language Independent Options
2911 @section Options to Control Diagnostic Messages Formatting
2912 @cindex options to control diagnostics formatting
2913 @cindex diagnostic messages
2914 @cindex message formatting
2916 Traditionally, diagnostic messages have been formatted irrespective of
2917 the output device's aspect (e.g.@: its width, @dots{}). You can use the
2918 options described below
2919 to control the formatting algorithm for diagnostic messages,
2920 e.g.@: how many characters per line, how often source location
2921 information should be reported. Note that some language front ends may not
2922 honor these options.
2925 @item -fmessage-length=@var{n}
2926 @opindex fmessage-length
2927 Try to format error messages so that they fit on lines of about @var{n}
2928 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2929 the front ends supported by GCC@. If @var{n} is zero, then no
2930 line-wrapping is done; each error message appears on a single
2933 @item -fdiagnostics-show-location=once
2934 @opindex fdiagnostics-show-location
2935 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2936 reporter to emit source location information @emph{once}; that is, in
2937 case the message is too long to fit on a single physical line and has to
2938 be wrapped, the source location won't be emitted (as prefix) again,
2939 over and over, in subsequent continuation lines. This is the default
2942 @item -fdiagnostics-show-location=every-line
2943 Only meaningful in line-wrapping mode. Instructs the diagnostic
2944 messages reporter to emit the same source location information (as
2945 prefix) for physical lines that result from the process of breaking
2946 a message which is too long to fit on a single line.
2948 @item -fno-diagnostics-show-option
2949 @opindex fno-diagnostics-show-option
2950 @opindex fdiagnostics-show-option
2951 By default, each diagnostic emitted includes text indicating the
2952 command-line option that directly controls the diagnostic (if such an
2953 option is known to the diagnostic machinery). Specifying the
2954 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
2956 @item -fno-diagnostics-show-caret
2957 @opindex fno-diagnostics-show-caret
2958 @opindex fdiagnostics-show-caret
2959 By default, each diagnostic emitted includes the original source line
2960 and a caret '^' indicating the column. This option suppresses this
2965 @node Warning Options
2966 @section Options to Request or Suppress Warnings
2967 @cindex options to control warnings
2968 @cindex warning messages
2969 @cindex messages, warning
2970 @cindex suppressing warnings
2972 Warnings are diagnostic messages that report constructions that
2973 are not inherently erroneous but that are risky or suggest there
2974 may have been an error.
2976 The following language-independent options do not enable specific
2977 warnings but control the kinds of diagnostics produced by GCC@.
2980 @cindex syntax checking
2982 @opindex fsyntax-only
2983 Check the code for syntax errors, but don't do anything beyond that.
2985 @item -fmax-errors=@var{n}
2986 @opindex fmax-errors
2987 Limits the maximum number of error messages to @var{n}, at which point
2988 GCC bails out rather than attempting to continue processing the source
2989 code. If @var{n} is 0 (the default), there is no limit on the number
2990 of error messages produced. If @option{-Wfatal-errors} is also
2991 specified, then @option{-Wfatal-errors} takes precedence over this
2996 Inhibit all warning messages.
3001 Make all warnings into errors.
3006 Make the specified warning into an error. The specifier for a warning
3007 is appended; for example @option{-Werror=switch} turns the warnings
3008 controlled by @option{-Wswitch} into errors. This switch takes a
3009 negative form, to be used to negate @option{-Werror} for specific
3010 warnings; for example @option{-Wno-error=switch} makes
3011 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3014 The warning message for each controllable warning includes the
3015 option that controls the warning. That option can then be used with
3016 @option{-Werror=} and @option{-Wno-error=} as described above.
3017 (Printing of the option in the warning message can be disabled using the
3018 @option{-fno-diagnostics-show-option} flag.)
3020 Note that specifying @option{-Werror=}@var{foo} automatically implies
3021 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3024 @item -Wfatal-errors
3025 @opindex Wfatal-errors
3026 @opindex Wno-fatal-errors
3027 This option causes the compiler to abort compilation on the first error
3028 occurred rather than trying to keep going and printing further error
3033 You can request many specific warnings with options beginning with
3034 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3035 implicit declarations. Each of these specific warning options also
3036 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3037 example, @option{-Wno-implicit}. This manual lists only one of the
3038 two forms, whichever is not the default. For further
3039 language-specific options also refer to @ref{C++ Dialect Options} and
3040 @ref{Objective-C and Objective-C++ Dialect Options}.
3042 When an unrecognized warning option is requested (e.g.,
3043 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3044 that the option is not recognized. However, if the @option{-Wno-} form
3045 is used, the behavior is slightly different: no diagnostic is
3046 produced for @option{-Wno-unknown-warning} unless other diagnostics
3047 are being produced. This allows the use of new @option{-Wno-} options
3048 with old compilers, but if something goes wrong, the compiler
3049 warns that an unrecognized option is present.
3056 Issue all the warnings demanded by strict ISO C and ISO C++;
3057 reject all programs that use forbidden extensions, and some other
3058 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3059 version of the ISO C standard specified by any @option{-std} option used.
3061 Valid ISO C and ISO C++ programs should compile properly with or without
3062 this option (though a rare few require @option{-ansi} or a
3063 @option{-std} option specifying the required version of ISO C)@. However,
3064 without this option, certain GNU extensions and traditional C and C++
3065 features are supported as well. With this option, they are rejected.
3067 @option{-Wpedantic} does not cause warning messages for use of the
3068 alternate keywords whose names begin and end with @samp{__}. Pedantic
3069 warnings are also disabled in the expression that follows
3070 @code{__extension__}. However, only system header files should use
3071 these escape routes; application programs should avoid them.
3072 @xref{Alternate Keywords}.
3074 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3075 C conformance. They soon find that it does not do quite what they want:
3076 it finds some non-ISO practices, but not all---only those for which
3077 ISO C @emph{requires} a diagnostic, and some others for which
3078 diagnostics have been added.
3080 A feature to report any failure to conform to ISO C might be useful in
3081 some instances, but would require considerable additional work and would
3082 be quite different from @option{-Wpedantic}. We don't have plans to
3083 support such a feature in the near future.
3085 Where the standard specified with @option{-std} represents a GNU
3086 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3087 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3088 extended dialect is based. Warnings from @option{-Wpedantic} are given
3089 where they are required by the base standard. (It does not make sense
3090 for such warnings to be given only for features not in the specified GNU
3091 C dialect, since by definition the GNU dialects of C include all
3092 features the compiler supports with the given option, and there would be
3093 nothing to warn about.)
3095 @item -pedantic-errors
3096 @opindex pedantic-errors
3097 Like @option{-Wpedantic}, except that errors are produced rather than
3103 This enables all the warnings about constructions that some users
3104 consider questionable, and that are easy to avoid (or modify to
3105 prevent the warning), even in conjunction with macros. This also
3106 enables some language-specific warnings described in @ref{C++ Dialect
3107 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3109 @option{-Wall} turns on the following warning flags:
3111 @gccoptlist{-Waddress @gol
3112 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
3114 -Wchar-subscripts @gol
3115 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3116 -Wimplicit-int @r{(C and Objective-C only)} @gol
3117 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3120 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3121 -Wmaybe-uninitialized @gol
3122 -Wmissing-braces @r{(only for C/ObjC)} @gol
3128 -Wsequence-point @gol
3129 -Wsign-compare @r{(only in C++)} @gol
3130 -Wstrict-aliasing @gol
3131 -Wstrict-overflow=1 @gol
3134 -Wuninitialized @gol
3135 -Wunknown-pragmas @gol
3136 -Wunused-function @gol
3139 -Wunused-variable @gol
3140 -Wvolatile-register-var @gol
3143 Note that some warning flags are not implied by @option{-Wall}. Some of
3144 them warn about constructions that users generally do not consider
3145 questionable, but which occasionally you might wish to check for;
3146 others warn about constructions that are necessary or hard to avoid in
3147 some cases, and there is no simple way to modify the code to suppress
3148 the warning. Some of them are enabled by @option{-Wextra} but many of
3149 them must be enabled individually.
3155 This enables some extra warning flags that are not enabled by
3156 @option{-Wall}. (This option used to be called @option{-W}. The older
3157 name is still supported, but the newer name is more descriptive.)
3159 @gccoptlist{-Wclobbered @gol
3161 -Wignored-qualifiers @gol
3162 -Wmissing-field-initializers @gol
3163 -Wmissing-parameter-type @r{(C only)} @gol
3164 -Wold-style-declaration @r{(C only)} @gol
3165 -Woverride-init @gol
3168 -Wuninitialized @gol
3169 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3170 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3173 The option @option{-Wextra} also prints warning messages for the
3179 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3180 @samp{>}, or @samp{>=}.
3183 (C++ only) An enumerator and a non-enumerator both appear in a
3184 conditional expression.
3187 (C++ only) Ambiguous virtual bases.
3190 (C++ only) Subscripting an array that has been declared @samp{register}.
3193 (C++ only) Taking the address of a variable that has been declared
3197 (C++ only) A base class is not initialized in a derived class's copy
3202 @item -Wchar-subscripts
3203 @opindex Wchar-subscripts
3204 @opindex Wno-char-subscripts
3205 Warn if an array subscript has type @code{char}. This is a common cause
3206 of error, as programmers often forget that this type is signed on some
3208 This warning is enabled by @option{-Wall}.
3212 @opindex Wno-comment
3213 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3214 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3215 This warning is enabled by @option{-Wall}.
3217 @item -Wno-coverage-mismatch
3218 @opindex Wno-coverage-mismatch
3219 Warn if feedback profiles do not match when using the
3220 @option{-fprofile-use} option.
3221 If a source file is changed between compiling with @option{-fprofile-gen} and
3222 with @option{-fprofile-use}, the files with the profile feedback can fail
3223 to match the source file and GCC cannot use the profile feedback
3224 information. By default, this warning is enabled and is treated as an
3225 error. @option{-Wno-coverage-mismatch} can be used to disable the
3226 warning or @option{-Wno-error=coverage-mismatch} can be used to
3227 disable the error. Disabling the error for this warning can result in
3228 poorly optimized code and is useful only in the
3229 case of very minor changes such as bug fixes to an existing code-base.
3230 Completely disabling the warning is not recommended.
3233 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3235 Suppress warning messages emitted by @code{#warning} directives.
3237 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3238 @opindex Wdouble-promotion
3239 @opindex Wno-double-promotion
3240 Give a warning when a value of type @code{float} is implicitly
3241 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3242 floating-point unit implement @code{float} in hardware, but emulate
3243 @code{double} in software. On such a machine, doing computations
3244 using @code{double} values is much more expensive because of the
3245 overhead required for software emulation.
3247 It is easy to accidentally do computations with @code{double} because
3248 floating-point literals are implicitly of type @code{double}. For
3252 float area(float radius)
3254 return 3.14159 * radius * radius;
3258 the compiler performs the entire computation with @code{double}
3259 because the floating-point literal is a @code{double}.
3262 @itemx -Wformat=@var{n}
3265 @opindex ffreestanding
3266 @opindex fno-builtin
3268 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3269 the arguments supplied have types appropriate to the format string
3270 specified, and that the conversions specified in the format string make
3271 sense. This includes standard functions, and others specified by format
3272 attributes (@pxref{Function Attributes}), in the @code{printf},
3273 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3274 not in the C standard) families (or other target-specific families).
3275 Which functions are checked without format attributes having been
3276 specified depends on the standard version selected, and such checks of
3277 functions without the attribute specified are disabled by
3278 @option{-ffreestanding} or @option{-fno-builtin}.
3280 The formats are checked against the format features supported by GNU
3281 libc version 2.2. These include all ISO C90 and C99 features, as well
3282 as features from the Single Unix Specification and some BSD and GNU
3283 extensions. Other library implementations may not support all these
3284 features; GCC does not support warning about features that go beyond a
3285 particular library's limitations. However, if @option{-Wpedantic} is used
3286 with @option{-Wformat}, warnings are given about format features not
3287 in the selected standard version (but not for @code{strfmon} formats,
3288 since those are not in any version of the C standard). @xref{C Dialect
3289 Options,,Options Controlling C Dialect}.
3294 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3295 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3296 @option{-Wformat} also checks for null format arguments for several
3297 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3298 aspects of this level of format checking can be disabled by the
3299 options: @option{-Wno-format-contains-nul},
3300 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3301 @option{-Wformat} is enabled by @option{-Wall}.
3303 @item -Wno-format-contains-nul
3304 @opindex Wno-format-contains-nul
3305 @opindex Wformat-contains-nul
3306 If @option{-Wformat} is specified, do not warn about format strings that
3309 @item -Wno-format-extra-args
3310 @opindex Wno-format-extra-args
3311 @opindex Wformat-extra-args
3312 If @option{-Wformat} is specified, do not warn about excess arguments to a
3313 @code{printf} or @code{scanf} format function. The C standard specifies
3314 that such arguments are ignored.
3316 Where the unused arguments lie between used arguments that are
3317 specified with @samp{$} operand number specifications, normally
3318 warnings are still given, since the implementation could not know what
3319 type to pass to @code{va_arg} to skip the unused arguments. However,
3320 in the case of @code{scanf} formats, this option suppresses the
3321 warning if the unused arguments are all pointers, since the Single
3322 Unix Specification says that such unused arguments are allowed.
3324 @item -Wno-format-zero-length
3325 @opindex Wno-format-zero-length
3326 @opindex Wformat-zero-length
3327 If @option{-Wformat} is specified, do not warn about zero-length formats.
3328 The C standard specifies that zero-length formats are allowed.
3332 Enable @option{-Wformat} plus additional format checks. Currently
3333 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3336 @item -Wformat-nonliteral
3337 @opindex Wformat-nonliteral
3338 @opindex Wno-format-nonliteral
3339 If @option{-Wformat} is specified, also warn if the format string is not a
3340 string literal and so cannot be checked, unless the format function
3341 takes its format arguments as a @code{va_list}.
3343 @item -Wformat-security
3344 @opindex Wformat-security
3345 @opindex Wno-format-security
3346 If @option{-Wformat} is specified, also warn about uses of format
3347 functions that represent possible security problems. At present, this
3348 warns about calls to @code{printf} and @code{scanf} functions where the
3349 format string is not a string literal and there are no format arguments,
3350 as in @code{printf (foo);}. This may be a security hole if the format
3351 string came from untrusted input and contains @samp{%n}. (This is
3352 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3353 in future warnings may be added to @option{-Wformat-security} that are not
3354 included in @option{-Wformat-nonliteral}.)
3357 @opindex Wformat-y2k
3358 @opindex Wno-format-y2k
3359 If @option{-Wformat} is specified, also warn about @code{strftime}
3360 formats that may yield only a two-digit year.
3365 @opindex Wno-nonnull
3366 Warn about passing a null pointer for arguments marked as
3367 requiring a non-null value by the @code{nonnull} function attribute.
3369 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3370 can be disabled with the @option{-Wno-nonnull} option.
3372 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3374 @opindex Wno-init-self
3375 Warn about uninitialized variables that are initialized with themselves.
3376 Note this option can only be used with the @option{-Wuninitialized} option.
3378 For example, GCC warns about @code{i} being uninitialized in the
3379 following snippet only when @option{-Winit-self} has been specified:
3390 This warning is enabled by @option{-Wall} in C++.
3392 @item -Wimplicit-int @r{(C and Objective-C only)}
3393 @opindex Wimplicit-int
3394 @opindex Wno-implicit-int
3395 Warn when a declaration does not specify a type.
3396 This warning is enabled by @option{-Wall}.
3398 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3399 @opindex Wimplicit-function-declaration
3400 @opindex Wno-implicit-function-declaration
3401 Give a warning whenever a function is used before being declared. In
3402 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3403 enabled by default and it is made into an error by
3404 @option{-pedantic-errors}. This warning is also enabled by
3407 @item -Wimplicit @r{(C and Objective-C only)}
3409 @opindex Wno-implicit
3410 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3411 This warning is enabled by @option{-Wall}.
3413 @item -Wignored-qualifiers @r{(C and C++ only)}
3414 @opindex Wignored-qualifiers
3415 @opindex Wno-ignored-qualifiers
3416 Warn if the return type of a function has a type qualifier
3417 such as @code{const}. For ISO C such a type qualifier has no effect,
3418 since the value returned by a function is not an lvalue.
3419 For C++, the warning is only emitted for scalar types or @code{void}.
3420 ISO C prohibits qualified @code{void} return types on function
3421 definitions, so such return types always receive a warning
3422 even without this option.
3424 This warning is also enabled by @option{-Wextra}.
3429 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3430 a function with external linkage, returning int, taking either zero
3431 arguments, two, or three arguments of appropriate types. This warning
3432 is enabled by default in C++ and is enabled by either @option{-Wall}
3433 or @option{-Wpedantic}.
3435 @item -Wmissing-braces
3436 @opindex Wmissing-braces
3437 @opindex Wno-missing-braces
3438 Warn if an aggregate or union initializer is not fully bracketed. In
3439 the following example, the initializer for @samp{a} is not fully
3440 bracketed, but that for @samp{b} is fully bracketed. This warning is
3441 enabled by @option{-Wall} in C.
3444 int a[2][2] = @{ 0, 1, 2, 3 @};
3445 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3448 This warning is enabled by @option{-Wall}.
3450 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3451 @opindex Wmissing-include-dirs
3452 @opindex Wno-missing-include-dirs
3453 Warn if a user-supplied include directory does not exist.
3456 @opindex Wparentheses
3457 @opindex Wno-parentheses
3458 Warn if parentheses are omitted in certain contexts, such
3459 as when there is an assignment in a context where a truth value
3460 is expected, or when operators are nested whose precedence people
3461 often get confused about.
3463 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3464 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3465 interpretation from that of ordinary mathematical notation.
3467 Also warn about constructions where there may be confusion to which
3468 @code{if} statement an @code{else} branch belongs. Here is an example of
3483 In C/C++, every @code{else} branch belongs to the innermost possible
3484 @code{if} statement, which in this example is @code{if (b)}. This is
3485 often not what the programmer expected, as illustrated in the above
3486 example by indentation the programmer chose. When there is the
3487 potential for this confusion, GCC issues a warning when this flag
3488 is specified. To eliminate the warning, add explicit braces around
3489 the innermost @code{if} statement so there is no way the @code{else}
3490 can belong to the enclosing @code{if}. The resulting code
3507 Also warn for dangerous uses of the GNU extension to
3508 @code{?:} with omitted middle operand. When the condition
3509 in the @code{?}: operator is a boolean expression, the omitted value is
3510 always 1. Often programmers expect it to be a value computed
3511 inside the conditional expression instead.
3513 This warning is enabled by @option{-Wall}.
3515 @item -Wsequence-point
3516 @opindex Wsequence-point
3517 @opindex Wno-sequence-point
3518 Warn about code that may have undefined semantics because of violations
3519 of sequence point rules in the C and C++ standards.
3521 The C and C++ standards define the order in which expressions in a C/C++
3522 program are evaluated in terms of @dfn{sequence points}, which represent
3523 a partial ordering between the execution of parts of the program: those
3524 executed before the sequence point, and those executed after it. These
3525 occur after the evaluation of a full expression (one which is not part
3526 of a larger expression), after the evaluation of the first operand of a
3527 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3528 function is called (but after the evaluation of its arguments and the
3529 expression denoting the called function), and in certain other places.
3530 Other than as expressed by the sequence point rules, the order of
3531 evaluation of subexpressions of an expression is not specified. All
3532 these rules describe only a partial order rather than a total order,
3533 since, for example, if two functions are called within one expression
3534 with no sequence point between them, the order in which the functions
3535 are called is not specified. However, the standards committee have
3536 ruled that function calls do not overlap.
3538 It is not specified when between sequence points modifications to the
3539 values of objects take effect. Programs whose behavior depends on this
3540 have undefined behavior; the C and C++ standards specify that ``Between
3541 the previous and next sequence point an object shall have its stored
3542 value modified at most once by the evaluation of an expression.
3543 Furthermore, the prior value shall be read only to determine the value
3544 to be stored.''. If a program breaks these rules, the results on any
3545 particular implementation are entirely unpredictable.
3547 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3548 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3549 diagnosed by this option, and it may give an occasional false positive
3550 result, but in general it has been found fairly effective at detecting
3551 this sort of problem in programs.
3553 The standard is worded confusingly, therefore there is some debate
3554 over the precise meaning of the sequence point rules in subtle cases.
3555 Links to discussions of the problem, including proposed formal
3556 definitions, may be found on the GCC readings page, at
3557 @uref{http://gcc.gnu.org/@/readings.html}.
3559 This warning is enabled by @option{-Wall} for C and C++.
3561 @item -Wno-return-local-addr
3562 @opindex Wno-return-local-addr
3563 @opindex Wreturn-local-addr
3564 Do not warn about returning a pointer (or in C++, a reference) to a
3565 variable that goes out of scope after the function returns.
3568 @opindex Wreturn-type
3569 @opindex Wno-return-type
3570 Warn whenever a function is defined with a return type that defaults
3571 to @code{int}. Also warn about any @code{return} statement with no
3572 return value in a function whose return type is not @code{void}
3573 (falling off the end of the function body is considered returning
3574 without a value), and about a @code{return} statement with an
3575 expression in a function whose return type is @code{void}.
3577 For C++, a function without return type always produces a diagnostic
3578 message, even when @option{-Wno-return-type} is specified. The only
3579 exceptions are @samp{main} and functions defined in system headers.
3581 This warning is enabled by @option{-Wall}.
3586 Warn whenever a @code{switch} statement has an index of enumerated type
3587 and lacks a @code{case} for one or more of the named codes of that
3588 enumeration. (The presence of a @code{default} label prevents this
3589 warning.) @code{case} labels outside the enumeration range also
3590 provoke warnings when this option is used (even if there is a
3591 @code{default} label).
3592 This warning is enabled by @option{-Wall}.
3594 @item -Wswitch-default
3595 @opindex Wswitch-default
3596 @opindex Wno-switch-default
3597 Warn whenever a @code{switch} statement does not have a @code{default}
3601 @opindex Wswitch-enum
3602 @opindex Wno-switch-enum
3603 Warn whenever a @code{switch} statement has an index of enumerated type
3604 and lacks a @code{case} for one or more of the named codes of that
3605 enumeration. @code{case} labels outside the enumeration range also
3606 provoke warnings when this option is used. The only difference
3607 between @option{-Wswitch} and this option is that this option gives a
3608 warning about an omitted enumeration code even if there is a
3609 @code{default} label.
3611 @item -Wsync-nand @r{(C and C++ only)}
3613 @opindex Wno-sync-nand
3614 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3615 built-in functions are used. These functions changed semantics in GCC 4.4.
3619 @opindex Wno-trigraphs
3620 Warn if any trigraphs are encountered that might change the meaning of
3621 the program (trigraphs within comments are not warned about).
3622 This warning is enabled by @option{-Wall}.
3624 @item -Wunused-but-set-parameter
3625 @opindex Wunused-but-set-parameter
3626 @opindex Wno-unused-but-set-parameter
3627 Warn whenever a function parameter is assigned to, but otherwise unused
3628 (aside from its declaration).
3630 To suppress this warning use the @samp{unused} attribute
3631 (@pxref{Variable Attributes}).
3633 This warning is also enabled by @option{-Wunused} together with
3636 @item -Wunused-but-set-variable
3637 @opindex Wunused-but-set-variable
3638 @opindex Wno-unused-but-set-variable
3639 Warn whenever a local variable is assigned to, but otherwise unused
3640 (aside from its declaration).
3641 This warning is enabled by @option{-Wall}.
3643 To suppress this warning use the @samp{unused} attribute
3644 (@pxref{Variable Attributes}).
3646 This warning is also enabled by @option{-Wunused}, which is enabled
3649 @item -Wunused-function
3650 @opindex Wunused-function
3651 @opindex Wno-unused-function
3652 Warn whenever a static function is declared but not defined or a
3653 non-inline static function is unused.
3654 This warning is enabled by @option{-Wall}.
3656 @item -Wunused-label
3657 @opindex Wunused-label
3658 @opindex Wno-unused-label
3659 Warn whenever a label is declared but not used.
3660 This warning is enabled by @option{-Wall}.
3662 To suppress this warning use the @samp{unused} attribute
3663 (@pxref{Variable Attributes}).
3665 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
3666 @opindex Wunused-local-typedefs
3667 Warn when a typedef locally defined in a function is not used.
3668 This warning is enabled by @option{-Wall}.
3670 @item -Wunused-parameter
3671 @opindex Wunused-parameter
3672 @opindex Wno-unused-parameter
3673 Warn whenever a function parameter is unused aside from its declaration.
3675 To suppress this warning use the @samp{unused} attribute
3676 (@pxref{Variable Attributes}).
3678 @item -Wno-unused-result
3679 @opindex Wunused-result
3680 @opindex Wno-unused-result
3681 Do not warn if a caller of a function marked with attribute
3682 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
3683 its return value. The default is @option{-Wunused-result}.
3685 @item -Wunused-variable
3686 @opindex Wunused-variable
3687 @opindex Wno-unused-variable
3688 Warn whenever a local variable or non-constant static variable is unused
3689 aside from its declaration.
3690 This warning is enabled by @option{-Wall}.
3692 To suppress this warning use the @samp{unused} attribute
3693 (@pxref{Variable Attributes}).
3695 @item -Wunused-value
3696 @opindex Wunused-value
3697 @opindex Wno-unused-value
3698 Warn whenever a statement computes a result that is explicitly not
3699 used. To suppress this warning cast the unused expression to
3700 @samp{void}. This includes an expression-statement or the left-hand
3701 side of a comma expression that contains no side effects. For example,
3702 an expression such as @samp{x[i,j]} causes a warning, while
3703 @samp{x[(void)i,j]} does not.
3705 This warning is enabled by @option{-Wall}.
3710 All the above @option{-Wunused} options combined.
3712 In order to get a warning about an unused function parameter, you must
3713 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
3714 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
3716 @item -Wuninitialized
3717 @opindex Wuninitialized
3718 @opindex Wno-uninitialized
3719 Warn if an automatic variable is used without first being initialized
3720 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3721 warn if a non-static reference or non-static @samp{const} member
3722 appears in a class without constructors.
3724 If you want to warn about code that uses the uninitialized value of the
3725 variable in its own initializer, use the @option{-Winit-self} option.
3727 These warnings occur for individual uninitialized or clobbered
3728 elements of structure, union or array variables as well as for
3729 variables that are uninitialized or clobbered as a whole. They do
3730 not occur for variables or elements declared @code{volatile}. Because
3731 these warnings depend on optimization, the exact variables or elements
3732 for which there are warnings depends on the precise optimization
3733 options and version of GCC used.
3735 Note that there may be no warning about a variable that is used only
3736 to compute a value that itself is never used, because such
3737 computations may be deleted by data flow analysis before the warnings
3740 @item -Wmaybe-uninitialized
3741 @opindex Wmaybe-uninitialized
3742 @opindex Wno-maybe-uninitialized
3743 For an automatic variable, if there exists a path from the function
3744 entry to a use of the variable that is initialized, but there exist
3745 some other paths for which the variable is not initialized, the compiler
3746 emits a warning if it cannot prove the uninitialized paths are not
3747 executed at run time. These warnings are made optional because GCC is
3748 not smart enough to see all the reasons why the code might be correct
3749 in spite of appearing to have an error. Here is one example of how
3770 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3771 always initialized, but GCC doesn't know this. To suppress the
3772 warning, you need to provide a default case with assert(0) or
3775 @cindex @code{longjmp} warnings
3776 This option also warns when a non-volatile automatic variable might be
3777 changed by a call to @code{longjmp}. These warnings as well are possible
3778 only in optimizing compilation.
3780 The compiler sees only the calls to @code{setjmp}. It cannot know
3781 where @code{longjmp} will be called; in fact, a signal handler could
3782 call it at any point in the code. As a result, you may get a warning
3783 even when there is in fact no problem because @code{longjmp} cannot
3784 in fact be called at the place that would cause a problem.
3786 Some spurious warnings can be avoided if you declare all the functions
3787 you use that never return as @code{noreturn}. @xref{Function
3790 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3792 @item -Wunknown-pragmas
3793 @opindex Wunknown-pragmas
3794 @opindex Wno-unknown-pragmas
3795 @cindex warning for unknown pragmas
3796 @cindex unknown pragmas, warning
3797 @cindex pragmas, warning of unknown
3798 Warn when a @code{#pragma} directive is encountered that is not understood by
3799 GCC@. If this command-line option is used, warnings are even issued
3800 for unknown pragmas in system header files. This is not the case if
3801 the warnings are only enabled by the @option{-Wall} command-line option.
3804 @opindex Wno-pragmas
3806 Do not warn about misuses of pragmas, such as incorrect parameters,
3807 invalid syntax, or conflicts between pragmas. See also
3808 @option{-Wunknown-pragmas}.
3810 @item -Wstrict-aliasing
3811 @opindex Wstrict-aliasing
3812 @opindex Wno-strict-aliasing
3813 This option is only active when @option{-fstrict-aliasing} is active.
3814 It warns about code that might break the strict aliasing rules that the
3815 compiler is using for optimization. The warning does not catch all
3816 cases, but does attempt to catch the more common pitfalls. It is
3817 included in @option{-Wall}.
3818 It is equivalent to @option{-Wstrict-aliasing=3}
3820 @item -Wstrict-aliasing=n
3821 @opindex Wstrict-aliasing=n
3822 This option is only active when @option{-fstrict-aliasing} is active.
3823 It warns about code that might break the strict aliasing rules that the
3824 compiler is using for optimization.
3825 Higher levels correspond to higher accuracy (fewer false positives).
3826 Higher levels also correspond to more effort, similar to the way @option{-O}
3828 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
3830 Level 1: Most aggressive, quick, least accurate.
3831 Possibly useful when higher levels
3832 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
3833 false negatives. However, it has many false positives.
3834 Warns for all pointer conversions between possibly incompatible types,
3835 even if never dereferenced. Runs in the front end only.
3837 Level 2: Aggressive, quick, not too precise.
3838 May still have many false positives (not as many as level 1 though),
3839 and few false negatives (but possibly more than level 1).
3840 Unlike level 1, it only warns when an address is taken. Warns about
3841 incomplete types. Runs in the front end only.
3843 Level 3 (default for @option{-Wstrict-aliasing}):
3844 Should have very few false positives and few false
3845 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
3846 Takes care of the common pun+dereference pattern in the front end:
3847 @code{*(int*)&some_float}.
3848 If optimization is enabled, it also runs in the back end, where it deals
3849 with multiple statement cases using flow-sensitive points-to information.
3850 Only warns when the converted pointer is dereferenced.
3851 Does not warn about incomplete types.
3853 @item -Wstrict-overflow
3854 @itemx -Wstrict-overflow=@var{n}
3855 @opindex Wstrict-overflow
3856 @opindex Wno-strict-overflow
3857 This option is only active when @option{-fstrict-overflow} is active.
3858 It warns about cases where the compiler optimizes based on the
3859 assumption that signed overflow does not occur. Note that it does not
3860 warn about all cases where the code might overflow: it only warns
3861 about cases where the compiler implements some optimization. Thus
3862 this warning depends on the optimization level.
3864 An optimization that assumes that signed overflow does not occur is
3865 perfectly safe if the values of the variables involved are such that
3866 overflow never does, in fact, occur. Therefore this warning can
3867 easily give a false positive: a warning about code that is not
3868 actually a problem. To help focus on important issues, several
3869 warning levels are defined. No warnings are issued for the use of
3870 undefined signed overflow when estimating how many iterations a loop
3871 requires, in particular when determining whether a loop will be
3875 @item -Wstrict-overflow=1
3876 Warn about cases that are both questionable and easy to avoid. For
3877 example, with @option{-fstrict-overflow}, the compiler simplifies
3878 @code{x + 1 > x} to @code{1}. This level of
3879 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3880 are not, and must be explicitly requested.
3882 @item -Wstrict-overflow=2
3883 Also warn about other cases where a comparison is simplified to a
3884 constant. For example: @code{abs (x) >= 0}. This can only be
3885 simplified when @option{-fstrict-overflow} is in effect, because
3886 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3887 zero. @option{-Wstrict-overflow} (with no level) is the same as
3888 @option{-Wstrict-overflow=2}.
3890 @item -Wstrict-overflow=3
3891 Also warn about other cases where a comparison is simplified. For
3892 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
3894 @item -Wstrict-overflow=4
3895 Also warn about other simplifications not covered by the above cases.
3896 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
3898 @item -Wstrict-overflow=5
3899 Also warn about cases where the compiler reduces the magnitude of a
3900 constant involved in a comparison. For example: @code{x + 2 > y} is
3901 simplified to @code{x + 1 >= y}. This is reported only at the
3902 highest warning level because this simplification applies to many
3903 comparisons, so this warning level gives a very large number of
3907 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
3908 @opindex Wsuggest-attribute=
3909 @opindex Wno-suggest-attribute=
3910 Warn for cases where adding an attribute may be beneficial. The
3911 attributes currently supported are listed below.
3914 @item -Wsuggest-attribute=pure
3915 @itemx -Wsuggest-attribute=const
3916 @itemx -Wsuggest-attribute=noreturn
3917 @opindex Wsuggest-attribute=pure
3918 @opindex Wno-suggest-attribute=pure
3919 @opindex Wsuggest-attribute=const
3920 @opindex Wno-suggest-attribute=const
3921 @opindex Wsuggest-attribute=noreturn
3922 @opindex Wno-suggest-attribute=noreturn
3924 Warn about functions that might be candidates for attributes
3925 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
3926 functions visible in other compilation units or (in the case of @code{pure} and
3927 @code{const}) if it cannot prove that the function returns normally. A function
3928 returns normally if it doesn't contain an infinite loop or return abnormally
3929 by throwing, calling @code{abort()} or trapping. This analysis requires option
3930 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
3931 higher. Higher optimization levels improve the accuracy of the analysis.
3933 @item -Wsuggest-attribute=format
3934 @itemx -Wmissing-format-attribute
3935 @opindex Wsuggest-attribute=format
3936 @opindex Wmissing-format-attribute
3937 @opindex Wno-suggest-attribute=format
3938 @opindex Wno-missing-format-attribute
3942 Warn about function pointers that might be candidates for @code{format}
3943 attributes. Note these are only possible candidates, not absolute ones.
3944 GCC guesses that function pointers with @code{format} attributes that
3945 are used in assignment, initialization, parameter passing or return
3946 statements should have a corresponding @code{format} attribute in the
3947 resulting type. I.e.@: the left-hand side of the assignment or
3948 initialization, the type of the parameter variable, or the return type
3949 of the containing function respectively should also have a @code{format}
3950 attribute to avoid the warning.
3952 GCC also warns about function definitions that might be
3953 candidates for @code{format} attributes. Again, these are only
3954 possible candidates. GCC guesses that @code{format} attributes
3955 might be appropriate for any function that calls a function like
3956 @code{vprintf} or @code{vscanf}, but this might not always be the
3957 case, and some functions for which @code{format} attributes are
3958 appropriate may not be detected.
3961 @item -Warray-bounds
3962 @opindex Wno-array-bounds
3963 @opindex Warray-bounds
3964 This option is only active when @option{-ftree-vrp} is active
3965 (default for @option{-O2} and above). It warns about subscripts to arrays
3966 that are always out of bounds. This warning is enabled by @option{-Wall}.
3968 @item -Wno-div-by-zero
3969 @opindex Wno-div-by-zero
3970 @opindex Wdiv-by-zero
3971 Do not warn about compile-time integer division by zero. Floating-point
3972 division by zero is not warned about, as it can be a legitimate way of
3973 obtaining infinities and NaNs.
3975 @item -Wsystem-headers
3976 @opindex Wsystem-headers
3977 @opindex Wno-system-headers
3978 @cindex warnings from system headers
3979 @cindex system headers, warnings from
3980 Print warning messages for constructs found in system header files.
3981 Warnings from system headers are normally suppressed, on the assumption
3982 that they usually do not indicate real problems and would only make the
3983 compiler output harder to read. Using this command-line option tells
3984 GCC to emit warnings from system headers as if they occurred in user
3985 code. However, note that using @option{-Wall} in conjunction with this
3986 option does @emph{not} warn about unknown pragmas in system
3987 headers---for that, @option{-Wunknown-pragmas} must also be used.
3990 @opindex Wtrampolines
3991 @opindex Wno-trampolines
3992 Warn about trampolines generated for pointers to nested functions.
3994 A trampoline is a small piece of data or code that is created at run
3995 time on the stack when the address of a nested function is taken, and
3996 is used to call the nested function indirectly. For some targets, it
3997 is made up of data only and thus requires no special treatment. But,
3998 for most targets, it is made up of code and thus requires the stack
3999 to be made executable in order for the program to work properly.
4002 @opindex Wfloat-equal
4003 @opindex Wno-float-equal
4004 Warn if floating-point values are used in equality comparisons.
4006 The idea behind this is that sometimes it is convenient (for the
4007 programmer) to consider floating-point values as approximations to
4008 infinitely precise real numbers. If you are doing this, then you need
4009 to compute (by analyzing the code, or in some other way) the maximum or
4010 likely maximum error that the computation introduces, and allow for it
4011 when performing comparisons (and when producing output, but that's a
4012 different problem). In particular, instead of testing for equality, you
4013 should check to see whether the two values have ranges that overlap; and
4014 this is done with the relational operators, so equality comparisons are
4017 @item -Wtraditional @r{(C and Objective-C only)}
4018 @opindex Wtraditional
4019 @opindex Wno-traditional
4020 Warn about certain constructs that behave differently in traditional and
4021 ISO C@. Also warn about ISO C constructs that have no traditional C
4022 equivalent, and/or problematic constructs that should be avoided.
4026 Macro parameters that appear within string literals in the macro body.
4027 In traditional C macro replacement takes place within string literals,
4028 but in ISO C it does not.
4031 In traditional C, some preprocessor directives did not exist.
4032 Traditional preprocessors only considered a line to be a directive
4033 if the @samp{#} appeared in column 1 on the line. Therefore
4034 @option{-Wtraditional} warns about directives that traditional C
4035 understands but ignores because the @samp{#} does not appear as the
4036 first character on the line. It also suggests you hide directives like
4037 @samp{#pragma} not understood by traditional C by indenting them. Some
4038 traditional implementations do not recognize @samp{#elif}, so this option
4039 suggests avoiding it altogether.
4042 A function-like macro that appears without arguments.
4045 The unary plus operator.
4048 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4049 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4050 constants.) Note, these suffixes appear in macros defined in the system
4051 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4052 Use of these macros in user code might normally lead to spurious
4053 warnings, however GCC's integrated preprocessor has enough context to
4054 avoid warning in these cases.
4057 A function declared external in one block and then used after the end of
4061 A @code{switch} statement has an operand of type @code{long}.
4064 A non-@code{static} function declaration follows a @code{static} one.
4065 This construct is not accepted by some traditional C compilers.
4068 The ISO type of an integer constant has a different width or
4069 signedness from its traditional type. This warning is only issued if
4070 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4071 typically represent bit patterns, are not warned about.
4074 Usage of ISO string concatenation is detected.
4077 Initialization of automatic aggregates.
4080 Identifier conflicts with labels. Traditional C lacks a separate
4081 namespace for labels.
4084 Initialization of unions. If the initializer is zero, the warning is
4085 omitted. This is done under the assumption that the zero initializer in
4086 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4087 initializer warnings and relies on default initialization to zero in the
4091 Conversions by prototypes between fixed/floating-point values and vice
4092 versa. The absence of these prototypes when compiling with traditional
4093 C causes serious problems. This is a subset of the possible
4094 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4097 Use of ISO C style function definitions. This warning intentionally is
4098 @emph{not} issued for prototype declarations or variadic functions
4099 because these ISO C features appear in your code when using
4100 libiberty's traditional C compatibility macros, @code{PARAMS} and
4101 @code{VPARAMS}. This warning is also bypassed for nested functions
4102 because that feature is already a GCC extension and thus not relevant to
4103 traditional C compatibility.
4106 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4107 @opindex Wtraditional-conversion
4108 @opindex Wno-traditional-conversion
4109 Warn if a prototype causes a type conversion that is different from what
4110 would happen to the same argument in the absence of a prototype. This
4111 includes conversions of fixed point to floating and vice versa, and
4112 conversions changing the width or signedness of a fixed-point argument
4113 except when the same as the default promotion.
4115 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4116 @opindex Wdeclaration-after-statement
4117 @opindex Wno-declaration-after-statement
4118 Warn when a declaration is found after a statement in a block. This
4119 construct, known from C++, was introduced with ISO C99 and is by default
4120 allowed in GCC@. It is not supported by ISO C90 and was not supported by
4121 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
4126 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
4128 @item -Wno-endif-labels
4129 @opindex Wno-endif-labels
4130 @opindex Wendif-labels
4131 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
4136 Warn whenever a local variable or type declaration shadows another variable,
4137 parameter, type, or class member (in C++), or whenever a built-in function
4138 is shadowed. Note that in C++, the compiler warns if a local variable
4139 shadows an explicit typedef, but not if it shadows a struct/class/enum.
4141 @item -Wlarger-than=@var{len}
4142 @opindex Wlarger-than=@var{len}
4143 @opindex Wlarger-than-@var{len}
4144 Warn whenever an object of larger than @var{len} bytes is defined.
4146 @item -Wframe-larger-than=@var{len}
4147 @opindex Wframe-larger-than
4148 Warn if the size of a function frame is larger than @var{len} bytes.
4149 The computation done to determine the stack frame size is approximate
4150 and not conservative.
4151 The actual requirements may be somewhat greater than @var{len}
4152 even if you do not get a warning. In addition, any space allocated
4153 via @code{alloca}, variable-length arrays, or related constructs
4154 is not included by the compiler when determining
4155 whether or not to issue a warning.
4157 @item -Wno-free-nonheap-object
4158 @opindex Wno-free-nonheap-object
4159 @opindex Wfree-nonheap-object
4160 Do not warn when attempting to free an object that was not allocated
4163 @item -Wstack-usage=@var{len}
4164 @opindex Wstack-usage
4165 Warn if the stack usage of a function might be larger than @var{len} bytes.
4166 The computation done to determine the stack usage is conservative.
4167 Any space allocated via @code{alloca}, variable-length arrays, or related
4168 constructs is included by the compiler when determining whether or not to
4171 The message is in keeping with the output of @option{-fstack-usage}.
4175 If the stack usage is fully static but exceeds the specified amount, it's:
4178 warning: stack usage is 1120 bytes
4181 If the stack usage is (partly) dynamic but bounded, it's:
4184 warning: stack usage might be 1648 bytes
4187 If the stack usage is (partly) dynamic and not bounded, it's:
4190 warning: stack usage might be unbounded
4194 @item -Wunsafe-loop-optimizations
4195 @opindex Wunsafe-loop-optimizations
4196 @opindex Wno-unsafe-loop-optimizations
4197 Warn if the loop cannot be optimized because the compiler cannot
4198 assume anything on the bounds of the loop indices. With
4199 @option{-funsafe-loop-optimizations} warn if the compiler makes
4202 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4203 @opindex Wno-pedantic-ms-format
4204 @opindex Wpedantic-ms-format
4205 When used in combination with @option{-Wformat}
4206 and @option{-pedantic} without GNU extensions, this option
4207 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4208 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4209 which depend on the MS runtime.
4211 @item -Wpointer-arith
4212 @opindex Wpointer-arith
4213 @opindex Wno-pointer-arith
4214 Warn about anything that depends on the ``size of'' a function type or
4215 of @code{void}. GNU C assigns these types a size of 1, for
4216 convenience in calculations with @code{void *} pointers and pointers
4217 to functions. In C++, warn also when an arithmetic operation involves
4218 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
4221 @opindex Wtype-limits
4222 @opindex Wno-type-limits
4223 Warn if a comparison is always true or always false due to the limited
4224 range of the data type, but do not warn for constant expressions. For
4225 example, warn if an unsigned variable is compared against zero with
4226 @samp{<} or @samp{>=}. This warning is also enabled by
4229 @item -Wbad-function-cast @r{(C and Objective-C only)}
4230 @opindex Wbad-function-cast
4231 @opindex Wno-bad-function-cast
4232 Warn whenever a function call is cast to a non-matching type.
4233 For example, warn if @code{int malloc()} is cast to @code{anything *}.
4235 @item -Wc++-compat @r{(C and Objective-C only)}
4236 Warn about ISO C constructs that are outside of the common subset of
4237 ISO C and ISO C++, e.g.@: request for implicit conversion from
4238 @code{void *} to a pointer to non-@code{void} type.
4240 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4241 Warn about C++ constructs whose meaning differs between ISO C++ 1998
4242 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
4243 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
4244 enabled by @option{-Wall}.
4248 @opindex Wno-cast-qual
4249 Warn whenever a pointer is cast so as to remove a type qualifier from
4250 the target type. For example, warn if a @code{const char *} is cast
4251 to an ordinary @code{char *}.
4253 Also warn when making a cast that introduces a type qualifier in an
4254 unsafe way. For example, casting @code{char **} to @code{const char **}
4255 is unsafe, as in this example:
4258 /* p is char ** value. */
4259 const char **q = (const char **) p;
4260 /* Assignment of readonly string to const char * is OK. */
4262 /* Now char** pointer points to read-only memory. */
4267 @opindex Wcast-align
4268 @opindex Wno-cast-align
4269 Warn whenever a pointer is cast such that the required alignment of the
4270 target is increased. For example, warn if a @code{char *} is cast to
4271 an @code{int *} on machines where integers can only be accessed at
4272 two- or four-byte boundaries.
4274 @item -Wwrite-strings
4275 @opindex Wwrite-strings
4276 @opindex Wno-write-strings
4277 When compiling C, give string constants the type @code{const
4278 char[@var{length}]} so that copying the address of one into a
4279 non-@code{const} @code{char *} pointer produces a warning. These
4280 warnings help you find at compile time code that can try to write
4281 into a string constant, but only if you have been very careful about
4282 using @code{const} in declarations and prototypes. Otherwise, it is
4283 just a nuisance. This is why we did not make @option{-Wall} request
4286 When compiling C++, warn about the deprecated conversion from string
4287 literals to @code{char *}. This warning is enabled by default for C++
4292 @opindex Wno-clobbered
4293 Warn for variables that might be changed by @samp{longjmp} or
4294 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
4297 @opindex Wconversion
4298 @opindex Wno-conversion
4299 Warn for implicit conversions that may alter a value. This includes
4300 conversions between real and integer, like @code{abs (x)} when
4301 @code{x} is @code{double}; conversions between signed and unsigned,
4302 like @code{unsigned ui = -1}; and conversions to smaller types, like
4303 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4304 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4305 changed by the conversion like in @code{abs (2.0)}. Warnings about
4306 conversions between signed and unsigned integers can be disabled by
4307 using @option{-Wno-sign-conversion}.
4309 For C++, also warn for confusing overload resolution for user-defined
4310 conversions; and conversions that never use a type conversion
4311 operator: conversions to @code{void}, the same type, a base class or a
4312 reference to them. Warnings about conversions between signed and
4313 unsigned integers are disabled by default in C++ unless
4314 @option{-Wsign-conversion} is explicitly enabled.
4316 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4317 @opindex Wconversion-null
4318 @opindex Wno-conversion-null
4319 Do not warn for conversions between @code{NULL} and non-pointer
4320 types. @option{-Wconversion-null} is enabled by default.
4322 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4323 @opindex Wzero-as-null-pointer-constant
4324 @opindex Wno-zero-as-null-pointer-constant
4325 Warn when a literal '0' is used as null pointer constant. This can
4326 be useful to facilitate the conversion to @code{nullptr} in C++11.
4328 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4329 @opindex Wuseless-cast
4330 @opindex Wno-useless-cast
4331 Warn when an expression is casted to its own type.
4334 @opindex Wempty-body
4335 @opindex Wno-empty-body
4336 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
4337 while} statement. This warning is also enabled by @option{-Wextra}.
4339 @item -Wenum-compare
4340 @opindex Wenum-compare
4341 @opindex Wno-enum-compare
4342 Warn about a comparison between values of different enumerated types.
4343 In C++ enumeral mismatches in conditional expressions are also
4344 diagnosed and the warning is enabled by default. In C this warning is
4345 enabled by @option{-Wall}.
4347 @item -Wjump-misses-init @r{(C, Objective-C only)}
4348 @opindex Wjump-misses-init
4349 @opindex Wno-jump-misses-init
4350 Warn if a @code{goto} statement or a @code{switch} statement jumps
4351 forward across the initialization of a variable, or jumps backward to a
4352 label after the variable has been initialized. This only warns about
4353 variables that are initialized when they are declared. This warning is
4354 only supported for C and Objective-C; in C++ this sort of branch is an
4357 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
4358 can be disabled with the @option{-Wno-jump-misses-init} option.
4360 @item -Wsign-compare
4361 @opindex Wsign-compare
4362 @opindex Wno-sign-compare
4363 @cindex warning for comparison of signed and unsigned values
4364 @cindex comparison of signed and unsigned values, warning
4365 @cindex signed and unsigned values, comparison warning
4366 Warn when a comparison between signed and unsigned values could produce
4367 an incorrect result when the signed value is converted to unsigned.
4368 This warning is also enabled by @option{-Wextra}; to get the other warnings
4369 of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}.
4371 @item -Wsign-conversion
4372 @opindex Wsign-conversion
4373 @opindex Wno-sign-conversion
4374 Warn for implicit conversions that may change the sign of an integer
4375 value, like assigning a signed integer expression to an unsigned
4376 integer variable. An explicit cast silences the warning. In C, this
4377 option is enabled also by @option{-Wconversion}.
4379 @item -Wsizeof-pointer-memaccess
4380 @opindex Wsizeof-pointer-memaccess
4381 @opindex Wno-sizeof-pointer-memaccess
4382 Warn for suspicious length parameters to certain string and memory built-in
4383 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
4384 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
4385 but a pointer, and suggests a possible fix, or about
4386 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
4391 @opindex Wno-address
4392 Warn about suspicious uses of memory addresses. These include using
4393 the address of a function in a conditional expression, such as
4394 @code{void func(void); if (func)}, and comparisons against the memory
4395 address of a string literal, such as @code{if (x == "abc")}. Such
4396 uses typically indicate a programmer error: the address of a function
4397 always evaluates to true, so their use in a conditional usually
4398 indicate that the programmer forgot the parentheses in a function
4399 call; and comparisons against string literals result in unspecified
4400 behavior and are not portable in C, so they usually indicate that the
4401 programmer intended to use @code{strcmp}. This warning is enabled by
4405 @opindex Wlogical-op
4406 @opindex Wno-logical-op
4407 Warn about suspicious uses of logical operators in expressions.
4408 This includes using logical operators in contexts where a
4409 bit-wise operator is likely to be expected.
4411 @item -Waggregate-return
4412 @opindex Waggregate-return
4413 @opindex Wno-aggregate-return
4414 Warn if any functions that return structures or unions are defined or
4415 called. (In languages where you can return an array, this also elicits
4418 @item -Wno-attributes
4419 @opindex Wno-attributes
4420 @opindex Wattributes
4421 Do not warn if an unexpected @code{__attribute__} is used, such as
4422 unrecognized attributes, function attributes applied to variables,
4423 etc. This does not stop errors for incorrect use of supported
4426 @item -Wno-builtin-macro-redefined
4427 @opindex Wno-builtin-macro-redefined
4428 @opindex Wbuiltin-macro-redefined
4429 Do not warn if certain built-in macros are redefined. This suppresses
4430 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4431 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4433 @item -Wstrict-prototypes @r{(C and Objective-C only)}
4434 @opindex Wstrict-prototypes
4435 @opindex Wno-strict-prototypes
4436 Warn if a function is declared or defined without specifying the
4437 argument types. (An old-style function definition is permitted without
4438 a warning if preceded by a declaration that specifies the argument
4441 @item -Wold-style-declaration @r{(C and Objective-C only)}
4442 @opindex Wold-style-declaration
4443 @opindex Wno-old-style-declaration
4444 Warn for obsolescent usages, according to the C Standard, in a
4445 declaration. For example, warn if storage-class specifiers like
4446 @code{static} are not the first things in a declaration. This warning
4447 is also enabled by @option{-Wextra}.
4449 @item -Wold-style-definition @r{(C and Objective-C only)}
4450 @opindex Wold-style-definition
4451 @opindex Wno-old-style-definition
4452 Warn if an old-style function definition is used. A warning is given
4453 even if there is a previous prototype.
4455 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
4456 @opindex Wmissing-parameter-type
4457 @opindex Wno-missing-parameter-type
4458 A function parameter is declared without a type specifier in K&R-style
4465 This warning is also enabled by @option{-Wextra}.
4467 @item -Wmissing-prototypes @r{(C and Objective-C only)}
4468 @opindex Wmissing-prototypes
4469 @opindex Wno-missing-prototypes
4470 Warn if a global function is defined without a previous prototype
4471 declaration. This warning is issued even if the definition itself
4472 provides a prototype. Use this option to detect global functions
4473 that do not have a matching prototype declaration in a header file.
4474 This option is not valid for C++ because all function declarations
4475 provide prototypes and a non-matching declaration will declare an
4476 overload rather than conflict with an earlier declaration.
4477 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
4479 @item -Wmissing-declarations
4480 @opindex Wmissing-declarations
4481 @opindex Wno-missing-declarations
4482 Warn if a global function is defined without a previous declaration.
4483 Do so even if the definition itself provides a prototype.
4484 Use this option to detect global functions that are not declared in
4485 header files. In C, no warnings are issued for functions with previous
4486 non-prototype declarations; use @option{-Wmissing-prototype} to detect
4487 missing prototypes. In C++, no warnings are issued for function templates,
4488 or for inline functions, or for functions in anonymous namespaces.
4490 @item -Wmissing-field-initializers
4491 @opindex Wmissing-field-initializers
4492 @opindex Wno-missing-field-initializers
4496 Warn if a structure's initializer has some fields missing. For
4497 example, the following code causes such a warning, because
4498 @code{x.h} is implicitly zero:
4501 struct s @{ int f, g, h; @};
4502 struct s x = @{ 3, 4 @};
4505 This option does not warn about designated initializers, so the following
4506 modification does not trigger a warning:
4509 struct s @{ int f, g, h; @};
4510 struct s x = @{ .f = 3, .g = 4 @};
4513 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
4514 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
4516 @item -Wno-multichar
4517 @opindex Wno-multichar
4519 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4520 Usually they indicate a typo in the user's code, as they have
4521 implementation-defined values, and should not be used in portable code.
4523 @item -Wnormalized=<none|id|nfc|nfkc>
4524 @opindex Wnormalized=
4527 @cindex character set, input normalization
4528 In ISO C and ISO C++, two identifiers are different if they are
4529 different sequences of characters. However, sometimes when characters
4530 outside the basic ASCII character set are used, you can have two
4531 different character sequences that look the same. To avoid confusion,
4532 the ISO 10646 standard sets out some @dfn{normalization rules} which
4533 when applied ensure that two sequences that look the same are turned into
4534 the same sequence. GCC can warn you if you are using identifiers that
4535 have not been normalized; this option controls that warning.
4537 There are four levels of warning supported by GCC@. The default is
4538 @option{-Wnormalized=nfc}, which warns about any identifier that is
4539 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4540 recommended form for most uses.
4542 Unfortunately, there are some characters allowed in identifiers by
4543 ISO C and ISO C++ that, when turned into NFC, are not allowed in
4544 identifiers. That is, there's no way to use these symbols in portable
4545 ISO C or C++ and have all your identifiers in NFC@.
4546 @option{-Wnormalized=id} suppresses the warning for these characters.
4547 It is hoped that future versions of the standards involved will correct
4548 this, which is why this option is not the default.
4550 You can switch the warning off for all characters by writing
4551 @option{-Wnormalized=none}. You should only do this if you
4552 are using some other normalization scheme (like ``D''), because
4553 otherwise you can easily create bugs that are literally impossible to see.
4555 Some characters in ISO 10646 have distinct meanings but look identical
4556 in some fonts or display methodologies, especially once formatting has
4557 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4558 LETTER N'', displays just like a regular @code{n} that has been
4559 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
4560 normalization scheme to convert all these into a standard form as
4561 well, and GCC warns if your code is not in NFKC if you use
4562 @option{-Wnormalized=nfkc}. This warning is comparable to warning
4563 about every identifier that contains the letter O because it might be
4564 confused with the digit 0, and so is not the default, but may be
4565 useful as a local coding convention if the programming environment
4566 cannot be fixed to display these characters distinctly.
4568 @item -Wno-deprecated
4569 @opindex Wno-deprecated
4570 @opindex Wdeprecated
4571 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4573 @item -Wno-deprecated-declarations
4574 @opindex Wno-deprecated-declarations
4575 @opindex Wdeprecated-declarations
4576 Do not warn about uses of functions (@pxref{Function Attributes}),
4577 variables (@pxref{Variable Attributes}), and types (@pxref{Type
4578 Attributes}) marked as deprecated by using the @code{deprecated}
4582 @opindex Wno-overflow
4584 Do not warn about compile-time overflow in constant expressions.
4586 @item -Woverride-init @r{(C and Objective-C only)}
4587 @opindex Woverride-init
4588 @opindex Wno-override-init
4592 Warn if an initialized field without side effects is overridden when
4593 using designated initializers (@pxref{Designated Inits, , Designated
4596 This warning is included in @option{-Wextra}. To get other
4597 @option{-Wextra} warnings without this one, use @option{-Wextra
4598 -Wno-override-init}.
4603 Warn if a structure is given the packed attribute, but the packed
4604 attribute has no effect on the layout or size of the structure.
4605 Such structures may be mis-aligned for little benefit. For
4606 instance, in this code, the variable @code{f.x} in @code{struct bar}
4607 is misaligned even though @code{struct bar} does not itself
4608 have the packed attribute:
4615 @} __attribute__((packed));
4623 @item -Wpacked-bitfield-compat
4624 @opindex Wpacked-bitfield-compat
4625 @opindex Wno-packed-bitfield-compat
4626 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4627 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
4628 the change can lead to differences in the structure layout. GCC
4629 informs you when the offset of such a field has changed in GCC 4.4.
4630 For example there is no longer a 4-bit padding between field @code{a}
4631 and @code{b} in this structure:
4638 @} __attribute__ ((packed));
4641 This warning is enabled by default. Use
4642 @option{-Wno-packed-bitfield-compat} to disable this warning.
4647 Warn if padding is included in a structure, either to align an element
4648 of the structure or to align the whole structure. Sometimes when this
4649 happens it is possible to rearrange the fields of the structure to
4650 reduce the padding and so make the structure smaller.
4652 @item -Wredundant-decls
4653 @opindex Wredundant-decls
4654 @opindex Wno-redundant-decls
4655 Warn if anything is declared more than once in the same scope, even in
4656 cases where multiple declaration is valid and changes nothing.
4658 @item -Wnested-externs @r{(C and Objective-C only)}
4659 @opindex Wnested-externs
4660 @opindex Wno-nested-externs
4661 Warn if an @code{extern} declaration is encountered within a function.
4663 @item -Wno-inherited-variadic-ctor
4664 @opindex Winherited-variadic-ctor
4665 @opindex Wno-inherited-variadic-ctor
4666 Suppress warnings about use of C++11 inheriting constructors when the
4667 base class inherited from has a C variadic constructor; the warning is
4668 on by default because the ellipsis is not inherited.
4673 Warn if a function that is declared as inline cannot be inlined.
4674 Even with this option, the compiler does not warn about failures to
4675 inline functions declared in system headers.
4677 The compiler uses a variety of heuristics to determine whether or not
4678 to inline a function. For example, the compiler takes into account
4679 the size of the function being inlined and the amount of inlining
4680 that has already been done in the current function. Therefore,
4681 seemingly insignificant changes in the source program can cause the
4682 warnings produced by @option{-Winline} to appear or disappear.
4684 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4685 @opindex Wno-invalid-offsetof
4686 @opindex Winvalid-offsetof
4687 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4688 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
4689 to a non-POD type is undefined. In existing C++ implementations,
4690 however, @samp{offsetof} typically gives meaningful results even when
4691 applied to certain kinds of non-POD types (such as a simple
4692 @samp{struct} that fails to be a POD type only by virtue of having a
4693 constructor). This flag is for users who are aware that they are
4694 writing nonportable code and who have deliberately chosen to ignore the
4697 The restrictions on @samp{offsetof} may be relaxed in a future version
4698 of the C++ standard.
4700 @item -Wno-int-to-pointer-cast
4701 @opindex Wno-int-to-pointer-cast
4702 @opindex Wint-to-pointer-cast
4703 Suppress warnings from casts to pointer type of an integer of a
4704 different size. In C++, casting to a pointer type of smaller size is
4705 an error. @option{Wint-to-pointer-cast} is enabled by default.
4708 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4709 @opindex Wno-pointer-to-int-cast
4710 @opindex Wpointer-to-int-cast
4711 Suppress warnings from casts from a pointer to an integer type of a
4715 @opindex Winvalid-pch
4716 @opindex Wno-invalid-pch
4717 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4718 the search path but can't be used.
4722 @opindex Wno-long-long
4723 Warn if @samp{long long} type is used. This is enabled by either
4724 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
4725 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
4727 @item -Wvariadic-macros
4728 @opindex Wvariadic-macros
4729 @opindex Wno-variadic-macros
4730 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4731 alternate syntax when in pedantic ISO C99 mode. This is default.
4732 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4736 @opindex Wno-varargs
4737 Warn upon questionable usage of the macros used to handle variable
4738 arguments like @samp{va_start}. This is default. To inhibit the
4739 warning messages, use @option{-Wno-varargs}.
4741 @item -Wvector-operation-performance
4742 @opindex Wvector-operation-performance
4743 @opindex Wno-vector-operation-performance
4744 Warn if vector operation is not implemented via SIMD capabilities of the
4745 architecture. Mainly useful for the performance tuning.
4746 Vector operation can be implemented @code{piecewise}, which means that the
4747 scalar operation is performed on every vector element;
4748 @code{in parallel}, which means that the vector operation is implemented
4749 using scalars of wider type, which normally is more performance efficient;
4750 and @code{as a single scalar}, which means that vector fits into a
4753 @item -Wno-virtual-move-assign
4754 @opindex Wvirtual-move-assign
4755 @opindex Wno-virtual-move-assign
4756 Suppress warnings about inheriting from a virtual base with a
4757 non-trivial C++11 move assignment operator. This is dangerous because
4758 if the virtual base is reachable along more than one path, it will be
4759 moved multiple times, which can mean both objects end up in the
4760 moved-from state. If the move assignment operator is written to avoid
4761 moving from a moved-from object, this warning can be disabled.
4766 Warn if variable length array is used in the code.
4767 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
4768 the variable length array.
4770 @item -Wvolatile-register-var
4771 @opindex Wvolatile-register-var
4772 @opindex Wno-volatile-register-var
4773 Warn if a register variable is declared volatile. The volatile
4774 modifier does not inhibit all optimizations that may eliminate reads
4775 and/or writes to register variables. This warning is enabled by
4778 @item -Wdisabled-optimization
4779 @opindex Wdisabled-optimization
4780 @opindex Wno-disabled-optimization
4781 Warn if a requested optimization pass is disabled. This warning does
4782 not generally indicate that there is anything wrong with your code; it
4783 merely indicates that GCC's optimizers are unable to handle the code
4784 effectively. Often, the problem is that your code is too big or too
4785 complex; GCC refuses to optimize programs when the optimization
4786 itself is likely to take inordinate amounts of time.
4788 @item -Wpointer-sign @r{(C and Objective-C only)}
4789 @opindex Wpointer-sign
4790 @opindex Wno-pointer-sign
4791 Warn for pointer argument passing or assignment with different signedness.
4792 This option is only supported for C and Objective-C@. It is implied by
4793 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
4794 @option{-Wno-pointer-sign}.
4796 @item -Wstack-protector
4797 @opindex Wstack-protector
4798 @opindex Wno-stack-protector
4799 This option is only active when @option{-fstack-protector} is active. It
4800 warns about functions that are not protected against stack smashing.
4803 @opindex Wno-mudflap
4804 Suppress warnings about constructs that cannot be instrumented by
4807 @item -Woverlength-strings
4808 @opindex Woverlength-strings
4809 @opindex Wno-overlength-strings
4810 Warn about string constants that are longer than the ``minimum
4811 maximum'' length specified in the C standard. Modern compilers
4812 generally allow string constants that are much longer than the
4813 standard's minimum limit, but very portable programs should avoid
4814 using longer strings.
4816 The limit applies @emph{after} string constant concatenation, and does
4817 not count the trailing NUL@. In C90, the limit was 509 characters; in
4818 C99, it was raised to 4095. C++98 does not specify a normative
4819 minimum maximum, so we do not diagnose overlength strings in C++@.
4821 This option is implied by @option{-Wpedantic}, and can be disabled with
4822 @option{-Wno-overlength-strings}.
4824 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
4825 @opindex Wunsuffixed-float-constants
4827 Issue a warning for any floating constant that does not have
4828 a suffix. When used together with @option{-Wsystem-headers} it
4829 warns about such constants in system header files. This can be useful
4830 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4831 from the decimal floating-point extension to C99.
4834 @node Debugging Options
4835 @section Options for Debugging Your Program or GCC
4836 @cindex options, debugging
4837 @cindex debugging information options
4839 GCC has various special options that are used for debugging
4840 either your program or GCC:
4845 Produce debugging information in the operating system's native format
4846 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
4849 On most systems that use stabs format, @option{-g} enables use of extra
4850 debugging information that only GDB can use; this extra information
4851 makes debugging work better in GDB but probably makes other debuggers
4853 refuse to read the program. If you want to control for certain whether
4854 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4855 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4857 GCC allows you to use @option{-g} with
4858 @option{-O}. The shortcuts taken by optimized code may occasionally
4859 produce surprising results: some variables you declared may not exist
4860 at all; flow of control may briefly move where you did not expect it;
4861 some statements may not be executed because they compute constant
4862 results or their values are already at hand; some statements may
4863 execute in different places because they have been moved out of loops.
4865 Nevertheless it proves possible to debug optimized output. This makes
4866 it reasonable to use the optimizer for programs that might have bugs.
4868 The following options are useful when GCC is generated with the
4869 capability for more than one debugging format.
4872 @opindex gsplit-dwarf
4873 Separate as much dwarf debugging information as possible into a
4874 separate output file with the extension .dwo. This option allows
4875 the build system to avoid linking files with debug information. To
4876 be useful, this option requires a debugger capable of reading .dwo
4881 Produce debugging information for use by GDB@. This means to use the
4882 most expressive format available (DWARF 2, stabs, or the native format
4883 if neither of those are supported), including GDB extensions if at all
4888 Generate dwarf .debug_pubnames and .debug_pubtypes sections.
4892 Produce debugging information in stabs format (if that is supported),
4893 without GDB extensions. This is the format used by DBX on most BSD
4894 systems. On MIPS, Alpha and System V Release 4 systems this option
4895 produces stabs debugging output that is not understood by DBX or SDB@.
4896 On System V Release 4 systems this option requires the GNU assembler.
4898 @item -feliminate-unused-debug-symbols
4899 @opindex feliminate-unused-debug-symbols
4900 Produce debugging information in stabs format (if that is supported),
4901 for only symbols that are actually used.
4903 @item -femit-class-debug-always
4904 Instead of emitting debugging information for a C++ class in only one
4905 object file, emit it in all object files using the class. This option
4906 should be used only with debuggers that are unable to handle the way GCC
4907 normally emits debugging information for classes because using this
4908 option increases the size of debugging information by as much as a
4911 @item -fdebug-types-section
4912 @opindex fdebug-types-section
4913 @opindex fno-debug-types-section
4914 When using DWARF Version 4 or higher, type DIEs can be put into
4915 their own @code{.debug_types} section instead of making them part of the
4916 @code{.debug_info} section. It is more efficient to put them in a separate
4917 comdat sections since the linker can then remove duplicates.
4918 But not all DWARF consumers support @code{.debug_types} sections yet
4919 and on some objects @code{.debug_types} produces larger instead of smaller
4920 debugging information.
4924 Produce debugging information in stabs format (if that is supported),
4925 using GNU extensions understood only by the GNU debugger (GDB)@. The
4926 use of these extensions is likely to make other debuggers crash or
4927 refuse to read the program.
4931 Produce debugging information in COFF format (if that is supported).
4932 This is the format used by SDB on most System V systems prior to
4937 Produce debugging information in XCOFF format (if that is supported).
4938 This is the format used by the DBX debugger on IBM RS/6000 systems.
4942 Produce debugging information in XCOFF format (if that is supported),
4943 using GNU extensions understood only by the GNU debugger (GDB)@. The
4944 use of these extensions is likely to make other debuggers crash or
4945 refuse to read the program, and may cause assemblers other than the GNU
4946 assembler (GAS) to fail with an error.
4948 @item -gdwarf-@var{version}
4949 @opindex gdwarf-@var{version}
4950 Produce debugging information in DWARF format (if that is supported).
4951 The value of @var{version} may be either 2, 3 or 4; the default version
4952 for most targets is 4.
4954 Note that with DWARF Version 2, some ports require and always
4955 use some non-conflicting DWARF 3 extensions in the unwind tables.
4957 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
4958 for maximum benefit.
4960 @item -grecord-gcc-switches
4961 @opindex grecord-gcc-switches
4962 This switch causes the command-line options used to invoke the
4963 compiler that may affect code generation to be appended to the
4964 DW_AT_producer attribute in DWARF debugging information. The options
4965 are concatenated with spaces separating them from each other and from
4966 the compiler version. See also @option{-frecord-gcc-switches} for another
4967 way of storing compiler options into the object file. This is the default.
4969 @item -gno-record-gcc-switches
4970 @opindex gno-record-gcc-switches
4971 Disallow appending command-line options to the DW_AT_producer attribute
4972 in DWARF debugging information.
4974 @item -gstrict-dwarf
4975 @opindex gstrict-dwarf
4976 Disallow using extensions of later DWARF standard version than selected
4977 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
4978 DWARF extensions from later standard versions is allowed.
4980 @item -gno-strict-dwarf
4981 @opindex gno-strict-dwarf
4982 Allow using extensions of later DWARF standard version than selected with
4983 @option{-gdwarf-@var{version}}.
4987 Produce debugging information in Alpha/VMS debug format (if that is
4988 supported). This is the format used by DEBUG on Alpha/VMS systems.
4991 @itemx -ggdb@var{level}
4992 @itemx -gstabs@var{level}
4993 @itemx -gcoff@var{level}
4994 @itemx -gxcoff@var{level}
4995 @itemx -gvms@var{level}
4996 Request debugging information and also use @var{level} to specify how
4997 much information. The default level is 2.
4999 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5002 Level 1 produces minimal information, enough for making backtraces in
5003 parts of the program that you don't plan to debug. This includes
5004 descriptions of functions and external variables, but no information
5005 about local variables and no line numbers.
5007 Level 3 includes extra information, such as all the macro definitions
5008 present in the program. Some debuggers support macro expansion when
5009 you use @option{-g3}.
5011 @option{-gdwarf-2} does not accept a concatenated debug level, because
5012 GCC used to support an option @option{-gdwarf} that meant to generate
5013 debug information in version 1 of the DWARF format (which is very
5014 different from version 2), and it would have been too confusing. That
5015 debug format is long obsolete, but the option cannot be changed now.
5016 Instead use an additional @option{-g@var{level}} option to change the
5017 debug level for DWARF.
5021 Turn off generation of debug info, if leaving out this option
5022 generates it, or turn it on at level 2 otherwise. The position of this
5023 argument in the command line does not matter; it takes effect after all
5024 other options are processed, and it does so only once, no matter how
5025 many times it is given. This is mainly intended to be used with
5026 @option{-fcompare-debug}.
5028 @item -fdump-final-insns@r{[}=@var{file}@r{]}
5029 @opindex fdump-final-insns
5030 Dump the final internal representation (RTL) to @var{file}. If the
5031 optional argument is omitted (or if @var{file} is @code{.}), the name
5032 of the dump file is determined by appending @code{.gkd} to the
5033 compilation output file name.
5035 @item -fcompare-debug@r{[}=@var{opts}@r{]}
5036 @opindex fcompare-debug
5037 @opindex fno-compare-debug
5038 If no error occurs during compilation, run the compiler a second time,
5039 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
5040 passed to the second compilation. Dump the final internal
5041 representation in both compilations, and print an error if they differ.
5043 If the equal sign is omitted, the default @option{-gtoggle} is used.
5045 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
5046 and nonzero, implicitly enables @option{-fcompare-debug}. If
5047 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
5048 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
5051 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
5052 is equivalent to @option{-fno-compare-debug}, which disables the dumping
5053 of the final representation and the second compilation, preventing even
5054 @env{GCC_COMPARE_DEBUG} from taking effect.
5056 To verify full coverage during @option{-fcompare-debug} testing, set
5057 @env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
5058 which GCC rejects as an invalid option in any actual compilation
5059 (rather than preprocessing, assembly or linking). To get just a
5060 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
5061 not overridden} will do.
5063 @item -fcompare-debug-second
5064 @opindex fcompare-debug-second
5065 This option is implicitly passed to the compiler for the second
5066 compilation requested by @option{-fcompare-debug}, along with options to
5067 silence warnings, and omitting other options that would cause
5068 side-effect compiler outputs to files or to the standard output. Dump
5069 files and preserved temporary files are renamed so as to contain the
5070 @code{.gk} additional extension during the second compilation, to avoid
5071 overwriting those generated by the first.
5073 When this option is passed to the compiler driver, it causes the
5074 @emph{first} compilation to be skipped, which makes it useful for little
5075 other than debugging the compiler proper.
5077 @item -feliminate-dwarf2-dups
5078 @opindex feliminate-dwarf2-dups
5079 Compress DWARF 2 debugging information by eliminating duplicated
5080 information about each symbol. This option only makes sense when
5081 generating DWARF 2 debugging information with @option{-gdwarf-2}.
5083 @item -femit-struct-debug-baseonly
5084 Emit debug information for struct-like types
5085 only when the base name of the compilation source file
5086 matches the base name of file in which the struct is defined.
5088 This option substantially reduces the size of debugging information,
5089 but at significant potential loss in type information to the debugger.
5090 See @option{-femit-struct-debug-reduced} for a less aggressive option.
5091 See @option{-femit-struct-debug-detailed} for more detailed control.
5093 This option works only with DWARF 2.
5095 @item -femit-struct-debug-reduced
5096 Emit debug information for struct-like types
5097 only when the base name of the compilation source file
5098 matches the base name of file in which the type is defined,
5099 unless the struct is a template or defined in a system header.
5101 This option significantly reduces the size of debugging information,
5102 with some potential loss in type information to the debugger.
5103 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
5104 See @option{-femit-struct-debug-detailed} for more detailed control.
5106 This option works only with DWARF 2.
5108 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
5109 Specify the struct-like types
5110 for which the compiler generates debug information.
5111 The intent is to reduce duplicate struct debug information
5112 between different object files within the same program.
5114 This option is a detailed version of
5115 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
5116 which serves for most needs.
5118 A specification has the syntax@*
5119 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
5121 The optional first word limits the specification to
5122 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
5123 A struct type is used directly when it is the type of a variable, member.
5124 Indirect uses arise through pointers to structs.
5125 That is, when use of an incomplete struct is valid, the use is indirect.
5127 @samp{struct one direct; struct two * indirect;}.
5129 The optional second word limits the specification to
5130 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
5131 Generic structs are a bit complicated to explain.
5132 For C++, these are non-explicit specializations of template classes,
5133 or non-template classes within the above.
5134 Other programming languages have generics,
5135 but @option{-femit-struct-debug-detailed} does not yet implement them.
5137 The third word specifies the source files for those
5138 structs for which the compiler should emit debug information.
5139 The values @samp{none} and @samp{any} have the normal meaning.
5140 The value @samp{base} means that
5141 the base of name of the file in which the type declaration appears
5142 must match the base of the name of the main compilation file.
5143 In practice, this means that when compiling @file{foo.c}, debug information
5144 is generated for types declared in that file and @file{foo.h},
5145 but not other header files.
5146 The value @samp{sys} means those types satisfying @samp{base}
5147 or declared in system or compiler headers.
5149 You may need to experiment to determine the best settings for your application.
5151 The default is @option{-femit-struct-debug-detailed=all}.
5153 This option works only with DWARF 2.
5155 @item -fno-merge-debug-strings
5156 @opindex fmerge-debug-strings
5157 @opindex fno-merge-debug-strings
5158 Direct the linker to not merge together strings in the debugging
5159 information that are identical in different object files. Merging is
5160 not supported by all assemblers or linkers. Merging decreases the size
5161 of the debug information in the output file at the cost of increasing
5162 link processing time. Merging is enabled by default.
5164 @item -fdebug-prefix-map=@var{old}=@var{new}
5165 @opindex fdebug-prefix-map
5166 When compiling files in directory @file{@var{old}}, record debugging
5167 information describing them as in @file{@var{new}} instead.
5169 @item -fno-dwarf2-cfi-asm
5170 @opindex fdwarf2-cfi-asm
5171 @opindex fno-dwarf2-cfi-asm
5172 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
5173 instead of using GAS @code{.cfi_*} directives.
5175 @cindex @command{prof}
5178 Generate extra code to write profile information suitable for the
5179 analysis program @command{prof}. You must use this option when compiling
5180 the source files you want data about, and you must also use it when
5183 @cindex @command{gprof}
5186 Generate extra code to write profile information suitable for the
5187 analysis program @command{gprof}. You must use this option when compiling
5188 the source files you want data about, and you must also use it when
5193 Makes the compiler print out each function name as it is compiled, and
5194 print some statistics about each pass when it finishes.
5197 @opindex ftime-report
5198 Makes the compiler print some statistics about the time consumed by each
5199 pass when it finishes.
5202 @opindex fmem-report
5203 Makes the compiler print some statistics about permanent memory
5204 allocation when it finishes.
5206 @item -fmem-report-wpa
5207 @opindex fmem-report-wpa
5208 Makes the compiler print some statistics about permanent memory
5209 allocation for the WPA phase only.
5211 @item -fpre-ipa-mem-report
5212 @opindex fpre-ipa-mem-report
5213 @item -fpost-ipa-mem-report
5214 @opindex fpost-ipa-mem-report
5215 Makes the compiler print some statistics about permanent memory
5216 allocation before or after interprocedural optimization.
5218 @item -fprofile-report
5219 @opindex fprofile-report
5220 Makes the compiler print some statistics about consistency of the
5221 (estimated) profile and effect of individual passes.
5224 @opindex fstack-usage
5225 Makes the compiler output stack usage information for the program, on a
5226 per-function basis. The filename for the dump is made by appending
5227 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
5228 the output file, if explicitly specified and it is not an executable,
5229 otherwise it is the basename of the source file. An entry is made up
5234 The name of the function.
5238 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
5241 The qualifier @code{static} means that the function manipulates the stack
5242 statically: a fixed number of bytes are allocated for the frame on function
5243 entry and released on function exit; no stack adjustments are otherwise made
5244 in the function. The second field is this fixed number of bytes.
5246 The qualifier @code{dynamic} means that the function manipulates the stack
5247 dynamically: in addition to the static allocation described above, stack
5248 adjustments are made in the body of the function, for example to push/pop
5249 arguments around function calls. If the qualifier @code{bounded} is also
5250 present, the amount of these adjustments is bounded at compile time and
5251 the second field is an upper bound of the total amount of stack used by
5252 the function. If it is not present, the amount of these adjustments is
5253 not bounded at compile time and the second field only represents the
5256 @item -fprofile-arcs
5257 @opindex fprofile-arcs
5258 Add code so that program flow @dfn{arcs} are instrumented. During
5259 execution the program records how many times each branch and call is
5260 executed and how many times it is taken or returns. When the compiled
5261 program exits it saves this data to a file called
5262 @file{@var{auxname}.gcda} for each source file. The data may be used for
5263 profile-directed optimizations (@option{-fbranch-probabilities}), or for
5264 test coverage analysis (@option{-ftest-coverage}). Each object file's
5265 @var{auxname} is generated from the name of the output file, if
5266 explicitly specified and it is not the final executable, otherwise it is
5267 the basename of the source file. In both cases any suffix is removed
5268 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
5269 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
5270 @xref{Cross-profiling}.
5272 @cindex @command{gcov}
5276 This option is used to compile and link code instrumented for coverage
5277 analysis. The option is a synonym for @option{-fprofile-arcs}
5278 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
5279 linking). See the documentation for those options for more details.
5284 Compile the source files with @option{-fprofile-arcs} plus optimization
5285 and code generation options. For test coverage analysis, use the
5286 additional @option{-ftest-coverage} option. You do not need to profile
5287 every source file in a program.
5290 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
5291 (the latter implies the former).
5294 Run the program on a representative workload to generate the arc profile
5295 information. This may be repeated any number of times. You can run
5296 concurrent instances of your program, and provided that the file system
5297 supports locking, the data files will be correctly updated. Also
5298 @code{fork} calls are detected and correctly handled (double counting
5302 For profile-directed optimizations, compile the source files again with
5303 the same optimization and code generation options plus
5304 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
5305 Control Optimization}).
5308 For test coverage analysis, use @command{gcov} to produce human readable
5309 information from the @file{.gcno} and @file{.gcda} files. Refer to the
5310 @command{gcov} documentation for further information.
5314 With @option{-fprofile-arcs}, for each function of your program GCC
5315 creates a program flow graph, then finds a spanning tree for the graph.
5316 Only arcs that are not on the spanning tree have to be instrumented: the
5317 compiler adds code to count the number of times that these arcs are
5318 executed. When an arc is the only exit or only entrance to a block, the
5319 instrumentation code can be added to the block; otherwise, a new basic
5320 block must be created to hold the instrumentation code.
5323 @item -ftest-coverage
5324 @opindex ftest-coverage
5325 Produce a notes file that the @command{gcov} code-coverage utility
5326 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
5327 show program coverage. Each source file's note file is called
5328 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
5329 above for a description of @var{auxname} and instructions on how to
5330 generate test coverage data. Coverage data matches the source files
5331 more closely if you do not optimize.
5333 @item -fdbg-cnt-list
5334 @opindex fdbg-cnt-list
5335 Print the name and the counter upper bound for all debug counters.
5338 @item -fdbg-cnt=@var{counter-value-list}
5340 Set the internal debug counter upper bound. @var{counter-value-list}
5341 is a comma-separated list of @var{name}:@var{value} pairs
5342 which sets the upper bound of each debug counter @var{name} to @var{value}.
5343 All debug counters have the initial upper bound of @code{UINT_MAX};
5344 thus @code{dbg_cnt()} returns true always unless the upper bound
5345 is set by this option.
5346 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
5347 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
5349 @item -fenable-@var{kind}-@var{pass}
5350 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
5354 This is a set of options that are used to explicitly disable/enable
5355 optimization passes. These options are intended for use for debugging GCC.
5356 Compiler users should use regular options for enabling/disabling
5361 @item -fdisable-ipa-@var{pass}
5362 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
5363 statically invoked in the compiler multiple times, the pass name should be
5364 appended with a sequential number starting from 1.
5366 @item -fdisable-rtl-@var{pass}
5367 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
5368 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
5369 statically invoked in the compiler multiple times, the pass name should be
5370 appended with a sequential number starting from 1. @var{range-list} is a
5371 comma-separated list of function ranges or assembler names. Each range is a number
5372 pair separated by a colon. The range is inclusive in both ends. If the range
5373 is trivial, the number pair can be simplified as a single number. If the
5374 function's call graph node's @var{uid} falls within one of the specified ranges,
5375 the @var{pass} is disabled for that function. The @var{uid} is shown in the
5376 function header of a dump file, and the pass names can be dumped by using
5377 option @option{-fdump-passes}.
5379 @item -fdisable-tree-@var{pass}
5380 @itemx -fdisable-tree-@var{pass}=@var{range-list}
5381 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
5384 @item -fenable-ipa-@var{pass}
5385 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
5386 statically invoked in the compiler multiple times, the pass name should be
5387 appended with a sequential number starting from 1.
5389 @item -fenable-rtl-@var{pass}
5390 @itemx -fenable-rtl-@var{pass}=@var{range-list}
5391 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
5392 description and examples.
5394 @item -fenable-tree-@var{pass}
5395 @itemx -fenable-tree-@var{pass}=@var{range-list}
5396 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
5397 of option arguments.
5401 Here are some examples showing uses of these options.
5405 # disable ccp1 for all functions
5407 # disable complete unroll for function whose cgraph node uid is 1
5408 -fenable-tree-cunroll=1
5409 # disable gcse2 for functions at the following ranges [1,1],
5410 # [300,400], and [400,1000]
5411 # disable gcse2 for functions foo and foo2
5412 -fdisable-rtl-gcse2=foo,foo2
5413 # disable early inlining
5414 -fdisable-tree-einline
5415 # disable ipa inlining
5416 -fdisable-ipa-inline
5417 # enable tree full unroll
5418 -fenable-tree-unroll
5422 @item -d@var{letters}
5423 @itemx -fdump-rtl-@var{pass}
5424 @itemx -fdump-rtl-@var{pass}=@var{filename}
5426 Says to make debugging dumps during compilation at times specified by
5427 @var{letters}. This is used for debugging the RTL-based passes of the
5428 compiler. The file names for most of the dumps are made by appending
5429 a pass number and a word to the @var{dumpname}, and the files are
5430 created in the directory of the output file. In case of
5431 @option{=@var{filename}} option, the dump is output on the given file
5432 instead of the pass numbered dump files. Note that the pass number is
5433 computed statically as passes get registered into the pass manager.
5434 Thus the numbering is not related to the dynamic order of execution of
5435 passes. In particular, a pass installed by a plugin could have a
5436 number over 200 even if it executed quite early. @var{dumpname} is
5437 generated from the name of the output file, if explicitly specified
5438 and it is not an executable, otherwise it is the basename of the
5439 source file. These switches may have different effects when
5440 @option{-E} is used for preprocessing.
5442 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
5443 @option{-d} option @var{letters}. Here are the possible
5444 letters for use in @var{pass} and @var{letters}, and their meanings:
5448 @item -fdump-rtl-alignments
5449 @opindex fdump-rtl-alignments
5450 Dump after branch alignments have been computed.
5452 @item -fdump-rtl-asmcons
5453 @opindex fdump-rtl-asmcons
5454 Dump after fixing rtl statements that have unsatisfied in/out constraints.
5456 @item -fdump-rtl-auto_inc_dec
5457 @opindex fdump-rtl-auto_inc_dec
5458 Dump after auto-inc-dec discovery. This pass is only run on
5459 architectures that have auto inc or auto dec instructions.
5461 @item -fdump-rtl-barriers
5462 @opindex fdump-rtl-barriers
5463 Dump after cleaning up the barrier instructions.
5465 @item -fdump-rtl-bbpart
5466 @opindex fdump-rtl-bbpart
5467 Dump after partitioning hot and cold basic blocks.
5469 @item -fdump-rtl-bbro
5470 @opindex fdump-rtl-bbro
5471 Dump after block reordering.
5473 @item -fdump-rtl-btl1
5474 @itemx -fdump-rtl-btl2
5475 @opindex fdump-rtl-btl2
5476 @opindex fdump-rtl-btl2
5477 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
5478 after the two branch
5479 target load optimization passes.
5481 @item -fdump-rtl-bypass
5482 @opindex fdump-rtl-bypass
5483 Dump after jump bypassing and control flow optimizations.
5485 @item -fdump-rtl-combine
5486 @opindex fdump-rtl-combine
5487 Dump after the RTL instruction combination pass.
5489 @item -fdump-rtl-compgotos
5490 @opindex fdump-rtl-compgotos
5491 Dump after duplicating the computed gotos.
5493 @item -fdump-rtl-ce1
5494 @itemx -fdump-rtl-ce2
5495 @itemx -fdump-rtl-ce3
5496 @opindex fdump-rtl-ce1
5497 @opindex fdump-rtl-ce2
5498 @opindex fdump-rtl-ce3
5499 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
5500 @option{-fdump-rtl-ce3} enable dumping after the three
5501 if conversion passes.
5503 @item -fdump-rtl-cprop_hardreg
5504 @opindex fdump-rtl-cprop_hardreg
5505 Dump after hard register copy propagation.
5507 @item -fdump-rtl-csa
5508 @opindex fdump-rtl-csa
5509 Dump after combining stack adjustments.
5511 @item -fdump-rtl-cse1
5512 @itemx -fdump-rtl-cse2
5513 @opindex fdump-rtl-cse1
5514 @opindex fdump-rtl-cse2
5515 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
5516 the two common subexpression elimination passes.
5518 @item -fdump-rtl-dce
5519 @opindex fdump-rtl-dce
5520 Dump after the standalone dead code elimination passes.
5522 @item -fdump-rtl-dbr
5523 @opindex fdump-rtl-dbr
5524 Dump after delayed branch scheduling.
5526 @item -fdump-rtl-dce1
5527 @itemx -fdump-rtl-dce2
5528 @opindex fdump-rtl-dce1
5529 @opindex fdump-rtl-dce2
5530 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
5531 the two dead store elimination passes.
5534 @opindex fdump-rtl-eh
5535 Dump after finalization of EH handling code.
5537 @item -fdump-rtl-eh_ranges
5538 @opindex fdump-rtl-eh_ranges
5539 Dump after conversion of EH handling range regions.
5541 @item -fdump-rtl-expand
5542 @opindex fdump-rtl-expand
5543 Dump after RTL generation.
5545 @item -fdump-rtl-fwprop1
5546 @itemx -fdump-rtl-fwprop2
5547 @opindex fdump-rtl-fwprop1
5548 @opindex fdump-rtl-fwprop2
5549 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
5550 dumping after the two forward propagation passes.
5552 @item -fdump-rtl-gcse1
5553 @itemx -fdump-rtl-gcse2
5554 @opindex fdump-rtl-gcse1
5555 @opindex fdump-rtl-gcse2
5556 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
5557 after global common subexpression elimination.
5559 @item -fdump-rtl-init-regs
5560 @opindex fdump-rtl-init-regs
5561 Dump after the initialization of the registers.
5563 @item -fdump-rtl-initvals
5564 @opindex fdump-rtl-initvals
5565 Dump after the computation of the initial value sets.
5567 @item -fdump-rtl-into_cfglayout
5568 @opindex fdump-rtl-into_cfglayout
5569 Dump after converting to cfglayout mode.
5571 @item -fdump-rtl-ira
5572 @opindex fdump-rtl-ira
5573 Dump after iterated register allocation.
5575 @item -fdump-rtl-jump
5576 @opindex fdump-rtl-jump
5577 Dump after the second jump optimization.
5579 @item -fdump-rtl-loop2
5580 @opindex fdump-rtl-loop2
5581 @option{-fdump-rtl-loop2} enables dumping after the rtl
5582 loop optimization passes.
5584 @item -fdump-rtl-mach
5585 @opindex fdump-rtl-mach
5586 Dump after performing the machine dependent reorganization pass, if that
5589 @item -fdump-rtl-mode_sw
5590 @opindex fdump-rtl-mode_sw
5591 Dump after removing redundant mode switches.
5593 @item -fdump-rtl-rnreg
5594 @opindex fdump-rtl-rnreg
5595 Dump after register renumbering.
5597 @item -fdump-rtl-outof_cfglayout
5598 @opindex fdump-rtl-outof_cfglayout
5599 Dump after converting from cfglayout mode.
5601 @item -fdump-rtl-peephole2
5602 @opindex fdump-rtl-peephole2
5603 Dump after the peephole pass.
5605 @item -fdump-rtl-postreload
5606 @opindex fdump-rtl-postreload
5607 Dump after post-reload optimizations.
5609 @itemx -fdump-rtl-pro_and_epilogue
5610 @opindex fdump-rtl-pro_and_epilogue
5611 Dump after generating the function prologues and epilogues.
5613 @item -fdump-rtl-regmove
5614 @opindex fdump-rtl-regmove
5615 Dump after the register move pass.
5617 @item -fdump-rtl-sched1
5618 @itemx -fdump-rtl-sched2
5619 @opindex fdump-rtl-sched1
5620 @opindex fdump-rtl-sched2
5621 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
5622 after the basic block scheduling passes.
5624 @item -fdump-rtl-see
5625 @opindex fdump-rtl-see
5626 Dump after sign extension elimination.
5628 @item -fdump-rtl-seqabstr
5629 @opindex fdump-rtl-seqabstr
5630 Dump after common sequence discovery.
5632 @item -fdump-rtl-shorten
5633 @opindex fdump-rtl-shorten
5634 Dump after shortening branches.
5636 @item -fdump-rtl-sibling
5637 @opindex fdump-rtl-sibling
5638 Dump after sibling call optimizations.
5640 @item -fdump-rtl-split1
5641 @itemx -fdump-rtl-split2
5642 @itemx -fdump-rtl-split3
5643 @itemx -fdump-rtl-split4
5644 @itemx -fdump-rtl-split5
5645 @opindex fdump-rtl-split1
5646 @opindex fdump-rtl-split2
5647 @opindex fdump-rtl-split3
5648 @opindex fdump-rtl-split4
5649 @opindex fdump-rtl-split5
5650 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
5651 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
5652 @option{-fdump-rtl-split5} enable dumping after five rounds of
5653 instruction splitting.
5655 @item -fdump-rtl-sms
5656 @opindex fdump-rtl-sms
5657 Dump after modulo scheduling. This pass is only run on some
5660 @item -fdump-rtl-stack
5661 @opindex fdump-rtl-stack
5662 Dump after conversion from GCC's ``flat register file'' registers to the
5663 x87's stack-like registers. This pass is only run on x86 variants.
5665 @item -fdump-rtl-subreg1
5666 @itemx -fdump-rtl-subreg2
5667 @opindex fdump-rtl-subreg1
5668 @opindex fdump-rtl-subreg2
5669 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
5670 the two subreg expansion passes.
5672 @item -fdump-rtl-unshare
5673 @opindex fdump-rtl-unshare
5674 Dump after all rtl has been unshared.
5676 @item -fdump-rtl-vartrack
5677 @opindex fdump-rtl-vartrack
5678 Dump after variable tracking.
5680 @item -fdump-rtl-vregs
5681 @opindex fdump-rtl-vregs
5682 Dump after converting virtual registers to hard registers.
5684 @item -fdump-rtl-web
5685 @opindex fdump-rtl-web
5686 Dump after live range splitting.
5688 @item -fdump-rtl-regclass
5689 @itemx -fdump-rtl-subregs_of_mode_init
5690 @itemx -fdump-rtl-subregs_of_mode_finish
5691 @itemx -fdump-rtl-dfinit
5692 @itemx -fdump-rtl-dfinish
5693 @opindex fdump-rtl-regclass
5694 @opindex fdump-rtl-subregs_of_mode_init
5695 @opindex fdump-rtl-subregs_of_mode_finish
5696 @opindex fdump-rtl-dfinit
5697 @opindex fdump-rtl-dfinish
5698 These dumps are defined but always produce empty files.
5701 @itemx -fdump-rtl-all
5703 @opindex fdump-rtl-all
5704 Produce all the dumps listed above.
5708 Annotate the assembler output with miscellaneous debugging information.
5712 Dump all macro definitions, at the end of preprocessing, in addition to
5717 Produce a core dump whenever an error occurs.
5721 Annotate the assembler output with a comment indicating which
5722 pattern and alternative is used. The length of each instruction is
5727 Dump the RTL in the assembler output as a comment before each instruction.
5728 Also turns on @option{-dp} annotation.
5732 Just generate RTL for a function instead of compiling it. Usually used
5733 with @option{-fdump-rtl-expand}.
5737 @opindex fdump-noaddr
5738 When doing debugging dumps, suppress address output. This makes it more
5739 feasible to use diff on debugging dumps for compiler invocations with
5740 different compiler binaries and/or different
5741 text / bss / data / heap / stack / dso start locations.
5743 @item -fdump-unnumbered
5744 @opindex fdump-unnumbered
5745 When doing debugging dumps, suppress instruction numbers and address output.
5746 This makes it more feasible to use diff on debugging dumps for compiler
5747 invocations with different options, in particular with and without
5750 @item -fdump-unnumbered-links
5751 @opindex fdump-unnumbered-links
5752 When doing debugging dumps (see @option{-d} option above), suppress
5753 instruction numbers for the links to the previous and next instructions
5756 @item -fdump-translation-unit @r{(C++ only)}
5757 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
5758 @opindex fdump-translation-unit
5759 Dump a representation of the tree structure for the entire translation
5760 unit to a file. The file name is made by appending @file{.tu} to the
5761 source file name, and the file is created in the same directory as the
5762 output file. If the @samp{-@var{options}} form is used, @var{options}
5763 controls the details of the dump as described for the
5764 @option{-fdump-tree} options.
5766 @item -fdump-class-hierarchy @r{(C++ only)}
5767 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
5768 @opindex fdump-class-hierarchy
5769 Dump a representation of each class's hierarchy and virtual function
5770 table layout to a file. The file name is made by appending
5771 @file{.class} to the source file name, and the file is created in the
5772 same directory as the output file. If the @samp{-@var{options}} form
5773 is used, @var{options} controls the details of the dump as described
5774 for the @option{-fdump-tree} options.
5776 @item -fdump-ipa-@var{switch}
5778 Control the dumping at various stages of inter-procedural analysis
5779 language tree to a file. The file name is generated by appending a
5780 switch specific suffix to the source file name, and the file is created
5781 in the same directory as the output file. The following dumps are
5786 Enables all inter-procedural analysis dumps.
5789 Dumps information about call-graph optimization, unused function removal,
5790 and inlining decisions.
5793 Dump after function inlining.
5798 @opindex fdump-passes
5799 Dump the list of optimization passes that are turned on and off by
5800 the current command-line options.
5802 @item -fdump-statistics-@var{option}
5803 @opindex fdump-statistics
5804 Enable and control dumping of pass statistics in a separate file. The
5805 file name is generated by appending a suffix ending in
5806 @samp{.statistics} to the source file name, and the file is created in
5807 the same directory as the output file. If the @samp{-@var{option}}
5808 form is used, @samp{-stats} causes counters to be summed over the
5809 whole compilation unit while @samp{-details} dumps every event as
5810 the passes generate them. The default with no option is to sum
5811 counters for each function compiled.
5813 @item -fdump-tree-@var{switch}
5814 @itemx -fdump-tree-@var{switch}-@var{options}
5815 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
5817 Control the dumping at various stages of processing the intermediate
5818 language tree to a file. The file name is generated by appending a
5819 switch-specific suffix to the source file name, and the file is
5820 created in the same directory as the output file. In case of
5821 @option{=@var{filename}} option, the dump is output on the given file
5822 instead of the auto named dump files. If the @samp{-@var{options}}
5823 form is used, @var{options} is a list of @samp{-} separated options
5824 which control the details of the dump. Not all options are applicable
5825 to all dumps; those that are not meaningful are ignored. The
5826 following options are available
5830 Print the address of each node. Usually this is not meaningful as it
5831 changes according to the environment and source file. Its primary use
5832 is for tying up a dump file with a debug environment.
5834 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5835 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
5836 use working backward from mangled names in the assembly file.
5838 When dumping front-end intermediate representations, inhibit dumping
5839 of members of a scope or body of a function merely because that scope
5840 has been reached. Only dump such items when they are directly reachable
5843 When dumping pretty-printed trees, this option inhibits dumping the
5844 bodies of control structures.
5846 When dumping RTL, print the RTL in slim (condensed) form instead of
5847 the default LISP-like representation.
5849 Print a raw representation of the tree. By default, trees are
5850 pretty-printed into a C-like representation.
5852 Enable more detailed dumps (not honored by every dump option). Also
5853 include information from the optimization passes.
5855 Enable dumping various statistics about the pass (not honored by every dump
5858 Enable showing basic block boundaries (disabled in raw dumps).
5860 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5861 dump a representation of the control flow graph suitable for viewing with
5862 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
5863 the file is pretty-printed as a subgraph, so that GraphViz can render them
5864 all in a single plot.
5866 This option currently only works for RTL dumps, and the RTL is always
5867 dumped in slim form.
5869 Enable showing virtual operands for every statement.
5871 Enable showing line numbers for statements.
5873 Enable showing the unique ID (@code{DECL_UID}) for each variable.
5875 Enable showing the tree dump for each statement.
5877 Enable showing the EH region number holding each statement.
5879 Enable showing scalar evolution analysis details.
5881 Enable showing optimization information (only available in certain
5884 Enable showing missed optimization information (only available in certain
5887 Enable other detailed optimization information (only available in
5889 @item =@var{filename}
5890 Instead of an auto named dump file, output into the given file
5891 name. The file names @file{stdout} and @file{stderr} are treated
5892 specially and are considered already open standard streams. For
5896 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
5897 -fdump-tree-pre=stderr file.c
5900 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
5901 output on to @file{stderr}. If two conflicting dump filenames are
5902 given for the same pass, then the latter option overrides the earlier
5906 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5907 and @option{lineno}.
5910 Turn on all optimization options, i.e., @option{optimized},
5911 @option{missed}, and @option{note}.
5914 The following tree dumps are possible:
5918 @opindex fdump-tree-original
5919 Dump before any tree based optimization, to @file{@var{file}.original}.
5922 @opindex fdump-tree-optimized
5923 Dump after all tree based optimization, to @file{@var{file}.optimized}.
5926 @opindex fdump-tree-gimple
5927 Dump each function before and after the gimplification pass to a file. The
5928 file name is made by appending @file{.gimple} to the source file name.
5931 @opindex fdump-tree-cfg
5932 Dump the control flow graph of each function to a file. The file name is
5933 made by appending @file{.cfg} to the source file name.
5936 @opindex fdump-tree-ch
5937 Dump each function after copying loop headers. The file name is made by
5938 appending @file{.ch} to the source file name.
5941 @opindex fdump-tree-ssa
5942 Dump SSA related information to a file. The file name is made by appending
5943 @file{.ssa} to the source file name.
5946 @opindex fdump-tree-alias
5947 Dump aliasing information for each function. The file name is made by
5948 appending @file{.alias} to the source file name.
5951 @opindex fdump-tree-ccp
5952 Dump each function after CCP@. The file name is made by appending
5953 @file{.ccp} to the source file name.
5956 @opindex fdump-tree-storeccp
5957 Dump each function after STORE-CCP@. The file name is made by appending
5958 @file{.storeccp} to the source file name.
5961 @opindex fdump-tree-pre
5962 Dump trees after partial redundancy elimination. The file name is made
5963 by appending @file{.pre} to the source file name.
5966 @opindex fdump-tree-fre
5967 Dump trees after full redundancy elimination. The file name is made
5968 by appending @file{.fre} to the source file name.
5971 @opindex fdump-tree-copyprop
5972 Dump trees after copy propagation. The file name is made
5973 by appending @file{.copyprop} to the source file name.
5975 @item store_copyprop
5976 @opindex fdump-tree-store_copyprop
5977 Dump trees after store copy-propagation. The file name is made
5978 by appending @file{.store_copyprop} to the source file name.
5981 @opindex fdump-tree-dce
5982 Dump each function after dead code elimination. The file name is made by
5983 appending @file{.dce} to the source file name.
5986 @opindex fdump-tree-mudflap
5987 Dump each function after adding mudflap instrumentation. The file name is
5988 made by appending @file{.mudflap} to the source file name.
5991 @opindex fdump-tree-sra
5992 Dump each function after performing scalar replacement of aggregates. The
5993 file name is made by appending @file{.sra} to the source file name.
5996 @opindex fdump-tree-sink
5997 Dump each function after performing code sinking. The file name is made
5998 by appending @file{.sink} to the source file name.
6001 @opindex fdump-tree-dom
6002 Dump each function after applying dominator tree optimizations. The file
6003 name is made by appending @file{.dom} to the source file name.
6006 @opindex fdump-tree-dse
6007 Dump each function after applying dead store elimination. The file
6008 name is made by appending @file{.dse} to the source file name.
6011 @opindex fdump-tree-phiopt
6012 Dump each function after optimizing PHI nodes into straightline code. The file
6013 name is made by appending @file{.phiopt} to the source file name.
6016 @opindex fdump-tree-forwprop
6017 Dump each function after forward propagating single use variables. The file
6018 name is made by appending @file{.forwprop} to the source file name.
6021 @opindex fdump-tree-copyrename
6022 Dump each function after applying the copy rename optimization. The file
6023 name is made by appending @file{.copyrename} to the source file name.
6026 @opindex fdump-tree-nrv
6027 Dump each function after applying the named return value optimization on
6028 generic trees. The file name is made by appending @file{.nrv} to the source
6032 @opindex fdump-tree-vect
6033 Dump each function after applying vectorization of loops. The file name is
6034 made by appending @file{.vect} to the source file name.
6037 @opindex fdump-tree-slp
6038 Dump each function after applying vectorization of basic blocks. The file name
6039 is made by appending @file{.slp} to the source file name.
6042 @opindex fdump-tree-vrp
6043 Dump each function after Value Range Propagation (VRP). The file name
6044 is made by appending @file{.vrp} to the source file name.
6047 @opindex fdump-tree-all
6048 Enable all the available tree dumps with the flags provided in this option.
6052 @itemx -fopt-info-@var{options}
6053 @itemx -fopt-info-@var{options}=@var{filename}
6055 Controls optimization dumps from various optimization passes. If the
6056 @samp{-@var{options}} form is used, @var{options} is a list of
6057 @samp{-} separated options to select the dump details and
6058 optimizations. If @var{options} is not specified, it defaults to
6059 @option{all} for details and @option{optall} for optimization
6060 groups. If the @var{filename} is not specified, it defaults to
6061 @file{stderr}. Note that the output @var{filename} will be overwritten
6062 in case of multiple translation units. If a combined output from
6063 multiple translation units is desired, @file{stderr} should be used
6066 The options can be divided into two groups, 1) options describing the
6067 verbosity of the dump, and 2) options describing which optimizations
6068 should be included. The options from both the groups can be freely
6069 mixed as they are non-overlapping. However, in case of any conflicts,
6070 the latter options override the earlier options on the command
6071 line. Though multiple -fopt-info options are accepted, only one of
6072 them can have @option{=filename}. If other filenames are provided then
6073 all but the first one are ignored.
6075 The dump verbosity has the following options
6079 Print information when an optimization is successfully applied. It is
6080 up to a pass to decide which information is relevant. For example, the
6081 vectorizer passes print the source location of loops which got
6082 successfully vectorized.
6084 Print information about missed optimizations. Individual passes
6085 control which informations to include in the output. For example,
6088 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
6091 will print information about missed optimization opportunities from
6092 vectorization passes on stderr.
6094 Print verbose information about optimizations, such as certain
6095 transformations, more detailed messages about decisions etc.
6097 Print detailed optimization information. This includes
6098 @var{optimized}, @var{missed}, and @var{note}.
6101 The second set of options describes a group of optimizations and may
6102 include one or more of the following.
6106 Enable dumps from all interprocedural optimizations.
6108 Enable dumps from all loop optimizations.
6110 Enable dumps from all inlining optimizations.
6112 Enable dumps from all vectorization optimizations.
6117 gcc -O3 -fopt-info-missed=missed.all
6120 outputs missed optimization report from all the passes into
6125 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
6128 will output information about missed optimizations as well as
6129 optimized locations from all the inlining passes into
6132 If the @var{filename} is provided, then the dumps from all the
6133 applicable optimizations are concatenated into the @file{filename}.
6134 Otherwise the dump is output onto @file{stderr}. If @var{options} is
6135 omitted, it defaults to @option{all-optall}, which means dump all
6136 available optimization info from all the passes. In the following
6137 example, all optimization info is output on to @file{stderr}.
6143 Note that @option{-fopt-info-vec-missed} behaves the same as
6144 @option{-fopt-info-missed-vec}.
6146 As another example, consider
6149 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
6152 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
6153 in conflict since only one output file is allowed. In this case, only
6154 the first option takes effect and the subsequent options are
6155 ignored. Thus only the @file{vec.miss} is produced which cotaints
6156 dumps from the vectorizer about missed opportunities.
6158 @item -ftree-vectorizer-verbose=@var{n}
6159 @opindex ftree-vectorizer-verbose
6160 This option is deprecated and is implemented in terms of
6161 @option{-fopt-info}. Please use @option{-fopt-info-@var{kind}} form
6162 instead, where @var{kind} is one of the valid opt-info options. It
6163 prints additional optimization information. For @var{n}=0 no
6164 diagnostic information is reported. If @var{n}=1 the vectorizer
6165 reports each loop that got vectorized, and the total number of loops
6166 that got vectorized. If @var{n}=2 the vectorizer reports locations
6167 which could not be vectorized and the reasons for those. For any
6168 higher verbosity levels all the analysis and transformation
6169 information from the vectorizer is reported.
6171 Note that the information output by @option{-ftree-vectorizer-verbose}
6172 option is sent to @file{stderr}. If the equivalent form
6173 @option{-fopt-info-@var{options}=@var{filename}} is used then the
6174 output is sent into @var{filename} instead.
6176 @item -frandom-seed=@var{string}
6177 @opindex frandom-seed
6178 This option provides a seed that GCC uses in place of
6179 random numbers in generating certain symbol names
6180 that have to be different in every compiled file. It is also used to
6181 place unique stamps in coverage data files and the object files that
6182 produce them. You can use the @option{-frandom-seed} option to produce
6183 reproducibly identical object files.
6185 The @var{string} should be different for every file you compile.
6187 @item -fsched-verbose=@var{n}
6188 @opindex fsched-verbose
6189 On targets that use instruction scheduling, this option controls the
6190 amount of debugging output the scheduler prints. This information is
6191 written to standard error, unless @option{-fdump-rtl-sched1} or
6192 @option{-fdump-rtl-sched2} is specified, in which case it is output
6193 to the usual dump listing file, @file{.sched1} or @file{.sched2}
6194 respectively. However for @var{n} greater than nine, the output is
6195 always printed to standard error.
6197 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
6198 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
6199 For @var{n} greater than one, it also output basic block probabilities,
6200 detailed ready list information and unit/insn info. For @var{n} greater
6201 than two, it includes RTL at abort point, control-flow and regions info.
6202 And for @var{n} over four, @option{-fsched-verbose} also includes
6206 @itemx -save-temps=cwd
6208 Store the usual ``temporary'' intermediate files permanently; place them
6209 in the current directory and name them based on the source file. Thus,
6210 compiling @file{foo.c} with @option{-c -save-temps} produces files
6211 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
6212 preprocessed @file{foo.i} output file even though the compiler now
6213 normally uses an integrated preprocessor.
6215 When used in combination with the @option{-x} command-line option,
6216 @option{-save-temps} is sensible enough to avoid over writing an
6217 input source file with the same extension as an intermediate file.
6218 The corresponding intermediate file may be obtained by renaming the
6219 source file before using @option{-save-temps}.
6221 If you invoke GCC in parallel, compiling several different source
6222 files that share a common base name in different subdirectories or the
6223 same source file compiled for multiple output destinations, it is
6224 likely that the different parallel compilers will interfere with each
6225 other, and overwrite the temporary files. For instance:
6228 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
6229 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
6232 may result in @file{foo.i} and @file{foo.o} being written to
6233 simultaneously by both compilers.
6235 @item -save-temps=obj
6236 @opindex save-temps=obj
6237 Store the usual ``temporary'' intermediate files permanently. If the
6238 @option{-o} option is used, the temporary files are based on the
6239 object file. If the @option{-o} option is not used, the
6240 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
6245 gcc -save-temps=obj -c foo.c
6246 gcc -save-temps=obj -c bar.c -o dir/xbar.o
6247 gcc -save-temps=obj foobar.c -o dir2/yfoobar
6251 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
6252 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
6253 @file{dir2/yfoobar.o}.
6255 @item -time@r{[}=@var{file}@r{]}
6257 Report the CPU time taken by each subprocess in the compilation
6258 sequence. For C source files, this is the compiler proper and assembler
6259 (plus the linker if linking is done).
6261 Without the specification of an output file, the output looks like this:
6268 The first number on each line is the ``user time'', that is time spent
6269 executing the program itself. The second number is ``system time'',
6270 time spent executing operating system routines on behalf of the program.
6271 Both numbers are in seconds.
6273 With the specification of an output file, the output is appended to the
6274 named file, and it looks like this:
6277 0.12 0.01 cc1 @var{options}
6278 0.00 0.01 as @var{options}
6281 The ``user time'' and the ``system time'' are moved before the program
6282 name, and the options passed to the program are displayed, so that one
6283 can later tell what file was being compiled, and with which options.
6285 @item -fvar-tracking
6286 @opindex fvar-tracking
6287 Run variable tracking pass. It computes where variables are stored at each
6288 position in code. Better debugging information is then generated
6289 (if the debugging information format supports this information).
6291 It is enabled by default when compiling with optimization (@option{-Os},
6292 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6293 the debug info format supports it.
6295 @item -fvar-tracking-assignments
6296 @opindex fvar-tracking-assignments
6297 @opindex fno-var-tracking-assignments
6298 Annotate assignments to user variables early in the compilation and
6299 attempt to carry the annotations over throughout the compilation all the
6300 way to the end, in an attempt to improve debug information while
6301 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6303 It can be enabled even if var-tracking is disabled, in which case
6304 annotations are created and maintained, but discarded at the end.
6306 @item -fvar-tracking-assignments-toggle
6307 @opindex fvar-tracking-assignments-toggle
6308 @opindex fno-var-tracking-assignments-toggle
6309 Toggle @option{-fvar-tracking-assignments}, in the same way that
6310 @option{-gtoggle} toggles @option{-g}.
6312 @item -print-file-name=@var{library}
6313 @opindex print-file-name
6314 Print the full absolute name of the library file @var{library} that
6315 would be used when linking---and don't do anything else. With this
6316 option, GCC does not compile or link anything; it just prints the
6319 @item -print-multi-directory
6320 @opindex print-multi-directory
6321 Print the directory name corresponding to the multilib selected by any
6322 other switches present in the command line. This directory is supposed
6323 to exist in @env{GCC_EXEC_PREFIX}.
6325 @item -print-multi-lib
6326 @opindex print-multi-lib
6327 Print the mapping from multilib directory names to compiler switches
6328 that enable them. The directory name is separated from the switches by
6329 @samp{;}, and each switch starts with an @samp{@@} instead of the
6330 @samp{-}, without spaces between multiple switches. This is supposed to
6331 ease shell processing.
6333 @item -print-multi-os-directory
6334 @opindex print-multi-os-directory
6335 Print the path to OS libraries for the selected
6336 multilib, relative to some @file{lib} subdirectory. If OS libraries are
6337 present in the @file{lib} subdirectory and no multilibs are used, this is
6338 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
6339 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
6340 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
6341 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
6343 @item -print-multiarch
6344 @opindex print-multiarch
6345 Print the path to OS libraries for the selected multiarch,
6346 relative to some @file{lib} subdirectory.
6348 @item -print-prog-name=@var{program}
6349 @opindex print-prog-name
6350 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
6352 @item -print-libgcc-file-name
6353 @opindex print-libgcc-file-name
6354 Same as @option{-print-file-name=libgcc.a}.
6356 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
6357 but you do want to link with @file{libgcc.a}. You can do:
6360 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
6363 @item -print-search-dirs
6364 @opindex print-search-dirs
6365 Print the name of the configured installation directory and a list of
6366 program and library directories @command{gcc} searches---and don't do anything else.
6368 This is useful when @command{gcc} prints the error message
6369 @samp{installation problem, cannot exec cpp0: No such file or directory}.
6370 To resolve this you either need to put @file{cpp0} and the other compiler
6371 components where @command{gcc} expects to find them, or you can set the environment
6372 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
6373 Don't forget the trailing @samp{/}.
6374 @xref{Environment Variables}.
6376 @item -print-sysroot
6377 @opindex print-sysroot
6378 Print the target sysroot directory that is used during
6379 compilation. This is the target sysroot specified either at configure
6380 time or using the @option{--sysroot} option, possibly with an extra
6381 suffix that depends on compilation options. If no target sysroot is
6382 specified, the option prints nothing.
6384 @item -print-sysroot-headers-suffix
6385 @opindex print-sysroot-headers-suffix
6386 Print the suffix added to the target sysroot when searching for
6387 headers, or give an error if the compiler is not configured with such
6388 a suffix---and don't do anything else.
6391 @opindex dumpmachine
6392 Print the compiler's target machine (for example,
6393 @samp{i686-pc-linux-gnu})---and don't do anything else.
6396 @opindex dumpversion
6397 Print the compiler version (for example, @samp{3.0})---and don't do
6402 Print the compiler's built-in specs---and don't do anything else. (This
6403 is used when GCC itself is being built.) @xref{Spec Files}.
6405 @item -fno-eliminate-unused-debug-types
6406 @opindex feliminate-unused-debug-types
6407 @opindex fno-eliminate-unused-debug-types
6408 Normally, when producing DWARF 2 output, GCC avoids producing debug symbol
6409 output for types that are nowhere used in the source file being compiled.
6410 Sometimes it is useful to have GCC emit debugging
6411 information for all types declared in a compilation
6412 unit, regardless of whether or not they are actually used
6413 in that compilation unit, for example
6414 if, in the debugger, you want to cast a value to a type that is
6415 not actually used in your program (but is declared). More often,
6416 however, this results in a significant amount of wasted space.
6419 @node Optimize Options
6420 @section Options That Control Optimization
6421 @cindex optimize options
6422 @cindex options, optimization
6424 These options control various sorts of optimizations.
6426 Without any optimization option, the compiler's goal is to reduce the
6427 cost of compilation and to make debugging produce the expected
6428 results. Statements are independent: if you stop the program with a
6429 breakpoint between statements, you can then assign a new value to any
6430 variable or change the program counter to any other statement in the
6431 function and get exactly the results you expect from the source
6434 Turning on optimization flags makes the compiler attempt to improve
6435 the performance and/or code size at the expense of compilation time
6436 and possibly the ability to debug the program.
6438 The compiler performs optimization based on the knowledge it has of the
6439 program. Compiling multiple files at once to a single output file mode allows
6440 the compiler to use information gained from all of the files when compiling
6443 Not all optimizations are controlled directly by a flag. Only
6444 optimizations that have a flag are listed in this section.
6446 Most optimizations are only enabled if an @option{-O} level is set on
6447 the command line. Otherwise they are disabled, even if individual
6448 optimization flags are specified.
6450 Depending on the target and how GCC was configured, a slightly different
6451 set of optimizations may be enabled at each @option{-O} level than
6452 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6453 to find out the exact set of optimizations that are enabled at each level.
6454 @xref{Overall Options}, for examples.
6461 Optimize. Optimizing compilation takes somewhat more time, and a lot
6462 more memory for a large function.
6464 With @option{-O}, the compiler tries to reduce code size and execution
6465 time, without performing any optimizations that take a great deal of
6468 @option{-O} turns on the following optimization flags:
6472 -fcprop-registers @gol
6475 -fdelayed-branch @gol
6477 -fguess-branch-probability @gol
6478 -fif-conversion2 @gol
6479 -fif-conversion @gol
6480 -fipa-pure-const @gol
6482 -fipa-reference @gol
6484 -fsplit-wide-types @gol
6486 -ftree-builtin-call-dce @gol
6489 -ftree-copyrename @gol
6491 -ftree-dominator-opts @gol
6493 -ftree-forwprop @gol
6502 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6503 where doing so does not interfere with debugging.
6507 Optimize even more. GCC performs nearly all supported optimizations
6508 that do not involve a space-speed tradeoff.
6509 As compared to @option{-O}, this option increases both compilation time
6510 and the performance of the generated code.
6512 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6513 also turns on the following optimization flags:
6514 @gccoptlist{-fthread-jumps @gol
6515 -falign-functions -falign-jumps @gol
6516 -falign-loops -falign-labels @gol
6519 -fcse-follow-jumps -fcse-skip-blocks @gol
6520 -fdelete-null-pointer-checks @gol
6522 -fexpensive-optimizations @gol
6523 -fgcse -fgcse-lm @gol
6524 -fhoist-adjacent-loads @gol
6525 -finline-small-functions @gol
6526 -findirect-inlining @gol
6528 -foptimize-sibling-calls @gol
6529 -fpartial-inlining @gol
6532 -freorder-blocks -freorder-functions @gol
6533 -frerun-cse-after-loop @gol
6534 -fsched-interblock -fsched-spec @gol
6535 -fschedule-insns -fschedule-insns2 @gol
6536 -fstrict-aliasing -fstrict-overflow @gol
6537 -ftree-switch-conversion -ftree-tail-merge @gol
6541 Please note the warning under @option{-fgcse} about
6542 invoking @option{-O2} on programs that use computed gotos.
6546 Optimize yet more. @option{-O3} turns on all optimizations specified
6547 by @option{-O2} and also turns on the @option{-finline-functions},
6548 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6549 @option{-fgcse-after-reload}, @option{-ftree-vectorize},
6550 @option{-fvect-cost-model},
6551 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
6555 Reduce compilation time and make debugging produce the expected
6556 results. This is the default.
6560 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6561 do not typically increase code size. It also performs further
6562 optimizations designed to reduce code size.
6564 @option{-Os} disables the following optimization flags:
6565 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6566 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
6567 -fprefetch-loop-arrays -ftree-vect-loop-version}
6571 Disregard strict standards compliance. @option{-Ofast} enables all
6572 @option{-O3} optimizations. It also enables optimizations that are not
6573 valid for all standard-compliant programs.
6574 It turns on @option{-ffast-math} and the Fortran-specific
6575 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6579 Optimize debugging experience. @option{-Og} enables optimizations
6580 that do not interfere with debugging. It should be the optimization
6581 level of choice for the standard edit-compile-debug cycle, offering
6582 a reasonable level of optimization while maintaining fast compilation
6583 and a good debugging experience.
6585 If you use multiple @option{-O} options, with or without level numbers,
6586 the last such option is the one that is effective.
6589 Options of the form @option{-f@var{flag}} specify machine-independent
6590 flags. Most flags have both positive and negative forms; the negative
6591 form of @option{-ffoo} is @option{-fno-foo}. In the table
6592 below, only one of the forms is listed---the one you typically
6593 use. You can figure out the other form by either removing @samp{no-}
6596 The following options control specific optimizations. They are either
6597 activated by @option{-O} options or are related to ones that are. You
6598 can use the following flags in the rare cases when ``fine-tuning'' of
6599 optimizations to be performed is desired.
6602 @item -fno-default-inline
6603 @opindex fno-default-inline
6604 Do not make member functions inline by default merely because they are
6605 defined inside the class scope (C++ only). Otherwise, when you specify
6606 @w{@option{-O}}, member functions defined inside class scope are compiled
6607 inline by default; i.e., you don't need to add @samp{inline} in front of
6608 the member function name.
6610 @item -fno-defer-pop
6611 @opindex fno-defer-pop
6612 Always pop the arguments to each function call as soon as that function
6613 returns. For machines that must pop arguments after a function call,
6614 the compiler normally lets arguments accumulate on the stack for several
6615 function calls and pops them all at once.
6617 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6619 @item -fforward-propagate
6620 @opindex fforward-propagate
6621 Perform a forward propagation pass on RTL@. The pass tries to combine two
6622 instructions and checks if the result can be simplified. If loop unrolling
6623 is active, two passes are performed and the second is scheduled after
6626 This option is enabled by default at optimization levels @option{-O},
6627 @option{-O2}, @option{-O3}, @option{-Os}.
6629 @item -ffp-contract=@var{style}
6630 @opindex ffp-contract
6631 @option{-ffp-contract=off} disables floating-point expression contraction.
6632 @option{-ffp-contract=fast} enables floating-point expression contraction
6633 such as forming of fused multiply-add operations if the target has
6634 native support for them.
6635 @option{-ffp-contract=on} enables floating-point expression contraction
6636 if allowed by the language standard. This is currently not implemented
6637 and treated equal to @option{-ffp-contract=off}.
6639 The default is @option{-ffp-contract=fast}.
6641 @item -fomit-frame-pointer
6642 @opindex fomit-frame-pointer
6643 Don't keep the frame pointer in a register for functions that
6644 don't need one. This avoids the instructions to save, set up and
6645 restore frame pointers; it also makes an extra register available
6646 in many functions. @strong{It also makes debugging impossible on
6649 On some machines, such as the VAX, this flag has no effect, because
6650 the standard calling sequence automatically handles the frame pointer
6651 and nothing is saved by pretending it doesn't exist. The
6652 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6653 whether a target machine supports this flag. @xref{Registers,,Register
6654 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6656 Starting with GCC version 4.6, the default setting (when not optimizing for
6657 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets has been changed to
6658 @option{-fomit-frame-pointer}. The default can be reverted to
6659 @option{-fno-omit-frame-pointer} by configuring GCC with the
6660 @option{--enable-frame-pointer} configure option.
6662 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6664 @item -foptimize-sibling-calls
6665 @opindex foptimize-sibling-calls
6666 Optimize sibling and tail recursive calls.
6668 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6672 Do not expand any functions inline apart from those marked with
6673 the @code{always_inline} attribute. This is the default when not
6676 Single functions can be exempted from inlining by marking them
6677 with the @code{noinline} attribute.
6679 @item -finline-small-functions
6680 @opindex finline-small-functions
6681 Integrate functions into their callers when their body is smaller than expected
6682 function call code (so overall size of program gets smaller). The compiler
6683 heuristically decides which functions are simple enough to be worth integrating
6684 in this way. This inlining applies to all functions, even those not declared
6687 Enabled at level @option{-O2}.
6689 @item -findirect-inlining
6690 @opindex findirect-inlining
6691 Inline also indirect calls that are discovered to be known at compile
6692 time thanks to previous inlining. This option has any effect only
6693 when inlining itself is turned on by the @option{-finline-functions}
6694 or @option{-finline-small-functions} options.
6696 Enabled at level @option{-O2}.
6698 @item -finline-functions
6699 @opindex finline-functions
6700 Consider all functions for inlining, even if they are not declared inline.
6701 The compiler heuristically decides which functions are worth integrating
6704 If all calls to a given function are integrated, and the function is
6705 declared @code{static}, then the function is normally not output as
6706 assembler code in its own right.
6708 Enabled at level @option{-O3}.
6710 @item -finline-functions-called-once
6711 @opindex finline-functions-called-once
6712 Consider all @code{static} functions called once for inlining into their
6713 caller even if they are not marked @code{inline}. If a call to a given
6714 function is integrated, then the function is not output as assembler code
6717 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6719 @item -fearly-inlining
6720 @opindex fearly-inlining
6721 Inline functions marked by @code{always_inline} and functions whose body seems
6722 smaller than the function call overhead early before doing
6723 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6724 makes profiling significantly cheaper and usually inlining faster on programs
6725 having large chains of nested wrapper functions.
6731 Perform interprocedural scalar replacement of aggregates, removal of
6732 unused parameters and replacement of parameters passed by reference
6733 by parameters passed by value.
6735 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6737 @item -finline-limit=@var{n}
6738 @opindex finline-limit
6739 By default, GCC limits the size of functions that can be inlined. This flag
6740 allows coarse control of this limit. @var{n} is the size of functions that
6741 can be inlined in number of pseudo instructions.
6743 Inlining is actually controlled by a number of parameters, which may be
6744 specified individually by using @option{--param @var{name}=@var{value}}.
6745 The @option{-finline-limit=@var{n}} option sets some of these parameters
6749 @item max-inline-insns-single
6750 is set to @var{n}/2.
6751 @item max-inline-insns-auto
6752 is set to @var{n}/2.
6755 See below for a documentation of the individual
6756 parameters controlling inlining and for the defaults of these parameters.
6758 @emph{Note:} there may be no value to @option{-finline-limit} that results
6759 in default behavior.
6761 @emph{Note:} pseudo instruction represents, in this particular context, an
6762 abstract measurement of function's size. In no way does it represent a count
6763 of assembly instructions and as such its exact meaning might change from one
6764 release to an another.
6766 @item -fno-keep-inline-dllexport
6767 @opindex -fno-keep-inline-dllexport
6768 This is a more fine-grained version of @option{-fkeep-inline-functions},
6769 which applies only to functions that are declared using the @code{dllexport}
6770 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6773 @item -fkeep-inline-functions
6774 @opindex fkeep-inline-functions
6775 In C, emit @code{static} functions that are declared @code{inline}
6776 into the object file, even if the function has been inlined into all
6777 of its callers. This switch does not affect functions using the
6778 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6779 inline functions into the object file.
6781 @item -fkeep-static-consts
6782 @opindex fkeep-static-consts
6783 Emit variables declared @code{static const} when optimization isn't turned
6784 on, even if the variables aren't referenced.
6786 GCC enables this option by default. If you want to force the compiler to
6787 check if a variable is referenced, regardless of whether or not
6788 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6790 @item -fmerge-constants
6791 @opindex fmerge-constants
6792 Attempt to merge identical constants (string constants and floating-point
6793 constants) across compilation units.
6795 This option is the default for optimized compilation if the assembler and
6796 linker support it. Use @option{-fno-merge-constants} to inhibit this
6799 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6801 @item -fmerge-all-constants
6802 @opindex fmerge-all-constants
6803 Attempt to merge identical constants and identical variables.
6805 This option implies @option{-fmerge-constants}. In addition to
6806 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6807 arrays or initialized constant variables with integral or floating-point
6808 types. Languages like C or C++ require each variable, including multiple
6809 instances of the same variable in recursive calls, to have distinct locations,
6810 so using this option results in non-conforming
6813 @item -fmodulo-sched
6814 @opindex fmodulo-sched
6815 Perform swing modulo scheduling immediately before the first scheduling
6816 pass. This pass looks at innermost loops and reorders their
6817 instructions by overlapping different iterations.
6819 @item -fmodulo-sched-allow-regmoves
6820 @opindex fmodulo-sched-allow-regmoves
6821 Perform more aggressive SMS-based modulo scheduling with register moves
6822 allowed. By setting this flag certain anti-dependences edges are
6823 deleted, which triggers the generation of reg-moves based on the
6824 life-range analysis. This option is effective only with
6825 @option{-fmodulo-sched} enabled.
6827 @item -fno-branch-count-reg
6828 @opindex fno-branch-count-reg
6829 Do not use ``decrement and branch'' instructions on a count register,
6830 but instead generate a sequence of instructions that decrement a
6831 register, compare it against zero, then branch based upon the result.
6832 This option is only meaningful on architectures that support such
6833 instructions, which include x86, PowerPC, IA-64 and S/390.
6835 The default is @option{-fbranch-count-reg}.
6837 @item -fno-function-cse
6838 @opindex fno-function-cse
6839 Do not put function addresses in registers; make each instruction that
6840 calls a constant function contain the function's address explicitly.
6842 This option results in less efficient code, but some strange hacks
6843 that alter the assembler output may be confused by the optimizations
6844 performed when this option is not used.
6846 The default is @option{-ffunction-cse}
6848 @item -fno-zero-initialized-in-bss
6849 @opindex fno-zero-initialized-in-bss
6850 If the target supports a BSS section, GCC by default puts variables that
6851 are initialized to zero into BSS@. This can save space in the resulting
6854 This option turns off this behavior because some programs explicitly
6855 rely on variables going to the data section---e.g., so that the
6856 resulting executable can find the beginning of that section and/or make
6857 assumptions based on that.
6859 The default is @option{-fzero-initialized-in-bss}.
6861 @item -fsanitize=address
6862 Enable AddressSanitizer, a fast memory error detector.
6863 Memory access instructions will be instrumented to detect
6864 out-of-bounds and use-after-free bugs.
6865 See @uref{http://code.google.com/p/address-sanitizer/} for more details.
6867 @item -fsanitize=thread
6868 Enable ThreadSanitizer, a fast data race detector.
6869 Memory access instructions will be instrumented to detect
6871 See @uref{http://code.google.com/p/data-race-test/wiki/ThreadSanitizer} for more details.
6873 @item -fmudflap -fmudflapth -fmudflapir
6877 @cindex bounds checking
6879 For front-ends that support it (C and C++), instrument all risky
6880 pointer/array dereferencing operations, some standard library
6881 string/heap functions, and some other associated constructs with
6882 range/validity tests. Modules so instrumented should be immune to
6883 buffer overflows, invalid heap use, and some other classes of C/C++
6884 programming errors. The instrumentation relies on a separate runtime
6885 library (@file{libmudflap}), which is linked into a program if
6886 @option{-fmudflap} is given at link time. Run-time behavior of the
6887 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
6888 environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
6891 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
6892 link if your program is multi-threaded. Use @option{-fmudflapir}, in
6893 addition to @option{-fmudflap} or @option{-fmudflapth}, if
6894 instrumentation should ignore pointer reads. This produces less
6895 instrumentation (and therefore faster execution) and still provides
6896 some protection against outright memory corrupting writes, but allows
6897 erroneously read data to propagate within a program.
6899 @item -fthread-jumps
6900 @opindex fthread-jumps
6901 Perform optimizations that check to see if a jump branches to a
6902 location where another comparison subsumed by the first is found. If
6903 so, the first branch is redirected to either the destination of the
6904 second branch or a point immediately following it, depending on whether
6905 the condition is known to be true or false.
6907 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6909 @item -fsplit-wide-types
6910 @opindex fsplit-wide-types
6911 When using a type that occupies multiple registers, such as @code{long
6912 long} on a 32-bit system, split the registers apart and allocate them
6913 independently. This normally generates better code for those types,
6914 but may make debugging more difficult.
6916 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6919 @item -fcse-follow-jumps
6920 @opindex fcse-follow-jumps
6921 In common subexpression elimination (CSE), scan through jump instructions
6922 when the target of the jump is not reached by any other path. For
6923 example, when CSE encounters an @code{if} statement with an
6924 @code{else} clause, CSE follows the jump when the condition
6927 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6929 @item -fcse-skip-blocks
6930 @opindex fcse-skip-blocks
6931 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6932 follow jumps that conditionally skip over blocks. When CSE
6933 encounters a simple @code{if} statement with no else clause,
6934 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6935 body of the @code{if}.
6937 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6939 @item -frerun-cse-after-loop
6940 @opindex frerun-cse-after-loop
6941 Re-run common subexpression elimination after loop optimizations are
6944 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6948 Perform a global common subexpression elimination pass.
6949 This pass also performs global constant and copy propagation.
6951 @emph{Note:} When compiling a program using computed gotos, a GCC
6952 extension, you may get better run-time performance if you disable
6953 the global common subexpression elimination pass by adding
6954 @option{-fno-gcse} to the command line.
6956 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6960 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6961 attempts to move loads that are only killed by stores into themselves. This
6962 allows a loop containing a load/store sequence to be changed to a load outside
6963 the loop, and a copy/store within the loop.
6965 Enabled by default when @option{-fgcse} is enabled.
6969 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6970 global common subexpression elimination. This pass attempts to move
6971 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6972 loops containing a load/store sequence can be changed to a load before
6973 the loop and a store after the loop.
6975 Not enabled at any optimization level.
6979 When @option{-fgcse-las} is enabled, the global common subexpression
6980 elimination pass eliminates redundant loads that come after stores to the
6981 same memory location (both partial and full redundancies).
6983 Not enabled at any optimization level.
6985 @item -fgcse-after-reload
6986 @opindex fgcse-after-reload
6987 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6988 pass is performed after reload. The purpose of this pass is to clean up
6991 @item -funsafe-loop-optimizations
6992 @opindex funsafe-loop-optimizations
6993 This option tells the loop optimizer to assume that loop indices do not
6994 overflow, and that loops with nontrivial exit condition are not
6995 infinite. This enables a wider range of loop optimizations even if
6996 the loop optimizer itself cannot prove that these assumptions are valid.
6997 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
6998 if it finds this kind of loop.
7000 @item -fcrossjumping
7001 @opindex fcrossjumping
7002 Perform cross-jumping transformation.
7003 This transformation unifies equivalent code and saves code size. The
7004 resulting code may or may not perform better than without cross-jumping.
7006 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7008 @item -fauto-inc-dec
7009 @opindex fauto-inc-dec
7010 Combine increments or decrements of addresses with memory accesses.
7011 This pass is always skipped on architectures that do not have
7012 instructions to support this. Enabled by default at @option{-O} and
7013 higher on architectures that support this.
7017 Perform dead code elimination (DCE) on RTL@.
7018 Enabled by default at @option{-O} and higher.
7022 Perform dead store elimination (DSE) on RTL@.
7023 Enabled by default at @option{-O} and higher.
7025 @item -fif-conversion
7026 @opindex fif-conversion
7027 Attempt to transform conditional jumps into branch-less equivalents. This
7028 includes use of conditional moves, min, max, set flags and abs instructions, and
7029 some tricks doable by standard arithmetics. The use of conditional execution
7030 on chips where it is available is controlled by @code{if-conversion2}.
7032 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7034 @item -fif-conversion2
7035 @opindex fif-conversion2
7036 Use conditional execution (where available) to transform conditional jumps into
7037 branch-less equivalents.
7039 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7041 @item -fdelete-null-pointer-checks
7042 @opindex fdelete-null-pointer-checks
7043 Assume that programs cannot safely dereference null pointers, and that
7044 no code or data element resides there. This enables simple constant
7045 folding optimizations at all optimization levels. In addition, other
7046 optimization passes in GCC use this flag to control global dataflow
7047 analyses that eliminate useless checks for null pointers; these assume
7048 that if a pointer is checked after it has already been dereferenced,
7051 Note however that in some environments this assumption is not true.
7052 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7053 for programs that depend on that behavior.
7055 Some targets, especially embedded ones, disable this option at all levels.
7056 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
7057 @option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
7058 are enabled independently at different optimization levels.
7060 @item -fdevirtualize
7061 @opindex fdevirtualize
7062 Attempt to convert calls to virtual functions to direct calls. This
7063 is done both within a procedure and interprocedurally as part of
7064 indirect inlining (@code{-findirect-inlining}) and interprocedural constant
7065 propagation (@option{-fipa-cp}).
7066 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7068 @item -fexpensive-optimizations
7069 @opindex fexpensive-optimizations
7070 Perform a number of minor optimizations that are relatively expensive.
7072 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7076 Attempt to remove redundant extension instructions. This is especially
7077 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7078 registers after writing to their lower 32-bit half.
7080 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7082 @item -foptimize-register-move
7084 @opindex foptimize-register-move
7086 Attempt to reassign register numbers in move instructions and as
7087 operands of other simple instructions in order to maximize the amount of
7088 register tying. This is especially helpful on machines with two-operand
7091 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
7094 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7096 @item -fira-algorithm=@var{algorithm}
7097 Use the specified coloring algorithm for the integrated register
7098 allocator. The @var{algorithm} argument can be @samp{priority}, which
7099 specifies Chow's priority coloring, or @samp{CB}, which specifies
7100 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7101 for all architectures, but for those targets that do support it, it is
7102 the default because it generates better code.
7104 @item -fira-region=@var{region}
7105 Use specified regions for the integrated register allocator. The
7106 @var{region} argument should be one of the following:
7111 Use all loops as register allocation regions.
7112 This can give the best results for machines with a small and/or
7113 irregular register set.
7116 Use all loops except for loops with small register pressure
7117 as the regions. This value usually gives
7118 the best results in most cases and for most architectures,
7119 and is enabled by default when compiling with optimization for speed
7120 (@option{-O}, @option{-O2}, @dots{}).
7123 Use all functions as a single region.
7124 This typically results in the smallest code size, and is enabled by default for
7125 @option{-Os} or @option{-O0}.
7129 @item -fira-hoist-pressure
7130 @opindex fira-hoist-pressure
7131 Use IRA to evaluate register pressure in the code hoisting pass for
7132 decisions to hoist expressions. This option usually results in smaller
7133 code, but it can slow the compiler down.
7135 This option is enabled at level @option{-Os} for all targets.
7137 @item -fira-loop-pressure
7138 @opindex fira-loop-pressure
7139 Use IRA to evaluate register pressure in loops for decisions to move
7140 loop invariants. This option usually results in generation
7141 of faster and smaller code on machines with large register files (>= 32
7142 registers), but it can slow the compiler down.
7144 This option is enabled at level @option{-O3} for some targets.
7146 @item -fno-ira-share-save-slots
7147 @opindex fno-ira-share-save-slots
7148 Disable sharing of stack slots used for saving call-used hard
7149 registers living through a call. Each hard register gets a
7150 separate stack slot, and as a result function stack frames are
7153 @item -fno-ira-share-spill-slots
7154 @opindex fno-ira-share-spill-slots
7155 Disable sharing of stack slots allocated for pseudo-registers. Each
7156 pseudo-register that does not get a hard register gets a separate
7157 stack slot, and as a result function stack frames are larger.
7159 @item -fira-verbose=@var{n}
7160 @opindex fira-verbose
7161 Control the verbosity of the dump file for the integrated register allocator.
7162 The default value is 5. If the value @var{n} is greater or equal to 10,
7163 the dump output is sent to stderr using the same format as @var{n} minus 10.
7165 @item -fdelayed-branch
7166 @opindex fdelayed-branch
7167 If supported for the target machine, attempt to reorder instructions
7168 to exploit instruction slots available after delayed branch
7171 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7173 @item -fschedule-insns
7174 @opindex fschedule-insns
7175 If supported for the target machine, attempt to reorder instructions to
7176 eliminate execution stalls due to required data being unavailable. This
7177 helps machines that have slow floating point or memory load instructions
7178 by allowing other instructions to be issued until the result of the load
7179 or floating-point instruction is required.
7181 Enabled at levels @option{-O2}, @option{-O3}.
7183 @item -fschedule-insns2
7184 @opindex fschedule-insns2
7185 Similar to @option{-fschedule-insns}, but requests an additional pass of
7186 instruction scheduling after register allocation has been done. This is
7187 especially useful on machines with a relatively small number of
7188 registers and where memory load instructions take more than one cycle.
7190 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7192 @item -fno-sched-interblock
7193 @opindex fno-sched-interblock
7194 Don't schedule instructions across basic blocks. This is normally
7195 enabled by default when scheduling before register allocation, i.e.@:
7196 with @option{-fschedule-insns} or at @option{-O2} or higher.
7198 @item -fno-sched-spec
7199 @opindex fno-sched-spec
7200 Don't allow speculative motion of non-load instructions. This is normally
7201 enabled by default when scheduling before register allocation, i.e.@:
7202 with @option{-fschedule-insns} or at @option{-O2} or higher.
7204 @item -fsched-pressure
7205 @opindex fsched-pressure
7206 Enable register pressure sensitive insn scheduling before register
7207 allocation. This only makes sense when scheduling before register
7208 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7209 @option{-O2} or higher. Usage of this option can improve the
7210 generated code and decrease its size by preventing register pressure
7211 increase above the number of available hard registers and subsequent
7212 spills in register allocation.
7214 @item -fsched-spec-load
7215 @opindex fsched-spec-load
7216 Allow speculative motion of some load instructions. This only makes
7217 sense when scheduling before register allocation, i.e.@: with
7218 @option{-fschedule-insns} or at @option{-O2} or higher.
7220 @item -fsched-spec-load-dangerous
7221 @opindex fsched-spec-load-dangerous
7222 Allow speculative motion of more load instructions. This only makes
7223 sense when scheduling before register allocation, i.e.@: with
7224 @option{-fschedule-insns} or at @option{-O2} or higher.
7226 @item -fsched-stalled-insns
7227 @itemx -fsched-stalled-insns=@var{n}
7228 @opindex fsched-stalled-insns
7229 Define how many insns (if any) can be moved prematurely from the queue
7230 of stalled insns into the ready list during the second scheduling pass.
7231 @option{-fno-sched-stalled-insns} means that no insns are moved
7232 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7233 on how many queued insns can be moved prematurely.
7234 @option{-fsched-stalled-insns} without a value is equivalent to
7235 @option{-fsched-stalled-insns=1}.
7237 @item -fsched-stalled-insns-dep
7238 @itemx -fsched-stalled-insns-dep=@var{n}
7239 @opindex fsched-stalled-insns-dep
7240 Define how many insn groups (cycles) are examined for a dependency
7241 on a stalled insn that is a candidate for premature removal from the queue
7242 of stalled insns. This has an effect only during the second scheduling pass,
7243 and only if @option{-fsched-stalled-insns} is used.
7244 @option{-fno-sched-stalled-insns-dep} is equivalent to
7245 @option{-fsched-stalled-insns-dep=0}.
7246 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7247 @option{-fsched-stalled-insns-dep=1}.
7249 @item -fsched2-use-superblocks
7250 @opindex fsched2-use-superblocks
7251 When scheduling after register allocation, use superblock scheduling.
7252 This allows motion across basic block boundaries,
7253 resulting in faster schedules. This option is experimental, as not all machine
7254 descriptions used by GCC model the CPU closely enough to avoid unreliable
7255 results from the algorithm.
7257 This only makes sense when scheduling after register allocation, i.e.@: with
7258 @option{-fschedule-insns2} or at @option{-O2} or higher.
7260 @item -fsched-group-heuristic
7261 @opindex fsched-group-heuristic
7262 Enable the group heuristic in the scheduler. This heuristic favors
7263 the instruction that belongs to a schedule group. This is enabled
7264 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7265 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7267 @item -fsched-critical-path-heuristic
7268 @opindex fsched-critical-path-heuristic
7269 Enable the critical-path heuristic in the scheduler. This heuristic favors
7270 instructions on the critical path. This is enabled by default when
7271 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7272 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7274 @item -fsched-spec-insn-heuristic
7275 @opindex fsched-spec-insn-heuristic
7276 Enable the speculative instruction heuristic in the scheduler. This
7277 heuristic favors speculative instructions with greater dependency weakness.
7278 This is enabled by default when scheduling is enabled, i.e.@:
7279 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7280 or at @option{-O2} or higher.
7282 @item -fsched-rank-heuristic
7283 @opindex fsched-rank-heuristic
7284 Enable the rank heuristic in the scheduler. This heuristic favors
7285 the instruction belonging to a basic block with greater size or frequency.
7286 This is enabled by default when scheduling is enabled, i.e.@:
7287 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7288 at @option{-O2} or higher.
7290 @item -fsched-last-insn-heuristic
7291 @opindex fsched-last-insn-heuristic
7292 Enable the last-instruction heuristic in the scheduler. This heuristic
7293 favors the instruction that is less dependent on the last instruction
7294 scheduled. This is enabled by default when scheduling is enabled,
7295 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7296 at @option{-O2} or higher.
7298 @item -fsched-dep-count-heuristic
7299 @opindex fsched-dep-count-heuristic
7300 Enable the dependent-count heuristic in the scheduler. This heuristic
7301 favors the instruction that has more instructions depending on it.
7302 This is enabled by default when scheduling is enabled, i.e.@:
7303 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7304 at @option{-O2} or higher.
7306 @item -freschedule-modulo-scheduled-loops
7307 @opindex freschedule-modulo-scheduled-loops
7308 Modulo scheduling is performed before traditional scheduling. If a loop
7309 is modulo scheduled, later scheduling passes may change its schedule.
7310 Use this option to control that behavior.
7312 @item -fselective-scheduling
7313 @opindex fselective-scheduling
7314 Schedule instructions using selective scheduling algorithm. Selective
7315 scheduling runs instead of the first scheduler pass.
7317 @item -fselective-scheduling2
7318 @opindex fselective-scheduling2
7319 Schedule instructions using selective scheduling algorithm. Selective
7320 scheduling runs instead of the second scheduler pass.
7322 @item -fsel-sched-pipelining
7323 @opindex fsel-sched-pipelining
7324 Enable software pipelining of innermost loops during selective scheduling.
7325 This option has no effect unless one of @option{-fselective-scheduling} or
7326 @option{-fselective-scheduling2} is turned on.
7328 @item -fsel-sched-pipelining-outer-loops
7329 @opindex fsel-sched-pipelining-outer-loops
7330 When pipelining loops during selective scheduling, also pipeline outer loops.
7331 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7334 @opindex fshrink-wrap
7335 Emit function prologues only before parts of the function that need it,
7336 rather than at the top of the function. This flag is enabled by default at
7337 @option{-O} and higher.
7339 @item -fcaller-saves
7340 @opindex fcaller-saves
7341 Enable allocation of values to registers that are clobbered by
7342 function calls, by emitting extra instructions to save and restore the
7343 registers around such calls. Such allocation is done only when it
7344 seems to result in better code.
7346 This option is always enabled by default on certain machines, usually
7347 those which have no call-preserved registers to use instead.
7349 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7351 @item -fcombine-stack-adjustments
7352 @opindex fcombine-stack-adjustments
7353 Tracks stack adjustments (pushes and pops) and stack memory references
7354 and then tries to find ways to combine them.
7356 Enabled by default at @option{-O1} and higher.
7358 @item -fconserve-stack
7359 @opindex fconserve-stack
7360 Attempt to minimize stack usage. The compiler attempts to use less
7361 stack space, even if that makes the program slower. This option
7362 implies setting the @option{large-stack-frame} parameter to 100
7363 and the @option{large-stack-frame-growth} parameter to 400.
7365 @item -ftree-reassoc
7366 @opindex ftree-reassoc
7367 Perform reassociation on trees. This flag is enabled by default
7368 at @option{-O} and higher.
7372 Perform partial redundancy elimination (PRE) on trees. This flag is
7373 enabled by default at @option{-O2} and @option{-O3}.
7375 @item -ftree-partial-pre
7376 @opindex ftree-partial-pre
7377 Make partial redundancy elimination (PRE) more aggressive. This flag is
7378 enabled by default at @option{-O3}.
7380 @item -ftree-forwprop
7381 @opindex ftree-forwprop
7382 Perform forward propagation on trees. This flag is enabled by default
7383 at @option{-O} and higher.
7387 Perform full redundancy elimination (FRE) on trees. The difference
7388 between FRE and PRE is that FRE only considers expressions
7389 that are computed on all paths leading to the redundant computation.
7390 This analysis is faster than PRE, though it exposes fewer redundancies.
7391 This flag is enabled by default at @option{-O} and higher.
7393 @item -ftree-phiprop
7394 @opindex ftree-phiprop
7395 Perform hoisting of loads from conditional pointers on trees. This
7396 pass is enabled by default at @option{-O} and higher.
7398 @item -fhoist-adjacent-loads
7399 @opindex hoist-adjacent-loads
7400 Speculatively hoist loads from both branches of an if-then-else if the
7401 loads are from adjacent locations in the same structure and the target
7402 architecture has a conditional move instruction. This flag is enabled
7403 by default at @option{-O2} and higher.
7405 @item -ftree-copy-prop
7406 @opindex ftree-copy-prop
7407 Perform copy propagation on trees. This pass eliminates unnecessary
7408 copy operations. This flag is enabled by default at @option{-O} and
7411 @item -fipa-pure-const
7412 @opindex fipa-pure-const
7413 Discover which functions are pure or constant.
7414 Enabled by default at @option{-O} and higher.
7416 @item -fipa-reference
7417 @opindex fipa-reference
7418 Discover which static variables do not escape the
7420 Enabled by default at @option{-O} and higher.
7424 Perform interprocedural pointer analysis and interprocedural modification
7425 and reference analysis. This option can cause excessive memory and
7426 compile-time usage on large compilation units. It is not enabled by
7427 default at any optimization level.
7430 @opindex fipa-profile
7431 Perform interprocedural profile propagation. The functions called only from
7432 cold functions are marked as cold. Also functions executed once (such as
7433 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7434 functions and loop less parts of functions executed once are then optimized for
7436 Enabled by default at @option{-O} and higher.
7440 Perform interprocedural constant propagation.
7441 This optimization analyzes the program to determine when values passed
7442 to functions are constants and then optimizes accordingly.
7443 This optimization can substantially increase performance
7444 if the application has constants passed to functions.
7445 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7447 @item -fipa-cp-clone
7448 @opindex fipa-cp-clone
7449 Perform function cloning to make interprocedural constant propagation stronger.
7450 When enabled, interprocedural constant propagation performs function cloning
7451 when externally visible function can be called with constant arguments.
7452 Because this optimization can create multiple copies of functions,
7453 it may significantly increase code size
7454 (see @option{--param ipcp-unit-growth=@var{value}}).
7455 This flag is enabled by default at @option{-O3}.
7459 Perform forward store motion on trees. This flag is
7460 enabled by default at @option{-O} and higher.
7462 @item -ftree-bit-ccp
7463 @opindex ftree-bit-ccp
7464 Perform sparse conditional bit constant propagation on trees and propagate
7465 pointer alignment information.
7466 This pass only operates on local scalar variables and is enabled by default
7467 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7471 Perform sparse conditional constant propagation (CCP) on trees. This
7472 pass only operates on local scalar variables and is enabled by default
7473 at @option{-O} and higher.
7475 @item -ftree-switch-conversion
7476 Perform conversion of simple initializations in a switch to
7477 initializations from a scalar array. This flag is enabled by default
7478 at @option{-O2} and higher.
7480 @item -ftree-tail-merge
7481 Look for identical code sequences. When found, replace one with a jump to the
7482 other. This optimization is known as tail merging or cross jumping. This flag
7483 is enabled by default at @option{-O2} and higher. The compilation time
7485 be limited using @option{max-tail-merge-comparisons} parameter and
7486 @option{max-tail-merge-iterations} parameter.
7490 Perform dead code elimination (DCE) on trees. This flag is enabled by
7491 default at @option{-O} and higher.
7493 @item -ftree-builtin-call-dce
7494 @opindex ftree-builtin-call-dce
7495 Perform conditional dead code elimination (DCE) for calls to built-in functions
7496 that may set @code{errno} but are otherwise side-effect free. This flag is
7497 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7500 @item -ftree-dominator-opts
7501 @opindex ftree-dominator-opts
7502 Perform a variety of simple scalar cleanups (constant/copy
7503 propagation, redundancy elimination, range propagation and expression
7504 simplification) based on a dominator tree traversal. This also
7505 performs jump threading (to reduce jumps to jumps). This flag is
7506 enabled by default at @option{-O} and higher.
7510 Perform dead store elimination (DSE) on trees. A dead store is a store into
7511 a memory location that is later overwritten by another store without
7512 any intervening loads. In this case the earlier store can be deleted. This
7513 flag is enabled by default at @option{-O} and higher.
7517 Perform loop header copying on trees. This is beneficial since it increases
7518 effectiveness of code motion optimizations. It also saves one jump. This flag
7519 is enabled by default at @option{-O} and higher. It is not enabled
7520 for @option{-Os}, since it usually increases code size.
7522 @item -ftree-loop-optimize
7523 @opindex ftree-loop-optimize
7524 Perform loop optimizations on trees. This flag is enabled by default
7525 at @option{-O} and higher.
7527 @item -ftree-loop-linear
7528 @opindex ftree-loop-linear
7529 Perform loop interchange transformations on tree. Same as
7530 @option{-floop-interchange}. To use this code transformation, GCC has
7531 to be configured with @option{--with-ppl} and @option{--with-cloog} to
7532 enable the Graphite loop transformation infrastructure.
7534 @item -floop-interchange
7535 @opindex floop-interchange
7536 Perform loop interchange transformations on loops. Interchanging two
7537 nested loops switches the inner and outer loops. For example, given a
7542 A(J, I) = A(J, I) * C
7546 loop interchange transforms the loop as if it were written:
7550 A(J, I) = A(J, I) * C
7554 which can be beneficial when @code{N} is larger than the caches,
7555 because in Fortran, the elements of an array are stored in memory
7556 contiguously by column, and the original loop iterates over rows,
7557 potentially creating at each access a cache miss. This optimization
7558 applies to all the languages supported by GCC and is not limited to
7559 Fortran. To use this code transformation, GCC has to be configured
7560 with @option{--with-ppl} and @option{--with-cloog} to enable the
7561 Graphite loop transformation infrastructure.
7563 @item -floop-strip-mine
7564 @opindex floop-strip-mine
7565 Perform loop strip mining transformations on loops. Strip mining
7566 splits a loop into two nested loops. The outer loop has strides
7567 equal to the strip size and the inner loop has strides of the
7568 original loop within a strip. The strip length can be changed
7569 using the @option{loop-block-tile-size} parameter. For example,
7576 loop strip mining transforms the loop as if it were written:
7579 DO I = II, min (II + 50, N)
7584 This optimization applies to all the languages supported by GCC and is
7585 not limited to Fortran. To use this code transformation, GCC has to
7586 be configured with @option{--with-ppl} and @option{--with-cloog} to
7587 enable the Graphite loop transformation infrastructure.
7590 @opindex floop-block
7591 Perform loop blocking transformations on loops. Blocking strip mines
7592 each loop in the loop nest such that the memory accesses of the
7593 element loops fit inside caches. The strip length can be changed
7594 using the @option{loop-block-tile-size} parameter. For example, given
7599 A(J, I) = B(I) + C(J)
7603 loop blocking transforms the loop as if it were written:
7607 DO I = II, min (II + 50, N)
7608 DO J = JJ, min (JJ + 50, M)
7609 A(J, I) = B(I) + C(J)
7615 which can be beneficial when @code{M} is larger than the caches,
7616 because the innermost loop iterates over a smaller amount of data
7617 which can be kept in the caches. This optimization applies to all the
7618 languages supported by GCC and is not limited to Fortran. To use this
7619 code transformation, GCC has to be configured with @option{--with-ppl}
7620 and @option{--with-cloog} to enable the Graphite loop transformation
7623 @item -fgraphite-identity
7624 @opindex fgraphite-identity
7625 Enable the identity transformation for graphite. For every SCoP we generate
7626 the polyhedral representation and transform it back to gimple. Using
7627 @option{-fgraphite-identity} we can check the costs or benefits of the
7628 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7629 are also performed by the code generator CLooG, like index splitting and
7630 dead code elimination in loops.
7632 @item -floop-nest-optimize
7633 @opindex floop-nest-optimize
7634 Enable the ISL based loop nest optimizer. This is a generic loop nest
7635 optimizer based on the Pluto optimization algorithms. It calculates a loop
7636 structure optimized for data-locality and parallelism. This option
7639 @item -floop-parallelize-all
7640 @opindex floop-parallelize-all
7641 Use the Graphite data dependence analysis to identify loops that can
7642 be parallelized. Parallelize all the loops that can be analyzed to
7643 not contain loop carried dependences without checking that it is
7644 profitable to parallelize the loops.
7646 @item -fcheck-data-deps
7647 @opindex fcheck-data-deps
7648 Compare the results of several data dependence analyzers. This option
7649 is used for debugging the data dependence analyzers.
7651 @item -ftree-loop-if-convert
7652 Attempt to transform conditional jumps in the innermost loops to
7653 branch-less equivalents. The intent is to remove control-flow from
7654 the innermost loops in order to improve the ability of the
7655 vectorization pass to handle these loops. This is enabled by default
7656 if vectorization is enabled.
7658 @item -ftree-loop-if-convert-stores
7659 Attempt to also if-convert conditional jumps containing memory writes.
7660 This transformation can be unsafe for multi-threaded programs as it
7661 transforms conditional memory writes into unconditional memory writes.
7664 for (i = 0; i < N; i++)
7670 for (i = 0; i < N; i++)
7671 A[i] = cond ? expr : A[i];
7673 potentially producing data races.
7675 @item -ftree-loop-distribution
7676 Perform loop distribution. This flag can improve cache performance on
7677 big loop bodies and allow further loop optimizations, like
7678 parallelization or vectorization, to take place. For example, the loop
7695 @item -ftree-loop-distribute-patterns
7696 Perform loop distribution of patterns that can be code generated with
7697 calls to a library. This flag is enabled by default at @option{-O3}.
7699 This pass distributes the initialization loops and generates a call to
7700 memset zero. For example, the loop
7716 and the initialization loop is transformed into a call to memset zero.
7718 @item -ftree-loop-im
7719 @opindex ftree-loop-im
7720 Perform loop invariant motion on trees. This pass moves only invariants that
7721 are hard to handle at RTL level (function calls, operations that expand to
7722 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7723 operands of conditions that are invariant out of the loop, so that we can use
7724 just trivial invariantness analysis in loop unswitching. The pass also includes
7727 @item -ftree-loop-ivcanon
7728 @opindex ftree-loop-ivcanon
7729 Create a canonical counter for number of iterations in loops for which
7730 determining number of iterations requires complicated analysis. Later
7731 optimizations then may determine the number easily. Useful especially
7732 in connection with unrolling.
7736 Perform induction variable optimizations (strength reduction, induction
7737 variable merging and induction variable elimination) on trees.
7739 @item -ftree-parallelize-loops=n
7740 @opindex ftree-parallelize-loops
7741 Parallelize loops, i.e., split their iteration space to run in n threads.
7742 This is only possible for loops whose iterations are independent
7743 and can be arbitrarily reordered. The optimization is only
7744 profitable on multiprocessor machines, for loops that are CPU-intensive,
7745 rather than constrained e.g.@: by memory bandwidth. This option
7746 implies @option{-pthread}, and thus is only supported on targets
7747 that have support for @option{-pthread}.
7751 Perform function-local points-to analysis on trees. This flag is
7752 enabled by default at @option{-O} and higher.
7756 Perform scalar replacement of aggregates. This pass replaces structure
7757 references with scalars to prevent committing structures to memory too
7758 early. This flag is enabled by default at @option{-O} and higher.
7760 @item -ftree-copyrename
7761 @opindex ftree-copyrename
7762 Perform copy renaming on trees. This pass attempts to rename compiler
7763 temporaries to other variables at copy locations, usually resulting in
7764 variable names which more closely resemble the original variables. This flag
7765 is enabled by default at @option{-O} and higher.
7767 @item -ftree-coalesce-inlined-vars
7768 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
7769 combine small user-defined variables too, but only if they were inlined
7770 from other functions. It is a more limited form of
7771 @option{-ftree-coalesce-vars}. This may harm debug information of such
7772 inlined variables, but it will keep variables of the inlined-into
7773 function apart from each other, such that they are more likely to
7774 contain the expected values in a debugging session. This was the
7775 default in GCC versions older than 4.7.
7777 @item -ftree-coalesce-vars
7778 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
7779 combine small user-defined variables too, instead of just compiler
7780 temporaries. This may severely limit the ability to debug an optimized
7781 program compiled with @option{-fno-var-tracking-assignments}. In the
7782 negated form, this flag prevents SSA coalescing of user variables,
7783 including inlined ones. This option is enabled by default.
7787 Perform temporary expression replacement during the SSA->normal phase. Single
7788 use/single def temporaries are replaced at their use location with their
7789 defining expression. This results in non-GIMPLE code, but gives the expanders
7790 much more complex trees to work on resulting in better RTL generation. This is
7791 enabled by default at @option{-O} and higher.
7795 Perform straight-line strength reduction on trees. This recognizes related
7796 expressions involving multiplications and replaces them by less expensive
7797 calculations when possible. This is enabled by default at @option{-O} and
7800 @item -ftree-vectorize
7801 @opindex ftree-vectorize
7802 Perform loop vectorization on trees. This flag is enabled by default at
7805 @item -ftree-slp-vectorize
7806 @opindex ftree-slp-vectorize
7807 Perform basic block vectorization on trees. This flag is enabled by default at
7808 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7810 @item -ftree-vect-loop-version
7811 @opindex ftree-vect-loop-version
7812 Perform loop versioning when doing loop vectorization on trees. When a loop
7813 appears to be vectorizable except that data alignment or data dependence cannot
7814 be determined at compile time, then vectorized and non-vectorized versions of
7815 the loop are generated along with run-time checks for alignment or dependence
7816 to control which version is executed. This option is enabled by default
7817 except at level @option{-Os} where it is disabled.
7819 @item -fvect-cost-model
7820 @opindex fvect-cost-model
7821 Enable cost model for vectorization. This option is enabled by default at
7826 Perform Value Range Propagation on trees. This is similar to the
7827 constant propagation pass, but instead of values, ranges of values are
7828 propagated. This allows the optimizers to remove unnecessary range
7829 checks like array bound checks and null pointer checks. This is
7830 enabled by default at @option{-O2} and higher. Null pointer check
7831 elimination is only done if @option{-fdelete-null-pointer-checks} is
7836 Perform tail duplication to enlarge superblock size. This transformation
7837 simplifies the control flow of the function allowing other optimizations to do
7840 @item -funroll-loops
7841 @opindex funroll-loops
7842 Unroll loops whose number of iterations can be determined at compile
7843 time or upon entry to the loop. @option{-funroll-loops} implies
7844 @option{-frerun-cse-after-loop}. This option makes code larger,
7845 and may or may not make it run faster.
7847 @item -funroll-all-loops
7848 @opindex funroll-all-loops
7849 Unroll all loops, even if their number of iterations is uncertain when
7850 the loop is entered. This usually makes programs run more slowly.
7851 @option{-funroll-all-loops} implies the same options as
7852 @option{-funroll-loops},
7854 @item -fsplit-ivs-in-unroller
7855 @opindex fsplit-ivs-in-unroller
7856 Enables expression of values of induction variables in later iterations
7857 of the unrolled loop using the value in the first iteration. This breaks
7858 long dependency chains, thus improving efficiency of the scheduling passes.
7860 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7861 same effect. However, that is not reliable in cases where the loop body
7862 is more complicated than a single basic block. It also does not work at all
7863 on some architectures due to restrictions in the CSE pass.
7865 This optimization is enabled by default.
7867 @item -fvariable-expansion-in-unroller
7868 @opindex fvariable-expansion-in-unroller
7869 With this option, the compiler creates multiple copies of some
7870 local variables when unrolling a loop, which can result in superior code.
7872 @item -fpartial-inlining
7873 @opindex fpartial-inlining
7874 Inline parts of functions. This option has any effect only
7875 when inlining itself is turned on by the @option{-finline-functions}
7876 or @option{-finline-small-functions} options.
7878 Enabled at level @option{-O2}.
7880 @item -fpredictive-commoning
7881 @opindex fpredictive-commoning
7882 Perform predictive commoning optimization, i.e., reusing computations
7883 (especially memory loads and stores) performed in previous
7884 iterations of loops.
7886 This option is enabled at level @option{-O3}.
7888 @item -fprefetch-loop-arrays
7889 @opindex fprefetch-loop-arrays
7890 If supported by the target machine, generate instructions to prefetch
7891 memory to improve the performance of loops that access large arrays.
7893 This option may generate better or worse code; results are highly
7894 dependent on the structure of loops within the source code.
7896 Disabled at level @option{-Os}.
7899 @itemx -fno-peephole2
7900 @opindex fno-peephole
7901 @opindex fno-peephole2
7902 Disable any machine-specific peephole optimizations. The difference
7903 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7904 are implemented in the compiler; some targets use one, some use the
7905 other, a few use both.
7907 @option{-fpeephole} is enabled by default.
7908 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7910 @item -fno-guess-branch-probability
7911 @opindex fno-guess-branch-probability
7912 Do not guess branch probabilities using heuristics.
7914 GCC uses heuristics to guess branch probabilities if they are
7915 not provided by profiling feedback (@option{-fprofile-arcs}). These
7916 heuristics are based on the control flow graph. If some branch probabilities
7917 are specified by @samp{__builtin_expect}, then the heuristics are
7918 used to guess branch probabilities for the rest of the control flow graph,
7919 taking the @samp{__builtin_expect} info into account. The interactions
7920 between the heuristics and @samp{__builtin_expect} can be complex, and in
7921 some cases, it may be useful to disable the heuristics so that the effects
7922 of @samp{__builtin_expect} are easier to understand.
7924 The default is @option{-fguess-branch-probability} at levels
7925 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7927 @item -freorder-blocks
7928 @opindex freorder-blocks
7929 Reorder basic blocks in the compiled function in order to reduce number of
7930 taken branches and improve code locality.
7932 Enabled at levels @option{-O2}, @option{-O3}.
7934 @item -freorder-blocks-and-partition
7935 @opindex freorder-blocks-and-partition
7936 In addition to reordering basic blocks in the compiled function, in order
7937 to reduce number of taken branches, partitions hot and cold basic blocks
7938 into separate sections of the assembly and .o files, to improve
7939 paging and cache locality performance.
7941 This optimization is automatically turned off in the presence of
7942 exception handling, for linkonce sections, for functions with a user-defined
7943 section attribute and on any architecture that does not support named
7946 @item -freorder-functions
7947 @opindex freorder-functions
7948 Reorder functions in the object file in order to
7949 improve code locality. This is implemented by using special
7950 subsections @code{.text.hot} for most frequently executed functions and
7951 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7952 the linker so object file format must support named sections and linker must
7953 place them in a reasonable way.
7955 Also profile feedback must be available to make this option effective. See
7956 @option{-fprofile-arcs} for details.
7958 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7960 @item -fstrict-aliasing
7961 @opindex fstrict-aliasing
7962 Allow the compiler to assume the strictest aliasing rules applicable to
7963 the language being compiled. For C (and C++), this activates
7964 optimizations based on the type of expressions. In particular, an
7965 object of one type is assumed never to reside at the same address as an
7966 object of a different type, unless the types are almost the same. For
7967 example, an @code{unsigned int} can alias an @code{int}, but not a
7968 @code{void*} or a @code{double}. A character type may alias any other
7971 @anchor{Type-punning}Pay special attention to code like this:
7984 The practice of reading from a different union member than the one most
7985 recently written to (called ``type-punning'') is common. Even with
7986 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7987 is accessed through the union type. So, the code above works as
7988 expected. @xref{Structures unions enumerations and bit-fields
7989 implementation}. However, this code might not:
8000 Similarly, access by taking the address, casting the resulting pointer
8001 and dereferencing the result has undefined behavior, even if the cast
8002 uses a union type, e.g.:
8006 return ((union a_union *) &d)->i;
8010 The @option{-fstrict-aliasing} option is enabled at levels
8011 @option{-O2}, @option{-O3}, @option{-Os}.
8013 @item -fstrict-overflow
8014 @opindex fstrict-overflow
8015 Allow the compiler to assume strict signed overflow rules, depending
8016 on the language being compiled. For C (and C++) this means that
8017 overflow when doing arithmetic with signed numbers is undefined, which
8018 means that the compiler may assume that it does not happen. This
8019 permits various optimizations. For example, the compiler assumes
8020 that an expression like @code{i + 10 > i} is always true for
8021 signed @code{i}. This assumption is only valid if signed overflow is
8022 undefined, as the expression is false if @code{i + 10} overflows when
8023 using twos complement arithmetic. When this option is in effect any
8024 attempt to determine whether an operation on signed numbers
8025 overflows must be written carefully to not actually involve overflow.
8027 This option also allows the compiler to assume strict pointer
8028 semantics: given a pointer to an object, if adding an offset to that
8029 pointer does not produce a pointer to the same object, the addition is
8030 undefined. This permits the compiler to conclude that @code{p + u >
8031 p} is always true for a pointer @code{p} and unsigned integer
8032 @code{u}. This assumption is only valid because pointer wraparound is
8033 undefined, as the expression is false if @code{p + u} overflows using
8034 twos complement arithmetic.
8036 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8037 that integer signed overflow is fully defined: it wraps. When
8038 @option{-fwrapv} is used, there is no difference between
8039 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8040 integers. With @option{-fwrapv} certain types of overflow are
8041 permitted. For example, if the compiler gets an overflow when doing
8042 arithmetic on constants, the overflowed value can still be used with
8043 @option{-fwrapv}, but not otherwise.
8045 The @option{-fstrict-overflow} option is enabled at levels
8046 @option{-O2}, @option{-O3}, @option{-Os}.
8048 @item -falign-functions
8049 @itemx -falign-functions=@var{n}
8050 @opindex falign-functions
8051 Align the start of functions to the next power-of-two greater than
8052 @var{n}, skipping up to @var{n} bytes. For instance,
8053 @option{-falign-functions=32} aligns functions to the next 32-byte
8054 boundary, but @option{-falign-functions=24} aligns to the next
8055 32-byte boundary only if this can be done by skipping 23 bytes or less.
8057 @option{-fno-align-functions} and @option{-falign-functions=1} are
8058 equivalent and mean that functions are not aligned.
8060 Some assemblers only support this flag when @var{n} is a power of two;
8061 in that case, it is rounded up.
8063 If @var{n} is not specified or is zero, use a machine-dependent default.
8065 Enabled at levels @option{-O2}, @option{-O3}.
8067 @item -falign-labels
8068 @itemx -falign-labels=@var{n}
8069 @opindex falign-labels
8070 Align all branch targets to a power-of-two boundary, skipping up to
8071 @var{n} bytes like @option{-falign-functions}. This option can easily
8072 make code slower, because it must insert dummy operations for when the
8073 branch target is reached in the usual flow of the code.
8075 @option{-fno-align-labels} and @option{-falign-labels=1} are
8076 equivalent and mean that labels are not aligned.
8078 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8079 are greater than this value, then their values are used instead.
8081 If @var{n} is not specified or is zero, use a machine-dependent default
8082 which is very likely to be @samp{1}, meaning no alignment.
8084 Enabled at levels @option{-O2}, @option{-O3}.
8087 @itemx -falign-loops=@var{n}
8088 @opindex falign-loops
8089 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8090 like @option{-falign-functions}. If the loops are
8091 executed many times, this makes up for any execution of the dummy
8094 @option{-fno-align-loops} and @option{-falign-loops=1} are
8095 equivalent and mean that loops are not aligned.
8097 If @var{n} is not specified or is zero, use a machine-dependent default.
8099 Enabled at levels @option{-O2}, @option{-O3}.
8102 @itemx -falign-jumps=@var{n}
8103 @opindex falign-jumps
8104 Align branch targets to a power-of-two boundary, for branch targets
8105 where the targets can only be reached by jumping, skipping up to @var{n}
8106 bytes like @option{-falign-functions}. In this case, no dummy operations
8109 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8110 equivalent and mean that loops are not aligned.
8112 If @var{n} is not specified or is zero, use a machine-dependent default.
8114 Enabled at levels @option{-O2}, @option{-O3}.
8116 @item -funit-at-a-time
8117 @opindex funit-at-a-time
8118 This option is left for compatibility reasons. @option{-funit-at-a-time}
8119 has no effect, while @option{-fno-unit-at-a-time} implies
8120 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8124 @item -fno-toplevel-reorder
8125 @opindex fno-toplevel-reorder
8126 Do not reorder top-level functions, variables, and @code{asm}
8127 statements. Output them in the same order that they appear in the
8128 input file. When this option is used, unreferenced static variables
8129 are not removed. This option is intended to support existing code
8130 that relies on a particular ordering. For new code, it is better to
8133 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8134 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8139 Constructs webs as commonly used for register allocation purposes and assign
8140 each web individual pseudo register. This allows the register allocation pass
8141 to operate on pseudos directly, but also strengthens several other optimization
8142 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8143 however, make debugging impossible, since variables no longer stay in a
8146 Enabled by default with @option{-funroll-loops}.
8148 @item -fwhole-program
8149 @opindex fwhole-program
8150 Assume that the current compilation unit represents the whole program being
8151 compiled. All public functions and variables with the exception of @code{main}
8152 and those merged by attribute @code{externally_visible} become static functions
8153 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.
8154 While this option is equivalent to proper use of the @code{static} keyword for
8155 programs consisting of a single file, in combination with option
8156 @option{-flto} this flag can be used to
8157 compile many smaller scale programs since the functions and variables become
8158 local for the whole combined compilation unit, not for the single source file
8161 This option implies @option{-fwhole-file} for Fortran programs.
8163 @item -flto[=@var{n}]
8165 This option runs the standard link-time optimizer. When invoked
8166 with source code, it generates GIMPLE (one of GCC's internal
8167 representations) and writes it to special ELF sections in the object
8168 file. When the object files are linked together, all the function
8169 bodies are read from these ELF sections and instantiated as if they
8170 had been part of the same translation unit.
8172 To use the link-time optimizer, @option{-flto} needs to be specified at
8173 compile time and during the final link. For example:
8176 gcc -c -O2 -flto foo.c
8177 gcc -c -O2 -flto bar.c
8178 gcc -o myprog -flto -O2 foo.o bar.o
8181 The first two invocations to GCC save a bytecode representation
8182 of GIMPLE into special ELF sections inside @file{foo.o} and
8183 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8184 @file{foo.o} and @file{bar.o}, merges the two files into a single
8185 internal image, and compiles the result as usual. Since both
8186 @file{foo.o} and @file{bar.o} are merged into a single image, this
8187 causes all the interprocedural analyses and optimizations in GCC to
8188 work across the two files as if they were a single one. This means,
8189 for example, that the inliner is able to inline functions in
8190 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8192 Another (simpler) way to enable link-time optimization is:
8195 gcc -o myprog -flto -O2 foo.c bar.c
8198 The above generates bytecode for @file{foo.c} and @file{bar.c},
8199 merges them together into a single GIMPLE representation and optimizes
8200 them as usual to produce @file{myprog}.
8202 The only important thing to keep in mind is that to enable link-time
8203 optimizations the @option{-flto} flag needs to be passed to both the
8204 compile and the link commands.
8206 To make whole program optimization effective, it is necessary to make
8207 certain whole program assumptions. The compiler needs to know
8208 what functions and variables can be accessed by libraries and runtime
8209 outside of the link-time optimized unit. When supported by the linker,
8210 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8211 to the compiler about used and externally visible symbols. When
8212 the linker plugin is not available, @option{-fwhole-program} should be
8213 used to allow the compiler to make these assumptions, which leads
8214 to more aggressive optimization decisions.
8216 Note that when a file is compiled with @option{-flto}, the generated
8217 object file is larger than a regular object file because it
8218 contains GIMPLE bytecodes and the usual final code. This means that
8219 object files with LTO information can be linked as normal object
8220 files; if @option{-flto} is not passed to the linker, no
8221 interprocedural optimizations are applied.
8223 Additionally, the optimization flags used to compile individual files
8224 are not necessarily related to those used at link time. For instance,
8227 gcc -c -O0 -flto foo.c
8228 gcc -c -O0 -flto bar.c
8229 gcc -o myprog -flto -O3 foo.o bar.o
8232 This produces individual object files with unoptimized assembler
8233 code, but the resulting binary @file{myprog} is optimized at
8234 @option{-O3}. If, instead, the final binary is generated without
8235 @option{-flto}, then @file{myprog} is not optimized.
8237 When producing the final binary with @option{-flto}, GCC only
8238 applies link-time optimizations to those files that contain bytecode.
8239 Therefore, you can mix and match object files and libraries with
8240 GIMPLE bytecodes and final object code. GCC automatically selects
8241 which files to optimize in LTO mode and which files to link without
8244 There are some code generation flags preserved by GCC when
8245 generating bytecodes, as they need to be used during the final link
8246 stage. Currently, the following options are saved into the GIMPLE
8247 bytecode files: @option{-fPIC}, @option{-fcommon} and all the
8248 @option{-m} target flags.
8250 At link time, these options are read in and reapplied. Note that the
8251 current implementation makes no attempt to recognize conflicting
8252 values for these options. If different files have conflicting option
8253 values (e.g., one file is compiled with @option{-fPIC} and another
8254 isn't), the compiler simply uses the last value read from the
8255 bytecode files. It is recommended, then, that you compile all the files
8256 participating in the same link with the same options.
8258 If LTO encounters objects with C linkage declared with incompatible
8259 types in separate translation units to be linked together (undefined
8260 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8261 issued. The behavior is still undefined at run time.
8263 Another feature of LTO is that it is possible to apply interprocedural
8264 optimizations on files written in different languages. This requires
8265 support in the language front end. Currently, the C, C++ and
8266 Fortran front ends are capable of emitting GIMPLE bytecodes, so
8267 something like this should work:
8272 gfortran -c -flto baz.f90
8273 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8276 Notice that the final link is done with @command{g++} to get the C++
8277 runtime libraries and @option{-lgfortran} is added to get the Fortran
8278 runtime libraries. In general, when mixing languages in LTO mode, you
8279 should use the same link command options as when mixing languages in a
8280 regular (non-LTO) compilation; all you need to add is @option{-flto} to
8281 all the compile and link commands.
8283 If object files containing GIMPLE bytecode are stored in a library archive, say
8284 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8285 are using a linker with plugin support. To enable this feature, use
8286 the flag @option{-fuse-linker-plugin} at link time:
8289 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8292 With the linker plugin enabled, the linker extracts the needed
8293 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8294 to make them part of the aggregated GIMPLE image to be optimized.
8296 If you are not using a linker with plugin support and/or do not
8297 enable the linker plugin, then the objects inside @file{libfoo.a}
8298 are extracted and linked as usual, but they do not participate
8299 in the LTO optimization process.
8301 Link-time optimizations do not require the presence of the whole program to
8302 operate. If the program does not require any symbols to be exported, it is
8303 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8304 the interprocedural optimizers to use more aggressive assumptions which may
8305 lead to improved optimization opportunities.
8306 Use of @option{-fwhole-program} is not needed when linker plugin is
8307 active (see @option{-fuse-linker-plugin}).
8309 The current implementation of LTO makes no
8310 attempt to generate bytecode that is portable between different
8311 types of hosts. The bytecode files are versioned and there is a
8312 strict version check, so bytecode files generated in one version of
8313 GCC will not work with an older/newer version of GCC@.
8315 Link-time optimization does not work well with generation of debugging
8316 information. Combining @option{-flto} with
8317 @option{-g} is currently experimental and expected to produce wrong
8320 If you specify the optional @var{n}, the optimization and code
8321 generation done at link time is executed in parallel using @var{n}
8322 parallel jobs by utilizing an installed @command{make} program. The
8323 environment variable @env{MAKE} may be used to override the program
8324 used. The default value for @var{n} is 1.
8326 You can also specify @option{-flto=jobserver} to use GNU make's
8327 job server mode to determine the number of parallel jobs. This
8328 is useful when the Makefile calling GCC is already executing in parallel.
8329 You must prepend a @samp{+} to the command recipe in the parent Makefile
8330 for this to work. This option likely only works if @env{MAKE} is
8333 This option is disabled by default.
8335 @item -flto-partition=@var{alg}
8336 @opindex flto-partition
8337 Specify the partitioning algorithm used by the link-time optimizer.
8338 The value is either @code{1to1} to specify a partitioning mirroring
8339 the original source files or @code{balanced} to specify partitioning
8340 into equally sized chunks (whenever possible) or @code{max} to create
8341 new partition for every symbol where possible. Specifying @code{none}
8342 as an algorithm disables partitioning and streaming completely.
8343 The default value is @code{balanced}. While @code{1to1} can be used
8344 as an workaround for various code ordering issues, the @code{max}
8345 partitioning is intended for internal testing only.
8347 @item -flto-compression-level=@var{n}
8348 This option specifies the level of compression used for intermediate
8349 language written to LTO object files, and is only meaningful in
8350 conjunction with LTO mode (@option{-flto}). Valid
8351 values are 0 (no compression) to 9 (maximum compression). Values
8352 outside this range are clamped to either 0 or 9. If the option is not
8353 given, a default balanced compression setting is used.
8356 Prints a report with internal details on the workings of the link-time
8357 optimizer. The contents of this report vary from version to version.
8358 It is meant to be useful to GCC developers when processing object
8359 files in LTO mode (via @option{-flto}).
8361 Disabled by default.
8363 @item -fuse-linker-plugin
8364 Enables the use of a linker plugin during link-time optimization. This
8365 option relies on plugin support in the linker, which is available in gold
8366 or in GNU ld 2.21 or newer.
8368 This option enables the extraction of object files with GIMPLE bytecode out
8369 of library archives. This improves the quality of optimization by exposing
8370 more code to the link-time optimizer. This information specifies what
8371 symbols can be accessed externally (by non-LTO object or during dynamic
8372 linking). Resulting code quality improvements on binaries (and shared
8373 libraries that use hidden visibility) are similar to @code{-fwhole-program}.
8374 See @option{-flto} for a description of the effect of this flag and how to
8377 This option is enabled by default when LTO support in GCC is enabled
8378 and GCC was configured for use with
8379 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8381 @item -ffat-lto-objects
8382 @opindex ffat-lto-objects
8383 Fat LTO objects are object files that contain both the intermediate language
8384 and the object code. This makes them usable for both LTO linking and normal
8385 linking. This option is effective only when compiling with @option{-flto}
8386 and is ignored at link time.
8388 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8389 requires the complete toolchain to be aware of LTO. It requires a linker with
8390 linker plugin support for basic functionality. Additionally,
8391 @command{nm}, @command{ar} and @command{ranlib}
8392 need to support linker plugins to allow a full-featured build environment
8393 (capable of building static libraries etc). gcc provides the @command{gcc-ar},
8394 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8395 to these tools. With non fat LTO makefiles need to be modified to use them.
8397 The default is @option{-ffat-lto-objects} but this default is intended to
8398 change in future releases when linker plugin enabled environments become more
8401 @item -fcompare-elim
8402 @opindex fcompare-elim
8403 After register allocation and post-register allocation instruction splitting,
8404 identify arithmetic instructions that compute processor flags similar to a
8405 comparison operation based on that arithmetic. If possible, eliminate the
8406 explicit comparison operation.
8408 This pass only applies to certain targets that cannot explicitly represent
8409 the comparison operation before register allocation is complete.
8411 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8414 Use the @command{bfd} linker instead of the default linker.
8417 Use the @command{gold} linker instead of the default linker.
8419 @item -fcprop-registers
8420 @opindex fcprop-registers
8421 After register allocation and post-register allocation instruction splitting,
8422 perform a copy-propagation pass to try to reduce scheduling dependencies
8423 and occasionally eliminate the copy.
8425 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8427 @item -fprofile-correction
8428 @opindex fprofile-correction
8429 Profiles collected using an instrumented binary for multi-threaded programs may
8430 be inconsistent due to missed counter updates. When this option is specified,
8431 GCC uses heuristics to correct or smooth out such inconsistencies. By
8432 default, GCC emits an error message when an inconsistent profile is detected.
8434 @item -fprofile-dir=@var{path}
8435 @opindex fprofile-dir
8437 Set the directory to search for the profile data files in to @var{path}.
8438 This option affects only the profile data generated by
8439 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
8440 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
8441 and its related options. Both absolute and relative paths can be used.
8442 By default, GCC uses the current directory as @var{path}, thus the
8443 profile data file appears in the same directory as the object file.
8445 @item -fprofile-generate
8446 @itemx -fprofile-generate=@var{path}
8447 @opindex fprofile-generate
8449 Enable options usually used for instrumenting application to produce
8450 profile useful for later recompilation with profile feedback based
8451 optimization. You must use @option{-fprofile-generate} both when
8452 compiling and when linking your program.
8454 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
8456 If @var{path} is specified, GCC looks at the @var{path} to find
8457 the profile feedback data files. See @option{-fprofile-dir}.
8460 @itemx -fprofile-use=@var{path}
8461 @opindex fprofile-use
8462 Enable profile feedback directed optimizations, and optimizations
8463 generally profitable only with profile feedback available.
8465 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
8466 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}, @code{-ftree-vectorize},
8467 @code{ftree-loop-distribute-patterns}
8469 By default, GCC emits an error message if the feedback profiles do not
8470 match the source code. This error can be turned into a warning by using
8471 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8474 If @var{path} is specified, GCC looks at the @var{path} to find
8475 the profile feedback data files. See @option{-fprofile-dir}.
8478 The following options control compiler behavior regarding floating-point
8479 arithmetic. These options trade off between speed and
8480 correctness. All must be specifically enabled.
8484 @opindex ffloat-store
8485 Do not store floating-point variables in registers, and inhibit other
8486 options that might change whether a floating-point value is taken from a
8489 @cindex floating-point precision
8490 This option prevents undesirable excess precision on machines such as
8491 the 68000 where the floating registers (of the 68881) keep more
8492 precision than a @code{double} is supposed to have. Similarly for the
8493 x86 architecture. For most programs, the excess precision does only
8494 good, but a few programs rely on the precise definition of IEEE floating
8495 point. Use @option{-ffloat-store} for such programs, after modifying
8496 them to store all pertinent intermediate computations into variables.
8498 @item -fexcess-precision=@var{style}
8499 @opindex fexcess-precision
8500 This option allows further control over excess precision on machines
8501 where floating-point registers have more precision than the IEEE
8502 @code{float} and @code{double} types and the processor does not
8503 support operations rounding to those types. By default,
8504 @option{-fexcess-precision=fast} is in effect; this means that
8505 operations are carried out in the precision of the registers and that
8506 it is unpredictable when rounding to the types specified in the source
8507 code takes place. When compiling C, if
8508 @option{-fexcess-precision=standard} is specified then excess
8509 precision follows the rules specified in ISO C99; in particular,
8510 both casts and assignments cause values to be rounded to their
8511 semantic types (whereas @option{-ffloat-store} only affects
8512 assignments). This option is enabled by default for C if a strict
8513 conformance option such as @option{-std=c99} is used.
8516 @option{-fexcess-precision=standard} is not implemented for languages
8517 other than C, and has no effect if
8518 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8519 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8520 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8521 semantics apply without excess precision, and in the latter, rounding
8526 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8527 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8528 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8530 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8532 This option is not turned on by any @option{-O} option besides
8533 @option{-Ofast} since it can result in incorrect output for programs
8534 that depend on an exact implementation of IEEE or ISO rules/specifications
8535 for math functions. It may, however, yield faster code for programs
8536 that do not require the guarantees of these specifications.
8538 @item -fno-math-errno
8539 @opindex fno-math-errno
8540 Do not set @code{errno} after calling math functions that are executed
8541 with a single instruction, e.g., @code{sqrt}. A program that relies on
8542 IEEE exceptions for math error handling may want to use this flag
8543 for speed while maintaining IEEE arithmetic compatibility.
8545 This option is not turned on by any @option{-O} option since
8546 it can result in incorrect output for programs that depend on
8547 an exact implementation of IEEE or ISO rules/specifications for
8548 math functions. It may, however, yield faster code for programs
8549 that do not require the guarantees of these specifications.
8551 The default is @option{-fmath-errno}.
8553 On Darwin systems, the math library never sets @code{errno}. There is
8554 therefore no reason for the compiler to consider the possibility that
8555 it might, and @option{-fno-math-errno} is the default.
8557 @item -funsafe-math-optimizations
8558 @opindex funsafe-math-optimizations
8560 Allow optimizations for floating-point arithmetic that (a) assume
8561 that arguments and results are valid and (b) may violate IEEE or
8562 ANSI standards. When used at link-time, it may include libraries
8563 or startup files that change the default FPU control word or other
8564 similar optimizations.
8566 This option is not turned on by any @option{-O} option since
8567 it can result in incorrect output for programs that depend on
8568 an exact implementation of IEEE or ISO rules/specifications for
8569 math functions. It may, however, yield faster code for programs
8570 that do not require the guarantees of these specifications.
8571 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8572 @option{-fassociative-math} and @option{-freciprocal-math}.
8574 The default is @option{-fno-unsafe-math-optimizations}.
8576 @item -fassociative-math
8577 @opindex fassociative-math
8579 Allow re-association of operands in series of floating-point operations.
8580 This violates the ISO C and C++ language standard by possibly changing
8581 computation result. NOTE: re-ordering may change the sign of zero as
8582 well as ignore NaNs and inhibit or create underflow or overflow (and
8583 thus cannot be used on code that relies on rounding behavior like
8584 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8585 and thus may not be used when ordered comparisons are required.
8586 This option requires that both @option{-fno-signed-zeros} and
8587 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8588 much sense with @option{-frounding-math}. For Fortran the option
8589 is automatically enabled when both @option{-fno-signed-zeros} and
8590 @option{-fno-trapping-math} are in effect.
8592 The default is @option{-fno-associative-math}.
8594 @item -freciprocal-math
8595 @opindex freciprocal-math
8597 Allow the reciprocal of a value to be used instead of dividing by
8598 the value if this enables optimizations. For example @code{x / y}
8599 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8600 is subject to common subexpression elimination. Note that this loses
8601 precision and increases the number of flops operating on the value.
8603 The default is @option{-fno-reciprocal-math}.
8605 @item -ffinite-math-only
8606 @opindex ffinite-math-only
8607 Allow optimizations for floating-point arithmetic that assume
8608 that arguments and results are not NaNs or +-Infs.
8610 This option is not turned on by any @option{-O} option since
8611 it can result in incorrect output for programs that depend on
8612 an exact implementation of IEEE or ISO rules/specifications for
8613 math functions. It may, however, yield faster code for programs
8614 that do not require the guarantees of these specifications.
8616 The default is @option{-fno-finite-math-only}.
8618 @item -fno-signed-zeros
8619 @opindex fno-signed-zeros
8620 Allow optimizations for floating-point arithmetic that ignore the
8621 signedness of zero. IEEE arithmetic specifies the behavior of
8622 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8623 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8624 This option implies that the sign of a zero result isn't significant.
8626 The default is @option{-fsigned-zeros}.
8628 @item -fno-trapping-math
8629 @opindex fno-trapping-math
8630 Compile code assuming that floating-point operations cannot generate
8631 user-visible traps. These traps include division by zero, overflow,
8632 underflow, inexact result and invalid operation. This option requires
8633 that @option{-fno-signaling-nans} be in effect. Setting this option may
8634 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8636 This option should never be turned on by any @option{-O} option since
8637 it can result in incorrect output for programs that depend on
8638 an exact implementation of IEEE or ISO rules/specifications for
8641 The default is @option{-ftrapping-math}.
8643 @item -frounding-math
8644 @opindex frounding-math
8645 Disable transformations and optimizations that assume default floating-point
8646 rounding behavior. This is round-to-zero for all floating point
8647 to integer conversions, and round-to-nearest for all other arithmetic
8648 truncations. This option should be specified for programs that change
8649 the FP rounding mode dynamically, or that may be executed with a
8650 non-default rounding mode. This option disables constant folding of
8651 floating-point expressions at compile time (which may be affected by
8652 rounding mode) and arithmetic transformations that are unsafe in the
8653 presence of sign-dependent rounding modes.
8655 The default is @option{-fno-rounding-math}.
8657 This option is experimental and does not currently guarantee to
8658 disable all GCC optimizations that are affected by rounding mode.
8659 Future versions of GCC may provide finer control of this setting
8660 using C99's @code{FENV_ACCESS} pragma. This command-line option
8661 will be used to specify the default state for @code{FENV_ACCESS}.
8663 @item -fsignaling-nans
8664 @opindex fsignaling-nans
8665 Compile code assuming that IEEE signaling NaNs may generate user-visible
8666 traps during floating-point operations. Setting this option disables
8667 optimizations that may change the number of exceptions visible with
8668 signaling NaNs. This option implies @option{-ftrapping-math}.
8670 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8673 The default is @option{-fno-signaling-nans}.
8675 This option is experimental and does not currently guarantee to
8676 disable all GCC optimizations that affect signaling NaN behavior.
8678 @item -fsingle-precision-constant
8679 @opindex fsingle-precision-constant
8680 Treat floating-point constants as single precision instead of
8681 implicitly converting them to double-precision constants.
8683 @item -fcx-limited-range
8684 @opindex fcx-limited-range
8685 When enabled, this option states that a range reduction step is not
8686 needed when performing complex division. Also, there is no checking
8687 whether the result of a complex multiplication or division is @code{NaN
8688 + I*NaN}, with an attempt to rescue the situation in that case. The
8689 default is @option{-fno-cx-limited-range}, but is enabled by
8690 @option{-ffast-math}.
8692 This option controls the default setting of the ISO C99
8693 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8696 @item -fcx-fortran-rules
8697 @opindex fcx-fortran-rules
8698 Complex multiplication and division follow Fortran rules. Range
8699 reduction is done as part of complex division, but there is no checking
8700 whether the result of a complex multiplication or division is @code{NaN
8701 + I*NaN}, with an attempt to rescue the situation in that case.
8703 The default is @option{-fno-cx-fortran-rules}.
8707 The following options control optimizations that may improve
8708 performance, but are not enabled by any @option{-O} options. This
8709 section includes experimental options that may produce broken code.
8712 @item -fbranch-probabilities
8713 @opindex fbranch-probabilities
8714 After running a program compiled with @option{-fprofile-arcs}
8715 (@pxref{Debugging Options,, Options for Debugging Your Program or
8716 @command{gcc}}), you can compile it a second time using
8717 @option{-fbranch-probabilities}, to improve optimizations based on
8718 the number of times each branch was taken. When a program
8719 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8720 counts to a file called @file{@var{sourcename}.gcda} for each source
8721 file. The information in this data file is very dependent on the
8722 structure of the generated code, so you must use the same source code
8723 and the same optimization options for both compilations.
8725 With @option{-fbranch-probabilities}, GCC puts a
8726 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8727 These can be used to improve optimization. Currently, they are only
8728 used in one place: in @file{reorg.c}, instead of guessing which path a
8729 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8730 exactly determine which path is taken more often.
8732 @item -fprofile-values
8733 @opindex fprofile-values
8734 If combined with @option{-fprofile-arcs}, it adds code so that some
8735 data about values of expressions in the program is gathered.
8737 With @option{-fbranch-probabilities}, it reads back the data gathered
8738 from profiling values of expressions for usage in optimizations.
8740 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8744 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8745 to add code to gather information about values of expressions.
8747 With @option{-fbranch-probabilities}, it reads back the data gathered
8748 and actually performs the optimizations based on them.
8749 Currently the optimizations include specialization of division operations
8750 using the knowledge about the value of the denominator.
8752 @item -frename-registers
8753 @opindex frename-registers
8754 Attempt to avoid false dependencies in scheduled code by making use
8755 of registers left over after register allocation. This optimization
8756 most benefits processors with lots of registers. Depending on the
8757 debug information format adopted by the target, however, it can
8758 make debugging impossible, since variables no longer stay in
8759 a ``home register''.
8761 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8765 Perform tail duplication to enlarge superblock size. This transformation
8766 simplifies the control flow of the function allowing other optimizations to do
8769 Enabled with @option{-fprofile-use}.
8771 @item -funroll-loops
8772 @opindex funroll-loops
8773 Unroll loops whose number of iterations can be determined at compile time or
8774 upon entry to the loop. @option{-funroll-loops} implies
8775 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8776 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8777 a small constant number of iterations). This option makes code larger, and may
8778 or may not make it run faster.
8780 Enabled with @option{-fprofile-use}.
8782 @item -funroll-all-loops
8783 @opindex funroll-all-loops
8784 Unroll all loops, even if their number of iterations is uncertain when
8785 the loop is entered. This usually makes programs run more slowly.
8786 @option{-funroll-all-loops} implies the same options as
8787 @option{-funroll-loops}.
8790 @opindex fpeel-loops
8791 Peels loops for which there is enough information that they do not
8792 roll much (from profile feedback). It also turns on complete loop peeling
8793 (i.e.@: complete removal of loops with small constant number of iterations).
8795 Enabled with @option{-fprofile-use}.
8797 @item -fmove-loop-invariants
8798 @opindex fmove-loop-invariants
8799 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8800 at level @option{-O1}
8802 @item -funswitch-loops
8803 @opindex funswitch-loops
8804 Move branches with loop invariant conditions out of the loop, with duplicates
8805 of the loop on both branches (modified according to result of the condition).
8807 @item -ffunction-sections
8808 @itemx -fdata-sections
8809 @opindex ffunction-sections
8810 @opindex fdata-sections
8811 Place each function or data item into its own section in the output
8812 file if the target supports arbitrary sections. The name of the
8813 function or the name of the data item determines the section's name
8816 Use these options on systems where the linker can perform optimizations
8817 to improve locality of reference in the instruction space. Most systems
8818 using the ELF object format and SPARC processors running Solaris 2 have
8819 linkers with such optimizations. AIX may have these optimizations in
8822 Only use these options when there are significant benefits from doing
8823 so. When you specify these options, the assembler and linker
8824 create larger object and executable files and are also slower.
8825 You cannot use @code{gprof} on all systems if you
8826 specify this option, and you may have problems with debugging if
8827 you specify both this option and @option{-g}.
8829 @item -fbranch-target-load-optimize
8830 @opindex fbranch-target-load-optimize
8831 Perform branch target register load optimization before prologue / epilogue
8833 The use of target registers can typically be exposed only during reload,
8834 thus hoisting loads out of loops and doing inter-block scheduling needs
8835 a separate optimization pass.
8837 @item -fbranch-target-load-optimize2
8838 @opindex fbranch-target-load-optimize2
8839 Perform branch target register load optimization after prologue / epilogue
8842 @item -fbtr-bb-exclusive
8843 @opindex fbtr-bb-exclusive
8844 When performing branch target register load optimization, don't reuse
8845 branch target registers within any basic block.
8847 @item -fstack-protector
8848 @opindex fstack-protector
8849 Emit extra code to check for buffer overflows, such as stack smashing
8850 attacks. This is done by adding a guard variable to functions with
8851 vulnerable objects. This includes functions that call @code{alloca}, and
8852 functions with buffers larger than 8 bytes. The guards are initialized
8853 when a function is entered and then checked when the function exits.
8854 If a guard check fails, an error message is printed and the program exits.
8856 @item -fstack-protector-all
8857 @opindex fstack-protector-all
8858 Like @option{-fstack-protector} except that all functions are protected.
8860 @item -fsection-anchors
8861 @opindex fsection-anchors
8862 Try to reduce the number of symbolic address calculations by using
8863 shared ``anchor'' symbols to address nearby objects. This transformation
8864 can help to reduce the number of GOT entries and GOT accesses on some
8867 For example, the implementation of the following function @code{foo}:
8871 int foo (void) @{ return a + b + c; @}
8875 usually calculates the addresses of all three variables, but if you
8876 compile it with @option{-fsection-anchors}, it accesses the variables
8877 from a common anchor point instead. The effect is similar to the
8878 following pseudocode (which isn't valid C):
8883 register int *xr = &x;
8884 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8888 Not all targets support this option.
8890 @item --param @var{name}=@var{value}
8892 In some places, GCC uses various constants to control the amount of
8893 optimization that is done. For example, GCC does not inline functions
8894 that contain more than a certain number of instructions. You can
8895 control some of these constants on the command line using the
8896 @option{--param} option.
8898 The names of specific parameters, and the meaning of the values, are
8899 tied to the internals of the compiler, and are subject to change
8900 without notice in future releases.
8902 In each case, the @var{value} is an integer. The allowable choices for
8906 @item predictable-branch-outcome
8907 When branch is predicted to be taken with probability lower than this threshold
8908 (in percent), then it is considered well predictable. The default is 10.
8910 @item max-crossjump-edges
8911 The maximum number of incoming edges to consider for cross-jumping.
8912 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8913 the number of edges incoming to each block. Increasing values mean
8914 more aggressive optimization, making the compilation time increase with
8915 probably small improvement in executable size.
8917 @item min-crossjump-insns
8918 The minimum number of instructions that must be matched at the end
8919 of two blocks before cross-jumping is performed on them. This
8920 value is ignored in the case where all instructions in the block being
8921 cross-jumped from are matched. The default value is 5.
8923 @item max-grow-copy-bb-insns
8924 The maximum code size expansion factor when copying basic blocks
8925 instead of jumping. The expansion is relative to a jump instruction.
8926 The default value is 8.
8928 @item max-goto-duplication-insns
8929 The maximum number of instructions to duplicate to a block that jumps
8930 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8931 passes, GCC factors computed gotos early in the compilation process,
8932 and unfactors them as late as possible. Only computed jumps at the
8933 end of a basic blocks with no more than max-goto-duplication-insns are
8934 unfactored. The default value is 8.
8936 @item max-delay-slot-insn-search
8937 The maximum number of instructions to consider when looking for an
8938 instruction to fill a delay slot. If more than this arbitrary number of
8939 instructions are searched, the time savings from filling the delay slot
8940 are minimal, so stop searching. Increasing values mean more
8941 aggressive optimization, making the compilation time increase with probably
8942 small improvement in execution time.
8944 @item max-delay-slot-live-search
8945 When trying to fill delay slots, the maximum number of instructions to
8946 consider when searching for a block with valid live register
8947 information. Increasing this arbitrarily chosen value means more
8948 aggressive optimization, increasing the compilation time. This parameter
8949 should be removed when the delay slot code is rewritten to maintain the
8952 @item max-gcse-memory
8953 The approximate maximum amount of memory that can be allocated in
8954 order to perform the global common subexpression elimination
8955 optimization. If more memory than specified is required, the
8956 optimization is not done.
8958 @item max-gcse-insertion-ratio
8959 If the ratio of expression insertions to deletions is larger than this value
8960 for any expression, then RTL PRE inserts or removes the expression and thus
8961 leaves partially redundant computations in the instruction stream. The default value is 20.
8963 @item max-pending-list-length
8964 The maximum number of pending dependencies scheduling allows
8965 before flushing the current state and starting over. Large functions
8966 with few branches or calls can create excessively large lists which
8967 needlessly consume memory and resources.
8969 @item max-modulo-backtrack-attempts
8970 The maximum number of backtrack attempts the scheduler should make
8971 when modulo scheduling a loop. Larger values can exponentially increase
8974 @item max-inline-insns-single
8975 Several parameters control the tree inliner used in GCC@.
8976 This number sets the maximum number of instructions (counted in GCC's
8977 internal representation) in a single function that the tree inliner
8978 considers for inlining. This only affects functions declared
8979 inline and methods implemented in a class declaration (C++).
8980 The default value is 400.
8982 @item max-inline-insns-auto
8983 When you use @option{-finline-functions} (included in @option{-O3}),
8984 a lot of functions that would otherwise not be considered for inlining
8985 by the compiler are investigated. To those functions, a different
8986 (more restrictive) limit compared to functions declared inline can
8988 The default value is 40.
8990 @item inline-min-speedup
8991 When estimated performance improvement of caller + callee runtime exceeds this
8992 threshold (in precent), the function can be inlined regardless the limit on
8993 @option{--param max-inline-insns-single} and @option{--param
8994 max-inline-insns-auto}.
8996 @item large-function-insns
8997 The limit specifying really large functions. For functions larger than this
8998 limit after inlining, inlining is constrained by
8999 @option{--param large-function-growth}. This parameter is useful primarily
9000 to avoid extreme compilation time caused by non-linear algorithms used by the
9002 The default value is 2700.
9004 @item large-function-growth
9005 Specifies maximal growth of large function caused by inlining in percents.
9006 The default value is 100 which limits large function growth to 2.0 times
9009 @item large-unit-insns
9010 The limit specifying large translation unit. Growth caused by inlining of
9011 units larger than this limit is limited by @option{--param inline-unit-growth}.
9012 For small units this might be too tight.
9013 For example, consider a unit consisting of function A
9014 that is inline and B that just calls A three times. If B is small relative to
9015 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9016 large units consisting of small inlineable functions, however, the overall unit
9017 growth limit is needed to avoid exponential explosion of code size. Thus for
9018 smaller units, the size is increased to @option{--param large-unit-insns}
9019 before applying @option{--param inline-unit-growth}. The default is 10000.
9021 @item inline-unit-growth
9022 Specifies maximal overall growth of the compilation unit caused by inlining.
9023 The default value is 30 which limits unit growth to 1.3 times the original
9026 @item ipcp-unit-growth
9027 Specifies maximal overall growth of the compilation unit caused by
9028 interprocedural constant propagation. The default value is 10 which limits
9029 unit growth to 1.1 times the original size.
9031 @item large-stack-frame
9032 The limit specifying large stack frames. While inlining the algorithm is trying
9033 to not grow past this limit too much. The default value is 256 bytes.
9035 @item large-stack-frame-growth
9036 Specifies maximal growth of large stack frames caused by inlining in percents.
9037 The default value is 1000 which limits large stack frame growth to 11 times
9040 @item max-inline-insns-recursive
9041 @itemx max-inline-insns-recursive-auto
9042 Specifies the maximum number of instructions an out-of-line copy of a
9043 self-recursive inline
9044 function can grow into by performing recursive inlining.
9046 For functions declared inline, @option{--param max-inline-insns-recursive} is
9047 taken into account. For functions not declared inline, recursive inlining
9048 happens only when @option{-finline-functions} (included in @option{-O3}) is
9049 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
9050 default value is 450.
9052 @item max-inline-recursive-depth
9053 @itemx max-inline-recursive-depth-auto
9054 Specifies the maximum recursion depth used for recursive inlining.
9056 For functions declared inline, @option{--param max-inline-recursive-depth} is
9057 taken into account. For functions not declared inline, recursive inlining
9058 happens only when @option{-finline-functions} (included in @option{-O3}) is
9059 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
9062 @item min-inline-recursive-probability
9063 Recursive inlining is profitable only for function having deep recursion
9064 in average and can hurt for function having little recursion depth by
9065 increasing the prologue size or complexity of function body to other
9068 When profile feedback is available (see @option{-fprofile-generate}) the actual
9069 recursion depth can be guessed from probability that function recurses via a
9070 given call expression. This parameter limits inlining only to call expressions
9071 whose probability exceeds the given threshold (in percents).
9072 The default value is 10.
9074 @item early-inlining-insns
9075 Specify growth that the early inliner can make. In effect it increases
9076 the amount of inlining for code having a large abstraction penalty.
9077 The default value is 10.
9079 @item max-early-inliner-iterations
9080 @itemx max-early-inliner-iterations
9081 Limit of iterations of the early inliner. This basically bounds
9082 the number of nested indirect calls the early inliner can resolve.
9083 Deeper chains are still handled by late inlining.
9085 @item comdat-sharing-probability
9086 @itemx comdat-sharing-probability
9087 Probability (in percent) that C++ inline function with comdat visibility
9088 are shared across multiple compilation units. The default value is 20.
9090 @item min-vect-loop-bound
9091 The minimum number of iterations under which loops are not vectorized
9092 when @option{-ftree-vectorize} is used. The number of iterations after
9093 vectorization needs to be greater than the value specified by this option
9094 to allow vectorization. The default value is 0.
9096 @item gcse-cost-distance-ratio
9097 Scaling factor in calculation of maximum distance an expression
9098 can be moved by GCSE optimizations. This is currently supported only in the
9099 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9100 is with simple expressions, i.e., the expressions that have cost
9101 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9102 hoisting of simple expressions. The default value is 10.
9104 @item gcse-unrestricted-cost
9105 Cost, roughly measured as the cost of a single typical machine
9106 instruction, at which GCSE optimizations do not constrain
9107 the distance an expression can travel. This is currently
9108 supported only in the code hoisting pass. The lesser the cost,
9109 the more aggressive code hoisting is. Specifying 0
9110 allows all expressions to travel unrestricted distances.
9111 The default value is 3.
9113 @item max-hoist-depth
9114 The depth of search in the dominator tree for expressions to hoist.
9115 This is used to avoid quadratic behavior in hoisting algorithm.
9116 The value of 0 does not limit on the search, but may slow down compilation
9117 of huge functions. The default value is 30.
9119 @item max-tail-merge-comparisons
9120 The maximum amount of similar bbs to compare a bb with. This is used to
9121 avoid quadratic behavior in tree tail merging. The default value is 10.
9123 @item max-tail-merge-iterations
9124 The maximum amount of iterations of the pass over the function. This is used to
9125 limit compilation time in tree tail merging. The default value is 2.
9127 @item max-unrolled-insns
9128 The maximum number of instructions that a loop may have to be unrolled.
9129 If a loop is unrolled, this parameter also determines how many times
9130 the loop code is unrolled.
9132 @item max-average-unrolled-insns
9133 The maximum number of instructions biased by probabilities of their execution
9134 that a loop may have to be unrolled. If a loop is unrolled,
9135 this parameter also determines how many times the loop code is unrolled.
9137 @item max-unroll-times
9138 The maximum number of unrollings of a single loop.
9140 @item max-peeled-insns
9141 The maximum number of instructions that a loop may have to be peeled.
9142 If a loop is peeled, this parameter also determines how many times
9143 the loop code is peeled.
9145 @item max-peel-times
9146 The maximum number of peelings of a single loop.
9148 @item max-peel-branches
9149 The maximum number of branches on the hot path through the peeled sequence.
9151 @item max-completely-peeled-insns
9152 The maximum number of insns of a completely peeled loop.
9154 @item max-completely-peel-times
9155 The maximum number of iterations of a loop to be suitable for complete peeling.
9157 @item max-completely-peel-loop-nest-depth
9158 The maximum depth of a loop nest suitable for complete peeling.
9160 @item max-unswitch-insns
9161 The maximum number of insns of an unswitched loop.
9163 @item max-unswitch-level
9164 The maximum number of branches unswitched in a single loop.
9167 The minimum cost of an expensive expression in the loop invariant motion.
9169 @item iv-consider-all-candidates-bound
9170 Bound on number of candidates for induction variables, below which
9171 all candidates are considered for each use in induction variable
9172 optimizations. If there are more candidates than this,
9173 only the most relevant ones are considered to avoid quadratic time complexity.
9175 @item iv-max-considered-uses
9176 The induction variable optimizations give up on loops that contain more
9177 induction variable uses.
9179 @item iv-always-prune-cand-set-bound
9180 If the number of candidates in the set is smaller than this value,
9181 always try to remove unnecessary ivs from the set
9182 when adding a new one.
9184 @item scev-max-expr-size
9185 Bound on size of expressions used in the scalar evolutions analyzer.
9186 Large expressions slow the analyzer.
9188 @item scev-max-expr-complexity
9189 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9190 Complex expressions slow the analyzer.
9192 @item omega-max-vars
9193 The maximum number of variables in an Omega constraint system.
9194 The default value is 128.
9196 @item omega-max-geqs
9197 The maximum number of inequalities in an Omega constraint system.
9198 The default value is 256.
9201 The maximum number of equalities in an Omega constraint system.
9202 The default value is 128.
9204 @item omega-max-wild-cards
9205 The maximum number of wildcard variables that the Omega solver is
9206 able to insert. The default value is 18.
9208 @item omega-hash-table-size
9209 The size of the hash table in the Omega solver. The default value is
9212 @item omega-max-keys
9213 The maximal number of keys used by the Omega solver. The default
9216 @item omega-eliminate-redundant-constraints
9217 When set to 1, use expensive methods to eliminate all redundant
9218 constraints. The default value is 0.
9220 @item vect-max-version-for-alignment-checks
9221 The maximum number of run-time checks that can be performed when
9222 doing loop versioning for alignment in the vectorizer. See option
9223 @option{-ftree-vect-loop-version} for more information.
9225 @item vect-max-version-for-alias-checks
9226 The maximum number of run-time checks that can be performed when
9227 doing loop versioning for alias in the vectorizer. See option
9228 @option{-ftree-vect-loop-version} for more information.
9230 @item max-iterations-to-track
9231 The maximum number of iterations of a loop the brute-force algorithm
9232 for analysis of the number of iterations of the loop tries to evaluate.
9234 @item hot-bb-count-ws-permille
9235 A basic block profile count is considered hot if it contributes to
9236 the given permillage (i.e. 0...1000) of the entire profiled execution.
9238 @item hot-bb-frequency-fraction
9239 Select fraction of the entry block frequency of executions of basic block in
9240 function given basic block needs to have to be considered hot.
9242 @item max-predicted-iterations
9243 The maximum number of loop iterations we predict statically. This is useful
9244 in cases where a function contains a single loop with known bound and
9245 another loop with unknown bound.
9246 The known number of iterations is predicted correctly, while
9247 the unknown number of iterations average to roughly 10. This means that the
9248 loop without bounds appears artificially cold relative to the other one.
9250 @item align-threshold
9252 Select fraction of the maximal frequency of executions of a basic block in
9253 a function to align the basic block.
9255 @item align-loop-iterations
9257 A loop expected to iterate at least the selected number of iterations is
9260 @item tracer-dynamic-coverage
9261 @itemx tracer-dynamic-coverage-feedback
9263 This value is used to limit superblock formation once the given percentage of
9264 executed instructions is covered. This limits unnecessary code size
9267 The @option{tracer-dynamic-coverage-feedback} is used only when profile
9268 feedback is available. The real profiles (as opposed to statically estimated
9269 ones) are much less balanced allowing the threshold to be larger value.
9271 @item tracer-max-code-growth
9272 Stop tail duplication once code growth has reached given percentage. This is
9273 a rather artificial limit, as most of the duplicates are eliminated later in
9274 cross jumping, so it may be set to much higher values than is the desired code
9277 @item tracer-min-branch-ratio
9279 Stop reverse growth when the reverse probability of best edge is less than this
9280 threshold (in percent).
9282 @item tracer-min-branch-ratio
9283 @itemx tracer-min-branch-ratio-feedback
9285 Stop forward growth if the best edge has probability lower than this
9288 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
9289 compilation for profile feedback and one for compilation without. The value
9290 for compilation with profile feedback needs to be more conservative (higher) in
9291 order to make tracer effective.
9293 @item max-cse-path-length
9295 The maximum number of basic blocks on path that CSE considers.
9299 The maximum number of instructions CSE processes before flushing.
9300 The default is 1000.
9302 @item ggc-min-expand
9304 GCC uses a garbage collector to manage its own memory allocation. This
9305 parameter specifies the minimum percentage by which the garbage
9306 collector's heap should be allowed to expand between collections.
9307 Tuning this may improve compilation speed; it has no effect on code
9310 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9311 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9312 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9313 GCC is not able to calculate RAM on a particular platform, the lower
9314 bound of 30% is used. Setting this parameter and
9315 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9316 every opportunity. This is extremely slow, but can be useful for
9319 @item ggc-min-heapsize
9321 Minimum size of the garbage collector's heap before it begins bothering
9322 to collect garbage. The first collection occurs after the heap expands
9323 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9324 tuning this may improve compilation speed, and has no effect on code
9327 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9328 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9329 with a lower bound of 4096 (four megabytes) and an upper bound of
9330 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9331 particular platform, the lower bound is used. Setting this parameter
9332 very large effectively disables garbage collection. Setting this
9333 parameter and @option{ggc-min-expand} to zero causes a full collection
9334 to occur at every opportunity.
9336 @item max-reload-search-insns
9337 The maximum number of instruction reload should look backward for equivalent
9338 register. Increasing values mean more aggressive optimization, making the
9339 compilation time increase with probably slightly better performance.
9340 The default value is 100.
9342 @item max-cselib-memory-locations
9343 The maximum number of memory locations cselib should take into account.
9344 Increasing values mean more aggressive optimization, making the compilation time
9345 increase with probably slightly better performance. The default value is 500.
9347 @item reorder-blocks-duplicate
9348 @itemx reorder-blocks-duplicate-feedback
9350 Used by the basic block reordering pass to decide whether to use unconditional
9351 branch or duplicate the code on its destination. Code is duplicated when its
9352 estimated size is smaller than this value multiplied by the estimated size of
9353 unconditional jump in the hot spots of the program.
9355 The @option{reorder-block-duplicate-feedback} is used only when profile
9356 feedback is available. It may be set to higher values than
9357 @option{reorder-block-duplicate} since information about the hot spots is more
9360 @item max-sched-ready-insns
9361 The maximum number of instructions ready to be issued the scheduler should
9362 consider at any given time during the first scheduling pass. Increasing
9363 values mean more thorough searches, making the compilation time increase
9364 with probably little benefit. The default value is 100.
9366 @item max-sched-region-blocks
9367 The maximum number of blocks in a region to be considered for
9368 interblock scheduling. The default value is 10.
9370 @item max-pipeline-region-blocks
9371 The maximum number of blocks in a region to be considered for
9372 pipelining in the selective scheduler. The default value is 15.
9374 @item max-sched-region-insns
9375 The maximum number of insns in a region to be considered for
9376 interblock scheduling. The default value is 100.
9378 @item max-pipeline-region-insns
9379 The maximum number of insns in a region to be considered for
9380 pipelining in the selective scheduler. The default value is 200.
9383 The minimum probability (in percents) of reaching a source block
9384 for interblock speculative scheduling. The default value is 40.
9386 @item max-sched-extend-regions-iters
9387 The maximum number of iterations through CFG to extend regions.
9388 A value of 0 (the default) disables region extensions.
9390 @item max-sched-insn-conflict-delay
9391 The maximum conflict delay for an insn to be considered for speculative motion.
9392 The default value is 3.
9394 @item sched-spec-prob-cutoff
9395 The minimal probability of speculation success (in percents), so that
9396 speculative insns are scheduled.
9397 The default value is 40.
9399 @item sched-spec-state-edge-prob-cutoff
9400 The minimum probability an edge must have for the scheduler to save its
9402 The default value is 10.
9404 @item sched-mem-true-dep-cost
9405 Minimal distance (in CPU cycles) between store and load targeting same
9406 memory locations. The default value is 1.
9408 @item selsched-max-lookahead
9409 The maximum size of the lookahead window of selective scheduling. It is a
9410 depth of search for available instructions.
9411 The default value is 50.
9413 @item selsched-max-sched-times
9414 The maximum number of times that an instruction is scheduled during
9415 selective scheduling. This is the limit on the number of iterations
9416 through which the instruction may be pipelined. The default value is 2.
9418 @item selsched-max-insns-to-rename
9419 The maximum number of best instructions in the ready list that are considered
9420 for renaming in the selective scheduler. The default value is 2.
9423 The minimum value of stage count that swing modulo scheduler
9424 generates. The default value is 2.
9426 @item max-last-value-rtl
9427 The maximum size measured as number of RTLs that can be recorded in an expression
9428 in combiner for a pseudo register as last known value of that register. The default
9431 @item integer-share-limit
9432 Small integer constants can use a shared data structure, reducing the
9433 compiler's memory usage and increasing its speed. This sets the maximum
9434 value of a shared integer constant. The default value is 256.
9436 @item ssp-buffer-size
9437 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9438 protection when @option{-fstack-protection} is used.
9440 @item max-jump-thread-duplication-stmts
9441 Maximum number of statements allowed in a block that needs to be
9442 duplicated when threading jumps.
9444 @item max-fields-for-field-sensitive
9445 Maximum number of fields in a structure treated in
9446 a field sensitive manner during pointer analysis. The default is zero
9447 for @option{-O0} and @option{-O1},
9448 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9450 @item prefetch-latency
9451 Estimate on average number of instructions that are executed before
9452 prefetch finishes. The distance prefetched ahead is proportional
9453 to this constant. Increasing this number may also lead to less
9454 streams being prefetched (see @option{simultaneous-prefetches}).
9456 @item simultaneous-prefetches
9457 Maximum number of prefetches that can run at the same time.
9459 @item l1-cache-line-size
9460 The size of cache line in L1 cache, in bytes.
9463 The size of L1 cache, in kilobytes.
9466 The size of L2 cache, in kilobytes.
9468 @item min-insn-to-prefetch-ratio
9469 The minimum ratio between the number of instructions and the
9470 number of prefetches to enable prefetching in a loop.
9472 @item prefetch-min-insn-to-mem-ratio
9473 The minimum ratio between the number of instructions and the
9474 number of memory references to enable prefetching in a loop.
9476 @item use-canonical-types
9477 Whether the compiler should use the ``canonical'' type system. By
9478 default, this should always be 1, which uses a more efficient internal
9479 mechanism for comparing types in C++ and Objective-C++. However, if
9480 bugs in the canonical type system are causing compilation failures,
9481 set this value to 0 to disable canonical types.
9483 @item switch-conversion-max-branch-ratio
9484 Switch initialization conversion refuses to create arrays that are
9485 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9486 branches in the switch.
9488 @item max-partial-antic-length
9489 Maximum length of the partial antic set computed during the tree
9490 partial redundancy elimination optimization (@option{-ftree-pre}) when
9491 optimizing at @option{-O3} and above. For some sorts of source code
9492 the enhanced partial redundancy elimination optimization can run away,
9493 consuming all of the memory available on the host machine. This
9494 parameter sets a limit on the length of the sets that are computed,
9495 which prevents the runaway behavior. Setting a value of 0 for
9496 this parameter allows an unlimited set length.
9498 @item sccvn-max-scc-size
9499 Maximum size of a strongly connected component (SCC) during SCCVN
9500 processing. If this limit is hit, SCCVN processing for the whole
9501 function is not done and optimizations depending on it are
9502 disabled. The default maximum SCC size is 10000.
9504 @item sccvn-max-alias-queries-per-access
9505 Maximum number of alias-oracle queries we perform when looking for
9506 redundancies for loads and stores. If this limit is hit the search
9507 is aborted and the load or store is not considered redundant. The
9508 number of queries is algorithmically limited to the number of
9509 stores on all paths from the load to the function entry.
9510 The default maxmimum number of queries is 1000.
9512 @item ira-max-loops-num
9513 IRA uses regional register allocation by default. If a function
9514 contains more loops than the number given by this parameter, only at most
9515 the given number of the most frequently-executed loops form regions
9516 for regional register allocation. The default value of the
9519 @item ira-max-conflict-table-size
9520 Although IRA uses a sophisticated algorithm to compress the conflict
9521 table, the table can still require excessive amounts of memory for
9522 huge functions. If the conflict table for a function could be more
9523 than the size in MB given by this parameter, the register allocator
9524 instead uses a faster, simpler, and lower-quality
9525 algorithm that does not require building a pseudo-register conflict table.
9526 The default value of the parameter is 2000.
9528 @item ira-loop-reserved-regs
9529 IRA can be used to evaluate more accurate register pressure in loops
9530 for decisions to move loop invariants (see @option{-O3}). The number
9531 of available registers reserved for some other purposes is given
9532 by this parameter. The default value of the parameter is 2, which is
9533 the minimal number of registers needed by typical instructions.
9534 This value is the best found from numerous experiments.
9536 @item loop-invariant-max-bbs-in-loop
9537 Loop invariant motion can be very expensive, both in compilation time and
9538 in amount of needed compile-time memory, with very large loops. Loops
9539 with more basic blocks than this parameter won't have loop invariant
9540 motion optimization performed on them. The default value of the
9541 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9543 @item loop-max-datarefs-for-datadeps
9544 Building data dapendencies is expensive for very large loops. This
9545 parameter limits the number of data references in loops that are
9546 considered for data dependence analysis. These large loops are no
9547 handled by the optimizations using loop data dependencies.
9548 The default value is 1000.
9550 @item max-vartrack-size
9551 Sets a maximum number of hash table slots to use during variable
9552 tracking dataflow analysis of any function. If this limit is exceeded
9553 with variable tracking at assignments enabled, analysis for that
9554 function is retried without it, after removing all debug insns from
9555 the function. If the limit is exceeded even without debug insns, var
9556 tracking analysis is completely disabled for the function. Setting
9557 the parameter to zero makes it unlimited.
9559 @item max-vartrack-expr-depth
9560 Sets a maximum number of recursion levels when attempting to map
9561 variable names or debug temporaries to value expressions. This trades
9562 compilation time for more complete debug information. If this is set too
9563 low, value expressions that are available and could be represented in
9564 debug information may end up not being used; setting this higher may
9565 enable the compiler to find more complex debug expressions, but compile
9566 time and memory use may grow. The default is 12.
9568 @item min-nondebug-insn-uid
9569 Use uids starting at this parameter for nondebug insns. The range below
9570 the parameter is reserved exclusively for debug insns created by
9571 @option{-fvar-tracking-assignments}, but debug insns may get
9572 (non-overlapping) uids above it if the reserved range is exhausted.
9574 @item ipa-sra-ptr-growth-factor
9575 IPA-SRA replaces a pointer to an aggregate with one or more new
9576 parameters only when their cumulative size is less or equal to
9577 @option{ipa-sra-ptr-growth-factor} times the size of the original
9580 @item tm-max-aggregate-size
9581 When making copies of thread-local variables in a transaction, this
9582 parameter specifies the size in bytes after which variables are
9583 saved with the logging functions as opposed to save/restore code
9584 sequence pairs. This option only applies when using
9587 @item graphite-max-nb-scop-params
9588 To avoid exponential effects in the Graphite loop transforms, the
9589 number of parameters in a Static Control Part (SCoP) is bounded. The
9590 default value is 10 parameters. A variable whose value is unknown at
9591 compilation time and defined outside a SCoP is a parameter of the SCoP.
9593 @item graphite-max-bbs-per-function
9594 To avoid exponential effects in the detection of SCoPs, the size of
9595 the functions analyzed by Graphite is bounded. The default value is
9598 @item loop-block-tile-size
9599 Loop blocking or strip mining transforms, enabled with
9600 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9601 loop in the loop nest by a given number of iterations. The strip
9602 length can be changed using the @option{loop-block-tile-size}
9603 parameter. The default value is 51 iterations.
9605 @item ipa-cp-value-list-size
9606 IPA-CP attempts to track all possible values and types passed to a function's
9607 parameter in order to propagate them and perform devirtualization.
9608 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9609 stores per one formal parameter of a function.
9611 @item lto-partitions
9612 Specify desired number of partitions produced during WHOPR compilation.
9613 The number of partitions should exceed the number of CPUs used for compilation.
9614 The default value is 32.
9616 @item lto-minpartition
9617 Size of minimal partition for WHOPR (in estimated instructions).
9618 This prevents expenses of splitting very small programs into too many
9621 @item cxx-max-namespaces-for-diagnostic-help
9622 The maximum number of namespaces to consult for suggestions when C++
9623 name lookup fails for an identifier. The default is 1000.
9625 @item sink-frequency-threshold
9626 The maximum relative execution frequency (in percents) of the target block
9627 relative to a statement's original block to allow statement sinking of a
9628 statement. Larger numbers result in more aggressive statement sinking.
9629 The default value is 75. A small positive adjustment is applied for
9630 statements with memory operands as those are even more profitable so sink.
9632 @item max-stores-to-sink
9633 The maximum number of conditional stores paires that can be sunk. Set to 0
9634 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9635 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9637 @item allow-load-data-races
9638 Allow optimizers to introduce new data races on loads.
9639 Set to 1 to allow, otherwise to 0. This option is enabled by default
9640 unless implicitly set by the @option{-fmemory-model=} option.
9642 @item allow-store-data-races
9643 Allow optimizers to introduce new data races on stores.
9644 Set to 1 to allow, otherwise to 0. This option is enabled by default
9645 unless implicitly set by the @option{-fmemory-model=} option.
9647 @item allow-packed-load-data-races
9648 Allow optimizers to introduce new data races on packed data loads.
9649 Set to 1 to allow, otherwise to 0. This option is enabled by default
9650 unless implicitly set by the @option{-fmemory-model=} option.
9652 @item allow-packed-store-data-races
9653 Allow optimizers to introduce new data races on packed data stores.
9654 Set to 1 to allow, otherwise to 0. This option is enabled by default
9655 unless implicitly set by the @option{-fmemory-model=} option.
9657 @item case-values-threshold
9658 The smallest number of different values for which it is best to use a
9659 jump-table instead of a tree of conditional branches. If the value is
9660 0, use the default for the machine. The default is 0.
9662 @item tree-reassoc-width
9663 Set the maximum number of instructions executed in parallel in
9664 reassociated tree. This parameter overrides target dependent
9665 heuristics used by default if has non zero value.
9667 @item sched-pressure-algorithm
9668 Choose between the two available implementations of
9669 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9670 and is the more likely to prevent instructions from being reordered.
9671 Algorithm 2 was designed to be a compromise between the relatively
9672 conservative approach taken by algorithm 1 and the rather aggressive
9673 approach taken by the default scheduler. It relies more heavily on
9674 having a regular register file and accurate register pressure classes.
9675 See @file{haifa-sched.c} in the GCC sources for more details.
9677 The default choice depends on the target.
9679 @item max-slsr-cand-scan
9680 Set the maximum number of existing candidates that will be considered when
9681 seeking a basis for a new straight-line strength reduction candidate.
9686 @node Preprocessor Options
9687 @section Options Controlling the Preprocessor
9688 @cindex preprocessor options
9689 @cindex options, preprocessor
9691 These options control the C preprocessor, which is run on each C source
9692 file before actual compilation.
9694 If you use the @option{-E} option, nothing is done except preprocessing.
9695 Some of these options make sense only together with @option{-E} because
9696 they cause the preprocessor output to be unsuitable for actual
9700 @item -Wp,@var{option}
9702 You can use @option{-Wp,@var{option}} to bypass the compiler driver
9703 and pass @var{option} directly through to the preprocessor. If
9704 @var{option} contains commas, it is split into multiple options at the
9705 commas. However, many options are modified, translated or interpreted
9706 by the compiler driver before being passed to the preprocessor, and
9707 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
9708 interface is undocumented and subject to change, so whenever possible
9709 you should avoid using @option{-Wp} and let the driver handle the
9712 @item -Xpreprocessor @var{option}
9713 @opindex Xpreprocessor
9714 Pass @var{option} as an option to the preprocessor. You can use this to
9715 supply system-specific preprocessor options that GCC does not
9718 If you want to pass an option that takes an argument, you must use
9719 @option{-Xpreprocessor} twice, once for the option and once for the argument.
9721 @item -no-integrated-cpp
9722 @opindex no-integrated-cpp
9723 Perform preprocessing as a separate pass before compilation.
9724 By default, GCC performs preprocessing as an integrated part of
9725 input tokenization and parsing.
9726 If this option is provided, the appropriate language front end
9727 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
9728 and Objective-C, respectively) is instead invoked twice,
9729 once for preprocessing only and once for actual compilation
9730 of the preprocessed input.
9731 This option may be useful in conjunction with the @option{-B} or
9732 @option{-wrapper} options to specify an alternate preprocessor or
9733 perform additional processing of the program source between
9734 normal preprocessing and compilation.
9737 @include cppopts.texi
9739 @node Assembler Options
9740 @section Passing Options to the Assembler
9742 @c prevent bad page break with this line
9743 You can pass options to the assembler.
9746 @item -Wa,@var{option}
9748 Pass @var{option} as an option to the assembler. If @var{option}
9749 contains commas, it is split into multiple options at the commas.
9751 @item -Xassembler @var{option}
9753 Pass @var{option} as an option to the assembler. You can use this to
9754 supply system-specific assembler options that GCC does not
9757 If you want to pass an option that takes an argument, you must use
9758 @option{-Xassembler} twice, once for the option and once for the argument.
9763 @section Options for Linking
9764 @cindex link options
9765 @cindex options, linking
9767 These options come into play when the compiler links object files into
9768 an executable output file. They are meaningless if the compiler is
9769 not doing a link step.
9773 @item @var{object-file-name}
9774 A file name that does not end in a special recognized suffix is
9775 considered to name an object file or library. (Object files are
9776 distinguished from libraries by the linker according to the file
9777 contents.) If linking is done, these object files are used as input
9786 If any of these options is used, then the linker is not run, and
9787 object file names should not be used as arguments. @xref{Overall
9791 @item -l@var{library}
9792 @itemx -l @var{library}
9794 Search the library named @var{library} when linking. (The second
9795 alternative with the library as a separate argument is only for
9796 POSIX compliance and is not recommended.)
9798 It makes a difference where in the command you write this option; the
9799 linker searches and processes libraries and object files in the order they
9800 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
9801 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
9802 to functions in @samp{z}, those functions may not be loaded.
9804 The linker searches a standard list of directories for the library,
9805 which is actually a file named @file{lib@var{library}.a}. The linker
9806 then uses this file as if it had been specified precisely by name.
9808 The directories searched include several standard system directories
9809 plus any that you specify with @option{-L}.
9811 Normally the files found this way are library files---archive files
9812 whose members are object files. The linker handles an archive file by
9813 scanning through it for members which define symbols that have so far
9814 been referenced but not defined. But if the file that is found is an
9815 ordinary object file, it is linked in the usual fashion. The only
9816 difference between using an @option{-l} option and specifying a file name
9817 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
9818 and searches several directories.
9822 You need this special case of the @option{-l} option in order to
9823 link an Objective-C or Objective-C++ program.
9826 @opindex nostartfiles
9827 Do not use the standard system startup files when linking.
9828 The standard system libraries are used normally, unless @option{-nostdlib}
9829 or @option{-nodefaultlibs} is used.
9831 @item -nodefaultlibs
9832 @opindex nodefaultlibs
9833 Do not use the standard system libraries when linking.
9834 Only the libraries you specify are passed to the linker, and options
9835 specifying linkage of the system libraries, such as @code{-static-libgcc}
9836 or @code{-shared-libgcc}, are ignored.
9837 The standard startup files are used normally, unless @option{-nostartfiles}
9840 The compiler may generate calls to @code{memcmp},
9841 @code{memset}, @code{memcpy} and @code{memmove}.
9842 These entries are usually resolved by entries in
9843 libc. These entry points should be supplied through some other
9844 mechanism when this option is specified.
9848 Do not use the standard system startup files or libraries when linking.
9849 No startup files and only the libraries you specify are passed to
9850 the linker, and options specifying linkage of the system libraries, such as
9851 @code{-static-libgcc} or @code{-shared-libgcc}, are ignored.
9853 The compiler may generate calls to @code{memcmp}, @code{memset},
9854 @code{memcpy} and @code{memmove}.
9855 These entries are usually resolved by entries in
9856 libc. These entry points should be supplied through some other
9857 mechanism when this option is specified.
9859 @cindex @option{-lgcc}, use with @option{-nostdlib}
9860 @cindex @option{-nostdlib} and unresolved references
9861 @cindex unresolved references and @option{-nostdlib}
9862 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
9863 @cindex @option{-nodefaultlibs} and unresolved references
9864 @cindex unresolved references and @option{-nodefaultlibs}
9865 One of the standard libraries bypassed by @option{-nostdlib} and
9866 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
9867 which GCC uses to overcome shortcomings of particular machines, or special
9868 needs for some languages.
9869 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
9870 Collection (GCC) Internals},
9871 for more discussion of @file{libgcc.a}.)
9872 In most cases, you need @file{libgcc.a} even when you want to avoid
9873 other standard libraries. In other words, when you specify @option{-nostdlib}
9874 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
9875 This ensures that you have no unresolved references to internal GCC
9876 library subroutines.
9877 (An example of such an internal subroutine is @samp{__main}, used to ensure C++
9878 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
9879 GNU Compiler Collection (GCC) Internals}.)
9883 Produce a position independent executable on targets that support it.
9884 For predictable results, you must also specify the same set of options
9885 used for compilation (@option{-fpie}, @option{-fPIE},
9886 or model suboptions) when you specify this linker option.
9890 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
9891 that support it. This instructs the linker to add all symbols, not
9892 only used ones, to the dynamic symbol table. This option is needed
9893 for some uses of @code{dlopen} or to allow obtaining backtraces
9894 from within a program.
9898 Remove all symbol table and relocation information from the executable.
9902 On systems that support dynamic linking, this prevents linking with the shared
9903 libraries. On other systems, this option has no effect.
9907 Produce a shared object which can then be linked with other objects to
9908 form an executable. Not all systems support this option. For predictable
9909 results, you must also specify the same set of options used for compilation
9910 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
9911 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
9912 needs to build supplementary stub code for constructors to work. On
9913 multi-libbed systems, @samp{gcc -shared} must select the correct support
9914 libraries to link against. Failing to supply the correct flags may lead
9915 to subtle defects. Supplying them in cases where they are not necessary
9918 @item -shared-libgcc
9919 @itemx -static-libgcc
9920 @opindex shared-libgcc
9921 @opindex static-libgcc
9922 On systems that provide @file{libgcc} as a shared library, these options
9923 force the use of either the shared or static version, respectively.
9924 If no shared version of @file{libgcc} was built when the compiler was
9925 configured, these options have no effect.
9927 There are several situations in which an application should use the
9928 shared @file{libgcc} instead of the static version. The most common
9929 of these is when the application wishes to throw and catch exceptions
9930 across different shared libraries. In that case, each of the libraries
9931 as well as the application itself should use the shared @file{libgcc}.
9933 Therefore, the G++ and GCJ drivers automatically add
9934 @option{-shared-libgcc} whenever you build a shared library or a main
9935 executable, because C++ and Java programs typically use exceptions, so
9936 this is the right thing to do.
9938 If, instead, you use the GCC driver to create shared libraries, you may
9939 find that they are not always linked with the shared @file{libgcc}.
9940 If GCC finds, at its configuration time, that you have a non-GNU linker
9941 or a GNU linker that does not support option @option{--eh-frame-hdr},
9942 it links the shared version of @file{libgcc} into shared libraries
9943 by default. Otherwise, it takes advantage of the linker and optimizes
9944 away the linking with the shared version of @file{libgcc}, linking with
9945 the static version of libgcc by default. This allows exceptions to
9946 propagate through such shared libraries, without incurring relocation
9947 costs at library load time.
9949 However, if a library or main executable is supposed to throw or catch
9950 exceptions, you must link it using the G++ or GCJ driver, as appropriate
9951 for the languages used in the program, or using the option
9952 @option{-shared-libgcc}, such that it is linked with the shared
9955 @item -static-libasan
9956 When the @option{-fsanitize=address} option is used to link a program,
9957 the GCC driver automatically links against @option{libasan}. If
9958 @file{libasan} is available as a shared library, and the @option{-static}
9959 option is not used, then this links against the shared version of
9960 @file{libasan}. The @option{-static-libasan} option directs the GCC
9961 driver to link @file{libasan} statically, without necessarily linking
9962 other libraries statically.
9964 @item -static-libtsan
9965 When the @option{-fsanitize=thread} option is used to link a program,
9966 the GCC driver automatically links against @option{libtsan}. If
9967 @file{libtsan} is available as a shared library, and the @option{-static}
9968 option is not used, then this links against the shared version of
9969 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
9970 driver to link @file{libtsan} statically, without necessarily linking
9971 other libraries statically.
9973 @item -static-libstdc++
9974 When the @command{g++} program is used to link a C++ program, it
9975 normally automatically links against @option{libstdc++}. If
9976 @file{libstdc++} is available as a shared library, and the
9977 @option{-static} option is not used, then this links against the
9978 shared version of @file{libstdc++}. That is normally fine. However, it
9979 is sometimes useful to freeze the version of @file{libstdc++} used by
9980 the program without going all the way to a fully static link. The
9981 @option{-static-libstdc++} option directs the @command{g++} driver to
9982 link @file{libstdc++} statically, without necessarily linking other
9983 libraries statically.
9987 Bind references to global symbols when building a shared object. Warn
9988 about any unresolved references (unless overridden by the link editor
9989 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
9992 @item -T @var{script}
9994 @cindex linker script
9995 Use @var{script} as the linker script. This option is supported by most
9996 systems using the GNU linker. On some targets, such as bare-board
9997 targets without an operating system, the @option{-T} option may be required
9998 when linking to avoid references to undefined symbols.
10000 @item -Xlinker @var{option}
10002 Pass @var{option} as an option to the linker. You can use this to
10003 supply system-specific linker options that GCC does not recognize.
10005 If you want to pass an option that takes a separate argument, you must use
10006 @option{-Xlinker} twice, once for the option and once for the argument.
10007 For example, to pass @option{-assert definitions}, you must write
10008 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10009 @option{-Xlinker "-assert definitions"}, because this passes the entire
10010 string as a single argument, which is not what the linker expects.
10012 When using the GNU linker, it is usually more convenient to pass
10013 arguments to linker options using the @option{@var{option}=@var{value}}
10014 syntax than as separate arguments. For example, you can specify
10015 @option{-Xlinker -Map=output.map} rather than
10016 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10017 this syntax for command-line options.
10019 @item -Wl,@var{option}
10021 Pass @var{option} as an option to the linker. If @var{option} contains
10022 commas, it is split into multiple options at the commas. You can use this
10023 syntax to pass an argument to the option.
10024 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10025 linker. When using the GNU linker, you can also get the same effect with
10026 @option{-Wl,-Map=output.map}.
10028 @item -u @var{symbol}
10030 Pretend the symbol @var{symbol} is undefined, to force linking of
10031 library modules to define it. You can use @option{-u} multiple times with
10032 different symbols to force loading of additional library modules.
10035 @node Directory Options
10036 @section Options for Directory Search
10037 @cindex directory options
10038 @cindex options, directory search
10039 @cindex search path
10041 These options specify directories to search for header files, for
10042 libraries and for parts of the compiler:
10047 Add the directory @var{dir} to the head of the list of directories to be
10048 searched for header files. This can be used to override a system header
10049 file, substituting your own version, since these directories are
10050 searched before the system header file directories. However, you should
10051 not use this option to add directories that contain vendor-supplied
10052 system header files (use @option{-isystem} for that). If you use more than
10053 one @option{-I} option, the directories are scanned in left-to-right
10054 order; the standard system directories come after.
10056 If a standard system include directory, or a directory specified with
10057 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
10058 option is ignored. The directory is still searched but as a
10059 system directory at its normal position in the system include chain.
10060 This is to ensure that GCC's procedure to fix buggy system headers and
10061 the ordering for the @code{include_next} directive are not inadvertently changed.
10062 If you really need to change the search order for system directories,
10063 use the @option{-nostdinc} and/or @option{-isystem} options.
10065 @item -iplugindir=@var{dir}
10066 Set the directory to search for plugins that are passed
10067 by @option{-fplugin=@var{name}} instead of
10068 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
10069 to be used by the user, but only passed by the driver.
10071 @item -iquote@var{dir}
10073 Add the directory @var{dir} to the head of the list of directories to
10074 be searched for header files only for the case of @samp{#include
10075 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
10076 otherwise just like @option{-I}.
10080 Add directory @var{dir} to the list of directories to be searched
10083 @item -B@var{prefix}
10085 This option specifies where to find the executables, libraries,
10086 include files, and data files of the compiler itself.
10088 The compiler driver program runs one or more of the subprograms
10089 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
10090 @var{prefix} as a prefix for each program it tries to run, both with and
10091 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
10093 For each subprogram to be run, the compiler driver first tries the
10094 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
10095 is not specified, the driver tries two standard prefixes,
10096 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
10097 those results in a file name that is found, the unmodified program
10098 name is searched for using the directories specified in your
10099 @env{PATH} environment variable.
10101 The compiler checks to see if the path provided by the @option{-B}
10102 refers to a directory, and if necessary it adds a directory
10103 separator character at the end of the path.
10105 @option{-B} prefixes that effectively specify directory names also apply
10106 to libraries in the linker, because the compiler translates these
10107 options into @option{-L} options for the linker. They also apply to
10108 includes files in the preprocessor, because the compiler translates these
10109 options into @option{-isystem} options for the preprocessor. In this case,
10110 the compiler appends @samp{include} to the prefix.
10112 The runtime support file @file{libgcc.a} can also be searched for using
10113 the @option{-B} prefix, if needed. If it is not found there, the two
10114 standard prefixes above are tried, and that is all. The file is left
10115 out of the link if it is not found by those means.
10117 Another way to specify a prefix much like the @option{-B} prefix is to use
10118 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
10121 As a special kludge, if the path provided by @option{-B} is
10122 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
10123 9, then it is replaced by @file{[dir/]include}. This is to help
10124 with boot-strapping the compiler.
10126 @item -specs=@var{file}
10128 Process @var{file} after the compiler reads in the standard @file{specs}
10129 file, in order to override the defaults which the @command{gcc} driver
10130 program uses when determining what switches to pass to @command{cc1},
10131 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
10132 @option{-specs=@var{file}} can be specified on the command line, and they
10133 are processed in order, from left to right.
10135 @item --sysroot=@var{dir}
10137 Use @var{dir} as the logical root directory for headers and libraries.
10138 For example, if the compiler normally searches for headers in
10139 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
10140 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
10142 If you use both this option and the @option{-isysroot} option, then
10143 the @option{--sysroot} option applies to libraries, but the
10144 @option{-isysroot} option applies to header files.
10146 The GNU linker (beginning with version 2.16) has the necessary support
10147 for this option. If your linker does not support this option, the
10148 header file aspect of @option{--sysroot} still works, but the
10149 library aspect does not.
10151 @item --no-sysroot-suffix
10152 @opindex no-sysroot-suffix
10153 For some targets, a suffix is added to the root directory specified
10154 with @option{--sysroot}, depending on the other options used, so that
10155 headers may for example be found in
10156 @file{@var{dir}/@var{suffix}/usr/include} instead of
10157 @file{@var{dir}/usr/include}. This option disables the addition of
10162 This option has been deprecated. Please use @option{-iquote} instead for
10163 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
10164 Any directories you specify with @option{-I} options before the @option{-I-}
10165 option are searched only for the case of @samp{#include "@var{file}"};
10166 they are not searched for @samp{#include <@var{file}>}.
10168 If additional directories are specified with @option{-I} options after
10169 the @option{-I-}, these directories are searched for all @samp{#include}
10170 directives. (Ordinarily @emph{all} @option{-I} directories are used
10173 In addition, the @option{-I-} option inhibits the use of the current
10174 directory (where the current input file came from) as the first search
10175 directory for @samp{#include "@var{file}"}. There is no way to
10176 override this effect of @option{-I-}. With @option{-I.} you can specify
10177 searching the directory that is current when the compiler is
10178 invoked. That is not exactly the same as what the preprocessor does
10179 by default, but it is often satisfactory.
10181 @option{-I-} does not inhibit the use of the standard system directories
10182 for header files. Thus, @option{-I-} and @option{-nostdinc} are
10189 @section Specifying subprocesses and the switches to pass to them
10192 @command{gcc} is a driver program. It performs its job by invoking a
10193 sequence of other programs to do the work of compiling, assembling and
10194 linking. GCC interprets its command-line parameters and uses these to
10195 deduce which programs it should invoke, and which command-line options
10196 it ought to place on their command lines. This behavior is controlled
10197 by @dfn{spec strings}. In most cases there is one spec string for each
10198 program that GCC can invoke, but a few programs have multiple spec
10199 strings to control their behavior. The spec strings built into GCC can
10200 be overridden by using the @option{-specs=} command-line switch to specify
10203 @dfn{Spec files} are plaintext files that are used to construct spec
10204 strings. They consist of a sequence of directives separated by blank
10205 lines. The type of directive is determined by the first non-whitespace
10206 character on the line, which can be one of the following:
10209 @item %@var{command}
10210 Issues a @var{command} to the spec file processor. The commands that can
10214 @item %include <@var{file}>
10215 @cindex @code{%include}
10216 Search for @var{file} and insert its text at the current point in the
10219 @item %include_noerr <@var{file}>
10220 @cindex @code{%include_noerr}
10221 Just like @samp{%include}, but do not generate an error message if the include
10222 file cannot be found.
10224 @item %rename @var{old_name} @var{new_name}
10225 @cindex @code{%rename}
10226 Rename the spec string @var{old_name} to @var{new_name}.
10230 @item *[@var{spec_name}]:
10231 This tells the compiler to create, override or delete the named spec
10232 string. All lines after this directive up to the next directive or
10233 blank line are considered to be the text for the spec string. If this
10234 results in an empty string then the spec is deleted. (Or, if the
10235 spec did not exist, then nothing happens.) Otherwise, if the spec
10236 does not currently exist a new spec is created. If the spec does
10237 exist then its contents are overridden by the text of this
10238 directive, unless the first character of that text is the @samp{+}
10239 character, in which case the text is appended to the spec.
10241 @item [@var{suffix}]:
10242 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
10243 and up to the next directive or blank line are considered to make up the
10244 spec string for the indicated suffix. When the compiler encounters an
10245 input file with the named suffix, it processes the spec string in
10246 order to work out how to compile that file. For example:
10250 z-compile -input %i
10253 This says that any input file whose name ends in @samp{.ZZ} should be
10254 passed to the program @samp{z-compile}, which should be invoked with the
10255 command-line switch @option{-input} and with the result of performing the
10256 @samp{%i} substitution. (See below.)
10258 As an alternative to providing a spec string, the text following a
10259 suffix directive can be one of the following:
10262 @item @@@var{language}
10263 This says that the suffix is an alias for a known @var{language}. This is
10264 similar to using the @option{-x} command-line switch to GCC to specify a
10265 language explicitly. For example:
10272 Says that .ZZ files are, in fact, C++ source files.
10275 This causes an error messages saying:
10278 @var{name} compiler not installed on this system.
10282 GCC already has an extensive list of suffixes built into it.
10283 This directive adds an entry to the end of the list of suffixes, but
10284 since the list is searched from the end backwards, it is effectively
10285 possible to override earlier entries using this technique.
10289 GCC has the following spec strings built into it. Spec files can
10290 override these strings or create their own. Note that individual
10291 targets can also add their own spec strings to this list.
10294 asm Options to pass to the assembler
10295 asm_final Options to pass to the assembler post-processor
10296 cpp Options to pass to the C preprocessor
10297 cc1 Options to pass to the C compiler
10298 cc1plus Options to pass to the C++ compiler
10299 endfile Object files to include at the end of the link
10300 link Options to pass to the linker
10301 lib Libraries to include on the command line to the linker
10302 libgcc Decides which GCC support library to pass to the linker
10303 linker Sets the name of the linker
10304 predefines Defines to be passed to the C preprocessor
10305 signed_char Defines to pass to CPP to say whether @code{char} is signed
10307 startfile Object files to include at the start of the link
10310 Here is a small example of a spec file:
10313 %rename lib old_lib
10316 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
10319 This example renames the spec called @samp{lib} to @samp{old_lib} and
10320 then overrides the previous definition of @samp{lib} with a new one.
10321 The new definition adds in some extra command-line options before
10322 including the text of the old definition.
10324 @dfn{Spec strings} are a list of command-line options to be passed to their
10325 corresponding program. In addition, the spec strings can contain
10326 @samp{%}-prefixed sequences to substitute variable text or to
10327 conditionally insert text into the command line. Using these constructs
10328 it is possible to generate quite complex command lines.
10330 Here is a table of all defined @samp{%}-sequences for spec
10331 strings. Note that spaces are not generated automatically around the
10332 results of expanding these sequences. Therefore you can concatenate them
10333 together or combine them with constant text in a single argument.
10337 Substitute one @samp{%} into the program name or argument.
10340 Substitute the name of the input file being processed.
10343 Substitute the basename of the input file being processed.
10344 This is the substring up to (and not including) the last period
10345 and not including the directory.
10348 This is the same as @samp{%b}, but include the file suffix (text after
10352 Marks the argument containing or following the @samp{%d} as a
10353 temporary file name, so that that file is deleted if GCC exits
10354 successfully. Unlike @samp{%g}, this contributes no text to the
10357 @item %g@var{suffix}
10358 Substitute a file name that has suffix @var{suffix} and is chosen
10359 once per compilation, and mark the argument in the same way as
10360 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
10361 name is now chosen in a way that is hard to predict even when previously
10362 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
10363 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
10364 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
10365 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
10366 was simply substituted with a file name chosen once per compilation,
10367 without regard to any appended suffix (which was therefore treated
10368 just like ordinary text), making such attacks more likely to succeed.
10370 @item %u@var{suffix}
10371 Like @samp{%g}, but generates a new temporary file name
10372 each time it appears instead of once per compilation.
10374 @item %U@var{suffix}
10375 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
10376 new one if there is no such last file name. In the absence of any
10377 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
10378 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
10379 involves the generation of two distinct file names, one
10380 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
10381 simply substituted with a file name chosen for the previous @samp{%u},
10382 without regard to any appended suffix.
10384 @item %j@var{suffix}
10385 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
10386 writable, and if @option{-save-temps} is not used;
10387 otherwise, substitute the name
10388 of a temporary file, just like @samp{%u}. This temporary file is not
10389 meant for communication between processes, but rather as a junk
10390 disposal mechanism.
10392 @item %|@var{suffix}
10393 @itemx %m@var{suffix}
10394 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
10395 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
10396 all. These are the two most common ways to instruct a program that it
10397 should read from standard input or write to standard output. If you
10398 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
10399 construct: see for example @file{f/lang-specs.h}.
10401 @item %.@var{SUFFIX}
10402 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
10403 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
10404 terminated by the next space or %.
10407 Marks the argument containing or following the @samp{%w} as the
10408 designated output file of this compilation. This puts the argument
10409 into the sequence of arguments that @samp{%o} substitutes.
10412 Substitutes the names of all the output files, with spaces
10413 automatically placed around them. You should write spaces
10414 around the @samp{%o} as well or the results are undefined.
10415 @samp{%o} is for use in the specs for running the linker.
10416 Input files whose names have no recognized suffix are not compiled
10417 at all, but they are included among the output files, so they are
10421 Substitutes the suffix for object files. Note that this is
10422 handled specially when it immediately follows @samp{%g, %u, or %U},
10423 because of the need for those to form complete file names. The
10424 handling is such that @samp{%O} is treated exactly as if it had already
10425 been substituted, except that @samp{%g, %u, and %U} do not currently
10426 support additional @var{suffix} characters following @samp{%O} as they do
10427 following, for example, @samp{.o}.
10430 Substitutes the standard macro predefinitions for the
10431 current target machine. Use this when running @code{cpp}.
10434 Like @samp{%p}, but puts @samp{__} before and after the name of each
10435 predefined macro, except for macros that start with @samp{__} or with
10436 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
10440 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
10441 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
10442 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
10443 and @option{-imultilib} as necessary.
10446 Current argument is the name of a library or startup file of some sort.
10447 Search for that file in a standard list of directories and substitute
10448 the full name found. The current working directory is included in the
10449 list of directories scanned.
10452 Current argument is the name of a linker script. Search for that file
10453 in the current list of directories to scan for libraries. If the file
10454 is located insert a @option{--script} option into the command line
10455 followed by the full path name found. If the file is not found then
10456 generate an error message. Note: the current working directory is not
10460 Print @var{str} as an error message. @var{str} is terminated by a newline.
10461 Use this when inconsistent options are detected.
10463 @item %(@var{name})
10464 Substitute the contents of spec string @var{name} at this point.
10466 @item %x@{@var{option}@}
10467 Accumulate an option for @samp{%X}.
10470 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
10474 Output the accumulated assembler options specified by @option{-Wa}.
10477 Output the accumulated preprocessor options specified by @option{-Wp}.
10480 Process the @code{asm} spec. This is used to compute the
10481 switches to be passed to the assembler.
10484 Process the @code{asm_final} spec. This is a spec string for
10485 passing switches to an assembler post-processor, if such a program is
10489 Process the @code{link} spec. This is the spec for computing the
10490 command line passed to the linker. Typically it makes use of the
10491 @samp{%L %G %S %D and %E} sequences.
10494 Dump out a @option{-L} option for each directory that GCC believes might
10495 contain startup files. If the target supports multilibs then the
10496 current multilib directory is prepended to each of these paths.
10499 Process the @code{lib} spec. This is a spec string for deciding which
10500 libraries are included on the command line to the linker.
10503 Process the @code{libgcc} spec. This is a spec string for deciding
10504 which GCC support library is included on the command line to the linker.
10507 Process the @code{startfile} spec. This is a spec for deciding which
10508 object files are the first ones passed to the linker. Typically
10509 this might be a file named @file{crt0.o}.
10512 Process the @code{endfile} spec. This is a spec string that specifies
10513 the last object files that are passed to the linker.
10516 Process the @code{cpp} spec. This is used to construct the arguments
10517 to be passed to the C preprocessor.
10520 Process the @code{cc1} spec. This is used to construct the options to be
10521 passed to the actual C compiler (@samp{cc1}).
10524 Process the @code{cc1plus} spec. This is used to construct the options to be
10525 passed to the actual C++ compiler (@samp{cc1plus}).
10528 Substitute the variable part of a matched option. See below.
10529 Note that each comma in the substituted string is replaced by
10533 Remove all occurrences of @code{-S} from the command line. Note---this
10534 command is position dependent. @samp{%} commands in the spec string
10535 before this one see @code{-S}, @samp{%} commands in the spec string
10536 after this one do not.
10538 @item %:@var{function}(@var{args})
10539 Call the named function @var{function}, passing it @var{args}.
10540 @var{args} is first processed as a nested spec string, then split
10541 into an argument vector in the usual fashion. The function returns
10542 a string which is processed as if it had appeared literally as part
10543 of the current spec.
10545 The following built-in spec functions are provided:
10548 @item @code{getenv}
10549 The @code{getenv} spec function takes two arguments: an environment
10550 variable name and a string. If the environment variable is not
10551 defined, a fatal error is issued. Otherwise, the return value is the
10552 value of the environment variable concatenated with the string. For
10553 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
10556 %:getenv(TOPDIR /include)
10559 expands to @file{/path/to/top/include}.
10561 @item @code{if-exists}
10562 The @code{if-exists} spec function takes one argument, an absolute
10563 pathname to a file. If the file exists, @code{if-exists} returns the
10564 pathname. Here is a small example of its usage:
10568 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
10571 @item @code{if-exists-else}
10572 The @code{if-exists-else} spec function is similar to the @code{if-exists}
10573 spec function, except that it takes two arguments. The first argument is
10574 an absolute pathname to a file. If the file exists, @code{if-exists-else}
10575 returns the pathname. If it does not exist, it returns the second argument.
10576 This way, @code{if-exists-else} can be used to select one file or another,
10577 based on the existence of the first. Here is a small example of its usage:
10581 crt0%O%s %:if-exists(crti%O%s) \
10582 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
10585 @item @code{replace-outfile}
10586 The @code{replace-outfile} spec function takes two arguments. It looks for the
10587 first argument in the outfiles array and replaces it with the second argument. Here
10588 is a small example of its usage:
10591 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
10594 @item @code{remove-outfile}
10595 The @code{remove-outfile} spec function takes one argument. It looks for the
10596 first argument in the outfiles array and removes it. Here is a small example
10600 %:remove-outfile(-lm)
10603 @item @code{pass-through-libs}
10604 The @code{pass-through-libs} spec function takes any number of arguments. It
10605 finds any @option{-l} options and any non-options ending in @file{.a} (which it
10606 assumes are the names of linker input library archive files) and returns a
10607 result containing all the found arguments each prepended by
10608 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
10609 intended to be passed to the LTO linker plugin.
10612 %:pass-through-libs(%G %L %G)
10615 @item @code{print-asm-header}
10616 The @code{print-asm-header} function takes no arguments and simply
10617 prints a banner like:
10623 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
10626 It is used to separate compiler options from assembler options
10627 in the @option{--target-help} output.
10630 @item %@{@code{S}@}
10631 Substitutes the @code{-S} switch, if that switch is given to GCC@.
10632 If that switch is not specified, this substitutes nothing. Note that
10633 the leading dash is omitted when specifying this option, and it is
10634 automatically inserted if the substitution is performed. Thus the spec
10635 string @samp{%@{foo@}} matches the command-line option @option{-foo}
10636 and outputs the command-line option @option{-foo}.
10638 @item %W@{@code{S}@}
10639 Like %@{@code{S}@} but mark last argument supplied within as a file to be
10640 deleted on failure.
10642 @item %@{@code{S}*@}
10643 Substitutes all the switches specified to GCC whose names start
10644 with @code{-S}, but which also take an argument. This is used for
10645 switches like @option{-o}, @option{-D}, @option{-I}, etc.
10646 GCC considers @option{-o foo} as being
10647 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
10648 text, including the space. Thus two arguments are generated.
10650 @item %@{@code{S}*&@code{T}*@}
10651 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
10652 (the order of @code{S} and @code{T} in the spec is not significant).
10653 There can be any number of ampersand-separated variables; for each the
10654 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
10656 @item %@{@code{S}:@code{X}@}
10657 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
10659 @item %@{!@code{S}:@code{X}@}
10660 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
10662 @item %@{@code{S}*:@code{X}@}
10663 Substitutes @code{X} if one or more switches whose names start with
10664 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
10665 once, no matter how many such switches appeared. However, if @code{%*}
10666 appears somewhere in @code{X}, then @code{X} is substituted once
10667 for each matching switch, with the @code{%*} replaced by the part of
10668 that switch matching the @code{*}.
10670 @item %@{.@code{S}:@code{X}@}
10671 Substitutes @code{X}, if processing a file with suffix @code{S}.
10673 @item %@{!.@code{S}:@code{X}@}
10674 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
10676 @item %@{,@code{S}:@code{X}@}
10677 Substitutes @code{X}, if processing a file for language @code{S}.
10679 @item %@{!,@code{S}:@code{X}@}
10680 Substitutes @code{X}, if not processing a file for language @code{S}.
10682 @item %@{@code{S}|@code{P}:@code{X}@}
10683 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
10684 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
10685 @code{*} sequences as well, although they have a stronger binding than
10686 the @samp{|}. If @code{%*} appears in @code{X}, all of the
10687 alternatives must be starred, and only the first matching alternative
10690 For example, a spec string like this:
10693 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
10697 outputs the following command-line options from the following input
10698 command-line options:
10703 -d fred.c -foo -baz -boggle
10704 -d jim.d -bar -baz -boggle
10707 @item %@{S:X; T:Y; :D@}
10709 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
10710 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
10711 be as many clauses as you need. This may be combined with @code{.},
10712 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
10717 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
10718 construct may contain other nested @samp{%} constructs or spaces, or
10719 even newlines. They are processed as usual, as described above.
10720 Trailing white space in @code{X} is ignored. White space may also
10721 appear anywhere on the left side of the colon in these constructs,
10722 except between @code{.} or @code{*} and the corresponding word.
10724 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
10725 handled specifically in these constructs. If another value of
10726 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
10727 @option{-W} switch is found later in the command line, the earlier
10728 switch value is ignored, except with @{@code{S}*@} where @code{S} is
10729 just one letter, which passes all matching options.
10731 The character @samp{|} at the beginning of the predicate text is used to
10732 indicate that a command should be piped to the following command, but
10733 only if @option{-pipe} is specified.
10735 It is built into GCC which switches take arguments and which do not.
10736 (You might think it would be useful to generalize this to allow each
10737 compiler's spec to say which switches take arguments. But this cannot
10738 be done in a consistent fashion. GCC cannot even decide which input
10739 files have been specified without knowing which switches take arguments,
10740 and it must know which input files to compile in order to tell which
10743 GCC also knows implicitly that arguments starting in @option{-l} are to be
10744 treated as compiler output files, and passed to the linker in their
10745 proper position among the other output files.
10747 @c man begin OPTIONS
10749 @node Target Options
10750 @section Specifying Target Machine and Compiler Version
10751 @cindex target options
10752 @cindex cross compiling
10753 @cindex specifying machine version
10754 @cindex specifying compiler version and target machine
10755 @cindex compiler version, specifying
10756 @cindex target machine, specifying
10758 The usual way to run GCC is to run the executable called @command{gcc}, or
10759 @command{@var{machine}-gcc} when cross-compiling, or
10760 @command{@var{machine}-gcc-@var{version}} to run a version other than the
10761 one that was installed last.
10763 @node Submodel Options
10764 @section Hardware Models and Configurations
10765 @cindex submodel options
10766 @cindex specifying hardware config
10767 @cindex hardware models and configurations, specifying
10768 @cindex machine dependent options
10770 Each target machine types can have its own
10771 special options, starting with @samp{-m}, to choose among various
10772 hardware models or configurations---for example, 68010 vs 68020,
10773 floating coprocessor or none. A single installed version of the
10774 compiler can compile for any model or configuration, according to the
10777 Some configurations of the compiler also support additional special
10778 options, usually for compatibility with other compilers on the same
10781 @c This list is ordered alphanumerically by subsection name.
10782 @c It should be the same order and spelling as these options are listed
10783 @c in Machine Dependent Options
10786 * AArch64 Options::
10787 * Adapteva Epiphany Options::
10790 * Blackfin Options::
10795 * DEC Alpha Options::
10798 * GNU/Linux Options::
10801 * i386 and x86-64 Options::
10802 * i386 and x86-64 Windows Options::
10810 * MicroBlaze Options::
10813 * MN10300 Options::
10816 * picoChip Options::
10817 * PowerPC Options::
10819 * RS/6000 and PowerPC Options::
10821 * S/390 and zSeries Options::
10824 * Solaris 2 Options::
10827 * System V Options::
10828 * TILE-Gx Options::
10829 * TILEPro Options::
10833 * VxWorks Options::
10835 * Xstormy16 Options::
10837 * zSeries Options::
10840 @node Adapteva Epiphany Options
10841 @subsection Adapteva Epiphany Options
10843 These @samp{-m} options are defined for Adapteva Epiphany:
10846 @item -mhalf-reg-file
10847 @opindex mhalf-reg-file
10848 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
10849 That allows code to run on hardware variants that lack these registers.
10851 @item -mprefer-short-insn-regs
10852 @opindex mprefer-short-insn-regs
10853 Preferrentially allocate registers that allow short instruction generation.
10854 This can result in increased instruction count, so this may either reduce or
10855 increase overall code size.
10857 @item -mbranch-cost=@var{num}
10858 @opindex mbranch-cost
10859 Set the cost of branches to roughly @var{num} ``simple'' instructions.
10860 This cost is only a heuristic and is not guaranteed to produce
10861 consistent results across releases.
10865 Enable the generation of conditional moves.
10867 @item -mnops=@var{num}
10869 Emit @var{num} NOPs before every other generated instruction.
10871 @item -mno-soft-cmpsf
10872 @opindex mno-soft-cmpsf
10873 For single-precision floating-point comparisons, emit an @code{fsub} instruction
10874 and test the flags. This is faster than a software comparison, but can
10875 get incorrect results in the presence of NaNs, or when two different small
10876 numbers are compared such that their difference is calculated as zero.
10877 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
10878 software comparisons.
10880 @item -mstack-offset=@var{num}
10881 @opindex mstack-offset
10882 Set the offset between the top of the stack and the stack pointer.
10883 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
10884 can be used by leaf functions without stack allocation.
10885 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
10886 Note also that this option changes the ABI; compiling a program with a
10887 different stack offset than the libraries have been compiled with
10888 generally does not work.
10889 This option can be useful if you want to evaluate if a different stack
10890 offset would give you better code, but to actually use a different stack
10891 offset to build working programs, it is recommended to configure the
10892 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
10894 @item -mno-round-nearest
10895 @opindex mno-round-nearest
10896 Make the scheduler assume that the rounding mode has been set to
10897 truncating. The default is @option{-mround-nearest}.
10900 @opindex mlong-calls
10901 If not otherwise specified by an attribute, assume all calls might be beyond
10902 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
10903 function address into a register before performing a (otherwise direct) call.
10904 This is the default.
10906 @item -mshort-calls
10907 @opindex short-calls
10908 If not otherwise specified by an attribute, assume all direct calls are
10909 in the range of the @code{b} / @code{bl} instructions, so use these instructions
10910 for direct calls. The default is @option{-mlong-calls}.
10914 Assume addresses can be loaded as 16-bit unsigned values. This does not
10915 apply to function addresses for which @option{-mlong-calls} semantics
10918 @item -mfp-mode=@var{mode}
10920 Set the prevailing mode of the floating-point unit.
10921 This determines the floating-point mode that is provided and expected
10922 at function call and return time. Making this mode match the mode you
10923 predominantly need at function start can make your programs smaller and
10924 faster by avoiding unnecessary mode switches.
10926 @var{mode} can be set to one the following values:
10930 Any mode at function entry is valid, and retained or restored when
10931 the function returns, and when it calls other functions.
10932 This mode is useful for compiling libraries or other compilation units
10933 you might want to incorporate into different programs with different
10934 prevailing FPU modes, and the convenience of being able to use a single
10935 object file outweighs the size and speed overhead for any extra
10936 mode switching that might be needed, compared with what would be needed
10937 with a more specific choice of prevailing FPU mode.
10940 This is the mode used for floating-point calculations with
10941 truncating (i.e.@: round towards zero) rounding mode. That includes
10942 conversion from floating point to integer.
10944 @item round-nearest
10945 This is the mode used for floating-point calculations with
10946 round-to-nearest-or-even rounding mode.
10949 This is the mode used to perform integer calculations in the FPU, e.g.@:
10950 integer multiply, or integer multiply-and-accumulate.
10953 The default is @option{-mfp-mode=caller}
10955 @item -mnosplit-lohi
10956 @itemx -mno-postinc
10957 @itemx -mno-postmodify
10958 @opindex mnosplit-lohi
10959 @opindex mno-postinc
10960 @opindex mno-postmodify
10961 Code generation tweaks that disable, respectively, splitting of 32-bit
10962 loads, generation of post-increment addresses, and generation of
10963 post-modify addresses. The defaults are @option{msplit-lohi},
10964 @option{-mpost-inc}, and @option{-mpost-modify}.
10966 @item -mnovect-double
10967 @opindex mno-vect-double
10968 Change the preferred SIMD mode to SImode. The default is
10969 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
10971 @item -max-vect-align=@var{num}
10972 @opindex max-vect-align
10973 The maximum alignment for SIMD vector mode types.
10974 @var{num} may be 4 or 8. The default is 8.
10975 Note that this is an ABI change, even though many library function
10976 interfaces are unaffected if they don't use SIMD vector modes
10977 in places that affect size and/or alignment of relevant types.
10979 @item -msplit-vecmove-early
10980 @opindex msplit-vecmove-early
10981 Split vector moves into single word moves before reload. In theory this
10982 can give better register allocation, but so far the reverse seems to be
10983 generally the case.
10985 @item -m1reg-@var{reg}
10987 Specify a register to hold the constant @minus{}1, which makes loading small negative
10988 constants and certain bitmasks faster.
10989 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
10990 which specify use of that register as a fixed register,
10991 and @samp{none}, which means that no register is used for this
10992 purpose. The default is @option{-m1reg-none}.
10996 @node AArch64 Options
10997 @subsection AArch64 Options
10998 @cindex AArch64 Options
11000 These options are defined for AArch64 implementations:
11005 @opindex mbig-endian
11006 Generate big-endian code. This is the default when GCC is configured for an
11007 @samp{aarch64_be-*-*} target.
11009 @item -mgeneral-regs-only
11010 @opindex mgeneral-regs-only
11011 Generate code which uses only the general registers.
11013 @item -mlittle-endian
11014 @opindex mlittle-endian
11015 Generate little-endian code. This is the default when GCC is configured for an
11016 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
11018 @item -mcmodel=tiny
11019 @opindex mcmodel=tiny
11020 Generate code for the tiny code model. The program and its statically defined
11021 symbols must be within 1GB of each other. Pointers are 64 bits. Programs can
11022 be statically or dynamically linked. This model is not fully implemented and
11023 mostly treated as @samp{small}.
11025 @item -mcmodel=small
11026 @opindex mcmodel=small
11027 Generate code for the small code model. The program and its statically defined
11028 symbols must be within 4GB of each other. Pointers are 64 bits. Programs can
11029 be statically or dynamically linked. This is the default code model.
11031 @item -mcmodel=large
11032 @opindex mcmodel=large
11033 Generate code for the large code model. This makes no assumptions about
11034 addresses and sizes of sections. Pointers are 64 bits. Programs can be
11035 statically linked only.
11037 @item -mstrict-align
11038 @opindex mstrict-align
11039 Do not assume that unaligned memory references will be handled by the system.
11041 @item -momit-leaf-frame-pointer
11042 @itemx -mno-omit-leaf-frame-pointer
11043 @opindex momit-leaf-frame-pointer
11044 @opindex mno-omit-leaf-frame-pointer
11045 Omit or keep the frame pointer in leaf functions. The former behaviour is the
11048 @item -mtls-dialect=desc
11049 @opindex mtls-dialect=desc
11050 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
11051 of TLS variables. This is the default.
11053 @item -mtls-dialect=traditional
11054 @opindex mtls-dialect=traditional
11055 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
11058 @item -march=@var{name}
11060 Specify the name of the target architecture, optionally suffixed by one or
11061 more feature modifiers. This option has the form
11062 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
11063 only value for @var{arch} is @samp{armv8-a}. The possible values for
11064 @var{feature} are documented in the sub-section below.
11066 Where conflicting feature modifiers are specified, the right-most feature is
11069 GCC uses this name to determine what kind of instructions it can emit when
11070 generating assembly code. This option can be used in conjunction with or
11071 instead of the @option{-mcpu=} option.
11073 @item -mcpu=@var{name}
11075 Specify the name of the target processor, optionally suffixed by one or more
11076 feature modifiers. This option has the form
11077 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
11078 possible values for @var{cpu} are @samp{generic}, @samp{large}. The
11079 possible values for @var{feature} are documented in the sub-section
11082 Where conflicting feature modifiers are specified, the right-most feature is
11085 GCC uses this name to determine what kind of instructions it can emit when
11086 generating assembly code.
11088 @item -mtune=@var{name}
11090 Specify the name of the processor to tune the performance for. The code will
11091 be tuned as if the target processor were of the type specified in this option,
11092 but still using instructions compatible with the target processor specified
11093 by a @option{-mcpu=} option. This option cannot be suffixed by feature
11098 @subsubsection @option{-march} and @option{-mcpu} feature modifiers
11099 @cindex @option{-march} feature modifiers
11100 @cindex @option{-mcpu} feature modifiers
11101 Feature modifiers used with @option{-march} and @option{-mcpu} can be one
11106 Enable Crypto extension. This implies Advanced SIMD is enabled.
11108 Enable floating-point instructions.
11110 Enable Advanced SIMD instructions. This implies floating-point instructions
11111 are enabled. This is the default for all current possible values for options
11112 @option{-march} and @option{-mcpu=}.
11116 @subsection ARM Options
11117 @cindex ARM options
11119 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
11123 @item -mabi=@var{name}
11125 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
11126 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
11129 @opindex mapcs-frame
11130 Generate a stack frame that is compliant with the ARM Procedure Call
11131 Standard for all functions, even if this is not strictly necessary for
11132 correct execution of the code. Specifying @option{-fomit-frame-pointer}
11133 with this option causes the stack frames not to be generated for
11134 leaf functions. The default is @option{-mno-apcs-frame}.
11138 This is a synonym for @option{-mapcs-frame}.
11141 @c not currently implemented
11142 @item -mapcs-stack-check
11143 @opindex mapcs-stack-check
11144 Generate code to check the amount of stack space available upon entry to
11145 every function (that actually uses some stack space). If there is
11146 insufficient space available then either the function
11147 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} is
11148 called, depending upon the amount of stack space required. The runtime
11149 system is required to provide these functions. The default is
11150 @option{-mno-apcs-stack-check}, since this produces smaller code.
11152 @c not currently implemented
11154 @opindex mapcs-float
11155 Pass floating-point arguments using the floating-point registers. This is
11156 one of the variants of the APCS@. This option is recommended if the
11157 target hardware has a floating-point unit or if a lot of floating-point
11158 arithmetic is going to be performed by the code. The default is
11159 @option{-mno-apcs-float}, since the size of integer-only code is
11160 slightly increased if @option{-mapcs-float} is used.
11162 @c not currently implemented
11163 @item -mapcs-reentrant
11164 @opindex mapcs-reentrant
11165 Generate reentrant, position-independent code. The default is
11166 @option{-mno-apcs-reentrant}.
11169 @item -mthumb-interwork
11170 @opindex mthumb-interwork
11171 Generate code that supports calling between the ARM and Thumb
11172 instruction sets. Without this option, on pre-v5 architectures, the
11173 two instruction sets cannot be reliably used inside one program. The
11174 default is @option{-mno-thumb-interwork}, since slightly larger code
11175 is generated when @option{-mthumb-interwork} is specified. In AAPCS
11176 configurations this option is meaningless.
11178 @item -mno-sched-prolog
11179 @opindex mno-sched-prolog
11180 Prevent the reordering of instructions in the function prologue, or the
11181 merging of those instruction with the instructions in the function's
11182 body. This means that all functions start with a recognizable set
11183 of instructions (or in fact one of a choice from a small set of
11184 different function prologues), and this information can be used to
11185 locate the start of functions inside an executable piece of code. The
11186 default is @option{-msched-prolog}.
11188 @item -mfloat-abi=@var{name}
11189 @opindex mfloat-abi
11190 Specifies which floating-point ABI to use. Permissible values
11191 are: @samp{soft}, @samp{softfp} and @samp{hard}.
11193 Specifying @samp{soft} causes GCC to generate output containing
11194 library calls for floating-point operations.
11195 @samp{softfp} allows the generation of code using hardware floating-point
11196 instructions, but still uses the soft-float calling conventions.
11197 @samp{hard} allows generation of floating-point instructions
11198 and uses FPU-specific calling conventions.
11200 The default depends on the specific target configuration. Note that
11201 the hard-float and soft-float ABIs are not link-compatible; you must
11202 compile your entire program with the same ABI, and link with a
11203 compatible set of libraries.
11205 @item -mlittle-endian
11206 @opindex mlittle-endian
11207 Generate code for a processor running in little-endian mode. This is
11208 the default for all standard configurations.
11211 @opindex mbig-endian
11212 Generate code for a processor running in big-endian mode; the default is
11213 to compile code for a little-endian processor.
11215 @item -mwords-little-endian
11216 @opindex mwords-little-endian
11217 This option only applies when generating code for big-endian processors.
11218 Generate code for a little-endian word order but a big-endian byte
11219 order. That is, a byte order of the form @samp{32107654}. Note: this
11220 option should only be used if you require compatibility with code for
11221 big-endian ARM processors generated by versions of the compiler prior to
11222 2.8. This option is now deprecated.
11224 @item -mcpu=@var{name}
11226 This specifies the name of the target ARM processor. GCC uses this name
11227 to determine what kind of instructions it can emit when generating
11228 assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
11229 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
11230 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
11231 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
11232 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
11234 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
11235 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
11236 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
11237 @samp{strongarm1110},
11238 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
11239 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
11240 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
11241 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
11242 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
11243 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
11244 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
11245 @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9},
11246 @samp{cortex-a15}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
11247 @samp{cortex-m4}, @samp{cortex-m3},
11250 @samp{cortex-m0plus},
11251 @samp{marvell-pj4},
11252 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
11253 @samp{fa526}, @samp{fa626},
11254 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}.
11257 @option{-mcpu=generic-@var{arch}} is also permissible, and is
11258 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
11259 See @option{-mtune} for more information.
11261 @option{-mcpu=native} causes the compiler to auto-detect the CPU
11262 of the build computer. At present, this feature is only supported on
11263 Linux, and not all architectures are recognized. If the auto-detect is
11264 unsuccessful the option has no effect.
11266 @item -mtune=@var{name}
11268 This option is very similar to the @option{-mcpu=} option, except that
11269 instead of specifying the actual target processor type, and hence
11270 restricting which instructions can be used, it specifies that GCC should
11271 tune the performance of the code as if the target were of the type
11272 specified in this option, but still choosing the instructions it
11273 generates based on the CPU specified by a @option{-mcpu=} option.
11274 For some ARM implementations better performance can be obtained by using
11277 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
11278 performance for a blend of processors within architecture @var{arch}.
11279 The aim is to generate code that run well on the current most popular
11280 processors, balancing between optimizations that benefit some CPUs in the
11281 range, and avoiding performance pitfalls of other CPUs. The effects of
11282 this option may change in future GCC versions as CPU models come and go.
11284 @option{-mtune=native} causes the compiler to auto-detect the CPU
11285 of the build computer. At present, this feature is only supported on
11286 Linux, and not all architectures are recognized. If the auto-detect is
11287 unsuccessful the option has no effect.
11289 @item -march=@var{name}
11291 This specifies the name of the target ARM architecture. GCC uses this
11292 name to determine what kind of instructions it can emit when generating
11293 assembly code. This option can be used in conjunction with or instead
11294 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
11295 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
11296 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
11297 @samp{armv6}, @samp{armv6j},
11298 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
11299 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
11301 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
11303 @option{-march=native} causes the compiler to auto-detect the architecture
11304 of the build computer. At present, this feature is only supported on
11305 Linux, and not all architectures are recognized. If the auto-detect is
11306 unsuccessful the option has no effect.
11308 @item -mfpu=@var{name}
11310 This specifies what floating-point hardware (or hardware emulation) is
11311 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
11312 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
11313 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
11314 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
11315 @samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}.
11317 If @option{-msoft-float} is specified this specifies the format of
11318 floating-point values.
11320 If the selected floating-point hardware includes the NEON extension
11321 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
11322 operations are not generated by GCC's auto-vectorization pass unless
11323 @option{-funsafe-math-optimizations} is also specified. This is
11324 because NEON hardware does not fully implement the IEEE 754 standard for
11325 floating-point arithmetic (in particular denormal values are treated as
11326 zero), so the use of NEON instructions may lead to a loss of precision.
11328 @item -mfp16-format=@var{name}
11329 @opindex mfp16-format
11330 Specify the format of the @code{__fp16} half-precision floating-point type.
11331 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
11332 the default is @samp{none}, in which case the @code{__fp16} type is not
11333 defined. @xref{Half-Precision}, for more information.
11335 @item -mstructure-size-boundary=@var{n}
11336 @opindex mstructure-size-boundary
11337 The sizes of all structures and unions are rounded up to a multiple
11338 of the number of bits set by this option. Permissible values are 8, 32
11339 and 64. The default value varies for different toolchains. For the COFF
11340 targeted toolchain the default value is 8. A value of 64 is only allowed
11341 if the underlying ABI supports it.
11343 Specifying a larger number can produce faster, more efficient code, but
11344 can also increase the size of the program. Different values are potentially
11345 incompatible. Code compiled with one value cannot necessarily expect to
11346 work with code or libraries compiled with another value, if they exchange
11347 information using structures or unions.
11349 @item -mabort-on-noreturn
11350 @opindex mabort-on-noreturn
11351 Generate a call to the function @code{abort} at the end of a
11352 @code{noreturn} function. It is executed if the function tries to
11356 @itemx -mno-long-calls
11357 @opindex mlong-calls
11358 @opindex mno-long-calls
11359 Tells the compiler to perform function calls by first loading the
11360 address of the function into a register and then performing a subroutine
11361 call on this register. This switch is needed if the target function
11362 lies outside of the 64-megabyte addressing range of the offset-based
11363 version of subroutine call instruction.
11365 Even if this switch is enabled, not all function calls are turned
11366 into long calls. The heuristic is that static functions, functions
11367 that have the @samp{short-call} attribute, functions that are inside
11368 the scope of a @samp{#pragma no_long_calls} directive, and functions whose
11369 definitions have already been compiled within the current compilation
11370 unit are not turned into long calls. The exceptions to this rule are
11371 that weak function definitions, functions with the @samp{long-call}
11372 attribute or the @samp{section} attribute, and functions that are within
11373 the scope of a @samp{#pragma long_calls} directive are always
11374 turned into long calls.
11376 This feature is not enabled by default. Specifying
11377 @option{-mno-long-calls} restores the default behavior, as does
11378 placing the function calls within the scope of a @samp{#pragma
11379 long_calls_off} directive. Note these switches have no effect on how
11380 the compiler generates code to handle function calls via function
11383 @item -msingle-pic-base
11384 @opindex msingle-pic-base
11385 Treat the register used for PIC addressing as read-only, rather than
11386 loading it in the prologue for each function. The runtime system is
11387 responsible for initializing this register with an appropriate value
11388 before execution begins.
11390 @item -mpic-register=@var{reg}
11391 @opindex mpic-register
11392 Specify the register to be used for PIC addressing. The default is R10
11393 unless stack-checking is enabled, when R9 is used.
11395 @item -mpoke-function-name
11396 @opindex mpoke-function-name
11397 Write the name of each function into the text section, directly
11398 preceding the function prologue. The generated code is similar to this:
11402 .ascii "arm_poke_function_name", 0
11405 .word 0xff000000 + (t1 - t0)
11406 arm_poke_function_name
11408 stmfd sp!, @{fp, ip, lr, pc@}
11412 When performing a stack backtrace, code can inspect the value of
11413 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
11414 location @code{pc - 12} and the top 8 bits are set, then we know that
11415 there is a function name embedded immediately preceding this location
11416 and has length @code{((pc[-3]) & 0xff000000)}.
11423 Select between generating code that executes in ARM and Thumb
11424 states. The default for most configurations is to generate code
11425 that executes in ARM state, but the default can be changed by
11426 configuring GCC with the @option{--with-mode=}@var{state}
11430 @opindex mtpcs-frame
11431 Generate a stack frame that is compliant with the Thumb Procedure Call
11432 Standard for all non-leaf functions. (A leaf function is one that does
11433 not call any other functions.) The default is @option{-mno-tpcs-frame}.
11435 @item -mtpcs-leaf-frame
11436 @opindex mtpcs-leaf-frame
11437 Generate a stack frame that is compliant with the Thumb Procedure Call
11438 Standard for all leaf functions. (A leaf function is one that does
11439 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
11441 @item -mcallee-super-interworking
11442 @opindex mcallee-super-interworking
11443 Gives all externally visible functions in the file being compiled an ARM
11444 instruction set header which switches to Thumb mode before executing the
11445 rest of the function. This allows these functions to be called from
11446 non-interworking code. This option is not valid in AAPCS configurations
11447 because interworking is enabled by default.
11449 @item -mcaller-super-interworking
11450 @opindex mcaller-super-interworking
11451 Allows calls via function pointers (including virtual functions) to
11452 execute correctly regardless of whether the target code has been
11453 compiled for interworking or not. There is a small overhead in the cost
11454 of executing a function pointer if this option is enabled. This option
11455 is not valid in AAPCS configurations because interworking is enabled
11458 @item -mtp=@var{name}
11460 Specify the access model for the thread local storage pointer. The valid
11461 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
11462 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
11463 (supported in the arm6k architecture), and @option{auto}, which uses the
11464 best available method for the selected processor. The default setting is
11467 @item -mtls-dialect=@var{dialect}
11468 @opindex mtls-dialect
11469 Specify the dialect to use for accessing thread local storage. Two
11470 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
11471 @samp{gnu} dialect selects the original GNU scheme for supporting
11472 local and global dynamic TLS models. The @samp{gnu2} dialect
11473 selects the GNU descriptor scheme, which provides better performance
11474 for shared libraries. The GNU descriptor scheme is compatible with
11475 the original scheme, but does require new assembler, linker and
11476 library support. Initial and local exec TLS models are unaffected by
11477 this option and always use the original scheme.
11479 @item -mword-relocations
11480 @opindex mword-relocations
11481 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
11482 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
11483 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
11486 @item -mfix-cortex-m3-ldrd
11487 @opindex mfix-cortex-m3-ldrd
11488 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
11489 with overlapping destination and base registers are used. This option avoids
11490 generating these instructions. This option is enabled by default when
11491 @option{-mcpu=cortex-m3} is specified.
11493 @item -munaligned-access
11494 @itemx -mno-unaligned-access
11495 @opindex munaligned-access
11496 @opindex mno-unaligned-access
11497 Enables (or disables) reading and writing of 16- and 32- bit values
11498 from addresses that are not 16- or 32- bit aligned. By default
11499 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
11500 architectures, and enabled for all other architectures. If unaligned
11501 access is not enabled then words in packed data structures will be
11502 accessed a byte at a time.
11504 The ARM attribute @code{Tag_CPU_unaligned_access} will be set in the
11505 generated object file to either true or false, depending upon the
11506 setting of this option. If unaligned access is enabled then the
11507 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} will also be
11513 @subsection AVR Options
11514 @cindex AVR Options
11516 These options are defined for AVR implementations:
11519 @item -mmcu=@var{mcu}
11521 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
11523 The default for this option is@tie{}@code{avr2}.
11525 GCC supports the following AVR devices and ISAs:
11527 @include avr-mmcu.texi
11529 @item -maccumulate-args
11530 @opindex maccumulate-args
11531 Accumulate outgoing function arguments and acquire/release the needed
11532 stack space for outgoing function arguments once in function
11533 prologue/epilogue. Without this option, outgoing arguments are pushed
11534 before calling a function and popped afterwards.
11536 Popping the arguments after the function call can be expensive on
11537 AVR so that accumulating the stack space might lead to smaller
11538 executables because arguments need not to be removed from the
11539 stack after such a function call.
11541 This option can lead to reduced code size for functions that perform
11542 several calls to functions that get their arguments on the stack like
11543 calls to printf-like functions.
11545 @item -mbranch-cost=@var{cost}
11546 @opindex mbranch-cost
11547 Set the branch costs for conditional branch instructions to
11548 @var{cost}. Reasonable values for @var{cost} are small, non-negative
11549 integers. The default branch cost is 0.
11551 @item -mcall-prologues
11552 @opindex mcall-prologues
11553 Functions prologues/epilogues are expanded as calls to appropriate
11554 subroutines. Code size is smaller.
11558 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
11559 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
11560 and @code{long long} is 4 bytes. Please note that this option does not
11561 conform to the C standards, but it results in smaller code
11564 @item -mno-interrupts
11565 @opindex mno-interrupts
11566 Generated code is not compatible with hardware interrupts.
11567 Code size is smaller.
11571 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
11572 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
11573 Setting @code{-mrelax} just adds the @code{--relax} option to the
11574 linker command line when the linker is called.
11576 Jump relaxing is performed by the linker because jump offsets are not
11577 known before code is located. Therefore, the assembler code generated by the
11578 compiler is the same, but the instructions in the executable may
11579 differ from instructions in the assembler code.
11581 Relaxing must be turned on if linker stubs are needed, see the
11582 section on @code{EIND} and linker stubs below.
11586 Treat the stack pointer register as an 8-bit register,
11587 i.e.@: assume the high byte of the stack pointer is zero.
11588 In general, you don't need to set this option by hand.
11590 This option is used internally by the compiler to select and
11591 build multilibs for architectures @code{avr2} and @code{avr25}.
11592 These architectures mix devices with and without @code{SPH}.
11593 For any setting other than @code{-mmcu=avr2} or @code{-mmcu=avr25}
11594 the compiler driver will add or remove this option from the compiler
11595 proper's command line, because the compiler then knows if the device
11596 or architecture has an 8-bit stack pointer and thus no @code{SPH}
11601 Use address register @code{X} in a way proposed by the hardware. This means
11602 that @code{X} is only used in indirect, post-increment or
11603 pre-decrement addressing.
11605 Without this option, the @code{X} register may be used in the same way
11606 as @code{Y} or @code{Z} which then is emulated by additional
11608 For example, loading a value with @code{X+const} addressing with a
11609 small non-negative @code{const < 64} to a register @var{Rn} is
11613 adiw r26, const ; X += const
11614 ld @var{Rn}, X ; @var{Rn} = *X
11615 sbiw r26, const ; X -= const
11619 @opindex mtiny-stack
11620 Only change the lower 8@tie{}bits of the stack pointer.
11623 @subsubsection @code{EIND} and Devices with more than 128 Ki Bytes of Flash
11624 @cindex @code{EIND}
11625 Pointers in the implementation are 16@tie{}bits wide.
11626 The address of a function or label is represented as word address so
11627 that indirect jumps and calls can target any code address in the
11628 range of 64@tie{}Ki words.
11630 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
11631 bytes of program memory space, there is a special function register called
11632 @code{EIND} that serves as most significant part of the target address
11633 when @code{EICALL} or @code{EIJMP} instructions are used.
11635 Indirect jumps and calls on these devices are handled as follows by
11636 the compiler and are subject to some limitations:
11641 The compiler never sets @code{EIND}.
11644 The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
11645 instructions or might read @code{EIND} directly in order to emulate an
11646 indirect call/jump by means of a @code{RET} instruction.
11649 The compiler assumes that @code{EIND} never changes during the startup
11650 code or during the application. In particular, @code{EIND} is not
11651 saved/restored in function or interrupt service routine
11655 For indirect calls to functions and computed goto, the linker
11656 generates @emph{stubs}. Stubs are jump pads sometimes also called
11657 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
11658 The stub contains a direct jump to the desired address.
11661 Linker relaxation must be turned on so that the linker will generate
11662 the stubs correctly an all situaltion. See the compiler option
11663 @code{-mrelax} and the linler option @code{--relax}.
11664 There are corner cases where the linker is supposed to generate stubs
11665 but aborts without relaxation and without a helpful error message.
11668 The default linker script is arranged for code with @code{EIND = 0}.
11669 If code is supposed to work for a setup with @code{EIND != 0}, a custom
11670 linker script has to be used in order to place the sections whose
11671 name start with @code{.trampolines} into the segment where @code{EIND}
11675 The startup code from libgcc never sets @code{EIND}.
11676 Notice that startup code is a blend of code from libgcc and AVR-LibC.
11677 For the impact of AVR-LibC on @code{EIND}, see the
11678 @w{@uref{http://nongnu.org/avr-libc/user-manual,AVR-LibC user manual}}.
11681 It is legitimate for user-specific startup code to set up @code{EIND}
11682 early, for example by means of initialization code located in
11683 section @code{.init3}. Such code runs prior to general startup code
11684 that initializes RAM and calls constructors, but after the bit
11685 of startup code from AVR-LibC that sets @code{EIND} to the segment
11686 where the vector table is located.
11688 #include <avr/io.h>
11691 __attribute__((section(".init3"),naked,used,no_instrument_function))
11692 init3_set_eind (void)
11694 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
11695 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
11700 The @code{__trampolines_start} symbol is defined in the linker script.
11703 Stubs are generated automatically by the linker if
11704 the following two conditions are met:
11707 @item The address of a label is taken by means of the @code{gs} modifier
11708 (short for @emph{generate stubs}) like so:
11710 LDI r24, lo8(gs(@var{func}))
11711 LDI r25, hi8(gs(@var{func}))
11713 @item The final location of that label is in a code segment
11714 @emph{outside} the segment where the stubs are located.
11718 The compiler emits such @code{gs} modifiers for code labels in the
11719 following situations:
11721 @item Taking address of a function or code label.
11722 @item Computed goto.
11723 @item If prologue-save function is used, see @option{-mcall-prologues}
11724 command-line option.
11725 @item Switch/case dispatch tables. If you do not want such dispatch
11726 tables you can specify the @option{-fno-jump-tables} command-line option.
11727 @item C and C++ constructors/destructors called during startup/shutdown.
11728 @item If the tools hit a @code{gs()} modifier explained above.
11732 Jumping to non-symbolic addresses like so is @emph{not} supported:
11737 /* Call function at word address 0x2 */
11738 return ((int(*)(void)) 0x2)();
11742 Instead, a stub has to be set up, i.e.@: the function has to be called
11743 through a symbol (@code{func_4} in the example):
11748 extern int func_4 (void);
11750 /* Call function at byte address 0x4 */
11755 and the application be linked with @code{-Wl,--defsym,func_4=0x4}.
11756 Alternatively, @code{func_4} can be defined in the linker script.
11759 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
11760 @cindex @code{RAMPD}
11761 @cindex @code{RAMPX}
11762 @cindex @code{RAMPY}
11763 @cindex @code{RAMPZ}
11764 Some AVR devices support memories larger than the 64@tie{}KiB range
11765 that can be accessed with 16-bit pointers. To access memory locations
11766 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
11767 register is used as high part of the address:
11768 The @code{X}, @code{Y}, @code{Z} address register is concatenated
11769 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
11770 register, respectively, to get a wide address. Similarly,
11771 @code{RAMPD} is used together with direct addressing.
11775 The startup code initializes the @code{RAMP} special function
11776 registers with zero.
11779 If a @ref{AVR Named Address Spaces,named address space} other than
11780 generic or @code{__flash} is used, then @code{RAMPZ} is set
11781 as needed before the operation.
11784 If the device supports RAM larger than 64@tie{KiB} and the compiler
11785 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
11786 is reset to zero after the operation.
11789 If the device comes with a specific @code{RAMP} register, the ISR
11790 prologue/epilogue saves/restores that SFR and initializes it with
11791 zero in case the ISR code might (implicitly) use it.
11794 RAM larger than 64@tie{KiB} is not supported by GCC for AVR targets.
11795 If you use inline assembler to read from locations outside the
11796 16-bit address range and change one of the @code{RAMP} registers,
11797 you must reset it to zero after the access.
11801 @subsubsection AVR Built-in Macros
11803 GCC defines several built-in macros so that the user code can test
11804 for the presence or absence of features. Almost any of the following
11805 built-in macros are deduced from device capabilities and thus
11806 triggered by the @code{-mmcu=} command-line option.
11808 For even more AVR-specific built-in macros see
11809 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
11814 Build-in macro that resolves to a decimal number that identifies the
11815 architecture and depends on the @code{-mmcu=@var{mcu}} option.
11816 Possible values are:
11818 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
11819 @code{4}, @code{5}, @code{51}, @code{6}, @code{102}, @code{104},
11820 @code{105}, @code{106}, @code{107}
11822 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3},
11823 @code{avr31}, @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51},
11824 @code{avr6}, @code{avrxmega2}, @code{avrxmega4}, @code{avrxmega5},
11825 @code{avrxmega6}, @code{avrxmega7}, respectively.
11826 If @var{mcu} specifies a device, this built-in macro is set
11827 accordingly. For example, with @code{-mmcu=atmega8} the macro will be
11828 defined to @code{4}.
11830 @item __AVR_@var{Device}__
11831 Setting @code{-mmcu=@var{device}} defines this built-in macro which reflects
11832 the device's name. For example, @code{-mmcu=atmega8} defines the
11833 built-in macro @code{__AVR_ATmega8__}, @code{-mmcu=attiny261a} defines
11834 @code{__AVR_ATtiny261A__}, etc.
11836 The built-in macros' names follow
11837 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
11838 the device name as from the AVR user manual. The difference between
11839 @var{Device} in the built-in macro and @var{device} in
11840 @code{-mmcu=@var{device}} is that the latter is always lowercase.
11842 If @var{device} is not a device but only a core architecture like
11843 @code{avr51}, this macro will not be defined.
11845 @item __AVR_XMEGA__
11846 The device / architecture belongs to the XMEGA family of devices.
11848 @item __AVR_HAVE_ELPM__
11849 The device has the the @code{ELPM} instruction.
11851 @item __AVR_HAVE_ELPMX__
11852 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
11853 R@var{n},Z+} instructions.
11855 @item __AVR_HAVE_MOVW__
11856 The device has the @code{MOVW} instruction to perform 16-bit
11857 register-register moves.
11859 @item __AVR_HAVE_LPMX__
11860 The device has the @code{LPM R@var{n},Z} and
11861 @code{LPM R@var{n},Z+} instructions.
11863 @item __AVR_HAVE_MUL__
11864 The device has a hardware multiplier.
11866 @item __AVR_HAVE_JMP_CALL__
11867 The device has the @code{JMP} and @code{CALL} instructions.
11868 This is the case for devices with at least 16@tie{}KiB of program
11871 @item __AVR_HAVE_EIJMP_EICALL__
11872 @itemx __AVR_3_BYTE_PC__
11873 The device has the @code{EIJMP} and @code{EICALL} instructions.
11874 This is the case for devices with more than 128@tie{}KiB of program memory.
11875 This also means that the program counter
11876 (PC) is 3@tie{}bytes wide.
11878 @item __AVR_2_BYTE_PC__
11879 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
11880 with up to 128@tie{}KiB of program memory.
11882 @item __AVR_HAVE_8BIT_SP__
11883 @itemx __AVR_HAVE_16BIT_SP__
11884 The stack pointer (SP) register is treated as 8-bit respectively
11885 16-bit register by the compiler.
11886 The definition of these macros is affected by @code{-mtiny-stack}.
11888 @item __AVR_HAVE_SPH__
11890 The device has the SPH (high part of stack pointer) special function
11891 register or has an 8-bit stack pointer, respectively.
11892 The definition of these macros is affected by @code{-mmcu=} and
11893 in the cases of @code{-mmcu=avr2} and @code{-mmcu=avr25} also
11896 @item __AVR_HAVE_RAMPD__
11897 @itemx __AVR_HAVE_RAMPX__
11898 @itemx __AVR_HAVE_RAMPY__
11899 @itemx __AVR_HAVE_RAMPZ__
11900 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
11901 @code{RAMPZ} special function register, respectively.
11903 @item __NO_INTERRUPTS__
11904 This macro reflects the @code{-mno-interrupts} command line option.
11906 @item __AVR_ERRATA_SKIP__
11907 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
11908 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
11909 instructions because of a hardware erratum. Skip instructions are
11910 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
11911 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
11914 @item __AVR_SFR_OFFSET__=@var{offset}
11915 Instructions that can address I/O special function registers directly
11916 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
11917 address as if addressed by an instruction to access RAM like @code{LD}
11918 or @code{STS}. This offset depends on the device architecture and has
11919 to be subtracted from the RAM address in order to get the
11920 respective I/O@tie{}address.
11922 @item __WITH_AVRLIBC__
11923 The compiler is configured to be used together with AVR-Libc.
11924 See the @code{--with-avrlibc} configure option.
11928 @node Blackfin Options
11929 @subsection Blackfin Options
11930 @cindex Blackfin Options
11933 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
11935 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
11936 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
11937 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
11938 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
11939 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
11940 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
11941 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
11942 @samp{bf561}, @samp{bf592}.
11944 The optional @var{sirevision} specifies the silicon revision of the target
11945 Blackfin processor. Any workarounds available for the targeted silicon revision
11946 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
11947 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
11948 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
11949 hexadecimal digits representing the major and minor numbers in the silicon
11950 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
11951 is not defined. If @var{sirevision} is @samp{any}, the
11952 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
11953 If this optional @var{sirevision} is not used, GCC assumes the latest known
11954 silicon revision of the targeted Blackfin processor.
11956 GCC defines a preprocessor macro for the specified @var{cpu}.
11957 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
11958 provided by libgloss to be linked in if @option{-msim} is not given.
11960 Without this option, @samp{bf532} is used as the processor by default.
11962 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
11963 only the preprocessor macro is defined.
11967 Specifies that the program will be run on the simulator. This causes
11968 the simulator BSP provided by libgloss to be linked in. This option
11969 has effect only for @samp{bfin-elf} toolchain.
11970 Certain other options, such as @option{-mid-shared-library} and
11971 @option{-mfdpic}, imply @option{-msim}.
11973 @item -momit-leaf-frame-pointer
11974 @opindex momit-leaf-frame-pointer
11975 Don't keep the frame pointer in a register for leaf functions. This
11976 avoids the instructions to save, set up and restore frame pointers and
11977 makes an extra register available in leaf functions. The option
11978 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
11979 which might make debugging harder.
11981 @item -mspecld-anomaly
11982 @opindex mspecld-anomaly
11983 When enabled, the compiler ensures that the generated code does not
11984 contain speculative loads after jump instructions. If this option is used,
11985 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
11987 @item -mno-specld-anomaly
11988 @opindex mno-specld-anomaly
11989 Don't generate extra code to prevent speculative loads from occurring.
11991 @item -mcsync-anomaly
11992 @opindex mcsync-anomaly
11993 When enabled, the compiler ensures that the generated code does not
11994 contain CSYNC or SSYNC instructions too soon after conditional branches.
11995 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
11997 @item -mno-csync-anomaly
11998 @opindex mno-csync-anomaly
11999 Don't generate extra code to prevent CSYNC or SSYNC instructions from
12000 occurring too soon after a conditional branch.
12004 When enabled, the compiler is free to take advantage of the knowledge that
12005 the entire program fits into the low 64k of memory.
12008 @opindex mno-low-64k
12009 Assume that the program is arbitrarily large. This is the default.
12011 @item -mstack-check-l1
12012 @opindex mstack-check-l1
12013 Do stack checking using information placed into L1 scratchpad memory by the
12016 @item -mid-shared-library
12017 @opindex mid-shared-library
12018 Generate code that supports shared libraries via the library ID method.
12019 This allows for execute in place and shared libraries in an environment
12020 without virtual memory management. This option implies @option{-fPIC}.
12021 With a @samp{bfin-elf} target, this option implies @option{-msim}.
12023 @item -mno-id-shared-library
12024 @opindex mno-id-shared-library
12025 Generate code that doesn't assume ID-based shared libraries are being used.
12026 This is the default.
12028 @item -mleaf-id-shared-library
12029 @opindex mleaf-id-shared-library
12030 Generate code that supports shared libraries via the library ID method,
12031 but assumes that this library or executable won't link against any other
12032 ID shared libraries. That allows the compiler to use faster code for jumps
12035 @item -mno-leaf-id-shared-library
12036 @opindex mno-leaf-id-shared-library
12037 Do not assume that the code being compiled won't link against any ID shared
12038 libraries. Slower code is generated for jump and call insns.
12040 @item -mshared-library-id=n
12041 @opindex mshared-library-id
12042 Specifies the identification number of the ID-based shared library being
12043 compiled. Specifying a value of 0 generates more compact code; specifying
12044 other values forces the allocation of that number to the current
12045 library but is no more space- or time-efficient than omitting this option.
12049 Generate code that allows the data segment to be located in a different
12050 area of memory from the text segment. This allows for execute in place in
12051 an environment without virtual memory management by eliminating relocations
12052 against the text section.
12054 @item -mno-sep-data
12055 @opindex mno-sep-data
12056 Generate code that assumes that the data segment follows the text segment.
12057 This is the default.
12060 @itemx -mno-long-calls
12061 @opindex mlong-calls
12062 @opindex mno-long-calls
12063 Tells the compiler to perform function calls by first loading the
12064 address of the function into a register and then performing a subroutine
12065 call on this register. This switch is needed if the target function
12066 lies outside of the 24-bit addressing range of the offset-based
12067 version of subroutine call instruction.
12069 This feature is not enabled by default. Specifying
12070 @option{-mno-long-calls} restores the default behavior. Note these
12071 switches have no effect on how the compiler generates code to handle
12072 function calls via function pointers.
12076 Link with the fast floating-point library. This library relaxes some of
12077 the IEEE floating-point standard's rules for checking inputs against
12078 Not-a-Number (NAN), in the interest of performance.
12081 @opindex minline-plt
12082 Enable inlining of PLT entries in function calls to functions that are
12083 not known to bind locally. It has no effect without @option{-mfdpic}.
12086 @opindex mmulticore
12087 Build a standalone application for multicore Blackfin processors.
12088 This option causes proper start files and link scripts supporting
12089 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
12090 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
12092 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
12093 selects the one-application-per-core programming model. Without
12094 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
12095 programming model is used. In this model, the main function of Core B
12096 should be named as @code{coreb_main}.
12098 If this option is not used, the single-core application programming
12103 Build a standalone application for Core A of BF561 when using
12104 the one-application-per-core programming model. Proper start files
12105 and link scripts are used to support Core A, and the macro
12106 @code{__BFIN_COREA} is defined.
12107 This option can only be used in conjunction with @option{-mmulticore}.
12111 Build a standalone application for Core B of BF561 when using
12112 the one-application-per-core programming model. Proper start files
12113 and link scripts are used to support Core B, and the macro
12114 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
12115 should be used instead of @code{main}.
12116 This option can only be used in conjunction with @option{-mmulticore}.
12120 Build a standalone application for SDRAM. Proper start files and
12121 link scripts are used to put the application into SDRAM, and the macro
12122 @code{__BFIN_SDRAM} is defined.
12123 The loader should initialize SDRAM before loading the application.
12127 Assume that ICPLBs are enabled at run time. This has an effect on certain
12128 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
12129 are enabled; for standalone applications the default is off.
12133 @subsection C6X Options
12134 @cindex C6X Options
12137 @item -march=@var{name}
12139 This specifies the name of the target architecture. GCC uses this
12140 name to determine what kind of instructions it can emit when generating
12141 assembly code. Permissible names are: @samp{c62x},
12142 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
12145 @opindex mbig-endian
12146 Generate code for a big-endian target.
12148 @item -mlittle-endian
12149 @opindex mlittle-endian
12150 Generate code for a little-endian target. This is the default.
12154 Choose startup files and linker script suitable for the simulator.
12156 @item -msdata=default
12157 @opindex msdata=default
12158 Put small global and static data in the @samp{.neardata} section,
12159 which is pointed to by register @code{B14}. Put small uninitialized
12160 global and static data in the @samp{.bss} section, which is adjacent
12161 to the @samp{.neardata} section. Put small read-only data into the
12162 @samp{.rodata} section. The corresponding sections used for large
12163 pieces of data are @samp{.fardata}, @samp{.far} and @samp{.const}.
12166 @opindex msdata=all
12167 Put all data, not just small objects, into the sections reserved for
12168 small data, and use addressing relative to the @code{B14} register to
12172 @opindex msdata=none
12173 Make no use of the sections reserved for small data, and use absolute
12174 addresses to access all data. Put all initialized global and static
12175 data in the @samp{.fardata} section, and all uninitialized data in the
12176 @samp{.far} section. Put all constant data into the @samp{.const}
12181 @subsection CRIS Options
12182 @cindex CRIS Options
12184 These options are defined specifically for the CRIS ports.
12187 @item -march=@var{architecture-type}
12188 @itemx -mcpu=@var{architecture-type}
12191 Generate code for the specified architecture. The choices for
12192 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
12193 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
12194 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
12197 @item -mtune=@var{architecture-type}
12199 Tune to @var{architecture-type} everything applicable about the generated
12200 code, except for the ABI and the set of available instructions. The
12201 choices for @var{architecture-type} are the same as for
12202 @option{-march=@var{architecture-type}}.
12204 @item -mmax-stack-frame=@var{n}
12205 @opindex mmax-stack-frame
12206 Warn when the stack frame of a function exceeds @var{n} bytes.
12212 The options @option{-metrax4} and @option{-metrax100} are synonyms for
12213 @option{-march=v3} and @option{-march=v8} respectively.
12215 @item -mmul-bug-workaround
12216 @itemx -mno-mul-bug-workaround
12217 @opindex mmul-bug-workaround
12218 @opindex mno-mul-bug-workaround
12219 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
12220 models where it applies. This option is active by default.
12224 Enable CRIS-specific verbose debug-related information in the assembly
12225 code. This option also has the effect of turning off the @samp{#NO_APP}
12226 formatted-code indicator to the assembler at the beginning of the
12231 Do not use condition-code results from previous instruction; always emit
12232 compare and test instructions before use of condition codes.
12234 @item -mno-side-effects
12235 @opindex mno-side-effects
12236 Do not emit instructions with side effects in addressing modes other than
12239 @item -mstack-align
12240 @itemx -mno-stack-align
12241 @itemx -mdata-align
12242 @itemx -mno-data-align
12243 @itemx -mconst-align
12244 @itemx -mno-const-align
12245 @opindex mstack-align
12246 @opindex mno-stack-align
12247 @opindex mdata-align
12248 @opindex mno-data-align
12249 @opindex mconst-align
12250 @opindex mno-const-align
12251 These options (@samp{no-} options) arrange (eliminate arrangements) for the
12252 stack frame, individual data and constants to be aligned for the maximum
12253 single data access size for the chosen CPU model. The default is to
12254 arrange for 32-bit alignment. ABI details such as structure layout are
12255 not affected by these options.
12263 Similar to the stack- data- and const-align options above, these options
12264 arrange for stack frame, writable data and constants to all be 32-bit,
12265 16-bit or 8-bit aligned. The default is 32-bit alignment.
12267 @item -mno-prologue-epilogue
12268 @itemx -mprologue-epilogue
12269 @opindex mno-prologue-epilogue
12270 @opindex mprologue-epilogue
12271 With @option{-mno-prologue-epilogue}, the normal function prologue and
12272 epilogue which set up the stack frame are omitted and no return
12273 instructions or return sequences are generated in the code. Use this
12274 option only together with visual inspection of the compiled code: no
12275 warnings or errors are generated when call-saved registers must be saved,
12276 or storage for local variables needs to be allocated.
12280 @opindex mno-gotplt
12282 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
12283 instruction sequences that load addresses for functions from the PLT part
12284 of the GOT rather than (traditional on other architectures) calls to the
12285 PLT@. The default is @option{-mgotplt}.
12289 Legacy no-op option only recognized with the cris-axis-elf and
12290 cris-axis-linux-gnu targets.
12294 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
12298 This option, recognized for the cris-axis-elf, arranges
12299 to link with input-output functions from a simulator library. Code,
12300 initialized data and zero-initialized data are allocated consecutively.
12304 Like @option{-sim}, but pass linker options to locate initialized data at
12305 0x40000000 and zero-initialized data at 0x80000000.
12309 @subsection CR16 Options
12310 @cindex CR16 Options
12312 These options are defined specifically for the CR16 ports.
12318 Enable the use of multiply-accumulate instructions. Disabled by default.
12322 @opindex mcr16cplus
12324 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
12329 Links the library libsim.a which is in compatible with simulator. Applicable
12330 to ELF compiler only.
12334 Choose integer type as 32-bit wide.
12338 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
12340 @item -mdata-model=@var{model}
12341 @opindex mdata-model
12342 Choose a data model. The choices for @var{model} are @samp{near},
12343 @samp{far} or @samp{medium}. @samp{medium} is default.
12344 However, @samp{far} is not valid with @option{-mcr16c}, as the
12345 CR16C architecture does not support the far data model.
12348 @node Darwin Options
12349 @subsection Darwin Options
12350 @cindex Darwin options
12352 These options are defined for all architectures running the Darwin operating
12355 FSF GCC on Darwin does not create ``fat'' object files; it creates
12356 an object file for the single architecture that GCC was built to
12357 target. Apple's GCC on Darwin does create ``fat'' files if multiple
12358 @option{-arch} options are used; it does so by running the compiler or
12359 linker multiple times and joining the results together with
12362 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
12363 @samp{i686}) is determined by the flags that specify the ISA
12364 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
12365 @option{-force_cpusubtype_ALL} option can be used to override this.
12367 The Darwin tools vary in their behavior when presented with an ISA
12368 mismatch. The assembler, @file{as}, only permits instructions to
12369 be used that are valid for the subtype of the file it is generating,
12370 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
12371 The linker for shared libraries, @file{/usr/bin/libtool}, fails
12372 and prints an error if asked to create a shared library with a less
12373 restrictive subtype than its input files (for instance, trying to put
12374 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
12375 for executables, @command{ld}, quietly gives the executable the most
12376 restrictive subtype of any of its input files.
12381 Add the framework directory @var{dir} to the head of the list of
12382 directories to be searched for header files. These directories are
12383 interleaved with those specified by @option{-I} options and are
12384 scanned in a left-to-right order.
12386 A framework directory is a directory with frameworks in it. A
12387 framework is a directory with a @file{Headers} and/or
12388 @file{PrivateHeaders} directory contained directly in it that ends
12389 in @file{.framework}. The name of a framework is the name of this
12390 directory excluding the @file{.framework}. Headers associated with
12391 the framework are found in one of those two directories, with
12392 @file{Headers} being searched first. A subframework is a framework
12393 directory that is in a framework's @file{Frameworks} directory.
12394 Includes of subframework headers can only appear in a header of a
12395 framework that contains the subframework, or in a sibling subframework
12396 header. Two subframeworks are siblings if they occur in the same
12397 framework. A subframework should not have the same name as a
12398 framework; a warning is issued if this is violated. Currently a
12399 subframework cannot have subframeworks; in the future, the mechanism
12400 may be extended to support this. The standard frameworks can be found
12401 in @file{/System/Library/Frameworks} and
12402 @file{/Library/Frameworks}. An example include looks like
12403 @code{#include <Framework/header.h>}, where @file{Framework} denotes
12404 the name of the framework and @file{header.h} is found in the
12405 @file{PrivateHeaders} or @file{Headers} directory.
12407 @item -iframework@var{dir}
12408 @opindex iframework
12409 Like @option{-F} except the directory is a treated as a system
12410 directory. The main difference between this @option{-iframework} and
12411 @option{-F} is that with @option{-iframework} the compiler does not
12412 warn about constructs contained within header files found via
12413 @var{dir}. This option is valid only for the C family of languages.
12417 Emit debugging information for symbols that are used. For stabs
12418 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
12419 This is by default ON@.
12423 Emit debugging information for all symbols and types.
12425 @item -mmacosx-version-min=@var{version}
12426 The earliest version of MacOS X that this executable will run on
12427 is @var{version}. Typical values of @var{version} include @code{10.1},
12428 @code{10.2}, and @code{10.3.9}.
12430 If the compiler was built to use the system's headers by default,
12431 then the default for this option is the system version on which the
12432 compiler is running, otherwise the default is to make choices that
12433 are compatible with as many systems and code bases as possible.
12437 Enable kernel development mode. The @option{-mkernel} option sets
12438 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
12439 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
12440 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
12441 applicable. This mode also sets @option{-mno-altivec},
12442 @option{-msoft-float}, @option{-fno-builtin} and
12443 @option{-mlong-branch} for PowerPC targets.
12445 @item -mone-byte-bool
12446 @opindex mone-byte-bool
12447 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
12448 By default @samp{sizeof(bool)} is @samp{4} when compiling for
12449 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
12450 option has no effect on x86.
12452 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
12453 to generate code that is not binary compatible with code generated
12454 without that switch. Using this switch may require recompiling all
12455 other modules in a program, including system libraries. Use this
12456 switch to conform to a non-default data model.
12458 @item -mfix-and-continue
12459 @itemx -ffix-and-continue
12460 @itemx -findirect-data
12461 @opindex mfix-and-continue
12462 @opindex ffix-and-continue
12463 @opindex findirect-data
12464 Generate code suitable for fast turnaround development, such as to
12465 allow GDB to dynamically load @code{.o} files into already-running
12466 programs. @option{-findirect-data} and @option{-ffix-and-continue}
12467 are provided for backwards compatibility.
12471 Loads all members of static archive libraries.
12472 See man ld(1) for more information.
12474 @item -arch_errors_fatal
12475 @opindex arch_errors_fatal
12476 Cause the errors having to do with files that have the wrong architecture
12479 @item -bind_at_load
12480 @opindex bind_at_load
12481 Causes the output file to be marked such that the dynamic linker will
12482 bind all undefined references when the file is loaded or launched.
12486 Produce a Mach-o bundle format file.
12487 See man ld(1) for more information.
12489 @item -bundle_loader @var{executable}
12490 @opindex bundle_loader
12491 This option specifies the @var{executable} that will load the build
12492 output file being linked. See man ld(1) for more information.
12495 @opindex dynamiclib
12496 When passed this option, GCC produces a dynamic library instead of
12497 an executable when linking, using the Darwin @file{libtool} command.
12499 @item -force_cpusubtype_ALL
12500 @opindex force_cpusubtype_ALL
12501 This causes GCC's output file to have the @var{ALL} subtype, instead of
12502 one controlled by the @option{-mcpu} or @option{-march} option.
12504 @item -allowable_client @var{client_name}
12505 @itemx -client_name
12506 @itemx -compatibility_version
12507 @itemx -current_version
12509 @itemx -dependency-file
12511 @itemx -dylinker_install_name
12513 @itemx -exported_symbols_list
12516 @itemx -flat_namespace
12517 @itemx -force_flat_namespace
12518 @itemx -headerpad_max_install_names
12521 @itemx -install_name
12522 @itemx -keep_private_externs
12523 @itemx -multi_module
12524 @itemx -multiply_defined
12525 @itemx -multiply_defined_unused
12528 @itemx -no_dead_strip_inits_and_terms
12529 @itemx -nofixprebinding
12530 @itemx -nomultidefs
12532 @itemx -noseglinkedit
12533 @itemx -pagezero_size
12535 @itemx -prebind_all_twolevel_modules
12536 @itemx -private_bundle
12538 @itemx -read_only_relocs
12540 @itemx -sectobjectsymbols
12544 @itemx -sectobjectsymbols
12547 @itemx -segs_read_only_addr
12549 @itemx -segs_read_write_addr
12550 @itemx -seg_addr_table
12551 @itemx -seg_addr_table_filename
12552 @itemx -seglinkedit
12554 @itemx -segs_read_only_addr
12555 @itemx -segs_read_write_addr
12556 @itemx -single_module
12558 @itemx -sub_library
12560 @itemx -sub_umbrella
12561 @itemx -twolevel_namespace
12564 @itemx -unexported_symbols_list
12565 @itemx -weak_reference_mismatches
12566 @itemx -whatsloaded
12567 @opindex allowable_client
12568 @opindex client_name
12569 @opindex compatibility_version
12570 @opindex current_version
12571 @opindex dead_strip
12572 @opindex dependency-file
12573 @opindex dylib_file
12574 @opindex dylinker_install_name
12576 @opindex exported_symbols_list
12578 @opindex flat_namespace
12579 @opindex force_flat_namespace
12580 @opindex headerpad_max_install_names
12581 @opindex image_base
12583 @opindex install_name
12584 @opindex keep_private_externs
12585 @opindex multi_module
12586 @opindex multiply_defined
12587 @opindex multiply_defined_unused
12588 @opindex noall_load
12589 @opindex no_dead_strip_inits_and_terms
12590 @opindex nofixprebinding
12591 @opindex nomultidefs
12593 @opindex noseglinkedit
12594 @opindex pagezero_size
12596 @opindex prebind_all_twolevel_modules
12597 @opindex private_bundle
12598 @opindex read_only_relocs
12600 @opindex sectobjectsymbols
12603 @opindex sectcreate
12604 @opindex sectobjectsymbols
12607 @opindex segs_read_only_addr
12608 @opindex segs_read_write_addr
12609 @opindex seg_addr_table
12610 @opindex seg_addr_table_filename
12611 @opindex seglinkedit
12613 @opindex segs_read_only_addr
12614 @opindex segs_read_write_addr
12615 @opindex single_module
12617 @opindex sub_library
12618 @opindex sub_umbrella
12619 @opindex twolevel_namespace
12622 @opindex unexported_symbols_list
12623 @opindex weak_reference_mismatches
12624 @opindex whatsloaded
12625 These options are passed to the Darwin linker. The Darwin linker man page
12626 describes them in detail.
12629 @node DEC Alpha Options
12630 @subsection DEC Alpha Options
12632 These @samp{-m} options are defined for the DEC Alpha implementations:
12635 @item -mno-soft-float
12636 @itemx -msoft-float
12637 @opindex mno-soft-float
12638 @opindex msoft-float
12639 Use (do not use) the hardware floating-point instructions for
12640 floating-point operations. When @option{-msoft-float} is specified,
12641 functions in @file{libgcc.a} are used to perform floating-point
12642 operations. Unless they are replaced by routines that emulate the
12643 floating-point operations, or compiled in such a way as to call such
12644 emulations routines, these routines issue floating-point
12645 operations. If you are compiling for an Alpha without floating-point
12646 operations, you must ensure that the library is built so as not to call
12649 Note that Alpha implementations without floating-point operations are
12650 required to have floating-point registers.
12653 @itemx -mno-fp-regs
12655 @opindex mno-fp-regs
12656 Generate code that uses (does not use) the floating-point register set.
12657 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
12658 register set is not used, floating-point operands are passed in integer
12659 registers as if they were integers and floating-point results are passed
12660 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
12661 so any function with a floating-point argument or return value called by code
12662 compiled with @option{-mno-fp-regs} must also be compiled with that
12665 A typical use of this option is building a kernel that does not use,
12666 and hence need not save and restore, any floating-point registers.
12670 The Alpha architecture implements floating-point hardware optimized for
12671 maximum performance. It is mostly compliant with the IEEE floating-point
12672 standard. However, for full compliance, software assistance is
12673 required. This option generates code fully IEEE-compliant code
12674 @emph{except} that the @var{inexact-flag} is not maintained (see below).
12675 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
12676 defined during compilation. The resulting code is less efficient but is
12677 able to correctly support denormalized numbers and exceptional IEEE
12678 values such as not-a-number and plus/minus infinity. Other Alpha
12679 compilers call this option @option{-ieee_with_no_inexact}.
12681 @item -mieee-with-inexact
12682 @opindex mieee-with-inexact
12683 This is like @option{-mieee} except the generated code also maintains
12684 the IEEE @var{inexact-flag}. Turning on this option causes the
12685 generated code to implement fully-compliant IEEE math. In addition to
12686 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
12687 macro. On some Alpha implementations the resulting code may execute
12688 significantly slower than the code generated by default. Since there is
12689 very little code that depends on the @var{inexact-flag}, you should
12690 normally not specify this option. Other Alpha compilers call this
12691 option @option{-ieee_with_inexact}.
12693 @item -mfp-trap-mode=@var{trap-mode}
12694 @opindex mfp-trap-mode
12695 This option controls what floating-point related traps are enabled.
12696 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
12697 The trap mode can be set to one of four values:
12701 This is the default (normal) setting. The only traps that are enabled
12702 are the ones that cannot be disabled in software (e.g., division by zero
12706 In addition to the traps enabled by @samp{n}, underflow traps are enabled
12710 Like @samp{u}, but the instructions are marked to be safe for software
12711 completion (see Alpha architecture manual for details).
12714 Like @samp{su}, but inexact traps are enabled as well.
12717 @item -mfp-rounding-mode=@var{rounding-mode}
12718 @opindex mfp-rounding-mode
12719 Selects the IEEE rounding mode. Other Alpha compilers call this option
12720 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
12725 Normal IEEE rounding mode. Floating-point numbers are rounded towards
12726 the nearest machine number or towards the even machine number in case
12730 Round towards minus infinity.
12733 Chopped rounding mode. Floating-point numbers are rounded towards zero.
12736 Dynamic rounding mode. A field in the floating-point control register
12737 (@var{fpcr}, see Alpha architecture reference manual) controls the
12738 rounding mode in effect. The C library initializes this register for
12739 rounding towards plus infinity. Thus, unless your program modifies the
12740 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
12743 @item -mtrap-precision=@var{trap-precision}
12744 @opindex mtrap-precision
12745 In the Alpha architecture, floating-point traps are imprecise. This
12746 means without software assistance it is impossible to recover from a
12747 floating trap and program execution normally needs to be terminated.
12748 GCC can generate code that can assist operating system trap handlers
12749 in determining the exact location that caused a floating-point trap.
12750 Depending on the requirements of an application, different levels of
12751 precisions can be selected:
12755 Program precision. This option is the default and means a trap handler
12756 can only identify which program caused a floating-point exception.
12759 Function precision. The trap handler can determine the function that
12760 caused a floating-point exception.
12763 Instruction precision. The trap handler can determine the exact
12764 instruction that caused a floating-point exception.
12767 Other Alpha compilers provide the equivalent options called
12768 @option{-scope_safe} and @option{-resumption_safe}.
12770 @item -mieee-conformant
12771 @opindex mieee-conformant
12772 This option marks the generated code as IEEE conformant. You must not
12773 use this option unless you also specify @option{-mtrap-precision=i} and either
12774 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
12775 is to emit the line @samp{.eflag 48} in the function prologue of the
12776 generated assembly file.
12778 @item -mbuild-constants
12779 @opindex mbuild-constants
12780 Normally GCC examines a 32- or 64-bit integer constant to
12781 see if it can construct it from smaller constants in two or three
12782 instructions. If it cannot, it outputs the constant as a literal and
12783 generates code to load it from the data segment at run time.
12785 Use this option to require GCC to construct @emph{all} integer constants
12786 using code, even if it takes more instructions (the maximum is six).
12788 You typically use this option to build a shared library dynamic
12789 loader. Itself a shared library, it must relocate itself in memory
12790 before it can find the variables and constants in its own data segment.
12808 Indicate whether GCC should generate code to use the optional BWX,
12809 CIX, FIX and MAX instruction sets. The default is to use the instruction
12810 sets supported by the CPU type specified via @option{-mcpu=} option or that
12811 of the CPU on which GCC was built if none is specified.
12814 @itemx -mfloat-ieee
12815 @opindex mfloat-vax
12816 @opindex mfloat-ieee
12817 Generate code that uses (does not use) VAX F and G floating-point
12818 arithmetic instead of IEEE single and double precision.
12820 @item -mexplicit-relocs
12821 @itemx -mno-explicit-relocs
12822 @opindex mexplicit-relocs
12823 @opindex mno-explicit-relocs
12824 Older Alpha assemblers provided no way to generate symbol relocations
12825 except via assembler macros. Use of these macros does not allow
12826 optimal instruction scheduling. GNU binutils as of version 2.12
12827 supports a new syntax that allows the compiler to explicitly mark
12828 which relocations should apply to which instructions. This option
12829 is mostly useful for debugging, as GCC detects the capabilities of
12830 the assembler when it is built and sets the default accordingly.
12833 @itemx -mlarge-data
12834 @opindex msmall-data
12835 @opindex mlarge-data
12836 When @option{-mexplicit-relocs} is in effect, static data is
12837 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
12838 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
12839 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
12840 16-bit relocations off of the @code{$gp} register. This limits the
12841 size of the small data area to 64KB, but allows the variables to be
12842 directly accessed via a single instruction.
12844 The default is @option{-mlarge-data}. With this option the data area
12845 is limited to just below 2GB@. Programs that require more than 2GB of
12846 data must use @code{malloc} or @code{mmap} to allocate the data in the
12847 heap instead of in the program's data segment.
12849 When generating code for shared libraries, @option{-fpic} implies
12850 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
12853 @itemx -mlarge-text
12854 @opindex msmall-text
12855 @opindex mlarge-text
12856 When @option{-msmall-text} is used, the compiler assumes that the
12857 code of the entire program (or shared library) fits in 4MB, and is
12858 thus reachable with a branch instruction. When @option{-msmall-data}
12859 is used, the compiler can assume that all local symbols share the
12860 same @code{$gp} value, and thus reduce the number of instructions
12861 required for a function call from 4 to 1.
12863 The default is @option{-mlarge-text}.
12865 @item -mcpu=@var{cpu_type}
12867 Set the instruction set and instruction scheduling parameters for
12868 machine type @var{cpu_type}. You can specify either the @samp{EV}
12869 style name or the corresponding chip number. GCC supports scheduling
12870 parameters for the EV4, EV5 and EV6 family of processors and
12871 chooses the default values for the instruction set from the processor
12872 you specify. If you do not specify a processor type, GCC defaults
12873 to the processor on which the compiler was built.
12875 Supported values for @var{cpu_type} are
12881 Schedules as an EV4 and has no instruction set extensions.
12885 Schedules as an EV5 and has no instruction set extensions.
12889 Schedules as an EV5 and supports the BWX extension.
12894 Schedules as an EV5 and supports the BWX and MAX extensions.
12898 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
12902 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
12905 Native toolchains also support the value @samp{native},
12906 which selects the best architecture option for the host processor.
12907 @option{-mcpu=native} has no effect if GCC does not recognize
12910 @item -mtune=@var{cpu_type}
12912 Set only the instruction scheduling parameters for machine type
12913 @var{cpu_type}. The instruction set is not changed.
12915 Native toolchains also support the value @samp{native},
12916 which selects the best architecture option for the host processor.
12917 @option{-mtune=native} has no effect if GCC does not recognize
12920 @item -mmemory-latency=@var{time}
12921 @opindex mmemory-latency
12922 Sets the latency the scheduler should assume for typical memory
12923 references as seen by the application. This number is highly
12924 dependent on the memory access patterns used by the application
12925 and the size of the external cache on the machine.
12927 Valid options for @var{time} are
12931 A decimal number representing clock cycles.
12937 The compiler contains estimates of the number of clock cycles for
12938 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
12939 (also called Dcache, Scache, and Bcache), as well as to main memory.
12940 Note that L3 is only valid for EV5.
12946 @subsection FR30 Options
12947 @cindex FR30 Options
12949 These options are defined specifically for the FR30 port.
12953 @item -msmall-model
12954 @opindex msmall-model
12955 Use the small address space model. This can produce smaller code, but
12956 it does assume that all symbolic values and addresses fit into a
12961 Assume that runtime support has been provided and so there is no need
12962 to include the simulator library (@file{libsim.a}) on the linker
12968 @subsection FRV Options
12969 @cindex FRV Options
12975 Only use the first 32 general-purpose registers.
12980 Use all 64 general-purpose registers.
12985 Use only the first 32 floating-point registers.
12990 Use all 64 floating-point registers.
12993 @opindex mhard-float
12995 Use hardware instructions for floating-point operations.
12998 @opindex msoft-float
13000 Use library routines for floating-point operations.
13005 Dynamically allocate condition code registers.
13010 Do not try to dynamically allocate condition code registers, only
13011 use @code{icc0} and @code{fcc0}.
13016 Change ABI to use double word insns.
13021 Do not use double word instructions.
13026 Use floating-point double instructions.
13029 @opindex mno-double
13031 Do not use floating-point double instructions.
13036 Use media instructions.
13041 Do not use media instructions.
13046 Use multiply and add/subtract instructions.
13049 @opindex mno-muladd
13051 Do not use multiply and add/subtract instructions.
13056 Select the FDPIC ABI, which uses function descriptors to represent
13057 pointers to functions. Without any PIC/PIE-related options, it
13058 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
13059 assumes GOT entries and small data are within a 12-bit range from the
13060 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
13061 are computed with 32 bits.
13062 With a @samp{bfin-elf} target, this option implies @option{-msim}.
13065 @opindex minline-plt
13067 Enable inlining of PLT entries in function calls to functions that are
13068 not known to bind locally. It has no effect without @option{-mfdpic}.
13069 It's enabled by default if optimizing for speed and compiling for
13070 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
13071 optimization option such as @option{-O3} or above is present in the
13077 Assume a large TLS segment when generating thread-local code.
13082 Do not assume a large TLS segment when generating thread-local code.
13087 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
13088 that is known to be in read-only sections. It's enabled by default,
13089 except for @option{-fpic} or @option{-fpie}: even though it may help
13090 make the global offset table smaller, it trades 1 instruction for 4.
13091 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
13092 one of which may be shared by multiple symbols, and it avoids the need
13093 for a GOT entry for the referenced symbol, so it's more likely to be a
13094 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
13096 @item -multilib-library-pic
13097 @opindex multilib-library-pic
13099 Link with the (library, not FD) pic libraries. It's implied by
13100 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
13101 @option{-fpic} without @option{-mfdpic}. You should never have to use
13105 @opindex mlinked-fp
13107 Follow the EABI requirement of always creating a frame pointer whenever
13108 a stack frame is allocated. This option is enabled by default and can
13109 be disabled with @option{-mno-linked-fp}.
13112 @opindex mlong-calls
13114 Use indirect addressing to call functions outside the current
13115 compilation unit. This allows the functions to be placed anywhere
13116 within the 32-bit address space.
13118 @item -malign-labels
13119 @opindex malign-labels
13121 Try to align labels to an 8-byte boundary by inserting NOPs into the
13122 previous packet. This option only has an effect when VLIW packing
13123 is enabled. It doesn't create new packets; it merely adds NOPs to
13126 @item -mlibrary-pic
13127 @opindex mlibrary-pic
13129 Generate position-independent EABI code.
13134 Use only the first four media accumulator registers.
13139 Use all eight media accumulator registers.
13144 Pack VLIW instructions.
13149 Do not pack VLIW instructions.
13152 @opindex mno-eflags
13154 Do not mark ABI switches in e_flags.
13157 @opindex mcond-move
13159 Enable the use of conditional-move instructions (default).
13161 This switch is mainly for debugging the compiler and will likely be removed
13162 in a future version.
13164 @item -mno-cond-move
13165 @opindex mno-cond-move
13167 Disable the use of conditional-move instructions.
13169 This switch is mainly for debugging the compiler and will likely be removed
13170 in a future version.
13175 Enable the use of conditional set instructions (default).
13177 This switch is mainly for debugging the compiler and will likely be removed
13178 in a future version.
13183 Disable the use of conditional set instructions.
13185 This switch is mainly for debugging the compiler and will likely be removed
13186 in a future version.
13189 @opindex mcond-exec
13191 Enable the use of conditional execution (default).
13193 This switch is mainly for debugging the compiler and will likely be removed
13194 in a future version.
13196 @item -mno-cond-exec
13197 @opindex mno-cond-exec
13199 Disable the use of conditional execution.
13201 This switch is mainly for debugging the compiler and will likely be removed
13202 in a future version.
13204 @item -mvliw-branch
13205 @opindex mvliw-branch
13207 Run a pass to pack branches into VLIW instructions (default).
13209 This switch is mainly for debugging the compiler and will likely be removed
13210 in a future version.
13212 @item -mno-vliw-branch
13213 @opindex mno-vliw-branch
13215 Do not run a pass to pack branches into VLIW instructions.
13217 This switch is mainly for debugging the compiler and will likely be removed
13218 in a future version.
13220 @item -mmulti-cond-exec
13221 @opindex mmulti-cond-exec
13223 Enable optimization of @code{&&} and @code{||} in conditional execution
13226 This switch is mainly for debugging the compiler and will likely be removed
13227 in a future version.
13229 @item -mno-multi-cond-exec
13230 @opindex mno-multi-cond-exec
13232 Disable optimization of @code{&&} and @code{||} in conditional execution.
13234 This switch is mainly for debugging the compiler and will likely be removed
13235 in a future version.
13237 @item -mnested-cond-exec
13238 @opindex mnested-cond-exec
13240 Enable nested conditional execution optimizations (default).
13242 This switch is mainly for debugging the compiler and will likely be removed
13243 in a future version.
13245 @item -mno-nested-cond-exec
13246 @opindex mno-nested-cond-exec
13248 Disable nested conditional execution optimizations.
13250 This switch is mainly for debugging the compiler and will likely be removed
13251 in a future version.
13253 @item -moptimize-membar
13254 @opindex moptimize-membar
13256 This switch removes redundant @code{membar} instructions from the
13257 compiler-generated code. It is enabled by default.
13259 @item -mno-optimize-membar
13260 @opindex mno-optimize-membar
13262 This switch disables the automatic removal of redundant @code{membar}
13263 instructions from the generated code.
13265 @item -mtomcat-stats
13266 @opindex mtomcat-stats
13268 Cause gas to print out tomcat statistics.
13270 @item -mcpu=@var{cpu}
13273 Select the processor type for which to generate code. Possible values are
13274 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
13275 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
13279 @node GNU/Linux Options
13280 @subsection GNU/Linux Options
13282 These @samp{-m} options are defined for GNU/Linux targets:
13287 Use the GNU C library. This is the default except
13288 on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
13292 Use uClibc C library. This is the default on
13293 @samp{*-*-linux-*uclibc*} targets.
13297 Use Bionic C library. This is the default on
13298 @samp{*-*-linux-*android*} targets.
13302 Compile code compatible with Android platform. This is the default on
13303 @samp{*-*-linux-*android*} targets.
13305 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
13306 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
13307 this option makes the GCC driver pass Android-specific options to the linker.
13308 Finally, this option causes the preprocessor macro @code{__ANDROID__}
13311 @item -tno-android-cc
13312 @opindex tno-android-cc
13313 Disable compilation effects of @option{-mandroid}, i.e., do not enable
13314 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
13315 @option{-fno-rtti} by default.
13317 @item -tno-android-ld
13318 @opindex tno-android-ld
13319 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
13320 linking options to the linker.
13324 @node H8/300 Options
13325 @subsection H8/300 Options
13327 These @samp{-m} options are defined for the H8/300 implementations:
13332 Shorten some address references at link time, when possible; uses the
13333 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
13334 ld, Using ld}, for a fuller description.
13338 Generate code for the H8/300H@.
13342 Generate code for the H8S@.
13346 Generate code for the H8S and H8/300H in the normal mode. This switch
13347 must be used either with @option{-mh} or @option{-ms}.
13351 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
13355 Extended registers are stored on stack before execution of function
13356 with monitor attribute. Default option is @option{-mexr}.
13357 This option is valid only for H8S targets.
13361 Extended registers are not stored on stack before execution of function
13362 with monitor attribute. Default option is @option{-mno-exr}.
13363 This option is valid only for H8S targets.
13367 Make @code{int} data 32 bits by default.
13370 @opindex malign-300
13371 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
13372 The default for the H8/300H and H8S is to align longs and floats on
13374 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
13375 This option has no effect on the H8/300.
13379 @subsection HPPA Options
13380 @cindex HPPA Options
13382 These @samp{-m} options are defined for the HPPA family of computers:
13385 @item -march=@var{architecture-type}
13387 Generate code for the specified architecture. The choices for
13388 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
13389 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
13390 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
13391 architecture option for your machine. Code compiled for lower numbered
13392 architectures runs on higher numbered architectures, but not the
13395 @item -mpa-risc-1-0
13396 @itemx -mpa-risc-1-1
13397 @itemx -mpa-risc-2-0
13398 @opindex mpa-risc-1-0
13399 @opindex mpa-risc-1-1
13400 @opindex mpa-risc-2-0
13401 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
13404 @opindex mbig-switch
13405 Generate code suitable for big switch tables. Use this option only if
13406 the assembler/linker complain about out-of-range branches within a switch
13409 @item -mjump-in-delay
13410 @opindex mjump-in-delay
13411 Fill delay slots of function calls with unconditional jump instructions
13412 by modifying the return pointer for the function call to be the target
13413 of the conditional jump.
13415 @item -mdisable-fpregs
13416 @opindex mdisable-fpregs
13417 Prevent floating-point registers from being used in any manner. This is
13418 necessary for compiling kernels that perform lazy context switching of
13419 floating-point registers. If you use this option and attempt to perform
13420 floating-point operations, the compiler aborts.
13422 @item -mdisable-indexing
13423 @opindex mdisable-indexing
13424 Prevent the compiler from using indexing address modes. This avoids some
13425 rather obscure problems when compiling MIG generated code under MACH@.
13427 @item -mno-space-regs
13428 @opindex mno-space-regs
13429 Generate code that assumes the target has no space registers. This allows
13430 GCC to generate faster indirect calls and use unscaled index address modes.
13432 Such code is suitable for level 0 PA systems and kernels.
13434 @item -mfast-indirect-calls
13435 @opindex mfast-indirect-calls
13436 Generate code that assumes calls never cross space boundaries. This
13437 allows GCC to emit code that performs faster indirect calls.
13439 This option does not work in the presence of shared libraries or nested
13442 @item -mfixed-range=@var{register-range}
13443 @opindex mfixed-range
13444 Generate code treating the given register range as fixed registers.
13445 A fixed register is one that the register allocator cannot use. This is
13446 useful when compiling kernel code. A register range is specified as
13447 two registers separated by a dash. Multiple register ranges can be
13448 specified separated by a comma.
13450 @item -mlong-load-store
13451 @opindex mlong-load-store
13452 Generate 3-instruction load and store sequences as sometimes required by
13453 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
13456 @item -mportable-runtime
13457 @opindex mportable-runtime
13458 Use the portable calling conventions proposed by HP for ELF systems.
13462 Enable the use of assembler directives only GAS understands.
13464 @item -mschedule=@var{cpu-type}
13466 Schedule code according to the constraints for the machine type
13467 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
13468 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
13469 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
13470 proper scheduling option for your machine. The default scheduling is
13474 @opindex mlinker-opt
13475 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
13476 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
13477 linkers in which they give bogus error messages when linking some programs.
13480 @opindex msoft-float
13481 Generate output containing library calls for floating point.
13482 @strong{Warning:} the requisite libraries are not available for all HPPA
13483 targets. Normally the facilities of the machine's usual C compiler are
13484 used, but this cannot be done directly in cross-compilation. You must make
13485 your own arrangements to provide suitable library functions for
13488 @option{-msoft-float} changes the calling convention in the output file;
13489 therefore, it is only useful if you compile @emph{all} of a program with
13490 this option. In particular, you need to compile @file{libgcc.a}, the
13491 library that comes with GCC, with @option{-msoft-float} in order for
13496 Generate the predefine, @code{_SIO}, for server IO@. The default is
13497 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
13498 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
13499 options are available under HP-UX and HI-UX@.
13503 Use options specific to GNU @command{ld}.
13504 This passes @option{-shared} to @command{ld} when
13505 building a shared library. It is the default when GCC is configured,
13506 explicitly or implicitly, with the GNU linker. This option does not
13507 affect which @command{ld} is called; it only changes what parameters
13508 are passed to that @command{ld}.
13509 The @command{ld} that is called is determined by the
13510 @option{--with-ld} configure option, GCC's program search path, and
13511 finally by the user's @env{PATH}. The linker used by GCC can be printed
13512 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
13513 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
13517 Use options specific to HP @command{ld}.
13518 This passes @option{-b} to @command{ld} when building
13519 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
13520 links. It is the default when GCC is configured, explicitly or
13521 implicitly, with the HP linker. This option does not affect
13522 which @command{ld} is called; it only changes what parameters are passed to that
13524 The @command{ld} that is called is determined by the @option{--with-ld}
13525 configure option, GCC's program search path, and finally by the user's
13526 @env{PATH}. The linker used by GCC can be printed using @samp{which
13527 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
13528 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
13531 @opindex mno-long-calls
13532 Generate code that uses long call sequences. This ensures that a call
13533 is always able to reach linker generated stubs. The default is to generate
13534 long calls only when the distance from the call site to the beginning
13535 of the function or translation unit, as the case may be, exceeds a
13536 predefined limit set by the branch type being used. The limits for
13537 normal calls are 7,600,000 and 240,000 bytes, respectively for the
13538 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
13541 Distances are measured from the beginning of functions when using the
13542 @option{-ffunction-sections} option, or when using the @option{-mgas}
13543 and @option{-mno-portable-runtime} options together under HP-UX with
13546 It is normally not desirable to use this option as it degrades
13547 performance. However, it may be useful in large applications,
13548 particularly when partial linking is used to build the application.
13550 The types of long calls used depends on the capabilities of the
13551 assembler and linker, and the type of code being generated. The
13552 impact on systems that support long absolute calls, and long pic
13553 symbol-difference or pc-relative calls should be relatively small.
13554 However, an indirect call is used on 32-bit ELF systems in pic code
13555 and it is quite long.
13557 @item -munix=@var{unix-std}
13559 Generate compiler predefines and select a startfile for the specified
13560 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
13561 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
13562 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
13563 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
13564 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
13567 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
13568 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
13569 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
13570 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
13571 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
13572 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
13574 It is @emph{important} to note that this option changes the interfaces
13575 for various library routines. It also affects the operational behavior
13576 of the C library. Thus, @emph{extreme} care is needed in using this
13579 Library code that is intended to operate with more than one UNIX
13580 standard must test, set and restore the variable @var{__xpg4_extended_mask}
13581 as appropriate. Most GNU software doesn't provide this capability.
13585 Suppress the generation of link options to search libdld.sl when the
13586 @option{-static} option is specified on HP-UX 10 and later.
13590 The HP-UX implementation of setlocale in libc has a dependency on
13591 libdld.sl. There isn't an archive version of libdld.sl. Thus,
13592 when the @option{-static} option is specified, special link options
13593 are needed to resolve this dependency.
13595 On HP-UX 10 and later, the GCC driver adds the necessary options to
13596 link with libdld.sl when the @option{-static} option is specified.
13597 This causes the resulting binary to be dynamic. On the 64-bit port,
13598 the linkers generate dynamic binaries by default in any case. The
13599 @option{-nolibdld} option can be used to prevent the GCC driver from
13600 adding these link options.
13604 Add support for multithreading with the @dfn{dce thread} library
13605 under HP-UX@. This option sets flags for both the preprocessor and
13609 @node i386 and x86-64 Options
13610 @subsection Intel 386 and AMD x86-64 Options
13611 @cindex i386 Options
13612 @cindex x86-64 Options
13613 @cindex Intel 386 Options
13614 @cindex AMD x86-64 Options
13616 These @samp{-m} options are defined for the i386 and x86-64 family of
13621 @item -march=@var{cpu-type}
13623 Generate instructions for the machine type @var{cpu-type}. In contrast to
13624 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
13625 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
13626 to generate code that may not run at all on processors other than the one
13627 indicated. Specifying @option{-march=@var{cpu-type}} implies
13628 @option{-mtune=@var{cpu-type}}.
13630 The choices for @var{cpu-type} are:
13634 This selects the CPU to generate code for at compilation time by determining
13635 the processor type of the compiling machine. Using @option{-march=native}
13636 enables all instruction subsets supported by the local machine (hence
13637 the result might not run on different machines). Using @option{-mtune=native}
13638 produces code optimized for the local machine under the constraints
13639 of the selected instruction set.
13642 Original Intel i386 CPU@.
13645 Intel i486 CPU@. (No scheduling is implemented for this chip.)
13649 Intel Pentium CPU with no MMX support.
13652 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
13655 Intel Pentium Pro CPU@.
13658 When used with @option{-march}, the Pentium Pro
13659 instruction set is used, so the code runs on all i686 family chips.
13660 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
13663 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
13668 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
13672 Intel Pentium M; low-power version of Intel Pentium III CPU
13673 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
13677 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
13680 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
13684 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
13685 SSE2 and SSE3 instruction set support.
13688 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
13689 instruction set support.
13692 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
13693 and SSE4.2 instruction set support.
13696 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
13697 SSE4.1, SSE4.2, AVX, AES and PCLMUL instruction set support.
13700 Intel Core CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
13701 SSE4.1, SSE4.2, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction
13705 Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
13706 instruction set support.
13709 AMD K6 CPU with MMX instruction set support.
13713 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
13716 @itemx athlon-tbird
13717 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
13723 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
13724 instruction set support.
13730 Processors based on the AMD K8 core with x86-64 instruction set support,
13731 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
13732 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
13733 instruction set extensions.)
13736 @itemx opteron-sse3
13737 @itemx athlon64-sse3
13738 Improved versions of AMD K8 cores with SSE3 instruction set support.
13742 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
13743 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
13744 instruction set extensions.)
13747 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
13748 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
13749 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
13751 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
13752 supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE,
13753 SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
13756 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
13757 supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE,
13758 SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
13762 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
13763 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
13764 instruction set extensions.)
13767 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
13768 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
13769 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
13772 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
13776 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
13777 instruction set support.
13780 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
13781 implemented for this chip.)
13784 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
13786 implemented for this chip.)
13789 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
13792 @item -mtune=@var{cpu-type}
13794 Tune to @var{cpu-type} everything applicable about the generated code, except
13795 for the ABI and the set of available instructions.
13796 While picking a specific @var{cpu-type} schedules things appropriately
13797 for that particular chip, the compiler does not generate any code that
13798 cannot run on the default machine type unless you use a
13799 @option{-march=@var{cpu-type}} option.
13800 For example, if GCC is configured for i686-pc-linux-gnu
13801 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
13802 but still runs on i686 machines.
13804 The choices for @var{cpu-type} are the same as for @option{-march}.
13805 In addition, @option{-mtune} supports an extra choice for @var{cpu-type}:
13809 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
13810 If you know the CPU on which your code will run, then you should use
13811 the corresponding @option{-mtune} or @option{-march} option instead of
13812 @option{-mtune=generic}. But, if you do not know exactly what CPU users
13813 of your application will have, then you should use this option.
13815 As new processors are deployed in the marketplace, the behavior of this
13816 option will change. Therefore, if you upgrade to a newer version of
13817 GCC, code generation controlled by this option will change to reflect
13819 that are most common at the time that version of GCC is released.
13821 There is no @option{-march=generic} option because @option{-march}
13822 indicates the instruction set the compiler can use, and there is no
13823 generic instruction set applicable to all processors. In contrast,
13824 @option{-mtune} indicates the processor (or, in this case, collection of
13825 processors) for which the code is optimized.
13828 @item -mcpu=@var{cpu-type}
13830 A deprecated synonym for @option{-mtune}.
13832 @item -mfpmath=@var{unit}
13834 Generate floating-point arithmetic for selected unit @var{unit}. The choices
13835 for @var{unit} are:
13839 Use the standard 387 floating-point coprocessor present on the majority of chips and
13840 emulated otherwise. Code compiled with this option runs almost everywhere.
13841 The temporary results are computed in 80-bit precision instead of the precision
13842 specified by the type, resulting in slightly different results compared to most
13843 of other chips. See @option{-ffloat-store} for more detailed description.
13845 This is the default choice for i386 compiler.
13848 Use scalar floating-point instructions present in the SSE instruction set.
13849 This instruction set is supported by Pentium III and newer chips,
13850 and in the AMD line
13851 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
13852 instruction set supports only single-precision arithmetic, thus the double and
13853 extended-precision arithmetic are still done using 387. A later version, present
13854 only in Pentium 4 and AMD x86-64 chips, supports double-precision
13857 For the i386 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
13858 or @option{-msse2} switches to enable SSE extensions and make this option
13859 effective. For the x86-64 compiler, these extensions are enabled by default.
13861 The resulting code should be considerably faster in the majority of cases and avoid
13862 the numerical instability problems of 387 code, but may break some existing
13863 code that expects temporaries to be 80 bits.
13865 This is the default choice for the x86-64 compiler.
13870 Attempt to utilize both instruction sets at once. This effectively doubles the
13871 amount of available registers, and on chips with separate execution units for
13872 387 and SSE the execution resources too. Use this option with care, as it is
13873 still experimental, because the GCC register allocator does not model separate
13874 functional units well, resulting in unstable performance.
13877 @item -masm=@var{dialect}
13878 @opindex masm=@var{dialect}
13879 Output assembly instructions using selected @var{dialect}. Supported
13880 choices are @samp{intel} or @samp{att} (the default). Darwin does
13881 not support @samp{intel}.
13884 @itemx -mno-ieee-fp
13886 @opindex mno-ieee-fp
13887 Control whether or not the compiler uses IEEE floating-point
13888 comparisons. These correctly handle the case where the result of a
13889 comparison is unordered.
13892 @opindex msoft-float
13893 Generate output containing library calls for floating point.
13895 @strong{Warning:} the requisite libraries are not part of GCC@.
13896 Normally the facilities of the machine's usual C compiler are used, but
13897 this can't be done directly in cross-compilation. You must make your
13898 own arrangements to provide suitable library functions for
13901 On machines where a function returns floating-point results in the 80387
13902 register stack, some floating-point opcodes may be emitted even if
13903 @option{-msoft-float} is used.
13905 @item -mno-fp-ret-in-387
13906 @opindex mno-fp-ret-in-387
13907 Do not use the FPU registers for return values of functions.
13909 The usual calling convention has functions return values of types
13910 @code{float} and @code{double} in an FPU register, even if there
13911 is no FPU@. The idea is that the operating system should emulate
13914 The option @option{-mno-fp-ret-in-387} causes such values to be returned
13915 in ordinary CPU registers instead.
13917 @item -mno-fancy-math-387
13918 @opindex mno-fancy-math-387
13919 Some 387 emulators do not support the @code{sin}, @code{cos} and
13920 @code{sqrt} instructions for the 387. Specify this option to avoid
13921 generating those instructions. This option is the default on FreeBSD,
13922 OpenBSD and NetBSD@. This option is overridden when @option{-march}
13923 indicates that the target CPU always has an FPU and so the
13924 instruction does not need emulation. These
13925 instructions are not generated unless you also use the
13926 @option{-funsafe-math-optimizations} switch.
13928 @item -malign-double
13929 @itemx -mno-align-double
13930 @opindex malign-double
13931 @opindex mno-align-double
13932 Control whether GCC aligns @code{double}, @code{long double}, and
13933 @code{long long} variables on a two-word boundary or a one-word
13934 boundary. Aligning @code{double} variables on a two-word boundary
13935 produces code that runs somewhat faster on a Pentium at the
13936 expense of more memory.
13938 On x86-64, @option{-malign-double} is enabled by default.
13940 @strong{Warning:} if you use the @option{-malign-double} switch,
13941 structures containing the above types are aligned differently than
13942 the published application binary interface specifications for the 386
13943 and are not binary compatible with structures in code compiled
13944 without that switch.
13946 @item -m96bit-long-double
13947 @itemx -m128bit-long-double
13948 @opindex m96bit-long-double
13949 @opindex m128bit-long-double
13950 These switches control the size of @code{long double} type. The i386
13951 application binary interface specifies the size to be 96 bits,
13952 so @option{-m96bit-long-double} is the default in 32-bit mode.
13954 Modern architectures (Pentium and newer) prefer @code{long double}
13955 to be aligned to an 8- or 16-byte boundary. In arrays or structures
13956 conforming to the ABI, this is not possible. So specifying
13957 @option{-m128bit-long-double} aligns @code{long double}
13958 to a 16-byte boundary by padding the @code{long double} with an additional
13961 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
13962 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
13964 Notice that neither of these options enable any extra precision over the x87
13965 standard of 80 bits for a @code{long double}.
13967 @strong{Warning:} if you override the default value for your target ABI, this
13968 changes the size of
13969 structures and arrays containing @code{long double} variables,
13970 as well as modifying the function calling convention for functions taking
13971 @code{long double}. Hence they are not binary-compatible
13972 with code compiled without that switch.
13974 @item -mlong-double-64
13975 @itemx -mlong-double-80
13976 @opindex mlong-double-64
13977 @opindex mlong-double-80
13978 These switches control the size of @code{long double} type. A size
13979 of 64 bits makes the @code{long double} type equivalent to the @code{double}
13980 type. This is the default for Bionic C library.
13982 @strong{Warning:} if you override the default value for your target ABI, this
13983 changes the size of
13984 structures and arrays containing @code{long double} variables,
13985 as well as modifying the function calling convention for functions taking
13986 @code{long double}. Hence they are not binary-compatible
13987 with code compiled without that switch.
13989 @item -mlarge-data-threshold=@var{threshold}
13990 @opindex mlarge-data-threshold
13991 When @option{-mcmodel=medium} is specified, data objects larger than
13992 @var{threshold} are placed in the large data section. This value must be the
13993 same across all objects linked into the binary, and defaults to 65535.
13997 Use a different function-calling convention, in which functions that
13998 take a fixed number of arguments return with the @code{ret @var{num}}
13999 instruction, which pops their arguments while returning. This saves one
14000 instruction in the caller since there is no need to pop the arguments
14003 You can specify that an individual function is called with this calling
14004 sequence with the function attribute @samp{stdcall}. You can also
14005 override the @option{-mrtd} option by using the function attribute
14006 @samp{cdecl}. @xref{Function Attributes}.
14008 @strong{Warning:} this calling convention is incompatible with the one
14009 normally used on Unix, so you cannot use it if you need to call
14010 libraries compiled with the Unix compiler.
14012 Also, you must provide function prototypes for all functions that
14013 take variable numbers of arguments (including @code{printf});
14014 otherwise incorrect code is generated for calls to those
14017 In addition, seriously incorrect code results if you call a
14018 function with too many arguments. (Normally, extra arguments are
14019 harmlessly ignored.)
14021 @item -mregparm=@var{num}
14023 Control how many registers are used to pass integer arguments. By
14024 default, no registers are used to pass arguments, and at most 3
14025 registers can be used. You can control this behavior for a specific
14026 function by using the function attribute @samp{regparm}.
14027 @xref{Function Attributes}.
14029 @strong{Warning:} if you use this switch, and
14030 @var{num} is nonzero, then you must build all modules with the same
14031 value, including any libraries. This includes the system libraries and
14035 @opindex msseregparm
14036 Use SSE register passing conventions for float and double arguments
14037 and return values. You can control this behavior for a specific
14038 function by using the function attribute @samp{sseregparm}.
14039 @xref{Function Attributes}.
14041 @strong{Warning:} if you use this switch then you must build all
14042 modules with the same value, including any libraries. This includes
14043 the system libraries and startup modules.
14045 @item -mvect8-ret-in-mem
14046 @opindex mvect8-ret-in-mem
14047 Return 8-byte vectors in memory instead of MMX registers. This is the
14048 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
14049 Studio compilers until version 12. Later compiler versions (starting
14050 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
14051 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
14052 you need to remain compatible with existing code produced by those
14053 previous compiler versions or older versions of GCC@.
14062 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
14063 is specified, the significands of results of floating-point operations are
14064 rounded to 24 bits (single precision); @option{-mpc64} rounds the
14065 significands of results of floating-point operations to 53 bits (double
14066 precision) and @option{-mpc80} rounds the significands of results of
14067 floating-point operations to 64 bits (extended double precision), which is
14068 the default. When this option is used, floating-point operations in higher
14069 precisions are not available to the programmer without setting the FPU
14070 control word explicitly.
14072 Setting the rounding of floating-point operations to less than the default
14073 80 bits can speed some programs by 2% or more. Note that some mathematical
14074 libraries assume that extended-precision (80-bit) floating-point operations
14075 are enabled by default; routines in such libraries could suffer significant
14076 loss of accuracy, typically through so-called ``catastrophic cancellation'',
14077 when this option is used to set the precision to less than extended precision.
14079 @item -mstackrealign
14080 @opindex mstackrealign
14081 Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
14082 option generates an alternate prologue and epilogue that realigns the
14083 run-time stack if necessary. This supports mixing legacy codes that keep
14084 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
14085 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
14086 applicable to individual functions.
14088 @item -mpreferred-stack-boundary=@var{num}
14089 @opindex mpreferred-stack-boundary
14090 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
14091 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
14092 the default is 4 (16 bytes or 128 bits).
14094 @strong{Warning:} When generating code for the x86-64 architecture with
14095 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
14096 used to keep the stack boundary aligned to 8 byte boundary. Since
14097 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
14098 intended to be used in controlled environment where stack space is
14099 important limitation. This option will lead to wrong code when functions
14100 compiled with 16 byte stack alignment (such as functions from a standard
14101 library) are called with misaligned stack. In this case, SSE
14102 instructions may lead to misaligned memory access traps. In addition,
14103 variable arguments will be handled incorrectly for 16 byte aligned
14104 objects (including x87 long double and __int128), leading to wrong
14105 results. You must build all modules with
14106 @option{-mpreferred-stack-boundary=3}, including any libraries. This
14107 includes the system libraries and startup modules.
14109 @item -mincoming-stack-boundary=@var{num}
14110 @opindex mincoming-stack-boundary
14111 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
14112 boundary. If @option{-mincoming-stack-boundary} is not specified,
14113 the one specified by @option{-mpreferred-stack-boundary} is used.
14115 On Pentium and Pentium Pro, @code{double} and @code{long double} values
14116 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
14117 suffer significant run time performance penalties. On Pentium III, the
14118 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
14119 properly if it is not 16-byte aligned.
14121 To ensure proper alignment of this values on the stack, the stack boundary
14122 must be as aligned as that required by any value stored on the stack.
14123 Further, every function must be generated such that it keeps the stack
14124 aligned. Thus calling a function compiled with a higher preferred
14125 stack boundary from a function compiled with a lower preferred stack
14126 boundary most likely misaligns the stack. It is recommended that
14127 libraries that use callbacks always use the default setting.
14129 This extra alignment does consume extra stack space, and generally
14130 increases code size. Code that is sensitive to stack space usage, such
14131 as embedded systems and operating system kernels, may want to reduce the
14132 preferred alignment to @option{-mpreferred-stack-boundary=2}.
14161 @itemx -mno-fsgsbase
14198 These switches enable or disable the use of instructions in the MMX, SSE,
14199 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, F16C,
14200 FMA, SSE4A, FMA4, XOP, LWP, ABM, BMI, BMI2, LZCNT, RTM or 3DNow!@:
14201 extended instruction sets.
14202 These extensions are also available as built-in functions: see
14203 @ref{X86 Built-in Functions}, for details of the functions enabled and
14204 disabled by these switches.
14206 To generate SSE/SSE2 instructions automatically from floating-point
14207 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
14209 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
14210 generates new AVX instructions or AVX equivalence for all SSEx instructions
14213 These options enable GCC to use these extended instructions in
14214 generated code, even without @option{-mfpmath=sse}. Applications that
14215 perform run-time CPU detection must compile separate files for each
14216 supported architecture, using the appropriate flags. In particular,
14217 the file containing the CPU detection code should be compiled without
14222 This option instructs GCC to emit a @code{cld} instruction in the prologue
14223 of functions that use string instructions. String instructions depend on
14224 the DF flag to select between autoincrement or autodecrement mode. While the
14225 ABI specifies the DF flag to be cleared on function entry, some operating
14226 systems violate this specification by not clearing the DF flag in their
14227 exception dispatchers. The exception handler can be invoked with the DF flag
14228 set, which leads to wrong direction mode when string instructions are used.
14229 This option can be enabled by default on 32-bit x86 targets by configuring
14230 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
14231 instructions can be suppressed with the @option{-mno-cld} compiler option
14235 @opindex mvzeroupper
14236 This option instructs GCC to emit a @code{vzeroupper} instruction
14237 before a transfer of control flow out of the function to minimize
14238 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
14241 @item -mprefer-avx128
14242 @opindex mprefer-avx128
14243 This option instructs GCC to use 128-bit AVX instructions instead of
14244 256-bit AVX instructions in the auto-vectorizer.
14248 This option enables GCC to generate @code{CMPXCHG16B} instructions.
14249 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
14250 (or oword) data types.
14251 This is useful for high-resolution counters that can be updated
14252 by multiple processors (or cores). This instruction is generated as part of
14253 atomic built-in functions: see @ref{__sync Builtins} or
14254 @ref{__atomic Builtins} for details.
14258 This option enables generation of @code{SAHF} instructions in 64-bit code.
14259 Early Intel Pentium 4 CPUs with Intel 64 support,
14260 prior to the introduction of Pentium 4 G1 step in December 2005,
14261 lacked the @code{LAHF} and @code{SAHF} instructions
14262 which were supported by AMD64.
14263 These are load and store instructions, respectively, for certain status flags.
14264 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
14265 @code{drem}, and @code{remainder} built-in functions;
14266 see @ref{Other Builtins} for details.
14270 This option enables use of the @code{movbe} instruction to implement
14271 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
14275 This option enables built-in functions @code{__builtin_ia32_crc32qi},
14276 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
14277 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
14281 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
14282 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
14283 with an additional Newton-Raphson step
14284 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
14285 (and their vectorized
14286 variants) for single-precision floating-point arguments. These instructions
14287 are generated only when @option{-funsafe-math-optimizations} is enabled
14288 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
14289 Note that while the throughput of the sequence is higher than the throughput
14290 of the non-reciprocal instruction, the precision of the sequence can be
14291 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
14293 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
14294 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
14295 combination), and doesn't need @option{-mrecip}.
14297 Also note that GCC emits the above sequence with additional Newton-Raphson step
14298 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
14299 already with @option{-ffast-math} (or the above option combination), and
14300 doesn't need @option{-mrecip}.
14302 @item -mrecip=@var{opt}
14303 @opindex mrecip=opt
14304 This option controls which reciprocal estimate instructions
14305 may be used. @var{opt} is a comma-separated list of options, which may
14306 be preceded by a @samp{!} to invert the option:
14310 Enable all estimate instructions.
14313 Enable the default instructions, equivalent to @option{-mrecip}.
14316 Disable all estimate instructions, equivalent to @option{-mno-recip}.
14319 Enable the approximation for scalar division.
14322 Enable the approximation for vectorized division.
14325 Enable the approximation for scalar square root.
14328 Enable the approximation for vectorized square root.
14331 So, for example, @option{-mrecip=all,!sqrt} enables
14332 all of the reciprocal approximations, except for square root.
14334 @item -mveclibabi=@var{type}
14335 @opindex mveclibabi
14336 Specifies the ABI type to use for vectorizing intrinsics using an
14337 external library. Supported values for @var{type} are @samp{svml}
14338 for the Intel short
14339 vector math library and @samp{acml} for the AMD math core library.
14340 To use this option, both @option{-ftree-vectorize} and
14341 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
14342 ABI-compatible library must be specified at link time.
14344 GCC currently emits calls to @code{vmldExp2},
14345 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
14346 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
14347 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
14348 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
14349 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
14350 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
14351 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
14352 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
14353 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
14354 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
14355 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
14356 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
14357 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
14358 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
14359 when @option{-mveclibabi=acml} is used.
14361 @item -mabi=@var{name}
14363 Generate code for the specified calling convention. Permissible values
14364 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
14365 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
14366 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
14367 You can control this behavior for a specific function by
14368 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
14369 @xref{Function Attributes}.
14371 @item -mtls-dialect=@var{type}
14372 @opindex mtls-dialect
14373 Generate code to access thread-local storage using the @samp{gnu} or
14374 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
14375 @samp{gnu2} is more efficient, but it may add compile- and run-time
14376 requirements that cannot be satisfied on all systems.
14379 @itemx -mno-push-args
14380 @opindex mpush-args
14381 @opindex mno-push-args
14382 Use PUSH operations to store outgoing parameters. This method is shorter
14383 and usually equally fast as method using SUB/MOV operations and is enabled
14384 by default. In some cases disabling it may improve performance because of
14385 improved scheduling and reduced dependencies.
14387 @item -maccumulate-outgoing-args
14388 @opindex maccumulate-outgoing-args
14389 If enabled, the maximum amount of space required for outgoing arguments is
14390 computed in the function prologue. This is faster on most modern CPUs
14391 because of reduced dependencies, improved scheduling and reduced stack usage
14392 when the preferred stack boundary is not equal to 2. The drawback is a notable
14393 increase in code size. This switch implies @option{-mno-push-args}.
14397 Support thread-safe exception handling on MinGW. Programs that rely
14398 on thread-safe exception handling must compile and link all code with the
14399 @option{-mthreads} option. When compiling, @option{-mthreads} defines
14400 @code{-D_MT}; when linking, it links in a special thread helper library
14401 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
14403 @item -mno-align-stringops
14404 @opindex mno-align-stringops
14405 Do not align the destination of inlined string operations. This switch reduces
14406 code size and improves performance in case the destination is already aligned,
14407 but GCC doesn't know about it.
14409 @item -minline-all-stringops
14410 @opindex minline-all-stringops
14411 By default GCC inlines string operations only when the destination is
14412 known to be aligned to least a 4-byte boundary.
14413 This enables more inlining and increases code
14414 size, but may improve performance of code that depends on fast
14415 @code{memcpy}, @code{strlen},
14416 and @code{memset} for short lengths.
14418 @item -minline-stringops-dynamically
14419 @opindex minline-stringops-dynamically
14420 For string operations of unknown size, use run-time checks with
14421 inline code for small blocks and a library call for large blocks.
14423 @item -mstringop-strategy=@var{alg}
14424 @opindex mstringop-strategy=@var{alg}
14425 Override the internal decision heuristic for the particular algorithm to use
14426 for inlining string operations. The allowed values for @var{alg} are:
14432 Expand using i386 @code{rep} prefix of the specified size.
14436 @itemx unrolled_loop
14437 Expand into an inline loop.
14440 Always use a library call.
14443 @item -momit-leaf-frame-pointer
14444 @opindex momit-leaf-frame-pointer
14445 Don't keep the frame pointer in a register for leaf functions. This
14446 avoids the instructions to save, set up, and restore frame pointers and
14447 makes an extra register available in leaf functions. The option
14448 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
14449 which might make debugging harder.
14451 @item -mtls-direct-seg-refs
14452 @itemx -mno-tls-direct-seg-refs
14453 @opindex mtls-direct-seg-refs
14454 Controls whether TLS variables may be accessed with offsets from the
14455 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
14456 or whether the thread base pointer must be added. Whether or not this
14457 is valid depends on the operating system, and whether it maps the
14458 segment to cover the entire TLS area.
14460 For systems that use the GNU C Library, the default is on.
14463 @itemx -mno-sse2avx
14465 Specify that the assembler should encode SSE instructions with VEX
14466 prefix. The option @option{-mavx} turns this on by default.
14471 If profiling is active (@option{-pg}), put the profiling
14472 counter call before the prologue.
14473 Note: On x86 architectures the attribute @code{ms_hook_prologue}
14474 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
14477 @itemx -mno-8bit-idiv
14479 On some processors, like Intel Atom, 8-bit unsigned integer divide is
14480 much faster than 32-bit/64-bit integer divide. This option generates a
14481 run-time check. If both dividend and divisor are within range of 0
14482 to 255, 8-bit unsigned integer divide is used instead of
14483 32-bit/64-bit integer divide.
14485 @item -mavx256-split-unaligned-load
14486 @itemx -mavx256-split-unaligned-store
14487 @opindex avx256-split-unaligned-load
14488 @opindex avx256-split-unaligned-store
14489 Split 32-byte AVX unaligned load and store.
14493 These @samp{-m} switches are supported in addition to the above
14494 on x86-64 processors in 64-bit environments.
14503 Generate code for a 32-bit or 64-bit environment.
14504 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
14506 generates code that runs on any i386 system.
14508 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
14509 types to 64 bits, and generates code for the x86-64 architecture.
14510 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
14511 and @option{-mdynamic-no-pic} options.
14513 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
14515 generates code for the x86-64 architecture.
14517 @item -mno-red-zone
14518 @opindex mno-red-zone
14519 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
14520 by the x86-64 ABI; it is a 128-byte area beyond the location of the
14521 stack pointer that is not modified by signal or interrupt handlers
14522 and therefore can be used for temporary data without adjusting the stack
14523 pointer. The flag @option{-mno-red-zone} disables this red zone.
14525 @item -mcmodel=small
14526 @opindex mcmodel=small
14527 Generate code for the small code model: the program and its symbols must
14528 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
14529 Programs can be statically or dynamically linked. This is the default
14532 @item -mcmodel=kernel
14533 @opindex mcmodel=kernel
14534 Generate code for the kernel code model. The kernel runs in the
14535 negative 2 GB of the address space.
14536 This model has to be used for Linux kernel code.
14538 @item -mcmodel=medium
14539 @opindex mcmodel=medium
14540 Generate code for the medium model: the program is linked in the lower 2
14541 GB of the address space. Small symbols are also placed there. Symbols
14542 with sizes larger than @option{-mlarge-data-threshold} are put into
14543 large data or BSS sections and can be located above 2GB. Programs can
14544 be statically or dynamically linked.
14546 @item -mcmodel=large
14547 @opindex mcmodel=large
14548 Generate code for the large model. This model makes no assumptions
14549 about addresses and sizes of sections.
14551 @item -maddress-mode=long
14552 @opindex maddress-mode=long
14553 Generate code for long address mode. This is only supported for 64-bit
14554 and x32 environments. It is the default address mode for 64-bit
14557 @item -maddress-mode=short
14558 @opindex maddress-mode=short
14559 Generate code for short address mode. This is only supported for 32-bit
14560 and x32 environments. It is the default address mode for 32-bit and
14564 @node i386 and x86-64 Windows Options
14565 @subsection i386 and x86-64 Windows Options
14566 @cindex i386 and x86-64 Windows Options
14568 These additional options are available for Microsoft Windows targets:
14574 specifies that a console application is to be generated, by
14575 instructing the linker to set the PE header subsystem type
14576 required for console applications.
14577 This option is available for Cygwin and MinGW targets and is
14578 enabled by default on those targets.
14582 This option is available for Cygwin and MinGW targets. It
14583 specifies that a DLL---a dynamic link library---is to be
14584 generated, enabling the selection of the required runtime
14585 startup object and entry point.
14587 @item -mnop-fun-dllimport
14588 @opindex mnop-fun-dllimport
14589 This option is available for Cygwin and MinGW targets. It
14590 specifies that the @code{dllimport} attribute should be ignored.
14594 This option is available for MinGW targets. It specifies
14595 that MinGW-specific thread support is to be used.
14599 This option is available for MinGW-w64 targets. It causes
14600 the @code{UNICODE} preprocessor macro to be predefined, and
14601 chooses Unicode-capable runtime startup code.
14605 This option is available for Cygwin and MinGW targets. It
14606 specifies that the typical Microsoft Windows predefined macros are to
14607 be set in the pre-processor, but does not influence the choice
14608 of runtime library/startup code.
14612 This option is available for Cygwin and MinGW targets. It
14613 specifies that a GUI application is to be generated by
14614 instructing the linker to set the PE header subsystem type
14617 @item -fno-set-stack-executable
14618 @opindex fno-set-stack-executable
14619 This option is available for MinGW targets. It specifies that
14620 the executable flag for the stack used by nested functions isn't
14621 set. This is necessary for binaries running in kernel mode of
14622 Microsoft Windows, as there the User32 API, which is used to set executable
14623 privileges, isn't available.
14625 @item -fwritable-relocated-rdata
14626 @opindex fno-writable-relocated-rdata
14627 This option is available for MinGW and Cygwin targets. It specifies
14628 that relocated-data in read-only section is put into .data
14629 section. This is a necessary for older runtimes not supporting
14630 modification of .rdata sections for pseudo-relocation.
14632 @item -mpe-aligned-commons
14633 @opindex mpe-aligned-commons
14634 This option is available for Cygwin and MinGW targets. It
14635 specifies that the GNU extension to the PE file format that
14636 permits the correct alignment of COMMON variables should be
14637 used when generating code. It is enabled by default if
14638 GCC detects that the target assembler found during configuration
14639 supports the feature.
14642 See also under @ref{i386 and x86-64 Options} for standard options.
14644 @node IA-64 Options
14645 @subsection IA-64 Options
14646 @cindex IA-64 Options
14648 These are the @samp{-m} options defined for the Intel IA-64 architecture.
14652 @opindex mbig-endian
14653 Generate code for a big-endian target. This is the default for HP-UX@.
14655 @item -mlittle-endian
14656 @opindex mlittle-endian
14657 Generate code for a little-endian target. This is the default for AIX5
14663 @opindex mno-gnu-as
14664 Generate (or don't) code for the GNU assembler. This is the default.
14665 @c Also, this is the default if the configure option @option{--with-gnu-as}
14671 @opindex mno-gnu-ld
14672 Generate (or don't) code for the GNU linker. This is the default.
14673 @c Also, this is the default if the configure option @option{--with-gnu-ld}
14678 Generate code that does not use a global pointer register. The result
14679 is not position independent code, and violates the IA-64 ABI@.
14681 @item -mvolatile-asm-stop
14682 @itemx -mno-volatile-asm-stop
14683 @opindex mvolatile-asm-stop
14684 @opindex mno-volatile-asm-stop
14685 Generate (or don't) a stop bit immediately before and after volatile asm
14688 @item -mregister-names
14689 @itemx -mno-register-names
14690 @opindex mregister-names
14691 @opindex mno-register-names
14692 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
14693 the stacked registers. This may make assembler output more readable.
14699 Disable (or enable) optimizations that use the small data section. This may
14700 be useful for working around optimizer bugs.
14702 @item -mconstant-gp
14703 @opindex mconstant-gp
14704 Generate code that uses a single constant global pointer value. This is
14705 useful when compiling kernel code.
14709 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
14710 This is useful when compiling firmware code.
14712 @item -minline-float-divide-min-latency
14713 @opindex minline-float-divide-min-latency
14714 Generate code for inline divides of floating-point values
14715 using the minimum latency algorithm.
14717 @item -minline-float-divide-max-throughput
14718 @opindex minline-float-divide-max-throughput
14719 Generate code for inline divides of floating-point values
14720 using the maximum throughput algorithm.
14722 @item -mno-inline-float-divide
14723 @opindex mno-inline-float-divide
14724 Do not generate inline code for divides of floating-point values.
14726 @item -minline-int-divide-min-latency
14727 @opindex minline-int-divide-min-latency
14728 Generate code for inline divides of integer values
14729 using the minimum latency algorithm.
14731 @item -minline-int-divide-max-throughput
14732 @opindex minline-int-divide-max-throughput
14733 Generate code for inline divides of integer values
14734 using the maximum throughput algorithm.
14736 @item -mno-inline-int-divide
14737 @opindex mno-inline-int-divide
14738 Do not generate inline code for divides of integer values.
14740 @item -minline-sqrt-min-latency
14741 @opindex minline-sqrt-min-latency
14742 Generate code for inline square roots
14743 using the minimum latency algorithm.
14745 @item -minline-sqrt-max-throughput
14746 @opindex minline-sqrt-max-throughput
14747 Generate code for inline square roots
14748 using the maximum throughput algorithm.
14750 @item -mno-inline-sqrt
14751 @opindex mno-inline-sqrt
14752 Do not generate inline code for @code{sqrt}.
14755 @itemx -mno-fused-madd
14756 @opindex mfused-madd
14757 @opindex mno-fused-madd
14758 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
14759 instructions. The default is to use these instructions.
14761 @item -mno-dwarf2-asm
14762 @itemx -mdwarf2-asm
14763 @opindex mno-dwarf2-asm
14764 @opindex mdwarf2-asm
14765 Don't (or do) generate assembler code for the DWARF 2 line number debugging
14766 info. This may be useful when not using the GNU assembler.
14768 @item -mearly-stop-bits
14769 @itemx -mno-early-stop-bits
14770 @opindex mearly-stop-bits
14771 @opindex mno-early-stop-bits
14772 Allow stop bits to be placed earlier than immediately preceding the
14773 instruction that triggered the stop bit. This can improve instruction
14774 scheduling, but does not always do so.
14776 @item -mfixed-range=@var{register-range}
14777 @opindex mfixed-range
14778 Generate code treating the given register range as fixed registers.
14779 A fixed register is one that the register allocator cannot use. This is
14780 useful when compiling kernel code. A register range is specified as
14781 two registers separated by a dash. Multiple register ranges can be
14782 specified separated by a comma.
14784 @item -mtls-size=@var{tls-size}
14786 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
14789 @item -mtune=@var{cpu-type}
14791 Tune the instruction scheduling for a particular CPU, Valid values are
14792 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
14793 and @samp{mckinley}.
14799 Generate code for a 32-bit or 64-bit environment.
14800 The 32-bit environment sets int, long and pointer to 32 bits.
14801 The 64-bit environment sets int to 32 bits and long and pointer
14802 to 64 bits. These are HP-UX specific flags.
14804 @item -mno-sched-br-data-spec
14805 @itemx -msched-br-data-spec
14806 @opindex mno-sched-br-data-spec
14807 @opindex msched-br-data-spec
14808 (Dis/En)able data speculative scheduling before reload.
14809 This results in generation of @code{ld.a} instructions and
14810 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
14811 The default is 'disable'.
14813 @item -msched-ar-data-spec
14814 @itemx -mno-sched-ar-data-spec
14815 @opindex msched-ar-data-spec
14816 @opindex mno-sched-ar-data-spec
14817 (En/Dis)able data speculative scheduling after reload.
14818 This results in generation of @code{ld.a} instructions and
14819 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
14820 The default is 'enable'.
14822 @item -mno-sched-control-spec
14823 @itemx -msched-control-spec
14824 @opindex mno-sched-control-spec
14825 @opindex msched-control-spec
14826 (Dis/En)able control speculative scheduling. This feature is
14827 available only during region scheduling (i.e.@: before reload).
14828 This results in generation of the @code{ld.s} instructions and
14829 the corresponding check instructions @code{chk.s}.
14830 The default is 'disable'.
14832 @item -msched-br-in-data-spec
14833 @itemx -mno-sched-br-in-data-spec
14834 @opindex msched-br-in-data-spec
14835 @opindex mno-sched-br-in-data-spec
14836 (En/Dis)able speculative scheduling of the instructions that
14837 are dependent on the data speculative loads before reload.
14838 This is effective only with @option{-msched-br-data-spec} enabled.
14839 The default is 'enable'.
14841 @item -msched-ar-in-data-spec
14842 @itemx -mno-sched-ar-in-data-spec
14843 @opindex msched-ar-in-data-spec
14844 @opindex mno-sched-ar-in-data-spec
14845 (En/Dis)able speculative scheduling of the instructions that
14846 are dependent on the data speculative loads after reload.
14847 This is effective only with @option{-msched-ar-data-spec} enabled.
14848 The default is 'enable'.
14850 @item -msched-in-control-spec
14851 @itemx -mno-sched-in-control-spec
14852 @opindex msched-in-control-spec
14853 @opindex mno-sched-in-control-spec
14854 (En/Dis)able speculative scheduling of the instructions that
14855 are dependent on the control speculative loads.
14856 This is effective only with @option{-msched-control-spec} enabled.
14857 The default is 'enable'.
14859 @item -mno-sched-prefer-non-data-spec-insns
14860 @itemx -msched-prefer-non-data-spec-insns
14861 @opindex mno-sched-prefer-non-data-spec-insns
14862 @opindex msched-prefer-non-data-spec-insns
14863 If enabled, data-speculative instructions are chosen for schedule
14864 only if there are no other choices at the moment. This makes
14865 the use of the data speculation much more conservative.
14866 The default is 'disable'.
14868 @item -mno-sched-prefer-non-control-spec-insns
14869 @itemx -msched-prefer-non-control-spec-insns
14870 @opindex mno-sched-prefer-non-control-spec-insns
14871 @opindex msched-prefer-non-control-spec-insns
14872 If enabled, control-speculative instructions are chosen for schedule
14873 only if there are no other choices at the moment. This makes
14874 the use of the control speculation much more conservative.
14875 The default is 'disable'.
14877 @item -mno-sched-count-spec-in-critical-path
14878 @itemx -msched-count-spec-in-critical-path
14879 @opindex mno-sched-count-spec-in-critical-path
14880 @opindex msched-count-spec-in-critical-path
14881 If enabled, speculative dependencies are considered during
14882 computation of the instructions priorities. This makes the use of the
14883 speculation a bit more conservative.
14884 The default is 'disable'.
14886 @item -msched-spec-ldc
14887 @opindex msched-spec-ldc
14888 Use a simple data speculation check. This option is on by default.
14890 @item -msched-control-spec-ldc
14891 @opindex msched-spec-ldc
14892 Use a simple check for control speculation. This option is on by default.
14894 @item -msched-stop-bits-after-every-cycle
14895 @opindex msched-stop-bits-after-every-cycle
14896 Place a stop bit after every cycle when scheduling. This option is on
14899 @item -msched-fp-mem-deps-zero-cost
14900 @opindex msched-fp-mem-deps-zero-cost
14901 Assume that floating-point stores and loads are not likely to cause a conflict
14902 when placed into the same instruction group. This option is disabled by
14905 @item -msel-sched-dont-check-control-spec
14906 @opindex msel-sched-dont-check-control-spec
14907 Generate checks for control speculation in selective scheduling.
14908 This flag is disabled by default.
14910 @item -msched-max-memory-insns=@var{max-insns}
14911 @opindex msched-max-memory-insns
14912 Limit on the number of memory insns per instruction group, giving lower
14913 priority to subsequent memory insns attempting to schedule in the same
14914 instruction group. Frequently useful to prevent cache bank conflicts.
14915 The default value is 1.
14917 @item -msched-max-memory-insns-hard-limit
14918 @opindex msched-max-memory-insns-hard-limit
14919 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
14920 disallowing more than that number in an instruction group.
14921 Otherwise, the limit is ``soft'', meaning that non-memory operations
14922 are preferred when the limit is reached, but memory operations may still
14928 @subsection LM32 Options
14929 @cindex LM32 options
14931 These @option{-m} options are defined for the LatticeMico32 architecture:
14934 @item -mbarrel-shift-enabled
14935 @opindex mbarrel-shift-enabled
14936 Enable barrel-shift instructions.
14938 @item -mdivide-enabled
14939 @opindex mdivide-enabled
14940 Enable divide and modulus instructions.
14942 @item -mmultiply-enabled
14943 @opindex multiply-enabled
14944 Enable multiply instructions.
14946 @item -msign-extend-enabled
14947 @opindex msign-extend-enabled
14948 Enable sign extend instructions.
14950 @item -muser-enabled
14951 @opindex muser-enabled
14952 Enable user-defined instructions.
14957 @subsection M32C Options
14958 @cindex M32C options
14961 @item -mcpu=@var{name}
14963 Select the CPU for which code is generated. @var{name} may be one of
14964 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
14965 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
14966 the M32C/80 series.
14970 Specifies that the program will be run on the simulator. This causes
14971 an alternate runtime library to be linked in which supports, for
14972 example, file I/O@. You must not use this option when generating
14973 programs that will run on real hardware; you must provide your own
14974 runtime library for whatever I/O functions are needed.
14976 @item -memregs=@var{number}
14978 Specifies the number of memory-based pseudo-registers GCC uses
14979 during code generation. These pseudo-registers are used like real
14980 registers, so there is a tradeoff between GCC's ability to fit the
14981 code into available registers, and the performance penalty of using
14982 memory instead of registers. Note that all modules in a program must
14983 be compiled with the same value for this option. Because of that, you
14984 must not use this option with GCC's default runtime libraries.
14988 @node M32R/D Options
14989 @subsection M32R/D Options
14990 @cindex M32R/D options
14992 These @option{-m} options are defined for Renesas M32R/D architectures:
14997 Generate code for the M32R/2@.
15001 Generate code for the M32R/X@.
15005 Generate code for the M32R@. This is the default.
15007 @item -mmodel=small
15008 @opindex mmodel=small
15009 Assume all objects live in the lower 16MB of memory (so that their addresses
15010 can be loaded with the @code{ld24} instruction), and assume all subroutines
15011 are reachable with the @code{bl} instruction.
15012 This is the default.
15014 The addressability of a particular object can be set with the
15015 @code{model} attribute.
15017 @item -mmodel=medium
15018 @opindex mmodel=medium
15019 Assume objects may be anywhere in the 32-bit address space (the compiler
15020 generates @code{seth/add3} instructions to load their addresses), and
15021 assume all subroutines are reachable with the @code{bl} instruction.
15023 @item -mmodel=large
15024 @opindex mmodel=large
15025 Assume objects may be anywhere in the 32-bit address space (the compiler
15026 generates @code{seth/add3} instructions to load their addresses), and
15027 assume subroutines may not be reachable with the @code{bl} instruction
15028 (the compiler generates the much slower @code{seth/add3/jl}
15029 instruction sequence).
15032 @opindex msdata=none
15033 Disable use of the small data area. Variables are put into
15034 one of @samp{.data}, @samp{.bss}, or @samp{.rodata} (unless the
15035 @code{section} attribute has been specified).
15036 This is the default.
15038 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
15039 Objects may be explicitly put in the small data area with the
15040 @code{section} attribute using one of these sections.
15042 @item -msdata=sdata
15043 @opindex msdata=sdata
15044 Put small global and static data in the small data area, but do not
15045 generate special code to reference them.
15048 @opindex msdata=use
15049 Put small global and static data in the small data area, and generate
15050 special instructions to reference them.
15054 @cindex smaller data references
15055 Put global and static objects less than or equal to @var{num} bytes
15056 into the small data or BSS sections instead of the normal data or BSS
15057 sections. The default value of @var{num} is 8.
15058 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
15059 for this option to have any effect.
15061 All modules should be compiled with the same @option{-G @var{num}} value.
15062 Compiling with different values of @var{num} may or may not work; if it
15063 doesn't the linker gives an error message---incorrect code is not
15068 Makes the M32R-specific code in the compiler display some statistics
15069 that might help in debugging programs.
15071 @item -malign-loops
15072 @opindex malign-loops
15073 Align all loops to a 32-byte boundary.
15075 @item -mno-align-loops
15076 @opindex mno-align-loops
15077 Do not enforce a 32-byte alignment for loops. This is the default.
15079 @item -missue-rate=@var{number}
15080 @opindex missue-rate=@var{number}
15081 Issue @var{number} instructions per cycle. @var{number} can only be 1
15084 @item -mbranch-cost=@var{number}
15085 @opindex mbranch-cost=@var{number}
15086 @var{number} can only be 1 or 2. If it is 1 then branches are
15087 preferred over conditional code, if it is 2, then the opposite applies.
15089 @item -mflush-trap=@var{number}
15090 @opindex mflush-trap=@var{number}
15091 Specifies the trap number to use to flush the cache. The default is
15092 12. Valid numbers are between 0 and 15 inclusive.
15094 @item -mno-flush-trap
15095 @opindex mno-flush-trap
15096 Specifies that the cache cannot be flushed by using a trap.
15098 @item -mflush-func=@var{name}
15099 @opindex mflush-func=@var{name}
15100 Specifies the name of the operating system function to call to flush
15101 the cache. The default is @emph{_flush_cache}, but a function call
15102 is only used if a trap is not available.
15104 @item -mno-flush-func
15105 @opindex mno-flush-func
15106 Indicates that there is no OS function for flushing the cache.
15110 @node M680x0 Options
15111 @subsection M680x0 Options
15112 @cindex M680x0 options
15114 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
15115 The default settings depend on which architecture was selected when
15116 the compiler was configured; the defaults for the most common choices
15120 @item -march=@var{arch}
15122 Generate code for a specific M680x0 or ColdFire instruction set
15123 architecture. Permissible values of @var{arch} for M680x0
15124 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
15125 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
15126 architectures are selected according to Freescale's ISA classification
15127 and the permissible values are: @samp{isaa}, @samp{isaaplus},
15128 @samp{isab} and @samp{isac}.
15130 GCC defines a macro @samp{__mcf@var{arch}__} whenever it is generating
15131 code for a ColdFire target. The @var{arch} in this macro is one of the
15132 @option{-march} arguments given above.
15134 When used together, @option{-march} and @option{-mtune} select code
15135 that runs on a family of similar processors but that is optimized
15136 for a particular microarchitecture.
15138 @item -mcpu=@var{cpu}
15140 Generate code for a specific M680x0 or ColdFire processor.
15141 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
15142 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
15143 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
15144 below, which also classifies the CPUs into families:
15146 @multitable @columnfractions 0.20 0.80
15147 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
15148 @item @samp{51} @tab @samp{51} @samp{51ac} @samp{51ag} @samp{51cn} @samp{51em} @samp{51je} @samp{51jf} @samp{51jg} @samp{51jm} @samp{51mm} @samp{51qe} @samp{51qm}
15149 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
15150 @item @samp{5206e} @tab @samp{5206e}
15151 @item @samp{5208} @tab @samp{5207} @samp{5208}
15152 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
15153 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
15154 @item @samp{5216} @tab @samp{5214} @samp{5216}
15155 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
15156 @item @samp{5225} @tab @samp{5224} @samp{5225}
15157 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
15158 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
15159 @item @samp{5249} @tab @samp{5249}
15160 @item @samp{5250} @tab @samp{5250}
15161 @item @samp{5271} @tab @samp{5270} @samp{5271}
15162 @item @samp{5272} @tab @samp{5272}
15163 @item @samp{5275} @tab @samp{5274} @samp{5275}
15164 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
15165 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
15166 @item @samp{5307} @tab @samp{5307}
15167 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
15168 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
15169 @item @samp{5407} @tab @samp{5407}
15170 @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}
15173 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
15174 @var{arch} is compatible with @var{cpu}. Other combinations of
15175 @option{-mcpu} and @option{-march} are rejected.
15177 GCC defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
15178 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
15179 where the value of @var{family} is given by the table above.
15181 @item -mtune=@var{tune}
15183 Tune the code for a particular microarchitecture within the
15184 constraints set by @option{-march} and @option{-mcpu}.
15185 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
15186 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
15187 and @samp{cpu32}. The ColdFire microarchitectures
15188 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
15190 You can also use @option{-mtune=68020-40} for code that needs
15191 to run relatively well on 68020, 68030 and 68040 targets.
15192 @option{-mtune=68020-60} is similar but includes 68060 targets
15193 as well. These two options select the same tuning decisions as
15194 @option{-m68020-40} and @option{-m68020-60} respectively.
15196 GCC defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
15197 when tuning for 680x0 architecture @var{arch}. It also defines
15198 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
15199 option is used. If GCC is tuning for a range of architectures,
15200 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
15201 it defines the macros for every architecture in the range.
15203 GCC also defines the macro @samp{__m@var{uarch}__} when tuning for
15204 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
15205 of the arguments given above.
15211 Generate output for a 68000. This is the default
15212 when the compiler is configured for 68000-based systems.
15213 It is equivalent to @option{-march=68000}.
15215 Use this option for microcontrollers with a 68000 or EC000 core,
15216 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
15220 Generate output for a 68010. This is the default
15221 when the compiler is configured for 68010-based systems.
15222 It is equivalent to @option{-march=68010}.
15228 Generate output for a 68020. This is the default
15229 when the compiler is configured for 68020-based systems.
15230 It is equivalent to @option{-march=68020}.
15234 Generate output for a 68030. This is the default when the compiler is
15235 configured for 68030-based systems. It is equivalent to
15236 @option{-march=68030}.
15240 Generate output for a 68040. This is the default when the compiler is
15241 configured for 68040-based systems. It is equivalent to
15242 @option{-march=68040}.
15244 This option inhibits the use of 68881/68882 instructions that have to be
15245 emulated by software on the 68040. Use this option if your 68040 does not
15246 have code to emulate those instructions.
15250 Generate output for a 68060. This is the default when the compiler is
15251 configured for 68060-based systems. It is equivalent to
15252 @option{-march=68060}.
15254 This option inhibits the use of 68020 and 68881/68882 instructions that
15255 have to be emulated by software on the 68060. Use this option if your 68060
15256 does not have code to emulate those instructions.
15260 Generate output for a CPU32. This is the default
15261 when the compiler is configured for CPU32-based systems.
15262 It is equivalent to @option{-march=cpu32}.
15264 Use this option for microcontrollers with a
15265 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
15266 68336, 68340, 68341, 68349 and 68360.
15270 Generate output for a 520X ColdFire CPU@. This is the default
15271 when the compiler is configured for 520X-based systems.
15272 It is equivalent to @option{-mcpu=5206}, and is now deprecated
15273 in favor of that option.
15275 Use this option for microcontroller with a 5200 core, including
15276 the MCF5202, MCF5203, MCF5204 and MCF5206.
15280 Generate output for a 5206e ColdFire CPU@. The option is now
15281 deprecated in favor of the equivalent @option{-mcpu=5206e}.
15285 Generate output for a member of the ColdFire 528X family.
15286 The option is now deprecated in favor of the equivalent
15287 @option{-mcpu=528x}.
15291 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
15292 in favor of the equivalent @option{-mcpu=5307}.
15296 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
15297 in favor of the equivalent @option{-mcpu=5407}.
15301 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
15302 This includes use of hardware floating-point instructions.
15303 The option is equivalent to @option{-mcpu=547x}, and is now
15304 deprecated in favor of that option.
15308 Generate output for a 68040, without using any of the new instructions.
15309 This results in code that can run relatively efficiently on either a
15310 68020/68881 or a 68030 or a 68040. The generated code does use the
15311 68881 instructions that are emulated on the 68040.
15313 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
15317 Generate output for a 68060, without using any of the new instructions.
15318 This results in code that can run relatively efficiently on either a
15319 68020/68881 or a 68030 or a 68040. The generated code does use the
15320 68881 instructions that are emulated on the 68060.
15322 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
15326 @opindex mhard-float
15328 Generate floating-point instructions. This is the default for 68020
15329 and above, and for ColdFire devices that have an FPU@. It defines the
15330 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
15331 on ColdFire targets.
15334 @opindex msoft-float
15335 Do not generate floating-point instructions; use library calls instead.
15336 This is the default for 68000, 68010, and 68832 targets. It is also
15337 the default for ColdFire devices that have no FPU.
15343 Generate (do not generate) ColdFire hardware divide and remainder
15344 instructions. If @option{-march} is used without @option{-mcpu},
15345 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
15346 architectures. Otherwise, the default is taken from the target CPU
15347 (either the default CPU, or the one specified by @option{-mcpu}). For
15348 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
15349 @option{-mcpu=5206e}.
15351 GCC defines the macro @samp{__mcfhwdiv__} when this option is enabled.
15355 Consider type @code{int} to be 16 bits wide, like @code{short int}.
15356 Additionally, parameters passed on the stack are also aligned to a
15357 16-bit boundary even on targets whose API mandates promotion to 32-bit.
15361 Do not consider type @code{int} to be 16 bits wide. This is the default.
15364 @itemx -mno-bitfield
15365 @opindex mnobitfield
15366 @opindex mno-bitfield
15367 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
15368 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
15372 Do use the bit-field instructions. The @option{-m68020} option implies
15373 @option{-mbitfield}. This is the default if you use a configuration
15374 designed for a 68020.
15378 Use a different function-calling convention, in which functions
15379 that take a fixed number of arguments return with the @code{rtd}
15380 instruction, which pops their arguments while returning. This
15381 saves one instruction in the caller since there is no need to pop
15382 the arguments there.
15384 This calling convention is incompatible with the one normally
15385 used on Unix, so you cannot use it if you need to call libraries
15386 compiled with the Unix compiler.
15388 Also, you must provide function prototypes for all functions that
15389 take variable numbers of arguments (including @code{printf});
15390 otherwise incorrect code is generated for calls to those
15393 In addition, seriously incorrect code results if you call a
15394 function with too many arguments. (Normally, extra arguments are
15395 harmlessly ignored.)
15397 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
15398 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
15402 Do not use the calling conventions selected by @option{-mrtd}.
15403 This is the default.
15406 @itemx -mno-align-int
15407 @opindex malign-int
15408 @opindex mno-align-int
15409 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
15410 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
15411 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
15412 Aligning variables on 32-bit boundaries produces code that runs somewhat
15413 faster on processors with 32-bit busses at the expense of more memory.
15415 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
15416 aligns structures containing the above types differently than
15417 most published application binary interface specifications for the m68k.
15421 Use the pc-relative addressing mode of the 68000 directly, instead of
15422 using a global offset table. At present, this option implies @option{-fpic},
15423 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
15424 not presently supported with @option{-mpcrel}, though this could be supported for
15425 68020 and higher processors.
15427 @item -mno-strict-align
15428 @itemx -mstrict-align
15429 @opindex mno-strict-align
15430 @opindex mstrict-align
15431 Do not (do) assume that unaligned memory references are handled by
15435 Generate code that allows the data segment to be located in a different
15436 area of memory from the text segment. This allows for execute-in-place in
15437 an environment without virtual memory management. This option implies
15440 @item -mno-sep-data
15441 Generate code that assumes that the data segment follows the text segment.
15442 This is the default.
15444 @item -mid-shared-library
15445 Generate code that supports shared libraries via the library ID method.
15446 This allows for execute-in-place and shared libraries in an environment
15447 without virtual memory management. This option implies @option{-fPIC}.
15449 @item -mno-id-shared-library
15450 Generate code that doesn't assume ID-based shared libraries are being used.
15451 This is the default.
15453 @item -mshared-library-id=n
15454 Specifies the identification number of the ID-based shared library being
15455 compiled. Specifying a value of 0 generates more compact code; specifying
15456 other values forces the allocation of that number to the current
15457 library, but is no more space- or time-efficient than omitting this option.
15463 When generating position-independent code for ColdFire, generate code
15464 that works if the GOT has more than 8192 entries. This code is
15465 larger and slower than code generated without this option. On M680x0
15466 processors, this option is not needed; @option{-fPIC} suffices.
15468 GCC normally uses a single instruction to load values from the GOT@.
15469 While this is relatively efficient, it only works if the GOT
15470 is smaller than about 64k. Anything larger causes the linker
15471 to report an error such as:
15473 @cindex relocation truncated to fit (ColdFire)
15475 relocation truncated to fit: R_68K_GOT16O foobar
15478 If this happens, you should recompile your code with @option{-mxgot}.
15479 It should then work with very large GOTs. However, code generated with
15480 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
15481 the value of a global symbol.
15483 Note that some linkers, including newer versions of the GNU linker,
15484 can create multiple GOTs and sort GOT entries. If you have such a linker,
15485 you should only need to use @option{-mxgot} when compiling a single
15486 object file that accesses more than 8192 GOT entries. Very few do.
15488 These options have no effect unless GCC is generating
15489 position-independent code.
15493 @node MCore Options
15494 @subsection MCore Options
15495 @cindex MCore options
15497 These are the @samp{-m} options defined for the Motorola M*Core
15503 @itemx -mno-hardlit
15505 @opindex mno-hardlit
15506 Inline constants into the code stream if it can be done in two
15507 instructions or less.
15513 Use the divide instruction. (Enabled by default).
15515 @item -mrelax-immediate
15516 @itemx -mno-relax-immediate
15517 @opindex mrelax-immediate
15518 @opindex mno-relax-immediate
15519 Allow arbitrary-sized immediates in bit operations.
15521 @item -mwide-bitfields
15522 @itemx -mno-wide-bitfields
15523 @opindex mwide-bitfields
15524 @opindex mno-wide-bitfields
15525 Always treat bit-fields as @code{int}-sized.
15527 @item -m4byte-functions
15528 @itemx -mno-4byte-functions
15529 @opindex m4byte-functions
15530 @opindex mno-4byte-functions
15531 Force all functions to be aligned to a 4-byte boundary.
15533 @item -mcallgraph-data
15534 @itemx -mno-callgraph-data
15535 @opindex mcallgraph-data
15536 @opindex mno-callgraph-data
15537 Emit callgraph information.
15540 @itemx -mno-slow-bytes
15541 @opindex mslow-bytes
15542 @opindex mno-slow-bytes
15543 Prefer word access when reading byte quantities.
15545 @item -mlittle-endian
15546 @itemx -mbig-endian
15547 @opindex mlittle-endian
15548 @opindex mbig-endian
15549 Generate code for a little-endian target.
15555 Generate code for the 210 processor.
15559 Assume that runtime support has been provided and so omit the
15560 simulator library (@file{libsim.a)} from the linker command line.
15562 @item -mstack-increment=@var{size}
15563 @opindex mstack-increment
15564 Set the maximum amount for a single stack increment operation. Large
15565 values can increase the speed of programs that contain functions
15566 that need a large amount of stack space, but they can also trigger a
15567 segmentation fault if the stack is extended too much. The default
15573 @subsection MeP Options
15574 @cindex MeP options
15580 Enables the @code{abs} instruction, which is the absolute difference
15581 between two registers.
15585 Enables all the optional instructions---average, multiply, divide, bit
15586 operations, leading zero, absolute difference, min/max, clip, and
15592 Enables the @code{ave} instruction, which computes the average of two
15595 @item -mbased=@var{n}
15597 Variables of size @var{n} bytes or smaller are placed in the
15598 @code{.based} section by default. Based variables use the @code{$tp}
15599 register as a base register, and there is a 128-byte limit to the
15600 @code{.based} section.
15604 Enables the bit operation instructions---bit test (@code{btstm}), set
15605 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
15606 test-and-set (@code{tas}).
15608 @item -mc=@var{name}
15610 Selects which section constant data is placed in. @var{name} may
15611 be @code{tiny}, @code{near}, or @code{far}.
15615 Enables the @code{clip} instruction. Note that @code{-mclip} is not
15616 useful unless you also provide @code{-mminmax}.
15618 @item -mconfig=@var{name}
15620 Selects one of the built-in core configurations. Each MeP chip has
15621 one or more modules in it; each module has a core CPU and a variety of
15622 coprocessors, optional instructions, and peripherals. The
15623 @code{MeP-Integrator} tool, not part of GCC, provides these
15624 configurations through this option; using this option is the same as
15625 using all the corresponding command-line options. The default
15626 configuration is @code{default}.
15630 Enables the coprocessor instructions. By default, this is a 32-bit
15631 coprocessor. Note that the coprocessor is normally enabled via the
15632 @code{-mconfig=} option.
15636 Enables the 32-bit coprocessor's instructions.
15640 Enables the 64-bit coprocessor's instructions.
15644 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
15648 Causes constant variables to be placed in the @code{.near} section.
15652 Enables the @code{div} and @code{divu} instructions.
15656 Generate big-endian code.
15660 Generate little-endian code.
15662 @item -mio-volatile
15663 @opindex mio-volatile
15664 Tells the compiler that any variable marked with the @code{io}
15665 attribute is to be considered volatile.
15669 Causes variables to be assigned to the @code{.far} section by default.
15673 Enables the @code{leadz} (leading zero) instruction.
15677 Causes variables to be assigned to the @code{.near} section by default.
15681 Enables the @code{min} and @code{max} instructions.
15685 Enables the multiplication and multiply-accumulate instructions.
15689 Disables all the optional instructions enabled by @code{-mall-opts}.
15693 Enables the @code{repeat} and @code{erepeat} instructions, used for
15694 low-overhead looping.
15698 Causes all variables to default to the @code{.tiny} section. Note
15699 that there is a 65536-byte limit to this section. Accesses to these
15700 variables use the @code{%gp} base register.
15704 Enables the saturation instructions. Note that the compiler does not
15705 currently generate these itself, but this option is included for
15706 compatibility with other tools, like @code{as}.
15710 Link the SDRAM-based runtime instead of the default ROM-based runtime.
15714 Link the simulator runtime libraries.
15718 Link the simulator runtime libraries, excluding built-in support
15719 for reset and exception vectors and tables.
15723 Causes all functions to default to the @code{.far} section. Without
15724 this option, functions default to the @code{.near} section.
15726 @item -mtiny=@var{n}
15728 Variables that are @var{n} bytes or smaller are allocated to the
15729 @code{.tiny} section. These variables use the @code{$gp} base
15730 register. The default for this option is 4, but note that there's a
15731 65536-byte limit to the @code{.tiny} section.
15735 @node MicroBlaze Options
15736 @subsection MicroBlaze Options
15737 @cindex MicroBlaze Options
15742 @opindex msoft-float
15743 Use software emulation for floating point (default).
15746 @opindex mhard-float
15747 Use hardware floating-point instructions.
15751 Do not optimize block moves, use @code{memcpy}.
15753 @item -mno-clearbss
15754 @opindex mno-clearbss
15755 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
15757 @item -mcpu=@var{cpu-type}
15759 Use features of, and schedule code for, the given CPU.
15760 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
15761 where @var{X} is a major version, @var{YY} is the minor version, and
15762 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
15763 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
15765 @item -mxl-soft-mul
15766 @opindex mxl-soft-mul
15767 Use software multiply emulation (default).
15769 @item -mxl-soft-div
15770 @opindex mxl-soft-div
15771 Use software emulation for divides (default).
15773 @item -mxl-barrel-shift
15774 @opindex mxl-barrel-shift
15775 Use the hardware barrel shifter.
15777 @item -mxl-pattern-compare
15778 @opindex mxl-pattern-compare
15779 Use pattern compare instructions.
15781 @item -msmall-divides
15782 @opindex msmall-divides
15783 Use table lookup optimization for small signed integer divisions.
15785 @item -mxl-stack-check
15786 @opindex mxl-stack-check
15787 This option is deprecated. Use @option{-fstack-check} instead.
15790 @opindex mxl-gp-opt
15791 Use GP-relative @code{.sdata}/@code{.sbss} sections.
15793 @item -mxl-multiply-high
15794 @opindex mxl-multiply-high
15795 Use multiply high instructions for high part of 32x32 multiply.
15797 @item -mxl-float-convert
15798 @opindex mxl-float-convert
15799 Use hardware floating-point conversion instructions.
15801 @item -mxl-float-sqrt
15802 @opindex mxl-float-sqrt
15803 Use hardware floating-point square root instruction.
15805 @item -mxl-mode-@var{app-model}
15806 Select application model @var{app-model}. Valid models are
15809 normal executable (default), uses startup code @file{crt0.o}.
15812 for use with Xilinx Microprocessor Debugger (XMD) based
15813 software intrusive debug agent called xmdstub. This uses startup file
15814 @file{crt1.o} and sets the start address of the program to 0x800.
15817 for applications that are loaded using a bootloader.
15818 This model uses startup file @file{crt2.o} which does not contain a processor
15819 reset vector handler. This is suitable for transferring control on a
15820 processor reset to the bootloader rather than the application.
15823 for applications that do not require any of the
15824 MicroBlaze vectors. This option may be useful for applications running
15825 within a monitoring application. This model uses @file{crt3.o} as a startup file.
15828 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
15829 @option{-mxl-mode-@var{app-model}}.
15834 @subsection MIPS Options
15835 @cindex MIPS options
15841 Generate big-endian code.
15845 Generate little-endian code. This is the default for @samp{mips*el-*-*}
15848 @item -march=@var{arch}
15850 Generate code that runs on @var{arch}, which can be the name of a
15851 generic MIPS ISA, or the name of a particular processor.
15853 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
15854 @samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
15855 The processor names are:
15856 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
15857 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
15858 @samp{5kc}, @samp{5kf},
15860 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
15861 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
15862 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
15863 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
15864 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
15865 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
15867 @samp{octeon}, @samp{octeon+}, @samp{octeon2},
15869 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
15870 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
15871 @samp{rm7000}, @samp{rm9000},
15872 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
15875 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
15876 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
15877 @samp{xlr} and @samp{xlp}.
15878 The special value @samp{from-abi} selects the
15879 most compatible architecture for the selected ABI (that is,
15880 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
15882 The native Linux/GNU toolchain also supports the value @samp{native},
15883 which selects the best architecture option for the host processor.
15884 @option{-march=native} has no effect if GCC does not recognize
15887 In processor names, a final @samp{000} can be abbreviated as @samp{k}
15888 (for example, @option{-march=r2k}). Prefixes are optional, and
15889 @samp{vr} may be written @samp{r}.
15891 Names of the form @samp{@var{n}f2_1} refer to processors with
15892 FPUs clocked at half the rate of the core, names of the form
15893 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
15894 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
15895 processors with FPUs clocked a ratio of 3:2 with respect to the core.
15896 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
15897 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
15898 accepted as synonyms for @samp{@var{n}f1_1}.
15900 GCC defines two macros based on the value of this option. The first
15901 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
15902 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
15903 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
15904 For example, @option{-march=r2000} sets @samp{_MIPS_ARCH}
15905 to @samp{"r2000"} and defines the macro @samp{_MIPS_ARCH_R2000}.
15907 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
15908 above. In other words, it has the full prefix and does not
15909 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
15910 the macro names the resolved architecture (either @samp{"mips1"} or
15911 @samp{"mips3"}). It names the default architecture when no
15912 @option{-march} option is given.
15914 @item -mtune=@var{arch}
15916 Optimize for @var{arch}. Among other things, this option controls
15917 the way instructions are scheduled, and the perceived cost of arithmetic
15918 operations. The list of @var{arch} values is the same as for
15921 When this option is not used, GCC optimizes for the processor
15922 specified by @option{-march}. By using @option{-march} and
15923 @option{-mtune} together, it is possible to generate code that
15924 runs on a family of processors, but optimize the code for one
15925 particular member of that family.
15927 @option{-mtune} defines the macros @samp{_MIPS_TUNE} and
15928 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
15929 @option{-march} ones described above.
15933 Equivalent to @option{-march=mips1}.
15937 Equivalent to @option{-march=mips2}.
15941 Equivalent to @option{-march=mips3}.
15945 Equivalent to @option{-march=mips4}.
15949 Equivalent to @option{-march=mips32}.
15953 Equivalent to @option{-march=mips32r2}.
15957 Equivalent to @option{-march=mips64}.
15961 Equivalent to @option{-march=mips64r2}.
15966 @opindex mno-mips16
15967 Generate (do not generate) MIPS16 code. If GCC is targeting a
15968 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
15970 MIPS16 code generation can also be controlled on a per-function basis
15971 by means of @code{mips16} and @code{nomips16} attributes.
15972 @xref{Function Attributes}, for more information.
15974 @item -mflip-mips16
15975 @opindex mflip-mips16
15976 Generate MIPS16 code on alternating functions. This option is provided
15977 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
15978 not intended for ordinary use in compiling user code.
15980 @item -minterlink-mips16
15981 @itemx -mno-interlink-mips16
15982 @opindex minterlink-mips16
15983 @opindex mno-interlink-mips16
15984 Require (do not require) that non-MIPS16 code be link-compatible with
15987 For example, non-MIPS16 code cannot jump directly to MIPS16 code;
15988 it must either use a call or an indirect jump. @option{-minterlink-mips16}
15989 therefore disables direct jumps unless GCC knows that the target of the
15990 jump is not MIPS16.
16002 Generate code for the given ABI@.
16004 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
16005 generates 64-bit code when you select a 64-bit architecture, but you
16006 can use @option{-mgp32} to get 32-bit code instead.
16008 For information about the O64 ABI, see
16009 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
16011 GCC supports a variant of the o32 ABI in which floating-point registers
16012 are 64 rather than 32 bits wide. You can select this combination with
16013 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
16014 and @code{mfhc1} instructions and is therefore only supported for
16015 MIPS32R2 processors.
16017 The register assignments for arguments and return values remain the
16018 same, but each scalar value is passed in a single 64-bit register
16019 rather than a pair of 32-bit registers. For example, scalar
16020 floating-point values are returned in @samp{$f0} only, not a
16021 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
16022 remains the same, but all 64 bits are saved.
16025 @itemx -mno-abicalls
16027 @opindex mno-abicalls
16028 Generate (do not generate) code that is suitable for SVR4-style
16029 dynamic objects. @option{-mabicalls} is the default for SVR4-based
16034 Generate (do not generate) code that is fully position-independent,
16035 and that can therefore be linked into shared libraries. This option
16036 only affects @option{-mabicalls}.
16038 All @option{-mabicalls} code has traditionally been position-independent,
16039 regardless of options like @option{-fPIC} and @option{-fpic}. However,
16040 as an extension, the GNU toolchain allows executables to use absolute
16041 accesses for locally-binding symbols. It can also use shorter GP
16042 initialization sequences and generate direct calls to locally-defined
16043 functions. This mode is selected by @option{-mno-shared}.
16045 @option{-mno-shared} depends on binutils 2.16 or higher and generates
16046 objects that can only be linked by the GNU linker. However, the option
16047 does not affect the ABI of the final executable; it only affects the ABI
16048 of relocatable objects. Using @option{-mno-shared} generally makes
16049 executables both smaller and quicker.
16051 @option{-mshared} is the default.
16057 Assume (do not assume) that the static and dynamic linkers
16058 support PLTs and copy relocations. This option only affects
16059 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
16060 has no effect without @option{-msym32}.
16062 You can make @option{-mplt} the default by configuring
16063 GCC with @option{--with-mips-plt}. The default is
16064 @option{-mno-plt} otherwise.
16070 Lift (do not lift) the usual restrictions on the size of the global
16073 GCC normally uses a single instruction to load values from the GOT@.
16074 While this is relatively efficient, it only works if the GOT
16075 is smaller than about 64k. Anything larger causes the linker
16076 to report an error such as:
16078 @cindex relocation truncated to fit (MIPS)
16080 relocation truncated to fit: R_MIPS_GOT16 foobar
16083 If this happens, you should recompile your code with @option{-mxgot}.
16084 This works with very large GOTs, although the code is also
16085 less efficient, since it takes three instructions to fetch the
16086 value of a global symbol.
16088 Note that some linkers can create multiple GOTs. If you have such a
16089 linker, you should only need to use @option{-mxgot} when a single object
16090 file accesses more than 64k's worth of GOT entries. Very few do.
16092 These options have no effect unless GCC is generating position
16097 Assume that general-purpose registers are 32 bits wide.
16101 Assume that general-purpose registers are 64 bits wide.
16105 Assume that floating-point registers are 32 bits wide.
16109 Assume that floating-point registers are 64 bits wide.
16112 @opindex mhard-float
16113 Use floating-point coprocessor instructions.
16116 @opindex msoft-float
16117 Do not use floating-point coprocessor instructions. Implement
16118 floating-point calculations using library calls instead.
16122 Equivalent to @option{-msoft-float}, but additionally asserts that the
16123 program being compiled does not perform any floating-point operations.
16124 This option is presently supported only by some bare-metal MIPS
16125 configurations, where it may select a special set of libraries
16126 that lack all floating-point support (including, for example, the
16127 floating-point @code{printf} formats).
16128 If code compiled with @code{-mno-float} accidentally contains
16129 floating-point operations, it is likely to suffer a link-time
16130 or run-time failure.
16132 @item -msingle-float
16133 @opindex msingle-float
16134 Assume that the floating-point coprocessor only supports single-precision
16137 @item -mdouble-float
16138 @opindex mdouble-float
16139 Assume that the floating-point coprocessor supports double-precision
16140 operations. This is the default.
16146 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
16147 implement atomic memory built-in functions. When neither option is
16148 specified, GCC uses the instructions if the target architecture
16151 @option{-mllsc} is useful if the runtime environment can emulate the
16152 instructions and @option{-mno-llsc} can be useful when compiling for
16153 nonstandard ISAs. You can make either option the default by
16154 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
16155 respectively. @option{--with-llsc} is the default for some
16156 configurations; see the installation documentation for details.
16162 Use (do not use) revision 1 of the MIPS DSP ASE@.
16163 @xref{MIPS DSP Built-in Functions}. This option defines the
16164 preprocessor macro @samp{__mips_dsp}. It also defines
16165 @samp{__mips_dsp_rev} to 1.
16171 Use (do not use) revision 2 of the MIPS DSP ASE@.
16172 @xref{MIPS DSP Built-in Functions}. This option defines the
16173 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
16174 It also defines @samp{__mips_dsp_rev} to 2.
16177 @itemx -mno-smartmips
16178 @opindex msmartmips
16179 @opindex mno-smartmips
16180 Use (do not use) the MIPS SmartMIPS ASE.
16182 @item -mpaired-single
16183 @itemx -mno-paired-single
16184 @opindex mpaired-single
16185 @opindex mno-paired-single
16186 Use (do not use) paired-single floating-point instructions.
16187 @xref{MIPS Paired-Single Support}. This option requires
16188 hardware floating-point support to be enabled.
16194 Use (do not use) MIPS Digital Media Extension instructions.
16195 This option can only be used when generating 64-bit code and requires
16196 hardware floating-point support to be enabled.
16201 @opindex mno-mips3d
16202 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
16203 The option @option{-mips3d} implies @option{-mpaired-single}.
16209 Use (do not use) MT Multithreading instructions.
16215 Use (do not use) the MIPS MCU ASE instructions.
16219 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
16220 an explanation of the default and the way that the pointer size is
16225 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
16227 The default size of @code{int}s, @code{long}s and pointers depends on
16228 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
16229 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
16230 32-bit @code{long}s. Pointers are the same size as @code{long}s,
16231 or the same size as integer registers, whichever is smaller.
16237 Assume (do not assume) that all symbols have 32-bit values, regardless
16238 of the selected ABI@. This option is useful in combination with
16239 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
16240 to generate shorter and faster references to symbolic addresses.
16244 Put definitions of externally-visible data in a small data section
16245 if that data is no bigger than @var{num} bytes. GCC can then generate
16246 more efficient accesses to the data; see @option{-mgpopt} for details.
16248 The default @option{-G} option depends on the configuration.
16250 @item -mlocal-sdata
16251 @itemx -mno-local-sdata
16252 @opindex mlocal-sdata
16253 @opindex mno-local-sdata
16254 Extend (do not extend) the @option{-G} behavior to local data too,
16255 such as to static variables in C@. @option{-mlocal-sdata} is the
16256 default for all configurations.
16258 If the linker complains that an application is using too much small data,
16259 you might want to try rebuilding the less performance-critical parts with
16260 @option{-mno-local-sdata}. You might also want to build large
16261 libraries with @option{-mno-local-sdata}, so that the libraries leave
16262 more room for the main program.
16264 @item -mextern-sdata
16265 @itemx -mno-extern-sdata
16266 @opindex mextern-sdata
16267 @opindex mno-extern-sdata
16268 Assume (do not assume) that externally-defined data is in
16269 a small data section if the size of that data is within the @option{-G} limit.
16270 @option{-mextern-sdata} is the default for all configurations.
16272 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
16273 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
16274 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
16275 is placed in a small data section. If @var{Var} is defined by another
16276 module, you must either compile that module with a high-enough
16277 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
16278 definition. If @var{Var} is common, you must link the application
16279 with a high-enough @option{-G} setting.
16281 The easiest way of satisfying these restrictions is to compile
16282 and link every module with the same @option{-G} option. However,
16283 you may wish to build a library that supports several different
16284 small data limits. You can do this by compiling the library with
16285 the highest supported @option{-G} setting and additionally using
16286 @option{-mno-extern-sdata} to stop the library from making assumptions
16287 about externally-defined data.
16293 Use (do not use) GP-relative accesses for symbols that are known to be
16294 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
16295 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
16298 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
16299 might not hold the value of @code{_gp}. For example, if the code is
16300 part of a library that might be used in a boot monitor, programs that
16301 call boot monitor routines pass an unknown value in @code{$gp}.
16302 (In such situations, the boot monitor itself is usually compiled
16303 with @option{-G0}.)
16305 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
16306 @option{-mno-extern-sdata}.
16308 @item -membedded-data
16309 @itemx -mno-embedded-data
16310 @opindex membedded-data
16311 @opindex mno-embedded-data
16312 Allocate variables to the read-only data section first if possible, then
16313 next in the small data section if possible, otherwise in data. This gives
16314 slightly slower code than the default, but reduces the amount of RAM required
16315 when executing, and thus may be preferred for some embedded systems.
16317 @item -muninit-const-in-rodata
16318 @itemx -mno-uninit-const-in-rodata
16319 @opindex muninit-const-in-rodata
16320 @opindex mno-uninit-const-in-rodata
16321 Put uninitialized @code{const} variables in the read-only data section.
16322 This option is only meaningful in conjunction with @option{-membedded-data}.
16324 @item -mcode-readable=@var{setting}
16325 @opindex mcode-readable
16326 Specify whether GCC may generate code that reads from executable sections.
16327 There are three possible settings:
16330 @item -mcode-readable=yes
16331 Instructions may freely access executable sections. This is the
16334 @item -mcode-readable=pcrel
16335 MIPS16 PC-relative load instructions can access executable sections,
16336 but other instructions must not do so. This option is useful on 4KSc
16337 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
16338 It is also useful on processors that can be configured to have a dual
16339 instruction/data SRAM interface and that, like the M4K, automatically
16340 redirect PC-relative loads to the instruction RAM.
16342 @item -mcode-readable=no
16343 Instructions must not access executable sections. This option can be
16344 useful on targets that are configured to have a dual instruction/data
16345 SRAM interface but that (unlike the M4K) do not automatically redirect
16346 PC-relative loads to the instruction RAM.
16349 @item -msplit-addresses
16350 @itemx -mno-split-addresses
16351 @opindex msplit-addresses
16352 @opindex mno-split-addresses
16353 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
16354 relocation operators. This option has been superseded by
16355 @option{-mexplicit-relocs} but is retained for backwards compatibility.
16357 @item -mexplicit-relocs
16358 @itemx -mno-explicit-relocs
16359 @opindex mexplicit-relocs
16360 @opindex mno-explicit-relocs
16361 Use (do not use) assembler relocation operators when dealing with symbolic
16362 addresses. The alternative, selected by @option{-mno-explicit-relocs},
16363 is to use assembler macros instead.
16365 @option{-mexplicit-relocs} is the default if GCC was configured
16366 to use an assembler that supports relocation operators.
16368 @item -mcheck-zero-division
16369 @itemx -mno-check-zero-division
16370 @opindex mcheck-zero-division
16371 @opindex mno-check-zero-division
16372 Trap (do not trap) on integer division by zero.
16374 The default is @option{-mcheck-zero-division}.
16376 @item -mdivide-traps
16377 @itemx -mdivide-breaks
16378 @opindex mdivide-traps
16379 @opindex mdivide-breaks
16380 MIPS systems check for division by zero by generating either a
16381 conditional trap or a break instruction. Using traps results in
16382 smaller code, but is only supported on MIPS II and later. Also, some
16383 versions of the Linux kernel have a bug that prevents trap from
16384 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
16385 allow conditional traps on architectures that support them and
16386 @option{-mdivide-breaks} to force the use of breaks.
16388 The default is usually @option{-mdivide-traps}, but this can be
16389 overridden at configure time using @option{--with-divide=breaks}.
16390 Divide-by-zero checks can be completely disabled using
16391 @option{-mno-check-zero-division}.
16396 @opindex mno-memcpy
16397 Force (do not force) the use of @code{memcpy()} for non-trivial block
16398 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
16399 most constant-sized copies.
16402 @itemx -mno-long-calls
16403 @opindex mlong-calls
16404 @opindex mno-long-calls
16405 Disable (do not disable) use of the @code{jal} instruction. Calling
16406 functions using @code{jal} is more efficient but requires the caller
16407 and callee to be in the same 256 megabyte segment.
16409 This option has no effect on abicalls code. The default is
16410 @option{-mno-long-calls}.
16416 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
16417 instructions, as provided by the R4650 ISA@.
16420 @itemx -mno-fused-madd
16421 @opindex mfused-madd
16422 @opindex mno-fused-madd
16423 Enable (disable) use of the floating-point multiply-accumulate
16424 instructions, when they are available. The default is
16425 @option{-mfused-madd}.
16427 When multiply-accumulate instructions are used, the intermediate
16428 product is calculated to infinite precision and is not subject to
16429 the FCSR Flush to Zero bit. This may be undesirable in some
16434 Tell the MIPS assembler to not run its preprocessor over user
16435 assembler files (with a @samp{.s} suffix) when assembling them.
16440 @opindex mno-fix-24k
16441 Work around the 24K E48 (lost data on stores during refill) errata.
16442 The workarounds are implemented by the assembler rather than by GCC@.
16445 @itemx -mno-fix-r4000
16446 @opindex mfix-r4000
16447 @opindex mno-fix-r4000
16448 Work around certain R4000 CPU errata:
16451 A double-word or a variable shift may give an incorrect result if executed
16452 immediately after starting an integer division.
16454 A double-word or a variable shift may give an incorrect result if executed
16455 while an integer multiplication is in progress.
16457 An integer division may give an incorrect result if started in a delay slot
16458 of a taken branch or a jump.
16462 @itemx -mno-fix-r4400
16463 @opindex mfix-r4400
16464 @opindex mno-fix-r4400
16465 Work around certain R4400 CPU errata:
16468 A double-word or a variable shift may give an incorrect result if executed
16469 immediately after starting an integer division.
16473 @itemx -mno-fix-r10000
16474 @opindex mfix-r10000
16475 @opindex mno-fix-r10000
16476 Work around certain R10000 errata:
16479 @code{ll}/@code{sc} sequences may not behave atomically on revisions
16480 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
16483 This option can only be used if the target architecture supports
16484 branch-likely instructions. @option{-mfix-r10000} is the default when
16485 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
16489 @itemx -mno-fix-vr4120
16490 @opindex mfix-vr4120
16491 Work around certain VR4120 errata:
16494 @code{dmultu} does not always produce the correct result.
16496 @code{div} and @code{ddiv} do not always produce the correct result if one
16497 of the operands is negative.
16499 The workarounds for the division errata rely on special functions in
16500 @file{libgcc.a}. At present, these functions are only provided by
16501 the @code{mips64vr*-elf} configurations.
16503 Other VR4120 errata require a NOP to be inserted between certain pairs of
16504 instructions. These errata are handled by the assembler, not by GCC itself.
16507 @opindex mfix-vr4130
16508 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
16509 workarounds are implemented by the assembler rather than by GCC,
16510 although GCC avoids using @code{mflo} and @code{mfhi} if the
16511 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
16512 instructions are available instead.
16515 @itemx -mno-fix-sb1
16517 Work around certain SB-1 CPU core errata.
16518 (This flag currently works around the SB-1 revision 2
16519 ``F1'' and ``F2'' floating-point errata.)
16521 @item -mr10k-cache-barrier=@var{setting}
16522 @opindex mr10k-cache-barrier
16523 Specify whether GCC should insert cache barriers to avoid the
16524 side-effects of speculation on R10K processors.
16526 In common with many processors, the R10K tries to predict the outcome
16527 of a conditional branch and speculatively executes instructions from
16528 the ``taken'' branch. It later aborts these instructions if the
16529 predicted outcome is wrong. However, on the R10K, even aborted
16530 instructions can have side effects.
16532 This problem only affects kernel stores and, depending on the system,
16533 kernel loads. As an example, a speculatively-executed store may load
16534 the target memory into cache and mark the cache line as dirty, even if
16535 the store itself is later aborted. If a DMA operation writes to the
16536 same area of memory before the ``dirty'' line is flushed, the cached
16537 data overwrites the DMA-ed data. See the R10K processor manual
16538 for a full description, including other potential problems.
16540 One workaround is to insert cache barrier instructions before every memory
16541 access that might be speculatively executed and that might have side
16542 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
16543 controls GCC's implementation of this workaround. It assumes that
16544 aborted accesses to any byte in the following regions does not have
16549 the memory occupied by the current function's stack frame;
16552 the memory occupied by an incoming stack argument;
16555 the memory occupied by an object with a link-time-constant address.
16558 It is the kernel's responsibility to ensure that speculative
16559 accesses to these regions are indeed safe.
16561 If the input program contains a function declaration such as:
16567 then the implementation of @code{foo} must allow @code{j foo} and
16568 @code{jal foo} to be executed speculatively. GCC honors this
16569 restriction for functions it compiles itself. It expects non-GCC
16570 functions (such as hand-written assembly code) to do the same.
16572 The option has three forms:
16575 @item -mr10k-cache-barrier=load-store
16576 Insert a cache barrier before a load or store that might be
16577 speculatively executed and that might have side effects even
16580 @item -mr10k-cache-barrier=store
16581 Insert a cache barrier before a store that might be speculatively
16582 executed and that might have side effects even if aborted.
16584 @item -mr10k-cache-barrier=none
16585 Disable the insertion of cache barriers. This is the default setting.
16588 @item -mflush-func=@var{func}
16589 @itemx -mno-flush-func
16590 @opindex mflush-func
16591 Specifies the function to call to flush the I and D caches, or to not
16592 call any such function. If called, the function must take the same
16593 arguments as the common @code{_flush_func()}, that is, the address of the
16594 memory range for which the cache is being flushed, the size of the
16595 memory range, and the number 3 (to flush both caches). The default
16596 depends on the target GCC was configured for, but commonly is either
16597 @samp{_flush_func} or @samp{__cpu_flush}.
16599 @item mbranch-cost=@var{num}
16600 @opindex mbranch-cost
16601 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16602 This cost is only a heuristic and is not guaranteed to produce
16603 consistent results across releases. A zero cost redundantly selects
16604 the default, which is based on the @option{-mtune} setting.
16606 @item -mbranch-likely
16607 @itemx -mno-branch-likely
16608 @opindex mbranch-likely
16609 @opindex mno-branch-likely
16610 Enable or disable use of Branch Likely instructions, regardless of the
16611 default for the selected architecture. By default, Branch Likely
16612 instructions may be generated if they are supported by the selected
16613 architecture. An exception is for the MIPS32 and MIPS64 architectures
16614 and processors that implement those architectures; for those, Branch
16615 Likely instructions are not be generated by default because the MIPS32
16616 and MIPS64 architectures specifically deprecate their use.
16618 @item -mfp-exceptions
16619 @itemx -mno-fp-exceptions
16620 @opindex mfp-exceptions
16621 Specifies whether FP exceptions are enabled. This affects how
16622 FP instructions are scheduled for some processors.
16623 The default is that FP exceptions are
16626 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
16627 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
16630 @item -mvr4130-align
16631 @itemx -mno-vr4130-align
16632 @opindex mvr4130-align
16633 The VR4130 pipeline is two-way superscalar, but can only issue two
16634 instructions together if the first one is 8-byte aligned. When this
16635 option is enabled, GCC aligns pairs of instructions that it
16636 thinks should execute in parallel.
16638 This option only has an effect when optimizing for the VR4130.
16639 It normally makes code faster, but at the expense of making it bigger.
16640 It is enabled by default at optimization level @option{-O3}.
16645 Enable (disable) generation of @code{synci} instructions on
16646 architectures that support it. The @code{synci} instructions (if
16647 enabled) are generated when @code{__builtin___clear_cache()} is
16650 This option defaults to @code{-mno-synci}, but the default can be
16651 overridden by configuring with @code{--with-synci}.
16653 When compiling code for single processor systems, it is generally safe
16654 to use @code{synci}. However, on many multi-core (SMP) systems, it
16655 does not invalidate the instruction caches on all cores and may lead
16656 to undefined behavior.
16658 @item -mrelax-pic-calls
16659 @itemx -mno-relax-pic-calls
16660 @opindex mrelax-pic-calls
16661 Try to turn PIC calls that are normally dispatched via register
16662 @code{$25} into direct calls. This is only possible if the linker can
16663 resolve the destination at link-time and if the destination is within
16664 range for a direct call.
16666 @option{-mrelax-pic-calls} is the default if GCC was configured to use
16667 an assembler and a linker that support the @code{.reloc} assembly
16668 directive and @code{-mexplicit-relocs} is in effect. With
16669 @code{-mno-explicit-relocs}, this optimization can be performed by the
16670 assembler and the linker alone without help from the compiler.
16672 @item -mmcount-ra-address
16673 @itemx -mno-mcount-ra-address
16674 @opindex mmcount-ra-address
16675 @opindex mno-mcount-ra-address
16676 Emit (do not emit) code that allows @code{_mcount} to modify the
16677 calling function's return address. When enabled, this option extends
16678 the usual @code{_mcount} interface with a new @var{ra-address}
16679 parameter, which has type @code{intptr_t *} and is passed in register
16680 @code{$12}. @code{_mcount} can then modify the return address by
16681 doing both of the following:
16684 Returning the new address in register @code{$31}.
16686 Storing the new address in @code{*@var{ra-address}},
16687 if @var{ra-address} is nonnull.
16690 The default is @option{-mno-mcount-ra-address}.
16695 @subsection MMIX Options
16696 @cindex MMIX Options
16698 These options are defined for the MMIX:
16702 @itemx -mno-libfuncs
16704 @opindex mno-libfuncs
16705 Specify that intrinsic library functions are being compiled, passing all
16706 values in registers, no matter the size.
16709 @itemx -mno-epsilon
16711 @opindex mno-epsilon
16712 Generate floating-point comparison instructions that compare with respect
16713 to the @code{rE} epsilon register.
16715 @item -mabi=mmixware
16717 @opindex mabi=mmixware
16719 Generate code that passes function parameters and return values that (in
16720 the called function) are seen as registers @code{$0} and up, as opposed to
16721 the GNU ABI which uses global registers @code{$231} and up.
16723 @item -mzero-extend
16724 @itemx -mno-zero-extend
16725 @opindex mzero-extend
16726 @opindex mno-zero-extend
16727 When reading data from memory in sizes shorter than 64 bits, use (do not
16728 use) zero-extending load instructions by default, rather than
16729 sign-extending ones.
16732 @itemx -mno-knuthdiv
16734 @opindex mno-knuthdiv
16735 Make the result of a division yielding a remainder have the same sign as
16736 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
16737 remainder follows the sign of the dividend. Both methods are
16738 arithmetically valid, the latter being almost exclusively used.
16740 @item -mtoplevel-symbols
16741 @itemx -mno-toplevel-symbols
16742 @opindex mtoplevel-symbols
16743 @opindex mno-toplevel-symbols
16744 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
16745 code can be used with the @code{PREFIX} assembly directive.
16749 Generate an executable in the ELF format, rather than the default
16750 @samp{mmo} format used by the @command{mmix} simulator.
16752 @item -mbranch-predict
16753 @itemx -mno-branch-predict
16754 @opindex mbranch-predict
16755 @opindex mno-branch-predict
16756 Use (do not use) the probable-branch instructions, when static branch
16757 prediction indicates a probable branch.
16759 @item -mbase-addresses
16760 @itemx -mno-base-addresses
16761 @opindex mbase-addresses
16762 @opindex mno-base-addresses
16763 Generate (do not generate) code that uses @emph{base addresses}. Using a
16764 base address automatically generates a request (handled by the assembler
16765 and the linker) for a constant to be set up in a global register. The
16766 register is used for one or more base address requests within the range 0
16767 to 255 from the value held in the register. The generally leads to short
16768 and fast code, but the number of different data items that can be
16769 addressed is limited. This means that a program that uses lots of static
16770 data may require @option{-mno-base-addresses}.
16772 @item -msingle-exit
16773 @itemx -mno-single-exit
16774 @opindex msingle-exit
16775 @opindex mno-single-exit
16776 Force (do not force) generated code to have a single exit point in each
16780 @node MN10300 Options
16781 @subsection MN10300 Options
16782 @cindex MN10300 options
16784 These @option{-m} options are defined for Matsushita MN10300 architectures:
16789 Generate code to avoid bugs in the multiply instructions for the MN10300
16790 processors. This is the default.
16792 @item -mno-mult-bug
16793 @opindex mno-mult-bug
16794 Do not generate code to avoid bugs in the multiply instructions for the
16795 MN10300 processors.
16799 Generate code using features specific to the AM33 processor.
16803 Do not generate code using features specific to the AM33 processor. This
16808 Generate code using features specific to the AM33/2.0 processor.
16812 Generate code using features specific to the AM34 processor.
16814 @item -mtune=@var{cpu-type}
16816 Use the timing characteristics of the indicated CPU type when
16817 scheduling instructions. This does not change the targeted processor
16818 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
16819 @samp{am33-2} or @samp{am34}.
16821 @item -mreturn-pointer-on-d0
16822 @opindex mreturn-pointer-on-d0
16823 When generating a function that returns a pointer, return the pointer
16824 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
16825 only in @code{a0}, and attempts to call such functions without a prototype
16826 result in errors. Note that this option is on by default; use
16827 @option{-mno-return-pointer-on-d0} to disable it.
16831 Do not link in the C run-time initialization object file.
16835 Indicate to the linker that it should perform a relaxation optimization pass
16836 to shorten branches, calls and absolute memory addresses. This option only
16837 has an effect when used on the command line for the final link step.
16839 This option makes symbolic debugging impossible.
16843 Allow the compiler to generate @emph{Long Instruction Word}
16844 instructions if the target is the @samp{AM33} or later. This is the
16845 default. This option defines the preprocessor macro @samp{__LIW__}.
16849 Do not allow the compiler to generate @emph{Long Instruction Word}
16850 instructions. This option defines the preprocessor macro
16855 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
16856 instructions if the target is the @samp{AM33} or later. This is the
16857 default. This option defines the preprocessor macro @samp{__SETLB__}.
16861 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
16862 instructions. This option defines the preprocessor macro
16863 @samp{__NO_SETLB__}.
16867 @node Moxie Options
16868 @subsection Moxie Options
16869 @cindex Moxie Options
16875 Generate big-endian code. This is the default for @samp{moxie-*-*}
16880 Generate little-endian code.
16884 Do not link in the C run-time initialization object file.
16888 @node PDP-11 Options
16889 @subsection PDP-11 Options
16890 @cindex PDP-11 Options
16892 These options are defined for the PDP-11:
16897 Use hardware FPP floating point. This is the default. (FIS floating
16898 point on the PDP-11/40 is not supported.)
16901 @opindex msoft-float
16902 Do not use hardware floating point.
16906 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
16910 Return floating-point results in memory. This is the default.
16914 Generate code for a PDP-11/40.
16918 Generate code for a PDP-11/45. This is the default.
16922 Generate code for a PDP-11/10.
16924 @item -mbcopy-builtin
16925 @opindex mbcopy-builtin
16926 Use inline @code{movmemhi} patterns for copying memory. This is the
16931 Do not use inline @code{movmemhi} patterns for copying memory.
16937 Use 16-bit @code{int}. This is the default.
16943 Use 32-bit @code{int}.
16946 @itemx -mno-float32
16948 @opindex mno-float32
16949 Use 64-bit @code{float}. This is the default.
16952 @itemx -mno-float64
16954 @opindex mno-float64
16955 Use 32-bit @code{float}.
16959 Use @code{abshi2} pattern. This is the default.
16963 Do not use @code{abshi2} pattern.
16965 @item -mbranch-expensive
16966 @opindex mbranch-expensive
16967 Pretend that branches are expensive. This is for experimenting with
16968 code generation only.
16970 @item -mbranch-cheap
16971 @opindex mbranch-cheap
16972 Do not pretend that branches are expensive. This is the default.
16976 Use Unix assembler syntax. This is the default when configured for
16977 @samp{pdp11-*-bsd}.
16981 Use DEC assembler syntax. This is the default when configured for any
16982 PDP-11 target other than @samp{pdp11-*-bsd}.
16985 @node picoChip Options
16986 @subsection picoChip Options
16987 @cindex picoChip options
16989 These @samp{-m} options are defined for picoChip implementations:
16993 @item -mae=@var{ae_type}
16995 Set the instruction set, register set, and instruction scheduling
16996 parameters for array element type @var{ae_type}. Supported values
16997 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
16999 @option{-mae=ANY} selects a completely generic AE type. Code
17000 generated with this option runs on any of the other AE types. The
17001 code is not as efficient as it would be if compiled for a specific
17002 AE type, and some types of operation (e.g., multiplication) do not
17003 work properly on all types of AE.
17005 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
17006 for compiled code, and is the default.
17008 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
17009 option may suffer from poor performance of byte (char) manipulation,
17010 since the DSP AE does not provide hardware support for byte load/stores.
17012 @item -msymbol-as-address
17013 Enable the compiler to directly use a symbol name as an address in a
17014 load/store instruction, without first loading it into a
17015 register. Typically, the use of this option generates larger
17016 programs, which run faster than when the option isn't used. However, the
17017 results vary from program to program, so it is left as a user option,
17018 rather than being permanently enabled.
17020 @item -mno-inefficient-warnings
17021 Disables warnings about the generation of inefficient code. These
17022 warnings can be generated, for example, when compiling code that
17023 performs byte-level memory operations on the MAC AE type. The MAC AE has
17024 no hardware support for byte-level memory operations, so all byte
17025 load/stores must be synthesized from word load/store operations. This is
17026 inefficient and a warning is generated to indicate
17027 that you should rewrite the code to avoid byte operations, or to target
17028 an AE type that has the necessary hardware support. This option disables
17033 @node PowerPC Options
17034 @subsection PowerPC Options
17035 @cindex PowerPC options
17037 These are listed under @xref{RS/6000 and PowerPC Options}.
17040 @subsection RL78 Options
17041 @cindex RL78 Options
17047 Links in additional target libraries to support operation within a
17054 Specifies the type of hardware multiplication support to be used. The
17055 default is @code{none}, which uses software multiplication functions.
17056 The @code{g13} option is for the hardware multiply/divide peripheral
17057 only on the RL78/G13 targets. The @code{rl78} option is for the
17058 standard hardware multiplication defined in the RL78 software manual.
17062 @node RS/6000 and PowerPC Options
17063 @subsection IBM RS/6000 and PowerPC Options
17064 @cindex RS/6000 and PowerPC Options
17065 @cindex IBM RS/6000 and PowerPC Options
17067 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
17069 @item -mpowerpc-gpopt
17070 @itemx -mno-powerpc-gpopt
17071 @itemx -mpowerpc-gfxopt
17072 @itemx -mno-powerpc-gfxopt
17075 @itemx -mno-powerpc64
17079 @itemx -mno-popcntb
17081 @itemx -mno-popcntd
17090 @itemx -mno-hard-dfp
17091 @opindex mpowerpc-gpopt
17092 @opindex mno-powerpc-gpopt
17093 @opindex mpowerpc-gfxopt
17094 @opindex mno-powerpc-gfxopt
17095 @opindex mpowerpc64
17096 @opindex mno-powerpc64
17100 @opindex mno-popcntb
17102 @opindex mno-popcntd
17108 @opindex mno-mfpgpr
17110 @opindex mno-hard-dfp
17111 You use these options to specify which instructions are available on the
17112 processor you are using. The default value of these options is
17113 determined when configuring GCC@. Specifying the
17114 @option{-mcpu=@var{cpu_type}} overrides the specification of these
17115 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
17116 rather than the options listed above.
17118 Specifying @option{-mpowerpc-gpopt} allows
17119 GCC to use the optional PowerPC architecture instructions in the
17120 General Purpose group, including floating-point square root. Specifying
17121 @option{-mpowerpc-gfxopt} allows GCC to
17122 use the optional PowerPC architecture instructions in the Graphics
17123 group, including floating-point select.
17125 The @option{-mmfcrf} option allows GCC to generate the move from
17126 condition register field instruction implemented on the POWER4
17127 processor and other processors that support the PowerPC V2.01
17129 The @option{-mpopcntb} option allows GCC to generate the popcount and
17130 double-precision FP reciprocal estimate instruction implemented on the
17131 POWER5 processor and other processors that support the PowerPC V2.02
17133 The @option{-mpopcntd} option allows GCC to generate the popcount
17134 instruction implemented on the POWER7 processor and other processors
17135 that support the PowerPC V2.06 architecture.
17136 The @option{-mfprnd} option allows GCC to generate the FP round to
17137 integer instructions implemented on the POWER5+ processor and other
17138 processors that support the PowerPC V2.03 architecture.
17139 The @option{-mcmpb} option allows GCC to generate the compare bytes
17140 instruction implemented on the POWER6 processor and other processors
17141 that support the PowerPC V2.05 architecture.
17142 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
17143 general-purpose register instructions implemented on the POWER6X
17144 processor and other processors that support the extended PowerPC V2.05
17146 The @option{-mhard-dfp} option allows GCC to generate the decimal
17147 floating-point instructions implemented on some POWER processors.
17149 The @option{-mpowerpc64} option allows GCC to generate the additional
17150 64-bit instructions that are found in the full PowerPC64 architecture
17151 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
17152 @option{-mno-powerpc64}.
17154 @item -mcpu=@var{cpu_type}
17156 Set architecture type, register usage, and
17157 instruction scheduling parameters for machine type @var{cpu_type}.
17158 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
17159 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
17160 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
17161 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
17162 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
17163 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
17164 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
17165 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
17166 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
17167 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc},
17168 @samp{powerpc64}, and @samp{rs64}.
17170 @option{-mcpu=powerpc}, and @option{-mcpu=powerpc64} specify pure 32-bit
17171 PowerPC and 64-bit PowerPC architecture machine
17172 types, with an appropriate, generic processor model assumed for
17173 scheduling purposes.
17175 The other options specify a specific processor. Code generated under
17176 those options runs best on that processor, and may not run at all on
17179 The @option{-mcpu} options automatically enable or disable the
17182 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
17183 -mpopcntb -mpopcntd -mpowerpc64 @gol
17184 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
17185 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx}
17187 The particular options set for any particular CPU varies between
17188 compiler versions, depending on what setting seems to produce optimal
17189 code for that CPU; it doesn't necessarily reflect the actual hardware's
17190 capabilities. If you wish to set an individual option to a particular
17191 value, you may specify it after the @option{-mcpu} option, like
17192 @option{-mcpu=970 -mno-altivec}.
17194 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
17195 not enabled or disabled by the @option{-mcpu} option at present because
17196 AIX does not have full support for these options. You may still
17197 enable or disable them individually if you're sure it'll work in your
17200 @item -mtune=@var{cpu_type}
17202 Set the instruction scheduling parameters for machine type
17203 @var{cpu_type}, but do not set the architecture type or register usage,
17204 as @option{-mcpu=@var{cpu_type}} does. The same
17205 values for @var{cpu_type} are used for @option{-mtune} as for
17206 @option{-mcpu}. If both are specified, the code generated uses the
17207 architecture and registers set by @option{-mcpu}, but the
17208 scheduling parameters set by @option{-mtune}.
17210 @item -mcmodel=small
17211 @opindex mcmodel=small
17212 Generate PowerPC64 code for the small model: The TOC is limited to
17215 @item -mcmodel=medium
17216 @opindex mcmodel=medium
17217 Generate PowerPC64 code for the medium model: The TOC and other static
17218 data may be up to a total of 4G in size.
17220 @item -mcmodel=large
17221 @opindex mcmodel=large
17222 Generate PowerPC64 code for the large model: The TOC may be up to 4G
17223 in size. Other data and code is only limited by the 64-bit address
17227 @itemx -mno-altivec
17229 @opindex mno-altivec
17230 Generate code that uses (does not use) AltiVec instructions, and also
17231 enable the use of built-in functions that allow more direct access to
17232 the AltiVec instruction set. You may also need to set
17233 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
17239 @opindex mno-vrsave
17240 Generate VRSAVE instructions when generating AltiVec code.
17242 @item -mgen-cell-microcode
17243 @opindex mgen-cell-microcode
17244 Generate Cell microcode instructions.
17246 @item -mwarn-cell-microcode
17247 @opindex mwarn-cell-microcode
17248 Warn when a Cell microcode instruction is emitted. An example
17249 of a Cell microcode instruction is a variable shift.
17252 @opindex msecure-plt
17253 Generate code that allows @command{ld} and @command{ld.so}
17254 to build executables and shared
17255 libraries with non-executable @code{.plt} and @code{.got} sections.
17257 32-bit SYSV ABI option.
17261 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
17263 requires @code{.plt} and @code{.got}
17264 sections that are both writable and executable.
17265 This is a PowerPC 32-bit SYSV ABI option.
17271 This switch enables or disables the generation of ISEL instructions.
17273 @item -misel=@var{yes/no}
17274 This switch has been deprecated. Use @option{-misel} and
17275 @option{-mno-isel} instead.
17281 This switch enables or disables the generation of SPE simd
17287 @opindex mno-paired
17288 This switch enables or disables the generation of PAIRED simd
17291 @item -mspe=@var{yes/no}
17292 This option has been deprecated. Use @option{-mspe} and
17293 @option{-mno-spe} instead.
17299 Generate code that uses (does not use) vector/scalar (VSX)
17300 instructions, and also enable the use of built-in functions that allow
17301 more direct access to the VSX instruction set.
17303 @item -mfloat-gprs=@var{yes/single/double/no}
17304 @itemx -mfloat-gprs
17305 @opindex mfloat-gprs
17306 This switch enables or disables the generation of floating-point
17307 operations on the general-purpose registers for architectures that
17310 The argument @var{yes} or @var{single} enables the use of
17311 single-precision floating-point operations.
17313 The argument @var{double} enables the use of single and
17314 double-precision floating-point operations.
17316 The argument @var{no} disables floating-point operations on the
17317 general-purpose registers.
17319 This option is currently only available on the MPC854x.
17325 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
17326 targets (including GNU/Linux). The 32-bit environment sets int, long
17327 and pointer to 32 bits and generates code that runs on any PowerPC
17328 variant. The 64-bit environment sets int to 32 bits and long and
17329 pointer to 64 bits, and generates code for PowerPC64, as for
17330 @option{-mpowerpc64}.
17333 @itemx -mno-fp-in-toc
17334 @itemx -mno-sum-in-toc
17335 @itemx -mminimal-toc
17337 @opindex mno-fp-in-toc
17338 @opindex mno-sum-in-toc
17339 @opindex mminimal-toc
17340 Modify generation of the TOC (Table Of Contents), which is created for
17341 every executable file. The @option{-mfull-toc} option is selected by
17342 default. In that case, GCC allocates at least one TOC entry for
17343 each unique non-automatic variable reference in your program. GCC
17344 also places floating-point constants in the TOC@. However, only
17345 16,384 entries are available in the TOC@.
17347 If you receive a linker error message that saying you have overflowed
17348 the available TOC space, you can reduce the amount of TOC space used
17349 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
17350 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
17351 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
17352 generate code to calculate the sum of an address and a constant at
17353 run time instead of putting that sum into the TOC@. You may specify one
17354 or both of these options. Each causes GCC to produce very slightly
17355 slower and larger code at the expense of conserving TOC space.
17357 If you still run out of space in the TOC even when you specify both of
17358 these options, specify @option{-mminimal-toc} instead. This option causes
17359 GCC to make only one TOC entry for every file. When you specify this
17360 option, GCC produces code that is slower and larger but which
17361 uses extremely little TOC space. You may wish to use this option
17362 only on files that contain less frequently-executed code.
17368 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
17369 @code{long} type, and the infrastructure needed to support them.
17370 Specifying @option{-maix64} implies @option{-mpowerpc64},
17371 while @option{-maix32} disables the 64-bit ABI and
17372 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
17375 @itemx -mno-xl-compat
17376 @opindex mxl-compat
17377 @opindex mno-xl-compat
17378 Produce code that conforms more closely to IBM XL compiler semantics
17379 when using AIX-compatible ABI@. Pass floating-point arguments to
17380 prototyped functions beyond the register save area (RSA) on the stack
17381 in addition to argument FPRs. Do not assume that most significant
17382 double in 128-bit long double value is properly rounded when comparing
17383 values and converting to double. Use XL symbol names for long double
17386 The AIX calling convention was extended but not initially documented to
17387 handle an obscure K&R C case of calling a function that takes the
17388 address of its arguments with fewer arguments than declared. IBM XL
17389 compilers access floating-point arguments that do not fit in the
17390 RSA from the stack when a subroutine is compiled without
17391 optimization. Because always storing floating-point arguments on the
17392 stack is inefficient and rarely needed, this option is not enabled by
17393 default and only is necessary when calling subroutines compiled by IBM
17394 XL compilers without optimization.
17398 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
17399 application written to use message passing with special startup code to
17400 enable the application to run. The system must have PE installed in the
17401 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
17402 must be overridden with the @option{-specs=} option to specify the
17403 appropriate directory location. The Parallel Environment does not
17404 support threads, so the @option{-mpe} option and the @option{-pthread}
17405 option are incompatible.
17407 @item -malign-natural
17408 @itemx -malign-power
17409 @opindex malign-natural
17410 @opindex malign-power
17411 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
17412 @option{-malign-natural} overrides the ABI-defined alignment of larger
17413 types, such as floating-point doubles, on their natural size-based boundary.
17414 The option @option{-malign-power} instructs GCC to follow the ABI-specified
17415 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
17417 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
17421 @itemx -mhard-float
17422 @opindex msoft-float
17423 @opindex mhard-float
17424 Generate code that does not use (uses) the floating-point register set.
17425 Software floating-point emulation is provided if you use the
17426 @option{-msoft-float} option, and pass the option to GCC when linking.
17428 @item -msingle-float
17429 @itemx -mdouble-float
17430 @opindex msingle-float
17431 @opindex mdouble-float
17432 Generate code for single- or double-precision floating-point operations.
17433 @option{-mdouble-float} implies @option{-msingle-float}.
17436 @opindex msimple-fpu
17437 Do not generate @code{sqrt} and @code{div} instructions for hardware
17438 floating-point unit.
17440 @item -mfpu=@var{name}
17442 Specify type of floating-point unit. Valid values for @var{name} are
17443 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
17444 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
17445 @samp{sp_full} (equivalent to @option{-msingle-float}),
17446 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
17449 @opindex mxilinx-fpu
17450 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
17453 @itemx -mno-multiple
17455 @opindex mno-multiple
17456 Generate code that uses (does not use) the load multiple word
17457 instructions and the store multiple word instructions. These
17458 instructions are generated by default on POWER systems, and not
17459 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
17460 PowerPC systems, since those instructions do not work when the
17461 processor is in little-endian mode. The exceptions are PPC740 and
17462 PPC750 which permit these instructions in little-endian mode.
17467 @opindex mno-string
17468 Generate code that uses (does not use) the load string instructions
17469 and the store string word instructions to save multiple registers and
17470 do small block moves. These instructions are generated by default on
17471 POWER systems, and not generated on PowerPC systems. Do not use
17472 @option{-mstring} on little-endian PowerPC systems, since those
17473 instructions do not work when the processor is in little-endian mode.
17474 The exceptions are PPC740 and PPC750 which permit these instructions
17475 in little-endian mode.
17480 @opindex mno-update
17481 Generate code that uses (does not use) the load or store instructions
17482 that update the base register to the address of the calculated memory
17483 location. These instructions are generated by default. If you use
17484 @option{-mno-update}, there is a small window between the time that the
17485 stack pointer is updated and the address of the previous frame is
17486 stored, which means code that walks the stack frame across interrupts or
17487 signals may get corrupted data.
17489 @item -mavoid-indexed-addresses
17490 @itemx -mno-avoid-indexed-addresses
17491 @opindex mavoid-indexed-addresses
17492 @opindex mno-avoid-indexed-addresses
17493 Generate code that tries to avoid (not avoid) the use of indexed load
17494 or store instructions. These instructions can incur a performance
17495 penalty on Power6 processors in certain situations, such as when
17496 stepping through large arrays that cross a 16M boundary. This option
17497 is enabled by default when targeting Power6 and disabled otherwise.
17500 @itemx -mno-fused-madd
17501 @opindex mfused-madd
17502 @opindex mno-fused-madd
17503 Generate code that uses (does not use) the floating-point multiply and
17504 accumulate instructions. These instructions are generated by default
17505 if hardware floating point is used. The machine-dependent
17506 @option{-mfused-madd} option is now mapped to the machine-independent
17507 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
17508 mapped to @option{-ffp-contract=off}.
17514 Generate code that uses (does not use) the half-word multiply and
17515 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
17516 These instructions are generated by default when targeting those
17523 Generate code that uses (does not use) the string-search @samp{dlmzb}
17524 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
17525 generated by default when targeting those processors.
17527 @item -mno-bit-align
17529 @opindex mno-bit-align
17530 @opindex mbit-align
17531 On System V.4 and embedded PowerPC systems do not (do) force structures
17532 and unions that contain bit-fields to be aligned to the base type of the
17535 For example, by default a structure containing nothing but 8
17536 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
17537 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
17538 the structure is aligned to a 1-byte boundary and is 1 byte in
17541 @item -mno-strict-align
17542 @itemx -mstrict-align
17543 @opindex mno-strict-align
17544 @opindex mstrict-align
17545 On System V.4 and embedded PowerPC systems do not (do) assume that
17546 unaligned memory references are handled by the system.
17548 @item -mrelocatable
17549 @itemx -mno-relocatable
17550 @opindex mrelocatable
17551 @opindex mno-relocatable
17552 Generate code that allows (does not allow) a static executable to be
17553 relocated to a different address at run time. A simple embedded
17554 PowerPC system loader should relocate the entire contents of
17555 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
17556 a table of 32-bit addresses generated by this option. For this to
17557 work, all objects linked together must be compiled with
17558 @option{-mrelocatable} or @option{-mrelocatable-lib}.
17559 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
17561 @item -mrelocatable-lib
17562 @itemx -mno-relocatable-lib
17563 @opindex mrelocatable-lib
17564 @opindex mno-relocatable-lib
17565 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
17566 @code{.fixup} section to allow static executables to be relocated at
17567 run time, but @option{-mrelocatable-lib} does not use the smaller stack
17568 alignment of @option{-mrelocatable}. Objects compiled with
17569 @option{-mrelocatable-lib} may be linked with objects compiled with
17570 any combination of the @option{-mrelocatable} options.
17576 On System V.4 and embedded PowerPC systems do not (do) assume that
17577 register 2 contains a pointer to a global area pointing to the addresses
17578 used in the program.
17581 @itemx -mlittle-endian
17583 @opindex mlittle-endian
17584 On System V.4 and embedded PowerPC systems compile code for the
17585 processor in little-endian mode. The @option{-mlittle-endian} option is
17586 the same as @option{-mlittle}.
17589 @itemx -mbig-endian
17591 @opindex mbig-endian
17592 On System V.4 and embedded PowerPC systems compile code for the
17593 processor in big-endian mode. The @option{-mbig-endian} option is
17594 the same as @option{-mbig}.
17596 @item -mdynamic-no-pic
17597 @opindex mdynamic-no-pic
17598 On Darwin and Mac OS X systems, compile code so that it is not
17599 relocatable, but that its external references are relocatable. The
17600 resulting code is suitable for applications, but not shared
17603 @item -msingle-pic-base
17604 @opindex msingle-pic-base
17605 Treat the register used for PIC addressing as read-only, rather than
17606 loading it in the prologue for each function. The runtime system is
17607 responsible for initializing this register with an appropriate value
17608 before execution begins.
17610 @item -mprioritize-restricted-insns=@var{priority}
17611 @opindex mprioritize-restricted-insns
17612 This option controls the priority that is assigned to
17613 dispatch-slot restricted instructions during the second scheduling
17614 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
17615 or @samp{2} to assign no, highest, or second-highest (respectively)
17616 priority to dispatch-slot restricted
17619 @item -msched-costly-dep=@var{dependence_type}
17620 @opindex msched-costly-dep
17621 This option controls which dependences are considered costly
17622 by the target during instruction scheduling. The argument
17623 @var{dependence_type} takes one of the following values:
17627 No dependence is costly.
17630 All dependences are costly.
17632 @item @samp{true_store_to_load}
17633 A true dependence from store to load is costly.
17635 @item @samp{store_to_load}
17636 Any dependence from store to load is costly.
17639 Any dependence for which the latency is greater than or equal to
17640 @var{number} is costly.
17643 @item -minsert-sched-nops=@var{scheme}
17644 @opindex minsert-sched-nops
17645 This option controls which NOP insertion scheme is used during
17646 the second scheduling pass. The argument @var{scheme} takes one of the
17654 Pad with NOPs any dispatch group that has vacant issue slots,
17655 according to the scheduler's grouping.
17657 @item @samp{regroup_exact}
17658 Insert NOPs to force costly dependent insns into
17659 separate groups. Insert exactly as many NOPs as needed to force an insn
17660 to a new group, according to the estimated processor grouping.
17663 Insert NOPs to force costly dependent insns into
17664 separate groups. Insert @var{number} NOPs to force an insn to a new group.
17668 @opindex mcall-sysv
17669 On System V.4 and embedded PowerPC systems compile code using calling
17670 conventions that adhere to the March 1995 draft of the System V
17671 Application Binary Interface, PowerPC processor supplement. This is the
17672 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
17674 @item -mcall-sysv-eabi
17676 @opindex mcall-sysv-eabi
17677 @opindex mcall-eabi
17678 Specify both @option{-mcall-sysv} and @option{-meabi} options.
17680 @item -mcall-sysv-noeabi
17681 @opindex mcall-sysv-noeabi
17682 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
17684 @item -mcall-aixdesc
17686 On System V.4 and embedded PowerPC systems compile code for the AIX
17690 @opindex mcall-linux
17691 On System V.4 and embedded PowerPC systems compile code for the
17692 Linux-based GNU system.
17694 @item -mcall-freebsd
17695 @opindex mcall-freebsd
17696 On System V.4 and embedded PowerPC systems compile code for the
17697 FreeBSD operating system.
17699 @item -mcall-netbsd
17700 @opindex mcall-netbsd
17701 On System V.4 and embedded PowerPC systems compile code for the
17702 NetBSD operating system.
17704 @item -mcall-openbsd
17705 @opindex mcall-netbsd
17706 On System V.4 and embedded PowerPC systems compile code for the
17707 OpenBSD operating system.
17709 @item -maix-struct-return
17710 @opindex maix-struct-return
17711 Return all structures in memory (as specified by the AIX ABI)@.
17713 @item -msvr4-struct-return
17714 @opindex msvr4-struct-return
17715 Return structures smaller than 8 bytes in registers (as specified by the
17718 @item -mabi=@var{abi-type}
17720 Extend the current ABI with a particular extension, or remove such extension.
17721 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
17722 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
17726 Extend the current ABI with SPE ABI extensions. This does not change
17727 the default ABI, instead it adds the SPE ABI extensions to the current
17731 @opindex mabi=no-spe
17732 Disable Book-E SPE ABI extensions for the current ABI@.
17734 @item -mabi=ibmlongdouble
17735 @opindex mabi=ibmlongdouble
17736 Change the current ABI to use IBM extended-precision long double.
17737 This is a PowerPC 32-bit SYSV ABI option.
17739 @item -mabi=ieeelongdouble
17740 @opindex mabi=ieeelongdouble
17741 Change the current ABI to use IEEE extended-precision long double.
17742 This is a PowerPC 32-bit Linux ABI option.
17745 @itemx -mno-prototype
17746 @opindex mprototype
17747 @opindex mno-prototype
17748 On System V.4 and embedded PowerPC systems assume that all calls to
17749 variable argument functions are properly prototyped. Otherwise, the
17750 compiler must insert an instruction before every non-prototyped call to
17751 set or clear bit 6 of the condition code register (@var{CR}) to
17752 indicate whether floating-point values are passed in the floating-point
17753 registers in case the function takes variable arguments. With
17754 @option{-mprototype}, only calls to prototyped variable argument functions
17755 set or clear the bit.
17759 On embedded PowerPC systems, assume that the startup module is called
17760 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
17761 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
17766 On embedded PowerPC systems, assume that the startup module is called
17767 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
17772 On embedded PowerPC systems, assume that the startup module is called
17773 @file{crt0.o} and the standard C libraries are @file{libads.a} and
17776 @item -myellowknife
17777 @opindex myellowknife
17778 On embedded PowerPC systems, assume that the startup module is called
17779 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
17784 On System V.4 and embedded PowerPC systems, specify that you are
17785 compiling for a VxWorks system.
17789 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
17790 header to indicate that @samp{eabi} extended relocations are used.
17796 On System V.4 and embedded PowerPC systems do (do not) adhere to the
17797 Embedded Applications Binary Interface (EABI), which is a set of
17798 modifications to the System V.4 specifications. Selecting @option{-meabi}
17799 means that the stack is aligned to an 8-byte boundary, a function
17800 @code{__eabi} is called from @code{main} to set up the EABI
17801 environment, and the @option{-msdata} option can use both @code{r2} and
17802 @code{r13} to point to two separate small data areas. Selecting
17803 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
17804 no EABI initialization function is called from @code{main}, and the
17805 @option{-msdata} option only uses @code{r13} to point to a single
17806 small data area. The @option{-meabi} option is on by default if you
17807 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
17810 @opindex msdata=eabi
17811 On System V.4 and embedded PowerPC systems, put small initialized
17812 @code{const} global and static data in the @samp{.sdata2} section, which
17813 is pointed to by register @code{r2}. Put small initialized
17814 non-@code{const} global and static data in the @samp{.sdata} section,
17815 which is pointed to by register @code{r13}. Put small uninitialized
17816 global and static data in the @samp{.sbss} section, which is adjacent to
17817 the @samp{.sdata} section. The @option{-msdata=eabi} option is
17818 incompatible with the @option{-mrelocatable} option. The
17819 @option{-msdata=eabi} option also sets the @option{-memb} option.
17822 @opindex msdata=sysv
17823 On System V.4 and embedded PowerPC systems, put small global and static
17824 data in the @samp{.sdata} section, which is pointed to by register
17825 @code{r13}. Put small uninitialized global and static data in the
17826 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
17827 The @option{-msdata=sysv} option is incompatible with the
17828 @option{-mrelocatable} option.
17830 @item -msdata=default
17832 @opindex msdata=default
17834 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
17835 compile code the same as @option{-msdata=eabi}, otherwise compile code the
17836 same as @option{-msdata=sysv}.
17839 @opindex msdata=data
17840 On System V.4 and embedded PowerPC systems, put small global
17841 data in the @samp{.sdata} section. Put small uninitialized global
17842 data in the @samp{.sbss} section. Do not use register @code{r13}
17843 to address small data however. This is the default behavior unless
17844 other @option{-msdata} options are used.
17848 @opindex msdata=none
17850 On embedded PowerPC systems, put all initialized global and static data
17851 in the @samp{.data} section, and all uninitialized data in the
17852 @samp{.bss} section.
17854 @item -mblock-move-inline-limit=@var{num}
17855 @opindex mblock-move-inline-limit
17856 Inline all block moves (such as calls to @code{memcpy} or structure
17857 copies) less than or equal to @var{num} bytes. The minimum value for
17858 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
17859 targets. The default value is target-specific.
17863 @cindex smaller data references (PowerPC)
17864 @cindex .sdata/.sdata2 references (PowerPC)
17865 On embedded PowerPC systems, put global and static items less than or
17866 equal to @var{num} bytes into the small data or BSS sections instead of
17867 the normal data or BSS section. By default, @var{num} is 8. The
17868 @option{-G @var{num}} switch is also passed to the linker.
17869 All modules should be compiled with the same @option{-G @var{num}} value.
17872 @itemx -mno-regnames
17874 @opindex mno-regnames
17875 On System V.4 and embedded PowerPC systems do (do not) emit register
17876 names in the assembly language output using symbolic forms.
17879 @itemx -mno-longcall
17881 @opindex mno-longcall
17882 By default assume that all calls are far away so that a longer and more
17883 expensive calling sequence is required. This is required for calls
17884 farther than 32 megabytes (33,554,432 bytes) from the current location.
17885 A short call is generated if the compiler knows
17886 the call cannot be that far away. This setting can be overridden by
17887 the @code{shortcall} function attribute, or by @code{#pragma
17890 Some linkers are capable of detecting out-of-range calls and generating
17891 glue code on the fly. On these systems, long calls are unnecessary and
17892 generate slower code. As of this writing, the AIX linker can do this,
17893 as can the GNU linker for PowerPC/64. It is planned to add this feature
17894 to the GNU linker for 32-bit PowerPC systems as well.
17896 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
17897 callee, L42}, plus a @dfn{branch island} (glue code). The two target
17898 addresses represent the callee and the branch island. The
17899 Darwin/PPC linker prefers the first address and generates a @code{bl
17900 callee} if the PPC @code{bl} instruction reaches the callee directly;
17901 otherwise, the linker generates @code{bl L42} to call the branch
17902 island. The branch island is appended to the body of the
17903 calling function; it computes the full 32-bit address of the callee
17906 On Mach-O (Darwin) systems, this option directs the compiler emit to
17907 the glue for every direct call, and the Darwin linker decides whether
17908 to use or discard it.
17910 In the future, GCC may ignore all longcall specifications
17911 when the linker is known to generate glue.
17913 @item -mtls-markers
17914 @itemx -mno-tls-markers
17915 @opindex mtls-markers
17916 @opindex mno-tls-markers
17917 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
17918 specifying the function argument. The relocation allows the linker to
17919 reliably associate function call with argument setup instructions for
17920 TLS optimization, which in turn allows GCC to better schedule the
17925 Adds support for multithreading with the @dfn{pthreads} library.
17926 This option sets flags for both the preprocessor and linker.
17931 This option enables use of the reciprocal estimate and
17932 reciprocal square root estimate instructions with additional
17933 Newton-Raphson steps to increase precision instead of doing a divide or
17934 square root and divide for floating-point arguments. You should use
17935 the @option{-ffast-math} option when using @option{-mrecip} (or at
17936 least @option{-funsafe-math-optimizations},
17937 @option{-finite-math-only}, @option{-freciprocal-math} and
17938 @option{-fno-trapping-math}). Note that while the throughput of the
17939 sequence is generally higher than the throughput of the non-reciprocal
17940 instruction, the precision of the sequence can be decreased by up to 2
17941 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
17944 @item -mrecip=@var{opt}
17945 @opindex mrecip=opt
17946 This option controls which reciprocal estimate instructions
17947 may be used. @var{opt} is a comma-separated list of options, which may
17948 be preceded by a @code{!} to invert the option:
17949 @code{all}: enable all estimate instructions,
17950 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
17951 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
17952 @code{div}: enable the reciprocal approximation instructions for both single and double precision;
17953 @code{divf}: enable the single-precision reciprocal approximation instructions;
17954 @code{divd}: enable the double-precision reciprocal approximation instructions;
17955 @code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
17956 @code{rsqrtf}: enable the single-precision reciprocal square root approximation instructions;
17957 @code{rsqrtd}: enable the double-precision reciprocal square root approximation instructions;
17959 So, for example, @option{-mrecip=all,!rsqrtd} enables
17960 all of the reciprocal estimate instructions, except for the
17961 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
17962 which handle the double-precision reciprocal square root calculations.
17964 @item -mrecip-precision
17965 @itemx -mno-recip-precision
17966 @opindex mrecip-precision
17967 Assume (do not assume) that the reciprocal estimate instructions
17968 provide higher-precision estimates than is mandated by the PowerPC
17969 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
17970 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
17971 The double-precision square root estimate instructions are not generated by
17972 default on low-precision machines, since they do not provide an
17973 estimate that converges after three steps.
17975 @item -mveclibabi=@var{type}
17976 @opindex mveclibabi
17977 Specifies the ABI type to use for vectorizing intrinsics using an
17978 external library. The only type supported at present is @code{mass},
17979 which specifies to use IBM's Mathematical Acceleration Subsystem
17980 (MASS) libraries for vectorizing intrinsics using external libraries.
17981 GCC currently emits calls to @code{acosd2}, @code{acosf4},
17982 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
17983 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
17984 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
17985 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
17986 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
17987 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
17988 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
17989 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
17990 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
17991 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
17992 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
17993 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
17994 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
17995 for power7. Both @option{-ftree-vectorize} and
17996 @option{-funsafe-math-optimizations} must also be enabled. The MASS
17997 libraries must be specified at link time.
18002 Generate (do not generate) the @code{friz} instruction when the
18003 @option{-funsafe-math-optimizations} option is used to optimize
18004 rounding of floating-point values to 64-bit integer and back to floating
18005 point. The @code{friz} instruction does not return the same value if
18006 the floating-point number is too large to fit in an integer.
18008 @item -mpointers-to-nested-functions
18009 @itemx -mno-pointers-to-nested-functions
18010 @opindex mpointers-to-nested-functions
18011 Generate (do not generate) code to load up the static chain register
18012 (@var{r11}) when calling through a pointer on AIX and 64-bit Linux
18013 systems where a function pointer points to a 3-word descriptor giving
18014 the function address, TOC value to be loaded in register @var{r2}, and
18015 static chain value to be loaded in register @var{r11}. The
18016 @option{-mpointers-to-nested-functions} is on by default. You cannot
18017 call through pointers to nested functions or pointers
18018 to functions compiled in other languages that use the static chain if
18019 you use the @option{-mno-pointers-to-nested-functions}.
18021 @item -msave-toc-indirect
18022 @itemx -mno-save-toc-indirect
18023 @opindex msave-toc-indirect
18024 Generate (do not generate) code to save the TOC value in the reserved
18025 stack location in the function prologue if the function calls through
18026 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
18027 saved in the prologue, it is saved just before the call through the
18028 pointer. The @option{-mno-save-toc-indirect} option is the default.
18032 @subsection RX Options
18035 These command-line options are defined for RX targets:
18038 @item -m64bit-doubles
18039 @itemx -m32bit-doubles
18040 @opindex m64bit-doubles
18041 @opindex m32bit-doubles
18042 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
18043 or 32 bits (@option{-m32bit-doubles}) in size. The default is
18044 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
18045 works on 32-bit values, which is why the default is
18046 @option{-m32bit-doubles}.
18052 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
18053 floating-point hardware. The default is enabled for the @var{RX600}
18054 series and disabled for the @var{RX200} series.
18056 Floating-point instructions are only generated for 32-bit floating-point
18057 values, however, so the FPU hardware is not used for doubles if the
18058 @option{-m64bit-doubles} option is used.
18060 @emph{Note} If the @option{-fpu} option is enabled then
18061 @option{-funsafe-math-optimizations} is also enabled automatically.
18062 This is because the RX FPU instructions are themselves unsafe.
18064 @item -mcpu=@var{name}
18066 Selects the type of RX CPU to be targeted. Currently three types are
18067 supported, the generic @var{RX600} and @var{RX200} series hardware and
18068 the specific @var{RX610} CPU. The default is @var{RX600}.
18070 The only difference between @var{RX600} and @var{RX610} is that the
18071 @var{RX610} does not support the @code{MVTIPL} instruction.
18073 The @var{RX200} series does not have a hardware floating-point unit
18074 and so @option{-nofpu} is enabled by default when this type is
18077 @item -mbig-endian-data
18078 @itemx -mlittle-endian-data
18079 @opindex mbig-endian-data
18080 @opindex mlittle-endian-data
18081 Store data (but not code) in the big-endian format. The default is
18082 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
18085 @item -msmall-data-limit=@var{N}
18086 @opindex msmall-data-limit
18087 Specifies the maximum size in bytes of global and static variables
18088 which can be placed into the small data area. Using the small data
18089 area can lead to smaller and faster code, but the size of area is
18090 limited and it is up to the programmer to ensure that the area does
18091 not overflow. Also when the small data area is used one of the RX's
18092 registers (usually @code{r13}) is reserved for use pointing to this
18093 area, so it is no longer available for use by the compiler. This
18094 could result in slower and/or larger code if variables are pushed onto
18095 the stack instead of being held in this register.
18097 Note, common variables (variables that have not been initialized) and
18098 constants are not placed into the small data area as they are assigned
18099 to other sections in the output executable.
18101 The default value is zero, which disables this feature. Note, this
18102 feature is not enabled by default with higher optimization levels
18103 (@option{-O2} etc) because of the potentially detrimental effects of
18104 reserving a register. It is up to the programmer to experiment and
18105 discover whether this feature is of benefit to their program. See the
18106 description of the @option{-mpid} option for a description of how the
18107 actual register to hold the small data area pointer is chosen.
18113 Use the simulator runtime. The default is to use the libgloss
18114 board-specific runtime.
18116 @item -mas100-syntax
18117 @itemx -mno-as100-syntax
18118 @opindex mas100-syntax
18119 @opindex mno-as100-syntax
18120 When generating assembler output use a syntax that is compatible with
18121 Renesas's AS100 assembler. This syntax can also be handled by the GAS
18122 assembler, but it has some restrictions so it is not generated by default.
18124 @item -mmax-constant-size=@var{N}
18125 @opindex mmax-constant-size
18126 Specifies the maximum size, in bytes, of a constant that can be used as
18127 an operand in a RX instruction. Although the RX instruction set does
18128 allow constants of up to 4 bytes in length to be used in instructions,
18129 a longer value equates to a longer instruction. Thus in some
18130 circumstances it can be beneficial to restrict the size of constants
18131 that are used in instructions. Constants that are too big are instead
18132 placed into a constant pool and referenced via register indirection.
18134 The value @var{N} can be between 0 and 4. A value of 0 (the default)
18135 or 4 means that constants of any size are allowed.
18139 Enable linker relaxation. Linker relaxation is a process whereby the
18140 linker attempts to reduce the size of a program by finding shorter
18141 versions of various instructions. Disabled by default.
18143 @item -mint-register=@var{N}
18144 @opindex mint-register
18145 Specify the number of registers to reserve for fast interrupt handler
18146 functions. The value @var{N} can be between 0 and 4. A value of 1
18147 means that register @code{r13} is reserved for the exclusive use
18148 of fast interrupt handlers. A value of 2 reserves @code{r13} and
18149 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
18150 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
18151 A value of 0, the default, does not reserve any registers.
18153 @item -msave-acc-in-interrupts
18154 @opindex msave-acc-in-interrupts
18155 Specifies that interrupt handler functions should preserve the
18156 accumulator register. This is only necessary if normal code might use
18157 the accumulator register, for example because it performs 64-bit
18158 multiplications. The default is to ignore the accumulator as this
18159 makes the interrupt handlers faster.
18165 Enables the generation of position independent data. When enabled any
18166 access to constant data is done via an offset from a base address
18167 held in a register. This allows the location of constant data to be
18168 determined at run time without requiring the executable to be
18169 relocated, which is a benefit to embedded applications with tight
18170 memory constraints. Data that can be modified is not affected by this
18173 Note, using this feature reserves a register, usually @code{r13}, for
18174 the constant data base address. This can result in slower and/or
18175 larger code, especially in complicated functions.
18177 The actual register chosen to hold the constant data base address
18178 depends upon whether the @option{-msmall-data-limit} and/or the
18179 @option{-mint-register} command-line options are enabled. Starting
18180 with register @code{r13} and proceeding downwards, registers are
18181 allocated first to satisfy the requirements of @option{-mint-register},
18182 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
18183 is possible for the small data area register to be @code{r8} if both
18184 @option{-mint-register=4} and @option{-mpid} are specified on the
18187 By default this feature is not enabled. The default can be restored
18188 via the @option{-mno-pid} command-line option.
18190 @item -mno-warn-multiple-fast-interrupts
18191 @itemx -mwarn-multiple-fast-interrupts
18192 @opindex mno-warn-multiple-fast-interrupts
18193 @opindex mwarn-multiple-fast-interrupts
18194 Prevents GCC from issuing a warning message if it finds more than one
18195 fast interrupt handler when it is compiling a file. The default is to
18196 issue a warning for each extra fast interrupt handler found, as the RX
18197 only supports one such interrupt.
18201 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
18202 has special significance to the RX port when used with the
18203 @code{interrupt} function attribute. This attribute indicates a
18204 function intended to process fast interrupts. GCC ensures
18205 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
18206 and/or @code{r13} and only provided that the normal use of the
18207 corresponding registers have been restricted via the
18208 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
18211 @node S/390 and zSeries Options
18212 @subsection S/390 and zSeries Options
18213 @cindex S/390 and zSeries Options
18215 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
18219 @itemx -msoft-float
18220 @opindex mhard-float
18221 @opindex msoft-float
18222 Use (do not use) the hardware floating-point instructions and registers
18223 for floating-point operations. When @option{-msoft-float} is specified,
18224 functions in @file{libgcc.a} are used to perform floating-point
18225 operations. When @option{-mhard-float} is specified, the compiler
18226 generates IEEE floating-point instructions. This is the default.
18229 @itemx -mno-hard-dfp
18231 @opindex mno-hard-dfp
18232 Use (do not use) the hardware decimal-floating-point instructions for
18233 decimal-floating-point operations. When @option{-mno-hard-dfp} is
18234 specified, functions in @file{libgcc.a} are used to perform
18235 decimal-floating-point operations. When @option{-mhard-dfp} is
18236 specified, the compiler generates decimal-floating-point hardware
18237 instructions. This is the default for @option{-march=z9-ec} or higher.
18239 @item -mlong-double-64
18240 @itemx -mlong-double-128
18241 @opindex mlong-double-64
18242 @opindex mlong-double-128
18243 These switches control the size of @code{long double} type. A size
18244 of 64 bits makes the @code{long double} type equivalent to the @code{double}
18245 type. This is the default.
18248 @itemx -mno-backchain
18249 @opindex mbackchain
18250 @opindex mno-backchain
18251 Store (do not store) the address of the caller's frame as backchain pointer
18252 into the callee's stack frame.
18253 A backchain may be needed to allow debugging using tools that do not understand
18254 DWARF 2 call frame information.
18255 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
18256 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
18257 the backchain is placed into the topmost word of the 96/160 byte register
18260 In general, code compiled with @option{-mbackchain} is call-compatible with
18261 code compiled with @option{-mmo-backchain}; however, use of the backchain
18262 for debugging purposes usually requires that the whole binary is built with
18263 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
18264 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
18265 to build a linux kernel use @option{-msoft-float}.
18267 The default is to not maintain the backchain.
18269 @item -mpacked-stack
18270 @itemx -mno-packed-stack
18271 @opindex mpacked-stack
18272 @opindex mno-packed-stack
18273 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
18274 specified, the compiler uses the all fields of the 96/160 byte register save
18275 area only for their default purpose; unused fields still take up stack space.
18276 When @option{-mpacked-stack} is specified, register save slots are densely
18277 packed at the top of the register save area; unused space is reused for other
18278 purposes, allowing for more efficient use of the available stack space.
18279 However, when @option{-mbackchain} is also in effect, the topmost word of
18280 the save area is always used to store the backchain, and the return address
18281 register is always saved two words below the backchain.
18283 As long as the stack frame backchain is not used, code generated with
18284 @option{-mpacked-stack} is call-compatible with code generated with
18285 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
18286 S/390 or zSeries generated code that uses the stack frame backchain at run
18287 time, not just for debugging purposes. Such code is not call-compatible
18288 with code compiled with @option{-mpacked-stack}. Also, note that the
18289 combination of @option{-mbackchain},
18290 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
18291 to build a linux kernel use @option{-msoft-float}.
18293 The default is to not use the packed stack layout.
18296 @itemx -mno-small-exec
18297 @opindex msmall-exec
18298 @opindex mno-small-exec
18299 Generate (or do not generate) code using the @code{bras} instruction
18300 to do subroutine calls.
18301 This only works reliably if the total executable size does not
18302 exceed 64k. The default is to use the @code{basr} instruction instead,
18303 which does not have this limitation.
18309 When @option{-m31} is specified, generate code compliant to the
18310 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
18311 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
18312 particular to generate 64-bit instructions. For the @samp{s390}
18313 targets, the default is @option{-m31}, while the @samp{s390x}
18314 targets default to @option{-m64}.
18320 When @option{-mzarch} is specified, generate code using the
18321 instructions available on z/Architecture.
18322 When @option{-mesa} is specified, generate code using the
18323 instructions available on ESA/390. Note that @option{-mesa} is
18324 not possible with @option{-m64}.
18325 When generating code compliant to the GNU/Linux for S/390 ABI,
18326 the default is @option{-mesa}. When generating code compliant
18327 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
18333 Generate (or do not generate) code using the @code{mvcle} instruction
18334 to perform block moves. When @option{-mno-mvcle} is specified,
18335 use a @code{mvc} loop instead. This is the default unless optimizing for
18342 Print (or do not print) additional debug information when compiling.
18343 The default is to not print debug information.
18345 @item -march=@var{cpu-type}
18347 Generate code that runs on @var{cpu-type}, which is the name of a system
18348 representing a certain processor type. Possible values for
18349 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
18350 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
18351 When generating code using the instructions available on z/Architecture,
18352 the default is @option{-march=z900}. Otherwise, the default is
18353 @option{-march=g5}.
18355 @item -mtune=@var{cpu-type}
18357 Tune to @var{cpu-type} everything applicable about the generated code,
18358 except for the ABI and the set of available instructions.
18359 The list of @var{cpu-type} values is the same as for @option{-march}.
18360 The default is the value used for @option{-march}.
18363 @itemx -mno-tpf-trace
18364 @opindex mtpf-trace
18365 @opindex mno-tpf-trace
18366 Generate code that adds (does not add) in TPF OS specific branches to trace
18367 routines in the operating system. This option is off by default, even
18368 when compiling for the TPF OS@.
18371 @itemx -mno-fused-madd
18372 @opindex mfused-madd
18373 @opindex mno-fused-madd
18374 Generate code that uses (does not use) the floating-point multiply and
18375 accumulate instructions. These instructions are generated by default if
18376 hardware floating point is used.
18378 @item -mwarn-framesize=@var{framesize}
18379 @opindex mwarn-framesize
18380 Emit a warning if the current function exceeds the given frame size. Because
18381 this is a compile-time check it doesn't need to be a real problem when the program
18382 runs. It is intended to identify functions that most probably cause
18383 a stack overflow. It is useful to be used in an environment with limited stack
18384 size e.g.@: the linux kernel.
18386 @item -mwarn-dynamicstack
18387 @opindex mwarn-dynamicstack
18388 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
18389 arrays. This is generally a bad idea with a limited stack size.
18391 @item -mstack-guard=@var{stack-guard}
18392 @itemx -mstack-size=@var{stack-size}
18393 @opindex mstack-guard
18394 @opindex mstack-size
18395 If these options are provided the S/390 back end emits additional instructions in
18396 the function prologue that trigger a trap if the stack size is @var{stack-guard}
18397 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
18398 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
18399 the frame size of the compiled function is chosen.
18400 These options are intended to be used to help debugging stack overflow problems.
18401 The additionally emitted code causes only little overhead and hence can also be
18402 used in production-like systems without greater performance degradation. The given
18403 values have to be exact powers of 2 and @var{stack-size} has to be greater than
18404 @var{stack-guard} without exceeding 64k.
18405 In order to be efficient the extra code makes the assumption that the stack starts
18406 at an address aligned to the value given by @var{stack-size}.
18407 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
18410 @node Score Options
18411 @subsection Score Options
18412 @cindex Score Options
18414 These options are defined for Score implementations:
18419 Compile code for big-endian mode. This is the default.
18423 Compile code for little-endian mode.
18427 Disable generation of @code{bcnz} instructions.
18431 Enable generation of unaligned load and store instructions.
18435 Enable the use of multiply-accumulate instructions. Disabled by default.
18439 Specify the SCORE5 as the target architecture.
18443 Specify the SCORE5U of the target architecture.
18447 Specify the SCORE7 as the target architecture. This is the default.
18451 Specify the SCORE7D as the target architecture.
18455 @subsection SH Options
18457 These @samp{-m} options are defined for the SH implementations:
18462 Generate code for the SH1.
18466 Generate code for the SH2.
18469 Generate code for the SH2e.
18473 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
18474 that the floating-point unit is not used.
18476 @item -m2a-single-only
18477 @opindex m2a-single-only
18478 Generate code for the SH2a-FPU, in such a way that no double-precision
18479 floating-point operations are used.
18482 @opindex m2a-single
18483 Generate code for the SH2a-FPU assuming the floating-point unit is in
18484 single-precision mode by default.
18488 Generate code for the SH2a-FPU assuming the floating-point unit is in
18489 double-precision mode by default.
18493 Generate code for the SH3.
18497 Generate code for the SH3e.
18501 Generate code for the SH4 without a floating-point unit.
18503 @item -m4-single-only
18504 @opindex m4-single-only
18505 Generate code for the SH4 with a floating-point unit that only
18506 supports single-precision arithmetic.
18510 Generate code for the SH4 assuming the floating-point unit is in
18511 single-precision mode by default.
18515 Generate code for the SH4.
18519 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
18520 floating-point unit is not used.
18522 @item -m4a-single-only
18523 @opindex m4a-single-only
18524 Generate code for the SH4a, in such a way that no double-precision
18525 floating-point operations are used.
18528 @opindex m4a-single
18529 Generate code for the SH4a assuming the floating-point unit is in
18530 single-precision mode by default.
18534 Generate code for the SH4a.
18538 Same as @option{-m4a-nofpu}, except that it implicitly passes
18539 @option{-dsp} to the assembler. GCC doesn't generate any DSP
18540 instructions at the moment.
18544 Compile code for the processor in big-endian mode.
18548 Compile code for the processor in little-endian mode.
18552 Align doubles at 64-bit boundaries. Note that this changes the calling
18553 conventions, and thus some functions from the standard C library do
18554 not work unless you recompile it first with @option{-mdalign}.
18558 Shorten some address references at link time, when possible; uses the
18559 linker option @option{-relax}.
18563 Use 32-bit offsets in @code{switch} tables. The default is to use
18568 Enable the use of bit manipulation instructions on SH2A.
18572 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
18573 alignment constraints.
18577 Comply with the calling conventions defined by Renesas.
18581 Comply with the calling conventions defined by Renesas.
18585 Comply with the calling conventions defined for GCC before the Renesas
18586 conventions were available. This option is the default for all
18587 targets of the SH toolchain.
18590 @opindex mnomacsave
18591 Mark the @code{MAC} register as call-clobbered, even if
18592 @option{-mhitachi} is given.
18598 Control the IEEE compliance of floating-point comparisons, which affects the
18599 handling of cases where the result of a comparison is unordered. By default
18600 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
18601 enabled @option{-mno-ieee} is implicitly set, which results in faster
18602 floating-point greater-equal and less-equal comparisons. The implcit settings
18603 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
18605 @item -minline-ic_invalidate
18606 @opindex minline-ic_invalidate
18607 Inline code to invalidate instruction cache entries after setting up
18608 nested function trampolines.
18609 This option has no effect if @option{-musermode} is in effect and the selected
18610 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
18612 If the selected code generation option does not allow the use of the @code{icbi}
18613 instruction, and @option{-musermode} is not in effect, the inlined code
18614 manipulates the instruction cache address array directly with an associative
18615 write. This not only requires privileged mode at run time, but it also
18616 fails if the cache line had been mapped via the TLB and has become unmapped.
18620 Dump instruction size and location in the assembly code.
18623 @opindex mpadstruct
18624 This option is deprecated. It pads structures to multiple of 4 bytes,
18625 which is incompatible with the SH ABI@.
18627 @item -matomic-model=@var{model}
18628 @opindex matomic-model=@var{model}
18629 Sets the model of atomic operations and additional parameters as a comma
18630 separated list. For details on the atomic built-in functions see
18631 @ref{__atomic Builtins}. The following models and parameters are supported:
18636 Disable compiler generated atomic sequences and emit library calls for atomic
18637 operations. This is the default if the target is not @code{sh-*-linux*}.
18640 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
18641 built-in functions. The generated atomic sequences require additional support
18642 from the interrupt/exception handling code of the system and are only suitable
18643 for SH3* and SH4* single-core systems. This option is enabled by default when
18644 the target is @code{sh-*-linux*} and SH3* or SH4*. When the target is SH4A,
18645 this option will also partially utilize the hardware atomic instructions
18646 @code{movli.l} and @code{movco.l} to create more efficient code, unless
18647 @samp{strict} is specified.
18650 Generate software atomic sequences that use a variable in the thread control
18651 block. This is a variation of the gUSA sequences which can also be used on
18652 SH1* and SH2* targets. The generated atomic sequences require additional
18653 support from the interrupt/exception handling code of the system and are only
18654 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
18655 parameter has to be specified as well.
18658 Generate software atomic sequences that temporarily disable interrupts by
18659 setting @code{SR.IMASK = 1111}. This model works only when the program runs
18660 in privileged mode and is only suitable for single-core systems. Additional
18661 support from the interrupt/exception handling code of the system is not
18662 required. This model is enabled by default when the target is
18663 @code{sh-*-linux*} and SH1* or SH2*.
18666 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
18667 instructions only. This is only available on SH4A and is suitable for
18668 multi-core systems. Since the hardware instructions support only 32 bit atomic
18669 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
18670 Code compiled with this option will also be compatible with other software
18671 atomic model interrupt/exception handling systems if executed on an SH4A
18672 system. Additional support from the interrupt/exception handling code of the
18673 system is not required for this model.
18676 This parameter specifies the offset in bytes of the variable in the thread
18677 control block structure that should be used by the generated atomic sequences
18678 when the @samp{soft-tcb} model has been selected. For other models this
18679 parameter is ignored. The specified value must be an integer multiple of four
18680 and in the range 0-1020.
18683 This parameter prevents mixed usage of multiple atomic models, even though they
18684 would be compatible, and will make the compiler generate atomic sequences of the
18685 specified model only.
18691 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
18692 Notice that depending on the particular hardware and software configuration
18693 this can degrade overall performance due to the operand cache line flushes
18694 that are implied by the @code{tas.b} instruction. On multi-core SH4A
18695 processors the @code{tas.b} instruction must be used with caution since it
18696 can result in data corruption for certain cache configurations.
18700 Optimize for space instead of speed. Implied by @option{-Os}.
18703 @opindex mprefergot
18704 When generating position-independent code, emit function calls using
18705 the Global Offset Table instead of the Procedure Linkage Table.
18709 Don't generate privileged mode only code. This option
18710 implies @option{-mno-inline-ic_invalidate}
18711 if the inlined code would not work in user mode.
18712 This is the default when the target is @code{sh-*-linux*}.
18714 @item -multcost=@var{number}
18715 @opindex multcost=@var{number}
18716 Set the cost to assume for a multiply insn.
18718 @item -mdiv=@var{strategy}
18719 @opindex mdiv=@var{strategy}
18720 Set the division strategy to use for SHmedia code. @var{strategy} must be
18726 Performs the operation in floating point. This has a very high latency,
18727 but needs only a few instructions, so it might be a good choice if
18728 your code has enough easily-exploitable ILP to allow the compiler to
18729 schedule the floating-point instructions together with other instructions.
18730 Division by zero causes a floating-point exception.
18733 Uses integer operations to calculate the inverse of the divisor,
18734 and then multiplies the dividend with the inverse. This strategy allows
18735 CSE and hoisting of the inverse calculation. Division by zero calculates
18736 an unspecified result, but does not trap.
18739 A variant of @samp{inv} where, if no CSE or hoisting opportunities
18740 have been found, or if the entire operation has been hoisted to the same
18741 place, the last stages of the inverse calculation are intertwined with the
18742 final multiply to reduce the overall latency, at the expense of using a few
18743 more instructions, and thus offering fewer scheduling opportunities with
18747 Calls a library function that usually implements the @samp{inv:minlat}
18749 This gives high code density for @code{m5-*media-nofpu} compilations.
18752 Uses a different entry point of the same library function, where it
18753 assumes that a pointer to a lookup table has already been set up, which
18754 exposes the pointer load to CSE and code hoisting optimizations.
18759 Use the @samp{inv} algorithm for initial
18760 code generation, but if the code stays unoptimized, revert to the @samp{call},
18761 @samp{call2}, or @samp{fp} strategies, respectively. Note that the
18762 potentially-trapping side effect of division by zero is carried by a
18763 separate instruction, so it is possible that all the integer instructions
18764 are hoisted out, but the marker for the side effect stays where it is.
18765 A recombination to floating-point operations or a call is not possible
18770 Variants of the @samp{inv:minlat} strategy. In the case
18771 that the inverse calculation is not separated from the multiply, they speed
18772 up division where the dividend fits into 20 bits (plus sign where applicable)
18773 by inserting a test to skip a number of operations in this case; this test
18774 slows down the case of larger dividends. @samp{inv20u} assumes the case of a such
18775 a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely.
18779 @item -maccumulate-outgoing-args
18780 @opindex maccumulate-outgoing-args
18781 Reserve space once for outgoing arguments in the function prologue rather
18782 than around each call. Generally beneficial for performance and size. Also
18783 needed for unwinding to avoid changing the stack frame around conditional code.
18785 @item -mdivsi3_libfunc=@var{name}
18786 @opindex mdivsi3_libfunc=@var{name}
18787 Set the name of the library function used for 32-bit signed division to
18789 This only affects the name used in the @samp{call} and @samp{inv:call}
18790 division strategies, and the compiler still expects the same
18791 sets of input/output/clobbered registers as if this option were not present.
18793 @item -mfixed-range=@var{register-range}
18794 @opindex mfixed-range
18795 Generate code treating the given register range as fixed registers.
18796 A fixed register is one that the register allocator can not use. This is
18797 useful when compiling kernel code. A register range is specified as
18798 two registers separated by a dash. Multiple register ranges can be
18799 specified separated by a comma.
18801 @item -mindexed-addressing
18802 @opindex mindexed-addressing
18803 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
18804 This is only safe if the hardware and/or OS implement 32-bit wrap-around
18805 semantics for the indexed addressing mode. The architecture allows the
18806 implementation of processors with 64-bit MMU, which the OS could use to
18807 get 32-bit addressing, but since no current hardware implementation supports
18808 this or any other way to make the indexed addressing mode safe to use in
18809 the 32-bit ABI, the default is @option{-mno-indexed-addressing}.
18811 @item -mgettrcost=@var{number}
18812 @opindex mgettrcost=@var{number}
18813 Set the cost assumed for the @code{gettr} instruction to @var{number}.
18814 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
18818 Assume @code{pt*} instructions won't trap. This generally generates
18819 better-scheduled code, but is unsafe on current hardware.
18820 The current architecture
18821 definition says that @code{ptabs} and @code{ptrel} trap when the target
18823 This has the unintentional effect of making it unsafe to schedule these
18824 instructions before a branch, or hoist them out of a loop. For example,
18825 @code{__do_global_ctors}, a part of @file{libgcc}
18826 that runs constructors at program
18827 startup, calls functions in a list which is delimited by @minus{}1. With the
18828 @option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1.
18829 That means that all the constructors run a bit more quickly, but when
18830 the loop comes to the end of the list, the program crashes because @code{ptabs}
18831 loads @minus{}1 into a target register.
18833 Since this option is unsafe for any
18834 hardware implementing the current architecture specification, the default
18835 is @option{-mno-pt-fixed}. Unless specified explicitly with
18836 @option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100};
18837 this deters register allocation from using target registers for storing
18840 @item -minvalid-symbols
18841 @opindex minvalid-symbols
18842 Assume symbols might be invalid. Ordinary function symbols generated by
18843 the compiler are always valid to load with
18844 @code{movi}/@code{shori}/@code{ptabs} or
18845 @code{movi}/@code{shori}/@code{ptrel},
18846 but with assembler and/or linker tricks it is possible
18847 to generate symbols that cause @code{ptabs} or @code{ptrel} to trap.
18848 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
18849 It prevents cross-basic-block CSE, hoisting and most scheduling
18850 of symbol loads. The default is @option{-mno-invalid-symbols}.
18852 @item -mbranch-cost=@var{num}
18853 @opindex mbranch-cost=@var{num}
18854 Assume @var{num} to be the cost for a branch instruction. Higher numbers
18855 make the compiler try to generate more branch-free code if possible.
18856 If not specified the value is selected depending on the processor type that
18857 is being compiled for.
18860 @itemx -mno-zdcbranch
18861 @opindex mzdcbranch
18862 @opindex mno-zdcbranch
18863 Assume (do not assume) that zero displacement conditional branch instructions
18864 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
18865 compiler will try to prefer zero displacement branch code sequences. This is
18866 enabled by default when generating code for SH4 and SH4A. It can be explicitly
18867 disabled by specifying @option{-mno-zdcbranch}.
18870 @opindex mcbranchdi
18871 Enable the @code{cbranchdi4} instruction pattern.
18875 Emit the @code{cmpeqdi_t} instruction pattern even when @option{-mcbranchdi}
18879 @itemx -mno-fused-madd
18880 @opindex mfused-madd
18881 @opindex mno-fused-madd
18882 Generate code that uses (does not use) the floating-point multiply and
18883 accumulate instructions. These instructions are generated by default
18884 if hardware floating point is used. The machine-dependent
18885 @option{-mfused-madd} option is now mapped to the machine-independent
18886 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
18887 mapped to @option{-ffp-contract=off}.
18893 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
18894 and cosine approximations. The option @code{-mfsca} must be used in
18895 combination with @code{-funsafe-math-optimizations}. It is enabled by default
18896 when generating code for SH4A. Using @code{-mno-fsca} disables sine and cosine
18897 approximations even if @code{-funsafe-math-optimizations} is in effect.
18903 Allow or disallow the compiler to emit the @code{fsrra} instruction for
18904 reciprocal square root approximations. The option @code{-mfsrra} must be used
18905 in combination with @code{-funsafe-math-optimizations} and
18906 @code{-ffinite-math-only}. It is enabled by default when generating code for
18907 SH4A. Using @code{-mno-fsrra} disables reciprocal square root approximations
18908 even if @code{-funsafe-math-optimizations} and @code{-ffinite-math-only} are
18911 @item -mpretend-cmove
18912 @opindex mpretend-cmove
18913 Prefer zero-displacement conditional branches for conditional move instruction
18914 patterns. This can result in faster code on the SH4 processor.
18918 @node Solaris 2 Options
18919 @subsection Solaris 2 Options
18920 @cindex Solaris 2 options
18922 These @samp{-m} options are supported on Solaris 2:
18925 @item -mimpure-text
18926 @opindex mimpure-text
18927 @option{-mimpure-text}, used in addition to @option{-shared}, tells
18928 the compiler to not pass @option{-z text} to the linker when linking a
18929 shared object. Using this option, you can link position-dependent
18930 code into a shared object.
18932 @option{-mimpure-text} suppresses the ``relocations remain against
18933 allocatable but non-writable sections'' linker error message.
18934 However, the necessary relocations trigger copy-on-write, and the
18935 shared object is not actually shared across processes. Instead of
18936 using @option{-mimpure-text}, you should compile all source code with
18937 @option{-fpic} or @option{-fPIC}.
18941 These switches are supported in addition to the above on Solaris 2:
18946 Add support for multithreading using the POSIX threads library. This
18947 option sets flags for both the preprocessor and linker. This option does
18948 not affect the thread safety of object code produced by the compiler or
18949 that of libraries supplied with it.
18953 This is a synonym for @option{-pthreads}.
18956 @node SPARC Options
18957 @subsection SPARC Options
18958 @cindex SPARC options
18960 These @samp{-m} options are supported on the SPARC:
18963 @item -mno-app-regs
18965 @opindex mno-app-regs
18967 Specify @option{-mapp-regs} to generate output using the global registers
18968 2 through 4, which the SPARC SVR4 ABI reserves for applications. This
18971 To be fully SVR4 ABI-compliant at the cost of some performance loss,
18972 specify @option{-mno-app-regs}. You should compile libraries and system
18973 software with this option.
18979 With @option{-mflat}, the compiler does not generate save/restore instructions
18980 and uses a ``flat'' or single register window model. This model is compatible
18981 with the regular register window model. The local registers and the input
18982 registers (0--5) are still treated as ``call-saved'' registers and are
18983 saved on the stack as needed.
18985 With @option{-mno-flat} (the default), the compiler generates save/restore
18986 instructions (except for leaf functions). This is the normal operating mode.
18989 @itemx -mhard-float
18991 @opindex mhard-float
18992 Generate output containing floating-point instructions. This is the
18996 @itemx -msoft-float
18998 @opindex msoft-float
18999 Generate output containing library calls for floating point.
19000 @strong{Warning:} the requisite libraries are not available for all SPARC
19001 targets. Normally the facilities of the machine's usual C compiler are
19002 used, but this cannot be done directly in cross-compilation. You must make
19003 your own arrangements to provide suitable library functions for
19004 cross-compilation. The embedded targets @samp{sparc-*-aout} and
19005 @samp{sparclite-*-*} do provide software floating-point support.
19007 @option{-msoft-float} changes the calling convention in the output file;
19008 therefore, it is only useful if you compile @emph{all} of a program with
19009 this option. In particular, you need to compile @file{libgcc.a}, the
19010 library that comes with GCC, with @option{-msoft-float} in order for
19013 @item -mhard-quad-float
19014 @opindex mhard-quad-float
19015 Generate output containing quad-word (long double) floating-point
19018 @item -msoft-quad-float
19019 @opindex msoft-quad-float
19020 Generate output containing library calls for quad-word (long double)
19021 floating-point instructions. The functions called are those specified
19022 in the SPARC ABI@. This is the default.
19024 As of this writing, there are no SPARC implementations that have hardware
19025 support for the quad-word floating-point instructions. They all invoke
19026 a trap handler for one of these instructions, and then the trap handler
19027 emulates the effect of the instruction. Because of the trap handler overhead,
19028 this is much slower than calling the ABI library routines. Thus the
19029 @option{-msoft-quad-float} option is the default.
19031 @item -mno-unaligned-doubles
19032 @itemx -munaligned-doubles
19033 @opindex mno-unaligned-doubles
19034 @opindex munaligned-doubles
19035 Assume that doubles have 8-byte alignment. This is the default.
19037 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
19038 alignment only if they are contained in another type, or if they have an
19039 absolute address. Otherwise, it assumes they have 4-byte alignment.
19040 Specifying this option avoids some rare compatibility problems with code
19041 generated by other compilers. It is not the default because it results
19042 in a performance loss, especially for floating-point code.
19044 @item -mno-faster-structs
19045 @itemx -mfaster-structs
19046 @opindex mno-faster-structs
19047 @opindex mfaster-structs
19048 With @option{-mfaster-structs}, the compiler assumes that structures
19049 should have 8-byte alignment. This enables the use of pairs of
19050 @code{ldd} and @code{std} instructions for copies in structure
19051 assignment, in place of twice as many @code{ld} and @code{st} pairs.
19052 However, the use of this changed alignment directly violates the SPARC
19053 ABI@. Thus, it's intended only for use on targets where the developer
19054 acknowledges that their resulting code is not directly in line with
19055 the rules of the ABI@.
19057 @item -mcpu=@var{cpu_type}
19059 Set the instruction set, register set, and instruction scheduling parameters
19060 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
19061 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
19062 @samp{leon}, @samp{sparclite}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
19063 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
19064 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
19065 and @samp{niagara4}.
19067 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
19068 which selects the best architecture option for the host processor.
19069 @option{-mcpu=native} has no effect if GCC does not recognize
19072 Default instruction scheduling parameters are used for values that select
19073 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
19074 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
19076 Here is a list of each supported architecture and their supported
19084 supersparc, hypersparc, leon
19087 f930, f934, sparclite86x
19093 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
19096 By default (unless configured otherwise), GCC generates code for the V7
19097 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
19098 additionally optimizes it for the Cypress CY7C602 chip, as used in the
19099 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
19100 SPARCStation 1, 2, IPX etc.
19102 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
19103 architecture. The only difference from V7 code is that the compiler emits
19104 the integer multiply and integer divide instructions which exist in SPARC-V8
19105 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
19106 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
19109 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
19110 the SPARC architecture. This adds the integer multiply, integer divide step
19111 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
19112 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
19113 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
19114 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
19115 MB86934 chip, which is the more recent SPARClite with FPU@.
19117 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
19118 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
19119 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
19120 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
19121 optimizes it for the TEMIC SPARClet chip.
19123 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
19124 architecture. This adds 64-bit integer and floating-point move instructions,
19125 3 additional floating-point condition code registers and conditional move
19126 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
19127 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
19128 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
19129 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
19130 @option{-mcpu=niagara}, the compiler additionally optimizes it for
19131 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
19132 additionally optimizes it for Sun UltraSPARC T2 chips. With
19133 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
19134 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
19135 additionally optimizes it for Sun UltraSPARC T4 chips.
19137 @item -mtune=@var{cpu_type}
19139 Set the instruction scheduling parameters for machine type
19140 @var{cpu_type}, but do not set the instruction set or register set that the
19141 option @option{-mcpu=@var{cpu_type}} does.
19143 The same values for @option{-mcpu=@var{cpu_type}} can be used for
19144 @option{-mtune=@var{cpu_type}}, but the only useful values are those
19145 that select a particular CPU implementation. Those are @samp{cypress},
19146 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{f930}, @samp{f934},
19147 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, @samp{ultrasparc3},
19148 @samp{niagara}, @samp{niagara2}, @samp{niagara3} and @samp{niagara4}. With
19149 native Solaris and GNU/Linux toolchains, @samp{native} can also be used.
19154 @opindex mno-v8plus
19155 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
19156 difference from the V8 ABI is that the global and out registers are
19157 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
19158 mode for all SPARC-V9 processors.
19164 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
19165 Visual Instruction Set extensions. The default is @option{-mno-vis}.
19171 With @option{-mvis2}, GCC generates code that takes advantage of
19172 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
19173 default is @option{-mvis2} when targeting a cpu that supports such
19174 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
19175 also sets @option{-mvis}.
19181 With @option{-mvis3}, GCC generates code that takes advantage of
19182 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
19183 default is @option{-mvis3} when targeting a cpu that supports such
19184 instructions, such as niagara-3 and later. Setting @option{-mvis3}
19185 also sets @option{-mvis2} and @option{-mvis}.
19190 @opindex mno-cbcond
19191 With @option{-mcbcond}, GCC generates code that takes advantage of
19192 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
19193 The default is @option{-mcbcond} when targeting a cpu that supports such
19194 instructions, such as niagara-4 and later.
19200 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
19201 population count instruction. The default is @option{-mpopc}
19202 when targeting a cpu that supports such instructions, such as Niagara-2 and
19209 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
19210 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
19211 when targeting a cpu that supports such instructions, such as Niagara-3 and
19215 @opindex mfix-at697f
19216 Enable the documented workaround for the single erratum of the Atmel AT697F
19217 processor (which corresponds to erratum #13 of the AT697E processor).
19220 These @samp{-m} options are supported in addition to the above
19221 on SPARC-V9 processors in 64-bit environments:
19224 @item -mlittle-endian
19225 @opindex mlittle-endian
19226 Generate code for a processor running in little-endian mode. It is only
19227 available for a few configurations and most notably not on Solaris and Linux.
19233 Generate code for a 32-bit or 64-bit environment.
19234 The 32-bit environment sets int, long and pointer to 32 bits.
19235 The 64-bit environment sets int to 32 bits and long and pointer
19238 @item -mcmodel=@var{which}
19240 Set the code model to one of
19244 The Medium/Low code model: 64-bit addresses, programs
19245 must be linked in the low 32 bits of memory. Programs can be statically
19246 or dynamically linked.
19249 The Medium/Middle code model: 64-bit addresses, programs
19250 must be linked in the low 44 bits of memory, the text and data segments must
19251 be less than 2GB in size and the data segment must be located within 2GB of
19255 The Medium/Anywhere code model: 64-bit addresses, programs
19256 may be linked anywhere in memory, the text and data segments must be less
19257 than 2GB in size and the data segment must be located within 2GB of the
19261 The Medium/Anywhere code model for embedded systems:
19262 64-bit addresses, the text and data segments must be less than 2GB in
19263 size, both starting anywhere in memory (determined at link time). The
19264 global register %g4 points to the base of the data segment. Programs
19265 are statically linked and PIC is not supported.
19268 @item -mmemory-model=@var{mem-model}
19269 @opindex mmemory-model
19270 Set the memory model in force on the processor to one of
19274 The default memory model for the processor and operating system.
19277 Relaxed Memory Order
19280 Partial Store Order
19286 Sequential Consistency
19289 These memory models are formally defined in Appendix D of the Sparc V9
19290 architecture manual, as set in the processor's @code{PSTATE.MM} field.
19293 @itemx -mno-stack-bias
19294 @opindex mstack-bias
19295 @opindex mno-stack-bias
19296 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
19297 frame pointer if present, are offset by @minus{}2047 which must be added back
19298 when making stack frame references. This is the default in 64-bit mode.
19299 Otherwise, assume no such offset is present.
19303 @subsection SPU Options
19304 @cindex SPU options
19306 These @samp{-m} options are supported on the SPU:
19310 @itemx -merror-reloc
19311 @opindex mwarn-reloc
19312 @opindex merror-reloc
19314 The loader for SPU does not handle dynamic relocations. By default, GCC
19315 gives an error when it generates code that requires a dynamic
19316 relocation. @option{-mno-error-reloc} disables the error,
19317 @option{-mwarn-reloc} generates a warning instead.
19320 @itemx -munsafe-dma
19322 @opindex munsafe-dma
19324 Instructions that initiate or test completion of DMA must not be
19325 reordered with respect to loads and stores of the memory that is being
19327 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
19328 memory accesses, but that can lead to inefficient code in places where the
19329 memory is known to not change. Rather than mark the memory as volatile,
19330 you can use @option{-msafe-dma} to tell the compiler to treat
19331 the DMA instructions as potentially affecting all memory.
19333 @item -mbranch-hints
19334 @opindex mbranch-hints
19336 By default, GCC generates a branch hint instruction to avoid
19337 pipeline stalls for always-taken or probably-taken branches. A hint
19338 is not generated closer than 8 instructions away from its branch.
19339 There is little reason to disable them, except for debugging purposes,
19340 or to make an object a little bit smaller.
19344 @opindex msmall-mem
19345 @opindex mlarge-mem
19347 By default, GCC generates code assuming that addresses are never larger
19348 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
19349 a full 32-bit address.
19354 By default, GCC links against startup code that assumes the SPU-style
19355 main function interface (which has an unconventional parameter list).
19356 With @option{-mstdmain}, GCC links your program against startup
19357 code that assumes a C99-style interface to @code{main}, including a
19358 local copy of @code{argv} strings.
19360 @item -mfixed-range=@var{register-range}
19361 @opindex mfixed-range
19362 Generate code treating the given register range as fixed registers.
19363 A fixed register is one that the register allocator cannot use. This is
19364 useful when compiling kernel code. A register range is specified as
19365 two registers separated by a dash. Multiple register ranges can be
19366 specified separated by a comma.
19372 Compile code assuming that pointers to the PPU address space accessed
19373 via the @code{__ea} named address space qualifier are either 32 or 64
19374 bits wide. The default is 32 bits. As this is an ABI-changing option,
19375 all object code in an executable must be compiled with the same setting.
19377 @item -maddress-space-conversion
19378 @itemx -mno-address-space-conversion
19379 @opindex maddress-space-conversion
19380 @opindex mno-address-space-conversion
19381 Allow/disallow treating the @code{__ea} address space as superset
19382 of the generic address space. This enables explicit type casts
19383 between @code{__ea} and generic pointer as well as implicit
19384 conversions of generic pointers to @code{__ea} pointers. The
19385 default is to allow address space pointer conversions.
19387 @item -mcache-size=@var{cache-size}
19388 @opindex mcache-size
19389 This option controls the version of libgcc that the compiler links to an
19390 executable and selects a software-managed cache for accessing variables
19391 in the @code{__ea} address space with a particular cache size. Possible
19392 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
19393 and @samp{128}. The default cache size is 64KB.
19395 @item -matomic-updates
19396 @itemx -mno-atomic-updates
19397 @opindex matomic-updates
19398 @opindex mno-atomic-updates
19399 This option controls the version of libgcc that the compiler links to an
19400 executable and selects whether atomic updates to the software-managed
19401 cache of PPU-side variables are used. If you use atomic updates, changes
19402 to a PPU variable from SPU code using the @code{__ea} named address space
19403 qualifier do not interfere with changes to other PPU variables residing
19404 in the same cache line from PPU code. If you do not use atomic updates,
19405 such interference may occur; however, writing back cache lines is
19406 more efficient. The default behavior is to use atomic updates.
19409 @itemx -mdual-nops=@var{n}
19410 @opindex mdual-nops
19411 By default, GCC inserts nops to increase dual issue when it expects
19412 it to increase performance. @var{n} can be a value from 0 to 10. A
19413 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
19414 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
19416 @item -mhint-max-nops=@var{n}
19417 @opindex mhint-max-nops
19418 Maximum number of nops to insert for a branch hint. A branch hint must
19419 be at least 8 instructions away from the branch it is affecting. GCC
19420 inserts up to @var{n} nops to enforce this, otherwise it does not
19421 generate the branch hint.
19423 @item -mhint-max-distance=@var{n}
19424 @opindex mhint-max-distance
19425 The encoding of the branch hint instruction limits the hint to be within
19426 256 instructions of the branch it is affecting. By default, GCC makes
19427 sure it is within 125.
19430 @opindex msafe-hints
19431 Work around a hardware bug that causes the SPU to stall indefinitely.
19432 By default, GCC inserts the @code{hbrp} instruction to make sure
19433 this stall won't happen.
19437 @node System V Options
19438 @subsection Options for System V
19440 These additional options are available on System V Release 4 for
19441 compatibility with other compilers on those systems:
19446 Create a shared object.
19447 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
19451 Identify the versions of each tool used by the compiler, in a
19452 @code{.ident} assembler directive in the output.
19456 Refrain from adding @code{.ident} directives to the output file (this is
19459 @item -YP,@var{dirs}
19461 Search the directories @var{dirs}, and no others, for libraries
19462 specified with @option{-l}.
19464 @item -Ym,@var{dir}
19466 Look in the directory @var{dir} to find the M4 preprocessor.
19467 The assembler uses this option.
19468 @c This is supposed to go with a -Yd for predefined M4 macro files, but
19469 @c the generic assembler that comes with Solaris takes just -Ym.
19472 @node TILE-Gx Options
19473 @subsection TILE-Gx Options
19474 @cindex TILE-Gx options
19476 These @samp{-m} options are supported on the TILE-Gx:
19479 @item -mcmodel=small
19480 @opindex mcmodel=small
19481 Generate code for the small model. The distance for direct calls is
19482 limited to 500M in either direction. PC-relative addresses are 32
19483 bits. Absolute addresses support the full address range.
19485 @item -mcmodel=large
19486 @opindex mcmodel=large
19487 Generate code for the large model. There is no limitation on call
19488 distance, pc-relative addresses, or absolute addresses.
19490 @item -mcpu=@var{name}
19492 Selects the type of CPU to be targeted. Currently the only supported
19493 type is @samp{tilegx}.
19499 Generate code for a 32-bit or 64-bit environment. The 32-bit
19500 environment sets int, long, and pointer to 32 bits. The 64-bit
19501 environment sets int to 32 bits and long and pointer to 64 bits.
19504 @node TILEPro Options
19505 @subsection TILEPro Options
19506 @cindex TILEPro options
19508 These @samp{-m} options are supported on the TILEPro:
19511 @item -mcpu=@var{name}
19513 Selects the type of CPU to be targeted. Currently the only supported
19514 type is @samp{tilepro}.
19518 Generate code for a 32-bit environment, which sets int, long, and
19519 pointer to 32 bits. This is the only supported behavior so the flag
19520 is essentially ignored.
19524 @subsection V850 Options
19525 @cindex V850 Options
19527 These @samp{-m} options are defined for V850 implementations:
19531 @itemx -mno-long-calls
19532 @opindex mlong-calls
19533 @opindex mno-long-calls
19534 Treat all calls as being far away (near). If calls are assumed to be
19535 far away, the compiler always loads the function's address into a
19536 register, and calls indirect through the pointer.
19542 Do not optimize (do optimize) basic blocks that use the same index
19543 pointer 4 or more times to copy pointer into the @code{ep} register, and
19544 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
19545 option is on by default if you optimize.
19547 @item -mno-prolog-function
19548 @itemx -mprolog-function
19549 @opindex mno-prolog-function
19550 @opindex mprolog-function
19551 Do not use (do use) external functions to save and restore registers
19552 at the prologue and epilogue of a function. The external functions
19553 are slower, but use less code space if more than one function saves
19554 the same number of registers. The @option{-mprolog-function} option
19555 is on by default if you optimize.
19559 Try to make the code as small as possible. At present, this just turns
19560 on the @option{-mep} and @option{-mprolog-function} options.
19562 @item -mtda=@var{n}
19564 Put static or global variables whose size is @var{n} bytes or less into
19565 the tiny data area that register @code{ep} points to. The tiny data
19566 area can hold up to 256 bytes in total (128 bytes for byte references).
19568 @item -msda=@var{n}
19570 Put static or global variables whose size is @var{n} bytes or less into
19571 the small data area that register @code{gp} points to. The small data
19572 area can hold up to 64 kilobytes.
19574 @item -mzda=@var{n}
19576 Put static or global variables whose size is @var{n} bytes or less into
19577 the first 32 kilobytes of memory.
19581 Specify that the target processor is the V850.
19584 @opindex mbig-switch
19585 Generate code suitable for big switch tables. Use this option only if
19586 the assembler/linker complain about out of range branches within a switch
19591 This option causes r2 and r5 to be used in the code generated by
19592 the compiler. This setting is the default.
19594 @item -mno-app-regs
19595 @opindex mno-app-regs
19596 This option causes r2 and r5 to be treated as fixed registers.
19600 Specify that the target processor is the V850E2V3. The preprocessor
19601 constant @samp{__v850e2v3__} is defined if
19602 this option is used.
19606 Specify that the target processor is the V850E2. The preprocessor
19607 constant @samp{__v850e2__} is defined if this option is used.
19611 Specify that the target processor is the V850E1. The preprocessor
19612 constants @samp{__v850e1__} and @samp{__v850e__} are defined if
19613 this option is used.
19617 Specify that the target processor is the V850ES. This is an alias for
19618 the @option{-mv850e1} option.
19622 Specify that the target processor is the V850E@. The preprocessor
19623 constant @samp{__v850e__} is defined if this option is used.
19625 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
19626 nor @option{-mv850e2} nor @option{-mv850e2v3}
19627 are defined then a default target processor is chosen and the
19628 relevant @samp{__v850*__} preprocessor constant is defined.
19630 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
19631 defined, regardless of which processor variant is the target.
19633 @item -mdisable-callt
19634 @opindex mdisable-callt
19635 This option suppresses generation of the @code{CALLT} instruction for the
19636 v850e, v850e1, v850e2 and v850e2v3 flavors of the v850 architecture. The default is
19637 @option{-mno-disable-callt} which allows the @code{CALLT} instruction to be used.
19642 @subsection VAX Options
19643 @cindex VAX options
19645 These @samp{-m} options are defined for the VAX:
19650 Do not output certain jump instructions (@code{aobleq} and so on)
19651 that the Unix assembler for the VAX cannot handle across long
19656 Do output those jump instructions, on the assumption that the
19657 GNU assembler is being used.
19661 Output code for G-format floating-point numbers instead of D-format.
19665 @subsection VMS Options
19667 These @samp{-m} options are defined for the VMS implementations:
19670 @item -mvms-return-codes
19671 @opindex mvms-return-codes
19672 Return VMS condition codes from @code{main}. The default is to return POSIX-style
19673 condition (e.g.@ error) codes.
19675 @item -mdebug-main=@var{prefix}
19676 @opindex mdebug-main=@var{prefix}
19677 Flag the first routine whose name starts with @var{prefix} as the main
19678 routine for the debugger.
19682 Default to 64-bit memory allocation routines.
19684 @item -mpointer-size=@var{size}
19685 @opindex -mpointer-size=@var{size}
19686 Set the default size of pointers. Possible options for @var{size} are
19687 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
19688 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
19689 The later option disables @code{pragma pointer_size}.
19692 @node VxWorks Options
19693 @subsection VxWorks Options
19694 @cindex VxWorks Options
19696 The options in this section are defined for all VxWorks targets.
19697 Options specific to the target hardware are listed with the other
19698 options for that target.
19703 GCC can generate code for both VxWorks kernels and real time processes
19704 (RTPs). This option switches from the former to the latter. It also
19705 defines the preprocessor macro @code{__RTP__}.
19708 @opindex non-static
19709 Link an RTP executable against shared libraries rather than static
19710 libraries. The options @option{-static} and @option{-shared} can
19711 also be used for RTPs (@pxref{Link Options}); @option{-static}
19718 These options are passed down to the linker. They are defined for
19719 compatibility with Diab.
19722 @opindex Xbind-lazy
19723 Enable lazy binding of function calls. This option is equivalent to
19724 @option{-Wl,-z,now} and is defined for compatibility with Diab.
19728 Disable lazy binding of function calls. This option is the default and
19729 is defined for compatibility with Diab.
19732 @node x86-64 Options
19733 @subsection x86-64 Options
19734 @cindex x86-64 options
19736 These are listed under @xref{i386 and x86-64 Options}.
19738 @node Xstormy16 Options
19739 @subsection Xstormy16 Options
19740 @cindex Xstormy16 Options
19742 These options are defined for Xstormy16:
19747 Choose startup files and linker script suitable for the simulator.
19750 @node Xtensa Options
19751 @subsection Xtensa Options
19752 @cindex Xtensa Options
19754 These options are supported for Xtensa targets:
19758 @itemx -mno-const16
19760 @opindex mno-const16
19761 Enable or disable use of @code{CONST16} instructions for loading
19762 constant values. The @code{CONST16} instruction is currently not a
19763 standard option from Tensilica. When enabled, @code{CONST16}
19764 instructions are always used in place of the standard @code{L32R}
19765 instructions. The use of @code{CONST16} is enabled by default only if
19766 the @code{L32R} instruction is not available.
19769 @itemx -mno-fused-madd
19770 @opindex mfused-madd
19771 @opindex mno-fused-madd
19772 Enable or disable use of fused multiply/add and multiply/subtract
19773 instructions in the floating-point option. This has no effect if the
19774 floating-point option is not also enabled. Disabling fused multiply/add
19775 and multiply/subtract instructions forces the compiler to use separate
19776 instructions for the multiply and add/subtract operations. This may be
19777 desirable in some cases where strict IEEE 754-compliant results are
19778 required: the fused multiply add/subtract instructions do not round the
19779 intermediate result, thereby producing results with @emph{more} bits of
19780 precision than specified by the IEEE standard. Disabling fused multiply
19781 add/subtract instructions also ensures that the program output is not
19782 sensitive to the compiler's ability to combine multiply and add/subtract
19785 @item -mserialize-volatile
19786 @itemx -mno-serialize-volatile
19787 @opindex mserialize-volatile
19788 @opindex mno-serialize-volatile
19789 When this option is enabled, GCC inserts @code{MEMW} instructions before
19790 @code{volatile} memory references to guarantee sequential consistency.
19791 The default is @option{-mserialize-volatile}. Use
19792 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
19794 @item -mforce-no-pic
19795 @opindex mforce-no-pic
19796 For targets, like GNU/Linux, where all user-mode Xtensa code must be
19797 position-independent code (PIC), this option disables PIC for compiling
19800 @item -mtext-section-literals
19801 @itemx -mno-text-section-literals
19802 @opindex mtext-section-literals
19803 @opindex mno-text-section-literals
19804 Control the treatment of literal pools. The default is
19805 @option{-mno-text-section-literals}, which places literals in a separate
19806 section in the output file. This allows the literal pool to be placed
19807 in a data RAM/ROM, and it also allows the linker to combine literal
19808 pools from separate object files to remove redundant literals and
19809 improve code size. With @option{-mtext-section-literals}, the literals
19810 are interspersed in the text section in order to keep them as close as
19811 possible to their references. This may be necessary for large assembly
19814 @item -mtarget-align
19815 @itemx -mno-target-align
19816 @opindex mtarget-align
19817 @opindex mno-target-align
19818 When this option is enabled, GCC instructs the assembler to
19819 automatically align instructions to reduce branch penalties at the
19820 expense of some code density. The assembler attempts to widen density
19821 instructions to align branch targets and the instructions following call
19822 instructions. If there are not enough preceding safe density
19823 instructions to align a target, no widening is performed. The
19824 default is @option{-mtarget-align}. These options do not affect the
19825 treatment of auto-aligned instructions like @code{LOOP}, which the
19826 assembler always aligns, either by widening density instructions or
19827 by inserting NOP instructions.
19830 @itemx -mno-longcalls
19831 @opindex mlongcalls
19832 @opindex mno-longcalls
19833 When this option is enabled, GCC instructs the assembler to translate
19834 direct calls to indirect calls unless it can determine that the target
19835 of a direct call is in the range allowed by the call instruction. This
19836 translation typically occurs for calls to functions in other source
19837 files. Specifically, the assembler translates a direct @code{CALL}
19838 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
19839 The default is @option{-mno-longcalls}. This option should be used in
19840 programs where the call target can potentially be out of range. This
19841 option is implemented in the assembler, not the compiler, so the
19842 assembly code generated by GCC still shows direct call
19843 instructions---look at the disassembled object code to see the actual
19844 instructions. Note that the assembler uses an indirect call for
19845 every cross-file call, not just those that really are out of range.
19848 @node zSeries Options
19849 @subsection zSeries Options
19850 @cindex zSeries options
19852 These are listed under @xref{S/390 and zSeries Options}.
19854 @node Code Gen Options
19855 @section Options for Code Generation Conventions
19856 @cindex code generation conventions
19857 @cindex options, code generation
19858 @cindex run-time options
19860 These machine-independent options control the interface conventions
19861 used in code generation.
19863 Most of them have both positive and negative forms; the negative form
19864 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
19865 one of the forms is listed---the one that is not the default. You
19866 can figure out the other form by either removing @samp{no-} or adding
19870 @item -fbounds-check
19871 @opindex fbounds-check
19872 For front ends that support it, generate additional code to check that
19873 indices used to access arrays are within the declared range. This is
19874 currently only supported by the Java and Fortran front ends, where
19875 this option defaults to true and false respectively.
19877 @item -fstack-reuse=@var{reuse-level}
19878 @opindex fstack_reuse
19879 This option controls stack space reuse for user declared local/auto variables
19880 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
19881 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
19882 local variables and temporaries, @samp{named_vars} enables the reuse only for
19883 user defined local variables with names, and @samp{none} disables stack reuse
19884 completely. The default value is @samp{all}. The option is needed when the
19885 program extends the lifetime of a scoped local variable or a compiler generated
19886 temporary beyond the end point defined by the language. When a lifetime of
19887 a variable ends, and if the variable lives in memory, the optimizing compiler
19888 has the freedom to reuse its stack space with other temporaries or scoped
19889 local variables whose live range does not overlap with it. Legacy code extending
19890 local lifetime will likely to break with the stack reuse optimization.
19909 if (*p == 10) // out of scope use of local1
19920 A(int k) : i(k), j(k) @{ @}
19927 void foo(const A& ar)
19934 foo(A(10)); // temp object's lifetime ends when foo returns
19940 ap->i+= 10; // ap references out of scope temp whose space
19941 // is reused with a. What is the value of ap->i?
19946 The lifetime of a compiler generated temporary is well defined by the C++
19947 standard. When a lifetime of a temporary ends, and if the temporary lives
19948 in memory, the optimizing compiler has the freedom to reuse its stack
19949 space with other temporaries or scoped local variables whose live range
19950 does not overlap with it. However some of the legacy code relies on
19951 the behavior of older compilers in which temporaries' stack space is
19952 not reused, the aggressive stack reuse can lead to runtime errors. This
19953 option is used to control the temporary stack reuse optimization.
19957 This option generates traps for signed overflow on addition, subtraction,
19958 multiplication operations.
19962 This option instructs the compiler to assume that signed arithmetic
19963 overflow of addition, subtraction and multiplication wraps around
19964 using twos-complement representation. This flag enables some optimizations
19965 and disables others. This option is enabled by default for the Java
19966 front end, as required by the Java language specification.
19969 @opindex fexceptions
19970 Enable exception handling. Generates extra code needed to propagate
19971 exceptions. For some targets, this implies GCC generates frame
19972 unwind information for all functions, which can produce significant data
19973 size overhead, although it does not affect execution. If you do not
19974 specify this option, GCC enables it by default for languages like
19975 C++ that normally require exception handling, and disables it for
19976 languages like C that do not normally require it. However, you may need
19977 to enable this option when compiling C code that needs to interoperate
19978 properly with exception handlers written in C++. You may also wish to
19979 disable this option if you are compiling older C++ programs that don't
19980 use exception handling.
19982 @item -fnon-call-exceptions
19983 @opindex fnon-call-exceptions
19984 Generate code that allows trapping instructions to throw exceptions.
19985 Note that this requires platform-specific runtime support that does
19986 not exist everywhere. Moreover, it only allows @emph{trapping}
19987 instructions to throw exceptions, i.e.@: memory references or floating-point
19988 instructions. It does not allow exceptions to be thrown from
19989 arbitrary signal handlers such as @code{SIGALRM}.
19991 @item -fdelete-dead-exceptions
19992 @opindex fdelete-dead-exceptions
19993 Consider that instructions that may throw exceptions but don't otherwise
19994 contribute to the execution of the program can be optimized away.
19995 This option is enabled by default for the Ada front end, as permitted by
19996 the Ada language specification.
19997 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
19999 @item -funwind-tables
20000 @opindex funwind-tables
20001 Similar to @option{-fexceptions}, except that it just generates any needed
20002 static data, but does not affect the generated code in any other way.
20003 You normally do not need to enable this option; instead, a language processor
20004 that needs this handling enables it on your behalf.
20006 @item -fasynchronous-unwind-tables
20007 @opindex fasynchronous-unwind-tables
20008 Generate unwind table in DWARF 2 format, if supported by target machine. The
20009 table is exact at each instruction boundary, so it can be used for stack
20010 unwinding from asynchronous events (such as debugger or garbage collector).
20012 @item -fpcc-struct-return
20013 @opindex fpcc-struct-return
20014 Return ``short'' @code{struct} and @code{union} values in memory like
20015 longer ones, rather than in registers. This convention is less
20016 efficient, but it has the advantage of allowing intercallability between
20017 GCC-compiled files and files compiled with other compilers, particularly
20018 the Portable C Compiler (pcc).
20020 The precise convention for returning structures in memory depends
20021 on the target configuration macros.
20023 Short structures and unions are those whose size and alignment match
20024 that of some integer type.
20026 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
20027 switch is not binary compatible with code compiled with the
20028 @option{-freg-struct-return} switch.
20029 Use it to conform to a non-default application binary interface.
20031 @item -freg-struct-return
20032 @opindex freg-struct-return
20033 Return @code{struct} and @code{union} values in registers when possible.
20034 This is more efficient for small structures than
20035 @option{-fpcc-struct-return}.
20037 If you specify neither @option{-fpcc-struct-return} nor
20038 @option{-freg-struct-return}, GCC defaults to whichever convention is
20039 standard for the target. If there is no standard convention, GCC
20040 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
20041 the principal compiler. In those cases, we can choose the standard, and
20042 we chose the more efficient register return alternative.
20044 @strong{Warning:} code compiled with the @option{-freg-struct-return}
20045 switch is not binary compatible with code compiled with the
20046 @option{-fpcc-struct-return} switch.
20047 Use it to conform to a non-default application binary interface.
20049 @item -fshort-enums
20050 @opindex fshort-enums
20051 Allocate to an @code{enum} type only as many bytes as it needs for the
20052 declared range of possible values. Specifically, the @code{enum} type
20053 is equivalent to the smallest integer type that has enough room.
20055 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
20056 code that is not binary compatible with code generated without that switch.
20057 Use it to conform to a non-default application binary interface.
20059 @item -fshort-double
20060 @opindex fshort-double
20061 Use the same size for @code{double} as for @code{float}.
20063 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
20064 code that is not binary compatible with code generated without that switch.
20065 Use it to conform to a non-default application binary interface.
20067 @item -fshort-wchar
20068 @opindex fshort-wchar
20069 Override the underlying type for @samp{wchar_t} to be @samp{short
20070 unsigned int} instead of the default for the target. This option is
20071 useful for building programs to run under WINE@.
20073 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
20074 code that is not binary compatible with code generated without that switch.
20075 Use it to conform to a non-default application binary interface.
20078 @opindex fno-common
20079 In C code, controls the placement of uninitialized global variables.
20080 Unix C compilers have traditionally permitted multiple definitions of
20081 such variables in different compilation units by placing the variables
20083 This is the behavior specified by @option{-fcommon}, and is the default
20084 for GCC on most targets.
20085 On the other hand, this behavior is not required by ISO C, and on some
20086 targets may carry a speed or code size penalty on variable references.
20087 The @option{-fno-common} option specifies that the compiler should place
20088 uninitialized global variables in the data section of the object file,
20089 rather than generating them as common blocks.
20090 This has the effect that if the same variable is declared
20091 (without @code{extern}) in two different compilations,
20092 you get a multiple-definition error when you link them.
20093 In this case, you must compile with @option{-fcommon} instead.
20094 Compiling with @option{-fno-common} is useful on targets for which
20095 it provides better performance, or if you wish to verify that the
20096 program will work on other systems that always treat uninitialized
20097 variable declarations this way.
20101 Ignore the @samp{#ident} directive.
20103 @item -finhibit-size-directive
20104 @opindex finhibit-size-directive
20105 Don't output a @code{.size} assembler directive, or anything else that
20106 would cause trouble if the function is split in the middle, and the
20107 two halves are placed at locations far apart in memory. This option is
20108 used when compiling @file{crtstuff.c}; you should not need to use it
20111 @item -fverbose-asm
20112 @opindex fverbose-asm
20113 Put extra commentary information in the generated assembly code to
20114 make it more readable. This option is generally only of use to those
20115 who actually need to read the generated assembly code (perhaps while
20116 debugging the compiler itself).
20118 @option{-fno-verbose-asm}, the default, causes the
20119 extra information to be omitted and is useful when comparing two assembler
20122 @item -frecord-gcc-switches
20123 @opindex frecord-gcc-switches
20124 This switch causes the command line used to invoke the
20125 compiler to be recorded into the object file that is being created.
20126 This switch is only implemented on some targets and the exact format
20127 of the recording is target and binary file format dependent, but it
20128 usually takes the form of a section containing ASCII text. This
20129 switch is related to the @option{-fverbose-asm} switch, but that
20130 switch only records information in the assembler output file as
20131 comments, so it never reaches the object file.
20132 See also @option{-grecord-gcc-switches} for another
20133 way of storing compiler options into the object file.
20137 @cindex global offset table
20139 Generate position-independent code (PIC) suitable for use in a shared
20140 library, if supported for the target machine. Such code accesses all
20141 constant addresses through a global offset table (GOT)@. The dynamic
20142 loader resolves the GOT entries when the program starts (the dynamic
20143 loader is not part of GCC; it is part of the operating system). If
20144 the GOT size for the linked executable exceeds a machine-specific
20145 maximum size, you get an error message from the linker indicating that
20146 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
20147 instead. (These maximums are 8k on the SPARC and 32k
20148 on the m68k and RS/6000. The 386 has no such limit.)
20150 Position-independent code requires special support, and therefore works
20151 only on certain machines. For the 386, GCC supports PIC for System V
20152 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
20153 position-independent.
20155 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
20160 If supported for the target machine, emit position-independent code,
20161 suitable for dynamic linking and avoiding any limit on the size of the
20162 global offset table. This option makes a difference on the m68k,
20163 PowerPC and SPARC@.
20165 Position-independent code requires special support, and therefore works
20166 only on certain machines.
20168 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
20175 These options are similar to @option{-fpic} and @option{-fPIC}, but
20176 generated position independent code can be only linked into executables.
20177 Usually these options are used when @option{-pie} GCC option is
20178 used during linking.
20180 @option{-fpie} and @option{-fPIE} both define the macros
20181 @code{__pie__} and @code{__PIE__}. The macros have the value 1
20182 for @option{-fpie} and 2 for @option{-fPIE}.
20184 @item -fno-jump-tables
20185 @opindex fno-jump-tables
20186 Do not use jump tables for switch statements even where it would be
20187 more efficient than other code generation strategies. This option is
20188 of use in conjunction with @option{-fpic} or @option{-fPIC} for
20189 building code that forms part of a dynamic linker and cannot
20190 reference the address of a jump table. On some targets, jump tables
20191 do not require a GOT and this option is not needed.
20193 @item -ffixed-@var{reg}
20195 Treat the register named @var{reg} as a fixed register; generated code
20196 should never refer to it (except perhaps as a stack pointer, frame
20197 pointer or in some other fixed role).
20199 @var{reg} must be the name of a register. The register names accepted
20200 are machine-specific and are defined in the @code{REGISTER_NAMES}
20201 macro in the machine description macro file.
20203 This flag does not have a negative form, because it specifies a
20206 @item -fcall-used-@var{reg}
20207 @opindex fcall-used
20208 Treat the register named @var{reg} as an allocable register that is
20209 clobbered by function calls. It may be allocated for temporaries or
20210 variables that do not live across a call. Functions compiled this way
20211 do not save and restore the register @var{reg}.
20213 It is an error to use this flag with the frame pointer or stack pointer.
20214 Use of this flag for other registers that have fixed pervasive roles in
20215 the machine's execution model produces disastrous results.
20217 This flag does not have a negative form, because it specifies a
20220 @item -fcall-saved-@var{reg}
20221 @opindex fcall-saved
20222 Treat the register named @var{reg} as an allocable register saved by
20223 functions. It may be allocated even for temporaries or variables that
20224 live across a call. Functions compiled this way save and restore
20225 the register @var{reg} if they use it.
20227 It is an error to use this flag with the frame pointer or stack pointer.
20228 Use of this flag for other registers that have fixed pervasive roles in
20229 the machine's execution model produces disastrous results.
20231 A different sort of disaster results from the use of this flag for
20232 a register in which function values may be returned.
20234 This flag does not have a negative form, because it specifies a
20237 @item -fpack-struct[=@var{n}]
20238 @opindex fpack-struct
20239 Without a value specified, pack all structure members together without
20240 holes. When a value is specified (which must be a small power of two), pack
20241 structure members according to this value, representing the maximum
20242 alignment (that is, objects with default alignment requirements larger than
20243 this are output potentially unaligned at the next fitting location.
20245 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
20246 code that is not binary compatible with code generated without that switch.
20247 Additionally, it makes the code suboptimal.
20248 Use it to conform to a non-default application binary interface.
20250 @item -finstrument-functions
20251 @opindex finstrument-functions
20252 Generate instrumentation calls for entry and exit to functions. Just
20253 after function entry and just before function exit, the following
20254 profiling functions are called with the address of the current
20255 function and its call site. (On some platforms,
20256 @code{__builtin_return_address} does not work beyond the current
20257 function, so the call site information may not be available to the
20258 profiling functions otherwise.)
20261 void __cyg_profile_func_enter (void *this_fn,
20263 void __cyg_profile_func_exit (void *this_fn,
20267 The first argument is the address of the start of the current function,
20268 which may be looked up exactly in the symbol table.
20270 This instrumentation is also done for functions expanded inline in other
20271 functions. The profiling calls indicate where, conceptually, the
20272 inline function is entered and exited. This means that addressable
20273 versions of such functions must be available. If all your uses of a
20274 function are expanded inline, this may mean an additional expansion of
20275 code size. If you use @samp{extern inline} in your C code, an
20276 addressable version of such functions must be provided. (This is
20277 normally the case anyway, but if you get lucky and the optimizer always
20278 expands the functions inline, you might have gotten away without
20279 providing static copies.)
20281 A function may be given the attribute @code{no_instrument_function}, in
20282 which case this instrumentation is not done. This can be used, for
20283 example, for the profiling functions listed above, high-priority
20284 interrupt routines, and any functions from which the profiling functions
20285 cannot safely be called (perhaps signal handlers, if the profiling
20286 routines generate output or allocate memory).
20288 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
20289 @opindex finstrument-functions-exclude-file-list
20291 Set the list of functions that are excluded from instrumentation (see
20292 the description of @code{-finstrument-functions}). If the file that
20293 contains a function definition matches with one of @var{file}, then
20294 that function is not instrumented. The match is done on substrings:
20295 if the @var{file} parameter is a substring of the file name, it is
20296 considered to be a match.
20301 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
20305 excludes any inline function defined in files whose pathnames
20306 contain @code{/bits/stl} or @code{include/sys}.
20308 If, for some reason, you want to include letter @code{','} in one of
20309 @var{sym}, write @code{'\,'}. For example,
20310 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
20311 (note the single quote surrounding the option).
20313 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
20314 @opindex finstrument-functions-exclude-function-list
20316 This is similar to @code{-finstrument-functions-exclude-file-list},
20317 but this option sets the list of function names to be excluded from
20318 instrumentation. The function name to be matched is its user-visible
20319 name, such as @code{vector<int> blah(const vector<int> &)}, not the
20320 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
20321 match is done on substrings: if the @var{sym} parameter is a substring
20322 of the function name, it is considered to be a match. For C99 and C++
20323 extended identifiers, the function name must be given in UTF-8, not
20324 using universal character names.
20326 @item -fstack-check
20327 @opindex fstack-check
20328 Generate code to verify that you do not go beyond the boundary of the
20329 stack. You should specify this flag if you are running in an
20330 environment with multiple threads, but you only rarely need to specify it in
20331 a single-threaded environment since stack overflow is automatically
20332 detected on nearly all systems if there is only one stack.
20334 Note that this switch does not actually cause checking to be done; the
20335 operating system or the language runtime must do that. The switch causes
20336 generation of code to ensure that they see the stack being extended.
20338 You can additionally specify a string parameter: @code{no} means no
20339 checking, @code{generic} means force the use of old-style checking,
20340 @code{specific} means use the best checking method and is equivalent
20341 to bare @option{-fstack-check}.
20343 Old-style checking is a generic mechanism that requires no specific
20344 target support in the compiler but comes with the following drawbacks:
20348 Modified allocation strategy for large objects: they are always
20349 allocated dynamically if their size exceeds a fixed threshold.
20352 Fixed limit on the size of the static frame of functions: when it is
20353 topped by a particular function, stack checking is not reliable and
20354 a warning is issued by the compiler.
20357 Inefficiency: because of both the modified allocation strategy and the
20358 generic implementation, code performance is hampered.
20361 Note that old-style stack checking is also the fallback method for
20362 @code{specific} if no target support has been added in the compiler.
20364 @item -fstack-limit-register=@var{reg}
20365 @itemx -fstack-limit-symbol=@var{sym}
20366 @itemx -fno-stack-limit
20367 @opindex fstack-limit-register
20368 @opindex fstack-limit-symbol
20369 @opindex fno-stack-limit
20370 Generate code to ensure that the stack does not grow beyond a certain value,
20371 either the value of a register or the address of a symbol. If a larger
20372 stack is required, a signal is raised at run time. For most targets,
20373 the signal is raised before the stack overruns the boundary, so
20374 it is possible to catch the signal without taking special precautions.
20376 For instance, if the stack starts at absolute address @samp{0x80000000}
20377 and grows downwards, you can use the flags
20378 @option{-fstack-limit-symbol=__stack_limit} and
20379 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
20380 of 128KB@. Note that this may only work with the GNU linker.
20382 @item -fsplit-stack
20383 @opindex fsplit-stack
20384 Generate code to automatically split the stack before it overflows.
20385 The resulting program has a discontiguous stack which can only
20386 overflow if the program is unable to allocate any more memory. This
20387 is most useful when running threaded programs, as it is no longer
20388 necessary to calculate a good stack size to use for each thread. This
20389 is currently only implemented for the i386 and x86_64 back ends running
20392 When code compiled with @option{-fsplit-stack} calls code compiled
20393 without @option{-fsplit-stack}, there may not be much stack space
20394 available for the latter code to run. If compiling all code,
20395 including library code, with @option{-fsplit-stack} is not an option,
20396 then the linker can fix up these calls so that the code compiled
20397 without @option{-fsplit-stack} always has a large stack. Support for
20398 this is implemented in the gold linker in GNU binutils release 2.21
20401 @item -fleading-underscore
20402 @opindex fleading-underscore
20403 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
20404 change the way C symbols are represented in the object file. One use
20405 is to help link with legacy assembly code.
20407 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
20408 generate code that is not binary compatible with code generated without that
20409 switch. Use it to conform to a non-default application binary interface.
20410 Not all targets provide complete support for this switch.
20412 @item -ftls-model=@var{model}
20413 @opindex ftls-model
20414 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
20415 The @var{model} argument should be one of @code{global-dynamic},
20416 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
20418 The default without @option{-fpic} is @code{initial-exec}; with
20419 @option{-fpic} the default is @code{global-dynamic}.
20421 @item -fvisibility=@var{default|internal|hidden|protected}
20422 @opindex fvisibility
20423 Set the default ELF image symbol visibility to the specified option---all
20424 symbols are marked with this unless overridden within the code.
20425 Using this feature can very substantially improve linking and
20426 load times of shared object libraries, produce more optimized
20427 code, provide near-perfect API export and prevent symbol clashes.
20428 It is @strong{strongly} recommended that you use this in any shared objects
20431 Despite the nomenclature, @code{default} always means public; i.e.,
20432 available to be linked against from outside the shared object.
20433 @code{protected} and @code{internal} are pretty useless in real-world
20434 usage so the only other commonly used option is @code{hidden}.
20435 The default if @option{-fvisibility} isn't specified is
20436 @code{default}, i.e., make every
20437 symbol public---this causes the same behavior as previous versions of
20440 A good explanation of the benefits offered by ensuring ELF
20441 symbols have the correct visibility is given by ``How To Write
20442 Shared Libraries'' by Ulrich Drepper (which can be found at
20443 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
20444 solution made possible by this option to marking things hidden when
20445 the default is public is to make the default hidden and mark things
20446 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
20447 and @code{__attribute__ ((visibility("default")))} instead of
20448 @code{__declspec(dllexport)} you get almost identical semantics with
20449 identical syntax. This is a great boon to those working with
20450 cross-platform projects.
20452 For those adding visibility support to existing code, you may find
20453 @samp{#pragma GCC visibility} of use. This works by you enclosing
20454 the declarations you wish to set visibility for with (for example)
20455 @samp{#pragma GCC visibility push(hidden)} and
20456 @samp{#pragma GCC visibility pop}.
20457 Bear in mind that symbol visibility should be viewed @strong{as
20458 part of the API interface contract} and thus all new code should
20459 always specify visibility when it is not the default; i.e., declarations
20460 only for use within the local DSO should @strong{always} be marked explicitly
20461 as hidden as so to avoid PLT indirection overheads---making this
20462 abundantly clear also aids readability and self-documentation of the code.
20463 Note that due to ISO C++ specification requirements, @code{operator new} and
20464 @code{operator delete} must always be of default visibility.
20466 Be aware that headers from outside your project, in particular system
20467 headers and headers from any other library you use, may not be
20468 expecting to be compiled with visibility other than the default. You
20469 may need to explicitly say @samp{#pragma GCC visibility push(default)}
20470 before including any such headers.
20472 @samp{extern} declarations are not affected by @option{-fvisibility}, so
20473 a lot of code can be recompiled with @option{-fvisibility=hidden} with
20474 no modifications. However, this means that calls to @code{extern}
20475 functions with no explicit visibility use the PLT, so it is more
20476 effective to use @code{__attribute ((visibility))} and/or
20477 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
20478 declarations should be treated as hidden.
20480 Note that @option{-fvisibility} does affect C++ vague linkage
20481 entities. This means that, for instance, an exception class that is
20482 be thrown between DSOs must be explicitly marked with default
20483 visibility so that the @samp{type_info} nodes are unified between
20486 An overview of these techniques, their benefits and how to use them
20487 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
20489 @item -fstrict-volatile-bitfields
20490 @opindex fstrict-volatile-bitfields
20491 This option should be used if accesses to volatile bit-fields (or other
20492 structure fields, although the compiler usually honors those types
20493 anyway) should use a single access of the width of the
20494 field's type, aligned to a natural alignment if possible. For
20495 example, targets with memory-mapped peripheral registers might require
20496 all such accesses to be 16 bits wide; with this flag you can
20497 declare all peripheral bit-fields as @code{unsigned short} (assuming short
20498 is 16 bits on these targets) to force GCC to use 16-bit accesses
20499 instead of, perhaps, a more efficient 32-bit access.
20501 If this option is disabled, the compiler uses the most efficient
20502 instruction. In the previous example, that might be a 32-bit load
20503 instruction, even though that accesses bytes that do not contain
20504 any portion of the bit-field, or memory-mapped registers unrelated to
20505 the one being updated.
20507 If the target requires strict alignment, and honoring the field
20508 type would require violating this alignment, a warning is issued.
20509 If the field has @code{packed} attribute, the access is done without
20510 honoring the field type. If the field doesn't have @code{packed}
20511 attribute, the access is done honoring the field type. In both cases,
20512 GCC assumes that the user knows something about the target hardware
20513 that it is unaware of.
20515 The default value of this option is determined by the application binary
20516 interface for the target processor.
20518 @item -fsync-libcalls
20519 @opindex fsync-libcalls
20520 This option controls whether any out-of-line instance of the @code{__sync}
20521 family of functions may be used to implement the C++11 @code{__atomic}
20522 family of functions.
20524 The default value of this option is enabled, thus the only useful form
20525 of the option is @option{-fno-sync-libcalls}. This option is used in
20526 the implementation of the @file{libatomic} runtime library.
20532 @node Environment Variables
20533 @section Environment Variables Affecting GCC
20534 @cindex environment variables
20536 @c man begin ENVIRONMENT
20537 This section describes several environment variables that affect how GCC
20538 operates. Some of them work by specifying directories or prefixes to use
20539 when searching for various kinds of files. Some are used to specify other
20540 aspects of the compilation environment.
20542 Note that you can also specify places to search using options such as
20543 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
20544 take precedence over places specified using environment variables, which
20545 in turn take precedence over those specified by the configuration of GCC@.
20546 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
20547 GNU Compiler Collection (GCC) Internals}.
20552 @c @itemx LC_COLLATE
20554 @c @itemx LC_MONETARY
20555 @c @itemx LC_NUMERIC
20560 @c @findex LC_COLLATE
20561 @findex LC_MESSAGES
20562 @c @findex LC_MONETARY
20563 @c @findex LC_NUMERIC
20567 These environment variables control the way that GCC uses
20568 localization information which allows GCC to work with different
20569 national conventions. GCC inspects the locale categories
20570 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
20571 so. These locale categories can be set to any value supported by your
20572 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
20573 Kingdom encoded in UTF-8.
20575 The @env{LC_CTYPE} environment variable specifies character
20576 classification. GCC uses it to determine the character boundaries in
20577 a string; this is needed for some multibyte encodings that contain quote
20578 and escape characters that are otherwise interpreted as a string
20581 The @env{LC_MESSAGES} environment variable specifies the language to
20582 use in diagnostic messages.
20584 If the @env{LC_ALL} environment variable is set, it overrides the value
20585 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
20586 and @env{LC_MESSAGES} default to the value of the @env{LANG}
20587 environment variable. If none of these variables are set, GCC
20588 defaults to traditional C English behavior.
20592 If @env{TMPDIR} is set, it specifies the directory to use for temporary
20593 files. GCC uses temporary files to hold the output of one stage of
20594 compilation which is to be used as input to the next stage: for example,
20595 the output of the preprocessor, which is the input to the compiler
20598 @item GCC_COMPARE_DEBUG
20599 @findex GCC_COMPARE_DEBUG
20600 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
20601 @option{-fcompare-debug} to the compiler driver. See the documentation
20602 of this option for more details.
20604 @item GCC_EXEC_PREFIX
20605 @findex GCC_EXEC_PREFIX
20606 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
20607 names of the subprograms executed by the compiler. No slash is added
20608 when this prefix is combined with the name of a subprogram, but you can
20609 specify a prefix that ends with a slash if you wish.
20611 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
20612 an appropriate prefix to use based on the pathname it is invoked with.
20614 If GCC cannot find the subprogram using the specified prefix, it
20615 tries looking in the usual places for the subprogram.
20617 The default value of @env{GCC_EXEC_PREFIX} is
20618 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
20619 the installed compiler. In many cases @var{prefix} is the value
20620 of @code{prefix} when you ran the @file{configure} script.
20622 Other prefixes specified with @option{-B} take precedence over this prefix.
20624 This prefix is also used for finding files such as @file{crt0.o} that are
20627 In addition, the prefix is used in an unusual way in finding the
20628 directories to search for header files. For each of the standard
20629 directories whose name normally begins with @samp{/usr/local/lib/gcc}
20630 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
20631 replacing that beginning with the specified prefix to produce an
20632 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
20633 @file{foo/bar} just before it searches the standard directory
20634 @file{/usr/local/lib/bar}.
20635 If a standard directory begins with the configured
20636 @var{prefix} then the value of @var{prefix} is replaced by
20637 @env{GCC_EXEC_PREFIX} when looking for header files.
20639 @item COMPILER_PATH
20640 @findex COMPILER_PATH
20641 The value of @env{COMPILER_PATH} is a colon-separated list of
20642 directories, much like @env{PATH}. GCC tries the directories thus
20643 specified when searching for subprograms, if it can't find the
20644 subprograms using @env{GCC_EXEC_PREFIX}.
20647 @findex LIBRARY_PATH
20648 The value of @env{LIBRARY_PATH} is a colon-separated list of
20649 directories, much like @env{PATH}. When configured as a native compiler,
20650 GCC tries the directories thus specified when searching for special
20651 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
20652 using GCC also uses these directories when searching for ordinary
20653 libraries for the @option{-l} option (but directories specified with
20654 @option{-L} come first).
20658 @cindex locale definition
20659 This variable is used to pass locale information to the compiler. One way in
20660 which this information is used is to determine the character set to be used
20661 when character literals, string literals and comments are parsed in C and C++.
20662 When the compiler is configured to allow multibyte characters,
20663 the following values for @env{LANG} are recognized:
20667 Recognize JIS characters.
20669 Recognize SJIS characters.
20671 Recognize EUCJP characters.
20674 If @env{LANG} is not defined, or if it has some other value, then the
20675 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
20676 recognize and translate multibyte characters.
20680 Some additional environment variables affect the behavior of the
20683 @include cppenv.texi
20687 @node Precompiled Headers
20688 @section Using Precompiled Headers
20689 @cindex precompiled headers
20690 @cindex speed of compilation
20692 Often large projects have many header files that are included in every
20693 source file. The time the compiler takes to process these header files
20694 over and over again can account for nearly all of the time required to
20695 build the project. To make builds faster, GCC allows you to
20696 @dfn{precompile} a header file.
20698 To create a precompiled header file, simply compile it as you would any
20699 other file, if necessary using the @option{-x} option to make the driver
20700 treat it as a C or C++ header file. You may want to use a
20701 tool like @command{make} to keep the precompiled header up-to-date when
20702 the headers it contains change.
20704 A precompiled header file is searched for when @code{#include} is
20705 seen in the compilation. As it searches for the included file
20706 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
20707 compiler looks for a precompiled header in each directory just before it
20708 looks for the include file in that directory. The name searched for is
20709 the name specified in the @code{#include} with @samp{.gch} appended. If
20710 the precompiled header file can't be used, it is ignored.
20712 For instance, if you have @code{#include "all.h"}, and you have
20713 @file{all.h.gch} in the same directory as @file{all.h}, then the
20714 precompiled header file is used if possible, and the original
20715 header is used otherwise.
20717 Alternatively, you might decide to put the precompiled header file in a
20718 directory and use @option{-I} to ensure that directory is searched
20719 before (or instead of) the directory containing the original header.
20720 Then, if you want to check that the precompiled header file is always
20721 used, you can put a file of the same name as the original header in this
20722 directory containing an @code{#error} command.
20724 This also works with @option{-include}. So yet another way to use
20725 precompiled headers, good for projects not designed with precompiled
20726 header files in mind, is to simply take most of the header files used by
20727 a project, include them from another header file, precompile that header
20728 file, and @option{-include} the precompiled header. If the header files
20729 have guards against multiple inclusion, they are skipped because
20730 they've already been included (in the precompiled header).
20732 If you need to precompile the same header file for different
20733 languages, targets, or compiler options, you can instead make a
20734 @emph{directory} named like @file{all.h.gch}, and put each precompiled
20735 header in the directory, perhaps using @option{-o}. It doesn't matter
20736 what you call the files in the directory; every precompiled header in
20737 the directory is considered. The first precompiled header
20738 encountered in the directory that is valid for this compilation is
20739 used; they're searched in no particular order.
20741 There are many other possibilities, limited only by your imagination,
20742 good sense, and the constraints of your build system.
20744 A precompiled header file can be used only when these conditions apply:
20748 Only one precompiled header can be used in a particular compilation.
20751 A precompiled header can't be used once the first C token is seen. You
20752 can have preprocessor directives before a precompiled header; you cannot
20753 include a precompiled header from inside another header.
20756 The precompiled header file must be produced for the same language as
20757 the current compilation. You can't use a C precompiled header for a C++
20761 The precompiled header file must have been produced by the same compiler
20762 binary as the current compilation is using.
20765 Any macros defined before the precompiled header is included must
20766 either be defined in the same way as when the precompiled header was
20767 generated, or must not affect the precompiled header, which usually
20768 means that they don't appear in the precompiled header at all.
20770 The @option{-D} option is one way to define a macro before a
20771 precompiled header is included; using a @code{#define} can also do it.
20772 There are also some options that define macros implicitly, like
20773 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
20776 @item If debugging information is output when using the precompiled
20777 header, using @option{-g} or similar, the same kind of debugging information
20778 must have been output when building the precompiled header. However,
20779 a precompiled header built using @option{-g} can be used in a compilation
20780 when no debugging information is being output.
20782 @item The same @option{-m} options must generally be used when building
20783 and using the precompiled header. @xref{Submodel Options},
20784 for any cases where this rule is relaxed.
20786 @item Each of the following options must be the same when building and using
20787 the precompiled header:
20789 @gccoptlist{-fexceptions}
20792 Some other command-line options starting with @option{-f},
20793 @option{-p}, or @option{-O} must be defined in the same way as when
20794 the precompiled header was generated. At present, it's not clear
20795 which options are safe to change and which are not; the safest choice
20796 is to use exactly the same options when generating and using the
20797 precompiled header. The following are known to be safe:
20799 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
20800 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
20801 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
20806 For all of these except the last, the compiler automatically
20807 ignores the precompiled header if the conditions aren't met. If you
20808 find an option combination that doesn't work and doesn't cause the
20809 precompiled header to be ignored, please consider filing a bug report,
20812 If you do use differing options when generating and using the
20813 precompiled header, the actual behavior is a mixture of the
20814 behavior for the options. For instance, if you use @option{-g} to
20815 generate the precompiled header but not when using it, you may or may
20816 not get debugging information for routines in the precompiled header.