1 @c Copyright (C) 1988-2014 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-2014 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{unit} -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 -fopenmp-simd -fms-extensions @gol
172 -fplan9-extensions -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 @gol
193 -fno-weak -nostdinc++ @gol
194 -fvisibility-inlines-hidden @gol
195 -fvtable-verify=@var{std|preinit|none} @gol
196 -fvtv-counts -fvtv-debug @gol
197 -fvisibility-ms-compat @gol
198 -fext-numeric-literals @gol
199 -Wabi=@var{n} -Wconversion-null -Wctor-dtor-privacy @gol
200 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol
201 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
202 -Weffc++ -Wstrict-null-sentinel @gol
203 -Wno-non-template-friend -Wold-style-cast @gol
204 -Woverloaded-virtual -Wno-pmf-conversions @gol
207 @item Objective-C and Objective-C++ Language Options
208 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
209 Objective-C and Objective-C++ Dialects}.
210 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
211 -fgnu-runtime -fnext-runtime @gol
212 -fno-nil-receivers @gol
213 -fobjc-abi-version=@var{n} @gol
214 -fobjc-call-cxx-cdtors @gol
215 -fobjc-direct-dispatch @gol
216 -fobjc-exceptions @gol
219 -fobjc-std=objc1 @gol
220 -fno-local-ivars @gol
221 -fivar-visibility=@var{public|protected|private|package} @gol
222 -freplace-objc-classes @gol
225 -Wassign-intercept @gol
226 -Wno-protocol -Wselector @gol
227 -Wstrict-selector-match @gol
228 -Wundeclared-selector}
230 @item Language Independent Options
231 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
232 @gccoptlist{-fmessage-length=@var{n} @gol
233 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
234 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
235 -fno-diagnostics-show-option -fno-diagnostics-show-caret}
237 @item Warning Options
238 @xref{Warning Options,,Options to Request or Suppress Warnings}.
239 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
240 -pedantic-errors @gol
241 -w -Wextra -Wall -Waddress -Waggregate-return @gol
242 -Waggressive-loop-optimizations -Warray-bounds @gol
243 -Wno-attributes -Wno-builtin-macro-redefined @gol
244 -Wc90-c99-compat @gol
245 -Wc++-compat -Wc++11-compat -Wcast-align -Wcast-qual @gol
246 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
247 -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
248 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
249 -Wdisabled-optimization -Wno-discarded-qualifiers @gol
250 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
251 -Wno-endif-labels -Werror -Werror=* @gol
252 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
253 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
254 -Wformat-security -Wformat-signedness -Wformat-y2k @gol
255 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
256 -Wignored-qualifiers -Wincompatible-pointer-types @gol
257 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
258 -Winit-self -Winline -Wno-int-conversion @gol
259 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
260 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
261 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
262 -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmissing-braces @gol
263 -Wmissing-field-initializers -Wmissing-include-dirs @gol
264 -Wno-multichar -Wnonnull -Wodr -Wno-overflow -Wopenmp-simd @gol
265 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
266 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
267 -Wpointer-arith -Wno-pointer-to-int-cast @gol
268 -Wredundant-decls -Wno-return-local-addr @gol
269 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
270 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
271 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
272 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
273 -Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
274 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
275 -Wsuggest-final-types @gol -Wsuggest-final-methods @gol
276 -Wmissing-format-attribute @gol
277 -Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
278 -Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
279 -Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
280 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
281 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
282 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
283 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
284 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
285 -Wvla -Wvolatile-register-var -Wwrite-strings -Wzero-as-null-pointer-constant}
287 @item C and Objective-C-only Warning Options
288 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
289 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
290 -Wold-style-declaration -Wold-style-definition @gol
291 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
292 -Wdeclaration-after-statement -Wpointer-sign}
294 @item Debugging Options
295 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
296 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
297 -fsanitize=@var{style} -fsanitize-recover @gol
298 -fsanitize-undefined-trap-on-error @gol
299 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
300 -fdisable-ipa-@var{pass_name} @gol
301 -fdisable-rtl-@var{pass_name} @gol
302 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
303 -fdisable-tree-@var{pass_name} @gol
304 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
305 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
306 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
307 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
308 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
310 -fdump-statistics @gol
312 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
313 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
314 -fdump-tree-cfg -fdump-tree-alias @gol
316 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
317 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
318 -fdump-tree-gimple@r{[}-raw@r{]} @gol
319 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
320 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
321 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
322 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
323 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
324 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
325 -fdump-tree-nrv -fdump-tree-vect @gol
326 -fdump-tree-sink @gol
327 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
328 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
329 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
330 -fdump-tree-vtable-verify @gol
331 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
332 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
333 -fdump-final-insns=@var{file} @gol
334 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
335 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
336 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
337 -fenable-@var{kind}-@var{pass} @gol
338 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
339 -fdebug-types-section -fmem-report-wpa @gol
340 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
342 -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
343 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
344 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
345 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
346 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
347 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
348 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
349 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
350 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
351 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
352 -fdebug-prefix-map=@var{old}=@var{new} @gol
353 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
354 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
355 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
356 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
357 -print-prog-name=@var{program} -print-search-dirs -Q @gol
358 -print-sysroot -print-sysroot-headers-suffix @gol
359 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
361 @item Optimization Options
362 @xref{Optimize Options,,Options that Control Optimization}.
363 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
364 -falign-jumps[=@var{n}] @gol
365 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
366 -fassociative-math -fauto-inc-dec -fbranch-probabilities @gol
367 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
368 -fbtr-bb-exclusive -fcaller-saves @gol
369 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
370 -fcompare-elim -fcprop-registers -fcrossjumping @gol
371 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
372 -fcx-limited-range @gol
373 -fdata-sections -fdce -fdelayed-branch @gol
374 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively -fdse @gol
375 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
376 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
377 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
378 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
379 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
380 -fif-conversion2 -findirect-inlining @gol
381 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
382 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
383 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
384 -fira-algorithm=@var{algorithm} @gol
385 -fira-region=@var{region} -fira-hoist-pressure @gol
386 -fira-loop-pressure -fno-ira-share-save-slots @gol
387 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
388 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute
389 -fivopts -fkeep-inline-functions -fkeep-static-consts -flive-range-shrinkage @gol
390 -floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol
391 -floop-parallelize-all -flto -flto-compression-level @gol
392 -flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
393 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
394 -fmove-loop-invariants -fno-branch-count-reg @gol
395 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
396 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
397 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
398 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
399 -fomit-frame-pointer -foptimize-sibling-calls @gol
400 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
401 -fprefetch-loop-arrays -fprofile-report @gol
402 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
403 -fprofile-generate=@var{path} @gol
404 -fprofile-use -fprofile-use=@var{path} -fprofile-values -fprofile-reorder-functions @gol
405 -freciprocal-math -free -frename-registers -freorder-blocks @gol
406 -freorder-blocks-and-partition -freorder-functions @gol
407 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
408 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
409 -fsched-spec-load -fsched-spec-load-dangerous @gol
410 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
411 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
412 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
413 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
414 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
415 -fselective-scheduling -fselective-scheduling2 @gol
416 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
417 -fsemantic-interposition @gol
418 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
419 -fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt -fstack-protector @gol
420 -fstack-protector-all -fstack-protector-strong -fstrict-aliasing @gol
421 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
422 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
423 -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
424 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
425 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
426 -ftree-loop-if-convert-stores -ftree-loop-im @gol
427 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
428 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
429 -ftree-loop-vectorize @gol
430 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
431 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
432 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
433 -ftree-vectorize -ftree-vrp @gol
434 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
435 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
436 -fuse-caller-save -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
437 -fweb -fwhole-program -fwpa -fuse-ld=@var{linker} -fuse-linker-plugin @gol
438 --param @var{name}=@var{value}
439 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
441 @item Preprocessor Options
442 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
443 @gccoptlist{-A@var{question}=@var{answer} @gol
444 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
445 -C -dD -dI -dM -dN @gol
446 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
447 -idirafter @var{dir} @gol
448 -include @var{file} -imacros @var{file} @gol
449 -iprefix @var{file} -iwithprefix @var{dir} @gol
450 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
451 -imultilib @var{dir} -isysroot @var{dir} @gol
452 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
453 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
454 -remap -trigraphs -undef -U@var{macro} @gol
455 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
457 @item Assembler Option
458 @xref{Assembler Options,,Passing Options to the Assembler}.
459 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
462 @xref{Link Options,,Options for Linking}.
463 @gccoptlist{@var{object-file-name} -l@var{library} @gol
464 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
465 -s -static -static-libgcc -static-libstdc++ @gol
466 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
467 -shared -shared-libgcc -symbolic @gol
468 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
469 -u @var{symbol} -z @var{keyword}}
471 @item Directory Options
472 @xref{Directory Options,,Options for Directory Search}.
473 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
474 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
475 --sysroot=@var{dir} --no-sysroot-suffix}
477 @item Machine Dependent Options
478 @xref{Submodel Options,,Hardware Models and Configurations}.
479 @c This list is ordered alphanumerically by subsection name.
480 @c Try and put the significant identifier (CPU or system) first,
481 @c so users have a clue at guessing where the ones they want will be.
483 @emph{AArch64 Options}
484 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
485 -mgeneral-regs-only @gol
486 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
488 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
489 -mtls-dialect=desc -mtls-dialect=traditional @gol
490 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
492 @emph{Adapteva Epiphany Options}
493 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
494 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
495 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
496 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
497 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
498 -msplit-vecmove-early -m1reg-@var{reg}}
501 @gccoptlist{-mbarrel-shifter @gol
502 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
503 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
504 -mea -mno-mpy -mmul32x16 -mmul64 @gol
505 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
506 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
507 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
508 -mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol
509 -mucb-mcount -mvolatile-cache @gol
510 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
511 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
512 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
513 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
514 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
515 -mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}}
518 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
519 -mabi=@var{name} @gol
520 -mapcs-stack-check -mno-apcs-stack-check @gol
521 -mapcs-float -mno-apcs-float @gol
522 -mapcs-reentrant -mno-apcs-reentrant @gol
523 -msched-prolog -mno-sched-prolog @gol
524 -mlittle-endian -mbig-endian @gol
525 -mfloat-abi=@var{name} @gol
526 -mfp16-format=@var{name}
527 -mthumb-interwork -mno-thumb-interwork @gol
528 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
529 -mstructure-size-boundary=@var{n} @gol
530 -mabort-on-noreturn @gol
531 -mlong-calls -mno-long-calls @gol
532 -msingle-pic-base -mno-single-pic-base @gol
533 -mpic-register=@var{reg} @gol
534 -mnop-fun-dllimport @gol
535 -mpoke-function-name @gol
537 -mtpcs-frame -mtpcs-leaf-frame @gol
538 -mcaller-super-interworking -mcallee-super-interworking @gol
539 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
540 -mword-relocations @gol
541 -mfix-cortex-m3-ldrd @gol
542 -munaligned-access @gol
543 -mneon-for-64bits @gol
544 -mslow-flash-data @gol
548 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
549 -mcall-prologues -mint8 -mno-interrupts -mrelax @gol
550 -mstrict-X -mtiny-stack -Waddr-space-convert}
552 @emph{Blackfin Options}
553 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
554 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
555 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
556 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
557 -mno-id-shared-library -mshared-library-id=@var{n} @gol
558 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
559 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
560 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
564 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
565 -msim -msdata=@var{sdata-type}}
568 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
569 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
570 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
571 -mstack-align -mdata-align -mconst-align @gol
572 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
573 -melf -maout -melinux -mlinux -sim -sim2 @gol
574 -mmul-bug-workaround -mno-mul-bug-workaround}
577 @gccoptlist{-mmac @gol
578 -mcr16cplus -mcr16c @gol
579 -msim -mint32 -mbit-ops
580 -mdata-model=@var{model}}
582 @emph{Darwin Options}
583 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
584 -arch_only -bind_at_load -bundle -bundle_loader @gol
585 -client_name -compatibility_version -current_version @gol
587 -dependency-file -dylib_file -dylinker_install_name @gol
588 -dynamic -dynamiclib -exported_symbols_list @gol
589 -filelist -flat_namespace -force_cpusubtype_ALL @gol
590 -force_flat_namespace -headerpad_max_install_names @gol
592 -image_base -init -install_name -keep_private_externs @gol
593 -multi_module -multiply_defined -multiply_defined_unused @gol
594 -noall_load -no_dead_strip_inits_and_terms @gol
595 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
596 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
597 -private_bundle -read_only_relocs -sectalign @gol
598 -sectobjectsymbols -whyload -seg1addr @gol
599 -sectcreate -sectobjectsymbols -sectorder @gol
600 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
601 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
602 -segprot -segs_read_only_addr -segs_read_write_addr @gol
603 -single_module -static -sub_library -sub_umbrella @gol
604 -twolevel_namespace -umbrella -undefined @gol
605 -unexported_symbols_list -weak_reference_mismatches @gol
606 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
607 -mkernel -mone-byte-bool}
609 @emph{DEC Alpha Options}
610 @gccoptlist{-mno-fp-regs -msoft-float @gol
611 -mieee -mieee-with-inexact -mieee-conformant @gol
612 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
613 -mtrap-precision=@var{mode} -mbuild-constants @gol
614 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
615 -mbwx -mmax -mfix -mcix @gol
616 -mfloat-vax -mfloat-ieee @gol
617 -mexplicit-relocs -msmall-data -mlarge-data @gol
618 -msmall-text -mlarge-text @gol
619 -mmemory-latency=@var{time}}
622 @gccoptlist{-msmall-model -mno-lsim}
625 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
626 -mhard-float -msoft-float @gol
627 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
628 -mdouble -mno-double @gol
629 -mmedia -mno-media -mmuladd -mno-muladd @gol
630 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
631 -mlinked-fp -mlong-calls -malign-labels @gol
632 -mlibrary-pic -macc-4 -macc-8 @gol
633 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
634 -moptimize-membar -mno-optimize-membar @gol
635 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
636 -mvliw-branch -mno-vliw-branch @gol
637 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
638 -mno-nested-cond-exec -mtomcat-stats @gol
642 @emph{GNU/Linux Options}
643 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
644 -tno-android-cc -tno-android-ld}
646 @emph{H8/300 Options}
647 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
650 @gccoptlist{-march=@var{architecture-type} @gol
651 -mdisable-fpregs -mdisable-indexing @gol
652 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
653 -mfixed-range=@var{register-range} @gol
654 -mjump-in-delay -mlinker-opt -mlong-calls @gol
655 -mlong-load-store -mno-disable-fpregs @gol
656 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
657 -mno-jump-in-delay -mno-long-load-store @gol
658 -mno-portable-runtime -mno-soft-float @gol
659 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
660 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
661 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
662 -munix=@var{unix-std} -nolibdld -static -threads}
664 @emph{i386 and x86-64 Options}
665 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
666 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
667 -mfpmath=@var{unit} @gol
668 -masm=@var{dialect} -mno-fancy-math-387 @gol
669 -mno-fp-ret-in-387 -msoft-float @gol
670 -mno-wide-multiply -mrtd -malign-double @gol
671 -mpreferred-stack-boundary=@var{num} @gol
672 -mincoming-stack-boundary=@var{num} @gol
673 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
674 -mrecip -mrecip=@var{opt} @gol
675 -mvzeroupper -mprefer-avx128 @gol
676 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
677 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -msha @gol
678 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 @gol
679 -mclflushopt -mxsavec -mxsaves @gol
680 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
681 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mthreads @gol
682 -mno-align-stringops -minline-all-stringops @gol
683 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
684 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy}
685 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
686 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
687 -mregparm=@var{num} -msseregparm @gol
688 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
689 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
690 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
691 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
692 -m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol
693 -msse2avx -mfentry -m8bit-idiv @gol
694 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
695 -mstack-protector-guard=@var{guard}}
697 @emph{i386 and x86-64 Windows Options}
698 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
699 -mnop-fun-dllimport -mthread @gol
700 -municode -mwin32 -mwindows -fno-set-stack-executable}
703 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
704 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
705 -mconstant-gp -mauto-pic -mfused-madd @gol
706 -minline-float-divide-min-latency @gol
707 -minline-float-divide-max-throughput @gol
708 -mno-inline-float-divide @gol
709 -minline-int-divide-min-latency @gol
710 -minline-int-divide-max-throughput @gol
711 -mno-inline-int-divide @gol
712 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
713 -mno-inline-sqrt @gol
714 -mdwarf2-asm -mearly-stop-bits @gol
715 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
716 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
717 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
718 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
719 -msched-spec-ldc -msched-spec-control-ldc @gol
720 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
721 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
722 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
723 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
726 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
727 -msign-extend-enabled -muser-enabled}
729 @emph{M32R/D Options}
730 @gccoptlist{-m32r2 -m32rx -m32r @gol
732 -malign-loops -mno-align-loops @gol
733 -missue-rate=@var{number} @gol
734 -mbranch-cost=@var{number} @gol
735 -mmodel=@var{code-size-model-type} @gol
736 -msdata=@var{sdata-type} @gol
737 -mno-flush-func -mflush-func=@var{name} @gol
738 -mno-flush-trap -mflush-trap=@var{number} @gol
742 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
744 @emph{M680x0 Options}
745 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
746 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
747 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
748 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
749 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
750 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
751 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
752 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
756 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
757 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
758 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
759 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
760 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
763 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
764 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
765 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
766 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
769 @emph{MicroBlaze Options}
770 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
771 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
772 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
773 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
774 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
777 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
778 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
779 -mips64 -mips64r2 -mips64r3 -mips64r5 @gol
780 -mips16 -mno-mips16 -mflip-mips16 @gol
781 -minterlink-compressed -mno-interlink-compressed @gol
782 -minterlink-mips16 -mno-interlink-mips16 @gol
783 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
784 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
785 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
786 -mno-float -msingle-float -mdouble-float @gol
787 -mabs=@var{mode} -mnan=@var{encoding} @gol
788 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
791 -mvirt -mno-virt @gol
793 -mmicromips -mno-micromips @gol
794 -mfpu=@var{fpu-type} @gol
795 -msmartmips -mno-smartmips @gol
796 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
797 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
798 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
799 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
800 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
801 -membedded-data -mno-embedded-data @gol
802 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
803 -mcode-readable=@var{setting} @gol
804 -msplit-addresses -mno-split-addresses @gol
805 -mexplicit-relocs -mno-explicit-relocs @gol
806 -mcheck-zero-division -mno-check-zero-division @gol
807 -mdivide-traps -mdivide-breaks @gol
808 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
809 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
810 -mfix-24k -mno-fix-24k @gol
811 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
812 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
813 -mfix-vr4120 -mno-fix-vr4120 @gol
814 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
815 -mflush-func=@var{func} -mno-flush-func @gol
816 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
817 -mfp-exceptions -mno-fp-exceptions @gol
818 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
819 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
822 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
823 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
824 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
825 -mno-base-addresses -msingle-exit -mno-single-exit}
827 @emph{MN10300 Options}
828 @gccoptlist{-mmult-bug -mno-mult-bug @gol
829 -mno-am33 -mam33 -mam33-2 -mam34 @gol
830 -mtune=@var{cpu-type} @gol
831 -mreturn-pointer-on-d0 @gol
832 -mno-crt0 -mrelax -mliw -msetlb}
835 @gccoptlist{-meb -mel -mno-crt0}
837 @emph{MSP430 Options}
838 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
842 @gccoptlist{-mbig-endian -mlittle-endian @gol
843 -mreduced-regs -mfull-regs @gol
844 -mcmov -mno-cmov @gol
845 -mperf-ext -mno-perf-ext @gol
846 -mv3push -mno-v3push @gol
847 -m16bit -mno-16bit @gol
848 -mgp-direct -mno-gp-direct @gol
849 -misr-vector-size=@var{num} @gol
850 -mcache-block-size=@var{num} @gol
851 -march=@var{arch} @gol
852 -mforce-fp-as-gp -mforbid-fp-as-gp @gol
853 -mex9 -mctor-dtor -mrelax}
855 @emph{Nios II Options}
856 @gccoptlist{-G @var{num} -mgpopt -mno-gpopt -mel -meb @gol
857 -mno-bypass-cache -mbypass-cache @gol
858 -mno-cache-volatile -mcache-volatile @gol
859 -mno-fast-sw-div -mfast-sw-div @gol
860 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
861 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
862 -mcustom-fpu-cfg=@var{name} @gol
863 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}}
865 @emph{PDP-11 Options}
866 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
867 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
868 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
869 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
870 -mbranch-expensive -mbranch-cheap @gol
871 -munix-asm -mdec-asm}
873 @emph{picoChip Options}
874 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
875 -msymbol-as-address -mno-inefficient-warnings}
877 @emph{PowerPC Options}
878 See RS/6000 and PowerPC Options.
881 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 -m64bit-doubles -m32bit-doubles}
883 @emph{RS/6000 and PowerPC Options}
884 @gccoptlist{-mcpu=@var{cpu-type} @gol
885 -mtune=@var{cpu-type} @gol
886 -mcmodel=@var{code-model} @gol
888 -maltivec -mno-altivec @gol
889 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
890 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
891 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
892 -mfprnd -mno-fprnd @gol
893 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
894 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
895 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
896 -malign-power -malign-natural @gol
897 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
898 -msingle-float -mdouble-float -msimple-fpu @gol
899 -mstring -mno-string -mupdate -mno-update @gol
900 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
901 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
902 -mstrict-align -mno-strict-align -mrelocatable @gol
903 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
904 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
905 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
906 -mprioritize-restricted-insns=@var{priority} @gol
907 -msched-costly-dep=@var{dependence_type} @gol
908 -minsert-sched-nops=@var{scheme} @gol
909 -mcall-sysv -mcall-netbsd @gol
910 -maix-struct-return -msvr4-struct-return @gol
911 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
912 -mblock-move-inline-limit=@var{num} @gol
913 -misel -mno-isel @gol
914 -misel=yes -misel=no @gol
916 -mspe=yes -mspe=no @gol
918 -mgen-cell-microcode -mwarn-cell-microcode @gol
919 -mvrsave -mno-vrsave @gol
920 -mmulhw -mno-mulhw @gol
921 -mdlmzb -mno-dlmzb @gol
922 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
923 -mprototype -mno-prototype @gol
924 -msim -mmvme -mads -myellowknife -memb -msdata @gol
925 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
926 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
927 -mno-recip-precision @gol
928 -mveclibabi=@var{type} -mfriz -mno-friz @gol
929 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
930 -msave-toc-indirect -mno-save-toc-indirect @gol
931 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
932 -mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
933 -mquad-memory -mno-quad-memory @gol
934 -mquad-memory-atomic -mno-quad-memory-atomic @gol
935 -mcompat-align-parm -mno-compat-align-parm}
938 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
940 -mbig-endian-data -mlittle-endian-data @gol
943 -mas100-syntax -mno-as100-syntax@gol
945 -mmax-constant-size=@gol
948 -mno-warn-multiple-fast-interrupts@gol
949 -msave-acc-in-interrupts}
951 @emph{S/390 and zSeries Options}
952 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
953 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
954 -mlong-double-64 -mlong-double-128 @gol
955 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
956 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
957 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
958 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
959 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
960 -mhotpatch[=@var{halfwords}] -mno-hotpatch}
963 @gccoptlist{-meb -mel @gol
967 -mscore5 -mscore5u -mscore7 -mscore7d}
970 @gccoptlist{-m1 -m2 -m2e @gol
971 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
973 -m4-nofpu -m4-single-only -m4-single -m4 @gol
974 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
975 -m5-64media -m5-64media-nofpu @gol
976 -m5-32media -m5-32media-nofpu @gol
977 -m5-compact -m5-compact-nofpu @gol
978 -mb -ml -mdalign -mrelax @gol
979 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
980 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
981 -mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
982 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
983 -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
984 -maccumulate-outgoing-args -minvalid-symbols @gol
985 -matomic-model=@var{atomic-model} @gol
986 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
987 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
988 -mpretend-cmove -mtas}
990 @emph{Solaris 2 Options}
991 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
995 @gccoptlist{-mcpu=@var{cpu-type} @gol
996 -mtune=@var{cpu-type} @gol
997 -mcmodel=@var{code-model} @gol
998 -mmemory-model=@var{mem-model} @gol
999 -m32 -m64 -mapp-regs -mno-app-regs @gol
1000 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1001 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1002 -mhard-quad-float -msoft-quad-float @gol
1003 -mstack-bias -mno-stack-bias @gol
1004 -munaligned-doubles -mno-unaligned-doubles @gol
1005 -muser-mode -mno-user-mode @gol
1006 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1007 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1008 -mcbcond -mno-cbcond @gol
1009 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1010 -mfix-at697f -mfix-ut699}
1013 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1014 -msafe-dma -munsafe-dma @gol
1016 -msmall-mem -mlarge-mem -mstdmain @gol
1017 -mfixed-range=@var{register-range} @gol
1019 -maddress-space-conversion -mno-address-space-conversion @gol
1020 -mcache-size=@var{cache-size} @gol
1021 -matomic-updates -mno-atomic-updates}
1023 @emph{System V Options}
1024 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1026 @emph{TILE-Gx Options}
1027 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1028 -mcmodel=@var{code-model}}
1030 @emph{TILEPro Options}
1031 @gccoptlist{-mcpu=@var{cpu} -m32}
1034 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1035 -mprolog-function -mno-prolog-function -mspace @gol
1036 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1037 -mapp-regs -mno-app-regs @gol
1038 -mdisable-callt -mno-disable-callt @gol
1039 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1040 -mv850e -mv850 -mv850e3v5 @gol
1051 @gccoptlist{-mg -mgnu -munix}
1054 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1055 -mpointer-size=@var{size}}
1057 @emph{VxWorks Options}
1058 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1059 -Xbind-lazy -Xbind-now}
1061 @emph{x86-64 Options}
1062 See i386 and x86-64 Options.
1064 @emph{Xstormy16 Options}
1067 @emph{Xtensa Options}
1068 @gccoptlist{-mconst16 -mno-const16 @gol
1069 -mfused-madd -mno-fused-madd @gol
1071 -mserialize-volatile -mno-serialize-volatile @gol
1072 -mtext-section-literals -mno-text-section-literals @gol
1073 -mtarget-align -mno-target-align @gol
1074 -mlongcalls -mno-longcalls}
1076 @emph{zSeries Options}
1077 See S/390 and zSeries Options.
1079 @item Code Generation Options
1080 @xref{Code Gen Options,,Options for Code Generation Conventions}.
1081 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
1082 -ffixed-@var{reg} -fexceptions @gol
1083 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
1084 -fasynchronous-unwind-tables @gol
1085 -fno-gnu-unique @gol
1086 -finhibit-size-directive -finstrument-functions @gol
1087 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
1088 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
1089 -fno-common -fno-ident @gol
1090 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
1091 -fno-jump-tables @gol
1092 -frecord-gcc-switches @gol
1093 -freg-struct-return -fshort-enums @gol
1094 -fshort-double -fshort-wchar @gol
1095 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
1096 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
1097 -fno-stack-limit -fsplit-stack @gol
1098 -fleading-underscore -ftls-model=@var{model} @gol
1099 -fstack-reuse=@var{reuse_level} @gol
1100 -ftrapv -fwrapv -fbounds-check @gol
1101 -fvisibility -fstrict-volatile-bitfields -fsync-libcalls}
1105 @node Overall Options
1106 @section Options Controlling the Kind of Output
1108 Compilation can involve up to four stages: preprocessing, compilation
1109 proper, assembly and linking, always in that order. GCC is capable of
1110 preprocessing and compiling several files either into several
1111 assembler input files, or into one assembler input file; then each
1112 assembler input file produces an object file, and linking combines all
1113 the object files (those newly compiled, and those specified as input)
1114 into an executable file.
1116 @cindex file name suffix
1117 For any given input file, the file name suffix determines what kind of
1118 compilation is done:
1122 C source code that must be preprocessed.
1125 C source code that should not be preprocessed.
1128 C++ source code that should not be preprocessed.
1131 Objective-C source code. Note that you must link with the @file{libobjc}
1132 library to make an Objective-C program work.
1135 Objective-C source code that should not be preprocessed.
1139 Objective-C++ source code. Note that you must link with the @file{libobjc}
1140 library to make an Objective-C++ program work. Note that @samp{.M} refers
1141 to a literal capital M@.
1143 @item @var{file}.mii
1144 Objective-C++ source code that should not be preprocessed.
1147 C, C++, Objective-C or Objective-C++ header file to be turned into a
1148 precompiled header (default), or C, C++ header file to be turned into an
1149 Ada spec (via the @option{-fdump-ada-spec} switch).
1152 @itemx @var{file}.cp
1153 @itemx @var{file}.cxx
1154 @itemx @var{file}.cpp
1155 @itemx @var{file}.CPP
1156 @itemx @var{file}.c++
1158 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1159 the last two letters must both be literally @samp{x}. Likewise,
1160 @samp{.C} refers to a literal capital C@.
1164 Objective-C++ source code that must be preprocessed.
1166 @item @var{file}.mii
1167 Objective-C++ source code that should not be preprocessed.
1171 @itemx @var{file}.hp
1172 @itemx @var{file}.hxx
1173 @itemx @var{file}.hpp
1174 @itemx @var{file}.HPP
1175 @itemx @var{file}.h++
1176 @itemx @var{file}.tcc
1177 C++ header file to be turned into a precompiled header or Ada spec.
1180 @itemx @var{file}.for
1181 @itemx @var{file}.ftn
1182 Fixed form Fortran source code that should not be preprocessed.
1185 @itemx @var{file}.FOR
1186 @itemx @var{file}.fpp
1187 @itemx @var{file}.FPP
1188 @itemx @var{file}.FTN
1189 Fixed form Fortran source code that must be preprocessed (with the traditional
1192 @item @var{file}.f90
1193 @itemx @var{file}.f95
1194 @itemx @var{file}.f03
1195 @itemx @var{file}.f08
1196 Free form Fortran source code that should not be preprocessed.
1198 @item @var{file}.F90
1199 @itemx @var{file}.F95
1200 @itemx @var{file}.F03
1201 @itemx @var{file}.F08
1202 Free form Fortran source code that must be preprocessed (with the
1203 traditional preprocessor).
1208 @c FIXME: Descriptions of Java file types.
1214 @item @var{file}.ads
1215 Ada source code file that contains a library unit declaration (a
1216 declaration of a package, subprogram, or generic, or a generic
1217 instantiation), or a library unit renaming declaration (a package,
1218 generic, or subprogram renaming declaration). Such files are also
1221 @item @var{file}.adb
1222 Ada source code file containing a library unit body (a subprogram or
1223 package body). Such files are also called @dfn{bodies}.
1225 @c GCC also knows about some suffixes for languages not yet included:
1236 @itemx @var{file}.sx
1237 Assembler code that must be preprocessed.
1240 An object file to be fed straight into linking.
1241 Any file name with no recognized suffix is treated this way.
1245 You can specify the input language explicitly with the @option{-x} option:
1248 @item -x @var{language}
1249 Specify explicitly the @var{language} for the following input files
1250 (rather than letting the compiler choose a default based on the file
1251 name suffix). This option applies to all following input files until
1252 the next @option{-x} option. Possible values for @var{language} are:
1254 c c-header cpp-output
1255 c++ c++-header c++-cpp-output
1256 objective-c objective-c-header objective-c-cpp-output
1257 objective-c++ objective-c++-header objective-c++-cpp-output
1258 assembler assembler-with-cpp
1260 f77 f77-cpp-input f95 f95-cpp-input
1266 Turn off any specification of a language, so that subsequent files are
1267 handled according to their file name suffixes (as they are if @option{-x}
1268 has not been used at all).
1270 @item -pass-exit-codes
1271 @opindex pass-exit-codes
1272 Normally the @command{gcc} program exits with the code of 1 if any
1273 phase of the compiler returns a non-success return code. If you specify
1274 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1275 the numerically highest error produced by any phase returning an error
1276 indication. The C, C++, and Fortran front ends return 4 if an internal
1277 compiler error is encountered.
1280 If you only want some of the stages of compilation, you can use
1281 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1282 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1283 @command{gcc} is to stop. Note that some combinations (for example,
1284 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1289 Compile or assemble the source files, but do not link. The linking
1290 stage simply is not done. The ultimate output is in the form of an
1291 object file for each source file.
1293 By default, the object file name for a source file is made by replacing
1294 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1296 Unrecognized input files, not requiring compilation or assembly, are
1301 Stop after the stage of compilation proper; do not assemble. The output
1302 is in the form of an assembler code file for each non-assembler input
1305 By default, the assembler file name for a source file is made by
1306 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1308 Input files that don't require compilation are ignored.
1312 Stop after the preprocessing stage; do not run the compiler proper. The
1313 output is in the form of preprocessed source code, which is sent to the
1316 Input files that don't require preprocessing are ignored.
1318 @cindex output file option
1321 Place output in file @var{file}. This applies to whatever
1322 sort of output is being produced, whether it be an executable file,
1323 an object file, an assembler file or preprocessed C code.
1325 If @option{-o} is not specified, the default is to put an executable
1326 file in @file{a.out}, the object file for
1327 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1328 assembler file in @file{@var{source}.s}, a precompiled header file in
1329 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1334 Print (on standard error output) the commands executed to run the stages
1335 of compilation. Also print the version number of the compiler driver
1336 program and of the preprocessor and the compiler proper.
1340 Like @option{-v} except the commands are not executed and arguments
1341 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1342 This is useful for shell scripts to capture the driver-generated command lines.
1346 Use pipes rather than temporary files for communication between the
1347 various stages of compilation. This fails to work on some systems where
1348 the assembler is unable to read from a pipe; but the GNU assembler has
1353 Print (on the standard output) a description of the command-line options
1354 understood by @command{gcc}. If the @option{-v} option is also specified
1355 then @option{--help} is also passed on to the various processes
1356 invoked by @command{gcc}, so that they can display the command-line options
1357 they accept. If the @option{-Wextra} option has also been specified
1358 (prior to the @option{--help} option), then command-line options that
1359 have no documentation associated with them are also displayed.
1362 @opindex target-help
1363 Print (on the standard output) a description of target-specific command-line
1364 options for each tool. For some targets extra target-specific
1365 information may also be printed.
1367 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1368 Print (on the standard output) a description of the command-line
1369 options understood by the compiler that fit into all specified classes
1370 and qualifiers. These are the supported classes:
1373 @item @samp{optimizers}
1374 Display all of the optimization options supported by the
1377 @item @samp{warnings}
1378 Display all of the options controlling warning messages
1379 produced by the compiler.
1382 Display target-specific options. Unlike the
1383 @option{--target-help} option however, target-specific options of the
1384 linker and assembler are not displayed. This is because those
1385 tools do not currently support the extended @option{--help=} syntax.
1388 Display the values recognized by the @option{--param}
1391 @item @var{language}
1392 Display the options supported for @var{language}, where
1393 @var{language} is the name of one of the languages supported in this
1397 Display the options that are common to all languages.
1400 These are the supported qualifiers:
1403 @item @samp{undocumented}
1404 Display only those options that are undocumented.
1407 Display options taking an argument that appears after an equal
1408 sign in the same continuous piece of text, such as:
1409 @samp{--help=target}.
1411 @item @samp{separate}
1412 Display options taking an argument that appears as a separate word
1413 following the original option, such as: @samp{-o output-file}.
1416 Thus for example to display all the undocumented target-specific
1417 switches supported by the compiler, use:
1420 --help=target,undocumented
1423 The sense of a qualifier can be inverted by prefixing it with the
1424 @samp{^} character, so for example to display all binary warning
1425 options (i.e., ones that are either on or off and that do not take an
1426 argument) that have a description, use:
1429 --help=warnings,^joined,^undocumented
1432 The argument to @option{--help=} should not consist solely of inverted
1435 Combining several classes is possible, although this usually
1436 restricts the output so much that there is nothing to display. One
1437 case where it does work, however, is when one of the classes is
1438 @var{target}. For example, to display all the target-specific
1439 optimization options, use:
1442 --help=target,optimizers
1445 The @option{--help=} option can be repeated on the command line. Each
1446 successive use displays its requested class of options, skipping
1447 those that have already been displayed.
1449 If the @option{-Q} option appears on the command line before the
1450 @option{--help=} option, then the descriptive text displayed by
1451 @option{--help=} is changed. Instead of describing the displayed
1452 options, an indication is given as to whether the option is enabled,
1453 disabled or set to a specific value (assuming that the compiler
1454 knows this at the point where the @option{--help=} option is used).
1456 Here is a truncated example from the ARM port of @command{gcc}:
1459 % gcc -Q -mabi=2 --help=target -c
1460 The following options are target specific:
1462 -mabort-on-noreturn [disabled]
1466 The output is sensitive to the effects of previous command-line
1467 options, so for example it is possible to find out which optimizations
1468 are enabled at @option{-O2} by using:
1471 -Q -O2 --help=optimizers
1474 Alternatively you can discover which binary optimizations are enabled
1475 by @option{-O3} by using:
1478 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1479 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1480 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1483 @item -no-canonical-prefixes
1484 @opindex no-canonical-prefixes
1485 Do not expand any symbolic links, resolve references to @samp{/../}
1486 or @samp{/./}, or make the path absolute when generating a relative
1491 Display the version number and copyrights of the invoked GCC@.
1495 Invoke all subcommands under a wrapper program. The name of the
1496 wrapper program and its parameters are passed as a comma separated
1500 gcc -c t.c -wrapper gdb,--args
1504 This invokes all subprograms of @command{gcc} under
1505 @samp{gdb --args}, thus the invocation of @command{cc1} is
1506 @samp{gdb --args cc1 @dots{}}.
1508 @item -fplugin=@var{name}.so
1510 Load the plugin code in file @var{name}.so, assumed to be a
1511 shared object to be dlopen'd by the compiler. The base name of
1512 the shared object file is used to identify the plugin for the
1513 purposes of argument parsing (See
1514 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1515 Each plugin should define the callback functions specified in the
1518 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1519 @opindex fplugin-arg
1520 Define an argument called @var{key} with a value of @var{value}
1521 for the plugin called @var{name}.
1523 @item -fdump-ada-spec@r{[}-slim@r{]}
1524 @opindex fdump-ada-spec
1525 For C and C++ source and include files, generate corresponding Ada specs.
1526 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1527 GNAT User's Guide}, which provides detailed documentation on this feature.
1529 @item -fada-spec-parent=@var{unit}
1530 @opindex fada-spec-parent
1531 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1532 Ada specs as child units of parent @var{unit}.
1534 @item -fdump-go-spec=@var{file}
1535 @opindex fdump-go-spec
1536 For input files in any language, generate corresponding Go
1537 declarations in @var{file}. This generates Go @code{const},
1538 @code{type}, @code{var}, and @code{func} declarations which may be a
1539 useful way to start writing a Go interface to code written in some
1542 @include @value{srcdir}/../libiberty/at-file.texi
1546 @section Compiling C++ Programs
1548 @cindex suffixes for C++ source
1549 @cindex C++ source file suffixes
1550 C++ source files conventionally use one of the suffixes @samp{.C},
1551 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1552 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1553 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1554 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1555 files with these names and compiles them as C++ programs even if you
1556 call the compiler the same way as for compiling C programs (usually
1557 with the name @command{gcc}).
1561 However, the use of @command{gcc} does not add the C++ library.
1562 @command{g++} is a program that calls GCC and automatically specifies linking
1563 against the C++ library. It treats @samp{.c},
1564 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1565 files unless @option{-x} is used. This program is also useful when
1566 precompiling a C header file with a @samp{.h} extension for use in C++
1567 compilations. On many systems, @command{g++} is also installed with
1568 the name @command{c++}.
1570 @cindex invoking @command{g++}
1571 When you compile C++ programs, you may specify many of the same
1572 command-line options that you use for compiling programs in any
1573 language; or command-line options meaningful for C and related
1574 languages; or options that are meaningful only for C++ programs.
1575 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1576 explanations of options for languages related to C@.
1577 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1578 explanations of options that are meaningful only for C++ programs.
1580 @node C Dialect Options
1581 @section Options Controlling C Dialect
1582 @cindex dialect options
1583 @cindex language dialect options
1584 @cindex options, dialect
1586 The following options control the dialect of C (or languages derived
1587 from C, such as C++, Objective-C and Objective-C++) that the compiler
1591 @cindex ANSI support
1595 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1596 equivalent to @option{-std=c++98}.
1598 This turns off certain features of GCC that are incompatible with ISO
1599 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1600 such as the @code{asm} and @code{typeof} keywords, and
1601 predefined macros such as @code{unix} and @code{vax} that identify the
1602 type of system you are using. It also enables the undesirable and
1603 rarely used ISO trigraph feature. For the C compiler,
1604 it disables recognition of C++ style @samp{//} comments as well as
1605 the @code{inline} keyword.
1607 The alternate keywords @code{__asm__}, @code{__extension__},
1608 @code{__inline__} and @code{__typeof__} continue to work despite
1609 @option{-ansi}. You would not want to use them in an ISO C program, of
1610 course, but it is useful to put them in header files that might be included
1611 in compilations done with @option{-ansi}. Alternate predefined macros
1612 such as @code{__unix__} and @code{__vax__} are also available, with or
1613 without @option{-ansi}.
1615 The @option{-ansi} option does not cause non-ISO programs to be
1616 rejected gratuitously. For that, @option{-Wpedantic} is required in
1617 addition to @option{-ansi}. @xref{Warning Options}.
1619 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1620 option is used. Some header files may notice this macro and refrain
1621 from declaring certain functions or defining certain macros that the
1622 ISO standard doesn't call for; this is to avoid interfering with any
1623 programs that might use these names for other things.
1625 Functions that are normally built in but do not have semantics
1626 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1627 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1628 built-in functions provided by GCC}, for details of the functions
1633 Determine the language standard. @xref{Standards,,Language Standards
1634 Supported by GCC}, for details of these standard versions. This option
1635 is currently only supported when compiling C or C++.
1637 The compiler can accept several base standards, such as @samp{c90} or
1638 @samp{c++98}, and GNU dialects of those standards, such as
1639 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1640 compiler accepts all programs following that standard plus those
1641 using GNU extensions that do not contradict it. For example,
1642 @option{-std=c90} turns off certain features of GCC that are
1643 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1644 keywords, but not other GNU extensions that do not have a meaning in
1645 ISO C90, such as omitting the middle term of a @code{?:}
1646 expression. On the other hand, when a GNU dialect of a standard is
1647 specified, all features supported by the compiler are enabled, even when
1648 those features change the meaning of the base standard. As a result, some
1649 strict-conforming programs may be rejected. The particular standard
1650 is used by @option{-Wpedantic} to identify which features are GNU
1651 extensions given that version of the standard. For example
1652 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1653 comments, while @option{-std=gnu99 -Wpedantic} does not.
1655 A value for this option must be provided; possible values are
1661 Support all ISO C90 programs (certain GNU extensions that conflict
1662 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1664 @item iso9899:199409
1665 ISO C90 as modified in amendment 1.
1671 ISO C99. This standard is substantially completely supported, modulo
1672 bugs, extended identifiers (supported except for corner cases when
1673 @option{-fextended-identifiers} is used) and floating-point issues
1674 (mainly but not entirely relating to optional C99 features from
1675 Annexes F and G). See
1676 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1677 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1682 ISO C11, the 2011 revision of the ISO C standard. This standard is
1683 substantially completely supported, modulo bugs, extended identifiers
1684 (supported except for corner cases when
1685 @option{-fextended-identifiers} is used), floating-point issues
1686 (mainly but not entirely relating to optional C11 features from
1687 Annexes F and G) and the optional Annexes K (Bounds-checking
1688 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1692 GNU dialect of ISO C90 (including some C99 features). This
1693 is the default for C code.
1697 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1701 GNU dialect of ISO C11. This is intended to become the default in a
1702 future release of GCC. The name @samp{gnu1x} is deprecated.
1706 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1707 additional defect reports. Same as @option{-ansi} for C++ code.
1711 GNU dialect of @option{-std=c++98}. This is the default for
1716 The 2011 ISO C++ standard plus amendments.
1717 The name @samp{c++0x} is deprecated.
1721 GNU dialect of @option{-std=c++11}.
1722 The name @samp{gnu++0x} is deprecated.
1725 The next revision of the ISO C++ standard, tentatively planned for
1726 2014. Support is highly experimental, and will almost certainly
1727 change in incompatible ways in future releases.
1730 GNU dialect of @option{-std=c++1y}. Support is highly experimental,
1731 and will almost certainly change in incompatible ways in future
1735 @item -fgnu89-inline
1736 @opindex fgnu89-inline
1737 The option @option{-fgnu89-inline} tells GCC to use the traditional
1738 GNU semantics for @code{inline} functions when in C99 mode.
1739 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1740 is accepted and ignored by GCC versions 4.1.3 up to but not including
1741 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1742 C99 mode. Using this option is roughly equivalent to adding the
1743 @code{gnu_inline} function attribute to all inline functions
1744 (@pxref{Function Attributes}).
1746 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1747 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1748 specifies the default behavior). This option was first supported in
1749 GCC 4.3. This option is not supported in @option{-std=c90} or
1750 @option{-std=gnu90} mode.
1752 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1753 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1754 in effect for @code{inline} functions. @xref{Common Predefined
1755 Macros,,,cpp,The C Preprocessor}.
1757 @item -aux-info @var{filename}
1759 Output to the given filename prototyped declarations for all functions
1760 declared and/or defined in a translation unit, including those in header
1761 files. This option is silently ignored in any language other than C@.
1763 Besides declarations, the file indicates, in comments, the origin of
1764 each declaration (source file and line), whether the declaration was
1765 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1766 @samp{O} for old, respectively, in the first character after the line
1767 number and the colon), and whether it came from a declaration or a
1768 definition (@samp{C} or @samp{F}, respectively, in the following
1769 character). In the case of function definitions, a K&R-style list of
1770 arguments followed by their declarations is also provided, inside
1771 comments, after the declaration.
1773 @item -fallow-parameterless-variadic-functions
1774 @opindex fallow-parameterless-variadic-functions
1775 Accept variadic functions without named parameters.
1777 Although it is possible to define such a function, this is not very
1778 useful as it is not possible to read the arguments. This is only
1779 supported for C as this construct is allowed by C++.
1783 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1784 keyword, so that code can use these words as identifiers. You can use
1785 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1786 instead. @option{-ansi} implies @option{-fno-asm}.
1788 In C++, this switch only affects the @code{typeof} keyword, since
1789 @code{asm} and @code{inline} are standard keywords. You may want to
1790 use the @option{-fno-gnu-keywords} flag instead, which has the same
1791 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1792 switch only affects the @code{asm} and @code{typeof} keywords, since
1793 @code{inline} is a standard keyword in ISO C99.
1796 @itemx -fno-builtin-@var{function}
1797 @opindex fno-builtin
1798 @cindex built-in functions
1799 Don't recognize built-in functions that do not begin with
1800 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1801 functions provided by GCC}, for details of the functions affected,
1802 including those which are not built-in functions when @option{-ansi} or
1803 @option{-std} options for strict ISO C conformance are used because they
1804 do not have an ISO standard meaning.
1806 GCC normally generates special code to handle certain built-in functions
1807 more efficiently; for instance, calls to @code{alloca} may become single
1808 instructions which adjust the stack directly, and calls to @code{memcpy}
1809 may become inline copy loops. The resulting code is often both smaller
1810 and faster, but since the function calls no longer appear as such, you
1811 cannot set a breakpoint on those calls, nor can you change the behavior
1812 of the functions by linking with a different library. In addition,
1813 when a function is recognized as a built-in function, GCC may use
1814 information about that function to warn about problems with calls to
1815 that function, or to generate more efficient code, even if the
1816 resulting code still contains calls to that function. For example,
1817 warnings are given with @option{-Wformat} for bad calls to
1818 @code{printf} when @code{printf} is built in and @code{strlen} is
1819 known not to modify global memory.
1821 With the @option{-fno-builtin-@var{function}} option
1822 only the built-in function @var{function} is
1823 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1824 function is named that is not built-in in this version of GCC, this
1825 option is ignored. There is no corresponding
1826 @option{-fbuiltin-@var{function}} option; if you wish to enable
1827 built-in functions selectively when using @option{-fno-builtin} or
1828 @option{-ffreestanding}, you may define macros such as:
1831 #define abs(n) __builtin_abs ((n))
1832 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1837 @cindex hosted environment
1839 Assert that compilation targets a hosted environment. This implies
1840 @option{-fbuiltin}. A hosted environment is one in which the
1841 entire standard library is available, and in which @code{main} has a return
1842 type of @code{int}. Examples are nearly everything except a kernel.
1843 This is equivalent to @option{-fno-freestanding}.
1845 @item -ffreestanding
1846 @opindex ffreestanding
1847 @cindex hosted environment
1849 Assert that compilation targets a freestanding environment. This
1850 implies @option{-fno-builtin}. A freestanding environment
1851 is one in which the standard library may not exist, and program startup may
1852 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1853 This is equivalent to @option{-fno-hosted}.
1855 @xref{Standards,,Language Standards Supported by GCC}, for details of
1856 freestanding and hosted environments.
1860 @cindex OpenMP parallel
1861 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1862 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1863 compiler generates parallel code according to the OpenMP Application
1864 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1865 implies @option{-pthread}, and thus is only supported on targets that
1866 have support for @option{-pthread}. @option{-fopenmp} implies
1867 @option{-fopenmp-simd}.
1870 @opindex fopenmp-simd
1873 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1874 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1879 @cindex Enable Cilk Plus
1880 Enable the usage of Cilk Plus language extension features for C/C++.
1881 When the option @option{-fcilkplus} is specified, enable the usage of
1882 the Cilk Plus Language extension features for C/C++. The present
1883 implementation follows ABI version 1.2. This is an experimental
1884 feature that is only partially complete, and whose interface may
1885 change in future versions of GCC as the official specification
1886 changes. Currently, all features but @code{_Cilk_for} have been
1891 When the option @option{-fgnu-tm} is specified, the compiler
1892 generates code for the Linux variant of Intel's current Transactional
1893 Memory ABI specification document (Revision 1.1, May 6 2009). This is
1894 an experimental feature whose interface may change in future versions
1895 of GCC, as the official specification changes. Please note that not
1896 all architectures are supported for this feature.
1898 For more information on GCC's support for transactional memory,
1899 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1900 Transactional Memory Library}.
1902 Note that the transactional memory feature is not supported with
1903 non-call exceptions (@option{-fnon-call-exceptions}).
1905 @item -fms-extensions
1906 @opindex fms-extensions
1907 Accept some non-standard constructs used in Microsoft header files.
1909 In C++ code, this allows member names in structures to be similar
1910 to previous types declarations.
1919 Some cases of unnamed fields in structures and unions are only
1920 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1921 fields within structs/unions}, for details.
1923 Note that this option is off for all targets but i?86 and x86_64
1924 targets using ms-abi.
1925 @item -fplan9-extensions
1926 Accept some non-standard constructs used in Plan 9 code.
1928 This enables @option{-fms-extensions}, permits passing pointers to
1929 structures with anonymous fields to functions that expect pointers to
1930 elements of the type of the field, and permits referring to anonymous
1931 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1932 struct/union fields within structs/unions}, for details. This is only
1933 supported for C, not C++.
1937 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1938 options for strict ISO C conformance) implies @option{-trigraphs}.
1940 @cindex traditional C language
1941 @cindex C language, traditional
1943 @itemx -traditional-cpp
1944 @opindex traditional-cpp
1945 @opindex traditional
1946 Formerly, these options caused GCC to attempt to emulate a pre-standard
1947 C compiler. They are now only supported with the @option{-E} switch.
1948 The preprocessor continues to support a pre-standard mode. See the GNU
1949 CPP manual for details.
1951 @item -fcond-mismatch
1952 @opindex fcond-mismatch
1953 Allow conditional expressions with mismatched types in the second and
1954 third arguments. The value of such an expression is void. This option
1955 is not supported for C++.
1957 @item -flax-vector-conversions
1958 @opindex flax-vector-conversions
1959 Allow implicit conversions between vectors with differing numbers of
1960 elements and/or incompatible element types. This option should not be
1963 @item -funsigned-char
1964 @opindex funsigned-char
1965 Let the type @code{char} be unsigned, like @code{unsigned char}.
1967 Each kind of machine has a default for what @code{char} should
1968 be. It is either like @code{unsigned char} by default or like
1969 @code{signed char} by default.
1971 Ideally, a portable program should always use @code{signed char} or
1972 @code{unsigned char} when it depends on the signedness of an object.
1973 But many programs have been written to use plain @code{char} and
1974 expect it to be signed, or expect it to be unsigned, depending on the
1975 machines they were written for. This option, and its inverse, let you
1976 make such a program work with the opposite default.
1978 The type @code{char} is always a distinct type from each of
1979 @code{signed char} or @code{unsigned char}, even though its behavior
1980 is always just like one of those two.
1983 @opindex fsigned-char
1984 Let the type @code{char} be signed, like @code{signed char}.
1986 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1987 the negative form of @option{-funsigned-char}. Likewise, the option
1988 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1990 @item -fsigned-bitfields
1991 @itemx -funsigned-bitfields
1992 @itemx -fno-signed-bitfields
1993 @itemx -fno-unsigned-bitfields
1994 @opindex fsigned-bitfields
1995 @opindex funsigned-bitfields
1996 @opindex fno-signed-bitfields
1997 @opindex fno-unsigned-bitfields
1998 These options control whether a bit-field is signed or unsigned, when the
1999 declaration does not use either @code{signed} or @code{unsigned}. By
2000 default, such a bit-field is signed, because this is consistent: the
2001 basic integer types such as @code{int} are signed types.
2004 @node C++ Dialect Options
2005 @section Options Controlling C++ Dialect
2007 @cindex compiler options, C++
2008 @cindex C++ options, command-line
2009 @cindex options, C++
2010 This section describes the command-line options that are only meaningful
2011 for C++ programs. You can also use most of the GNU compiler options
2012 regardless of what language your program is in. For example, you
2013 might compile a file @code{firstClass.C} like this:
2016 g++ -g -frepo -O -c firstClass.C
2020 In this example, only @option{-frepo} is an option meant
2021 only for C++ programs; you can use the other options with any
2022 language supported by GCC@.
2024 Here is a list of options that are @emph{only} for compiling C++ programs:
2028 @item -fabi-version=@var{n}
2029 @opindex fabi-version
2030 Use version @var{n} of the C++ ABI@. The default is version 0.
2032 Version 0 refers to the version conforming most closely to
2033 the C++ ABI specification. Therefore, the ABI obtained using version 0
2034 will change in different versions of G++ as ABI bugs are fixed.
2036 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2038 Version 2 is the version of the C++ ABI that first appeared in G++
2039 3.4, and was the default through G++ 4.9.
2041 Version 3 corrects an error in mangling a constant address as a
2044 Version 4, which first appeared in G++ 4.5, implements a standard
2045 mangling for vector types.
2047 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2048 attribute const/volatile on function pointer types, decltype of a
2049 plain decl, and use of a function parameter in the declaration of
2052 Version 6, which first appeared in G++ 4.7, corrects the promotion
2053 behavior of C++11 scoped enums and the mangling of template argument
2054 packs, const/static_cast, prefix ++ and --, and a class scope function
2055 used as a template argument.
2057 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2058 builtin type and corrects the mangling of lambdas in default argument
2061 Version 8, which first appeared in G++ 4.9, corrects the substitution
2062 behavior of function types with function-cv-qualifiers.
2064 See also @option{-Wabi}.
2066 @item -fabi-compat-version=@var{n}
2067 @opindex fabi-compat-version
2068 Starting with GCC 4.5, on targets that support strong aliases, G++
2069 works around mangling changes by creating an alias with the correct
2070 mangled name when defining a symbol with an incorrect mangled name.
2071 This switch specifies which ABI version to use for the alias.
2073 With @option{-fabi-version=0} (the default), this defaults to 2. If
2074 another ABI version is explicitly selected, this defaults to 0.
2076 The compatibility version is also set by @option{-Wabi=@var{n}}.
2078 @item -fno-access-control
2079 @opindex fno-access-control
2080 Turn off all access checking. This switch is mainly useful for working
2081 around bugs in the access control code.
2085 Check that the pointer returned by @code{operator new} is non-null
2086 before attempting to modify the storage allocated. This check is
2087 normally unnecessary because the C++ standard specifies that
2088 @code{operator new} only returns @code{0} if it is declared
2089 @samp{throw()}, in which case the compiler always checks the
2090 return value even without this option. In all other cases, when
2091 @code{operator new} has a non-empty exception specification, memory
2092 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2093 @samp{new (nothrow)}.
2095 @item -fconstexpr-depth=@var{n}
2096 @opindex fconstexpr-depth
2097 Set the maximum nested evaluation depth for C++11 constexpr functions
2098 to @var{n}. A limit is needed to detect endless recursion during
2099 constant expression evaluation. The minimum specified by the standard
2102 @item -fdeduce-init-list
2103 @opindex fdeduce-init-list
2104 Enable deduction of a template type parameter as
2105 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2108 template <class T> auto forward(T t) -> decltype (realfn (t))
2115 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2119 This deduction was implemented as a possible extension to the
2120 originally proposed semantics for the C++11 standard, but was not part
2121 of the final standard, so it is disabled by default. This option is
2122 deprecated, and may be removed in a future version of G++.
2124 @item -ffriend-injection
2125 @opindex ffriend-injection
2126 Inject friend functions into the enclosing namespace, so that they are
2127 visible outside the scope of the class in which they are declared.
2128 Friend functions were documented to work this way in the old Annotated
2129 C++ Reference Manual, and versions of G++ before 4.1 always worked
2130 that way. However, in ISO C++ a friend function that is not declared
2131 in an enclosing scope can only be found using argument dependent
2132 lookup. This option causes friends to be injected as they were in
2135 This option is for compatibility, and may be removed in a future
2138 @item -fno-elide-constructors
2139 @opindex fno-elide-constructors
2140 The C++ standard allows an implementation to omit creating a temporary
2141 that is only used to initialize another object of the same type.
2142 Specifying this option disables that optimization, and forces G++ to
2143 call the copy constructor in all cases.
2145 @item -fno-enforce-eh-specs
2146 @opindex fno-enforce-eh-specs
2147 Don't generate code to check for violation of exception specifications
2148 at run time. This option violates the C++ standard, but may be useful
2149 for reducing code size in production builds, much like defining
2150 @samp{NDEBUG}. This does not give user code permission to throw
2151 exceptions in violation of the exception specifications; the compiler
2152 still optimizes based on the specifications, so throwing an
2153 unexpected exception results in undefined behavior at run time.
2155 @item -fextern-tls-init
2156 @itemx -fno-extern-tls-init
2157 @opindex fextern-tls-init
2158 @opindex fno-extern-tls-init
2159 The C++11 and OpenMP standards allow @samp{thread_local} and
2160 @samp{threadprivate} variables to have dynamic (runtime)
2161 initialization. To support this, any use of such a variable goes
2162 through a wrapper function that performs any necessary initialization.
2163 When the use and definition of the variable are in the same
2164 translation unit, this overhead can be optimized away, but when the
2165 use is in a different translation unit there is significant overhead
2166 even if the variable doesn't actually need dynamic initialization. If
2167 the programmer can be sure that no use of the variable in a
2168 non-defining TU needs to trigger dynamic initialization (either
2169 because the variable is statically initialized, or a use of the
2170 variable in the defining TU will be executed before any uses in
2171 another TU), they can avoid this overhead with the
2172 @option{-fno-extern-tls-init} option.
2174 On targets that support symbol aliases, the default is
2175 @option{-fextern-tls-init}. On targets that do not support symbol
2176 aliases, the default is @option{-fno-extern-tls-init}.
2179 @itemx -fno-for-scope
2181 @opindex fno-for-scope
2182 If @option{-ffor-scope} is specified, the scope of variables declared in
2183 a @i{for-init-statement} is limited to the @samp{for} loop itself,
2184 as specified by the C++ standard.
2185 If @option{-fno-for-scope} is specified, the scope of variables declared in
2186 a @i{for-init-statement} extends to the end of the enclosing scope,
2187 as was the case in old versions of G++, and other (traditional)
2188 implementations of C++.
2190 If neither flag is given, the default is to follow the standard,
2191 but to allow and give a warning for old-style code that would
2192 otherwise be invalid, or have different behavior.
2194 @item -fno-gnu-keywords
2195 @opindex fno-gnu-keywords
2196 Do not recognize @code{typeof} as a keyword, so that code can use this
2197 word as an identifier. You can use the keyword @code{__typeof__} instead.
2198 @option{-ansi} implies @option{-fno-gnu-keywords}.
2200 @item -fno-implicit-templates
2201 @opindex fno-implicit-templates
2202 Never emit code for non-inline templates that are instantiated
2203 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2204 @xref{Template Instantiation}, for more information.
2206 @item -fno-implicit-inline-templates
2207 @opindex fno-implicit-inline-templates
2208 Don't emit code for implicit instantiations of inline templates, either.
2209 The default is to handle inlines differently so that compiles with and
2210 without optimization need the same set of explicit instantiations.
2212 @item -fno-implement-inlines
2213 @opindex fno-implement-inlines
2214 To save space, do not emit out-of-line copies of inline functions
2215 controlled by @samp{#pragma implementation}. This causes linker
2216 errors if these functions are not inlined everywhere they are called.
2218 @item -fms-extensions
2219 @opindex fms-extensions
2220 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2221 int and getting a pointer to member function via non-standard syntax.
2223 @item -fno-nonansi-builtins
2224 @opindex fno-nonansi-builtins
2225 Disable built-in declarations of functions that are not mandated by
2226 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2227 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2230 @opindex fnothrow-opt
2231 Treat a @code{throw()} exception specification as if it were a
2232 @code{noexcept} specification to reduce or eliminate the text size
2233 overhead relative to a function with no exception specification. If
2234 the function has local variables of types with non-trivial
2235 destructors, the exception specification actually makes the
2236 function smaller because the EH cleanups for those variables can be
2237 optimized away. The semantic effect is that an exception thrown out of
2238 a function with such an exception specification results in a call
2239 to @code{terminate} rather than @code{unexpected}.
2241 @item -fno-operator-names
2242 @opindex fno-operator-names
2243 Do not treat the operator name keywords @code{and}, @code{bitand},
2244 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2245 synonyms as keywords.
2247 @item -fno-optional-diags
2248 @opindex fno-optional-diags
2249 Disable diagnostics that the standard says a compiler does not need to
2250 issue. Currently, the only such diagnostic issued by G++ is the one for
2251 a name having multiple meanings within a class.
2254 @opindex fpermissive
2255 Downgrade some diagnostics about nonconformant code from errors to
2256 warnings. Thus, using @option{-fpermissive} allows some
2257 nonconforming code to compile.
2259 @item -fno-pretty-templates
2260 @opindex fno-pretty-templates
2261 When an error message refers to a specialization of a function
2262 template, the compiler normally prints the signature of the
2263 template followed by the template arguments and any typedefs or
2264 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2265 rather than @code{void f(int)}) so that it's clear which template is
2266 involved. When an error message refers to a specialization of a class
2267 template, the compiler omits any template arguments that match
2268 the default template arguments for that template. If either of these
2269 behaviors make it harder to understand the error message rather than
2270 easier, you can use @option{-fno-pretty-templates} to disable them.
2274 Enable automatic template instantiation at link time. This option also
2275 implies @option{-fno-implicit-templates}. @xref{Template
2276 Instantiation}, for more information.
2280 Disable generation of information about every class with virtual
2281 functions for use by the C++ run-time type identification features
2282 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
2283 of the language, you can save some space by using this flag. Note that
2284 exception handling uses the same information, but G++ generates it as
2285 needed. The @samp{dynamic_cast} operator can still be used for casts that
2286 do not require run-time type information, i.e.@: casts to @code{void *} or to
2287 unambiguous base classes.
2291 Emit statistics about front-end processing at the end of the compilation.
2292 This information is generally only useful to the G++ development team.
2294 @item -fstrict-enums
2295 @opindex fstrict-enums
2296 Allow the compiler to optimize using the assumption that a value of
2297 enumerated type can only be one of the values of the enumeration (as
2298 defined in the C++ standard; basically, a value that can be
2299 represented in the minimum number of bits needed to represent all the
2300 enumerators). This assumption may not be valid if the program uses a
2301 cast to convert an arbitrary integer value to the enumerated type.
2303 @item -ftemplate-backtrace-limit=@var{n}
2304 @opindex ftemplate-backtrace-limit
2305 Set the maximum number of template instantiation notes for a single
2306 warning or error to @var{n}. The default value is 10.
2308 @item -ftemplate-depth=@var{n}
2309 @opindex ftemplate-depth
2310 Set the maximum instantiation depth for template classes to @var{n}.
2311 A limit on the template instantiation depth is needed to detect
2312 endless recursions during template class instantiation. ANSI/ISO C++
2313 conforming programs must not rely on a maximum depth greater than 17
2314 (changed to 1024 in C++11). The default value is 900, as the compiler
2315 can run out of stack space before hitting 1024 in some situations.
2317 @item -fno-threadsafe-statics
2318 @opindex fno-threadsafe-statics
2319 Do not emit the extra code to use the routines specified in the C++
2320 ABI for thread-safe initialization of local statics. You can use this
2321 option to reduce code size slightly in code that doesn't need to be
2324 @item -fuse-cxa-atexit
2325 @opindex fuse-cxa-atexit
2326 Register destructors for objects with static storage duration with the
2327 @code{__cxa_atexit} function rather than the @code{atexit} function.
2328 This option is required for fully standards-compliant handling of static
2329 destructors, but only works if your C library supports
2330 @code{__cxa_atexit}.
2332 @item -fno-use-cxa-get-exception-ptr
2333 @opindex fno-use-cxa-get-exception-ptr
2334 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2335 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2336 if the runtime routine is not available.
2338 @item -fvisibility-inlines-hidden
2339 @opindex fvisibility-inlines-hidden
2340 This switch declares that the user does not attempt to compare
2341 pointers to inline functions or methods where the addresses of the two functions
2342 are taken in different shared objects.
2344 The effect of this is that GCC may, effectively, mark inline methods with
2345 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2346 appear in the export table of a DSO and do not require a PLT indirection
2347 when used within the DSO@. Enabling this option can have a dramatic effect
2348 on load and link times of a DSO as it massively reduces the size of the
2349 dynamic export table when the library makes heavy use of templates.
2351 The behavior of this switch is not quite the same as marking the
2352 methods as hidden directly, because it does not affect static variables
2353 local to the function or cause the compiler to deduce that
2354 the function is defined in only one shared object.
2356 You may mark a method as having a visibility explicitly to negate the
2357 effect of the switch for that method. For example, if you do want to
2358 compare pointers to a particular inline method, you might mark it as
2359 having default visibility. Marking the enclosing class with explicit
2360 visibility has no effect.
2362 Explicitly instantiated inline methods are unaffected by this option
2363 as their linkage might otherwise cross a shared library boundary.
2364 @xref{Template Instantiation}.
2366 @item -fvisibility-ms-compat
2367 @opindex fvisibility-ms-compat
2368 This flag attempts to use visibility settings to make GCC's C++
2369 linkage model compatible with that of Microsoft Visual Studio.
2371 The flag makes these changes to GCC's linkage model:
2375 It sets the default visibility to @code{hidden}, like
2376 @option{-fvisibility=hidden}.
2379 Types, but not their members, are not hidden by default.
2382 The One Definition Rule is relaxed for types without explicit
2383 visibility specifications that are defined in more than one
2384 shared object: those declarations are permitted if they are
2385 permitted when this option is not used.
2388 In new code it is better to use @option{-fvisibility=hidden} and
2389 export those classes that are intended to be externally visible.
2390 Unfortunately it is possible for code to rely, perhaps accidentally,
2391 on the Visual Studio behavior.
2393 Among the consequences of these changes are that static data members
2394 of the same type with the same name but defined in different shared
2395 objects are different, so changing one does not change the other;
2396 and that pointers to function members defined in different shared
2397 objects may not compare equal. When this flag is given, it is a
2398 violation of the ODR to define types with the same name differently.
2400 @item -fvtable-verify=@var{std|preinit|none}
2401 @opindex fvtable-verify
2402 Turn on (or off, if using @option{-fvtable-verify=none}) the security
2403 feature that verifies at runtime, for every virtual call that is made, that
2404 the vtable pointer through which the call is made is valid for the type of
2405 the object, and has not been corrupted or overwritten. If an invalid vtable
2406 pointer is detected (at runtime), an error is reported and execution of the
2407 program is immediately halted.
2409 This option causes runtime data structures to be built, at program start up,
2410 for verifying the vtable pointers. The options @code{std} and @code{preinit}
2411 control the timing of when these data structures are built. In both cases the
2412 data structures are built before execution reaches 'main'. The
2413 @option{-fvtable-verify=std} causes these data structure to be built after the
2414 shared libraries have been loaded and initialized.
2415 @option{-fvtable-verify=preinit} causes them to be built before the shared
2416 libraries have been loaded and initialized.
2418 If this option appears multiple times in the compiler line, with different
2419 values specified, 'none' will take highest priority over both 'std' and
2420 'preinit'; 'preinit' will take priority over 'std'.
2423 @opindex (fvtv-debug)
2424 Causes debug versions of the runtime functions for the vtable verification
2425 feature to be called. This assumes the @option{-fvtable-verify=std} or
2426 @option{-fvtable-verify=preinit} has been used. This flag will also cause the
2427 compiler to keep track of which vtable pointers it found for each class, and
2428 record that information in the file ``vtv_set_ptr_data.log'', in the dump
2429 file directory on the user's machine.
2431 Note: This feature APPENDS data to the log file. If you want a fresh log
2432 file, be sure to delete any existing one.
2435 @opindex fvtv-counts
2436 This is a debugging flag. When used in conjunction with
2437 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
2438 causes the compiler to keep track of the total number of virtual calls
2439 it encountered and the number of verifications it inserted. It also
2440 counts the number of calls to certain runtime library functions
2441 that it inserts. This information, for each compilation unit, is written
2442 to a file named ``vtv_count_data.log'', in the dump_file directory on
2443 the user's machine. It also counts the size of the vtable pointer sets
2444 for each class, and writes this information to ``vtv_class_set_sizes.log''
2445 in the same directory.
2447 Note: This feature APPENDS data to the log files. To get a fresh log
2448 files, be sure to delete any existing ones.
2452 Do not use weak symbol support, even if it is provided by the linker.
2453 By default, G++ uses weak symbols if they are available. This
2454 option exists only for testing, and should not be used by end-users;
2455 it results in inferior code and has no benefits. This option may
2456 be removed in a future release of G++.
2460 Do not search for header files in the standard directories specific to
2461 C++, but do still search the other standard directories. (This option
2462 is used when building the C++ library.)
2465 In addition, these optimization, warning, and code generation options
2466 have meanings only for C++ programs:
2469 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2472 When an explicit @option{-fabi-version=@var{n}} option is used, causes
2473 G++ to warn when it generates code that is probably not compatible with the
2474 vendor-neutral C++ ABI@. Since G++ now defaults to
2475 @option{-fabi-version=0}, @option{-Wabi} has no effect unless either
2476 an older ABI version is selected (with @option{-fabi-version=@var{n}})
2477 or an older compatibility version is selected (with
2478 @option{-Wabi=@var{n}} or @option{-fabi-compat-version=@var{n}}).
2480 Although an effort has been made to warn about
2481 all such cases, there are probably some cases that are not warned about,
2482 even though G++ is generating incompatible code. There may also be
2483 cases where warnings are emitted even though the code that is generated
2486 You should rewrite your code to avoid these warnings if you are
2487 concerned about the fact that code generated by G++ may not be binary
2488 compatible with code generated by other compilers.
2490 @option{-Wabi} can also be used with an explicit version number to
2491 warn about compatibility with a particular @option{-fabi-version}
2492 level, e.g. @option{-Wabi=2} to warn about changes relative to
2493 @option{-fabi-version=2}. Specifying a version number also sets
2494 @option{-fabi-compat-version=@var{n}}.
2496 The known incompatibilities in @option{-fabi-version=2} (which was the
2497 default from GCC 3.4 to 4.9) include:
2502 A template with a non-type template parameter of reference type was
2503 mangled incorrectly:
2506 template <int &> struct S @{@};
2510 This was fixed in @option{-fabi-version=3}.
2513 SIMD vector types declared using @code{__attribute ((vector_size))} were
2514 mangled in a non-standard way that does not allow for overloading of
2515 functions taking vectors of different sizes.
2517 The mangling was changed in @option{-fabi-version=4}.
2520 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2521 qualifiers, and @code{decltype} of a plain declaration was folded away.
2523 These mangling issues were fixed in @option{-fabi-version=5}.
2526 Scoped enumerators passed as arguments to a variadic function are
2527 promoted like unscoped enumerators, causing @samp{va_arg} to complain.
2528 On most targets this does not actually affect the parameter passing
2529 ABI, as there is no way to pass an argument smaller than @samp{int}.
2531 Also, the ABI changed the mangling of template argument packs,
2532 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2533 a class scope function used as a template argument.
2535 These issues were corrected in @option{-fabi-version=6}.
2538 Lambdas in default argument scope were mangled incorrectly, and the
2539 ABI changed the mangling of nullptr_t.
2541 These issues were corrected in @option{-fabi-version=7}.
2544 When mangling a function type with function-cv-qualifiers, the
2545 un-qualified function type was incorrectly treated as a substitution
2548 This was fixed in @option{-fabi-version=8}.
2551 It also warns about psABI-related changes. The known psABI changes at this
2557 For SysV/x86-64, unions with @code{long double} members are
2558 passed in memory as specified in psABI. For example:
2568 @code{union U} is always passed in memory.
2572 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2573 @opindex Wctor-dtor-privacy
2574 @opindex Wno-ctor-dtor-privacy
2575 Warn when a class seems unusable because all the constructors or
2576 destructors in that class are private, and it has neither friends nor
2577 public static member functions. Also warn if there are no non-private
2578 methods, and there's at least one private member function that isn't
2579 a constructor or destructor.
2581 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2582 @opindex Wdelete-non-virtual-dtor
2583 @opindex Wno-delete-non-virtual-dtor
2584 Warn when @samp{delete} is used to destroy an instance of a class that
2585 has virtual functions and non-virtual destructor. It is unsafe to delete
2586 an instance of a derived class through a pointer to a base class if the
2587 base class does not have a virtual destructor. This warning is enabled
2590 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2591 @opindex Wliteral-suffix
2592 @opindex Wno-literal-suffix
2593 Warn when a string or character literal is followed by a ud-suffix which does
2594 not begin with an underscore. As a conforming extension, GCC treats such
2595 suffixes as separate preprocessing tokens in order to maintain backwards
2596 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2600 #define __STDC_FORMAT_MACROS
2601 #include <inttypes.h>
2606 printf("My int64: %"PRId64"\n", i64);
2610 In this case, @code{PRId64} is treated as a separate preprocessing token.
2612 This warning is enabled by default.
2614 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2616 @opindex Wno-narrowing
2617 Warn when a narrowing conversion prohibited by C++11 occurs within
2621 int i = @{ 2.2 @}; // error: narrowing from double to int
2624 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2626 With @option{-std=c++11}, @option{-Wno-narrowing} suppresses for
2627 non-constants the diagnostic required by the standard. Note that this
2628 does not affect the meaning of well-formed code; narrowing conversions
2629 are still considered ill-formed in SFINAE context.
2631 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2633 @opindex Wno-noexcept
2634 Warn when a noexcept-expression evaluates to false because of a call
2635 to a function that does not have a non-throwing exception
2636 specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2637 the compiler to never throw an exception.
2639 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2640 @opindex Wnon-virtual-dtor
2641 @opindex Wno-non-virtual-dtor
2642 Warn when a class has virtual functions and an accessible non-virtual
2643 destructor itself or in an accessible polymorphic base class, in which
2644 case it is possible but unsafe to delete an instance of a derived
2645 class through a pointer to the class itself or base class. This
2646 warning is automatically enabled if @option{-Weffc++} is specified.
2648 @item -Wreorder @r{(C++ and Objective-C++ only)}
2650 @opindex Wno-reorder
2651 @cindex reordering, warning
2652 @cindex warning for reordering of member initializers
2653 Warn when the order of member initializers given in the code does not
2654 match the order in which they must be executed. For instance:
2660 A(): j (0), i (1) @{ @}
2665 The compiler rearranges the member initializers for @samp{i}
2666 and @samp{j} to match the declaration order of the members, emitting
2667 a warning to that effect. This warning is enabled by @option{-Wall}.
2669 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2670 @opindex fext-numeric-literals
2671 @opindex fno-ext-numeric-literals
2672 Accept imaginary, fixed-point, or machine-defined
2673 literal number suffixes as GNU extensions.
2674 When this option is turned off these suffixes are treated
2675 as C++11 user-defined literal numeric suffixes.
2676 This is on by default for all pre-C++11 dialects and all GNU dialects:
2677 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2678 @option{-std=gnu++1y}.
2679 This option is off by default
2680 for ISO C++11 onwards (@option{-std=c++11}, ...).
2683 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2686 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2689 Warn about violations of the following style guidelines from Scott Meyers'
2690 @cite{Effective C++} series of books:
2694 Define a copy constructor and an assignment operator for classes
2695 with dynamically-allocated memory.
2698 Prefer initialization to assignment in constructors.
2701 Have @code{operator=} return a reference to @code{*this}.
2704 Don't try to return a reference when you must return an object.
2707 Distinguish between prefix and postfix forms of increment and
2708 decrement operators.
2711 Never overload @code{&&}, @code{||}, or @code{,}.
2715 This option also enables @option{-Wnon-virtual-dtor}, which is also
2716 one of the effective C++ recommendations. However, the check is
2717 extended to warn about the lack of virtual destructor in accessible
2718 non-polymorphic bases classes too.
2720 When selecting this option, be aware that the standard library
2721 headers do not obey all of these guidelines; use @samp{grep -v}
2722 to filter out those warnings.
2724 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2725 @opindex Wstrict-null-sentinel
2726 @opindex Wno-strict-null-sentinel
2727 Warn about the use of an uncasted @code{NULL} as sentinel. When
2728 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2729 to @code{__null}. Although it is a null pointer constant rather than a
2730 null pointer, it is guaranteed to be of the same size as a pointer.
2731 But this use is not portable across different compilers.
2733 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2734 @opindex Wno-non-template-friend
2735 @opindex Wnon-template-friend
2736 Disable warnings when non-templatized friend functions are declared
2737 within a template. Since the advent of explicit template specification
2738 support in G++, if the name of the friend is an unqualified-id (i.e.,
2739 @samp{friend foo(int)}), the C++ language specification demands that the
2740 friend declare or define an ordinary, nontemplate function. (Section
2741 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2742 could be interpreted as a particular specialization of a templatized
2743 function. Because this non-conforming behavior is no longer the default
2744 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2745 check existing code for potential trouble spots and is on by default.
2746 This new compiler behavior can be turned off with
2747 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2748 but disables the helpful warning.
2750 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2751 @opindex Wold-style-cast
2752 @opindex Wno-old-style-cast
2753 Warn if an old-style (C-style) cast to a non-void type is used within
2754 a C++ program. The new-style casts (@samp{dynamic_cast},
2755 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2756 less vulnerable to unintended effects and much easier to search for.
2758 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2759 @opindex Woverloaded-virtual
2760 @opindex Wno-overloaded-virtual
2761 @cindex overloaded virtual function, warning
2762 @cindex warning for overloaded virtual function
2763 Warn when a function declaration hides virtual functions from a
2764 base class. For example, in:
2771 struct B: public A @{
2776 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2787 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2788 @opindex Wno-pmf-conversions
2789 @opindex Wpmf-conversions
2790 Disable the diagnostic for converting a bound pointer to member function
2793 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2794 @opindex Wsign-promo
2795 @opindex Wno-sign-promo
2796 Warn when overload resolution chooses a promotion from unsigned or
2797 enumerated type to a signed type, over a conversion to an unsigned type of
2798 the same size. Previous versions of G++ tried to preserve
2799 unsignedness, but the standard mandates the current behavior.
2802 @node Objective-C and Objective-C++ Dialect Options
2803 @section Options Controlling Objective-C and Objective-C++ Dialects
2805 @cindex compiler options, Objective-C and Objective-C++
2806 @cindex Objective-C and Objective-C++ options, command-line
2807 @cindex options, Objective-C and Objective-C++
2808 (NOTE: This manual does not describe the Objective-C and Objective-C++
2809 languages themselves. @xref{Standards,,Language Standards
2810 Supported by GCC}, for references.)
2812 This section describes the command-line options that are only meaningful
2813 for Objective-C and Objective-C++ programs. You can also use most of
2814 the language-independent GNU compiler options.
2815 For example, you might compile a file @code{some_class.m} like this:
2818 gcc -g -fgnu-runtime -O -c some_class.m
2822 In this example, @option{-fgnu-runtime} is an option meant only for
2823 Objective-C and Objective-C++ programs; you can use the other options with
2824 any language supported by GCC@.
2826 Note that since Objective-C is an extension of the C language, Objective-C
2827 compilations may also use options specific to the C front-end (e.g.,
2828 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2829 C++-specific options (e.g., @option{-Wabi}).
2831 Here is a list of options that are @emph{only} for compiling Objective-C
2832 and Objective-C++ programs:
2835 @item -fconstant-string-class=@var{class-name}
2836 @opindex fconstant-string-class
2837 Use @var{class-name} as the name of the class to instantiate for each
2838 literal string specified with the syntax @code{@@"@dots{}"}. The default
2839 class name is @code{NXConstantString} if the GNU runtime is being used, and
2840 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2841 @option{-fconstant-cfstrings} option, if also present, overrides the
2842 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2843 to be laid out as constant CoreFoundation strings.
2846 @opindex fgnu-runtime
2847 Generate object code compatible with the standard GNU Objective-C
2848 runtime. This is the default for most types of systems.
2850 @item -fnext-runtime
2851 @opindex fnext-runtime
2852 Generate output compatible with the NeXT runtime. This is the default
2853 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2854 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2857 @item -fno-nil-receivers
2858 @opindex fno-nil-receivers
2859 Assume that all Objective-C message dispatches (@code{[receiver
2860 message:arg]}) in this translation unit ensure that the receiver is
2861 not @code{nil}. This allows for more efficient entry points in the
2862 runtime to be used. This option is only available in conjunction with
2863 the NeXT runtime and ABI version 0 or 1.
2865 @item -fobjc-abi-version=@var{n}
2866 @opindex fobjc-abi-version
2867 Use version @var{n} of the Objective-C ABI for the selected runtime.
2868 This option is currently supported only for the NeXT runtime. In that
2869 case, Version 0 is the traditional (32-bit) ABI without support for
2870 properties and other Objective-C 2.0 additions. Version 1 is the
2871 traditional (32-bit) ABI with support for properties and other
2872 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2873 nothing is specified, the default is Version 0 on 32-bit target
2874 machines, and Version 2 on 64-bit target machines.
2876 @item -fobjc-call-cxx-cdtors
2877 @opindex fobjc-call-cxx-cdtors
2878 For each Objective-C class, check if any of its instance variables is a
2879 C++ object with a non-trivial default constructor. If so, synthesize a
2880 special @code{- (id) .cxx_construct} instance method which runs
2881 non-trivial default constructors on any such instance variables, in order,
2882 and then return @code{self}. Similarly, check if any instance variable
2883 is a C++ object with a non-trivial destructor, and if so, synthesize a
2884 special @code{- (void) .cxx_destruct} method which runs
2885 all such default destructors, in reverse order.
2887 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2888 methods thusly generated only operate on instance variables
2889 declared in the current Objective-C class, and not those inherited
2890 from superclasses. It is the responsibility of the Objective-C
2891 runtime to invoke all such methods in an object's inheritance
2892 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
2893 by the runtime immediately after a new object instance is allocated;
2894 the @code{- (void) .cxx_destruct} methods are invoked immediately
2895 before the runtime deallocates an object instance.
2897 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2898 support for invoking the @code{- (id) .cxx_construct} and
2899 @code{- (void) .cxx_destruct} methods.
2901 @item -fobjc-direct-dispatch
2902 @opindex fobjc-direct-dispatch
2903 Allow fast jumps to the message dispatcher. On Darwin this is
2904 accomplished via the comm page.
2906 @item -fobjc-exceptions
2907 @opindex fobjc-exceptions
2908 Enable syntactic support for structured exception handling in
2909 Objective-C, similar to what is offered by C++ and Java. This option
2910 is required to use the Objective-C keywords @code{@@try},
2911 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2912 @code{@@synchronized}. This option is available with both the GNU
2913 runtime and the NeXT runtime (but not available in conjunction with
2914 the NeXT runtime on Mac OS X 10.2 and earlier).
2918 Enable garbage collection (GC) in Objective-C and Objective-C++
2919 programs. This option is only available with the NeXT runtime; the
2920 GNU runtime has a different garbage collection implementation that
2921 does not require special compiler flags.
2923 @item -fobjc-nilcheck
2924 @opindex fobjc-nilcheck
2925 For the NeXT runtime with version 2 of the ABI, check for a nil
2926 receiver in method invocations before doing the actual method call.
2927 This is the default and can be disabled using
2928 @option{-fno-objc-nilcheck}. Class methods and super calls are never
2929 checked for nil in this way no matter what this flag is set to.
2930 Currently this flag does nothing when the GNU runtime, or an older
2931 version of the NeXT runtime ABI, is used.
2933 @item -fobjc-std=objc1
2935 Conform to the language syntax of Objective-C 1.0, the language
2936 recognized by GCC 4.0. This only affects the Objective-C additions to
2937 the C/C++ language; it does not affect conformance to C/C++ standards,
2938 which is controlled by the separate C/C++ dialect option flags. When
2939 this option is used with the Objective-C or Objective-C++ compiler,
2940 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2941 This is useful if you need to make sure that your Objective-C code can
2942 be compiled with older versions of GCC@.
2944 @item -freplace-objc-classes
2945 @opindex freplace-objc-classes
2946 Emit a special marker instructing @command{ld(1)} not to statically link in
2947 the resulting object file, and allow @command{dyld(1)} to load it in at
2948 run time instead. This is used in conjunction with the Fix-and-Continue
2949 debugging mode, where the object file in question may be recompiled and
2950 dynamically reloaded in the course of program execution, without the need
2951 to restart the program itself. Currently, Fix-and-Continue functionality
2952 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2957 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2958 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2959 compile time) with static class references that get initialized at load time,
2960 which improves run-time performance. Specifying the @option{-fzero-link} flag
2961 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2962 to be retained. This is useful in Zero-Link debugging mode, since it allows
2963 for individual class implementations to be modified during program execution.
2964 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2965 regardless of command-line options.
2967 @item -fno-local-ivars
2968 @opindex fno-local-ivars
2969 @opindex flocal-ivars
2970 By default instance variables in Objective-C can be accessed as if
2971 they were local variables from within the methods of the class they're
2972 declared in. This can lead to shadowing between instance variables
2973 and other variables declared either locally inside a class method or
2974 globally with the same name. Specifying the @option{-fno-local-ivars}
2975 flag disables this behavior thus avoiding variable shadowing issues.
2977 @item -fivar-visibility=@var{public|protected|private|package}
2978 @opindex fivar-visibility
2979 Set the default instance variable visibility to the specified option
2980 so that instance variables declared outside the scope of any access
2981 modifier directives default to the specified visibility.
2985 Dump interface declarations for all classes seen in the source file to a
2986 file named @file{@var{sourcename}.decl}.
2988 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2989 @opindex Wassign-intercept
2990 @opindex Wno-assign-intercept
2991 Warn whenever an Objective-C assignment is being intercepted by the
2994 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2995 @opindex Wno-protocol
2997 If a class is declared to implement a protocol, a warning is issued for
2998 every method in the protocol that is not implemented by the class. The
2999 default behavior is to issue a warning for every method not explicitly
3000 implemented in the class, even if a method implementation is inherited
3001 from the superclass. If you use the @option{-Wno-protocol} option, then
3002 methods inherited from the superclass are considered to be implemented,
3003 and no warning is issued for them.
3005 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3007 @opindex Wno-selector
3008 Warn if multiple methods of different types for the same selector are
3009 found during compilation. The check is performed on the list of methods
3010 in the final stage of compilation. Additionally, a check is performed
3011 for each selector appearing in a @code{@@selector(@dots{})}
3012 expression, and a corresponding method for that selector has been found
3013 during compilation. Because these checks scan the method table only at
3014 the end of compilation, these warnings are not produced if the final
3015 stage of compilation is not reached, for example because an error is
3016 found during compilation, or because the @option{-fsyntax-only} option is
3019 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3020 @opindex Wstrict-selector-match
3021 @opindex Wno-strict-selector-match
3022 Warn if multiple methods with differing argument and/or return types are
3023 found for a given selector when attempting to send a message using this
3024 selector to a receiver of type @code{id} or @code{Class}. When this flag
3025 is off (which is the default behavior), the compiler omits such warnings
3026 if any differences found are confined to types that share the same size
3029 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3030 @opindex Wundeclared-selector
3031 @opindex Wno-undeclared-selector
3032 Warn if a @code{@@selector(@dots{})} expression referring to an
3033 undeclared selector is found. A selector is considered undeclared if no
3034 method with that name has been declared before the
3035 @code{@@selector(@dots{})} expression, either explicitly in an
3036 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3037 an @code{@@implementation} section. This option always performs its
3038 checks as soon as a @code{@@selector(@dots{})} expression is found,
3039 while @option{-Wselector} only performs its checks in the final stage of
3040 compilation. This also enforces the coding style convention
3041 that methods and selectors must be declared before being used.
3043 @item -print-objc-runtime-info
3044 @opindex print-objc-runtime-info
3045 Generate C header describing the largest structure that is passed by
3050 @node Language Independent Options
3051 @section Options to Control Diagnostic Messages Formatting
3052 @cindex options to control diagnostics formatting
3053 @cindex diagnostic messages
3054 @cindex message formatting
3056 Traditionally, diagnostic messages have been formatted irrespective of
3057 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3058 options described below
3059 to control the formatting algorithm for diagnostic messages,
3060 e.g.@: how many characters per line, how often source location
3061 information should be reported. Note that some language front ends may not
3062 honor these options.
3065 @item -fmessage-length=@var{n}
3066 @opindex fmessage-length
3067 Try to format error messages so that they fit on lines of about @var{n}
3068 characters. The default is 72 characters for @command{g++} and 0 for the rest of
3069 the front ends supported by GCC@. If @var{n} is zero, then no
3070 line-wrapping is done; each error message appears on a single
3073 @item -fdiagnostics-show-location=once
3074 @opindex fdiagnostics-show-location
3075 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3076 reporter to emit source location information @emph{once}; that is, in
3077 case the message is too long to fit on a single physical line and has to
3078 be wrapped, the source location won't be emitted (as prefix) again,
3079 over and over, in subsequent continuation lines. This is the default
3082 @item -fdiagnostics-show-location=every-line
3083 Only meaningful in line-wrapping mode. Instructs the diagnostic
3084 messages reporter to emit the same source location information (as
3085 prefix) for physical lines that result from the process of breaking
3086 a message which is too long to fit on a single line.
3088 @item -fdiagnostics-color[=@var{WHEN}]
3089 @itemx -fno-diagnostics-color
3090 @opindex fdiagnostics-color
3091 @cindex highlight, color, colour
3092 @vindex GCC_COLORS @r{environment variable}
3093 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3094 or @samp{auto}. The default is @samp{never} if @env{GCC_COLORS} environment
3095 variable isn't present in the environment, and @samp{auto} otherwise.
3096 @samp{auto} means to use color only when the standard error is a terminal.
3097 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3098 aliases for @option{-fdiagnostics-color=always} and
3099 @option{-fdiagnostics-color=never}, respectively.
3101 The colors are defined by the environment variable @env{GCC_COLORS}.
3102 Its value is a colon-separated list of capabilities and Select Graphic
3103 Rendition (SGR) substrings. SGR commands are interpreted by the
3104 terminal or terminal emulator. (See the section in the documentation
3105 of your text terminal for permitted values and their meanings as
3106 character attributes.) These substring values are integers in decimal
3107 representation and can be concatenated with semicolons.
3108 Common values to concatenate include
3110 @samp{4} for underline,
3112 @samp{7} for inverse,
3113 @samp{39} for default foreground color,
3114 @samp{30} to @samp{37} for foreground colors,
3115 @samp{90} to @samp{97} for 16-color mode foreground colors,
3116 @samp{38;5;0} to @samp{38;5;255}
3117 for 88-color and 256-color modes foreground colors,
3118 @samp{49} for default background color,
3119 @samp{40} to @samp{47} for background colors,
3120 @samp{100} to @samp{107} for 16-color mode background colors,
3121 and @samp{48;5;0} to @samp{48;5;255}
3122 for 88-color and 256-color modes background colors.
3124 The default @env{GCC_COLORS} is
3125 @samp{error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01}
3126 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3127 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3128 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3129 string disables colors.
3130 Supported capabilities are as follows.
3134 @vindex error GCC_COLORS @r{capability}
3135 SGR substring for error: markers.
3138 @vindex warning GCC_COLORS @r{capability}
3139 SGR substring for warning: markers.
3142 @vindex note GCC_COLORS @r{capability}
3143 SGR substring for note: markers.
3146 @vindex caret GCC_COLORS @r{capability}
3147 SGR substring for caret line.
3150 @vindex locus GCC_COLORS @r{capability}
3151 SGR substring for location information, @samp{file:line} or
3152 @samp{file:line:column} etc.
3155 @vindex quote GCC_COLORS @r{capability}
3156 SGR substring for information printed within quotes.
3159 @item -fno-diagnostics-show-option
3160 @opindex fno-diagnostics-show-option
3161 @opindex fdiagnostics-show-option
3162 By default, each diagnostic emitted includes text indicating the
3163 command-line option that directly controls the diagnostic (if such an
3164 option is known to the diagnostic machinery). Specifying the
3165 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3167 @item -fno-diagnostics-show-caret
3168 @opindex fno-diagnostics-show-caret
3169 @opindex fdiagnostics-show-caret
3170 By default, each diagnostic emitted includes the original source line
3171 and a caret '^' indicating the column. This option suppresses this
3176 @node Warning Options
3177 @section Options to Request or Suppress Warnings
3178 @cindex options to control warnings
3179 @cindex warning messages
3180 @cindex messages, warning
3181 @cindex suppressing warnings
3183 Warnings are diagnostic messages that report constructions that
3184 are not inherently erroneous but that are risky or suggest there
3185 may have been an error.
3187 The following language-independent options do not enable specific
3188 warnings but control the kinds of diagnostics produced by GCC@.
3191 @cindex syntax checking
3193 @opindex fsyntax-only
3194 Check the code for syntax errors, but don't do anything beyond that.
3196 @item -fmax-errors=@var{n}
3197 @opindex fmax-errors
3198 Limits the maximum number of error messages to @var{n}, at which point
3199 GCC bails out rather than attempting to continue processing the source
3200 code. If @var{n} is 0 (the default), there is no limit on the number
3201 of error messages produced. If @option{-Wfatal-errors} is also
3202 specified, then @option{-Wfatal-errors} takes precedence over this
3207 Inhibit all warning messages.
3212 Make all warnings into errors.
3217 Make the specified warning into an error. The specifier for a warning
3218 is appended; for example @option{-Werror=switch} turns the warnings
3219 controlled by @option{-Wswitch} into errors. This switch takes a
3220 negative form, to be used to negate @option{-Werror} for specific
3221 warnings; for example @option{-Wno-error=switch} makes
3222 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3225 The warning message for each controllable warning includes the
3226 option that controls the warning. That option can then be used with
3227 @option{-Werror=} and @option{-Wno-error=} as described above.
3228 (Printing of the option in the warning message can be disabled using the
3229 @option{-fno-diagnostics-show-option} flag.)
3231 Note that specifying @option{-Werror=}@var{foo} automatically implies
3232 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3235 @item -Wfatal-errors
3236 @opindex Wfatal-errors
3237 @opindex Wno-fatal-errors
3238 This option causes the compiler to abort compilation on the first error
3239 occurred rather than trying to keep going and printing further error
3244 You can request many specific warnings with options beginning with
3245 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3246 implicit declarations. Each of these specific warning options also
3247 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3248 example, @option{-Wno-implicit}. This manual lists only one of the
3249 two forms, whichever is not the default. For further
3250 language-specific options also refer to @ref{C++ Dialect Options} and
3251 @ref{Objective-C and Objective-C++ Dialect Options}.
3253 When an unrecognized warning option is requested (e.g.,
3254 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3255 that the option is not recognized. However, if the @option{-Wno-} form
3256 is used, the behavior is slightly different: no diagnostic is
3257 produced for @option{-Wno-unknown-warning} unless other diagnostics
3258 are being produced. This allows the use of new @option{-Wno-} options
3259 with old compilers, but if something goes wrong, the compiler
3260 warns that an unrecognized option is present.
3267 Issue all the warnings demanded by strict ISO C and ISO C++;
3268 reject all programs that use forbidden extensions, and some other
3269 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3270 version of the ISO C standard specified by any @option{-std} option used.
3272 Valid ISO C and ISO C++ programs should compile properly with or without
3273 this option (though a rare few require @option{-ansi} or a
3274 @option{-std} option specifying the required version of ISO C)@. However,
3275 without this option, certain GNU extensions and traditional C and C++
3276 features are supported as well. With this option, they are rejected.
3278 @option{-Wpedantic} does not cause warning messages for use of the
3279 alternate keywords whose names begin and end with @samp{__}. Pedantic
3280 warnings are also disabled in the expression that follows
3281 @code{__extension__}. However, only system header files should use
3282 these escape routes; application programs should avoid them.
3283 @xref{Alternate Keywords}.
3285 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3286 C conformance. They soon find that it does not do quite what they want:
3287 it finds some non-ISO practices, but not all---only those for which
3288 ISO C @emph{requires} a diagnostic, and some others for which
3289 diagnostics have been added.
3291 A feature to report any failure to conform to ISO C might be useful in
3292 some instances, but would require considerable additional work and would
3293 be quite different from @option{-Wpedantic}. We don't have plans to
3294 support such a feature in the near future.
3296 Where the standard specified with @option{-std} represents a GNU
3297 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3298 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3299 extended dialect is based. Warnings from @option{-Wpedantic} are given
3300 where they are required by the base standard. (It does not make sense
3301 for such warnings to be given only for features not in the specified GNU
3302 C dialect, since by definition the GNU dialects of C include all
3303 features the compiler supports with the given option, and there would be
3304 nothing to warn about.)
3306 @item -pedantic-errors
3307 @opindex pedantic-errors
3308 Like @option{-Wpedantic}, except that errors are produced rather than
3314 This enables all the warnings about constructions that some users
3315 consider questionable, and that are easy to avoid (or modify to
3316 prevent the warning), even in conjunction with macros. This also
3317 enables some language-specific warnings described in @ref{C++ Dialect
3318 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3320 @option{-Wall} turns on the following warning flags:
3322 @gccoptlist{-Waddress @gol
3323 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
3325 -Wchar-subscripts @gol
3326 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3327 -Wimplicit-int @r{(C and Objective-C only)} @gol
3328 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3331 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3332 -Wmaybe-uninitialized @gol
3333 -Wmissing-braces @r{(only for C/ObjC)} @gol
3340 -Wsequence-point @gol
3341 -Wsign-compare @r{(only in C++)} @gol
3342 -Wstrict-aliasing @gol
3343 -Wstrict-overflow=1 @gol
3346 -Wuninitialized @gol
3347 -Wunknown-pragmas @gol
3348 -Wunused-function @gol
3351 -Wunused-variable @gol
3352 -Wvolatile-register-var @gol
3355 Note that some warning flags are not implied by @option{-Wall}. Some of
3356 them warn about constructions that users generally do not consider
3357 questionable, but which occasionally you might wish to check for;
3358 others warn about constructions that are necessary or hard to avoid in
3359 some cases, and there is no simple way to modify the code to suppress
3360 the warning. Some of them are enabled by @option{-Wextra} but many of
3361 them must be enabled individually.
3367 This enables some extra warning flags that are not enabled by
3368 @option{-Wall}. (This option used to be called @option{-W}. The older
3369 name is still supported, but the newer name is more descriptive.)
3371 @gccoptlist{-Wclobbered @gol
3373 -Wignored-qualifiers @gol
3374 -Wmissing-field-initializers @gol
3375 -Wmissing-parameter-type @r{(C only)} @gol
3376 -Wold-style-declaration @r{(C only)} @gol
3377 -Woverride-init @gol
3380 -Wuninitialized @gol
3381 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3382 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3385 The option @option{-Wextra} also prints warning messages for the
3391 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3392 @samp{>}, or @samp{>=}.
3395 (C++ only) An enumerator and a non-enumerator both appear in a
3396 conditional expression.
3399 (C++ only) Ambiguous virtual bases.
3402 (C++ only) Subscripting an array that has been declared @samp{register}.
3405 (C++ only) Taking the address of a variable that has been declared
3409 (C++ only) A base class is not initialized in a derived class's copy
3414 @item -Wchar-subscripts
3415 @opindex Wchar-subscripts
3416 @opindex Wno-char-subscripts
3417 Warn if an array subscript has type @code{char}. This is a common cause
3418 of error, as programmers often forget that this type is signed on some
3420 This warning is enabled by @option{-Wall}.
3424 @opindex Wno-comment
3425 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3426 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3427 This warning is enabled by @option{-Wall}.
3429 @item -Wno-coverage-mismatch
3430 @opindex Wno-coverage-mismatch
3431 Warn if feedback profiles do not match when using the
3432 @option{-fprofile-use} option.
3433 If a source file is changed between compiling with @option{-fprofile-gen} and
3434 with @option{-fprofile-use}, the files with the profile feedback can fail
3435 to match the source file and GCC cannot use the profile feedback
3436 information. By default, this warning is enabled and is treated as an
3437 error. @option{-Wno-coverage-mismatch} can be used to disable the
3438 warning or @option{-Wno-error=coverage-mismatch} can be used to
3439 disable the error. Disabling the error for this warning can result in
3440 poorly optimized code and is useful only in the
3441 case of very minor changes such as bug fixes to an existing code-base.
3442 Completely disabling the warning is not recommended.
3445 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3447 Suppress warning messages emitted by @code{#warning} directives.
3449 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3450 @opindex Wdouble-promotion
3451 @opindex Wno-double-promotion
3452 Give a warning when a value of type @code{float} is implicitly
3453 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3454 floating-point unit implement @code{float} in hardware, but emulate
3455 @code{double} in software. On such a machine, doing computations
3456 using @code{double} values is much more expensive because of the
3457 overhead required for software emulation.
3459 It is easy to accidentally do computations with @code{double} because
3460 floating-point literals are implicitly of type @code{double}. For
3464 float area(float radius)
3466 return 3.14159 * radius * radius;
3470 the compiler performs the entire computation with @code{double}
3471 because the floating-point literal is a @code{double}.
3474 @itemx -Wformat=@var{n}
3477 @opindex ffreestanding
3478 @opindex fno-builtin
3480 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3481 the arguments supplied have types appropriate to the format string
3482 specified, and that the conversions specified in the format string make
3483 sense. This includes standard functions, and others specified by format
3484 attributes (@pxref{Function Attributes}), in the @code{printf},
3485 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3486 not in the C standard) families (or other target-specific families).
3487 Which functions are checked without format attributes having been
3488 specified depends on the standard version selected, and such checks of
3489 functions without the attribute specified are disabled by
3490 @option{-ffreestanding} or @option{-fno-builtin}.
3492 The formats are checked against the format features supported by GNU
3493 libc version 2.2. These include all ISO C90 and C99 features, as well
3494 as features from the Single Unix Specification and some BSD and GNU
3495 extensions. Other library implementations may not support all these
3496 features; GCC does not support warning about features that go beyond a
3497 particular library's limitations. However, if @option{-Wpedantic} is used
3498 with @option{-Wformat}, warnings are given about format features not
3499 in the selected standard version (but not for @code{strfmon} formats,
3500 since those are not in any version of the C standard). @xref{C Dialect
3501 Options,,Options Controlling C Dialect}.
3508 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3509 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3510 @option{-Wformat} also checks for null format arguments for several
3511 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3512 aspects of this level of format checking can be disabled by the
3513 options: @option{-Wno-format-contains-nul},
3514 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3515 @option{-Wformat} is enabled by @option{-Wall}.
3517 @item -Wno-format-contains-nul
3518 @opindex Wno-format-contains-nul
3519 @opindex Wformat-contains-nul
3520 If @option{-Wformat} is specified, do not warn about format strings that
3523 @item -Wno-format-extra-args
3524 @opindex Wno-format-extra-args
3525 @opindex Wformat-extra-args
3526 If @option{-Wformat} is specified, do not warn about excess arguments to a
3527 @code{printf} or @code{scanf} format function. The C standard specifies
3528 that such arguments are ignored.
3530 Where the unused arguments lie between used arguments that are
3531 specified with @samp{$} operand number specifications, normally
3532 warnings are still given, since the implementation could not know what
3533 type to pass to @code{va_arg} to skip the unused arguments. However,
3534 in the case of @code{scanf} formats, this option suppresses the
3535 warning if the unused arguments are all pointers, since the Single
3536 Unix Specification says that such unused arguments are allowed.
3538 @item -Wno-format-zero-length
3539 @opindex Wno-format-zero-length
3540 @opindex Wformat-zero-length
3541 If @option{-Wformat} is specified, do not warn about zero-length formats.
3542 The C standard specifies that zero-length formats are allowed.
3547 Enable @option{-Wformat} plus additional format checks. Currently
3548 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3549 -Wformat-signedness -Wformat-y2k}.
3551 @item -Wformat-nonliteral
3552 @opindex Wformat-nonliteral
3553 @opindex Wno-format-nonliteral
3554 If @option{-Wformat} is specified, also warn if the format string is not a
3555 string literal and so cannot be checked, unless the format function
3556 takes its format arguments as a @code{va_list}.
3558 @item -Wformat-security
3559 @opindex Wformat-security
3560 @opindex Wno-format-security
3561 If @option{-Wformat} is specified, also warn about uses of format
3562 functions that represent possible security problems. At present, this
3563 warns about calls to @code{printf} and @code{scanf} functions where the
3564 format string is not a string literal and there are no format arguments,
3565 as in @code{printf (foo);}. This may be a security hole if the format
3566 string came from untrusted input and contains @samp{%n}. (This is
3567 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3568 in future warnings may be added to @option{-Wformat-security} that are not
3569 included in @option{-Wformat-nonliteral}.)
3571 @item -Wformat-signedness
3572 @opindex Wformat-signedness
3573 @opindex Wno-format-signedness
3574 If @option{-Wformat} is specified, also warn if the format string
3575 requires an unsigned argument and the argument is signed and vice versa.
3578 @opindex Wformat-y2k
3579 @opindex Wno-format-y2k
3580 If @option{-Wformat} is specified, also warn about @code{strftime}
3581 formats that may yield only a two-digit year.
3586 @opindex Wno-nonnull
3587 Warn about passing a null pointer for arguments marked as
3588 requiring a non-null value by the @code{nonnull} function attribute.
3590 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3591 can be disabled with the @option{-Wno-nonnull} option.
3593 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3595 @opindex Wno-init-self
3596 Warn about uninitialized variables that are initialized with themselves.
3597 Note this option can only be used with the @option{-Wuninitialized} option.
3599 For example, GCC warns about @code{i} being uninitialized in the
3600 following snippet only when @option{-Winit-self} has been specified:
3611 This warning is enabled by @option{-Wall} in C++.
3613 @item -Wimplicit-int @r{(C and Objective-C only)}
3614 @opindex Wimplicit-int
3615 @opindex Wno-implicit-int
3616 Warn when a declaration does not specify a type.
3617 This warning is enabled by @option{-Wall}.
3619 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3620 @opindex Wimplicit-function-declaration
3621 @opindex Wno-implicit-function-declaration
3622 Give a warning whenever a function is used before being declared. In
3623 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3624 enabled by default and it is made into an error by
3625 @option{-pedantic-errors}. This warning is also enabled by
3628 @item -Wimplicit @r{(C and Objective-C only)}
3630 @opindex Wno-implicit
3631 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3632 This warning is enabled by @option{-Wall}.
3634 @item -Wignored-qualifiers @r{(C and C++ only)}
3635 @opindex Wignored-qualifiers
3636 @opindex Wno-ignored-qualifiers
3637 Warn if the return type of a function has a type qualifier
3638 such as @code{const}. For ISO C such a type qualifier has no effect,
3639 since the value returned by a function is not an lvalue.
3640 For C++, the warning is only emitted for scalar types or @code{void}.
3641 ISO C prohibits qualified @code{void} return types on function
3642 definitions, so such return types always receive a warning
3643 even without this option.
3645 This warning is also enabled by @option{-Wextra}.
3650 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3651 a function with external linkage, returning int, taking either zero
3652 arguments, two, or three arguments of appropriate types. This warning
3653 is enabled by default in C++ and is enabled by either @option{-Wall}
3654 or @option{-Wpedantic}.
3656 @item -Wmissing-braces
3657 @opindex Wmissing-braces
3658 @opindex Wno-missing-braces
3659 Warn if an aggregate or union initializer is not fully bracketed. In
3660 the following example, the initializer for @samp{a} is not fully
3661 bracketed, but that for @samp{b} is fully bracketed. This warning is
3662 enabled by @option{-Wall} in C.
3665 int a[2][2] = @{ 0, 1, 2, 3 @};
3666 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3669 This warning is enabled by @option{-Wall}.
3671 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3672 @opindex Wmissing-include-dirs
3673 @opindex Wno-missing-include-dirs
3674 Warn if a user-supplied include directory does not exist.
3677 @opindex Wparentheses
3678 @opindex Wno-parentheses
3679 Warn if parentheses are omitted in certain contexts, such
3680 as when there is an assignment in a context where a truth value
3681 is expected, or when operators are nested whose precedence people
3682 often get confused about.
3684 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3685 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3686 interpretation from that of ordinary mathematical notation.
3688 Also warn about constructions where there may be confusion to which
3689 @code{if} statement an @code{else} branch belongs. Here is an example of
3704 In C/C++, every @code{else} branch belongs to the innermost possible
3705 @code{if} statement, which in this example is @code{if (b)}. This is
3706 often not what the programmer expected, as illustrated in the above
3707 example by indentation the programmer chose. When there is the
3708 potential for this confusion, GCC issues a warning when this flag
3709 is specified. To eliminate the warning, add explicit braces around
3710 the innermost @code{if} statement so there is no way the @code{else}
3711 can belong to the enclosing @code{if}. The resulting code
3728 Also warn for dangerous uses of the GNU extension to
3729 @code{?:} with omitted middle operand. When the condition
3730 in the @code{?}: operator is a boolean expression, the omitted value is
3731 always 1. Often programmers expect it to be a value computed
3732 inside the conditional expression instead.
3734 This warning is enabled by @option{-Wall}.
3736 @item -Wsequence-point
3737 @opindex Wsequence-point
3738 @opindex Wno-sequence-point
3739 Warn about code that may have undefined semantics because of violations
3740 of sequence point rules in the C and C++ standards.
3742 The C and C++ standards define the order in which expressions in a C/C++
3743 program are evaluated in terms of @dfn{sequence points}, which represent
3744 a partial ordering between the execution of parts of the program: those
3745 executed before the sequence point, and those executed after it. These
3746 occur after the evaluation of a full expression (one which is not part
3747 of a larger expression), after the evaluation of the first operand of a
3748 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3749 function is called (but after the evaluation of its arguments and the
3750 expression denoting the called function), and in certain other places.
3751 Other than as expressed by the sequence point rules, the order of
3752 evaluation of subexpressions of an expression is not specified. All
3753 these rules describe only a partial order rather than a total order,
3754 since, for example, if two functions are called within one expression
3755 with no sequence point between them, the order in which the functions
3756 are called is not specified. However, the standards committee have
3757 ruled that function calls do not overlap.
3759 It is not specified when between sequence points modifications to the
3760 values of objects take effect. Programs whose behavior depends on this
3761 have undefined behavior; the C and C++ standards specify that ``Between
3762 the previous and next sequence point an object shall have its stored
3763 value modified at most once by the evaluation of an expression.
3764 Furthermore, the prior value shall be read only to determine the value
3765 to be stored.''. If a program breaks these rules, the results on any
3766 particular implementation are entirely unpredictable.
3768 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3769 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3770 diagnosed by this option, and it may give an occasional false positive
3771 result, but in general it has been found fairly effective at detecting
3772 this sort of problem in programs.
3774 The standard is worded confusingly, therefore there is some debate
3775 over the precise meaning of the sequence point rules in subtle cases.
3776 Links to discussions of the problem, including proposed formal
3777 definitions, may be found on the GCC readings page, at
3778 @uref{http://gcc.gnu.org/@/readings.html}.
3780 This warning is enabled by @option{-Wall} for C and C++.
3782 @item -Wno-return-local-addr
3783 @opindex Wno-return-local-addr
3784 @opindex Wreturn-local-addr
3785 Do not warn about returning a pointer (or in C++, a reference) to a
3786 variable that goes out of scope after the function returns.
3789 @opindex Wreturn-type
3790 @opindex Wno-return-type
3791 Warn whenever a function is defined with a return type that defaults
3792 to @code{int}. Also warn about any @code{return} statement with no
3793 return value in a function whose return type is not @code{void}
3794 (falling off the end of the function body is considered returning
3795 without a value), and about a @code{return} statement with an
3796 expression in a function whose return type is @code{void}.
3798 For C++, a function without return type always produces a diagnostic
3799 message, even when @option{-Wno-return-type} is specified. The only
3800 exceptions are @samp{main} and functions defined in system headers.
3802 This warning is enabled by @option{-Wall}.
3807 Warn whenever a @code{switch} statement has an index of enumerated type
3808 and lacks a @code{case} for one or more of the named codes of that
3809 enumeration. (The presence of a @code{default} label prevents this
3810 warning.) @code{case} labels outside the enumeration range also
3811 provoke warnings when this option is used (even if there is a
3812 @code{default} label).
3813 This warning is enabled by @option{-Wall}.
3815 @item -Wswitch-default
3816 @opindex Wswitch-default
3817 @opindex Wno-switch-default
3818 Warn whenever a @code{switch} statement does not have a @code{default}
3822 @opindex Wswitch-enum
3823 @opindex Wno-switch-enum
3824 Warn whenever a @code{switch} statement has an index of enumerated type
3825 and lacks a @code{case} for one or more of the named codes of that
3826 enumeration. @code{case} labels outside the enumeration range also
3827 provoke warnings when this option is used. The only difference
3828 between @option{-Wswitch} and this option is that this option gives a
3829 warning about an omitted enumeration code even if there is a
3830 @code{default} label.
3833 @opindex Wswitch-bool
3834 @opindex Wno-switch-bool
3835 Warn whenever a @code{switch} statement has an index of boolean type.
3836 It is possible to suppress this warning by casting the controlling
3837 expression to a type other than @code{bool}. For example:
3840 switch ((int) (a == 4))
3846 This warning is enabled by default for C and C++ programs.
3848 @item -Wsync-nand @r{(C and C++ only)}
3850 @opindex Wno-sync-nand
3851 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3852 built-in functions are used. These functions changed semantics in GCC 4.4.
3856 @opindex Wno-trigraphs
3857 Warn if any trigraphs are encountered that might change the meaning of
3858 the program (trigraphs within comments are not warned about).
3859 This warning is enabled by @option{-Wall}.
3861 @item -Wunused-but-set-parameter
3862 @opindex Wunused-but-set-parameter
3863 @opindex Wno-unused-but-set-parameter
3864 Warn whenever a function parameter is assigned to, but otherwise unused
3865 (aside from its declaration).
3867 To suppress this warning use the @samp{unused} attribute
3868 (@pxref{Variable Attributes}).
3870 This warning is also enabled by @option{-Wunused} together with
3873 @item -Wunused-but-set-variable
3874 @opindex Wunused-but-set-variable
3875 @opindex Wno-unused-but-set-variable
3876 Warn whenever a local variable is assigned to, but otherwise unused
3877 (aside from its declaration).
3878 This warning is enabled by @option{-Wall}.
3880 To suppress this warning use the @samp{unused} attribute
3881 (@pxref{Variable Attributes}).
3883 This warning is also enabled by @option{-Wunused}, which is enabled
3886 @item -Wunused-function
3887 @opindex Wunused-function
3888 @opindex Wno-unused-function
3889 Warn whenever a static function is declared but not defined or a
3890 non-inline static function is unused.
3891 This warning is enabled by @option{-Wall}.
3893 @item -Wunused-label
3894 @opindex Wunused-label
3895 @opindex Wno-unused-label
3896 Warn whenever a label is declared but not used.
3897 This warning is enabled by @option{-Wall}.
3899 To suppress this warning use the @samp{unused} attribute
3900 (@pxref{Variable Attributes}).
3902 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
3903 @opindex Wunused-local-typedefs
3904 Warn when a typedef locally defined in a function is not used.
3905 This warning is enabled by @option{-Wall}.
3907 @item -Wunused-parameter
3908 @opindex Wunused-parameter
3909 @opindex Wno-unused-parameter
3910 Warn whenever a function parameter is unused aside from its declaration.
3912 To suppress this warning use the @samp{unused} attribute
3913 (@pxref{Variable Attributes}).
3915 @item -Wno-unused-result
3916 @opindex Wunused-result
3917 @opindex Wno-unused-result
3918 Do not warn if a caller of a function marked with attribute
3919 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
3920 its return value. The default is @option{-Wunused-result}.
3922 @item -Wunused-variable
3923 @opindex Wunused-variable
3924 @opindex Wno-unused-variable
3925 Warn whenever a local variable or non-constant static variable is unused
3926 aside from its declaration.
3927 This warning is enabled by @option{-Wall}.
3929 To suppress this warning use the @samp{unused} attribute
3930 (@pxref{Variable Attributes}).
3932 @item -Wunused-value
3933 @opindex Wunused-value
3934 @opindex Wno-unused-value
3935 Warn whenever a statement computes a result that is explicitly not
3936 used. To suppress this warning cast the unused expression to
3937 @samp{void}. This includes an expression-statement or the left-hand
3938 side of a comma expression that contains no side effects. For example,
3939 an expression such as @samp{x[i,j]} causes a warning, while
3940 @samp{x[(void)i,j]} does not.
3942 This warning is enabled by @option{-Wall}.
3947 All the above @option{-Wunused} options combined.
3949 In order to get a warning about an unused function parameter, you must
3950 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
3951 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
3953 @item -Wuninitialized
3954 @opindex Wuninitialized
3955 @opindex Wno-uninitialized
3956 Warn if an automatic variable is used without first being initialized
3957 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3958 warn if a non-static reference or non-static @samp{const} member
3959 appears in a class without constructors.
3961 If you want to warn about code that uses the uninitialized value of the
3962 variable in its own initializer, use the @option{-Winit-self} option.
3964 These warnings occur for individual uninitialized or clobbered
3965 elements of structure, union or array variables as well as for
3966 variables that are uninitialized or clobbered as a whole. They do
3967 not occur for variables or elements declared @code{volatile}. Because
3968 these warnings depend on optimization, the exact variables or elements
3969 for which there are warnings depends on the precise optimization
3970 options and version of GCC used.
3972 Note that there may be no warning about a variable that is used only
3973 to compute a value that itself is never used, because such
3974 computations may be deleted by data flow analysis before the warnings
3977 @item -Wmaybe-uninitialized
3978 @opindex Wmaybe-uninitialized
3979 @opindex Wno-maybe-uninitialized
3980 For an automatic variable, if there exists a path from the function
3981 entry to a use of the variable that is initialized, but there exist
3982 some other paths for which the variable is not initialized, the compiler
3983 emits a warning if it cannot prove the uninitialized paths are not
3984 executed at run time. These warnings are made optional because GCC is
3985 not smart enough to see all the reasons why the code might be correct
3986 in spite of appearing to have an error. Here is one example of how
4007 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4008 always initialized, but GCC doesn't know this. To suppress the
4009 warning, you need to provide a default case with assert(0) or
4012 @cindex @code{longjmp} warnings
4013 This option also warns when a non-volatile automatic variable might be
4014 changed by a call to @code{longjmp}. These warnings as well are possible
4015 only in optimizing compilation.
4017 The compiler sees only the calls to @code{setjmp}. It cannot know
4018 where @code{longjmp} will be called; in fact, a signal handler could
4019 call it at any point in the code. As a result, you may get a warning
4020 even when there is in fact no problem because @code{longjmp} cannot
4021 in fact be called at the place that would cause a problem.
4023 Some spurious warnings can be avoided if you declare all the functions
4024 you use that never return as @code{noreturn}. @xref{Function
4027 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4029 @item -Wunknown-pragmas
4030 @opindex Wunknown-pragmas
4031 @opindex Wno-unknown-pragmas
4032 @cindex warning for unknown pragmas
4033 @cindex unknown pragmas, warning
4034 @cindex pragmas, warning of unknown
4035 Warn when a @code{#pragma} directive is encountered that is not understood by
4036 GCC@. If this command-line option is used, warnings are even issued
4037 for unknown pragmas in system header files. This is not the case if
4038 the warnings are only enabled by the @option{-Wall} command-line option.
4041 @opindex Wno-pragmas
4043 Do not warn about misuses of pragmas, such as incorrect parameters,
4044 invalid syntax, or conflicts between pragmas. See also
4045 @option{-Wunknown-pragmas}.
4047 @item -Wstrict-aliasing
4048 @opindex Wstrict-aliasing
4049 @opindex Wno-strict-aliasing
4050 This option is only active when @option{-fstrict-aliasing} is active.
4051 It warns about code that might break the strict aliasing rules that the
4052 compiler is using for optimization. The warning does not catch all
4053 cases, but does attempt to catch the more common pitfalls. It is
4054 included in @option{-Wall}.
4055 It is equivalent to @option{-Wstrict-aliasing=3}
4057 @item -Wstrict-aliasing=n
4058 @opindex Wstrict-aliasing=n
4059 This option is only active when @option{-fstrict-aliasing} is active.
4060 It warns about code that might break the strict aliasing rules that the
4061 compiler is using for optimization.
4062 Higher levels correspond to higher accuracy (fewer false positives).
4063 Higher levels also correspond to more effort, similar to the way @option{-O}
4065 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4067 Level 1: Most aggressive, quick, least accurate.
4068 Possibly useful when higher levels
4069 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4070 false negatives. However, it has many false positives.
4071 Warns for all pointer conversions between possibly incompatible types,
4072 even if never dereferenced. Runs in the front end only.
4074 Level 2: Aggressive, quick, not too precise.
4075 May still have many false positives (not as many as level 1 though),
4076 and few false negatives (but possibly more than level 1).
4077 Unlike level 1, it only warns when an address is taken. Warns about
4078 incomplete types. Runs in the front end only.
4080 Level 3 (default for @option{-Wstrict-aliasing}):
4081 Should have very few false positives and few false
4082 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4083 Takes care of the common pun+dereference pattern in the front end:
4084 @code{*(int*)&some_float}.
4085 If optimization is enabled, it also runs in the back end, where it deals
4086 with multiple statement cases using flow-sensitive points-to information.
4087 Only warns when the converted pointer is dereferenced.
4088 Does not warn about incomplete types.
4090 @item -Wstrict-overflow
4091 @itemx -Wstrict-overflow=@var{n}
4092 @opindex Wstrict-overflow
4093 @opindex Wno-strict-overflow
4094 This option is only active when @option{-fstrict-overflow} is active.
4095 It warns about cases where the compiler optimizes based on the
4096 assumption that signed overflow does not occur. Note that it does not
4097 warn about all cases where the code might overflow: it only warns
4098 about cases where the compiler implements some optimization. Thus
4099 this warning depends on the optimization level.
4101 An optimization that assumes that signed overflow does not occur is
4102 perfectly safe if the values of the variables involved are such that
4103 overflow never does, in fact, occur. Therefore this warning can
4104 easily give a false positive: a warning about code that is not
4105 actually a problem. To help focus on important issues, several
4106 warning levels are defined. No warnings are issued for the use of
4107 undefined signed overflow when estimating how many iterations a loop
4108 requires, in particular when determining whether a loop will be
4112 @item -Wstrict-overflow=1
4113 Warn about cases that are both questionable and easy to avoid. For
4114 example, with @option{-fstrict-overflow}, the compiler simplifies
4115 @code{x + 1 > x} to @code{1}. This level of
4116 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4117 are not, and must be explicitly requested.
4119 @item -Wstrict-overflow=2
4120 Also warn about other cases where a comparison is simplified to a
4121 constant. For example: @code{abs (x) >= 0}. This can only be
4122 simplified when @option{-fstrict-overflow} is in effect, because
4123 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4124 zero. @option{-Wstrict-overflow} (with no level) is the same as
4125 @option{-Wstrict-overflow=2}.
4127 @item -Wstrict-overflow=3
4128 Also warn about other cases where a comparison is simplified. For
4129 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4131 @item -Wstrict-overflow=4
4132 Also warn about other simplifications not covered by the above cases.
4133 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4135 @item -Wstrict-overflow=5
4136 Also warn about cases where the compiler reduces the magnitude of a
4137 constant involved in a comparison. For example: @code{x + 2 > y} is
4138 simplified to @code{x + 1 >= y}. This is reported only at the
4139 highest warning level because this simplification applies to many
4140 comparisons, so this warning level gives a very large number of
4144 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4145 @opindex Wsuggest-attribute=
4146 @opindex Wno-suggest-attribute=
4147 Warn for cases where adding an attribute may be beneficial. The
4148 attributes currently supported are listed below.
4151 @item -Wsuggest-attribute=pure
4152 @itemx -Wsuggest-attribute=const
4153 @itemx -Wsuggest-attribute=noreturn
4154 @opindex Wsuggest-attribute=pure
4155 @opindex Wno-suggest-attribute=pure
4156 @opindex Wsuggest-attribute=const
4157 @opindex Wno-suggest-attribute=const
4158 @opindex Wsuggest-attribute=noreturn
4159 @opindex Wno-suggest-attribute=noreturn
4161 Warn about functions that might be candidates for attributes
4162 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4163 functions visible in other compilation units or (in the case of @code{pure} and
4164 @code{const}) if it cannot prove that the function returns normally. A function
4165 returns normally if it doesn't contain an infinite loop or return abnormally
4166 by throwing, calling @code{abort()} or trapping. This analysis requires option
4167 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4168 higher. Higher optimization levels improve the accuracy of the analysis.
4170 @item -Wsuggest-attribute=format
4171 @itemx -Wmissing-format-attribute
4172 @opindex Wsuggest-attribute=format
4173 @opindex Wmissing-format-attribute
4174 @opindex Wno-suggest-attribute=format
4175 @opindex Wno-missing-format-attribute
4179 Warn about function pointers that might be candidates for @code{format}
4180 attributes. Note these are only possible candidates, not absolute ones.
4181 GCC guesses that function pointers with @code{format} attributes that
4182 are used in assignment, initialization, parameter passing or return
4183 statements should have a corresponding @code{format} attribute in the
4184 resulting type. I.e.@: the left-hand side of the assignment or
4185 initialization, the type of the parameter variable, or the return type
4186 of the containing function respectively should also have a @code{format}
4187 attribute to avoid the warning.
4189 GCC also warns about function definitions that might be
4190 candidates for @code{format} attributes. Again, these are only
4191 possible candidates. GCC guesses that @code{format} attributes
4192 might be appropriate for any function that calls a function like
4193 @code{vprintf} or @code{vscanf}, but this might not always be the
4194 case, and some functions for which @code{format} attributes are
4195 appropriate may not be detected.
4198 @item -Wsuggest-final-types
4199 @opindex Wno-suggest-final-types
4200 @opindex Wsuggest-final-types
4201 Warn about types with virtual methods where code quality would be improved
4202 if the type was declared with C++11 final specifier, or, if possible,
4203 declared in anonymous namespace. This allows GCC to devritualize more aggressively
4204 the polymorphic calls. This warning is more effective with link time optimization,
4205 where the information about the class hiearchy graph is more complete.
4207 @item -Wsuggest-final-methods
4208 @opindex Wno-suggest-final-methods
4209 @opindex Wsuggest-final-methods
4210 Warn about virtual methods where code quality would be improved if the method
4211 was declared with C++11 final specifier, or, if possible, its type was declared
4212 in the anonymous namespace or with final specifier. This warning is more
4213 effective with link time optimization, where the information about the class
4214 hiearchy graph is more complete. It is recommended to first consider suggestins
4215 of @option{-Wsuggest-final-types} and then rebuild with new annotations.
4217 @item -Warray-bounds
4218 @opindex Wno-array-bounds
4219 @opindex Warray-bounds
4220 This option is only active when @option{-ftree-vrp} is active
4221 (default for @option{-O2} and above). It warns about subscripts to arrays
4222 that are always out of bounds. This warning is enabled by @option{-Wall}.
4224 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4225 @opindex Wno-discarded-qualifiers
4226 @opindex Wdiscarded-qualifiers
4227 Do not warn if type qualifiers on pointers are being discarded.
4228 Typically, the compiler will warn if a @code{const char *} variable is
4229 passed to a function that takes @code{char *} parameter. This option
4230 can be used to suppress such a warning.
4232 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4233 @opindex Wno-incompatible-pointer-types
4234 @opindex Wincompatible-pointer-types
4235 Do not warn when there is a conversion between pointers that have incompatible
4236 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4237 which warns for pointer argument passing or assignment with different signedness
4239 @item -Wno-int-conversion @r{(C and Objective-C only)}
4240 @opindex Wno-int-conversion
4241 @opindex Wint-conversion
4242 Do not warn about incompatible integer to pointer and pointer to integer
4243 conversions. This warning is about implicit conversions; for explicit
4244 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4245 @option{-Wno-pointer-to-int-cast} may be used.
4247 @item -Wno-div-by-zero
4248 @opindex Wno-div-by-zero
4249 @opindex Wdiv-by-zero
4250 Do not warn about compile-time integer division by zero. Floating-point
4251 division by zero is not warned about, as it can be a legitimate way of
4252 obtaining infinities and NaNs.
4254 @item -Wsystem-headers
4255 @opindex Wsystem-headers
4256 @opindex Wno-system-headers
4257 @cindex warnings from system headers
4258 @cindex system headers, warnings from
4259 Print warning messages for constructs found in system header files.
4260 Warnings from system headers are normally suppressed, on the assumption
4261 that they usually do not indicate real problems and would only make the
4262 compiler output harder to read. Using this command-line option tells
4263 GCC to emit warnings from system headers as if they occurred in user
4264 code. However, note that using @option{-Wall} in conjunction with this
4265 option does @emph{not} warn about unknown pragmas in system
4266 headers---for that, @option{-Wunknown-pragmas} must also be used.
4269 @opindex Wtrampolines
4270 @opindex Wno-trampolines
4271 Warn about trampolines generated for pointers to nested functions.
4273 A trampoline is a small piece of data or code that is created at run
4274 time on the stack when the address of a nested function is taken, and
4275 is used to call the nested function indirectly. For some targets, it
4276 is made up of data only and thus requires no special treatment. But,
4277 for most targets, it is made up of code and thus requires the stack
4278 to be made executable in order for the program to work properly.
4281 @opindex Wfloat-equal
4282 @opindex Wno-float-equal
4283 Warn if floating-point values are used in equality comparisons.
4285 The idea behind this is that sometimes it is convenient (for the
4286 programmer) to consider floating-point values as approximations to
4287 infinitely precise real numbers. If you are doing this, then you need
4288 to compute (by analyzing the code, or in some other way) the maximum or
4289 likely maximum error that the computation introduces, and allow for it
4290 when performing comparisons (and when producing output, but that's a
4291 different problem). In particular, instead of testing for equality, you
4292 should check to see whether the two values have ranges that overlap; and
4293 this is done with the relational operators, so equality comparisons are
4296 @item -Wtraditional @r{(C and Objective-C only)}
4297 @opindex Wtraditional
4298 @opindex Wno-traditional
4299 Warn about certain constructs that behave differently in traditional and
4300 ISO C@. Also warn about ISO C constructs that have no traditional C
4301 equivalent, and/or problematic constructs that should be avoided.
4305 Macro parameters that appear within string literals in the macro body.
4306 In traditional C macro replacement takes place within string literals,
4307 but in ISO C it does not.
4310 In traditional C, some preprocessor directives did not exist.
4311 Traditional preprocessors only considered a line to be a directive
4312 if the @samp{#} appeared in column 1 on the line. Therefore
4313 @option{-Wtraditional} warns about directives that traditional C
4314 understands but ignores because the @samp{#} does not appear as the
4315 first character on the line. It also suggests you hide directives like
4316 @samp{#pragma} not understood by traditional C by indenting them. Some
4317 traditional implementations do not recognize @samp{#elif}, so this option
4318 suggests avoiding it altogether.
4321 A function-like macro that appears without arguments.
4324 The unary plus operator.
4327 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4328 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4329 constants.) Note, these suffixes appear in macros defined in the system
4330 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4331 Use of these macros in user code might normally lead to spurious
4332 warnings, however GCC's integrated preprocessor has enough context to
4333 avoid warning in these cases.
4336 A function declared external in one block and then used after the end of
4340 A @code{switch} statement has an operand of type @code{long}.
4343 A non-@code{static} function declaration follows a @code{static} one.
4344 This construct is not accepted by some traditional C compilers.
4347 The ISO type of an integer constant has a different width or
4348 signedness from its traditional type. This warning is only issued if
4349 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4350 typically represent bit patterns, are not warned about.
4353 Usage of ISO string concatenation is detected.
4356 Initialization of automatic aggregates.
4359 Identifier conflicts with labels. Traditional C lacks a separate
4360 namespace for labels.
4363 Initialization of unions. If the initializer is zero, the warning is
4364 omitted. This is done under the assumption that the zero initializer in
4365 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4366 initializer warnings and relies on default initialization to zero in the
4370 Conversions by prototypes between fixed/floating-point values and vice
4371 versa. The absence of these prototypes when compiling with traditional
4372 C causes serious problems. This is a subset of the possible
4373 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4376 Use of ISO C style function definitions. This warning intentionally is
4377 @emph{not} issued for prototype declarations or variadic functions
4378 because these ISO C features appear in your code when using
4379 libiberty's traditional C compatibility macros, @code{PARAMS} and
4380 @code{VPARAMS}. This warning is also bypassed for nested functions
4381 because that feature is already a GCC extension and thus not relevant to
4382 traditional C compatibility.
4385 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4386 @opindex Wtraditional-conversion
4387 @opindex Wno-traditional-conversion
4388 Warn if a prototype causes a type conversion that is different from what
4389 would happen to the same argument in the absence of a prototype. This
4390 includes conversions of fixed point to floating and vice versa, and
4391 conversions changing the width or signedness of a fixed-point argument
4392 except when the same as the default promotion.
4394 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4395 @opindex Wdeclaration-after-statement
4396 @opindex Wno-declaration-after-statement
4397 Warn when a declaration is found after a statement in a block. This
4398 construct, known from C++, was introduced with ISO C99 and is by default
4399 allowed in GCC@. It is not supported by ISO C90 and was not supported by
4400 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
4405 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
4407 @item -Wno-endif-labels
4408 @opindex Wno-endif-labels
4409 @opindex Wendif-labels
4410 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
4415 Warn whenever a local variable or type declaration shadows another
4416 variable, parameter, type, class member (in C++), or instance variable
4417 (in Objective-C) or whenever a built-in function is shadowed. Note
4418 that in C++, the compiler warns if a local variable shadows an
4419 explicit typedef, but not if it shadows a struct/class/enum.
4421 @item -Wno-shadow-ivar @r{(Objective-C only)}
4422 @opindex Wno-shadow-ivar
4423 @opindex Wshadow-ivar
4424 Do not warn whenever a local variable shadows an instance variable in an
4427 @item -Wlarger-than=@var{len}
4428 @opindex Wlarger-than=@var{len}
4429 @opindex Wlarger-than-@var{len}
4430 Warn whenever an object of larger than @var{len} bytes is defined.
4432 @item -Wframe-larger-than=@var{len}
4433 @opindex Wframe-larger-than
4434 Warn if the size of a function frame is larger than @var{len} bytes.
4435 The computation done to determine the stack frame size is approximate
4436 and not conservative.
4437 The actual requirements may be somewhat greater than @var{len}
4438 even if you do not get a warning. In addition, any space allocated
4439 via @code{alloca}, variable-length arrays, or related constructs
4440 is not included by the compiler when determining
4441 whether or not to issue a warning.
4443 @item -Wno-free-nonheap-object
4444 @opindex Wno-free-nonheap-object
4445 @opindex Wfree-nonheap-object
4446 Do not warn when attempting to free an object that was not allocated
4449 @item -Wstack-usage=@var{len}
4450 @opindex Wstack-usage
4451 Warn if the stack usage of a function might be larger than @var{len} bytes.
4452 The computation done to determine the stack usage is conservative.
4453 Any space allocated via @code{alloca}, variable-length arrays, or related
4454 constructs is included by the compiler when determining whether or not to
4457 The message is in keeping with the output of @option{-fstack-usage}.
4461 If the stack usage is fully static but exceeds the specified amount, it's:
4464 warning: stack usage is 1120 bytes
4467 If the stack usage is (partly) dynamic but bounded, it's:
4470 warning: stack usage might be 1648 bytes
4473 If the stack usage is (partly) dynamic and not bounded, it's:
4476 warning: stack usage might be unbounded
4480 @item -Wunsafe-loop-optimizations
4481 @opindex Wunsafe-loop-optimizations
4482 @opindex Wno-unsafe-loop-optimizations
4483 Warn if the loop cannot be optimized because the compiler cannot
4484 assume anything on the bounds of the loop indices. With
4485 @option{-funsafe-loop-optimizations} warn if the compiler makes
4488 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4489 @opindex Wno-pedantic-ms-format
4490 @opindex Wpedantic-ms-format
4491 When used in combination with @option{-Wformat}
4492 and @option{-pedantic} without GNU extensions, this option
4493 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4494 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4495 which depend on the MS runtime.
4497 @item -Wpointer-arith
4498 @opindex Wpointer-arith
4499 @opindex Wno-pointer-arith
4500 Warn about anything that depends on the ``size of'' a function type or
4501 of @code{void}. GNU C assigns these types a size of 1, for
4502 convenience in calculations with @code{void *} pointers and pointers
4503 to functions. In C++, warn also when an arithmetic operation involves
4504 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
4507 @opindex Wtype-limits
4508 @opindex Wno-type-limits
4509 Warn if a comparison is always true or always false due to the limited
4510 range of the data type, but do not warn for constant expressions. For
4511 example, warn if an unsigned variable is compared against zero with
4512 @samp{<} or @samp{>=}. This warning is also enabled by
4515 @item -Wbad-function-cast @r{(C and Objective-C only)}
4516 @opindex Wbad-function-cast
4517 @opindex Wno-bad-function-cast
4518 Warn whenever a function call is cast to a non-matching type.
4519 For example, warn if @code{int malloc()} is cast to @code{anything *}.
4521 @item -Wc90-c99-compat @r{(C and Objective-C only)}
4522 @opindex Wc90-c99-compat
4523 @opindex Wno-c90-c99-compat
4524 Warn about features not present in ISO C90, but present in ISO C99.
4525 For instance, warn about use of variable length arrays, @code{long long}
4526 type, @code{bool} type, compound literals, designated initializers, and so
4527 on. This option is independent of the standards mode. Warnings are disabled
4528 in the expression that follows @code{__extension__}.
4530 @item -Wc++-compat @r{(C and Objective-C only)}
4531 Warn about ISO C constructs that are outside of the common subset of
4532 ISO C and ISO C++, e.g.@: request for implicit conversion from
4533 @code{void *} to a pointer to non-@code{void} type.
4535 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4536 Warn about C++ constructs whose meaning differs between ISO C++ 1998
4537 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
4538 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
4539 enabled by @option{-Wall}.
4543 @opindex Wno-cast-qual
4544 Warn whenever a pointer is cast so as to remove a type qualifier from
4545 the target type. For example, warn if a @code{const char *} is cast
4546 to an ordinary @code{char *}.
4548 Also warn when making a cast that introduces a type qualifier in an
4549 unsafe way. For example, casting @code{char **} to @code{const char **}
4550 is unsafe, as in this example:
4553 /* p is char ** value. */
4554 const char **q = (const char **) p;
4555 /* Assignment of readonly string to const char * is OK. */
4557 /* Now char** pointer points to read-only memory. */
4562 @opindex Wcast-align
4563 @opindex Wno-cast-align
4564 Warn whenever a pointer is cast such that the required alignment of the
4565 target is increased. For example, warn if a @code{char *} is cast to
4566 an @code{int *} on machines where integers can only be accessed at
4567 two- or four-byte boundaries.
4569 @item -Wwrite-strings
4570 @opindex Wwrite-strings
4571 @opindex Wno-write-strings
4572 When compiling C, give string constants the type @code{const
4573 char[@var{length}]} so that copying the address of one into a
4574 non-@code{const} @code{char *} pointer produces a warning. These
4575 warnings help you find at compile time code that can try to write
4576 into a string constant, but only if you have been very careful about
4577 using @code{const} in declarations and prototypes. Otherwise, it is
4578 just a nuisance. This is why we did not make @option{-Wall} request
4581 When compiling C++, warn about the deprecated conversion from string
4582 literals to @code{char *}. This warning is enabled by default for C++
4587 @opindex Wno-clobbered
4588 Warn for variables that might be changed by @samp{longjmp} or
4589 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
4591 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4592 @opindex Wconditionally-supported
4593 @opindex Wno-conditionally-supported
4594 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4597 @opindex Wconversion
4598 @opindex Wno-conversion
4599 Warn for implicit conversions that may alter a value. This includes
4600 conversions between real and integer, like @code{abs (x)} when
4601 @code{x} is @code{double}; conversions between signed and unsigned,
4602 like @code{unsigned ui = -1}; and conversions to smaller types, like
4603 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4604 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4605 changed by the conversion like in @code{abs (2.0)}. Warnings about
4606 conversions between signed and unsigned integers can be disabled by
4607 using @option{-Wno-sign-conversion}.
4609 For C++, also warn for confusing overload resolution for user-defined
4610 conversions; and conversions that never use a type conversion
4611 operator: conversions to @code{void}, the same type, a base class or a
4612 reference to them. Warnings about conversions between signed and
4613 unsigned integers are disabled by default in C++ unless
4614 @option{-Wsign-conversion} is explicitly enabled.
4616 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4617 @opindex Wconversion-null
4618 @opindex Wno-conversion-null
4619 Do not warn for conversions between @code{NULL} and non-pointer
4620 types. @option{-Wconversion-null} is enabled by default.
4622 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4623 @opindex Wzero-as-null-pointer-constant
4624 @opindex Wno-zero-as-null-pointer-constant
4625 Warn when a literal '0' is used as null pointer constant. This can
4626 be useful to facilitate the conversion to @code{nullptr} in C++11.
4630 @opindex Wno-date-time
4631 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
4632 are encountered as they might prevent bit-wise-identical reproducible
4635 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
4636 @opindex Wdelete-incomplete
4637 @opindex Wno-delete-incomplete
4638 Warn when deleting a pointer to incomplete type, which may cause
4639 undefined behavior at runtime. This warning is enabled by default.
4641 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4642 @opindex Wuseless-cast
4643 @opindex Wno-useless-cast
4644 Warn when an expression is casted to its own type.
4647 @opindex Wempty-body
4648 @opindex Wno-empty-body
4649 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
4650 while} statement. This warning is also enabled by @option{-Wextra}.
4652 @item -Wenum-compare
4653 @opindex Wenum-compare
4654 @opindex Wno-enum-compare
4655 Warn about a comparison between values of different enumerated types.
4656 In C++ enumeral mismatches in conditional expressions are also
4657 diagnosed and the warning is enabled by default. In C this warning is
4658 enabled by @option{-Wall}.
4660 @item -Wjump-misses-init @r{(C, Objective-C only)}
4661 @opindex Wjump-misses-init
4662 @opindex Wno-jump-misses-init
4663 Warn if a @code{goto} statement or a @code{switch} statement jumps
4664 forward across the initialization of a variable, or jumps backward to a
4665 label after the variable has been initialized. This only warns about
4666 variables that are initialized when they are declared. This warning is
4667 only supported for C and Objective-C; in C++ this sort of branch is an
4670 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
4671 can be disabled with the @option{-Wno-jump-misses-init} option.
4673 @item -Wsign-compare
4674 @opindex Wsign-compare
4675 @opindex Wno-sign-compare
4676 @cindex warning for comparison of signed and unsigned values
4677 @cindex comparison of signed and unsigned values, warning
4678 @cindex signed and unsigned values, comparison warning
4679 Warn when a comparison between signed and unsigned values could produce
4680 an incorrect result when the signed value is converted to unsigned.
4681 This warning is also enabled by @option{-Wextra}; to get the other warnings
4682 of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}.
4684 @item -Wsign-conversion
4685 @opindex Wsign-conversion
4686 @opindex Wno-sign-conversion
4687 Warn for implicit conversions that may change the sign of an integer
4688 value, like assigning a signed integer expression to an unsigned
4689 integer variable. An explicit cast silences the warning. In C, this
4690 option is enabled also by @option{-Wconversion}.
4692 @item -Wfloat-conversion
4693 @opindex Wfloat-conversion
4694 @opindex Wno-float-conversion
4695 Warn for implicit conversions that reduce the precision of a real value.
4696 This includes conversions from real to integer, and from higher precision
4697 real to lower precision real values. This option is also enabled by
4698 @option{-Wconversion}.
4700 @item -Wsizeof-pointer-memaccess
4701 @opindex Wsizeof-pointer-memaccess
4702 @opindex Wno-sizeof-pointer-memaccess
4703 Warn for suspicious length parameters to certain string and memory built-in
4704 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
4705 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
4706 but a pointer, and suggests a possible fix, or about
4707 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
4710 @item -Wsizeof-array-argument
4711 @opindex Wsizeof-array-argument
4712 @opindex Wno-sizeof-array-argument
4713 Warn when the @code{sizeof} operator is applied to a parameter that is
4714 declared as an array in a function definition. This warning is enabled by
4715 default for C and C++ programs.
4717 @item -Wmemset-transposed-args
4718 @opindex Wmemset-transposed-args
4719 @opindex Wno-memset-transposed-args
4720 Warn for suspicious calls to the @code{memset} built-in function, if the
4721 second argument is not zero and the third argument is zero. This warns e.g.@
4722 about @code{memset (buf, sizeof buf, 0)} where most probably
4723 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
4724 is only emitted if the third argument is literal zero, if it is some expression
4725 that is folded to zero, or e.g. a cast of zero to some type etc., it
4726 is far less likely that user has mistakenly exchanged the arguments and
4727 no warning is emitted. This warning is enabled by @option{-Wall}.
4731 @opindex Wno-address
4732 Warn about suspicious uses of memory addresses. These include using
4733 the address of a function in a conditional expression, such as
4734 @code{void func(void); if (func)}, and comparisons against the memory
4735 address of a string literal, such as @code{if (x == "abc")}. Such
4736 uses typically indicate a programmer error: the address of a function
4737 always evaluates to true, so their use in a conditional usually
4738 indicate that the programmer forgot the parentheses in a function
4739 call; and comparisons against string literals result in unspecified
4740 behavior and are not portable in C, so they usually indicate that the
4741 programmer intended to use @code{strcmp}. This warning is enabled by
4745 @opindex Wlogical-op
4746 @opindex Wno-logical-op
4747 Warn about suspicious uses of logical operators in expressions.
4748 This includes using logical operators in contexts where a
4749 bit-wise operator is likely to be expected.
4751 @item -Wlogical-not-parentheses
4752 @opindex Wlogical-not-parentheses
4753 @opindex Wno-logical-not-parentheses
4754 Warn about logical not used on the left hand side operand of a comparison.
4755 This option does not warn if the LHS or RHS operand is of a boolean or
4756 a vector type. Its purpose is to detect suspicious code like the following:
4760 if (!a > 1) @{ @dots{} @}
4763 It is possible to suppress the warning by wrapping the LHS into
4766 if ((!a) > 1) @{ @dots{} @}
4769 @item -Waggregate-return
4770 @opindex Waggregate-return
4771 @opindex Wno-aggregate-return
4772 Warn if any functions that return structures or unions are defined or
4773 called. (In languages where you can return an array, this also elicits
4776 @item -Wno-aggressive-loop-optimizations
4777 @opindex Wno-aggressive-loop-optimizations
4778 @opindex Waggressive-loop-optimizations
4779 Warn if in a loop with constant number of iterations the compiler detects
4780 undefined behavior in some statement during one or more of the iterations.
4782 @item -Wno-attributes
4783 @opindex Wno-attributes
4784 @opindex Wattributes
4785 Do not warn if an unexpected @code{__attribute__} is used, such as
4786 unrecognized attributes, function attributes applied to variables,
4787 etc. This does not stop errors for incorrect use of supported
4790 @item -Wno-builtin-macro-redefined
4791 @opindex Wno-builtin-macro-redefined
4792 @opindex Wbuiltin-macro-redefined
4793 Do not warn if certain built-in macros are redefined. This suppresses
4794 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4795 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4797 @item -Wstrict-prototypes @r{(C and Objective-C only)}
4798 @opindex Wstrict-prototypes
4799 @opindex Wno-strict-prototypes
4800 Warn if a function is declared or defined without specifying the
4801 argument types. (An old-style function definition is permitted without
4802 a warning if preceded by a declaration that specifies the argument
4805 @item -Wold-style-declaration @r{(C and Objective-C only)}
4806 @opindex Wold-style-declaration
4807 @opindex Wno-old-style-declaration
4808 Warn for obsolescent usages, according to the C Standard, in a
4809 declaration. For example, warn if storage-class specifiers like
4810 @code{static} are not the first things in a declaration. This warning
4811 is also enabled by @option{-Wextra}.
4813 @item -Wold-style-definition @r{(C and Objective-C only)}
4814 @opindex Wold-style-definition
4815 @opindex Wno-old-style-definition
4816 Warn if an old-style function definition is used. A warning is given
4817 even if there is a previous prototype.
4819 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
4820 @opindex Wmissing-parameter-type
4821 @opindex Wno-missing-parameter-type
4822 A function parameter is declared without a type specifier in K&R-style
4829 This warning is also enabled by @option{-Wextra}.
4831 @item -Wmissing-prototypes @r{(C and Objective-C only)}
4832 @opindex Wmissing-prototypes
4833 @opindex Wno-missing-prototypes
4834 Warn if a global function is defined without a previous prototype
4835 declaration. This warning is issued even if the definition itself
4836 provides a prototype. Use this option to detect global functions
4837 that do not have a matching prototype declaration in a header file.
4838 This option is not valid for C++ because all function declarations
4839 provide prototypes and a non-matching declaration will declare an
4840 overload rather than conflict with an earlier declaration.
4841 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
4843 @item -Wmissing-declarations
4844 @opindex Wmissing-declarations
4845 @opindex Wno-missing-declarations
4846 Warn if a global function is defined without a previous declaration.
4847 Do so even if the definition itself provides a prototype.
4848 Use this option to detect global functions that are not declared in
4849 header files. In C, no warnings are issued for functions with previous
4850 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
4851 missing prototypes. In C++, no warnings are issued for function templates,
4852 or for inline functions, or for functions in anonymous namespaces.
4854 @item -Wmissing-field-initializers
4855 @opindex Wmissing-field-initializers
4856 @opindex Wno-missing-field-initializers
4860 Warn if a structure's initializer has some fields missing. For
4861 example, the following code causes such a warning, because
4862 @code{x.h} is implicitly zero:
4865 struct s @{ int f, g, h; @};
4866 struct s x = @{ 3, 4 @};
4869 This option does not warn about designated initializers, so the following
4870 modification does not trigger a warning:
4873 struct s @{ int f, g, h; @};
4874 struct s x = @{ .f = 3, .g = 4 @};
4877 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
4878 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
4880 @item -Wno-multichar
4881 @opindex Wno-multichar
4883 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4884 Usually they indicate a typo in the user's code, as they have
4885 implementation-defined values, and should not be used in portable code.
4887 @item -Wnormalized=<none|id|nfc|nfkc>
4888 @opindex Wnormalized=
4891 @cindex character set, input normalization
4892 In ISO C and ISO C++, two identifiers are different if they are
4893 different sequences of characters. However, sometimes when characters
4894 outside the basic ASCII character set are used, you can have two
4895 different character sequences that look the same. To avoid confusion,
4896 the ISO 10646 standard sets out some @dfn{normalization rules} which
4897 when applied ensure that two sequences that look the same are turned into
4898 the same sequence. GCC can warn you if you are using identifiers that
4899 have not been normalized; this option controls that warning.
4901 There are four levels of warning supported by GCC@. The default is
4902 @option{-Wnormalized=nfc}, which warns about any identifier that is
4903 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4904 recommended form for most uses.
4906 Unfortunately, there are some characters allowed in identifiers by
4907 ISO C and ISO C++ that, when turned into NFC, are not allowed in
4908 identifiers. That is, there's no way to use these symbols in portable
4909 ISO C or C++ and have all your identifiers in NFC@.
4910 @option{-Wnormalized=id} suppresses the warning for these characters.
4911 It is hoped that future versions of the standards involved will correct
4912 this, which is why this option is not the default.
4914 You can switch the warning off for all characters by writing
4915 @option{-Wnormalized=none}. You should only do this if you
4916 are using some other normalization scheme (like ``D''), because
4917 otherwise you can easily create bugs that are literally impossible to see.
4919 Some characters in ISO 10646 have distinct meanings but look identical
4920 in some fonts or display methodologies, especially once formatting has
4921 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4922 LETTER N'', displays just like a regular @code{n} that has been
4923 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
4924 normalization scheme to convert all these into a standard form as
4925 well, and GCC warns if your code is not in NFKC if you use
4926 @option{-Wnormalized=nfkc}. This warning is comparable to warning
4927 about every identifier that contains the letter O because it might be
4928 confused with the digit 0, and so is not the default, but may be
4929 useful as a local coding convention if the programming environment
4930 cannot be fixed to display these characters distinctly.
4932 @item -Wno-deprecated
4933 @opindex Wno-deprecated
4934 @opindex Wdeprecated
4935 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4937 @item -Wno-deprecated-declarations
4938 @opindex Wno-deprecated-declarations
4939 @opindex Wdeprecated-declarations
4940 Do not warn about uses of functions (@pxref{Function Attributes}),
4941 variables (@pxref{Variable Attributes}), and types (@pxref{Type
4942 Attributes}) marked as deprecated by using the @code{deprecated}
4946 @opindex Wno-overflow
4948 Do not warn about compile-time overflow in constant expressions.
4953 Warn about One Definition Rule violations during link-time optimization.
4954 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
4957 @opindex Wopenm-simd
4958 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
4959 simd directive set by user. The @option{-fsimd-cost-model=unlimited} can
4960 be used to relax the cost model.
4962 @item -Woverride-init @r{(C and Objective-C only)}
4963 @opindex Woverride-init
4964 @opindex Wno-override-init
4968 Warn if an initialized field without side effects is overridden when
4969 using designated initializers (@pxref{Designated Inits, , Designated
4972 This warning is included in @option{-Wextra}. To get other
4973 @option{-Wextra} warnings without this one, use @option{-Wextra
4974 -Wno-override-init}.
4979 Warn if a structure is given the packed attribute, but the packed
4980 attribute has no effect on the layout or size of the structure.
4981 Such structures may be mis-aligned for little benefit. For
4982 instance, in this code, the variable @code{f.x} in @code{struct bar}
4983 is misaligned even though @code{struct bar} does not itself
4984 have the packed attribute:
4991 @} __attribute__((packed));
4999 @item -Wpacked-bitfield-compat
5000 @opindex Wpacked-bitfield-compat
5001 @opindex Wno-packed-bitfield-compat
5002 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5003 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5004 the change can lead to differences in the structure layout. GCC
5005 informs you when the offset of such a field has changed in GCC 4.4.
5006 For example there is no longer a 4-bit padding between field @code{a}
5007 and @code{b} in this structure:
5014 @} __attribute__ ((packed));
5017 This warning is enabled by default. Use
5018 @option{-Wno-packed-bitfield-compat} to disable this warning.
5023 Warn if padding is included in a structure, either to align an element
5024 of the structure or to align the whole structure. Sometimes when this
5025 happens it is possible to rearrange the fields of the structure to
5026 reduce the padding and so make the structure smaller.
5028 @item -Wredundant-decls
5029 @opindex Wredundant-decls
5030 @opindex Wno-redundant-decls
5031 Warn if anything is declared more than once in the same scope, even in
5032 cases where multiple declaration is valid and changes nothing.
5034 @item -Wnested-externs @r{(C and Objective-C only)}
5035 @opindex Wnested-externs
5036 @opindex Wno-nested-externs
5037 Warn if an @code{extern} declaration is encountered within a function.
5039 @item -Wno-inherited-variadic-ctor
5040 @opindex Winherited-variadic-ctor
5041 @opindex Wno-inherited-variadic-ctor
5042 Suppress warnings about use of C++11 inheriting constructors when the
5043 base class inherited from has a C variadic constructor; the warning is
5044 on by default because the ellipsis is not inherited.
5049 Warn if a function that is declared as inline cannot be inlined.
5050 Even with this option, the compiler does not warn about failures to
5051 inline functions declared in system headers.
5053 The compiler uses a variety of heuristics to determine whether or not
5054 to inline a function. For example, the compiler takes into account
5055 the size of the function being inlined and the amount of inlining
5056 that has already been done in the current function. Therefore,
5057 seemingly insignificant changes in the source program can cause the
5058 warnings produced by @option{-Winline} to appear or disappear.
5060 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5061 @opindex Wno-invalid-offsetof
5062 @opindex Winvalid-offsetof
5063 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
5064 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
5065 to a non-POD type is undefined. In existing C++ implementations,
5066 however, @samp{offsetof} typically gives meaningful results even when
5067 applied to certain kinds of non-POD types (such as a simple
5068 @samp{struct} that fails to be a POD type only by virtue of having a
5069 constructor). This flag is for users who are aware that they are
5070 writing nonportable code and who have deliberately chosen to ignore the
5073 The restrictions on @samp{offsetof} may be relaxed in a future version
5074 of the C++ standard.
5076 @item -Wno-int-to-pointer-cast
5077 @opindex Wno-int-to-pointer-cast
5078 @opindex Wint-to-pointer-cast
5079 Suppress warnings from casts to pointer type of an integer of a
5080 different size. In C++, casting to a pointer type of smaller size is
5081 an error. @option{Wint-to-pointer-cast} is enabled by default.
5084 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5085 @opindex Wno-pointer-to-int-cast
5086 @opindex Wpointer-to-int-cast
5087 Suppress warnings from casts from a pointer to an integer type of a
5091 @opindex Winvalid-pch
5092 @opindex Wno-invalid-pch
5093 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5094 the search path but can't be used.
5098 @opindex Wno-long-long
5099 Warn if @samp{long long} type is used. This is enabled by either
5100 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5101 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5103 @item -Wvariadic-macros
5104 @opindex Wvariadic-macros
5105 @opindex Wno-variadic-macros
5106 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
5107 alternate syntax when in pedantic ISO C99 mode. This is default.
5108 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
5112 @opindex Wno-varargs
5113 Warn upon questionable usage of the macros used to handle variable
5114 arguments like @samp{va_start}. This is default. To inhibit the
5115 warning messages, use @option{-Wno-varargs}.
5117 @item -Wvector-operation-performance
5118 @opindex Wvector-operation-performance
5119 @opindex Wno-vector-operation-performance
5120 Warn if vector operation is not implemented via SIMD capabilities of the
5121 architecture. Mainly useful for the performance tuning.
5122 Vector operation can be implemented @code{piecewise}, which means that the
5123 scalar operation is performed on every vector element;
5124 @code{in parallel}, which means that the vector operation is implemented
5125 using scalars of wider type, which normally is more performance efficient;
5126 and @code{as a single scalar}, which means that vector fits into a
5129 @item -Wno-virtual-move-assign
5130 @opindex Wvirtual-move-assign
5131 @opindex Wno-virtual-move-assign
5132 Suppress warnings about inheriting from a virtual base with a
5133 non-trivial C++11 move assignment operator. This is dangerous because
5134 if the virtual base is reachable along more than one path, it will be
5135 moved multiple times, which can mean both objects end up in the
5136 moved-from state. If the move assignment operator is written to avoid
5137 moving from a moved-from object, this warning can be disabled.
5142 Warn if variable length array is used in the code.
5143 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5144 the variable length array.
5146 @item -Wvolatile-register-var
5147 @opindex Wvolatile-register-var
5148 @opindex Wno-volatile-register-var
5149 Warn if a register variable is declared volatile. The volatile
5150 modifier does not inhibit all optimizations that may eliminate reads
5151 and/or writes to register variables. This warning is enabled by
5154 @item -Wdisabled-optimization
5155 @opindex Wdisabled-optimization
5156 @opindex Wno-disabled-optimization
5157 Warn if a requested optimization pass is disabled. This warning does
5158 not generally indicate that there is anything wrong with your code; it
5159 merely indicates that GCC's optimizers are unable to handle the code
5160 effectively. Often, the problem is that your code is too big or too
5161 complex; GCC refuses to optimize programs when the optimization
5162 itself is likely to take inordinate amounts of time.
5164 @item -Wpointer-sign @r{(C and Objective-C only)}
5165 @opindex Wpointer-sign
5166 @opindex Wno-pointer-sign
5167 Warn for pointer argument passing or assignment with different signedness.
5168 This option is only supported for C and Objective-C@. It is implied by
5169 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5170 @option{-Wno-pointer-sign}.
5172 @item -Wstack-protector
5173 @opindex Wstack-protector
5174 @opindex Wno-stack-protector
5175 This option is only active when @option{-fstack-protector} is active. It
5176 warns about functions that are not protected against stack smashing.
5178 @item -Woverlength-strings
5179 @opindex Woverlength-strings
5180 @opindex Wno-overlength-strings
5181 Warn about string constants that are longer than the ``minimum
5182 maximum'' length specified in the C standard. Modern compilers
5183 generally allow string constants that are much longer than the
5184 standard's minimum limit, but very portable programs should avoid
5185 using longer strings.
5187 The limit applies @emph{after} string constant concatenation, and does
5188 not count the trailing NUL@. In C90, the limit was 509 characters; in
5189 C99, it was raised to 4095. C++98 does not specify a normative
5190 minimum maximum, so we do not diagnose overlength strings in C++@.
5192 This option is implied by @option{-Wpedantic}, and can be disabled with
5193 @option{-Wno-overlength-strings}.
5195 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5196 @opindex Wunsuffixed-float-constants
5198 Issue a warning for any floating constant that does not have
5199 a suffix. When used together with @option{-Wsystem-headers} it
5200 warns about such constants in system header files. This can be useful
5201 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5202 from the decimal floating-point extension to C99.
5204 @item -Wno-designated-init @r{(C and Objective-C only)}
5205 Suppress warnings when a positional initializer is used to initialize
5206 a structure that has been marked with the @code{designated_init}
5211 @node Debugging Options
5212 @section Options for Debugging Your Program or GCC
5213 @cindex options, debugging
5214 @cindex debugging information options
5216 GCC has various special options that are used for debugging
5217 either your program or GCC:
5222 Produce debugging information in the operating system's native format
5223 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
5226 On most systems that use stabs format, @option{-g} enables use of extra
5227 debugging information that only GDB can use; this extra information
5228 makes debugging work better in GDB but probably makes other debuggers
5230 refuse to read the program. If you want to control for certain whether
5231 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5232 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5234 GCC allows you to use @option{-g} with
5235 @option{-O}. The shortcuts taken by optimized code may occasionally
5236 produce surprising results: some variables you declared may not exist
5237 at all; flow of control may briefly move where you did not expect it;
5238 some statements may not be executed because they compute constant
5239 results or their values are already at hand; some statements may
5240 execute in different places because they have been moved out of loops.
5242 Nevertheless it proves possible to debug optimized output. This makes
5243 it reasonable to use the optimizer for programs that might have bugs.
5245 The following options are useful when GCC is generated with the
5246 capability for more than one debugging format.
5249 @opindex gsplit-dwarf
5250 Separate as much dwarf debugging information as possible into a
5251 separate output file with the extension .dwo. This option allows
5252 the build system to avoid linking files with debug information. To
5253 be useful, this option requires a debugger capable of reading .dwo
5258 Produce debugging information for use by GDB@. This means to use the
5259 most expressive format available (DWARF 2, stabs, or the native format
5260 if neither of those are supported), including GDB extensions if at all
5265 Generate dwarf .debug_pubnames and .debug_pubtypes sections.
5267 @item -ggnu-pubnames
5268 @opindex ggnu-pubnames
5269 Generate .debug_pubnames and .debug_pubtypes sections in a format
5270 suitable for conversion into a GDB@ index. This option is only useful
5271 with a linker that can produce GDB@ index version 7.
5275 Produce debugging information in stabs format (if that is supported),
5276 without GDB extensions. This is the format used by DBX on most BSD
5277 systems. On MIPS, Alpha and System V Release 4 systems this option
5278 produces stabs debugging output that is not understood by DBX or SDB@.
5279 On System V Release 4 systems this option requires the GNU assembler.
5281 @item -feliminate-unused-debug-symbols
5282 @opindex feliminate-unused-debug-symbols
5283 Produce debugging information in stabs format (if that is supported),
5284 for only symbols that are actually used.
5286 @item -femit-class-debug-always
5287 Instead of emitting debugging information for a C++ class in only one
5288 object file, emit it in all object files using the class. This option
5289 should be used only with debuggers that are unable to handle the way GCC
5290 normally emits debugging information for classes because using this
5291 option increases the size of debugging information by as much as a
5294 @item -fdebug-types-section
5295 @opindex fdebug-types-section
5296 @opindex fno-debug-types-section
5297 When using DWARF Version 4 or higher, type DIEs can be put into
5298 their own @code{.debug_types} section instead of making them part of the
5299 @code{.debug_info} section. It is more efficient to put them in a separate
5300 comdat sections since the linker can then remove duplicates.
5301 But not all DWARF consumers support @code{.debug_types} sections yet
5302 and on some objects @code{.debug_types} produces larger instead of smaller
5303 debugging information.
5307 Produce debugging information in stabs format (if that is supported),
5308 using GNU extensions understood only by the GNU debugger (GDB)@. The
5309 use of these extensions is likely to make other debuggers crash or
5310 refuse to read the program.
5314 Produce debugging information in COFF format (if that is supported).
5315 This is the format used by SDB on most System V systems prior to
5320 Produce debugging information in XCOFF format (if that is supported).
5321 This is the format used by the DBX debugger on IBM RS/6000 systems.
5325 Produce debugging information in XCOFF format (if that is supported),
5326 using GNU extensions understood only by the GNU debugger (GDB)@. The
5327 use of these extensions is likely to make other debuggers crash or
5328 refuse to read the program, and may cause assemblers other than the GNU
5329 assembler (GAS) to fail with an error.
5331 @item -gdwarf-@var{version}
5332 @opindex gdwarf-@var{version}
5333 Produce debugging information in DWARF format (if that is supported).
5334 The value of @var{version} may be either 2, 3 or 4; the default version
5335 for most targets is 4.
5337 Note that with DWARF Version 2, some ports require and always
5338 use some non-conflicting DWARF 3 extensions in the unwind tables.
5340 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5341 for maximum benefit.
5343 @item -grecord-gcc-switches
5344 @opindex grecord-gcc-switches
5345 This switch causes the command-line options used to invoke the
5346 compiler that may affect code generation to be appended to the
5347 DW_AT_producer attribute in DWARF debugging information. The options
5348 are concatenated with spaces separating them from each other and from
5349 the compiler version. See also @option{-frecord-gcc-switches} for another
5350 way of storing compiler options into the object file. This is the default.
5352 @item -gno-record-gcc-switches
5353 @opindex gno-record-gcc-switches
5354 Disallow appending command-line options to the DW_AT_producer attribute
5355 in DWARF debugging information.
5357 @item -gstrict-dwarf
5358 @opindex gstrict-dwarf
5359 Disallow using extensions of later DWARF standard version than selected
5360 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
5361 DWARF extensions from later standard versions is allowed.
5363 @item -gno-strict-dwarf
5364 @opindex gno-strict-dwarf
5365 Allow using extensions of later DWARF standard version than selected with
5366 @option{-gdwarf-@var{version}}.
5368 @item -gz@r{[}=@var{type}@r{]}
5370 Produce compressed debug sections in DWARF format, if that is supported.
5371 If @var{type} is not given, the default type depends on the capabilities
5372 of the assembler and linker used. @var{type} may be one of
5373 @option{none} (don't compress debug sections), @option{zlib} (use zlib
5374 compression in ELF gABI format), or @option{zlib-gnu} (use zlib
5375 compression in traditional GNU format). If the linker doesn't support
5376 writing compressed debug sections, the option is rejected. Otherwise,
5377 if the assembler does not support them, @option{-gz} is silently ignored
5378 when producing object files.
5382 Produce debugging information in Alpha/VMS debug format (if that is
5383 supported). This is the format used by DEBUG on Alpha/VMS systems.
5386 @itemx -ggdb@var{level}
5387 @itemx -gstabs@var{level}
5388 @itemx -gcoff@var{level}
5389 @itemx -gxcoff@var{level}
5390 @itemx -gvms@var{level}
5391 Request debugging information and also use @var{level} to specify how
5392 much information. The default level is 2.
5394 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5397 Level 1 produces minimal information, enough for making backtraces in
5398 parts of the program that you don't plan to debug. This includes
5399 descriptions of functions and external variables, and line number
5400 tables, but no information about local variables.
5402 Level 3 includes extra information, such as all the macro definitions
5403 present in the program. Some debuggers support macro expansion when
5404 you use @option{-g3}.
5406 @option{-gdwarf-2} does not accept a concatenated debug level, because
5407 GCC used to support an option @option{-gdwarf} that meant to generate
5408 debug information in version 1 of the DWARF format (which is very
5409 different from version 2), and it would have been too confusing. That
5410 debug format is long obsolete, but the option cannot be changed now.
5411 Instead use an additional @option{-g@var{level}} option to change the
5412 debug level for DWARF.
5416 Turn off generation of debug info, if leaving out this option
5417 generates it, or turn it on at level 2 otherwise. The position of this
5418 argument in the command line does not matter; it takes effect after all
5419 other options are processed, and it does so only once, no matter how
5420 many times it is given. This is mainly intended to be used with
5421 @option{-fcompare-debug}.
5423 @item -fsanitize=address
5424 @opindex fsanitize=address
5425 Enable AddressSanitizer, a fast memory error detector.
5426 Memory access instructions will be instrumented to detect
5427 out-of-bounds and use-after-free bugs.
5428 See @uref{http://code.google.com/p/address-sanitizer/} for
5429 more details. The run-time behavior can be influenced using the
5430 @env{ASAN_OPTIONS} environment variable; see
5431 @url{https://code.google.com/p/address-sanitizer/wiki/Flags#Run-time_flags} for
5432 a list of supported options.
5434 @item -fsanitize=kernel-address
5435 @opindex fsanitize=kernel-address
5436 Enable AddressSanitizer for Linux kernel.
5437 See @uref{http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel} for more details.
5439 @item -fsanitize=thread
5440 @opindex fsanitize=thread
5441 Enable ThreadSanitizer, a fast data race detector.
5442 Memory access instructions will be instrumented to detect
5443 data race bugs. See @uref{http://code.google.com/p/thread-sanitizer/} for more
5444 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
5445 environment variable; see
5446 @url{https://code.google.com/p/thread-sanitizer/wiki/Flags} for a list of
5449 @item -fsanitize=leak
5450 @opindex fsanitize=leak
5451 Enable LeakSanitizer, a memory leak detector.
5452 This option only matters for linking of executables and if neither
5453 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
5454 case it will link the executable against a library that overrides @code{malloc}
5455 and other allocator functions. See
5456 @uref{https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer} for more
5457 details. The run-time behavior can be influenced using the
5458 @env{LSAN_OPTIONS} environment variable.
5460 @item -fsanitize=undefined
5461 @opindex fsanitize=undefined
5462 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
5463 Various computations will be instrumented to detect undefined behavior
5464 at runtime. Current suboptions are:
5468 @item -fsanitize=shift
5469 @opindex fsanitize=shift
5470 This option enables checking that the result of a shift operation is
5471 not undefined. Note that what exactly is considered undefined differs
5472 slightly between C and C++, as well as between ISO C90 and C99, etc.
5474 @item -fsanitize=integer-divide-by-zero
5475 @opindex fsanitize=integer-divide-by-zero
5476 Detect integer division by zero as well as @code{INT_MIN / -1} division.
5478 @item -fsanitize=unreachable
5479 @opindex fsanitize=unreachable
5480 With this option, the compiler will turn the @code{__builtin_unreachable}
5481 call into a diagnostics message call instead. When reaching the
5482 @code{__builtin_unreachable} call, the behavior is undefined.
5484 @item -fsanitize=vla-bound
5485 @opindex fsanitize=vla-bound
5486 This option instructs the compiler to check that the size of a variable
5487 length array is positive. This option does not have any effect in
5488 @option{-std=c++1y} mode, as the standard requires the exception be thrown
5491 @item -fsanitize=null
5492 @opindex fsanitize=null
5493 This option enables pointer checking. Particularly, the application
5494 built with this option turned on will issue an error message when it
5495 tries to dereference a NULL pointer, or if a reference (possibly an
5496 rvalue reference) is bound to a NULL pointer, or if a method is invoked
5497 on an object pointed by a NULL pointer.
5499 @item -fsanitize=return
5500 @opindex fsanitize=return
5501 This option enables return statement checking. Programs
5502 built with this option turned on will issue an error message
5503 when the end of a non-void function is reached without actually
5504 returning a value. This option works in C++ only.
5506 @item -fsanitize=signed-integer-overflow
5507 @opindex fsanitize=signed-integer-overflow
5508 This option enables signed integer overflow checking. We check that
5509 the result of @code{+}, @code{*}, and both unary and binary @code{-}
5510 does not overflow in the signed arithmetics. Note, integer promotion
5511 rules must be taken into account. That is, the following is not an
5514 signed char a = SCHAR_MAX;
5518 @item -fsanitize=bounds
5519 @opindex fsanitize=bounds
5520 This option enables instrumentation of array bounds. Various out of bounds
5521 accesses are detected. Flexible array members and initializers of variables
5522 with static storage are not instrumented.
5524 @item -fsanitize=alignment
5525 @opindex fsanitize=alignment
5527 This option enables checking of alignment of pointers when they are
5528 dereferenced, or when a reference is bound to insufficiently aligned target,
5529 or when a method or constructor is invoked on insufficiently aligned object.
5531 @item -fsanitize=float-divide-by-zero
5532 @opindex fsanitize=float-divide-by-zero
5533 Detect floating-point division by zero. Unlike other similar options,
5534 @option{-fsanitize=float-divide-by-zero} is not enabled by
5535 @option{-fsanitize=undefined}, since floating-point division by zero can
5536 be a legitimate way of obtaining infinities and NaNs.
5538 @item -fsanitize=float-cast-overflow
5539 @opindex fsanitize=float-cast-overflow
5540 This option enables floating-point type to integer conversion checking.
5541 We check that the result of the conversion does not overflow.
5542 This option does not work well with @code{FE_INVALID} exceptions enabled.
5546 While @option{-ftrapv} causes traps for signed overflows to be emitted,
5547 @option{-fsanitize=undefined} gives a diagnostic message.
5548 This currently works only for the C family of languages.
5550 @item -fsanitize-recover
5551 @opindex fsanitize-recover
5552 By default @option{-fsanitize=undefined} sanitization (and its suboptions
5553 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return})
5554 after reporting undefined behavior attempts to continue running the
5555 program as if no undefined behavior happened. This means multiple undefined
5556 behavior runtime errors can be reported in a single program run, and the exit
5557 code of the program may indicate success even when undefined behavior
5558 has been reported. The @option{-fno-sanitize-recover} can be used to alter
5559 this behavior, only the first detected undefined behavior will be reported
5560 and program will exit after that with non-zero exit code.
5562 @item -fsanitize-undefined-trap-on-error
5563 @opindex fsanitize-undefined-trap-on-error
5564 The @option{-fsanitize-undefined-trap-on-error} instructs the compiler to
5565 report undefined behavior using @code{__builtin_trap ()} rather than
5566 a @code{libubsan} library routine. The advantage of this is that the
5567 @code{libubsan} library is not needed and will not be linked in, so this
5568 is usable even for use in freestanding environments.
5570 @item -fdump-final-insns@r{[}=@var{file}@r{]}
5571 @opindex fdump-final-insns
5572 Dump the final internal representation (RTL) to @var{file}. If the
5573 optional argument is omitted (or if @var{file} is @code{.}), the name
5574 of the dump file is determined by appending @code{.gkd} to the
5575 compilation output file name.
5577 @item -fcompare-debug@r{[}=@var{opts}@r{]}
5578 @opindex fcompare-debug
5579 @opindex fno-compare-debug
5580 If no error occurs during compilation, run the compiler a second time,
5581 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
5582 passed to the second compilation. Dump the final internal
5583 representation in both compilations, and print an error if they differ.
5585 If the equal sign is omitted, the default @option{-gtoggle} is used.
5587 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
5588 and nonzero, implicitly enables @option{-fcompare-debug}. If
5589 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
5590 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
5593 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
5594 is equivalent to @option{-fno-compare-debug}, which disables the dumping
5595 of the final representation and the second compilation, preventing even
5596 @env{GCC_COMPARE_DEBUG} from taking effect.
5598 To verify full coverage during @option{-fcompare-debug} testing, set
5599 @env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
5600 which GCC rejects as an invalid option in any actual compilation
5601 (rather than preprocessing, assembly or linking). To get just a
5602 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
5603 not overridden} will do.
5605 @item -fcompare-debug-second
5606 @opindex fcompare-debug-second
5607 This option is implicitly passed to the compiler for the second
5608 compilation requested by @option{-fcompare-debug}, along with options to
5609 silence warnings, and omitting other options that would cause
5610 side-effect compiler outputs to files or to the standard output. Dump
5611 files and preserved temporary files are renamed so as to contain the
5612 @code{.gk} additional extension during the second compilation, to avoid
5613 overwriting those generated by the first.
5615 When this option is passed to the compiler driver, it causes the
5616 @emph{first} compilation to be skipped, which makes it useful for little
5617 other than debugging the compiler proper.
5619 @item -feliminate-dwarf2-dups
5620 @opindex feliminate-dwarf2-dups
5621 Compress DWARF 2 debugging information by eliminating duplicated
5622 information about each symbol. This option only makes sense when
5623 generating DWARF 2 debugging information with @option{-gdwarf-2}.
5625 @item -femit-struct-debug-baseonly
5626 @opindex femit-struct-debug-baseonly
5627 Emit debug information for struct-like types
5628 only when the base name of the compilation source file
5629 matches the base name of file in which the struct is defined.
5631 This option substantially reduces the size of debugging information,
5632 but at significant potential loss in type information to the debugger.
5633 See @option{-femit-struct-debug-reduced} for a less aggressive option.
5634 See @option{-femit-struct-debug-detailed} for more detailed control.
5636 This option works only with DWARF 2.
5638 @item -femit-struct-debug-reduced
5639 @opindex femit-struct-debug-reduced
5640 Emit debug information for struct-like types
5641 only when the base name of the compilation source file
5642 matches the base name of file in which the type is defined,
5643 unless the struct is a template or defined in a system header.
5645 This option significantly reduces the size of debugging information,
5646 with some potential loss in type information to the debugger.
5647 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
5648 See @option{-femit-struct-debug-detailed} for more detailed control.
5650 This option works only with DWARF 2.
5652 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
5653 Specify the struct-like types
5654 for which the compiler generates debug information.
5655 The intent is to reduce duplicate struct debug information
5656 between different object files within the same program.
5658 This option is a detailed version of
5659 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
5660 which serves for most needs.
5662 A specification has the syntax@*
5663 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
5665 The optional first word limits the specification to
5666 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
5667 A struct type is used directly when it is the type of a variable, member.
5668 Indirect uses arise through pointers to structs.
5669 That is, when use of an incomplete struct is valid, the use is indirect.
5671 @samp{struct one direct; struct two * indirect;}.
5673 The optional second word limits the specification to
5674 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
5675 Generic structs are a bit complicated to explain.
5676 For C++, these are non-explicit specializations of template classes,
5677 or non-template classes within the above.
5678 Other programming languages have generics,
5679 but @option{-femit-struct-debug-detailed} does not yet implement them.
5681 The third word specifies the source files for those
5682 structs for which the compiler should emit debug information.
5683 The values @samp{none} and @samp{any} have the normal meaning.
5684 The value @samp{base} means that
5685 the base of name of the file in which the type declaration appears
5686 must match the base of the name of the main compilation file.
5687 In practice, this means that when compiling @file{foo.c}, debug information
5688 is generated for types declared in that file and @file{foo.h},
5689 but not other header files.
5690 The value @samp{sys} means those types satisfying @samp{base}
5691 or declared in system or compiler headers.
5693 You may need to experiment to determine the best settings for your application.
5695 The default is @option{-femit-struct-debug-detailed=all}.
5697 This option works only with DWARF 2.
5699 @item -fno-merge-debug-strings
5700 @opindex fmerge-debug-strings
5701 @opindex fno-merge-debug-strings
5702 Direct the linker to not merge together strings in the debugging
5703 information that are identical in different object files. Merging is
5704 not supported by all assemblers or linkers. Merging decreases the size
5705 of the debug information in the output file at the cost of increasing
5706 link processing time. Merging is enabled by default.
5708 @item -fdebug-prefix-map=@var{old}=@var{new}
5709 @opindex fdebug-prefix-map
5710 When compiling files in directory @file{@var{old}}, record debugging
5711 information describing them as in @file{@var{new}} instead.
5713 @item -fno-dwarf2-cfi-asm
5714 @opindex fdwarf2-cfi-asm
5715 @opindex fno-dwarf2-cfi-asm
5716 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
5717 instead of using GAS @code{.cfi_*} directives.
5719 @cindex @command{prof}
5722 Generate extra code to write profile information suitable for the
5723 analysis program @command{prof}. You must use this option when compiling
5724 the source files you want data about, and you must also use it when
5727 @cindex @command{gprof}
5730 Generate extra code to write profile information suitable for the
5731 analysis program @command{gprof}. You must use this option when compiling
5732 the source files you want data about, and you must also use it when
5737 Makes the compiler print out each function name as it is compiled, and
5738 print some statistics about each pass when it finishes.
5741 @opindex ftime-report
5742 Makes the compiler print some statistics about the time consumed by each
5743 pass when it finishes.
5746 @opindex fmem-report
5747 Makes the compiler print some statistics about permanent memory
5748 allocation when it finishes.
5750 @item -fmem-report-wpa
5751 @opindex fmem-report-wpa
5752 Makes the compiler print some statistics about permanent memory
5753 allocation for the WPA phase only.
5755 @item -fpre-ipa-mem-report
5756 @opindex fpre-ipa-mem-report
5757 @item -fpost-ipa-mem-report
5758 @opindex fpost-ipa-mem-report
5759 Makes the compiler print some statistics about permanent memory
5760 allocation before or after interprocedural optimization.
5762 @item -fprofile-report
5763 @opindex fprofile-report
5764 Makes the compiler print some statistics about consistency of the
5765 (estimated) profile and effect of individual passes.
5768 @opindex fstack-usage
5769 Makes the compiler output stack usage information for the program, on a
5770 per-function basis. The filename for the dump is made by appending
5771 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
5772 the output file, if explicitly specified and it is not an executable,
5773 otherwise it is the basename of the source file. An entry is made up
5778 The name of the function.
5782 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
5785 The qualifier @code{static} means that the function manipulates the stack
5786 statically: a fixed number of bytes are allocated for the frame on function
5787 entry and released on function exit; no stack adjustments are otherwise made
5788 in the function. The second field is this fixed number of bytes.
5790 The qualifier @code{dynamic} means that the function manipulates the stack
5791 dynamically: in addition to the static allocation described above, stack
5792 adjustments are made in the body of the function, for example to push/pop
5793 arguments around function calls. If the qualifier @code{bounded} is also
5794 present, the amount of these adjustments is bounded at compile time and
5795 the second field is an upper bound of the total amount of stack used by
5796 the function. If it is not present, the amount of these adjustments is
5797 not bounded at compile time and the second field only represents the
5800 @item -fprofile-arcs
5801 @opindex fprofile-arcs
5802 Add code so that program flow @dfn{arcs} are instrumented. During
5803 execution the program records how many times each branch and call is
5804 executed and how many times it is taken or returns. When the compiled
5805 program exits it saves this data to a file called
5806 @file{@var{auxname}.gcda} for each source file. The data may be used for
5807 profile-directed optimizations (@option{-fbranch-probabilities}), or for
5808 test coverage analysis (@option{-ftest-coverage}). Each object file's
5809 @var{auxname} is generated from the name of the output file, if
5810 explicitly specified and it is not the final executable, otherwise it is
5811 the basename of the source file. In both cases any suffix is removed
5812 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
5813 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
5814 @xref{Cross-profiling}.
5816 @cindex @command{gcov}
5820 This option is used to compile and link code instrumented for coverage
5821 analysis. The option is a synonym for @option{-fprofile-arcs}
5822 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
5823 linking). See the documentation for those options for more details.
5828 Compile the source files with @option{-fprofile-arcs} plus optimization
5829 and code generation options. For test coverage analysis, use the
5830 additional @option{-ftest-coverage} option. You do not need to profile
5831 every source file in a program.
5834 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
5835 (the latter implies the former).
5838 Run the program on a representative workload to generate the arc profile
5839 information. This may be repeated any number of times. You can run
5840 concurrent instances of your program, and provided that the file system
5841 supports locking, the data files will be correctly updated. Also
5842 @code{fork} calls are detected and correctly handled (double counting
5846 For profile-directed optimizations, compile the source files again with
5847 the same optimization and code generation options plus
5848 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
5849 Control Optimization}).
5852 For test coverage analysis, use @command{gcov} to produce human readable
5853 information from the @file{.gcno} and @file{.gcda} files. Refer to the
5854 @command{gcov} documentation for further information.
5858 With @option{-fprofile-arcs}, for each function of your program GCC
5859 creates a program flow graph, then finds a spanning tree for the graph.
5860 Only arcs that are not on the spanning tree have to be instrumented: the
5861 compiler adds code to count the number of times that these arcs are
5862 executed. When an arc is the only exit or only entrance to a block, the
5863 instrumentation code can be added to the block; otherwise, a new basic
5864 block must be created to hold the instrumentation code.
5867 @item -ftest-coverage
5868 @opindex ftest-coverage
5869 Produce a notes file that the @command{gcov} code-coverage utility
5870 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
5871 show program coverage. Each source file's note file is called
5872 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
5873 above for a description of @var{auxname} and instructions on how to
5874 generate test coverage data. Coverage data matches the source files
5875 more closely if you do not optimize.
5877 @item -fdbg-cnt-list
5878 @opindex fdbg-cnt-list
5879 Print the name and the counter upper bound for all debug counters.
5882 @item -fdbg-cnt=@var{counter-value-list}
5884 Set the internal debug counter upper bound. @var{counter-value-list}
5885 is a comma-separated list of @var{name}:@var{value} pairs
5886 which sets the upper bound of each debug counter @var{name} to @var{value}.
5887 All debug counters have the initial upper bound of @code{UINT_MAX};
5888 thus @code{dbg_cnt()} returns true always unless the upper bound
5889 is set by this option.
5890 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
5891 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
5893 @item -fenable-@var{kind}-@var{pass}
5894 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
5898 This is a set of options that are used to explicitly disable/enable
5899 optimization passes. These options are intended for use for debugging GCC.
5900 Compiler users should use regular options for enabling/disabling
5905 @item -fdisable-ipa-@var{pass}
5906 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
5907 statically invoked in the compiler multiple times, the pass name should be
5908 appended with a sequential number starting from 1.
5910 @item -fdisable-rtl-@var{pass}
5911 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
5912 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
5913 statically invoked in the compiler multiple times, the pass name should be
5914 appended with a sequential number starting from 1. @var{range-list} is a
5915 comma-separated list of function ranges or assembler names. Each range is a number
5916 pair separated by a colon. The range is inclusive in both ends. If the range
5917 is trivial, the number pair can be simplified as a single number. If the
5918 function's call graph node's @var{uid} falls within one of the specified ranges,
5919 the @var{pass} is disabled for that function. The @var{uid} is shown in the
5920 function header of a dump file, and the pass names can be dumped by using
5921 option @option{-fdump-passes}.
5923 @item -fdisable-tree-@var{pass}
5924 @itemx -fdisable-tree-@var{pass}=@var{range-list}
5925 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
5928 @item -fenable-ipa-@var{pass}
5929 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
5930 statically invoked in the compiler multiple times, the pass name should be
5931 appended with a sequential number starting from 1.
5933 @item -fenable-rtl-@var{pass}
5934 @itemx -fenable-rtl-@var{pass}=@var{range-list}
5935 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
5936 description and examples.
5938 @item -fenable-tree-@var{pass}
5939 @itemx -fenable-tree-@var{pass}=@var{range-list}
5940 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
5941 of option arguments.
5945 Here are some examples showing uses of these options.
5949 # disable ccp1 for all functions
5951 # disable complete unroll for function whose cgraph node uid is 1
5952 -fenable-tree-cunroll=1
5953 # disable gcse2 for functions at the following ranges [1,1],
5954 # [300,400], and [400,1000]
5955 # disable gcse2 for functions foo and foo2
5956 -fdisable-rtl-gcse2=foo,foo2
5957 # disable early inlining
5958 -fdisable-tree-einline
5959 # disable ipa inlining
5960 -fdisable-ipa-inline
5961 # enable tree full unroll
5962 -fenable-tree-unroll
5966 @item -d@var{letters}
5967 @itemx -fdump-rtl-@var{pass}
5968 @itemx -fdump-rtl-@var{pass}=@var{filename}
5970 @opindex fdump-rtl-@var{pass}
5971 Says to make debugging dumps during compilation at times specified by
5972 @var{letters}. This is used for debugging the RTL-based passes of the
5973 compiler. The file names for most of the dumps are made by appending
5974 a pass number and a word to the @var{dumpname}, and the files are
5975 created in the directory of the output file. In case of
5976 @option{=@var{filename}} option, the dump is output on the given file
5977 instead of the pass numbered dump files. Note that the pass number is
5978 computed statically as passes get registered into the pass manager.
5979 Thus the numbering is not related to the dynamic order of execution of
5980 passes. In particular, a pass installed by a plugin could have a
5981 number over 200 even if it executed quite early. @var{dumpname} is
5982 generated from the name of the output file, if explicitly specified
5983 and it is not an executable, otherwise it is the basename of the
5984 source file. These switches may have different effects when
5985 @option{-E} is used for preprocessing.
5987 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
5988 @option{-d} option @var{letters}. Here are the possible
5989 letters for use in @var{pass} and @var{letters}, and their meanings:
5993 @item -fdump-rtl-alignments
5994 @opindex fdump-rtl-alignments
5995 Dump after branch alignments have been computed.
5997 @item -fdump-rtl-asmcons
5998 @opindex fdump-rtl-asmcons
5999 Dump after fixing rtl statements that have unsatisfied in/out constraints.
6001 @item -fdump-rtl-auto_inc_dec
6002 @opindex fdump-rtl-auto_inc_dec
6003 Dump after auto-inc-dec discovery. This pass is only run on
6004 architectures that have auto inc or auto dec instructions.
6006 @item -fdump-rtl-barriers
6007 @opindex fdump-rtl-barriers
6008 Dump after cleaning up the barrier instructions.
6010 @item -fdump-rtl-bbpart
6011 @opindex fdump-rtl-bbpart
6012 Dump after partitioning hot and cold basic blocks.
6014 @item -fdump-rtl-bbro
6015 @opindex fdump-rtl-bbro
6016 Dump after block reordering.
6018 @item -fdump-rtl-btl1
6019 @itemx -fdump-rtl-btl2
6020 @opindex fdump-rtl-btl2
6021 @opindex fdump-rtl-btl2
6022 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
6023 after the two branch
6024 target load optimization passes.
6026 @item -fdump-rtl-bypass
6027 @opindex fdump-rtl-bypass
6028 Dump after jump bypassing and control flow optimizations.
6030 @item -fdump-rtl-combine
6031 @opindex fdump-rtl-combine
6032 Dump after the RTL instruction combination pass.
6034 @item -fdump-rtl-compgotos
6035 @opindex fdump-rtl-compgotos
6036 Dump after duplicating the computed gotos.
6038 @item -fdump-rtl-ce1
6039 @itemx -fdump-rtl-ce2
6040 @itemx -fdump-rtl-ce3
6041 @opindex fdump-rtl-ce1
6042 @opindex fdump-rtl-ce2
6043 @opindex fdump-rtl-ce3
6044 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
6045 @option{-fdump-rtl-ce3} enable dumping after the three
6046 if conversion passes.
6048 @item -fdump-rtl-cprop_hardreg
6049 @opindex fdump-rtl-cprop_hardreg
6050 Dump after hard register copy propagation.
6052 @item -fdump-rtl-csa
6053 @opindex fdump-rtl-csa
6054 Dump after combining stack adjustments.
6056 @item -fdump-rtl-cse1
6057 @itemx -fdump-rtl-cse2
6058 @opindex fdump-rtl-cse1
6059 @opindex fdump-rtl-cse2
6060 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
6061 the two common subexpression elimination passes.
6063 @item -fdump-rtl-dce
6064 @opindex fdump-rtl-dce
6065 Dump after the standalone dead code elimination passes.
6067 @item -fdump-rtl-dbr
6068 @opindex fdump-rtl-dbr
6069 Dump after delayed branch scheduling.
6071 @item -fdump-rtl-dce1
6072 @itemx -fdump-rtl-dce2
6073 @opindex fdump-rtl-dce1
6074 @opindex fdump-rtl-dce2
6075 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
6076 the two dead store elimination passes.
6079 @opindex fdump-rtl-eh
6080 Dump after finalization of EH handling code.
6082 @item -fdump-rtl-eh_ranges
6083 @opindex fdump-rtl-eh_ranges
6084 Dump after conversion of EH handling range regions.
6086 @item -fdump-rtl-expand
6087 @opindex fdump-rtl-expand
6088 Dump after RTL generation.
6090 @item -fdump-rtl-fwprop1
6091 @itemx -fdump-rtl-fwprop2
6092 @opindex fdump-rtl-fwprop1
6093 @opindex fdump-rtl-fwprop2
6094 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
6095 dumping after the two forward propagation passes.
6097 @item -fdump-rtl-gcse1
6098 @itemx -fdump-rtl-gcse2
6099 @opindex fdump-rtl-gcse1
6100 @opindex fdump-rtl-gcse2
6101 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
6102 after global common subexpression elimination.
6104 @item -fdump-rtl-init-regs
6105 @opindex fdump-rtl-init-regs
6106 Dump after the initialization of the registers.
6108 @item -fdump-rtl-initvals
6109 @opindex fdump-rtl-initvals
6110 Dump after the computation of the initial value sets.
6112 @item -fdump-rtl-into_cfglayout
6113 @opindex fdump-rtl-into_cfglayout
6114 Dump after converting to cfglayout mode.
6116 @item -fdump-rtl-ira
6117 @opindex fdump-rtl-ira
6118 Dump after iterated register allocation.
6120 @item -fdump-rtl-jump
6121 @opindex fdump-rtl-jump
6122 Dump after the second jump optimization.
6124 @item -fdump-rtl-loop2
6125 @opindex fdump-rtl-loop2
6126 @option{-fdump-rtl-loop2} enables dumping after the rtl
6127 loop optimization passes.
6129 @item -fdump-rtl-mach
6130 @opindex fdump-rtl-mach
6131 Dump after performing the machine dependent reorganization pass, if that
6134 @item -fdump-rtl-mode_sw
6135 @opindex fdump-rtl-mode_sw
6136 Dump after removing redundant mode switches.
6138 @item -fdump-rtl-rnreg
6139 @opindex fdump-rtl-rnreg
6140 Dump after register renumbering.
6142 @item -fdump-rtl-outof_cfglayout
6143 @opindex fdump-rtl-outof_cfglayout
6144 Dump after converting from cfglayout mode.
6146 @item -fdump-rtl-peephole2
6147 @opindex fdump-rtl-peephole2
6148 Dump after the peephole pass.
6150 @item -fdump-rtl-postreload
6151 @opindex fdump-rtl-postreload
6152 Dump after post-reload optimizations.
6154 @item -fdump-rtl-pro_and_epilogue
6155 @opindex fdump-rtl-pro_and_epilogue
6156 Dump after generating the function prologues and epilogues.
6158 @item -fdump-rtl-sched1
6159 @itemx -fdump-rtl-sched2
6160 @opindex fdump-rtl-sched1
6161 @opindex fdump-rtl-sched2
6162 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
6163 after the basic block scheduling passes.
6165 @item -fdump-rtl-ree
6166 @opindex fdump-rtl-ree
6167 Dump after sign/zero extension elimination.
6169 @item -fdump-rtl-seqabstr
6170 @opindex fdump-rtl-seqabstr
6171 Dump after common sequence discovery.
6173 @item -fdump-rtl-shorten
6174 @opindex fdump-rtl-shorten
6175 Dump after shortening branches.
6177 @item -fdump-rtl-sibling
6178 @opindex fdump-rtl-sibling
6179 Dump after sibling call optimizations.
6181 @item -fdump-rtl-split1
6182 @itemx -fdump-rtl-split2
6183 @itemx -fdump-rtl-split3
6184 @itemx -fdump-rtl-split4
6185 @itemx -fdump-rtl-split5
6186 @opindex fdump-rtl-split1
6187 @opindex fdump-rtl-split2
6188 @opindex fdump-rtl-split3
6189 @opindex fdump-rtl-split4
6190 @opindex fdump-rtl-split5
6191 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
6192 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
6193 @option{-fdump-rtl-split5} enable dumping after five rounds of
6194 instruction splitting.
6196 @item -fdump-rtl-sms
6197 @opindex fdump-rtl-sms
6198 Dump after modulo scheduling. This pass is only run on some
6201 @item -fdump-rtl-stack
6202 @opindex fdump-rtl-stack
6203 Dump after conversion from GCC's ``flat register file'' registers to the
6204 x87's stack-like registers. This pass is only run on x86 variants.
6206 @item -fdump-rtl-subreg1
6207 @itemx -fdump-rtl-subreg2
6208 @opindex fdump-rtl-subreg1
6209 @opindex fdump-rtl-subreg2
6210 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
6211 the two subreg expansion passes.
6213 @item -fdump-rtl-unshare
6214 @opindex fdump-rtl-unshare
6215 Dump after all rtl has been unshared.
6217 @item -fdump-rtl-vartrack
6218 @opindex fdump-rtl-vartrack
6219 Dump after variable tracking.
6221 @item -fdump-rtl-vregs
6222 @opindex fdump-rtl-vregs
6223 Dump after converting virtual registers to hard registers.
6225 @item -fdump-rtl-web
6226 @opindex fdump-rtl-web
6227 Dump after live range splitting.
6229 @item -fdump-rtl-regclass
6230 @itemx -fdump-rtl-subregs_of_mode_init
6231 @itemx -fdump-rtl-subregs_of_mode_finish
6232 @itemx -fdump-rtl-dfinit
6233 @itemx -fdump-rtl-dfinish
6234 @opindex fdump-rtl-regclass
6235 @opindex fdump-rtl-subregs_of_mode_init
6236 @opindex fdump-rtl-subregs_of_mode_finish
6237 @opindex fdump-rtl-dfinit
6238 @opindex fdump-rtl-dfinish
6239 These dumps are defined but always produce empty files.
6242 @itemx -fdump-rtl-all
6244 @opindex fdump-rtl-all
6245 Produce all the dumps listed above.
6249 Annotate the assembler output with miscellaneous debugging information.
6253 Dump all macro definitions, at the end of preprocessing, in addition to
6258 Produce a core dump whenever an error occurs.
6262 Annotate the assembler output with a comment indicating which
6263 pattern and alternative is used. The length of each instruction is
6268 Dump the RTL in the assembler output as a comment before each instruction.
6269 Also turns on @option{-dp} annotation.
6273 Just generate RTL for a function instead of compiling it. Usually used
6274 with @option{-fdump-rtl-expand}.
6278 @opindex fdump-noaddr
6279 When doing debugging dumps, suppress address output. This makes it more
6280 feasible to use diff on debugging dumps for compiler invocations with
6281 different compiler binaries and/or different
6282 text / bss / data / heap / stack / dso start locations.
6284 @item -fdump-unnumbered
6285 @opindex fdump-unnumbered
6286 When doing debugging dumps, suppress instruction numbers and address output.
6287 This makes it more feasible to use diff on debugging dumps for compiler
6288 invocations with different options, in particular with and without
6291 @item -fdump-unnumbered-links
6292 @opindex fdump-unnumbered-links
6293 When doing debugging dumps (see @option{-d} option above), suppress
6294 instruction numbers for the links to the previous and next instructions
6297 @item -fdump-translation-unit @r{(C++ only)}
6298 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
6299 @opindex fdump-translation-unit
6300 Dump a representation of the tree structure for the entire translation
6301 unit to a file. The file name is made by appending @file{.tu} to the
6302 source file name, and the file is created in the same directory as the
6303 output file. If the @samp{-@var{options}} form is used, @var{options}
6304 controls the details of the dump as described for the
6305 @option{-fdump-tree} options.
6307 @item -fdump-class-hierarchy @r{(C++ only)}
6308 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
6309 @opindex fdump-class-hierarchy
6310 Dump a representation of each class's hierarchy and virtual function
6311 table layout to a file. The file name is made by appending
6312 @file{.class} to the source file name, and the file is created in the
6313 same directory as the output file. If the @samp{-@var{options}} form
6314 is used, @var{options} controls the details of the dump as described
6315 for the @option{-fdump-tree} options.
6317 @item -fdump-ipa-@var{switch}
6319 Control the dumping at various stages of inter-procedural analysis
6320 language tree to a file. The file name is generated by appending a
6321 switch specific suffix to the source file name, and the file is created
6322 in the same directory as the output file. The following dumps are
6327 Enables all inter-procedural analysis dumps.
6330 Dumps information about call-graph optimization, unused function removal,
6331 and inlining decisions.
6334 Dump after function inlining.
6339 @opindex fdump-passes
6340 Dump the list of optimization passes that are turned on and off by
6341 the current command-line options.
6343 @item -fdump-statistics-@var{option}
6344 @opindex fdump-statistics
6345 Enable and control dumping of pass statistics in a separate file. The
6346 file name is generated by appending a suffix ending in
6347 @samp{.statistics} to the source file name, and the file is created in
6348 the same directory as the output file. If the @samp{-@var{option}}
6349 form is used, @samp{-stats} causes counters to be summed over the
6350 whole compilation unit while @samp{-details} dumps every event as
6351 the passes generate them. The default with no option is to sum
6352 counters for each function compiled.
6354 @item -fdump-tree-@var{switch}
6355 @itemx -fdump-tree-@var{switch}-@var{options}
6356 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
6358 Control the dumping at various stages of processing the intermediate
6359 language tree to a file. The file name is generated by appending a
6360 switch-specific suffix to the source file name, and the file is
6361 created in the same directory as the output file. In case of
6362 @option{=@var{filename}} option, the dump is output on the given file
6363 instead of the auto named dump files. If the @samp{-@var{options}}
6364 form is used, @var{options} is a list of @samp{-} separated options
6365 which control the details of the dump. Not all options are applicable
6366 to all dumps; those that are not meaningful are ignored. The
6367 following options are available
6371 Print the address of each node. Usually this is not meaningful as it
6372 changes according to the environment and source file. Its primary use
6373 is for tying up a dump file with a debug environment.
6375 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
6376 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
6377 use working backward from mangled names in the assembly file.
6379 When dumping front-end intermediate representations, inhibit dumping
6380 of members of a scope or body of a function merely because that scope
6381 has been reached. Only dump such items when they are directly reachable
6384 When dumping pretty-printed trees, this option inhibits dumping the
6385 bodies of control structures.
6387 When dumping RTL, print the RTL in slim (condensed) form instead of
6388 the default LISP-like representation.
6390 Print a raw representation of the tree. By default, trees are
6391 pretty-printed into a C-like representation.
6393 Enable more detailed dumps (not honored by every dump option). Also
6394 include information from the optimization passes.
6396 Enable dumping various statistics about the pass (not honored by every dump
6399 Enable showing basic block boundaries (disabled in raw dumps).
6401 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
6402 dump a representation of the control flow graph suitable for viewing with
6403 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
6404 the file is pretty-printed as a subgraph, so that GraphViz can render them
6405 all in a single plot.
6407 This option currently only works for RTL dumps, and the RTL is always
6408 dumped in slim form.
6410 Enable showing virtual operands for every statement.
6412 Enable showing line numbers for statements.
6414 Enable showing the unique ID (@code{DECL_UID}) for each variable.
6416 Enable showing the tree dump for each statement.
6418 Enable showing the EH region number holding each statement.
6420 Enable showing scalar evolution analysis details.
6422 Enable showing optimization information (only available in certain
6425 Enable showing missed optimization information (only available in certain
6428 Enable other detailed optimization information (only available in
6430 @item =@var{filename}
6431 Instead of an auto named dump file, output into the given file
6432 name. The file names @file{stdout} and @file{stderr} are treated
6433 specially and are considered already open standard streams. For
6437 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
6438 -fdump-tree-pre=stderr file.c
6441 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
6442 output on to @file{stderr}. If two conflicting dump filenames are
6443 given for the same pass, then the latter option overrides the earlier
6447 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
6448 and @option{lineno}.
6451 Turn on all optimization options, i.e., @option{optimized},
6452 @option{missed}, and @option{note}.
6455 The following tree dumps are possible:
6459 @opindex fdump-tree-original
6460 Dump before any tree based optimization, to @file{@var{file}.original}.
6463 @opindex fdump-tree-optimized
6464 Dump after all tree based optimization, to @file{@var{file}.optimized}.
6467 @opindex fdump-tree-gimple
6468 Dump each function before and after the gimplification pass to a file. The
6469 file name is made by appending @file{.gimple} to the source file name.
6472 @opindex fdump-tree-cfg
6473 Dump the control flow graph of each function to a file. The file name is
6474 made by appending @file{.cfg} to the source file name.
6477 @opindex fdump-tree-ch
6478 Dump each function after copying loop headers. The file name is made by
6479 appending @file{.ch} to the source file name.
6482 @opindex fdump-tree-ssa
6483 Dump SSA related information to a file. The file name is made by appending
6484 @file{.ssa} to the source file name.
6487 @opindex fdump-tree-alias
6488 Dump aliasing information for each function. The file name is made by
6489 appending @file{.alias} to the source file name.
6492 @opindex fdump-tree-ccp
6493 Dump each function after CCP@. The file name is made by appending
6494 @file{.ccp} to the source file name.
6497 @opindex fdump-tree-storeccp
6498 Dump each function after STORE-CCP@. The file name is made by appending
6499 @file{.storeccp} to the source file name.
6502 @opindex fdump-tree-pre
6503 Dump trees after partial redundancy elimination. The file name is made
6504 by appending @file{.pre} to the source file name.
6507 @opindex fdump-tree-fre
6508 Dump trees after full redundancy elimination. The file name is made
6509 by appending @file{.fre} to the source file name.
6512 @opindex fdump-tree-copyprop
6513 Dump trees after copy propagation. The file name is made
6514 by appending @file{.copyprop} to the source file name.
6516 @item store_copyprop
6517 @opindex fdump-tree-store_copyprop
6518 Dump trees after store copy-propagation. The file name is made
6519 by appending @file{.store_copyprop} to the source file name.
6522 @opindex fdump-tree-dce
6523 Dump each function after dead code elimination. The file name is made by
6524 appending @file{.dce} to the source file name.
6527 @opindex fdump-tree-sra
6528 Dump each function after performing scalar replacement of aggregates. The
6529 file name is made by appending @file{.sra} to the source file name.
6532 @opindex fdump-tree-sink
6533 Dump each function after performing code sinking. The file name is made
6534 by appending @file{.sink} to the source file name.
6537 @opindex fdump-tree-dom
6538 Dump each function after applying dominator tree optimizations. The file
6539 name is made by appending @file{.dom} to the source file name.
6542 @opindex fdump-tree-dse
6543 Dump each function after applying dead store elimination. The file
6544 name is made by appending @file{.dse} to the source file name.
6547 @opindex fdump-tree-phiopt
6548 Dump each function after optimizing PHI nodes into straightline code. The file
6549 name is made by appending @file{.phiopt} to the source file name.
6552 @opindex fdump-tree-forwprop
6553 Dump each function after forward propagating single use variables. The file
6554 name is made by appending @file{.forwprop} to the source file name.
6557 @opindex fdump-tree-copyrename
6558 Dump each function after applying the copy rename optimization. The file
6559 name is made by appending @file{.copyrename} to the source file name.
6562 @opindex fdump-tree-nrv
6563 Dump each function after applying the named return value optimization on
6564 generic trees. The file name is made by appending @file{.nrv} to the source
6568 @opindex fdump-tree-vect
6569 Dump each function after applying vectorization of loops. The file name is
6570 made by appending @file{.vect} to the source file name.
6573 @opindex fdump-tree-slp
6574 Dump each function after applying vectorization of basic blocks. The file name
6575 is made by appending @file{.slp} to the source file name.
6578 @opindex fdump-tree-vrp
6579 Dump each function after Value Range Propagation (VRP). The file name
6580 is made by appending @file{.vrp} to the source file name.
6583 @opindex fdump-tree-all
6584 Enable all the available tree dumps with the flags provided in this option.
6588 @itemx -fopt-info-@var{options}
6589 @itemx -fopt-info-@var{options}=@var{filename}
6591 Controls optimization dumps from various optimization passes. If the
6592 @samp{-@var{options}} form is used, @var{options} is a list of
6593 @samp{-} separated options to select the dump details and
6594 optimizations. If @var{options} is not specified, it defaults to
6595 @option{optimized} for details and @option{optall} for optimization
6596 groups. If the @var{filename} is not specified, it defaults to
6597 @file{stderr}. Note that the output @var{filename} will be overwritten
6598 in case of multiple translation units. If a combined output from
6599 multiple translation units is desired, @file{stderr} should be used
6602 The options can be divided into two groups, 1) options describing the
6603 verbosity of the dump, and 2) options describing which optimizations
6604 should be included. The options from both the groups can be freely
6605 mixed as they are non-overlapping. However, in case of any conflicts,
6606 the latter options override the earlier options on the command
6607 line. Though multiple -fopt-info options are accepted, only one of
6608 them can have @option{=filename}. If other filenames are provided then
6609 all but the first one are ignored.
6611 The dump verbosity has the following options
6615 Print information when an optimization is successfully applied. It is
6616 up to a pass to decide which information is relevant. For example, the
6617 vectorizer passes print the source location of loops which got
6618 successfully vectorized.
6620 Print information about missed optimizations. Individual passes
6621 control which information to include in the output. For example,
6624 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
6627 will print information about missed optimization opportunities from
6628 vectorization passes on stderr.
6630 Print verbose information about optimizations, such as certain
6631 transformations, more detailed messages about decisions etc.
6633 Print detailed optimization information. This includes
6634 @var{optimized}, @var{missed}, and @var{note}.
6637 The second set of options describes a group of optimizations and may
6638 include one or more of the following.
6642 Enable dumps from all interprocedural optimizations.
6644 Enable dumps from all loop optimizations.
6646 Enable dumps from all inlining optimizations.
6648 Enable dumps from all vectorization optimizations.
6650 Enable dumps from all optimizations. This is a superset of
6651 the optimization groups listed above.
6656 gcc -O3 -fopt-info-missed=missed.all
6659 outputs missed optimization report from all the passes into
6664 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
6667 will output information about missed optimizations as well as
6668 optimized locations from all the inlining passes into
6671 If the @var{filename} is provided, then the dumps from all the
6672 applicable optimizations are concatenated into the @file{filename}.
6673 Otherwise the dump is output onto @file{stderr}. If @var{options} is
6674 omitted, it defaults to @option{all-optall}, which means dump all
6675 available optimization info from all the passes. In the following
6676 example, all optimization info is output on to @file{stderr}.
6682 Note that @option{-fopt-info-vec-missed} behaves the same as
6683 @option{-fopt-info-missed-vec}.
6685 As another example, consider
6688 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
6691 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
6692 in conflict since only one output file is allowed. In this case, only
6693 the first option takes effect and the subsequent options are
6694 ignored. Thus only the @file{vec.miss} is produced which contains
6695 dumps from the vectorizer about missed opportunities.
6697 @item -frandom-seed=@var{string}
6698 @opindex frandom-seed
6699 This option provides a seed that GCC uses in place of
6700 random numbers in generating certain symbol names
6701 that have to be different in every compiled file. It is also used to
6702 place unique stamps in coverage data files and the object files that
6703 produce them. You can use the @option{-frandom-seed} option to produce
6704 reproducibly identical object files.
6706 The @var{string} should be different for every file you compile.
6708 @item -fsched-verbose=@var{n}
6709 @opindex fsched-verbose
6710 On targets that use instruction scheduling, this option controls the
6711 amount of debugging output the scheduler prints. This information is
6712 written to standard error, unless @option{-fdump-rtl-sched1} or
6713 @option{-fdump-rtl-sched2} is specified, in which case it is output
6714 to the usual dump listing file, @file{.sched1} or @file{.sched2}
6715 respectively. However for @var{n} greater than nine, the output is
6716 always printed to standard error.
6718 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
6719 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
6720 For @var{n} greater than one, it also output basic block probabilities,
6721 detailed ready list information and unit/insn info. For @var{n} greater
6722 than two, it includes RTL at abort point, control-flow and regions info.
6723 And for @var{n} over four, @option{-fsched-verbose} also includes
6727 @itemx -save-temps=cwd
6729 Store the usual ``temporary'' intermediate files permanently; place them
6730 in the current directory and name them based on the source file. Thus,
6731 compiling @file{foo.c} with @option{-c -save-temps} produces files
6732 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
6733 preprocessed @file{foo.i} output file even though the compiler now
6734 normally uses an integrated preprocessor.
6736 When used in combination with the @option{-x} command-line option,
6737 @option{-save-temps} is sensible enough to avoid over writing an
6738 input source file with the same extension as an intermediate file.
6739 The corresponding intermediate file may be obtained by renaming the
6740 source file before using @option{-save-temps}.
6742 If you invoke GCC in parallel, compiling several different source
6743 files that share a common base name in different subdirectories or the
6744 same source file compiled for multiple output destinations, it is
6745 likely that the different parallel compilers will interfere with each
6746 other, and overwrite the temporary files. For instance:
6749 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
6750 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
6753 may result in @file{foo.i} and @file{foo.o} being written to
6754 simultaneously by both compilers.
6756 @item -save-temps=obj
6757 @opindex save-temps=obj
6758 Store the usual ``temporary'' intermediate files permanently. If the
6759 @option{-o} option is used, the temporary files are based on the
6760 object file. If the @option{-o} option is not used, the
6761 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
6766 gcc -save-temps=obj -c foo.c
6767 gcc -save-temps=obj -c bar.c -o dir/xbar.o
6768 gcc -save-temps=obj foobar.c -o dir2/yfoobar
6772 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
6773 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
6774 @file{dir2/yfoobar.o}.
6776 @item -time@r{[}=@var{file}@r{]}
6778 Report the CPU time taken by each subprocess in the compilation
6779 sequence. For C source files, this is the compiler proper and assembler
6780 (plus the linker if linking is done).
6782 Without the specification of an output file, the output looks like this:
6789 The first number on each line is the ``user time'', that is time spent
6790 executing the program itself. The second number is ``system time'',
6791 time spent executing operating system routines on behalf of the program.
6792 Both numbers are in seconds.
6794 With the specification of an output file, the output is appended to the
6795 named file, and it looks like this:
6798 0.12 0.01 cc1 @var{options}
6799 0.00 0.01 as @var{options}
6802 The ``user time'' and the ``system time'' are moved before the program
6803 name, and the options passed to the program are displayed, so that one
6804 can later tell what file was being compiled, and with which options.
6806 @item -fvar-tracking
6807 @opindex fvar-tracking
6808 Run variable tracking pass. It computes where variables are stored at each
6809 position in code. Better debugging information is then generated
6810 (if the debugging information format supports this information).
6812 It is enabled by default when compiling with optimization (@option{-Os},
6813 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6814 the debug info format supports it.
6816 @item -fvar-tracking-assignments
6817 @opindex fvar-tracking-assignments
6818 @opindex fno-var-tracking-assignments
6819 Annotate assignments to user variables early in the compilation and
6820 attempt to carry the annotations over throughout the compilation all the
6821 way to the end, in an attempt to improve debug information while
6822 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6824 It can be enabled even if var-tracking is disabled, in which case
6825 annotations are created and maintained, but discarded at the end.
6827 @item -fvar-tracking-assignments-toggle
6828 @opindex fvar-tracking-assignments-toggle
6829 @opindex fno-var-tracking-assignments-toggle
6830 Toggle @option{-fvar-tracking-assignments}, in the same way that
6831 @option{-gtoggle} toggles @option{-g}.
6833 @item -print-file-name=@var{library}
6834 @opindex print-file-name
6835 Print the full absolute name of the library file @var{library} that
6836 would be used when linking---and don't do anything else. With this
6837 option, GCC does not compile or link anything; it just prints the
6840 @item -print-multi-directory
6841 @opindex print-multi-directory
6842 Print the directory name corresponding to the multilib selected by any
6843 other switches present in the command line. This directory is supposed
6844 to exist in @env{GCC_EXEC_PREFIX}.
6846 @item -print-multi-lib
6847 @opindex print-multi-lib
6848 Print the mapping from multilib directory names to compiler switches
6849 that enable them. The directory name is separated from the switches by
6850 @samp{;}, and each switch starts with an @samp{@@} instead of the
6851 @samp{-}, without spaces between multiple switches. This is supposed to
6852 ease shell processing.
6854 @item -print-multi-os-directory
6855 @opindex print-multi-os-directory
6856 Print the path to OS libraries for the selected
6857 multilib, relative to some @file{lib} subdirectory. If OS libraries are
6858 present in the @file{lib} subdirectory and no multilibs are used, this is
6859 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
6860 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
6861 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
6862 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
6864 @item -print-multiarch
6865 @opindex print-multiarch
6866 Print the path to OS libraries for the selected multiarch,
6867 relative to some @file{lib} subdirectory.
6869 @item -print-prog-name=@var{program}
6870 @opindex print-prog-name
6871 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
6873 @item -print-libgcc-file-name
6874 @opindex print-libgcc-file-name
6875 Same as @option{-print-file-name=libgcc.a}.
6877 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
6878 but you do want to link with @file{libgcc.a}. You can do:
6881 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
6884 @item -print-search-dirs
6885 @opindex print-search-dirs
6886 Print the name of the configured installation directory and a list of
6887 program and library directories @command{gcc} searches---and don't do anything else.
6889 This is useful when @command{gcc} prints the error message
6890 @samp{installation problem, cannot exec cpp0: No such file or directory}.
6891 To resolve this you either need to put @file{cpp0} and the other compiler
6892 components where @command{gcc} expects to find them, or you can set the environment
6893 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
6894 Don't forget the trailing @samp{/}.
6895 @xref{Environment Variables}.
6897 @item -print-sysroot
6898 @opindex print-sysroot
6899 Print the target sysroot directory that is used during
6900 compilation. This is the target sysroot specified either at configure
6901 time or using the @option{--sysroot} option, possibly with an extra
6902 suffix that depends on compilation options. If no target sysroot is
6903 specified, the option prints nothing.
6905 @item -print-sysroot-headers-suffix
6906 @opindex print-sysroot-headers-suffix
6907 Print the suffix added to the target sysroot when searching for
6908 headers, or give an error if the compiler is not configured with such
6909 a suffix---and don't do anything else.
6912 @opindex dumpmachine
6913 Print the compiler's target machine (for example,
6914 @samp{i686-pc-linux-gnu})---and don't do anything else.
6917 @opindex dumpversion
6918 Print the compiler version (for example, @samp{3.0})---and don't do
6923 Print the compiler's built-in specs---and don't do anything else. (This
6924 is used when GCC itself is being built.) @xref{Spec Files}.
6926 @item -fno-eliminate-unused-debug-types
6927 @opindex feliminate-unused-debug-types
6928 @opindex fno-eliminate-unused-debug-types
6929 Normally, when producing DWARF 2 output, GCC avoids producing debug symbol
6930 output for types that are nowhere used in the source file being compiled.
6931 Sometimes it is useful to have GCC emit debugging
6932 information for all types declared in a compilation
6933 unit, regardless of whether or not they are actually used
6934 in that compilation unit, for example
6935 if, in the debugger, you want to cast a value to a type that is
6936 not actually used in your program (but is declared). More often,
6937 however, this results in a significant amount of wasted space.
6940 @node Optimize Options
6941 @section Options That Control Optimization
6942 @cindex optimize options
6943 @cindex options, optimization
6945 These options control various sorts of optimizations.
6947 Without any optimization option, the compiler's goal is to reduce the
6948 cost of compilation and to make debugging produce the expected
6949 results. Statements are independent: if you stop the program with a
6950 breakpoint between statements, you can then assign a new value to any
6951 variable or change the program counter to any other statement in the
6952 function and get exactly the results you expect from the source
6955 Turning on optimization flags makes the compiler attempt to improve
6956 the performance and/or code size at the expense of compilation time
6957 and possibly the ability to debug the program.
6959 The compiler performs optimization based on the knowledge it has of the
6960 program. Compiling multiple files at once to a single output file mode allows
6961 the compiler to use information gained from all of the files when compiling
6964 Not all optimizations are controlled directly by a flag. Only
6965 optimizations that have a flag are listed in this section.
6967 Most optimizations are only enabled if an @option{-O} level is set on
6968 the command line. Otherwise they are disabled, even if individual
6969 optimization flags are specified.
6971 Depending on the target and how GCC was configured, a slightly different
6972 set of optimizations may be enabled at each @option{-O} level than
6973 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6974 to find out the exact set of optimizations that are enabled at each level.
6975 @xref{Overall Options}, for examples.
6982 Optimize. Optimizing compilation takes somewhat more time, and a lot
6983 more memory for a large function.
6985 With @option{-O}, the compiler tries to reduce code size and execution
6986 time, without performing any optimizations that take a great deal of
6989 @option{-O} turns on the following optimization flags:
6992 -fbranch-count-reg @gol
6993 -fcombine-stack-adjustments @gol
6995 -fcprop-registers @gol
6998 -fdelayed-branch @gol
7000 -fforward-propagate @gol
7001 -fguess-branch-probability @gol
7002 -fif-conversion2 @gol
7003 -fif-conversion @gol
7004 -finline-functions-called-once @gol
7005 -fipa-pure-const @gol
7007 -fipa-reference @gol
7008 -fmerge-constants @gol
7009 -fmove-loop-invariants @gol
7011 -fsplit-wide-types @gol
7016 -ftree-copy-prop @gol
7017 -ftree-copyrename @gol
7019 -ftree-dominator-opts @gol
7021 -ftree-forwprop @gol
7031 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
7032 where doing so does not interfere with debugging.
7036 Optimize even more. GCC performs nearly all supported optimizations
7037 that do not involve a space-speed tradeoff.
7038 As compared to @option{-O}, this option increases both compilation time
7039 and the performance of the generated code.
7041 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7042 also turns on the following optimization flags:
7043 @gccoptlist{-fthread-jumps @gol
7044 -falign-functions -falign-jumps @gol
7045 -falign-loops -falign-labels @gol
7048 -fcse-follow-jumps -fcse-skip-blocks @gol
7049 -fdelete-null-pointer-checks @gol
7050 -fdevirtualize -fdevirtualize-speculatively @gol
7051 -fexpensive-optimizations @gol
7052 -fgcse -fgcse-lm @gol
7053 -fhoist-adjacent-loads @gol
7054 -finline-small-functions @gol
7055 -findirect-inlining @gol
7058 -fisolate-erroneous-paths-dereference @gol
7059 -foptimize-sibling-calls @gol
7060 -foptimize-strlen @gol
7061 -fpartial-inlining @gol
7063 -freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
7064 -frerun-cse-after-loop @gol
7065 -fsched-interblock -fsched-spec @gol
7066 -fschedule-insns -fschedule-insns2 @gol
7067 -fstrict-aliasing -fstrict-overflow @gol
7068 -ftree-builtin-call-dce @gol
7069 -ftree-switch-conversion -ftree-tail-merge @gol
7074 Please note the warning under @option{-fgcse} about
7075 invoking @option{-O2} on programs that use computed gotos.
7079 Optimize yet more. @option{-O3} turns on all optimizations specified
7080 by @option{-O2} and also turns on the @option{-finline-functions},
7081 @option{-funswitch-loops}, @option{-fpredictive-commoning},
7082 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
7083 @option{-ftree-loop-distribute-patterns},
7084 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
7085 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
7089 Reduce compilation time and make debugging produce the expected
7090 results. This is the default.
7094 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7095 do not typically increase code size. It also performs further
7096 optimizations designed to reduce code size.
7098 @option{-Os} disables the following optimization flags:
7099 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7100 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
7101 -fprefetch-loop-arrays}
7105 Disregard strict standards compliance. @option{-Ofast} enables all
7106 @option{-O3} optimizations. It also enables optimizations that are not
7107 valid for all standard-compliant programs.
7108 It turns on @option{-ffast-math} and the Fortran-specific
7109 @option{-fno-protect-parens} and @option{-fstack-arrays}.
7113 Optimize debugging experience. @option{-Og} enables optimizations
7114 that do not interfere with debugging. It should be the optimization
7115 level of choice for the standard edit-compile-debug cycle, offering
7116 a reasonable level of optimization while maintaining fast compilation
7117 and a good debugging experience.
7119 If you use multiple @option{-O} options, with or without level numbers,
7120 the last such option is the one that is effective.
7123 Options of the form @option{-f@var{flag}} specify machine-independent
7124 flags. Most flags have both positive and negative forms; the negative
7125 form of @option{-ffoo} is @option{-fno-foo}. In the table
7126 below, only one of the forms is listed---the one you typically
7127 use. You can figure out the other form by either removing @samp{no-}
7130 The following options control specific optimizations. They are either
7131 activated by @option{-O} options or are related to ones that are. You
7132 can use the following flags in the rare cases when ``fine-tuning'' of
7133 optimizations to be performed is desired.
7136 @item -fno-defer-pop
7137 @opindex fno-defer-pop
7138 Always pop the arguments to each function call as soon as that function
7139 returns. For machines that must pop arguments after a function call,
7140 the compiler normally lets arguments accumulate on the stack for several
7141 function calls and pops them all at once.
7143 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7145 @item -fforward-propagate
7146 @opindex fforward-propagate
7147 Perform a forward propagation pass on RTL@. The pass tries to combine two
7148 instructions and checks if the result can be simplified. If loop unrolling
7149 is active, two passes are performed and the second is scheduled after
7152 This option is enabled by default at optimization levels @option{-O},
7153 @option{-O2}, @option{-O3}, @option{-Os}.
7155 @item -ffp-contract=@var{style}
7156 @opindex ffp-contract
7157 @option{-ffp-contract=off} disables floating-point expression contraction.
7158 @option{-ffp-contract=fast} enables floating-point expression contraction
7159 such as forming of fused multiply-add operations if the target has
7160 native support for them.
7161 @option{-ffp-contract=on} enables floating-point expression contraction
7162 if allowed by the language standard. This is currently not implemented
7163 and treated equal to @option{-ffp-contract=off}.
7165 The default is @option{-ffp-contract=fast}.
7167 @item -fomit-frame-pointer
7168 @opindex fomit-frame-pointer
7169 Don't keep the frame pointer in a register for functions that
7170 don't need one. This avoids the instructions to save, set up and
7171 restore frame pointers; it also makes an extra register available
7172 in many functions. @strong{It also makes debugging impossible on
7175 On some machines, such as the VAX, this flag has no effect, because
7176 the standard calling sequence automatically handles the frame pointer
7177 and nothing is saved by pretending it doesn't exist. The
7178 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7179 whether a target machine supports this flag. @xref{Registers,,Register
7180 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7182 Starting with GCC version 4.6, the default setting (when not optimizing for
7183 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets has been changed to
7184 @option{-fomit-frame-pointer}. The default can be reverted to
7185 @option{-fno-omit-frame-pointer} by configuring GCC with the
7186 @option{--enable-frame-pointer} configure option.
7188 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7190 @item -foptimize-sibling-calls
7191 @opindex foptimize-sibling-calls
7192 Optimize sibling and tail recursive calls.
7194 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7196 @item -foptimize-strlen
7197 @opindex foptimize-strlen
7198 Optimize various standard C string functions (e.g. @code{strlen},
7199 @code{strchr} or @code{strcpy}) and
7200 their _FORTIFY_SOURCE counterparts into faster alternatives.
7202 Enabled at levels @option{-O2}, @option{-O3}.
7206 Do not expand any functions inline apart from those marked with
7207 the @code{always_inline} attribute. This is the default when not
7210 Single functions can be exempted from inlining by marking them
7211 with the @code{noinline} attribute.
7213 @item -finline-small-functions
7214 @opindex finline-small-functions
7215 Integrate functions into their callers when their body is smaller than expected
7216 function call code (so overall size of program gets smaller). The compiler
7217 heuristically decides which functions are simple enough to be worth integrating
7218 in this way. This inlining applies to all functions, even those not declared
7221 Enabled at level @option{-O2}.
7223 @item -findirect-inlining
7224 @opindex findirect-inlining
7225 Inline also indirect calls that are discovered to be known at compile
7226 time thanks to previous inlining. This option has any effect only
7227 when inlining itself is turned on by the @option{-finline-functions}
7228 or @option{-finline-small-functions} options.
7230 Enabled at level @option{-O2}.
7232 @item -finline-functions
7233 @opindex finline-functions
7234 Consider all functions for inlining, even if they are not declared inline.
7235 The compiler heuristically decides which functions are worth integrating
7238 If all calls to a given function are integrated, and the function is
7239 declared @code{static}, then the function is normally not output as
7240 assembler code in its own right.
7242 Enabled at level @option{-O3}.
7244 @item -finline-functions-called-once
7245 @opindex finline-functions-called-once
7246 Consider all @code{static} functions called once for inlining into their
7247 caller even if they are not marked @code{inline}. If a call to a given
7248 function is integrated, then the function is not output as assembler code
7251 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7253 @item -fearly-inlining
7254 @opindex fearly-inlining
7255 Inline functions marked by @code{always_inline} and functions whose body seems
7256 smaller than the function call overhead early before doing
7257 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7258 makes profiling significantly cheaper and usually inlining faster on programs
7259 having large chains of nested wrapper functions.
7265 Perform interprocedural scalar replacement of aggregates, removal of
7266 unused parameters and replacement of parameters passed by reference
7267 by parameters passed by value.
7269 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7271 @item -finline-limit=@var{n}
7272 @opindex finline-limit
7273 By default, GCC limits the size of functions that can be inlined. This flag
7274 allows coarse control of this limit. @var{n} is the size of functions that
7275 can be inlined in number of pseudo instructions.
7277 Inlining is actually controlled by a number of parameters, which may be
7278 specified individually by using @option{--param @var{name}=@var{value}}.
7279 The @option{-finline-limit=@var{n}} option sets some of these parameters
7283 @item max-inline-insns-single
7284 is set to @var{n}/2.
7285 @item max-inline-insns-auto
7286 is set to @var{n}/2.
7289 See below for a documentation of the individual
7290 parameters controlling inlining and for the defaults of these parameters.
7292 @emph{Note:} there may be no value to @option{-finline-limit} that results
7293 in default behavior.
7295 @emph{Note:} pseudo instruction represents, in this particular context, an
7296 abstract measurement of function's size. In no way does it represent a count
7297 of assembly instructions and as such its exact meaning might change from one
7298 release to an another.
7300 @item -fno-keep-inline-dllexport
7301 @opindex -fno-keep-inline-dllexport
7302 This is a more fine-grained version of @option{-fkeep-inline-functions},
7303 which applies only to functions that are declared using the @code{dllexport}
7304 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
7307 @item -fkeep-inline-functions
7308 @opindex fkeep-inline-functions
7309 In C, emit @code{static} functions that are declared @code{inline}
7310 into the object file, even if the function has been inlined into all
7311 of its callers. This switch does not affect functions using the
7312 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7313 inline functions into the object file.
7315 @item -fkeep-static-consts
7316 @opindex fkeep-static-consts
7317 Emit variables declared @code{static const} when optimization isn't turned
7318 on, even if the variables aren't referenced.
7320 GCC enables this option by default. If you want to force the compiler to
7321 check if a variable is referenced, regardless of whether or not
7322 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7324 @item -fmerge-constants
7325 @opindex fmerge-constants
7326 Attempt to merge identical constants (string constants and floating-point
7327 constants) across compilation units.
7329 This option is the default for optimized compilation if the assembler and
7330 linker support it. Use @option{-fno-merge-constants} to inhibit this
7333 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7335 @item -fmerge-all-constants
7336 @opindex fmerge-all-constants
7337 Attempt to merge identical constants and identical variables.
7339 This option implies @option{-fmerge-constants}. In addition to
7340 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7341 arrays or initialized constant variables with integral or floating-point
7342 types. Languages like C or C++ require each variable, including multiple
7343 instances of the same variable in recursive calls, to have distinct locations,
7344 so using this option results in non-conforming
7347 @item -fmodulo-sched
7348 @opindex fmodulo-sched
7349 Perform swing modulo scheduling immediately before the first scheduling
7350 pass. This pass looks at innermost loops and reorders their
7351 instructions by overlapping different iterations.
7353 @item -fmodulo-sched-allow-regmoves
7354 @opindex fmodulo-sched-allow-regmoves
7355 Perform more aggressive SMS-based modulo scheduling with register moves
7356 allowed. By setting this flag certain anti-dependences edges are
7357 deleted, which triggers the generation of reg-moves based on the
7358 life-range analysis. This option is effective only with
7359 @option{-fmodulo-sched} enabled.
7361 @item -fno-branch-count-reg
7362 @opindex fno-branch-count-reg
7363 Do not use ``decrement and branch'' instructions on a count register,
7364 but instead generate a sequence of instructions that decrement a
7365 register, compare it against zero, then branch based upon the result.
7366 This option is only meaningful on architectures that support such
7367 instructions, which include x86, PowerPC, IA-64 and S/390.
7369 Enabled by default at -O1 and higher.
7371 The default is @option{-fbranch-count-reg}.
7373 @item -fno-function-cse
7374 @opindex fno-function-cse
7375 Do not put function addresses in registers; make each instruction that
7376 calls a constant function contain the function's address explicitly.
7378 This option results in less efficient code, but some strange hacks
7379 that alter the assembler output may be confused by the optimizations
7380 performed when this option is not used.
7382 The default is @option{-ffunction-cse}
7384 @item -fno-zero-initialized-in-bss
7385 @opindex fno-zero-initialized-in-bss
7386 If the target supports a BSS section, GCC by default puts variables that
7387 are initialized to zero into BSS@. This can save space in the resulting
7390 This option turns off this behavior because some programs explicitly
7391 rely on variables going to the data section---e.g., so that the
7392 resulting executable can find the beginning of that section and/or make
7393 assumptions based on that.
7395 The default is @option{-fzero-initialized-in-bss}.
7397 @item -fthread-jumps
7398 @opindex fthread-jumps
7399 Perform optimizations that check to see if a jump branches to a
7400 location where another comparison subsumed by the first is found. If
7401 so, the first branch is redirected to either the destination of the
7402 second branch or a point immediately following it, depending on whether
7403 the condition is known to be true or false.
7405 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7407 @item -fsplit-wide-types
7408 @opindex fsplit-wide-types
7409 When using a type that occupies multiple registers, such as @code{long
7410 long} on a 32-bit system, split the registers apart and allocate them
7411 independently. This normally generates better code for those types,
7412 but may make debugging more difficult.
7414 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7417 @item -fcse-follow-jumps
7418 @opindex fcse-follow-jumps
7419 In common subexpression elimination (CSE), scan through jump instructions
7420 when the target of the jump is not reached by any other path. For
7421 example, when CSE encounters an @code{if} statement with an
7422 @code{else} clause, CSE follows the jump when the condition
7425 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7427 @item -fcse-skip-blocks
7428 @opindex fcse-skip-blocks
7429 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7430 follow jumps that conditionally skip over blocks. When CSE
7431 encounters a simple @code{if} statement with no else clause,
7432 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7433 body of the @code{if}.
7435 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7437 @item -frerun-cse-after-loop
7438 @opindex frerun-cse-after-loop
7439 Re-run common subexpression elimination after loop optimizations are
7442 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7446 Perform a global common subexpression elimination pass.
7447 This pass also performs global constant and copy propagation.
7449 @emph{Note:} When compiling a program using computed gotos, a GCC
7450 extension, you may get better run-time performance if you disable
7451 the global common subexpression elimination pass by adding
7452 @option{-fno-gcse} to the command line.
7454 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7458 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7459 attempts to move loads that are only killed by stores into themselves. This
7460 allows a loop containing a load/store sequence to be changed to a load outside
7461 the loop, and a copy/store within the loop.
7463 Enabled by default when @option{-fgcse} is enabled.
7467 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7468 global common subexpression elimination. This pass attempts to move
7469 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7470 loops containing a load/store sequence can be changed to a load before
7471 the loop and a store after the loop.
7473 Not enabled at any optimization level.
7477 When @option{-fgcse-las} is enabled, the global common subexpression
7478 elimination pass eliminates redundant loads that come after stores to the
7479 same memory location (both partial and full redundancies).
7481 Not enabled at any optimization level.
7483 @item -fgcse-after-reload
7484 @opindex fgcse-after-reload
7485 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7486 pass is performed after reload. The purpose of this pass is to clean up
7489 @item -faggressive-loop-optimizations
7490 @opindex faggressive-loop-optimizations
7491 This option tells the loop optimizer to use language constraints to
7492 derive bounds for the number of iterations of a loop. This assumes that
7493 loop code does not invoke undefined behavior by for example causing signed
7494 integer overflows or out-of-bound array accesses. The bounds for the
7495 number of iterations of a loop are used to guide loop unrolling and peeling
7496 and loop exit test optimizations.
7497 This option is enabled by default.
7499 @item -funsafe-loop-optimizations
7500 @opindex funsafe-loop-optimizations
7501 This option tells the loop optimizer to assume that loop indices do not
7502 overflow, and that loops with nontrivial exit condition are not
7503 infinite. This enables a wider range of loop optimizations even if
7504 the loop optimizer itself cannot prove that these assumptions are valid.
7505 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
7506 if it finds this kind of loop.
7508 @item -fcrossjumping
7509 @opindex fcrossjumping
7510 Perform cross-jumping transformation.
7511 This transformation unifies equivalent code and saves code size. The
7512 resulting code may or may not perform better than without cross-jumping.
7514 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7516 @item -fauto-inc-dec
7517 @opindex fauto-inc-dec
7518 Combine increments or decrements of addresses with memory accesses.
7519 This pass is always skipped on architectures that do not have
7520 instructions to support this. Enabled by default at @option{-O} and
7521 higher on architectures that support this.
7525 Perform dead code elimination (DCE) on RTL@.
7526 Enabled by default at @option{-O} and higher.
7530 Perform dead store elimination (DSE) on RTL@.
7531 Enabled by default at @option{-O} and higher.
7533 @item -fif-conversion
7534 @opindex fif-conversion
7535 Attempt to transform conditional jumps into branch-less equivalents. This
7536 includes use of conditional moves, min, max, set flags and abs instructions, and
7537 some tricks doable by standard arithmetics. The use of conditional execution
7538 on chips where it is available is controlled by @code{if-conversion2}.
7540 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7542 @item -fif-conversion2
7543 @opindex fif-conversion2
7544 Use conditional execution (where available) to transform conditional jumps into
7545 branch-less equivalents.
7547 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7549 @item -fdeclone-ctor-dtor
7550 @opindex fdeclone-ctor-dtor
7551 The C++ ABI requires multiple entry points for constructors and
7552 destructors: one for a base subobject, one for a complete object, and
7553 one for a virtual destructor that calls operator delete afterwards.
7554 For a hierarchy with virtual bases, the base and complete variants are
7555 clones, which means two copies of the function. With this option, the
7556 base and complete variants are changed to be thunks that call a common
7559 Enabled by @option{-Os}.
7561 @item -fdelete-null-pointer-checks
7562 @opindex fdelete-null-pointer-checks
7563 Assume that programs cannot safely dereference null pointers, and that
7564 no code or data element resides there. This enables simple constant
7565 folding optimizations at all optimization levels. In addition, other
7566 optimization passes in GCC use this flag to control global dataflow
7567 analyses that eliminate useless checks for null pointers; these assume
7568 that if a pointer is checked after it has already been dereferenced,
7571 Note however that in some environments this assumption is not true.
7572 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7573 for programs that depend on that behavior.
7575 Some targets, especially embedded ones, disable this option at all levels.
7576 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
7577 @option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
7578 are enabled independently at different optimization levels.
7580 @item -fdevirtualize
7581 @opindex fdevirtualize
7582 Attempt to convert calls to virtual functions to direct calls. This
7583 is done both within a procedure and interprocedurally as part of
7584 indirect inlining (@code{-findirect-inlining}) and interprocedural constant
7585 propagation (@option{-fipa-cp}).
7586 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7588 @item -fdevirtualize-speculatively
7589 @opindex fdevirtualize-speculatively
7590 Attempt to convert calls to virtual functions to speculative direct calls.
7591 Based on the analysis of the type inheritance graph, determine for a given call
7592 the set of likely targets. If the set is small, preferably of size 1, change
7593 the call into an conditional deciding on direct and indirect call. The
7594 speculative calls enable more optimizations, such as inlining. When they seem
7595 useless after further optimization, they are converted back into original form.
7597 @item -fexpensive-optimizations
7598 @opindex fexpensive-optimizations
7599 Perform a number of minor optimizations that are relatively expensive.
7601 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7605 Attempt to remove redundant extension instructions. This is especially
7606 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7607 registers after writing to their lower 32-bit half.
7609 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7610 @option{-O3}, @option{-Os}.
7612 @item -flive-range-shrinkage
7613 @opindex flive-range-shrinkage
7614 Attempt to decrease register pressure through register live range
7615 shrinkage. This is helpful for fast processors with small or moderate
7618 @item -fira-algorithm=@var{algorithm}
7619 Use the specified coloring algorithm for the integrated register
7620 allocator. The @var{algorithm} argument can be @samp{priority}, which
7621 specifies Chow's priority coloring, or @samp{CB}, which specifies
7622 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7623 for all architectures, but for those targets that do support it, it is
7624 the default because it generates better code.
7626 @item -fira-region=@var{region}
7627 Use specified regions for the integrated register allocator. The
7628 @var{region} argument should be one of the following:
7633 Use all loops as register allocation regions.
7634 This can give the best results for machines with a small and/or
7635 irregular register set.
7638 Use all loops except for loops with small register pressure
7639 as the regions. This value usually gives
7640 the best results in most cases and for most architectures,
7641 and is enabled by default when compiling with optimization for speed
7642 (@option{-O}, @option{-O2}, @dots{}).
7645 Use all functions as a single region.
7646 This typically results in the smallest code size, and is enabled by default for
7647 @option{-Os} or @option{-O0}.
7651 @item -fira-hoist-pressure
7652 @opindex fira-hoist-pressure
7653 Use IRA to evaluate register pressure in the code hoisting pass for
7654 decisions to hoist expressions. This option usually results in smaller
7655 code, but it can slow the compiler down.
7657 This option is enabled at level @option{-Os} for all targets.
7659 @item -fira-loop-pressure
7660 @opindex fira-loop-pressure
7661 Use IRA to evaluate register pressure in loops for decisions to move
7662 loop invariants. This option usually results in generation
7663 of faster and smaller code on machines with large register files (>= 32
7664 registers), but it can slow the compiler down.
7666 This option is enabled at level @option{-O3} for some targets.
7668 @item -fno-ira-share-save-slots
7669 @opindex fno-ira-share-save-slots
7670 Disable sharing of stack slots used for saving call-used hard
7671 registers living through a call. Each hard register gets a
7672 separate stack slot, and as a result function stack frames are
7675 @item -fno-ira-share-spill-slots
7676 @opindex fno-ira-share-spill-slots
7677 Disable sharing of stack slots allocated for pseudo-registers. Each
7678 pseudo-register that does not get a hard register gets a separate
7679 stack slot, and as a result function stack frames are larger.
7681 @item -fira-verbose=@var{n}
7682 @opindex fira-verbose
7683 Control the verbosity of the dump file for the integrated register allocator.
7684 The default value is 5. If the value @var{n} is greater or equal to 10,
7685 the dump output is sent to stderr using the same format as @var{n} minus 10.
7687 @item -fdelayed-branch
7688 @opindex fdelayed-branch
7689 If supported for the target machine, attempt to reorder instructions
7690 to exploit instruction slots available after delayed branch
7693 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7695 @item -fschedule-insns
7696 @opindex fschedule-insns
7697 If supported for the target machine, attempt to reorder instructions to
7698 eliminate execution stalls due to required data being unavailable. This
7699 helps machines that have slow floating point or memory load instructions
7700 by allowing other instructions to be issued until the result of the load
7701 or floating-point instruction is required.
7703 Enabled at levels @option{-O2}, @option{-O3}.
7705 @item -fschedule-insns2
7706 @opindex fschedule-insns2
7707 Similar to @option{-fschedule-insns}, but requests an additional pass of
7708 instruction scheduling after register allocation has been done. This is
7709 especially useful on machines with a relatively small number of
7710 registers and where memory load instructions take more than one cycle.
7712 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7714 @item -fno-sched-interblock
7715 @opindex fno-sched-interblock
7716 Don't schedule instructions across basic blocks. This is normally
7717 enabled by default when scheduling before register allocation, i.e.@:
7718 with @option{-fschedule-insns} or at @option{-O2} or higher.
7720 @item -fno-sched-spec
7721 @opindex fno-sched-spec
7722 Don't allow speculative motion of non-load instructions. This is normally
7723 enabled by default when scheduling before register allocation, i.e.@:
7724 with @option{-fschedule-insns} or at @option{-O2} or higher.
7726 @item -fsched-pressure
7727 @opindex fsched-pressure
7728 Enable register pressure sensitive insn scheduling before register
7729 allocation. This only makes sense when scheduling before register
7730 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7731 @option{-O2} or higher. Usage of this option can improve the
7732 generated code and decrease its size by preventing register pressure
7733 increase above the number of available hard registers and subsequent
7734 spills in register allocation.
7736 @item -fsched-spec-load
7737 @opindex fsched-spec-load
7738 Allow speculative motion of some load instructions. This only makes
7739 sense when scheduling before register allocation, i.e.@: with
7740 @option{-fschedule-insns} or at @option{-O2} or higher.
7742 @item -fsched-spec-load-dangerous
7743 @opindex fsched-spec-load-dangerous
7744 Allow speculative motion of more load instructions. This only makes
7745 sense when scheduling before register allocation, i.e.@: with
7746 @option{-fschedule-insns} or at @option{-O2} or higher.
7748 @item -fsched-stalled-insns
7749 @itemx -fsched-stalled-insns=@var{n}
7750 @opindex fsched-stalled-insns
7751 Define how many insns (if any) can be moved prematurely from the queue
7752 of stalled insns into the ready list during the second scheduling pass.
7753 @option{-fno-sched-stalled-insns} means that no insns are moved
7754 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7755 on how many queued insns can be moved prematurely.
7756 @option{-fsched-stalled-insns} without a value is equivalent to
7757 @option{-fsched-stalled-insns=1}.
7759 @item -fsched-stalled-insns-dep
7760 @itemx -fsched-stalled-insns-dep=@var{n}
7761 @opindex fsched-stalled-insns-dep
7762 Define how many insn groups (cycles) are examined for a dependency
7763 on a stalled insn that is a candidate for premature removal from the queue
7764 of stalled insns. This has an effect only during the second scheduling pass,
7765 and only if @option{-fsched-stalled-insns} is used.
7766 @option{-fno-sched-stalled-insns-dep} is equivalent to
7767 @option{-fsched-stalled-insns-dep=0}.
7768 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7769 @option{-fsched-stalled-insns-dep=1}.
7771 @item -fsched2-use-superblocks
7772 @opindex fsched2-use-superblocks
7773 When scheduling after register allocation, use superblock scheduling.
7774 This allows motion across basic block boundaries,
7775 resulting in faster schedules. This option is experimental, as not all machine
7776 descriptions used by GCC model the CPU closely enough to avoid unreliable
7777 results from the algorithm.
7779 This only makes sense when scheduling after register allocation, i.e.@: with
7780 @option{-fschedule-insns2} or at @option{-O2} or higher.
7782 @item -fsched-group-heuristic
7783 @opindex fsched-group-heuristic
7784 Enable the group heuristic in the scheduler. This heuristic favors
7785 the instruction that belongs to a schedule group. This is enabled
7786 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7787 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7789 @item -fsched-critical-path-heuristic
7790 @opindex fsched-critical-path-heuristic
7791 Enable the critical-path heuristic in the scheduler. This heuristic favors
7792 instructions on the critical path. This is enabled by default when
7793 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7794 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7796 @item -fsched-spec-insn-heuristic
7797 @opindex fsched-spec-insn-heuristic
7798 Enable the speculative instruction heuristic in the scheduler. This
7799 heuristic favors speculative instructions with greater dependency weakness.
7800 This is enabled by default when scheduling is enabled, i.e.@:
7801 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7802 or at @option{-O2} or higher.
7804 @item -fsched-rank-heuristic
7805 @opindex fsched-rank-heuristic
7806 Enable the rank heuristic in the scheduler. This heuristic favors
7807 the instruction belonging to a basic block with greater size or frequency.
7808 This is enabled by default when scheduling is enabled, i.e.@:
7809 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7810 at @option{-O2} or higher.
7812 @item -fsched-last-insn-heuristic
7813 @opindex fsched-last-insn-heuristic
7814 Enable the last-instruction heuristic in the scheduler. This heuristic
7815 favors the instruction that is less dependent on the last instruction
7816 scheduled. This is enabled by default when scheduling is enabled,
7817 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7818 at @option{-O2} or higher.
7820 @item -fsched-dep-count-heuristic
7821 @opindex fsched-dep-count-heuristic
7822 Enable the dependent-count heuristic in the scheduler. This heuristic
7823 favors the instruction that has more instructions depending on it.
7824 This is enabled by default when scheduling is enabled, i.e.@:
7825 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7826 at @option{-O2} or higher.
7828 @item -freschedule-modulo-scheduled-loops
7829 @opindex freschedule-modulo-scheduled-loops
7830 Modulo scheduling is performed before traditional scheduling. If a loop
7831 is modulo scheduled, later scheduling passes may change its schedule.
7832 Use this option to control that behavior.
7834 @item -fselective-scheduling
7835 @opindex fselective-scheduling
7836 Schedule instructions using selective scheduling algorithm. Selective
7837 scheduling runs instead of the first scheduler pass.
7839 @item -fselective-scheduling2
7840 @opindex fselective-scheduling2
7841 Schedule instructions using selective scheduling algorithm. Selective
7842 scheduling runs instead of the second scheduler pass.
7844 @item -fsel-sched-pipelining
7845 @opindex fsel-sched-pipelining
7846 Enable software pipelining of innermost loops during selective scheduling.
7847 This option has no effect unless one of @option{-fselective-scheduling} or
7848 @option{-fselective-scheduling2} is turned on.
7850 @item -fsel-sched-pipelining-outer-loops
7851 @opindex fsel-sched-pipelining-outer-loops
7852 When pipelining loops during selective scheduling, also pipeline outer loops.
7853 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7855 @item -fsemantic-interposition
7856 @opindex fsemantic-interposition
7857 Some object formats, like ELF, allow interposing of symbols by dynamic linker.
7858 This means that for symbols exported from the DSO compiler can not perform
7859 inter-procedural propagation, inlining and other optimizations in anticipation
7860 that the function or variable in question may change. While this feature is
7861 useful, for example, to rewrite memory allocation functions by a debugging
7862 implementation, it is expensive in the terms of code quality.
7863 With @option{-fno-semantic-inteposition} compiler assumest that if interposition
7864 happens for functions the overwritting function will have
7865 precisely same semantics (and side effects). Similarly if interposition happens
7866 for variables, the constructor of the variable will be the same. The flag
7867 has no effect for functions explicitly declared inline, where
7868 interposition changing semantic is never allowed and for symbols explicitly
7872 @opindex fshrink-wrap
7873 Emit function prologues only before parts of the function that need it,
7874 rather than at the top of the function. This flag is enabled by default at
7875 @option{-O} and higher.
7877 @item -fcaller-saves
7878 @opindex fcaller-saves
7879 Enable allocation of values to registers that are clobbered by
7880 function calls, by emitting extra instructions to save and restore the
7881 registers around such calls. Such allocation is done only when it
7882 seems to result in better code.
7884 This option is always enabled by default on certain machines, usually
7885 those which have no call-preserved registers to use instead.
7887 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7889 @item -fcombine-stack-adjustments
7890 @opindex fcombine-stack-adjustments
7891 Tracks stack adjustments (pushes and pops) and stack memory references
7892 and then tries to find ways to combine them.
7894 Enabled by default at @option{-O1} and higher.
7896 @item -fuse-caller-save
7897 Use caller save registers for allocation if those registers are not used by
7898 any called function. In that case it is not necessary to save and restore
7899 them around calls. This is only possible if called functions are part of
7900 same compilation unit as current function and they are compiled before it.
7902 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7904 @item -fconserve-stack
7905 @opindex fconserve-stack
7906 Attempt to minimize stack usage. The compiler attempts to use less
7907 stack space, even if that makes the program slower. This option
7908 implies setting the @option{large-stack-frame} parameter to 100
7909 and the @option{large-stack-frame-growth} parameter to 400.
7911 @item -ftree-reassoc
7912 @opindex ftree-reassoc
7913 Perform reassociation on trees. This flag is enabled by default
7914 at @option{-O} and higher.
7918 Perform partial redundancy elimination (PRE) on trees. This flag is
7919 enabled by default at @option{-O2} and @option{-O3}.
7921 @item -ftree-partial-pre
7922 @opindex ftree-partial-pre
7923 Make partial redundancy elimination (PRE) more aggressive. This flag is
7924 enabled by default at @option{-O3}.
7926 @item -ftree-forwprop
7927 @opindex ftree-forwprop
7928 Perform forward propagation on trees. This flag is enabled by default
7929 at @option{-O} and higher.
7933 Perform full redundancy elimination (FRE) on trees. The difference
7934 between FRE and PRE is that FRE only considers expressions
7935 that are computed on all paths leading to the redundant computation.
7936 This analysis is faster than PRE, though it exposes fewer redundancies.
7937 This flag is enabled by default at @option{-O} and higher.
7939 @item -ftree-phiprop
7940 @opindex ftree-phiprop
7941 Perform hoisting of loads from conditional pointers on trees. This
7942 pass is enabled by default at @option{-O} and higher.
7944 @item -fhoist-adjacent-loads
7945 @opindex hoist-adjacent-loads
7946 Speculatively hoist loads from both branches of an if-then-else if the
7947 loads are from adjacent locations in the same structure and the target
7948 architecture has a conditional move instruction. This flag is enabled
7949 by default at @option{-O2} and higher.
7951 @item -ftree-copy-prop
7952 @opindex ftree-copy-prop
7953 Perform copy propagation on trees. This pass eliminates unnecessary
7954 copy operations. This flag is enabled by default at @option{-O} and
7957 @item -fipa-pure-const
7958 @opindex fipa-pure-const
7959 Discover which functions are pure or constant.
7960 Enabled by default at @option{-O} and higher.
7962 @item -fipa-reference
7963 @opindex fipa-reference
7964 Discover which static variables do not escape the
7966 Enabled by default at @option{-O} and higher.
7970 Perform interprocedural pointer analysis and interprocedural modification
7971 and reference analysis. This option can cause excessive memory and
7972 compile-time usage on large compilation units. It is not enabled by
7973 default at any optimization level.
7976 @opindex fipa-profile
7977 Perform interprocedural profile propagation. The functions called only from
7978 cold functions are marked as cold. Also functions executed once (such as
7979 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7980 functions and loop less parts of functions executed once are then optimized for
7982 Enabled by default at @option{-O} and higher.
7986 Perform interprocedural constant propagation.
7987 This optimization analyzes the program to determine when values passed
7988 to functions are constants and then optimizes accordingly.
7989 This optimization can substantially increase performance
7990 if the application has constants passed to functions.
7991 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7993 @item -fipa-cp-clone
7994 @opindex fipa-cp-clone
7995 Perform function cloning to make interprocedural constant propagation stronger.
7996 When enabled, interprocedural constant propagation performs function cloning
7997 when externally visible function can be called with constant arguments.
7998 Because this optimization can create multiple copies of functions,
7999 it may significantly increase code size
8000 (see @option{--param ipcp-unit-growth=@var{value}}).
8001 This flag is enabled by default at @option{-O3}.
8003 @item -fisolate-erroneous-paths-dereference
8004 Detect paths which trigger erroneous or undefined behaviour due to
8005 dereferencing a NULL pointer. Isolate those paths from the main control
8006 flow and turn the statement with erroneous or undefined behaviour into a trap.
8008 @item -fisolate-erroneous-paths-attribute
8009 Detect paths which trigger erroneous or undefined behaviour due a NULL value
8010 being used in a way which is forbidden by a @code{returns_nonnull} or @code{nonnull}
8011 attribute. Isolate those paths from the main control flow and turn the
8012 statement with erroneous or undefined behaviour into a trap. This is not
8013 currently enabled, but may be enabled by @code{-O2} in the future.
8017 Perform forward store motion on trees. This flag is
8018 enabled by default at @option{-O} and higher.
8020 @item -ftree-bit-ccp
8021 @opindex ftree-bit-ccp
8022 Perform sparse conditional bit constant propagation on trees and propagate
8023 pointer alignment information.
8024 This pass only operates on local scalar variables and is enabled by default
8025 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8029 Perform sparse conditional constant propagation (CCP) on trees. This
8030 pass only operates on local scalar variables and is enabled by default
8031 at @option{-O} and higher.
8034 @opindex fssa-phiopt
8035 Perform pattern matching on SSA PHI nodes to optimize conditional
8036 code. This pass is enabled by default at @option{-O} and higher.
8038 @item -ftree-switch-conversion
8039 Perform conversion of simple initializations in a switch to
8040 initializations from a scalar array. This flag is enabled by default
8041 at @option{-O2} and higher.
8043 @item -ftree-tail-merge
8044 Look for identical code sequences. When found, replace one with a jump to the
8045 other. This optimization is known as tail merging or cross jumping. This flag
8046 is enabled by default at @option{-O2} and higher. The compilation time
8048 be limited using @option{max-tail-merge-comparisons} parameter and
8049 @option{max-tail-merge-iterations} parameter.
8053 Perform dead code elimination (DCE) on trees. This flag is enabled by
8054 default at @option{-O} and higher.
8056 @item -ftree-builtin-call-dce
8057 @opindex ftree-builtin-call-dce
8058 Perform conditional dead code elimination (DCE) for calls to built-in functions
8059 that may set @code{errno} but are otherwise side-effect free. This flag is
8060 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8063 @item -ftree-dominator-opts
8064 @opindex ftree-dominator-opts
8065 Perform a variety of simple scalar cleanups (constant/copy
8066 propagation, redundancy elimination, range propagation and expression
8067 simplification) based on a dominator tree traversal. This also
8068 performs jump threading (to reduce jumps to jumps). This flag is
8069 enabled by default at @option{-O} and higher.
8073 Perform dead store elimination (DSE) on trees. A dead store is a store into
8074 a memory location that is later overwritten by another store without
8075 any intervening loads. In this case the earlier store can be deleted. This
8076 flag is enabled by default at @option{-O} and higher.
8080 Perform loop header copying on trees. This is beneficial since it increases
8081 effectiveness of code motion optimizations. It also saves one jump. This flag
8082 is enabled by default at @option{-O} and higher. It is not enabled
8083 for @option{-Os}, since it usually increases code size.
8085 @item -ftree-loop-optimize
8086 @opindex ftree-loop-optimize
8087 Perform loop optimizations on trees. This flag is enabled by default
8088 at @option{-O} and higher.
8090 @item -ftree-loop-linear
8091 @opindex ftree-loop-linear
8092 Perform loop interchange transformations on tree. Same as
8093 @option{-floop-interchange}. To use this code transformation, GCC has
8094 to be configured with @option{--with-ppl} and @option{--with-cloog} to
8095 enable the Graphite loop transformation infrastructure.
8097 @item -floop-interchange
8098 @opindex floop-interchange
8099 Perform loop interchange transformations on loops. Interchanging two
8100 nested loops switches the inner and outer loops. For example, given a
8105 A(J, I) = A(J, I) * C
8109 loop interchange transforms the loop as if it were written:
8113 A(J, I) = A(J, I) * C
8117 which can be beneficial when @code{N} is larger than the caches,
8118 because in Fortran, the elements of an array are stored in memory
8119 contiguously by column, and the original loop iterates over rows,
8120 potentially creating at each access a cache miss. This optimization
8121 applies to all the languages supported by GCC and is not limited to
8122 Fortran. To use this code transformation, GCC has to be configured
8123 with @option{--with-ppl} and @option{--with-cloog} to enable the
8124 Graphite loop transformation infrastructure.
8126 @item -floop-strip-mine
8127 @opindex floop-strip-mine
8128 Perform loop strip mining transformations on loops. Strip mining
8129 splits a loop into two nested loops. The outer loop has strides
8130 equal to the strip size and the inner loop has strides of the
8131 original loop within a strip. The strip length can be changed
8132 using the @option{loop-block-tile-size} parameter. For example,
8139 loop strip mining transforms the loop as if it were written:
8142 DO I = II, min (II + 50, N)
8147 This optimization applies to all the languages supported by GCC and is
8148 not limited to Fortran. To use this code transformation, GCC has to
8149 be configured with @option{--with-ppl} and @option{--with-cloog} to
8150 enable the Graphite loop transformation infrastructure.
8153 @opindex floop-block
8154 Perform loop blocking transformations on loops. Blocking strip mines
8155 each loop in the loop nest such that the memory accesses of the
8156 element loops fit inside caches. The strip length can be changed
8157 using the @option{loop-block-tile-size} parameter. For example, given
8162 A(J, I) = B(I) + C(J)
8166 loop blocking transforms the loop as if it were written:
8170 DO I = II, min (II + 50, N)
8171 DO J = JJ, min (JJ + 50, M)
8172 A(J, I) = B(I) + C(J)
8178 which can be beneficial when @code{M} is larger than the caches,
8179 because the innermost loop iterates over a smaller amount of data
8180 which can be kept in the caches. This optimization applies to all the
8181 languages supported by GCC and is not limited to Fortran. To use this
8182 code transformation, GCC has to be configured with @option{--with-ppl}
8183 and @option{--with-cloog} to enable the Graphite loop transformation
8186 @item -fgraphite-identity
8187 @opindex fgraphite-identity
8188 Enable the identity transformation for graphite. For every SCoP we generate
8189 the polyhedral representation and transform it back to gimple. Using
8190 @option{-fgraphite-identity} we can check the costs or benefits of the
8191 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8192 are also performed by the code generator CLooG, like index splitting and
8193 dead code elimination in loops.
8195 @item -floop-nest-optimize
8196 @opindex floop-nest-optimize
8197 Enable the ISL based loop nest optimizer. This is a generic loop nest
8198 optimizer based on the Pluto optimization algorithms. It calculates a loop
8199 structure optimized for data-locality and parallelism. This option
8202 @item -floop-parallelize-all
8203 @opindex floop-parallelize-all
8204 Use the Graphite data dependence analysis to identify loops that can
8205 be parallelized. Parallelize all the loops that can be analyzed to
8206 not contain loop carried dependences without checking that it is
8207 profitable to parallelize the loops.
8209 @item -fcheck-data-deps
8210 @opindex fcheck-data-deps
8211 Compare the results of several data dependence analyzers. This option
8212 is used for debugging the data dependence analyzers.
8214 @item -ftree-loop-if-convert
8215 Attempt to transform conditional jumps in the innermost loops to
8216 branch-less equivalents. The intent is to remove control-flow from
8217 the innermost loops in order to improve the ability of the
8218 vectorization pass to handle these loops. This is enabled by default
8219 if vectorization is enabled.
8221 @item -ftree-loop-if-convert-stores
8222 Attempt to also if-convert conditional jumps containing memory writes.
8223 This transformation can be unsafe for multi-threaded programs as it
8224 transforms conditional memory writes into unconditional memory writes.
8227 for (i = 0; i < N; i++)
8233 for (i = 0; i < N; i++)
8234 A[i] = cond ? expr : A[i];
8236 potentially producing data races.
8238 @item -ftree-loop-distribution
8239 Perform loop distribution. This flag can improve cache performance on
8240 big loop bodies and allow further loop optimizations, like
8241 parallelization or vectorization, to take place. For example, the loop
8258 @item -ftree-loop-distribute-patterns
8259 Perform loop distribution of patterns that can be code generated with
8260 calls to a library. This flag is enabled by default at @option{-O3}.
8262 This pass distributes the initialization loops and generates a call to
8263 memset zero. For example, the loop
8279 and the initialization loop is transformed into a call to memset zero.
8281 @item -ftree-loop-im
8282 @opindex ftree-loop-im
8283 Perform loop invariant motion on trees. This pass moves only invariants that
8284 are hard to handle at RTL level (function calls, operations that expand to
8285 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8286 operands of conditions that are invariant out of the loop, so that we can use
8287 just trivial invariantness analysis in loop unswitching. The pass also includes
8290 @item -ftree-loop-ivcanon
8291 @opindex ftree-loop-ivcanon
8292 Create a canonical counter for number of iterations in loops for which
8293 determining number of iterations requires complicated analysis. Later
8294 optimizations then may determine the number easily. Useful especially
8295 in connection with unrolling.
8299 Perform induction variable optimizations (strength reduction, induction
8300 variable merging and induction variable elimination) on trees.
8302 @item -ftree-parallelize-loops=n
8303 @opindex ftree-parallelize-loops
8304 Parallelize loops, i.e., split their iteration space to run in n threads.
8305 This is only possible for loops whose iterations are independent
8306 and can be arbitrarily reordered. The optimization is only
8307 profitable on multiprocessor machines, for loops that are CPU-intensive,
8308 rather than constrained e.g.@: by memory bandwidth. This option
8309 implies @option{-pthread}, and thus is only supported on targets
8310 that have support for @option{-pthread}.
8314 Perform function-local points-to analysis on trees. This flag is
8315 enabled by default at @option{-O} and higher.
8319 Perform scalar replacement of aggregates. This pass replaces structure
8320 references with scalars to prevent committing structures to memory too
8321 early. This flag is enabled by default at @option{-O} and higher.
8323 @item -ftree-copyrename
8324 @opindex ftree-copyrename
8325 Perform copy renaming on trees. This pass attempts to rename compiler
8326 temporaries to other variables at copy locations, usually resulting in
8327 variable names which more closely resemble the original variables. This flag
8328 is enabled by default at @option{-O} and higher.
8330 @item -ftree-coalesce-inlined-vars
8331 @opindex ftree-coalesce-inlined-vars
8332 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
8333 combine small user-defined variables too, but only if they were inlined
8334 from other functions. It is a more limited form of
8335 @option{-ftree-coalesce-vars}. This may harm debug information of such
8336 inlined variables, but it will keep variables of the inlined-into
8337 function apart from each other, such that they are more likely to
8338 contain the expected values in a debugging session. This was the
8339 default in GCC versions older than 4.7.
8341 @item -ftree-coalesce-vars
8342 @opindex ftree-coalesce-vars
8343 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
8344 combine small user-defined variables too, instead of just compiler
8345 temporaries. This may severely limit the ability to debug an optimized
8346 program compiled with @option{-fno-var-tracking-assignments}. In the
8347 negated form, this flag prevents SSA coalescing of user variables,
8348 including inlined ones. This option is enabled by default.
8352 Perform temporary expression replacement during the SSA->normal phase. Single
8353 use/single def temporaries are replaced at their use location with their
8354 defining expression. This results in non-GIMPLE code, but gives the expanders
8355 much more complex trees to work on resulting in better RTL generation. This is
8356 enabled by default at @option{-O} and higher.
8360 Perform straight-line strength reduction on trees. This recognizes related
8361 expressions involving multiplications and replaces them by less expensive
8362 calculations when possible. This is enabled by default at @option{-O} and
8365 @item -ftree-vectorize
8366 @opindex ftree-vectorize
8367 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8368 and @option{-ftree-slp-vectorize} if not explicitly specified.
8370 @item -ftree-loop-vectorize
8371 @opindex ftree-loop-vectorize
8372 Perform loop vectorization on trees. This flag is enabled by default at
8373 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8375 @item -ftree-slp-vectorize
8376 @opindex ftree-slp-vectorize
8377 Perform basic block vectorization on trees. This flag is enabled by default at
8378 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8380 @item -fvect-cost-model=@var{model}
8381 @opindex fvect-cost-model
8382 Alter the cost model used for vectorization. The @var{model} argument
8383 should be one of @code{unlimited}, @code{dynamic} or @code{cheap}.
8384 With the @code{unlimited} model the vectorized code-path is assumed
8385 to be profitable while with the @code{dynamic} model a runtime check
8386 will guard the vectorized code-path to enable it only for iteration
8387 counts that will likely execute faster than when executing the original
8388 scalar loop. The @code{cheap} model will disable vectorization of
8389 loops where doing so would be cost prohibitive for example due to
8390 required runtime checks for data dependence or alignment but otherwise
8391 is equal to the @code{dynamic} model.
8392 The default cost model depends on other optimization flags and is
8393 either @code{dynamic} or @code{cheap}.
8395 @item -fsimd-cost-model=@var{model}
8396 @opindex fsimd-cost-model
8397 Alter the cost model used for vectorization of loops marked with the OpenMP
8398 or Cilk Plus simd directive. The @var{model} argument should be one of
8399 @code{unlimited}, @code{dynamic}, @code{cheap}. All values of @var{model}
8400 have the same meaning as described in @option{-fvect-cost-model} and by
8401 default a cost model defined with @option{-fvect-cost-model} is used.
8405 Perform Value Range Propagation on trees. This is similar to the
8406 constant propagation pass, but instead of values, ranges of values are
8407 propagated. This allows the optimizers to remove unnecessary range
8408 checks like array bound checks and null pointer checks. This is
8409 enabled by default at @option{-O2} and higher. Null pointer check
8410 elimination is only done if @option{-fdelete-null-pointer-checks} is
8415 Perform tail duplication to enlarge superblock size. This transformation
8416 simplifies the control flow of the function allowing other optimizations to do
8419 @item -funroll-loops
8420 @opindex funroll-loops
8421 Unroll loops whose number of iterations can be determined at compile
8422 time or upon entry to the loop. @option{-funroll-loops} implies
8423 @option{-frerun-cse-after-loop}. This option makes code larger,
8424 and may or may not make it run faster.
8426 @item -funroll-all-loops
8427 @opindex funroll-all-loops
8428 Unroll all loops, even if their number of iterations is uncertain when
8429 the loop is entered. This usually makes programs run more slowly.
8430 @option{-funroll-all-loops} implies the same options as
8431 @option{-funroll-loops},
8433 @item -fsplit-ivs-in-unroller
8434 @opindex fsplit-ivs-in-unroller
8435 Enables expression of values of induction variables in later iterations
8436 of the unrolled loop using the value in the first iteration. This breaks
8437 long dependency chains, thus improving efficiency of the scheduling passes.
8439 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8440 same effect. However, that is not reliable in cases where the loop body
8441 is more complicated than a single basic block. It also does not work at all
8442 on some architectures due to restrictions in the CSE pass.
8444 This optimization is enabled by default.
8446 @item -fvariable-expansion-in-unroller
8447 @opindex fvariable-expansion-in-unroller
8448 With this option, the compiler creates multiple copies of some
8449 local variables when unrolling a loop, which can result in superior code.
8451 @item -fpartial-inlining
8452 @opindex fpartial-inlining
8453 Inline parts of functions. This option has any effect only
8454 when inlining itself is turned on by the @option{-finline-functions}
8455 or @option{-finline-small-functions} options.
8457 Enabled at level @option{-O2}.
8459 @item -fpredictive-commoning
8460 @opindex fpredictive-commoning
8461 Perform predictive commoning optimization, i.e., reusing computations
8462 (especially memory loads and stores) performed in previous
8463 iterations of loops.
8465 This option is enabled at level @option{-O3}.
8467 @item -fprefetch-loop-arrays
8468 @opindex fprefetch-loop-arrays
8469 If supported by the target machine, generate instructions to prefetch
8470 memory to improve the performance of loops that access large arrays.
8472 This option may generate better or worse code; results are highly
8473 dependent on the structure of loops within the source code.
8475 Disabled at level @option{-Os}.
8478 @itemx -fno-peephole2
8479 @opindex fno-peephole
8480 @opindex fno-peephole2
8481 Disable any machine-specific peephole optimizations. The difference
8482 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8483 are implemented in the compiler; some targets use one, some use the
8484 other, a few use both.
8486 @option{-fpeephole} is enabled by default.
8487 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8489 @item -fno-guess-branch-probability
8490 @opindex fno-guess-branch-probability
8491 Do not guess branch probabilities using heuristics.
8493 GCC uses heuristics to guess branch probabilities if they are
8494 not provided by profiling feedback (@option{-fprofile-arcs}). These
8495 heuristics are based on the control flow graph. If some branch probabilities
8496 are specified by @samp{__builtin_expect}, then the heuristics are
8497 used to guess branch probabilities for the rest of the control flow graph,
8498 taking the @samp{__builtin_expect} info into account. The interactions
8499 between the heuristics and @samp{__builtin_expect} can be complex, and in
8500 some cases, it may be useful to disable the heuristics so that the effects
8501 of @samp{__builtin_expect} are easier to understand.
8503 The default is @option{-fguess-branch-probability} at levels
8504 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8506 @item -freorder-blocks
8507 @opindex freorder-blocks
8508 Reorder basic blocks in the compiled function in order to reduce number of
8509 taken branches and improve code locality.
8511 Enabled at levels @option{-O2}, @option{-O3}.
8513 @item -freorder-blocks-and-partition
8514 @opindex freorder-blocks-and-partition
8515 In addition to reordering basic blocks in the compiled function, in order
8516 to reduce number of taken branches, partitions hot and cold basic blocks
8517 into separate sections of the assembly and .o files, to improve
8518 paging and cache locality performance.
8520 This optimization is automatically turned off in the presence of
8521 exception handling, for linkonce sections, for functions with a user-defined
8522 section attribute and on any architecture that does not support named
8525 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8527 @item -freorder-functions
8528 @opindex freorder-functions
8529 Reorder functions in the object file in order to
8530 improve code locality. This is implemented by using special
8531 subsections @code{.text.hot} for most frequently executed functions and
8532 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8533 the linker so object file format must support named sections and linker must
8534 place them in a reasonable way.
8536 Also profile feedback must be available to make this option effective. See
8537 @option{-fprofile-arcs} for details.
8539 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8541 @item -fstrict-aliasing
8542 @opindex fstrict-aliasing
8543 Allow the compiler to assume the strictest aliasing rules applicable to
8544 the language being compiled. For C (and C++), this activates
8545 optimizations based on the type of expressions. In particular, an
8546 object of one type is assumed never to reside at the same address as an
8547 object of a different type, unless the types are almost the same. For
8548 example, an @code{unsigned int} can alias an @code{int}, but not a
8549 @code{void*} or a @code{double}. A character type may alias any other
8552 @anchor{Type-punning}Pay special attention to code like this:
8565 The practice of reading from a different union member than the one most
8566 recently written to (called ``type-punning'') is common. Even with
8567 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8568 is accessed through the union type. So, the code above works as
8569 expected. @xref{Structures unions enumerations and bit-fields
8570 implementation}. However, this code might not:
8581 Similarly, access by taking the address, casting the resulting pointer
8582 and dereferencing the result has undefined behavior, even if the cast
8583 uses a union type, e.g.:
8587 return ((union a_union *) &d)->i;
8591 The @option{-fstrict-aliasing} option is enabled at levels
8592 @option{-O2}, @option{-O3}, @option{-Os}.
8594 @item -fstrict-overflow
8595 @opindex fstrict-overflow
8596 Allow the compiler to assume strict signed overflow rules, depending
8597 on the language being compiled. For C (and C++) this means that
8598 overflow when doing arithmetic with signed numbers is undefined, which
8599 means that the compiler may assume that it does not happen. This
8600 permits various optimizations. For example, the compiler assumes
8601 that an expression like @code{i + 10 > i} is always true for
8602 signed @code{i}. This assumption is only valid if signed overflow is
8603 undefined, as the expression is false if @code{i + 10} overflows when
8604 using twos complement arithmetic. When this option is in effect any
8605 attempt to determine whether an operation on signed numbers
8606 overflows must be written carefully to not actually involve overflow.
8608 This option also allows the compiler to assume strict pointer
8609 semantics: given a pointer to an object, if adding an offset to that
8610 pointer does not produce a pointer to the same object, the addition is
8611 undefined. This permits the compiler to conclude that @code{p + u >
8612 p} is always true for a pointer @code{p} and unsigned integer
8613 @code{u}. This assumption is only valid because pointer wraparound is
8614 undefined, as the expression is false if @code{p + u} overflows using
8615 twos complement arithmetic.
8617 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8618 that integer signed overflow is fully defined: it wraps. When
8619 @option{-fwrapv} is used, there is no difference between
8620 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8621 integers. With @option{-fwrapv} certain types of overflow are
8622 permitted. For example, if the compiler gets an overflow when doing
8623 arithmetic on constants, the overflowed value can still be used with
8624 @option{-fwrapv}, but not otherwise.
8626 The @option{-fstrict-overflow} option is enabled at levels
8627 @option{-O2}, @option{-O3}, @option{-Os}.
8629 @item -falign-functions
8630 @itemx -falign-functions=@var{n}
8631 @opindex falign-functions
8632 Align the start of functions to the next power-of-two greater than
8633 @var{n}, skipping up to @var{n} bytes. For instance,
8634 @option{-falign-functions=32} aligns functions to the next 32-byte
8635 boundary, but @option{-falign-functions=24} aligns to the next
8636 32-byte boundary only if this can be done by skipping 23 bytes or less.
8638 @option{-fno-align-functions} and @option{-falign-functions=1} are
8639 equivalent and mean that functions are not aligned.
8641 Some assemblers only support this flag when @var{n} is a power of two;
8642 in that case, it is rounded up.
8644 If @var{n} is not specified or is zero, use a machine-dependent default.
8646 Enabled at levels @option{-O2}, @option{-O3}.
8648 @item -falign-labels
8649 @itemx -falign-labels=@var{n}
8650 @opindex falign-labels
8651 Align all branch targets to a power-of-two boundary, skipping up to
8652 @var{n} bytes like @option{-falign-functions}. This option can easily
8653 make code slower, because it must insert dummy operations for when the
8654 branch target is reached in the usual flow of the code.
8656 @option{-fno-align-labels} and @option{-falign-labels=1} are
8657 equivalent and mean that labels are not aligned.
8659 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8660 are greater than this value, then their values are used instead.
8662 If @var{n} is not specified or is zero, use a machine-dependent default
8663 which is very likely to be @samp{1}, meaning no alignment.
8665 Enabled at levels @option{-O2}, @option{-O3}.
8668 @itemx -falign-loops=@var{n}
8669 @opindex falign-loops
8670 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8671 like @option{-falign-functions}. If the loops are
8672 executed many times, this makes up for any execution of the dummy
8675 @option{-fno-align-loops} and @option{-falign-loops=1} are
8676 equivalent and mean that loops are not aligned.
8678 If @var{n} is not specified or is zero, use a machine-dependent default.
8680 Enabled at levels @option{-O2}, @option{-O3}.
8683 @itemx -falign-jumps=@var{n}
8684 @opindex falign-jumps
8685 Align branch targets to a power-of-two boundary, for branch targets
8686 where the targets can only be reached by jumping, skipping up to @var{n}
8687 bytes like @option{-falign-functions}. In this case, no dummy operations
8690 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8691 equivalent and mean that loops are not aligned.
8693 If @var{n} is not specified or is zero, use a machine-dependent default.
8695 Enabled at levels @option{-O2}, @option{-O3}.
8697 @item -funit-at-a-time
8698 @opindex funit-at-a-time
8699 This option is left for compatibility reasons. @option{-funit-at-a-time}
8700 has no effect, while @option{-fno-unit-at-a-time} implies
8701 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8705 @item -fno-toplevel-reorder
8706 @opindex fno-toplevel-reorder
8707 Do not reorder top-level functions, variables, and @code{asm}
8708 statements. Output them in the same order that they appear in the
8709 input file. When this option is used, unreferenced static variables
8710 are not removed. This option is intended to support existing code
8711 that relies on a particular ordering. For new code, it is better to
8712 use attributes when possible.
8714 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8715 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8720 Constructs webs as commonly used for register allocation purposes and assign
8721 each web individual pseudo register. This allows the register allocation pass
8722 to operate on pseudos directly, but also strengthens several other optimization
8723 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8724 however, make debugging impossible, since variables no longer stay in a
8727 Enabled by default with @option{-funroll-loops}.
8729 @item -fwhole-program
8730 @opindex fwhole-program
8731 Assume that the current compilation unit represents the whole program being
8732 compiled. All public functions and variables with the exception of @code{main}
8733 and those merged by attribute @code{externally_visible} become static functions
8734 and in effect are optimized more aggressively by interprocedural optimizers.
8736 This option should not be used in combination with @code{-flto}.
8737 Instead relying on a linker plugin should provide safer and more precise
8740 @item -flto[=@var{n}]
8742 This option runs the standard link-time optimizer. When invoked
8743 with source code, it generates GIMPLE (one of GCC's internal
8744 representations) and writes it to special ELF sections in the object
8745 file. When the object files are linked together, all the function
8746 bodies are read from these ELF sections and instantiated as if they
8747 had been part of the same translation unit.
8749 To use the link-time optimizer, @option{-flto} and optimization
8750 options should be specified at compile time and during the final link.
8754 gcc -c -O2 -flto foo.c
8755 gcc -c -O2 -flto bar.c
8756 gcc -o myprog -flto -O2 foo.o bar.o
8759 The first two invocations to GCC save a bytecode representation
8760 of GIMPLE into special ELF sections inside @file{foo.o} and
8761 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8762 @file{foo.o} and @file{bar.o}, merges the two files into a single
8763 internal image, and compiles the result as usual. Since both
8764 @file{foo.o} and @file{bar.o} are merged into a single image, this
8765 causes all the interprocedural analyses and optimizations in GCC to
8766 work across the two files as if they were a single one. This means,
8767 for example, that the inliner is able to inline functions in
8768 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8770 Another (simpler) way to enable link-time optimization is:
8773 gcc -o myprog -flto -O2 foo.c bar.c
8776 The above generates bytecode for @file{foo.c} and @file{bar.c},
8777 merges them together into a single GIMPLE representation and optimizes
8778 them as usual to produce @file{myprog}.
8780 The only important thing to keep in mind is that to enable link-time
8781 optimizations you need to use the GCC driver to perform the link-step.
8782 GCC then automatically performs link-time optimization if any of the
8783 objects involved were compiled with the @option{-flto}. You generally
8784 should specify the optimization options to be used for link-time
8785 optimization though GCC will try to be clever at guessing an
8786 optimization level to use from the options used at compile-time
8787 if you fail to specify one at link-time. You can always override
8788 the automatic decision to do link-time optimization at link-time
8789 by passing @option{-fno-lto} to the link command.
8791 To make whole program optimization effective, it is necessary to make
8792 certain whole program assumptions. The compiler needs to know
8793 what functions and variables can be accessed by libraries and runtime
8794 outside of the link-time optimized unit. When supported by the linker,
8795 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8796 to the compiler about used and externally visible symbols. When
8797 the linker plugin is not available, @option{-fwhole-program} should be
8798 used to allow the compiler to make these assumptions, which leads
8799 to more aggressive optimization decisions.
8801 When @option{-fuse-linker-plugin} is not enabled then, when a file is
8802 compiled with @option{-flto}, the generated object file is larger than
8803 a regular object file because it contains GIMPLE bytecodes and the usual
8804 final code (see @option{-ffat-lto-objects}. This means that
8805 object files with LTO information can be linked as normal object
8806 files; if @option{-fno-lto} is passed to the linker, no
8807 interprocedural optimizations are applied. Note that when
8808 @option{-fno-fat-lto-objects} is enabled the compile-stage is faster
8809 but you cannot perform a regular, non-LTO link on them.
8811 Additionally, the optimization flags used to compile individual files
8812 are not necessarily related to those used at link time. For instance,
8815 gcc -c -O0 -ffat-lto-objects -flto foo.c
8816 gcc -c -O0 -ffat-lto-objects -flto bar.c
8817 gcc -o myprog -O3 foo.o bar.o
8820 This produces individual object files with unoptimized assembler
8821 code, but the resulting binary @file{myprog} is optimized at
8822 @option{-O3}. If, instead, the final binary is generated with
8823 @option{-fno-lto}, then @file{myprog} is not optimized.
8825 When producing the final binary, GCC only
8826 applies link-time optimizations to those files that contain bytecode.
8827 Therefore, you can mix and match object files and libraries with
8828 GIMPLE bytecodes and final object code. GCC automatically selects
8829 which files to optimize in LTO mode and which files to link without
8832 There are some code generation flags preserved by GCC when
8833 generating bytecodes, as they need to be used during the final link
8834 stage. Generally options specified at link-time override those
8835 specified at compile-time.
8837 If you do not specify an optimization level option @option{-O} at
8838 link-time then GCC will compute one based on the optimization levels
8839 used when compiling the object files. The highest optimization
8840 level will win here.
8842 Currently, the following options and their setting are take from
8843 the first object file that explicitely specified it:
8844 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8845 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8846 and all the @option{-m} target flags.
8848 Certain ABI changing flags are required to match in all compilation-units
8849 and trying to override this at link-time with a conflicting value
8850 is ignored. This includes options such as @option{-freg-struct-return}
8851 and @option{-fpcc-struct-return}.
8853 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8854 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8855 are passed through to the link stage and merged conservatively for
8856 conflicting translation units. Specifically
8857 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8858 precedence and for example @option{-ffp-contract=off} takes precedence
8859 over @option{-ffp-contract=fast}. You can override them at linke-time.
8861 It is recommended that you compile all the files participating in the
8862 same link with the same options and also specify those options at
8865 If LTO encounters objects with C linkage declared with incompatible
8866 types in separate translation units to be linked together (undefined
8867 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8868 issued. The behavior is still undefined at run time. Similar
8869 diagnostics may be raised for other languages.
8871 Another feature of LTO is that it is possible to apply interprocedural
8872 optimizations on files written in different languages:
8877 gfortran -c -flto baz.f90
8878 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8881 Notice that the final link is done with @command{g++} to get the C++
8882 runtime libraries and @option{-lgfortran} is added to get the Fortran
8883 runtime libraries. In general, when mixing languages in LTO mode, you
8884 should use the same link command options as when mixing languages in a
8885 regular (non-LTO) compilation.
8887 If object files containing GIMPLE bytecode are stored in a library archive, say
8888 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8889 are using a linker with plugin support. To create static libraries suitable
8890 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8891 and @code{ranlib}; to show the symbols of object files with GIMPLE bytecode, use
8892 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8893 and @command{nm} have been compiled with plugin support. At link time, use the the
8894 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8895 the LTO optimization process:
8898 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8901 With the linker plugin enabled, the linker extracts the needed
8902 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8903 to make them part of the aggregated GIMPLE image to be optimized.
8905 If you are not using a linker with plugin support and/or do not
8906 enable the linker plugin, then the objects inside @file{libfoo.a}
8907 are extracted and linked as usual, but they do not participate
8908 in the LTO optimization process. In order to make a static library suitable
8909 for both LTO optimization and usual linkage, compile its object files with
8910 @option{-flto} @code{-ffat-lto-objects}.
8912 Link-time optimizations do not require the presence of the whole program to
8913 operate. If the program does not require any symbols to be exported, it is
8914 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8915 the interprocedural optimizers to use more aggressive assumptions which may
8916 lead to improved optimization opportunities.
8917 Use of @option{-fwhole-program} is not needed when linker plugin is
8918 active (see @option{-fuse-linker-plugin}).
8920 The current implementation of LTO makes no
8921 attempt to generate bytecode that is portable between different
8922 types of hosts. The bytecode files are versioned and there is a
8923 strict version check, so bytecode files generated in one version of
8924 GCC will not work with an older or newer version of GCC.
8926 Link-time optimization does not work well with generation of debugging
8927 information. Combining @option{-flto} with
8928 @option{-g} is currently experimental and expected to produce unexpected
8931 If you specify the optional @var{n}, the optimization and code
8932 generation done at link time is executed in parallel using @var{n}
8933 parallel jobs by utilizing an installed @command{make} program. The
8934 environment variable @env{MAKE} may be used to override the program
8935 used. The default value for @var{n} is 1.
8937 You can also specify @option{-flto=jobserver} to use GNU make's
8938 job server mode to determine the number of parallel jobs. This
8939 is useful when the Makefile calling GCC is already executing in parallel.
8940 You must prepend a @samp{+} to the command recipe in the parent Makefile
8941 for this to work. This option likely only works if @env{MAKE} is
8944 @item -flto-partition=@var{alg}
8945 @opindex flto-partition
8946 Specify the partitioning algorithm used by the link-time optimizer.
8947 The value is either @code{1to1} to specify a partitioning mirroring
8948 the original source files or @code{balanced} to specify partitioning
8949 into equally sized chunks (whenever possible) or @code{max} to create
8950 new partition for every symbol where possible. Specifying @code{none}
8951 as an algorithm disables partitioning and streaming completely.
8952 The default value is @code{balanced}. While @code{1to1} can be used
8953 as an workaround for various code ordering issues, the @code{max}
8954 partitioning is intended for internal testing only.
8955 The value @code{one} specifies that exactly one partition should be
8956 used while the value @code{none} bypasses partitioning and executes
8957 the link-time optimization step directly from the WPA phase.
8959 @item -flto-compression-level=@var{n}
8960 This option specifies the level of compression used for intermediate
8961 language written to LTO object files, and is only meaningful in
8962 conjunction with LTO mode (@option{-flto}). Valid
8963 values are 0 (no compression) to 9 (maximum compression). Values
8964 outside this range are clamped to either 0 or 9. If the option is not
8965 given, a default balanced compression setting is used.
8968 Prints a report with internal details on the workings of the link-time
8969 optimizer. The contents of this report vary from version to version.
8970 It is meant to be useful to GCC developers when processing object
8971 files in LTO mode (via @option{-flto}).
8973 Disabled by default.
8975 @item -flto-report-wpa
8976 Like @option{-flto-report}, but only print for the WPA phase of Link
8979 @item -fuse-linker-plugin
8980 Enables the use of a linker plugin during link-time optimization. This
8981 option relies on plugin support in the linker, which is available in gold
8982 or in GNU ld 2.21 or newer.
8984 This option enables the extraction of object files with GIMPLE bytecode out
8985 of library archives. This improves the quality of optimization by exposing
8986 more code to the link-time optimizer. This information specifies what
8987 symbols can be accessed externally (by non-LTO object or during dynamic
8988 linking). Resulting code quality improvements on binaries (and shared
8989 libraries that use hidden visibility) are similar to @code{-fwhole-program}.
8990 See @option{-flto} for a description of the effect of this flag and how to
8993 This option is enabled by default when LTO support in GCC is enabled
8994 and GCC was configured for use with
8995 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8997 @item -ffat-lto-objects
8998 @opindex ffat-lto-objects
8999 Fat LTO objects are object files that contain both the intermediate language
9000 and the object code. This makes them usable for both LTO linking and normal
9001 linking. This option is effective only when compiling with @option{-flto}
9002 and is ignored at link time.
9004 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9005 requires the complete toolchain to be aware of LTO. It requires a linker with
9006 linker plugin support for basic functionality. Additionally,
9007 @command{nm}, @command{ar} and @command{ranlib}
9008 need to support linker plugins to allow a full-featured build environment
9009 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9010 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9011 to these tools. With non fat LTO makefiles need to be modified to use them.
9013 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9016 @item -fcompare-elim
9017 @opindex fcompare-elim
9018 After register allocation and post-register allocation instruction splitting,
9019 identify arithmetic instructions that compute processor flags similar to a
9020 comparison operation based on that arithmetic. If possible, eliminate the
9021 explicit comparison operation.
9023 This pass only applies to certain targets that cannot explicitly represent
9024 the comparison operation before register allocation is complete.
9026 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9029 @opindex fuse-ld=bfd
9030 Use the @command{bfd} linker instead of the default linker.
9033 @opindex fuse-ld=gold
9034 Use the @command{gold} linker instead of the default linker.
9036 @item -fcprop-registers
9037 @opindex fcprop-registers
9038 After register allocation and post-register allocation instruction splitting,
9039 perform a copy-propagation pass to try to reduce scheduling dependencies
9040 and occasionally eliminate the copy.
9042 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9044 @item -fprofile-correction
9045 @opindex fprofile-correction
9046 Profiles collected using an instrumented binary for multi-threaded programs may
9047 be inconsistent due to missed counter updates. When this option is specified,
9048 GCC uses heuristics to correct or smooth out such inconsistencies. By
9049 default, GCC emits an error message when an inconsistent profile is detected.
9051 @item -fprofile-dir=@var{path}
9052 @opindex fprofile-dir
9054 Set the directory to search for the profile data files in to @var{path}.
9055 This option affects only the profile data generated by
9056 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9057 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9058 and its related options. Both absolute and relative paths can be used.
9059 By default, GCC uses the current directory as @var{path}, thus the
9060 profile data file appears in the same directory as the object file.
9062 @item -fprofile-generate
9063 @itemx -fprofile-generate=@var{path}
9064 @opindex fprofile-generate
9066 Enable options usually used for instrumenting application to produce
9067 profile useful for later recompilation with profile feedback based
9068 optimization. You must use @option{-fprofile-generate} both when
9069 compiling and when linking your program.
9071 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
9073 If @var{path} is specified, GCC looks at the @var{path} to find
9074 the profile feedback data files. See @option{-fprofile-dir}.
9077 @itemx -fprofile-use=@var{path}
9078 @opindex fprofile-use
9079 Enable profile feedback directed optimizations, and optimizations
9080 generally profitable only with profile feedback available.
9082 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
9083 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}, @code{-ftree-vectorize},
9084 @code{ftree-loop-distribute-patterns}
9086 By default, GCC emits an error message if the feedback profiles do not
9087 match the source code. This error can be turned into a warning by using
9088 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9091 If @var{path} is specified, GCC looks at the @var{path} to find
9092 the profile feedback data files. See @option{-fprofile-dir}.
9095 The following options control compiler behavior regarding floating-point
9096 arithmetic. These options trade off between speed and
9097 correctness. All must be specifically enabled.
9101 @opindex ffloat-store
9102 Do not store floating-point variables in registers, and inhibit other
9103 options that might change whether a floating-point value is taken from a
9106 @cindex floating-point precision
9107 This option prevents undesirable excess precision on machines such as
9108 the 68000 where the floating registers (of the 68881) keep more
9109 precision than a @code{double} is supposed to have. Similarly for the
9110 x86 architecture. For most programs, the excess precision does only
9111 good, but a few programs rely on the precise definition of IEEE floating
9112 point. Use @option{-ffloat-store} for such programs, after modifying
9113 them to store all pertinent intermediate computations into variables.
9115 @item -fexcess-precision=@var{style}
9116 @opindex fexcess-precision
9117 This option allows further control over excess precision on machines
9118 where floating-point registers have more precision than the IEEE
9119 @code{float} and @code{double} types and the processor does not
9120 support operations rounding to those types. By default,
9121 @option{-fexcess-precision=fast} is in effect; this means that
9122 operations are carried out in the precision of the registers and that
9123 it is unpredictable when rounding to the types specified in the source
9124 code takes place. When compiling C, if
9125 @option{-fexcess-precision=standard} is specified then excess
9126 precision follows the rules specified in ISO C99; in particular,
9127 both casts and assignments cause values to be rounded to their
9128 semantic types (whereas @option{-ffloat-store} only affects
9129 assignments). This option is enabled by default for C if a strict
9130 conformance option such as @option{-std=c99} is used.
9133 @option{-fexcess-precision=standard} is not implemented for languages
9134 other than C, and has no effect if
9135 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
9136 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
9137 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9138 semantics apply without excess precision, and in the latter, rounding
9143 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9144 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9145 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
9147 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9149 This option is not turned on by any @option{-O} option besides
9150 @option{-Ofast} since it can result in incorrect output for programs
9151 that depend on an exact implementation of IEEE or ISO rules/specifications
9152 for math functions. It may, however, yield faster code for programs
9153 that do not require the guarantees of these specifications.
9155 @item -fno-math-errno
9156 @opindex fno-math-errno
9157 Do not set @code{errno} after calling math functions that are executed
9158 with a single instruction, e.g., @code{sqrt}. A program that relies on
9159 IEEE exceptions for math error handling may want to use this flag
9160 for speed while maintaining IEEE arithmetic compatibility.
9162 This option is not turned on by any @option{-O} option since
9163 it can result in incorrect output for programs that depend on
9164 an exact implementation of IEEE or ISO rules/specifications for
9165 math functions. It may, however, yield faster code for programs
9166 that do not require the guarantees of these specifications.
9168 The default is @option{-fmath-errno}.
9170 On Darwin systems, the math library never sets @code{errno}. There is
9171 therefore no reason for the compiler to consider the possibility that
9172 it might, and @option{-fno-math-errno} is the default.
9174 @item -funsafe-math-optimizations
9175 @opindex funsafe-math-optimizations
9177 Allow optimizations for floating-point arithmetic that (a) assume
9178 that arguments and results are valid and (b) may violate IEEE or
9179 ANSI standards. When used at link-time, it may include libraries
9180 or startup files that change the default FPU control word or other
9181 similar optimizations.
9183 This option is not turned on by any @option{-O} option since
9184 it can result in incorrect output for programs that depend on
9185 an exact implementation of IEEE or ISO rules/specifications for
9186 math functions. It may, however, yield faster code for programs
9187 that do not require the guarantees of these specifications.
9188 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9189 @option{-fassociative-math} and @option{-freciprocal-math}.
9191 The default is @option{-fno-unsafe-math-optimizations}.
9193 @item -fassociative-math
9194 @opindex fassociative-math
9196 Allow re-association of operands in series of floating-point operations.
9197 This violates the ISO C and C++ language standard by possibly changing
9198 computation result. NOTE: re-ordering may change the sign of zero as
9199 well as ignore NaNs and inhibit or create underflow or overflow (and
9200 thus cannot be used on code that relies on rounding behavior like
9201 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9202 and thus may not be used when ordered comparisons are required.
9203 This option requires that both @option{-fno-signed-zeros} and
9204 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9205 much sense with @option{-frounding-math}. For Fortran the option
9206 is automatically enabled when both @option{-fno-signed-zeros} and
9207 @option{-fno-trapping-math} are in effect.
9209 The default is @option{-fno-associative-math}.
9211 @item -freciprocal-math
9212 @opindex freciprocal-math
9214 Allow the reciprocal of a value to be used instead of dividing by
9215 the value if this enables optimizations. For example @code{x / y}
9216 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9217 is subject to common subexpression elimination. Note that this loses
9218 precision and increases the number of flops operating on the value.
9220 The default is @option{-fno-reciprocal-math}.
9222 @item -ffinite-math-only
9223 @opindex ffinite-math-only
9224 Allow optimizations for floating-point arithmetic that assume
9225 that arguments and results are not NaNs or +-Infs.
9227 This option is not turned on by any @option{-O} option since
9228 it can result in incorrect output for programs that depend on
9229 an exact implementation of IEEE or ISO rules/specifications for
9230 math functions. It may, however, yield faster code for programs
9231 that do not require the guarantees of these specifications.
9233 The default is @option{-fno-finite-math-only}.
9235 @item -fno-signed-zeros
9236 @opindex fno-signed-zeros
9237 Allow optimizations for floating-point arithmetic that ignore the
9238 signedness of zero. IEEE arithmetic specifies the behavior of
9239 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9240 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9241 This option implies that the sign of a zero result isn't significant.
9243 The default is @option{-fsigned-zeros}.
9245 @item -fno-trapping-math
9246 @opindex fno-trapping-math
9247 Compile code assuming that floating-point operations cannot generate
9248 user-visible traps. These traps include division by zero, overflow,
9249 underflow, inexact result and invalid operation. This option requires
9250 that @option{-fno-signaling-nans} be in effect. Setting this option may
9251 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9253 This option should never be turned on by any @option{-O} option since
9254 it can result in incorrect output for programs that depend on
9255 an exact implementation of IEEE or ISO rules/specifications for
9258 The default is @option{-ftrapping-math}.
9260 @item -frounding-math
9261 @opindex frounding-math
9262 Disable transformations and optimizations that assume default floating-point
9263 rounding behavior. This is round-to-zero for all floating point
9264 to integer conversions, and round-to-nearest for all other arithmetic
9265 truncations. This option should be specified for programs that change
9266 the FP rounding mode dynamically, or that may be executed with a
9267 non-default rounding mode. This option disables constant folding of
9268 floating-point expressions at compile time (which may be affected by
9269 rounding mode) and arithmetic transformations that are unsafe in the
9270 presence of sign-dependent rounding modes.
9272 The default is @option{-fno-rounding-math}.
9274 This option is experimental and does not currently guarantee to
9275 disable all GCC optimizations that are affected by rounding mode.
9276 Future versions of GCC may provide finer control of this setting
9277 using C99's @code{FENV_ACCESS} pragma. This command-line option
9278 will be used to specify the default state for @code{FENV_ACCESS}.
9280 @item -fsignaling-nans
9281 @opindex fsignaling-nans
9282 Compile code assuming that IEEE signaling NaNs may generate user-visible
9283 traps during floating-point operations. Setting this option disables
9284 optimizations that may change the number of exceptions visible with
9285 signaling NaNs. This option implies @option{-ftrapping-math}.
9287 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9290 The default is @option{-fno-signaling-nans}.
9292 This option is experimental and does not currently guarantee to
9293 disable all GCC optimizations that affect signaling NaN behavior.
9295 @item -fsingle-precision-constant
9296 @opindex fsingle-precision-constant
9297 Treat floating-point constants as single precision instead of
9298 implicitly converting them to double-precision constants.
9300 @item -fcx-limited-range
9301 @opindex fcx-limited-range
9302 When enabled, this option states that a range reduction step is not
9303 needed when performing complex division. Also, there is no checking
9304 whether the result of a complex multiplication or division is @code{NaN
9305 + I*NaN}, with an attempt to rescue the situation in that case. The
9306 default is @option{-fno-cx-limited-range}, but is enabled by
9307 @option{-ffast-math}.
9309 This option controls the default setting of the ISO C99
9310 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9313 @item -fcx-fortran-rules
9314 @opindex fcx-fortran-rules
9315 Complex multiplication and division follow Fortran rules. Range
9316 reduction is done as part of complex division, but there is no checking
9317 whether the result of a complex multiplication or division is @code{NaN
9318 + I*NaN}, with an attempt to rescue the situation in that case.
9320 The default is @option{-fno-cx-fortran-rules}.
9324 The following options control optimizations that may improve
9325 performance, but are not enabled by any @option{-O} options. This
9326 section includes experimental options that may produce broken code.
9329 @item -fbranch-probabilities
9330 @opindex fbranch-probabilities
9331 After running a program compiled with @option{-fprofile-arcs}
9332 (@pxref{Debugging Options,, Options for Debugging Your Program or
9333 @command{gcc}}), you can compile it a second time using
9334 @option{-fbranch-probabilities}, to improve optimizations based on
9335 the number of times each branch was taken. When a program
9336 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9337 counts to a file called @file{@var{sourcename}.gcda} for each source
9338 file. The information in this data file is very dependent on the
9339 structure of the generated code, so you must use the same source code
9340 and the same optimization options for both compilations.
9342 With @option{-fbranch-probabilities}, GCC puts a
9343 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9344 These can be used to improve optimization. Currently, they are only
9345 used in one place: in @file{reorg.c}, instead of guessing which path a
9346 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9347 exactly determine which path is taken more often.
9349 @item -fprofile-values
9350 @opindex fprofile-values
9351 If combined with @option{-fprofile-arcs}, it adds code so that some
9352 data about values of expressions in the program is gathered.
9354 With @option{-fbranch-probabilities}, it reads back the data gathered
9355 from profiling values of expressions for usage in optimizations.
9357 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9359 @item -fprofile-reorder-functions
9360 @opindex fprofile-reorder-functions
9361 Function reordering based on profile instrumentation collects
9362 first time of execution of a function and orders these functions
9365 Enabled with @option{-fprofile-use}.
9369 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9370 to add code to gather information about values of expressions.
9372 With @option{-fbranch-probabilities}, it reads back the data gathered
9373 and actually performs the optimizations based on them.
9374 Currently the optimizations include specialization of division operations
9375 using the knowledge about the value of the denominator.
9377 @item -frename-registers
9378 @opindex frename-registers
9379 Attempt to avoid false dependencies in scheduled code by making use
9380 of registers left over after register allocation. This optimization
9381 most benefits processors with lots of registers. Depending on the
9382 debug information format adopted by the target, however, it can
9383 make debugging impossible, since variables no longer stay in
9384 a ``home register''.
9386 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
9390 Perform tail duplication to enlarge superblock size. This transformation
9391 simplifies the control flow of the function allowing other optimizations to do
9394 Enabled with @option{-fprofile-use}.
9396 @item -funroll-loops
9397 @opindex funroll-loops
9398 Unroll loops whose number of iterations can be determined at compile time or
9399 upon entry to the loop. @option{-funroll-loops} implies
9400 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9401 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9402 a small constant number of iterations). This option makes code larger, and may
9403 or may not make it run faster.
9405 Enabled with @option{-fprofile-use}.
9407 @item -funroll-all-loops
9408 @opindex funroll-all-loops
9409 Unroll all loops, even if their number of iterations is uncertain when
9410 the loop is entered. This usually makes programs run more slowly.
9411 @option{-funroll-all-loops} implies the same options as
9412 @option{-funroll-loops}.
9415 @opindex fpeel-loops
9416 Peels loops for which there is enough information that they do not
9417 roll much (from profile feedback). It also turns on complete loop peeling
9418 (i.e.@: complete removal of loops with small constant number of iterations).
9420 Enabled with @option{-fprofile-use}.
9422 @item -fmove-loop-invariants
9423 @opindex fmove-loop-invariants
9424 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9425 at level @option{-O1}
9427 @item -funswitch-loops
9428 @opindex funswitch-loops
9429 Move branches with loop invariant conditions out of the loop, with duplicates
9430 of the loop on both branches (modified according to result of the condition).
9432 @item -ffunction-sections
9433 @itemx -fdata-sections
9434 @opindex ffunction-sections
9435 @opindex fdata-sections
9436 Place each function or data item into its own section in the output
9437 file if the target supports arbitrary sections. The name of the
9438 function or the name of the data item determines the section's name
9441 Use these options on systems where the linker can perform optimizations
9442 to improve locality of reference in the instruction space. Most systems
9443 using the ELF object format and SPARC processors running Solaris 2 have
9444 linkers with such optimizations. AIX may have these optimizations in
9447 Only use these options when there are significant benefits from doing
9448 so. When you specify these options, the assembler and linker
9449 create larger object and executable files and are also slower.
9450 You cannot use @code{gprof} on all systems if you
9451 specify this option, and you may have problems with debugging if
9452 you specify both this option and @option{-g}.
9454 @item -fbranch-target-load-optimize
9455 @opindex fbranch-target-load-optimize
9456 Perform branch target register load optimization before prologue / epilogue
9458 The use of target registers can typically be exposed only during reload,
9459 thus hoisting loads out of loops and doing inter-block scheduling needs
9460 a separate optimization pass.
9462 @item -fbranch-target-load-optimize2
9463 @opindex fbranch-target-load-optimize2
9464 Perform branch target register load optimization after prologue / epilogue
9467 @item -fbtr-bb-exclusive
9468 @opindex fbtr-bb-exclusive
9469 When performing branch target register load optimization, don't reuse
9470 branch target registers within any basic block.
9472 @item -fstack-protector
9473 @opindex fstack-protector
9474 Emit extra code to check for buffer overflows, such as stack smashing
9475 attacks. This is done by adding a guard variable to functions with
9476 vulnerable objects. This includes functions that call @code{alloca}, and
9477 functions with buffers larger than 8 bytes. The guards are initialized
9478 when a function is entered and then checked when the function exits.
9479 If a guard check fails, an error message is printed and the program exits.
9481 @item -fstack-protector-all
9482 @opindex fstack-protector-all
9483 Like @option{-fstack-protector} except that all functions are protected.
9485 @item -fstack-protector-strong
9486 @opindex fstack-protector-strong
9487 Like @option{-fstack-protector} but includes additional functions to
9488 be protected --- those that have local array definitions, or have
9489 references to local frame addresses.
9491 @item -fsection-anchors
9492 @opindex fsection-anchors
9493 Try to reduce the number of symbolic address calculations by using
9494 shared ``anchor'' symbols to address nearby objects. This transformation
9495 can help to reduce the number of GOT entries and GOT accesses on some
9498 For example, the implementation of the following function @code{foo}:
9502 int foo (void) @{ return a + b + c; @}
9506 usually calculates the addresses of all three variables, but if you
9507 compile it with @option{-fsection-anchors}, it accesses the variables
9508 from a common anchor point instead. The effect is similar to the
9509 following pseudocode (which isn't valid C):
9514 register int *xr = &x;
9515 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9519 Not all targets support this option.
9521 @item --param @var{name}=@var{value}
9523 In some places, GCC uses various constants to control the amount of
9524 optimization that is done. For example, GCC does not inline functions
9525 that contain more than a certain number of instructions. You can
9526 control some of these constants on the command line using the
9527 @option{--param} option.
9529 The names of specific parameters, and the meaning of the values, are
9530 tied to the internals of the compiler, and are subject to change
9531 without notice in future releases.
9533 In each case, the @var{value} is an integer. The allowable choices for
9537 @item predictable-branch-outcome
9538 When branch is predicted to be taken with probability lower than this threshold
9539 (in percent), then it is considered well predictable. The default is 10.
9541 @item max-crossjump-edges
9542 The maximum number of incoming edges to consider for cross-jumping.
9543 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9544 the number of edges incoming to each block. Increasing values mean
9545 more aggressive optimization, making the compilation time increase with
9546 probably small improvement in executable size.
9548 @item min-crossjump-insns
9549 The minimum number of instructions that must be matched at the end
9550 of two blocks before cross-jumping is performed on them. This
9551 value is ignored in the case where all instructions in the block being
9552 cross-jumped from are matched. The default value is 5.
9554 @item max-grow-copy-bb-insns
9555 The maximum code size expansion factor when copying basic blocks
9556 instead of jumping. The expansion is relative to a jump instruction.
9557 The default value is 8.
9559 @item max-goto-duplication-insns
9560 The maximum number of instructions to duplicate to a block that jumps
9561 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9562 passes, GCC factors computed gotos early in the compilation process,
9563 and unfactors them as late as possible. Only computed jumps at the
9564 end of a basic blocks with no more than max-goto-duplication-insns are
9565 unfactored. The default value is 8.
9567 @item max-delay-slot-insn-search
9568 The maximum number of instructions to consider when looking for an
9569 instruction to fill a delay slot. If more than this arbitrary number of
9570 instructions are searched, the time savings from filling the delay slot
9571 are minimal, so stop searching. Increasing values mean more
9572 aggressive optimization, making the compilation time increase with probably
9573 small improvement in execution time.
9575 @item max-delay-slot-live-search
9576 When trying to fill delay slots, the maximum number of instructions to
9577 consider when searching for a block with valid live register
9578 information. Increasing this arbitrarily chosen value means more
9579 aggressive optimization, increasing the compilation time. This parameter
9580 should be removed when the delay slot code is rewritten to maintain the
9583 @item max-gcse-memory
9584 The approximate maximum amount of memory that can be allocated in
9585 order to perform the global common subexpression elimination
9586 optimization. If more memory than specified is required, the
9587 optimization is not done.
9589 @item max-gcse-insertion-ratio
9590 If the ratio of expression insertions to deletions is larger than this value
9591 for any expression, then RTL PRE inserts or removes the expression and thus
9592 leaves partially redundant computations in the instruction stream. The default value is 20.
9594 @item max-pending-list-length
9595 The maximum number of pending dependencies scheduling allows
9596 before flushing the current state and starting over. Large functions
9597 with few branches or calls can create excessively large lists which
9598 needlessly consume memory and resources.
9600 @item max-modulo-backtrack-attempts
9601 The maximum number of backtrack attempts the scheduler should make
9602 when modulo scheduling a loop. Larger values can exponentially increase
9605 @item max-inline-insns-single
9606 Several parameters control the tree inliner used in GCC@.
9607 This number sets the maximum number of instructions (counted in GCC's
9608 internal representation) in a single function that the tree inliner
9609 considers for inlining. This only affects functions declared
9610 inline and methods implemented in a class declaration (C++).
9611 The default value is 400.
9613 @item max-inline-insns-auto
9614 When you use @option{-finline-functions} (included in @option{-O3}),
9615 a lot of functions that would otherwise not be considered for inlining
9616 by the compiler are investigated. To those functions, a different
9617 (more restrictive) limit compared to functions declared inline can
9619 The default value is 40.
9621 @item inline-min-speedup
9622 When estimated performance improvement of caller + callee runtime exceeds this
9623 threshold (in precent), the function can be inlined regardless the limit on
9624 @option{--param max-inline-insns-single} and @option{--param
9625 max-inline-insns-auto}.
9627 @item large-function-insns
9628 The limit specifying really large functions. For functions larger than this
9629 limit after inlining, inlining is constrained by
9630 @option{--param large-function-growth}. This parameter is useful primarily
9631 to avoid extreme compilation time caused by non-linear algorithms used by the
9633 The default value is 2700.
9635 @item large-function-growth
9636 Specifies maximal growth of large function caused by inlining in percents.
9637 The default value is 100 which limits large function growth to 2.0 times
9640 @item large-unit-insns
9641 The limit specifying large translation unit. Growth caused by inlining of
9642 units larger than this limit is limited by @option{--param inline-unit-growth}.
9643 For small units this might be too tight.
9644 For example, consider a unit consisting of function A
9645 that is inline and B that just calls A three times. If B is small relative to
9646 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9647 large units consisting of small inlineable functions, however, the overall unit
9648 growth limit is needed to avoid exponential explosion of code size. Thus for
9649 smaller units, the size is increased to @option{--param large-unit-insns}
9650 before applying @option{--param inline-unit-growth}. The default is 10000.
9652 @item inline-unit-growth
9653 Specifies maximal overall growth of the compilation unit caused by inlining.
9654 The default value is 30 which limits unit growth to 1.3 times the original
9655 size. Cold functions (either marked cold via an attribute or by profile
9656 feedback) are not accounted into the unit size.
9658 @item ipcp-unit-growth
9659 Specifies maximal overall growth of the compilation unit caused by
9660 interprocedural constant propagation. The default value is 10 which limits
9661 unit growth to 1.1 times the original size.
9663 @item large-stack-frame
9664 The limit specifying large stack frames. While inlining the algorithm is trying
9665 to not grow past this limit too much. The default value is 256 bytes.
9667 @item large-stack-frame-growth
9668 Specifies maximal growth of large stack frames caused by inlining in percents.
9669 The default value is 1000 which limits large stack frame growth to 11 times
9672 @item max-inline-insns-recursive
9673 @itemx max-inline-insns-recursive-auto
9674 Specifies the maximum number of instructions an out-of-line copy of a
9675 self-recursive inline
9676 function can grow into by performing recursive inlining.
9678 For functions declared inline, @option{--param max-inline-insns-recursive} is
9679 taken into account. For functions not declared inline, recursive inlining
9680 happens only when @option{-finline-functions} (included in @option{-O3}) is
9681 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
9682 default value is 450.
9684 @item max-inline-recursive-depth
9685 @itemx max-inline-recursive-depth-auto
9686 Specifies the maximum recursion depth used for recursive inlining.
9688 For functions declared inline, @option{--param max-inline-recursive-depth} is
9689 taken into account. For functions not declared inline, recursive inlining
9690 happens only when @option{-finline-functions} (included in @option{-O3}) is
9691 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
9694 @item min-inline-recursive-probability
9695 Recursive inlining is profitable only for function having deep recursion
9696 in average and can hurt for function having little recursion depth by
9697 increasing the prologue size or complexity of function body to other
9700 When profile feedback is available (see @option{-fprofile-generate}) the actual
9701 recursion depth can be guessed from probability that function recurses via a
9702 given call expression. This parameter limits inlining only to call expressions
9703 whose probability exceeds the given threshold (in percents).
9704 The default value is 10.
9706 @item early-inlining-insns
9707 Specify growth that the early inliner can make. In effect it increases
9708 the amount of inlining for code having a large abstraction penalty.
9709 The default value is 10.
9711 @item max-early-inliner-iterations
9712 @itemx max-early-inliner-iterations
9713 Limit of iterations of the early inliner. This basically bounds
9714 the number of nested indirect calls the early inliner can resolve.
9715 Deeper chains are still handled by late inlining.
9717 @item comdat-sharing-probability
9718 @itemx comdat-sharing-probability
9719 Probability (in percent) that C++ inline function with comdat visibility
9720 are shared across multiple compilation units. The default value is 20.
9722 @item profile-func-internal-id
9723 @itemx profile-func-internal-id
9724 A parameter to control whether to use function internal id in profile
9725 database lookup. If the value is 0, the compiler will use id that
9726 is based on function assembler name and filename, which makes old profile
9727 data more tolerant to source changes such as function reordering etc.
9728 The default value is 0.
9730 @item min-vect-loop-bound
9731 The minimum number of iterations under which loops are not vectorized
9732 when @option{-ftree-vectorize} is used. The number of iterations after
9733 vectorization needs to be greater than the value specified by this option
9734 to allow vectorization. The default value is 0.
9736 @item gcse-cost-distance-ratio
9737 Scaling factor in calculation of maximum distance an expression
9738 can be moved by GCSE optimizations. This is currently supported only in the
9739 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9740 is with simple expressions, i.e., the expressions that have cost
9741 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9742 hoisting of simple expressions. The default value is 10.
9744 @item gcse-unrestricted-cost
9745 Cost, roughly measured as the cost of a single typical machine
9746 instruction, at which GCSE optimizations do not constrain
9747 the distance an expression can travel. This is currently
9748 supported only in the code hoisting pass. The lesser the cost,
9749 the more aggressive code hoisting is. Specifying 0
9750 allows all expressions to travel unrestricted distances.
9751 The default value is 3.
9753 @item max-hoist-depth
9754 The depth of search in the dominator tree for expressions to hoist.
9755 This is used to avoid quadratic behavior in hoisting algorithm.
9756 The value of 0 does not limit on the search, but may slow down compilation
9757 of huge functions. The default value is 30.
9759 @item max-tail-merge-comparisons
9760 The maximum amount of similar bbs to compare a bb with. This is used to
9761 avoid quadratic behavior in tree tail merging. The default value is 10.
9763 @item max-tail-merge-iterations
9764 The maximum amount of iterations of the pass over the function. This is used to
9765 limit compilation time in tree tail merging. The default value is 2.
9767 @item max-unrolled-insns
9768 The maximum number of instructions that a loop may have to be unrolled.
9769 If a loop is unrolled, this parameter also determines how many times
9770 the loop code is unrolled.
9772 @item max-average-unrolled-insns
9773 The maximum number of instructions biased by probabilities of their execution
9774 that a loop may have to be unrolled. If a loop is unrolled,
9775 this parameter also determines how many times the loop code is unrolled.
9777 @item max-unroll-times
9778 The maximum number of unrollings of a single loop.
9780 @item max-peeled-insns
9781 The maximum number of instructions that a loop may have to be peeled.
9782 If a loop is peeled, this parameter also determines how many times
9783 the loop code is peeled.
9785 @item max-peel-times
9786 The maximum number of peelings of a single loop.
9788 @item max-peel-branches
9789 The maximum number of branches on the hot path through the peeled sequence.
9791 @item max-completely-peeled-insns
9792 The maximum number of insns of a completely peeled loop.
9794 @item max-completely-peel-times
9795 The maximum number of iterations of a loop to be suitable for complete peeling.
9797 @item max-completely-peel-loop-nest-depth
9798 The maximum depth of a loop nest suitable for complete peeling.
9800 @item max-unswitch-insns
9801 The maximum number of insns of an unswitched loop.
9803 @item max-unswitch-level
9804 The maximum number of branches unswitched in a single loop.
9807 The minimum cost of an expensive expression in the loop invariant motion.
9809 @item iv-consider-all-candidates-bound
9810 Bound on number of candidates for induction variables, below which
9811 all candidates are considered for each use in induction variable
9812 optimizations. If there are more candidates than this,
9813 only the most relevant ones are considered to avoid quadratic time complexity.
9815 @item iv-max-considered-uses
9816 The induction variable optimizations give up on loops that contain more
9817 induction variable uses.
9819 @item iv-always-prune-cand-set-bound
9820 If the number of candidates in the set is smaller than this value,
9821 always try to remove unnecessary ivs from the set
9822 when adding a new one.
9824 @item scev-max-expr-size
9825 Bound on size of expressions used in the scalar evolutions analyzer.
9826 Large expressions slow the analyzer.
9828 @item scev-max-expr-complexity
9829 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9830 Complex expressions slow the analyzer.
9832 @item omega-max-vars
9833 The maximum number of variables in an Omega constraint system.
9834 The default value is 128.
9836 @item omega-max-geqs
9837 The maximum number of inequalities in an Omega constraint system.
9838 The default value is 256.
9841 The maximum number of equalities in an Omega constraint system.
9842 The default value is 128.
9844 @item omega-max-wild-cards
9845 The maximum number of wildcard variables that the Omega solver is
9846 able to insert. The default value is 18.
9848 @item omega-hash-table-size
9849 The size of the hash table in the Omega solver. The default value is
9852 @item omega-max-keys
9853 The maximal number of keys used by the Omega solver. The default
9856 @item omega-eliminate-redundant-constraints
9857 When set to 1, use expensive methods to eliminate all redundant
9858 constraints. The default value is 0.
9860 @item vect-max-version-for-alignment-checks
9861 The maximum number of run-time checks that can be performed when
9862 doing loop versioning for alignment in the vectorizer.
9864 @item vect-max-version-for-alias-checks
9865 The maximum number of run-time checks that can be performed when
9866 doing loop versioning for alias in the vectorizer.
9868 @item vect-max-peeling-for-alignment
9869 The maximum number of loop peels to enhance access alignment
9870 for vectorizer. Value -1 means 'no limit'.
9872 @item max-iterations-to-track
9873 The maximum number of iterations of a loop the brute-force algorithm
9874 for analysis of the number of iterations of the loop tries to evaluate.
9876 @item hot-bb-count-ws-permille
9877 A basic block profile count is considered hot if it contributes to
9878 the given permillage (i.e. 0...1000) of the entire profiled execution.
9880 @item hot-bb-frequency-fraction
9881 Select fraction of the entry block frequency of executions of basic block in
9882 function given basic block needs to have to be considered hot.
9884 @item max-predicted-iterations
9885 The maximum number of loop iterations we predict statically. This is useful
9886 in cases where a function contains a single loop with known bound and
9887 another loop with unknown bound.
9888 The known number of iterations is predicted correctly, while
9889 the unknown number of iterations average to roughly 10. This means that the
9890 loop without bounds appears artificially cold relative to the other one.
9892 @item builtin-expect-probability
9893 Control the probability of the expression having the specified value. This
9894 parameter takes a percentage (i.e. 0 ... 100) as input.
9895 The default probability of 90 is obtained empirically.
9897 @item align-threshold
9899 Select fraction of the maximal frequency of executions of a basic block in
9900 a function to align the basic block.
9902 @item align-loop-iterations
9904 A loop expected to iterate at least the selected number of iterations is
9907 @item tracer-dynamic-coverage
9908 @itemx tracer-dynamic-coverage-feedback
9910 This value is used to limit superblock formation once the given percentage of
9911 executed instructions is covered. This limits unnecessary code size
9914 The @option{tracer-dynamic-coverage-feedback} is used only when profile
9915 feedback is available. The real profiles (as opposed to statically estimated
9916 ones) are much less balanced allowing the threshold to be larger value.
9918 @item tracer-max-code-growth
9919 Stop tail duplication once code growth has reached given percentage. This is
9920 a rather artificial limit, as most of the duplicates are eliminated later in
9921 cross jumping, so it may be set to much higher values than is the desired code
9924 @item tracer-min-branch-ratio
9926 Stop reverse growth when the reverse probability of best edge is less than this
9927 threshold (in percent).
9929 @item tracer-min-branch-ratio
9930 @itemx tracer-min-branch-ratio-feedback
9932 Stop forward growth if the best edge has probability lower than this
9935 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
9936 compilation for profile feedback and one for compilation without. The value
9937 for compilation with profile feedback needs to be more conservative (higher) in
9938 order to make tracer effective.
9940 @item max-cse-path-length
9942 The maximum number of basic blocks on path that CSE considers.
9946 The maximum number of instructions CSE processes before flushing.
9947 The default is 1000.
9949 @item ggc-min-expand
9951 GCC uses a garbage collector to manage its own memory allocation. This
9952 parameter specifies the minimum percentage by which the garbage
9953 collector's heap should be allowed to expand between collections.
9954 Tuning this may improve compilation speed; it has no effect on code
9957 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9958 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9959 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9960 GCC is not able to calculate RAM on a particular platform, the lower
9961 bound of 30% is used. Setting this parameter and
9962 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9963 every opportunity. This is extremely slow, but can be useful for
9966 @item ggc-min-heapsize
9968 Minimum size of the garbage collector's heap before it begins bothering
9969 to collect garbage. The first collection occurs after the heap expands
9970 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9971 tuning this may improve compilation speed, and has no effect on code
9974 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9975 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9976 with a lower bound of 4096 (four megabytes) and an upper bound of
9977 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9978 particular platform, the lower bound is used. Setting this parameter
9979 very large effectively disables garbage collection. Setting this
9980 parameter and @option{ggc-min-expand} to zero causes a full collection
9981 to occur at every opportunity.
9983 @item max-reload-search-insns
9984 The maximum number of instruction reload should look backward for equivalent
9985 register. Increasing values mean more aggressive optimization, making the
9986 compilation time increase with probably slightly better performance.
9987 The default value is 100.
9989 @item max-cselib-memory-locations
9990 The maximum number of memory locations cselib should take into account.
9991 Increasing values mean more aggressive optimization, making the compilation time
9992 increase with probably slightly better performance. The default value is 500.
9994 @item reorder-blocks-duplicate
9995 @itemx reorder-blocks-duplicate-feedback
9997 Used by the basic block reordering pass to decide whether to use unconditional
9998 branch or duplicate the code on its destination. Code is duplicated when its
9999 estimated size is smaller than this value multiplied by the estimated size of
10000 unconditional jump in the hot spots of the program.
10002 The @option{reorder-block-duplicate-feedback} is used only when profile
10003 feedback is available. It may be set to higher values than
10004 @option{reorder-block-duplicate} since information about the hot spots is more
10007 @item max-sched-ready-insns
10008 The maximum number of instructions ready to be issued the scheduler should
10009 consider at any given time during the first scheduling pass. Increasing
10010 values mean more thorough searches, making the compilation time increase
10011 with probably little benefit. The default value is 100.
10013 @item max-sched-region-blocks
10014 The maximum number of blocks in a region to be considered for
10015 interblock scheduling. The default value is 10.
10017 @item max-pipeline-region-blocks
10018 The maximum number of blocks in a region to be considered for
10019 pipelining in the selective scheduler. The default value is 15.
10021 @item max-sched-region-insns
10022 The maximum number of insns in a region to be considered for
10023 interblock scheduling. The default value is 100.
10025 @item max-pipeline-region-insns
10026 The maximum number of insns in a region to be considered for
10027 pipelining in the selective scheduler. The default value is 200.
10029 @item min-spec-prob
10030 The minimum probability (in percents) of reaching a source block
10031 for interblock speculative scheduling. The default value is 40.
10033 @item max-sched-extend-regions-iters
10034 The maximum number of iterations through CFG to extend regions.
10035 A value of 0 (the default) disables region extensions.
10037 @item max-sched-insn-conflict-delay
10038 The maximum conflict delay for an insn to be considered for speculative motion.
10039 The default value is 3.
10041 @item sched-spec-prob-cutoff
10042 The minimal probability of speculation success (in percents), so that
10043 speculative insns are scheduled.
10044 The default value is 40.
10046 @item sched-spec-state-edge-prob-cutoff
10047 The minimum probability an edge must have for the scheduler to save its
10049 The default value is 10.
10051 @item sched-mem-true-dep-cost
10052 Minimal distance (in CPU cycles) between store and load targeting same
10053 memory locations. The default value is 1.
10055 @item selsched-max-lookahead
10056 The maximum size of the lookahead window of selective scheduling. It is a
10057 depth of search for available instructions.
10058 The default value is 50.
10060 @item selsched-max-sched-times
10061 The maximum number of times that an instruction is scheduled during
10062 selective scheduling. This is the limit on the number of iterations
10063 through which the instruction may be pipelined. The default value is 2.
10065 @item selsched-max-insns-to-rename
10066 The maximum number of best instructions in the ready list that are considered
10067 for renaming in the selective scheduler. The default value is 2.
10070 The minimum value of stage count that swing modulo scheduler
10071 generates. The default value is 2.
10073 @item max-last-value-rtl
10074 The maximum size measured as number of RTLs that can be recorded in an expression
10075 in combiner for a pseudo register as last known value of that register. The default
10078 @item max-combine-insns
10079 The maximum number of instructions the RTL combiner tries to combine.
10080 The default value is 2 at @option{-Og} and 4 otherwise.
10082 @item integer-share-limit
10083 Small integer constants can use a shared data structure, reducing the
10084 compiler's memory usage and increasing its speed. This sets the maximum
10085 value of a shared integer constant. The default value is 256.
10087 @item ssp-buffer-size
10088 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10089 protection when @option{-fstack-protection} is used.
10091 @item min-size-for-stack-sharing
10092 The minimum size of variables taking part in stack slot sharing when not
10093 optimizing. The default value is 32.
10095 @item max-jump-thread-duplication-stmts
10096 Maximum number of statements allowed in a block that needs to be
10097 duplicated when threading jumps.
10099 @item max-fields-for-field-sensitive
10100 Maximum number of fields in a structure treated in
10101 a field sensitive manner during pointer analysis. The default is zero
10102 for @option{-O0} and @option{-O1},
10103 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10105 @item prefetch-latency
10106 Estimate on average number of instructions that are executed before
10107 prefetch finishes. The distance prefetched ahead is proportional
10108 to this constant. Increasing this number may also lead to less
10109 streams being prefetched (see @option{simultaneous-prefetches}).
10111 @item simultaneous-prefetches
10112 Maximum number of prefetches that can run at the same time.
10114 @item l1-cache-line-size
10115 The size of cache line in L1 cache, in bytes.
10117 @item l1-cache-size
10118 The size of L1 cache, in kilobytes.
10120 @item l2-cache-size
10121 The size of L2 cache, in kilobytes.
10123 @item min-insn-to-prefetch-ratio
10124 The minimum ratio between the number of instructions and the
10125 number of prefetches to enable prefetching in a loop.
10127 @item prefetch-min-insn-to-mem-ratio
10128 The minimum ratio between the number of instructions and the
10129 number of memory references to enable prefetching in a loop.
10131 @item use-canonical-types
10132 Whether the compiler should use the ``canonical'' type system. By
10133 default, this should always be 1, which uses a more efficient internal
10134 mechanism for comparing types in C++ and Objective-C++. However, if
10135 bugs in the canonical type system are causing compilation failures,
10136 set this value to 0 to disable canonical types.
10138 @item switch-conversion-max-branch-ratio
10139 Switch initialization conversion refuses to create arrays that are
10140 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10141 branches in the switch.
10143 @item max-partial-antic-length
10144 Maximum length of the partial antic set computed during the tree
10145 partial redundancy elimination optimization (@option{-ftree-pre}) when
10146 optimizing at @option{-O3} and above. For some sorts of source code
10147 the enhanced partial redundancy elimination optimization can run away,
10148 consuming all of the memory available on the host machine. This
10149 parameter sets a limit on the length of the sets that are computed,
10150 which prevents the runaway behavior. Setting a value of 0 for
10151 this parameter allows an unlimited set length.
10153 @item sccvn-max-scc-size
10154 Maximum size of a strongly connected component (SCC) during SCCVN
10155 processing. If this limit is hit, SCCVN processing for the whole
10156 function is not done and optimizations depending on it are
10157 disabled. The default maximum SCC size is 10000.
10159 @item sccvn-max-alias-queries-per-access
10160 Maximum number of alias-oracle queries we perform when looking for
10161 redundancies for loads and stores. If this limit is hit the search
10162 is aborted and the load or store is not considered redundant. The
10163 number of queries is algorithmically limited to the number of
10164 stores on all paths from the load to the function entry.
10165 The default maxmimum number of queries is 1000.
10167 @item ira-max-loops-num
10168 IRA uses regional register allocation by default. If a function
10169 contains more loops than the number given by this parameter, only at most
10170 the given number of the most frequently-executed loops form regions
10171 for regional register allocation. The default value of the
10174 @item ira-max-conflict-table-size
10175 Although IRA uses a sophisticated algorithm to compress the conflict
10176 table, the table can still require excessive amounts of memory for
10177 huge functions. If the conflict table for a function could be more
10178 than the size in MB given by this parameter, the register allocator
10179 instead uses a faster, simpler, and lower-quality
10180 algorithm that does not require building a pseudo-register conflict table.
10181 The default value of the parameter is 2000.
10183 @item ira-loop-reserved-regs
10184 IRA can be used to evaluate more accurate register pressure in loops
10185 for decisions to move loop invariants (see @option{-O3}). The number
10186 of available registers reserved for some other purposes is given
10187 by this parameter. The default value of the parameter is 2, which is
10188 the minimal number of registers needed by typical instructions.
10189 This value is the best found from numerous experiments.
10191 @item loop-invariant-max-bbs-in-loop
10192 Loop invariant motion can be very expensive, both in compilation time and
10193 in amount of needed compile-time memory, with very large loops. Loops
10194 with more basic blocks than this parameter won't have loop invariant
10195 motion optimization performed on them. The default value of the
10196 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10198 @item loop-max-datarefs-for-datadeps
10199 Building data dapendencies is expensive for very large loops. This
10200 parameter limits the number of data references in loops that are
10201 considered for data dependence analysis. These large loops are no
10202 handled by the optimizations using loop data dependencies.
10203 The default value is 1000.
10205 @item max-vartrack-size
10206 Sets a maximum number of hash table slots to use during variable
10207 tracking dataflow analysis of any function. If this limit is exceeded
10208 with variable tracking at assignments enabled, analysis for that
10209 function is retried without it, after removing all debug insns from
10210 the function. If the limit is exceeded even without debug insns, var
10211 tracking analysis is completely disabled for the function. Setting
10212 the parameter to zero makes it unlimited.
10214 @item max-vartrack-expr-depth
10215 Sets a maximum number of recursion levels when attempting to map
10216 variable names or debug temporaries to value expressions. This trades
10217 compilation time for more complete debug information. If this is set too
10218 low, value expressions that are available and could be represented in
10219 debug information may end up not being used; setting this higher may
10220 enable the compiler to find more complex debug expressions, but compile
10221 time and memory use may grow. The default is 12.
10223 @item min-nondebug-insn-uid
10224 Use uids starting at this parameter for nondebug insns. The range below
10225 the parameter is reserved exclusively for debug insns created by
10226 @option{-fvar-tracking-assignments}, but debug insns may get
10227 (non-overlapping) uids above it if the reserved range is exhausted.
10229 @item ipa-sra-ptr-growth-factor
10230 IPA-SRA replaces a pointer to an aggregate with one or more new
10231 parameters only when their cumulative size is less or equal to
10232 @option{ipa-sra-ptr-growth-factor} times the size of the original
10235 @item tm-max-aggregate-size
10236 When making copies of thread-local variables in a transaction, this
10237 parameter specifies the size in bytes after which variables are
10238 saved with the logging functions as opposed to save/restore code
10239 sequence pairs. This option only applies when using
10242 @item graphite-max-nb-scop-params
10243 To avoid exponential effects in the Graphite loop transforms, the
10244 number of parameters in a Static Control Part (SCoP) is bounded. The
10245 default value is 10 parameters. A variable whose value is unknown at
10246 compilation time and defined outside a SCoP is a parameter of the SCoP.
10248 @item graphite-max-bbs-per-function
10249 To avoid exponential effects in the detection of SCoPs, the size of
10250 the functions analyzed by Graphite is bounded. The default value is
10253 @item loop-block-tile-size
10254 Loop blocking or strip mining transforms, enabled with
10255 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10256 loop in the loop nest by a given number of iterations. The strip
10257 length can be changed using the @option{loop-block-tile-size}
10258 parameter. The default value is 51 iterations.
10260 @item ipa-cp-value-list-size
10261 IPA-CP attempts to track all possible values and types passed to a function's
10262 parameter in order to propagate them and perform devirtualization.
10263 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10264 stores per one formal parameter of a function.
10266 @item ipa-cp-eval-threshold
10267 IPA-CP calculates its own score of cloning profitability heuristics
10268 and performs those cloning opportunities with scores that exceed
10269 @option{ipa-cp-eval-threshold}.
10271 @item ipa-max-agg-items
10272 IPA-CP is also capable to propagate a number of scalar values passed
10273 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10274 number of such values per one parameter.
10276 @item ipa-cp-loop-hint-bonus
10277 When IPA-CP determines that a cloning candidate would make the number
10278 of iterations of a loop known, it adds a bonus of
10279 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10282 @item ipa-cp-array-index-hint-bonus
10283 When IPA-CP determines that a cloning candidate would make the index of
10284 an array access known, it adds a bonus of
10285 @option{ipa-cp-array-index-hint-bonus} to the profitability
10286 score of the candidate.
10288 @item ipa-max-aa-steps
10289 During its analysis of function bodies, IPA-CP employs alias analysis
10290 in order to track values pointed to by function parameters. In order
10291 not spend too much time analyzing huge functions, it will give up and
10292 consider all memory clobbered after examining
10293 @option{ipa-max-aa-steps} statements modifying memory.
10295 @item lto-partitions
10296 Specify desired number of partitions produced during WHOPR compilation.
10297 The number of partitions should exceed the number of CPUs used for compilation.
10298 The default value is 32.
10300 @item lto-minpartition
10301 Size of minimal partition for WHOPR (in estimated instructions).
10302 This prevents expenses of splitting very small programs into too many
10305 @item cxx-max-namespaces-for-diagnostic-help
10306 The maximum number of namespaces to consult for suggestions when C++
10307 name lookup fails for an identifier. The default is 1000.
10309 @item sink-frequency-threshold
10310 The maximum relative execution frequency (in percents) of the target block
10311 relative to a statement's original block to allow statement sinking of a
10312 statement. Larger numbers result in more aggressive statement sinking.
10313 The default value is 75. A small positive adjustment is applied for
10314 statements with memory operands as those are even more profitable so sink.
10316 @item max-stores-to-sink
10317 The maximum number of conditional stores paires that can be sunk. Set to 0
10318 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10319 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10321 @item allow-store-data-races
10322 Allow optimizers to introduce new data races on stores.
10323 Set to 1 to allow, otherwise to 0. This option is enabled by default
10324 at optimization level @option{-Ofast}.
10326 @item case-values-threshold
10327 The smallest number of different values for which it is best to use a
10328 jump-table instead of a tree of conditional branches. If the value is
10329 0, use the default for the machine. The default is 0.
10331 @item tree-reassoc-width
10332 Set the maximum number of instructions executed in parallel in
10333 reassociated tree. This parameter overrides target dependent
10334 heuristics used by default if has non zero value.
10336 @item sched-pressure-algorithm
10337 Choose between the two available implementations of
10338 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10339 and is the more likely to prevent instructions from being reordered.
10340 Algorithm 2 was designed to be a compromise between the relatively
10341 conservative approach taken by algorithm 1 and the rather aggressive
10342 approach taken by the default scheduler. It relies more heavily on
10343 having a regular register file and accurate register pressure classes.
10344 See @file{haifa-sched.c} in the GCC sources for more details.
10346 The default choice depends on the target.
10348 @item max-slsr-cand-scan
10349 Set the maximum number of existing candidates that will be considered when
10350 seeking a basis for a new straight-line strength reduction candidate.
10353 Enable buffer overflow detection for global objects. This kind
10354 of protection is enabled by default if you are using
10355 @option{-fsanitize=address} option.
10356 To disable global objects protection use @option{--param asan-globals=0}.
10359 Enable buffer overflow detection for stack objects. This kind of
10360 protection is enabled by default when using@option{-fsanitize=address}.
10361 To disable stack protection use @option{--param asan-stack=0} option.
10363 @item asan-instrument-reads
10364 Enable buffer overflow detection for memory reads. This kind of
10365 protection is enabled by default when using @option{-fsanitize=address}.
10366 To disable memory reads protection use
10367 @option{--param asan-instrument-reads=0}.
10369 @item asan-instrument-writes
10370 Enable buffer overflow detection for memory writes. This kind of
10371 protection is enabled by default when using @option{-fsanitize=address}.
10372 To disable memory writes protection use
10373 @option{--param asan-instrument-writes=0} option.
10375 @item asan-memintrin
10376 Enable detection for built-in functions. This kind of protection
10377 is enabled by default when using @option{-fsanitize=address}.
10378 To disable built-in functions protection use
10379 @option{--param asan-memintrin=0}.
10381 @item asan-use-after-return
10382 Enable detection of use-after-return. This kind of protection
10383 is enabled by default when using @option{-fsanitize=address} option.
10384 To disable use-after-return detection use
10385 @option{--param asan-use-after-return=0}.
10387 @item asan-instrumentation-with-call-threshold
10388 Once number of memory accesses in function becomes greater
10389 or equal than this number, use callbacks instead of
10390 generating inline code. E.g. to disable inline code use
10391 @option{--param asan-instrumentation-with-call-threshold=0}.
10396 @node Preprocessor Options
10397 @section Options Controlling the Preprocessor
10398 @cindex preprocessor options
10399 @cindex options, preprocessor
10401 These options control the C preprocessor, which is run on each C source
10402 file before actual compilation.
10404 If you use the @option{-E} option, nothing is done except preprocessing.
10405 Some of these options make sense only together with @option{-E} because
10406 they cause the preprocessor output to be unsuitable for actual
10410 @item -Wp,@var{option}
10412 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10413 and pass @var{option} directly through to the preprocessor. If
10414 @var{option} contains commas, it is split into multiple options at the
10415 commas. However, many options are modified, translated or interpreted
10416 by the compiler driver before being passed to the preprocessor, and
10417 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10418 interface is undocumented and subject to change, so whenever possible
10419 you should avoid using @option{-Wp} and let the driver handle the
10422 @item -Xpreprocessor @var{option}
10423 @opindex Xpreprocessor
10424 Pass @var{option} as an option to the preprocessor. You can use this to
10425 supply system-specific preprocessor options that GCC does not
10428 If you want to pass an option that takes an argument, you must use
10429 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10431 @item -no-integrated-cpp
10432 @opindex no-integrated-cpp
10433 Perform preprocessing as a separate pass before compilation.
10434 By default, GCC performs preprocessing as an integrated part of
10435 input tokenization and parsing.
10436 If this option is provided, the appropriate language front end
10437 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10438 and Objective-C, respectively) is instead invoked twice,
10439 once for preprocessing only and once for actual compilation
10440 of the preprocessed input.
10441 This option may be useful in conjunction with the @option{-B} or
10442 @option{-wrapper} options to specify an alternate preprocessor or
10443 perform additional processing of the program source between
10444 normal preprocessing and compilation.
10447 @include cppopts.texi
10449 @node Assembler Options
10450 @section Passing Options to the Assembler
10452 @c prevent bad page break with this line
10453 You can pass options to the assembler.
10456 @item -Wa,@var{option}
10458 Pass @var{option} as an option to the assembler. If @var{option}
10459 contains commas, it is split into multiple options at the commas.
10461 @item -Xassembler @var{option}
10462 @opindex Xassembler
10463 Pass @var{option} as an option to the assembler. You can use this to
10464 supply system-specific assembler options that GCC does not
10467 If you want to pass an option that takes an argument, you must use
10468 @option{-Xassembler} twice, once for the option and once for the argument.
10473 @section Options for Linking
10474 @cindex link options
10475 @cindex options, linking
10477 These options come into play when the compiler links object files into
10478 an executable output file. They are meaningless if the compiler is
10479 not doing a link step.
10483 @item @var{object-file-name}
10484 A file name that does not end in a special recognized suffix is
10485 considered to name an object file or library. (Object files are
10486 distinguished from libraries by the linker according to the file
10487 contents.) If linking is done, these object files are used as input
10496 If any of these options is used, then the linker is not run, and
10497 object file names should not be used as arguments. @xref{Overall
10501 @item -l@var{library}
10502 @itemx -l @var{library}
10504 Search the library named @var{library} when linking. (The second
10505 alternative with the library as a separate argument is only for
10506 POSIX compliance and is not recommended.)
10508 It makes a difference where in the command you write this option; the
10509 linker searches and processes libraries and object files in the order they
10510 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10511 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10512 to functions in @samp{z}, those functions may not be loaded.
10514 The linker searches a standard list of directories for the library,
10515 which is actually a file named @file{lib@var{library}.a}. The linker
10516 then uses this file as if it had been specified precisely by name.
10518 The directories searched include several standard system directories
10519 plus any that you specify with @option{-L}.
10521 Normally the files found this way are library files---archive files
10522 whose members are object files. The linker handles an archive file by
10523 scanning through it for members which define symbols that have so far
10524 been referenced but not defined. But if the file that is found is an
10525 ordinary object file, it is linked in the usual fashion. The only
10526 difference between using an @option{-l} option and specifying a file name
10527 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10528 and searches several directories.
10532 You need this special case of the @option{-l} option in order to
10533 link an Objective-C or Objective-C++ program.
10535 @item -nostartfiles
10536 @opindex nostartfiles
10537 Do not use the standard system startup files when linking.
10538 The standard system libraries are used normally, unless @option{-nostdlib}
10539 or @option{-nodefaultlibs} is used.
10541 @item -nodefaultlibs
10542 @opindex nodefaultlibs
10543 Do not use the standard system libraries when linking.
10544 Only the libraries you specify are passed to the linker, and options
10545 specifying linkage of the system libraries, such as @code{-static-libgcc}
10546 or @code{-shared-libgcc}, are ignored.
10547 The standard startup files are used normally, unless @option{-nostartfiles}
10550 The compiler may generate calls to @code{memcmp},
10551 @code{memset}, @code{memcpy} and @code{memmove}.
10552 These entries are usually resolved by entries in
10553 libc. These entry points should be supplied through some other
10554 mechanism when this option is specified.
10558 Do not use the standard system startup files or libraries when linking.
10559 No startup files and only the libraries you specify are passed to
10560 the linker, and options specifying linkage of the system libraries, such as
10561 @code{-static-libgcc} or @code{-shared-libgcc}, are ignored.
10563 The compiler may generate calls to @code{memcmp}, @code{memset},
10564 @code{memcpy} and @code{memmove}.
10565 These entries are usually resolved by entries in
10566 libc. These entry points should be supplied through some other
10567 mechanism when this option is specified.
10569 @cindex @option{-lgcc}, use with @option{-nostdlib}
10570 @cindex @option{-nostdlib} and unresolved references
10571 @cindex unresolved references and @option{-nostdlib}
10572 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10573 @cindex @option{-nodefaultlibs} and unresolved references
10574 @cindex unresolved references and @option{-nodefaultlibs}
10575 One of the standard libraries bypassed by @option{-nostdlib} and
10576 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10577 which GCC uses to overcome shortcomings of particular machines, or special
10578 needs for some languages.
10579 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10580 Collection (GCC) Internals},
10581 for more discussion of @file{libgcc.a}.)
10582 In most cases, you need @file{libgcc.a} even when you want to avoid
10583 other standard libraries. In other words, when you specify @option{-nostdlib}
10584 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10585 This ensures that you have no unresolved references to internal GCC
10586 library subroutines.
10587 (An example of such an internal subroutine is @samp{__main}, used to ensure C++
10588 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10589 GNU Compiler Collection (GCC) Internals}.)
10593 Produce a position independent executable on targets that support it.
10594 For predictable results, you must also specify the same set of options
10595 used for compilation (@option{-fpie}, @option{-fPIE},
10596 or model suboptions) when you specify this linker option.
10600 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10601 that support it. This instructs the linker to add all symbols, not
10602 only used ones, to the dynamic symbol table. This option is needed
10603 for some uses of @code{dlopen} or to allow obtaining backtraces
10604 from within a program.
10608 Remove all symbol table and relocation information from the executable.
10612 On systems that support dynamic linking, this prevents linking with the shared
10613 libraries. On other systems, this option has no effect.
10617 Produce a shared object which can then be linked with other objects to
10618 form an executable. Not all systems support this option. For predictable
10619 results, you must also specify the same set of options used for compilation
10620 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10621 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10622 needs to build supplementary stub code for constructors to work. On
10623 multi-libbed systems, @samp{gcc -shared} must select the correct support
10624 libraries to link against. Failing to supply the correct flags may lead
10625 to subtle defects. Supplying them in cases where they are not necessary
10628 @item -shared-libgcc
10629 @itemx -static-libgcc
10630 @opindex shared-libgcc
10631 @opindex static-libgcc
10632 On systems that provide @file{libgcc} as a shared library, these options
10633 force the use of either the shared or static version, respectively.
10634 If no shared version of @file{libgcc} was built when the compiler was
10635 configured, these options have no effect.
10637 There are several situations in which an application should use the
10638 shared @file{libgcc} instead of the static version. The most common
10639 of these is when the application wishes to throw and catch exceptions
10640 across different shared libraries. In that case, each of the libraries
10641 as well as the application itself should use the shared @file{libgcc}.
10643 Therefore, the G++ and GCJ drivers automatically add
10644 @option{-shared-libgcc} whenever you build a shared library or a main
10645 executable, because C++ and Java programs typically use exceptions, so
10646 this is the right thing to do.
10648 If, instead, you use the GCC driver to create shared libraries, you may
10649 find that they are not always linked with the shared @file{libgcc}.
10650 If GCC finds, at its configuration time, that you have a non-GNU linker
10651 or a GNU linker that does not support option @option{--eh-frame-hdr},
10652 it links the shared version of @file{libgcc} into shared libraries
10653 by default. Otherwise, it takes advantage of the linker and optimizes
10654 away the linking with the shared version of @file{libgcc}, linking with
10655 the static version of libgcc by default. This allows exceptions to
10656 propagate through such shared libraries, without incurring relocation
10657 costs at library load time.
10659 However, if a library or main executable is supposed to throw or catch
10660 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10661 for the languages used in the program, or using the option
10662 @option{-shared-libgcc}, such that it is linked with the shared
10665 @item -static-libasan
10666 @opindex static-libasan
10667 When the @option{-fsanitize=address} option is used to link a program,
10668 the GCC driver automatically links against @option{libasan}. If
10669 @file{libasan} is available as a shared library, and the @option{-static}
10670 option is not used, then this links against the shared version of
10671 @file{libasan}. The @option{-static-libasan} option directs the GCC
10672 driver to link @file{libasan} statically, without necessarily linking
10673 other libraries statically.
10675 @item -static-libtsan
10676 @opindex static-libtsan
10677 When the @option{-fsanitize=thread} option is used to link a program,
10678 the GCC driver automatically links against @option{libtsan}. If
10679 @file{libtsan} is available as a shared library, and the @option{-static}
10680 option is not used, then this links against the shared version of
10681 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10682 driver to link @file{libtsan} statically, without necessarily linking
10683 other libraries statically.
10685 @item -static-liblsan
10686 @opindex static-liblsan
10687 When the @option{-fsanitize=leak} option is used to link a program,
10688 the GCC driver automatically links against @option{liblsan}. If
10689 @file{liblsan} is available as a shared library, and the @option{-static}
10690 option is not used, then this links against the shared version of
10691 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10692 driver to link @file{liblsan} statically, without necessarily linking
10693 other libraries statically.
10695 @item -static-libubsan
10696 @opindex static-libubsan
10697 When the @option{-fsanitize=undefined} option is used to link a program,
10698 the GCC driver automatically links against @option{libubsan}. If
10699 @file{libubsan} is available as a shared library, and the @option{-static}
10700 option is not used, then this links against the shared version of
10701 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10702 driver to link @file{libubsan} statically, without necessarily linking
10703 other libraries statically.
10705 @item -static-libstdc++
10706 @opindex static-libstdc++
10707 When the @command{g++} program is used to link a C++ program, it
10708 normally automatically links against @option{libstdc++}. If
10709 @file{libstdc++} is available as a shared library, and the
10710 @option{-static} option is not used, then this links against the
10711 shared version of @file{libstdc++}. That is normally fine. However, it
10712 is sometimes useful to freeze the version of @file{libstdc++} used by
10713 the program without going all the way to a fully static link. The
10714 @option{-static-libstdc++} option directs the @command{g++} driver to
10715 link @file{libstdc++} statically, without necessarily linking other
10716 libraries statically.
10720 Bind references to global symbols when building a shared object. Warn
10721 about any unresolved references (unless overridden by the link editor
10722 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
10725 @item -T @var{script}
10727 @cindex linker script
10728 Use @var{script} as the linker script. This option is supported by most
10729 systems using the GNU linker. On some targets, such as bare-board
10730 targets without an operating system, the @option{-T} option may be required
10731 when linking to avoid references to undefined symbols.
10733 @item -Xlinker @var{option}
10735 Pass @var{option} as an option to the linker. You can use this to
10736 supply system-specific linker options that GCC does not recognize.
10738 If you want to pass an option that takes a separate argument, you must use
10739 @option{-Xlinker} twice, once for the option and once for the argument.
10740 For example, to pass @option{-assert definitions}, you must write
10741 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10742 @option{-Xlinker "-assert definitions"}, because this passes the entire
10743 string as a single argument, which is not what the linker expects.
10745 When using the GNU linker, it is usually more convenient to pass
10746 arguments to linker options using the @option{@var{option}=@var{value}}
10747 syntax than as separate arguments. For example, you can specify
10748 @option{-Xlinker -Map=output.map} rather than
10749 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10750 this syntax for command-line options.
10752 @item -Wl,@var{option}
10754 Pass @var{option} as an option to the linker. If @var{option} contains
10755 commas, it is split into multiple options at the commas. You can use this
10756 syntax to pass an argument to the option.
10757 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10758 linker. When using the GNU linker, you can also get the same effect with
10759 @option{-Wl,-Map=output.map}.
10761 @item -u @var{symbol}
10763 Pretend the symbol @var{symbol} is undefined, to force linking of
10764 library modules to define it. You can use @option{-u} multiple times with
10765 different symbols to force loading of additional library modules.
10767 @item -z @var{keyword}
10769 @option{-z} is passed directly on to the linker along with the keyword
10770 @var{keyword}. See the section in the documentation of your linker for
10771 permitted values and their meanings.
10774 @node Directory Options
10775 @section Options for Directory Search
10776 @cindex directory options
10777 @cindex options, directory search
10778 @cindex search path
10780 These options specify directories to search for header files, for
10781 libraries and for parts of the compiler:
10786 Add the directory @var{dir} to the head of the list of directories to be
10787 searched for header files. This can be used to override a system header
10788 file, substituting your own version, since these directories are
10789 searched before the system header file directories. However, you should
10790 not use this option to add directories that contain vendor-supplied
10791 system header files (use @option{-isystem} for that). If you use more than
10792 one @option{-I} option, the directories are scanned in left-to-right
10793 order; the standard system directories come after.
10795 If a standard system include directory, or a directory specified with
10796 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
10797 option is ignored. The directory is still searched but as a
10798 system directory at its normal position in the system include chain.
10799 This is to ensure that GCC's procedure to fix buggy system headers and
10800 the ordering for the @code{include_next} directive are not inadvertently changed.
10801 If you really need to change the search order for system directories,
10802 use the @option{-nostdinc} and/or @option{-isystem} options.
10804 @item -iplugindir=@var{dir}
10805 @opindex iplugindir=
10806 Set the directory to search for plugins that are passed
10807 by @option{-fplugin=@var{name}} instead of
10808 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
10809 to be used by the user, but only passed by the driver.
10811 @item -iquote@var{dir}
10813 Add the directory @var{dir} to the head of the list of directories to
10814 be searched for header files only for the case of @samp{#include
10815 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
10816 otherwise just like @option{-I}.
10820 Add directory @var{dir} to the list of directories to be searched
10823 @item -B@var{prefix}
10825 This option specifies where to find the executables, libraries,
10826 include files, and data files of the compiler itself.
10828 The compiler driver program runs one or more of the subprograms
10829 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
10830 @var{prefix} as a prefix for each program it tries to run, both with and
10831 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
10833 For each subprogram to be run, the compiler driver first tries the
10834 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
10835 is not specified, the driver tries two standard prefixes,
10836 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
10837 those results in a file name that is found, the unmodified program
10838 name is searched for using the directories specified in your
10839 @env{PATH} environment variable.
10841 The compiler checks to see if the path provided by the @option{-B}
10842 refers to a directory, and if necessary it adds a directory
10843 separator character at the end of the path.
10845 @option{-B} prefixes that effectively specify directory names also apply
10846 to libraries in the linker, because the compiler translates these
10847 options into @option{-L} options for the linker. They also apply to
10848 include files in the preprocessor, because the compiler translates these
10849 options into @option{-isystem} options for the preprocessor. In this case,
10850 the compiler appends @samp{include} to the prefix.
10852 The runtime support file @file{libgcc.a} can also be searched for using
10853 the @option{-B} prefix, if needed. If it is not found there, the two
10854 standard prefixes above are tried, and that is all. The file is left
10855 out of the link if it is not found by those means.
10857 Another way to specify a prefix much like the @option{-B} prefix is to use
10858 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
10861 As a special kludge, if the path provided by @option{-B} is
10862 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
10863 9, then it is replaced by @file{[dir/]include}. This is to help
10864 with boot-strapping the compiler.
10866 @item -specs=@var{file}
10868 Process @var{file} after the compiler reads in the standard @file{specs}
10869 file, in order to override the defaults which the @command{gcc} driver
10870 program uses when determining what switches to pass to @command{cc1},
10871 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
10872 @option{-specs=@var{file}} can be specified on the command line, and they
10873 are processed in order, from left to right.
10875 @item --sysroot=@var{dir}
10877 Use @var{dir} as the logical root directory for headers and libraries.
10878 For example, if the compiler normally searches for headers in
10879 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
10880 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
10882 If you use both this option and the @option{-isysroot} option, then
10883 the @option{--sysroot} option applies to libraries, but the
10884 @option{-isysroot} option applies to header files.
10886 The GNU linker (beginning with version 2.16) has the necessary support
10887 for this option. If your linker does not support this option, the
10888 header file aspect of @option{--sysroot} still works, but the
10889 library aspect does not.
10891 @item --no-sysroot-suffix
10892 @opindex no-sysroot-suffix
10893 For some targets, a suffix is added to the root directory specified
10894 with @option{--sysroot}, depending on the other options used, so that
10895 headers may for example be found in
10896 @file{@var{dir}/@var{suffix}/usr/include} instead of
10897 @file{@var{dir}/usr/include}. This option disables the addition of
10902 This option has been deprecated. Please use @option{-iquote} instead for
10903 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
10904 Any directories you specify with @option{-I} options before the @option{-I-}
10905 option are searched only for the case of @samp{#include "@var{file}"};
10906 they are not searched for @samp{#include <@var{file}>}.
10908 If additional directories are specified with @option{-I} options after
10909 the @option{-I-}, these directories are searched for all @samp{#include}
10910 directives. (Ordinarily @emph{all} @option{-I} directories are used
10913 In addition, the @option{-I-} option inhibits the use of the current
10914 directory (where the current input file came from) as the first search
10915 directory for @samp{#include "@var{file}"}. There is no way to
10916 override this effect of @option{-I-}. With @option{-I.} you can specify
10917 searching the directory that is current when the compiler is
10918 invoked. That is not exactly the same as what the preprocessor does
10919 by default, but it is often satisfactory.
10921 @option{-I-} does not inhibit the use of the standard system directories
10922 for header files. Thus, @option{-I-} and @option{-nostdinc} are
10929 @section Specifying subprocesses and the switches to pass to them
10932 @command{gcc} is a driver program. It performs its job by invoking a
10933 sequence of other programs to do the work of compiling, assembling and
10934 linking. GCC interprets its command-line parameters and uses these to
10935 deduce which programs it should invoke, and which command-line options
10936 it ought to place on their command lines. This behavior is controlled
10937 by @dfn{spec strings}. In most cases there is one spec string for each
10938 program that GCC can invoke, but a few programs have multiple spec
10939 strings to control their behavior. The spec strings built into GCC can
10940 be overridden by using the @option{-specs=} command-line switch to specify
10943 @dfn{Spec files} are plaintext files that are used to construct spec
10944 strings. They consist of a sequence of directives separated by blank
10945 lines. The type of directive is determined by the first non-whitespace
10946 character on the line, which can be one of the following:
10949 @item %@var{command}
10950 Issues a @var{command} to the spec file processor. The commands that can
10954 @item %include <@var{file}>
10955 @cindex @code{%include}
10956 Search for @var{file} and insert its text at the current point in the
10959 @item %include_noerr <@var{file}>
10960 @cindex @code{%include_noerr}
10961 Just like @samp{%include}, but do not generate an error message if the include
10962 file cannot be found.
10964 @item %rename @var{old_name} @var{new_name}
10965 @cindex @code{%rename}
10966 Rename the spec string @var{old_name} to @var{new_name}.
10970 @item *[@var{spec_name}]:
10971 This tells the compiler to create, override or delete the named spec
10972 string. All lines after this directive up to the next directive or
10973 blank line are considered to be the text for the spec string. If this
10974 results in an empty string then the spec is deleted. (Or, if the
10975 spec did not exist, then nothing happens.) Otherwise, if the spec
10976 does not currently exist a new spec is created. If the spec does
10977 exist then its contents are overridden by the text of this
10978 directive, unless the first character of that text is the @samp{+}
10979 character, in which case the text is appended to the spec.
10981 @item [@var{suffix}]:
10982 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
10983 and up to the next directive or blank line are considered to make up the
10984 spec string for the indicated suffix. When the compiler encounters an
10985 input file with the named suffix, it processes the spec string in
10986 order to work out how to compile that file. For example:
10990 z-compile -input %i
10993 This says that any input file whose name ends in @samp{.ZZ} should be
10994 passed to the program @samp{z-compile}, which should be invoked with the
10995 command-line switch @option{-input} and with the result of performing the
10996 @samp{%i} substitution. (See below.)
10998 As an alternative to providing a spec string, the text following a
10999 suffix directive can be one of the following:
11002 @item @@@var{language}
11003 This says that the suffix is an alias for a known @var{language}. This is
11004 similar to using the @option{-x} command-line switch to GCC to specify a
11005 language explicitly. For example:
11012 Says that .ZZ files are, in fact, C++ source files.
11015 This causes an error messages saying:
11018 @var{name} compiler not installed on this system.
11022 GCC already has an extensive list of suffixes built into it.
11023 This directive adds an entry to the end of the list of suffixes, but
11024 since the list is searched from the end backwards, it is effectively
11025 possible to override earlier entries using this technique.
11029 GCC has the following spec strings built into it. Spec files can
11030 override these strings or create their own. Note that individual
11031 targets can also add their own spec strings to this list.
11034 asm Options to pass to the assembler
11035 asm_final Options to pass to the assembler post-processor
11036 cpp Options to pass to the C preprocessor
11037 cc1 Options to pass to the C compiler
11038 cc1plus Options to pass to the C++ compiler
11039 endfile Object files to include at the end of the link
11040 link Options to pass to the linker
11041 lib Libraries to include on the command line to the linker
11042 libgcc Decides which GCC support library to pass to the linker
11043 linker Sets the name of the linker
11044 predefines Defines to be passed to the C preprocessor
11045 signed_char Defines to pass to CPP to say whether @code{char} is signed
11047 startfile Object files to include at the start of the link
11050 Here is a small example of a spec file:
11053 %rename lib old_lib
11056 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
11059 This example renames the spec called @samp{lib} to @samp{old_lib} and
11060 then overrides the previous definition of @samp{lib} with a new one.
11061 The new definition adds in some extra command-line options before
11062 including the text of the old definition.
11064 @dfn{Spec strings} are a list of command-line options to be passed to their
11065 corresponding program. In addition, the spec strings can contain
11066 @samp{%}-prefixed sequences to substitute variable text or to
11067 conditionally insert text into the command line. Using these constructs
11068 it is possible to generate quite complex command lines.
11070 Here is a table of all defined @samp{%}-sequences for spec
11071 strings. Note that spaces are not generated automatically around the
11072 results of expanding these sequences. Therefore you can concatenate them
11073 together or combine them with constant text in a single argument.
11077 Substitute one @samp{%} into the program name or argument.
11080 Substitute the name of the input file being processed.
11083 Substitute the basename of the input file being processed.
11084 This is the substring up to (and not including) the last period
11085 and not including the directory.
11088 This is the same as @samp{%b}, but include the file suffix (text after
11092 Marks the argument containing or following the @samp{%d} as a
11093 temporary file name, so that that file is deleted if GCC exits
11094 successfully. Unlike @samp{%g}, this contributes no text to the
11097 @item %g@var{suffix}
11098 Substitute a file name that has suffix @var{suffix} and is chosen
11099 once per compilation, and mark the argument in the same way as
11100 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
11101 name is now chosen in a way that is hard to predict even when previously
11102 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
11103 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
11104 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
11105 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
11106 was simply substituted with a file name chosen once per compilation,
11107 without regard to any appended suffix (which was therefore treated
11108 just like ordinary text), making such attacks more likely to succeed.
11110 @item %u@var{suffix}
11111 Like @samp{%g}, but generates a new temporary file name
11112 each time it appears instead of once per compilation.
11114 @item %U@var{suffix}
11115 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
11116 new one if there is no such last file name. In the absence of any
11117 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
11118 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
11119 involves the generation of two distinct file names, one
11120 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
11121 simply substituted with a file name chosen for the previous @samp{%u},
11122 without regard to any appended suffix.
11124 @item %j@var{suffix}
11125 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
11126 writable, and if @option{-save-temps} is not used;
11127 otherwise, substitute the name
11128 of a temporary file, just like @samp{%u}. This temporary file is not
11129 meant for communication between processes, but rather as a junk
11130 disposal mechanism.
11132 @item %|@var{suffix}
11133 @itemx %m@var{suffix}
11134 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
11135 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
11136 all. These are the two most common ways to instruct a program that it
11137 should read from standard input or write to standard output. If you
11138 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
11139 construct: see for example @file{f/lang-specs.h}.
11141 @item %.@var{SUFFIX}
11142 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
11143 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
11144 terminated by the next space or %.
11147 Marks the argument containing or following the @samp{%w} as the
11148 designated output file of this compilation. This puts the argument
11149 into the sequence of arguments that @samp{%o} substitutes.
11152 Substitutes the names of all the output files, with spaces
11153 automatically placed around them. You should write spaces
11154 around the @samp{%o} as well or the results are undefined.
11155 @samp{%o} is for use in the specs for running the linker.
11156 Input files whose names have no recognized suffix are not compiled
11157 at all, but they are included among the output files, so they are
11161 Substitutes the suffix for object files. Note that this is
11162 handled specially when it immediately follows @samp{%g, %u, or %U},
11163 because of the need for those to form complete file names. The
11164 handling is such that @samp{%O} is treated exactly as if it had already
11165 been substituted, except that @samp{%g, %u, and %U} do not currently
11166 support additional @var{suffix} characters following @samp{%O} as they do
11167 following, for example, @samp{.o}.
11170 Substitutes the standard macro predefinitions for the
11171 current target machine. Use this when running @code{cpp}.
11174 Like @samp{%p}, but puts @samp{__} before and after the name of each
11175 predefined macro, except for macros that start with @samp{__} or with
11176 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
11180 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
11181 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
11182 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
11183 and @option{-imultilib} as necessary.
11186 Current argument is the name of a library or startup file of some sort.
11187 Search for that file in a standard list of directories and substitute
11188 the full name found. The current working directory is included in the
11189 list of directories scanned.
11192 Current argument is the name of a linker script. Search for that file
11193 in the current list of directories to scan for libraries. If the file
11194 is located insert a @option{--script} option into the command line
11195 followed by the full path name found. If the file is not found then
11196 generate an error message. Note: the current working directory is not
11200 Print @var{str} as an error message. @var{str} is terminated by a newline.
11201 Use this when inconsistent options are detected.
11203 @item %(@var{name})
11204 Substitute the contents of spec string @var{name} at this point.
11206 @item %x@{@var{option}@}
11207 Accumulate an option for @samp{%X}.
11210 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
11214 Output the accumulated assembler options specified by @option{-Wa}.
11217 Output the accumulated preprocessor options specified by @option{-Wp}.
11220 Process the @code{asm} spec. This is used to compute the
11221 switches to be passed to the assembler.
11224 Process the @code{asm_final} spec. This is a spec string for
11225 passing switches to an assembler post-processor, if such a program is
11229 Process the @code{link} spec. This is the spec for computing the
11230 command line passed to the linker. Typically it makes use of the
11231 @samp{%L %G %S %D and %E} sequences.
11234 Dump out a @option{-L} option for each directory that GCC believes might
11235 contain startup files. If the target supports multilibs then the
11236 current multilib directory is prepended to each of these paths.
11239 Process the @code{lib} spec. This is a spec string for deciding which
11240 libraries are included on the command line to the linker.
11243 Process the @code{libgcc} spec. This is a spec string for deciding
11244 which GCC support library is included on the command line to the linker.
11247 Process the @code{startfile} spec. This is a spec for deciding which
11248 object files are the first ones passed to the linker. Typically
11249 this might be a file named @file{crt0.o}.
11252 Process the @code{endfile} spec. This is a spec string that specifies
11253 the last object files that are passed to the linker.
11256 Process the @code{cpp} spec. This is used to construct the arguments
11257 to be passed to the C preprocessor.
11260 Process the @code{cc1} spec. This is used to construct the options to be
11261 passed to the actual C compiler (@samp{cc1}).
11264 Process the @code{cc1plus} spec. This is used to construct the options to be
11265 passed to the actual C++ compiler (@samp{cc1plus}).
11268 Substitute the variable part of a matched option. See below.
11269 Note that each comma in the substituted string is replaced by
11273 Remove all occurrences of @code{-S} from the command line. Note---this
11274 command is position dependent. @samp{%} commands in the spec string
11275 before this one see @code{-S}, @samp{%} commands in the spec string
11276 after this one do not.
11278 @item %:@var{function}(@var{args})
11279 Call the named function @var{function}, passing it @var{args}.
11280 @var{args} is first processed as a nested spec string, then split
11281 into an argument vector in the usual fashion. The function returns
11282 a string which is processed as if it had appeared literally as part
11283 of the current spec.
11285 The following built-in spec functions are provided:
11288 @item @code{getenv}
11289 The @code{getenv} spec function takes two arguments: an environment
11290 variable name and a string. If the environment variable is not
11291 defined, a fatal error is issued. Otherwise, the return value is the
11292 value of the environment variable concatenated with the string. For
11293 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
11296 %:getenv(TOPDIR /include)
11299 expands to @file{/path/to/top/include}.
11301 @item @code{if-exists}
11302 The @code{if-exists} spec function takes one argument, an absolute
11303 pathname to a file. If the file exists, @code{if-exists} returns the
11304 pathname. Here is a small example of its usage:
11308 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
11311 @item @code{if-exists-else}
11312 The @code{if-exists-else} spec function is similar to the @code{if-exists}
11313 spec function, except that it takes two arguments. The first argument is
11314 an absolute pathname to a file. If the file exists, @code{if-exists-else}
11315 returns the pathname. If it does not exist, it returns the second argument.
11316 This way, @code{if-exists-else} can be used to select one file or another,
11317 based on the existence of the first. Here is a small example of its usage:
11321 crt0%O%s %:if-exists(crti%O%s) \
11322 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
11325 @item @code{replace-outfile}
11326 The @code{replace-outfile} spec function takes two arguments. It looks for the
11327 first argument in the outfiles array and replaces it with the second argument. Here
11328 is a small example of its usage:
11331 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
11334 @item @code{remove-outfile}
11335 The @code{remove-outfile} spec function takes one argument. It looks for the
11336 first argument in the outfiles array and removes it. Here is a small example
11340 %:remove-outfile(-lm)
11343 @item @code{pass-through-libs}
11344 The @code{pass-through-libs} spec function takes any number of arguments. It
11345 finds any @option{-l} options and any non-options ending in @file{.a} (which it
11346 assumes are the names of linker input library archive files) and returns a
11347 result containing all the found arguments each prepended by
11348 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
11349 intended to be passed to the LTO linker plugin.
11352 %:pass-through-libs(%G %L %G)
11355 @item @code{print-asm-header}
11356 The @code{print-asm-header} function takes no arguments and simply
11357 prints a banner like:
11363 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
11366 It is used to separate compiler options from assembler options
11367 in the @option{--target-help} output.
11370 @item %@{@code{S}@}
11371 Substitutes the @code{-S} switch, if that switch is given to GCC@.
11372 If that switch is not specified, this substitutes nothing. Note that
11373 the leading dash is omitted when specifying this option, and it is
11374 automatically inserted if the substitution is performed. Thus the spec
11375 string @samp{%@{foo@}} matches the command-line option @option{-foo}
11376 and outputs the command-line option @option{-foo}.
11378 @item %W@{@code{S}@}
11379 Like %@{@code{S}@} but mark last argument supplied within as a file to be
11380 deleted on failure.
11382 @item %@{@code{S}*@}
11383 Substitutes all the switches specified to GCC whose names start
11384 with @code{-S}, but which also take an argument. This is used for
11385 switches like @option{-o}, @option{-D}, @option{-I}, etc.
11386 GCC considers @option{-o foo} as being
11387 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
11388 text, including the space. Thus two arguments are generated.
11390 @item %@{@code{S}*&@code{T}*@}
11391 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
11392 (the order of @code{S} and @code{T} in the spec is not significant).
11393 There can be any number of ampersand-separated variables; for each the
11394 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
11396 @item %@{@code{S}:@code{X}@}
11397 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
11399 @item %@{!@code{S}:@code{X}@}
11400 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
11402 @item %@{@code{S}*:@code{X}@}
11403 Substitutes @code{X} if one or more switches whose names start with
11404 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
11405 once, no matter how many such switches appeared. However, if @code{%*}
11406 appears somewhere in @code{X}, then @code{X} is substituted once
11407 for each matching switch, with the @code{%*} replaced by the part of
11408 that switch matching the @code{*}.
11410 If @code{%*} appears as the last part of a spec sequence then a space
11411 will be added after the end of the last substitution. If there is more
11412 text in the sequence however then a space will not be generated. This
11413 allows the @code{%*} substitution to be used as part of a larger
11414 string. For example, a spec string like this:
11417 %@{mcu=*:--script=%*/memory.ld@}
11420 when matching an option like @code{-mcu=newchip} will produce:
11423 --script=newchip/memory.ld
11426 @item %@{.@code{S}:@code{X}@}
11427 Substitutes @code{X}, if processing a file with suffix @code{S}.
11429 @item %@{!.@code{S}:@code{X}@}
11430 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
11432 @item %@{,@code{S}:@code{X}@}
11433 Substitutes @code{X}, if processing a file for language @code{S}.
11435 @item %@{!,@code{S}:@code{X}@}
11436 Substitutes @code{X}, if not processing a file for language @code{S}.
11438 @item %@{@code{S}|@code{P}:@code{X}@}
11439 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
11440 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
11441 @code{*} sequences as well, although they have a stronger binding than
11442 the @samp{|}. If @code{%*} appears in @code{X}, all of the
11443 alternatives must be starred, and only the first matching alternative
11446 For example, a spec string like this:
11449 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
11453 outputs the following command-line options from the following input
11454 command-line options:
11459 -d fred.c -foo -baz -boggle
11460 -d jim.d -bar -baz -boggle
11463 @item %@{S:X; T:Y; :D@}
11465 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
11466 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
11467 be as many clauses as you need. This may be combined with @code{.},
11468 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
11473 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
11474 construct may contain other nested @samp{%} constructs or spaces, or
11475 even newlines. They are processed as usual, as described above.
11476 Trailing white space in @code{X} is ignored. White space may also
11477 appear anywhere on the left side of the colon in these constructs,
11478 except between @code{.} or @code{*} and the corresponding word.
11480 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
11481 handled specifically in these constructs. If another value of
11482 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
11483 @option{-W} switch is found later in the command line, the earlier
11484 switch value is ignored, except with @{@code{S}*@} where @code{S} is
11485 just one letter, which passes all matching options.
11487 The character @samp{|} at the beginning of the predicate text is used to
11488 indicate that a command should be piped to the following command, but
11489 only if @option{-pipe} is specified.
11491 It is built into GCC which switches take arguments and which do not.
11492 (You might think it would be useful to generalize this to allow each
11493 compiler's spec to say which switches take arguments. But this cannot
11494 be done in a consistent fashion. GCC cannot even decide which input
11495 files have been specified without knowing which switches take arguments,
11496 and it must know which input files to compile in order to tell which
11499 GCC also knows implicitly that arguments starting in @option{-l} are to be
11500 treated as compiler output files, and passed to the linker in their
11501 proper position among the other output files.
11503 @c man begin OPTIONS
11505 @node Target Options
11506 @section Specifying Target Machine and Compiler Version
11507 @cindex target options
11508 @cindex cross compiling
11509 @cindex specifying machine version
11510 @cindex specifying compiler version and target machine
11511 @cindex compiler version, specifying
11512 @cindex target machine, specifying
11514 The usual way to run GCC is to run the executable called @command{gcc}, or
11515 @command{@var{machine}-gcc} when cross-compiling, or
11516 @command{@var{machine}-gcc-@var{version}} to run a version other than the
11517 one that was installed last.
11519 @node Submodel Options
11520 @section Hardware Models and Configurations
11521 @cindex submodel options
11522 @cindex specifying hardware config
11523 @cindex hardware models and configurations, specifying
11524 @cindex machine dependent options
11526 Each target machine types can have its own
11527 special options, starting with @samp{-m}, to choose among various
11528 hardware models or configurations---for example, 68010 vs 68020,
11529 floating coprocessor or none. A single installed version of the
11530 compiler can compile for any model or configuration, according to the
11533 Some configurations of the compiler also support additional special
11534 options, usually for compatibility with other compilers on the same
11537 @c This list is ordered alphanumerically by subsection name.
11538 @c It should be the same order and spelling as these options are listed
11539 @c in Machine Dependent Options
11542 * AArch64 Options::
11543 * Adapteva Epiphany Options::
11547 * Blackfin Options::
11552 * DEC Alpha Options::
11555 * GNU/Linux Options::
11558 * i386 and x86-64 Options::
11559 * i386 and x86-64 Windows Options::
11567 * MicroBlaze Options::
11570 * MN10300 Options::
11574 * Nios II Options::
11576 * picoChip Options::
11577 * PowerPC Options::
11579 * RS/6000 and PowerPC Options::
11581 * S/390 and zSeries Options::
11584 * Solaris 2 Options::
11587 * System V Options::
11588 * TILE-Gx Options::
11589 * TILEPro Options::
11593 * VxWorks Options::
11595 * Xstormy16 Options::
11597 * zSeries Options::
11600 @node AArch64 Options
11601 @subsection AArch64 Options
11602 @cindex AArch64 Options
11604 These options are defined for AArch64 implementations:
11608 @item -mabi=@var{name}
11610 Generate code for the specified data model. Permissible values
11611 are @samp{ilp32} for SysV-like data model where int, long int and pointer
11612 are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit,
11613 but long int and pointer are 64-bit.
11615 The default depends on the specific target configuration. Note that
11616 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
11617 entire program with the same ABI, and link with a compatible set of libraries.
11620 @opindex mbig-endian
11621 Generate big-endian code. This is the default when GCC is configured for an
11622 @samp{aarch64_be-*-*} target.
11624 @item -mgeneral-regs-only
11625 @opindex mgeneral-regs-only
11626 Generate code which uses only the general registers.
11628 @item -mlittle-endian
11629 @opindex mlittle-endian
11630 Generate little-endian code. This is the default when GCC is configured for an
11631 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
11633 @item -mcmodel=tiny
11634 @opindex mcmodel=tiny
11635 Generate code for the tiny code model. The program and its statically defined
11636 symbols must be within 1GB of each other. Pointers are 64 bits. Programs can
11637 be statically or dynamically linked. This model is not fully implemented and
11638 mostly treated as @samp{small}.
11640 @item -mcmodel=small
11641 @opindex mcmodel=small
11642 Generate code for the small code model. The program and its statically defined
11643 symbols must be within 4GB of each other. Pointers are 64 bits. Programs can
11644 be statically or dynamically linked. This is the default code model.
11646 @item -mcmodel=large
11647 @opindex mcmodel=large
11648 Generate code for the large code model. This makes no assumptions about
11649 addresses and sizes of sections. Pointers are 64 bits. Programs can be
11650 statically linked only.
11652 @item -mstrict-align
11653 @opindex mstrict-align
11654 Do not assume that unaligned memory references will be handled by the system.
11656 @item -momit-leaf-frame-pointer
11657 @itemx -mno-omit-leaf-frame-pointer
11658 @opindex momit-leaf-frame-pointer
11659 @opindex mno-omit-leaf-frame-pointer
11660 Omit or keep the frame pointer in leaf functions. The former behaviour is the
11663 @item -mtls-dialect=desc
11664 @opindex mtls-dialect=desc
11665 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
11666 of TLS variables. This is the default.
11668 @item -mtls-dialect=traditional
11669 @opindex mtls-dialect=traditional
11670 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
11673 @item -march=@var{name}
11675 Specify the name of the target architecture, optionally suffixed by one or
11676 more feature modifiers. This option has the form
11677 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
11678 only permissible value for @var{arch} is @samp{armv8-a}. The permissible
11679 values for @var{feature} are documented in the sub-section below.
11681 Where conflicting feature modifiers are specified, the right-most feature is
11684 GCC uses this name to determine what kind of instructions it can emit when
11685 generating assembly code.
11687 Where @option{-march} is specified without either of @option{-mtune}
11688 or @option{-mcpu} also being specified, the code will be tuned to perform
11689 well across a range of target processors implementing the target
11692 @item -mtune=@var{name}
11694 Specify the name of the target processor for which GCC should tune the
11695 performance of the code. Permissible values for this option are:
11696 @samp{generic}, @samp{cortex-a53}, @samp{cortex-a57}.
11698 Additionally, this option can specify that GCC should tune the performance
11699 of the code for a big.LITTLE system. The only permissible value is
11700 @samp{cortex-a57.cortex-a53}.
11702 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
11703 are specified, the code will be tuned to perform well across a range
11704 of target processors.
11706 This option cannot be suffixed by feature modifiers.
11708 @item -mcpu=@var{name}
11710 Specify the name of the target processor, optionally suffixed by one or more
11711 feature modifiers. This option has the form
11712 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
11713 permissible values for @var{cpu} are the same as those available for
11716 The permissible values for @var{feature} are documented in the sub-section
11719 Where conflicting feature modifiers are specified, the right-most feature is
11722 GCC uses this name to determine what kind of instructions it can emit when
11723 generating assembly code (as if by @option{-march}) and to determine
11724 the target processor for which to tune for performance (as if
11725 by @option{-mtune}). Where this option is used in conjunction
11726 with @option{-march} or @option{-mtune}, those options take precedence
11727 over the appropriate part of this option.
11730 @subsubsection @option{-march} and @option{-mcpu} feature modifiers
11731 @cindex @option{-march} feature modifiers
11732 @cindex @option{-mcpu} feature modifiers
11733 Feature modifiers used with @option{-march} and @option{-mcpu} can be one
11738 Enable CRC extension.
11740 Enable Crypto extension. This implies Advanced SIMD is enabled.
11742 Enable floating-point instructions.
11744 Enable Advanced SIMD instructions. This implies floating-point instructions
11745 are enabled. This is the default for all current possible values for options
11746 @option{-march} and @option{-mcpu=}.
11749 @node Adapteva Epiphany Options
11750 @subsection Adapteva Epiphany Options
11752 These @samp{-m} options are defined for Adapteva Epiphany:
11755 @item -mhalf-reg-file
11756 @opindex mhalf-reg-file
11757 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
11758 That allows code to run on hardware variants that lack these registers.
11760 @item -mprefer-short-insn-regs
11761 @opindex mprefer-short-insn-regs
11762 Preferrentially allocate registers that allow short instruction generation.
11763 This can result in increased instruction count, so this may either reduce or
11764 increase overall code size.
11766 @item -mbranch-cost=@var{num}
11767 @opindex mbranch-cost
11768 Set the cost of branches to roughly @var{num} ``simple'' instructions.
11769 This cost is only a heuristic and is not guaranteed to produce
11770 consistent results across releases.
11774 Enable the generation of conditional moves.
11776 @item -mnops=@var{num}
11778 Emit @var{num} NOPs before every other generated instruction.
11780 @item -mno-soft-cmpsf
11781 @opindex mno-soft-cmpsf
11782 For single-precision floating-point comparisons, emit an @code{fsub} instruction
11783 and test the flags. This is faster than a software comparison, but can
11784 get incorrect results in the presence of NaNs, or when two different small
11785 numbers are compared such that their difference is calculated as zero.
11786 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
11787 software comparisons.
11789 @item -mstack-offset=@var{num}
11790 @opindex mstack-offset
11791 Set the offset between the top of the stack and the stack pointer.
11792 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
11793 can be used by leaf functions without stack allocation.
11794 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
11795 Note also that this option changes the ABI; compiling a program with a
11796 different stack offset than the libraries have been compiled with
11797 generally does not work.
11798 This option can be useful if you want to evaluate if a different stack
11799 offset would give you better code, but to actually use a different stack
11800 offset to build working programs, it is recommended to configure the
11801 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
11803 @item -mno-round-nearest
11804 @opindex mno-round-nearest
11805 Make the scheduler assume that the rounding mode has been set to
11806 truncating. The default is @option{-mround-nearest}.
11809 @opindex mlong-calls
11810 If not otherwise specified by an attribute, assume all calls might be beyond
11811 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
11812 function address into a register before performing a (otherwise direct) call.
11813 This is the default.
11815 @item -mshort-calls
11816 @opindex short-calls
11817 If not otherwise specified by an attribute, assume all direct calls are
11818 in the range of the @code{b} / @code{bl} instructions, so use these instructions
11819 for direct calls. The default is @option{-mlong-calls}.
11823 Assume addresses can be loaded as 16-bit unsigned values. This does not
11824 apply to function addresses for which @option{-mlong-calls} semantics
11827 @item -mfp-mode=@var{mode}
11829 Set the prevailing mode of the floating-point unit.
11830 This determines the floating-point mode that is provided and expected
11831 at function call and return time. Making this mode match the mode you
11832 predominantly need at function start can make your programs smaller and
11833 faster by avoiding unnecessary mode switches.
11835 @var{mode} can be set to one the following values:
11839 Any mode at function entry is valid, and retained or restored when
11840 the function returns, and when it calls other functions.
11841 This mode is useful for compiling libraries or other compilation units
11842 you might want to incorporate into different programs with different
11843 prevailing FPU modes, and the convenience of being able to use a single
11844 object file outweighs the size and speed overhead for any extra
11845 mode switching that might be needed, compared with what would be needed
11846 with a more specific choice of prevailing FPU mode.
11849 This is the mode used for floating-point calculations with
11850 truncating (i.e.@: round towards zero) rounding mode. That includes
11851 conversion from floating point to integer.
11853 @item round-nearest
11854 This is the mode used for floating-point calculations with
11855 round-to-nearest-or-even rounding mode.
11858 This is the mode used to perform integer calculations in the FPU, e.g.@:
11859 integer multiply, or integer multiply-and-accumulate.
11862 The default is @option{-mfp-mode=caller}
11864 @item -mnosplit-lohi
11865 @itemx -mno-postinc
11866 @itemx -mno-postmodify
11867 @opindex mnosplit-lohi
11868 @opindex mno-postinc
11869 @opindex mno-postmodify
11870 Code generation tweaks that disable, respectively, splitting of 32-bit
11871 loads, generation of post-increment addresses, and generation of
11872 post-modify addresses. The defaults are @option{msplit-lohi},
11873 @option{-mpost-inc}, and @option{-mpost-modify}.
11875 @item -mnovect-double
11876 @opindex mno-vect-double
11877 Change the preferred SIMD mode to SImode. The default is
11878 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
11880 @item -max-vect-align=@var{num}
11881 @opindex max-vect-align
11882 The maximum alignment for SIMD vector mode types.
11883 @var{num} may be 4 or 8. The default is 8.
11884 Note that this is an ABI change, even though many library function
11885 interfaces are unaffected if they don't use SIMD vector modes
11886 in places that affect size and/or alignment of relevant types.
11888 @item -msplit-vecmove-early
11889 @opindex msplit-vecmove-early
11890 Split vector moves into single word moves before reload. In theory this
11891 can give better register allocation, but so far the reverse seems to be
11892 generally the case.
11894 @item -m1reg-@var{reg}
11896 Specify a register to hold the constant @minus{}1, which makes loading small negative
11897 constants and certain bitmasks faster.
11898 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
11899 which specify use of that register as a fixed register,
11900 and @samp{none}, which means that no register is used for this
11901 purpose. The default is @option{-m1reg-none}.
11906 @subsection ARC Options
11907 @cindex ARC options
11909 The following options control the architecture variant for which code
11912 @c architecture variants
11915 @item -mbarrel-shifter
11916 @opindex mbarrel-shifter
11917 Generate instructions supported by barrel shifter. This is the default
11918 unless @samp{-mcpu=ARC601} is in effect.
11920 @item -mcpu=@var{cpu}
11922 Set architecture type, register usage, and instruction scheduling
11923 parameters for @var{cpu}. There are also shortcut alias options
11924 available for backward compatibility and convenience. Supported
11925 values for @var{cpu} are
11931 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
11935 Compile for ARC601. Alias: @option{-mARC601}.
11940 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
11941 This is the default when configured with @samp{--with-cpu=arc700}@.
11946 @itemx -mdpfp-compact
11947 @opindex mdpfp-compact
11948 FPX: Generate Double Precision FPX instructions, tuned for the compact
11952 @opindex mdpfp-fast
11953 FPX: Generate Double Precision FPX instructions, tuned for the fast
11956 @item -mno-dpfp-lrsr
11957 @opindex mno-dpfp-lrsr
11958 Disable LR and SR instructions from using FPX extension aux registers.
11962 Generate Extended arithmetic instructions. Currently only
11963 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
11964 supported. This is always enabled for @samp{-mcpu=ARC700}.
11968 Do not generate mpy instructions for ARC700.
11972 Generate 32x16 bit multiply and mac instructions.
11976 Generate mul64 and mulu64 instructions. Only valid for @samp{-mcpu=ARC600}.
11980 Generate norm instruction. This is the default if @samp{-mcpu=ARC700}
11985 @itemx -mspfp-compact
11986 @opindex mspfp-compact
11987 FPX: Generate Single Precision FPX instructions, tuned for the compact
11991 @opindex mspfp-fast
11992 FPX: Generate Single Precision FPX instructions, tuned for the fast
11997 Enable generation of ARC SIMD instructions via target-specific
11998 builtins. Only valid for @samp{-mcpu=ARC700}.
12001 @opindex msoft-float
12002 This option ignored; it is provided for compatibility purposes only.
12003 Software floating point code is emitted by default, and this default
12004 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
12005 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
12006 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
12010 Generate swap instructions.
12014 The following options are passed through to the assembler, and also
12015 define preprocessor macro symbols.
12017 @c Flags used by the assembler, but for which we define preprocessor
12018 @c macro symbols as well.
12021 @opindex mdsp-packa
12022 Passed down to the assembler to enable the DSP Pack A extensions.
12023 Also sets the preprocessor symbol @code{__Xdsp_packa}.
12027 Passed down to the assembler to enable the dual viterbi butterfly
12028 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
12030 @c ARC700 4.10 extension instruction
12033 Passed down to the assembler to enable the Locked Load/Store
12034 Conditional extension. Also sets the preprocessor symbol
12039 Passed down to the assembler. Also sets the preprocessor symbol
12040 @code{__Xxmac_d16}.
12044 Passed down to the assembler. Also sets the preprocessor symbol
12047 @c ARC700 4.10 extension instruction
12050 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
12051 extension instruction. Also sets the preprocessor symbol
12054 @c ARC700 4.10 extension instruction
12057 Passed down to the assembler to enable the swap byte ordering
12058 extension instruction. Also sets the preprocessor symbol
12062 @opindex mtelephony
12063 Passed down to the assembler to enable dual and single operand
12064 instructions for telephony. Also sets the preprocessor symbol
12065 @code{__Xtelephony}.
12069 Passed down to the assembler to enable the XY Memory extension. Also
12070 sets the preprocessor symbol @code{__Xxy}.
12074 The following options control how the assembly code is annotated:
12076 @c Assembly annotation options
12080 Annotate assembler instructions with estimated addresses.
12082 @item -mannotate-align
12083 @opindex mannotate-align
12084 Explain what alignment considerations lead to the decision to make an
12085 instruction short or long.
12089 The following options are passed through to the linker:
12091 @c options passed through to the linker
12095 Passed through to the linker, to specify use of the @code{arclinux} emulation.
12096 This option is enabled by default in tool chains built for
12097 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
12098 when profiling is not requested.
12100 @item -marclinux_prof
12101 @opindex marclinux_prof
12102 Passed through to the linker, to specify use of the
12103 @code{arclinux_prof} emulation. This option is enabled by default in
12104 tool chains built for @w{@code{arc-linux-uclibc}} and
12105 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
12109 The following options control the semantics of generated code:
12111 @c semantically relevant code generation options
12113 @item -mepilogue-cfi
12114 @opindex mepilogue-cfi
12115 Enable generation of call frame information for epilogues.
12117 @item -mno-epilogue-cfi
12118 @opindex mno-epilogue-cfi
12119 Disable generation of call frame information for epilogues.
12122 @opindex mlong-calls
12123 Generate call insns as register indirect calls, thus providing access
12124 to the full 32-bit address range.
12126 @item -mmedium-calls
12127 @opindex mmedium-calls
12128 Don't use less than 25 bit addressing range for calls, which is the
12129 offset available for an unconditional branch-and-link
12130 instruction. Conditional execution of function calls is suppressed, to
12131 allow use of the 25-bit range, rather than the 21-bit range with
12132 conditional branch-and-link. This is the default for tool chains built
12133 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
12137 Do not generate sdata references. This is the default for tool chains
12138 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
12142 @opindex mucb-mcount
12143 Instrument with mcount calls as used in UCB code. I.e. do the
12144 counting in the callee, not the caller. By default ARC instrumentation
12145 counts in the caller.
12147 @item -mvolatile-cache
12148 @opindex mvolatile-cache
12149 Use ordinarily cached memory accesses for volatile references. This is the
12152 @item -mno-volatile-cache
12153 @opindex mno-volatile-cache
12154 Enable cache bypass for volatile references.
12158 The following options fine tune code generation:
12159 @c code generation tuning options
12162 @opindex malign-call
12163 Do alignment optimizations for call instructions.
12165 @item -mauto-modify-reg
12166 @opindex mauto-modify-reg
12167 Enable the use of pre/post modify with register displacement.
12169 @item -mbbit-peephole
12170 @opindex mbbit-peephole
12171 Enable bbit peephole2.
12175 This option disables a target-specific pass in @file{arc_reorg} to
12176 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
12177 generation driven by the combiner pass.
12179 @item -mcase-vector-pcrel
12180 @opindex mcase-vector-pcrel
12181 Use pc-relative switch case tables - this enables case table shortening.
12182 This is the default for @option{-Os}.
12184 @item -mcompact-casesi
12185 @opindex mcompact-casesi
12186 Enable compact casesi pattern.
12187 This is the default for @option{-Os}.
12189 @item -mno-cond-exec
12190 @opindex mno-cond-exec
12191 Disable ARCompact specific pass to generate conditional execution instructions.
12192 Due to delay slot scheduling and interactions between operand numbers,
12193 literal sizes, instruction lengths, and the support for conditional execution,
12194 the target-independent pass to generate conditional execution is often lacking,
12195 so the ARC port has kept a special pass around that tries to find more
12196 conditional execution generating opportunities after register allocation,
12197 branch shortening, and delay slot scheduling have been done. This pass
12198 generally, but not always, improves performance and code size, at the cost of
12199 extra compilation time, which is why there is an option to switch it off.
12200 If you have a problem with call instructions exceeding their allowable
12201 offset range because they are conditionalized, you should consider using
12202 @option{-mmedium-calls} instead.
12204 @item -mearly-cbranchsi
12205 @opindex mearly-cbranchsi
12206 Enable pre-reload use of the cbranchsi pattern.
12208 @item -mexpand-adddi
12209 @opindex mexpand-adddi
12210 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
12211 @code{add.f}, @code{adc} etc.
12213 @item -mindexed-loads
12214 @opindex mindexed-loads
12215 Enable the use of indexed loads. This can be problematic because some
12216 optimizers will then assume the that indexed stores exist, which is not
12221 Enable Local Register Allocation. This is still experimental for ARC,
12222 so by default the compiler uses standard reload
12223 (i.e. @samp{-mno-lra}).
12225 @item -mlra-priority-none
12226 @opindex mlra-priority-none
12227 Don't indicate any priority for target registers.
12229 @item -mlra-priority-compact
12230 @opindex mlra-priority-compact
12231 Indicate target register priority for r0..r3 / r12..r15.
12233 @item -mlra-priority-noncompact
12234 @opindex mlra-priority-noncompact
12235 Reduce target regsiter priority for r0..r3 / r12..r15.
12237 @item -mno-millicode
12238 @opindex mno-millicode
12239 When optimizing for size (using @option{-Os}), prologues and epilogues
12240 that have to save or restore a large number of registers are often
12241 shortened by using call to a special function in libgcc; this is
12242 referred to as a @emph{millicode} call. As these calls can pose
12243 performance issues, and/or cause linking issues when linking in a
12244 nonstandard way, this option is provided to turn off millicode call
12248 @opindex mmixed-code
12249 Tweak register allocation to help 16-bit instruction generation.
12250 This generally has the effect of decreasing the average instruction size
12251 while increasing the instruction count.
12255 Enable 'q' instruction alternatives.
12256 This is the default for @option{-Os}.
12260 Enable Rcq constraint handling - most short code generation depends on this.
12261 This is the default.
12265 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
12266 This is the default.
12268 @item -msize-level=@var{level}
12269 @opindex msize-level
12270 Fine-tune size optimization with regards to instruction lengths and alignment.
12271 The recognized values for @var{level} are:
12274 No size optimization. This level is deprecated and treated like @samp{1}.
12277 Short instructions are used opportunistically.
12280 In addition, alignment of loops and of code after barriers are dropped.
12283 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
12287 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
12288 the behavior when this is not set is equivalent to level @samp{1}.
12290 @item -mtune=@var{cpu}
12292 Set instruction scheduling parameters for @var{cpu}, overriding any implied
12293 by @option{-mcpu=}.
12295 Supported values for @var{cpu} are
12299 Tune for ARC600 cpu.
12302 Tune for ARC601 cpu.
12305 Tune for ARC700 cpu with standard multiplier block.
12308 Tune for ARC700 cpu with XMAC block.
12311 Tune for ARC725D cpu.
12314 Tune for ARC750D cpu.
12318 @item -mmultcost=@var{num}
12320 Cost to assume for a multiply instruction, with @samp{4} being equal to a
12321 normal instruction.
12323 @item -munalign-prob-threshold=@var{probability}
12324 @opindex munalign-prob-threshold
12325 Set probability threshold for unaligning branches.
12326 When tuning for @samp{ARC700} and optimizing for speed, branches without
12327 filled delay slot are preferably emitted unaligned and long, unless
12328 profiling indicates that the probability for the branch to be taken
12329 is below @var{probability}. @xref{Cross-profiling}.
12330 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
12334 The following options are maintained for backward compatibility, but
12335 are now deprecated and will be removed in a future release:
12337 @c Deprecated options
12345 @opindex mbig-endian
12348 Compile code for big endian targets. Use of these options is now
12349 deprecated. Users wanting big-endian code, should use the
12350 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
12351 building the tool chain, for which big-endian is the default.
12353 @item -mlittle-endian
12354 @opindex mlittle-endian
12357 Compile code for little endian targets. Use of these options is now
12358 deprecated. Users wanting little-endian code should use the
12359 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
12360 building the tool chain, for which little-endian is the default.
12362 @item -mbarrel_shifter
12363 @opindex mbarrel_shifter
12364 Replaced by @samp{-mbarrel-shifter}
12366 @item -mdpfp_compact
12367 @opindex mdpfp_compact
12368 Replaced by @samp{-mdpfp-compact}
12371 @opindex mdpfp_fast
12372 Replaced by @samp{-mdpfp-fast}
12375 @opindex mdsp_packa
12376 Replaced by @samp{-mdsp-packa}
12380 Replaced by @samp{-mea}
12384 Replaced by @samp{-mmac-24}
12388 Replaced by @samp{-mmac-d16}
12390 @item -mspfp_compact
12391 @opindex mspfp_compact
12392 Replaced by @samp{-mspfp-compact}
12395 @opindex mspfp_fast
12396 Replaced by @samp{-mspfp-fast}
12398 @item -mtune=@var{cpu}
12400 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
12401 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
12402 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
12404 @item -multcost=@var{num}
12406 Replaced by @samp{-mmultcost}.
12411 @subsection ARM Options
12412 @cindex ARM options
12414 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
12418 @item -mabi=@var{name}
12420 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
12421 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
12424 @opindex mapcs-frame
12425 Generate a stack frame that is compliant with the ARM Procedure Call
12426 Standard for all functions, even if this is not strictly necessary for
12427 correct execution of the code. Specifying @option{-fomit-frame-pointer}
12428 with this option causes the stack frames not to be generated for
12429 leaf functions. The default is @option{-mno-apcs-frame}.
12433 This is a synonym for @option{-mapcs-frame}.
12436 @c not currently implemented
12437 @item -mapcs-stack-check
12438 @opindex mapcs-stack-check
12439 Generate code to check the amount of stack space available upon entry to
12440 every function (that actually uses some stack space). If there is
12441 insufficient space available then either the function
12442 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} is
12443 called, depending upon the amount of stack space required. The runtime
12444 system is required to provide these functions. The default is
12445 @option{-mno-apcs-stack-check}, since this produces smaller code.
12447 @c not currently implemented
12449 @opindex mapcs-float
12450 Pass floating-point arguments using the floating-point registers. This is
12451 one of the variants of the APCS@. This option is recommended if the
12452 target hardware has a floating-point unit or if a lot of floating-point
12453 arithmetic is going to be performed by the code. The default is
12454 @option{-mno-apcs-float}, since the size of integer-only code is
12455 slightly increased if @option{-mapcs-float} is used.
12457 @c not currently implemented
12458 @item -mapcs-reentrant
12459 @opindex mapcs-reentrant
12460 Generate reentrant, position-independent code. The default is
12461 @option{-mno-apcs-reentrant}.
12464 @item -mthumb-interwork
12465 @opindex mthumb-interwork
12466 Generate code that supports calling between the ARM and Thumb
12467 instruction sets. Without this option, on pre-v5 architectures, the
12468 two instruction sets cannot be reliably used inside one program. The
12469 default is @option{-mno-thumb-interwork}, since slightly larger code
12470 is generated when @option{-mthumb-interwork} is specified. In AAPCS
12471 configurations this option is meaningless.
12473 @item -mno-sched-prolog
12474 @opindex mno-sched-prolog
12475 Prevent the reordering of instructions in the function prologue, or the
12476 merging of those instruction with the instructions in the function's
12477 body. This means that all functions start with a recognizable set
12478 of instructions (or in fact one of a choice from a small set of
12479 different function prologues), and this information can be used to
12480 locate the start of functions inside an executable piece of code. The
12481 default is @option{-msched-prolog}.
12483 @item -mfloat-abi=@var{name}
12484 @opindex mfloat-abi
12485 Specifies which floating-point ABI to use. Permissible values
12486 are: @samp{soft}, @samp{softfp} and @samp{hard}.
12488 Specifying @samp{soft} causes GCC to generate output containing
12489 library calls for floating-point operations.
12490 @samp{softfp} allows the generation of code using hardware floating-point
12491 instructions, but still uses the soft-float calling conventions.
12492 @samp{hard} allows generation of floating-point instructions
12493 and uses FPU-specific calling conventions.
12495 The default depends on the specific target configuration. Note that
12496 the hard-float and soft-float ABIs are not link-compatible; you must
12497 compile your entire program with the same ABI, and link with a
12498 compatible set of libraries.
12500 @item -mlittle-endian
12501 @opindex mlittle-endian
12502 Generate code for a processor running in little-endian mode. This is
12503 the default for all standard configurations.
12506 @opindex mbig-endian
12507 Generate code for a processor running in big-endian mode; the default is
12508 to compile code for a little-endian processor.
12510 @item -march=@var{name}
12512 This specifies the name of the target ARM architecture. GCC uses this
12513 name to determine what kind of instructions it can emit when generating
12514 assembly code. This option can be used in conjunction with or instead
12515 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
12516 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
12517 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
12518 @samp{armv6}, @samp{armv6j},
12519 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
12520 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m},
12521 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc},
12522 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
12524 @option{-march=armv7ve} is the armv7-a architecture with virtualization
12527 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
12528 architecture together with the optional CRC32 extensions.
12530 @option{-march=native} causes the compiler to auto-detect the architecture
12531 of the build computer. At present, this feature is only supported on
12532 Linux, and not all architectures are recognized. If the auto-detect is
12533 unsuccessful the option has no effect.
12535 @item -mtune=@var{name}
12537 This option specifies the name of the target ARM processor for
12538 which GCC should tune the performance of the code.
12539 For some ARM implementations better performance can be obtained by using
12541 Permissible names are: @samp{arm2}, @samp{arm250},
12542 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
12543 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
12544 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
12545 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
12547 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
12548 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
12549 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
12550 @samp{strongarm1110},
12551 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
12552 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
12553 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
12554 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
12555 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
12556 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
12557 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
12558 @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9},
12559 @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a53}, @samp{cortex-a57},
12561 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m4},
12565 @samp{cortex-m0plus},
12566 @samp{marvell-pj4},
12567 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
12568 @samp{fa526}, @samp{fa626},
12569 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}.
12571 Additionally, this option can specify that GCC should tune the performance
12572 of the code for a big.LITTLE system. Permissible names are:
12573 @samp{cortex-a15.cortex-a7}, @samp{cortex-a57.cortex-a53}.
12575 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
12576 performance for a blend of processors within architecture @var{arch}.
12577 The aim is to generate code that run well on the current most popular
12578 processors, balancing between optimizations that benefit some CPUs in the
12579 range, and avoiding performance pitfalls of other CPUs. The effects of
12580 this option may change in future GCC versions as CPU models come and go.
12582 @option{-mtune=native} causes the compiler to auto-detect the CPU
12583 of the build computer. At present, this feature is only supported on
12584 Linux, and not all architectures are recognized. If the auto-detect is
12585 unsuccessful the option has no effect.
12587 @item -mcpu=@var{name}
12589 This specifies the name of the target ARM processor. GCC uses this name
12590 to derive the name of the target ARM architecture (as if specified
12591 by @option{-march}) and the ARM processor type for which to tune for
12592 performance (as if specified by @option{-mtune}). Where this option
12593 is used in conjunction with @option{-march} or @option{-mtune},
12594 those options take precedence over the appropriate part of this option.
12596 Permissible names for this option are the same as those for
12599 @option{-mcpu=generic-@var{arch}} is also permissible, and is
12600 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
12601 See @option{-mtune} for more information.
12603 @option{-mcpu=native} causes the compiler to auto-detect the CPU
12604 of the build computer. At present, this feature is only supported on
12605 Linux, and not all architectures are recognized. If the auto-detect is
12606 unsuccessful the option has no effect.
12608 @item -mfpu=@var{name}
12610 This specifies what floating-point hardware (or hardware emulation) is
12611 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
12612 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
12613 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
12614 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
12615 @samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}.
12617 If @option{-msoft-float} is specified this specifies the format of
12618 floating-point values.
12620 If the selected floating-point hardware includes the NEON extension
12621 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
12622 operations are not generated by GCC's auto-vectorization pass unless
12623 @option{-funsafe-math-optimizations} is also specified. This is
12624 because NEON hardware does not fully implement the IEEE 754 standard for
12625 floating-point arithmetic (in particular denormal values are treated as
12626 zero), so the use of NEON instructions may lead to a loss of precision.
12628 @item -mfp16-format=@var{name}
12629 @opindex mfp16-format
12630 Specify the format of the @code{__fp16} half-precision floating-point type.
12631 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
12632 the default is @samp{none}, in which case the @code{__fp16} type is not
12633 defined. @xref{Half-Precision}, for more information.
12635 @item -mstructure-size-boundary=@var{n}
12636 @opindex mstructure-size-boundary
12637 The sizes of all structures and unions are rounded up to a multiple
12638 of the number of bits set by this option. Permissible values are 8, 32
12639 and 64. The default value varies for different toolchains. For the COFF
12640 targeted toolchain the default value is 8. A value of 64 is only allowed
12641 if the underlying ABI supports it.
12643 Specifying a larger number can produce faster, more efficient code, but
12644 can also increase the size of the program. Different values are potentially
12645 incompatible. Code compiled with one value cannot necessarily expect to
12646 work with code or libraries compiled with another value, if they exchange
12647 information using structures or unions.
12649 @item -mabort-on-noreturn
12650 @opindex mabort-on-noreturn
12651 Generate a call to the function @code{abort} at the end of a
12652 @code{noreturn} function. It is executed if the function tries to
12656 @itemx -mno-long-calls
12657 @opindex mlong-calls
12658 @opindex mno-long-calls
12659 Tells the compiler to perform function calls by first loading the
12660 address of the function into a register and then performing a subroutine
12661 call on this register. This switch is needed if the target function
12662 lies outside of the 64-megabyte addressing range of the offset-based
12663 version of subroutine call instruction.
12665 Even if this switch is enabled, not all function calls are turned
12666 into long calls. The heuristic is that static functions, functions
12667 that have the @samp{short-call} attribute, functions that are inside
12668 the scope of a @samp{#pragma no_long_calls} directive, and functions whose
12669 definitions have already been compiled within the current compilation
12670 unit are not turned into long calls. The exceptions to this rule are
12671 that weak function definitions, functions with the @samp{long-call}
12672 attribute or the @samp{section} attribute, and functions that are within
12673 the scope of a @samp{#pragma long_calls} directive are always
12674 turned into long calls.
12676 This feature is not enabled by default. Specifying
12677 @option{-mno-long-calls} restores the default behavior, as does
12678 placing the function calls within the scope of a @samp{#pragma
12679 long_calls_off} directive. Note these switches have no effect on how
12680 the compiler generates code to handle function calls via function
12683 @item -msingle-pic-base
12684 @opindex msingle-pic-base
12685 Treat the register used for PIC addressing as read-only, rather than
12686 loading it in the prologue for each function. The runtime system is
12687 responsible for initializing this register with an appropriate value
12688 before execution begins.
12690 @item -mpic-register=@var{reg}
12691 @opindex mpic-register
12692 Specify the register to be used for PIC addressing.
12693 For standard PIC base case, the default will be any suitable register
12694 determined by compiler. For single PIC base case, the default is
12695 @samp{R9} if target is EABI based or stack-checking is enabled,
12696 otherwise the default is @samp{R10}.
12698 @item -mpic-data-is-text-relative
12699 @opindex mpic-data-is-text-relative
12700 Assume that each data segments are relative to text segment at load time.
12701 Therefore, it permits addressing data using PC-relative operations.
12702 This option is on by default for targets other than VxWorks RTP.
12704 @item -mpoke-function-name
12705 @opindex mpoke-function-name
12706 Write the name of each function into the text section, directly
12707 preceding the function prologue. The generated code is similar to this:
12711 .ascii "arm_poke_function_name", 0
12714 .word 0xff000000 + (t1 - t0)
12715 arm_poke_function_name
12717 stmfd sp!, @{fp, ip, lr, pc@}
12721 When performing a stack backtrace, code can inspect the value of
12722 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
12723 location @code{pc - 12} and the top 8 bits are set, then we know that
12724 there is a function name embedded immediately preceding this location
12725 and has length @code{((pc[-3]) & 0xff000000)}.
12732 Select between generating code that executes in ARM and Thumb
12733 states. The default for most configurations is to generate code
12734 that executes in ARM state, but the default can be changed by
12735 configuring GCC with the @option{--with-mode=}@var{state}
12739 @opindex mtpcs-frame
12740 Generate a stack frame that is compliant with the Thumb Procedure Call
12741 Standard for all non-leaf functions. (A leaf function is one that does
12742 not call any other functions.) The default is @option{-mno-tpcs-frame}.
12744 @item -mtpcs-leaf-frame
12745 @opindex mtpcs-leaf-frame
12746 Generate a stack frame that is compliant with the Thumb Procedure Call
12747 Standard for all leaf functions. (A leaf function is one that does
12748 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
12750 @item -mcallee-super-interworking
12751 @opindex mcallee-super-interworking
12752 Gives all externally visible functions in the file being compiled an ARM
12753 instruction set header which switches to Thumb mode before executing the
12754 rest of the function. This allows these functions to be called from
12755 non-interworking code. This option is not valid in AAPCS configurations
12756 because interworking is enabled by default.
12758 @item -mcaller-super-interworking
12759 @opindex mcaller-super-interworking
12760 Allows calls via function pointers (including virtual functions) to
12761 execute correctly regardless of whether the target code has been
12762 compiled for interworking or not. There is a small overhead in the cost
12763 of executing a function pointer if this option is enabled. This option
12764 is not valid in AAPCS configurations because interworking is enabled
12767 @item -mtp=@var{name}
12769 Specify the access model for the thread local storage pointer. The valid
12770 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
12771 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
12772 (supported in the arm6k architecture), and @option{auto}, which uses the
12773 best available method for the selected processor. The default setting is
12776 @item -mtls-dialect=@var{dialect}
12777 @opindex mtls-dialect
12778 Specify the dialect to use for accessing thread local storage. Two
12779 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
12780 @samp{gnu} dialect selects the original GNU scheme for supporting
12781 local and global dynamic TLS models. The @samp{gnu2} dialect
12782 selects the GNU descriptor scheme, which provides better performance
12783 for shared libraries. The GNU descriptor scheme is compatible with
12784 the original scheme, but does require new assembler, linker and
12785 library support. Initial and local exec TLS models are unaffected by
12786 this option and always use the original scheme.
12788 @item -mword-relocations
12789 @opindex mword-relocations
12790 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
12791 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
12792 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
12795 @item -mfix-cortex-m3-ldrd
12796 @opindex mfix-cortex-m3-ldrd
12797 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
12798 with overlapping destination and base registers are used. This option avoids
12799 generating these instructions. This option is enabled by default when
12800 @option{-mcpu=cortex-m3} is specified.
12802 @item -munaligned-access
12803 @itemx -mno-unaligned-access
12804 @opindex munaligned-access
12805 @opindex mno-unaligned-access
12806 Enables (or disables) reading and writing of 16- and 32- bit values
12807 from addresses that are not 16- or 32- bit aligned. By default
12808 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
12809 architectures, and enabled for all other architectures. If unaligned
12810 access is not enabled then words in packed data structures will be
12811 accessed a byte at a time.
12813 The ARM attribute @code{Tag_CPU_unaligned_access} will be set in the
12814 generated object file to either true or false, depending upon the
12815 setting of this option. If unaligned access is enabled then the
12816 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} will also be
12819 @item -mneon-for-64bits
12820 @opindex mneon-for-64bits
12821 Enables using Neon to handle scalar 64-bits operations. This is
12822 disabled by default since the cost of moving data from core registers
12825 @item -mslow-flash-data
12826 @opindex mslow-flash-data
12827 Assume loading data from flash is slower than fetching instruction.
12828 Therefore literal load is minimized for better performance.
12829 This option is only supported when compiling for ARMv7 M-profile and
12832 @item -mrestrict-it
12833 @opindex mrestrict-it
12834 Restricts generation of IT blocks to conform to the rules of ARMv8.
12835 IT blocks can only contain a single 16-bit instruction from a select
12836 set of instructions. This option is on by default for ARMv8 Thumb mode.
12840 @subsection AVR Options
12841 @cindex AVR Options
12843 These options are defined for AVR implementations:
12846 @item -mmcu=@var{mcu}
12848 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
12850 The default for this option is@tie{}@code{avr2}.
12852 GCC supports the following AVR devices and ISAs:
12854 @include avr-mmcu.texi
12856 @item -maccumulate-args
12857 @opindex maccumulate-args
12858 Accumulate outgoing function arguments and acquire/release the needed
12859 stack space for outgoing function arguments once in function
12860 prologue/epilogue. Without this option, outgoing arguments are pushed
12861 before calling a function and popped afterwards.
12863 Popping the arguments after the function call can be expensive on
12864 AVR so that accumulating the stack space might lead to smaller
12865 executables because arguments need not to be removed from the
12866 stack after such a function call.
12868 This option can lead to reduced code size for functions that perform
12869 several calls to functions that get their arguments on the stack like
12870 calls to printf-like functions.
12872 @item -mbranch-cost=@var{cost}
12873 @opindex mbranch-cost
12874 Set the branch costs for conditional branch instructions to
12875 @var{cost}. Reasonable values for @var{cost} are small, non-negative
12876 integers. The default branch cost is 0.
12878 @item -mcall-prologues
12879 @opindex mcall-prologues
12880 Functions prologues/epilogues are expanded as calls to appropriate
12881 subroutines. Code size is smaller.
12885 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
12886 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
12887 and @code{long long} is 4 bytes. Please note that this option does not
12888 conform to the C standards, but it results in smaller code
12891 @item -mno-interrupts
12892 @opindex mno-interrupts
12893 Generated code is not compatible with hardware interrupts.
12894 Code size is smaller.
12898 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
12899 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
12900 Setting @code{-mrelax} just adds the @code{--relax} option to the
12901 linker command line when the linker is called.
12903 Jump relaxing is performed by the linker because jump offsets are not
12904 known before code is located. Therefore, the assembler code generated by the
12905 compiler is the same, but the instructions in the executable may
12906 differ from instructions in the assembler code.
12908 Relaxing must be turned on if linker stubs are needed, see the
12909 section on @code{EIND} and linker stubs below.
12913 Treat the stack pointer register as an 8-bit register,
12914 i.e.@: assume the high byte of the stack pointer is zero.
12915 In general, you don't need to set this option by hand.
12917 This option is used internally by the compiler to select and
12918 build multilibs for architectures @code{avr2} and @code{avr25}.
12919 These architectures mix devices with and without @code{SPH}.
12920 For any setting other than @code{-mmcu=avr2} or @code{-mmcu=avr25}
12921 the compiler driver will add or remove this option from the compiler
12922 proper's command line, because the compiler then knows if the device
12923 or architecture has an 8-bit stack pointer and thus no @code{SPH}
12928 Use address register @code{X} in a way proposed by the hardware. This means
12929 that @code{X} is only used in indirect, post-increment or
12930 pre-decrement addressing.
12932 Without this option, the @code{X} register may be used in the same way
12933 as @code{Y} or @code{Z} which then is emulated by additional
12935 For example, loading a value with @code{X+const} addressing with a
12936 small non-negative @code{const < 64} to a register @var{Rn} is
12940 adiw r26, const ; X += const
12941 ld @var{Rn}, X ; @var{Rn} = *X
12942 sbiw r26, const ; X -= const
12946 @opindex mtiny-stack
12947 Only change the lower 8@tie{}bits of the stack pointer.
12949 @item -Waddr-space-convert
12950 @opindex Waddr-space-convert
12951 Warn about conversions between address spaces in the case where the
12952 resulting address space is not contained in the incoming address space.
12955 @subsubsection @code{EIND} and Devices with more than 128 Ki Bytes of Flash
12956 @cindex @code{EIND}
12957 Pointers in the implementation are 16@tie{}bits wide.
12958 The address of a function or label is represented as word address so
12959 that indirect jumps and calls can target any code address in the
12960 range of 64@tie{}Ki words.
12962 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
12963 bytes of program memory space, there is a special function register called
12964 @code{EIND} that serves as most significant part of the target address
12965 when @code{EICALL} or @code{EIJMP} instructions are used.
12967 Indirect jumps and calls on these devices are handled as follows by
12968 the compiler and are subject to some limitations:
12973 The compiler never sets @code{EIND}.
12976 The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
12977 instructions or might read @code{EIND} directly in order to emulate an
12978 indirect call/jump by means of a @code{RET} instruction.
12981 The compiler assumes that @code{EIND} never changes during the startup
12982 code or during the application. In particular, @code{EIND} is not
12983 saved/restored in function or interrupt service routine
12987 For indirect calls to functions and computed goto, the linker
12988 generates @emph{stubs}. Stubs are jump pads sometimes also called
12989 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
12990 The stub contains a direct jump to the desired address.
12993 Linker relaxation must be turned on so that the linker will generate
12994 the stubs correctly an all situaltion. See the compiler option
12995 @code{-mrelax} and the linler option @code{--relax}.
12996 There are corner cases where the linker is supposed to generate stubs
12997 but aborts without relaxation and without a helpful error message.
13000 The default linker script is arranged for code with @code{EIND = 0}.
13001 If code is supposed to work for a setup with @code{EIND != 0}, a custom
13002 linker script has to be used in order to place the sections whose
13003 name start with @code{.trampolines} into the segment where @code{EIND}
13007 The startup code from libgcc never sets @code{EIND}.
13008 Notice that startup code is a blend of code from libgcc and AVR-LibC.
13009 For the impact of AVR-LibC on @code{EIND}, see the
13010 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
13013 It is legitimate for user-specific startup code to set up @code{EIND}
13014 early, for example by means of initialization code located in
13015 section @code{.init3}. Such code runs prior to general startup code
13016 that initializes RAM and calls constructors, but after the bit
13017 of startup code from AVR-LibC that sets @code{EIND} to the segment
13018 where the vector table is located.
13020 #include <avr/io.h>
13023 __attribute__((section(".init3"),naked,used,no_instrument_function))
13024 init3_set_eind (void)
13026 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
13027 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
13032 The @code{__trampolines_start} symbol is defined in the linker script.
13035 Stubs are generated automatically by the linker if
13036 the following two conditions are met:
13039 @item The address of a label is taken by means of the @code{gs} modifier
13040 (short for @emph{generate stubs}) like so:
13042 LDI r24, lo8(gs(@var{func}))
13043 LDI r25, hi8(gs(@var{func}))
13045 @item The final location of that label is in a code segment
13046 @emph{outside} the segment where the stubs are located.
13050 The compiler emits such @code{gs} modifiers for code labels in the
13051 following situations:
13053 @item Taking address of a function or code label.
13054 @item Computed goto.
13055 @item If prologue-save function is used, see @option{-mcall-prologues}
13056 command-line option.
13057 @item Switch/case dispatch tables. If you do not want such dispatch
13058 tables you can specify the @option{-fno-jump-tables} command-line option.
13059 @item C and C++ constructors/destructors called during startup/shutdown.
13060 @item If the tools hit a @code{gs()} modifier explained above.
13064 Jumping to non-symbolic addresses like so is @emph{not} supported:
13069 /* Call function at word address 0x2 */
13070 return ((int(*)(void)) 0x2)();
13074 Instead, a stub has to be set up, i.e.@: the function has to be called
13075 through a symbol (@code{func_4} in the example):
13080 extern int func_4 (void);
13082 /* Call function at byte address 0x4 */
13087 and the application be linked with @code{-Wl,--defsym,func_4=0x4}.
13088 Alternatively, @code{func_4} can be defined in the linker script.
13091 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
13092 @cindex @code{RAMPD}
13093 @cindex @code{RAMPX}
13094 @cindex @code{RAMPY}
13095 @cindex @code{RAMPZ}
13096 Some AVR devices support memories larger than the 64@tie{}KiB range
13097 that can be accessed with 16-bit pointers. To access memory locations
13098 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
13099 register is used as high part of the address:
13100 The @code{X}, @code{Y}, @code{Z} address register is concatenated
13101 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
13102 register, respectively, to get a wide address. Similarly,
13103 @code{RAMPD} is used together with direct addressing.
13107 The startup code initializes the @code{RAMP} special function
13108 registers with zero.
13111 If a @ref{AVR Named Address Spaces,named address space} other than
13112 generic or @code{__flash} is used, then @code{RAMPZ} is set
13113 as needed before the operation.
13116 If the device supports RAM larger than 64@tie{}KiB and the compiler
13117 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
13118 is reset to zero after the operation.
13121 If the device comes with a specific @code{RAMP} register, the ISR
13122 prologue/epilogue saves/restores that SFR and initializes it with
13123 zero in case the ISR code might (implicitly) use it.
13126 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
13127 If you use inline assembler to read from locations outside the
13128 16-bit address range and change one of the @code{RAMP} registers,
13129 you must reset it to zero after the access.
13133 @subsubsection AVR Built-in Macros
13135 GCC defines several built-in macros so that the user code can test
13136 for the presence or absence of features. Almost any of the following
13137 built-in macros are deduced from device capabilities and thus
13138 triggered by the @code{-mmcu=} command-line option.
13140 For even more AVR-specific built-in macros see
13141 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
13146 Build-in macro that resolves to a decimal number that identifies the
13147 architecture and depends on the @code{-mmcu=@var{mcu}} option.
13148 Possible values are:
13150 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
13151 @code{4}, @code{5}, @code{51}, @code{6}, @code{102}, @code{104},
13152 @code{105}, @code{106}, @code{107}
13154 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3},
13155 @code{avr31}, @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51},
13156 @code{avr6}, @code{avrxmega2}, @code{avrxmega4}, @code{avrxmega5},
13157 @code{avrxmega6}, @code{avrxmega7}, respectively.
13158 If @var{mcu} specifies a device, this built-in macro is set
13159 accordingly. For example, with @code{-mmcu=atmega8} the macro will be
13160 defined to @code{4}.
13162 @item __AVR_@var{Device}__
13163 Setting @code{-mmcu=@var{device}} defines this built-in macro which reflects
13164 the device's name. For example, @code{-mmcu=atmega8} defines the
13165 built-in macro @code{__AVR_ATmega8__}, @code{-mmcu=attiny261a} defines
13166 @code{__AVR_ATtiny261A__}, etc.
13168 The built-in macros' names follow
13169 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
13170 the device name as from the AVR user manual. The difference between
13171 @var{Device} in the built-in macro and @var{device} in
13172 @code{-mmcu=@var{device}} is that the latter is always lowercase.
13174 If @var{device} is not a device but only a core architecture like
13175 @code{avr51}, this macro will not be defined.
13177 @item __AVR_DEVICE_NAME__
13178 Setting @code{-mmcu=@var{device}} defines this built-in macro to
13179 the device's name. For example, with @code{-mmcu=atmega8} the macro
13180 will be defined to @code{atmega8}.
13182 If @var{device} is not a device but only a core architecture like
13183 @code{avr51}, this macro will not be defined.
13185 @item __AVR_XMEGA__
13186 The device / architecture belongs to the XMEGA family of devices.
13188 @item __AVR_HAVE_ELPM__
13189 The device has the the @code{ELPM} instruction.
13191 @item __AVR_HAVE_ELPMX__
13192 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
13193 R@var{n},Z+} instructions.
13195 @item __AVR_HAVE_MOVW__
13196 The device has the @code{MOVW} instruction to perform 16-bit
13197 register-register moves.
13199 @item __AVR_HAVE_LPMX__
13200 The device has the @code{LPM R@var{n},Z} and
13201 @code{LPM R@var{n},Z+} instructions.
13203 @item __AVR_HAVE_MUL__
13204 The device has a hardware multiplier.
13206 @item __AVR_HAVE_JMP_CALL__
13207 The device has the @code{JMP} and @code{CALL} instructions.
13208 This is the case for devices with at least 16@tie{}KiB of program
13211 @item __AVR_HAVE_EIJMP_EICALL__
13212 @itemx __AVR_3_BYTE_PC__
13213 The device has the @code{EIJMP} and @code{EICALL} instructions.
13214 This is the case for devices with more than 128@tie{}KiB of program memory.
13215 This also means that the program counter
13216 (PC) is 3@tie{}bytes wide.
13218 @item __AVR_2_BYTE_PC__
13219 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
13220 with up to 128@tie{}KiB of program memory.
13222 @item __AVR_HAVE_8BIT_SP__
13223 @itemx __AVR_HAVE_16BIT_SP__
13224 The stack pointer (SP) register is treated as 8-bit respectively
13225 16-bit register by the compiler.
13226 The definition of these macros is affected by @code{-mtiny-stack}.
13228 @item __AVR_HAVE_SPH__
13230 The device has the SPH (high part of stack pointer) special function
13231 register or has an 8-bit stack pointer, respectively.
13232 The definition of these macros is affected by @code{-mmcu=} and
13233 in the cases of @code{-mmcu=avr2} and @code{-mmcu=avr25} also
13236 @item __AVR_HAVE_RAMPD__
13237 @itemx __AVR_HAVE_RAMPX__
13238 @itemx __AVR_HAVE_RAMPY__
13239 @itemx __AVR_HAVE_RAMPZ__
13240 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
13241 @code{RAMPZ} special function register, respectively.
13243 @item __NO_INTERRUPTS__
13244 This macro reflects the @code{-mno-interrupts} command line option.
13246 @item __AVR_ERRATA_SKIP__
13247 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
13248 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
13249 instructions because of a hardware erratum. Skip instructions are
13250 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
13251 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
13254 @item __AVR_ISA_RMW__
13255 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
13257 @item __AVR_SFR_OFFSET__=@var{offset}
13258 Instructions that can address I/O special function registers directly
13259 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
13260 address as if addressed by an instruction to access RAM like @code{LD}
13261 or @code{STS}. This offset depends on the device architecture and has
13262 to be subtracted from the RAM address in order to get the
13263 respective I/O@tie{}address.
13265 @item __WITH_AVRLIBC__
13266 The compiler is configured to be used together with AVR-Libc.
13267 See the @code{--with-avrlibc} configure option.
13271 @node Blackfin Options
13272 @subsection Blackfin Options
13273 @cindex Blackfin Options
13276 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
13278 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
13279 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
13280 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
13281 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
13282 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
13283 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
13284 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
13285 @samp{bf561}, @samp{bf592}.
13287 The optional @var{sirevision} specifies the silicon revision of the target
13288 Blackfin processor. Any workarounds available for the targeted silicon revision
13289 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
13290 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
13291 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
13292 hexadecimal digits representing the major and minor numbers in the silicon
13293 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
13294 is not defined. If @var{sirevision} is @samp{any}, the
13295 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
13296 If this optional @var{sirevision} is not used, GCC assumes the latest known
13297 silicon revision of the targeted Blackfin processor.
13299 GCC defines a preprocessor macro for the specified @var{cpu}.
13300 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
13301 provided by libgloss to be linked in if @option{-msim} is not given.
13303 Without this option, @samp{bf532} is used as the processor by default.
13305 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
13306 only the preprocessor macro is defined.
13310 Specifies that the program will be run on the simulator. This causes
13311 the simulator BSP provided by libgloss to be linked in. This option
13312 has effect only for @samp{bfin-elf} toolchain.
13313 Certain other options, such as @option{-mid-shared-library} and
13314 @option{-mfdpic}, imply @option{-msim}.
13316 @item -momit-leaf-frame-pointer
13317 @opindex momit-leaf-frame-pointer
13318 Don't keep the frame pointer in a register for leaf functions. This
13319 avoids the instructions to save, set up and restore frame pointers and
13320 makes an extra register available in leaf functions. The option
13321 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
13322 which might make debugging harder.
13324 @item -mspecld-anomaly
13325 @opindex mspecld-anomaly
13326 When enabled, the compiler ensures that the generated code does not
13327 contain speculative loads after jump instructions. If this option is used,
13328 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
13330 @item -mno-specld-anomaly
13331 @opindex mno-specld-anomaly
13332 Don't generate extra code to prevent speculative loads from occurring.
13334 @item -mcsync-anomaly
13335 @opindex mcsync-anomaly
13336 When enabled, the compiler ensures that the generated code does not
13337 contain CSYNC or SSYNC instructions too soon after conditional branches.
13338 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
13340 @item -mno-csync-anomaly
13341 @opindex mno-csync-anomaly
13342 Don't generate extra code to prevent CSYNC or SSYNC instructions from
13343 occurring too soon after a conditional branch.
13347 When enabled, the compiler is free to take advantage of the knowledge that
13348 the entire program fits into the low 64k of memory.
13351 @opindex mno-low-64k
13352 Assume that the program is arbitrarily large. This is the default.
13354 @item -mstack-check-l1
13355 @opindex mstack-check-l1
13356 Do stack checking using information placed into L1 scratchpad memory by the
13359 @item -mid-shared-library
13360 @opindex mid-shared-library
13361 Generate code that supports shared libraries via the library ID method.
13362 This allows for execute in place and shared libraries in an environment
13363 without virtual memory management. This option implies @option{-fPIC}.
13364 With a @samp{bfin-elf} target, this option implies @option{-msim}.
13366 @item -mno-id-shared-library
13367 @opindex mno-id-shared-library
13368 Generate code that doesn't assume ID-based shared libraries are being used.
13369 This is the default.
13371 @item -mleaf-id-shared-library
13372 @opindex mleaf-id-shared-library
13373 Generate code that supports shared libraries via the library ID method,
13374 but assumes that this library or executable won't link against any other
13375 ID shared libraries. That allows the compiler to use faster code for jumps
13378 @item -mno-leaf-id-shared-library
13379 @opindex mno-leaf-id-shared-library
13380 Do not assume that the code being compiled won't link against any ID shared
13381 libraries. Slower code is generated for jump and call insns.
13383 @item -mshared-library-id=n
13384 @opindex mshared-library-id
13385 Specifies the identification number of the ID-based shared library being
13386 compiled. Specifying a value of 0 generates more compact code; specifying
13387 other values forces the allocation of that number to the current
13388 library but is no more space- or time-efficient than omitting this option.
13392 Generate code that allows the data segment to be located in a different
13393 area of memory from the text segment. This allows for execute in place in
13394 an environment without virtual memory management by eliminating relocations
13395 against the text section.
13397 @item -mno-sep-data
13398 @opindex mno-sep-data
13399 Generate code that assumes that the data segment follows the text segment.
13400 This is the default.
13403 @itemx -mno-long-calls
13404 @opindex mlong-calls
13405 @opindex mno-long-calls
13406 Tells the compiler to perform function calls by first loading the
13407 address of the function into a register and then performing a subroutine
13408 call on this register. This switch is needed if the target function
13409 lies outside of the 24-bit addressing range of the offset-based
13410 version of subroutine call instruction.
13412 This feature is not enabled by default. Specifying
13413 @option{-mno-long-calls} restores the default behavior. Note these
13414 switches have no effect on how the compiler generates code to handle
13415 function calls via function pointers.
13419 Link with the fast floating-point library. This library relaxes some of
13420 the IEEE floating-point standard's rules for checking inputs against
13421 Not-a-Number (NAN), in the interest of performance.
13424 @opindex minline-plt
13425 Enable inlining of PLT entries in function calls to functions that are
13426 not known to bind locally. It has no effect without @option{-mfdpic}.
13429 @opindex mmulticore
13430 Build a standalone application for multicore Blackfin processors.
13431 This option causes proper start files and link scripts supporting
13432 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
13433 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
13435 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
13436 selects the one-application-per-core programming model. Without
13437 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
13438 programming model is used. In this model, the main function of Core B
13439 should be named as @code{coreb_main}.
13441 If this option is not used, the single-core application programming
13446 Build a standalone application for Core A of BF561 when using
13447 the one-application-per-core programming model. Proper start files
13448 and link scripts are used to support Core A, and the macro
13449 @code{__BFIN_COREA} is defined.
13450 This option can only be used in conjunction with @option{-mmulticore}.
13454 Build a standalone application for Core B of BF561 when using
13455 the one-application-per-core programming model. Proper start files
13456 and link scripts are used to support Core B, and the macro
13457 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
13458 should be used instead of @code{main}.
13459 This option can only be used in conjunction with @option{-mmulticore}.
13463 Build a standalone application for SDRAM. Proper start files and
13464 link scripts are used to put the application into SDRAM, and the macro
13465 @code{__BFIN_SDRAM} is defined.
13466 The loader should initialize SDRAM before loading the application.
13470 Assume that ICPLBs are enabled at run time. This has an effect on certain
13471 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
13472 are enabled; for standalone applications the default is off.
13476 @subsection C6X Options
13477 @cindex C6X Options
13480 @item -march=@var{name}
13482 This specifies the name of the target architecture. GCC uses this
13483 name to determine what kind of instructions it can emit when generating
13484 assembly code. Permissible names are: @samp{c62x},
13485 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
13488 @opindex mbig-endian
13489 Generate code for a big-endian target.
13491 @item -mlittle-endian
13492 @opindex mlittle-endian
13493 Generate code for a little-endian target. This is the default.
13497 Choose startup files and linker script suitable for the simulator.
13499 @item -msdata=default
13500 @opindex msdata=default
13501 Put small global and static data in the @samp{.neardata} section,
13502 which is pointed to by register @code{B14}. Put small uninitialized
13503 global and static data in the @samp{.bss} section, which is adjacent
13504 to the @samp{.neardata} section. Put small read-only data into the
13505 @samp{.rodata} section. The corresponding sections used for large
13506 pieces of data are @samp{.fardata}, @samp{.far} and @samp{.const}.
13509 @opindex msdata=all
13510 Put all data, not just small objects, into the sections reserved for
13511 small data, and use addressing relative to the @code{B14} register to
13515 @opindex msdata=none
13516 Make no use of the sections reserved for small data, and use absolute
13517 addresses to access all data. Put all initialized global and static
13518 data in the @samp{.fardata} section, and all uninitialized data in the
13519 @samp{.far} section. Put all constant data into the @samp{.const}
13524 @subsection CRIS Options
13525 @cindex CRIS Options
13527 These options are defined specifically for the CRIS ports.
13530 @item -march=@var{architecture-type}
13531 @itemx -mcpu=@var{architecture-type}
13534 Generate code for the specified architecture. The choices for
13535 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
13536 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
13537 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
13540 @item -mtune=@var{architecture-type}
13542 Tune to @var{architecture-type} everything applicable about the generated
13543 code, except for the ABI and the set of available instructions. The
13544 choices for @var{architecture-type} are the same as for
13545 @option{-march=@var{architecture-type}}.
13547 @item -mmax-stack-frame=@var{n}
13548 @opindex mmax-stack-frame
13549 Warn when the stack frame of a function exceeds @var{n} bytes.
13555 The options @option{-metrax4} and @option{-metrax100} are synonyms for
13556 @option{-march=v3} and @option{-march=v8} respectively.
13558 @item -mmul-bug-workaround
13559 @itemx -mno-mul-bug-workaround
13560 @opindex mmul-bug-workaround
13561 @opindex mno-mul-bug-workaround
13562 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
13563 models where it applies. This option is active by default.
13567 Enable CRIS-specific verbose debug-related information in the assembly
13568 code. This option also has the effect of turning off the @samp{#NO_APP}
13569 formatted-code indicator to the assembler at the beginning of the
13574 Do not use condition-code results from previous instruction; always emit
13575 compare and test instructions before use of condition codes.
13577 @item -mno-side-effects
13578 @opindex mno-side-effects
13579 Do not emit instructions with side effects in addressing modes other than
13582 @item -mstack-align
13583 @itemx -mno-stack-align
13584 @itemx -mdata-align
13585 @itemx -mno-data-align
13586 @itemx -mconst-align
13587 @itemx -mno-const-align
13588 @opindex mstack-align
13589 @opindex mno-stack-align
13590 @opindex mdata-align
13591 @opindex mno-data-align
13592 @opindex mconst-align
13593 @opindex mno-const-align
13594 These options (@samp{no-} options) arrange (eliminate arrangements) for the
13595 stack frame, individual data and constants to be aligned for the maximum
13596 single data access size for the chosen CPU model. The default is to
13597 arrange for 32-bit alignment. ABI details such as structure layout are
13598 not affected by these options.
13606 Similar to the stack- data- and const-align options above, these options
13607 arrange for stack frame, writable data and constants to all be 32-bit,
13608 16-bit or 8-bit aligned. The default is 32-bit alignment.
13610 @item -mno-prologue-epilogue
13611 @itemx -mprologue-epilogue
13612 @opindex mno-prologue-epilogue
13613 @opindex mprologue-epilogue
13614 With @option{-mno-prologue-epilogue}, the normal function prologue and
13615 epilogue which set up the stack frame are omitted and no return
13616 instructions or return sequences are generated in the code. Use this
13617 option only together with visual inspection of the compiled code: no
13618 warnings or errors are generated when call-saved registers must be saved,
13619 or storage for local variables needs to be allocated.
13623 @opindex mno-gotplt
13625 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
13626 instruction sequences that load addresses for functions from the PLT part
13627 of the GOT rather than (traditional on other architectures) calls to the
13628 PLT@. The default is @option{-mgotplt}.
13632 Legacy no-op option only recognized with the cris-axis-elf and
13633 cris-axis-linux-gnu targets.
13637 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
13641 This option, recognized for the cris-axis-elf, arranges
13642 to link with input-output functions from a simulator library. Code,
13643 initialized data and zero-initialized data are allocated consecutively.
13647 Like @option{-sim}, but pass linker options to locate initialized data at
13648 0x40000000 and zero-initialized data at 0x80000000.
13652 @subsection CR16 Options
13653 @cindex CR16 Options
13655 These options are defined specifically for the CR16 ports.
13661 Enable the use of multiply-accumulate instructions. Disabled by default.
13665 @opindex mcr16cplus
13667 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
13672 Links the library libsim.a which is in compatible with simulator. Applicable
13673 to ELF compiler only.
13677 Choose integer type as 32-bit wide.
13681 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
13683 @item -mdata-model=@var{model}
13684 @opindex mdata-model
13685 Choose a data model. The choices for @var{model} are @samp{near},
13686 @samp{far} or @samp{medium}. @samp{medium} is default.
13687 However, @samp{far} is not valid with @option{-mcr16c}, as the
13688 CR16C architecture does not support the far data model.
13691 @node Darwin Options
13692 @subsection Darwin Options
13693 @cindex Darwin options
13695 These options are defined for all architectures running the Darwin operating
13698 FSF GCC on Darwin does not create ``fat'' object files; it creates
13699 an object file for the single architecture that GCC was built to
13700 target. Apple's GCC on Darwin does create ``fat'' files if multiple
13701 @option{-arch} options are used; it does so by running the compiler or
13702 linker multiple times and joining the results together with
13705 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
13706 @samp{i686}) is determined by the flags that specify the ISA
13707 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
13708 @option{-force_cpusubtype_ALL} option can be used to override this.
13710 The Darwin tools vary in their behavior when presented with an ISA
13711 mismatch. The assembler, @file{as}, only permits instructions to
13712 be used that are valid for the subtype of the file it is generating,
13713 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
13714 The linker for shared libraries, @file{/usr/bin/libtool}, fails
13715 and prints an error if asked to create a shared library with a less
13716 restrictive subtype than its input files (for instance, trying to put
13717 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
13718 for executables, @command{ld}, quietly gives the executable the most
13719 restrictive subtype of any of its input files.
13724 Add the framework directory @var{dir} to the head of the list of
13725 directories to be searched for header files. These directories are
13726 interleaved with those specified by @option{-I} options and are
13727 scanned in a left-to-right order.
13729 A framework directory is a directory with frameworks in it. A
13730 framework is a directory with a @file{Headers} and/or
13731 @file{PrivateHeaders} directory contained directly in it that ends
13732 in @file{.framework}. The name of a framework is the name of this
13733 directory excluding the @file{.framework}. Headers associated with
13734 the framework are found in one of those two directories, with
13735 @file{Headers} being searched first. A subframework is a framework
13736 directory that is in a framework's @file{Frameworks} directory.
13737 Includes of subframework headers can only appear in a header of a
13738 framework that contains the subframework, or in a sibling subframework
13739 header. Two subframeworks are siblings if they occur in the same
13740 framework. A subframework should not have the same name as a
13741 framework; a warning is issued if this is violated. Currently a
13742 subframework cannot have subframeworks; in the future, the mechanism
13743 may be extended to support this. The standard frameworks can be found
13744 in @file{/System/Library/Frameworks} and
13745 @file{/Library/Frameworks}. An example include looks like
13746 @code{#include <Framework/header.h>}, where @file{Framework} denotes
13747 the name of the framework and @file{header.h} is found in the
13748 @file{PrivateHeaders} or @file{Headers} directory.
13750 @item -iframework@var{dir}
13751 @opindex iframework
13752 Like @option{-F} except the directory is a treated as a system
13753 directory. The main difference between this @option{-iframework} and
13754 @option{-F} is that with @option{-iframework} the compiler does not
13755 warn about constructs contained within header files found via
13756 @var{dir}. This option is valid only for the C family of languages.
13760 Emit debugging information for symbols that are used. For stabs
13761 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
13762 This is by default ON@.
13766 Emit debugging information for all symbols and types.
13768 @item -mmacosx-version-min=@var{version}
13769 The earliest version of MacOS X that this executable will run on
13770 is @var{version}. Typical values of @var{version} include @code{10.1},
13771 @code{10.2}, and @code{10.3.9}.
13773 If the compiler was built to use the system's headers by default,
13774 then the default for this option is the system version on which the
13775 compiler is running, otherwise the default is to make choices that
13776 are compatible with as many systems and code bases as possible.
13780 Enable kernel development mode. The @option{-mkernel} option sets
13781 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
13782 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
13783 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
13784 applicable. This mode also sets @option{-mno-altivec},
13785 @option{-msoft-float}, @option{-fno-builtin} and
13786 @option{-mlong-branch} for PowerPC targets.
13788 @item -mone-byte-bool
13789 @opindex mone-byte-bool
13790 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
13791 By default @samp{sizeof(bool)} is @samp{4} when compiling for
13792 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
13793 option has no effect on x86.
13795 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
13796 to generate code that is not binary compatible with code generated
13797 without that switch. Using this switch may require recompiling all
13798 other modules in a program, including system libraries. Use this
13799 switch to conform to a non-default data model.
13801 @item -mfix-and-continue
13802 @itemx -ffix-and-continue
13803 @itemx -findirect-data
13804 @opindex mfix-and-continue
13805 @opindex ffix-and-continue
13806 @opindex findirect-data
13807 Generate code suitable for fast turnaround development, such as to
13808 allow GDB to dynamically load @code{.o} files into already-running
13809 programs. @option{-findirect-data} and @option{-ffix-and-continue}
13810 are provided for backwards compatibility.
13814 Loads all members of static archive libraries.
13815 See man ld(1) for more information.
13817 @item -arch_errors_fatal
13818 @opindex arch_errors_fatal
13819 Cause the errors having to do with files that have the wrong architecture
13822 @item -bind_at_load
13823 @opindex bind_at_load
13824 Causes the output file to be marked such that the dynamic linker will
13825 bind all undefined references when the file is loaded or launched.
13829 Produce a Mach-o bundle format file.
13830 See man ld(1) for more information.
13832 @item -bundle_loader @var{executable}
13833 @opindex bundle_loader
13834 This option specifies the @var{executable} that will load the build
13835 output file being linked. See man ld(1) for more information.
13838 @opindex dynamiclib
13839 When passed this option, GCC produces a dynamic library instead of
13840 an executable when linking, using the Darwin @file{libtool} command.
13842 @item -force_cpusubtype_ALL
13843 @opindex force_cpusubtype_ALL
13844 This causes GCC's output file to have the @var{ALL} subtype, instead of
13845 one controlled by the @option{-mcpu} or @option{-march} option.
13847 @item -allowable_client @var{client_name}
13848 @itemx -client_name
13849 @itemx -compatibility_version
13850 @itemx -current_version
13852 @itemx -dependency-file
13854 @itemx -dylinker_install_name
13856 @itemx -exported_symbols_list
13859 @itemx -flat_namespace
13860 @itemx -force_flat_namespace
13861 @itemx -headerpad_max_install_names
13864 @itemx -install_name
13865 @itemx -keep_private_externs
13866 @itemx -multi_module
13867 @itemx -multiply_defined
13868 @itemx -multiply_defined_unused
13871 @itemx -no_dead_strip_inits_and_terms
13872 @itemx -nofixprebinding
13873 @itemx -nomultidefs
13875 @itemx -noseglinkedit
13876 @itemx -pagezero_size
13878 @itemx -prebind_all_twolevel_modules
13879 @itemx -private_bundle
13881 @itemx -read_only_relocs
13883 @itemx -sectobjectsymbols
13887 @itemx -sectobjectsymbols
13890 @itemx -segs_read_only_addr
13892 @itemx -segs_read_write_addr
13893 @itemx -seg_addr_table
13894 @itemx -seg_addr_table_filename
13895 @itemx -seglinkedit
13897 @itemx -segs_read_only_addr
13898 @itemx -segs_read_write_addr
13899 @itemx -single_module
13901 @itemx -sub_library
13903 @itemx -sub_umbrella
13904 @itemx -twolevel_namespace
13907 @itemx -unexported_symbols_list
13908 @itemx -weak_reference_mismatches
13909 @itemx -whatsloaded
13910 @opindex allowable_client
13911 @opindex client_name
13912 @opindex compatibility_version
13913 @opindex current_version
13914 @opindex dead_strip
13915 @opindex dependency-file
13916 @opindex dylib_file
13917 @opindex dylinker_install_name
13919 @opindex exported_symbols_list
13921 @opindex flat_namespace
13922 @opindex force_flat_namespace
13923 @opindex headerpad_max_install_names
13924 @opindex image_base
13926 @opindex install_name
13927 @opindex keep_private_externs
13928 @opindex multi_module
13929 @opindex multiply_defined
13930 @opindex multiply_defined_unused
13931 @opindex noall_load
13932 @opindex no_dead_strip_inits_and_terms
13933 @opindex nofixprebinding
13934 @opindex nomultidefs
13936 @opindex noseglinkedit
13937 @opindex pagezero_size
13939 @opindex prebind_all_twolevel_modules
13940 @opindex private_bundle
13941 @opindex read_only_relocs
13943 @opindex sectobjectsymbols
13946 @opindex sectcreate
13947 @opindex sectobjectsymbols
13950 @opindex segs_read_only_addr
13951 @opindex segs_read_write_addr
13952 @opindex seg_addr_table
13953 @opindex seg_addr_table_filename
13954 @opindex seglinkedit
13956 @opindex segs_read_only_addr
13957 @opindex segs_read_write_addr
13958 @opindex single_module
13960 @opindex sub_library
13961 @opindex sub_umbrella
13962 @opindex twolevel_namespace
13965 @opindex unexported_symbols_list
13966 @opindex weak_reference_mismatches
13967 @opindex whatsloaded
13968 These options are passed to the Darwin linker. The Darwin linker man page
13969 describes them in detail.
13972 @node DEC Alpha Options
13973 @subsection DEC Alpha Options
13975 These @samp{-m} options are defined for the DEC Alpha implementations:
13978 @item -mno-soft-float
13979 @itemx -msoft-float
13980 @opindex mno-soft-float
13981 @opindex msoft-float
13982 Use (do not use) the hardware floating-point instructions for
13983 floating-point operations. When @option{-msoft-float} is specified,
13984 functions in @file{libgcc.a} are used to perform floating-point
13985 operations. Unless they are replaced by routines that emulate the
13986 floating-point operations, or compiled in such a way as to call such
13987 emulations routines, these routines issue floating-point
13988 operations. If you are compiling for an Alpha without floating-point
13989 operations, you must ensure that the library is built so as not to call
13992 Note that Alpha implementations without floating-point operations are
13993 required to have floating-point registers.
13996 @itemx -mno-fp-regs
13998 @opindex mno-fp-regs
13999 Generate code that uses (does not use) the floating-point register set.
14000 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
14001 register set is not used, floating-point operands are passed in integer
14002 registers as if they were integers and floating-point results are passed
14003 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
14004 so any function with a floating-point argument or return value called by code
14005 compiled with @option{-mno-fp-regs} must also be compiled with that
14008 A typical use of this option is building a kernel that does not use,
14009 and hence need not save and restore, any floating-point registers.
14013 The Alpha architecture implements floating-point hardware optimized for
14014 maximum performance. It is mostly compliant with the IEEE floating-point
14015 standard. However, for full compliance, software assistance is
14016 required. This option generates code fully IEEE-compliant code
14017 @emph{except} that the @var{inexact-flag} is not maintained (see below).
14018 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
14019 defined during compilation. The resulting code is less efficient but is
14020 able to correctly support denormalized numbers and exceptional IEEE
14021 values such as not-a-number and plus/minus infinity. Other Alpha
14022 compilers call this option @option{-ieee_with_no_inexact}.
14024 @item -mieee-with-inexact
14025 @opindex mieee-with-inexact
14026 This is like @option{-mieee} except the generated code also maintains
14027 the IEEE @var{inexact-flag}. Turning on this option causes the
14028 generated code to implement fully-compliant IEEE math. In addition to
14029 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
14030 macro. On some Alpha implementations the resulting code may execute
14031 significantly slower than the code generated by default. Since there is
14032 very little code that depends on the @var{inexact-flag}, you should
14033 normally not specify this option. Other Alpha compilers call this
14034 option @option{-ieee_with_inexact}.
14036 @item -mfp-trap-mode=@var{trap-mode}
14037 @opindex mfp-trap-mode
14038 This option controls what floating-point related traps are enabled.
14039 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
14040 The trap mode can be set to one of four values:
14044 This is the default (normal) setting. The only traps that are enabled
14045 are the ones that cannot be disabled in software (e.g., division by zero
14049 In addition to the traps enabled by @samp{n}, underflow traps are enabled
14053 Like @samp{u}, but the instructions are marked to be safe for software
14054 completion (see Alpha architecture manual for details).
14057 Like @samp{su}, but inexact traps are enabled as well.
14060 @item -mfp-rounding-mode=@var{rounding-mode}
14061 @opindex mfp-rounding-mode
14062 Selects the IEEE rounding mode. Other Alpha compilers call this option
14063 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
14068 Normal IEEE rounding mode. Floating-point numbers are rounded towards
14069 the nearest machine number or towards the even machine number in case
14073 Round towards minus infinity.
14076 Chopped rounding mode. Floating-point numbers are rounded towards zero.
14079 Dynamic rounding mode. A field in the floating-point control register
14080 (@var{fpcr}, see Alpha architecture reference manual) controls the
14081 rounding mode in effect. The C library initializes this register for
14082 rounding towards plus infinity. Thus, unless your program modifies the
14083 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
14086 @item -mtrap-precision=@var{trap-precision}
14087 @opindex mtrap-precision
14088 In the Alpha architecture, floating-point traps are imprecise. This
14089 means without software assistance it is impossible to recover from a
14090 floating trap and program execution normally needs to be terminated.
14091 GCC can generate code that can assist operating system trap handlers
14092 in determining the exact location that caused a floating-point trap.
14093 Depending on the requirements of an application, different levels of
14094 precisions can be selected:
14098 Program precision. This option is the default and means a trap handler
14099 can only identify which program caused a floating-point exception.
14102 Function precision. The trap handler can determine the function that
14103 caused a floating-point exception.
14106 Instruction precision. The trap handler can determine the exact
14107 instruction that caused a floating-point exception.
14110 Other Alpha compilers provide the equivalent options called
14111 @option{-scope_safe} and @option{-resumption_safe}.
14113 @item -mieee-conformant
14114 @opindex mieee-conformant
14115 This option marks the generated code as IEEE conformant. You must not
14116 use this option unless you also specify @option{-mtrap-precision=i} and either
14117 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
14118 is to emit the line @samp{.eflag 48} in the function prologue of the
14119 generated assembly file.
14121 @item -mbuild-constants
14122 @opindex mbuild-constants
14123 Normally GCC examines a 32- or 64-bit integer constant to
14124 see if it can construct it from smaller constants in two or three
14125 instructions. If it cannot, it outputs the constant as a literal and
14126 generates code to load it from the data segment at run time.
14128 Use this option to require GCC to construct @emph{all} integer constants
14129 using code, even if it takes more instructions (the maximum is six).
14131 You typically use this option to build a shared library dynamic
14132 loader. Itself a shared library, it must relocate itself in memory
14133 before it can find the variables and constants in its own data segment.
14151 Indicate whether GCC should generate code to use the optional BWX,
14152 CIX, FIX and MAX instruction sets. The default is to use the instruction
14153 sets supported by the CPU type specified via @option{-mcpu=} option or that
14154 of the CPU on which GCC was built if none is specified.
14157 @itemx -mfloat-ieee
14158 @opindex mfloat-vax
14159 @opindex mfloat-ieee
14160 Generate code that uses (does not use) VAX F and G floating-point
14161 arithmetic instead of IEEE single and double precision.
14163 @item -mexplicit-relocs
14164 @itemx -mno-explicit-relocs
14165 @opindex mexplicit-relocs
14166 @opindex mno-explicit-relocs
14167 Older Alpha assemblers provided no way to generate symbol relocations
14168 except via assembler macros. Use of these macros does not allow
14169 optimal instruction scheduling. GNU binutils as of version 2.12
14170 supports a new syntax that allows the compiler to explicitly mark
14171 which relocations should apply to which instructions. This option
14172 is mostly useful for debugging, as GCC detects the capabilities of
14173 the assembler when it is built and sets the default accordingly.
14176 @itemx -mlarge-data
14177 @opindex msmall-data
14178 @opindex mlarge-data
14179 When @option{-mexplicit-relocs} is in effect, static data is
14180 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
14181 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
14182 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
14183 16-bit relocations off of the @code{$gp} register. This limits the
14184 size of the small data area to 64KB, but allows the variables to be
14185 directly accessed via a single instruction.
14187 The default is @option{-mlarge-data}. With this option the data area
14188 is limited to just below 2GB@. Programs that require more than 2GB of
14189 data must use @code{malloc} or @code{mmap} to allocate the data in the
14190 heap instead of in the program's data segment.
14192 When generating code for shared libraries, @option{-fpic} implies
14193 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
14196 @itemx -mlarge-text
14197 @opindex msmall-text
14198 @opindex mlarge-text
14199 When @option{-msmall-text} is used, the compiler assumes that the
14200 code of the entire program (or shared library) fits in 4MB, and is
14201 thus reachable with a branch instruction. When @option{-msmall-data}
14202 is used, the compiler can assume that all local symbols share the
14203 same @code{$gp} value, and thus reduce the number of instructions
14204 required for a function call from 4 to 1.
14206 The default is @option{-mlarge-text}.
14208 @item -mcpu=@var{cpu_type}
14210 Set the instruction set and instruction scheduling parameters for
14211 machine type @var{cpu_type}. You can specify either the @samp{EV}
14212 style name or the corresponding chip number. GCC supports scheduling
14213 parameters for the EV4, EV5 and EV6 family of processors and
14214 chooses the default values for the instruction set from the processor
14215 you specify. If you do not specify a processor type, GCC defaults
14216 to the processor on which the compiler was built.
14218 Supported values for @var{cpu_type} are
14224 Schedules as an EV4 and has no instruction set extensions.
14228 Schedules as an EV5 and has no instruction set extensions.
14232 Schedules as an EV5 and supports the BWX extension.
14237 Schedules as an EV5 and supports the BWX and MAX extensions.
14241 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
14245 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
14248 Native toolchains also support the value @samp{native},
14249 which selects the best architecture option for the host processor.
14250 @option{-mcpu=native} has no effect if GCC does not recognize
14253 @item -mtune=@var{cpu_type}
14255 Set only the instruction scheduling parameters for machine type
14256 @var{cpu_type}. The instruction set is not changed.
14258 Native toolchains also support the value @samp{native},
14259 which selects the best architecture option for the host processor.
14260 @option{-mtune=native} has no effect if GCC does not recognize
14263 @item -mmemory-latency=@var{time}
14264 @opindex mmemory-latency
14265 Sets the latency the scheduler should assume for typical memory
14266 references as seen by the application. This number is highly
14267 dependent on the memory access patterns used by the application
14268 and the size of the external cache on the machine.
14270 Valid options for @var{time} are
14274 A decimal number representing clock cycles.
14280 The compiler contains estimates of the number of clock cycles for
14281 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
14282 (also called Dcache, Scache, and Bcache), as well as to main memory.
14283 Note that L3 is only valid for EV5.
14289 @subsection FR30 Options
14290 @cindex FR30 Options
14292 These options are defined specifically for the FR30 port.
14296 @item -msmall-model
14297 @opindex msmall-model
14298 Use the small address space model. This can produce smaller code, but
14299 it does assume that all symbolic values and addresses fit into a
14304 Assume that runtime support has been provided and so there is no need
14305 to include the simulator library (@file{libsim.a}) on the linker
14311 @subsection FRV Options
14312 @cindex FRV Options
14318 Only use the first 32 general-purpose registers.
14323 Use all 64 general-purpose registers.
14328 Use only the first 32 floating-point registers.
14333 Use all 64 floating-point registers.
14336 @opindex mhard-float
14338 Use hardware instructions for floating-point operations.
14341 @opindex msoft-float
14343 Use library routines for floating-point operations.
14348 Dynamically allocate condition code registers.
14353 Do not try to dynamically allocate condition code registers, only
14354 use @code{icc0} and @code{fcc0}.
14359 Change ABI to use double word insns.
14364 Do not use double word instructions.
14369 Use floating-point double instructions.
14372 @opindex mno-double
14374 Do not use floating-point double instructions.
14379 Use media instructions.
14384 Do not use media instructions.
14389 Use multiply and add/subtract instructions.
14392 @opindex mno-muladd
14394 Do not use multiply and add/subtract instructions.
14399 Select the FDPIC ABI, which uses function descriptors to represent
14400 pointers to functions. Without any PIC/PIE-related options, it
14401 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
14402 assumes GOT entries and small data are within a 12-bit range from the
14403 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
14404 are computed with 32 bits.
14405 With a @samp{bfin-elf} target, this option implies @option{-msim}.
14408 @opindex minline-plt
14410 Enable inlining of PLT entries in function calls to functions that are
14411 not known to bind locally. It has no effect without @option{-mfdpic}.
14412 It's enabled by default if optimizing for speed and compiling for
14413 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
14414 optimization option such as @option{-O3} or above is present in the
14420 Assume a large TLS segment when generating thread-local code.
14425 Do not assume a large TLS segment when generating thread-local code.
14430 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
14431 that is known to be in read-only sections. It's enabled by default,
14432 except for @option{-fpic} or @option{-fpie}: even though it may help
14433 make the global offset table smaller, it trades 1 instruction for 4.
14434 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
14435 one of which may be shared by multiple symbols, and it avoids the need
14436 for a GOT entry for the referenced symbol, so it's more likely to be a
14437 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
14439 @item -multilib-library-pic
14440 @opindex multilib-library-pic
14442 Link with the (library, not FD) pic libraries. It's implied by
14443 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
14444 @option{-fpic} without @option{-mfdpic}. You should never have to use
14448 @opindex mlinked-fp
14450 Follow the EABI requirement of always creating a frame pointer whenever
14451 a stack frame is allocated. This option is enabled by default and can
14452 be disabled with @option{-mno-linked-fp}.
14455 @opindex mlong-calls
14457 Use indirect addressing to call functions outside the current
14458 compilation unit. This allows the functions to be placed anywhere
14459 within the 32-bit address space.
14461 @item -malign-labels
14462 @opindex malign-labels
14464 Try to align labels to an 8-byte boundary by inserting NOPs into the
14465 previous packet. This option only has an effect when VLIW packing
14466 is enabled. It doesn't create new packets; it merely adds NOPs to
14469 @item -mlibrary-pic
14470 @opindex mlibrary-pic
14472 Generate position-independent EABI code.
14477 Use only the first four media accumulator registers.
14482 Use all eight media accumulator registers.
14487 Pack VLIW instructions.
14492 Do not pack VLIW instructions.
14495 @opindex mno-eflags
14497 Do not mark ABI switches in e_flags.
14500 @opindex mcond-move
14502 Enable the use of conditional-move instructions (default).
14504 This switch is mainly for debugging the compiler and will likely be removed
14505 in a future version.
14507 @item -mno-cond-move
14508 @opindex mno-cond-move
14510 Disable the use of conditional-move instructions.
14512 This switch is mainly for debugging the compiler and will likely be removed
14513 in a future version.
14518 Enable the use of conditional set instructions (default).
14520 This switch is mainly for debugging the compiler and will likely be removed
14521 in a future version.
14526 Disable the use of conditional set instructions.
14528 This switch is mainly for debugging the compiler and will likely be removed
14529 in a future version.
14532 @opindex mcond-exec
14534 Enable the use of conditional execution (default).
14536 This switch is mainly for debugging the compiler and will likely be removed
14537 in a future version.
14539 @item -mno-cond-exec
14540 @opindex mno-cond-exec
14542 Disable the use of conditional execution.
14544 This switch is mainly for debugging the compiler and will likely be removed
14545 in a future version.
14547 @item -mvliw-branch
14548 @opindex mvliw-branch
14550 Run a pass to pack branches into VLIW instructions (default).
14552 This switch is mainly for debugging the compiler and will likely be removed
14553 in a future version.
14555 @item -mno-vliw-branch
14556 @opindex mno-vliw-branch
14558 Do not run a pass to pack branches into VLIW instructions.
14560 This switch is mainly for debugging the compiler and will likely be removed
14561 in a future version.
14563 @item -mmulti-cond-exec
14564 @opindex mmulti-cond-exec
14566 Enable optimization of @code{&&} and @code{||} in conditional execution
14569 This switch is mainly for debugging the compiler and will likely be removed
14570 in a future version.
14572 @item -mno-multi-cond-exec
14573 @opindex mno-multi-cond-exec
14575 Disable optimization of @code{&&} and @code{||} in conditional execution.
14577 This switch is mainly for debugging the compiler and will likely be removed
14578 in a future version.
14580 @item -mnested-cond-exec
14581 @opindex mnested-cond-exec
14583 Enable nested conditional execution optimizations (default).
14585 This switch is mainly for debugging the compiler and will likely be removed
14586 in a future version.
14588 @item -mno-nested-cond-exec
14589 @opindex mno-nested-cond-exec
14591 Disable nested conditional execution optimizations.
14593 This switch is mainly for debugging the compiler and will likely be removed
14594 in a future version.
14596 @item -moptimize-membar
14597 @opindex moptimize-membar
14599 This switch removes redundant @code{membar} instructions from the
14600 compiler-generated code. It is enabled by default.
14602 @item -mno-optimize-membar
14603 @opindex mno-optimize-membar
14605 This switch disables the automatic removal of redundant @code{membar}
14606 instructions from the generated code.
14608 @item -mtomcat-stats
14609 @opindex mtomcat-stats
14611 Cause gas to print out tomcat statistics.
14613 @item -mcpu=@var{cpu}
14616 Select the processor type for which to generate code. Possible values are
14617 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
14618 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
14622 @node GNU/Linux Options
14623 @subsection GNU/Linux Options
14625 These @samp{-m} options are defined for GNU/Linux targets:
14630 Use the GNU C library. This is the default except
14631 on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
14635 Use uClibc C library. This is the default on
14636 @samp{*-*-linux-*uclibc*} targets.
14640 Use Bionic C library. This is the default on
14641 @samp{*-*-linux-*android*} targets.
14645 Compile code compatible with Android platform. This is the default on
14646 @samp{*-*-linux-*android*} targets.
14648 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
14649 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
14650 this option makes the GCC driver pass Android-specific options to the linker.
14651 Finally, this option causes the preprocessor macro @code{__ANDROID__}
14654 @item -tno-android-cc
14655 @opindex tno-android-cc
14656 Disable compilation effects of @option{-mandroid}, i.e., do not enable
14657 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
14658 @option{-fno-rtti} by default.
14660 @item -tno-android-ld
14661 @opindex tno-android-ld
14662 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
14663 linking options to the linker.
14667 @node H8/300 Options
14668 @subsection H8/300 Options
14670 These @samp{-m} options are defined for the H8/300 implementations:
14675 Shorten some address references at link time, when possible; uses the
14676 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
14677 ld, Using ld}, for a fuller description.
14681 Generate code for the H8/300H@.
14685 Generate code for the H8S@.
14689 Generate code for the H8S and H8/300H in the normal mode. This switch
14690 must be used either with @option{-mh} or @option{-ms}.
14694 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
14698 Extended registers are stored on stack before execution of function
14699 with monitor attribute. Default option is @option{-mexr}.
14700 This option is valid only for H8S targets.
14704 Extended registers are not stored on stack before execution of function
14705 with monitor attribute. Default option is @option{-mno-exr}.
14706 This option is valid only for H8S targets.
14710 Make @code{int} data 32 bits by default.
14713 @opindex malign-300
14714 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
14715 The default for the H8/300H and H8S is to align longs and floats on
14717 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
14718 This option has no effect on the H8/300.
14722 @subsection HPPA Options
14723 @cindex HPPA Options
14725 These @samp{-m} options are defined for the HPPA family of computers:
14728 @item -march=@var{architecture-type}
14730 Generate code for the specified architecture. The choices for
14731 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
14732 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
14733 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
14734 architecture option for your machine. Code compiled for lower numbered
14735 architectures runs on higher numbered architectures, but not the
14738 @item -mpa-risc-1-0
14739 @itemx -mpa-risc-1-1
14740 @itemx -mpa-risc-2-0
14741 @opindex mpa-risc-1-0
14742 @opindex mpa-risc-1-1
14743 @opindex mpa-risc-2-0
14744 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
14746 @item -mjump-in-delay
14747 @opindex mjump-in-delay
14748 Fill delay slots of function calls with unconditional jump instructions
14749 by modifying the return pointer for the function call to be the target
14750 of the conditional jump.
14752 @item -mdisable-fpregs
14753 @opindex mdisable-fpregs
14754 Prevent floating-point registers from being used in any manner. This is
14755 necessary for compiling kernels that perform lazy context switching of
14756 floating-point registers. If you use this option and attempt to perform
14757 floating-point operations, the compiler aborts.
14759 @item -mdisable-indexing
14760 @opindex mdisable-indexing
14761 Prevent the compiler from using indexing address modes. This avoids some
14762 rather obscure problems when compiling MIG generated code under MACH@.
14764 @item -mno-space-regs
14765 @opindex mno-space-regs
14766 Generate code that assumes the target has no space registers. This allows
14767 GCC to generate faster indirect calls and use unscaled index address modes.
14769 Such code is suitable for level 0 PA systems and kernels.
14771 @item -mfast-indirect-calls
14772 @opindex mfast-indirect-calls
14773 Generate code that assumes calls never cross space boundaries. This
14774 allows GCC to emit code that performs faster indirect calls.
14776 This option does not work in the presence of shared libraries or nested
14779 @item -mfixed-range=@var{register-range}
14780 @opindex mfixed-range
14781 Generate code treating the given register range as fixed registers.
14782 A fixed register is one that the register allocator cannot use. This is
14783 useful when compiling kernel code. A register range is specified as
14784 two registers separated by a dash. Multiple register ranges can be
14785 specified separated by a comma.
14787 @item -mlong-load-store
14788 @opindex mlong-load-store
14789 Generate 3-instruction load and store sequences as sometimes required by
14790 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
14793 @item -mportable-runtime
14794 @opindex mportable-runtime
14795 Use the portable calling conventions proposed by HP for ELF systems.
14799 Enable the use of assembler directives only GAS understands.
14801 @item -mschedule=@var{cpu-type}
14803 Schedule code according to the constraints for the machine type
14804 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
14805 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
14806 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
14807 proper scheduling option for your machine. The default scheduling is
14811 @opindex mlinker-opt
14812 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
14813 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
14814 linkers in which they give bogus error messages when linking some programs.
14817 @opindex msoft-float
14818 Generate output containing library calls for floating point.
14819 @strong{Warning:} the requisite libraries are not available for all HPPA
14820 targets. Normally the facilities of the machine's usual C compiler are
14821 used, but this cannot be done directly in cross-compilation. You must make
14822 your own arrangements to provide suitable library functions for
14825 @option{-msoft-float} changes the calling convention in the output file;
14826 therefore, it is only useful if you compile @emph{all} of a program with
14827 this option. In particular, you need to compile @file{libgcc.a}, the
14828 library that comes with GCC, with @option{-msoft-float} in order for
14833 Generate the predefine, @code{_SIO}, for server IO@. The default is
14834 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
14835 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
14836 options are available under HP-UX and HI-UX@.
14840 Use options specific to GNU @command{ld}.
14841 This passes @option{-shared} to @command{ld} when
14842 building a shared library. It is the default when GCC is configured,
14843 explicitly or implicitly, with the GNU linker. This option does not
14844 affect which @command{ld} is called; it only changes what parameters
14845 are passed to that @command{ld}.
14846 The @command{ld} that is called is determined by the
14847 @option{--with-ld} configure option, GCC's program search path, and
14848 finally by the user's @env{PATH}. The linker used by GCC can be printed
14849 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
14850 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
14854 Use options specific to HP @command{ld}.
14855 This passes @option{-b} to @command{ld} when building
14856 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
14857 links. It is the default when GCC is configured, explicitly or
14858 implicitly, with the HP linker. This option does not affect
14859 which @command{ld} is called; it only changes what parameters are passed to that
14861 The @command{ld} that is called is determined by the @option{--with-ld}
14862 configure option, GCC's program search path, and finally by the user's
14863 @env{PATH}. The linker used by GCC can be printed using @samp{which
14864 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
14865 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
14868 @opindex mno-long-calls
14869 Generate code that uses long call sequences. This ensures that a call
14870 is always able to reach linker generated stubs. The default is to generate
14871 long calls only when the distance from the call site to the beginning
14872 of the function or translation unit, as the case may be, exceeds a
14873 predefined limit set by the branch type being used. The limits for
14874 normal calls are 7,600,000 and 240,000 bytes, respectively for the
14875 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
14878 Distances are measured from the beginning of functions when using the
14879 @option{-ffunction-sections} option, or when using the @option{-mgas}
14880 and @option{-mno-portable-runtime} options together under HP-UX with
14883 It is normally not desirable to use this option as it degrades
14884 performance. However, it may be useful in large applications,
14885 particularly when partial linking is used to build the application.
14887 The types of long calls used depends on the capabilities of the
14888 assembler and linker, and the type of code being generated. The
14889 impact on systems that support long absolute calls, and long pic
14890 symbol-difference or pc-relative calls should be relatively small.
14891 However, an indirect call is used on 32-bit ELF systems in pic code
14892 and it is quite long.
14894 @item -munix=@var{unix-std}
14896 Generate compiler predefines and select a startfile for the specified
14897 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
14898 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
14899 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
14900 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
14901 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
14904 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
14905 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
14906 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
14907 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
14908 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
14909 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
14911 It is @emph{important} to note that this option changes the interfaces
14912 for various library routines. It also affects the operational behavior
14913 of the C library. Thus, @emph{extreme} care is needed in using this
14916 Library code that is intended to operate with more than one UNIX
14917 standard must test, set and restore the variable @var{__xpg4_extended_mask}
14918 as appropriate. Most GNU software doesn't provide this capability.
14922 Suppress the generation of link options to search libdld.sl when the
14923 @option{-static} option is specified on HP-UX 10 and later.
14927 The HP-UX implementation of setlocale in libc has a dependency on
14928 libdld.sl. There isn't an archive version of libdld.sl. Thus,
14929 when the @option{-static} option is specified, special link options
14930 are needed to resolve this dependency.
14932 On HP-UX 10 and later, the GCC driver adds the necessary options to
14933 link with libdld.sl when the @option{-static} option is specified.
14934 This causes the resulting binary to be dynamic. On the 64-bit port,
14935 the linkers generate dynamic binaries by default in any case. The
14936 @option{-nolibdld} option can be used to prevent the GCC driver from
14937 adding these link options.
14941 Add support for multithreading with the @dfn{dce thread} library
14942 under HP-UX@. This option sets flags for both the preprocessor and
14946 @node i386 and x86-64 Options
14947 @subsection Intel 386 and AMD x86-64 Options
14948 @cindex i386 Options
14949 @cindex x86-64 Options
14950 @cindex Intel 386 Options
14951 @cindex AMD x86-64 Options
14953 These @samp{-m} options are defined for the i386 and x86-64 family of
14958 @item -march=@var{cpu-type}
14960 Generate instructions for the machine type @var{cpu-type}. In contrast to
14961 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
14962 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
14963 to generate code that may not run at all on processors other than the one
14964 indicated. Specifying @option{-march=@var{cpu-type}} implies
14965 @option{-mtune=@var{cpu-type}}.
14967 The choices for @var{cpu-type} are:
14971 This selects the CPU to generate code for at compilation time by determining
14972 the processor type of the compiling machine. Using @option{-march=native}
14973 enables all instruction subsets supported by the local machine (hence
14974 the result might not run on different machines). Using @option{-mtune=native}
14975 produces code optimized for the local machine under the constraints
14976 of the selected instruction set.
14979 Original Intel i386 CPU@.
14982 Intel i486 CPU@. (No scheduling is implemented for this chip.)
14986 Intel Pentium CPU with no MMX support.
14989 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
14992 Intel Pentium Pro CPU@.
14995 When used with @option{-march}, the Pentium Pro
14996 instruction set is used, so the code runs on all i686 family chips.
14997 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
15000 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
15005 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
15009 Intel Pentium M; low-power version of Intel Pentium III CPU
15010 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
15014 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
15017 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
15021 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
15022 SSE2 and SSE3 instruction set support.
15025 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
15026 instruction set support.
15029 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15030 SSE4.1, SSE4.2 and POPCNT instruction set support.
15033 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15034 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
15037 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15038 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
15041 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15042 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
15043 instruction set support.
15046 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
15047 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
15048 BMI, BMI2 and F16C instruction set support.
15051 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
15052 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
15053 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
15056 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
15057 instruction set support.
15060 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
15061 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
15064 AMD K6 CPU with MMX instruction set support.
15068 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
15071 @itemx athlon-tbird
15072 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
15078 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
15079 instruction set support.
15085 Processors based on the AMD K8 core with x86-64 instruction set support,
15086 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
15087 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
15088 instruction set extensions.)
15091 @itemx opteron-sse3
15092 @itemx athlon64-sse3
15093 Improved versions of AMD K8 cores with SSE3 instruction set support.
15097 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
15098 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
15099 instruction set extensions.)
15102 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
15103 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
15104 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
15106 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
15107 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
15108 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
15111 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
15112 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
15113 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
15114 64-bit instruction set extensions.
15116 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
15117 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
15118 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
15119 SSE4.2, ABM and 64-bit instruction set extensions.
15122 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
15123 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
15124 instruction set extensions.)
15127 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
15128 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
15129 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
15132 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
15136 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
15137 instruction set support.
15140 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
15141 implemented for this chip.)
15144 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
15146 implemented for this chip.)
15149 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
15152 @item -mtune=@var{cpu-type}
15154 Tune to @var{cpu-type} everything applicable about the generated code, except
15155 for the ABI and the set of available instructions.
15156 While picking a specific @var{cpu-type} schedules things appropriately
15157 for that particular chip, the compiler does not generate any code that
15158 cannot run on the default machine type unless you use a
15159 @option{-march=@var{cpu-type}} option.
15160 For example, if GCC is configured for i686-pc-linux-gnu
15161 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
15162 but still runs on i686 machines.
15164 The choices for @var{cpu-type} are the same as for @option{-march}.
15165 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
15169 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
15170 If you know the CPU on which your code will run, then you should use
15171 the corresponding @option{-mtune} or @option{-march} option instead of
15172 @option{-mtune=generic}. But, if you do not know exactly what CPU users
15173 of your application will have, then you should use this option.
15175 As new processors are deployed in the marketplace, the behavior of this
15176 option will change. Therefore, if you upgrade to a newer version of
15177 GCC, code generation controlled by this option will change to reflect
15179 that are most common at the time that version of GCC is released.
15181 There is no @option{-march=generic} option because @option{-march}
15182 indicates the instruction set the compiler can use, and there is no
15183 generic instruction set applicable to all processors. In contrast,
15184 @option{-mtune} indicates the processor (or, in this case, collection of
15185 processors) for which the code is optimized.
15188 Produce code optimized for the most current Intel processors, which are
15189 Haswell and Silvermont for this version of GCC. If you know the CPU
15190 on which your code will run, then you should use the corresponding
15191 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
15192 But, if you want your application performs better on both Haswell and
15193 Silvermont, then you should use this option.
15195 As new Intel processors are deployed in the marketplace, the behavior of
15196 this option will change. Therefore, if you upgrade to a newer version of
15197 GCC, code generation controlled by this option will change to reflect
15198 the most current Intel processors at the time that version of GCC is
15201 There is no @option{-march=intel} option because @option{-march} indicates
15202 the instruction set the compiler can use, and there is no common
15203 instruction set applicable to all processors. In contrast,
15204 @option{-mtune} indicates the processor (or, in this case, collection of
15205 processors) for which the code is optimized.
15208 @item -mcpu=@var{cpu-type}
15210 A deprecated synonym for @option{-mtune}.
15212 @item -mfpmath=@var{unit}
15214 Generate floating-point arithmetic for selected unit @var{unit}. The choices
15215 for @var{unit} are:
15219 Use the standard 387 floating-point coprocessor present on the majority of chips and
15220 emulated otherwise. Code compiled with this option runs almost everywhere.
15221 The temporary results are computed in 80-bit precision instead of the precision
15222 specified by the type, resulting in slightly different results compared to most
15223 of other chips. See @option{-ffloat-store} for more detailed description.
15225 This is the default choice for i386 compiler.
15228 Use scalar floating-point instructions present in the SSE instruction set.
15229 This instruction set is supported by Pentium III and newer chips,
15230 and in the AMD line
15231 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
15232 instruction set supports only single-precision arithmetic, thus the double and
15233 extended-precision arithmetic are still done using 387. A later version, present
15234 only in Pentium 4 and AMD x86-64 chips, supports double-precision
15237 For the i386 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
15238 or @option{-msse2} switches to enable SSE extensions and make this option
15239 effective. For the x86-64 compiler, these extensions are enabled by default.
15241 The resulting code should be considerably faster in the majority of cases and avoid
15242 the numerical instability problems of 387 code, but may break some existing
15243 code that expects temporaries to be 80 bits.
15245 This is the default choice for the x86-64 compiler.
15250 Attempt to utilize both instruction sets at once. This effectively doubles the
15251 amount of available registers, and on chips with separate execution units for
15252 387 and SSE the execution resources too. Use this option with care, as it is
15253 still experimental, because the GCC register allocator does not model separate
15254 functional units well, resulting in unstable performance.
15257 @item -masm=@var{dialect}
15258 @opindex masm=@var{dialect}
15259 Output assembly instructions using selected @var{dialect}. Supported
15260 choices are @samp{intel} or @samp{att} (the default). Darwin does
15261 not support @samp{intel}.
15264 @itemx -mno-ieee-fp
15266 @opindex mno-ieee-fp
15267 Control whether or not the compiler uses IEEE floating-point
15268 comparisons. These correctly handle the case where the result of a
15269 comparison is unordered.
15272 @opindex msoft-float
15273 Generate output containing library calls for floating point.
15275 @strong{Warning:} the requisite libraries are not part of GCC@.
15276 Normally the facilities of the machine's usual C compiler are used, but
15277 this can't be done directly in cross-compilation. You must make your
15278 own arrangements to provide suitable library functions for
15281 On machines where a function returns floating-point results in the 80387
15282 register stack, some floating-point opcodes may be emitted even if
15283 @option{-msoft-float} is used.
15285 @item -mno-fp-ret-in-387
15286 @opindex mno-fp-ret-in-387
15287 Do not use the FPU registers for return values of functions.
15289 The usual calling convention has functions return values of types
15290 @code{float} and @code{double} in an FPU register, even if there
15291 is no FPU@. The idea is that the operating system should emulate
15294 The option @option{-mno-fp-ret-in-387} causes such values to be returned
15295 in ordinary CPU registers instead.
15297 @item -mno-fancy-math-387
15298 @opindex mno-fancy-math-387
15299 Some 387 emulators do not support the @code{sin}, @code{cos} and
15300 @code{sqrt} instructions for the 387. Specify this option to avoid
15301 generating those instructions. This option is the default on FreeBSD,
15302 OpenBSD and NetBSD@. This option is overridden when @option{-march}
15303 indicates that the target CPU always has an FPU and so the
15304 instruction does not need emulation. These
15305 instructions are not generated unless you also use the
15306 @option{-funsafe-math-optimizations} switch.
15308 @item -malign-double
15309 @itemx -mno-align-double
15310 @opindex malign-double
15311 @opindex mno-align-double
15312 Control whether GCC aligns @code{double}, @code{long double}, and
15313 @code{long long} variables on a two-word boundary or a one-word
15314 boundary. Aligning @code{double} variables on a two-word boundary
15315 produces code that runs somewhat faster on a Pentium at the
15316 expense of more memory.
15318 On x86-64, @option{-malign-double} is enabled by default.
15320 @strong{Warning:} if you use the @option{-malign-double} switch,
15321 structures containing the above types are aligned differently than
15322 the published application binary interface specifications for the 386
15323 and are not binary compatible with structures in code compiled
15324 without that switch.
15326 @item -m96bit-long-double
15327 @itemx -m128bit-long-double
15328 @opindex m96bit-long-double
15329 @opindex m128bit-long-double
15330 These switches control the size of @code{long double} type. The i386
15331 application binary interface specifies the size to be 96 bits,
15332 so @option{-m96bit-long-double} is the default in 32-bit mode.
15334 Modern architectures (Pentium and newer) prefer @code{long double}
15335 to be aligned to an 8- or 16-byte boundary. In arrays or structures
15336 conforming to the ABI, this is not possible. So specifying
15337 @option{-m128bit-long-double} aligns @code{long double}
15338 to a 16-byte boundary by padding the @code{long double} with an additional
15341 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
15342 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
15344 Notice that neither of these options enable any extra precision over the x87
15345 standard of 80 bits for a @code{long double}.
15347 @strong{Warning:} if you override the default value for your target ABI, this
15348 changes the size of
15349 structures and arrays containing @code{long double} variables,
15350 as well as modifying the function calling convention for functions taking
15351 @code{long double}. Hence they are not binary-compatible
15352 with code compiled without that switch.
15354 @item -mlong-double-64
15355 @itemx -mlong-double-80
15356 @itemx -mlong-double-128
15357 @opindex mlong-double-64
15358 @opindex mlong-double-80
15359 @opindex mlong-double-128
15360 These switches control the size of @code{long double} type. A size
15361 of 64 bits makes the @code{long double} type equivalent to the @code{double}
15362 type. This is the default for 32-bit Bionic C library. A size
15363 of 128 bits makes the @code{long double} type equivalent to the
15364 @code{__float128} type. This is the default for 64-bit Bionic C library.
15366 @strong{Warning:} if you override the default value for your target ABI, this
15367 changes the size of
15368 structures and arrays containing @code{long double} variables,
15369 as well as modifying the function calling convention for functions taking
15370 @code{long double}. Hence they are not binary-compatible
15371 with code compiled without that switch.
15373 @item -mlarge-data-threshold=@var{threshold}
15374 @opindex mlarge-data-threshold
15375 When @option{-mcmodel=medium} is specified, data objects larger than
15376 @var{threshold} are placed in the large data section. This value must be the
15377 same across all objects linked into the binary, and defaults to 65535.
15381 Use a different function-calling convention, in which functions that
15382 take a fixed number of arguments return with the @code{ret @var{num}}
15383 instruction, which pops their arguments while returning. This saves one
15384 instruction in the caller since there is no need to pop the arguments
15387 You can specify that an individual function is called with this calling
15388 sequence with the function attribute @samp{stdcall}. You can also
15389 override the @option{-mrtd} option by using the function attribute
15390 @samp{cdecl}. @xref{Function Attributes}.
15392 @strong{Warning:} this calling convention is incompatible with the one
15393 normally used on Unix, so you cannot use it if you need to call
15394 libraries compiled with the Unix compiler.
15396 Also, you must provide function prototypes for all functions that
15397 take variable numbers of arguments (including @code{printf});
15398 otherwise incorrect code is generated for calls to those
15401 In addition, seriously incorrect code results if you call a
15402 function with too many arguments. (Normally, extra arguments are
15403 harmlessly ignored.)
15405 @item -mregparm=@var{num}
15407 Control how many registers are used to pass integer arguments. By
15408 default, no registers are used to pass arguments, and at most 3
15409 registers can be used. You can control this behavior for a specific
15410 function by using the function attribute @samp{regparm}.
15411 @xref{Function Attributes}.
15413 @strong{Warning:} if you use this switch, and
15414 @var{num} is nonzero, then you must build all modules with the same
15415 value, including any libraries. This includes the system libraries and
15419 @opindex msseregparm
15420 Use SSE register passing conventions for float and double arguments
15421 and return values. You can control this behavior for a specific
15422 function by using the function attribute @samp{sseregparm}.
15423 @xref{Function Attributes}.
15425 @strong{Warning:} if you use this switch then you must build all
15426 modules with the same value, including any libraries. This includes
15427 the system libraries and startup modules.
15429 @item -mvect8-ret-in-mem
15430 @opindex mvect8-ret-in-mem
15431 Return 8-byte vectors in memory instead of MMX registers. This is the
15432 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
15433 Studio compilers until version 12. Later compiler versions (starting
15434 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
15435 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
15436 you need to remain compatible with existing code produced by those
15437 previous compiler versions or older versions of GCC@.
15446 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
15447 is specified, the significands of results of floating-point operations are
15448 rounded to 24 bits (single precision); @option{-mpc64} rounds the
15449 significands of results of floating-point operations to 53 bits (double
15450 precision) and @option{-mpc80} rounds the significands of results of
15451 floating-point operations to 64 bits (extended double precision), which is
15452 the default. When this option is used, floating-point operations in higher
15453 precisions are not available to the programmer without setting the FPU
15454 control word explicitly.
15456 Setting the rounding of floating-point operations to less than the default
15457 80 bits can speed some programs by 2% or more. Note that some mathematical
15458 libraries assume that extended-precision (80-bit) floating-point operations
15459 are enabled by default; routines in such libraries could suffer significant
15460 loss of accuracy, typically through so-called ``catastrophic cancellation'',
15461 when this option is used to set the precision to less than extended precision.
15463 @item -mstackrealign
15464 @opindex mstackrealign
15465 Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
15466 option generates an alternate prologue and epilogue that realigns the
15467 run-time stack if necessary. This supports mixing legacy codes that keep
15468 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
15469 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
15470 applicable to individual functions.
15472 @item -mpreferred-stack-boundary=@var{num}
15473 @opindex mpreferred-stack-boundary
15474 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
15475 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
15476 the default is 4 (16 bytes or 128 bits).
15478 @strong{Warning:} When generating code for the x86-64 architecture with
15479 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
15480 used to keep the stack boundary aligned to 8 byte boundary. Since
15481 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
15482 intended to be used in controlled environment where stack space is
15483 important limitation. This option will lead to wrong code when functions
15484 compiled with 16 byte stack alignment (such as functions from a standard
15485 library) are called with misaligned stack. In this case, SSE
15486 instructions may lead to misaligned memory access traps. In addition,
15487 variable arguments will be handled incorrectly for 16 byte aligned
15488 objects (including x87 long double and __int128), leading to wrong
15489 results. You must build all modules with
15490 @option{-mpreferred-stack-boundary=3}, including any libraries. This
15491 includes the system libraries and startup modules.
15493 @item -mincoming-stack-boundary=@var{num}
15494 @opindex mincoming-stack-boundary
15495 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
15496 boundary. If @option{-mincoming-stack-boundary} is not specified,
15497 the one specified by @option{-mpreferred-stack-boundary} is used.
15499 On Pentium and Pentium Pro, @code{double} and @code{long double} values
15500 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
15501 suffer significant run time performance penalties. On Pentium III, the
15502 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
15503 properly if it is not 16-byte aligned.
15505 To ensure proper alignment of this values on the stack, the stack boundary
15506 must be as aligned as that required by any value stored on the stack.
15507 Further, every function must be generated such that it keeps the stack
15508 aligned. Thus calling a function compiled with a higher preferred
15509 stack boundary from a function compiled with a lower preferred stack
15510 boundary most likely misaligns the stack. It is recommended that
15511 libraries that use callbacks always use the default setting.
15513 This extra alignment does consume extra stack space, and generally
15514 increases code size. Code that is sensitive to stack space usage, such
15515 as embedded systems and operating system kernels, may want to reduce the
15516 preferred alignment to @option{-mpreferred-stack-boundary=2}.
15540 @itemx -mno-avx512f
15543 @itemx -mno-avx512pf
15545 @itemx -mno-avx512er
15547 @itemx -mno-avx512cd
15555 @itemx -mno-clflsuhopt
15558 @itemx -mno-fsgsbase
15565 @itemx -mprefetchwt1
15566 @itemx -mno-prefetchwt1
15604 These switches enable or disable the use of instructions in the MMX, SSE,
15605 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
15606 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
15607 BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, or 3DNow!@:
15608 extended instruction sets.
15609 These extensions are also available as built-in functions: see
15610 @ref{X86 Built-in Functions}, for details of the functions enabled and
15611 disabled by these switches.
15613 To generate SSE/SSE2 instructions automatically from floating-point
15614 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
15616 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
15617 generates new AVX instructions or AVX equivalence for all SSEx instructions
15620 These options enable GCC to use these extended instructions in
15621 generated code, even without @option{-mfpmath=sse}. Applications that
15622 perform run-time CPU detection must compile separate files for each
15623 supported architecture, using the appropriate flags. In particular,
15624 the file containing the CPU detection code should be compiled without
15627 @item -mdump-tune-features
15628 @opindex mdump-tune-features
15629 This option instructs GCC to dump the names of the x86 performance
15630 tuning features and default settings. The names can be used in
15631 @option{-mtune-ctrl=@var{feature-list}}.
15633 @item -mtune-ctrl=@var{feature-list}
15634 @opindex mtune-ctrl=@var{feature-list}
15635 This option is used to do fine grain control of x86 code generation features.
15636 @var{feature-list} is a comma separated list of @var{feature} names. See also
15637 @option{-mdump-tune-features}. When specified, the @var{feature} will be turned
15638 on if it is not preceded with @code{^}, otherwise, it will be turned off.
15639 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
15640 developers. Using it may lead to code paths not covered by testing and can
15641 potentially result in compiler ICEs or runtime errors.
15644 @opindex mno-default
15645 This option instructs GCC to turn off all tunable features. See also
15646 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
15650 This option instructs GCC to emit a @code{cld} instruction in the prologue
15651 of functions that use string instructions. String instructions depend on
15652 the DF flag to select between autoincrement or autodecrement mode. While the
15653 ABI specifies the DF flag to be cleared on function entry, some operating
15654 systems violate this specification by not clearing the DF flag in their
15655 exception dispatchers. The exception handler can be invoked with the DF flag
15656 set, which leads to wrong direction mode when string instructions are used.
15657 This option can be enabled by default on 32-bit x86 targets by configuring
15658 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
15659 instructions can be suppressed with the @option{-mno-cld} compiler option
15663 @opindex mvzeroupper
15664 This option instructs GCC to emit a @code{vzeroupper} instruction
15665 before a transfer of control flow out of the function to minimize
15666 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
15669 @item -mprefer-avx128
15670 @opindex mprefer-avx128
15671 This option instructs GCC to use 128-bit AVX instructions instead of
15672 256-bit AVX instructions in the auto-vectorizer.
15676 This option enables GCC to generate @code{CMPXCHG16B} instructions.
15677 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
15678 (or oword) data types.
15679 This is useful for high-resolution counters that can be updated
15680 by multiple processors (or cores). This instruction is generated as part of
15681 atomic built-in functions: see @ref{__sync Builtins} or
15682 @ref{__atomic Builtins} for details.
15686 This option enables generation of @code{SAHF} instructions in 64-bit code.
15687 Early Intel Pentium 4 CPUs with Intel 64 support,
15688 prior to the introduction of Pentium 4 G1 step in December 2005,
15689 lacked the @code{LAHF} and @code{SAHF} instructions
15690 which were supported by AMD64.
15691 These are load and store instructions, respectively, for certain status flags.
15692 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
15693 @code{drem}, and @code{remainder} built-in functions;
15694 see @ref{Other Builtins} for details.
15698 This option enables use of the @code{movbe} instruction to implement
15699 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
15703 This option enables built-in functions @code{__builtin_ia32_crc32qi},
15704 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
15705 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
15709 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
15710 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
15711 with an additional Newton-Raphson step
15712 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
15713 (and their vectorized
15714 variants) for single-precision floating-point arguments. These instructions
15715 are generated only when @option{-funsafe-math-optimizations} is enabled
15716 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
15717 Note that while the throughput of the sequence is higher than the throughput
15718 of the non-reciprocal instruction, the precision of the sequence can be
15719 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
15721 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
15722 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
15723 combination), and doesn't need @option{-mrecip}.
15725 Also note that GCC emits the above sequence with additional Newton-Raphson step
15726 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
15727 already with @option{-ffast-math} (or the above option combination), and
15728 doesn't need @option{-mrecip}.
15730 @item -mrecip=@var{opt}
15731 @opindex mrecip=opt
15732 This option controls which reciprocal estimate instructions
15733 may be used. @var{opt} is a comma-separated list of options, which may
15734 be preceded by a @samp{!} to invert the option:
15738 Enable all estimate instructions.
15741 Enable the default instructions, equivalent to @option{-mrecip}.
15744 Disable all estimate instructions, equivalent to @option{-mno-recip}.
15747 Enable the approximation for scalar division.
15750 Enable the approximation for vectorized division.
15753 Enable the approximation for scalar square root.
15756 Enable the approximation for vectorized square root.
15759 So, for example, @option{-mrecip=all,!sqrt} enables
15760 all of the reciprocal approximations, except for square root.
15762 @item -mveclibabi=@var{type}
15763 @opindex mveclibabi
15764 Specifies the ABI type to use for vectorizing intrinsics using an
15765 external library. Supported values for @var{type} are @samp{svml}
15766 for the Intel short
15767 vector math library and @samp{acml} for the AMD math core library.
15768 To use this option, both @option{-ftree-vectorize} and
15769 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
15770 ABI-compatible library must be specified at link time.
15772 GCC currently emits calls to @code{vmldExp2},
15773 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
15774 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
15775 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
15776 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
15777 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
15778 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
15779 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
15780 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
15781 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
15782 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
15783 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
15784 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
15785 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
15786 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
15787 when @option{-mveclibabi=acml} is used.
15789 @item -mabi=@var{name}
15791 Generate code for the specified calling convention. Permissible values
15792 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
15793 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
15794 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
15795 You can control this behavior for a specific function by
15796 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
15797 @xref{Function Attributes}.
15799 @item -mtls-dialect=@var{type}
15800 @opindex mtls-dialect
15801 Generate code to access thread-local storage using the @samp{gnu} or
15802 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
15803 @samp{gnu2} is more efficient, but it may add compile- and run-time
15804 requirements that cannot be satisfied on all systems.
15807 @itemx -mno-push-args
15808 @opindex mpush-args
15809 @opindex mno-push-args
15810 Use PUSH operations to store outgoing parameters. This method is shorter
15811 and usually equally fast as method using SUB/MOV operations and is enabled
15812 by default. In some cases disabling it may improve performance because of
15813 improved scheduling and reduced dependencies.
15815 @item -maccumulate-outgoing-args
15816 @opindex maccumulate-outgoing-args
15817 If enabled, the maximum amount of space required for outgoing arguments is
15818 computed in the function prologue. This is faster on most modern CPUs
15819 because of reduced dependencies, improved scheduling and reduced stack usage
15820 when the preferred stack boundary is not equal to 2. The drawback is a notable
15821 increase in code size. This switch implies @option{-mno-push-args}.
15825 Support thread-safe exception handling on MinGW. Programs that rely
15826 on thread-safe exception handling must compile and link all code with the
15827 @option{-mthreads} option. When compiling, @option{-mthreads} defines
15828 @code{-D_MT}; when linking, it links in a special thread helper library
15829 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
15831 @item -mno-align-stringops
15832 @opindex mno-align-stringops
15833 Do not align the destination of inlined string operations. This switch reduces
15834 code size and improves performance in case the destination is already aligned,
15835 but GCC doesn't know about it.
15837 @item -minline-all-stringops
15838 @opindex minline-all-stringops
15839 By default GCC inlines string operations only when the destination is
15840 known to be aligned to least a 4-byte boundary.
15841 This enables more inlining and increases code
15842 size, but may improve performance of code that depends on fast
15843 @code{memcpy}, @code{strlen},
15844 and @code{memset} for short lengths.
15846 @item -minline-stringops-dynamically
15847 @opindex minline-stringops-dynamically
15848 For string operations of unknown size, use run-time checks with
15849 inline code for small blocks and a library call for large blocks.
15851 @item -mstringop-strategy=@var{alg}
15852 @opindex mstringop-strategy=@var{alg}
15853 Override the internal decision heuristic for the particular algorithm to use
15854 for inlining string operations. The allowed values for @var{alg} are:
15860 Expand using i386 @code{rep} prefix of the specified size.
15864 @itemx unrolled_loop
15865 Expand into an inline loop.
15868 Always use a library call.
15871 @item -mmemcpy-strategy=@var{strategy}
15872 @opindex mmemcpy-strategy=@var{strategy}
15873 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
15874 should be inlined and what inline algorithm to use when the expected size
15875 of the copy operation is known. @var{strategy}
15876 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
15877 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
15878 the max byte size with which inline algorithm @var{alg} is allowed. For the last
15879 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
15880 in the list must be specified in increasing order. The minimal byte size for
15881 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
15884 @item -mmemset-strategy=@var{strategy}
15885 @opindex mmemset-strategy=@var{strategy}
15886 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
15887 @code{__builtin_memset} expansion.
15889 @item -momit-leaf-frame-pointer
15890 @opindex momit-leaf-frame-pointer
15891 Don't keep the frame pointer in a register for leaf functions. This
15892 avoids the instructions to save, set up, and restore frame pointers and
15893 makes an extra register available in leaf functions. The option
15894 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
15895 which might make debugging harder.
15897 @item -mtls-direct-seg-refs
15898 @itemx -mno-tls-direct-seg-refs
15899 @opindex mtls-direct-seg-refs
15900 Controls whether TLS variables may be accessed with offsets from the
15901 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
15902 or whether the thread base pointer must be added. Whether or not this
15903 is valid depends on the operating system, and whether it maps the
15904 segment to cover the entire TLS area.
15906 For systems that use the GNU C Library, the default is on.
15909 @itemx -mno-sse2avx
15911 Specify that the assembler should encode SSE instructions with VEX
15912 prefix. The option @option{-mavx} turns this on by default.
15917 If profiling is active (@option{-pg}), put the profiling
15918 counter call before the prologue.
15919 Note: On x86 architectures the attribute @code{ms_hook_prologue}
15920 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
15923 @itemx -mno-8bit-idiv
15925 On some processors, like Intel Atom, 8-bit unsigned integer divide is
15926 much faster than 32-bit/64-bit integer divide. This option generates a
15927 run-time check. If both dividend and divisor are within range of 0
15928 to 255, 8-bit unsigned integer divide is used instead of
15929 32-bit/64-bit integer divide.
15931 @item -mavx256-split-unaligned-load
15932 @itemx -mavx256-split-unaligned-store
15933 @opindex avx256-split-unaligned-load
15934 @opindex avx256-split-unaligned-store
15935 Split 32-byte AVX unaligned load and store.
15937 @item -mstack-protector-guard=@var{guard}
15938 @opindex mstack-protector-guard=@var{guard}
15939 Generate stack protection code using canary at @var{guard}. Supported
15940 locations are @samp{global} for global canary or @samp{tls} for per-thread
15941 canary in the TLS block (the default). This option has effect only when
15942 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
15946 These @samp{-m} switches are supported in addition to the above
15947 on x86-64 processors in 64-bit environments.
15958 Generate code for a 16-bit, 32-bit or 64-bit environment.
15959 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
15961 generates code that runs on any i386 system.
15963 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
15964 types to 64 bits, and generates code for the x86-64 architecture.
15965 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
15966 and @option{-mdynamic-no-pic} options.
15968 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
15970 generates code for the x86-64 architecture.
15972 The @option{-m16} option is the same as @option{-m32}, except for that
15973 it outputs the @code{.code16gcc} assembly directive at the beginning of
15974 the assembly output so that the binary can run in 16-bit mode.
15976 @item -mno-red-zone
15977 @opindex mno-red-zone
15978 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
15979 by the x86-64 ABI; it is a 128-byte area beyond the location of the
15980 stack pointer that is not modified by signal or interrupt handlers
15981 and therefore can be used for temporary data without adjusting the stack
15982 pointer. The flag @option{-mno-red-zone} disables this red zone.
15984 @item -mcmodel=small
15985 @opindex mcmodel=small
15986 Generate code for the small code model: the program and its symbols must
15987 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
15988 Programs can be statically or dynamically linked. This is the default
15991 @item -mcmodel=kernel
15992 @opindex mcmodel=kernel
15993 Generate code for the kernel code model. The kernel runs in the
15994 negative 2 GB of the address space.
15995 This model has to be used for Linux kernel code.
15997 @item -mcmodel=medium
15998 @opindex mcmodel=medium
15999 Generate code for the medium model: the program is linked in the lower 2
16000 GB of the address space. Small symbols are also placed there. Symbols
16001 with sizes larger than @option{-mlarge-data-threshold} are put into
16002 large data or BSS sections and can be located above 2GB. Programs can
16003 be statically or dynamically linked.
16005 @item -mcmodel=large
16006 @opindex mcmodel=large
16007 Generate code for the large model. This model makes no assumptions
16008 about addresses and sizes of sections.
16010 @item -maddress-mode=long
16011 @opindex maddress-mode=long
16012 Generate code for long address mode. This is only supported for 64-bit
16013 and x32 environments. It is the default address mode for 64-bit
16016 @item -maddress-mode=short
16017 @opindex maddress-mode=short
16018 Generate code for short address mode. This is only supported for 32-bit
16019 and x32 environments. It is the default address mode for 32-bit and
16023 @node i386 and x86-64 Windows Options
16024 @subsection i386 and x86-64 Windows Options
16025 @cindex i386 and x86-64 Windows Options
16027 These additional options are available for Microsoft Windows targets:
16033 specifies that a console application is to be generated, by
16034 instructing the linker to set the PE header subsystem type
16035 required for console applications.
16036 This option is available for Cygwin and MinGW targets and is
16037 enabled by default on those targets.
16041 This option is available for Cygwin and MinGW targets. It
16042 specifies that a DLL---a dynamic link library---is to be
16043 generated, enabling the selection of the required runtime
16044 startup object and entry point.
16046 @item -mnop-fun-dllimport
16047 @opindex mnop-fun-dllimport
16048 This option is available for Cygwin and MinGW targets. It
16049 specifies that the @code{dllimport} attribute should be ignored.
16053 This option is available for MinGW targets. It specifies
16054 that MinGW-specific thread support is to be used.
16058 This option is available for MinGW-w64 targets. It causes
16059 the @code{UNICODE} preprocessor macro to be predefined, and
16060 chooses Unicode-capable runtime startup code.
16064 This option is available for Cygwin and MinGW targets. It
16065 specifies that the typical Microsoft Windows predefined macros are to
16066 be set in the pre-processor, but does not influence the choice
16067 of runtime library/startup code.
16071 This option is available for Cygwin and MinGW targets. It
16072 specifies that a GUI application is to be generated by
16073 instructing the linker to set the PE header subsystem type
16076 @item -fno-set-stack-executable
16077 @opindex fno-set-stack-executable
16078 This option is available for MinGW targets. It specifies that
16079 the executable flag for the stack used by nested functions isn't
16080 set. This is necessary for binaries running in kernel mode of
16081 Microsoft Windows, as there the User32 API, which is used to set executable
16082 privileges, isn't available.
16084 @item -fwritable-relocated-rdata
16085 @opindex fno-writable-relocated-rdata
16086 This option is available for MinGW and Cygwin targets. It specifies
16087 that relocated-data in read-only section is put into .data
16088 section. This is a necessary for older runtimes not supporting
16089 modification of .rdata sections for pseudo-relocation.
16091 @item -mpe-aligned-commons
16092 @opindex mpe-aligned-commons
16093 This option is available for Cygwin and MinGW targets. It
16094 specifies that the GNU extension to the PE file format that
16095 permits the correct alignment of COMMON variables should be
16096 used when generating code. It is enabled by default if
16097 GCC detects that the target assembler found during configuration
16098 supports the feature.
16101 See also under @ref{i386 and x86-64 Options} for standard options.
16103 @node IA-64 Options
16104 @subsection IA-64 Options
16105 @cindex IA-64 Options
16107 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16111 @opindex mbig-endian
16112 Generate code for a big-endian target. This is the default for HP-UX@.
16114 @item -mlittle-endian
16115 @opindex mlittle-endian
16116 Generate code for a little-endian target. This is the default for AIX5
16122 @opindex mno-gnu-as
16123 Generate (or don't) code for the GNU assembler. This is the default.
16124 @c Also, this is the default if the configure option @option{--with-gnu-as}
16130 @opindex mno-gnu-ld
16131 Generate (or don't) code for the GNU linker. This is the default.
16132 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16137 Generate code that does not use a global pointer register. The result
16138 is not position independent code, and violates the IA-64 ABI@.
16140 @item -mvolatile-asm-stop
16141 @itemx -mno-volatile-asm-stop
16142 @opindex mvolatile-asm-stop
16143 @opindex mno-volatile-asm-stop
16144 Generate (or don't) a stop bit immediately before and after volatile asm
16147 @item -mregister-names
16148 @itemx -mno-register-names
16149 @opindex mregister-names
16150 @opindex mno-register-names
16151 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16152 the stacked registers. This may make assembler output more readable.
16158 Disable (or enable) optimizations that use the small data section. This may
16159 be useful for working around optimizer bugs.
16161 @item -mconstant-gp
16162 @opindex mconstant-gp
16163 Generate code that uses a single constant global pointer value. This is
16164 useful when compiling kernel code.
16168 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16169 This is useful when compiling firmware code.
16171 @item -minline-float-divide-min-latency
16172 @opindex minline-float-divide-min-latency
16173 Generate code for inline divides of floating-point values
16174 using the minimum latency algorithm.
16176 @item -minline-float-divide-max-throughput
16177 @opindex minline-float-divide-max-throughput
16178 Generate code for inline divides of floating-point values
16179 using the maximum throughput algorithm.
16181 @item -mno-inline-float-divide
16182 @opindex mno-inline-float-divide
16183 Do not generate inline code for divides of floating-point values.
16185 @item -minline-int-divide-min-latency
16186 @opindex minline-int-divide-min-latency
16187 Generate code for inline divides of integer values
16188 using the minimum latency algorithm.
16190 @item -minline-int-divide-max-throughput
16191 @opindex minline-int-divide-max-throughput
16192 Generate code for inline divides of integer values
16193 using the maximum throughput algorithm.
16195 @item -mno-inline-int-divide
16196 @opindex mno-inline-int-divide
16197 Do not generate inline code for divides of integer values.
16199 @item -minline-sqrt-min-latency
16200 @opindex minline-sqrt-min-latency
16201 Generate code for inline square roots
16202 using the minimum latency algorithm.
16204 @item -minline-sqrt-max-throughput
16205 @opindex minline-sqrt-max-throughput
16206 Generate code for inline square roots
16207 using the maximum throughput algorithm.
16209 @item -mno-inline-sqrt
16210 @opindex mno-inline-sqrt
16211 Do not generate inline code for @code{sqrt}.
16214 @itemx -mno-fused-madd
16215 @opindex mfused-madd
16216 @opindex mno-fused-madd
16217 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16218 instructions. The default is to use these instructions.
16220 @item -mno-dwarf2-asm
16221 @itemx -mdwarf2-asm
16222 @opindex mno-dwarf2-asm
16223 @opindex mdwarf2-asm
16224 Don't (or do) generate assembler code for the DWARF 2 line number debugging
16225 info. This may be useful when not using the GNU assembler.
16227 @item -mearly-stop-bits
16228 @itemx -mno-early-stop-bits
16229 @opindex mearly-stop-bits
16230 @opindex mno-early-stop-bits
16231 Allow stop bits to be placed earlier than immediately preceding the
16232 instruction that triggered the stop bit. This can improve instruction
16233 scheduling, but does not always do so.
16235 @item -mfixed-range=@var{register-range}
16236 @opindex mfixed-range
16237 Generate code treating the given register range as fixed registers.
16238 A fixed register is one that the register allocator cannot use. This is
16239 useful when compiling kernel code. A register range is specified as
16240 two registers separated by a dash. Multiple register ranges can be
16241 specified separated by a comma.
16243 @item -mtls-size=@var{tls-size}
16245 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16248 @item -mtune=@var{cpu-type}
16250 Tune the instruction scheduling for a particular CPU, Valid values are
16251 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16252 and @samp{mckinley}.
16258 Generate code for a 32-bit or 64-bit environment.
16259 The 32-bit environment sets int, long and pointer to 32 bits.
16260 The 64-bit environment sets int to 32 bits and long and pointer
16261 to 64 bits. These are HP-UX specific flags.
16263 @item -mno-sched-br-data-spec
16264 @itemx -msched-br-data-spec
16265 @opindex mno-sched-br-data-spec
16266 @opindex msched-br-data-spec
16267 (Dis/En)able data speculative scheduling before reload.
16268 This results in generation of @code{ld.a} instructions and
16269 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16270 The default is 'disable'.
16272 @item -msched-ar-data-spec
16273 @itemx -mno-sched-ar-data-spec
16274 @opindex msched-ar-data-spec
16275 @opindex mno-sched-ar-data-spec
16276 (En/Dis)able data speculative scheduling after reload.
16277 This results in generation of @code{ld.a} instructions and
16278 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16279 The default is 'enable'.
16281 @item -mno-sched-control-spec
16282 @itemx -msched-control-spec
16283 @opindex mno-sched-control-spec
16284 @opindex msched-control-spec
16285 (Dis/En)able control speculative scheduling. This feature is
16286 available only during region scheduling (i.e.@: before reload).
16287 This results in generation of the @code{ld.s} instructions and
16288 the corresponding check instructions @code{chk.s}.
16289 The default is 'disable'.
16291 @item -msched-br-in-data-spec
16292 @itemx -mno-sched-br-in-data-spec
16293 @opindex msched-br-in-data-spec
16294 @opindex mno-sched-br-in-data-spec
16295 (En/Dis)able speculative scheduling of the instructions that
16296 are dependent on the data speculative loads before reload.
16297 This is effective only with @option{-msched-br-data-spec} enabled.
16298 The default is 'enable'.
16300 @item -msched-ar-in-data-spec
16301 @itemx -mno-sched-ar-in-data-spec
16302 @opindex msched-ar-in-data-spec
16303 @opindex mno-sched-ar-in-data-spec
16304 (En/Dis)able speculative scheduling of the instructions that
16305 are dependent on the data speculative loads after reload.
16306 This is effective only with @option{-msched-ar-data-spec} enabled.
16307 The default is 'enable'.
16309 @item -msched-in-control-spec
16310 @itemx -mno-sched-in-control-spec
16311 @opindex msched-in-control-spec
16312 @opindex mno-sched-in-control-spec
16313 (En/Dis)able speculative scheduling of the instructions that
16314 are dependent on the control speculative loads.
16315 This is effective only with @option{-msched-control-spec} enabled.
16316 The default is 'enable'.
16318 @item -mno-sched-prefer-non-data-spec-insns
16319 @itemx -msched-prefer-non-data-spec-insns
16320 @opindex mno-sched-prefer-non-data-spec-insns
16321 @opindex msched-prefer-non-data-spec-insns
16322 If enabled, data-speculative instructions are chosen for schedule
16323 only if there are no other choices at the moment. This makes
16324 the use of the data speculation much more conservative.
16325 The default is 'disable'.
16327 @item -mno-sched-prefer-non-control-spec-insns
16328 @itemx -msched-prefer-non-control-spec-insns
16329 @opindex mno-sched-prefer-non-control-spec-insns
16330 @opindex msched-prefer-non-control-spec-insns
16331 If enabled, control-speculative instructions are chosen for schedule
16332 only if there are no other choices at the moment. This makes
16333 the use of the control speculation much more conservative.
16334 The default is 'disable'.
16336 @item -mno-sched-count-spec-in-critical-path
16337 @itemx -msched-count-spec-in-critical-path
16338 @opindex mno-sched-count-spec-in-critical-path
16339 @opindex msched-count-spec-in-critical-path
16340 If enabled, speculative dependencies are considered during
16341 computation of the instructions priorities. This makes the use of the
16342 speculation a bit more conservative.
16343 The default is 'disable'.
16345 @item -msched-spec-ldc
16346 @opindex msched-spec-ldc
16347 Use a simple data speculation check. This option is on by default.
16349 @item -msched-control-spec-ldc
16350 @opindex msched-spec-ldc
16351 Use a simple check for control speculation. This option is on by default.
16353 @item -msched-stop-bits-after-every-cycle
16354 @opindex msched-stop-bits-after-every-cycle
16355 Place a stop bit after every cycle when scheduling. This option is on
16358 @item -msched-fp-mem-deps-zero-cost
16359 @opindex msched-fp-mem-deps-zero-cost
16360 Assume that floating-point stores and loads are not likely to cause a conflict
16361 when placed into the same instruction group. This option is disabled by
16364 @item -msel-sched-dont-check-control-spec
16365 @opindex msel-sched-dont-check-control-spec
16366 Generate checks for control speculation in selective scheduling.
16367 This flag is disabled by default.
16369 @item -msched-max-memory-insns=@var{max-insns}
16370 @opindex msched-max-memory-insns
16371 Limit on the number of memory insns per instruction group, giving lower
16372 priority to subsequent memory insns attempting to schedule in the same
16373 instruction group. Frequently useful to prevent cache bank conflicts.
16374 The default value is 1.
16376 @item -msched-max-memory-insns-hard-limit
16377 @opindex msched-max-memory-insns-hard-limit
16378 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
16379 disallowing more than that number in an instruction group.
16380 Otherwise, the limit is ``soft'', meaning that non-memory operations
16381 are preferred when the limit is reached, but memory operations may still
16387 @subsection LM32 Options
16388 @cindex LM32 options
16390 These @option{-m} options are defined for the LatticeMico32 architecture:
16393 @item -mbarrel-shift-enabled
16394 @opindex mbarrel-shift-enabled
16395 Enable barrel-shift instructions.
16397 @item -mdivide-enabled
16398 @opindex mdivide-enabled
16399 Enable divide and modulus instructions.
16401 @item -mmultiply-enabled
16402 @opindex multiply-enabled
16403 Enable multiply instructions.
16405 @item -msign-extend-enabled
16406 @opindex msign-extend-enabled
16407 Enable sign extend instructions.
16409 @item -muser-enabled
16410 @opindex muser-enabled
16411 Enable user-defined instructions.
16416 @subsection M32C Options
16417 @cindex M32C options
16420 @item -mcpu=@var{name}
16422 Select the CPU for which code is generated. @var{name} may be one of
16423 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
16424 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
16425 the M32C/80 series.
16429 Specifies that the program will be run on the simulator. This causes
16430 an alternate runtime library to be linked in which supports, for
16431 example, file I/O@. You must not use this option when generating
16432 programs that will run on real hardware; you must provide your own
16433 runtime library for whatever I/O functions are needed.
16435 @item -memregs=@var{number}
16437 Specifies the number of memory-based pseudo-registers GCC uses
16438 during code generation. These pseudo-registers are used like real
16439 registers, so there is a tradeoff between GCC's ability to fit the
16440 code into available registers, and the performance penalty of using
16441 memory instead of registers. Note that all modules in a program must
16442 be compiled with the same value for this option. Because of that, you
16443 must not use this option with GCC's default runtime libraries.
16447 @node M32R/D Options
16448 @subsection M32R/D Options
16449 @cindex M32R/D options
16451 These @option{-m} options are defined for Renesas M32R/D architectures:
16456 Generate code for the M32R/2@.
16460 Generate code for the M32R/X@.
16464 Generate code for the M32R@. This is the default.
16466 @item -mmodel=small
16467 @opindex mmodel=small
16468 Assume all objects live in the lower 16MB of memory (so that their addresses
16469 can be loaded with the @code{ld24} instruction), and assume all subroutines
16470 are reachable with the @code{bl} instruction.
16471 This is the default.
16473 The addressability of a particular object can be set with the
16474 @code{model} attribute.
16476 @item -mmodel=medium
16477 @opindex mmodel=medium
16478 Assume objects may be anywhere in the 32-bit address space (the compiler
16479 generates @code{seth/add3} instructions to load their addresses), and
16480 assume all subroutines are reachable with the @code{bl} instruction.
16482 @item -mmodel=large
16483 @opindex mmodel=large
16484 Assume objects may be anywhere in the 32-bit address space (the compiler
16485 generates @code{seth/add3} instructions to load their addresses), and
16486 assume subroutines may not be reachable with the @code{bl} instruction
16487 (the compiler generates the much slower @code{seth/add3/jl}
16488 instruction sequence).
16491 @opindex msdata=none
16492 Disable use of the small data area. Variables are put into
16493 one of @samp{.data}, @samp{.bss}, or @samp{.rodata} (unless the
16494 @code{section} attribute has been specified).
16495 This is the default.
16497 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
16498 Objects may be explicitly put in the small data area with the
16499 @code{section} attribute using one of these sections.
16501 @item -msdata=sdata
16502 @opindex msdata=sdata
16503 Put small global and static data in the small data area, but do not
16504 generate special code to reference them.
16507 @opindex msdata=use
16508 Put small global and static data in the small data area, and generate
16509 special instructions to reference them.
16513 @cindex smaller data references
16514 Put global and static objects less than or equal to @var{num} bytes
16515 into the small data or BSS sections instead of the normal data or BSS
16516 sections. The default value of @var{num} is 8.
16517 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
16518 for this option to have any effect.
16520 All modules should be compiled with the same @option{-G @var{num}} value.
16521 Compiling with different values of @var{num} may or may not work; if it
16522 doesn't the linker gives an error message---incorrect code is not
16527 Makes the M32R-specific code in the compiler display some statistics
16528 that might help in debugging programs.
16530 @item -malign-loops
16531 @opindex malign-loops
16532 Align all loops to a 32-byte boundary.
16534 @item -mno-align-loops
16535 @opindex mno-align-loops
16536 Do not enforce a 32-byte alignment for loops. This is the default.
16538 @item -missue-rate=@var{number}
16539 @opindex missue-rate=@var{number}
16540 Issue @var{number} instructions per cycle. @var{number} can only be 1
16543 @item -mbranch-cost=@var{number}
16544 @opindex mbranch-cost=@var{number}
16545 @var{number} can only be 1 or 2. If it is 1 then branches are
16546 preferred over conditional code, if it is 2, then the opposite applies.
16548 @item -mflush-trap=@var{number}
16549 @opindex mflush-trap=@var{number}
16550 Specifies the trap number to use to flush the cache. The default is
16551 12. Valid numbers are between 0 and 15 inclusive.
16553 @item -mno-flush-trap
16554 @opindex mno-flush-trap
16555 Specifies that the cache cannot be flushed by using a trap.
16557 @item -mflush-func=@var{name}
16558 @opindex mflush-func=@var{name}
16559 Specifies the name of the operating system function to call to flush
16560 the cache. The default is @emph{_flush_cache}, but a function call
16561 is only used if a trap is not available.
16563 @item -mno-flush-func
16564 @opindex mno-flush-func
16565 Indicates that there is no OS function for flushing the cache.
16569 @node M680x0 Options
16570 @subsection M680x0 Options
16571 @cindex M680x0 options
16573 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
16574 The default settings depend on which architecture was selected when
16575 the compiler was configured; the defaults for the most common choices
16579 @item -march=@var{arch}
16581 Generate code for a specific M680x0 or ColdFire instruction set
16582 architecture. Permissible values of @var{arch} for M680x0
16583 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
16584 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
16585 architectures are selected according to Freescale's ISA classification
16586 and the permissible values are: @samp{isaa}, @samp{isaaplus},
16587 @samp{isab} and @samp{isac}.
16589 GCC defines a macro @samp{__mcf@var{arch}__} whenever it is generating
16590 code for a ColdFire target. The @var{arch} in this macro is one of the
16591 @option{-march} arguments given above.
16593 When used together, @option{-march} and @option{-mtune} select code
16594 that runs on a family of similar processors but that is optimized
16595 for a particular microarchitecture.
16597 @item -mcpu=@var{cpu}
16599 Generate code for a specific M680x0 or ColdFire processor.
16600 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
16601 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
16602 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
16603 below, which also classifies the CPUs into families:
16605 @multitable @columnfractions 0.20 0.80
16606 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
16607 @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}
16608 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
16609 @item @samp{5206e} @tab @samp{5206e}
16610 @item @samp{5208} @tab @samp{5207} @samp{5208}
16611 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
16612 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
16613 @item @samp{5216} @tab @samp{5214} @samp{5216}
16614 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
16615 @item @samp{5225} @tab @samp{5224} @samp{5225}
16616 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
16617 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
16618 @item @samp{5249} @tab @samp{5249}
16619 @item @samp{5250} @tab @samp{5250}
16620 @item @samp{5271} @tab @samp{5270} @samp{5271}
16621 @item @samp{5272} @tab @samp{5272}
16622 @item @samp{5275} @tab @samp{5274} @samp{5275}
16623 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
16624 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
16625 @item @samp{5307} @tab @samp{5307}
16626 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
16627 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
16628 @item @samp{5407} @tab @samp{5407}
16629 @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}
16632 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
16633 @var{arch} is compatible with @var{cpu}. Other combinations of
16634 @option{-mcpu} and @option{-march} are rejected.
16636 GCC defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
16637 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
16638 where the value of @var{family} is given by the table above.
16640 @item -mtune=@var{tune}
16642 Tune the code for a particular microarchitecture within the
16643 constraints set by @option{-march} and @option{-mcpu}.
16644 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
16645 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
16646 and @samp{cpu32}. The ColdFire microarchitectures
16647 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
16649 You can also use @option{-mtune=68020-40} for code that needs
16650 to run relatively well on 68020, 68030 and 68040 targets.
16651 @option{-mtune=68020-60} is similar but includes 68060 targets
16652 as well. These two options select the same tuning decisions as
16653 @option{-m68020-40} and @option{-m68020-60} respectively.
16655 GCC defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
16656 when tuning for 680x0 architecture @var{arch}. It also defines
16657 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
16658 option is used. If GCC is tuning for a range of architectures,
16659 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
16660 it defines the macros for every architecture in the range.
16662 GCC also defines the macro @samp{__m@var{uarch}__} when tuning for
16663 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
16664 of the arguments given above.
16670 Generate output for a 68000. This is the default
16671 when the compiler is configured for 68000-based systems.
16672 It is equivalent to @option{-march=68000}.
16674 Use this option for microcontrollers with a 68000 or EC000 core,
16675 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
16679 Generate output for a 68010. This is the default
16680 when the compiler is configured for 68010-based systems.
16681 It is equivalent to @option{-march=68010}.
16687 Generate output for a 68020. This is the default
16688 when the compiler is configured for 68020-based systems.
16689 It is equivalent to @option{-march=68020}.
16693 Generate output for a 68030. This is the default when the compiler is
16694 configured for 68030-based systems. It is equivalent to
16695 @option{-march=68030}.
16699 Generate output for a 68040. This is the default when the compiler is
16700 configured for 68040-based systems. It is equivalent to
16701 @option{-march=68040}.
16703 This option inhibits the use of 68881/68882 instructions that have to be
16704 emulated by software on the 68040. Use this option if your 68040 does not
16705 have code to emulate those instructions.
16709 Generate output for a 68060. This is the default when the compiler is
16710 configured for 68060-based systems. It is equivalent to
16711 @option{-march=68060}.
16713 This option inhibits the use of 68020 and 68881/68882 instructions that
16714 have to be emulated by software on the 68060. Use this option if your 68060
16715 does not have code to emulate those instructions.
16719 Generate output for a CPU32. This is the default
16720 when the compiler is configured for CPU32-based systems.
16721 It is equivalent to @option{-march=cpu32}.
16723 Use this option for microcontrollers with a
16724 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
16725 68336, 68340, 68341, 68349 and 68360.
16729 Generate output for a 520X ColdFire CPU@. This is the default
16730 when the compiler is configured for 520X-based systems.
16731 It is equivalent to @option{-mcpu=5206}, and is now deprecated
16732 in favor of that option.
16734 Use this option for microcontroller with a 5200 core, including
16735 the MCF5202, MCF5203, MCF5204 and MCF5206.
16739 Generate output for a 5206e ColdFire CPU@. The option is now
16740 deprecated in favor of the equivalent @option{-mcpu=5206e}.
16744 Generate output for a member of the ColdFire 528X family.
16745 The option is now deprecated in favor of the equivalent
16746 @option{-mcpu=528x}.
16750 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
16751 in favor of the equivalent @option{-mcpu=5307}.
16755 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
16756 in favor of the equivalent @option{-mcpu=5407}.
16760 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
16761 This includes use of hardware floating-point instructions.
16762 The option is equivalent to @option{-mcpu=547x}, and is now
16763 deprecated in favor of that option.
16767 Generate output for a 68040, without using any of the new instructions.
16768 This results in code that can run relatively efficiently on either a
16769 68020/68881 or a 68030 or a 68040. The generated code does use the
16770 68881 instructions that are emulated on the 68040.
16772 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
16776 Generate output for a 68060, without using any of the new instructions.
16777 This results in code that can run relatively efficiently on either a
16778 68020/68881 or a 68030 or a 68040. The generated code does use the
16779 68881 instructions that are emulated on the 68060.
16781 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
16785 @opindex mhard-float
16787 Generate floating-point instructions. This is the default for 68020
16788 and above, and for ColdFire devices that have an FPU@. It defines the
16789 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
16790 on ColdFire targets.
16793 @opindex msoft-float
16794 Do not generate floating-point instructions; use library calls instead.
16795 This is the default for 68000, 68010, and 68832 targets. It is also
16796 the default for ColdFire devices that have no FPU.
16802 Generate (do not generate) ColdFire hardware divide and remainder
16803 instructions. If @option{-march} is used without @option{-mcpu},
16804 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
16805 architectures. Otherwise, the default is taken from the target CPU
16806 (either the default CPU, or the one specified by @option{-mcpu}). For
16807 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
16808 @option{-mcpu=5206e}.
16810 GCC defines the macro @samp{__mcfhwdiv__} when this option is enabled.
16814 Consider type @code{int} to be 16 bits wide, like @code{short int}.
16815 Additionally, parameters passed on the stack are also aligned to a
16816 16-bit boundary even on targets whose API mandates promotion to 32-bit.
16820 Do not consider type @code{int} to be 16 bits wide. This is the default.
16823 @itemx -mno-bitfield
16824 @opindex mnobitfield
16825 @opindex mno-bitfield
16826 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
16827 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
16831 Do use the bit-field instructions. The @option{-m68020} option implies
16832 @option{-mbitfield}. This is the default if you use a configuration
16833 designed for a 68020.
16837 Use a different function-calling convention, in which functions
16838 that take a fixed number of arguments return with the @code{rtd}
16839 instruction, which pops their arguments while returning. This
16840 saves one instruction in the caller since there is no need to pop
16841 the arguments there.
16843 This calling convention is incompatible with the one normally
16844 used on Unix, so you cannot use it if you need to call libraries
16845 compiled with the Unix compiler.
16847 Also, you must provide function prototypes for all functions that
16848 take variable numbers of arguments (including @code{printf});
16849 otherwise incorrect code is generated for calls to those
16852 In addition, seriously incorrect code results if you call a
16853 function with too many arguments. (Normally, extra arguments are
16854 harmlessly ignored.)
16856 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
16857 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
16861 Do not use the calling conventions selected by @option{-mrtd}.
16862 This is the default.
16865 @itemx -mno-align-int
16866 @opindex malign-int
16867 @opindex mno-align-int
16868 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
16869 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
16870 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
16871 Aligning variables on 32-bit boundaries produces code that runs somewhat
16872 faster on processors with 32-bit busses at the expense of more memory.
16874 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
16875 aligns structures containing the above types differently than
16876 most published application binary interface specifications for the m68k.
16880 Use the pc-relative addressing mode of the 68000 directly, instead of
16881 using a global offset table. At present, this option implies @option{-fpic},
16882 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
16883 not presently supported with @option{-mpcrel}, though this could be supported for
16884 68020 and higher processors.
16886 @item -mno-strict-align
16887 @itemx -mstrict-align
16888 @opindex mno-strict-align
16889 @opindex mstrict-align
16890 Do not (do) assume that unaligned memory references are handled by
16894 Generate code that allows the data segment to be located in a different
16895 area of memory from the text segment. This allows for execute-in-place in
16896 an environment without virtual memory management. This option implies
16899 @item -mno-sep-data
16900 Generate code that assumes that the data segment follows the text segment.
16901 This is the default.
16903 @item -mid-shared-library
16904 Generate code that supports shared libraries via the library ID method.
16905 This allows for execute-in-place and shared libraries in an environment
16906 without virtual memory management. This option implies @option{-fPIC}.
16908 @item -mno-id-shared-library
16909 Generate code that doesn't assume ID-based shared libraries are being used.
16910 This is the default.
16912 @item -mshared-library-id=n
16913 Specifies the identification number of the ID-based shared library being
16914 compiled. Specifying a value of 0 generates more compact code; specifying
16915 other values forces the allocation of that number to the current
16916 library, but is no more space- or time-efficient than omitting this option.
16922 When generating position-independent code for ColdFire, generate code
16923 that works if the GOT has more than 8192 entries. This code is
16924 larger and slower than code generated without this option. On M680x0
16925 processors, this option is not needed; @option{-fPIC} suffices.
16927 GCC normally uses a single instruction to load values from the GOT@.
16928 While this is relatively efficient, it only works if the GOT
16929 is smaller than about 64k. Anything larger causes the linker
16930 to report an error such as:
16932 @cindex relocation truncated to fit (ColdFire)
16934 relocation truncated to fit: R_68K_GOT16O foobar
16937 If this happens, you should recompile your code with @option{-mxgot}.
16938 It should then work with very large GOTs. However, code generated with
16939 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
16940 the value of a global symbol.
16942 Note that some linkers, including newer versions of the GNU linker,
16943 can create multiple GOTs and sort GOT entries. If you have such a linker,
16944 you should only need to use @option{-mxgot} when compiling a single
16945 object file that accesses more than 8192 GOT entries. Very few do.
16947 These options have no effect unless GCC is generating
16948 position-independent code.
16952 @node MCore Options
16953 @subsection MCore Options
16954 @cindex MCore options
16956 These are the @samp{-m} options defined for the Motorola M*Core
16962 @itemx -mno-hardlit
16964 @opindex mno-hardlit
16965 Inline constants into the code stream if it can be done in two
16966 instructions or less.
16972 Use the divide instruction. (Enabled by default).
16974 @item -mrelax-immediate
16975 @itemx -mno-relax-immediate
16976 @opindex mrelax-immediate
16977 @opindex mno-relax-immediate
16978 Allow arbitrary-sized immediates in bit operations.
16980 @item -mwide-bitfields
16981 @itemx -mno-wide-bitfields
16982 @opindex mwide-bitfields
16983 @opindex mno-wide-bitfields
16984 Always treat bit-fields as @code{int}-sized.
16986 @item -m4byte-functions
16987 @itemx -mno-4byte-functions
16988 @opindex m4byte-functions
16989 @opindex mno-4byte-functions
16990 Force all functions to be aligned to a 4-byte boundary.
16992 @item -mcallgraph-data
16993 @itemx -mno-callgraph-data
16994 @opindex mcallgraph-data
16995 @opindex mno-callgraph-data
16996 Emit callgraph information.
16999 @itemx -mno-slow-bytes
17000 @opindex mslow-bytes
17001 @opindex mno-slow-bytes
17002 Prefer word access when reading byte quantities.
17004 @item -mlittle-endian
17005 @itemx -mbig-endian
17006 @opindex mlittle-endian
17007 @opindex mbig-endian
17008 Generate code for a little-endian target.
17014 Generate code for the 210 processor.
17018 Assume that runtime support has been provided and so omit the
17019 simulator library (@file{libsim.a)} from the linker command line.
17021 @item -mstack-increment=@var{size}
17022 @opindex mstack-increment
17023 Set the maximum amount for a single stack increment operation. Large
17024 values can increase the speed of programs that contain functions
17025 that need a large amount of stack space, but they can also trigger a
17026 segmentation fault if the stack is extended too much. The default
17032 @subsection MeP Options
17033 @cindex MeP options
17039 Enables the @code{abs} instruction, which is the absolute difference
17040 between two registers.
17044 Enables all the optional instructions---average, multiply, divide, bit
17045 operations, leading zero, absolute difference, min/max, clip, and
17051 Enables the @code{ave} instruction, which computes the average of two
17054 @item -mbased=@var{n}
17056 Variables of size @var{n} bytes or smaller are placed in the
17057 @code{.based} section by default. Based variables use the @code{$tp}
17058 register as a base register, and there is a 128-byte limit to the
17059 @code{.based} section.
17063 Enables the bit operation instructions---bit test (@code{btstm}), set
17064 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17065 test-and-set (@code{tas}).
17067 @item -mc=@var{name}
17069 Selects which section constant data is placed in. @var{name} may
17070 be @code{tiny}, @code{near}, or @code{far}.
17074 Enables the @code{clip} instruction. Note that @code{-mclip} is not
17075 useful unless you also provide @code{-mminmax}.
17077 @item -mconfig=@var{name}
17079 Selects one of the built-in core configurations. Each MeP chip has
17080 one or more modules in it; each module has a core CPU and a variety of
17081 coprocessors, optional instructions, and peripherals. The
17082 @code{MeP-Integrator} tool, not part of GCC, provides these
17083 configurations through this option; using this option is the same as
17084 using all the corresponding command-line options. The default
17085 configuration is @code{default}.
17089 Enables the coprocessor instructions. By default, this is a 32-bit
17090 coprocessor. Note that the coprocessor is normally enabled via the
17091 @code{-mconfig=} option.
17095 Enables the 32-bit coprocessor's instructions.
17099 Enables the 64-bit coprocessor's instructions.
17103 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17107 Causes constant variables to be placed in the @code{.near} section.
17111 Enables the @code{div} and @code{divu} instructions.
17115 Generate big-endian code.
17119 Generate little-endian code.
17121 @item -mio-volatile
17122 @opindex mio-volatile
17123 Tells the compiler that any variable marked with the @code{io}
17124 attribute is to be considered volatile.
17128 Causes variables to be assigned to the @code{.far} section by default.
17132 Enables the @code{leadz} (leading zero) instruction.
17136 Causes variables to be assigned to the @code{.near} section by default.
17140 Enables the @code{min} and @code{max} instructions.
17144 Enables the multiplication and multiply-accumulate instructions.
17148 Disables all the optional instructions enabled by @code{-mall-opts}.
17152 Enables the @code{repeat} and @code{erepeat} instructions, used for
17153 low-overhead looping.
17157 Causes all variables to default to the @code{.tiny} section. Note
17158 that there is a 65536-byte limit to this section. Accesses to these
17159 variables use the @code{%gp} base register.
17163 Enables the saturation instructions. Note that the compiler does not
17164 currently generate these itself, but this option is included for
17165 compatibility with other tools, like @code{as}.
17169 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17173 Link the simulator run-time libraries.
17177 Link the simulator runtime libraries, excluding built-in support
17178 for reset and exception vectors and tables.
17182 Causes all functions to default to the @code{.far} section. Without
17183 this option, functions default to the @code{.near} section.
17185 @item -mtiny=@var{n}
17187 Variables that are @var{n} bytes or smaller are allocated to the
17188 @code{.tiny} section. These variables use the @code{$gp} base
17189 register. The default for this option is 4, but note that there's a
17190 65536-byte limit to the @code{.tiny} section.
17194 @node MicroBlaze Options
17195 @subsection MicroBlaze Options
17196 @cindex MicroBlaze Options
17201 @opindex msoft-float
17202 Use software emulation for floating point (default).
17205 @opindex mhard-float
17206 Use hardware floating-point instructions.
17210 Do not optimize block moves, use @code{memcpy}.
17212 @item -mno-clearbss
17213 @opindex mno-clearbss
17214 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17216 @item -mcpu=@var{cpu-type}
17218 Use features of, and schedule code for, the given CPU.
17219 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17220 where @var{X} is a major version, @var{YY} is the minor version, and
17221 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17222 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17224 @item -mxl-soft-mul
17225 @opindex mxl-soft-mul
17226 Use software multiply emulation (default).
17228 @item -mxl-soft-div
17229 @opindex mxl-soft-div
17230 Use software emulation for divides (default).
17232 @item -mxl-barrel-shift
17233 @opindex mxl-barrel-shift
17234 Use the hardware barrel shifter.
17236 @item -mxl-pattern-compare
17237 @opindex mxl-pattern-compare
17238 Use pattern compare instructions.
17240 @item -msmall-divides
17241 @opindex msmall-divides
17242 Use table lookup optimization for small signed integer divisions.
17244 @item -mxl-stack-check
17245 @opindex mxl-stack-check
17246 This option is deprecated. Use @option{-fstack-check} instead.
17249 @opindex mxl-gp-opt
17250 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17252 @item -mxl-multiply-high
17253 @opindex mxl-multiply-high
17254 Use multiply high instructions for high part of 32x32 multiply.
17256 @item -mxl-float-convert
17257 @opindex mxl-float-convert
17258 Use hardware floating-point conversion instructions.
17260 @item -mxl-float-sqrt
17261 @opindex mxl-float-sqrt
17262 Use hardware floating-point square root instruction.
17265 @opindex mbig-endian
17266 Generate code for a big-endian target.
17268 @item -mlittle-endian
17269 @opindex mlittle-endian
17270 Generate code for a little-endian target.
17273 @opindex mxl-reorder
17274 Use reorder instructions (swap and byte reversed load/store).
17276 @item -mxl-mode-@var{app-model}
17277 Select application model @var{app-model}. Valid models are
17280 normal executable (default), uses startup code @file{crt0.o}.
17283 for use with Xilinx Microprocessor Debugger (XMD) based
17284 software intrusive debug agent called xmdstub. This uses startup file
17285 @file{crt1.o} and sets the start address of the program to 0x800.
17288 for applications that are loaded using a bootloader.
17289 This model uses startup file @file{crt2.o} which does not contain a processor
17290 reset vector handler. This is suitable for transferring control on a
17291 processor reset to the bootloader rather than the application.
17294 for applications that do not require any of the
17295 MicroBlaze vectors. This option may be useful for applications running
17296 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17299 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17300 @option{-mxl-mode-@var{app-model}}.
17305 @subsection MIPS Options
17306 @cindex MIPS options
17312 Generate big-endian code.
17316 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17319 @item -march=@var{arch}
17321 Generate code that runs on @var{arch}, which can be the name of a
17322 generic MIPS ISA, or the name of a particular processor.
17324 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17325 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17326 @samp{mips64}, @samp{mips64r2}, @samp{mips64r3} and @samp{mips64r5}.
17327 The processor names are:
17328 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17329 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17330 @samp{5kc}, @samp{5kf},
17332 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17333 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17334 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17335 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17336 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17337 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17339 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17340 @samp{octeon}, @samp{octeon+}, @samp{octeon2},
17343 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17344 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17345 @samp{rm7000}, @samp{rm9000},
17346 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17349 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17350 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17351 @samp{xlr} and @samp{xlp}.
17352 The special value @samp{from-abi} selects the
17353 most compatible architecture for the selected ABI (that is,
17354 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17356 The native Linux/GNU toolchain also supports the value @samp{native},
17357 which selects the best architecture option for the host processor.
17358 @option{-march=native} has no effect if GCC does not recognize
17361 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17362 (for example, @option{-march=r2k}). Prefixes are optional, and
17363 @samp{vr} may be written @samp{r}.
17365 Names of the form @samp{@var{n}f2_1} refer to processors with
17366 FPUs clocked at half the rate of the core, names of the form
17367 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17368 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17369 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17370 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17371 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
17372 accepted as synonyms for @samp{@var{n}f1_1}.
17374 GCC defines two macros based on the value of this option. The first
17375 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
17376 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
17377 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
17378 For example, @option{-march=r2000} sets @samp{_MIPS_ARCH}
17379 to @samp{"r2000"} and defines the macro @samp{_MIPS_ARCH_R2000}.
17381 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
17382 above. In other words, it has the full prefix and does not
17383 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
17384 the macro names the resolved architecture (either @samp{"mips1"} or
17385 @samp{"mips3"}). It names the default architecture when no
17386 @option{-march} option is given.
17388 @item -mtune=@var{arch}
17390 Optimize for @var{arch}. Among other things, this option controls
17391 the way instructions are scheduled, and the perceived cost of arithmetic
17392 operations. The list of @var{arch} values is the same as for
17395 When this option is not used, GCC optimizes for the processor
17396 specified by @option{-march}. By using @option{-march} and
17397 @option{-mtune} together, it is possible to generate code that
17398 runs on a family of processors, but optimize the code for one
17399 particular member of that family.
17401 @option{-mtune} defines the macros @samp{_MIPS_TUNE} and
17402 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
17403 @option{-march} ones described above.
17407 Equivalent to @option{-march=mips1}.
17411 Equivalent to @option{-march=mips2}.
17415 Equivalent to @option{-march=mips3}.
17419 Equivalent to @option{-march=mips4}.
17423 Equivalent to @option{-march=mips32}.
17427 Equivalent to @option{-march=mips32r3}.
17431 Equivalent to @option{-march=mips32r5}.
17435 Equivalent to @option{-march=mips64}.
17439 Equivalent to @option{-march=mips64r2}.
17443 Equivalent to @option{-march=mips64r3}.
17447 Equivalent to @option{-march=mips64r5}.
17452 @opindex mno-mips16
17453 Generate (do not generate) MIPS16 code. If GCC is targeting a
17454 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
17456 MIPS16 code generation can also be controlled on a per-function basis
17457 by means of @code{mips16} and @code{nomips16} attributes.
17458 @xref{Function Attributes}, for more information.
17460 @item -mflip-mips16
17461 @opindex mflip-mips16
17462 Generate MIPS16 code on alternating functions. This option is provided
17463 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
17464 not intended for ordinary use in compiling user code.
17466 @item -minterlink-compressed
17467 @item -mno-interlink-compressed
17468 @opindex minterlink-compressed
17469 @opindex mno-interlink-compressed
17470 Require (do not require) that code using the standard (uncompressed) MIPS ISA
17471 be link-compatible with MIPS16 and microMIPS code, and vice versa.
17473 For example, code using the standard ISA encoding cannot jump directly
17474 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
17475 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
17476 knows that the target of the jump is not compressed.
17478 @item -minterlink-mips16
17479 @itemx -mno-interlink-mips16
17480 @opindex minterlink-mips16
17481 @opindex mno-interlink-mips16
17482 Aliases of @option{-minterlink-compressed} and
17483 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
17484 and are retained for backwards compatibility.
17496 Generate code for the given ABI@.
17498 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
17499 generates 64-bit code when you select a 64-bit architecture, but you
17500 can use @option{-mgp32} to get 32-bit code instead.
17502 For information about the O64 ABI, see
17503 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
17505 GCC supports a variant of the o32 ABI in which floating-point registers
17506 are 64 rather than 32 bits wide. You can select this combination with
17507 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
17508 and @code{mfhc1} instructions and is therefore only supported for
17509 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
17511 The register assignments for arguments and return values remain the
17512 same, but each scalar value is passed in a single 64-bit register
17513 rather than a pair of 32-bit registers. For example, scalar
17514 floating-point values are returned in @samp{$f0} only, not a
17515 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
17516 remains the same, but all 64 bits are saved.
17519 @itemx -mno-abicalls
17521 @opindex mno-abicalls
17522 Generate (do not generate) code that is suitable for SVR4-style
17523 dynamic objects. @option{-mabicalls} is the default for SVR4-based
17528 Generate (do not generate) code that is fully position-independent,
17529 and that can therefore be linked into shared libraries. This option
17530 only affects @option{-mabicalls}.
17532 All @option{-mabicalls} code has traditionally been position-independent,
17533 regardless of options like @option{-fPIC} and @option{-fpic}. However,
17534 as an extension, the GNU toolchain allows executables to use absolute
17535 accesses for locally-binding symbols. It can also use shorter GP
17536 initialization sequences and generate direct calls to locally-defined
17537 functions. This mode is selected by @option{-mno-shared}.
17539 @option{-mno-shared} depends on binutils 2.16 or higher and generates
17540 objects that can only be linked by the GNU linker. However, the option
17541 does not affect the ABI of the final executable; it only affects the ABI
17542 of relocatable objects. Using @option{-mno-shared} generally makes
17543 executables both smaller and quicker.
17545 @option{-mshared} is the default.
17551 Assume (do not assume) that the static and dynamic linkers
17552 support PLTs and copy relocations. This option only affects
17553 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
17554 has no effect without @option{-msym32}.
17556 You can make @option{-mplt} the default by configuring
17557 GCC with @option{--with-mips-plt}. The default is
17558 @option{-mno-plt} otherwise.
17564 Lift (do not lift) the usual restrictions on the size of the global
17567 GCC normally uses a single instruction to load values from the GOT@.
17568 While this is relatively efficient, it only works if the GOT
17569 is smaller than about 64k. Anything larger causes the linker
17570 to report an error such as:
17572 @cindex relocation truncated to fit (MIPS)
17574 relocation truncated to fit: R_MIPS_GOT16 foobar
17577 If this happens, you should recompile your code with @option{-mxgot}.
17578 This works with very large GOTs, although the code is also
17579 less efficient, since it takes three instructions to fetch the
17580 value of a global symbol.
17582 Note that some linkers can create multiple GOTs. If you have such a
17583 linker, you should only need to use @option{-mxgot} when a single object
17584 file accesses more than 64k's worth of GOT entries. Very few do.
17586 These options have no effect unless GCC is generating position
17591 Assume that general-purpose registers are 32 bits wide.
17595 Assume that general-purpose registers are 64 bits wide.
17599 Assume that floating-point registers are 32 bits wide.
17603 Assume that floating-point registers are 64 bits wide.
17606 @opindex mhard-float
17607 Use floating-point coprocessor instructions.
17610 @opindex msoft-float
17611 Do not use floating-point coprocessor instructions. Implement
17612 floating-point calculations using library calls instead.
17616 Equivalent to @option{-msoft-float}, but additionally asserts that the
17617 program being compiled does not perform any floating-point operations.
17618 This option is presently supported only by some bare-metal MIPS
17619 configurations, where it may select a special set of libraries
17620 that lack all floating-point support (including, for example, the
17621 floating-point @code{printf} formats).
17622 If code compiled with @code{-mno-float} accidentally contains
17623 floating-point operations, it is likely to suffer a link-time
17624 or run-time failure.
17626 @item -msingle-float
17627 @opindex msingle-float
17628 Assume that the floating-point coprocessor only supports single-precision
17631 @item -mdouble-float
17632 @opindex mdouble-float
17633 Assume that the floating-point coprocessor supports double-precision
17634 operations. This is the default.
17637 @itemx -mabs=legacy
17639 @opindex mabs=legacy
17640 These options control the treatment of the special not-a-number (NaN)
17641 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
17642 @code{neg.@i{fmt}} machine instructions.
17644 By default or when the @option{-mabs=legacy} is used the legacy
17645 treatment is selected. In this case these instructions are considered
17646 arithmetic and avoided where correct operation is required and the
17647 input operand might be a NaN. A longer sequence of instructions that
17648 manipulate the sign bit of floating-point datum manually is used
17649 instead unless the @option{-ffinite-math-only} option has also been
17652 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
17653 this case these instructions are considered non-arithmetic and therefore
17654 operating correctly in all cases, including in particular where the
17655 input operand is a NaN. These instructions are therefore always used
17656 for the respective operations.
17659 @itemx -mnan=legacy
17661 @opindex mnan=legacy
17662 These options control the encoding of the special not-a-number (NaN)
17663 IEEE 754 floating-point data.
17665 The @option{-mnan=legacy} option selects the legacy encoding. In this
17666 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
17667 significand field being 0, whereas signalling NaNs (sNaNs) are denoted
17668 by the first bit of their trailing significand field being 1.
17670 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
17671 this case qNaNs are denoted by the first bit of their trailing
17672 significand field being 1, whereas sNaNs are denoted by the first bit of
17673 their trailing significand field being 0.
17675 The default is @option{-mnan=legacy} unless GCC has been configured with
17676 @option{--with-nan=2008}.
17682 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
17683 implement atomic memory built-in functions. When neither option is
17684 specified, GCC uses the instructions if the target architecture
17687 @option{-mllsc} is useful if the runtime environment can emulate the
17688 instructions and @option{-mno-llsc} can be useful when compiling for
17689 nonstandard ISAs. You can make either option the default by
17690 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
17691 respectively. @option{--with-llsc} is the default for some
17692 configurations; see the installation documentation for details.
17698 Use (do not use) revision 1 of the MIPS DSP ASE@.
17699 @xref{MIPS DSP Built-in Functions}. This option defines the
17700 preprocessor macro @samp{__mips_dsp}. It also defines
17701 @samp{__mips_dsp_rev} to 1.
17707 Use (do not use) revision 2 of the MIPS DSP ASE@.
17708 @xref{MIPS DSP Built-in Functions}. This option defines the
17709 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
17710 It also defines @samp{__mips_dsp_rev} to 2.
17713 @itemx -mno-smartmips
17714 @opindex msmartmips
17715 @opindex mno-smartmips
17716 Use (do not use) the MIPS SmartMIPS ASE.
17718 @item -mpaired-single
17719 @itemx -mno-paired-single
17720 @opindex mpaired-single
17721 @opindex mno-paired-single
17722 Use (do not use) paired-single floating-point instructions.
17723 @xref{MIPS Paired-Single Support}. This option requires
17724 hardware floating-point support to be enabled.
17730 Use (do not use) MIPS Digital Media Extension instructions.
17731 This option can only be used when generating 64-bit code and requires
17732 hardware floating-point support to be enabled.
17737 @opindex mno-mips3d
17738 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
17739 The option @option{-mips3d} implies @option{-mpaired-single}.
17742 @itemx -mno-micromips
17743 @opindex mmicromips
17744 @opindex mno-mmicromips
17745 Generate (do not generate) microMIPS code.
17747 MicroMIPS code generation can also be controlled on a per-function basis
17748 by means of @code{micromips} and @code{nomicromips} attributes.
17749 @xref{Function Attributes}, for more information.
17755 Use (do not use) MT Multithreading instructions.
17761 Use (do not use) the MIPS MCU ASE instructions.
17767 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
17773 Use (do not use) the MIPS Virtualization Application Specific instructions.
17779 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
17783 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
17784 an explanation of the default and the way that the pointer size is
17789 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
17791 The default size of @code{int}s, @code{long}s and pointers depends on
17792 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
17793 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
17794 32-bit @code{long}s. Pointers are the same size as @code{long}s,
17795 or the same size as integer registers, whichever is smaller.
17801 Assume (do not assume) that all symbols have 32-bit values, regardless
17802 of the selected ABI@. This option is useful in combination with
17803 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
17804 to generate shorter and faster references to symbolic addresses.
17808 Put definitions of externally-visible data in a small data section
17809 if that data is no bigger than @var{num} bytes. GCC can then generate
17810 more efficient accesses to the data; see @option{-mgpopt} for details.
17812 The default @option{-G} option depends on the configuration.
17814 @item -mlocal-sdata
17815 @itemx -mno-local-sdata
17816 @opindex mlocal-sdata
17817 @opindex mno-local-sdata
17818 Extend (do not extend) the @option{-G} behavior to local data too,
17819 such as to static variables in C@. @option{-mlocal-sdata} is the
17820 default for all configurations.
17822 If the linker complains that an application is using too much small data,
17823 you might want to try rebuilding the less performance-critical parts with
17824 @option{-mno-local-sdata}. You might also want to build large
17825 libraries with @option{-mno-local-sdata}, so that the libraries leave
17826 more room for the main program.
17828 @item -mextern-sdata
17829 @itemx -mno-extern-sdata
17830 @opindex mextern-sdata
17831 @opindex mno-extern-sdata
17832 Assume (do not assume) that externally-defined data is in
17833 a small data section if the size of that data is within the @option{-G} limit.
17834 @option{-mextern-sdata} is the default for all configurations.
17836 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
17837 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
17838 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
17839 is placed in a small data section. If @var{Var} is defined by another
17840 module, you must either compile that module with a high-enough
17841 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
17842 definition. If @var{Var} is common, you must link the application
17843 with a high-enough @option{-G} setting.
17845 The easiest way of satisfying these restrictions is to compile
17846 and link every module with the same @option{-G} option. However,
17847 you may wish to build a library that supports several different
17848 small data limits. You can do this by compiling the library with
17849 the highest supported @option{-G} setting and additionally using
17850 @option{-mno-extern-sdata} to stop the library from making assumptions
17851 about externally-defined data.
17857 Use (do not use) GP-relative accesses for symbols that are known to be
17858 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
17859 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
17862 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
17863 might not hold the value of @code{_gp}. For example, if the code is
17864 part of a library that might be used in a boot monitor, programs that
17865 call boot monitor routines pass an unknown value in @code{$gp}.
17866 (In such situations, the boot monitor itself is usually compiled
17867 with @option{-G0}.)
17869 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
17870 @option{-mno-extern-sdata}.
17872 @item -membedded-data
17873 @itemx -mno-embedded-data
17874 @opindex membedded-data
17875 @opindex mno-embedded-data
17876 Allocate variables to the read-only data section first if possible, then
17877 next in the small data section if possible, otherwise in data. This gives
17878 slightly slower code than the default, but reduces the amount of RAM required
17879 when executing, and thus may be preferred for some embedded systems.
17881 @item -muninit-const-in-rodata
17882 @itemx -mno-uninit-const-in-rodata
17883 @opindex muninit-const-in-rodata
17884 @opindex mno-uninit-const-in-rodata
17885 Put uninitialized @code{const} variables in the read-only data section.
17886 This option is only meaningful in conjunction with @option{-membedded-data}.
17888 @item -mcode-readable=@var{setting}
17889 @opindex mcode-readable
17890 Specify whether GCC may generate code that reads from executable sections.
17891 There are three possible settings:
17894 @item -mcode-readable=yes
17895 Instructions may freely access executable sections. This is the
17898 @item -mcode-readable=pcrel
17899 MIPS16 PC-relative load instructions can access executable sections,
17900 but other instructions must not do so. This option is useful on 4KSc
17901 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
17902 It is also useful on processors that can be configured to have a dual
17903 instruction/data SRAM interface and that, like the M4K, automatically
17904 redirect PC-relative loads to the instruction RAM.
17906 @item -mcode-readable=no
17907 Instructions must not access executable sections. This option can be
17908 useful on targets that are configured to have a dual instruction/data
17909 SRAM interface but that (unlike the M4K) do not automatically redirect
17910 PC-relative loads to the instruction RAM.
17913 @item -msplit-addresses
17914 @itemx -mno-split-addresses
17915 @opindex msplit-addresses
17916 @opindex mno-split-addresses
17917 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
17918 relocation operators. This option has been superseded by
17919 @option{-mexplicit-relocs} but is retained for backwards compatibility.
17921 @item -mexplicit-relocs
17922 @itemx -mno-explicit-relocs
17923 @opindex mexplicit-relocs
17924 @opindex mno-explicit-relocs
17925 Use (do not use) assembler relocation operators when dealing with symbolic
17926 addresses. The alternative, selected by @option{-mno-explicit-relocs},
17927 is to use assembler macros instead.
17929 @option{-mexplicit-relocs} is the default if GCC was configured
17930 to use an assembler that supports relocation operators.
17932 @item -mcheck-zero-division
17933 @itemx -mno-check-zero-division
17934 @opindex mcheck-zero-division
17935 @opindex mno-check-zero-division
17936 Trap (do not trap) on integer division by zero.
17938 The default is @option{-mcheck-zero-division}.
17940 @item -mdivide-traps
17941 @itemx -mdivide-breaks
17942 @opindex mdivide-traps
17943 @opindex mdivide-breaks
17944 MIPS systems check for division by zero by generating either a
17945 conditional trap or a break instruction. Using traps results in
17946 smaller code, but is only supported on MIPS II and later. Also, some
17947 versions of the Linux kernel have a bug that prevents trap from
17948 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
17949 allow conditional traps on architectures that support them and
17950 @option{-mdivide-breaks} to force the use of breaks.
17952 The default is usually @option{-mdivide-traps}, but this can be
17953 overridden at configure time using @option{--with-divide=breaks}.
17954 Divide-by-zero checks can be completely disabled using
17955 @option{-mno-check-zero-division}.
17960 @opindex mno-memcpy
17961 Force (do not force) the use of @code{memcpy()} for non-trivial block
17962 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
17963 most constant-sized copies.
17966 @itemx -mno-long-calls
17967 @opindex mlong-calls
17968 @opindex mno-long-calls
17969 Disable (do not disable) use of the @code{jal} instruction. Calling
17970 functions using @code{jal} is more efficient but requires the caller
17971 and callee to be in the same 256 megabyte segment.
17973 This option has no effect on abicalls code. The default is
17974 @option{-mno-long-calls}.
17980 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
17981 instructions, as provided by the R4650 ISA@.
17987 Enable (disable) use of the @code{madd} and @code{msub} integer
17988 instructions. The default is @option{-mimadd} on architectures
17989 that support @code{madd} and @code{msub} except for the 74k
17990 architecture where it was found to generate slower code.
17993 @itemx -mno-fused-madd
17994 @opindex mfused-madd
17995 @opindex mno-fused-madd
17996 Enable (disable) use of the floating-point multiply-accumulate
17997 instructions, when they are available. The default is
17998 @option{-mfused-madd}.
18000 On the R8000 CPU when multiply-accumulate instructions are used,
18001 the intermediate product is calculated to infinite precision
18002 and is not subject to the FCSR Flush to Zero bit. This may be
18003 undesirable in some circumstances. On other processors the result
18004 is numerically identical to the equivalent computation using
18005 separate multiply, add, subtract and negate instructions.
18009 Tell the MIPS assembler to not run its preprocessor over user
18010 assembler files (with a @samp{.s} suffix) when assembling them.
18015 @opindex mno-fix-24k
18016 Work around the 24K E48 (lost data on stores during refill) errata.
18017 The workarounds are implemented by the assembler rather than by GCC@.
18020 @itemx -mno-fix-r4000
18021 @opindex mfix-r4000
18022 @opindex mno-fix-r4000
18023 Work around certain R4000 CPU errata:
18026 A double-word or a variable shift may give an incorrect result if executed
18027 immediately after starting an integer division.
18029 A double-word or a variable shift may give an incorrect result if executed
18030 while an integer multiplication is in progress.
18032 An integer division may give an incorrect result if started in a delay slot
18033 of a taken branch or a jump.
18037 @itemx -mno-fix-r4400
18038 @opindex mfix-r4400
18039 @opindex mno-fix-r4400
18040 Work around certain R4400 CPU errata:
18043 A double-word or a variable shift may give an incorrect result if executed
18044 immediately after starting an integer division.
18048 @itemx -mno-fix-r10000
18049 @opindex mfix-r10000
18050 @opindex mno-fix-r10000
18051 Work around certain R10000 errata:
18054 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18055 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18058 This option can only be used if the target architecture supports
18059 branch-likely instructions. @option{-mfix-r10000} is the default when
18060 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18064 @itemx -mno-fix-rm7000
18065 @opindex mfix-rm7000
18066 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18067 workarounds are implemented by the assembler rather than by GCC@.
18070 @itemx -mno-fix-vr4120
18071 @opindex mfix-vr4120
18072 Work around certain VR4120 errata:
18075 @code{dmultu} does not always produce the correct result.
18077 @code{div} and @code{ddiv} do not always produce the correct result if one
18078 of the operands is negative.
18080 The workarounds for the division errata rely on special functions in
18081 @file{libgcc.a}. At present, these functions are only provided by
18082 the @code{mips64vr*-elf} configurations.
18084 Other VR4120 errata require a NOP to be inserted between certain pairs of
18085 instructions. These errata are handled by the assembler, not by GCC itself.
18088 @opindex mfix-vr4130
18089 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18090 workarounds are implemented by the assembler rather than by GCC,
18091 although GCC avoids using @code{mflo} and @code{mfhi} if the
18092 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18093 instructions are available instead.
18096 @itemx -mno-fix-sb1
18098 Work around certain SB-1 CPU core errata.
18099 (This flag currently works around the SB-1 revision 2
18100 ``F1'' and ``F2'' floating-point errata.)
18102 @item -mr10k-cache-barrier=@var{setting}
18103 @opindex mr10k-cache-barrier
18104 Specify whether GCC should insert cache barriers to avoid the
18105 side-effects of speculation on R10K processors.
18107 In common with many processors, the R10K tries to predict the outcome
18108 of a conditional branch and speculatively executes instructions from
18109 the ``taken'' branch. It later aborts these instructions if the
18110 predicted outcome is wrong. However, on the R10K, even aborted
18111 instructions can have side effects.
18113 This problem only affects kernel stores and, depending on the system,
18114 kernel loads. As an example, a speculatively-executed store may load
18115 the target memory into cache and mark the cache line as dirty, even if
18116 the store itself is later aborted. If a DMA operation writes to the
18117 same area of memory before the ``dirty'' line is flushed, the cached
18118 data overwrites the DMA-ed data. See the R10K processor manual
18119 for a full description, including other potential problems.
18121 One workaround is to insert cache barrier instructions before every memory
18122 access that might be speculatively executed and that might have side
18123 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18124 controls GCC's implementation of this workaround. It assumes that
18125 aborted accesses to any byte in the following regions does not have
18130 the memory occupied by the current function's stack frame;
18133 the memory occupied by an incoming stack argument;
18136 the memory occupied by an object with a link-time-constant address.
18139 It is the kernel's responsibility to ensure that speculative
18140 accesses to these regions are indeed safe.
18142 If the input program contains a function declaration such as:
18148 then the implementation of @code{foo} must allow @code{j foo} and
18149 @code{jal foo} to be executed speculatively. GCC honors this
18150 restriction for functions it compiles itself. It expects non-GCC
18151 functions (such as hand-written assembly code) to do the same.
18153 The option has three forms:
18156 @item -mr10k-cache-barrier=load-store
18157 Insert a cache barrier before a load or store that might be
18158 speculatively executed and that might have side effects even
18161 @item -mr10k-cache-barrier=store
18162 Insert a cache barrier before a store that might be speculatively
18163 executed and that might have side effects even if aborted.
18165 @item -mr10k-cache-barrier=none
18166 Disable the insertion of cache barriers. This is the default setting.
18169 @item -mflush-func=@var{func}
18170 @itemx -mno-flush-func
18171 @opindex mflush-func
18172 Specifies the function to call to flush the I and D caches, or to not
18173 call any such function. If called, the function must take the same
18174 arguments as the common @code{_flush_func()}, that is, the address of the
18175 memory range for which the cache is being flushed, the size of the
18176 memory range, and the number 3 (to flush both caches). The default
18177 depends on the target GCC was configured for, but commonly is either
18178 @samp{_flush_func} or @samp{__cpu_flush}.
18180 @item mbranch-cost=@var{num}
18181 @opindex mbranch-cost
18182 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18183 This cost is only a heuristic and is not guaranteed to produce
18184 consistent results across releases. A zero cost redundantly selects
18185 the default, which is based on the @option{-mtune} setting.
18187 @item -mbranch-likely
18188 @itemx -mno-branch-likely
18189 @opindex mbranch-likely
18190 @opindex mno-branch-likely
18191 Enable or disable use of Branch Likely instructions, regardless of the
18192 default for the selected architecture. By default, Branch Likely
18193 instructions may be generated if they are supported by the selected
18194 architecture. An exception is for the MIPS32 and MIPS64 architectures
18195 and processors that implement those architectures; for those, Branch
18196 Likely instructions are not be generated by default because the MIPS32
18197 and MIPS64 architectures specifically deprecate their use.
18199 @item -mfp-exceptions
18200 @itemx -mno-fp-exceptions
18201 @opindex mfp-exceptions
18202 Specifies whether FP exceptions are enabled. This affects how
18203 FP instructions are scheduled for some processors.
18204 The default is that FP exceptions are
18207 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18208 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18211 @item -mvr4130-align
18212 @itemx -mno-vr4130-align
18213 @opindex mvr4130-align
18214 The VR4130 pipeline is two-way superscalar, but can only issue two
18215 instructions together if the first one is 8-byte aligned. When this
18216 option is enabled, GCC aligns pairs of instructions that it
18217 thinks should execute in parallel.
18219 This option only has an effect when optimizing for the VR4130.
18220 It normally makes code faster, but at the expense of making it bigger.
18221 It is enabled by default at optimization level @option{-O3}.
18226 Enable (disable) generation of @code{synci} instructions on
18227 architectures that support it. The @code{synci} instructions (if
18228 enabled) are generated when @code{__builtin___clear_cache()} is
18231 This option defaults to @code{-mno-synci}, but the default can be
18232 overridden by configuring with @code{--with-synci}.
18234 When compiling code for single processor systems, it is generally safe
18235 to use @code{synci}. However, on many multi-core (SMP) systems, it
18236 does not invalidate the instruction caches on all cores and may lead
18237 to undefined behavior.
18239 @item -mrelax-pic-calls
18240 @itemx -mno-relax-pic-calls
18241 @opindex mrelax-pic-calls
18242 Try to turn PIC calls that are normally dispatched via register
18243 @code{$25} into direct calls. This is only possible if the linker can
18244 resolve the destination at link-time and if the destination is within
18245 range for a direct call.
18247 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18248 an assembler and a linker that support the @code{.reloc} assembly
18249 directive and @code{-mexplicit-relocs} is in effect. With
18250 @code{-mno-explicit-relocs}, this optimization can be performed by the
18251 assembler and the linker alone without help from the compiler.
18253 @item -mmcount-ra-address
18254 @itemx -mno-mcount-ra-address
18255 @opindex mmcount-ra-address
18256 @opindex mno-mcount-ra-address
18257 Emit (do not emit) code that allows @code{_mcount} to modify the
18258 calling function's return address. When enabled, this option extends
18259 the usual @code{_mcount} interface with a new @var{ra-address}
18260 parameter, which has type @code{intptr_t *} and is passed in register
18261 @code{$12}. @code{_mcount} can then modify the return address by
18262 doing both of the following:
18265 Returning the new address in register @code{$31}.
18267 Storing the new address in @code{*@var{ra-address}},
18268 if @var{ra-address} is nonnull.
18271 The default is @option{-mno-mcount-ra-address}.
18276 @subsection MMIX Options
18277 @cindex MMIX Options
18279 These options are defined for the MMIX:
18283 @itemx -mno-libfuncs
18285 @opindex mno-libfuncs
18286 Specify that intrinsic library functions are being compiled, passing all
18287 values in registers, no matter the size.
18290 @itemx -mno-epsilon
18292 @opindex mno-epsilon
18293 Generate floating-point comparison instructions that compare with respect
18294 to the @code{rE} epsilon register.
18296 @item -mabi=mmixware
18298 @opindex mabi=mmixware
18300 Generate code that passes function parameters and return values that (in
18301 the called function) are seen as registers @code{$0} and up, as opposed to
18302 the GNU ABI which uses global registers @code{$231} and up.
18304 @item -mzero-extend
18305 @itemx -mno-zero-extend
18306 @opindex mzero-extend
18307 @opindex mno-zero-extend
18308 When reading data from memory in sizes shorter than 64 bits, use (do not
18309 use) zero-extending load instructions by default, rather than
18310 sign-extending ones.
18313 @itemx -mno-knuthdiv
18315 @opindex mno-knuthdiv
18316 Make the result of a division yielding a remainder have the same sign as
18317 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
18318 remainder follows the sign of the dividend. Both methods are
18319 arithmetically valid, the latter being almost exclusively used.
18321 @item -mtoplevel-symbols
18322 @itemx -mno-toplevel-symbols
18323 @opindex mtoplevel-symbols
18324 @opindex mno-toplevel-symbols
18325 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
18326 code can be used with the @code{PREFIX} assembly directive.
18330 Generate an executable in the ELF format, rather than the default
18331 @samp{mmo} format used by the @command{mmix} simulator.
18333 @item -mbranch-predict
18334 @itemx -mno-branch-predict
18335 @opindex mbranch-predict
18336 @opindex mno-branch-predict
18337 Use (do not use) the probable-branch instructions, when static branch
18338 prediction indicates a probable branch.
18340 @item -mbase-addresses
18341 @itemx -mno-base-addresses
18342 @opindex mbase-addresses
18343 @opindex mno-base-addresses
18344 Generate (do not generate) code that uses @emph{base addresses}. Using a
18345 base address automatically generates a request (handled by the assembler
18346 and the linker) for a constant to be set up in a global register. The
18347 register is used for one or more base address requests within the range 0
18348 to 255 from the value held in the register. The generally leads to short
18349 and fast code, but the number of different data items that can be
18350 addressed is limited. This means that a program that uses lots of static
18351 data may require @option{-mno-base-addresses}.
18353 @item -msingle-exit
18354 @itemx -mno-single-exit
18355 @opindex msingle-exit
18356 @opindex mno-single-exit
18357 Force (do not force) generated code to have a single exit point in each
18361 @node MN10300 Options
18362 @subsection MN10300 Options
18363 @cindex MN10300 options
18365 These @option{-m} options are defined for Matsushita MN10300 architectures:
18370 Generate code to avoid bugs in the multiply instructions for the MN10300
18371 processors. This is the default.
18373 @item -mno-mult-bug
18374 @opindex mno-mult-bug
18375 Do not generate code to avoid bugs in the multiply instructions for the
18376 MN10300 processors.
18380 Generate code using features specific to the AM33 processor.
18384 Do not generate code using features specific to the AM33 processor. This
18389 Generate code using features specific to the AM33/2.0 processor.
18393 Generate code using features specific to the AM34 processor.
18395 @item -mtune=@var{cpu-type}
18397 Use the timing characteristics of the indicated CPU type when
18398 scheduling instructions. This does not change the targeted processor
18399 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
18400 @samp{am33-2} or @samp{am34}.
18402 @item -mreturn-pointer-on-d0
18403 @opindex mreturn-pointer-on-d0
18404 When generating a function that returns a pointer, return the pointer
18405 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
18406 only in @code{a0}, and attempts to call such functions without a prototype
18407 result in errors. Note that this option is on by default; use
18408 @option{-mno-return-pointer-on-d0} to disable it.
18412 Do not link in the C run-time initialization object file.
18416 Indicate to the linker that it should perform a relaxation optimization pass
18417 to shorten branches, calls and absolute memory addresses. This option only
18418 has an effect when used on the command line for the final link step.
18420 This option makes symbolic debugging impossible.
18424 Allow the compiler to generate @emph{Long Instruction Word}
18425 instructions if the target is the @samp{AM33} or later. This is the
18426 default. This option defines the preprocessor macro @samp{__LIW__}.
18430 Do not allow the compiler to generate @emph{Long Instruction Word}
18431 instructions. This option defines the preprocessor macro
18436 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
18437 instructions if the target is the @samp{AM33} or later. This is the
18438 default. This option defines the preprocessor macro @samp{__SETLB__}.
18442 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
18443 instructions. This option defines the preprocessor macro
18444 @samp{__NO_SETLB__}.
18448 @node Moxie Options
18449 @subsection Moxie Options
18450 @cindex Moxie Options
18456 Generate big-endian code. This is the default for @samp{moxie-*-*}
18461 Generate little-endian code.
18465 Do not link in the C run-time initialization object file.
18469 @node MSP430 Options
18470 @subsection MSP430 Options
18471 @cindex MSP430 Options
18473 These options are defined for the MSP430:
18479 Force assembly output to always use hex constants. Normally such
18480 constants are signed decimals, but this option is available for
18481 testsuite and/or aesthetic purposes.
18485 Select the MCU to target. This is used to create a C preprocessor
18486 symbol based upon the MCU name, converted to upper case and pre- and
18487 post- fixed with @code{__}. This in turn will be used by the
18488 @code{msp430.h} header file to select an MCU specific supplimentary
18491 The option also sets the ISA to use. If the MCU name is one that is
18492 known to only support the 430 ISA then that is selected, otherwise the
18493 430X ISA is selected. A generic MCU name of @code{msp430} can also be
18494 used to select the 430 ISA. Similarly the generic @code{msp430x} MCU
18495 name will select the 430X ISA.
18497 In addition an MCU specific linker script will be added to the linker
18498 command line. The script's name is the name of the MCU with
18499 @code{.ld} appended. Thus specifying @option{-mmcu=xxx} on the gcc
18500 command line will define the C preprocessor symbol @code{__XXX__} and
18501 cause the linker to search for a script called @file{xxx.ld}.
18503 This option is also passed on to the assembler.
18507 Specifies the ISA to use. Accepted values are @code{msp430},
18508 @code{msp430x} and @code{msp430xv2}. This option is deprecated. The
18509 @option{-mmcu=} option should be used to select the ISA.
18513 Link to the simulator runtime libraries and linker script. Overrides
18514 any scripts that would be selected by the @option{-mmcu=} option.
18518 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
18522 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
18526 This option is passed to the assembler and linker, and allows the
18527 linker to perform certain optimizations that cannot be done until
18532 Describes the type of hardware multiply supported by the target.
18533 Accepted values are @code{none} for no hardware multiply, @code{16bit}
18534 for the original 16-bit-only multiply supported by early MCUs.
18535 @code{32bit} for the 16/32-bit multiply supported by later MCUs and
18536 @code{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
18537 A value of @code{auto} can also be given. This tells GCC to deduce
18538 the hardware multiply support based upon the MCU name provided by the
18539 @option{-mmcu} option. If no @option{-mmcu} option is specified then
18540 @code{32bit} hardware multiply support is assumed. @code{auto} is the
18543 Hardware multiplies are normally performed by calling a library
18544 routine. This saves space in the generated code. When compiling at
18545 @code{-O3} or higher however the hardware multiplier is invoked
18546 inline. This makes for bigger, but faster code.
18548 The hardware multiply routines disable interrupts whilst running and
18549 restore the previous interrupt state when they finish. This makes
18550 them safe to use inside interrupt handlers as well as in normal code.
18554 @node NDS32 Options
18555 @subsection NDS32 Options
18556 @cindex NDS32 Options
18558 These options are defined for NDS32 implementations:
18563 @opindex mbig-endian
18564 Generate code in big-endian mode.
18566 @item -mlittle-endian
18567 @opindex mlittle-endian
18568 Generate code in little-endian mode.
18570 @item -mreduced-regs
18571 @opindex mreduced-regs
18572 Use reduced-set registers for register allocation.
18575 @opindex mfull-regs
18576 Use full-set registers for register allocation.
18580 Generate conditional move instructions.
18584 Do not generate conditional move instructions.
18588 Generate performance extension instructions.
18590 @item -mno-perf-ext
18591 @opindex mno-perf-ext
18592 Do not generate performance extension instructions.
18596 Generate v3 push25/pop25 instructions.
18599 @opindex mno-v3push
18600 Do not generate v3 push25/pop25 instructions.
18604 Generate 16-bit instructions.
18607 @opindex mno-16-bit
18608 Do not generate 16-bit instructions.
18611 @opindex mgp-direct
18612 Generate GP base instructions directly.
18614 @item -mno-gp-direct
18615 @opindex mno-gp-direct
18616 Do no generate GP base instructions directly.
18618 @item -misr-vector-size=@var{num}
18619 @opindex misr-vector-size
18620 Specify the size of each interrupt vector, which must be 4 or 16.
18622 @item -mcache-block-size=@var{num}
18623 @opindex mcache-block-size
18624 Specify the size of each cache block,
18625 which must be a power of 2 between 4 and 512.
18627 @item -march=@var{arch}
18629 Specify the name of the target architecture.
18631 @item -mforce-fp-as-gp
18632 @opindex mforce-fp-as-gp
18633 Prevent $fp being allocated during register allocation so that compiler
18634 is able to force performing fp-as-gp optimization.
18636 @item -mforbid-fp-as-gp
18637 @opindex mforbid-fp-as-gp
18638 Forbid using $fp to access static and global variables.
18639 This option strictly forbids fp-as-gp optimization
18640 regardless of @option{-mforce-fp-as-gp}.
18644 Use special directives to guide linker doing ex9 optimization.
18647 @opindex mctor-dtor
18648 Enable constructor/destructor feature.
18652 Guide linker to relax instructions.
18656 @node Nios II Options
18657 @subsection Nios II Options
18658 @cindex Nios II options
18659 @cindex Altera Nios II options
18661 These are the options defined for the Altera Nios II processor.
18667 @cindex smaller data references
18668 Put global and static objects less than or equal to @var{num} bytes
18669 into the small data or BSS sections instead of the normal data or BSS
18670 sections. The default value of @var{num} is 8.
18676 Generate (do not generate) GP-relative accesses for objects in the
18677 small data or BSS sections. The default is @option{-mgpopt} except
18678 when @option{-fpic} or @option{-fPIC} is specified to generate
18679 position-independent code. Note that the Nios II ABI does not permit
18680 GP-relative accesses from shared libraries.
18682 You may need to specify @option{-mno-gpopt} explicitly when building
18683 programs that include large amounts of small data, including large
18684 GOT data sections. In this case, the 16-bit offset for GP-relative
18685 addressing may not be large enough to allow access to the entire
18686 small data section.
18692 Generate little-endian (default) or big-endian (experimental) code,
18695 @item -mbypass-cache
18696 @itemx -mno-bypass-cache
18697 @opindex mno-bypass-cache
18698 @opindex mbypass-cache
18699 Force all load and store instructions to always bypass cache by
18700 using I/O variants of the instructions. The default is not to
18703 @item -mno-cache-volatile
18704 @itemx -mcache-volatile
18705 @opindex mcache-volatile
18706 @opindex mno-cache-volatile
18707 Volatile memory access bypass the cache using the I/O variants of
18708 the load and store instructions. The default is not to bypass the cache.
18710 @item -mno-fast-sw-div
18711 @itemx -mfast-sw-div
18712 @opindex mno-fast-sw-div
18713 @opindex mfast-sw-div
18714 Do not use table-based fast divide for small numbers. The default
18715 is to use the fast divide at @option{-O3} and above.
18719 @itemx -mno-hw-mulx
18723 @opindex mno-hw-mul
18725 @opindex mno-hw-mulx
18727 @opindex mno-hw-div
18729 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
18730 instructions by the compiler. The default is to emit @code{mul}
18731 and not emit @code{div} and @code{mulx}.
18733 @item -mcustom-@var{insn}=@var{N}
18734 @itemx -mno-custom-@var{insn}
18735 @opindex mcustom-@var{insn}
18736 @opindex mno-custom-@var{insn}
18737 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
18738 custom instruction with encoding @var{N} when generating code that uses
18739 @var{insn}. For example, @code{-mcustom-fadds=253} generates custom
18740 instruction 253 for single-precision floating-point add operations instead
18741 of the default behavior of using a library call.
18743 The following values of @var{insn} are supported. Except as otherwise
18744 noted, floating-point operations are expected to be implemented with
18745 normal IEEE 754 semantics and correspond directly to the C operators or the
18746 equivalent GCC built-in functions (@pxref{Other Builtins}).
18748 Single-precision floating point:
18751 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
18752 Binary arithmetic operations.
18758 Unary absolute value.
18760 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
18761 Comparison operations.
18763 @item @samp{fmins}, @samp{fmaxs}
18764 Floating-point minimum and maximum. These instructions are only
18765 generated if @option{-ffinite-math-only} is specified.
18767 @item @samp{fsqrts}
18768 Unary square root operation.
18770 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
18771 Floating-point trigonometric and exponential functions. These instructions
18772 are only generated if @option{-funsafe-math-optimizations} is also specified.
18776 Double-precision floating point:
18779 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
18780 Binary arithmetic operations.
18786 Unary absolute value.
18788 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
18789 Comparison operations.
18791 @item @samp{fmind}, @samp{fmaxd}
18792 Double-precision minimum and maximum. These instructions are only
18793 generated if @option{-ffinite-math-only} is specified.
18795 @item @samp{fsqrtd}
18796 Unary square root operation.
18798 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
18799 Double-precision trigonometric and exponential functions. These instructions
18800 are only generated if @option{-funsafe-math-optimizations} is also specified.
18806 @item @samp{fextsd}
18807 Conversion from single precision to double precision.
18809 @item @samp{ftruncds}
18810 Conversion from double precision to single precision.
18812 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
18813 Conversion from floating point to signed or unsigned integer types, with
18814 truncation towards zero.
18817 Conversion from single-precision floating point to signed integer,
18818 rounding to the nearest integer and ties away from zero.
18819 This corresponds to the @code{__builtin_lroundf} function when
18820 @option{-fno-math-errno} is used.
18822 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
18823 Conversion from signed or unsigned integer types to floating-point types.
18827 In addition, all of the following transfer instructions for internal
18828 registers X and Y must be provided to use any of the double-precision
18829 floating-point instructions. Custom instructions taking two
18830 double-precision source operands expect the first operand in the
18831 64-bit register X. The other operand (or only operand of a unary
18832 operation) is given to the custom arithmetic instruction with the
18833 least significant half in source register @var{src1} and the most
18834 significant half in @var{src2}. A custom instruction that returns a
18835 double-precision result returns the most significant 32 bits in the
18836 destination register and the other half in 32-bit register Y.
18837 GCC automatically generates the necessary code sequences to write
18838 register X and/or read register Y when double-precision floating-point
18839 instructions are used.
18844 Write @var{src1} into the least significant half of X and @var{src2} into
18845 the most significant half of X.
18848 Write @var{src1} into Y.
18850 @item @samp{frdxhi}, @samp{frdxlo}
18851 Read the most or least (respectively) significant half of X and store it in
18855 Read the value of Y and store it into @var{dest}.
18858 Note that you can gain more local control over generation of Nios II custom
18859 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
18860 and @code{target("no-custom-@var{insn}")} function attributes
18861 (@pxref{Function Attributes})
18862 or pragmas (@pxref{Function Specific Option Pragmas}).
18864 @item -mcustom-fpu-cfg=@var{name}
18865 @opindex mcustom-fpu-cfg
18867 This option enables a predefined, named set of custom instruction encodings
18868 (see @option{-mcustom-@var{insn}} above).
18869 Currently, the following sets are defined:
18871 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
18872 @gccoptlist{-mcustom-fmuls=252 @gol
18873 -mcustom-fadds=253 @gol
18874 -mcustom-fsubs=254 @gol
18875 -fsingle-precision-constant}
18877 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
18878 @gccoptlist{-mcustom-fmuls=252 @gol
18879 -mcustom-fadds=253 @gol
18880 -mcustom-fsubs=254 @gol
18881 -mcustom-fdivs=255 @gol
18882 -fsingle-precision-constant}
18884 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
18885 @gccoptlist{-mcustom-floatus=243 @gol
18886 -mcustom-fixsi=244 @gol
18887 -mcustom-floatis=245 @gol
18888 -mcustom-fcmpgts=246 @gol
18889 -mcustom-fcmples=249 @gol
18890 -mcustom-fcmpeqs=250 @gol
18891 -mcustom-fcmpnes=251 @gol
18892 -mcustom-fmuls=252 @gol
18893 -mcustom-fadds=253 @gol
18894 -mcustom-fsubs=254 @gol
18895 -mcustom-fdivs=255 @gol
18896 -fsingle-precision-constant}
18898 Custom instruction assignments given by individual
18899 @option{-mcustom-@var{insn}=} options override those given by
18900 @option{-mcustom-fpu-cfg=}, regardless of the
18901 order of the options on the command line.
18903 Note that you can gain more local control over selection of a FPU
18904 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
18905 function attribute (@pxref{Function Attributes})
18906 or pragma (@pxref{Function Specific Option Pragmas}).
18910 These additional @samp{-m} options are available for the Altera Nios II
18911 ELF (bare-metal) target:
18917 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
18918 startup and termination code, and is typically used in conjunction with
18919 @option{-msys-crt0=} to specify the location of the alternate startup code
18920 provided by the HAL BSP.
18924 Link with a limited version of the C library, @option{-lsmallc}, rather than
18927 @item -msys-crt0=@var{startfile}
18929 @var{startfile} is the file name of the startfile (crt0) to use
18930 when linking. This option is only useful in conjunction with @option{-mhal}.
18932 @item -msys-lib=@var{systemlib}
18934 @var{systemlib} is the library name of the library that provides
18935 low-level system calls required by the C library,
18936 e.g. @code{read} and @code{write}.
18937 This option is typically used to link with a library provided by a HAL BSP.
18941 @node PDP-11 Options
18942 @subsection PDP-11 Options
18943 @cindex PDP-11 Options
18945 These options are defined for the PDP-11:
18950 Use hardware FPP floating point. This is the default. (FIS floating
18951 point on the PDP-11/40 is not supported.)
18954 @opindex msoft-float
18955 Do not use hardware floating point.
18959 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
18963 Return floating-point results in memory. This is the default.
18967 Generate code for a PDP-11/40.
18971 Generate code for a PDP-11/45. This is the default.
18975 Generate code for a PDP-11/10.
18977 @item -mbcopy-builtin
18978 @opindex mbcopy-builtin
18979 Use inline @code{movmemhi} patterns for copying memory. This is the
18984 Do not use inline @code{movmemhi} patterns for copying memory.
18990 Use 16-bit @code{int}. This is the default.
18996 Use 32-bit @code{int}.
18999 @itemx -mno-float32
19001 @opindex mno-float32
19002 Use 64-bit @code{float}. This is the default.
19005 @itemx -mno-float64
19007 @opindex mno-float64
19008 Use 32-bit @code{float}.
19012 Use @code{abshi2} pattern. This is the default.
19016 Do not use @code{abshi2} pattern.
19018 @item -mbranch-expensive
19019 @opindex mbranch-expensive
19020 Pretend that branches are expensive. This is for experimenting with
19021 code generation only.
19023 @item -mbranch-cheap
19024 @opindex mbranch-cheap
19025 Do not pretend that branches are expensive. This is the default.
19029 Use Unix assembler syntax. This is the default when configured for
19030 @samp{pdp11-*-bsd}.
19034 Use DEC assembler syntax. This is the default when configured for any
19035 PDP-11 target other than @samp{pdp11-*-bsd}.
19038 @node picoChip Options
19039 @subsection picoChip Options
19040 @cindex picoChip options
19042 These @samp{-m} options are defined for picoChip implementations:
19046 @item -mae=@var{ae_type}
19048 Set the instruction set, register set, and instruction scheduling
19049 parameters for array element type @var{ae_type}. Supported values
19050 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19052 @option{-mae=ANY} selects a completely generic AE type. Code
19053 generated with this option runs on any of the other AE types. The
19054 code is not as efficient as it would be if compiled for a specific
19055 AE type, and some types of operation (e.g., multiplication) do not
19056 work properly on all types of AE.
19058 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19059 for compiled code, and is the default.
19061 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19062 option may suffer from poor performance of byte (char) manipulation,
19063 since the DSP AE does not provide hardware support for byte load/stores.
19065 @item -msymbol-as-address
19066 Enable the compiler to directly use a symbol name as an address in a
19067 load/store instruction, without first loading it into a
19068 register. Typically, the use of this option generates larger
19069 programs, which run faster than when the option isn't used. However, the
19070 results vary from program to program, so it is left as a user option,
19071 rather than being permanently enabled.
19073 @item -mno-inefficient-warnings
19074 Disables warnings about the generation of inefficient code. These
19075 warnings can be generated, for example, when compiling code that
19076 performs byte-level memory operations on the MAC AE type. The MAC AE has
19077 no hardware support for byte-level memory operations, so all byte
19078 load/stores must be synthesized from word load/store operations. This is
19079 inefficient and a warning is generated to indicate
19080 that you should rewrite the code to avoid byte operations, or to target
19081 an AE type that has the necessary hardware support. This option disables
19086 @node PowerPC Options
19087 @subsection PowerPC Options
19088 @cindex PowerPC options
19090 These are listed under @xref{RS/6000 and PowerPC Options}.
19093 @subsection RL78 Options
19094 @cindex RL78 Options
19100 Links in additional target libraries to support operation within a
19107 Specifies the type of hardware multiplication support to be used. The
19108 default is @code{none}, which uses software multiplication functions.
19109 The @code{g13} option is for the hardware multiply/divide peripheral
19110 only on the RL78/G13 targets. The @code{rl78} option is for the
19111 standard hardware multiplication defined in the RL78 software manual.
19113 @item -m64bit-doubles
19114 @itemx -m32bit-doubles
19115 @opindex m64bit-doubles
19116 @opindex m32bit-doubles
19117 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19118 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19119 @option{-m32bit-doubles}.
19123 @node RS/6000 and PowerPC Options
19124 @subsection IBM RS/6000 and PowerPC Options
19125 @cindex RS/6000 and PowerPC Options
19126 @cindex IBM RS/6000 and PowerPC Options
19128 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
19130 @item -mpowerpc-gpopt
19131 @itemx -mno-powerpc-gpopt
19132 @itemx -mpowerpc-gfxopt
19133 @itemx -mno-powerpc-gfxopt
19136 @itemx -mno-powerpc64
19140 @itemx -mno-popcntb
19142 @itemx -mno-popcntd
19151 @itemx -mno-hard-dfp
19152 @opindex mpowerpc-gpopt
19153 @opindex mno-powerpc-gpopt
19154 @opindex mpowerpc-gfxopt
19155 @opindex mno-powerpc-gfxopt
19156 @opindex mpowerpc64
19157 @opindex mno-powerpc64
19161 @opindex mno-popcntb
19163 @opindex mno-popcntd
19169 @opindex mno-mfpgpr
19171 @opindex mno-hard-dfp
19172 You use these options to specify which instructions are available on the
19173 processor you are using. The default value of these options is
19174 determined when configuring GCC@. Specifying the
19175 @option{-mcpu=@var{cpu_type}} overrides the specification of these
19176 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
19177 rather than the options listed above.
19179 Specifying @option{-mpowerpc-gpopt} allows
19180 GCC to use the optional PowerPC architecture instructions in the
19181 General Purpose group, including floating-point square root. Specifying
19182 @option{-mpowerpc-gfxopt} allows GCC to
19183 use the optional PowerPC architecture instructions in the Graphics
19184 group, including floating-point select.
19186 The @option{-mmfcrf} option allows GCC to generate the move from
19187 condition register field instruction implemented on the POWER4
19188 processor and other processors that support the PowerPC V2.01
19190 The @option{-mpopcntb} option allows GCC to generate the popcount and
19191 double-precision FP reciprocal estimate instruction implemented on the
19192 POWER5 processor and other processors that support the PowerPC V2.02
19194 The @option{-mpopcntd} option allows GCC to generate the popcount
19195 instruction implemented on the POWER7 processor and other processors
19196 that support the PowerPC V2.06 architecture.
19197 The @option{-mfprnd} option allows GCC to generate the FP round to
19198 integer instructions implemented on the POWER5+ processor and other
19199 processors that support the PowerPC V2.03 architecture.
19200 The @option{-mcmpb} option allows GCC to generate the compare bytes
19201 instruction implemented on the POWER6 processor and other processors
19202 that support the PowerPC V2.05 architecture.
19203 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
19204 general-purpose register instructions implemented on the POWER6X
19205 processor and other processors that support the extended PowerPC V2.05
19207 The @option{-mhard-dfp} option allows GCC to generate the decimal
19208 floating-point instructions implemented on some POWER processors.
19210 The @option{-mpowerpc64} option allows GCC to generate the additional
19211 64-bit instructions that are found in the full PowerPC64 architecture
19212 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
19213 @option{-mno-powerpc64}.
19215 @item -mcpu=@var{cpu_type}
19217 Set architecture type, register usage, and
19218 instruction scheduling parameters for machine type @var{cpu_type}.
19219 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
19220 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
19221 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
19222 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
19223 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
19224 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
19225 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
19226 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
19227 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
19228 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc},
19229 @samp{powerpc64}, and @samp{rs64}.
19231 @option{-mcpu=powerpc}, and @option{-mcpu=powerpc64} specify pure 32-bit
19232 PowerPC and 64-bit PowerPC architecture machine
19233 types, with an appropriate, generic processor model assumed for
19234 scheduling purposes.
19236 The other options specify a specific processor. Code generated under
19237 those options runs best on that processor, and may not run at all on
19240 The @option{-mcpu} options automatically enable or disable the
19243 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
19244 -mpopcntb -mpopcntd -mpowerpc64 @gol
19245 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
19246 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
19247 -mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
19248 -mquad-memory -mquad-memory-atomic}
19250 The particular options set for any particular CPU varies between
19251 compiler versions, depending on what setting seems to produce optimal
19252 code for that CPU; it doesn't necessarily reflect the actual hardware's
19253 capabilities. If you wish to set an individual option to a particular
19254 value, you may specify it after the @option{-mcpu} option, like
19255 @option{-mcpu=970 -mno-altivec}.
19257 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
19258 not enabled or disabled by the @option{-mcpu} option at present because
19259 AIX does not have full support for these options. You may still
19260 enable or disable them individually if you're sure it'll work in your
19263 @item -mtune=@var{cpu_type}
19265 Set the instruction scheduling parameters for machine type
19266 @var{cpu_type}, but do not set the architecture type or register usage,
19267 as @option{-mcpu=@var{cpu_type}} does. The same
19268 values for @var{cpu_type} are used for @option{-mtune} as for
19269 @option{-mcpu}. If both are specified, the code generated uses the
19270 architecture and registers set by @option{-mcpu}, but the
19271 scheduling parameters set by @option{-mtune}.
19273 @item -mcmodel=small
19274 @opindex mcmodel=small
19275 Generate PowerPC64 code for the small model: The TOC is limited to
19278 @item -mcmodel=medium
19279 @opindex mcmodel=medium
19280 Generate PowerPC64 code for the medium model: The TOC and other static
19281 data may be up to a total of 4G in size.
19283 @item -mcmodel=large
19284 @opindex mcmodel=large
19285 Generate PowerPC64 code for the large model: The TOC may be up to 4G
19286 in size. Other data and code is only limited by the 64-bit address
19290 @itemx -mno-altivec
19292 @opindex mno-altivec
19293 Generate code that uses (does not use) AltiVec instructions, and also
19294 enable the use of built-in functions that allow more direct access to
19295 the AltiVec instruction set. You may also need to set
19296 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
19299 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
19300 @option{-maltivec=be}, the element order for Altivec intrinsics such
19301 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} will
19302 match array element order corresponding to the endianness of the
19303 target. That is, element zero identifies the leftmost element in a
19304 vector register when targeting a big-endian platform, and identifies
19305 the rightmost element in a vector register when targeting a
19306 little-endian platform.
19309 @opindex maltivec=be
19310 Generate Altivec instructions using big-endian element order,
19311 regardless of whether the target is big- or little-endian. This is
19312 the default when targeting a big-endian platform.
19314 The element order is used to interpret element numbers in Altivec
19315 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19316 @code{vec_insert}. By default, these will match array element order
19317 corresponding to the endianness for the target.
19320 @opindex maltivec=le
19321 Generate Altivec instructions using little-endian element order,
19322 regardless of whether the target is big- or little-endian. This is
19323 the default when targeting a little-endian platform. This option is
19324 currently ignored when targeting a big-endian platform.
19326 The element order is used to interpret element numbers in Altivec
19327 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19328 @code{vec_insert}. By default, these will match array element order
19329 corresponding to the endianness for the target.
19334 @opindex mno-vrsave
19335 Generate VRSAVE instructions when generating AltiVec code.
19337 @item -mgen-cell-microcode
19338 @opindex mgen-cell-microcode
19339 Generate Cell microcode instructions.
19341 @item -mwarn-cell-microcode
19342 @opindex mwarn-cell-microcode
19343 Warn when a Cell microcode instruction is emitted. An example
19344 of a Cell microcode instruction is a variable shift.
19347 @opindex msecure-plt
19348 Generate code that allows @command{ld} and @command{ld.so}
19349 to build executables and shared
19350 libraries with non-executable @code{.plt} and @code{.got} sections.
19352 32-bit SYSV ABI option.
19356 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
19358 requires @code{.plt} and @code{.got}
19359 sections that are both writable and executable.
19360 This is a PowerPC 32-bit SYSV ABI option.
19366 This switch enables or disables the generation of ISEL instructions.
19368 @item -misel=@var{yes/no}
19369 This switch has been deprecated. Use @option{-misel} and
19370 @option{-mno-isel} instead.
19376 This switch enables or disables the generation of SPE simd
19382 @opindex mno-paired
19383 This switch enables or disables the generation of PAIRED simd
19386 @item -mspe=@var{yes/no}
19387 This option has been deprecated. Use @option{-mspe} and
19388 @option{-mno-spe} instead.
19394 Generate code that uses (does not use) vector/scalar (VSX)
19395 instructions, and also enable the use of built-in functions that allow
19396 more direct access to the VSX instruction set.
19401 @opindex mno-crypto
19402 Enable the use (disable) of the built-in functions that allow direct
19403 access to the cryptographic instructions that were added in version
19404 2.07 of the PowerPC ISA.
19406 @item -mdirect-move
19407 @itemx -mno-direct-move
19408 @opindex mdirect-move
19409 @opindex mno-direct-move
19410 Generate code that uses (does not use) the instructions to move data
19411 between the general purpose registers and the vector/scalar (VSX)
19412 registers that were added in version 2.07 of the PowerPC ISA.
19414 @item -mpower8-fusion
19415 @itemx -mno-power8-fusion
19416 @opindex mpower8-fusion
19417 @opindex mno-power8-fusion
19418 Generate code that keeps (does not keeps) some integer operations
19419 adjacent so that the instructions can be fused together on power8 and
19422 @item -mpower8-vector
19423 @itemx -mno-power8-vector
19424 @opindex mpower8-vector
19425 @opindex mno-power8-vector
19426 Generate code that uses (does not use) the vector and scalar
19427 instructions that were added in version 2.07 of the PowerPC ISA. Also
19428 enable the use of built-in functions that allow more direct access to
19429 the vector instructions.
19431 @item -mquad-memory
19432 @itemx -mno-quad-memory
19433 @opindex mquad-memory
19434 @opindex mno-quad-memory
19435 Generate code that uses (does not use) the non-atomic quad word memory
19436 instructions. The @option{-mquad-memory} option requires use of
19439 @item -mquad-memory-atomic
19440 @itemx -mno-quad-memory-atomic
19441 @opindex mquad-memory-atomic
19442 @opindex mno-quad-memory-atomic
19443 Generate code that uses (does not use) the atomic quad word memory
19444 instructions. The @option{-mquad-memory-atomic} option requires use of
19447 @item -mfloat-gprs=@var{yes/single/double/no}
19448 @itemx -mfloat-gprs
19449 @opindex mfloat-gprs
19450 This switch enables or disables the generation of floating-point
19451 operations on the general-purpose registers for architectures that
19454 The argument @var{yes} or @var{single} enables the use of
19455 single-precision floating-point operations.
19457 The argument @var{double} enables the use of single and
19458 double-precision floating-point operations.
19460 The argument @var{no} disables floating-point operations on the
19461 general-purpose registers.
19463 This option is currently only available on the MPC854x.
19469 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
19470 targets (including GNU/Linux). The 32-bit environment sets int, long
19471 and pointer to 32 bits and generates code that runs on any PowerPC
19472 variant. The 64-bit environment sets int to 32 bits and long and
19473 pointer to 64 bits, and generates code for PowerPC64, as for
19474 @option{-mpowerpc64}.
19477 @itemx -mno-fp-in-toc
19478 @itemx -mno-sum-in-toc
19479 @itemx -mminimal-toc
19481 @opindex mno-fp-in-toc
19482 @opindex mno-sum-in-toc
19483 @opindex mminimal-toc
19484 Modify generation of the TOC (Table Of Contents), which is created for
19485 every executable file. The @option{-mfull-toc} option is selected by
19486 default. In that case, GCC allocates at least one TOC entry for
19487 each unique non-automatic variable reference in your program. GCC
19488 also places floating-point constants in the TOC@. However, only
19489 16,384 entries are available in the TOC@.
19491 If you receive a linker error message that saying you have overflowed
19492 the available TOC space, you can reduce the amount of TOC space used
19493 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
19494 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
19495 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
19496 generate code to calculate the sum of an address and a constant at
19497 run time instead of putting that sum into the TOC@. You may specify one
19498 or both of these options. Each causes GCC to produce very slightly
19499 slower and larger code at the expense of conserving TOC space.
19501 If you still run out of space in the TOC even when you specify both of
19502 these options, specify @option{-mminimal-toc} instead. This option causes
19503 GCC to make only one TOC entry for every file. When you specify this
19504 option, GCC produces code that is slower and larger but which
19505 uses extremely little TOC space. You may wish to use this option
19506 only on files that contain less frequently-executed code.
19512 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
19513 @code{long} type, and the infrastructure needed to support them.
19514 Specifying @option{-maix64} implies @option{-mpowerpc64},
19515 while @option{-maix32} disables the 64-bit ABI and
19516 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
19519 @itemx -mno-xl-compat
19520 @opindex mxl-compat
19521 @opindex mno-xl-compat
19522 Produce code that conforms more closely to IBM XL compiler semantics
19523 when using AIX-compatible ABI@. Pass floating-point arguments to
19524 prototyped functions beyond the register save area (RSA) on the stack
19525 in addition to argument FPRs. Do not assume that most significant
19526 double in 128-bit long double value is properly rounded when comparing
19527 values and converting to double. Use XL symbol names for long double
19530 The AIX calling convention was extended but not initially documented to
19531 handle an obscure K&R C case of calling a function that takes the
19532 address of its arguments with fewer arguments than declared. IBM XL
19533 compilers access floating-point arguments that do not fit in the
19534 RSA from the stack when a subroutine is compiled without
19535 optimization. Because always storing floating-point arguments on the
19536 stack is inefficient and rarely needed, this option is not enabled by
19537 default and only is necessary when calling subroutines compiled by IBM
19538 XL compilers without optimization.
19542 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
19543 application written to use message passing with special startup code to
19544 enable the application to run. The system must have PE installed in the
19545 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
19546 must be overridden with the @option{-specs=} option to specify the
19547 appropriate directory location. The Parallel Environment does not
19548 support threads, so the @option{-mpe} option and the @option{-pthread}
19549 option are incompatible.
19551 @item -malign-natural
19552 @itemx -malign-power
19553 @opindex malign-natural
19554 @opindex malign-power
19555 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
19556 @option{-malign-natural} overrides the ABI-defined alignment of larger
19557 types, such as floating-point doubles, on their natural size-based boundary.
19558 The option @option{-malign-power} instructs GCC to follow the ABI-specified
19559 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
19561 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
19565 @itemx -mhard-float
19566 @opindex msoft-float
19567 @opindex mhard-float
19568 Generate code that does not use (uses) the floating-point register set.
19569 Software floating-point emulation is provided if you use the
19570 @option{-msoft-float} option, and pass the option to GCC when linking.
19572 @item -msingle-float
19573 @itemx -mdouble-float
19574 @opindex msingle-float
19575 @opindex mdouble-float
19576 Generate code for single- or double-precision floating-point operations.
19577 @option{-mdouble-float} implies @option{-msingle-float}.
19580 @opindex msimple-fpu
19581 Do not generate @code{sqrt} and @code{div} instructions for hardware
19582 floating-point unit.
19584 @item -mfpu=@var{name}
19586 Specify type of floating-point unit. Valid values for @var{name} are
19587 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
19588 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
19589 @samp{sp_full} (equivalent to @option{-msingle-float}),
19590 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
19593 @opindex mxilinx-fpu
19594 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
19597 @itemx -mno-multiple
19599 @opindex mno-multiple
19600 Generate code that uses (does not use) the load multiple word
19601 instructions and the store multiple word instructions. These
19602 instructions are generated by default on POWER systems, and not
19603 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
19604 PowerPC systems, since those instructions do not work when the
19605 processor is in little-endian mode. The exceptions are PPC740 and
19606 PPC750 which permit these instructions in little-endian mode.
19611 @opindex mno-string
19612 Generate code that uses (does not use) the load string instructions
19613 and the store string word instructions to save multiple registers and
19614 do small block moves. These instructions are generated by default on
19615 POWER systems, and not generated on PowerPC systems. Do not use
19616 @option{-mstring} on little-endian PowerPC systems, since those
19617 instructions do not work when the processor is in little-endian mode.
19618 The exceptions are PPC740 and PPC750 which permit these instructions
19619 in little-endian mode.
19624 @opindex mno-update
19625 Generate code that uses (does not use) the load or store instructions
19626 that update the base register to the address of the calculated memory
19627 location. These instructions are generated by default. If you use
19628 @option{-mno-update}, there is a small window between the time that the
19629 stack pointer is updated and the address of the previous frame is
19630 stored, which means code that walks the stack frame across interrupts or
19631 signals may get corrupted data.
19633 @item -mavoid-indexed-addresses
19634 @itemx -mno-avoid-indexed-addresses
19635 @opindex mavoid-indexed-addresses
19636 @opindex mno-avoid-indexed-addresses
19637 Generate code that tries to avoid (not avoid) the use of indexed load
19638 or store instructions. These instructions can incur a performance
19639 penalty on Power6 processors in certain situations, such as when
19640 stepping through large arrays that cross a 16M boundary. This option
19641 is enabled by default when targeting Power6 and disabled otherwise.
19644 @itemx -mno-fused-madd
19645 @opindex mfused-madd
19646 @opindex mno-fused-madd
19647 Generate code that uses (does not use) the floating-point multiply and
19648 accumulate instructions. These instructions are generated by default
19649 if hardware floating point is used. The machine-dependent
19650 @option{-mfused-madd} option is now mapped to the machine-independent
19651 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
19652 mapped to @option{-ffp-contract=off}.
19658 Generate code that uses (does not use) the half-word multiply and
19659 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
19660 These instructions are generated by default when targeting those
19667 Generate code that uses (does not use) the string-search @samp{dlmzb}
19668 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
19669 generated by default when targeting those processors.
19671 @item -mno-bit-align
19673 @opindex mno-bit-align
19674 @opindex mbit-align
19675 On System V.4 and embedded PowerPC systems do not (do) force structures
19676 and unions that contain bit-fields to be aligned to the base type of the
19679 For example, by default a structure containing nothing but 8
19680 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
19681 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
19682 the structure is aligned to a 1-byte boundary and is 1 byte in
19685 @item -mno-strict-align
19686 @itemx -mstrict-align
19687 @opindex mno-strict-align
19688 @opindex mstrict-align
19689 On System V.4 and embedded PowerPC systems do not (do) assume that
19690 unaligned memory references are handled by the system.
19692 @item -mrelocatable
19693 @itemx -mno-relocatable
19694 @opindex mrelocatable
19695 @opindex mno-relocatable
19696 Generate code that allows (does not allow) a static executable to be
19697 relocated to a different address at run time. A simple embedded
19698 PowerPC system loader should relocate the entire contents of
19699 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
19700 a table of 32-bit addresses generated by this option. For this to
19701 work, all objects linked together must be compiled with
19702 @option{-mrelocatable} or @option{-mrelocatable-lib}.
19703 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
19705 @item -mrelocatable-lib
19706 @itemx -mno-relocatable-lib
19707 @opindex mrelocatable-lib
19708 @opindex mno-relocatable-lib
19709 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
19710 @code{.fixup} section to allow static executables to be relocated at
19711 run time, but @option{-mrelocatable-lib} does not use the smaller stack
19712 alignment of @option{-mrelocatable}. Objects compiled with
19713 @option{-mrelocatable-lib} may be linked with objects compiled with
19714 any combination of the @option{-mrelocatable} options.
19720 On System V.4 and embedded PowerPC systems do not (do) assume that
19721 register 2 contains a pointer to a global area pointing to the addresses
19722 used in the program.
19725 @itemx -mlittle-endian
19727 @opindex mlittle-endian
19728 On System V.4 and embedded PowerPC systems compile code for the
19729 processor in little-endian mode. The @option{-mlittle-endian} option is
19730 the same as @option{-mlittle}.
19733 @itemx -mbig-endian
19735 @opindex mbig-endian
19736 On System V.4 and embedded PowerPC systems compile code for the
19737 processor in big-endian mode. The @option{-mbig-endian} option is
19738 the same as @option{-mbig}.
19740 @item -mdynamic-no-pic
19741 @opindex mdynamic-no-pic
19742 On Darwin and Mac OS X systems, compile code so that it is not
19743 relocatable, but that its external references are relocatable. The
19744 resulting code is suitable for applications, but not shared
19747 @item -msingle-pic-base
19748 @opindex msingle-pic-base
19749 Treat the register used for PIC addressing as read-only, rather than
19750 loading it in the prologue for each function. The runtime system is
19751 responsible for initializing this register with an appropriate value
19752 before execution begins.
19754 @item -mprioritize-restricted-insns=@var{priority}
19755 @opindex mprioritize-restricted-insns
19756 This option controls the priority that is assigned to
19757 dispatch-slot restricted instructions during the second scheduling
19758 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
19759 or @samp{2} to assign no, highest, or second-highest (respectively)
19760 priority to dispatch-slot restricted
19763 @item -msched-costly-dep=@var{dependence_type}
19764 @opindex msched-costly-dep
19765 This option controls which dependences are considered costly
19766 by the target during instruction scheduling. The argument
19767 @var{dependence_type} takes one of the following values:
19771 No dependence is costly.
19774 All dependences are costly.
19776 @item @samp{true_store_to_load}
19777 A true dependence from store to load is costly.
19779 @item @samp{store_to_load}
19780 Any dependence from store to load is costly.
19783 Any dependence for which the latency is greater than or equal to
19784 @var{number} is costly.
19787 @item -minsert-sched-nops=@var{scheme}
19788 @opindex minsert-sched-nops
19789 This option controls which NOP insertion scheme is used during
19790 the second scheduling pass. The argument @var{scheme} takes one of the
19798 Pad with NOPs any dispatch group that has vacant issue slots,
19799 according to the scheduler's grouping.
19801 @item @samp{regroup_exact}
19802 Insert NOPs to force costly dependent insns into
19803 separate groups. Insert exactly as many NOPs as needed to force an insn
19804 to a new group, according to the estimated processor grouping.
19807 Insert NOPs to force costly dependent insns into
19808 separate groups. Insert @var{number} NOPs to force an insn to a new group.
19812 @opindex mcall-sysv
19813 On System V.4 and embedded PowerPC systems compile code using calling
19814 conventions that adhere to the March 1995 draft of the System V
19815 Application Binary Interface, PowerPC processor supplement. This is the
19816 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
19818 @item -mcall-sysv-eabi
19820 @opindex mcall-sysv-eabi
19821 @opindex mcall-eabi
19822 Specify both @option{-mcall-sysv} and @option{-meabi} options.
19824 @item -mcall-sysv-noeabi
19825 @opindex mcall-sysv-noeabi
19826 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
19828 @item -mcall-aixdesc
19830 On System V.4 and embedded PowerPC systems compile code for the AIX
19834 @opindex mcall-linux
19835 On System V.4 and embedded PowerPC systems compile code for the
19836 Linux-based GNU system.
19838 @item -mcall-freebsd
19839 @opindex mcall-freebsd
19840 On System V.4 and embedded PowerPC systems compile code for the
19841 FreeBSD operating system.
19843 @item -mcall-netbsd
19844 @opindex mcall-netbsd
19845 On System V.4 and embedded PowerPC systems compile code for the
19846 NetBSD operating system.
19848 @item -mcall-openbsd
19849 @opindex mcall-netbsd
19850 On System V.4 and embedded PowerPC systems compile code for the
19851 OpenBSD operating system.
19853 @item -maix-struct-return
19854 @opindex maix-struct-return
19855 Return all structures in memory (as specified by the AIX ABI)@.
19857 @item -msvr4-struct-return
19858 @opindex msvr4-struct-return
19859 Return structures smaller than 8 bytes in registers (as specified by the
19862 @item -mabi=@var{abi-type}
19864 Extend the current ABI with a particular extension, or remove such extension.
19865 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
19866 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble},
19867 @var{elfv1}, @var{elfv2}@.
19871 Extend the current ABI with SPE ABI extensions. This does not change
19872 the default ABI, instead it adds the SPE ABI extensions to the current
19876 @opindex mabi=no-spe
19877 Disable Book-E SPE ABI extensions for the current ABI@.
19879 @item -mabi=ibmlongdouble
19880 @opindex mabi=ibmlongdouble
19881 Change the current ABI to use IBM extended-precision long double.
19882 This is a PowerPC 32-bit SYSV ABI option.
19884 @item -mabi=ieeelongdouble
19885 @opindex mabi=ieeelongdouble
19886 Change the current ABI to use IEEE extended-precision long double.
19887 This is a PowerPC 32-bit Linux ABI option.
19890 @opindex mabi=elfv1
19891 Change the current ABI to use the ELFv1 ABI.
19892 This is the default ABI for big-endian PowerPC 64-bit Linux.
19893 Overriding the default ABI requires special system support and is
19894 likely to fail in spectacular ways.
19897 @opindex mabi=elfv2
19898 Change the current ABI to use the ELFv2 ABI.
19899 This is the default ABI for little-endian PowerPC 64-bit Linux.
19900 Overriding the default ABI requires special system support and is
19901 likely to fail in spectacular ways.
19904 @itemx -mno-prototype
19905 @opindex mprototype
19906 @opindex mno-prototype
19907 On System V.4 and embedded PowerPC systems assume that all calls to
19908 variable argument functions are properly prototyped. Otherwise, the
19909 compiler must insert an instruction before every non-prototyped call to
19910 set or clear bit 6 of the condition code register (@var{CR}) to
19911 indicate whether floating-point values are passed in the floating-point
19912 registers in case the function takes variable arguments. With
19913 @option{-mprototype}, only calls to prototyped variable argument functions
19914 set or clear the bit.
19918 On embedded PowerPC systems, assume that the startup module is called
19919 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
19920 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
19925 On embedded PowerPC systems, assume that the startup module is called
19926 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
19931 On embedded PowerPC systems, assume that the startup module is called
19932 @file{crt0.o} and the standard C libraries are @file{libads.a} and
19935 @item -myellowknife
19936 @opindex myellowknife
19937 On embedded PowerPC systems, assume that the startup module is called
19938 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
19943 On System V.4 and embedded PowerPC systems, specify that you are
19944 compiling for a VxWorks system.
19948 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
19949 header to indicate that @samp{eabi} extended relocations are used.
19955 On System V.4 and embedded PowerPC systems do (do not) adhere to the
19956 Embedded Applications Binary Interface (EABI), which is a set of
19957 modifications to the System V.4 specifications. Selecting @option{-meabi}
19958 means that the stack is aligned to an 8-byte boundary, a function
19959 @code{__eabi} is called from @code{main} to set up the EABI
19960 environment, and the @option{-msdata} option can use both @code{r2} and
19961 @code{r13} to point to two separate small data areas. Selecting
19962 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
19963 no EABI initialization function is called from @code{main}, and the
19964 @option{-msdata} option only uses @code{r13} to point to a single
19965 small data area. The @option{-meabi} option is on by default if you
19966 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
19969 @opindex msdata=eabi
19970 On System V.4 and embedded PowerPC systems, put small initialized
19971 @code{const} global and static data in the @samp{.sdata2} section, which
19972 is pointed to by register @code{r2}. Put small initialized
19973 non-@code{const} global and static data in the @samp{.sdata} section,
19974 which is pointed to by register @code{r13}. Put small uninitialized
19975 global and static data in the @samp{.sbss} section, which is adjacent to
19976 the @samp{.sdata} section. The @option{-msdata=eabi} option is
19977 incompatible with the @option{-mrelocatable} option. The
19978 @option{-msdata=eabi} option also sets the @option{-memb} option.
19981 @opindex msdata=sysv
19982 On System V.4 and embedded PowerPC systems, put small global and static
19983 data in the @samp{.sdata} section, which is pointed to by register
19984 @code{r13}. Put small uninitialized global and static data in the
19985 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
19986 The @option{-msdata=sysv} option is incompatible with the
19987 @option{-mrelocatable} option.
19989 @item -msdata=default
19991 @opindex msdata=default
19993 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
19994 compile code the same as @option{-msdata=eabi}, otherwise compile code the
19995 same as @option{-msdata=sysv}.
19998 @opindex msdata=data
19999 On System V.4 and embedded PowerPC systems, put small global
20000 data in the @samp{.sdata} section. Put small uninitialized global
20001 data in the @samp{.sbss} section. Do not use register @code{r13}
20002 to address small data however. This is the default behavior unless
20003 other @option{-msdata} options are used.
20007 @opindex msdata=none
20009 On embedded PowerPC systems, put all initialized global and static data
20010 in the @samp{.data} section, and all uninitialized data in the
20011 @samp{.bss} section.
20013 @item -mblock-move-inline-limit=@var{num}
20014 @opindex mblock-move-inline-limit
20015 Inline all block moves (such as calls to @code{memcpy} or structure
20016 copies) less than or equal to @var{num} bytes. The minimum value for
20017 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
20018 targets. The default value is target-specific.
20022 @cindex smaller data references (PowerPC)
20023 @cindex .sdata/.sdata2 references (PowerPC)
20024 On embedded PowerPC systems, put global and static items less than or
20025 equal to @var{num} bytes into the small data or BSS sections instead of
20026 the normal data or BSS section. By default, @var{num} is 8. The
20027 @option{-G @var{num}} switch is also passed to the linker.
20028 All modules should be compiled with the same @option{-G @var{num}} value.
20031 @itemx -mno-regnames
20033 @opindex mno-regnames
20034 On System V.4 and embedded PowerPC systems do (do not) emit register
20035 names in the assembly language output using symbolic forms.
20038 @itemx -mno-longcall
20040 @opindex mno-longcall
20041 By default assume that all calls are far away so that a longer and more
20042 expensive calling sequence is required. This is required for calls
20043 farther than 32 megabytes (33,554,432 bytes) from the current location.
20044 A short call is generated if the compiler knows
20045 the call cannot be that far away. This setting can be overridden by
20046 the @code{shortcall} function attribute, or by @code{#pragma
20049 Some linkers are capable of detecting out-of-range calls and generating
20050 glue code on the fly. On these systems, long calls are unnecessary and
20051 generate slower code. As of this writing, the AIX linker can do this,
20052 as can the GNU linker for PowerPC/64. It is planned to add this feature
20053 to the GNU linker for 32-bit PowerPC systems as well.
20055 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
20056 callee, L42}, plus a @dfn{branch island} (glue code). The two target
20057 addresses represent the callee and the branch island. The
20058 Darwin/PPC linker prefers the first address and generates a @code{bl
20059 callee} if the PPC @code{bl} instruction reaches the callee directly;
20060 otherwise, the linker generates @code{bl L42} to call the branch
20061 island. The branch island is appended to the body of the
20062 calling function; it computes the full 32-bit address of the callee
20065 On Mach-O (Darwin) systems, this option directs the compiler emit to
20066 the glue for every direct call, and the Darwin linker decides whether
20067 to use or discard it.
20069 In the future, GCC may ignore all longcall specifications
20070 when the linker is known to generate glue.
20072 @item -mtls-markers
20073 @itemx -mno-tls-markers
20074 @opindex mtls-markers
20075 @opindex mno-tls-markers
20076 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
20077 specifying the function argument. The relocation allows the linker to
20078 reliably associate function call with argument setup instructions for
20079 TLS optimization, which in turn allows GCC to better schedule the
20084 Adds support for multithreading with the @dfn{pthreads} library.
20085 This option sets flags for both the preprocessor and linker.
20090 This option enables use of the reciprocal estimate and
20091 reciprocal square root estimate instructions with additional
20092 Newton-Raphson steps to increase precision instead of doing a divide or
20093 square root and divide for floating-point arguments. You should use
20094 the @option{-ffast-math} option when using @option{-mrecip} (or at
20095 least @option{-funsafe-math-optimizations},
20096 @option{-finite-math-only}, @option{-freciprocal-math} and
20097 @option{-fno-trapping-math}). Note that while the throughput of the
20098 sequence is generally higher than the throughput of the non-reciprocal
20099 instruction, the precision of the sequence can be decreased by up to 2
20100 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
20103 @item -mrecip=@var{opt}
20104 @opindex mrecip=opt
20105 This option controls which reciprocal estimate instructions
20106 may be used. @var{opt} is a comma-separated list of options, which may
20107 be preceded by a @code{!} to invert the option:
20108 @code{all}: enable all estimate instructions,
20109 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
20110 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
20111 @code{div}: enable the reciprocal approximation instructions for both single and double precision;
20112 @code{divf}: enable the single-precision reciprocal approximation instructions;
20113 @code{divd}: enable the double-precision reciprocal approximation instructions;
20114 @code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
20115 @code{rsqrtf}: enable the single-precision reciprocal square root approximation instructions;
20116 @code{rsqrtd}: enable the double-precision reciprocal square root approximation instructions;
20118 So, for example, @option{-mrecip=all,!rsqrtd} enables
20119 all of the reciprocal estimate instructions, except for the
20120 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
20121 which handle the double-precision reciprocal square root calculations.
20123 @item -mrecip-precision
20124 @itemx -mno-recip-precision
20125 @opindex mrecip-precision
20126 Assume (do not assume) that the reciprocal estimate instructions
20127 provide higher-precision estimates than is mandated by the PowerPC
20128 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
20129 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
20130 The double-precision square root estimate instructions are not generated by
20131 default on low-precision machines, since they do not provide an
20132 estimate that converges after three steps.
20134 @item -mveclibabi=@var{type}
20135 @opindex mveclibabi
20136 Specifies the ABI type to use for vectorizing intrinsics using an
20137 external library. The only type supported at present is @code{mass},
20138 which specifies to use IBM's Mathematical Acceleration Subsystem
20139 (MASS) libraries for vectorizing intrinsics using external libraries.
20140 GCC currently emits calls to @code{acosd2}, @code{acosf4},
20141 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
20142 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
20143 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
20144 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
20145 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
20146 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
20147 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
20148 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
20149 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
20150 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
20151 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
20152 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
20153 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
20154 for power7. Both @option{-ftree-vectorize} and
20155 @option{-funsafe-math-optimizations} must also be enabled. The MASS
20156 libraries must be specified at link time.
20161 Generate (do not generate) the @code{friz} instruction when the
20162 @option{-funsafe-math-optimizations} option is used to optimize
20163 rounding of floating-point values to 64-bit integer and back to floating
20164 point. The @code{friz} instruction does not return the same value if
20165 the floating-point number is too large to fit in an integer.
20167 @item -mpointers-to-nested-functions
20168 @itemx -mno-pointers-to-nested-functions
20169 @opindex mpointers-to-nested-functions
20170 Generate (do not generate) code to load up the static chain register
20171 (@var{r11}) when calling through a pointer on AIX and 64-bit Linux
20172 systems where a function pointer points to a 3-word descriptor giving
20173 the function address, TOC value to be loaded in register @var{r2}, and
20174 static chain value to be loaded in register @var{r11}. The
20175 @option{-mpointers-to-nested-functions} is on by default. You cannot
20176 call through pointers to nested functions or pointers
20177 to functions compiled in other languages that use the static chain if
20178 you use the @option{-mno-pointers-to-nested-functions}.
20180 @item -msave-toc-indirect
20181 @itemx -mno-save-toc-indirect
20182 @opindex msave-toc-indirect
20183 Generate (do not generate) code to save the TOC value in the reserved
20184 stack location in the function prologue if the function calls through
20185 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
20186 saved in the prologue, it is saved just before the call through the
20187 pointer. The @option{-mno-save-toc-indirect} option is the default.
20189 @item -mcompat-align-parm
20190 @itemx -mno-compat-align-parm
20191 @opindex mcompat-align-parm
20192 Generate (do not generate) code to pass structure parameters with a
20193 maximum alignment of 64 bits, for compatibility with older versions
20196 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
20197 structure parameter on a 128-bit boundary when that structure contained
20198 a member requiring 128-bit alignment. This is corrected in more
20199 recent versions of GCC. This option may be used to generate code
20200 that is compatible with functions compiled with older versions of
20203 The @option{-mno-compat-align-parm} option is the default.
20207 @subsection RX Options
20210 These command-line options are defined for RX targets:
20213 @item -m64bit-doubles
20214 @itemx -m32bit-doubles
20215 @opindex m64bit-doubles
20216 @opindex m32bit-doubles
20217 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20218 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20219 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
20220 works on 32-bit values, which is why the default is
20221 @option{-m32bit-doubles}.
20227 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
20228 floating-point hardware. The default is enabled for the @var{RX600}
20229 series and disabled for the @var{RX200} series.
20231 Floating-point instructions are only generated for 32-bit floating-point
20232 values, however, so the FPU hardware is not used for doubles if the
20233 @option{-m64bit-doubles} option is used.
20235 @emph{Note} If the @option{-fpu} option is enabled then
20236 @option{-funsafe-math-optimizations} is also enabled automatically.
20237 This is because the RX FPU instructions are themselves unsafe.
20239 @item -mcpu=@var{name}
20241 Selects the type of RX CPU to be targeted. Currently three types are
20242 supported, the generic @var{RX600} and @var{RX200} series hardware and
20243 the specific @var{RX610} CPU. The default is @var{RX600}.
20245 The only difference between @var{RX600} and @var{RX610} is that the
20246 @var{RX610} does not support the @code{MVTIPL} instruction.
20248 The @var{RX200} series does not have a hardware floating-point unit
20249 and so @option{-nofpu} is enabled by default when this type is
20252 @item -mbig-endian-data
20253 @itemx -mlittle-endian-data
20254 @opindex mbig-endian-data
20255 @opindex mlittle-endian-data
20256 Store data (but not code) in the big-endian format. The default is
20257 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
20260 @item -msmall-data-limit=@var{N}
20261 @opindex msmall-data-limit
20262 Specifies the maximum size in bytes of global and static variables
20263 which can be placed into the small data area. Using the small data
20264 area can lead to smaller and faster code, but the size of area is
20265 limited and it is up to the programmer to ensure that the area does
20266 not overflow. Also when the small data area is used one of the RX's
20267 registers (usually @code{r13}) is reserved for use pointing to this
20268 area, so it is no longer available for use by the compiler. This
20269 could result in slower and/or larger code if variables are pushed onto
20270 the stack instead of being held in this register.
20272 Note, common variables (variables that have not been initialized) and
20273 constants are not placed into the small data area as they are assigned
20274 to other sections in the output executable.
20276 The default value is zero, which disables this feature. Note, this
20277 feature is not enabled by default with higher optimization levels
20278 (@option{-O2} etc) because of the potentially detrimental effects of
20279 reserving a register. It is up to the programmer to experiment and
20280 discover whether this feature is of benefit to their program. See the
20281 description of the @option{-mpid} option for a description of how the
20282 actual register to hold the small data area pointer is chosen.
20288 Use the simulator runtime. The default is to use the libgloss
20289 board-specific runtime.
20291 @item -mas100-syntax
20292 @itemx -mno-as100-syntax
20293 @opindex mas100-syntax
20294 @opindex mno-as100-syntax
20295 When generating assembler output use a syntax that is compatible with
20296 Renesas's AS100 assembler. This syntax can also be handled by the GAS
20297 assembler, but it has some restrictions so it is not generated by default.
20299 @item -mmax-constant-size=@var{N}
20300 @opindex mmax-constant-size
20301 Specifies the maximum size, in bytes, of a constant that can be used as
20302 an operand in a RX instruction. Although the RX instruction set does
20303 allow constants of up to 4 bytes in length to be used in instructions,
20304 a longer value equates to a longer instruction. Thus in some
20305 circumstances it can be beneficial to restrict the size of constants
20306 that are used in instructions. Constants that are too big are instead
20307 placed into a constant pool and referenced via register indirection.
20309 The value @var{N} can be between 0 and 4. A value of 0 (the default)
20310 or 4 means that constants of any size are allowed.
20314 Enable linker relaxation. Linker relaxation is a process whereby the
20315 linker attempts to reduce the size of a program by finding shorter
20316 versions of various instructions. Disabled by default.
20318 @item -mint-register=@var{N}
20319 @opindex mint-register
20320 Specify the number of registers to reserve for fast interrupt handler
20321 functions. The value @var{N} can be between 0 and 4. A value of 1
20322 means that register @code{r13} is reserved for the exclusive use
20323 of fast interrupt handlers. A value of 2 reserves @code{r13} and
20324 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
20325 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
20326 A value of 0, the default, does not reserve any registers.
20328 @item -msave-acc-in-interrupts
20329 @opindex msave-acc-in-interrupts
20330 Specifies that interrupt handler functions should preserve the
20331 accumulator register. This is only necessary if normal code might use
20332 the accumulator register, for example because it performs 64-bit
20333 multiplications. The default is to ignore the accumulator as this
20334 makes the interrupt handlers faster.
20340 Enables the generation of position independent data. When enabled any
20341 access to constant data is done via an offset from a base address
20342 held in a register. This allows the location of constant data to be
20343 determined at run time without requiring the executable to be
20344 relocated, which is a benefit to embedded applications with tight
20345 memory constraints. Data that can be modified is not affected by this
20348 Note, using this feature reserves a register, usually @code{r13}, for
20349 the constant data base address. This can result in slower and/or
20350 larger code, especially in complicated functions.
20352 The actual register chosen to hold the constant data base address
20353 depends upon whether the @option{-msmall-data-limit} and/or the
20354 @option{-mint-register} command-line options are enabled. Starting
20355 with register @code{r13} and proceeding downwards, registers are
20356 allocated first to satisfy the requirements of @option{-mint-register},
20357 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
20358 is possible for the small data area register to be @code{r8} if both
20359 @option{-mint-register=4} and @option{-mpid} are specified on the
20362 By default this feature is not enabled. The default can be restored
20363 via the @option{-mno-pid} command-line option.
20365 @item -mno-warn-multiple-fast-interrupts
20366 @itemx -mwarn-multiple-fast-interrupts
20367 @opindex mno-warn-multiple-fast-interrupts
20368 @opindex mwarn-multiple-fast-interrupts
20369 Prevents GCC from issuing a warning message if it finds more than one
20370 fast interrupt handler when it is compiling a file. The default is to
20371 issue a warning for each extra fast interrupt handler found, as the RX
20372 only supports one such interrupt.
20376 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
20377 has special significance to the RX port when used with the
20378 @code{interrupt} function attribute. This attribute indicates a
20379 function intended to process fast interrupts. GCC ensures
20380 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
20381 and/or @code{r13} and only provided that the normal use of the
20382 corresponding registers have been restricted via the
20383 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
20386 @node S/390 and zSeries Options
20387 @subsection S/390 and zSeries Options
20388 @cindex S/390 and zSeries Options
20390 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
20394 @itemx -msoft-float
20395 @opindex mhard-float
20396 @opindex msoft-float
20397 Use (do not use) the hardware floating-point instructions and registers
20398 for floating-point operations. When @option{-msoft-float} is specified,
20399 functions in @file{libgcc.a} are used to perform floating-point
20400 operations. When @option{-mhard-float} is specified, the compiler
20401 generates IEEE floating-point instructions. This is the default.
20404 @itemx -mno-hard-dfp
20406 @opindex mno-hard-dfp
20407 Use (do not use) the hardware decimal-floating-point instructions for
20408 decimal-floating-point operations. When @option{-mno-hard-dfp} is
20409 specified, functions in @file{libgcc.a} are used to perform
20410 decimal-floating-point operations. When @option{-mhard-dfp} is
20411 specified, the compiler generates decimal-floating-point hardware
20412 instructions. This is the default for @option{-march=z9-ec} or higher.
20414 @item -mlong-double-64
20415 @itemx -mlong-double-128
20416 @opindex mlong-double-64
20417 @opindex mlong-double-128
20418 These switches control the size of @code{long double} type. A size
20419 of 64 bits makes the @code{long double} type equivalent to the @code{double}
20420 type. This is the default.
20423 @itemx -mno-backchain
20424 @opindex mbackchain
20425 @opindex mno-backchain
20426 Store (do not store) the address of the caller's frame as backchain pointer
20427 into the callee's stack frame.
20428 A backchain may be needed to allow debugging using tools that do not understand
20429 DWARF 2 call frame information.
20430 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
20431 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
20432 the backchain is placed into the topmost word of the 96/160 byte register
20435 In general, code compiled with @option{-mbackchain} is call-compatible with
20436 code compiled with @option{-mmo-backchain}; however, use of the backchain
20437 for debugging purposes usually requires that the whole binary is built with
20438 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
20439 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20440 to build a linux kernel use @option{-msoft-float}.
20442 The default is to not maintain the backchain.
20444 @item -mpacked-stack
20445 @itemx -mno-packed-stack
20446 @opindex mpacked-stack
20447 @opindex mno-packed-stack
20448 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
20449 specified, the compiler uses the all fields of the 96/160 byte register save
20450 area only for their default purpose; unused fields still take up stack space.
20451 When @option{-mpacked-stack} is specified, register save slots are densely
20452 packed at the top of the register save area; unused space is reused for other
20453 purposes, allowing for more efficient use of the available stack space.
20454 However, when @option{-mbackchain} is also in effect, the topmost word of
20455 the save area is always used to store the backchain, and the return address
20456 register is always saved two words below the backchain.
20458 As long as the stack frame backchain is not used, code generated with
20459 @option{-mpacked-stack} is call-compatible with code generated with
20460 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
20461 S/390 or zSeries generated code that uses the stack frame backchain at run
20462 time, not just for debugging purposes. Such code is not call-compatible
20463 with code compiled with @option{-mpacked-stack}. Also, note that the
20464 combination of @option{-mbackchain},
20465 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20466 to build a linux kernel use @option{-msoft-float}.
20468 The default is to not use the packed stack layout.
20471 @itemx -mno-small-exec
20472 @opindex msmall-exec
20473 @opindex mno-small-exec
20474 Generate (or do not generate) code using the @code{bras} instruction
20475 to do subroutine calls.
20476 This only works reliably if the total executable size does not
20477 exceed 64k. The default is to use the @code{basr} instruction instead,
20478 which does not have this limitation.
20484 When @option{-m31} is specified, generate code compliant to the
20485 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
20486 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
20487 particular to generate 64-bit instructions. For the @samp{s390}
20488 targets, the default is @option{-m31}, while the @samp{s390x}
20489 targets default to @option{-m64}.
20495 When @option{-mzarch} is specified, generate code using the
20496 instructions available on z/Architecture.
20497 When @option{-mesa} is specified, generate code using the
20498 instructions available on ESA/390. Note that @option{-mesa} is
20499 not possible with @option{-m64}.
20500 When generating code compliant to the GNU/Linux for S/390 ABI,
20501 the default is @option{-mesa}. When generating code compliant
20502 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
20508 Generate (or do not generate) code using the @code{mvcle} instruction
20509 to perform block moves. When @option{-mno-mvcle} is specified,
20510 use a @code{mvc} loop instead. This is the default unless optimizing for
20517 Print (or do not print) additional debug information when compiling.
20518 The default is to not print debug information.
20520 @item -march=@var{cpu-type}
20522 Generate code that runs on @var{cpu-type}, which is the name of a system
20523 representing a certain processor type. Possible values for
20524 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
20525 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
20526 When generating code using the instructions available on z/Architecture,
20527 the default is @option{-march=z900}. Otherwise, the default is
20528 @option{-march=g5}.
20530 @item -mtune=@var{cpu-type}
20532 Tune to @var{cpu-type} everything applicable about the generated code,
20533 except for the ABI and the set of available instructions.
20534 The list of @var{cpu-type} values is the same as for @option{-march}.
20535 The default is the value used for @option{-march}.
20538 @itemx -mno-tpf-trace
20539 @opindex mtpf-trace
20540 @opindex mno-tpf-trace
20541 Generate code that adds (does not add) in TPF OS specific branches to trace
20542 routines in the operating system. This option is off by default, even
20543 when compiling for the TPF OS@.
20546 @itemx -mno-fused-madd
20547 @opindex mfused-madd
20548 @opindex mno-fused-madd
20549 Generate code that uses (does not use) the floating-point multiply and
20550 accumulate instructions. These instructions are generated by default if
20551 hardware floating point is used.
20553 @item -mwarn-framesize=@var{framesize}
20554 @opindex mwarn-framesize
20555 Emit a warning if the current function exceeds the given frame size. Because
20556 this is a compile-time check it doesn't need to be a real problem when the program
20557 runs. It is intended to identify functions that most probably cause
20558 a stack overflow. It is useful to be used in an environment with limited stack
20559 size e.g.@: the linux kernel.
20561 @item -mwarn-dynamicstack
20562 @opindex mwarn-dynamicstack
20563 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
20564 arrays. This is generally a bad idea with a limited stack size.
20566 @item -mstack-guard=@var{stack-guard}
20567 @itemx -mstack-size=@var{stack-size}
20568 @opindex mstack-guard
20569 @opindex mstack-size
20570 If these options are provided the S/390 back end emits additional instructions in
20571 the function prologue that trigger a trap if the stack size is @var{stack-guard}
20572 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
20573 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
20574 the frame size of the compiled function is chosen.
20575 These options are intended to be used to help debugging stack overflow problems.
20576 The additionally emitted code causes only little overhead and hence can also be
20577 used in production-like systems without greater performance degradation. The given
20578 values have to be exact powers of 2 and @var{stack-size} has to be greater than
20579 @var{stack-guard} without exceeding 64k.
20580 In order to be efficient the extra code makes the assumption that the stack starts
20581 at an address aligned to the value given by @var{stack-size}.
20582 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
20584 @item -mhotpatch[=@var{halfwords}]
20585 @itemx -mno-hotpatch
20587 If the hotpatch option is enabled, a ``hot-patching'' function
20588 prologue is generated for all functions in the compilation unit.
20589 The funtion label is prepended with the given number of two-byte
20590 Nop instructions (@var{halfwords}, maximum 1000000) or 12 Nop
20591 instructions if no argument is present. Functions with a
20592 hot-patching prologue are never inlined automatically, and a
20593 hot-patching prologue is never generated for functions functions
20594 that are explicitly inline.
20596 This option can be overridden for individual functions with the
20597 @code{hotpatch} attribute.
20600 @node Score Options
20601 @subsection Score Options
20602 @cindex Score Options
20604 These options are defined for Score implementations:
20609 Compile code for big-endian mode. This is the default.
20613 Compile code for little-endian mode.
20617 Disable generation of @code{bcnz} instructions.
20621 Enable generation of unaligned load and store instructions.
20625 Enable the use of multiply-accumulate instructions. Disabled by default.
20629 Specify the SCORE5 as the target architecture.
20633 Specify the SCORE5U of the target architecture.
20637 Specify the SCORE7 as the target architecture. This is the default.
20641 Specify the SCORE7D as the target architecture.
20645 @subsection SH Options
20647 These @samp{-m} options are defined for the SH implementations:
20652 Generate code for the SH1.
20656 Generate code for the SH2.
20659 Generate code for the SH2e.
20663 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
20664 that the floating-point unit is not used.
20666 @item -m2a-single-only
20667 @opindex m2a-single-only
20668 Generate code for the SH2a-FPU, in such a way that no double-precision
20669 floating-point operations are used.
20672 @opindex m2a-single
20673 Generate code for the SH2a-FPU assuming the floating-point unit is in
20674 single-precision mode by default.
20678 Generate code for the SH2a-FPU assuming the floating-point unit is in
20679 double-precision mode by default.
20683 Generate code for the SH3.
20687 Generate code for the SH3e.
20691 Generate code for the SH4 without a floating-point unit.
20693 @item -m4-single-only
20694 @opindex m4-single-only
20695 Generate code for the SH4 with a floating-point unit that only
20696 supports single-precision arithmetic.
20700 Generate code for the SH4 assuming the floating-point unit is in
20701 single-precision mode by default.
20705 Generate code for the SH4.
20709 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
20710 floating-point unit is not used.
20712 @item -m4a-single-only
20713 @opindex m4a-single-only
20714 Generate code for the SH4a, in such a way that no double-precision
20715 floating-point operations are used.
20718 @opindex m4a-single
20719 Generate code for the SH4a assuming the floating-point unit is in
20720 single-precision mode by default.
20724 Generate code for the SH4a.
20728 Same as @option{-m4a-nofpu}, except that it implicitly passes
20729 @option{-dsp} to the assembler. GCC doesn't generate any DSP
20730 instructions at the moment.
20734 Compile code for the processor in big-endian mode.
20738 Compile code for the processor in little-endian mode.
20742 Align doubles at 64-bit boundaries. Note that this changes the calling
20743 conventions, and thus some functions from the standard C library do
20744 not work unless you recompile it first with @option{-mdalign}.
20748 Shorten some address references at link time, when possible; uses the
20749 linker option @option{-relax}.
20753 Use 32-bit offsets in @code{switch} tables. The default is to use
20758 Enable the use of bit manipulation instructions on SH2A.
20762 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
20763 alignment constraints.
20767 Comply with the calling conventions defined by Renesas.
20771 Comply with the calling conventions defined by Renesas.
20775 Comply with the calling conventions defined for GCC before the Renesas
20776 conventions were available. This option is the default for all
20777 targets of the SH toolchain.
20780 @opindex mnomacsave
20781 Mark the @code{MAC} register as call-clobbered, even if
20782 @option{-mhitachi} is given.
20788 Control the IEEE compliance of floating-point comparisons, which affects the
20789 handling of cases where the result of a comparison is unordered. By default
20790 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
20791 enabled @option{-mno-ieee} is implicitly set, which results in faster
20792 floating-point greater-equal and less-equal comparisons. The implcit settings
20793 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
20795 @item -minline-ic_invalidate
20796 @opindex minline-ic_invalidate
20797 Inline code to invalidate instruction cache entries after setting up
20798 nested function trampolines.
20799 This option has no effect if @option{-musermode} is in effect and the selected
20800 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
20802 If the selected code generation option does not allow the use of the @code{icbi}
20803 instruction, and @option{-musermode} is not in effect, the inlined code
20804 manipulates the instruction cache address array directly with an associative
20805 write. This not only requires privileged mode at run time, but it also
20806 fails if the cache line had been mapped via the TLB and has become unmapped.
20810 Dump instruction size and location in the assembly code.
20813 @opindex mpadstruct
20814 This option is deprecated. It pads structures to multiple of 4 bytes,
20815 which is incompatible with the SH ABI@.
20817 @item -matomic-model=@var{model}
20818 @opindex matomic-model=@var{model}
20819 Sets the model of atomic operations and additional parameters as a comma
20820 separated list. For details on the atomic built-in functions see
20821 @ref{__atomic Builtins}. The following models and parameters are supported:
20826 Disable compiler generated atomic sequences and emit library calls for atomic
20827 operations. This is the default if the target is not @code{sh-*-linux*}.
20830 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
20831 built-in functions. The generated atomic sequences require additional support
20832 from the interrupt/exception handling code of the system and are only suitable
20833 for SH3* and SH4* single-core systems. This option is enabled by default when
20834 the target is @code{sh-*-linux*} and SH3* or SH4*. When the target is SH4A,
20835 this option will also partially utilize the hardware atomic instructions
20836 @code{movli.l} and @code{movco.l} to create more efficient code, unless
20837 @samp{strict} is specified.
20840 Generate software atomic sequences that use a variable in the thread control
20841 block. This is a variation of the gUSA sequences which can also be used on
20842 SH1* and SH2* targets. The generated atomic sequences require additional
20843 support from the interrupt/exception handling code of the system and are only
20844 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
20845 parameter has to be specified as well.
20848 Generate software atomic sequences that temporarily disable interrupts by
20849 setting @code{SR.IMASK = 1111}. This model works only when the program runs
20850 in privileged mode and is only suitable for single-core systems. Additional
20851 support from the interrupt/exception handling code of the system is not
20852 required. This model is enabled by default when the target is
20853 @code{sh-*-linux*} and SH1* or SH2*.
20856 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
20857 instructions only. This is only available on SH4A and is suitable for
20858 multi-core systems. Since the hardware instructions support only 32 bit atomic
20859 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
20860 Code compiled with this option will also be compatible with other software
20861 atomic model interrupt/exception handling systems if executed on an SH4A
20862 system. Additional support from the interrupt/exception handling code of the
20863 system is not required for this model.
20866 This parameter specifies the offset in bytes of the variable in the thread
20867 control block structure that should be used by the generated atomic sequences
20868 when the @samp{soft-tcb} model has been selected. For other models this
20869 parameter is ignored. The specified value must be an integer multiple of four
20870 and in the range 0-1020.
20873 This parameter prevents mixed usage of multiple atomic models, even though they
20874 would be compatible, and will make the compiler generate atomic sequences of the
20875 specified model only.
20881 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
20882 Notice that depending on the particular hardware and software configuration
20883 this can degrade overall performance due to the operand cache line flushes
20884 that are implied by the @code{tas.b} instruction. On multi-core SH4A
20885 processors the @code{tas.b} instruction must be used with caution since it
20886 can result in data corruption for certain cache configurations.
20890 Optimize for space instead of speed. Implied by @option{-Os}.
20893 @opindex mprefergot
20894 When generating position-independent code, emit function calls using
20895 the Global Offset Table instead of the Procedure Linkage Table.
20899 Don't generate privileged mode only code. This option
20900 implies @option{-mno-inline-ic_invalidate}
20901 if the inlined code would not work in user mode.
20902 This is the default when the target is @code{sh-*-linux*}.
20904 @item -multcost=@var{number}
20905 @opindex multcost=@var{number}
20906 Set the cost to assume for a multiply insn.
20908 @item -mdiv=@var{strategy}
20909 @opindex mdiv=@var{strategy}
20910 Set the division strategy to be used for integer division operations.
20911 For SHmedia @var{strategy} can be one of:
20916 Performs the operation in floating point. This has a very high latency,
20917 but needs only a few instructions, so it might be a good choice if
20918 your code has enough easily-exploitable ILP to allow the compiler to
20919 schedule the floating-point instructions together with other instructions.
20920 Division by zero causes a floating-point exception.
20923 Uses integer operations to calculate the inverse of the divisor,
20924 and then multiplies the dividend with the inverse. This strategy allows
20925 CSE and hoisting of the inverse calculation. Division by zero calculates
20926 an unspecified result, but does not trap.
20929 A variant of @samp{inv} where, if no CSE or hoisting opportunities
20930 have been found, or if the entire operation has been hoisted to the same
20931 place, the last stages of the inverse calculation are intertwined with the
20932 final multiply to reduce the overall latency, at the expense of using a few
20933 more instructions, and thus offering fewer scheduling opportunities with
20937 Calls a library function that usually implements the @samp{inv:minlat}
20939 This gives high code density for @code{m5-*media-nofpu} compilations.
20942 Uses a different entry point of the same library function, where it
20943 assumes that a pointer to a lookup table has already been set up, which
20944 exposes the pointer load to CSE and code hoisting optimizations.
20949 Use the @samp{inv} algorithm for initial
20950 code generation, but if the code stays unoptimized, revert to the @samp{call},
20951 @samp{call2}, or @samp{fp} strategies, respectively. Note that the
20952 potentially-trapping side effect of division by zero is carried by a
20953 separate instruction, so it is possible that all the integer instructions
20954 are hoisted out, but the marker for the side effect stays where it is.
20955 A recombination to floating-point operations or a call is not possible
20960 Variants of the @samp{inv:minlat} strategy. In the case
20961 that the inverse calculation is not separated from the multiply, they speed
20962 up division where the dividend fits into 20 bits (plus sign where applicable)
20963 by inserting a test to skip a number of operations in this case; this test
20964 slows down the case of larger dividends. @samp{inv20u} assumes the case of a such
20965 a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely.
20969 For targets other than SHmedia @var{strategy} can be one of:
20974 Calls a library function that uses the single-step division instruction
20975 @code{div1} to perform the operation. Division by zero calculates an
20976 unspecified result and does not trap. This is the default except for SH4,
20977 SH2A and SHcompact.
20980 Calls a library function that performs the operation in double precision
20981 floating point. Division by zero causes a floating-point exception. This is
20982 the default for SHcompact with FPU. Specifying this for targets that do not
20983 have a double precision FPU will default to @code{call-div1}.
20986 Calls a library function that uses a lookup table for small divisors and
20987 the @code{div1} instruction with case distinction for larger divisors. Division
20988 by zero calculates an unspecified result and does not trap. This is the default
20989 for SH4. Specifying this for targets that do not have dynamic shift
20990 instructions will default to @code{call-div1}.
20994 When a division strategy has not been specified the default strategy will be
20995 selected based on the current target. For SH2A the default strategy is to
20996 use the @code{divs} and @code{divu} instructions instead of library function
20999 @item -maccumulate-outgoing-args
21000 @opindex maccumulate-outgoing-args
21001 Reserve space once for outgoing arguments in the function prologue rather
21002 than around each call. Generally beneficial for performance and size. Also
21003 needed for unwinding to avoid changing the stack frame around conditional code.
21005 @item -mdivsi3_libfunc=@var{name}
21006 @opindex mdivsi3_libfunc=@var{name}
21007 Set the name of the library function used for 32-bit signed division to
21009 This only affects the name used in the @samp{call} and @samp{inv:call}
21010 division strategies, and the compiler still expects the same
21011 sets of input/output/clobbered registers as if this option were not present.
21013 @item -mfixed-range=@var{register-range}
21014 @opindex mfixed-range
21015 Generate code treating the given register range as fixed registers.
21016 A fixed register is one that the register allocator can not use. This is
21017 useful when compiling kernel code. A register range is specified as
21018 two registers separated by a dash. Multiple register ranges can be
21019 specified separated by a comma.
21021 @item -mindexed-addressing
21022 @opindex mindexed-addressing
21023 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
21024 This is only safe if the hardware and/or OS implement 32-bit wrap-around
21025 semantics for the indexed addressing mode. The architecture allows the
21026 implementation of processors with 64-bit MMU, which the OS could use to
21027 get 32-bit addressing, but since no current hardware implementation supports
21028 this or any other way to make the indexed addressing mode safe to use in
21029 the 32-bit ABI, the default is @option{-mno-indexed-addressing}.
21031 @item -mgettrcost=@var{number}
21032 @opindex mgettrcost=@var{number}
21033 Set the cost assumed for the @code{gettr} instruction to @var{number}.
21034 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
21038 Assume @code{pt*} instructions won't trap. This generally generates
21039 better-scheduled code, but is unsafe on current hardware.
21040 The current architecture
21041 definition says that @code{ptabs} and @code{ptrel} trap when the target
21043 This has the unintentional effect of making it unsafe to schedule these
21044 instructions before a branch, or hoist them out of a loop. For example,
21045 @code{__do_global_ctors}, a part of @file{libgcc}
21046 that runs constructors at program
21047 startup, calls functions in a list which is delimited by @minus{}1. With the
21048 @option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1.
21049 That means that all the constructors run a bit more quickly, but when
21050 the loop comes to the end of the list, the program crashes because @code{ptabs}
21051 loads @minus{}1 into a target register.
21053 Since this option is unsafe for any
21054 hardware implementing the current architecture specification, the default
21055 is @option{-mno-pt-fixed}. Unless specified explicitly with
21056 @option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100};
21057 this deters register allocation from using target registers for storing
21060 @item -minvalid-symbols
21061 @opindex minvalid-symbols
21062 Assume symbols might be invalid. Ordinary function symbols generated by
21063 the compiler are always valid to load with
21064 @code{movi}/@code{shori}/@code{ptabs} or
21065 @code{movi}/@code{shori}/@code{ptrel},
21066 but with assembler and/or linker tricks it is possible
21067 to generate symbols that cause @code{ptabs} or @code{ptrel} to trap.
21068 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
21069 It prevents cross-basic-block CSE, hoisting and most scheduling
21070 of symbol loads. The default is @option{-mno-invalid-symbols}.
21072 @item -mbranch-cost=@var{num}
21073 @opindex mbranch-cost=@var{num}
21074 Assume @var{num} to be the cost for a branch instruction. Higher numbers
21075 make the compiler try to generate more branch-free code if possible.
21076 If not specified the value is selected depending on the processor type that
21077 is being compiled for.
21080 @itemx -mno-zdcbranch
21081 @opindex mzdcbranch
21082 @opindex mno-zdcbranch
21083 Assume (do not assume) that zero displacement conditional branch instructions
21084 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
21085 compiler will try to prefer zero displacement branch code sequences. This is
21086 enabled by default when generating code for SH4 and SH4A. It can be explicitly
21087 disabled by specifying @option{-mno-zdcbranch}.
21090 @itemx -mno-fused-madd
21091 @opindex mfused-madd
21092 @opindex mno-fused-madd
21093 Generate code that uses (does not use) the floating-point multiply and
21094 accumulate instructions. These instructions are generated by default
21095 if hardware floating point is used. The machine-dependent
21096 @option{-mfused-madd} option is now mapped to the machine-independent
21097 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21098 mapped to @option{-ffp-contract=off}.
21104 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
21105 and cosine approximations. The option @code{-mfsca} must be used in
21106 combination with @code{-funsafe-math-optimizations}. It is enabled by default
21107 when generating code for SH4A. Using @code{-mno-fsca} disables sine and cosine
21108 approximations even if @code{-funsafe-math-optimizations} is in effect.
21114 Allow or disallow the compiler to emit the @code{fsrra} instruction for
21115 reciprocal square root approximations. The option @code{-mfsrra} must be used
21116 in combination with @code{-funsafe-math-optimizations} and
21117 @code{-ffinite-math-only}. It is enabled by default when generating code for
21118 SH4A. Using @code{-mno-fsrra} disables reciprocal square root approximations
21119 even if @code{-funsafe-math-optimizations} and @code{-ffinite-math-only} are
21122 @item -mpretend-cmove
21123 @opindex mpretend-cmove
21124 Prefer zero-displacement conditional branches for conditional move instruction
21125 patterns. This can result in faster code on the SH4 processor.
21129 @node Solaris 2 Options
21130 @subsection Solaris 2 Options
21131 @cindex Solaris 2 options
21133 These @samp{-m} options are supported on Solaris 2:
21136 @item -mclear-hwcap
21137 @opindex mclear-hwcap
21138 @option{-mclear-hwcap} tells the compiler to remove the hardware
21139 capabilities generated by the Solaris assembler. This is only necessary
21140 when object files use ISA extensions not supported by the current
21141 machine, but check at runtime whether or not to use them.
21143 @item -mimpure-text
21144 @opindex mimpure-text
21145 @option{-mimpure-text}, used in addition to @option{-shared}, tells
21146 the compiler to not pass @option{-z text} to the linker when linking a
21147 shared object. Using this option, you can link position-dependent
21148 code into a shared object.
21150 @option{-mimpure-text} suppresses the ``relocations remain against
21151 allocatable but non-writable sections'' linker error message.
21152 However, the necessary relocations trigger copy-on-write, and the
21153 shared object is not actually shared across processes. Instead of
21154 using @option{-mimpure-text}, you should compile all source code with
21155 @option{-fpic} or @option{-fPIC}.
21159 These switches are supported in addition to the above on Solaris 2:
21164 Add support for multithreading using the POSIX threads library. This
21165 option sets flags for both the preprocessor and linker. This option does
21166 not affect the thread safety of object code produced by the compiler or
21167 that of libraries supplied with it.
21171 This is a synonym for @option{-pthreads}.
21174 @node SPARC Options
21175 @subsection SPARC Options
21176 @cindex SPARC options
21178 These @samp{-m} options are supported on the SPARC:
21181 @item -mno-app-regs
21183 @opindex mno-app-regs
21185 Specify @option{-mapp-regs} to generate output using the global registers
21186 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
21187 global register 1, each global register 2 through 4 is then treated as an
21188 allocable register that is clobbered by function calls. This is the default.
21190 To be fully SVR4 ABI-compliant at the cost of some performance loss,
21191 specify @option{-mno-app-regs}. You should compile libraries and system
21192 software with this option.
21198 With @option{-mflat}, the compiler does not generate save/restore instructions
21199 and uses a ``flat'' or single register window model. This model is compatible
21200 with the regular register window model. The local registers and the input
21201 registers (0--5) are still treated as ``call-saved'' registers and are
21202 saved on the stack as needed.
21204 With @option{-mno-flat} (the default), the compiler generates save/restore
21205 instructions (except for leaf functions). This is the normal operating mode.
21208 @itemx -mhard-float
21210 @opindex mhard-float
21211 Generate output containing floating-point instructions. This is the
21215 @itemx -msoft-float
21217 @opindex msoft-float
21218 Generate output containing library calls for floating point.
21219 @strong{Warning:} the requisite libraries are not available for all SPARC
21220 targets. Normally the facilities of the machine's usual C compiler are
21221 used, but this cannot be done directly in cross-compilation. You must make
21222 your own arrangements to provide suitable library functions for
21223 cross-compilation. The embedded targets @samp{sparc-*-aout} and
21224 @samp{sparclite-*-*} do provide software floating-point support.
21226 @option{-msoft-float} changes the calling convention in the output file;
21227 therefore, it is only useful if you compile @emph{all} of a program with
21228 this option. In particular, you need to compile @file{libgcc.a}, the
21229 library that comes with GCC, with @option{-msoft-float} in order for
21232 @item -mhard-quad-float
21233 @opindex mhard-quad-float
21234 Generate output containing quad-word (long double) floating-point
21237 @item -msoft-quad-float
21238 @opindex msoft-quad-float
21239 Generate output containing library calls for quad-word (long double)
21240 floating-point instructions. The functions called are those specified
21241 in the SPARC ABI@. This is the default.
21243 As of this writing, there are no SPARC implementations that have hardware
21244 support for the quad-word floating-point instructions. They all invoke
21245 a trap handler for one of these instructions, and then the trap handler
21246 emulates the effect of the instruction. Because of the trap handler overhead,
21247 this is much slower than calling the ABI library routines. Thus the
21248 @option{-msoft-quad-float} option is the default.
21250 @item -mno-unaligned-doubles
21251 @itemx -munaligned-doubles
21252 @opindex mno-unaligned-doubles
21253 @opindex munaligned-doubles
21254 Assume that doubles have 8-byte alignment. This is the default.
21256 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
21257 alignment only if they are contained in another type, or if they have an
21258 absolute address. Otherwise, it assumes they have 4-byte alignment.
21259 Specifying this option avoids some rare compatibility problems with code
21260 generated by other compilers. It is not the default because it results
21261 in a performance loss, especially for floating-point code.
21264 @itemx -mno-user-mode
21265 @opindex muser-mode
21266 @opindex mno-user-mode
21267 Do not generate code that can only run in supervisor mode. This is relevant
21268 only for the @code{casa} instruction emitted for the LEON3 processor. The
21269 default is @option{-mno-user-mode}.
21271 @item -mno-faster-structs
21272 @itemx -mfaster-structs
21273 @opindex mno-faster-structs
21274 @opindex mfaster-structs
21275 With @option{-mfaster-structs}, the compiler assumes that structures
21276 should have 8-byte alignment. This enables the use of pairs of
21277 @code{ldd} and @code{std} instructions for copies in structure
21278 assignment, in place of twice as many @code{ld} and @code{st} pairs.
21279 However, the use of this changed alignment directly violates the SPARC
21280 ABI@. Thus, it's intended only for use on targets where the developer
21281 acknowledges that their resulting code is not directly in line with
21282 the rules of the ABI@.
21284 @item -mcpu=@var{cpu_type}
21286 Set the instruction set, register set, and instruction scheduling parameters
21287 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
21288 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
21289 @samp{leon}, @samp{leon3}, @samp{sparclite}, @samp{f930}, @samp{f934},
21290 @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
21291 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
21292 @samp{niagara3} and @samp{niagara4}.
21294 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
21295 which selects the best architecture option for the host processor.
21296 @option{-mcpu=native} has no effect if GCC does not recognize
21299 Default instruction scheduling parameters are used for values that select
21300 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
21301 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
21303 Here is a list of each supported architecture and their supported
21311 supersparc, hypersparc, leon, leon3
21314 f930, f934, sparclite86x
21320 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
21323 By default (unless configured otherwise), GCC generates code for the V7
21324 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
21325 additionally optimizes it for the Cypress CY7C602 chip, as used in the
21326 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
21327 SPARCStation 1, 2, IPX etc.
21329 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
21330 architecture. The only difference from V7 code is that the compiler emits
21331 the integer multiply and integer divide instructions which exist in SPARC-V8
21332 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
21333 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
21336 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
21337 the SPARC architecture. This adds the integer multiply, integer divide step
21338 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
21339 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
21340 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
21341 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
21342 MB86934 chip, which is the more recent SPARClite with FPU@.
21344 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
21345 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
21346 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
21347 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
21348 optimizes it for the TEMIC SPARClet chip.
21350 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
21351 architecture. This adds 64-bit integer and floating-point move instructions,
21352 3 additional floating-point condition code registers and conditional move
21353 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
21354 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
21355 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
21356 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
21357 @option{-mcpu=niagara}, the compiler additionally optimizes it for
21358 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
21359 additionally optimizes it for Sun UltraSPARC T2 chips. With
21360 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
21361 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
21362 additionally optimizes it for Sun UltraSPARC T4 chips.
21364 @item -mtune=@var{cpu_type}
21366 Set the instruction scheduling parameters for machine type
21367 @var{cpu_type}, but do not set the instruction set or register set that the
21368 option @option{-mcpu=@var{cpu_type}} does.
21370 The same values for @option{-mcpu=@var{cpu_type}} can be used for
21371 @option{-mtune=@var{cpu_type}}, but the only useful values are those
21372 that select a particular CPU implementation. Those are @samp{cypress},
21373 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3}, @samp{f930},
21374 @samp{f934}, @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
21375 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3} and
21376 @samp{niagara4}. With native Solaris and GNU/Linux toolchains, @samp{native}
21382 @opindex mno-v8plus
21383 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
21384 difference from the V8 ABI is that the global and out registers are
21385 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
21386 mode for all SPARC-V9 processors.
21392 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
21393 Visual Instruction Set extensions. The default is @option{-mno-vis}.
21399 With @option{-mvis2}, GCC generates code that takes advantage of
21400 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
21401 default is @option{-mvis2} when targeting a cpu that supports such
21402 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
21403 also sets @option{-mvis}.
21409 With @option{-mvis3}, GCC generates code that takes advantage of
21410 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
21411 default is @option{-mvis3} when targeting a cpu that supports such
21412 instructions, such as niagara-3 and later. Setting @option{-mvis3}
21413 also sets @option{-mvis2} and @option{-mvis}.
21418 @opindex mno-cbcond
21419 With @option{-mcbcond}, GCC generates code that takes advantage of
21420 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
21421 The default is @option{-mcbcond} when targeting a cpu that supports such
21422 instructions, such as niagara-4 and later.
21428 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
21429 population count instruction. The default is @option{-mpopc}
21430 when targeting a cpu that supports such instructions, such as Niagara-2 and
21437 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
21438 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
21439 when targeting a cpu that supports such instructions, such as Niagara-3 and
21443 @opindex mfix-at697f
21444 Enable the documented workaround for the single erratum of the Atmel AT697F
21445 processor (which corresponds to erratum #13 of the AT697E processor).
21448 @opindex mfix-ut699
21449 Enable the documented workarounds for the floating-point errata and the data
21450 cache nullify errata of the UT699 processor.
21453 These @samp{-m} options are supported in addition to the above
21454 on SPARC-V9 processors in 64-bit environments:
21461 Generate code for a 32-bit or 64-bit environment.
21462 The 32-bit environment sets int, long and pointer to 32 bits.
21463 The 64-bit environment sets int to 32 bits and long and pointer
21466 @item -mcmodel=@var{which}
21468 Set the code model to one of
21472 The Medium/Low code model: 64-bit addresses, programs
21473 must be linked in the low 32 bits of memory. Programs can be statically
21474 or dynamically linked.
21477 The Medium/Middle code model: 64-bit addresses, programs
21478 must be linked in the low 44 bits of memory, the text and data segments must
21479 be less than 2GB in size and the data segment must be located within 2GB of
21483 The Medium/Anywhere code model: 64-bit addresses, programs
21484 may be linked anywhere in memory, the text and data segments must be less
21485 than 2GB in size and the data segment must be located within 2GB of the
21489 The Medium/Anywhere code model for embedded systems:
21490 64-bit addresses, the text and data segments must be less than 2GB in
21491 size, both starting anywhere in memory (determined at link time). The
21492 global register %g4 points to the base of the data segment. Programs
21493 are statically linked and PIC is not supported.
21496 @item -mmemory-model=@var{mem-model}
21497 @opindex mmemory-model
21498 Set the memory model in force on the processor to one of
21502 The default memory model for the processor and operating system.
21505 Relaxed Memory Order
21508 Partial Store Order
21514 Sequential Consistency
21517 These memory models are formally defined in Appendix D of the Sparc V9
21518 architecture manual, as set in the processor's @code{PSTATE.MM} field.
21521 @itemx -mno-stack-bias
21522 @opindex mstack-bias
21523 @opindex mno-stack-bias
21524 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
21525 frame pointer if present, are offset by @minus{}2047 which must be added back
21526 when making stack frame references. This is the default in 64-bit mode.
21527 Otherwise, assume no such offset is present.
21531 @subsection SPU Options
21532 @cindex SPU options
21534 These @samp{-m} options are supported on the SPU:
21538 @itemx -merror-reloc
21539 @opindex mwarn-reloc
21540 @opindex merror-reloc
21542 The loader for SPU does not handle dynamic relocations. By default, GCC
21543 gives an error when it generates code that requires a dynamic
21544 relocation. @option{-mno-error-reloc} disables the error,
21545 @option{-mwarn-reloc} generates a warning instead.
21548 @itemx -munsafe-dma
21550 @opindex munsafe-dma
21552 Instructions that initiate or test completion of DMA must not be
21553 reordered with respect to loads and stores of the memory that is being
21555 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
21556 memory accesses, but that can lead to inefficient code in places where the
21557 memory is known to not change. Rather than mark the memory as volatile,
21558 you can use @option{-msafe-dma} to tell the compiler to treat
21559 the DMA instructions as potentially affecting all memory.
21561 @item -mbranch-hints
21562 @opindex mbranch-hints
21564 By default, GCC generates a branch hint instruction to avoid
21565 pipeline stalls for always-taken or probably-taken branches. A hint
21566 is not generated closer than 8 instructions away from its branch.
21567 There is little reason to disable them, except for debugging purposes,
21568 or to make an object a little bit smaller.
21572 @opindex msmall-mem
21573 @opindex mlarge-mem
21575 By default, GCC generates code assuming that addresses are never larger
21576 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
21577 a full 32-bit address.
21582 By default, GCC links against startup code that assumes the SPU-style
21583 main function interface (which has an unconventional parameter list).
21584 With @option{-mstdmain}, GCC links your program against startup
21585 code that assumes a C99-style interface to @code{main}, including a
21586 local copy of @code{argv} strings.
21588 @item -mfixed-range=@var{register-range}
21589 @opindex mfixed-range
21590 Generate code treating the given register range as fixed registers.
21591 A fixed register is one that the register allocator cannot use. This is
21592 useful when compiling kernel code. A register range is specified as
21593 two registers separated by a dash. Multiple register ranges can be
21594 specified separated by a comma.
21600 Compile code assuming that pointers to the PPU address space accessed
21601 via the @code{__ea} named address space qualifier are either 32 or 64
21602 bits wide. The default is 32 bits. As this is an ABI-changing option,
21603 all object code in an executable must be compiled with the same setting.
21605 @item -maddress-space-conversion
21606 @itemx -mno-address-space-conversion
21607 @opindex maddress-space-conversion
21608 @opindex mno-address-space-conversion
21609 Allow/disallow treating the @code{__ea} address space as superset
21610 of the generic address space. This enables explicit type casts
21611 between @code{__ea} and generic pointer as well as implicit
21612 conversions of generic pointers to @code{__ea} pointers. The
21613 default is to allow address space pointer conversions.
21615 @item -mcache-size=@var{cache-size}
21616 @opindex mcache-size
21617 This option controls the version of libgcc that the compiler links to an
21618 executable and selects a software-managed cache for accessing variables
21619 in the @code{__ea} address space with a particular cache size. Possible
21620 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
21621 and @samp{128}. The default cache size is 64KB.
21623 @item -matomic-updates
21624 @itemx -mno-atomic-updates
21625 @opindex matomic-updates
21626 @opindex mno-atomic-updates
21627 This option controls the version of libgcc that the compiler links to an
21628 executable and selects whether atomic updates to the software-managed
21629 cache of PPU-side variables are used. If you use atomic updates, changes
21630 to a PPU variable from SPU code using the @code{__ea} named address space
21631 qualifier do not interfere with changes to other PPU variables residing
21632 in the same cache line from PPU code. If you do not use atomic updates,
21633 such interference may occur; however, writing back cache lines is
21634 more efficient. The default behavior is to use atomic updates.
21637 @itemx -mdual-nops=@var{n}
21638 @opindex mdual-nops
21639 By default, GCC inserts nops to increase dual issue when it expects
21640 it to increase performance. @var{n} can be a value from 0 to 10. A
21641 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
21642 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
21644 @item -mhint-max-nops=@var{n}
21645 @opindex mhint-max-nops
21646 Maximum number of nops to insert for a branch hint. A branch hint must
21647 be at least 8 instructions away from the branch it is affecting. GCC
21648 inserts up to @var{n} nops to enforce this, otherwise it does not
21649 generate the branch hint.
21651 @item -mhint-max-distance=@var{n}
21652 @opindex mhint-max-distance
21653 The encoding of the branch hint instruction limits the hint to be within
21654 256 instructions of the branch it is affecting. By default, GCC makes
21655 sure it is within 125.
21658 @opindex msafe-hints
21659 Work around a hardware bug that causes the SPU to stall indefinitely.
21660 By default, GCC inserts the @code{hbrp} instruction to make sure
21661 this stall won't happen.
21665 @node System V Options
21666 @subsection Options for System V
21668 These additional options are available on System V Release 4 for
21669 compatibility with other compilers on those systems:
21674 Create a shared object.
21675 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
21679 Identify the versions of each tool used by the compiler, in a
21680 @code{.ident} assembler directive in the output.
21684 Refrain from adding @code{.ident} directives to the output file (this is
21687 @item -YP,@var{dirs}
21689 Search the directories @var{dirs}, and no others, for libraries
21690 specified with @option{-l}.
21692 @item -Ym,@var{dir}
21694 Look in the directory @var{dir} to find the M4 preprocessor.
21695 The assembler uses this option.
21696 @c This is supposed to go with a -Yd for predefined M4 macro files, but
21697 @c the generic assembler that comes with Solaris takes just -Ym.
21700 @node TILE-Gx Options
21701 @subsection TILE-Gx Options
21702 @cindex TILE-Gx options
21704 These @samp{-m} options are supported on the TILE-Gx:
21707 @item -mcmodel=small
21708 @opindex mcmodel=small
21709 Generate code for the small model. The distance for direct calls is
21710 limited to 500M in either direction. PC-relative addresses are 32
21711 bits. Absolute addresses support the full address range.
21713 @item -mcmodel=large
21714 @opindex mcmodel=large
21715 Generate code for the large model. There is no limitation on call
21716 distance, pc-relative addresses, or absolute addresses.
21718 @item -mcpu=@var{name}
21720 Selects the type of CPU to be targeted. Currently the only supported
21721 type is @samp{tilegx}.
21727 Generate code for a 32-bit or 64-bit environment. The 32-bit
21728 environment sets int, long, and pointer to 32 bits. The 64-bit
21729 environment sets int to 32 bits and long and pointer to 64 bits.
21732 @itemx -mlittle-endian
21733 @opindex mbig-endian
21734 @opindex mlittle-endian
21735 Generate code in big/little endian mode, respectively.
21738 @node TILEPro Options
21739 @subsection TILEPro Options
21740 @cindex TILEPro options
21742 These @samp{-m} options are supported on the TILEPro:
21745 @item -mcpu=@var{name}
21747 Selects the type of CPU to be targeted. Currently the only supported
21748 type is @samp{tilepro}.
21752 Generate code for a 32-bit environment, which sets int, long, and
21753 pointer to 32 bits. This is the only supported behavior so the flag
21754 is essentially ignored.
21758 @subsection V850 Options
21759 @cindex V850 Options
21761 These @samp{-m} options are defined for V850 implementations:
21765 @itemx -mno-long-calls
21766 @opindex mlong-calls
21767 @opindex mno-long-calls
21768 Treat all calls as being far away (near). If calls are assumed to be
21769 far away, the compiler always loads the function's address into a
21770 register, and calls indirect through the pointer.
21776 Do not optimize (do optimize) basic blocks that use the same index
21777 pointer 4 or more times to copy pointer into the @code{ep} register, and
21778 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
21779 option is on by default if you optimize.
21781 @item -mno-prolog-function
21782 @itemx -mprolog-function
21783 @opindex mno-prolog-function
21784 @opindex mprolog-function
21785 Do not use (do use) external functions to save and restore registers
21786 at the prologue and epilogue of a function. The external functions
21787 are slower, but use less code space if more than one function saves
21788 the same number of registers. The @option{-mprolog-function} option
21789 is on by default if you optimize.
21793 Try to make the code as small as possible. At present, this just turns
21794 on the @option{-mep} and @option{-mprolog-function} options.
21796 @item -mtda=@var{n}
21798 Put static or global variables whose size is @var{n} bytes or less into
21799 the tiny data area that register @code{ep} points to. The tiny data
21800 area can hold up to 256 bytes in total (128 bytes for byte references).
21802 @item -msda=@var{n}
21804 Put static or global variables whose size is @var{n} bytes or less into
21805 the small data area that register @code{gp} points to. The small data
21806 area can hold up to 64 kilobytes.
21808 @item -mzda=@var{n}
21810 Put static or global variables whose size is @var{n} bytes or less into
21811 the first 32 kilobytes of memory.
21815 Specify that the target processor is the V850.
21819 Specify that the target processor is the V850E3V5. The preprocessor
21820 constant @samp{__v850e3v5__} is defined if this option is used.
21824 Specify that the target processor is the V850E3V5. This is an alias for
21825 the @option{-mv850e3v5} option.
21829 Specify that the target processor is the V850E2V3. The preprocessor
21830 constant @samp{__v850e2v3__} is defined if this option is used.
21834 Specify that the target processor is the V850E2. The preprocessor
21835 constant @samp{__v850e2__} is defined if this option is used.
21839 Specify that the target processor is the V850E1. The preprocessor
21840 constants @samp{__v850e1__} and @samp{__v850e__} are defined if
21841 this option is used.
21845 Specify that the target processor is the V850ES. This is an alias for
21846 the @option{-mv850e1} option.
21850 Specify that the target processor is the V850E@. The preprocessor
21851 constant @samp{__v850e__} is defined if this option is used.
21853 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
21854 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
21855 are defined then a default target processor is chosen and the
21856 relevant @samp{__v850*__} preprocessor constant is defined.
21858 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
21859 defined, regardless of which processor variant is the target.
21861 @item -mdisable-callt
21862 @itemx -mno-disable-callt
21863 @opindex mdisable-callt
21864 @opindex mno-disable-callt
21865 This option suppresses generation of the @code{CALLT} instruction for the
21866 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
21869 This option is enabled by default when the RH850 ABI is
21870 in use (see @option{-mrh850-abi}), and disabled by default when the
21871 GCC ABI is in use. If @code{CALLT} instructions are being generated
21872 then the C preprocessor symbol @code{__V850_CALLT__} will be defined.
21878 Pass on (or do not pass on) the @option{-mrelax} command line option
21882 @itemx -mno-long-jumps
21883 @opindex mlong-jumps
21884 @opindex mno-long-jumps
21885 Disable (or re-enable) the generation of PC-relative jump instructions.
21888 @itemx -mhard-float
21889 @opindex msoft-float
21890 @opindex mhard-float
21891 Disable (or re-enable) the generation of hardware floating point
21892 instructions. This option is only significant when the target
21893 architecture is @samp{V850E2V3} or higher. If hardware floating point
21894 instructions are being generated then the C preprocessor symbol
21895 @code{__FPU_OK__} will be defined, otherwise the symbol
21896 @code{__NO_FPU__} will be defined.
21900 Enables the use of the e3v5 LOOP instruction. The use of this
21901 instruction is not enabled by default when the e3v5 architecture is
21902 selected because its use is still experimental.
21906 @opindex mrh850-abi
21908 Enables support for the RH850 version of the V850 ABI. This is the
21909 default. With this version of the ABI the following rules apply:
21913 Integer sized structures and unions are returned via a memory pointer
21914 rather than a register.
21917 Large structures and unions (more than 8 bytes in size) are passed by
21921 Functions are aligned to 16-bit boundaries.
21924 The @option{-m8byte-align} command line option is supported.
21927 The @option{-mdisable-callt} command line option is enabled by
21928 default. The @option{-mno-disable-callt} command line option is not
21932 When this version of the ABI is enabled the C preprocessor symbol
21933 @code{__V850_RH850_ABI__} is defined.
21937 Enables support for the old GCC version of the V850 ABI. With this
21938 version of the ABI the following rules apply:
21942 Integer sized structures and unions are returned in register @code{r10}.
21945 Large structures and unions (more than 8 bytes in size) are passed by
21949 Functions are aligned to 32-bit boundaries, unless optimizing for
21953 The @option{-m8byte-align} command line option is not supported.
21956 The @option{-mdisable-callt} command line option is supported but not
21957 enabled by default.
21960 When this version of the ABI is enabled the C preprocessor symbol
21961 @code{__V850_GCC_ABI__} is defined.
21963 @item -m8byte-align
21964 @itemx -mno-8byte-align
21965 @opindex m8byte-align
21966 @opindex mno-8byte-align
21967 Enables support for @code{doubles} and @code{long long} types to be
21968 aligned on 8-byte boundaries. The default is to restrict the
21969 alignment of all objects to at most 4-bytes. When
21970 @option{-m8byte-align} is in effect the C preprocessor symbol
21971 @code{__V850_8BYTE_ALIGN__} will be defined.
21974 @opindex mbig-switch
21975 Generate code suitable for big switch tables. Use this option only if
21976 the assembler/linker complain about out of range branches within a switch
21981 This option causes r2 and r5 to be used in the code generated by
21982 the compiler. This setting is the default.
21984 @item -mno-app-regs
21985 @opindex mno-app-regs
21986 This option causes r2 and r5 to be treated as fixed registers.
21991 @subsection VAX Options
21992 @cindex VAX options
21994 These @samp{-m} options are defined for the VAX:
21999 Do not output certain jump instructions (@code{aobleq} and so on)
22000 that the Unix assembler for the VAX cannot handle across long
22005 Do output those jump instructions, on the assumption that the
22006 GNU assembler is being used.
22010 Output code for G-format floating-point numbers instead of D-format.
22014 @subsection VMS Options
22016 These @samp{-m} options are defined for the VMS implementations:
22019 @item -mvms-return-codes
22020 @opindex mvms-return-codes
22021 Return VMS condition codes from @code{main}. The default is to return POSIX-style
22022 condition (e.g.@ error) codes.
22024 @item -mdebug-main=@var{prefix}
22025 @opindex mdebug-main=@var{prefix}
22026 Flag the first routine whose name starts with @var{prefix} as the main
22027 routine for the debugger.
22031 Default to 64-bit memory allocation routines.
22033 @item -mpointer-size=@var{size}
22034 @opindex -mpointer-size=@var{size}
22035 Set the default size of pointers. Possible options for @var{size} are
22036 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
22037 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
22038 The later option disables @code{pragma pointer_size}.
22041 @node VxWorks Options
22042 @subsection VxWorks Options
22043 @cindex VxWorks Options
22045 The options in this section are defined for all VxWorks targets.
22046 Options specific to the target hardware are listed with the other
22047 options for that target.
22052 GCC can generate code for both VxWorks kernels and real time processes
22053 (RTPs). This option switches from the former to the latter. It also
22054 defines the preprocessor macro @code{__RTP__}.
22057 @opindex non-static
22058 Link an RTP executable against shared libraries rather than static
22059 libraries. The options @option{-static} and @option{-shared} can
22060 also be used for RTPs (@pxref{Link Options}); @option{-static}
22067 These options are passed down to the linker. They are defined for
22068 compatibility with Diab.
22071 @opindex Xbind-lazy
22072 Enable lazy binding of function calls. This option is equivalent to
22073 @option{-Wl,-z,now} and is defined for compatibility with Diab.
22077 Disable lazy binding of function calls. This option is the default and
22078 is defined for compatibility with Diab.
22081 @node x86-64 Options
22082 @subsection x86-64 Options
22083 @cindex x86-64 options
22085 These are listed under @xref{i386 and x86-64 Options}.
22087 @node Xstormy16 Options
22088 @subsection Xstormy16 Options
22089 @cindex Xstormy16 Options
22091 These options are defined for Xstormy16:
22096 Choose startup files and linker script suitable for the simulator.
22099 @node Xtensa Options
22100 @subsection Xtensa Options
22101 @cindex Xtensa Options
22103 These options are supported for Xtensa targets:
22107 @itemx -mno-const16
22109 @opindex mno-const16
22110 Enable or disable use of @code{CONST16} instructions for loading
22111 constant values. The @code{CONST16} instruction is currently not a
22112 standard option from Tensilica. When enabled, @code{CONST16}
22113 instructions are always used in place of the standard @code{L32R}
22114 instructions. The use of @code{CONST16} is enabled by default only if
22115 the @code{L32R} instruction is not available.
22118 @itemx -mno-fused-madd
22119 @opindex mfused-madd
22120 @opindex mno-fused-madd
22121 Enable or disable use of fused multiply/add and multiply/subtract
22122 instructions in the floating-point option. This has no effect if the
22123 floating-point option is not also enabled. Disabling fused multiply/add
22124 and multiply/subtract instructions forces the compiler to use separate
22125 instructions for the multiply and add/subtract operations. This may be
22126 desirable in some cases where strict IEEE 754-compliant results are
22127 required: the fused multiply add/subtract instructions do not round the
22128 intermediate result, thereby producing results with @emph{more} bits of
22129 precision than specified by the IEEE standard. Disabling fused multiply
22130 add/subtract instructions also ensures that the program output is not
22131 sensitive to the compiler's ability to combine multiply and add/subtract
22134 @item -mserialize-volatile
22135 @itemx -mno-serialize-volatile
22136 @opindex mserialize-volatile
22137 @opindex mno-serialize-volatile
22138 When this option is enabled, GCC inserts @code{MEMW} instructions before
22139 @code{volatile} memory references to guarantee sequential consistency.
22140 The default is @option{-mserialize-volatile}. Use
22141 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
22143 @item -mforce-no-pic
22144 @opindex mforce-no-pic
22145 For targets, like GNU/Linux, where all user-mode Xtensa code must be
22146 position-independent code (PIC), this option disables PIC for compiling
22149 @item -mtext-section-literals
22150 @itemx -mno-text-section-literals
22151 @opindex mtext-section-literals
22152 @opindex mno-text-section-literals
22153 Control the treatment of literal pools. The default is
22154 @option{-mno-text-section-literals}, which places literals in a separate
22155 section in the output file. This allows the literal pool to be placed
22156 in a data RAM/ROM, and it also allows the linker to combine literal
22157 pools from separate object files to remove redundant literals and
22158 improve code size. With @option{-mtext-section-literals}, the literals
22159 are interspersed in the text section in order to keep them as close as
22160 possible to their references. This may be necessary for large assembly
22163 @item -mtarget-align
22164 @itemx -mno-target-align
22165 @opindex mtarget-align
22166 @opindex mno-target-align
22167 When this option is enabled, GCC instructs the assembler to
22168 automatically align instructions to reduce branch penalties at the
22169 expense of some code density. The assembler attempts to widen density
22170 instructions to align branch targets and the instructions following call
22171 instructions. If there are not enough preceding safe density
22172 instructions to align a target, no widening is performed. The
22173 default is @option{-mtarget-align}. These options do not affect the
22174 treatment of auto-aligned instructions like @code{LOOP}, which the
22175 assembler always aligns, either by widening density instructions or
22176 by inserting NOP instructions.
22179 @itemx -mno-longcalls
22180 @opindex mlongcalls
22181 @opindex mno-longcalls
22182 When this option is enabled, GCC instructs the assembler to translate
22183 direct calls to indirect calls unless it can determine that the target
22184 of a direct call is in the range allowed by the call instruction. This
22185 translation typically occurs for calls to functions in other source
22186 files. Specifically, the assembler translates a direct @code{CALL}
22187 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
22188 The default is @option{-mno-longcalls}. This option should be used in
22189 programs where the call target can potentially be out of range. This
22190 option is implemented in the assembler, not the compiler, so the
22191 assembly code generated by GCC still shows direct call
22192 instructions---look at the disassembled object code to see the actual
22193 instructions. Note that the assembler uses an indirect call for
22194 every cross-file call, not just those that really are out of range.
22197 @node zSeries Options
22198 @subsection zSeries Options
22199 @cindex zSeries options
22201 These are listed under @xref{S/390 and zSeries Options}.
22203 @node Code Gen Options
22204 @section Options for Code Generation Conventions
22205 @cindex code generation conventions
22206 @cindex options, code generation
22207 @cindex run-time options
22209 These machine-independent options control the interface conventions
22210 used in code generation.
22212 Most of them have both positive and negative forms; the negative form
22213 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
22214 one of the forms is listed---the one that is not the default. You
22215 can figure out the other form by either removing @samp{no-} or adding
22219 @item -fbounds-check
22220 @opindex fbounds-check
22221 For front ends that support it, generate additional code to check that
22222 indices used to access arrays are within the declared range. This is
22223 currently only supported by the Java and Fortran front ends, where
22224 this option defaults to true and false respectively.
22226 @item -fstack-reuse=@var{reuse-level}
22227 @opindex fstack_reuse
22228 This option controls stack space reuse for user declared local/auto variables
22229 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
22230 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
22231 local variables and temporaries, @samp{named_vars} enables the reuse only for
22232 user defined local variables with names, and @samp{none} disables stack reuse
22233 completely. The default value is @samp{all}. The option is needed when the
22234 program extends the lifetime of a scoped local variable or a compiler generated
22235 temporary beyond the end point defined by the language. When a lifetime of
22236 a variable ends, and if the variable lives in memory, the optimizing compiler
22237 has the freedom to reuse its stack space with other temporaries or scoped
22238 local variables whose live range does not overlap with it. Legacy code extending
22239 local lifetime will likely to break with the stack reuse optimization.
22258 if (*p == 10) // out of scope use of local1
22269 A(int k) : i(k), j(k) @{ @}
22276 void foo(const A& ar)
22283 foo(A(10)); // temp object's lifetime ends when foo returns
22289 ap->i+= 10; // ap references out of scope temp whose space
22290 // is reused with a. What is the value of ap->i?
22295 The lifetime of a compiler generated temporary is well defined by the C++
22296 standard. When a lifetime of a temporary ends, and if the temporary lives
22297 in memory, the optimizing compiler has the freedom to reuse its stack
22298 space with other temporaries or scoped local variables whose live range
22299 does not overlap with it. However some of the legacy code relies on
22300 the behavior of older compilers in which temporaries' stack space is
22301 not reused, the aggressive stack reuse can lead to runtime errors. This
22302 option is used to control the temporary stack reuse optimization.
22306 This option generates traps for signed overflow on addition, subtraction,
22307 multiplication operations.
22311 This option instructs the compiler to assume that signed arithmetic
22312 overflow of addition, subtraction and multiplication wraps around
22313 using twos-complement representation. This flag enables some optimizations
22314 and disables others. This option is enabled by default for the Java
22315 front end, as required by the Java language specification.
22318 @opindex fexceptions
22319 Enable exception handling. Generates extra code needed to propagate
22320 exceptions. For some targets, this implies GCC generates frame
22321 unwind information for all functions, which can produce significant data
22322 size overhead, although it does not affect execution. If you do not
22323 specify this option, GCC enables it by default for languages like
22324 C++ that normally require exception handling, and disables it for
22325 languages like C that do not normally require it. However, you may need
22326 to enable this option when compiling C code that needs to interoperate
22327 properly with exception handlers written in C++. You may also wish to
22328 disable this option if you are compiling older C++ programs that don't
22329 use exception handling.
22331 @item -fnon-call-exceptions
22332 @opindex fnon-call-exceptions
22333 Generate code that allows trapping instructions to throw exceptions.
22334 Note that this requires platform-specific runtime support that does
22335 not exist everywhere. Moreover, it only allows @emph{trapping}
22336 instructions to throw exceptions, i.e.@: memory references or floating-point
22337 instructions. It does not allow exceptions to be thrown from
22338 arbitrary signal handlers such as @code{SIGALRM}.
22340 @item -fdelete-dead-exceptions
22341 @opindex fdelete-dead-exceptions
22342 Consider that instructions that may throw exceptions but don't otherwise
22343 contribute to the execution of the program can be optimized away.
22344 This option is enabled by default for the Ada front end, as permitted by
22345 the Ada language specification.
22346 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
22348 @item -funwind-tables
22349 @opindex funwind-tables
22350 Similar to @option{-fexceptions}, except that it just generates any needed
22351 static data, but does not affect the generated code in any other way.
22352 You normally do not need to enable this option; instead, a language processor
22353 that needs this handling enables it on your behalf.
22355 @item -fasynchronous-unwind-tables
22356 @opindex fasynchronous-unwind-tables
22357 Generate unwind table in DWARF 2 format, if supported by target machine. The
22358 table is exact at each instruction boundary, so it can be used for stack
22359 unwinding from asynchronous events (such as debugger or garbage collector).
22361 @item -fno-gnu-unique
22362 @opindex fno-gnu-unique
22363 On systems with recent GNU assembler and C library, the C++ compiler
22364 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
22365 of template static data members and static local variables in inline
22366 functions are unique even in the presence of @code{RTLD_LOCAL}; this
22367 is necessary to avoid problems with a library used by two different
22368 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
22369 therefore disagreeing with the other one about the binding of the
22370 symbol. But this causes @code{dlclose} to be ignored for affected
22371 DSOs; if your program relies on reinitialization of a DSO via
22372 @code{dlclose} and @code{dlopen}, you can use
22373 @option{-fno-gnu-unique}.
22375 @item -fpcc-struct-return
22376 @opindex fpcc-struct-return
22377 Return ``short'' @code{struct} and @code{union} values in memory like
22378 longer ones, rather than in registers. This convention is less
22379 efficient, but it has the advantage of allowing intercallability between
22380 GCC-compiled files and files compiled with other compilers, particularly
22381 the Portable C Compiler (pcc).
22383 The precise convention for returning structures in memory depends
22384 on the target configuration macros.
22386 Short structures and unions are those whose size and alignment match
22387 that of some integer type.
22389 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
22390 switch is not binary compatible with code compiled with the
22391 @option{-freg-struct-return} switch.
22392 Use it to conform to a non-default application binary interface.
22394 @item -freg-struct-return
22395 @opindex freg-struct-return
22396 Return @code{struct} and @code{union} values in registers when possible.
22397 This is more efficient for small structures than
22398 @option{-fpcc-struct-return}.
22400 If you specify neither @option{-fpcc-struct-return} nor
22401 @option{-freg-struct-return}, GCC defaults to whichever convention is
22402 standard for the target. If there is no standard convention, GCC
22403 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
22404 the principal compiler. In those cases, we can choose the standard, and
22405 we chose the more efficient register return alternative.
22407 @strong{Warning:} code compiled with the @option{-freg-struct-return}
22408 switch is not binary compatible with code compiled with the
22409 @option{-fpcc-struct-return} switch.
22410 Use it to conform to a non-default application binary interface.
22412 @item -fshort-enums
22413 @opindex fshort-enums
22414 Allocate to an @code{enum} type only as many bytes as it needs for the
22415 declared range of possible values. Specifically, the @code{enum} type
22416 is equivalent to the smallest integer type that has enough room.
22418 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
22419 code that is not binary compatible with code generated without that switch.
22420 Use it to conform to a non-default application binary interface.
22422 @item -fshort-double
22423 @opindex fshort-double
22424 Use the same size for @code{double} as for @code{float}.
22426 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
22427 code that is not binary compatible with code generated without that switch.
22428 Use it to conform to a non-default application binary interface.
22430 @item -fshort-wchar
22431 @opindex fshort-wchar
22432 Override the underlying type for @samp{wchar_t} to be @samp{short
22433 unsigned int} instead of the default for the target. This option is
22434 useful for building programs to run under WINE@.
22436 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
22437 code that is not binary compatible with code generated without that switch.
22438 Use it to conform to a non-default application binary interface.
22441 @opindex fno-common
22442 In C code, controls the placement of uninitialized global variables.
22443 Unix C compilers have traditionally permitted multiple definitions of
22444 such variables in different compilation units by placing the variables
22446 This is the behavior specified by @option{-fcommon}, and is the default
22447 for GCC on most targets.
22448 On the other hand, this behavior is not required by ISO C, and on some
22449 targets may carry a speed or code size penalty on variable references.
22450 The @option{-fno-common} option specifies that the compiler should place
22451 uninitialized global variables in the data section of the object file,
22452 rather than generating them as common blocks.
22453 This has the effect that if the same variable is declared
22454 (without @code{extern}) in two different compilations,
22455 you get a multiple-definition error when you link them.
22456 In this case, you must compile with @option{-fcommon} instead.
22457 Compiling with @option{-fno-common} is useful on targets for which
22458 it provides better performance, or if you wish to verify that the
22459 program will work on other systems that always treat uninitialized
22460 variable declarations this way.
22464 Ignore the @samp{#ident} directive.
22466 @item -finhibit-size-directive
22467 @opindex finhibit-size-directive
22468 Don't output a @code{.size} assembler directive, or anything else that
22469 would cause trouble if the function is split in the middle, and the
22470 two halves are placed at locations far apart in memory. This option is
22471 used when compiling @file{crtstuff.c}; you should not need to use it
22474 @item -fverbose-asm
22475 @opindex fverbose-asm
22476 Put extra commentary information in the generated assembly code to
22477 make it more readable. This option is generally only of use to those
22478 who actually need to read the generated assembly code (perhaps while
22479 debugging the compiler itself).
22481 @option{-fno-verbose-asm}, the default, causes the
22482 extra information to be omitted and is useful when comparing two assembler
22485 @item -frecord-gcc-switches
22486 @opindex frecord-gcc-switches
22487 This switch causes the command line used to invoke the
22488 compiler to be recorded into the object file that is being created.
22489 This switch is only implemented on some targets and the exact format
22490 of the recording is target and binary file format dependent, but it
22491 usually takes the form of a section containing ASCII text. This
22492 switch is related to the @option{-fverbose-asm} switch, but that
22493 switch only records information in the assembler output file as
22494 comments, so it never reaches the object file.
22495 See also @option{-grecord-gcc-switches} for another
22496 way of storing compiler options into the object file.
22500 @cindex global offset table
22502 Generate position-independent code (PIC) suitable for use in a shared
22503 library, if supported for the target machine. Such code accesses all
22504 constant addresses through a global offset table (GOT)@. The dynamic
22505 loader resolves the GOT entries when the program starts (the dynamic
22506 loader is not part of GCC; it is part of the operating system). If
22507 the GOT size for the linked executable exceeds a machine-specific
22508 maximum size, you get an error message from the linker indicating that
22509 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
22510 instead. (These maximums are 8k on the SPARC and 32k
22511 on the m68k and RS/6000. The 386 has no such limit.)
22513 Position-independent code requires special support, and therefore works
22514 only on certain machines. For the 386, GCC supports PIC for System V
22515 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
22516 position-independent.
22518 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
22523 If supported for the target machine, emit position-independent code,
22524 suitable for dynamic linking and avoiding any limit on the size of the
22525 global offset table. This option makes a difference on the m68k,
22526 PowerPC and SPARC@.
22528 Position-independent code requires special support, and therefore works
22529 only on certain machines.
22531 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
22538 These options are similar to @option{-fpic} and @option{-fPIC}, but
22539 generated position independent code can be only linked into executables.
22540 Usually these options are used when @option{-pie} GCC option is
22541 used during linking.
22543 @option{-fpie} and @option{-fPIE} both define the macros
22544 @code{__pie__} and @code{__PIE__}. The macros have the value 1
22545 for @option{-fpie} and 2 for @option{-fPIE}.
22547 @item -fno-jump-tables
22548 @opindex fno-jump-tables
22549 Do not use jump tables for switch statements even where it would be
22550 more efficient than other code generation strategies. This option is
22551 of use in conjunction with @option{-fpic} or @option{-fPIC} for
22552 building code that forms part of a dynamic linker and cannot
22553 reference the address of a jump table. On some targets, jump tables
22554 do not require a GOT and this option is not needed.
22556 @item -ffixed-@var{reg}
22558 Treat the register named @var{reg} as a fixed register; generated code
22559 should never refer to it (except perhaps as a stack pointer, frame
22560 pointer or in some other fixed role).
22562 @var{reg} must be the name of a register. The register names accepted
22563 are machine-specific and are defined in the @code{REGISTER_NAMES}
22564 macro in the machine description macro file.
22566 This flag does not have a negative form, because it specifies a
22569 @item -fcall-used-@var{reg}
22570 @opindex fcall-used
22571 Treat the register named @var{reg} as an allocable register that is
22572 clobbered by function calls. It may be allocated for temporaries or
22573 variables that do not live across a call. Functions compiled this way
22574 do not save and restore the register @var{reg}.
22576 It is an error to use this flag with the frame pointer or stack pointer.
22577 Use of this flag for other registers that have fixed pervasive roles in
22578 the machine's execution model produces disastrous results.
22580 This flag does not have a negative form, because it specifies a
22583 @item -fcall-saved-@var{reg}
22584 @opindex fcall-saved
22585 Treat the register named @var{reg} as an allocable register saved by
22586 functions. It may be allocated even for temporaries or variables that
22587 live across a call. Functions compiled this way save and restore
22588 the register @var{reg} if they use it.
22590 It is an error to use this flag with the frame pointer or stack pointer.
22591 Use of this flag for other registers that have fixed pervasive roles in
22592 the machine's execution model produces disastrous results.
22594 A different sort of disaster results from the use of this flag for
22595 a register in which function values may be returned.
22597 This flag does not have a negative form, because it specifies a
22600 @item -fpack-struct[=@var{n}]
22601 @opindex fpack-struct
22602 Without a value specified, pack all structure members together without
22603 holes. When a value is specified (which must be a small power of two), pack
22604 structure members according to this value, representing the maximum
22605 alignment (that is, objects with default alignment requirements larger than
22606 this are output potentially unaligned at the next fitting location.
22608 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
22609 code that is not binary compatible with code generated without that switch.
22610 Additionally, it makes the code suboptimal.
22611 Use it to conform to a non-default application binary interface.
22613 @item -finstrument-functions
22614 @opindex finstrument-functions
22615 Generate instrumentation calls for entry and exit to functions. Just
22616 after function entry and just before function exit, the following
22617 profiling functions are called with the address of the current
22618 function and its call site. (On some platforms,
22619 @code{__builtin_return_address} does not work beyond the current
22620 function, so the call site information may not be available to the
22621 profiling functions otherwise.)
22624 void __cyg_profile_func_enter (void *this_fn,
22626 void __cyg_profile_func_exit (void *this_fn,
22630 The first argument is the address of the start of the current function,
22631 which may be looked up exactly in the symbol table.
22633 This instrumentation is also done for functions expanded inline in other
22634 functions. The profiling calls indicate where, conceptually, the
22635 inline function is entered and exited. This means that addressable
22636 versions of such functions must be available. If all your uses of a
22637 function are expanded inline, this may mean an additional expansion of
22638 code size. If you use @samp{extern inline} in your C code, an
22639 addressable version of such functions must be provided. (This is
22640 normally the case anyway, but if you get lucky and the optimizer always
22641 expands the functions inline, you might have gotten away without
22642 providing static copies.)
22644 A function may be given the attribute @code{no_instrument_function}, in
22645 which case this instrumentation is not done. This can be used, for
22646 example, for the profiling functions listed above, high-priority
22647 interrupt routines, and any functions from which the profiling functions
22648 cannot safely be called (perhaps signal handlers, if the profiling
22649 routines generate output or allocate memory).
22651 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
22652 @opindex finstrument-functions-exclude-file-list
22654 Set the list of functions that are excluded from instrumentation (see
22655 the description of @code{-finstrument-functions}). If the file that
22656 contains a function definition matches with one of @var{file}, then
22657 that function is not instrumented. The match is done on substrings:
22658 if the @var{file} parameter is a substring of the file name, it is
22659 considered to be a match.
22664 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
22668 excludes any inline function defined in files whose pathnames
22669 contain @code{/bits/stl} or @code{include/sys}.
22671 If, for some reason, you want to include letter @code{','} in one of
22672 @var{sym}, write @code{'\,'}. For example,
22673 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
22674 (note the single quote surrounding the option).
22676 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
22677 @opindex finstrument-functions-exclude-function-list
22679 This is similar to @code{-finstrument-functions-exclude-file-list},
22680 but this option sets the list of function names to be excluded from
22681 instrumentation. The function name to be matched is its user-visible
22682 name, such as @code{vector<int> blah(const vector<int> &)}, not the
22683 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
22684 match is done on substrings: if the @var{sym} parameter is a substring
22685 of the function name, it is considered to be a match. For C99 and C++
22686 extended identifiers, the function name must be given in UTF-8, not
22687 using universal character names.
22689 @item -fstack-check
22690 @opindex fstack-check
22691 Generate code to verify that you do not go beyond the boundary of the
22692 stack. You should specify this flag if you are running in an
22693 environment with multiple threads, but you only rarely need to specify it in
22694 a single-threaded environment since stack overflow is automatically
22695 detected on nearly all systems if there is only one stack.
22697 Note that this switch does not actually cause checking to be done; the
22698 operating system or the language runtime must do that. The switch causes
22699 generation of code to ensure that they see the stack being extended.
22701 You can additionally specify a string parameter: @code{no} means no
22702 checking, @code{generic} means force the use of old-style checking,
22703 @code{specific} means use the best checking method and is equivalent
22704 to bare @option{-fstack-check}.
22706 Old-style checking is a generic mechanism that requires no specific
22707 target support in the compiler but comes with the following drawbacks:
22711 Modified allocation strategy for large objects: they are always
22712 allocated dynamically if their size exceeds a fixed threshold.
22715 Fixed limit on the size of the static frame of functions: when it is
22716 topped by a particular function, stack checking is not reliable and
22717 a warning is issued by the compiler.
22720 Inefficiency: because of both the modified allocation strategy and the
22721 generic implementation, code performance is hampered.
22724 Note that old-style stack checking is also the fallback method for
22725 @code{specific} if no target support has been added in the compiler.
22727 @item -fstack-limit-register=@var{reg}
22728 @itemx -fstack-limit-symbol=@var{sym}
22729 @itemx -fno-stack-limit
22730 @opindex fstack-limit-register
22731 @opindex fstack-limit-symbol
22732 @opindex fno-stack-limit
22733 Generate code to ensure that the stack does not grow beyond a certain value,
22734 either the value of a register or the address of a symbol. If a larger
22735 stack is required, a signal is raised at run time. For most targets,
22736 the signal is raised before the stack overruns the boundary, so
22737 it is possible to catch the signal without taking special precautions.
22739 For instance, if the stack starts at absolute address @samp{0x80000000}
22740 and grows downwards, you can use the flags
22741 @option{-fstack-limit-symbol=__stack_limit} and
22742 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
22743 of 128KB@. Note that this may only work with the GNU linker.
22745 @item -fsplit-stack
22746 @opindex fsplit-stack
22747 Generate code to automatically split the stack before it overflows.
22748 The resulting program has a discontiguous stack which can only
22749 overflow if the program is unable to allocate any more memory. This
22750 is most useful when running threaded programs, as it is no longer
22751 necessary to calculate a good stack size to use for each thread. This
22752 is currently only implemented for the i386 and x86_64 back ends running
22755 When code compiled with @option{-fsplit-stack} calls code compiled
22756 without @option{-fsplit-stack}, there may not be much stack space
22757 available for the latter code to run. If compiling all code,
22758 including library code, with @option{-fsplit-stack} is not an option,
22759 then the linker can fix up these calls so that the code compiled
22760 without @option{-fsplit-stack} always has a large stack. Support for
22761 this is implemented in the gold linker in GNU binutils release 2.21
22764 @item -fleading-underscore
22765 @opindex fleading-underscore
22766 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
22767 change the way C symbols are represented in the object file. One use
22768 is to help link with legacy assembly code.
22770 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
22771 generate code that is not binary compatible with code generated without that
22772 switch. Use it to conform to a non-default application binary interface.
22773 Not all targets provide complete support for this switch.
22775 @item -ftls-model=@var{model}
22776 @opindex ftls-model
22777 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
22778 The @var{model} argument should be one of @code{global-dynamic},
22779 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
22780 Note that the choice is subject to optimization: the compiler may use
22781 a more efficient model for symbols not visible outside of the translation
22782 unit, or if @option{-fpic} is not given on the command line.
22784 The default without @option{-fpic} is @code{initial-exec}; with
22785 @option{-fpic} the default is @code{global-dynamic}.
22787 @item -fvisibility=@var{default|internal|hidden|protected}
22788 @opindex fvisibility
22789 Set the default ELF image symbol visibility to the specified option---all
22790 symbols are marked with this unless overridden within the code.
22791 Using this feature can very substantially improve linking and
22792 load times of shared object libraries, produce more optimized
22793 code, provide near-perfect API export and prevent symbol clashes.
22794 It is @strong{strongly} recommended that you use this in any shared objects
22797 Despite the nomenclature, @code{default} always means public; i.e.,
22798 available to be linked against from outside the shared object.
22799 @code{protected} and @code{internal} are pretty useless in real-world
22800 usage so the only other commonly used option is @code{hidden}.
22801 The default if @option{-fvisibility} isn't specified is
22802 @code{default}, i.e., make every
22803 symbol public---this causes the same behavior as previous versions of
22806 A good explanation of the benefits offered by ensuring ELF
22807 symbols have the correct visibility is given by ``How To Write
22808 Shared Libraries'' by Ulrich Drepper (which can be found at
22809 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
22810 solution made possible by this option to marking things hidden when
22811 the default is public is to make the default hidden and mark things
22812 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
22813 and @code{__attribute__ ((visibility("default")))} instead of
22814 @code{__declspec(dllexport)} you get almost identical semantics with
22815 identical syntax. This is a great boon to those working with
22816 cross-platform projects.
22818 For those adding visibility support to existing code, you may find
22819 @samp{#pragma GCC visibility} of use. This works by you enclosing
22820 the declarations you wish to set visibility for with (for example)
22821 @samp{#pragma GCC visibility push(hidden)} and
22822 @samp{#pragma GCC visibility pop}.
22823 Bear in mind that symbol visibility should be viewed @strong{as
22824 part of the API interface contract} and thus all new code should
22825 always specify visibility when it is not the default; i.e., declarations
22826 only for use within the local DSO should @strong{always} be marked explicitly
22827 as hidden as so to avoid PLT indirection overheads---making this
22828 abundantly clear also aids readability and self-documentation of the code.
22829 Note that due to ISO C++ specification requirements, @code{operator new} and
22830 @code{operator delete} must always be of default visibility.
22832 Be aware that headers from outside your project, in particular system
22833 headers and headers from any other library you use, may not be
22834 expecting to be compiled with visibility other than the default. You
22835 may need to explicitly say @samp{#pragma GCC visibility push(default)}
22836 before including any such headers.
22838 @samp{extern} declarations are not affected by @option{-fvisibility}, so
22839 a lot of code can be recompiled with @option{-fvisibility=hidden} with
22840 no modifications. However, this means that calls to @code{extern}
22841 functions with no explicit visibility use the PLT, so it is more
22842 effective to use @code{__attribute ((visibility))} and/or
22843 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
22844 declarations should be treated as hidden.
22846 Note that @option{-fvisibility} does affect C++ vague linkage
22847 entities. This means that, for instance, an exception class that is
22848 be thrown between DSOs must be explicitly marked with default
22849 visibility so that the @samp{type_info} nodes are unified between
22852 An overview of these techniques, their benefits and how to use them
22853 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
22855 @item -fstrict-volatile-bitfields
22856 @opindex fstrict-volatile-bitfields
22857 This option should be used if accesses to volatile bit-fields (or other
22858 structure fields, although the compiler usually honors those types
22859 anyway) should use a single access of the width of the
22860 field's type, aligned to a natural alignment if possible. For
22861 example, targets with memory-mapped peripheral registers might require
22862 all such accesses to be 16 bits wide; with this flag you can
22863 declare all peripheral bit-fields as @code{unsigned short} (assuming short
22864 is 16 bits on these targets) to force GCC to use 16-bit accesses
22865 instead of, perhaps, a more efficient 32-bit access.
22867 If this option is disabled, the compiler uses the most efficient
22868 instruction. In the previous example, that might be a 32-bit load
22869 instruction, even though that accesses bytes that do not contain
22870 any portion of the bit-field, or memory-mapped registers unrelated to
22871 the one being updated.
22873 In some cases, such as when the @code{packed} attribute is applied to a
22874 structure field, it may not be possible to access the field with a single
22875 read or write that is correctly aligned for the target machine. In this
22876 case GCC falls back to generating multiple accesses rather than code that
22877 will fault or truncate the result at run time.
22879 Note: Due to restrictions of the C/C++11 memory model, write accesses are
22880 not allowed to touch non bit-field members. It is therefore recommended
22881 to define all bits of the field's type as bit-field members.
22883 The default value of this option is determined by the application binary
22884 interface for the target processor.
22886 @item -fsync-libcalls
22887 @opindex fsync-libcalls
22888 This option controls whether any out-of-line instance of the @code{__sync}
22889 family of functions may be used to implement the C++11 @code{__atomic}
22890 family of functions.
22892 The default value of this option is enabled, thus the only useful form
22893 of the option is @option{-fno-sync-libcalls}. This option is used in
22894 the implementation of the @file{libatomic} runtime library.
22900 @node Environment Variables
22901 @section Environment Variables Affecting GCC
22902 @cindex environment variables
22904 @c man begin ENVIRONMENT
22905 This section describes several environment variables that affect how GCC
22906 operates. Some of them work by specifying directories or prefixes to use
22907 when searching for various kinds of files. Some are used to specify other
22908 aspects of the compilation environment.
22910 Note that you can also specify places to search using options such as
22911 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
22912 take precedence over places specified using environment variables, which
22913 in turn take precedence over those specified by the configuration of GCC@.
22914 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
22915 GNU Compiler Collection (GCC) Internals}.
22920 @c @itemx LC_COLLATE
22922 @c @itemx LC_MONETARY
22923 @c @itemx LC_NUMERIC
22928 @c @findex LC_COLLATE
22929 @findex LC_MESSAGES
22930 @c @findex LC_MONETARY
22931 @c @findex LC_NUMERIC
22935 These environment variables control the way that GCC uses
22936 localization information which allows GCC to work with different
22937 national conventions. GCC inspects the locale categories
22938 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
22939 so. These locale categories can be set to any value supported by your
22940 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
22941 Kingdom encoded in UTF-8.
22943 The @env{LC_CTYPE} environment variable specifies character
22944 classification. GCC uses it to determine the character boundaries in
22945 a string; this is needed for some multibyte encodings that contain quote
22946 and escape characters that are otherwise interpreted as a string
22949 The @env{LC_MESSAGES} environment variable specifies the language to
22950 use in diagnostic messages.
22952 If the @env{LC_ALL} environment variable is set, it overrides the value
22953 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
22954 and @env{LC_MESSAGES} default to the value of the @env{LANG}
22955 environment variable. If none of these variables are set, GCC
22956 defaults to traditional C English behavior.
22960 If @env{TMPDIR} is set, it specifies the directory to use for temporary
22961 files. GCC uses temporary files to hold the output of one stage of
22962 compilation which is to be used as input to the next stage: for example,
22963 the output of the preprocessor, which is the input to the compiler
22966 @item GCC_COMPARE_DEBUG
22967 @findex GCC_COMPARE_DEBUG
22968 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
22969 @option{-fcompare-debug} to the compiler driver. See the documentation
22970 of this option for more details.
22972 @item GCC_EXEC_PREFIX
22973 @findex GCC_EXEC_PREFIX
22974 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
22975 names of the subprograms executed by the compiler. No slash is added
22976 when this prefix is combined with the name of a subprogram, but you can
22977 specify a prefix that ends with a slash if you wish.
22979 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
22980 an appropriate prefix to use based on the pathname it is invoked with.
22982 If GCC cannot find the subprogram using the specified prefix, it
22983 tries looking in the usual places for the subprogram.
22985 The default value of @env{GCC_EXEC_PREFIX} is
22986 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
22987 the installed compiler. In many cases @var{prefix} is the value
22988 of @code{prefix} when you ran the @file{configure} script.
22990 Other prefixes specified with @option{-B} take precedence over this prefix.
22992 This prefix is also used for finding files such as @file{crt0.o} that are
22995 In addition, the prefix is used in an unusual way in finding the
22996 directories to search for header files. For each of the standard
22997 directories whose name normally begins with @samp{/usr/local/lib/gcc}
22998 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
22999 replacing that beginning with the specified prefix to produce an
23000 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
23001 @file{foo/bar} just before it searches the standard directory
23002 @file{/usr/local/lib/bar}.
23003 If a standard directory begins with the configured
23004 @var{prefix} then the value of @var{prefix} is replaced by
23005 @env{GCC_EXEC_PREFIX} when looking for header files.
23007 @item COMPILER_PATH
23008 @findex COMPILER_PATH
23009 The value of @env{COMPILER_PATH} is a colon-separated list of
23010 directories, much like @env{PATH}. GCC tries the directories thus
23011 specified when searching for subprograms, if it can't find the
23012 subprograms using @env{GCC_EXEC_PREFIX}.
23015 @findex LIBRARY_PATH
23016 The value of @env{LIBRARY_PATH} is a colon-separated list of
23017 directories, much like @env{PATH}. When configured as a native compiler,
23018 GCC tries the directories thus specified when searching for special
23019 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
23020 using GCC also uses these directories when searching for ordinary
23021 libraries for the @option{-l} option (but directories specified with
23022 @option{-L} come first).
23026 @cindex locale definition
23027 This variable is used to pass locale information to the compiler. One way in
23028 which this information is used is to determine the character set to be used
23029 when character literals, string literals and comments are parsed in C and C++.
23030 When the compiler is configured to allow multibyte characters,
23031 the following values for @env{LANG} are recognized:
23035 Recognize JIS characters.
23037 Recognize SJIS characters.
23039 Recognize EUCJP characters.
23042 If @env{LANG} is not defined, or if it has some other value, then the
23043 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
23044 recognize and translate multibyte characters.
23048 Some additional environment variables affect the behavior of the
23051 @include cppenv.texi
23055 @node Precompiled Headers
23056 @section Using Precompiled Headers
23057 @cindex precompiled headers
23058 @cindex speed of compilation
23060 Often large projects have many header files that are included in every
23061 source file. The time the compiler takes to process these header files
23062 over and over again can account for nearly all of the time required to
23063 build the project. To make builds faster, GCC allows you to
23064 @dfn{precompile} a header file.
23066 To create a precompiled header file, simply compile it as you would any
23067 other file, if necessary using the @option{-x} option to make the driver
23068 treat it as a C or C++ header file. You may want to use a
23069 tool like @command{make} to keep the precompiled header up-to-date when
23070 the headers it contains change.
23072 A precompiled header file is searched for when @code{#include} is
23073 seen in the compilation. As it searches for the included file
23074 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
23075 compiler looks for a precompiled header in each directory just before it
23076 looks for the include file in that directory. The name searched for is
23077 the name specified in the @code{#include} with @samp{.gch} appended. If
23078 the precompiled header file can't be used, it is ignored.
23080 For instance, if you have @code{#include "all.h"}, and you have
23081 @file{all.h.gch} in the same directory as @file{all.h}, then the
23082 precompiled header file is used if possible, and the original
23083 header is used otherwise.
23085 Alternatively, you might decide to put the precompiled header file in a
23086 directory and use @option{-I} to ensure that directory is searched
23087 before (or instead of) the directory containing the original header.
23088 Then, if you want to check that the precompiled header file is always
23089 used, you can put a file of the same name as the original header in this
23090 directory containing an @code{#error} command.
23092 This also works with @option{-include}. So yet another way to use
23093 precompiled headers, good for projects not designed with precompiled
23094 header files in mind, is to simply take most of the header files used by
23095 a project, include them from another header file, precompile that header
23096 file, and @option{-include} the precompiled header. If the header files
23097 have guards against multiple inclusion, they are skipped because
23098 they've already been included (in the precompiled header).
23100 If you need to precompile the same header file for different
23101 languages, targets, or compiler options, you can instead make a
23102 @emph{directory} named like @file{all.h.gch}, and put each precompiled
23103 header in the directory, perhaps using @option{-o}. It doesn't matter
23104 what you call the files in the directory; every precompiled header in
23105 the directory is considered. The first precompiled header
23106 encountered in the directory that is valid for this compilation is
23107 used; they're searched in no particular order.
23109 There are many other possibilities, limited only by your imagination,
23110 good sense, and the constraints of your build system.
23112 A precompiled header file can be used only when these conditions apply:
23116 Only one precompiled header can be used in a particular compilation.
23119 A precompiled header can't be used once the first C token is seen. You
23120 can have preprocessor directives before a precompiled header; you cannot
23121 include a precompiled header from inside another header.
23124 The precompiled header file must be produced for the same language as
23125 the current compilation. You can't use a C precompiled header for a C++
23129 The precompiled header file must have been produced by the same compiler
23130 binary as the current compilation is using.
23133 Any macros defined before the precompiled header is included must
23134 either be defined in the same way as when the precompiled header was
23135 generated, or must not affect the precompiled header, which usually
23136 means that they don't appear in the precompiled header at all.
23138 The @option{-D} option is one way to define a macro before a
23139 precompiled header is included; using a @code{#define} can also do it.
23140 There are also some options that define macros implicitly, like
23141 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
23144 @item If debugging information is output when using the precompiled
23145 header, using @option{-g} or similar, the same kind of debugging information
23146 must have been output when building the precompiled header. However,
23147 a precompiled header built using @option{-g} can be used in a compilation
23148 when no debugging information is being output.
23150 @item The same @option{-m} options must generally be used when building
23151 and using the precompiled header. @xref{Submodel Options},
23152 for any cases where this rule is relaxed.
23154 @item Each of the following options must be the same when building and using
23155 the precompiled header:
23157 @gccoptlist{-fexceptions}
23160 Some other command-line options starting with @option{-f},
23161 @option{-p}, or @option{-O} must be defined in the same way as when
23162 the precompiled header was generated. At present, it's not clear
23163 which options are safe to change and which are not; the safest choice
23164 is to use exactly the same options when generating and using the
23165 precompiled header. The following are known to be safe:
23167 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
23168 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
23169 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
23174 For all of these except the last, the compiler automatically
23175 ignores the precompiled header if the conditions aren't met. If you
23176 find an option combination that doesn't work and doesn't cause the
23177 precompiled header to be ignored, please consider filing a bug report,
23180 If you do use differing options when generating and using the
23181 precompiled header, the actual behavior is a mixture of the
23182 behavior for the options. For instance, if you use @option{-g} to
23183 generate the precompiled header but not when using it, you may or may
23184 not get debugging information for routines in the precompiled header.