1 @c Copyright (C) 1988-2018 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-2018 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. @command{g++} accepts mostly the same options as @command{gcc}.
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(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.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
126 @xref{Option Index}, for an index to GCC's options.
129 * Option Summary:: Brief list of all options, without explanations.
130 * Overall Options:: Controlling the kind of output:
131 an executable, object files, assembler files,
132 or preprocessed source.
133 * Invoking G++:: Compiling C++ programs.
134 * C Dialect Options:: Controlling the variant of C language compiled.
135 * C++ Dialect Options:: Variations on C++.
136 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
138 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
140 * Warning Options:: How picky should the compiler be?
141 * Debugging Options:: Producing debuggable code.
142 * Optimize Options:: How much optimization?
143 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
144 * Preprocessor Options:: Controlling header files and macro definitions.
145 Also, getting dependency information for Make.
146 * Assembler Options:: Passing options to the assembler.
147 * Link Options:: Specifying libraries and so on.
148 * Directory Options:: Where to find header files and libraries.
149 Where to find the compiler executable files.
150 * Code Gen Options:: Specifying conventions for function calls, data layout
152 * Developer Options:: Printing GCC configuration info, statistics, and
154 * Submodel Options:: Target-specific options, such as compiling for a
155 specific processor variant.
156 * Spec Files:: How to pass switches to sub-processes.
157 * Environment Variables:: Env vars that affect GCC.
158 * Precompiled Headers:: Compiling a header once, and using it many times.
164 @section Option Summary
166 Here is a summary of all the options, grouped by type. Explanations are
167 in the following sections.
170 @item Overall Options
171 @xref{Overall Options,,Options Controlling the Kind of Output}.
172 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
173 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
174 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
175 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
176 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
177 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
179 @item C Language Options
180 @xref{C Dialect Options,,Options Controlling C Dialect}.
181 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
182 -fpermitted-flt-eval-methods=@var{standard} @gol
183 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
184 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
185 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
186 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
187 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
188 -fsigned-bitfields -fsigned-char @gol
189 -funsigned-bitfields -funsigned-char}
191 @item C++ Language Options
192 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
193 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
194 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
195 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -fnew-inheriting-ctors @gol
203 -fnew-ttp-matching @gol
204 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
205 -fno-optional-diags -fpermissive @gol
206 -fno-pretty-templates @gol
207 -frepo -fno-rtti -fsized-deallocation @gol
208 -ftemplate-backtrace-limit=@var{n} @gol
209 -ftemplate-depth=@var{n} @gol
210 -fno-threadsafe-statics -fuse-cxa-atexit @gol
211 -fno-weak -nostdinc++ @gol
212 -fvisibility-inlines-hidden @gol
213 -fvisibility-ms-compat @gol
214 -fext-numeric-literals @gol
215 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
216 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wliteral-suffix @gol
217 -Wmultiple-inheritance @gol
218 -Wnamespaces -Wnarrowing @gol
219 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
220 -Wnon-virtual-dtor -Wreorder -Wregister @gol
221 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
222 -Wno-non-template-friend -Wold-style-cast @gol
223 -Woverloaded-virtual -Wno-pmf-conversions @gol
224 -Wsign-promo -Wvirtual-inheritance}
226 @item Objective-C and Objective-C++ Language Options
227 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
228 Objective-C and Objective-C++ Dialects}.
229 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
230 -fgnu-runtime -fnext-runtime @gol
231 -fno-nil-receivers @gol
232 -fobjc-abi-version=@var{n} @gol
233 -fobjc-call-cxx-cdtors @gol
234 -fobjc-direct-dispatch @gol
235 -fobjc-exceptions @gol
238 -fobjc-std=objc1 @gol
239 -fno-local-ivars @gol
240 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
241 -freplace-objc-classes @gol
244 -Wassign-intercept @gol
245 -Wno-protocol -Wselector @gol
246 -Wstrict-selector-match @gol
247 -Wundeclared-selector}
249 @item Diagnostic Message Formatting Options
250 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
251 @gccoptlist{-fmessage-length=@var{n} @gol
252 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
253 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
254 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
255 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
256 -fdiagnostics-show-template-tree -fno-elide-type @gol
259 @item Warning Options
260 @xref{Warning Options,,Options to Request or Suppress Warnings}.
261 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
262 -pedantic-errors @gol
263 -w -Wextra -Wall -Waddress -Waggregate-return @gol
264 -Walloc-zero -Walloc-size-larger-than=@var{n}
265 -Walloca -Walloca-larger-than=@var{n} @gol
266 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
267 -Wno-attributes -Wbool-compare -Wbool-operation @gol
268 -Wno-builtin-declaration-mismatch @gol
269 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
270 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
271 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
272 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
273 -Wclobbered -Wcomment -Wconditionally-supported @gol
274 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
275 -Wdelete-incomplete @gol
276 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
277 -Wdisabled-optimization @gol
278 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
279 -Wno-div-by-zero -Wdouble-promotion @gol
280 -Wduplicated-branches -Wduplicated-cond @gol
281 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
282 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
283 -Wfloat-equal -Wformat -Wformat=2 @gol
284 -Wno-format-contains-nul -Wno-format-extra-args @gol
285 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
286 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
287 -Wformat-y2k -Wframe-address @gol
288 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
289 -Wif-not-aligned @gol
290 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
291 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
292 -Wimplicit-function-declaration -Wimplicit-int @gol
293 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
294 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
295 -Winvalid-pch -Wlarger-than=@var{len} @gol
296 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
297 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
298 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
299 -Wmissing-field-initializers -Wmissing-include-dirs @gol
300 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
301 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
302 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
303 -Woverride-init-side-effects -Woverlength-strings @gol
304 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
305 -Wparentheses -Wno-pedantic-ms-format @gol
306 -Wplacement-new -Wplacement-new=@var{n} @gol
307 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
308 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
309 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
310 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
311 -Wshift-overflow -Wshift-overflow=@var{n} @gol
312 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
313 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
314 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
315 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
316 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
317 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
318 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
319 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
320 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
321 -Wmissing-format-attribute -Wsubobject-linkage @gol
322 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
323 -Wswitch-unreachable -Wsync-nand @gol
324 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
325 -Wtype-limits -Wundef @gol
326 -Wuninitialized -Wunknown-pragmas @gol
327 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
328 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
329 -Wunused-parameter -Wno-unused-result @gol
330 -Wunused-value -Wunused-variable @gol
331 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
332 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
333 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
334 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
335 -Wzero-as-null-pointer-constant -Whsa}
337 @item C and Objective-C-only Warning Options
338 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
339 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
340 -Wold-style-declaration -Wold-style-definition @gol
341 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
342 -Wdeclaration-after-statement -Wpointer-sign}
344 @item Debugging Options
345 @xref{Debugging Options,,Options for Debugging Your Program}.
346 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
347 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
348 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
349 -gas-loc-support -gno-as-loc-support @gol
350 -gas-locview-support -gno-as-locview-support @gol
351 -gcolumn-info -gno-column-info @gol
352 -gstatement-frontiers -gno-statement-frontiers @gol
353 -gvariable-location-views -gno-variable-location-views @gol
354 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
355 -ginline-points -gno-inline-points @gol
356 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
358 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
359 -fno-eliminate-unused-debug-types @gol
360 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
361 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
362 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
363 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
364 -fvar-tracking -fvar-tracking-assignments}
366 @item Optimization Options
367 @xref{Optimize Options,,Options that Control Optimization}.
368 @gccoptlist{-faggressive-loop-optimizations @gol
369 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
370 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
371 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
372 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
373 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
374 -fauto-inc-dec -fbranch-probabilities @gol
375 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
376 -fbtr-bb-exclusive -fcaller-saves @gol
377 -fcombine-stack-adjustments -fconserve-stack @gol
378 -fcompare-elim -fcprop-registers -fcrossjumping @gol
379 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
380 -fcx-limited-range @gol
381 -fdata-sections -fdce -fdelayed-branch @gol
382 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
383 -fdevirtualize-at-ltrans -fdse @gol
384 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
385 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
386 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
387 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
388 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
389 -fif-conversion2 -findirect-inlining @gol
390 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
391 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
392 -fipa-bit-cp -fipa-vrp @gol
393 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
394 -fira-algorithm=@var{algorithm} @gol
395 -fira-region=@var{region} -fira-hoist-pressure @gol
396 -fira-loop-pressure -fno-ira-share-save-slots @gol
397 -fno-ira-share-spill-slots @gol
398 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
399 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
400 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
401 -floop-block -floop-interchange -floop-strip-mine @gol
402 -floop-unroll-and-jam -floop-nest-optimize @gol
403 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
404 -flto-partition=@var{alg} -fmerge-all-constants @gol
405 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
406 -fmove-loop-invariants -fno-branch-count-reg @gol
407 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
408 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
409 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
410 -fno-sched-spec -fno-signed-zeros @gol
411 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
412 -fomit-frame-pointer -foptimize-sibling-calls @gol
413 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
414 -fprefetch-loop-arrays @gol
415 -fprofile-correction @gol
416 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
417 -fprofile-reorder-functions @gol
418 -freciprocal-math -free -frename-registers -freorder-blocks @gol
419 -freorder-blocks-algorithm=@var{algorithm} @gol
420 -freorder-blocks-and-partition -freorder-functions @gol
421 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
422 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
423 -fsched-spec-load -fsched-spec-load-dangerous @gol
424 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
425 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
426 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
427 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
428 -fschedule-fusion @gol
429 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
430 -fselective-scheduling -fselective-scheduling2 @gol
431 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
432 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
433 -fsignaling-nans @gol
434 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
436 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
437 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
438 -fthread-jumps -ftracer -ftree-bit-ccp @gol
439 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
440 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
441 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
442 -ftree-loop-if-convert -ftree-loop-im @gol
443 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
444 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
445 -ftree-loop-vectorize @gol
446 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
447 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
448 -ftree-switch-conversion -ftree-tail-merge @gol
449 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
450 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
451 -funsafe-math-optimizations -funswitch-loops @gol
452 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
453 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
454 --param @var{name}=@var{value}
455 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
457 @item Program Instrumentation Options
458 @xref{Instrumentation Options,,Program Instrumentation Options}.
459 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
460 -fprofile-abs-path @gol
461 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
462 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
463 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
464 -fsanitize-undefined-trap-on-error -fbounds-check @gol
465 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
466 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
467 -fstack-protector-explicit -fstack-check @gol
468 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
469 -fno-stack-limit -fsplit-stack @gol
470 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
471 -fvtv-counts -fvtv-debug @gol
472 -finstrument-functions @gol
473 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
474 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
476 @item Preprocessor Options
477 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
478 @gccoptlist{-A@var{question}=@var{answer} @gol
479 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
480 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
481 -dD -dI -dM -dN -dU @gol
482 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
483 -fexec-charset=@var{charset} -fextended-identifiers @gol
484 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
485 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
486 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
487 -fwide-exec-charset=@var{charset} -fworking-directory @gol
488 -H -imacros @var{file} -include @var{file} @gol
489 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
490 -no-integrated-cpp -P -pthread -remap @gol
491 -traditional -traditional-cpp -trigraphs @gol
492 -U@var{macro} -undef @gol
493 -Wp,@var{option} -Xpreprocessor @var{option}}
495 @item Assembler Options
496 @xref{Assembler Options,,Passing Options to the Assembler}.
497 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
500 @xref{Link Options,,Options for Linking}.
501 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
502 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
503 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
504 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
505 -shared -shared-libgcc -symbolic @gol
506 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
507 -u @var{symbol} -z @var{keyword}}
509 @item Directory Options
510 @xref{Directory Options,,Options for Directory Search}.
511 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
512 -idirafter @var{dir} @gol
513 -imacros @var{file} -imultilib @var{dir} @gol
514 -iplugindir=@var{dir} -iprefix @var{file} @gol
515 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
516 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
517 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
518 -nostdinc -nostdinc++ --sysroot=@var{dir}}
520 @item Code Generation Options
521 @xref{Code Gen Options,,Options for Code Generation Conventions}.
522 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
523 -ffixed-@var{reg} -fexceptions @gol
524 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
525 -fasynchronous-unwind-tables @gol
527 -finhibit-size-directive -fno-common -fno-ident @gol
528 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
529 -fno-jump-tables @gol
530 -frecord-gcc-switches @gol
531 -freg-struct-return -fshort-enums -fshort-wchar @gol
532 -fverbose-asm -fpack-struct[=@var{n}] @gol
533 -fleading-underscore -ftls-model=@var{model} @gol
534 -fstack-reuse=@var{reuse_level} @gol
535 -ftrampolines -ftrapv -fwrapv @gol
536 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
537 -fstrict-volatile-bitfields -fsync-libcalls}
539 @item Developer Options
540 @xref{Developer Options,,GCC Developer Options}.
541 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
542 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
543 -fdbg-cnt=@var{counter-value-list} @gol
544 -fdisable-ipa-@var{pass_name} @gol
545 -fdisable-rtl-@var{pass_name} @gol
546 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
547 -fdisable-tree-@var{pass_name} @gol
548 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
549 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
550 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
551 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
552 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
554 -fdump-lang-@var{switch} @gol
555 -fdump-lang-@var{switch}-@var{options} @gol
556 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
558 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
559 -fdump-statistics @gol
561 -fdump-tree-@var{switch} @gol
562 -fdump-tree-@var{switch}-@var{options} @gol
563 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
564 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
565 -fenable-@var{kind}-@var{pass} @gol
566 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
567 -fira-verbose=@var{n} @gol
568 -flto-report -flto-report-wpa -fmem-report-wpa @gol
569 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
570 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
571 -fprofile-report @gol
572 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
573 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
574 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
575 -fvar-tracking-assignments-toggle -gtoggle @gol
576 -print-file-name=@var{library} -print-libgcc-file-name @gol
577 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
578 -print-prog-name=@var{program} -print-search-dirs -Q @gol
579 -print-sysroot -print-sysroot-headers-suffix @gol
580 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
582 @item Machine-Dependent Options
583 @xref{Submodel Options,,Machine-Dependent Options}.
584 @c This list is ordered alphanumerically by subsection name.
585 @c Try and put the significant identifier (CPU or system) first,
586 @c so users have a clue at guessing where the ones they want will be.
588 @emph{AArch64 Options}
589 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
590 -mgeneral-regs-only @gol
591 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
592 -mstrict-align -mno-strict-align @gol
593 -momit-leaf-frame-pointer @gol
594 -mtls-dialect=desc -mtls-dialect=traditional @gol
595 -mtls-size=@var{size} @gol
596 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
597 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
598 -mpc-relative-literal-loads @gol
599 -msign-return-address=@var{scope} @gol
600 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
601 -moverride=@var{string} -mverbose-cost-dump}
603 @emph{Adapteva Epiphany Options}
604 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
605 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
606 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
607 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
608 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
609 -msplit-vecmove-early -m1reg-@var{reg}}
612 @gccoptlist{-mbarrel-shifter -mjli-always @gol
613 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
614 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
615 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
616 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
617 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
618 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
619 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
620 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
621 -mvolatile-cache -mtp-regno=@var{regno} @gol
622 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
623 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
624 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
625 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
626 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
627 -mtune=@var{cpu} -mmultcost=@var{num} @gol
628 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
629 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16}
632 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
633 -mabi=@var{name} @gol
634 -mapcs-stack-check -mno-apcs-stack-check @gol
635 -mapcs-reentrant -mno-apcs-reentrant @gol
636 -msched-prolog -mno-sched-prolog @gol
637 -mlittle-endian -mbig-endian @gol
639 -mfloat-abi=@var{name} @gol
640 -mfp16-format=@var{name}
641 -mthumb-interwork -mno-thumb-interwork @gol
642 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
643 -mtune=@var{name} -mprint-tune-info @gol
644 -mstructure-size-boundary=@var{n} @gol
645 -mabort-on-noreturn @gol
646 -mlong-calls -mno-long-calls @gol
647 -msingle-pic-base -mno-single-pic-base @gol
648 -mpic-register=@var{reg} @gol
649 -mnop-fun-dllimport @gol
650 -mpoke-function-name @gol
651 -mthumb -marm -mflip-thumb @gol
652 -mtpcs-frame -mtpcs-leaf-frame @gol
653 -mcaller-super-interworking -mcallee-super-interworking @gol
654 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
655 -mword-relocations @gol
656 -mfix-cortex-m3-ldrd @gol
657 -munaligned-access @gol
658 -mneon-for-64bits @gol
659 -mslow-flash-data @gol
660 -masm-syntax-unified @gol
662 -mverbose-cost-dump @gol
667 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
668 -mbranch-cost=@var{cost} @gol
669 -mcall-prologues -mgas-isr-prologues -mint8 @gol
670 -mn_flash=@var{size} -mno-interrupts @gol
671 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
672 -mfract-convert-truncate @gol
673 -mshort-calls -nodevicelib @gol
674 -Waddr-space-convert -Wmisspelled-isr}
676 @emph{Blackfin Options}
677 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
678 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
679 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
680 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
681 -mno-id-shared-library -mshared-library-id=@var{n} @gol
682 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
683 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
684 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
688 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
689 -msim -msdata=@var{sdata-type}}
692 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
693 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
694 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
695 -mstack-align -mdata-align -mconst-align @gol
696 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
697 -melf -maout -melinux -mlinux -sim -sim2 @gol
698 -mmul-bug-workaround -mno-mul-bug-workaround}
701 @gccoptlist{-mmac @gol
702 -mcr16cplus -mcr16c @gol
703 -msim -mint32 -mbit-ops
704 -mdata-model=@var{model}}
706 @emph{Darwin Options}
707 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
708 -arch_only -bind_at_load -bundle -bundle_loader @gol
709 -client_name -compatibility_version -current_version @gol
711 -dependency-file -dylib_file -dylinker_install_name @gol
712 -dynamic -dynamiclib -exported_symbols_list @gol
713 -filelist -flat_namespace -force_cpusubtype_ALL @gol
714 -force_flat_namespace -headerpad_max_install_names @gol
716 -image_base -init -install_name -keep_private_externs @gol
717 -multi_module -multiply_defined -multiply_defined_unused @gol
718 -noall_load -no_dead_strip_inits_and_terms @gol
719 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
720 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
721 -private_bundle -read_only_relocs -sectalign @gol
722 -sectobjectsymbols -whyload -seg1addr @gol
723 -sectcreate -sectobjectsymbols -sectorder @gol
724 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
725 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
726 -segprot -segs_read_only_addr -segs_read_write_addr @gol
727 -single_module -static -sub_library -sub_umbrella @gol
728 -twolevel_namespace -umbrella -undefined @gol
729 -unexported_symbols_list -weak_reference_mismatches @gol
730 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
731 -mkernel -mone-byte-bool}
733 @emph{DEC Alpha Options}
734 @gccoptlist{-mno-fp-regs -msoft-float @gol
735 -mieee -mieee-with-inexact -mieee-conformant @gol
736 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
737 -mtrap-precision=@var{mode} -mbuild-constants @gol
738 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
739 -mbwx -mmax -mfix -mcix @gol
740 -mfloat-vax -mfloat-ieee @gol
741 -mexplicit-relocs -msmall-data -mlarge-data @gol
742 -msmall-text -mlarge-text @gol
743 -mmemory-latency=@var{time}}
746 @gccoptlist{-msmall-model -mno-lsim}
749 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
752 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
753 -mhard-float -msoft-float @gol
754 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
755 -mdouble -mno-double @gol
756 -mmedia -mno-media -mmuladd -mno-muladd @gol
757 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
758 -mlinked-fp -mlong-calls -malign-labels @gol
759 -mlibrary-pic -macc-4 -macc-8 @gol
760 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
761 -moptimize-membar -mno-optimize-membar @gol
762 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
763 -mvliw-branch -mno-vliw-branch @gol
764 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
765 -mno-nested-cond-exec -mtomcat-stats @gol
769 @emph{GNU/Linux Options}
770 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
771 -tno-android-cc -tno-android-ld}
773 @emph{H8/300 Options}
774 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
777 @gccoptlist{-march=@var{architecture-type} @gol
778 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
779 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
780 -mfixed-range=@var{register-range} @gol
781 -mjump-in-delay -mlinker-opt -mlong-calls @gol
782 -mlong-load-store -mno-disable-fpregs @gol
783 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
784 -mno-jump-in-delay -mno-long-load-store @gol
785 -mno-portable-runtime -mno-soft-float @gol
786 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
787 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
788 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
789 -munix=@var{unix-std} -nolibdld -static -threads}
792 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
793 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
794 -mconstant-gp -mauto-pic -mfused-madd @gol
795 -minline-float-divide-min-latency @gol
796 -minline-float-divide-max-throughput @gol
797 -mno-inline-float-divide @gol
798 -minline-int-divide-min-latency @gol
799 -minline-int-divide-max-throughput @gol
800 -mno-inline-int-divide @gol
801 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
802 -mno-inline-sqrt @gol
803 -mdwarf2-asm -mearly-stop-bits @gol
804 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
805 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
806 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
807 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
808 -msched-spec-ldc -msched-spec-control-ldc @gol
809 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
810 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
811 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
812 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
815 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
816 -msign-extend-enabled -muser-enabled}
818 @emph{M32R/D Options}
819 @gccoptlist{-m32r2 -m32rx -m32r @gol
821 -malign-loops -mno-align-loops @gol
822 -missue-rate=@var{number} @gol
823 -mbranch-cost=@var{number} @gol
824 -mmodel=@var{code-size-model-type} @gol
825 -msdata=@var{sdata-type} @gol
826 -mno-flush-func -mflush-func=@var{name} @gol
827 -mno-flush-trap -mflush-trap=@var{number} @gol
831 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
833 @emph{M680x0 Options}
834 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
835 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
836 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
837 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
838 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
839 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
840 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
841 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
842 -mxgot -mno-xgot -mlong-jump-table-offsets}
845 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
846 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
847 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
848 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
849 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
852 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
853 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
854 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
855 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
858 @emph{MicroBlaze Options}
859 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
860 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
861 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
862 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
863 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
864 -mpic-data-is-text-relative}
867 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
868 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
869 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
870 -mips16 -mno-mips16 -mflip-mips16 @gol
871 -minterlink-compressed -mno-interlink-compressed @gol
872 -minterlink-mips16 -mno-interlink-mips16 @gol
873 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
874 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
875 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
876 -mno-float -msingle-float -mdouble-float @gol
877 -modd-spreg -mno-odd-spreg @gol
878 -mabs=@var{mode} -mnan=@var{encoding} @gol
879 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
882 -mvirt -mno-virt @gol
885 -mginv -mno-ginv @gol
886 -mmicromips -mno-micromips @gol
888 -mfpu=@var{fpu-type} @gol
889 -msmartmips -mno-smartmips @gol
890 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
891 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
892 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
893 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
894 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
895 -membedded-data -mno-embedded-data @gol
896 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
897 -mcode-readable=@var{setting} @gol
898 -msplit-addresses -mno-split-addresses @gol
899 -mexplicit-relocs -mno-explicit-relocs @gol
900 -mcheck-zero-division -mno-check-zero-division @gol
901 -mdivide-traps -mdivide-breaks @gol
902 -mload-store-pairs -mno-load-store-pairs @gol
903 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
904 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
905 -mfix-24k -mno-fix-24k @gol
906 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
907 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
908 -mfix-vr4120 -mno-fix-vr4120 @gol
909 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
910 -mflush-func=@var{func} -mno-flush-func @gol
911 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
912 -mcompact-branches=@var{policy} @gol
913 -mfp-exceptions -mno-fp-exceptions @gol
914 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
915 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
916 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
917 -mframe-header-opt -mno-frame-header-opt}
920 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
921 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
922 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
923 -mno-base-addresses -msingle-exit -mno-single-exit}
925 @emph{MN10300 Options}
926 @gccoptlist{-mmult-bug -mno-mult-bug @gol
927 -mno-am33 -mam33 -mam33-2 -mam34 @gol
928 -mtune=@var{cpu-type} @gol
929 -mreturn-pointer-on-d0 @gol
930 -mno-crt0 -mrelax -mliw -msetlb}
933 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
935 @emph{MSP430 Options}
936 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
938 -mcode-region= -mdata-region= @gol
939 -msilicon-errata= -msilicon-errata-warn= @gol
943 @gccoptlist{-mbig-endian -mlittle-endian @gol
944 -mreduced-regs -mfull-regs @gol
945 -mcmov -mno-cmov @gol
946 -mext-perf -mno-ext-perf @gol
947 -mext-perf2 -mno-ext-perf2 @gol
948 -mext-string -mno-ext-string @gol
949 -mv3push -mno-v3push @gol
950 -m16bit -mno-16bit @gol
951 -misr-vector-size=@var{num} @gol
952 -mcache-block-size=@var{num} @gol
953 -march=@var{arch} @gol
954 -mcmodel=@var{code-model} @gol
957 @emph{Nios II Options}
958 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
959 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
961 -mno-bypass-cache -mbypass-cache @gol
962 -mno-cache-volatile -mcache-volatile @gol
963 -mno-fast-sw-div -mfast-sw-div @gol
964 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
965 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
966 -mcustom-fpu-cfg=@var{name} @gol
967 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
968 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
970 @emph{Nvidia PTX Options}
971 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
973 @emph{PDP-11 Options}
974 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
975 -mint32 -mno-int16 -mint16 -mno-int32 @gol
976 -mfloat32 -mno-float64 -mfloat64 -mno-float32 @gol
977 -msplit -munix-asm -mdec-asm -mgnu-asm}
979 @emph{picoChip Options}
980 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
981 -msymbol-as-address -mno-inefficient-warnings}
983 @emph{PowerPC Options}
984 See RS/6000 and PowerPC Options.
986 @emph{PowerPC SPE Options}
987 @gccoptlist{-mcpu=@var{cpu-type} @gol
988 -mtune=@var{cpu-type} @gol
989 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
990 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
991 -m32 -mxl-compat -mno-xl-compat @gol
992 -malign-power -malign-natural @gol
993 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
994 -msingle-float -mdouble-float @gol
995 -mupdate -mno-update @gol
996 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
997 -mstrict-align -mno-strict-align -mrelocatable @gol
998 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
999 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1000 -msingle-pic-base @gol
1001 -mprioritize-restricted-insns=@var{priority} @gol
1002 -msched-costly-dep=@var{dependence_type} @gol
1003 -minsert-sched-nops=@var{scheme} @gol
1004 -mcall-sysv -mcall-netbsd @gol
1005 -maix-struct-return -msvr4-struct-return @gol
1006 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1007 -mblock-move-inline-limit=@var{num} @gol
1008 -misel -mno-isel @gol
1009 -misel=yes -misel=no @gol
1011 -mspe=yes -mspe=no @gol
1012 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1013 -mprototype -mno-prototype @gol
1014 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1015 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1016 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1017 -mno-recip-precision @gol
1018 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1019 -msave-toc-indirect -mno-save-toc-indirect @gol
1020 -mcompat-align-parm -mno-compat-align-parm @gol
1021 -mfloat128 -mno-float128 @gol
1022 -mgnu-attribute -mno-gnu-attribute @gol
1023 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1024 -mstack-protector-guard-offset=@var{offset}}
1026 @emph{RISC-V Options}
1027 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1029 -mabi=@var{ABI-string} @gol
1030 -mfdiv -mno-fdiv @gol
1032 -march=@var{ISA-string} @gol
1033 -mtune=@var{processor-string} @gol
1034 -mpreferred-stack-boundary=@var{num} @gol
1035 -msmall-data-limit=@var{N-bytes} @gol
1036 -msave-restore -mno-save-restore @gol
1037 -mstrict-align -mno-strict-align @gol
1038 -mcmodel=medlow -mcmodel=medany @gol
1039 -mexplicit-relocs -mno-explicit-relocs @gol
1040 -mrelax -mno-relax @gol}
1043 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1044 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1045 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1047 @emph{RS/6000 and PowerPC Options}
1048 @gccoptlist{-mcpu=@var{cpu-type} @gol
1049 -mtune=@var{cpu-type} @gol
1050 -mcmodel=@var{code-model} @gol
1052 -maltivec -mno-altivec @gol
1053 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1054 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1055 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1056 -mfprnd -mno-fprnd @gol
1057 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1058 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1059 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1060 -malign-power -malign-natural @gol
1061 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1062 -mupdate -mno-update @gol
1063 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1064 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1065 -mstrict-align -mno-strict-align -mrelocatable @gol
1066 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1067 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1068 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1069 -mprioritize-restricted-insns=@var{priority} @gol
1070 -msched-costly-dep=@var{dependence_type} @gol
1071 -minsert-sched-nops=@var{scheme} @gol
1072 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1073 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1074 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1075 -mtraceback=@var{traceback_type} @gol
1076 -maix-struct-return -msvr4-struct-return @gol
1077 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1078 -mblock-move-inline-limit=@var{num} @gol
1079 -mblock-compare-inline-limit=@var{num} @gol
1080 -mblock-compare-inline-loop-limit=@var{num} @gol
1081 -mstring-compare-inline-limit=@var{num} @gol
1082 -misel -mno-isel @gol
1083 -misel=yes -misel=no @gol
1084 -mvrsave -mno-vrsave @gol
1085 -mmulhw -mno-mulhw @gol
1086 -mdlmzb -mno-dlmzb @gol
1087 -mprototype -mno-prototype @gol
1088 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1089 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1090 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1091 -mno-recip-precision @gol
1092 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1093 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1094 -msave-toc-indirect -mno-save-toc-indirect @gol
1095 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1096 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1097 -mquad-memory -mno-quad-memory @gol
1098 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1099 -mcompat-align-parm -mno-compat-align-parm @gol
1100 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1101 -mgnu-attribute -mno-gnu-attribute @gol
1102 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1103 -mstack-protector-guard-offset=@var{offset}}
1106 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1108 -mbig-endian-data -mlittle-endian-data @gol
1111 -mas100-syntax -mno-as100-syntax@gol
1113 -mmax-constant-size=@gol
1116 -mallow-string-insns -mno-allow-string-insns@gol
1118 -mno-warn-multiple-fast-interrupts@gol
1119 -msave-acc-in-interrupts}
1121 @emph{S/390 and zSeries Options}
1122 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1123 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1124 -mlong-double-64 -mlong-double-128 @gol
1125 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1126 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1127 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1128 -mhtm -mvx -mzvector @gol
1129 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1130 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1131 -mhotpatch=@var{halfwords},@var{halfwords}}
1133 @emph{Score Options}
1134 @gccoptlist{-meb -mel @gol
1138 -mscore5 -mscore5u -mscore7 -mscore7d}
1141 @gccoptlist{-m1 -m2 -m2e @gol
1142 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1144 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1145 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1146 -mb -ml -mdalign -mrelax @gol
1147 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1148 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1149 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1150 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1151 -maccumulate-outgoing-args @gol
1152 -matomic-model=@var{atomic-model} @gol
1153 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1154 -mcbranch-force-delay-slot @gol
1155 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1156 -mpretend-cmove -mtas}
1158 @emph{Solaris 2 Options}
1159 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1162 @emph{SPARC Options}
1163 @gccoptlist{-mcpu=@var{cpu-type} @gol
1164 -mtune=@var{cpu-type} @gol
1165 -mcmodel=@var{code-model} @gol
1166 -mmemory-model=@var{mem-model} @gol
1167 -m32 -m64 -mapp-regs -mno-app-regs @gol
1168 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1169 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1170 -mhard-quad-float -msoft-quad-float @gol
1171 -mstack-bias -mno-stack-bias @gol
1172 -mstd-struct-return -mno-std-struct-return @gol
1173 -munaligned-doubles -mno-unaligned-doubles @gol
1174 -muser-mode -mno-user-mode @gol
1175 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1176 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1177 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1178 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1179 -mpopc -mno-popc -msubxc -mno-subxc @gol
1180 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1184 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1185 -msafe-dma -munsafe-dma @gol
1187 -msmall-mem -mlarge-mem -mstdmain @gol
1188 -mfixed-range=@var{register-range} @gol
1190 -maddress-space-conversion -mno-address-space-conversion @gol
1191 -mcache-size=@var{cache-size} @gol
1192 -matomic-updates -mno-atomic-updates}
1194 @emph{System V Options}
1195 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1197 @emph{TILE-Gx Options}
1198 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1199 -mcmodel=@var{code-model}}
1201 @emph{TILEPro Options}
1202 @gccoptlist{-mcpu=@var{cpu} -m32}
1205 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1206 -mprolog-function -mno-prolog-function -mspace @gol
1207 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1208 -mapp-regs -mno-app-regs @gol
1209 -mdisable-callt -mno-disable-callt @gol
1210 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1211 -mv850e -mv850 -mv850e3v5 @gol
1222 @gccoptlist{-mg -mgnu -munix}
1224 @emph{Visium Options}
1225 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1226 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1229 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1230 -mpointer-size=@var{size}}
1232 @emph{VxWorks Options}
1233 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1234 -Xbind-lazy -Xbind-now}
1237 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1238 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1239 -mfpmath=@var{unit} @gol
1240 -masm=@var{dialect} -mno-fancy-math-387 @gol
1241 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1242 -mno-wide-multiply -mrtd -malign-double @gol
1243 -mpreferred-stack-boundary=@var{num} @gol
1244 -mincoming-stack-boundary=@var{num} @gol
1245 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1246 -mrecip -mrecip=@var{opt} @gol
1247 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1248 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1249 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1250 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1251 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1252 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1253 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1254 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1255 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1256 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1257 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1259 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1260 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1261 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1262 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1263 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1264 -mregparm=@var{num} -msseregparm @gol
1265 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1266 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1267 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1268 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1269 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1270 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1271 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1272 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1273 -mstack-protector-guard-reg=@var{reg} @gol
1274 -mstack-protector-guard-offset=@var{offset} @gol
1275 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1276 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1277 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1278 -mindirect-branch-register}
1280 @emph{x86 Windows Options}
1281 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1282 -mnop-fun-dllimport -mthread @gol
1283 -municode -mwin32 -mwindows -fno-set-stack-executable}
1285 @emph{Xstormy16 Options}
1288 @emph{Xtensa Options}
1289 @gccoptlist{-mconst16 -mno-const16 @gol
1290 -mfused-madd -mno-fused-madd @gol
1292 -mserialize-volatile -mno-serialize-volatile @gol
1293 -mtext-section-literals -mno-text-section-literals @gol
1294 -mauto-litpools -mno-auto-litpools @gol
1295 -mtarget-align -mno-target-align @gol
1296 -mlongcalls -mno-longcalls}
1298 @emph{zSeries Options}
1299 See S/390 and zSeries Options.
1303 @node Overall Options
1304 @section Options Controlling the Kind of Output
1306 Compilation can involve up to four stages: preprocessing, compilation
1307 proper, assembly and linking, always in that order. GCC is capable of
1308 preprocessing and compiling several files either into several
1309 assembler input files, or into one assembler input file; then each
1310 assembler input file produces an object file, and linking combines all
1311 the object files (those newly compiled, and those specified as input)
1312 into an executable file.
1314 @cindex file name suffix
1315 For any given input file, the file name suffix determines what kind of
1316 compilation is done:
1320 C source code that must be preprocessed.
1323 C source code that should not be preprocessed.
1326 C++ source code that should not be preprocessed.
1329 Objective-C source code. Note that you must link with the @file{libobjc}
1330 library to make an Objective-C program work.
1333 Objective-C source code that should not be preprocessed.
1337 Objective-C++ source code. Note that you must link with the @file{libobjc}
1338 library to make an Objective-C++ program work. Note that @samp{.M} refers
1339 to a literal capital M@.
1341 @item @var{file}.mii
1342 Objective-C++ source code that should not be preprocessed.
1345 C, C++, Objective-C or Objective-C++ header file to be turned into a
1346 precompiled header (default), or C, C++ header file to be turned into an
1347 Ada spec (via the @option{-fdump-ada-spec} switch).
1350 @itemx @var{file}.cp
1351 @itemx @var{file}.cxx
1352 @itemx @var{file}.cpp
1353 @itemx @var{file}.CPP
1354 @itemx @var{file}.c++
1356 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1357 the last two letters must both be literally @samp{x}. Likewise,
1358 @samp{.C} refers to a literal capital C@.
1362 Objective-C++ source code that must be preprocessed.
1364 @item @var{file}.mii
1365 Objective-C++ source code that should not be preprocessed.
1369 @itemx @var{file}.hp
1370 @itemx @var{file}.hxx
1371 @itemx @var{file}.hpp
1372 @itemx @var{file}.HPP
1373 @itemx @var{file}.h++
1374 @itemx @var{file}.tcc
1375 C++ header file to be turned into a precompiled header or Ada spec.
1378 @itemx @var{file}.for
1379 @itemx @var{file}.ftn
1380 Fixed form Fortran source code that should not be preprocessed.
1383 @itemx @var{file}.FOR
1384 @itemx @var{file}.fpp
1385 @itemx @var{file}.FPP
1386 @itemx @var{file}.FTN
1387 Fixed form Fortran source code that must be preprocessed (with the traditional
1390 @item @var{file}.f90
1391 @itemx @var{file}.f95
1392 @itemx @var{file}.f03
1393 @itemx @var{file}.f08
1394 Free form Fortran source code that should not be preprocessed.
1396 @item @var{file}.F90
1397 @itemx @var{file}.F95
1398 @itemx @var{file}.F03
1399 @itemx @var{file}.F08
1400 Free form Fortran source code that must be preprocessed (with the
1401 traditional preprocessor).
1406 @item @var{file}.brig
1407 BRIG files (binary representation of HSAIL).
1409 @item @var{file}.ads
1410 Ada source code file that contains a library unit declaration (a
1411 declaration of a package, subprogram, or generic, or a generic
1412 instantiation), or a library unit renaming declaration (a package,
1413 generic, or subprogram renaming declaration). Such files are also
1416 @item @var{file}.adb
1417 Ada source code file containing a library unit body (a subprogram or
1418 package body). Such files are also called @dfn{bodies}.
1420 @c GCC also knows about some suffixes for languages not yet included:
1431 @itemx @var{file}.sx
1432 Assembler code that must be preprocessed.
1435 An object file to be fed straight into linking.
1436 Any file name with no recognized suffix is treated this way.
1440 You can specify the input language explicitly with the @option{-x} option:
1443 @item -x @var{language}
1444 Specify explicitly the @var{language} for the following input files
1445 (rather than letting the compiler choose a default based on the file
1446 name suffix). This option applies to all following input files until
1447 the next @option{-x} option. Possible values for @var{language} are:
1449 c c-header cpp-output
1450 c++ c++-header c++-cpp-output
1451 objective-c objective-c-header objective-c-cpp-output
1452 objective-c++ objective-c++-header objective-c++-cpp-output
1453 assembler assembler-with-cpp
1455 f77 f77-cpp-input f95 f95-cpp-input
1461 Turn off any specification of a language, so that subsequent files are
1462 handled according to their file name suffixes (as they are if @option{-x}
1463 has not been used at all).
1466 If you only want some of the stages of compilation, you can use
1467 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1468 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1469 @command{gcc} is to stop. Note that some combinations (for example,
1470 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1475 Compile or assemble the source files, but do not link. The linking
1476 stage simply is not done. The ultimate output is in the form of an
1477 object file for each source file.
1479 By default, the object file name for a source file is made by replacing
1480 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1482 Unrecognized input files, not requiring compilation or assembly, are
1487 Stop after the stage of compilation proper; do not assemble. The output
1488 is in the form of an assembler code file for each non-assembler input
1491 By default, the assembler file name for a source file is made by
1492 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1494 Input files that don't require compilation are ignored.
1498 Stop after the preprocessing stage; do not run the compiler proper. The
1499 output is in the form of preprocessed source code, which is sent to the
1502 Input files that don't require preprocessing are ignored.
1504 @cindex output file option
1507 Place output in file @var{file}. This applies to whatever
1508 sort of output is being produced, whether it be an executable file,
1509 an object file, an assembler file or preprocessed C code.
1511 If @option{-o} is not specified, the default is to put an executable
1512 file in @file{a.out}, the object file for
1513 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1514 assembler file in @file{@var{source}.s}, a precompiled header file in
1515 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1520 Print (on standard error output) the commands executed to run the stages
1521 of compilation. Also print the version number of the compiler driver
1522 program and of the preprocessor and the compiler proper.
1526 Like @option{-v} except the commands are not executed and arguments
1527 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1528 This is useful for shell scripts to capture the driver-generated command lines.
1532 Print (on the standard output) a description of the command-line options
1533 understood by @command{gcc}. If the @option{-v} option is also specified
1534 then @option{--help} is also passed on to the various processes
1535 invoked by @command{gcc}, so that they can display the command-line options
1536 they accept. If the @option{-Wextra} option has also been specified
1537 (prior to the @option{--help} option), then command-line options that
1538 have no documentation associated with them are also displayed.
1541 @opindex target-help
1542 Print (on the standard output) a description of target-specific command-line
1543 options for each tool. For some targets extra target-specific
1544 information may also be printed.
1546 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1547 Print (on the standard output) a description of the command-line
1548 options understood by the compiler that fit into all specified classes
1549 and qualifiers. These are the supported classes:
1552 @item @samp{optimizers}
1553 Display all of the optimization options supported by the
1556 @item @samp{warnings}
1557 Display all of the options controlling warning messages
1558 produced by the compiler.
1561 Display target-specific options. Unlike the
1562 @option{--target-help} option however, target-specific options of the
1563 linker and assembler are not displayed. This is because those
1564 tools do not currently support the extended @option{--help=} syntax.
1567 Display the values recognized by the @option{--param}
1570 @item @var{language}
1571 Display the options supported for @var{language}, where
1572 @var{language} is the name of one of the languages supported in this
1576 Display the options that are common to all languages.
1579 These are the supported qualifiers:
1582 @item @samp{undocumented}
1583 Display only those options that are undocumented.
1586 Display options taking an argument that appears after an equal
1587 sign in the same continuous piece of text, such as:
1588 @samp{--help=target}.
1590 @item @samp{separate}
1591 Display options taking an argument that appears as a separate word
1592 following the original option, such as: @samp{-o output-file}.
1595 Thus for example to display all the undocumented target-specific
1596 switches supported by the compiler, use:
1599 --help=target,undocumented
1602 The sense of a qualifier can be inverted by prefixing it with the
1603 @samp{^} character, so for example to display all binary warning
1604 options (i.e., ones that are either on or off and that do not take an
1605 argument) that have a description, use:
1608 --help=warnings,^joined,^undocumented
1611 The argument to @option{--help=} should not consist solely of inverted
1614 Combining several classes is possible, although this usually
1615 restricts the output so much that there is nothing to display. One
1616 case where it does work, however, is when one of the classes is
1617 @var{target}. For example, to display all the target-specific
1618 optimization options, use:
1621 --help=target,optimizers
1624 The @option{--help=} option can be repeated on the command line. Each
1625 successive use displays its requested class of options, skipping
1626 those that have already been displayed.
1628 If the @option{-Q} option appears on the command line before the
1629 @option{--help=} option, then the descriptive text displayed by
1630 @option{--help=} is changed. Instead of describing the displayed
1631 options, an indication is given as to whether the option is enabled,
1632 disabled or set to a specific value (assuming that the compiler
1633 knows this at the point where the @option{--help=} option is used).
1635 Here is a truncated example from the ARM port of @command{gcc}:
1638 % gcc -Q -mabi=2 --help=target -c
1639 The following options are target specific:
1641 -mabort-on-noreturn [disabled]
1645 The output is sensitive to the effects of previous command-line
1646 options, so for example it is possible to find out which optimizations
1647 are enabled at @option{-O2} by using:
1650 -Q -O2 --help=optimizers
1653 Alternatively you can discover which binary optimizations are enabled
1654 by @option{-O3} by using:
1657 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1658 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1659 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1664 Display the version number and copyrights of the invoked GCC@.
1666 @item -pass-exit-codes
1667 @opindex pass-exit-codes
1668 Normally the @command{gcc} program exits with the code of 1 if any
1669 phase of the compiler returns a non-success return code. If you specify
1670 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1671 the numerically highest error produced by any phase returning an error
1672 indication. The C, C++, and Fortran front ends return 4 if an internal
1673 compiler error is encountered.
1677 Use pipes rather than temporary files for communication between the
1678 various stages of compilation. This fails to work on some systems where
1679 the assembler is unable to read from a pipe; but the GNU assembler has
1682 @item -specs=@var{file}
1684 Process @var{file} after the compiler reads in the standard @file{specs}
1685 file, in order to override the defaults which the @command{gcc} driver
1686 program uses when determining what switches to pass to @command{cc1},
1687 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1688 @option{-specs=@var{file}} can be specified on the command line, and they
1689 are processed in order, from left to right. @xref{Spec Files}, for
1690 information about the format of the @var{file}.
1694 Invoke all subcommands under a wrapper program. The name of the
1695 wrapper program and its parameters are passed as a comma separated
1699 gcc -c t.c -wrapper gdb,--args
1703 This invokes all subprograms of @command{gcc} under
1704 @samp{gdb --args}, thus the invocation of @command{cc1} is
1705 @samp{gdb --args cc1 @dots{}}.
1707 @item -ffile-prefix-map=@var{old}=@var{new}
1708 @opindex ffile-prefix-map
1709 When compiling files residing in directory @file{@var{old}}, record
1710 any references to them in the result of the compilation as if the
1711 files resided in directory @file{@var{new}} instead. Specifying this
1712 option is equivalent to specifying all the individual
1713 @option{-f*-prefix-map} options. This can be used to make reproducible
1714 builds that are location independent. See also
1715 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1717 @item -fplugin=@var{name}.so
1719 Load the plugin code in file @var{name}.so, assumed to be a
1720 shared object to be dlopen'd by the compiler. The base name of
1721 the shared object file is used to identify the plugin for the
1722 purposes of argument parsing (See
1723 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1724 Each plugin should define the callback functions specified in the
1727 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1728 @opindex fplugin-arg
1729 Define an argument called @var{key} with a value of @var{value}
1730 for the plugin called @var{name}.
1732 @item -fdump-ada-spec@r{[}-slim@r{]}
1733 @opindex fdump-ada-spec
1734 For C and C++ source and include files, generate corresponding Ada specs.
1735 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1736 GNAT User's Guide}, which provides detailed documentation on this feature.
1738 @item -fada-spec-parent=@var{unit}
1739 @opindex fada-spec-parent
1740 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1741 Ada specs as child units of parent @var{unit}.
1743 @item -fdump-go-spec=@var{file}
1744 @opindex fdump-go-spec
1745 For input files in any language, generate corresponding Go
1746 declarations in @var{file}. This generates Go @code{const},
1747 @code{type}, @code{var}, and @code{func} declarations which may be a
1748 useful way to start writing a Go interface to code written in some
1751 @include @value{srcdir}/../libiberty/at-file.texi
1755 @section Compiling C++ Programs
1757 @cindex suffixes for C++ source
1758 @cindex C++ source file suffixes
1759 C++ source files conventionally use one of the suffixes @samp{.C},
1760 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1761 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1762 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1763 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1764 files with these names and compiles them as C++ programs even if you
1765 call the compiler the same way as for compiling C programs (usually
1766 with the name @command{gcc}).
1770 However, the use of @command{gcc} does not add the C++ library.
1771 @command{g++} is a program that calls GCC and automatically specifies linking
1772 against the C++ library. It treats @samp{.c},
1773 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1774 files unless @option{-x} is used. This program is also useful when
1775 precompiling a C header file with a @samp{.h} extension for use in C++
1776 compilations. On many systems, @command{g++} is also installed with
1777 the name @command{c++}.
1779 @cindex invoking @command{g++}
1780 When you compile C++ programs, you may specify many of the same
1781 command-line options that you use for compiling programs in any
1782 language; or command-line options meaningful for C and related
1783 languages; or options that are meaningful only for C++ programs.
1784 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1785 explanations of options for languages related to C@.
1786 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1787 explanations of options that are meaningful only for C++ programs.
1789 @node C Dialect Options
1790 @section Options Controlling C Dialect
1791 @cindex dialect options
1792 @cindex language dialect options
1793 @cindex options, dialect
1795 The following options control the dialect of C (or languages derived
1796 from C, such as C++, Objective-C and Objective-C++) that the compiler
1800 @cindex ANSI support
1804 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1805 equivalent to @option{-std=c++98}.
1807 This turns off certain features of GCC that are incompatible with ISO
1808 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1809 such as the @code{asm} and @code{typeof} keywords, and
1810 predefined macros such as @code{unix} and @code{vax} that identify the
1811 type of system you are using. It also enables the undesirable and
1812 rarely used ISO trigraph feature. For the C compiler,
1813 it disables recognition of C++ style @samp{//} comments as well as
1814 the @code{inline} keyword.
1816 The alternate keywords @code{__asm__}, @code{__extension__},
1817 @code{__inline__} and @code{__typeof__} continue to work despite
1818 @option{-ansi}. You would not want to use them in an ISO C program, of
1819 course, but it is useful to put them in header files that might be included
1820 in compilations done with @option{-ansi}. Alternate predefined macros
1821 such as @code{__unix__} and @code{__vax__} are also available, with or
1822 without @option{-ansi}.
1824 The @option{-ansi} option does not cause non-ISO programs to be
1825 rejected gratuitously. For that, @option{-Wpedantic} is required in
1826 addition to @option{-ansi}. @xref{Warning Options}.
1828 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1829 option is used. Some header files may notice this macro and refrain
1830 from declaring certain functions or defining certain macros that the
1831 ISO standard doesn't call for; this is to avoid interfering with any
1832 programs that might use these names for other things.
1834 Functions that are normally built in but do not have semantics
1835 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1836 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1837 built-in functions provided by GCC}, for details of the functions
1842 Determine the language standard. @xref{Standards,,Language Standards
1843 Supported by GCC}, for details of these standard versions. This option
1844 is currently only supported when compiling C or C++.
1846 The compiler can accept several base standards, such as @samp{c90} or
1847 @samp{c++98}, and GNU dialects of those standards, such as
1848 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1849 compiler accepts all programs following that standard plus those
1850 using GNU extensions that do not contradict it. For example,
1851 @option{-std=c90} turns off certain features of GCC that are
1852 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1853 keywords, but not other GNU extensions that do not have a meaning in
1854 ISO C90, such as omitting the middle term of a @code{?:}
1855 expression. On the other hand, when a GNU dialect of a standard is
1856 specified, all features supported by the compiler are enabled, even when
1857 those features change the meaning of the base standard. As a result, some
1858 strict-conforming programs may be rejected. The particular standard
1859 is used by @option{-Wpedantic} to identify which features are GNU
1860 extensions given that version of the standard. For example
1861 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1862 comments, while @option{-std=gnu99 -Wpedantic} does not.
1864 A value for this option must be provided; possible values are
1870 Support all ISO C90 programs (certain GNU extensions that conflict
1871 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1873 @item iso9899:199409
1874 ISO C90 as modified in amendment 1.
1880 ISO C99. This standard is substantially completely supported, modulo
1881 bugs and floating-point issues
1882 (mainly but not entirely relating to optional C99 features from
1883 Annexes F and G). See
1884 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1885 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1890 ISO C11, the 2011 revision of the ISO C standard. This standard is
1891 substantially completely supported, modulo bugs, floating-point issues
1892 (mainly but not entirely relating to optional C11 features from
1893 Annexes F and G) and the optional Annexes K (Bounds-checking
1894 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1900 ISO C17, the 2017 revision of the ISO C standard (expected to be
1901 published in 2018). This standard is
1902 same as C11 except for corrections of defects (all of which are also
1903 applied with @option{-std=c11}) and a new value of
1904 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1908 GNU dialect of ISO C90 (including some C99 features).
1912 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1916 GNU dialect of ISO C11.
1917 The name @samp{gnu1x} is deprecated.
1921 GNU dialect of ISO C17. This is the default for C code.
1925 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1926 additional defect reports. Same as @option{-ansi} for C++ code.
1930 GNU dialect of @option{-std=c++98}.
1934 The 2011 ISO C++ standard plus amendments.
1935 The name @samp{c++0x} is deprecated.
1939 GNU dialect of @option{-std=c++11}.
1940 The name @samp{gnu++0x} is deprecated.
1944 The 2014 ISO C++ standard plus amendments.
1945 The name @samp{c++1y} is deprecated.
1949 GNU dialect of @option{-std=c++14}.
1950 This is the default for C++ code.
1951 The name @samp{gnu++1y} is deprecated.
1955 The 2017 ISO C++ standard plus amendments.
1956 The name @samp{c++1z} is deprecated.
1960 GNU dialect of @option{-std=c++17}.
1961 The name @samp{gnu++1z} is deprecated.
1964 The next revision of the ISO C++ standard, tentatively planned for
1965 2020. Support is highly experimental, and will almost certainly
1966 change in incompatible ways in future releases.
1969 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
1970 and will almost certainly change in incompatible ways in future
1974 @item -fgnu89-inline
1975 @opindex fgnu89-inline
1976 The option @option{-fgnu89-inline} tells GCC to use the traditional
1977 GNU semantics for @code{inline} functions when in C99 mode.
1978 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1979 Using this option is roughly equivalent to adding the
1980 @code{gnu_inline} function attribute to all inline functions
1981 (@pxref{Function Attributes}).
1983 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1984 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1985 specifies the default behavior).
1986 This option is not supported in @option{-std=c90} or
1987 @option{-std=gnu90} mode.
1989 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1990 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1991 in effect for @code{inline} functions. @xref{Common Predefined
1992 Macros,,,cpp,The C Preprocessor}.
1994 @item -fpermitted-flt-eval-methods=@var{style}
1995 @opindex fpermitted-flt-eval-methods
1996 @opindex fpermitted-flt-eval-methods=c11
1997 @opindex fpermitted-flt-eval-methods=ts-18661-3
1998 ISO/IEC TS 18661-3 defines new permissible values for
1999 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2000 a semantic type that is an interchange or extended format should be
2001 evaluated to the precision and range of that type. These new values are
2002 a superset of those permitted under C99/C11, which does not specify the
2003 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2004 conforming to C11 may not have been written expecting the possibility of
2007 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2008 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2009 or the extended set of values specified in ISO/IEC TS 18661-3.
2011 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2013 The default when in a standards compliant mode (@option{-std=c11} or similar)
2014 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2015 dialect (@option{-std=gnu11} or similar) is
2016 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2018 @item -aux-info @var{filename}
2020 Output to the given filename prototyped declarations for all functions
2021 declared and/or defined in a translation unit, including those in header
2022 files. This option is silently ignored in any language other than C@.
2024 Besides declarations, the file indicates, in comments, the origin of
2025 each declaration (source file and line), whether the declaration was
2026 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2027 @samp{O} for old, respectively, in the first character after the line
2028 number and the colon), and whether it came from a declaration or a
2029 definition (@samp{C} or @samp{F}, respectively, in the following
2030 character). In the case of function definitions, a K&R-style list of
2031 arguments followed by their declarations is also provided, inside
2032 comments, after the declaration.
2034 @item -fallow-parameterless-variadic-functions
2035 @opindex fallow-parameterless-variadic-functions
2036 Accept variadic functions without named parameters.
2038 Although it is possible to define such a function, this is not very
2039 useful as it is not possible to read the arguments. This is only
2040 supported for C as this construct is allowed by C++.
2044 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2045 keyword, so that code can use these words as identifiers. You can use
2046 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2047 instead. @option{-ansi} implies @option{-fno-asm}.
2049 In C++, this switch only affects the @code{typeof} keyword, since
2050 @code{asm} and @code{inline} are standard keywords. You may want to
2051 use the @option{-fno-gnu-keywords} flag instead, which has the same
2052 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2053 switch only affects the @code{asm} and @code{typeof} keywords, since
2054 @code{inline} is a standard keyword in ISO C99.
2057 @itemx -fno-builtin-@var{function}
2058 @opindex fno-builtin
2059 @cindex built-in functions
2060 Don't recognize built-in functions that do not begin with
2061 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2062 functions provided by GCC}, for details of the functions affected,
2063 including those which are not built-in functions when @option{-ansi} or
2064 @option{-std} options for strict ISO C conformance are used because they
2065 do not have an ISO standard meaning.
2067 GCC normally generates special code to handle certain built-in functions
2068 more efficiently; for instance, calls to @code{alloca} may become single
2069 instructions which adjust the stack directly, and calls to @code{memcpy}
2070 may become inline copy loops. The resulting code is often both smaller
2071 and faster, but since the function calls no longer appear as such, you
2072 cannot set a breakpoint on those calls, nor can you change the behavior
2073 of the functions by linking with a different library. In addition,
2074 when a function is recognized as a built-in function, GCC may use
2075 information about that function to warn about problems with calls to
2076 that function, or to generate more efficient code, even if the
2077 resulting code still contains calls to that function. For example,
2078 warnings are given with @option{-Wformat} for bad calls to
2079 @code{printf} when @code{printf} is built in and @code{strlen} is
2080 known not to modify global memory.
2082 With the @option{-fno-builtin-@var{function}} option
2083 only the built-in function @var{function} is
2084 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2085 function is named that is not built-in in this version of GCC, this
2086 option is ignored. There is no corresponding
2087 @option{-fbuiltin-@var{function}} option; if you wish to enable
2088 built-in functions selectively when using @option{-fno-builtin} or
2089 @option{-ffreestanding}, you may define macros such as:
2092 #define abs(n) __builtin_abs ((n))
2093 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2099 Enable parsing of function definitions marked with @code{__GIMPLE}.
2100 This is an experimental feature that allows unit testing of GIMPLE
2105 @cindex hosted environment
2107 Assert that compilation targets a hosted environment. This implies
2108 @option{-fbuiltin}. A hosted environment is one in which the
2109 entire standard library is available, and in which @code{main} has a return
2110 type of @code{int}. Examples are nearly everything except a kernel.
2111 This is equivalent to @option{-fno-freestanding}.
2113 @item -ffreestanding
2114 @opindex ffreestanding
2115 @cindex hosted environment
2117 Assert that compilation targets a freestanding environment. This
2118 implies @option{-fno-builtin}. A freestanding environment
2119 is one in which the standard library may not exist, and program startup may
2120 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2121 This is equivalent to @option{-fno-hosted}.
2123 @xref{Standards,,Language Standards Supported by GCC}, for details of
2124 freestanding and hosted environments.
2128 @cindex OpenACC accelerator programming
2129 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2130 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2131 compiler generates accelerated code according to the OpenACC Application
2132 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2133 implies @option{-pthread}, and thus is only supported on targets that
2134 have support for @option{-pthread}.
2136 @item -fopenacc-dim=@var{geom}
2137 @opindex fopenacc-dim
2138 @cindex OpenACC accelerator programming
2139 Specify default compute dimensions for parallel offload regions that do
2140 not explicitly specify. The @var{geom} value is a triple of
2141 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2142 can be omitted, to use a target-specific default value.
2146 @cindex OpenMP parallel
2147 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2148 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2149 compiler generates parallel code according to the OpenMP Application
2150 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2151 implies @option{-pthread}, and thus is only supported on targets that
2152 have support for @option{-pthread}. @option{-fopenmp} implies
2153 @option{-fopenmp-simd}.
2156 @opindex fopenmp-simd
2159 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2160 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2165 When the option @option{-fgnu-tm} is specified, the compiler
2166 generates code for the Linux variant of Intel's current Transactional
2167 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2168 an experimental feature whose interface may change in future versions
2169 of GCC, as the official specification changes. Please note that not
2170 all architectures are supported for this feature.
2172 For more information on GCC's support for transactional memory,
2173 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2174 Transactional Memory Library}.
2176 Note that the transactional memory feature is not supported with
2177 non-call exceptions (@option{-fnon-call-exceptions}).
2179 @item -fms-extensions
2180 @opindex fms-extensions
2181 Accept some non-standard constructs used in Microsoft header files.
2183 In C++ code, this allows member names in structures to be similar
2184 to previous types declarations.
2193 Some cases of unnamed fields in structures and unions are only
2194 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2195 fields within structs/unions}, for details.
2197 Note that this option is off for all targets but x86
2198 targets using ms-abi.
2200 @item -fplan9-extensions
2201 @opindex fplan9-extensions
2202 Accept some non-standard constructs used in Plan 9 code.
2204 This enables @option{-fms-extensions}, permits passing pointers to
2205 structures with anonymous fields to functions that expect pointers to
2206 elements of the type of the field, and permits referring to anonymous
2207 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2208 struct/union fields within structs/unions}, for details. This is only
2209 supported for C, not C++.
2211 @item -fcond-mismatch
2212 @opindex fcond-mismatch
2213 Allow conditional expressions with mismatched types in the second and
2214 third arguments. The value of such an expression is void. This option
2215 is not supported for C++.
2217 @item -flax-vector-conversions
2218 @opindex flax-vector-conversions
2219 Allow implicit conversions between vectors with differing numbers of
2220 elements and/or incompatible element types. This option should not be
2223 @item -funsigned-char
2224 @opindex funsigned-char
2225 Let the type @code{char} be unsigned, like @code{unsigned char}.
2227 Each kind of machine has a default for what @code{char} should
2228 be. It is either like @code{unsigned char} by default or like
2229 @code{signed char} by default.
2231 Ideally, a portable program should always use @code{signed char} or
2232 @code{unsigned char} when it depends on the signedness of an object.
2233 But many programs have been written to use plain @code{char} and
2234 expect it to be signed, or expect it to be unsigned, depending on the
2235 machines they were written for. This option, and its inverse, let you
2236 make such a program work with the opposite default.
2238 The type @code{char} is always a distinct type from each of
2239 @code{signed char} or @code{unsigned char}, even though its behavior
2240 is always just like one of those two.
2243 @opindex fsigned-char
2244 Let the type @code{char} be signed, like @code{signed char}.
2246 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2247 the negative form of @option{-funsigned-char}. Likewise, the option
2248 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2250 @item -fsigned-bitfields
2251 @itemx -funsigned-bitfields
2252 @itemx -fno-signed-bitfields
2253 @itemx -fno-unsigned-bitfields
2254 @opindex fsigned-bitfields
2255 @opindex funsigned-bitfields
2256 @opindex fno-signed-bitfields
2257 @opindex fno-unsigned-bitfields
2258 These options control whether a bit-field is signed or unsigned, when the
2259 declaration does not use either @code{signed} or @code{unsigned}. By
2260 default, such a bit-field is signed, because this is consistent: the
2261 basic integer types such as @code{int} are signed types.
2263 @item -fsso-struct=@var{endianness}
2264 @opindex fsso-struct
2265 Set the default scalar storage order of structures and unions to the
2266 specified endianness. The accepted values are @samp{big-endian},
2267 @samp{little-endian} and @samp{native} for the native endianness of
2268 the target (the default). This option is not supported for C++.
2270 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2271 code that is not binary compatible with code generated without it if the
2272 specified endianness is not the native endianness of the target.
2275 @node C++ Dialect Options
2276 @section Options Controlling C++ Dialect
2278 @cindex compiler options, C++
2279 @cindex C++ options, command-line
2280 @cindex options, C++
2281 This section describes the command-line options that are only meaningful
2282 for C++ programs. You can also use most of the GNU compiler options
2283 regardless of what language your program is in. For example, you
2284 might compile a file @file{firstClass.C} like this:
2287 g++ -g -fstrict-enums -O -c firstClass.C
2291 In this example, only @option{-fstrict-enums} is an option meant
2292 only for C++ programs; you can use the other options with any
2293 language supported by GCC@.
2295 Some options for compiling C programs, such as @option{-std}, are also
2296 relevant for C++ programs.
2297 @xref{C Dialect Options,,Options Controlling C Dialect}.
2299 Here is a list of options that are @emph{only} for compiling C++ programs:
2303 @item -fabi-version=@var{n}
2304 @opindex fabi-version
2305 Use version @var{n} of the C++ ABI@. The default is version 0.
2307 Version 0 refers to the version conforming most closely to
2308 the C++ ABI specification. Therefore, the ABI obtained using version 0
2309 will change in different versions of G++ as ABI bugs are fixed.
2311 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2313 Version 2 is the version of the C++ ABI that first appeared in G++
2314 3.4, and was the default through G++ 4.9.
2316 Version 3 corrects an error in mangling a constant address as a
2319 Version 4, which first appeared in G++ 4.5, implements a standard
2320 mangling for vector types.
2322 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2323 attribute const/volatile on function pointer types, decltype of a
2324 plain decl, and use of a function parameter in the declaration of
2327 Version 6, which first appeared in G++ 4.7, corrects the promotion
2328 behavior of C++11 scoped enums and the mangling of template argument
2329 packs, const/static_cast, prefix ++ and --, and a class scope function
2330 used as a template argument.
2332 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2333 builtin type and corrects the mangling of lambdas in default argument
2336 Version 8, which first appeared in G++ 4.9, corrects the substitution
2337 behavior of function types with function-cv-qualifiers.
2339 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2342 Version 10, which first appeared in G++ 6.1, adds mangling of
2343 attributes that affect type identity, such as ia32 calling convention
2344 attributes (e.g. @samp{stdcall}).
2346 Version 11, which first appeared in G++ 7, corrects the mangling of
2347 sizeof... expressions and operator names. For multiple entities with
2348 the same name within a function, that are declared in different scopes,
2349 the mangling now changes starting with the twelfth occurrence. It also
2350 implies @option{-fnew-inheriting-ctors}.
2352 Version 12, which first appeared in G++ 8, corrects the calling
2353 conventions for empty classes on the x86_64 target and for classes
2354 with only deleted copy/move constructors. It accidentally changes the
2355 calling convention for classes with a deleted copy constructor and a
2356 trivial move constructor.
2358 Version 13, which first appeared in G++ 8.2, fixes the accidental
2359 change in version 12.
2361 See also @option{-Wabi}.
2363 @item -fabi-compat-version=@var{n}
2364 @opindex fabi-compat-version
2365 On targets that support strong aliases, G++
2366 works around mangling changes by creating an alias with the correct
2367 mangled name when defining a symbol with an incorrect mangled name.
2368 This switch specifies which ABI version to use for the alias.
2370 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2371 compatibility). If another ABI version is explicitly selected, this
2372 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2373 use @option{-fabi-compat-version=2}.
2375 If this option is not provided but @option{-Wabi=@var{n}} is, that
2376 version is used for compatibility aliases. If this option is provided
2377 along with @option{-Wabi} (without the version), the version from this
2378 option is used for the warning.
2380 @item -fno-access-control
2381 @opindex fno-access-control
2382 Turn off all access checking. This switch is mainly useful for working
2383 around bugs in the access control code.
2386 @opindex faligned-new
2387 Enable support for C++17 @code{new} of types that require more
2388 alignment than @code{void* ::operator new(std::size_t)} provides. A
2389 numeric argument such as @code{-faligned-new=32} can be used to
2390 specify how much alignment (in bytes) is provided by that function,
2391 but few users will need to override the default of
2392 @code{alignof(std::max_align_t)}.
2394 This flag is enabled by default for @option{-std=c++17}.
2398 Check that the pointer returned by @code{operator new} is non-null
2399 before attempting to modify the storage allocated. This check is
2400 normally unnecessary because the C++ standard specifies that
2401 @code{operator new} only returns @code{0} if it is declared
2402 @code{throw()}, in which case the compiler always checks the
2403 return value even without this option. In all other cases, when
2404 @code{operator new} has a non-empty exception specification, memory
2405 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2406 @samp{new (nothrow)}.
2410 Enable support for the C++ Extensions for Concepts Technical
2411 Specification, ISO 19217 (2015), which allows code like
2414 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2415 template <Addable T> T add (T a, T b) @{ return a + b; @}
2418 @item -fconstexpr-depth=@var{n}
2419 @opindex fconstexpr-depth
2420 Set the maximum nested evaluation depth for C++11 constexpr functions
2421 to @var{n}. A limit is needed to detect endless recursion during
2422 constant expression evaluation. The minimum specified by the standard
2425 @item -fconstexpr-loop-limit=@var{n}
2426 @opindex fconstexpr-loop-limit
2427 Set the maximum number of iterations for a loop in C++14 constexpr functions
2428 to @var{n}. A limit is needed to detect infinite loops during
2429 constant expression evaluation. The default is 262144 (1<<18).
2431 @item -fdeduce-init-list
2432 @opindex fdeduce-init-list
2433 Enable deduction of a template type parameter as
2434 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2437 template <class T> auto forward(T t) -> decltype (realfn (t))
2444 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2448 This deduction was implemented as a possible extension to the
2449 originally proposed semantics for the C++11 standard, but was not part
2450 of the final standard, so it is disabled by default. This option is
2451 deprecated, and may be removed in a future version of G++.
2453 @item -fno-elide-constructors
2454 @opindex fno-elide-constructors
2455 The C++ standard allows an implementation to omit creating a temporary
2456 that is only used to initialize another object of the same type.
2457 Specifying this option disables that optimization, and forces G++ to
2458 call the copy constructor in all cases. This option also causes G++
2459 to call trivial member functions which otherwise would be expanded inline.
2461 In C++17, the compiler is required to omit these temporaries, but this
2462 option still affects trivial member functions.
2464 @item -fno-enforce-eh-specs
2465 @opindex fno-enforce-eh-specs
2466 Don't generate code to check for violation of exception specifications
2467 at run time. This option violates the C++ standard, but may be useful
2468 for reducing code size in production builds, much like defining
2469 @code{NDEBUG}. This does not give user code permission to throw
2470 exceptions in violation of the exception specifications; the compiler
2471 still optimizes based on the specifications, so throwing an
2472 unexpected exception results in undefined behavior at run time.
2474 @item -fextern-tls-init
2475 @itemx -fno-extern-tls-init
2476 @opindex fextern-tls-init
2477 @opindex fno-extern-tls-init
2478 The C++11 and OpenMP standards allow @code{thread_local} and
2479 @code{threadprivate} variables to have dynamic (runtime)
2480 initialization. To support this, any use of such a variable goes
2481 through a wrapper function that performs any necessary initialization.
2482 When the use and definition of the variable are in the same
2483 translation unit, this overhead can be optimized away, but when the
2484 use is in a different translation unit there is significant overhead
2485 even if the variable doesn't actually need dynamic initialization. If
2486 the programmer can be sure that no use of the variable in a
2487 non-defining TU needs to trigger dynamic initialization (either
2488 because the variable is statically initialized, or a use of the
2489 variable in the defining TU will be executed before any uses in
2490 another TU), they can avoid this overhead with the
2491 @option{-fno-extern-tls-init} option.
2493 On targets that support symbol aliases, the default is
2494 @option{-fextern-tls-init}. On targets that do not support symbol
2495 aliases, the default is @option{-fno-extern-tls-init}.
2497 @item -fno-gnu-keywords
2498 @opindex fno-gnu-keywords
2499 Do not recognize @code{typeof} as a keyword, so that code can use this
2500 word as an identifier. You can use the keyword @code{__typeof__} instead.
2501 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2502 @option{-std=c++98}, @option{-std=c++11}, etc.
2504 @item -fno-implicit-templates
2505 @opindex fno-implicit-templates
2506 Never emit code for non-inline templates that are instantiated
2507 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2508 @xref{Template Instantiation}, for more information.
2510 @item -fno-implicit-inline-templates
2511 @opindex fno-implicit-inline-templates
2512 Don't emit code for implicit instantiations of inline templates, either.
2513 The default is to handle inlines differently so that compiles with and
2514 without optimization need the same set of explicit instantiations.
2516 @item -fno-implement-inlines
2517 @opindex fno-implement-inlines
2518 To save space, do not emit out-of-line copies of inline functions
2519 controlled by @code{#pragma implementation}. This causes linker
2520 errors if these functions are not inlined everywhere they are called.
2522 @item -fms-extensions
2523 @opindex fms-extensions
2524 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2525 int and getting a pointer to member function via non-standard syntax.
2527 @item -fnew-inheriting-ctors
2528 @opindex fnew-inheriting-ctors
2529 Enable the P0136 adjustment to the semantics of C++11 constructor
2530 inheritance. This is part of C++17 but also considered to be a Defect
2531 Report against C++11 and C++14. This flag is enabled by default
2532 unless @option{-fabi-version=10} or lower is specified.
2534 @item -fnew-ttp-matching
2535 @opindex fnew-ttp-matching
2536 Enable the P0522 resolution to Core issue 150, template template
2537 parameters and default arguments: this allows a template with default
2538 template arguments as an argument for a template template parameter
2539 with fewer template parameters. This flag is enabled by default for
2540 @option{-std=c++17}.
2542 @item -fno-nonansi-builtins
2543 @opindex fno-nonansi-builtins
2544 Disable built-in declarations of functions that are not mandated by
2545 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2546 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2549 @opindex fnothrow-opt
2550 Treat a @code{throw()} exception specification as if it were a
2551 @code{noexcept} specification to reduce or eliminate the text size
2552 overhead relative to a function with no exception specification. If
2553 the function has local variables of types with non-trivial
2554 destructors, the exception specification actually makes the
2555 function smaller because the EH cleanups for those variables can be
2556 optimized away. The semantic effect is that an exception thrown out of
2557 a function with such an exception specification results in a call
2558 to @code{terminate} rather than @code{unexpected}.
2560 @item -fno-operator-names
2561 @opindex fno-operator-names
2562 Do not treat the operator name keywords @code{and}, @code{bitand},
2563 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2564 synonyms as keywords.
2566 @item -fno-optional-diags
2567 @opindex fno-optional-diags
2568 Disable diagnostics that the standard says a compiler does not need to
2569 issue. Currently, the only such diagnostic issued by G++ is the one for
2570 a name having multiple meanings within a class.
2573 @opindex fpermissive
2574 Downgrade some diagnostics about nonconformant code from errors to
2575 warnings. Thus, using @option{-fpermissive} allows some
2576 nonconforming code to compile.
2578 @item -fno-pretty-templates
2579 @opindex fno-pretty-templates
2580 When an error message refers to a specialization of a function
2581 template, the compiler normally prints the signature of the
2582 template followed by the template arguments and any typedefs or
2583 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2584 rather than @code{void f(int)}) so that it's clear which template is
2585 involved. When an error message refers to a specialization of a class
2586 template, the compiler omits any template arguments that match
2587 the default template arguments for that template. If either of these
2588 behaviors make it harder to understand the error message rather than
2589 easier, you can use @option{-fno-pretty-templates} to disable them.
2593 Enable automatic template instantiation at link time. This option also
2594 implies @option{-fno-implicit-templates}. @xref{Template
2595 Instantiation}, for more information.
2599 Disable generation of information about every class with virtual
2600 functions for use by the C++ run-time type identification features
2601 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2602 of the language, you can save some space by using this flag. Note that
2603 exception handling uses the same information, but G++ generates it as
2604 needed. The @code{dynamic_cast} operator can still be used for casts that
2605 do not require run-time type information, i.e.@: casts to @code{void *} or to
2606 unambiguous base classes.
2608 @item -fsized-deallocation
2609 @opindex fsized-deallocation
2610 Enable the built-in global declarations
2612 void operator delete (void *, std::size_t) noexcept;
2613 void operator delete[] (void *, std::size_t) noexcept;
2615 as introduced in C++14. This is useful for user-defined replacement
2616 deallocation functions that, for example, use the size of the object
2617 to make deallocation faster. Enabled by default under
2618 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2619 warns about places that might want to add a definition.
2621 @item -fstrict-enums
2622 @opindex fstrict-enums
2623 Allow the compiler to optimize using the assumption that a value of
2624 enumerated type can only be one of the values of the enumeration (as
2625 defined in the C++ standard; basically, a value that can be
2626 represented in the minimum number of bits needed to represent all the
2627 enumerators). This assumption may not be valid if the program uses a
2628 cast to convert an arbitrary integer value to the enumerated type.
2630 @item -fstrong-eval-order
2631 @opindex fstrong-eval-order
2632 Evaluate member access, array subscripting, and shift expressions in
2633 left-to-right order, and evaluate assignment in right-to-left order,
2634 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2635 @option{-fstrong-eval-order=some} enables just the ordering of member
2636 access and shift expressions, and is the default without
2637 @option{-std=c++17}.
2639 @item -ftemplate-backtrace-limit=@var{n}
2640 @opindex ftemplate-backtrace-limit
2641 Set the maximum number of template instantiation notes for a single
2642 warning or error to @var{n}. The default value is 10.
2644 @item -ftemplate-depth=@var{n}
2645 @opindex ftemplate-depth
2646 Set the maximum instantiation depth for template classes to @var{n}.
2647 A limit on the template instantiation depth is needed to detect
2648 endless recursions during template class instantiation. ANSI/ISO C++
2649 conforming programs must not rely on a maximum depth greater than 17
2650 (changed to 1024 in C++11). The default value is 900, as the compiler
2651 can run out of stack space before hitting 1024 in some situations.
2653 @item -fno-threadsafe-statics
2654 @opindex fno-threadsafe-statics
2655 Do not emit the extra code to use the routines specified in the C++
2656 ABI for thread-safe initialization of local statics. You can use this
2657 option to reduce code size slightly in code that doesn't need to be
2660 @item -fuse-cxa-atexit
2661 @opindex fuse-cxa-atexit
2662 Register destructors for objects with static storage duration with the
2663 @code{__cxa_atexit} function rather than the @code{atexit} function.
2664 This option is required for fully standards-compliant handling of static
2665 destructors, but only works if your C library supports
2666 @code{__cxa_atexit}.
2668 @item -fno-use-cxa-get-exception-ptr
2669 @opindex fno-use-cxa-get-exception-ptr
2670 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2671 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2672 if the runtime routine is not available.
2674 @item -fvisibility-inlines-hidden
2675 @opindex fvisibility-inlines-hidden
2676 This switch declares that the user does not attempt to compare
2677 pointers to inline functions or methods where the addresses of the two functions
2678 are taken in different shared objects.
2680 The effect of this is that GCC may, effectively, mark inline methods with
2681 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2682 appear in the export table of a DSO and do not require a PLT indirection
2683 when used within the DSO@. Enabling this option can have a dramatic effect
2684 on load and link times of a DSO as it massively reduces the size of the
2685 dynamic export table when the library makes heavy use of templates.
2687 The behavior of this switch is not quite the same as marking the
2688 methods as hidden directly, because it does not affect static variables
2689 local to the function or cause the compiler to deduce that
2690 the function is defined in only one shared object.
2692 You may mark a method as having a visibility explicitly to negate the
2693 effect of the switch for that method. For example, if you do want to
2694 compare pointers to a particular inline method, you might mark it as
2695 having default visibility. Marking the enclosing class with explicit
2696 visibility has no effect.
2698 Explicitly instantiated inline methods are unaffected by this option
2699 as their linkage might otherwise cross a shared library boundary.
2700 @xref{Template Instantiation}.
2702 @item -fvisibility-ms-compat
2703 @opindex fvisibility-ms-compat
2704 This flag attempts to use visibility settings to make GCC's C++
2705 linkage model compatible with that of Microsoft Visual Studio.
2707 The flag makes these changes to GCC's linkage model:
2711 It sets the default visibility to @code{hidden}, like
2712 @option{-fvisibility=hidden}.
2715 Types, but not their members, are not hidden by default.
2718 The One Definition Rule is relaxed for types without explicit
2719 visibility specifications that are defined in more than one
2720 shared object: those declarations are permitted if they are
2721 permitted when this option is not used.
2724 In new code it is better to use @option{-fvisibility=hidden} and
2725 export those classes that are intended to be externally visible.
2726 Unfortunately it is possible for code to rely, perhaps accidentally,
2727 on the Visual Studio behavior.
2729 Among the consequences of these changes are that static data members
2730 of the same type with the same name but defined in different shared
2731 objects are different, so changing one does not change the other;
2732 and that pointers to function members defined in different shared
2733 objects may not compare equal. When this flag is given, it is a
2734 violation of the ODR to define types with the same name differently.
2738 Do not use weak symbol support, even if it is provided by the linker.
2739 By default, G++ uses weak symbols if they are available. This
2740 option exists only for testing, and should not be used by end-users;
2741 it results in inferior code and has no benefits. This option may
2742 be removed in a future release of G++.
2746 Do not search for header files in the standard directories specific to
2747 C++, but do still search the other standard directories. (This option
2748 is used when building the C++ library.)
2751 In addition, these optimization, warning, and code generation options
2752 have meanings only for C++ programs:
2755 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2758 Warn when G++ it generates code that is probably not compatible with
2759 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2760 ABI with each major release, normally @option{-Wabi} will warn only if
2761 there is a check added later in a release series for an ABI issue
2762 discovered since the initial release. @option{-Wabi} will warn about
2763 more things if an older ABI version is selected (with
2764 @option{-fabi-version=@var{n}}).
2766 @option{-Wabi} can also be used with an explicit version number to
2767 warn about compatibility with a particular @option{-fabi-version}
2768 level, e.g. @option{-Wabi=2} to warn about changes relative to
2769 @option{-fabi-version=2}.
2771 If an explicit version number is provided and
2772 @option{-fabi-compat-version} is not specified, the version number
2773 from this option is used for compatibility aliases. If no explicit
2774 version number is provided with this option, but
2775 @option{-fabi-compat-version} is specified, that version number is
2776 used for ABI warnings.
2778 Although an effort has been made to warn about
2779 all such cases, there are probably some cases that are not warned about,
2780 even though G++ is generating incompatible code. There may also be
2781 cases where warnings are emitted even though the code that is generated
2784 You should rewrite your code to avoid these warnings if you are
2785 concerned about the fact that code generated by G++ may not be binary
2786 compatible with code generated by other compilers.
2788 Known incompatibilities in @option{-fabi-version=2} (which was the
2789 default from GCC 3.4 to 4.9) include:
2794 A template with a non-type template parameter of reference type was
2795 mangled incorrectly:
2798 template <int &> struct S @{@};
2802 This was fixed in @option{-fabi-version=3}.
2805 SIMD vector types declared using @code{__attribute ((vector_size))} were
2806 mangled in a non-standard way that does not allow for overloading of
2807 functions taking vectors of different sizes.
2809 The mangling was changed in @option{-fabi-version=4}.
2812 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2813 qualifiers, and @code{decltype} of a plain declaration was folded away.
2815 These mangling issues were fixed in @option{-fabi-version=5}.
2818 Scoped enumerators passed as arguments to a variadic function are
2819 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2820 On most targets this does not actually affect the parameter passing
2821 ABI, as there is no way to pass an argument smaller than @code{int}.
2823 Also, the ABI changed the mangling of template argument packs,
2824 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2825 a class scope function used as a template argument.
2827 These issues were corrected in @option{-fabi-version=6}.
2830 Lambdas in default argument scope were mangled incorrectly, and the
2831 ABI changed the mangling of @code{nullptr_t}.
2833 These issues were corrected in @option{-fabi-version=7}.
2836 When mangling a function type with function-cv-qualifiers, the
2837 un-qualified function type was incorrectly treated as a substitution
2840 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2843 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2844 unaligned accesses. Note that this did not affect the ABI of a
2845 function with a @code{nullptr_t} parameter, as parameters have a
2848 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2851 Target-specific attributes that affect the identity of a type, such as
2852 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2853 did not affect the mangled name, leading to name collisions when
2854 function pointers were used as template arguments.
2856 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2860 It also warns about psABI-related changes. The known psABI changes at this
2866 For SysV/x86-64, unions with @code{long double} members are
2867 passed in memory as specified in psABI. For example:
2877 @code{union U} is always passed in memory.
2881 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2884 Warn when a type with an ABI tag is used in a context that does not
2885 have that ABI tag. See @ref{C++ Attributes} for more information
2888 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2889 @opindex Wctor-dtor-privacy
2890 @opindex Wno-ctor-dtor-privacy
2891 Warn when a class seems unusable because all the constructors or
2892 destructors in that class are private, and it has neither friends nor
2893 public static member functions. Also warn if there are no non-private
2894 methods, and there's at least one private member function that isn't
2895 a constructor or destructor.
2897 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2898 @opindex Wdelete-non-virtual-dtor
2899 @opindex Wno-delete-non-virtual-dtor
2900 Warn when @code{delete} is used to destroy an instance of a class that
2901 has virtual functions and non-virtual destructor. It is unsafe to delete
2902 an instance of a derived class through a pointer to a base class if the
2903 base class does not have a virtual destructor. This warning is enabled
2906 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2907 @opindex Wdeprecated-copy
2908 @opindex Wno-deprecated-copy
2909 Warn that the implicit declaration of a copy constructor or copy
2910 assignment operator is deprecated if the class has a user-provided
2911 copy constructor, copy assignment operator, or destructor, in C++11
2912 and up. This warning is enabled by @option{-Wall}.
2914 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2915 @opindex Winit-list-lifetime
2916 @opindex Wno-init-list-lifetime
2917 Do not warn about uses of @code{std::initializer_list} that are likely
2918 to result in dangling pointers. Since the underlying array for an
2919 @code{initializer_list} is handled like a normal C++ temporary object,
2920 it is easy to inadvertently keep a pointer to the array past the end
2921 of the array's lifetime. For example:
2925 If a function returns a temporary @code{initializer_list}, or a local
2926 @code{initializer_list} variable, the array's lifetime ends at the end
2927 of the return statement, so the value returned has a dangling pointer.
2930 If a new-expression creates an @code{initializer_list}, the array only
2931 lives until the end of the enclosing full-expression, so the
2932 @code{initializer_list} in the heap has a dangling pointer.
2935 When an @code{initializer_list} variable is assigned from a
2936 brace-enclosed initializer list, the temporary array created for the
2937 right side of the assignment only lives until the end of the
2938 full-expression, so at the next statement the @code{initializer_list}
2939 variable has a dangling pointer.
2942 // li's initial underlying array lives as long as li
2943 std::initializer_list<int> li = @{ 1,2,3 @};
2944 // assignment changes li to point to a temporary array
2946 // now the temporary is gone and li has a dangling pointer
2947 int i = li.begin()[0] // undefined behavior
2951 When a list constructor stores the @code{begin} pointer from the
2952 @code{initializer_list} argument, this doesn't extend the lifetime of
2953 the array, so if a class variable is constructed from a temporary
2954 @code{initializer_list}, the pointer is left dangling by the end of
2955 the variable declaration statement.
2959 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2960 @opindex Wliteral-suffix
2961 @opindex Wno-literal-suffix
2962 Warn when a string or character literal is followed by a ud-suffix which does
2963 not begin with an underscore. As a conforming extension, GCC treats such
2964 suffixes as separate preprocessing tokens in order to maintain backwards
2965 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2969 #define __STDC_FORMAT_MACROS
2970 #include <inttypes.h>
2975 printf("My int64: %" PRId64"\n", i64);
2979 In this case, @code{PRId64} is treated as a separate preprocessing token.
2981 Additionally, warn when a user-defined literal operator is declared with
2982 a literal suffix identifier that doesn't begin with an underscore. Literal
2983 suffix identifiers that don't begin with an underscore are reserved for
2984 future standardization.
2986 This warning is enabled by default.
2988 @item -Wlto-type-mismatch
2989 @opindex Wlto-type-mismatch
2990 @opindex Wno-lto-type-mismatch
2992 During the link-time optimization warn about type mismatches in
2993 global declarations from different compilation units.
2994 Requires @option{-flto} to be enabled. Enabled by default.
2996 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
2998 @opindex Wno-narrowing
2999 For C++11 and later standards, narrowing conversions are diagnosed by default,
3000 as required by the standard. A narrowing conversion from a constant produces
3001 an error, and a narrowing conversion from a non-constant produces a warning,
3002 but @option{-Wno-narrowing} suppresses the diagnostic.
3003 Note that this does not affect the meaning of well-formed code;
3004 narrowing conversions are still considered ill-formed in SFINAE contexts.
3006 With @option{-Wnarrowing} in C++98, warn when a narrowing
3007 conversion prohibited by C++11 occurs within
3011 int i = @{ 2.2 @}; // error: narrowing from double to int
3014 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3016 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3018 @opindex Wno-noexcept
3019 Warn when a noexcept-expression evaluates to false because of a call
3020 to a function that does not have a non-throwing exception
3021 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3022 the compiler to never throw an exception.
3024 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3025 @opindex Wnoexcept-type
3026 @opindex Wno-noexcept-type
3027 Warn if the C++17 feature making @code{noexcept} part of a function
3028 type changes the mangled name of a symbol relative to C++14. Enabled
3029 by @option{-Wabi} and @option{-Wc++17-compat}.
3034 template <class T> void f(T t) @{ t(); @};
3036 void h() @{ f(g); @}
3040 In C++14, @code{f} calls calls @code{f<void(*)()>}, but in
3041 C++17 it calls @code{f<void(*)()noexcept>}.
3043 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3044 @opindex Wclass-memaccess
3045 @opindex Wno-class-memaccess
3046 Warn when the destination of a call to a raw memory function such as
3047 @code{memset} or @code{memcpy} is an object of class type, and when writing
3048 into such an object might bypass the class non-trivial or deleted constructor
3049 or copy assignment, violate const-correctness or encapsulation, or corrupt
3050 virtual table pointers. Modifying the representation of such objects may
3051 violate invariants maintained by member functions of the class. For example,
3052 the call to @code{memset} below is undefined because it modifies a non-trivial
3053 class object and is, therefore, diagnosed. The safe way to either initialize
3054 or clear the storage of objects of such types is by using the appropriate
3055 constructor or assignment operator, if one is available.
3057 std::string str = "abc";
3058 memset (&str, 0, sizeof str);
3060 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3061 Explicitly casting the pointer to the class object to @code{void *} or
3062 to a type that can be safely accessed by the raw memory function suppresses
3065 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3066 @opindex Wnon-virtual-dtor
3067 @opindex Wno-non-virtual-dtor
3068 Warn when a class has virtual functions and an accessible non-virtual
3069 destructor itself or in an accessible polymorphic base class, in which
3070 case it is possible but unsafe to delete an instance of a derived
3071 class through a pointer to the class itself or base class. This
3072 warning is automatically enabled if @option{-Weffc++} is specified.
3074 @item -Wregister @r{(C++ and Objective-C++ only)}
3076 @opindex Wno-register
3077 Warn on uses of the @code{register} storage class specifier, except
3078 when it is part of the GNU @ref{Explicit Register Variables} extension.
3079 The use of the @code{register} keyword as storage class specifier has
3080 been deprecated in C++11 and removed in C++17.
3081 Enabled by default with @option{-std=c++17}.
3083 @item -Wreorder @r{(C++ and Objective-C++ only)}
3085 @opindex Wno-reorder
3086 @cindex reordering, warning
3087 @cindex warning for reordering of member initializers
3088 Warn when the order of member initializers given in the code does not
3089 match the order in which they must be executed. For instance:
3095 A(): j (0), i (1) @{ @}
3100 The compiler rearranges the member initializers for @code{i}
3101 and @code{j} to match the declaration order of the members, emitting
3102 a warning to that effect. This warning is enabled by @option{-Wall}.
3104 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3105 @opindex fext-numeric-literals
3106 @opindex fno-ext-numeric-literals
3107 Accept imaginary, fixed-point, or machine-defined
3108 literal number suffixes as GNU extensions.
3109 When this option is turned off these suffixes are treated
3110 as C++11 user-defined literal numeric suffixes.
3111 This is on by default for all pre-C++11 dialects and all GNU dialects:
3112 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3113 @option{-std=gnu++14}.
3114 This option is off by default
3115 for ISO C++11 onwards (@option{-std=c++11}, ...).
3118 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3121 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3124 Warn about violations of the following style guidelines from Scott Meyers'
3125 @cite{Effective C++} series of books:
3129 Define a copy constructor and an assignment operator for classes
3130 with dynamically-allocated memory.
3133 Prefer initialization to assignment in constructors.
3136 Have @code{operator=} return a reference to @code{*this}.
3139 Don't try to return a reference when you must return an object.
3142 Distinguish between prefix and postfix forms of increment and
3143 decrement operators.
3146 Never overload @code{&&}, @code{||}, or @code{,}.
3150 This option also enables @option{-Wnon-virtual-dtor}, which is also
3151 one of the effective C++ recommendations. However, the check is
3152 extended to warn about the lack of virtual destructor in accessible
3153 non-polymorphic bases classes too.
3155 When selecting this option, be aware that the standard library
3156 headers do not obey all of these guidelines; use @samp{grep -v}
3157 to filter out those warnings.
3159 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3160 @opindex Wstrict-null-sentinel
3161 @opindex Wno-strict-null-sentinel
3162 Warn about the use of an uncasted @code{NULL} as sentinel. When
3163 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3164 to @code{__null}. Although it is a null pointer constant rather than a
3165 null pointer, it is guaranteed to be of the same size as a pointer.
3166 But this use is not portable across different compilers.
3168 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3169 @opindex Wno-non-template-friend
3170 @opindex Wnon-template-friend
3171 Disable warnings when non-template friend functions are declared
3172 within a template. In very old versions of GCC that predate implementation
3173 of the ISO standard, declarations such as
3174 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3175 could be interpreted as a particular specialization of a template
3176 function; the warning exists to diagnose compatibility problems,
3177 and is enabled by default.
3179 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3180 @opindex Wold-style-cast
3181 @opindex Wno-old-style-cast
3182 Warn if an old-style (C-style) cast to a non-void type is used within
3183 a C++ program. The new-style casts (@code{dynamic_cast},
3184 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3185 less vulnerable to unintended effects and much easier to search for.
3187 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3188 @opindex Woverloaded-virtual
3189 @opindex Wno-overloaded-virtual
3190 @cindex overloaded virtual function, warning
3191 @cindex warning for overloaded virtual function
3192 Warn when a function declaration hides virtual functions from a
3193 base class. For example, in:
3200 struct B: public A @{
3205 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3216 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3217 @opindex Wno-pmf-conversions
3218 @opindex Wpmf-conversions
3219 Disable the diagnostic for converting a bound pointer to member function
3222 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3223 @opindex Wsign-promo
3224 @opindex Wno-sign-promo
3225 Warn when overload resolution chooses a promotion from unsigned or
3226 enumerated type to a signed type, over a conversion to an unsigned type of
3227 the same size. Previous versions of G++ tried to preserve
3228 unsignedness, but the standard mandates the current behavior.
3230 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3232 @opindex Wno-templates
3233 Warn when a primary template declaration is encountered. Some coding
3234 rules disallow templates, and this may be used to enforce that rule.
3235 The warning is inactive inside a system header file, such as the STL, so
3236 one can still use the STL. One may also instantiate or specialize
3239 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3240 @opindex Wmultiple-inheritance
3241 @opindex Wno-multiple-inheritance
3242 Warn when a class is defined with multiple direct base classes. Some
3243 coding rules disallow multiple inheritance, and this may be used to
3244 enforce that rule. The warning is inactive inside a system header file,
3245 such as the STL, so one can still use the STL. One may also define
3246 classes that indirectly use multiple inheritance.
3248 @item -Wvirtual-inheritance
3249 @opindex Wvirtual-inheritance
3250 @opindex Wno-virtual-inheritance
3251 Warn when a class is defined with a virtual direct base class. Some
3252 coding rules disallow multiple inheritance, and this may be used to
3253 enforce that rule. The warning is inactive inside a system header file,
3254 such as the STL, so one can still use the STL. One may also define
3255 classes that indirectly use virtual inheritance.
3258 @opindex Wnamespaces
3259 @opindex Wno-namespaces
3260 Warn when a namespace definition is opened. Some coding rules disallow
3261 namespaces, and this may be used to enforce that rule. The warning is
3262 inactive inside a system header file, such as the STL, so one can still
3263 use the STL. One may also use using directives and qualified names.
3265 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3267 @opindex Wno-terminate
3268 Disable the warning about a throw-expression that will immediately
3269 result in a call to @code{terminate}.
3272 @node Objective-C and Objective-C++ Dialect Options
3273 @section Options Controlling Objective-C and Objective-C++ Dialects
3275 @cindex compiler options, Objective-C and Objective-C++
3276 @cindex Objective-C and Objective-C++ options, command-line
3277 @cindex options, Objective-C and Objective-C++
3278 (NOTE: This manual does not describe the Objective-C and Objective-C++
3279 languages themselves. @xref{Standards,,Language Standards
3280 Supported by GCC}, for references.)
3282 This section describes the command-line options that are only meaningful
3283 for Objective-C and Objective-C++ programs. You can also use most of
3284 the language-independent GNU compiler options.
3285 For example, you might compile a file @file{some_class.m} like this:
3288 gcc -g -fgnu-runtime -O -c some_class.m
3292 In this example, @option{-fgnu-runtime} is an option meant only for
3293 Objective-C and Objective-C++ programs; you can use the other options with
3294 any language supported by GCC@.
3296 Note that since Objective-C is an extension of the C language, Objective-C
3297 compilations may also use options specific to the C front-end (e.g.,
3298 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3299 C++-specific options (e.g., @option{-Wabi}).
3301 Here is a list of options that are @emph{only} for compiling Objective-C
3302 and Objective-C++ programs:
3305 @item -fconstant-string-class=@var{class-name}
3306 @opindex fconstant-string-class
3307 Use @var{class-name} as the name of the class to instantiate for each
3308 literal string specified with the syntax @code{@@"@dots{}"}. The default
3309 class name is @code{NXConstantString} if the GNU runtime is being used, and
3310 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3311 @option{-fconstant-cfstrings} option, if also present, overrides the
3312 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3313 to be laid out as constant CoreFoundation strings.
3316 @opindex fgnu-runtime
3317 Generate object code compatible with the standard GNU Objective-C
3318 runtime. This is the default for most types of systems.
3320 @item -fnext-runtime
3321 @opindex fnext-runtime
3322 Generate output compatible with the NeXT runtime. This is the default
3323 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3324 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3327 @item -fno-nil-receivers
3328 @opindex fno-nil-receivers
3329 Assume that all Objective-C message dispatches (@code{[receiver
3330 message:arg]}) in this translation unit ensure that the receiver is
3331 not @code{nil}. This allows for more efficient entry points in the
3332 runtime to be used. This option is only available in conjunction with
3333 the NeXT runtime and ABI version 0 or 1.
3335 @item -fobjc-abi-version=@var{n}
3336 @opindex fobjc-abi-version
3337 Use version @var{n} of the Objective-C ABI for the selected runtime.
3338 This option is currently supported only for the NeXT runtime. In that
3339 case, Version 0 is the traditional (32-bit) ABI without support for
3340 properties and other Objective-C 2.0 additions. Version 1 is the
3341 traditional (32-bit) ABI with support for properties and other
3342 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3343 nothing is specified, the default is Version 0 on 32-bit target
3344 machines, and Version 2 on 64-bit target machines.
3346 @item -fobjc-call-cxx-cdtors
3347 @opindex fobjc-call-cxx-cdtors
3348 For each Objective-C class, check if any of its instance variables is a
3349 C++ object with a non-trivial default constructor. If so, synthesize a
3350 special @code{- (id) .cxx_construct} instance method which runs
3351 non-trivial default constructors on any such instance variables, in order,
3352 and then return @code{self}. Similarly, check if any instance variable
3353 is a C++ object with a non-trivial destructor, and if so, synthesize a
3354 special @code{- (void) .cxx_destruct} method which runs
3355 all such default destructors, in reverse order.
3357 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3358 methods thusly generated only operate on instance variables
3359 declared in the current Objective-C class, and not those inherited
3360 from superclasses. It is the responsibility of the Objective-C
3361 runtime to invoke all such methods in an object's inheritance
3362 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3363 by the runtime immediately after a new object instance is allocated;
3364 the @code{- (void) .cxx_destruct} methods are invoked immediately
3365 before the runtime deallocates an object instance.
3367 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3368 support for invoking the @code{- (id) .cxx_construct} and
3369 @code{- (void) .cxx_destruct} methods.
3371 @item -fobjc-direct-dispatch
3372 @opindex fobjc-direct-dispatch
3373 Allow fast jumps to the message dispatcher. On Darwin this is
3374 accomplished via the comm page.
3376 @item -fobjc-exceptions
3377 @opindex fobjc-exceptions
3378 Enable syntactic support for structured exception handling in
3379 Objective-C, similar to what is offered by C++. This option
3380 is required to use the Objective-C keywords @code{@@try},
3381 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3382 @code{@@synchronized}. This option is available with both the GNU
3383 runtime and the NeXT runtime (but not available in conjunction with
3384 the NeXT runtime on Mac OS X 10.2 and earlier).
3388 Enable garbage collection (GC) in Objective-C and Objective-C++
3389 programs. This option is only available with the NeXT runtime; the
3390 GNU runtime has a different garbage collection implementation that
3391 does not require special compiler flags.
3393 @item -fobjc-nilcheck
3394 @opindex fobjc-nilcheck
3395 For the NeXT runtime with version 2 of the ABI, check for a nil
3396 receiver in method invocations before doing the actual method call.
3397 This is the default and can be disabled using
3398 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3399 checked for nil in this way no matter what this flag is set to.
3400 Currently this flag does nothing when the GNU runtime, or an older
3401 version of the NeXT runtime ABI, is used.
3403 @item -fobjc-std=objc1
3405 Conform to the language syntax of Objective-C 1.0, the language
3406 recognized by GCC 4.0. This only affects the Objective-C additions to
3407 the C/C++ language; it does not affect conformance to C/C++ standards,
3408 which is controlled by the separate C/C++ dialect option flags. When
3409 this option is used with the Objective-C or Objective-C++ compiler,
3410 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3411 This is useful if you need to make sure that your Objective-C code can
3412 be compiled with older versions of GCC@.
3414 @item -freplace-objc-classes
3415 @opindex freplace-objc-classes
3416 Emit a special marker instructing @command{ld(1)} not to statically link in
3417 the resulting object file, and allow @command{dyld(1)} to load it in at
3418 run time instead. This is used in conjunction with the Fix-and-Continue
3419 debugging mode, where the object file in question may be recompiled and
3420 dynamically reloaded in the course of program execution, without the need
3421 to restart the program itself. Currently, Fix-and-Continue functionality
3422 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3427 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3428 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3429 compile time) with static class references that get initialized at load time,
3430 which improves run-time performance. Specifying the @option{-fzero-link} flag
3431 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3432 to be retained. This is useful in Zero-Link debugging mode, since it allows
3433 for individual class implementations to be modified during program execution.
3434 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3435 regardless of command-line options.
3437 @item -fno-local-ivars
3438 @opindex fno-local-ivars
3439 @opindex flocal-ivars
3440 By default instance variables in Objective-C can be accessed as if
3441 they were local variables from within the methods of the class they're
3442 declared in. This can lead to shadowing between instance variables
3443 and other variables declared either locally inside a class method or
3444 globally with the same name. Specifying the @option{-fno-local-ivars}
3445 flag disables this behavior thus avoiding variable shadowing issues.
3447 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3448 @opindex fivar-visibility
3449 Set the default instance variable visibility to the specified option
3450 so that instance variables declared outside the scope of any access
3451 modifier directives default to the specified visibility.
3455 Dump interface declarations for all classes seen in the source file to a
3456 file named @file{@var{sourcename}.decl}.
3458 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3459 @opindex Wassign-intercept
3460 @opindex Wno-assign-intercept
3461 Warn whenever an Objective-C assignment is being intercepted by the
3464 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3465 @opindex Wno-protocol
3467 If a class is declared to implement a protocol, a warning is issued for
3468 every method in the protocol that is not implemented by the class. The
3469 default behavior is to issue a warning for every method not explicitly
3470 implemented in the class, even if a method implementation is inherited
3471 from the superclass. If you use the @option{-Wno-protocol} option, then
3472 methods inherited from the superclass are considered to be implemented,
3473 and no warning is issued for them.
3475 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3477 @opindex Wno-selector
3478 Warn if multiple methods of different types for the same selector are
3479 found during compilation. The check is performed on the list of methods
3480 in the final stage of compilation. Additionally, a check is performed
3481 for each selector appearing in a @code{@@selector(@dots{})}
3482 expression, and a corresponding method for that selector has been found
3483 during compilation. Because these checks scan the method table only at
3484 the end of compilation, these warnings are not produced if the final
3485 stage of compilation is not reached, for example because an error is
3486 found during compilation, or because the @option{-fsyntax-only} option is
3489 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3490 @opindex Wstrict-selector-match
3491 @opindex Wno-strict-selector-match
3492 Warn if multiple methods with differing argument and/or return types are
3493 found for a given selector when attempting to send a message using this
3494 selector to a receiver of type @code{id} or @code{Class}. When this flag
3495 is off (which is the default behavior), the compiler omits such warnings
3496 if any differences found are confined to types that share the same size
3499 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3500 @opindex Wundeclared-selector
3501 @opindex Wno-undeclared-selector
3502 Warn if a @code{@@selector(@dots{})} expression referring to an
3503 undeclared selector is found. A selector is considered undeclared if no
3504 method with that name has been declared before the
3505 @code{@@selector(@dots{})} expression, either explicitly in an
3506 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3507 an @code{@@implementation} section. This option always performs its
3508 checks as soon as a @code{@@selector(@dots{})} expression is found,
3509 while @option{-Wselector} only performs its checks in the final stage of
3510 compilation. This also enforces the coding style convention
3511 that methods and selectors must be declared before being used.
3513 @item -print-objc-runtime-info
3514 @opindex print-objc-runtime-info
3515 Generate C header describing the largest structure that is passed by
3520 @node Diagnostic Message Formatting Options
3521 @section Options to Control Diagnostic Messages Formatting
3522 @cindex options to control diagnostics formatting
3523 @cindex diagnostic messages
3524 @cindex message formatting
3526 Traditionally, diagnostic messages have been formatted irrespective of
3527 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3528 options described below
3529 to control the formatting algorithm for diagnostic messages,
3530 e.g.@: how many characters per line, how often source location
3531 information should be reported. Note that some language front ends may not
3532 honor these options.
3535 @item -fmessage-length=@var{n}
3536 @opindex fmessage-length
3537 Try to format error messages so that they fit on lines of about
3538 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3539 done; each error message appears on a single line. This is the
3540 default for all front ends.
3542 Note - this option also affects the display of the @samp{#error} and
3543 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3544 function/type/variable attribute. It does not however affect the
3545 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3547 @item -fdiagnostics-show-location=once
3548 @opindex fdiagnostics-show-location
3549 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3550 reporter to emit source location information @emph{once}; that is, in
3551 case the message is too long to fit on a single physical line and has to
3552 be wrapped, the source location won't be emitted (as prefix) again,
3553 over and over, in subsequent continuation lines. This is the default
3556 @item -fdiagnostics-show-location=every-line
3557 Only meaningful in line-wrapping mode. Instructs the diagnostic
3558 messages reporter to emit the same source location information (as
3559 prefix) for physical lines that result from the process of breaking
3560 a message which is too long to fit on a single line.
3562 @item -fdiagnostics-color[=@var{WHEN}]
3563 @itemx -fno-diagnostics-color
3564 @opindex fdiagnostics-color
3565 @cindex highlight, color
3566 @vindex GCC_COLORS @r{environment variable}
3567 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3568 or @samp{auto}. The default depends on how the compiler has been configured,
3569 it can be any of the above @var{WHEN} options or also @samp{never}
3570 if @env{GCC_COLORS} environment variable isn't present in the environment,
3571 and @samp{auto} otherwise.
3572 @samp{auto} means to use color only when the standard error is a terminal.
3573 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3574 aliases for @option{-fdiagnostics-color=always} and
3575 @option{-fdiagnostics-color=never}, respectively.
3577 The colors are defined by the environment variable @env{GCC_COLORS}.
3578 Its value is a colon-separated list of capabilities and Select Graphic
3579 Rendition (SGR) substrings. SGR commands are interpreted by the
3580 terminal or terminal emulator. (See the section in the documentation
3581 of your text terminal for permitted values and their meanings as
3582 character attributes.) These substring values are integers in decimal
3583 representation and can be concatenated with semicolons.
3584 Common values to concatenate include
3586 @samp{4} for underline,
3588 @samp{7} for inverse,
3589 @samp{39} for default foreground color,
3590 @samp{30} to @samp{37} for foreground colors,
3591 @samp{90} to @samp{97} for 16-color mode foreground colors,
3592 @samp{38;5;0} to @samp{38;5;255}
3593 for 88-color and 256-color modes foreground colors,
3594 @samp{49} for default background color,
3595 @samp{40} to @samp{47} for background colors,
3596 @samp{100} to @samp{107} for 16-color mode background colors,
3597 and @samp{48;5;0} to @samp{48;5;255}
3598 for 88-color and 256-color modes background colors.
3600 The default @env{GCC_COLORS} is
3602 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3603 quote=01:fixit-insert=32:fixit-delete=31:\
3604 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3608 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3609 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3610 @samp{01} is bold, and @samp{31} is red.
3611 Setting @env{GCC_COLORS} to the empty string disables colors.
3612 Supported capabilities are as follows.
3616 @vindex error GCC_COLORS @r{capability}
3617 SGR substring for error: markers.
3620 @vindex warning GCC_COLORS @r{capability}
3621 SGR substring for warning: markers.
3624 @vindex note GCC_COLORS @r{capability}
3625 SGR substring for note: markers.
3628 @vindex range1 GCC_COLORS @r{capability}
3629 SGR substring for first additional range.
3632 @vindex range2 GCC_COLORS @r{capability}
3633 SGR substring for second additional range.
3636 @vindex locus GCC_COLORS @r{capability}
3637 SGR substring for location information, @samp{file:line} or
3638 @samp{file:line:column} etc.
3641 @vindex quote GCC_COLORS @r{capability}
3642 SGR substring for information printed within quotes.
3645 @vindex fixit-insert GCC_COLORS @r{capability}
3646 SGR substring for fix-it hints suggesting text to
3647 be inserted or replaced.
3650 @vindex fixit-delete GCC_COLORS @r{capability}
3651 SGR substring for fix-it hints suggesting text to
3654 @item diff-filename=
3655 @vindex diff-filename GCC_COLORS @r{capability}
3656 SGR substring for filename headers within generated patches.
3659 @vindex diff-hunk GCC_COLORS @r{capability}
3660 SGR substring for the starts of hunks within generated patches.
3663 @vindex diff-delete GCC_COLORS @r{capability}
3664 SGR substring for deleted lines within generated patches.
3667 @vindex diff-insert GCC_COLORS @r{capability}
3668 SGR substring for inserted lines within generated patches.
3671 @vindex type-diff GCC_COLORS @r{capability}
3672 SGR substring for highlighting mismatching types within template
3673 arguments in the C++ frontend.
3676 @item -fno-diagnostics-show-option
3677 @opindex fno-diagnostics-show-option
3678 @opindex fdiagnostics-show-option
3679 By default, each diagnostic emitted includes text indicating the
3680 command-line option that directly controls the diagnostic (if such an
3681 option is known to the diagnostic machinery). Specifying the
3682 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3684 @item -fno-diagnostics-show-caret
3685 @opindex fno-diagnostics-show-caret
3686 @opindex fdiagnostics-show-caret
3687 By default, each diagnostic emitted includes the original source line
3688 and a caret @samp{^} indicating the column. This option suppresses this
3689 information. The source line is truncated to @var{n} characters, if
3690 the @option{-fmessage-length=n} option is given. When the output is done
3691 to the terminal, the width is limited to the width given by the
3692 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3694 @item -fdiagnostics-parseable-fixits
3695 @opindex fdiagnostics-parseable-fixits
3696 Emit fix-it hints in a machine-parseable format, suitable for consumption
3697 by IDEs. For each fix-it, a line will be printed after the relevant
3698 diagnostic, starting with the string ``fix-it:''. For example:
3701 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3704 The location is expressed as a half-open range, expressed as a count of
3705 bytes, starting at byte 1 for the initial column. In the above example,
3706 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3710 00000000011111111112222222222
3711 12345678901234567890123456789
3712 gtk_widget_showall (dlg);
3717 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3718 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3719 (e.g. vertical tab as ``\013'').
3721 An empty replacement string indicates that the given range is to be removed.
3722 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3723 be inserted at the given position.
3725 @item -fdiagnostics-generate-patch
3726 @opindex fdiagnostics-generate-patch
3727 Print fix-it hints to stderr in unified diff format, after any diagnostics
3728 are printed. For example:
3735 void show_cb(GtkDialog *dlg)
3737 - gtk_widget_showall(dlg);
3738 + gtk_widget_show_all(dlg);
3743 The diff may or may not be colorized, following the same rules
3744 as for diagnostics (see @option{-fdiagnostics-color}).
3746 @item -fdiagnostics-show-template-tree
3747 @opindex fdiagnostics-show-template-tree
3749 In the C++ frontend, when printing diagnostics showing mismatching
3750 template types, such as:
3753 could not convert 'std::map<int, std::vector<double> >()'
3754 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3757 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3758 tree-like structure showing the common and differing parts of the types,
3768 The parts that differ are highlighted with color (``double'' and
3769 ``float'' in this case).
3771 @item -fno-elide-type
3772 @opindex fno-elide-type
3773 @opindex felide-type
3774 By default when the C++ frontend prints diagnostics showing mismatching
3775 template types, common parts of the types are printed as ``[...]'' to
3776 simplify the error message. For example:
3779 could not convert 'std::map<int, std::vector<double> >()'
3780 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3783 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3784 This flag also affects the output of the
3785 @option{-fdiagnostics-show-template-tree} flag.
3787 @item -fno-show-column
3788 @opindex fno-show-column
3789 Do not print column numbers in diagnostics. This may be necessary if
3790 diagnostics are being scanned by a program that does not understand the
3791 column numbers, such as @command{dejagnu}.
3795 @node Warning Options
3796 @section Options to Request or Suppress Warnings
3797 @cindex options to control warnings
3798 @cindex warning messages
3799 @cindex messages, warning
3800 @cindex suppressing warnings
3802 Warnings are diagnostic messages that report constructions that
3803 are not inherently erroneous but that are risky or suggest there
3804 may have been an error.
3806 The following language-independent options do not enable specific
3807 warnings but control the kinds of diagnostics produced by GCC@.
3810 @cindex syntax checking
3812 @opindex fsyntax-only
3813 Check the code for syntax errors, but don't do anything beyond that.
3815 @item -fmax-errors=@var{n}
3816 @opindex fmax-errors
3817 Limits the maximum number of error messages to @var{n}, at which point
3818 GCC bails out rather than attempting to continue processing the source
3819 code. If @var{n} is 0 (the default), there is no limit on the number
3820 of error messages produced. If @option{-Wfatal-errors} is also
3821 specified, then @option{-Wfatal-errors} takes precedence over this
3826 Inhibit all warning messages.
3831 Make all warnings into errors.
3836 Make the specified warning into an error. The specifier for a warning
3837 is appended; for example @option{-Werror=switch} turns the warnings
3838 controlled by @option{-Wswitch} into errors. This switch takes a
3839 negative form, to be used to negate @option{-Werror} for specific
3840 warnings; for example @option{-Wno-error=switch} makes
3841 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3844 The warning message for each controllable warning includes the
3845 option that controls the warning. That option can then be used with
3846 @option{-Werror=} and @option{-Wno-error=} as described above.
3847 (Printing of the option in the warning message can be disabled using the
3848 @option{-fno-diagnostics-show-option} flag.)
3850 Note that specifying @option{-Werror=}@var{foo} automatically implies
3851 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3854 @item -Wfatal-errors
3855 @opindex Wfatal-errors
3856 @opindex Wno-fatal-errors
3857 This option causes the compiler to abort compilation on the first error
3858 occurred rather than trying to keep going and printing further error
3863 You can request many specific warnings with options beginning with
3864 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3865 implicit declarations. Each of these specific warning options also
3866 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3867 example, @option{-Wno-implicit}. This manual lists only one of the
3868 two forms, whichever is not the default. For further
3869 language-specific options also refer to @ref{C++ Dialect Options} and
3870 @ref{Objective-C and Objective-C++ Dialect Options}.
3872 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3873 options, such as @option{-Wunused}, which may turn on further options,
3874 such as @option{-Wunused-value}. The combined effect of positive and
3875 negative forms is that more specific options have priority over less
3876 specific ones, independently of their position in the command-line. For
3877 options of the same specificity, the last one takes effect. Options
3878 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3879 as if they appeared at the end of the command-line.
3881 When an unrecognized warning option is requested (e.g.,
3882 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3883 that the option is not recognized. However, if the @option{-Wno-} form
3884 is used, the behavior is slightly different: no diagnostic is
3885 produced for @option{-Wno-unknown-warning} unless other diagnostics
3886 are being produced. This allows the use of new @option{-Wno-} options
3887 with old compilers, but if something goes wrong, the compiler
3888 warns that an unrecognized option is present.
3895 @opindex Wno-pedantic
3896 Issue all the warnings demanded by strict ISO C and ISO C++;
3897 reject all programs that use forbidden extensions, and some other
3898 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3899 version of the ISO C standard specified by any @option{-std} option used.
3901 Valid ISO C and ISO C++ programs should compile properly with or without
3902 this option (though a rare few require @option{-ansi} or a
3903 @option{-std} option specifying the required version of ISO C)@. However,
3904 without this option, certain GNU extensions and traditional C and C++
3905 features are supported as well. With this option, they are rejected.
3907 @option{-Wpedantic} does not cause warning messages for use of the
3908 alternate keywords whose names begin and end with @samp{__}. Pedantic
3909 warnings are also disabled in the expression that follows
3910 @code{__extension__}. However, only system header files should use
3911 these escape routes; application programs should avoid them.
3912 @xref{Alternate Keywords}.
3914 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3915 C conformance. They soon find that it does not do quite what they want:
3916 it finds some non-ISO practices, but not all---only those for which
3917 ISO C @emph{requires} a diagnostic, and some others for which
3918 diagnostics have been added.
3920 A feature to report any failure to conform to ISO C might be useful in
3921 some instances, but would require considerable additional work and would
3922 be quite different from @option{-Wpedantic}. We don't have plans to
3923 support such a feature in the near future.
3925 Where the standard specified with @option{-std} represents a GNU
3926 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3927 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3928 extended dialect is based. Warnings from @option{-Wpedantic} are given
3929 where they are required by the base standard. (It does not make sense
3930 for such warnings to be given only for features not in the specified GNU
3931 C dialect, since by definition the GNU dialects of C include all
3932 features the compiler supports with the given option, and there would be
3933 nothing to warn about.)
3935 @item -pedantic-errors
3936 @opindex pedantic-errors
3937 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3938 requires a diagnostic, in some cases where there is undefined behavior
3939 at compile-time and in some other cases that do not prevent compilation
3940 of programs that are valid according to the standard. This is not
3941 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3942 by this option and not enabled by the latter and vice versa.
3947 This enables all the warnings about constructions that some users
3948 consider questionable, and that are easy to avoid (or modify to
3949 prevent the warning), even in conjunction with macros. This also
3950 enables some language-specific warnings described in @ref{C++ Dialect
3951 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3953 @option{-Wall} turns on the following warning flags:
3955 @gccoptlist{-Waddress @gol
3956 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3958 -Wbool-operation @gol
3959 -Wc++11-compat -Wc++14-compat @gol
3960 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3961 -Wchar-subscripts @gol
3963 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3964 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3966 -Wint-in-bool-context @gol
3967 -Wimplicit @r{(C and Objective-C only)} @gol
3968 -Wimplicit-int @r{(C and Objective-C only)} @gol
3969 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3970 -Winit-self @r{(only for C++)} @gol
3971 -Wlogical-not-parentheses @gol
3972 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3973 -Wmaybe-uninitialized @gol
3974 -Wmemset-elt-size @gol
3975 -Wmemset-transposed-args @gol
3976 -Wmisleading-indentation @r{(only for C/C++)} @gol
3977 -Wmissing-attributes @gol
3978 -Wmissing-braces @r{(only for C/ObjC)} @gol
3979 -Wmultistatement-macros @gol
3980 -Wnarrowing @r{(only for C++)} @gol
3982 -Wnonnull-compare @gol
3989 -Wsequence-point @gol
3990 -Wsign-compare @r{(only in C++)} @gol
3991 -Wsizeof-pointer-div @gol
3992 -Wsizeof-pointer-memaccess @gol
3993 -Wstrict-aliasing @gol
3994 -Wstrict-overflow=1 @gol
3996 -Wtautological-compare @gol
3998 -Wuninitialized @gol
3999 -Wunknown-pragmas @gol
4000 -Wunused-function @gol
4003 -Wunused-variable @gol
4004 -Wvolatile-register-var @gol
4007 Note that some warning flags are not implied by @option{-Wall}. Some of
4008 them warn about constructions that users generally do not consider
4009 questionable, but which occasionally you might wish to check for;
4010 others warn about constructions that are necessary or hard to avoid in
4011 some cases, and there is no simple way to modify the code to suppress
4012 the warning. Some of them are enabled by @option{-Wextra} but many of
4013 them must be enabled individually.
4019 This enables some extra warning flags that are not enabled by
4020 @option{-Wall}. (This option used to be called @option{-W}. The older
4021 name is still supported, but the newer name is more descriptive.)
4023 @gccoptlist{-Wclobbered @gol
4024 -Wcast-function-type @gol
4026 -Wignored-qualifiers @gol
4027 -Wimplicit-fallthrough=3 @gol
4028 -Wmissing-field-initializers @gol
4029 -Wmissing-parameter-type @r{(C only)} @gol
4030 -Wold-style-declaration @r{(C only)} @gol
4031 -Woverride-init @gol
4032 -Wsign-compare @r{(C only)} @gol
4034 -Wuninitialized @gol
4035 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4036 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4037 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4040 The option @option{-Wextra} also prints warning messages for the
4046 A pointer is compared against integer zero with @code{<}, @code{<=},
4047 @code{>}, or @code{>=}.
4050 (C++ only) An enumerator and a non-enumerator both appear in a
4051 conditional expression.
4054 (C++ only) Ambiguous virtual bases.
4057 (C++ only) Subscripting an array that has been declared @code{register}.
4060 (C++ only) Taking the address of a variable that has been declared
4064 (C++ only) A base class is not initialized in the copy constructor
4069 @item -Wchar-subscripts
4070 @opindex Wchar-subscripts
4071 @opindex Wno-char-subscripts
4072 Warn if an array subscript has type @code{char}. This is a common cause
4073 of error, as programmers often forget that this type is signed on some
4075 This warning is enabled by @option{-Wall}.
4080 Warn about an invalid memory access that is found by Pointer Bounds Checker
4081 (@option{-fcheck-pointer-bounds}).
4083 @item -Wno-coverage-mismatch
4084 @opindex Wno-coverage-mismatch
4085 @opindex Wcoverage-mismatch
4086 Warn if feedback profiles do not match when using the
4087 @option{-fprofile-use} option.
4088 If a source file is changed between compiling with @option{-fprofile-gen} and
4089 with @option{-fprofile-use}, the files with the profile feedback can fail
4090 to match the source file and GCC cannot use the profile feedback
4091 information. By default, this warning is enabled and is treated as an
4092 error. @option{-Wno-coverage-mismatch} can be used to disable the
4093 warning or @option{-Wno-error=coverage-mismatch} can be used to
4094 disable the error. Disabling the error for this warning can result in
4095 poorly optimized code and is useful only in the
4096 case of very minor changes such as bug fixes to an existing code-base.
4097 Completely disabling the warning is not recommended.
4100 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4102 Suppress warning messages emitted by @code{#warning} directives.
4104 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4105 @opindex Wdouble-promotion
4106 @opindex Wno-double-promotion
4107 Give a warning when a value of type @code{float} is implicitly
4108 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4109 floating-point unit implement @code{float} in hardware, but emulate
4110 @code{double} in software. On such a machine, doing computations
4111 using @code{double} values is much more expensive because of the
4112 overhead required for software emulation.
4114 It is easy to accidentally do computations with @code{double} because
4115 floating-point literals are implicitly of type @code{double}. For
4119 float area(float radius)
4121 return 3.14159 * radius * radius;
4125 the compiler performs the entire computation with @code{double}
4126 because the floating-point literal is a @code{double}.
4128 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4129 @opindex Wduplicate-decl-specifier
4130 @opindex Wno-duplicate-decl-specifier
4131 Warn if a declaration has duplicate @code{const}, @code{volatile},
4132 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4136 @itemx -Wformat=@var{n}
4139 @opindex ffreestanding
4140 @opindex fno-builtin
4142 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4143 the arguments supplied have types appropriate to the format string
4144 specified, and that the conversions specified in the format string make
4145 sense. This includes standard functions, and others specified by format
4146 attributes (@pxref{Function Attributes}), in the @code{printf},
4147 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4148 not in the C standard) families (or other target-specific families).
4149 Which functions are checked without format attributes having been
4150 specified depends on the standard version selected, and such checks of
4151 functions without the attribute specified are disabled by
4152 @option{-ffreestanding} or @option{-fno-builtin}.
4154 The formats are checked against the format features supported by GNU
4155 libc version 2.2. These include all ISO C90 and C99 features, as well
4156 as features from the Single Unix Specification and some BSD and GNU
4157 extensions. Other library implementations may not support all these
4158 features; GCC does not support warning about features that go beyond a
4159 particular library's limitations. However, if @option{-Wpedantic} is used
4160 with @option{-Wformat}, warnings are given about format features not
4161 in the selected standard version (but not for @code{strfmon} formats,
4162 since those are not in any version of the C standard). @xref{C Dialect
4163 Options,,Options Controlling C Dialect}.
4170 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4171 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4172 @option{-Wformat} also checks for null format arguments for several
4173 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4174 aspects of this level of format checking can be disabled by the
4175 options: @option{-Wno-format-contains-nul},
4176 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4177 @option{-Wformat} is enabled by @option{-Wall}.
4179 @item -Wno-format-contains-nul
4180 @opindex Wno-format-contains-nul
4181 @opindex Wformat-contains-nul
4182 If @option{-Wformat} is specified, do not warn about format strings that
4185 @item -Wno-format-extra-args
4186 @opindex Wno-format-extra-args
4187 @opindex Wformat-extra-args
4188 If @option{-Wformat} is specified, do not warn about excess arguments to a
4189 @code{printf} or @code{scanf} format function. The C standard specifies
4190 that such arguments are ignored.
4192 Where the unused arguments lie between used arguments that are
4193 specified with @samp{$} operand number specifications, normally
4194 warnings are still given, since the implementation could not know what
4195 type to pass to @code{va_arg} to skip the unused arguments. However,
4196 in the case of @code{scanf} formats, this option suppresses the
4197 warning if the unused arguments are all pointers, since the Single
4198 Unix Specification says that such unused arguments are allowed.
4200 @item -Wformat-overflow
4201 @itemx -Wformat-overflow=@var{level}
4202 @opindex Wformat-overflow
4203 @opindex Wno-format-overflow
4204 Warn about calls to formatted input/output functions such as @code{sprintf}
4205 and @code{vsprintf} that might overflow the destination buffer. When the
4206 exact number of bytes written by a format directive cannot be determined
4207 at compile-time it is estimated based on heuristics that depend on the
4208 @var{level} argument and on optimization. While enabling optimization
4209 will in most cases improve the accuracy of the warning, it may also
4210 result in false positives.
4213 @item -Wformat-overflow
4214 @itemx -Wformat-overflow=1
4215 @opindex Wformat-overflow
4216 @opindex Wno-format-overflow
4217 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4218 employs a conservative approach that warns only about calls that most
4219 likely overflow the buffer. At this level, numeric arguments to format
4220 directives with unknown values are assumed to have the value of one, and
4221 strings of unknown length to be empty. Numeric arguments that are known
4222 to be bounded to a subrange of their type, or string arguments whose output
4223 is bounded either by their directive's precision or by a finite set of
4224 string literals, are assumed to take on the value within the range that
4225 results in the most bytes on output. For example, the call to @code{sprintf}
4226 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4227 the terminating NUL character (@code{'\0'}) appended by the function
4228 to the destination buffer will be written past its end. Increasing
4229 the size of the buffer by a single byte is sufficient to avoid the
4230 warning, though it may not be sufficient to avoid the overflow.
4233 void f (int a, int b)
4236 sprintf (buf, "a = %i, b = %i\n", a, b);
4240 @item -Wformat-overflow=2
4241 Level @var{2} warns also about calls that might overflow the destination
4242 buffer given an argument of sufficient length or magnitude. At level
4243 @var{2}, unknown numeric arguments are assumed to have the minimum
4244 representable value for signed types with a precision greater than 1, and
4245 the maximum representable value otherwise. Unknown string arguments whose
4246 length cannot be assumed to be bounded either by the directive's precision,
4247 or by a finite set of string literals they may evaluate to, or the character
4248 array they may point to, are assumed to be 1 character long.
4250 At level @var{2}, the call in the example above is again diagnosed, but
4251 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4252 @code{%i} directive will write some of its digits beyond the end of
4253 the destination buffer. To make the call safe regardless of the values
4254 of the two variables, the size of the destination buffer must be increased
4255 to at least 34 bytes. GCC includes the minimum size of the buffer in
4256 an informational note following the warning.
4258 An alternative to increasing the size of the destination buffer is to
4259 constrain the range of formatted values. The maximum length of string
4260 arguments can be bounded by specifying the precision in the format
4261 directive. When numeric arguments of format directives can be assumed
4262 to be bounded by less than the precision of their type, choosing
4263 an appropriate length modifier to the format specifier will reduce
4264 the required buffer size. For example, if @var{a} and @var{b} in the
4265 example above can be assumed to be within the precision of
4266 the @code{short int} type then using either the @code{%hi} format
4267 directive or casting the argument to @code{short} reduces the maximum
4268 required size of the buffer to 24 bytes.
4271 void f (int a, int b)
4274 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4279 @item -Wno-format-zero-length
4280 @opindex Wno-format-zero-length
4281 @opindex Wformat-zero-length
4282 If @option{-Wformat} is specified, do not warn about zero-length formats.
4283 The C standard specifies that zero-length formats are allowed.
4288 Enable @option{-Wformat} plus additional format checks. Currently
4289 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4292 @item -Wformat-nonliteral
4293 @opindex Wformat-nonliteral
4294 @opindex Wno-format-nonliteral
4295 If @option{-Wformat} is specified, also warn if the format string is not a
4296 string literal and so cannot be checked, unless the format function
4297 takes its format arguments as a @code{va_list}.
4299 @item -Wformat-security
4300 @opindex Wformat-security
4301 @opindex Wno-format-security
4302 If @option{-Wformat} is specified, also warn about uses of format
4303 functions that represent possible security problems. At present, this
4304 warns about calls to @code{printf} and @code{scanf} functions where the
4305 format string is not a string literal and there are no format arguments,
4306 as in @code{printf (foo);}. This may be a security hole if the format
4307 string came from untrusted input and contains @samp{%n}. (This is
4308 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4309 in future warnings may be added to @option{-Wformat-security} that are not
4310 included in @option{-Wformat-nonliteral}.)
4312 @item -Wformat-signedness
4313 @opindex Wformat-signedness
4314 @opindex Wno-format-signedness
4315 If @option{-Wformat} is specified, also warn if the format string
4316 requires an unsigned argument and the argument is signed and vice versa.
4318 @item -Wformat-truncation
4319 @itemx -Wformat-truncation=@var{level}
4320 @opindex Wformat-truncation
4321 @opindex Wno-format-truncation
4322 Warn about calls to formatted input/output functions such as @code{snprintf}
4323 and @code{vsnprintf} that might result in output truncation. When the exact
4324 number of bytes written by a format directive cannot be determined at
4325 compile-time it is estimated based on heuristics that depend on
4326 the @var{level} argument and on optimization. While enabling optimization
4327 will in most cases improve the accuracy of the warning, it may also result
4328 in false positives. Except as noted otherwise, the option uses the same
4329 logic @option{-Wformat-overflow}.
4332 @item -Wformat-truncation
4333 @itemx -Wformat-truncation=1
4334 @opindex Wformat-truncation
4335 @opindex Wno-format-truncation
4336 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4337 employs a conservative approach that warns only about calls to bounded
4338 functions whose return value is unused and that will most likely result
4339 in output truncation.
4341 @item -Wformat-truncation=2
4342 Level @var{2} warns also about calls to bounded functions whose return
4343 value is used and that might result in truncation given an argument of
4344 sufficient length or magnitude.
4348 @opindex Wformat-y2k
4349 @opindex Wno-format-y2k
4350 If @option{-Wformat} is specified, also warn about @code{strftime}
4351 formats that may yield only a two-digit year.
4356 @opindex Wno-nonnull
4357 Warn about passing a null pointer for arguments marked as
4358 requiring a non-null value by the @code{nonnull} function attribute.
4360 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4361 can be disabled with the @option{-Wno-nonnull} option.
4363 @item -Wnonnull-compare
4364 @opindex Wnonnull-compare
4365 @opindex Wno-nonnull-compare
4366 Warn when comparing an argument marked with the @code{nonnull}
4367 function attribute against null inside the function.
4369 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4370 can be disabled with the @option{-Wno-nonnull-compare} option.
4372 @item -Wnull-dereference
4373 @opindex Wnull-dereference
4374 @opindex Wno-null-dereference
4375 Warn if the compiler detects paths that trigger erroneous or
4376 undefined behavior due to dereferencing a null pointer. This option
4377 is only active when @option{-fdelete-null-pointer-checks} is active,
4378 which is enabled by optimizations in most targets. The precision of
4379 the warnings depends on the optimization options used.
4381 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4383 @opindex Wno-init-self
4384 Warn about uninitialized variables that are initialized with themselves.
4385 Note this option can only be used with the @option{-Wuninitialized} option.
4387 For example, GCC warns about @code{i} being uninitialized in the
4388 following snippet only when @option{-Winit-self} has been specified:
4399 This warning is enabled by @option{-Wall} in C++.
4401 @item -Wimplicit-int @r{(C and Objective-C only)}
4402 @opindex Wimplicit-int
4403 @opindex Wno-implicit-int
4404 Warn when a declaration does not specify a type.
4405 This warning is enabled by @option{-Wall}.
4407 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4408 @opindex Wimplicit-function-declaration
4409 @opindex Wno-implicit-function-declaration
4410 Give a warning whenever a function is used before being declared. In
4411 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4412 enabled by default and it is made into an error by
4413 @option{-pedantic-errors}. This warning is also enabled by
4416 @item -Wimplicit @r{(C and Objective-C only)}
4418 @opindex Wno-implicit
4419 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4420 This warning is enabled by @option{-Wall}.
4422 @item -Wimplicit-fallthrough
4423 @opindex Wimplicit-fallthrough
4424 @opindex Wno-implicit-fallthrough
4425 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4426 and @option{-Wno-implicit-fallthrough} is the same as
4427 @option{-Wimplicit-fallthrough=0}.
4429 @item -Wimplicit-fallthrough=@var{n}
4430 @opindex Wimplicit-fallthrough=
4431 Warn when a switch case falls through. For example:
4449 This warning does not warn when the last statement of a case cannot
4450 fall through, e.g. when there is a return statement or a call to function
4451 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4452 also takes into account control flow statements, such as ifs, and only
4453 warns when appropriate. E.g.@:
4463 @} else if (i < 1) @{
4473 Since there are occasions where a switch case fall through is desirable,
4474 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4475 to be used along with a null statement to suppress this warning that
4476 would normally occur:
4484 __attribute__ ((fallthrough));
4491 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4492 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4493 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4494 Instead of these attributes, it is also possible to add a fallthrough comment
4495 to silence the warning. The whole body of the C or C++ style comment should
4496 match the given regular expressions listed below. The option argument @var{n}
4497 specifies what kind of comments are accepted:
4501 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4503 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4504 expression, any comment is used as fallthrough comment.
4506 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4507 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4509 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4510 following regular expressions:
4514 @item @code{-fallthrough}
4516 @item @code{@@fallthrough@@}
4518 @item @code{lint -fallthrough[ \t]*}
4520 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4522 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4524 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4528 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4529 following regular expressions:
4533 @item @code{-fallthrough}
4535 @item @code{@@fallthrough@@}
4537 @item @code{lint -fallthrough[ \t]*}
4539 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4543 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4544 fallthrough comments, only attributes disable the warning.
4548 The comment needs to be followed after optional whitespace and other comments
4549 by @code{case} or @code{default} keywords or by a user label that precedes some
4550 @code{case} or @code{default} label.
4565 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4567 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4568 @opindex Wif-not-aligned
4569 @opindex Wno-if-not-aligned
4570 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4571 should be issued. This is is enabled by default.
4572 Use @option{-Wno-if-not-aligned} to disable it.
4574 @item -Wignored-qualifiers @r{(C and C++ only)}
4575 @opindex Wignored-qualifiers
4576 @opindex Wno-ignored-qualifiers
4577 Warn if the return type of a function has a type qualifier
4578 such as @code{const}. For ISO C such a type qualifier has no effect,
4579 since the value returned by a function is not an lvalue.
4580 For C++, the warning is only emitted for scalar types or @code{void}.
4581 ISO C prohibits qualified @code{void} return types on function
4582 definitions, so such return types always receive a warning
4583 even without this option.
4585 This warning is also enabled by @option{-Wextra}.
4587 @item -Wignored-attributes @r{(C and C++ only)}
4588 @opindex Wignored-attributes
4589 @opindex Wno-ignored-attributes
4590 Warn when an attribute is ignored. This is different from the
4591 @option{-Wattributes} option in that it warns whenever the compiler decides
4592 to drop an attribute, not that the attribute is either unknown, used in a
4593 wrong place, etc. This warning is enabled by default.
4598 Warn if the type of @code{main} is suspicious. @code{main} should be
4599 a function with external linkage, returning int, taking either zero
4600 arguments, two, or three arguments of appropriate types. This warning
4601 is enabled by default in C++ and is enabled by either @option{-Wall}
4602 or @option{-Wpedantic}.
4604 @item -Wmisleading-indentation @r{(C and C++ only)}
4605 @opindex Wmisleading-indentation
4606 @opindex Wno-misleading-indentation
4607 Warn when the indentation of the code does not reflect the block structure.
4608 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4609 @code{for} clauses with a guarded statement that does not use braces,
4610 followed by an unguarded statement with the same indentation.
4612 In the following example, the call to ``bar'' is misleadingly indented as
4613 if it were guarded by the ``if'' conditional.
4616 if (some_condition ())
4618 bar (); /* Gotcha: this is not guarded by the "if". */
4621 In the case of mixed tabs and spaces, the warning uses the
4622 @option{-ftabstop=} option to determine if the statements line up
4625 The warning is not issued for code involving multiline preprocessor logic
4626 such as the following example.
4631 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4637 The warning is not issued after a @code{#line} directive, since this
4638 typically indicates autogenerated code, and no assumptions can be made
4639 about the layout of the file that the directive references.
4641 This warning is enabled by @option{-Wall} in C and C++.
4643 @item -Wmissing-attributes
4644 @opindex Wmissing-attributes
4645 @opindex Wno-missing-attributes
4646 Warn when a declaration of a function is missing one or more attributes
4647 that a related function is declared with and whose absence may adversely
4648 affect the correctness or efficiency of generated code. For example, in
4649 C++, the warning is issued when an explicit specialization of a primary
4650 template declared with attribute @code{alloc_align}, @code{alloc_size},
4651 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4652 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4653 @code{error}, and @code{warning} suppress the warning.
4654 (@pxref{Function Attributes}).
4656 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4658 For example, since the declaration of the primary function template
4659 below makes use of both attribute @code{malloc} and @code{alloc_size}
4660 the declaration of the explicit specialization of the template is
4661 diagnosed because it is missing one of the attributes.
4665 T* __attribute__ ((malloc, alloc_size (1)))
4669 void* __attribute__ ((malloc)) // missing alloc_size
4670 allocate<void> (size_t);
4673 @item -Wmissing-braces
4674 @opindex Wmissing-braces
4675 @opindex Wno-missing-braces
4676 Warn if an aggregate or union initializer is not fully bracketed. In
4677 the following example, the initializer for @code{a} is not fully
4678 bracketed, but that for @code{b} is fully bracketed. This warning is
4679 enabled by @option{-Wall} in C.
4682 int a[2][2] = @{ 0, 1, 2, 3 @};
4683 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4686 This warning is enabled by @option{-Wall}.
4688 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4689 @opindex Wmissing-include-dirs
4690 @opindex Wno-missing-include-dirs
4691 Warn if a user-supplied include directory does not exist.
4693 @item -Wmultistatement-macros
4694 @opindex Wmultistatement-macros
4695 @opindex Wno-multistatement-macros
4696 Warn about unsafe multiple statement macros that appear to be guarded
4697 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4698 @code{while}, in which only the first statement is actually guarded after
4699 the macro is expanded.
4704 #define DOIT x++; y++
4709 will increment @code{y} unconditionally, not just when @code{c} holds.
4710 The can usually be fixed by wrapping the macro in a do-while loop:
4712 #define DOIT do @{ x++; y++; @} while (0)
4717 This warning is enabled by @option{-Wall} in C and C++.
4720 @opindex Wparentheses
4721 @opindex Wno-parentheses
4722 Warn if parentheses are omitted in certain contexts, such
4723 as when there is an assignment in a context where a truth value
4724 is expected, or when operators are nested whose precedence people
4725 often get confused about.
4727 Also warn if a comparison like @code{x<=y<=z} appears; this is
4728 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4729 interpretation from that of ordinary mathematical notation.
4731 Also warn for dangerous uses of the GNU extension to
4732 @code{?:} with omitted middle operand. When the condition
4733 in the @code{?}: operator is a boolean expression, the omitted value is
4734 always 1. Often programmers expect it to be a value computed
4735 inside the conditional expression instead.
4737 For C++ this also warns for some cases of unnecessary parentheses in
4738 declarations, which can indicate an attempt at a function call instead
4742 // Declares a local variable called mymutex.
4743 std::unique_lock<std::mutex> (mymutex);
4744 // User meant std::unique_lock<std::mutex> lock (mymutex);
4748 This warning is enabled by @option{-Wall}.
4750 @item -Wsequence-point
4751 @opindex Wsequence-point
4752 @opindex Wno-sequence-point
4753 Warn about code that may have undefined semantics because of violations
4754 of sequence point rules in the C and C++ standards.
4756 The C and C++ standards define the order in which expressions in a C/C++
4757 program are evaluated in terms of @dfn{sequence points}, which represent
4758 a partial ordering between the execution of parts of the program: those
4759 executed before the sequence point, and those executed after it. These
4760 occur after the evaluation of a full expression (one which is not part
4761 of a larger expression), after the evaluation of the first operand of a
4762 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4763 function is called (but after the evaluation of its arguments and the
4764 expression denoting the called function), and in certain other places.
4765 Other than as expressed by the sequence point rules, the order of
4766 evaluation of subexpressions of an expression is not specified. All
4767 these rules describe only a partial order rather than a total order,
4768 since, for example, if two functions are called within one expression
4769 with no sequence point between them, the order in which the functions
4770 are called is not specified. However, the standards committee have
4771 ruled that function calls do not overlap.
4773 It is not specified when between sequence points modifications to the
4774 values of objects take effect. Programs whose behavior depends on this
4775 have undefined behavior; the C and C++ standards specify that ``Between
4776 the previous and next sequence point an object shall have its stored
4777 value modified at most once by the evaluation of an expression.
4778 Furthermore, the prior value shall be read only to determine the value
4779 to be stored.''. If a program breaks these rules, the results on any
4780 particular implementation are entirely unpredictable.
4782 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4783 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4784 diagnosed by this option, and it may give an occasional false positive
4785 result, but in general it has been found fairly effective at detecting
4786 this sort of problem in programs.
4788 The C++17 standard will define the order of evaluation of operands in
4789 more cases: in particular it requires that the right-hand side of an
4790 assignment be evaluated before the left-hand side, so the above
4791 examples are no longer undefined. But this warning will still warn
4792 about them, to help people avoid writing code that is undefined in C
4793 and earlier revisions of C++.
4795 The standard is worded confusingly, therefore there is some debate
4796 over the precise meaning of the sequence point rules in subtle cases.
4797 Links to discussions of the problem, including proposed formal
4798 definitions, may be found on the GCC readings page, at
4799 @uref{http://gcc.gnu.org/@/readings.html}.
4801 This warning is enabled by @option{-Wall} for C and C++.
4803 @item -Wno-return-local-addr
4804 @opindex Wno-return-local-addr
4805 @opindex Wreturn-local-addr
4806 Do not warn about returning a pointer (or in C++, a reference) to a
4807 variable that goes out of scope after the function returns.
4810 @opindex Wreturn-type
4811 @opindex Wno-return-type
4812 Warn whenever a function is defined with a return type that defaults
4813 to @code{int}. Also warn about any @code{return} statement with no
4814 return value in a function whose return type is not @code{void}
4815 (falling off the end of the function body is considered returning
4818 For C only, warn about a @code{return} statement with an expression in a
4819 function whose return type is @code{void}, unless the expression type is
4820 also @code{void}. As a GNU extension, the latter case is accepted
4821 without a warning unless @option{-Wpedantic} is used.
4823 For C++, a function without return type always produces a diagnostic
4824 message, even when @option{-Wno-return-type} is specified. The only
4825 exceptions are @code{main} and functions defined in system headers.
4827 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
4829 @item -Wshift-count-negative
4830 @opindex Wshift-count-negative
4831 @opindex Wno-shift-count-negative
4832 Warn if shift count is negative. This warning is enabled by default.
4834 @item -Wshift-count-overflow
4835 @opindex Wshift-count-overflow
4836 @opindex Wno-shift-count-overflow
4837 Warn if shift count >= width of type. This warning is enabled by default.
4839 @item -Wshift-negative-value
4840 @opindex Wshift-negative-value
4841 @opindex Wno-shift-negative-value
4842 Warn if left shifting a negative value. This warning is enabled by
4843 @option{-Wextra} in C99 and C++11 modes (and newer).
4845 @item -Wshift-overflow
4846 @itemx -Wshift-overflow=@var{n}
4847 @opindex Wshift-overflow
4848 @opindex Wno-shift-overflow
4849 Warn about left shift overflows. This warning is enabled by
4850 default in C99 and C++11 modes (and newer).
4853 @item -Wshift-overflow=1
4854 This is the warning level of @option{-Wshift-overflow} and is enabled
4855 by default in C99 and C++11 modes (and newer). This warning level does
4856 not warn about left-shifting 1 into the sign bit. (However, in C, such
4857 an overflow is still rejected in contexts where an integer constant expression
4860 @item -Wshift-overflow=2
4861 This warning level also warns about left-shifting 1 into the sign bit,
4862 unless C++14 mode is active.
4868 Warn whenever a @code{switch} statement has an index of enumerated type
4869 and lacks a @code{case} for one or more of the named codes of that
4870 enumeration. (The presence of a @code{default} label prevents this
4871 warning.) @code{case} labels outside the enumeration range also
4872 provoke warnings when this option is used (even if there is a
4873 @code{default} label).
4874 This warning is enabled by @option{-Wall}.
4876 @item -Wswitch-default
4877 @opindex Wswitch-default
4878 @opindex Wno-switch-default
4879 Warn whenever a @code{switch} statement does not have a @code{default}
4883 @opindex Wswitch-enum
4884 @opindex Wno-switch-enum
4885 Warn whenever a @code{switch} statement has an index of enumerated type
4886 and lacks a @code{case} for one or more of the named codes of that
4887 enumeration. @code{case} labels outside the enumeration range also
4888 provoke warnings when this option is used. The only difference
4889 between @option{-Wswitch} and this option is that this option gives a
4890 warning about an omitted enumeration code even if there is a
4891 @code{default} label.
4894 @opindex Wswitch-bool
4895 @opindex Wno-switch-bool
4896 Warn whenever a @code{switch} statement has an index of boolean type
4897 and the case values are outside the range of a boolean type.
4898 It is possible to suppress this warning by casting the controlling
4899 expression to a type other than @code{bool}. For example:
4902 switch ((int) (a == 4))
4908 This warning is enabled by default for C and C++ programs.
4910 @item -Wswitch-unreachable
4911 @opindex Wswitch-unreachable
4912 @opindex Wno-switch-unreachable
4913 Warn whenever a @code{switch} statement contains statements between the
4914 controlling expression and the first case label, which will never be
4915 executed. For example:
4927 @option{-Wswitch-unreachable} does not warn if the statement between the
4928 controlling expression and the first case label is just a declaration:
4941 This warning is enabled by default for C and C++ programs.
4943 @item -Wsync-nand @r{(C and C++ only)}
4945 @opindex Wno-sync-nand
4946 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4947 built-in functions are used. These functions changed semantics in GCC 4.4.
4949 @item -Wunused-but-set-parameter
4950 @opindex Wunused-but-set-parameter
4951 @opindex Wno-unused-but-set-parameter
4952 Warn whenever a function parameter is assigned to, but otherwise unused
4953 (aside from its declaration).
4955 To suppress this warning use the @code{unused} attribute
4956 (@pxref{Variable Attributes}).
4958 This warning is also enabled by @option{-Wunused} together with
4961 @item -Wunused-but-set-variable
4962 @opindex Wunused-but-set-variable
4963 @opindex Wno-unused-but-set-variable
4964 Warn whenever a local variable is assigned to, but otherwise unused
4965 (aside from its declaration).
4966 This warning is enabled by @option{-Wall}.
4968 To suppress this warning use the @code{unused} attribute
4969 (@pxref{Variable Attributes}).
4971 This warning is also enabled by @option{-Wunused}, which is enabled
4974 @item -Wunused-function
4975 @opindex Wunused-function
4976 @opindex Wno-unused-function
4977 Warn whenever a static function is declared but not defined or a
4978 non-inline static function is unused.
4979 This warning is enabled by @option{-Wall}.
4981 @item -Wunused-label
4982 @opindex Wunused-label
4983 @opindex Wno-unused-label
4984 Warn whenever a label is declared but not used.
4985 This warning is enabled by @option{-Wall}.
4987 To suppress this warning use the @code{unused} attribute
4988 (@pxref{Variable Attributes}).
4990 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4991 @opindex Wunused-local-typedefs
4992 @opindex Wno-unused-local-typedefs
4993 Warn when a typedef locally defined in a function is not used.
4994 This warning is enabled by @option{-Wall}.
4996 @item -Wunused-parameter
4997 @opindex Wunused-parameter
4998 @opindex Wno-unused-parameter
4999 Warn whenever a function parameter is unused aside from its declaration.
5001 To suppress this warning use the @code{unused} attribute
5002 (@pxref{Variable Attributes}).
5004 @item -Wno-unused-result
5005 @opindex Wunused-result
5006 @opindex Wno-unused-result
5007 Do not warn if a caller of a function marked with attribute
5008 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5009 its return value. The default is @option{-Wunused-result}.
5011 @item -Wunused-variable
5012 @opindex Wunused-variable
5013 @opindex Wno-unused-variable
5014 Warn whenever a local or static variable is unused aside from its
5015 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5016 but not for C++. This warning is enabled by @option{-Wall}.
5018 To suppress this warning use the @code{unused} attribute
5019 (@pxref{Variable Attributes}).
5021 @item -Wunused-const-variable
5022 @itemx -Wunused-const-variable=@var{n}
5023 @opindex Wunused-const-variable
5024 @opindex Wno-unused-const-variable
5025 Warn whenever a constant static variable is unused aside from its declaration.
5026 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5027 for C, but not for C++. In C this declares variable storage, but in C++ this
5028 is not an error since const variables take the place of @code{#define}s.
5030 To suppress this warning use the @code{unused} attribute
5031 (@pxref{Variable Attributes}).
5034 @item -Wunused-const-variable=1
5035 This is the warning level that is enabled by @option{-Wunused-variable} for
5036 C. It warns only about unused static const variables defined in the main
5037 compilation unit, but not about static const variables declared in any
5040 @item -Wunused-const-variable=2
5041 This warning level also warns for unused constant static variables in
5042 headers (excluding system headers). This is the warning level of
5043 @option{-Wunused-const-variable} and must be explicitly requested since
5044 in C++ this isn't an error and in C it might be harder to clean up all
5048 @item -Wunused-value
5049 @opindex Wunused-value
5050 @opindex Wno-unused-value
5051 Warn whenever a statement computes a result that is explicitly not
5052 used. To suppress this warning cast the unused expression to
5053 @code{void}. This includes an expression-statement or the left-hand
5054 side of a comma expression that contains no side effects. For example,
5055 an expression such as @code{x[i,j]} causes a warning, while
5056 @code{x[(void)i,j]} does not.
5058 This warning is enabled by @option{-Wall}.
5063 All the above @option{-Wunused} options combined.
5065 In order to get a warning about an unused function parameter, you must
5066 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5067 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5069 @item -Wuninitialized
5070 @opindex Wuninitialized
5071 @opindex Wno-uninitialized
5072 Warn if an automatic variable is used without first being initialized
5073 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5074 warn if a non-static reference or non-static @code{const} member
5075 appears in a class without constructors.
5077 If you want to warn about code that uses the uninitialized value of the
5078 variable in its own initializer, use the @option{-Winit-self} option.
5080 These warnings occur for individual uninitialized or clobbered
5081 elements of structure, union or array variables as well as for
5082 variables that are uninitialized or clobbered as a whole. They do
5083 not occur for variables or elements declared @code{volatile}. Because
5084 these warnings depend on optimization, the exact variables or elements
5085 for which there are warnings depends on the precise optimization
5086 options and version of GCC used.
5088 Note that there may be no warning about a variable that is used only
5089 to compute a value that itself is never used, because such
5090 computations may be deleted by data flow analysis before the warnings
5093 @item -Winvalid-memory-model
5094 @opindex Winvalid-memory-model
5095 @opindex Wno-invalid-memory-model
5096 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5097 and the C11 atomic generic functions with a memory consistency argument
5098 that is either invalid for the operation or outside the range of values
5099 of the @code{memory_order} enumeration. For example, since the
5100 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5101 defined for the relaxed, release, and sequentially consistent memory
5102 orders the following code is diagnosed:
5107 __atomic_store_n (i, 0, memory_order_consume);
5111 @option{-Winvalid-memory-model} is enabled by default.
5113 @item -Wmaybe-uninitialized
5114 @opindex Wmaybe-uninitialized
5115 @opindex Wno-maybe-uninitialized
5116 For an automatic (i.e.@ local) variable, if there exists a path from the
5117 function entry to a use of the variable that is initialized, but there exist
5118 some other paths for which the variable is not initialized, the compiler
5119 emits a warning if it cannot prove the uninitialized paths are not
5120 executed at run time.
5122 These warnings are only possible in optimizing compilation, because otherwise
5123 GCC does not keep track of the state of variables.
5125 These warnings are made optional because GCC may not be able to determine when
5126 the code is correct in spite of appearing to have an error. Here is one
5127 example of how this can happen:
5147 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5148 always initialized, but GCC doesn't know this. To suppress the
5149 warning, you need to provide a default case with assert(0) or
5152 @cindex @code{longjmp} warnings
5153 This option also warns when a non-volatile automatic variable might be
5154 changed by a call to @code{longjmp}.
5155 The compiler sees only the calls to @code{setjmp}. It cannot know
5156 where @code{longjmp} will be called; in fact, a signal handler could
5157 call it at any point in the code. As a result, you may get a warning
5158 even when there is in fact no problem because @code{longjmp} cannot
5159 in fact be called at the place that would cause a problem.
5161 Some spurious warnings can be avoided if you declare all the functions
5162 you use that never return as @code{noreturn}. @xref{Function
5165 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5167 @item -Wunknown-pragmas
5168 @opindex Wunknown-pragmas
5169 @opindex Wno-unknown-pragmas
5170 @cindex warning for unknown pragmas
5171 @cindex unknown pragmas, warning
5172 @cindex pragmas, warning of unknown
5173 Warn when a @code{#pragma} directive is encountered that is not understood by
5174 GCC@. If this command-line option is used, warnings are even issued
5175 for unknown pragmas in system header files. This is not the case if
5176 the warnings are only enabled by the @option{-Wall} command-line option.
5179 @opindex Wno-pragmas
5181 Do not warn about misuses of pragmas, such as incorrect parameters,
5182 invalid syntax, or conflicts between pragmas. See also
5183 @option{-Wunknown-pragmas}.
5185 @item -Wstrict-aliasing
5186 @opindex Wstrict-aliasing
5187 @opindex Wno-strict-aliasing
5188 This option is only active when @option{-fstrict-aliasing} is active.
5189 It warns about code that might break the strict aliasing rules that the
5190 compiler is using for optimization. The warning does not catch all
5191 cases, but does attempt to catch the more common pitfalls. It is
5192 included in @option{-Wall}.
5193 It is equivalent to @option{-Wstrict-aliasing=3}
5195 @item -Wstrict-aliasing=n
5196 @opindex Wstrict-aliasing=n
5197 This option is only active when @option{-fstrict-aliasing} is active.
5198 It warns about code that might break the strict aliasing rules that the
5199 compiler is using for optimization.
5200 Higher levels correspond to higher accuracy (fewer false positives).
5201 Higher levels also correspond to more effort, similar to the way @option{-O}
5203 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5205 Level 1: Most aggressive, quick, least accurate.
5206 Possibly useful when higher levels
5207 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5208 false negatives. However, it has many false positives.
5209 Warns for all pointer conversions between possibly incompatible types,
5210 even if never dereferenced. Runs in the front end only.
5212 Level 2: Aggressive, quick, not too precise.
5213 May still have many false positives (not as many as level 1 though),
5214 and few false negatives (but possibly more than level 1).
5215 Unlike level 1, it only warns when an address is taken. Warns about
5216 incomplete types. Runs in the front end only.
5218 Level 3 (default for @option{-Wstrict-aliasing}):
5219 Should have very few false positives and few false
5220 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5221 Takes care of the common pun+dereference pattern in the front end:
5222 @code{*(int*)&some_float}.
5223 If optimization is enabled, it also runs in the back end, where it deals
5224 with multiple statement cases using flow-sensitive points-to information.
5225 Only warns when the converted pointer is dereferenced.
5226 Does not warn about incomplete types.
5228 @item -Wstrict-overflow
5229 @itemx -Wstrict-overflow=@var{n}
5230 @opindex Wstrict-overflow
5231 @opindex Wno-strict-overflow
5232 This option is only active when signed overflow is undefined.
5233 It warns about cases where the compiler optimizes based on the
5234 assumption that signed overflow does not occur. Note that it does not
5235 warn about all cases where the code might overflow: it only warns
5236 about cases where the compiler implements some optimization. Thus
5237 this warning depends on the optimization level.
5239 An optimization that assumes that signed overflow does not occur is
5240 perfectly safe if the values of the variables involved are such that
5241 overflow never does, in fact, occur. Therefore this warning can
5242 easily give a false positive: a warning about code that is not
5243 actually a problem. To help focus on important issues, several
5244 warning levels are defined. No warnings are issued for the use of
5245 undefined signed overflow when estimating how many iterations a loop
5246 requires, in particular when determining whether a loop will be
5250 @item -Wstrict-overflow=1
5251 Warn about cases that are both questionable and easy to avoid. For
5252 example the compiler simplifies
5253 @code{x + 1 > x} to @code{1}. This level of
5254 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5255 are not, and must be explicitly requested.
5257 @item -Wstrict-overflow=2
5258 Also warn about other cases where a comparison is simplified to a
5259 constant. For example: @code{abs (x) >= 0}. This can only be
5260 simplified when signed integer overflow is undefined, because
5261 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5262 zero. @option{-Wstrict-overflow} (with no level) is the same as
5263 @option{-Wstrict-overflow=2}.
5265 @item -Wstrict-overflow=3
5266 Also warn about other cases where a comparison is simplified. For
5267 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5269 @item -Wstrict-overflow=4
5270 Also warn about other simplifications not covered by the above cases.
5271 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5273 @item -Wstrict-overflow=5
5274 Also warn about cases where the compiler reduces the magnitude of a
5275 constant involved in a comparison. For example: @code{x + 2 > y} is
5276 simplified to @code{x + 1 >= y}. This is reported only at the
5277 highest warning level because this simplification applies to many
5278 comparisons, so this warning level gives a very large number of
5282 @item -Wstringop-overflow
5283 @itemx -Wstringop-overflow=@var{type}
5284 @opindex Wstringop-overflow
5285 @opindex Wno-stringop-overflow
5286 Warn for calls to string manipulation functions such as @code{memcpy} and
5287 @code{strcpy} that are determined to overflow the destination buffer. The
5288 optional argument is one greater than the type of Object Size Checking to
5289 perform to determine the size of the destination. @xref{Object Size Checking}.
5290 The argument is meaningful only for functions that operate on character arrays
5291 but not for raw memory functions like @code{memcpy} which always make use
5292 of Object Size type-0. The option also warns for calls that specify a size
5293 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5294 The option produces the best results with optimization enabled but can detect
5295 a small subset of simple buffer overflows even without optimization in
5296 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5297 correspond to the standard functions. In any case, the option warns about
5298 just a subset of buffer overflows detected by the corresponding overflow
5299 checking built-ins. For example, the option will issue a warning for
5300 the @code{strcpy} call below because it copies at least 5 characters
5301 (the string @code{"blue"} including the terminating NUL) into the buffer
5305 enum Color @{ blue, purple, yellow @};
5306 const char* f (enum Color clr)
5308 static char buf [4];
5312 case blue: str = "blue"; break;
5313 case purple: str = "purple"; break;
5314 case yellow: str = "yellow"; break;
5317 return strcpy (buf, str); // warning here
5321 Option @option{-Wstringop-overflow=2} is enabled by default.
5324 @item -Wstringop-overflow
5325 @itemx -Wstringop-overflow=1
5326 @opindex Wstringop-overflow
5327 @opindex Wno-stringop-overflow
5328 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5329 to determine the sizes of destination objects. This is the default setting
5330 of the option. At this setting the option will not warn for writes past
5331 the end of subobjects of larger objects accessed by pointers unless the
5332 size of the largest surrounding object is known. When the destination may
5333 be one of several objects it is assumed to be the largest one of them. On
5334 Linux systems, when optimization is enabled at this setting the option warns
5335 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5338 @item -Wstringop-overflow=2
5339 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5340 to determine the sizes of destination objects. At this setting the option
5341 will warn about overflows when writing to members of the largest complete
5342 objects whose exact size is known. It will, however, not warn for excessive
5343 writes to the same members of unknown objects referenced by pointers since
5344 they may point to arrays containing unknown numbers of elements.
5346 @item -Wstringop-overflow=3
5347 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5348 to determine the sizes of destination objects. At this setting the option
5349 warns about overflowing the smallest object or data member. This is the
5350 most restrictive setting of the option that may result in warnings for safe
5353 @item -Wstringop-overflow=4
5354 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5355 to determine the sizes of destination objects. At this setting the option
5356 will warn about overflowing any data members, and when the destination is
5357 one of several objects it uses the size of the largest of them to decide
5358 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5359 setting of the option may result in warnings for benign code.
5362 @item -Wstringop-truncation
5363 @opindex Wstringop-truncation
5364 @opindex Wno-stringop-truncation
5365 Warn for calls to bounded string manipulation functions such as @code{strncat},
5366 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5367 or leave the destination unchanged.
5369 In the following example, the call to @code{strncat} specifies a bound that
5370 is less than the length of the source string. As a result, the copy of
5371 the source will be truncated and so the call is diagnosed. To avoid the
5372 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5375 void append (char *buf, size_t bufsize)
5377 strncat (buf, ".txt", 3);
5381 As another example, the following call to @code{strncpy} results in copying
5382 to @code{d} just the characters preceding the terminating NUL, without
5383 appending the NUL to the end. Assuming the result of @code{strncpy} is
5384 necessarily a NUL-terminated string is a common mistake, and so the call
5385 is diagnosed. To avoid the warning when the result is not expected to be
5386 NUL-terminated, call @code{memcpy} instead.
5389 void copy (char *d, const char *s)
5391 strncpy (d, s, strlen (s));
5395 In the following example, the call to @code{strncpy} specifies the size
5396 of the destination buffer as the bound. If the length of the source
5397 string is equal to or greater than this size the result of the copy will
5398 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5399 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5400 element of the buffer to @code{NUL}.
5403 void copy (const char *s)
5406 strncpy (buf, s, sizeof buf);
5411 In situations where a character array is intended to store a sequence
5412 of bytes with no terminating @code{NUL} such an array may be annotated
5413 with attribute @code{nonstring} to avoid this warning. Such arrays,
5414 however, are not suitable arguments to functions that expect
5415 @code{NUL}-terminated strings. To help detect accidental misuses of
5416 such arrays GCC issues warnings unless it can prove that the use is
5417 safe. @xref{Common Variable Attributes}.
5419 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5420 @opindex Wsuggest-attribute=
5421 @opindex Wno-suggest-attribute=
5422 Warn for cases where adding an attribute may be beneficial. The
5423 attributes currently supported are listed below.
5426 @item -Wsuggest-attribute=pure
5427 @itemx -Wsuggest-attribute=const
5428 @itemx -Wsuggest-attribute=noreturn
5429 @itemx -Wsuggest-attribute=malloc
5430 @opindex Wsuggest-attribute=pure
5431 @opindex Wno-suggest-attribute=pure
5432 @opindex Wsuggest-attribute=const
5433 @opindex Wno-suggest-attribute=const
5434 @opindex Wsuggest-attribute=noreturn
5435 @opindex Wno-suggest-attribute=noreturn
5436 @opindex Wsuggest-attribute=malloc
5437 @opindex Wno-suggest-attribute=malloc
5439 Warn about functions that might be candidates for attributes
5440 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5441 only warns for functions visible in other compilation units or (in the case of
5442 @code{pure} and @code{const}) if it cannot prove that the function returns
5443 normally. A function returns normally if it doesn't contain an infinite loop or
5444 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5445 requires option @option{-fipa-pure-const}, which is enabled by default at
5446 @option{-O} and higher. Higher optimization levels improve the accuracy
5449 @item -Wsuggest-attribute=format
5450 @itemx -Wmissing-format-attribute
5451 @opindex Wsuggest-attribute=format
5452 @opindex Wmissing-format-attribute
5453 @opindex Wno-suggest-attribute=format
5454 @opindex Wno-missing-format-attribute
5458 Warn about function pointers that might be candidates for @code{format}
5459 attributes. Note these are only possible candidates, not absolute ones.
5460 GCC guesses that function pointers with @code{format} attributes that
5461 are used in assignment, initialization, parameter passing or return
5462 statements should have a corresponding @code{format} attribute in the
5463 resulting type. I.e.@: the left-hand side of the assignment or
5464 initialization, the type of the parameter variable, or the return type
5465 of the containing function respectively should also have a @code{format}
5466 attribute to avoid the warning.
5468 GCC also warns about function definitions that might be
5469 candidates for @code{format} attributes. Again, these are only
5470 possible candidates. GCC guesses that @code{format} attributes
5471 might be appropriate for any function that calls a function like
5472 @code{vprintf} or @code{vscanf}, but this might not always be the
5473 case, and some functions for which @code{format} attributes are
5474 appropriate may not be detected.
5476 @item -Wsuggest-attribute=cold
5477 @opindex Wsuggest-attribute=cold
5478 @opindex Wno-suggest-attribute=cold
5480 Warn about functions that might be candidates for @code{cold} attribute. This
5481 is based on static detection and generally will only warn about functions which
5482 always leads to a call to another @code{cold} function such as wrappers of
5483 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5486 @item -Wsuggest-final-types
5487 @opindex Wno-suggest-final-types
5488 @opindex Wsuggest-final-types
5489 Warn about types with virtual methods where code quality would be improved
5490 if the type were declared with the C++11 @code{final} specifier,
5492 declared in an anonymous namespace. This allows GCC to more aggressively
5493 devirtualize the polymorphic calls. This warning is more effective with link
5494 time optimization, where the information about the class hierarchy graph is
5497 @item -Wsuggest-final-methods
5498 @opindex Wno-suggest-final-methods
5499 @opindex Wsuggest-final-methods
5500 Warn about virtual methods where code quality would be improved if the method
5501 were declared with the C++11 @code{final} specifier,
5502 or, if possible, its type were
5503 declared in an anonymous namespace or with the @code{final} specifier.
5505 more effective with link-time optimization, where the information about the
5506 class hierarchy graph is more complete. It is recommended to first consider
5507 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5510 @item -Wsuggest-override
5511 Warn about overriding virtual functions that are not marked with the override
5515 @opindex Wno-alloc-zero
5516 @opindex Walloc-zero
5517 Warn about calls to allocation functions decorated with attribute
5518 @code{alloc_size} that specify zero bytes, including those to the built-in
5519 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5520 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5521 when called with a zero size differs among implementations (and in the case
5522 of @code{realloc} has been deprecated) relying on it may result in subtle
5523 portability bugs and should be avoided.
5525 @item -Walloc-size-larger-than=@var{n}
5526 @opindex Walloc-size-larger-than=@var{n}
5527 @opindex Wno-alloc-size-larger-than
5528 Warn about calls to functions decorated with attribute @code{alloc_size}
5529 that attempt to allocate objects larger than the specified number of bytes,
5530 or where the result of the size computation in an integer type with infinite
5531 precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n} is
5532 treated as an integer with infinite precision and may end in one of
5533 the standard suffixes designating a multiple of bytes such as @code{kB} and
5534 @code{KiB} for kilobyte and kibibyte, respectively, @code{MB} and @code{MiB}
5535 for megabyte and mebibyte, and so on.
5536 @option{-Walloc-size-larger-than=}@var{PTRDIFF_MAX} is enabled by default.
5537 Warnings controlled by the option can be disabled either by specifying
5538 @var{n} of @var{SIZE_MAX} or more or by @option{-Wno-alloc-size-larger-than}.
5539 @xref{Function Attributes}.
5544 This option warns on all uses of @code{alloca} in the source.
5546 @item -Walloca-larger-than=@var{n}
5547 This option warns on calls to @code{alloca} that are not bounded by a
5548 controlling predicate limiting its argument of integer type to at most
5549 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5550 Arguments of non-integer types are considered unbounded even if they
5551 appear to be constrained to the expected range.
5553 For example, a bounded case of @code{alloca} could be:
5556 void func (size_t n)
5567 In the above example, passing @code{-Walloca-larger-than=1000} would not
5568 issue a warning because the call to @code{alloca} is known to be at most
5569 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5570 the compiler would emit a warning.
5572 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5573 controlling predicate constraining its integer argument. For example:
5578 void *p = alloca (n);
5583 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5584 a warning, but this time because of the lack of bounds checking.
5586 Note, that even seemingly correct code involving signed integers could
5590 void func (signed int n)
5600 In the above example, @var{n} could be negative, causing a larger than
5601 expected argument to be implicitly cast into the @code{alloca} call.
5603 This option also warns when @code{alloca} is used in a loop.
5605 This warning is not enabled by @option{-Wall}, and is only active when
5606 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5608 See also @option{-Wvla-larger-than=@var{n}}.
5610 @item -Warray-bounds
5611 @itemx -Warray-bounds=@var{n}
5612 @opindex Wno-array-bounds
5613 @opindex Warray-bounds
5614 This option is only active when @option{-ftree-vrp} is active
5615 (default for @option{-O2} and above). It warns about subscripts to arrays
5616 that are always out of bounds. This warning is enabled by @option{-Wall}.
5619 @item -Warray-bounds=1
5620 This is the warning level of @option{-Warray-bounds} and is enabled
5621 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5623 @item -Warray-bounds=2
5624 This warning level also warns about out of bounds access for
5625 arrays at the end of a struct and for arrays accessed through
5626 pointers. This warning level may give a larger number of
5627 false positives and is deactivated by default.
5630 @item -Wattribute-alias
5631 Warn about declarations using the @code{alias} and similar attributes whose
5632 target is incompatible with the type of the alias. @xref{Function Attributes,
5633 ,Declaring Attributes of Functions}.
5635 @item -Wbool-compare
5636 @opindex Wno-bool-compare
5637 @opindex Wbool-compare
5638 Warn about boolean expression compared with an integer value different from
5639 @code{true}/@code{false}. For instance, the following comparison is
5644 if ((n > 1) == 2) @{ @dots{} @}
5646 This warning is enabled by @option{-Wall}.
5648 @item -Wbool-operation
5649 @opindex Wno-bool-operation
5650 @opindex Wbool-operation
5651 Warn about suspicious operations on expressions of a boolean type. For
5652 instance, bitwise negation of a boolean is very likely a bug in the program.
5653 For C, this warning also warns about incrementing or decrementing a boolean,
5654 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5655 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5657 This warning is enabled by @option{-Wall}.
5659 @item -Wduplicated-branches
5660 @opindex Wno-duplicated-branches
5661 @opindex Wduplicated-branches
5662 Warn when an if-else has identical branches. This warning detects cases like
5669 It doesn't warn when both branches contain just a null statement. This warning
5670 also warn for conditional operators:
5672 int i = x ? *p : *p;
5675 @item -Wduplicated-cond
5676 @opindex Wno-duplicated-cond
5677 @opindex Wduplicated-cond
5678 Warn about duplicated conditions in an if-else-if chain. For instance,
5679 warn for the following code:
5681 if (p->q != NULL) @{ @dots{} @}
5682 else if (p->q != NULL) @{ @dots{} @}
5685 @item -Wframe-address
5686 @opindex Wno-frame-address
5687 @opindex Wframe-address
5688 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5689 is called with an argument greater than 0. Such calls may return indeterminate
5690 values or crash the program. The warning is included in @option{-Wall}.
5692 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5693 @opindex Wno-discarded-qualifiers
5694 @opindex Wdiscarded-qualifiers
5695 Do not warn if type qualifiers on pointers are being discarded.
5696 Typically, the compiler warns if a @code{const char *} variable is
5697 passed to a function that takes a @code{char *} parameter. This option
5698 can be used to suppress such a warning.
5700 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5701 @opindex Wno-discarded-array-qualifiers
5702 @opindex Wdiscarded-array-qualifiers
5703 Do not warn if type qualifiers on arrays which are pointer targets
5704 are being discarded. Typically, the compiler warns if a
5705 @code{const int (*)[]} variable is passed to a function that
5706 takes a @code{int (*)[]} parameter. This option can be used to
5707 suppress such a warning.
5709 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5710 @opindex Wno-incompatible-pointer-types
5711 @opindex Wincompatible-pointer-types
5712 Do not warn when there is a conversion between pointers that have incompatible
5713 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5714 which warns for pointer argument passing or assignment with different
5717 @item -Wno-int-conversion @r{(C and Objective-C only)}
5718 @opindex Wno-int-conversion
5719 @opindex Wint-conversion
5720 Do not warn about incompatible integer to pointer and pointer to integer
5721 conversions. This warning is about implicit conversions; for explicit
5722 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5723 @option{-Wno-pointer-to-int-cast} may be used.
5725 @item -Wno-div-by-zero
5726 @opindex Wno-div-by-zero
5727 @opindex Wdiv-by-zero
5728 Do not warn about compile-time integer division by zero. Floating-point
5729 division by zero is not warned about, as it can be a legitimate way of
5730 obtaining infinities and NaNs.
5732 @item -Wsystem-headers
5733 @opindex Wsystem-headers
5734 @opindex Wno-system-headers
5735 @cindex warnings from system headers
5736 @cindex system headers, warnings from
5737 Print warning messages for constructs found in system header files.
5738 Warnings from system headers are normally suppressed, on the assumption
5739 that they usually do not indicate real problems and would only make the
5740 compiler output harder to read. Using this command-line option tells
5741 GCC to emit warnings from system headers as if they occurred in user
5742 code. However, note that using @option{-Wall} in conjunction with this
5743 option does @emph{not} warn about unknown pragmas in system
5744 headers---for that, @option{-Wunknown-pragmas} must also be used.
5746 @item -Wtautological-compare
5747 @opindex Wtautological-compare
5748 @opindex Wno-tautological-compare
5749 Warn if a self-comparison always evaluates to true or false. This
5750 warning detects various mistakes such as:
5754 if (i > i) @{ @dots{} @}
5757 This warning also warns about bitwise comparisons that always evaluate
5758 to true or false, for instance:
5760 if ((a & 16) == 10) @{ @dots{} @}
5762 will always be false.
5764 This warning is enabled by @option{-Wall}.
5767 @opindex Wtrampolines
5768 @opindex Wno-trampolines
5769 Warn about trampolines generated for pointers to nested functions.
5770 A trampoline is a small piece of data or code that is created at run
5771 time on the stack when the address of a nested function is taken, and is
5772 used to call the nested function indirectly. For some targets, it is
5773 made up of data only and thus requires no special treatment. But, for
5774 most targets, it is made up of code and thus requires the stack to be
5775 made executable in order for the program to work properly.
5778 @opindex Wfloat-equal
5779 @opindex Wno-float-equal
5780 Warn if floating-point values are used in equality comparisons.
5782 The idea behind this is that sometimes it is convenient (for the
5783 programmer) to consider floating-point values as approximations to
5784 infinitely precise real numbers. If you are doing this, then you need
5785 to compute (by analyzing the code, or in some other way) the maximum or
5786 likely maximum error that the computation introduces, and allow for it
5787 when performing comparisons (and when producing output, but that's a
5788 different problem). In particular, instead of testing for equality, you
5789 should check to see whether the two values have ranges that overlap; and
5790 this is done with the relational operators, so equality comparisons are
5793 @item -Wtraditional @r{(C and Objective-C only)}
5794 @opindex Wtraditional
5795 @opindex Wno-traditional
5796 Warn about certain constructs that behave differently in traditional and
5797 ISO C@. Also warn about ISO C constructs that have no traditional C
5798 equivalent, and/or problematic constructs that should be avoided.
5802 Macro parameters that appear within string literals in the macro body.
5803 In traditional C macro replacement takes place within string literals,
5804 but in ISO C it does not.
5807 In traditional C, some preprocessor directives did not exist.
5808 Traditional preprocessors only considered a line to be a directive
5809 if the @samp{#} appeared in column 1 on the line. Therefore
5810 @option{-Wtraditional} warns about directives that traditional C
5811 understands but ignores because the @samp{#} does not appear as the
5812 first character on the line. It also suggests you hide directives like
5813 @code{#pragma} not understood by traditional C by indenting them. Some
5814 traditional implementations do not recognize @code{#elif}, so this option
5815 suggests avoiding it altogether.
5818 A function-like macro that appears without arguments.
5821 The unary plus operator.
5824 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5825 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5826 constants.) Note, these suffixes appear in macros defined in the system
5827 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5828 Use of these macros in user code might normally lead to spurious
5829 warnings, however GCC's integrated preprocessor has enough context to
5830 avoid warning in these cases.
5833 A function declared external in one block and then used after the end of
5837 A @code{switch} statement has an operand of type @code{long}.
5840 A non-@code{static} function declaration follows a @code{static} one.
5841 This construct is not accepted by some traditional C compilers.
5844 The ISO type of an integer constant has a different width or
5845 signedness from its traditional type. This warning is only issued if
5846 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5847 typically represent bit patterns, are not warned about.
5850 Usage of ISO string concatenation is detected.
5853 Initialization of automatic aggregates.
5856 Identifier conflicts with labels. Traditional C lacks a separate
5857 namespace for labels.
5860 Initialization of unions. If the initializer is zero, the warning is
5861 omitted. This is done under the assumption that the zero initializer in
5862 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5863 initializer warnings and relies on default initialization to zero in the
5867 Conversions by prototypes between fixed/floating-point values and vice
5868 versa. The absence of these prototypes when compiling with traditional
5869 C causes serious problems. This is a subset of the possible
5870 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5873 Use of ISO C style function definitions. This warning intentionally is
5874 @emph{not} issued for prototype declarations or variadic functions
5875 because these ISO C features appear in your code when using
5876 libiberty's traditional C compatibility macros, @code{PARAMS} and
5877 @code{VPARAMS}. This warning is also bypassed for nested functions
5878 because that feature is already a GCC extension and thus not relevant to
5879 traditional C compatibility.
5882 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5883 @opindex Wtraditional-conversion
5884 @opindex Wno-traditional-conversion
5885 Warn if a prototype causes a type conversion that is different from what
5886 would happen to the same argument in the absence of a prototype. This
5887 includes conversions of fixed point to floating and vice versa, and
5888 conversions changing the width or signedness of a fixed-point argument
5889 except when the same as the default promotion.
5891 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5892 @opindex Wdeclaration-after-statement
5893 @opindex Wno-declaration-after-statement
5894 Warn when a declaration is found after a statement in a block. This
5895 construct, known from C++, was introduced with ISO C99 and is by default
5896 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5901 Warn whenever a local variable or type declaration shadows another
5902 variable, parameter, type, class member (in C++), or instance variable
5903 (in Objective-C) or whenever a built-in function is shadowed. Note
5904 that in C++, the compiler warns if a local variable shadows an
5905 explicit typedef, but not if it shadows a struct/class/enum.
5906 Same as @option{-Wshadow=global}.
5908 @item -Wno-shadow-ivar @r{(Objective-C only)}
5909 @opindex Wno-shadow-ivar
5910 @opindex Wshadow-ivar
5911 Do not warn whenever a local variable shadows an instance variable in an
5914 @item -Wshadow=global
5915 @opindex Wshadow=local
5916 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5918 @item -Wshadow=local
5919 @opindex Wshadow=local
5920 Warn when a local variable shadows another local variable or parameter.
5921 This warning is enabled by @option{-Wshadow=global}.
5923 @item -Wshadow=compatible-local
5924 @opindex Wshadow=compatible-local
5925 Warn when a local variable shadows another local variable or parameter
5926 whose type is compatible with that of the shadowing variable. In C++,
5927 type compatibility here means the type of the shadowing variable can be
5928 converted to that of the shadowed variable. The creation of this flag
5929 (in addition to @option{-Wshadow=local}) is based on the idea that when
5930 a local variable shadows another one of incompatible type, it is most
5931 likely intentional, not a bug or typo, as shown in the following example:
5935 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5937 for (int i = 0; i < N; ++i)
5946 Since the two variable @code{i} in the example above have incompatible types,
5947 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5948 Because their types are incompatible, if a programmer accidentally uses one
5949 in place of the other, type checking will catch that and emit an error or
5950 warning. So not warning (about shadowing) in this case will not lead to
5951 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5952 possibly reduce the number of warnings triggered by intentional shadowing.
5954 This warning is enabled by @option{-Wshadow=local}.
5956 @item -Wlarger-than=@var{len}
5957 @opindex Wlarger-than=@var{len}
5958 @opindex Wlarger-than-@var{len}
5959 Warn whenever an object of larger than @var{len} bytes is defined.
5961 @item -Wframe-larger-than=@var{len}
5962 @opindex Wframe-larger-than=@var{len}
5963 @opindex Wframe-larger-than
5964 Warn if the size of a function frame is larger than @var{len} bytes.
5965 The computation done to determine the stack frame size is approximate
5966 and not conservative.
5967 The actual requirements may be somewhat greater than @var{len}
5968 even if you do not get a warning. In addition, any space allocated
5969 via @code{alloca}, variable-length arrays, or related constructs
5970 is not included by the compiler when determining
5971 whether or not to issue a warning.
5973 @item -Wno-free-nonheap-object
5974 @opindex Wno-free-nonheap-object
5975 @opindex Wfree-nonheap-object
5976 Do not warn when attempting to free an object that was not allocated
5979 @item -Wstack-usage=@var{len}
5980 @opindex Wstack-usage
5981 @opindex Wno-stack-usage
5982 Warn if the stack usage of a function might be larger than @var{len} bytes.
5983 The computation done to determine the stack usage is conservative.
5984 Any space allocated via @code{alloca}, variable-length arrays, or related
5985 constructs is included by the compiler when determining whether or not to
5988 The message is in keeping with the output of @option{-fstack-usage}.
5992 If the stack usage is fully static but exceeds the specified amount, it's:
5995 warning: stack usage is 1120 bytes
5998 If the stack usage is (partly) dynamic but bounded, it's:
6001 warning: stack usage might be 1648 bytes
6004 If the stack usage is (partly) dynamic and not bounded, it's:
6007 warning: stack usage might be unbounded
6011 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6012 @opindex Wno-pedantic-ms-format
6013 @opindex Wpedantic-ms-format
6014 When used in combination with @option{-Wformat}
6015 and @option{-pedantic} without GNU extensions, this option
6016 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6017 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6018 which depend on the MS runtime.
6021 @opindex Waligned-new
6022 @opindex Wno-aligned-new
6023 Warn about a new-expression of a type that requires greater alignment
6024 than the @code{alignof(std::max_align_t)} but uses an allocation
6025 function without an explicit alignment parameter. This option is
6026 enabled by @option{-Wall}.
6028 Normally this only warns about global allocation functions, but
6029 @option{-Waligned-new=all} also warns about class member allocation
6032 @item -Wplacement-new
6033 @itemx -Wplacement-new=@var{n}
6034 @opindex Wplacement-new
6035 @opindex Wno-placement-new
6036 Warn about placement new expressions with undefined behavior, such as
6037 constructing an object in a buffer that is smaller than the type of
6038 the object. For example, the placement new expression below is diagnosed
6039 because it attempts to construct an array of 64 integers in a buffer only
6045 This warning is enabled by default.
6048 @item -Wplacement-new=1
6049 This is the default warning level of @option{-Wplacement-new}. At this
6050 level the warning is not issued for some strictly undefined constructs that
6051 GCC allows as extensions for compatibility with legacy code. For example,
6052 the following @code{new} expression is not diagnosed at this level even
6053 though it has undefined behavior according to the C++ standard because
6054 it writes past the end of the one-element array.
6056 struct S @{ int n, a[1]; @};
6057 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6058 new (s->a)int [32]();
6061 @item -Wplacement-new=2
6062 At this level, in addition to diagnosing all the same constructs as at level
6063 1, a diagnostic is also issued for placement new expressions that construct
6064 an object in the last member of structure whose type is an array of a single
6065 element and whose size is less than the size of the object being constructed.
6066 While the previous example would be diagnosed, the following construct makes
6067 use of the flexible member array extension to avoid the warning at level 2.
6069 struct S @{ int n, a[]; @};
6070 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6071 new (s->a)int [32]();
6076 @item -Wpointer-arith
6077 @opindex Wpointer-arith
6078 @opindex Wno-pointer-arith
6079 Warn about anything that depends on the ``size of'' a function type or
6080 of @code{void}. GNU C assigns these types a size of 1, for
6081 convenience in calculations with @code{void *} pointers and pointers
6082 to functions. In C++, warn also when an arithmetic operation involves
6083 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6085 @item -Wpointer-compare
6086 @opindex Wpointer-compare
6087 @opindex Wno-pointer-compare
6088 Warn if a pointer is compared with a zero character constant. This usually
6089 means that the pointer was meant to be dereferenced. For example:
6092 const char *p = foo ();
6097 Note that the code above is invalid in C++11.
6099 This warning is enabled by default.
6102 @opindex Wtype-limits
6103 @opindex Wno-type-limits
6104 Warn if a comparison is always true or always false due to the limited
6105 range of the data type, but do not warn for constant expressions. For
6106 example, warn if an unsigned variable is compared against zero with
6107 @code{<} or @code{>=}. This warning is also enabled by
6110 @include cppwarnopts.texi
6112 @item -Wbad-function-cast @r{(C and Objective-C only)}
6113 @opindex Wbad-function-cast
6114 @opindex Wno-bad-function-cast
6115 Warn when a function call is cast to a non-matching type.
6116 For example, warn if a call to a function returning an integer type
6117 is cast to a pointer type.
6119 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6120 @opindex Wc90-c99-compat
6121 @opindex Wno-c90-c99-compat
6122 Warn about features not present in ISO C90, but present in ISO C99.
6123 For instance, warn about use of variable length arrays, @code{long long}
6124 type, @code{bool} type, compound literals, designated initializers, and so
6125 on. This option is independent of the standards mode. Warnings are disabled
6126 in the expression that follows @code{__extension__}.
6128 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6129 @opindex Wc99-c11-compat
6130 @opindex Wno-c99-c11-compat
6131 Warn about features not present in ISO C99, but present in ISO C11.
6132 For instance, warn about use of anonymous structures and unions,
6133 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6134 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6135 and so on. This option is independent of the standards mode. Warnings are
6136 disabled in the expression that follows @code{__extension__}.
6138 @item -Wc++-compat @r{(C and Objective-C only)}
6139 @opindex Wc++-compat
6140 @opindex Wno-c++-compat
6141 Warn about ISO C constructs that are outside of the common subset of
6142 ISO C and ISO C++, e.g.@: request for implicit conversion from
6143 @code{void *} to a pointer to non-@code{void} type.
6145 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6146 @opindex Wc++11-compat
6147 @opindex Wno-c++11-compat
6148 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6149 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6150 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6151 enabled by @option{-Wall}.
6153 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6154 @opindex Wc++14-compat
6155 @opindex Wno-c++14-compat
6156 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6157 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6159 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6160 @opindex Wc++17-compat
6161 @opindex Wno-c++17-compat
6162 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6163 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6167 @opindex Wno-cast-qual
6168 Warn whenever a pointer is cast so as to remove a type qualifier from
6169 the target type. For example, warn if a @code{const char *} is cast
6170 to an ordinary @code{char *}.
6172 Also warn when making a cast that introduces a type qualifier in an
6173 unsafe way. For example, casting @code{char **} to @code{const char **}
6174 is unsafe, as in this example:
6177 /* p is char ** value. */
6178 const char **q = (const char **) p;
6179 /* Assignment of readonly string to const char * is OK. */
6181 /* Now char** pointer points to read-only memory. */
6186 @opindex Wcast-align
6187 @opindex Wno-cast-align
6188 Warn whenever a pointer is cast such that the required alignment of the
6189 target is increased. For example, warn if a @code{char *} is cast to
6190 an @code{int *} on machines where integers can only be accessed at
6191 two- or four-byte boundaries.
6193 @item -Wcast-align=strict
6194 @opindex Wcast-align=strict
6195 Warn whenever a pointer is cast such that the required alignment of the
6196 target is increased. For example, warn if a @code{char *} is cast to
6197 an @code{int *} regardless of the target machine.
6199 @item -Wcast-function-type
6200 @opindex Wcast-function-type
6201 @opindex Wno-cast-function-type
6202 Warn when a function pointer is cast to an incompatible function pointer.
6203 In a cast involving function types with a variable argument list only
6204 the types of initial arguments that are provided are considered.
6205 Any parameter of pointer-type matches any other pointer-type. Any benign
6206 differences in integral types are ignored, like @code{int} vs. @code{long}
6207 on ILP32 targets. Likewise type qualifiers are ignored. The function
6208 type @code{void (*) (void)} is special and matches everything, which can
6209 be used to suppress this warning.
6210 In a cast involving pointer to member types this warning warns whenever
6211 the type cast is changing the pointer to member type.
6212 This warning is enabled by @option{-Wextra}.
6214 @item -Wwrite-strings
6215 @opindex Wwrite-strings
6216 @opindex Wno-write-strings
6217 When compiling C, give string constants the type @code{const
6218 char[@var{length}]} so that copying the address of one into a
6219 non-@code{const} @code{char *} pointer produces a warning. These
6220 warnings help you find at compile time code that can try to write
6221 into a string constant, but only if you have been very careful about
6222 using @code{const} in declarations and prototypes. Otherwise, it is
6223 just a nuisance. This is why we did not make @option{-Wall} request
6226 When compiling C++, warn about the deprecated conversion from string
6227 literals to @code{char *}. This warning is enabled by default for C++
6231 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6232 @opindex Wcatch-value
6233 @opindex Wno-catch-value
6234 Warn about catch handlers that do not catch via reference.
6235 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6236 warn about polymorphic class types that are caught by value.
6237 With @option{-Wcatch-value=2} warn about all class types that are caught
6238 by value. With @option{-Wcatch-value=3} warn about all types that are
6239 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6243 @opindex Wno-clobbered
6244 Warn for variables that might be changed by @code{longjmp} or
6245 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6247 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6248 @opindex Wconditionally-supported
6249 @opindex Wno-conditionally-supported
6250 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6253 @opindex Wconversion
6254 @opindex Wno-conversion
6255 Warn for implicit conversions that may alter a value. This includes
6256 conversions between real and integer, like @code{abs (x)} when
6257 @code{x} is @code{double}; conversions between signed and unsigned,
6258 like @code{unsigned ui = -1}; and conversions to smaller types, like
6259 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6260 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6261 changed by the conversion like in @code{abs (2.0)}. Warnings about
6262 conversions between signed and unsigned integers can be disabled by
6263 using @option{-Wno-sign-conversion}.
6265 For C++, also warn for confusing overload resolution for user-defined
6266 conversions; and conversions that never use a type conversion
6267 operator: conversions to @code{void}, the same type, a base class or a
6268 reference to them. Warnings about conversions between signed and
6269 unsigned integers are disabled by default in C++ unless
6270 @option{-Wsign-conversion} is explicitly enabled.
6272 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6273 @opindex Wconversion-null
6274 @opindex Wno-conversion-null
6275 Do not warn for conversions between @code{NULL} and non-pointer
6276 types. @option{-Wconversion-null} is enabled by default.
6278 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6279 @opindex Wzero-as-null-pointer-constant
6280 @opindex Wno-zero-as-null-pointer-constant
6281 Warn when a literal @samp{0} is used as null pointer constant. This can
6282 be useful to facilitate the conversion to @code{nullptr} in C++11.
6284 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6285 @opindex Wsubobject-linkage
6286 @opindex Wno-subobject-linkage
6287 Warn if a class type has a base or a field whose type uses the anonymous
6288 namespace or depends on a type with no linkage. If a type A depends on
6289 a type B with no or internal linkage, defining it in multiple
6290 translation units would be an ODR violation because the meaning of B
6291 is different in each translation unit. If A only appears in a single
6292 translation unit, the best way to silence the warning is to give it
6293 internal linkage by putting it in an anonymous namespace as well. The
6294 compiler doesn't give this warning for types defined in the main .C
6295 file, as those are unlikely to have multiple definitions.
6296 @option{-Wsubobject-linkage} is enabled by default.
6298 @item -Wdangling-else
6299 @opindex Wdangling-else
6300 @opindex Wno-dangling-else
6301 Warn about constructions where there may be confusion to which
6302 @code{if} statement an @code{else} branch belongs. Here is an example of
6317 In C/C++, every @code{else} branch belongs to the innermost possible
6318 @code{if} statement, which in this example is @code{if (b)}. This is
6319 often not what the programmer expected, as illustrated in the above
6320 example by indentation the programmer chose. When there is the
6321 potential for this confusion, GCC issues a warning when this flag
6322 is specified. To eliminate the warning, add explicit braces around
6323 the innermost @code{if} statement so there is no way the @code{else}
6324 can belong to the enclosing @code{if}. The resulting code
6341 This warning is enabled by @option{-Wparentheses}.
6345 @opindex Wno-date-time
6346 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6347 are encountered as they might prevent bit-wise-identical reproducible
6350 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6351 @opindex Wdelete-incomplete
6352 @opindex Wno-delete-incomplete
6353 Warn when deleting a pointer to incomplete type, which may cause
6354 undefined behavior at runtime. This warning is enabled by default.
6356 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6357 @opindex Wuseless-cast
6358 @opindex Wno-useless-cast
6359 Warn when an expression is casted to its own type.
6362 @opindex Wempty-body
6363 @opindex Wno-empty-body
6364 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6365 while} statement. This warning is also enabled by @option{-Wextra}.
6367 @item -Wenum-compare
6368 @opindex Wenum-compare
6369 @opindex Wno-enum-compare
6370 Warn about a comparison between values of different enumerated types.
6371 In C++ enumerated type mismatches in conditional expressions are also
6372 diagnosed and the warning is enabled by default. In C this warning is
6373 enabled by @option{-Wall}.
6375 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6376 @opindex Wextra-semi
6377 @opindex Wno-extra-semi
6378 Warn about redundant semicolon after in-class function definition.
6380 @item -Wjump-misses-init @r{(C, Objective-C only)}
6381 @opindex Wjump-misses-init
6382 @opindex Wno-jump-misses-init
6383 Warn if a @code{goto} statement or a @code{switch} statement jumps
6384 forward across the initialization of a variable, or jumps backward to a
6385 label after the variable has been initialized. This only warns about
6386 variables that are initialized when they are declared. This warning is
6387 only supported for C and Objective-C; in C++ this sort of branch is an
6390 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6391 can be disabled with the @option{-Wno-jump-misses-init} option.
6393 @item -Wsign-compare
6394 @opindex Wsign-compare
6395 @opindex Wno-sign-compare
6396 @cindex warning for comparison of signed and unsigned values
6397 @cindex comparison of signed and unsigned values, warning
6398 @cindex signed and unsigned values, comparison warning
6399 Warn when a comparison between signed and unsigned values could produce
6400 an incorrect result when the signed value is converted to unsigned.
6401 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6402 also enabled by @option{-Wextra}.
6404 @item -Wsign-conversion
6405 @opindex Wsign-conversion
6406 @opindex Wno-sign-conversion
6407 Warn for implicit conversions that may change the sign of an integer
6408 value, like assigning a signed integer expression to an unsigned
6409 integer variable. An explicit cast silences the warning. In C, this
6410 option is enabled also by @option{-Wconversion}.
6412 @item -Wfloat-conversion
6413 @opindex Wfloat-conversion
6414 @opindex Wno-float-conversion
6415 Warn for implicit conversions that reduce the precision of a real value.
6416 This includes conversions from real to integer, and from higher precision
6417 real to lower precision real values. This option is also enabled by
6418 @option{-Wconversion}.
6420 @item -Wno-scalar-storage-order
6421 @opindex -Wno-scalar-storage-order
6422 @opindex -Wscalar-storage-order
6423 Do not warn on suspicious constructs involving reverse scalar storage order.
6425 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6426 @opindex Wsized-deallocation
6427 @opindex Wno-sized-deallocation
6428 Warn about a definition of an unsized deallocation function
6430 void operator delete (void *) noexcept;
6431 void operator delete[] (void *) noexcept;
6433 without a definition of the corresponding sized deallocation function
6435 void operator delete (void *, std::size_t) noexcept;
6436 void operator delete[] (void *, std::size_t) noexcept;
6438 or vice versa. Enabled by @option{-Wextra} along with
6439 @option{-fsized-deallocation}.
6441 @item -Wsizeof-pointer-div
6442 @opindex Wsizeof-pointer-div
6443 @opindex Wno-sizeof-pointer-div
6444 Warn for suspicious divisions of two sizeof expressions that divide
6445 the pointer size by the element size, which is the usual way to compute
6446 the array size but won't work out correctly with pointers. This warning
6447 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6448 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6450 @item -Wsizeof-pointer-memaccess
6451 @opindex Wsizeof-pointer-memaccess
6452 @opindex Wno-sizeof-pointer-memaccess
6453 Warn for suspicious length parameters to certain string and memory built-in
6454 functions if the argument uses @code{sizeof}. This warning triggers for
6455 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6456 an array, but a pointer, and suggests a possible fix, or about
6457 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6458 also warns about calls to bounded string copy functions like @code{strncat}
6459 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6460 the source array. For example, in the following function the call to
6461 @code{strncat} specifies the size of the source string as the bound. That
6462 is almost certainly a mistake and so the call is diagnosed.
6464 void make_file (const char *name)
6466 char path[PATH_MAX];
6467 strncpy (path, name, sizeof path - 1);
6468 strncat (path, ".text", sizeof ".text");
6473 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6475 @item -Wsizeof-array-argument
6476 @opindex Wsizeof-array-argument
6477 @opindex Wno-sizeof-array-argument
6478 Warn when the @code{sizeof} operator is applied to a parameter that is
6479 declared as an array in a function definition. This warning is enabled by
6480 default for C and C++ programs.
6482 @item -Wmemset-elt-size
6483 @opindex Wmemset-elt-size
6484 @opindex Wno-memset-elt-size
6485 Warn for suspicious calls to the @code{memset} built-in function, if the
6486 first argument references an array, and the third argument is a number
6487 equal to the number of elements, but not equal to the size of the array
6488 in memory. This indicates that the user has omitted a multiplication by
6489 the element size. This warning is enabled by @option{-Wall}.
6491 @item -Wmemset-transposed-args
6492 @opindex Wmemset-transposed-args
6493 @opindex Wno-memset-transposed-args
6494 Warn for suspicious calls to the @code{memset} built-in function, if the
6495 second argument is not zero and the third argument is zero. This warns e.g.@
6496 about @code{memset (buf, sizeof buf, 0)} where most probably
6497 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6498 is only emitted if the third argument is literal zero. If it is some
6499 expression that is folded to zero, a cast of zero to some type, etc.,
6500 it is far less likely that the user has mistakenly exchanged the arguments
6501 and no warning is emitted. This warning is enabled by @option{-Wall}.
6505 @opindex Wno-address
6506 Warn about suspicious uses of memory addresses. These include using
6507 the address of a function in a conditional expression, such as
6508 @code{void func(void); if (func)}, and comparisons against the memory
6509 address of a string literal, such as @code{if (x == "abc")}. Such
6510 uses typically indicate a programmer error: the address of a function
6511 always evaluates to true, so their use in a conditional usually
6512 indicate that the programmer forgot the parentheses in a function
6513 call; and comparisons against string literals result in unspecified
6514 behavior and are not portable in C, so they usually indicate that the
6515 programmer intended to use @code{strcmp}. This warning is enabled by
6519 @opindex Wlogical-op
6520 @opindex Wno-logical-op
6521 Warn about suspicious uses of logical operators in expressions.
6522 This includes using logical operators in contexts where a
6523 bit-wise operator is likely to be expected. Also warns when
6524 the operands of a logical operator are the same:
6527 if (a < 0 && a < 0) @{ @dots{} @}
6530 @item -Wlogical-not-parentheses
6531 @opindex Wlogical-not-parentheses
6532 @opindex Wno-logical-not-parentheses
6533 Warn about logical not used on the left hand side operand of a comparison.
6534 This option does not warn if the right operand is considered to be a boolean
6535 expression. Its purpose is to detect suspicious code like the following:
6539 if (!a > 1) @{ @dots{} @}
6542 It is possible to suppress the warning by wrapping the LHS into
6545 if ((!a) > 1) @{ @dots{} @}
6548 This warning is enabled by @option{-Wall}.
6550 @item -Waggregate-return
6551 @opindex Waggregate-return
6552 @opindex Wno-aggregate-return
6553 Warn if any functions that return structures or unions are defined or
6554 called. (In languages where you can return an array, this also elicits
6557 @item -Wno-aggressive-loop-optimizations
6558 @opindex Wno-aggressive-loop-optimizations
6559 @opindex Waggressive-loop-optimizations
6560 Warn if in a loop with constant number of iterations the compiler detects
6561 undefined behavior in some statement during one or more of the iterations.
6563 @item -Wno-attributes
6564 @opindex Wno-attributes
6565 @opindex Wattributes
6566 Do not warn if an unexpected @code{__attribute__} is used, such as
6567 unrecognized attributes, function attributes applied to variables,
6568 etc. This does not stop errors for incorrect use of supported
6571 @item -Wno-builtin-declaration-mismatch
6572 @opindex Wno-builtin-declaration-mismatch
6573 @opindex Wbuiltin-declaration-mismatch
6574 Warn if a built-in function is declared with the wrong signature or
6576 This warning is enabled by default.
6578 @item -Wno-builtin-macro-redefined
6579 @opindex Wno-builtin-macro-redefined
6580 @opindex Wbuiltin-macro-redefined
6581 Do not warn if certain built-in macros are redefined. This suppresses
6582 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6583 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6585 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6586 @opindex Wstrict-prototypes
6587 @opindex Wno-strict-prototypes
6588 Warn if a function is declared or defined without specifying the
6589 argument types. (An old-style function definition is permitted without
6590 a warning if preceded by a declaration that specifies the argument
6593 @item -Wold-style-declaration @r{(C and Objective-C only)}
6594 @opindex Wold-style-declaration
6595 @opindex Wno-old-style-declaration
6596 Warn for obsolescent usages, according to the C Standard, in a
6597 declaration. For example, warn if storage-class specifiers like
6598 @code{static} are not the first things in a declaration. This warning
6599 is also enabled by @option{-Wextra}.
6601 @item -Wold-style-definition @r{(C and Objective-C only)}
6602 @opindex Wold-style-definition
6603 @opindex Wno-old-style-definition
6604 Warn if an old-style function definition is used. A warning is given
6605 even if there is a previous prototype.
6607 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6608 @opindex Wmissing-parameter-type
6609 @opindex Wno-missing-parameter-type
6610 A function parameter is declared without a type specifier in K&R-style
6617 This warning is also enabled by @option{-Wextra}.
6619 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6620 @opindex Wmissing-prototypes
6621 @opindex Wno-missing-prototypes
6622 Warn if a global function is defined without a previous prototype
6623 declaration. This warning is issued even if the definition itself
6624 provides a prototype. Use this option to detect global functions
6625 that do not have a matching prototype declaration in a header file.
6626 This option is not valid for C++ because all function declarations
6627 provide prototypes and a non-matching declaration declares an
6628 overload rather than conflict with an earlier declaration.
6629 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6631 @item -Wmissing-declarations
6632 @opindex Wmissing-declarations
6633 @opindex Wno-missing-declarations
6634 Warn if a global function is defined without a previous declaration.
6635 Do so even if the definition itself provides a prototype.
6636 Use this option to detect global functions that are not declared in
6637 header files. In C, no warnings are issued for functions with previous
6638 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6639 missing prototypes. In C++, no warnings are issued for function templates,
6640 or for inline functions, or for functions in anonymous namespaces.
6642 @item -Wmissing-field-initializers
6643 @opindex Wmissing-field-initializers
6644 @opindex Wno-missing-field-initializers
6648 Warn if a structure's initializer has some fields missing. For
6649 example, the following code causes such a warning, because
6650 @code{x.h} is implicitly zero:
6653 struct s @{ int f, g, h; @};
6654 struct s x = @{ 3, 4 @};
6657 This option does not warn about designated initializers, so the following
6658 modification does not trigger a warning:
6661 struct s @{ int f, g, h; @};
6662 struct s x = @{ .f = 3, .g = 4 @};
6665 In C this option does not warn about the universal zero initializer
6669 struct s @{ int f, g, h; @};
6670 struct s x = @{ 0 @};
6673 Likewise, in C++ this option does not warn about the empty @{ @}
6674 initializer, for example:
6677 struct s @{ int f, g, h; @};
6681 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6682 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6684 @item -Wno-multichar
6685 @opindex Wno-multichar
6687 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6688 Usually they indicate a typo in the user's code, as they have
6689 implementation-defined values, and should not be used in portable code.
6691 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6692 @opindex Wnormalized=
6693 @opindex Wnormalized
6694 @opindex Wno-normalized
6697 @cindex character set, input normalization
6698 In ISO C and ISO C++, two identifiers are different if they are
6699 different sequences of characters. However, sometimes when characters
6700 outside the basic ASCII character set are used, you can have two
6701 different character sequences that look the same. To avoid confusion,
6702 the ISO 10646 standard sets out some @dfn{normalization rules} which
6703 when applied ensure that two sequences that look the same are turned into
6704 the same sequence. GCC can warn you if you are using identifiers that
6705 have not been normalized; this option controls that warning.
6707 There are four levels of warning supported by GCC@. The default is
6708 @option{-Wnormalized=nfc}, which warns about any identifier that is
6709 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6710 recommended form for most uses. It is equivalent to
6711 @option{-Wnormalized}.
6713 Unfortunately, there are some characters allowed in identifiers by
6714 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6715 identifiers. That is, there's no way to use these symbols in portable
6716 ISO C or C++ and have all your identifiers in NFC@.
6717 @option{-Wnormalized=id} suppresses the warning for these characters.
6718 It is hoped that future versions of the standards involved will correct
6719 this, which is why this option is not the default.
6721 You can switch the warning off for all characters by writing
6722 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6723 only do this if you are using some other normalization scheme (like
6724 ``D''), because otherwise you can easily create bugs that are
6725 literally impossible to see.
6727 Some characters in ISO 10646 have distinct meanings but look identical
6728 in some fonts or display methodologies, especially once formatting has
6729 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6730 LETTER N'', displays just like a regular @code{n} that has been
6731 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6732 normalization scheme to convert all these into a standard form as
6733 well, and GCC warns if your code is not in NFKC if you use
6734 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6735 about every identifier that contains the letter O because it might be
6736 confused with the digit 0, and so is not the default, but may be
6737 useful as a local coding convention if the programming environment
6738 cannot be fixed to display these characters distinctly.
6740 @item -Wno-deprecated
6741 @opindex Wno-deprecated
6742 @opindex Wdeprecated
6743 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6745 @item -Wno-deprecated-declarations
6746 @opindex Wno-deprecated-declarations
6747 @opindex Wdeprecated-declarations
6748 Do not warn about uses of functions (@pxref{Function Attributes}),
6749 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6750 Attributes}) marked as deprecated by using the @code{deprecated}
6754 @opindex Wno-overflow
6756 Do not warn about compile-time overflow in constant expressions.
6761 Warn about One Definition Rule violations during link-time optimization.
6762 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6765 @opindex Wopenmp-simd
6766 @opindex Wno-openmp-simd
6767 Warn if the vectorizer cost model overrides the OpenMP
6768 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6769 option can be used to relax the cost model.
6771 @item -Woverride-init @r{(C and Objective-C only)}
6772 @opindex Woverride-init
6773 @opindex Wno-override-init
6777 Warn if an initialized field without side effects is overridden when
6778 using designated initializers (@pxref{Designated Inits, , Designated
6781 This warning is included in @option{-Wextra}. To get other
6782 @option{-Wextra} warnings without this one, use @option{-Wextra
6783 -Wno-override-init}.
6785 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6786 @opindex Woverride-init-side-effects
6787 @opindex Wno-override-init-side-effects
6788 Warn if an initialized field with side effects is overridden when
6789 using designated initializers (@pxref{Designated Inits, , Designated
6790 Initializers}). This warning is enabled by default.
6795 Warn if a structure is given the packed attribute, but the packed
6796 attribute has no effect on the layout or size of the structure.
6797 Such structures may be mis-aligned for little benefit. For
6798 instance, in this code, the variable @code{f.x} in @code{struct bar}
6799 is misaligned even though @code{struct bar} does not itself
6800 have the packed attribute:
6807 @} __attribute__((packed));
6815 @item -Wpacked-bitfield-compat
6816 @opindex Wpacked-bitfield-compat
6817 @opindex Wno-packed-bitfield-compat
6818 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6819 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6820 the change can lead to differences in the structure layout. GCC
6821 informs you when the offset of such a field has changed in GCC 4.4.
6822 For example there is no longer a 4-bit padding between field @code{a}
6823 and @code{b} in this structure:
6830 @} __attribute__ ((packed));
6833 This warning is enabled by default. Use
6834 @option{-Wno-packed-bitfield-compat} to disable this warning.
6836 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6837 @opindex Wpacked-not-aligned
6838 @opindex Wno-packed-not-aligned
6839 Warn if a structure field with explicitly specified alignment in a
6840 packed struct or union is misaligned. For example, a warning will
6841 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6842 'struct S' is less than 8}, in this code:
6846 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6847 struct __attribute__ ((packed)) S @{
6853 This warning is enabled by @option{-Wall}.
6858 Warn if padding is included in a structure, either to align an element
6859 of the structure or to align the whole structure. Sometimes when this
6860 happens it is possible to rearrange the fields of the structure to
6861 reduce the padding and so make the structure smaller.
6863 @item -Wredundant-decls
6864 @opindex Wredundant-decls
6865 @opindex Wno-redundant-decls
6866 Warn if anything is declared more than once in the same scope, even in
6867 cases where multiple declaration is valid and changes nothing.
6871 @opindex Wno-restrict
6872 Warn when an object referenced by a @code{restrict}-qualified parameter
6873 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
6874 argument, or when copies between such objects overlap. For example,
6875 the call to the @code{strcpy} function below attempts to truncate the string
6876 by replacing its initial characters with the last four. However, because
6877 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
6878 the call is diagnosed.
6883 char a[] = "abcd1234";
6888 The @option{-Wrestrict} option detects some instances of simple overlap
6889 even without optimization but works best at @option{-O2} and above. It
6890 is included in @option{-Wall}.
6892 @item -Wnested-externs @r{(C and Objective-C only)}
6893 @opindex Wnested-externs
6894 @opindex Wno-nested-externs
6895 Warn if an @code{extern} declaration is encountered within a function.
6897 @item -Wno-inherited-variadic-ctor
6898 @opindex Winherited-variadic-ctor
6899 @opindex Wno-inherited-variadic-ctor
6900 Suppress warnings about use of C++11 inheriting constructors when the
6901 base class inherited from has a C variadic constructor; the warning is
6902 on by default because the ellipsis is not inherited.
6907 Warn if a function that is declared as inline cannot be inlined.
6908 Even with this option, the compiler does not warn about failures to
6909 inline functions declared in system headers.
6911 The compiler uses a variety of heuristics to determine whether or not
6912 to inline a function. For example, the compiler takes into account
6913 the size of the function being inlined and the amount of inlining
6914 that has already been done in the current function. Therefore,
6915 seemingly insignificant changes in the source program can cause the
6916 warnings produced by @option{-Winline} to appear or disappear.
6918 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6919 @opindex Wno-invalid-offsetof
6920 @opindex Winvalid-offsetof
6921 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6922 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6923 to a non-standard-layout type is undefined. In existing C++ implementations,
6924 however, @code{offsetof} typically gives meaningful results.
6925 This flag is for users who are aware that they are
6926 writing nonportable code and who have deliberately chosen to ignore the
6929 The restrictions on @code{offsetof} may be relaxed in a future version
6930 of the C++ standard.
6932 @item -Wint-in-bool-context
6933 @opindex Wint-in-bool-context
6934 @opindex Wno-int-in-bool-context
6935 Warn for suspicious use of integer values where boolean values are expected,
6936 such as conditional expressions (?:) using non-boolean integer constants in
6937 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6938 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6939 for all kinds of multiplications regardless of the data type.
6940 This warning is enabled by @option{-Wall}.
6942 @item -Wno-int-to-pointer-cast
6943 @opindex Wno-int-to-pointer-cast
6944 @opindex Wint-to-pointer-cast
6945 Suppress warnings from casts to pointer type of an integer of a
6946 different size. In C++, casting to a pointer type of smaller size is
6947 an error. @option{Wint-to-pointer-cast} is enabled by default.
6950 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6951 @opindex Wno-pointer-to-int-cast
6952 @opindex Wpointer-to-int-cast
6953 Suppress warnings from casts from a pointer to an integer type of a
6957 @opindex Winvalid-pch
6958 @opindex Wno-invalid-pch
6959 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6960 the search path but cannot be used.
6964 @opindex Wno-long-long
6965 Warn if @code{long long} type is used. This is enabled by either
6966 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6967 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6969 @item -Wvariadic-macros
6970 @opindex Wvariadic-macros
6971 @opindex Wno-variadic-macros
6972 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6973 alternate syntax is used in ISO C99 mode. This is enabled by either
6974 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6975 messages, use @option{-Wno-variadic-macros}.
6979 @opindex Wno-varargs
6980 Warn upon questionable usage of the macros used to handle variable
6981 arguments like @code{va_start}. This is default. To inhibit the
6982 warning messages, use @option{-Wno-varargs}.
6984 @item -Wvector-operation-performance
6985 @opindex Wvector-operation-performance
6986 @opindex Wno-vector-operation-performance
6987 Warn if vector operation is not implemented via SIMD capabilities of the
6988 architecture. Mainly useful for the performance tuning.
6989 Vector operation can be implemented @code{piecewise}, which means that the
6990 scalar operation is performed on every vector element;
6991 @code{in parallel}, which means that the vector operation is implemented
6992 using scalars of wider type, which normally is more performance efficient;
6993 and @code{as a single scalar}, which means that vector fits into a
6996 @item -Wno-virtual-move-assign
6997 @opindex Wvirtual-move-assign
6998 @opindex Wno-virtual-move-assign
6999 Suppress warnings about inheriting from a virtual base with a
7000 non-trivial C++11 move assignment operator. This is dangerous because
7001 if the virtual base is reachable along more than one path, it is
7002 moved multiple times, which can mean both objects end up in the
7003 moved-from state. If the move assignment operator is written to avoid
7004 moving from a moved-from object, this warning can be disabled.
7009 Warn if a variable-length array is used in the code.
7010 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7011 the variable-length array.
7013 @item -Wvla-larger-than=@var{n}
7014 If this option is used, the compiler will warn on uses of
7015 variable-length arrays where the size is either unbounded, or bounded
7016 by an argument that can be larger than @var{n} bytes. This is similar
7017 to how @option{-Walloca-larger-than=@var{n}} works, but with
7018 variable-length arrays.
7020 Note that GCC may optimize small variable-length arrays of a known
7021 value into plain arrays, so this warning may not get triggered for
7024 This warning is not enabled by @option{-Wall}, and is only active when
7025 @option{-ftree-vrp} is active (default for @option{-O2} and above).
7027 See also @option{-Walloca-larger-than=@var{n}}.
7029 @item -Wvolatile-register-var
7030 @opindex Wvolatile-register-var
7031 @opindex Wno-volatile-register-var
7032 Warn if a register variable is declared volatile. The volatile
7033 modifier does not inhibit all optimizations that may eliminate reads
7034 and/or writes to register variables. This warning is enabled by
7037 @item -Wdisabled-optimization
7038 @opindex Wdisabled-optimization
7039 @opindex Wno-disabled-optimization
7040 Warn if a requested optimization pass is disabled. This warning does
7041 not generally indicate that there is anything wrong with your code; it
7042 merely indicates that GCC's optimizers are unable to handle the code
7043 effectively. Often, the problem is that your code is too big or too
7044 complex; GCC refuses to optimize programs when the optimization
7045 itself is likely to take inordinate amounts of time.
7047 @item -Wpointer-sign @r{(C and Objective-C only)}
7048 @opindex Wpointer-sign
7049 @opindex Wno-pointer-sign
7050 Warn for pointer argument passing or assignment with different signedness.
7051 This option is only supported for C and Objective-C@. It is implied by
7052 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7053 @option{-Wno-pointer-sign}.
7055 @item -Wstack-protector
7056 @opindex Wstack-protector
7057 @opindex Wno-stack-protector
7058 This option is only active when @option{-fstack-protector} is active. It
7059 warns about functions that are not protected against stack smashing.
7061 @item -Woverlength-strings
7062 @opindex Woverlength-strings
7063 @opindex Wno-overlength-strings
7064 Warn about string constants that are longer than the ``minimum
7065 maximum'' length specified in the C standard. Modern compilers
7066 generally allow string constants that are much longer than the
7067 standard's minimum limit, but very portable programs should avoid
7068 using longer strings.
7070 The limit applies @emph{after} string constant concatenation, and does
7071 not count the trailing NUL@. In C90, the limit was 509 characters; in
7072 C99, it was raised to 4095. C++98 does not specify a normative
7073 minimum maximum, so we do not diagnose overlength strings in C++@.
7075 This option is implied by @option{-Wpedantic}, and can be disabled with
7076 @option{-Wno-overlength-strings}.
7078 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7079 @opindex Wunsuffixed-float-constants
7080 @opindex Wno-unsuffixed-float-constants
7082 Issue a warning for any floating constant that does not have
7083 a suffix. When used together with @option{-Wsystem-headers} it
7084 warns about such constants in system header files. This can be useful
7085 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7086 from the decimal floating-point extension to C99.
7088 @item -Wno-designated-init @r{(C and Objective-C only)}
7089 Suppress warnings when a positional initializer is used to initialize
7090 a structure that has been marked with the @code{designated_init}
7094 Issue a warning when HSAIL cannot be emitted for the compiled function or
7099 @node Debugging Options
7100 @section Options for Debugging Your Program
7101 @cindex options, debugging
7102 @cindex debugging information options
7104 To tell GCC to emit extra information for use by a debugger, in almost
7105 all cases you need only to add @option{-g} to your other options.
7107 GCC allows you to use @option{-g} with
7108 @option{-O}. The shortcuts taken by optimized code may occasionally
7109 be surprising: some variables you declared may not exist
7110 at all; flow of control may briefly move where you did not expect it;
7111 some statements may not be executed because they compute constant
7112 results or their values are already at hand; some statements may
7113 execute in different places because they have been moved out of loops.
7114 Nevertheless it is possible to debug optimized output. This makes
7115 it reasonable to use the optimizer for programs that might have bugs.
7117 If you are not using some other optimization option, consider
7118 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7119 With no @option{-O} option at all, some compiler passes that collect
7120 information useful for debugging do not run at all, so that
7121 @option{-Og} may result in a better debugging experience.
7126 Produce debugging information in the operating system's native format
7127 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7130 On most systems that use stabs format, @option{-g} enables use of extra
7131 debugging information that only GDB can use; this extra information
7132 makes debugging work better in GDB but probably makes other debuggers
7134 refuse to read the program. If you want to control for certain whether
7135 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7136 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7140 Produce debugging information for use by GDB@. This means to use the
7141 most expressive format available (DWARF, stabs, or the native format
7142 if neither of those are supported), including GDB extensions if at all
7146 @itemx -gdwarf-@var{version}
7148 Produce debugging information in DWARF format (if that is supported).
7149 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7150 for most targets is 4. DWARF Version 5 is only experimental.
7152 Note that with DWARF Version 2, some ports require and always
7153 use some non-conflicting DWARF 3 extensions in the unwind tables.
7155 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7156 for maximum benefit.
7158 GCC no longer supports DWARF Version 1, which is substantially
7159 different than Version 2 and later. For historical reasons, some
7160 other DWARF-related options such as
7161 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7162 in their names, but apply to all currently-supported versions of DWARF.
7166 Produce debugging information in stabs format (if that is supported),
7167 without GDB extensions. This is the format used by DBX on most BSD
7168 systems. On MIPS, Alpha and System V Release 4 systems this option
7169 produces stabs debugging output that is not understood by DBX@.
7170 On System V Release 4 systems this option requires the GNU assembler.
7174 Produce debugging information in stabs format (if that is supported),
7175 using GNU extensions understood only by the GNU debugger (GDB)@. The
7176 use of these extensions is likely to make other debuggers crash or
7177 refuse to read the program.
7181 Produce debugging information in XCOFF format (if that is supported).
7182 This is the format used by the DBX debugger on IBM RS/6000 systems.
7186 Produce debugging information in XCOFF format (if that is supported),
7187 using GNU extensions understood only by the GNU debugger (GDB)@. The
7188 use of these extensions is likely to make other debuggers crash or
7189 refuse to read the program, and may cause assemblers other than the GNU
7190 assembler (GAS) to fail with an error.
7194 Produce debugging information in Alpha/VMS debug format (if that is
7195 supported). This is the format used by DEBUG on Alpha/VMS systems.
7198 @itemx -ggdb@var{level}
7199 @itemx -gstabs@var{level}
7200 @itemx -gxcoff@var{level}
7201 @itemx -gvms@var{level}
7202 Request debugging information and also use @var{level} to specify how
7203 much information. The default level is 2.
7205 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7208 Level 1 produces minimal information, enough for making backtraces in
7209 parts of the program that you don't plan to debug. This includes
7210 descriptions of functions and external variables, and line number
7211 tables, but no information about local variables.
7213 Level 3 includes extra information, such as all the macro definitions
7214 present in the program. Some debuggers support macro expansion when
7215 you use @option{-g3}.
7217 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7218 confusion with @option{-gdwarf-@var{level}}.
7219 Instead use an additional @option{-g@var{level}} option to change the
7220 debug level for DWARF.
7222 @item -feliminate-unused-debug-symbols
7223 @opindex feliminate-unused-debug-symbols
7224 Produce debugging information in stabs format (if that is supported),
7225 for only symbols that are actually used.
7227 @item -femit-class-debug-always
7228 @opindex femit-class-debug-always
7229 Instead of emitting debugging information for a C++ class in only one
7230 object file, emit it in all object files using the class. This option
7231 should be used only with debuggers that are unable to handle the way GCC
7232 normally emits debugging information for classes because using this
7233 option increases the size of debugging information by as much as a
7236 @item -fno-merge-debug-strings
7237 @opindex fmerge-debug-strings
7238 @opindex fno-merge-debug-strings
7239 Direct the linker to not merge together strings in the debugging
7240 information that are identical in different object files. Merging is
7241 not supported by all assemblers or linkers. Merging decreases the size
7242 of the debug information in the output file at the cost of increasing
7243 link processing time. Merging is enabled by default.
7245 @item -fdebug-prefix-map=@var{old}=@var{new}
7246 @opindex fdebug-prefix-map
7247 When compiling files residing in directory @file{@var{old}}, record
7248 debugging information describing them as if the files resided in
7249 directory @file{@var{new}} instead. This can be used to replace a
7250 build-time path with an install-time path in the debug info. It can
7251 also be used to change an absolute path to a relative path by using
7252 @file{.} for @var{new}. This can give more reproducible builds, which
7253 are location independent, but may require an extra command to tell GDB
7254 where to find the source files. See also @option{-ffile-prefix-map}.
7256 @item -fvar-tracking
7257 @opindex fvar-tracking
7258 Run variable tracking pass. It computes where variables are stored at each
7259 position in code. Better debugging information is then generated
7260 (if the debugging information format supports this information).
7262 It is enabled by default when compiling with optimization (@option{-Os},
7263 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7264 the debug info format supports it.
7266 @item -fvar-tracking-assignments
7267 @opindex fvar-tracking-assignments
7268 @opindex fno-var-tracking-assignments
7269 Annotate assignments to user variables early in the compilation and
7270 attempt to carry the annotations over throughout the compilation all the
7271 way to the end, in an attempt to improve debug information while
7272 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7274 It can be enabled even if var-tracking is disabled, in which case
7275 annotations are created and maintained, but discarded at the end.
7276 By default, this flag is enabled together with @option{-fvar-tracking},
7277 except when selective scheduling is enabled.
7280 @opindex gsplit-dwarf
7281 Separate as much DWARF debugging information as possible into a
7282 separate output file with the extension @file{.dwo}. This option allows
7283 the build system to avoid linking files with debug information. To
7284 be useful, this option requires a debugger capable of reading @file{.dwo}
7289 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7291 @item -ggnu-pubnames
7292 @opindex ggnu-pubnames
7293 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7294 suitable for conversion into a GDB@ index. This option is only useful
7295 with a linker that can produce GDB@ index version 7.
7297 @item -fdebug-types-section
7298 @opindex fdebug-types-section
7299 @opindex fno-debug-types-section
7300 When using DWARF Version 4 or higher, type DIEs can be put into
7301 their own @code{.debug_types} section instead of making them part of the
7302 @code{.debug_info} section. It is more efficient to put them in a separate
7303 comdat section since the linker can then remove duplicates.
7304 But not all DWARF consumers support @code{.debug_types} sections yet
7305 and on some objects @code{.debug_types} produces larger instead of smaller
7306 debugging information.
7308 @item -grecord-gcc-switches
7309 @itemx -gno-record-gcc-switches
7310 @opindex grecord-gcc-switches
7311 @opindex gno-record-gcc-switches
7312 This switch causes the command-line options used to invoke the
7313 compiler that may affect code generation to be appended to the
7314 DW_AT_producer attribute in DWARF debugging information. The options
7315 are concatenated with spaces separating them from each other and from
7316 the compiler version.
7317 It is enabled by default.
7318 See also @option{-frecord-gcc-switches} for another
7319 way of storing compiler options into the object file.
7321 @item -gstrict-dwarf
7322 @opindex gstrict-dwarf
7323 Disallow using extensions of later DWARF standard version than selected
7324 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7325 DWARF extensions from later standard versions is allowed.
7327 @item -gno-strict-dwarf
7328 @opindex gno-strict-dwarf
7329 Allow using extensions of later DWARF standard version than selected with
7330 @option{-gdwarf-@var{version}}.
7332 @item -gas-loc-support
7333 @opindex gas-loc-support
7334 Inform the compiler that the assembler supports @code{.loc} directives.
7335 It may then use them for the assembler to generate DWARF2+ line number
7338 This is generally desirable, because assembler-generated line-number
7339 tables are a lot more compact than those the compiler can generate
7342 This option will be enabled by default if, at GCC configure time, the
7343 assembler was found to support such directives.
7345 @item -gno-as-loc-support
7346 @opindex gno-as-loc-support
7347 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7348 line number tables are to be generated.
7350 @item gas-locview-support
7351 @opindex gas-locview-support
7352 Inform the compiler that the assembler supports @code{view} assignment
7353 and reset assertion checking in @code{.loc} directives.
7355 This option will be enabled by default if, at GCC configure time, the
7356 assembler was found to support them.
7358 @item gno-as-locview-support
7359 Force GCC to assign view numbers internally, if
7360 @option{-gvariable-location-views} are explicitly requested.
7363 @itemx -gno-column-info
7364 @opindex gcolumn-info
7365 @opindex gno-column-info
7366 Emit location column information into DWARF debugging information, rather
7367 than just file and line.
7368 This option is enabled by default.
7370 @item -gstatement-frontiers
7371 @itemx -gno-statement-frontiers
7372 @opindex gstatement-frontiers
7373 @opindex gno-statement-frontiers
7374 This option causes GCC to create markers in the internal representation
7375 at the beginning of statements, and to keep them roughly in place
7376 throughout compilation, using them to guide the output of @code{is_stmt}
7377 markers in the line number table. This is enabled by default when
7378 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7379 @dots{}), and outputting DWARF 2 debug information at the normal level.
7381 @item -gvariable-location-views
7382 @itemx -gvariable-location-views=incompat5
7383 @itemx -gno-variable-location-views
7384 @opindex gvariable-location-views
7385 @opindex gvariable-location-views=incompat5
7386 @opindex gno-variable-location-views
7387 Augment variable location lists with progressive view numbers implied
7388 from the line number table. This enables debug information consumers to
7389 inspect state at certain points of the program, even if no instructions
7390 associated with the corresponding source locations are present at that
7391 point. If the assembler lacks support for view numbers in line number
7392 tables, this will cause the compiler to emit the line number table,
7393 which generally makes them somewhat less compact. The augmented line
7394 number tables and location lists are fully backward-compatible, so they
7395 can be consumed by debug information consumers that are not aware of
7396 these augmentations, but they won't derive any benefit from them either.
7398 This is enabled by default when outputting DWARF 2 debug information at
7399 the normal level, as long as there is assembler support,
7400 @option{-fvar-tracking-assignments} is enabled and
7401 @option{-gstrict-dwarf} is not. When assembler support is not
7402 available, this may still be enabled, but it will force GCC to output
7403 internal line number tables, and if
7404 @option{-ginternal-reset-location-views} is not enabled, that will most
7405 certainly lead to silently mismatching location views.
7407 There is a proposed representation for view numbers that is not backward
7408 compatible with the location list format introduced in DWARF 5, that can
7409 be enabled with @option{-gvariable-location-views=incompat5}. This
7410 option may be removed in the future, is only provided as a reference
7411 implementation of the proposed representation. Debug information
7412 consumers are not expected to support this extended format, and they
7413 would be rendered unable to decode location lists using it.
7415 @item -ginternal-reset-location-views
7416 @itemx -gnointernal-reset-location-views
7417 @opindex ginternal-reset-location-views
7418 @opindex gno-internal-reset-location-views
7419 Attempt to determine location views that can be omitted from location
7420 view lists. This requires the compiler to have very accurate insn
7421 length estimates, which isn't always the case, and it may cause
7422 incorrect view lists to be generated silently when using an assembler
7423 that does not support location view lists. The GNU assembler will flag
7424 any such error as a @code{view number mismatch}. This is only enabled
7425 on ports that define a reliable estimation function.
7427 @item -ginline-points
7428 @itemx -gno-inline-points
7429 @opindex ginline-points
7430 @opindex gno-inline-points
7431 Generate extended debug information for inlined functions. Location
7432 view tracking markers are inserted at inlined entry points, so that
7433 address and view numbers can be computed and output in debug
7434 information. This can be enabled independently of location views, in
7435 which case the view numbers won't be output, but it can only be enabled
7436 along with statement frontiers, and it is only enabled by default if
7437 location views are enabled.
7439 @item -gz@r{[}=@var{type}@r{]}
7441 Produce compressed debug sections in DWARF format, if that is supported.
7442 If @var{type} is not given, the default type depends on the capabilities
7443 of the assembler and linker used. @var{type} may be one of
7444 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7445 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7446 compression in traditional GNU format). If the linker doesn't support
7447 writing compressed debug sections, the option is rejected. Otherwise,
7448 if the assembler does not support them, @option{-gz} is silently ignored
7449 when producing object files.
7451 @item -femit-struct-debug-baseonly
7452 @opindex femit-struct-debug-baseonly
7453 Emit debug information for struct-like types
7454 only when the base name of the compilation source file
7455 matches the base name of file in which the struct is defined.
7457 This option substantially reduces the size of debugging information,
7458 but at significant potential loss in type information to the debugger.
7459 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7460 See @option{-femit-struct-debug-detailed} for more detailed control.
7462 This option works only with DWARF debug output.
7464 @item -femit-struct-debug-reduced
7465 @opindex femit-struct-debug-reduced
7466 Emit debug information for struct-like types
7467 only when the base name of the compilation source file
7468 matches the base name of file in which the type is defined,
7469 unless the struct is a template or defined in a system header.
7471 This option significantly reduces the size of debugging information,
7472 with some potential loss in type information to the debugger.
7473 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7474 See @option{-femit-struct-debug-detailed} for more detailed control.
7476 This option works only with DWARF debug output.
7478 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7479 @opindex femit-struct-debug-detailed
7480 Specify the struct-like types
7481 for which the compiler generates debug information.
7482 The intent is to reduce duplicate struct debug information
7483 between different object files within the same program.
7485 This option is a detailed version of
7486 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7487 which serves for most needs.
7489 A specification has the syntax@*
7490 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7492 The optional first word limits the specification to
7493 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7494 A struct type is used directly when it is the type of a variable, member.
7495 Indirect uses arise through pointers to structs.
7496 That is, when use of an incomplete struct is valid, the use is indirect.
7498 @samp{struct one direct; struct two * indirect;}.
7500 The optional second word limits the specification to
7501 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7502 Generic structs are a bit complicated to explain.
7503 For C++, these are non-explicit specializations of template classes,
7504 or non-template classes within the above.
7505 Other programming languages have generics,
7506 but @option{-femit-struct-debug-detailed} does not yet implement them.
7508 The third word specifies the source files for those
7509 structs for which the compiler should emit debug information.
7510 The values @samp{none} and @samp{any} have the normal meaning.
7511 The value @samp{base} means that
7512 the base of name of the file in which the type declaration appears
7513 must match the base of the name of the main compilation file.
7514 In practice, this means that when compiling @file{foo.c}, debug information
7515 is generated for types declared in that file and @file{foo.h},
7516 but not other header files.
7517 The value @samp{sys} means those types satisfying @samp{base}
7518 or declared in system or compiler headers.
7520 You may need to experiment to determine the best settings for your application.
7522 The default is @option{-femit-struct-debug-detailed=all}.
7524 This option works only with DWARF debug output.
7526 @item -fno-dwarf2-cfi-asm
7527 @opindex fdwarf2-cfi-asm
7528 @opindex fno-dwarf2-cfi-asm
7529 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7530 instead of using GAS @code{.cfi_*} directives.
7532 @item -fno-eliminate-unused-debug-types
7533 @opindex feliminate-unused-debug-types
7534 @opindex fno-eliminate-unused-debug-types
7535 Normally, when producing DWARF output, GCC avoids producing debug symbol
7536 output for types that are nowhere used in the source file being compiled.
7537 Sometimes it is useful to have GCC emit debugging
7538 information for all types declared in a compilation
7539 unit, regardless of whether or not they are actually used
7540 in that compilation unit, for example
7541 if, in the debugger, you want to cast a value to a type that is
7542 not actually used in your program (but is declared). More often,
7543 however, this results in a significant amount of wasted space.
7546 @node Optimize Options
7547 @section Options That Control Optimization
7548 @cindex optimize options
7549 @cindex options, optimization
7551 These options control various sorts of optimizations.
7553 Without any optimization option, the compiler's goal is to reduce the
7554 cost of compilation and to make debugging produce the expected
7555 results. Statements are independent: if you stop the program with a
7556 breakpoint between statements, you can then assign a new value to any
7557 variable or change the program counter to any other statement in the
7558 function and get exactly the results you expect from the source
7561 Turning on optimization flags makes the compiler attempt to improve
7562 the performance and/or code size at the expense of compilation time
7563 and possibly the ability to debug the program.
7565 The compiler performs optimization based on the knowledge it has of the
7566 program. Compiling multiple files at once to a single output file mode allows
7567 the compiler to use information gained from all of the files when compiling
7570 Not all optimizations are controlled directly by a flag. Only
7571 optimizations that have a flag are listed in this section.
7573 Most optimizations are only enabled if an @option{-O} level is set on
7574 the command line. Otherwise they are disabled, even if individual
7575 optimization flags are specified.
7577 Depending on the target and how GCC was configured, a slightly different
7578 set of optimizations may be enabled at each @option{-O} level than
7579 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7580 to find out the exact set of optimizations that are enabled at each level.
7581 @xref{Overall Options}, for examples.
7588 Optimize. Optimizing compilation takes somewhat more time, and a lot
7589 more memory for a large function.
7591 With @option{-O}, the compiler tries to reduce code size and execution
7592 time, without performing any optimizations that take a great deal of
7595 @option{-O} turns on the following optimization flags:
7598 -fbranch-count-reg @gol
7599 -fcombine-stack-adjustments @gol
7601 -fcprop-registers @gol
7604 -fdelayed-branch @gol
7606 -fforward-propagate @gol
7607 -fguess-branch-probability @gol
7608 -fif-conversion2 @gol
7609 -fif-conversion @gol
7610 -finline-functions-called-once @gol
7611 -fipa-pure-const @gol
7613 -fipa-reference @gol
7614 -fmerge-constants @gol
7615 -fmove-loop-invariants @gol
7616 -fomit-frame-pointer @gol
7617 -freorder-blocks @gol
7619 -fshrink-wrap-separate @gol
7620 -fsplit-wide-types @gol
7626 -ftree-coalesce-vars @gol
7627 -ftree-copy-prop @gol
7629 -ftree-dominator-opts @gol
7631 -ftree-forwprop @gol
7643 Optimize even more. GCC performs nearly all supported optimizations
7644 that do not involve a space-speed tradeoff.
7645 As compared to @option{-O}, this option increases both compilation time
7646 and the performance of the generated code.
7648 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7649 also turns on the following optimization flags:
7650 @gccoptlist{-fthread-jumps @gol
7651 -falign-functions -falign-jumps @gol
7652 -falign-loops -falign-labels @gol
7655 -fcse-follow-jumps -fcse-skip-blocks @gol
7656 -fdelete-null-pointer-checks @gol
7657 -fdevirtualize -fdevirtualize-speculatively @gol
7658 -fexpensive-optimizations @gol
7659 -fgcse -fgcse-lm @gol
7660 -fhoist-adjacent-loads @gol
7661 -finline-small-functions @gol
7662 -findirect-inlining @gol
7668 -fisolate-erroneous-paths-dereference @gol
7670 -foptimize-sibling-calls @gol
7671 -foptimize-strlen @gol
7672 -fpartial-inlining @gol
7674 -freorder-blocks-algorithm=stc @gol
7675 -freorder-blocks-and-partition -freorder-functions @gol
7676 -frerun-cse-after-loop @gol
7677 -fsched-interblock -fsched-spec @gol
7678 -fschedule-insns -fschedule-insns2 @gol
7679 -fstore-merging @gol
7680 -fstrict-aliasing @gol
7681 -ftree-builtin-call-dce @gol
7682 -ftree-switch-conversion -ftree-tail-merge @gol
7683 -fcode-hoisting @gol
7688 Please note the warning under @option{-fgcse} about
7689 invoking @option{-O2} on programs that use computed gotos.
7693 Optimize yet more. @option{-O3} turns on all optimizations specified
7694 by @option{-O2} and also turns on the following optimization flags:
7695 @gccoptlist{-finline-functions @gol
7696 -funswitch-loops @gol
7697 -fpredictive-commoning @gol
7698 -fgcse-after-reload @gol
7699 -ftree-loop-vectorize @gol
7700 -ftree-loop-distribution @gol
7701 -ftree-loop-distribute-patterns @gol
7702 -floop-interchange @gol
7703 -floop-unroll-and-jam @gol
7705 -ftree-slp-vectorize @gol
7706 -fvect-cost-model @gol
7707 -ftree-partial-pre @gol
7713 Reduce compilation time and make debugging produce the expected
7714 results. This is the default.
7718 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7719 do not typically increase code size. It also performs further
7720 optimizations designed to reduce code size.
7722 @option{-Os} disables the following optimization flags:
7723 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7724 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7725 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7729 Disregard strict standards compliance. @option{-Ofast} enables all
7730 @option{-O3} optimizations. It also enables optimizations that are not
7731 valid for all standard-compliant programs.
7732 It turns on @option{-ffast-math} and the Fortran-specific
7733 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7734 specified, and @option{-fno-protect-parens}.
7738 Optimize debugging experience. @option{-Og} enables optimizations
7739 that do not interfere with debugging. It should be the optimization
7740 level of choice for the standard edit-compile-debug cycle, offering
7741 a reasonable level of optimization while maintaining fast compilation
7742 and a good debugging experience.
7745 If you use multiple @option{-O} options, with or without level numbers,
7746 the last such option is the one that is effective.
7748 Options of the form @option{-f@var{flag}} specify machine-independent
7749 flags. Most flags have both positive and negative forms; the negative
7750 form of @option{-ffoo} is @option{-fno-foo}. In the table
7751 below, only one of the forms is listed---the one you typically
7752 use. You can figure out the other form by either removing @samp{no-}
7755 The following options control specific optimizations. They are either
7756 activated by @option{-O} options or are related to ones that are. You
7757 can use the following flags in the rare cases when ``fine-tuning'' of
7758 optimizations to be performed is desired.
7761 @item -fno-defer-pop
7762 @opindex fno-defer-pop
7763 Always pop the arguments to each function call as soon as that function
7764 returns. For machines that must pop arguments after a function call,
7765 the compiler normally lets arguments accumulate on the stack for several
7766 function calls and pops them all at once.
7768 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7770 @item -fforward-propagate
7771 @opindex fforward-propagate
7772 Perform a forward propagation pass on RTL@. The pass tries to combine two
7773 instructions and checks if the result can be simplified. If loop unrolling
7774 is active, two passes are performed and the second is scheduled after
7777 This option is enabled by default at optimization levels @option{-O},
7778 @option{-O2}, @option{-O3}, @option{-Os}.
7780 @item -ffp-contract=@var{style}
7781 @opindex ffp-contract
7782 @option{-ffp-contract=off} disables floating-point expression contraction.
7783 @option{-ffp-contract=fast} enables floating-point expression contraction
7784 such as forming of fused multiply-add operations if the target has
7785 native support for them.
7786 @option{-ffp-contract=on} enables floating-point expression contraction
7787 if allowed by the language standard. This is currently not implemented
7788 and treated equal to @option{-ffp-contract=off}.
7790 The default is @option{-ffp-contract=fast}.
7792 @item -fomit-frame-pointer
7793 @opindex fomit-frame-pointer
7794 Omit the frame pointer in functions that don't need one. This avoids the
7795 instructions to save, set up and restore the frame pointer; on many targets
7796 it also makes an extra register available.
7798 On some targets this flag has no effect because the standard calling sequence
7799 always uses a frame pointer, so it cannot be omitted.
7801 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
7802 is used in all functions. Several targets always omit the frame pointer in
7805 Enabled by default at @option{-O} and higher.
7807 @item -foptimize-sibling-calls
7808 @opindex foptimize-sibling-calls
7809 Optimize sibling and tail recursive calls.
7811 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7813 @item -foptimize-strlen
7814 @opindex foptimize-strlen
7815 Optimize various standard C string functions (e.g. @code{strlen},
7816 @code{strchr} or @code{strcpy}) and
7817 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7819 Enabled at levels @option{-O2}, @option{-O3}.
7823 Do not expand any functions inline apart from those marked with
7824 the @code{always_inline} attribute. This is the default when not
7827 Single functions can be exempted from inlining by marking them
7828 with the @code{noinline} attribute.
7830 @item -finline-small-functions
7831 @opindex finline-small-functions
7832 Integrate functions into their callers when their body is smaller than expected
7833 function call code (so overall size of program gets smaller). The compiler
7834 heuristically decides which functions are simple enough to be worth integrating
7835 in this way. This inlining applies to all functions, even those not declared
7838 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7840 @item -findirect-inlining
7841 @opindex findirect-inlining
7842 Inline also indirect calls that are discovered to be known at compile
7843 time thanks to previous inlining. This option has any effect only
7844 when inlining itself is turned on by the @option{-finline-functions}
7845 or @option{-finline-small-functions} options.
7847 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7849 @item -finline-functions
7850 @opindex finline-functions
7851 Consider all functions for inlining, even if they are not declared inline.
7852 The compiler heuristically decides which functions are worth integrating
7855 If all calls to a given function are integrated, and the function is
7856 declared @code{static}, then the function is normally not output as
7857 assembler code in its own right.
7859 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7861 @item -finline-functions-called-once
7862 @opindex finline-functions-called-once
7863 Consider all @code{static} functions called once for inlining into their
7864 caller even if they are not marked @code{inline}. If a call to a given
7865 function is integrated, then the function is not output as assembler code
7868 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7870 @item -fearly-inlining
7871 @opindex fearly-inlining
7872 Inline functions marked by @code{always_inline} and functions whose body seems
7873 smaller than the function call overhead early before doing
7874 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7875 makes profiling significantly cheaper and usually inlining faster on programs
7876 having large chains of nested wrapper functions.
7882 Perform interprocedural scalar replacement of aggregates, removal of
7883 unused parameters and replacement of parameters passed by reference
7884 by parameters passed by value.
7886 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7888 @item -finline-limit=@var{n}
7889 @opindex finline-limit
7890 By default, GCC limits the size of functions that can be inlined. This flag
7891 allows coarse control of this limit. @var{n} is the size of functions that
7892 can be inlined in number of pseudo instructions.
7894 Inlining is actually controlled by a number of parameters, which may be
7895 specified individually by using @option{--param @var{name}=@var{value}}.
7896 The @option{-finline-limit=@var{n}} option sets some of these parameters
7900 @item max-inline-insns-single
7901 is set to @var{n}/2.
7902 @item max-inline-insns-auto
7903 is set to @var{n}/2.
7906 See below for a documentation of the individual
7907 parameters controlling inlining and for the defaults of these parameters.
7909 @emph{Note:} there may be no value to @option{-finline-limit} that results
7910 in default behavior.
7912 @emph{Note:} pseudo instruction represents, in this particular context, an
7913 abstract measurement of function's size. In no way does it represent a count
7914 of assembly instructions and as such its exact meaning might change from one
7915 release to an another.
7917 @item -fno-keep-inline-dllexport
7918 @opindex fno-keep-inline-dllexport
7919 This is a more fine-grained version of @option{-fkeep-inline-functions},
7920 which applies only to functions that are declared using the @code{dllexport}
7921 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7924 @item -fkeep-inline-functions
7925 @opindex fkeep-inline-functions
7926 In C, emit @code{static} functions that are declared @code{inline}
7927 into the object file, even if the function has been inlined into all
7928 of its callers. This switch does not affect functions using the
7929 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7930 inline functions into the object file.
7932 @item -fkeep-static-functions
7933 @opindex fkeep-static-functions
7934 Emit @code{static} functions into the object file, even if the function
7937 @item -fkeep-static-consts
7938 @opindex fkeep-static-consts
7939 Emit variables declared @code{static const} when optimization isn't turned
7940 on, even if the variables aren't referenced.
7942 GCC enables this option by default. If you want to force the compiler to
7943 check if a variable is referenced, regardless of whether or not
7944 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7946 @item -fmerge-constants
7947 @opindex fmerge-constants
7948 Attempt to merge identical constants (string constants and floating-point
7949 constants) across compilation units.
7951 This option is the default for optimized compilation if the assembler and
7952 linker support it. Use @option{-fno-merge-constants} to inhibit this
7955 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7957 @item -fmerge-all-constants
7958 @opindex fmerge-all-constants
7959 Attempt to merge identical constants and identical variables.
7961 This option implies @option{-fmerge-constants}. In addition to
7962 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7963 arrays or initialized constant variables with integral or floating-point
7964 types. Languages like C or C++ require each variable, including multiple
7965 instances of the same variable in recursive calls, to have distinct locations,
7966 so using this option results in non-conforming
7969 @item -fmodulo-sched
7970 @opindex fmodulo-sched
7971 Perform swing modulo scheduling immediately before the first scheduling
7972 pass. This pass looks at innermost loops and reorders their
7973 instructions by overlapping different iterations.
7975 @item -fmodulo-sched-allow-regmoves
7976 @opindex fmodulo-sched-allow-regmoves
7977 Perform more aggressive SMS-based modulo scheduling with register moves
7978 allowed. By setting this flag certain anti-dependences edges are
7979 deleted, which triggers the generation of reg-moves based on the
7980 life-range analysis. This option is effective only with
7981 @option{-fmodulo-sched} enabled.
7983 @item -fno-branch-count-reg
7984 @opindex fno-branch-count-reg
7985 Avoid running a pass scanning for opportunities to use ``decrement and
7986 branch'' instructions on a count register instead of generating sequences
7987 of instructions that decrement a register, compare it against zero, and
7988 then branch based upon the result. This option is only meaningful on
7989 architectures that support such instructions, which include x86, PowerPC,
7990 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7991 doesn't remove the decrement and branch instructions from the generated
7992 instruction stream introduced by other optimization passes.
7994 Enabled by default at @option{-O1} and higher.
7996 The default is @option{-fbranch-count-reg}.
7998 @item -fno-function-cse
7999 @opindex fno-function-cse
8000 Do not put function addresses in registers; make each instruction that
8001 calls a constant function contain the function's address explicitly.
8003 This option results in less efficient code, but some strange hacks
8004 that alter the assembler output may be confused by the optimizations
8005 performed when this option is not used.
8007 The default is @option{-ffunction-cse}
8009 @item -fno-zero-initialized-in-bss
8010 @opindex fno-zero-initialized-in-bss
8011 If the target supports a BSS section, GCC by default puts variables that
8012 are initialized to zero into BSS@. This can save space in the resulting
8015 This option turns off this behavior because some programs explicitly
8016 rely on variables going to the data section---e.g., so that the
8017 resulting executable can find the beginning of that section and/or make
8018 assumptions based on that.
8020 The default is @option{-fzero-initialized-in-bss}.
8022 @item -fthread-jumps
8023 @opindex fthread-jumps
8024 Perform optimizations that check to see if a jump branches to a
8025 location where another comparison subsumed by the first is found. If
8026 so, the first branch is redirected to either the destination of the
8027 second branch or a point immediately following it, depending on whether
8028 the condition is known to be true or false.
8030 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8032 @item -fsplit-wide-types
8033 @opindex fsplit-wide-types
8034 When using a type that occupies multiple registers, such as @code{long
8035 long} on a 32-bit system, split the registers apart and allocate them
8036 independently. This normally generates better code for those types,
8037 but may make debugging more difficult.
8039 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8042 @item -fcse-follow-jumps
8043 @opindex fcse-follow-jumps
8044 In common subexpression elimination (CSE), scan through jump instructions
8045 when the target of the jump is not reached by any other path. For
8046 example, when CSE encounters an @code{if} statement with an
8047 @code{else} clause, CSE follows the jump when the condition
8050 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8052 @item -fcse-skip-blocks
8053 @opindex fcse-skip-blocks
8054 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8055 follow jumps that conditionally skip over blocks. When CSE
8056 encounters a simple @code{if} statement with no else clause,
8057 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8058 body of the @code{if}.
8060 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8062 @item -frerun-cse-after-loop
8063 @opindex frerun-cse-after-loop
8064 Re-run common subexpression elimination after loop optimizations are
8067 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8071 Perform a global common subexpression elimination pass.
8072 This pass also performs global constant and copy propagation.
8074 @emph{Note:} When compiling a program using computed gotos, a GCC
8075 extension, you may get better run-time performance if you disable
8076 the global common subexpression elimination pass by adding
8077 @option{-fno-gcse} to the command line.
8079 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8083 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8084 attempts to move loads that are only killed by stores into themselves. This
8085 allows a loop containing a load/store sequence to be changed to a load outside
8086 the loop, and a copy/store within the loop.
8088 Enabled by default when @option{-fgcse} is enabled.
8092 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8093 global common subexpression elimination. This pass attempts to move
8094 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8095 loops containing a load/store sequence can be changed to a load before
8096 the loop and a store after the loop.
8098 Not enabled at any optimization level.
8102 When @option{-fgcse-las} is enabled, the global common subexpression
8103 elimination pass eliminates redundant loads that come after stores to the
8104 same memory location (both partial and full redundancies).
8106 Not enabled at any optimization level.
8108 @item -fgcse-after-reload
8109 @opindex fgcse-after-reload
8110 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8111 pass is performed after reload. The purpose of this pass is to clean up
8114 @item -faggressive-loop-optimizations
8115 @opindex faggressive-loop-optimizations
8116 This option tells the loop optimizer to use language constraints to
8117 derive bounds for the number of iterations of a loop. This assumes that
8118 loop code does not invoke undefined behavior by for example causing signed
8119 integer overflows or out-of-bound array accesses. The bounds for the
8120 number of iterations of a loop are used to guide loop unrolling and peeling
8121 and loop exit test optimizations.
8122 This option is enabled by default.
8124 @item -funconstrained-commons
8125 @opindex funconstrained-commons
8126 This option tells the compiler that variables declared in common blocks
8127 (e.g. Fortran) may later be overridden with longer trailing arrays. This
8128 prevents certain optimizations that depend on knowing the array bounds.
8130 @item -fcrossjumping
8131 @opindex fcrossjumping
8132 Perform cross-jumping transformation.
8133 This transformation unifies equivalent code and saves code size. The
8134 resulting code may or may not perform better than without cross-jumping.
8136 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8138 @item -fauto-inc-dec
8139 @opindex fauto-inc-dec
8140 Combine increments or decrements of addresses with memory accesses.
8141 This pass is always skipped on architectures that do not have
8142 instructions to support this. Enabled by default at @option{-O} and
8143 higher on architectures that support this.
8147 Perform dead code elimination (DCE) on RTL@.
8148 Enabled by default at @option{-O} and higher.
8152 Perform dead store elimination (DSE) on RTL@.
8153 Enabled by default at @option{-O} and higher.
8155 @item -fif-conversion
8156 @opindex fif-conversion
8157 Attempt to transform conditional jumps into branch-less equivalents. This
8158 includes use of conditional moves, min, max, set flags and abs instructions, and
8159 some tricks doable by standard arithmetics. The use of conditional execution
8160 on chips where it is available is controlled by @option{-fif-conversion2}.
8162 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8164 @item -fif-conversion2
8165 @opindex fif-conversion2
8166 Use conditional execution (where available) to transform conditional jumps into
8167 branch-less equivalents.
8169 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8171 @item -fdeclone-ctor-dtor
8172 @opindex fdeclone-ctor-dtor
8173 The C++ ABI requires multiple entry points for constructors and
8174 destructors: one for a base subobject, one for a complete object, and
8175 one for a virtual destructor that calls operator delete afterwards.
8176 For a hierarchy with virtual bases, the base and complete variants are
8177 clones, which means two copies of the function. With this option, the
8178 base and complete variants are changed to be thunks that call a common
8181 Enabled by @option{-Os}.
8183 @item -fdelete-null-pointer-checks
8184 @opindex fdelete-null-pointer-checks
8185 Assume that programs cannot safely dereference null pointers, and that
8186 no code or data element resides at address zero.
8187 This option enables simple constant
8188 folding optimizations at all optimization levels. In addition, other
8189 optimization passes in GCC use this flag to control global dataflow
8190 analyses that eliminate useless checks for null pointers; these assume
8191 that a memory access to address zero always results in a trap, so
8192 that if a pointer is checked after it has already been dereferenced,
8195 Note however that in some environments this assumption is not true.
8196 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8197 for programs that depend on that behavior.
8199 This option is enabled by default on most targets. On Nios II ELF, it
8200 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8202 Passes that use the dataflow information
8203 are enabled independently at different optimization levels.
8205 @item -fdevirtualize
8206 @opindex fdevirtualize
8207 Attempt to convert calls to virtual functions to direct calls. This
8208 is done both within a procedure and interprocedurally as part of
8209 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8210 propagation (@option{-fipa-cp}).
8211 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8213 @item -fdevirtualize-speculatively
8214 @opindex fdevirtualize-speculatively
8215 Attempt to convert calls to virtual functions to speculative direct calls.
8216 Based on the analysis of the type inheritance graph, determine for a given call
8217 the set of likely targets. If the set is small, preferably of size 1, change
8218 the call into a conditional deciding between direct and indirect calls. The
8219 speculative calls enable more optimizations, such as inlining. When they seem
8220 useless after further optimization, they are converted back into original form.
8222 @item -fdevirtualize-at-ltrans
8223 @opindex fdevirtualize-at-ltrans
8224 Stream extra information needed for aggressive devirtualization when running
8225 the link-time optimizer in local transformation mode.
8226 This option enables more devirtualization but
8227 significantly increases the size of streamed data. For this reason it is
8228 disabled by default.
8230 @item -fexpensive-optimizations
8231 @opindex fexpensive-optimizations
8232 Perform a number of minor optimizations that are relatively expensive.
8234 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8238 Attempt to remove redundant extension instructions. This is especially
8239 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8240 registers after writing to their lower 32-bit half.
8242 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8243 @option{-O3}, @option{-Os}.
8245 @item -fno-lifetime-dse
8246 @opindex fno-lifetime-dse
8247 In C++ the value of an object is only affected by changes within its
8248 lifetime: when the constructor begins, the object has an indeterminate
8249 value, and any changes during the lifetime of the object are dead when
8250 the object is destroyed. Normally dead store elimination will take
8251 advantage of this; if your code relies on the value of the object
8252 storage persisting beyond the lifetime of the object, you can use this
8253 flag to disable this optimization. To preserve stores before the
8254 constructor starts (e.g. because your operator new clears the object
8255 storage) but still treat the object as dead after the destructor you,
8256 can use @option{-flifetime-dse=1}. The default behavior can be
8257 explicitly selected with @option{-flifetime-dse=2}.
8258 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8260 @item -flive-range-shrinkage
8261 @opindex flive-range-shrinkage
8262 Attempt to decrease register pressure through register live range
8263 shrinkage. This is helpful for fast processors with small or moderate
8266 @item -fira-algorithm=@var{algorithm}
8267 @opindex fira-algorithm
8268 Use the specified coloring algorithm for the integrated register
8269 allocator. The @var{algorithm} argument can be @samp{priority}, which
8270 specifies Chow's priority coloring, or @samp{CB}, which specifies
8271 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8272 for all architectures, but for those targets that do support it, it is
8273 the default because it generates better code.
8275 @item -fira-region=@var{region}
8276 @opindex fira-region
8277 Use specified regions for the integrated register allocator. The
8278 @var{region} argument should be one of the following:
8283 Use all loops as register allocation regions.
8284 This can give the best results for machines with a small and/or
8285 irregular register set.
8288 Use all loops except for loops with small register pressure
8289 as the regions. This value usually gives
8290 the best results in most cases and for most architectures,
8291 and is enabled by default when compiling with optimization for speed
8292 (@option{-O}, @option{-O2}, @dots{}).
8295 Use all functions as a single region.
8296 This typically results in the smallest code size, and is enabled by default for
8297 @option{-Os} or @option{-O0}.
8301 @item -fira-hoist-pressure
8302 @opindex fira-hoist-pressure
8303 Use IRA to evaluate register pressure in the code hoisting pass for
8304 decisions to hoist expressions. This option usually results in smaller
8305 code, but it can slow the compiler down.
8307 This option is enabled at level @option{-Os} for all targets.
8309 @item -fira-loop-pressure
8310 @opindex fira-loop-pressure
8311 Use IRA to evaluate register pressure in loops for decisions to move
8312 loop invariants. This option usually results in generation
8313 of faster and smaller code on machines with large register files (>= 32
8314 registers), but it can slow the compiler down.
8316 This option is enabled at level @option{-O3} for some targets.
8318 @item -fno-ira-share-save-slots
8319 @opindex fno-ira-share-save-slots
8320 Disable sharing of stack slots used for saving call-used hard
8321 registers living through a call. Each hard register gets a
8322 separate stack slot, and as a result function stack frames are
8325 @item -fno-ira-share-spill-slots
8326 @opindex fno-ira-share-spill-slots
8327 Disable sharing of stack slots allocated for pseudo-registers. Each
8328 pseudo-register that does not get a hard register gets a separate
8329 stack slot, and as a result function stack frames are larger.
8333 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8334 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8335 values if it is profitable.
8337 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8339 @item -fdelayed-branch
8340 @opindex fdelayed-branch
8341 If supported for the target machine, attempt to reorder instructions
8342 to exploit instruction slots available after delayed branch
8345 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8347 @item -fschedule-insns
8348 @opindex fschedule-insns
8349 If supported for the target machine, attempt to reorder instructions to
8350 eliminate execution stalls due to required data being unavailable. This
8351 helps machines that have slow floating point or memory load instructions
8352 by allowing other instructions to be issued until the result of the load
8353 or floating-point instruction is required.
8355 Enabled at levels @option{-O2}, @option{-O3}.
8357 @item -fschedule-insns2
8358 @opindex fschedule-insns2
8359 Similar to @option{-fschedule-insns}, but requests an additional pass of
8360 instruction scheduling after register allocation has been done. This is
8361 especially useful on machines with a relatively small number of
8362 registers and where memory load instructions take more than one cycle.
8364 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8366 @item -fno-sched-interblock
8367 @opindex fno-sched-interblock
8368 Don't schedule instructions across basic blocks. This is normally
8369 enabled by default when scheduling before register allocation, i.e.@:
8370 with @option{-fschedule-insns} or at @option{-O2} or higher.
8372 @item -fno-sched-spec
8373 @opindex fno-sched-spec
8374 Don't allow speculative motion of non-load instructions. This is normally
8375 enabled by default when scheduling before register allocation, i.e.@:
8376 with @option{-fschedule-insns} or at @option{-O2} or higher.
8378 @item -fsched-pressure
8379 @opindex fsched-pressure
8380 Enable register pressure sensitive insn scheduling before register
8381 allocation. This only makes sense when scheduling before register
8382 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8383 @option{-O2} or higher. Usage of this option can improve the
8384 generated code and decrease its size by preventing register pressure
8385 increase above the number of available hard registers and subsequent
8386 spills in register allocation.
8388 @item -fsched-spec-load
8389 @opindex fsched-spec-load
8390 Allow speculative motion of some load instructions. This only makes
8391 sense when scheduling before register allocation, i.e.@: with
8392 @option{-fschedule-insns} or at @option{-O2} or higher.
8394 @item -fsched-spec-load-dangerous
8395 @opindex fsched-spec-load-dangerous
8396 Allow speculative motion of more load instructions. This only makes
8397 sense when scheduling before register allocation, i.e.@: with
8398 @option{-fschedule-insns} or at @option{-O2} or higher.
8400 @item -fsched-stalled-insns
8401 @itemx -fsched-stalled-insns=@var{n}
8402 @opindex fsched-stalled-insns
8403 Define how many insns (if any) can be moved prematurely from the queue
8404 of stalled insns into the ready list during the second scheduling pass.
8405 @option{-fno-sched-stalled-insns} means that no insns are moved
8406 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8407 on how many queued insns can be moved prematurely.
8408 @option{-fsched-stalled-insns} without a value is equivalent to
8409 @option{-fsched-stalled-insns=1}.
8411 @item -fsched-stalled-insns-dep
8412 @itemx -fsched-stalled-insns-dep=@var{n}
8413 @opindex fsched-stalled-insns-dep
8414 Define how many insn groups (cycles) are examined for a dependency
8415 on a stalled insn that is a candidate for premature removal from the queue
8416 of stalled insns. This has an effect only during the second scheduling pass,
8417 and only if @option{-fsched-stalled-insns} is used.
8418 @option{-fno-sched-stalled-insns-dep} is equivalent to
8419 @option{-fsched-stalled-insns-dep=0}.
8420 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8421 @option{-fsched-stalled-insns-dep=1}.
8423 @item -fsched2-use-superblocks
8424 @opindex fsched2-use-superblocks
8425 When scheduling after register allocation, use superblock scheduling.
8426 This allows motion across basic block boundaries,
8427 resulting in faster schedules. This option is experimental, as not all machine
8428 descriptions used by GCC model the CPU closely enough to avoid unreliable
8429 results from the algorithm.
8431 This only makes sense when scheduling after register allocation, i.e.@: with
8432 @option{-fschedule-insns2} or at @option{-O2} or higher.
8434 @item -fsched-group-heuristic
8435 @opindex fsched-group-heuristic
8436 Enable the group heuristic in the scheduler. This heuristic favors
8437 the instruction that belongs to a schedule group. This is enabled
8438 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8439 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8441 @item -fsched-critical-path-heuristic
8442 @opindex fsched-critical-path-heuristic
8443 Enable the critical-path heuristic in the scheduler. This heuristic favors
8444 instructions on the critical path. This is enabled by default when
8445 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8446 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8448 @item -fsched-spec-insn-heuristic
8449 @opindex fsched-spec-insn-heuristic
8450 Enable the speculative instruction heuristic in the scheduler. This
8451 heuristic favors speculative instructions with greater dependency weakness.
8452 This is enabled by default when scheduling is enabled, i.e.@:
8453 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8454 or at @option{-O2} or higher.
8456 @item -fsched-rank-heuristic
8457 @opindex fsched-rank-heuristic
8458 Enable the rank heuristic in the scheduler. This heuristic favors
8459 the instruction belonging to a basic block with greater size or frequency.
8460 This is enabled by default when scheduling is enabled, i.e.@:
8461 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8462 at @option{-O2} or higher.
8464 @item -fsched-last-insn-heuristic
8465 @opindex fsched-last-insn-heuristic
8466 Enable the last-instruction heuristic in the scheduler. This heuristic
8467 favors the instruction that is less dependent on the last instruction
8468 scheduled. This is enabled by default when scheduling is enabled,
8469 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8470 at @option{-O2} or higher.
8472 @item -fsched-dep-count-heuristic
8473 @opindex fsched-dep-count-heuristic
8474 Enable the dependent-count heuristic in the scheduler. This heuristic
8475 favors the instruction that has more instructions depending on it.
8476 This is enabled by default when scheduling is enabled, i.e.@:
8477 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8478 at @option{-O2} or higher.
8480 @item -freschedule-modulo-scheduled-loops
8481 @opindex freschedule-modulo-scheduled-loops
8482 Modulo scheduling is performed before traditional scheduling. If a loop
8483 is modulo scheduled, later scheduling passes may change its schedule.
8484 Use this option to control that behavior.
8486 @item -fselective-scheduling
8487 @opindex fselective-scheduling
8488 Schedule instructions using selective scheduling algorithm. Selective
8489 scheduling runs instead of the first scheduler pass.
8491 @item -fselective-scheduling2
8492 @opindex fselective-scheduling2
8493 Schedule instructions using selective scheduling algorithm. Selective
8494 scheduling runs instead of the second scheduler pass.
8496 @item -fsel-sched-pipelining
8497 @opindex fsel-sched-pipelining
8498 Enable software pipelining of innermost loops during selective scheduling.
8499 This option has no effect unless one of @option{-fselective-scheduling} or
8500 @option{-fselective-scheduling2} is turned on.
8502 @item -fsel-sched-pipelining-outer-loops
8503 @opindex fsel-sched-pipelining-outer-loops
8504 When pipelining loops during selective scheduling, also pipeline outer loops.
8505 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8507 @item -fsemantic-interposition
8508 @opindex fsemantic-interposition
8509 Some object formats, like ELF, allow interposing of symbols by the
8511 This means that for symbols exported from the DSO, the compiler cannot perform
8512 interprocedural propagation, inlining and other optimizations in anticipation
8513 that the function or variable in question may change. While this feature is
8514 useful, for example, to rewrite memory allocation functions by a debugging
8515 implementation, it is expensive in the terms of code quality.
8516 With @option{-fno-semantic-interposition} the compiler assumes that
8517 if interposition happens for functions the overwriting function will have
8518 precisely the same semantics (and side effects).
8519 Similarly if interposition happens
8520 for variables, the constructor of the variable will be the same. The flag
8521 has no effect for functions explicitly declared inline
8522 (where it is never allowed for interposition to change semantics)
8523 and for symbols explicitly declared weak.
8526 @opindex fshrink-wrap
8527 Emit function prologues only before parts of the function that need it,
8528 rather than at the top of the function. This flag is enabled by default at
8529 @option{-O} and higher.
8531 @item -fshrink-wrap-separate
8532 @opindex fshrink-wrap-separate
8533 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8534 those parts are only executed when needed.
8535 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8536 is also turned on and the target supports this.
8538 @item -fcaller-saves
8539 @opindex fcaller-saves
8540 Enable allocation of values to registers that are clobbered by
8541 function calls, by emitting extra instructions to save and restore the
8542 registers around such calls. Such allocation is done only when it
8543 seems to result in better code.
8545 This option is always enabled by default on certain machines, usually
8546 those which have no call-preserved registers to use instead.
8548 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8550 @item -fcombine-stack-adjustments
8551 @opindex fcombine-stack-adjustments
8552 Tracks stack adjustments (pushes and pops) and stack memory references
8553 and then tries to find ways to combine them.
8555 Enabled by default at @option{-O1} and higher.
8559 Use caller save registers for allocation if those registers are not used by
8560 any called function. In that case it is not necessary to save and restore
8561 them around calls. This is only possible if called functions are part of
8562 same compilation unit as current function and they are compiled before it.
8564 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8565 is disabled if generated code will be instrumented for profiling
8566 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8567 exactly (this happens on targets that do not expose prologues
8568 and epilogues in RTL).
8570 @item -fconserve-stack
8571 @opindex fconserve-stack
8572 Attempt to minimize stack usage. The compiler attempts to use less
8573 stack space, even if that makes the program slower. This option
8574 implies setting the @option{large-stack-frame} parameter to 100
8575 and the @option{large-stack-frame-growth} parameter to 400.
8577 @item -ftree-reassoc
8578 @opindex ftree-reassoc
8579 Perform reassociation on trees. This flag is enabled by default
8580 at @option{-O} and higher.
8582 @item -fcode-hoisting
8583 @opindex fcode-hoisting
8584 Perform code hoisting. Code hoisting tries to move the
8585 evaluation of expressions executed on all paths to the function exit
8586 as early as possible. This is especially useful as a code size
8587 optimization, but it often helps for code speed as well.
8588 This flag is enabled by default at @option{-O2} and higher.
8592 Perform partial redundancy elimination (PRE) on trees. This flag is
8593 enabled by default at @option{-O2} and @option{-O3}.
8595 @item -ftree-partial-pre
8596 @opindex ftree-partial-pre
8597 Make partial redundancy elimination (PRE) more aggressive. This flag is
8598 enabled by default at @option{-O3}.
8600 @item -ftree-forwprop
8601 @opindex ftree-forwprop
8602 Perform forward propagation on trees. This flag is enabled by default
8603 at @option{-O} and higher.
8607 Perform full redundancy elimination (FRE) on trees. The difference
8608 between FRE and PRE is that FRE only considers expressions
8609 that are computed on all paths leading to the redundant computation.
8610 This analysis is faster than PRE, though it exposes fewer redundancies.
8611 This flag is enabled by default at @option{-O} and higher.
8613 @item -ftree-phiprop
8614 @opindex ftree-phiprop
8615 Perform hoisting of loads from conditional pointers on trees. This
8616 pass is enabled by default at @option{-O} and higher.
8618 @item -fhoist-adjacent-loads
8619 @opindex fhoist-adjacent-loads
8620 Speculatively hoist loads from both branches of an if-then-else if the
8621 loads are from adjacent locations in the same structure and the target
8622 architecture has a conditional move instruction. This flag is enabled
8623 by default at @option{-O2} and higher.
8625 @item -ftree-copy-prop
8626 @opindex ftree-copy-prop
8627 Perform copy propagation on trees. This pass eliminates unnecessary
8628 copy operations. This flag is enabled by default at @option{-O} and
8631 @item -fipa-pure-const
8632 @opindex fipa-pure-const
8633 Discover which functions are pure or constant.
8634 Enabled by default at @option{-O} and higher.
8636 @item -fipa-reference
8637 @opindex fipa-reference
8638 Discover which static variables do not escape the
8640 Enabled by default at @option{-O} and higher.
8644 Perform interprocedural pointer analysis and interprocedural modification
8645 and reference analysis. This option can cause excessive memory and
8646 compile-time usage on large compilation units. It is not enabled by
8647 default at any optimization level.
8650 @opindex fipa-profile
8651 Perform interprocedural profile propagation. The functions called only from
8652 cold functions are marked as cold. Also functions executed once (such as
8653 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8654 functions and loop less parts of functions executed once are then optimized for
8656 Enabled by default at @option{-O} and higher.
8660 Perform interprocedural constant propagation.
8661 This optimization analyzes the program to determine when values passed
8662 to functions are constants and then optimizes accordingly.
8663 This optimization can substantially increase performance
8664 if the application has constants passed to functions.
8665 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8667 @item -fipa-cp-clone
8668 @opindex fipa-cp-clone
8669 Perform function cloning to make interprocedural constant propagation stronger.
8670 When enabled, interprocedural constant propagation performs function cloning
8671 when externally visible function can be called with constant arguments.
8672 Because this optimization can create multiple copies of functions,
8673 it may significantly increase code size
8674 (see @option{--param ipcp-unit-growth=@var{value}}).
8675 This flag is enabled by default at @option{-O3}.
8678 @opindex -fipa-bit-cp
8679 When enabled, perform interprocedural bitwise constant
8680 propagation. This flag is enabled by default at @option{-O2}. It
8681 requires that @option{-fipa-cp} is enabled.
8685 When enabled, perform interprocedural propagation of value
8686 ranges. This flag is enabled by default at @option{-O2}. It requires
8687 that @option{-fipa-cp} is enabled.
8691 Perform Identical Code Folding for functions and read-only variables.
8692 The optimization reduces code size and may disturb unwind stacks by replacing
8693 a function by equivalent one with a different name. The optimization works
8694 more effectively with link-time optimization enabled.
8696 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8697 works on different levels and thus the optimizations are not same - there are
8698 equivalences that are found only by GCC and equivalences found only by Gold.
8700 This flag is enabled by default at @option{-O2} and @option{-Os}.
8702 @item -fisolate-erroneous-paths-dereference
8703 @opindex fisolate-erroneous-paths-dereference
8704 Detect paths that trigger erroneous or undefined behavior due to
8705 dereferencing a null pointer. Isolate those paths from the main control
8706 flow and turn the statement with erroneous or undefined behavior into a trap.
8707 This flag is enabled by default at @option{-O2} and higher and depends on
8708 @option{-fdelete-null-pointer-checks} also being enabled.
8710 @item -fisolate-erroneous-paths-attribute
8711 @opindex fisolate-erroneous-paths-attribute
8712 Detect paths that trigger erroneous or undefined behavior due to a null value
8713 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8714 attribute. Isolate those paths from the main control flow and turn the
8715 statement with erroneous or undefined behavior into a trap. This is not
8716 currently enabled, but may be enabled by @option{-O2} in the future.
8720 Perform forward store motion on trees. This flag is
8721 enabled by default at @option{-O} and higher.
8723 @item -ftree-bit-ccp
8724 @opindex ftree-bit-ccp
8725 Perform sparse conditional bit constant propagation on trees and propagate
8726 pointer alignment information.
8727 This pass only operates on local scalar variables and is enabled by default
8728 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8732 Perform sparse conditional constant propagation (CCP) on trees. This
8733 pass only operates on local scalar variables and is enabled by default
8734 at @option{-O} and higher.
8736 @item -fssa-backprop
8737 @opindex fssa-backprop
8738 Propagate information about uses of a value up the definition chain
8739 in order to simplify the definitions. For example, this pass strips
8740 sign operations if the sign of a value never matters. The flag is
8741 enabled by default at @option{-O} and higher.
8744 @opindex fssa-phiopt
8745 Perform pattern matching on SSA PHI nodes to optimize conditional
8746 code. This pass is enabled by default at @option{-O} and higher.
8748 @item -ftree-switch-conversion
8749 @opindex ftree-switch-conversion
8750 Perform conversion of simple initializations in a switch to
8751 initializations from a scalar array. This flag is enabled by default
8752 at @option{-O2} and higher.
8754 @item -ftree-tail-merge
8755 @opindex ftree-tail-merge
8756 Look for identical code sequences. When found, replace one with a jump to the
8757 other. This optimization is known as tail merging or cross jumping. This flag
8758 is enabled by default at @option{-O2} and higher. The compilation time
8760 be limited using @option{max-tail-merge-comparisons} parameter and
8761 @option{max-tail-merge-iterations} parameter.
8765 Perform dead code elimination (DCE) on trees. This flag is enabled by
8766 default at @option{-O} and higher.
8768 @item -ftree-builtin-call-dce
8769 @opindex ftree-builtin-call-dce
8770 Perform conditional dead code elimination (DCE) for calls to built-in functions
8771 that may set @code{errno} but are otherwise free of side effects. This flag is
8772 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8775 @item -ftree-dominator-opts
8776 @opindex ftree-dominator-opts
8777 Perform a variety of simple scalar cleanups (constant/copy
8778 propagation, redundancy elimination, range propagation and expression
8779 simplification) based on a dominator tree traversal. This also
8780 performs jump threading (to reduce jumps to jumps). This flag is
8781 enabled by default at @option{-O} and higher.
8785 Perform dead store elimination (DSE) on trees. A dead store is a store into
8786 a memory location that is later overwritten by another store without
8787 any intervening loads. In this case the earlier store can be deleted. This
8788 flag is enabled by default at @option{-O} and higher.
8792 Perform loop header copying on trees. This is beneficial since it increases
8793 effectiveness of code motion optimizations. It also saves one jump. This flag
8794 is enabled by default at @option{-O} and higher. It is not enabled
8795 for @option{-Os}, since it usually increases code size.
8797 @item -ftree-loop-optimize
8798 @opindex ftree-loop-optimize
8799 Perform loop optimizations on trees. This flag is enabled by default
8800 at @option{-O} and higher.
8802 @item -ftree-loop-linear
8803 @itemx -floop-strip-mine
8805 @opindex ftree-loop-linear
8806 @opindex floop-strip-mine
8807 @opindex floop-block
8808 Perform loop nest optimizations. Same as
8809 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8810 to be configured with @option{--with-isl} to enable the Graphite loop
8811 transformation infrastructure.
8813 @item -fgraphite-identity
8814 @opindex fgraphite-identity
8815 Enable the identity transformation for graphite. For every SCoP we generate
8816 the polyhedral representation and transform it back to gimple. Using
8817 @option{-fgraphite-identity} we can check the costs or benefits of the
8818 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8819 are also performed by the code generator isl, like index splitting and
8820 dead code elimination in loops.
8822 @item -floop-nest-optimize
8823 @opindex floop-nest-optimize
8824 Enable the isl based loop nest optimizer. This is a generic loop nest
8825 optimizer based on the Pluto optimization algorithms. It calculates a loop
8826 structure optimized for data-locality and parallelism. This option
8829 @item -floop-parallelize-all
8830 @opindex floop-parallelize-all
8831 Use the Graphite data dependence analysis to identify loops that can
8832 be parallelized. Parallelize all the loops that can be analyzed to
8833 not contain loop carried dependences without checking that it is
8834 profitable to parallelize the loops.
8836 @item -ftree-coalesce-vars
8837 @opindex ftree-coalesce-vars
8838 While transforming the program out of the SSA representation, attempt to
8839 reduce copying by coalescing versions of different user-defined
8840 variables, instead of just compiler temporaries. This may severely
8841 limit the ability to debug an optimized program compiled with
8842 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8843 prevents SSA coalescing of user variables. This option is enabled by
8844 default if optimization is enabled, and it does very little otherwise.
8846 @item -ftree-loop-if-convert
8847 @opindex ftree-loop-if-convert
8848 Attempt to transform conditional jumps in the innermost loops to
8849 branch-less equivalents. The intent is to remove control-flow from
8850 the innermost loops in order to improve the ability of the
8851 vectorization pass to handle these loops. This is enabled by default
8852 if vectorization is enabled.
8854 @item -ftree-loop-distribution
8855 @opindex ftree-loop-distribution
8856 Perform loop distribution. This flag can improve cache performance on
8857 big loop bodies and allow further loop optimizations, like
8858 parallelization or vectorization, to take place. For example, the loop
8875 @item -ftree-loop-distribute-patterns
8876 @opindex ftree-loop-distribute-patterns
8877 Perform loop distribution of patterns that can be code generated with
8878 calls to a library. This flag is enabled by default at @option{-O3}.
8880 This pass distributes the initialization loops and generates a call to
8881 memset zero. For example, the loop
8897 and the initialization loop is transformed into a call to memset zero.
8899 @item -floop-interchange
8900 @opindex floop-interchange
8901 Perform loop interchange outside of graphite. This flag can improve cache
8902 performance on loop nest and allow further loop optimizations, like
8903 vectorization, to take place. For example, the loop
8905 for (int i = 0; i < N; i++)
8906 for (int j = 0; j < N; j++)
8907 for (int k = 0; k < N; k++)
8908 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8912 for (int i = 0; i < N; i++)
8913 for (int k = 0; k < N; k++)
8914 for (int j = 0; j < N; j++)
8915 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8917 This flag is enabled by default at @option{-O3}.
8919 @item -floop-unroll-and-jam
8920 @opindex floop-unroll-and-jam
8921 Apply unroll and jam transformations on feasible loops. In a loop
8922 nest this unrolls the outer loop by some factor and fuses the resulting
8923 multiple inner loops. This flag is enabled by default at @option{-O3}.
8925 @item -ftree-loop-im
8926 @opindex ftree-loop-im
8927 Perform loop invariant motion on trees. This pass moves only invariants that
8928 are hard to handle at RTL level (function calls, operations that expand to
8929 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8930 operands of conditions that are invariant out of the loop, so that we can use
8931 just trivial invariantness analysis in loop unswitching. The pass also includes
8934 @item -ftree-loop-ivcanon
8935 @opindex ftree-loop-ivcanon
8936 Create a canonical counter for number of iterations in loops for which
8937 determining number of iterations requires complicated analysis. Later
8938 optimizations then may determine the number easily. Useful especially
8939 in connection with unrolling.
8943 Perform induction variable optimizations (strength reduction, induction
8944 variable merging and induction variable elimination) on trees.
8946 @item -ftree-parallelize-loops=n
8947 @opindex ftree-parallelize-loops
8948 Parallelize loops, i.e., split their iteration space to run in n threads.
8949 This is only possible for loops whose iterations are independent
8950 and can be arbitrarily reordered. The optimization is only
8951 profitable on multiprocessor machines, for loops that are CPU-intensive,
8952 rather than constrained e.g.@: by memory bandwidth. This option
8953 implies @option{-pthread}, and thus is only supported on targets
8954 that have support for @option{-pthread}.
8958 Perform function-local points-to analysis on trees. This flag is
8959 enabled by default at @option{-O} and higher.
8963 Perform scalar replacement of aggregates. This pass replaces structure
8964 references with scalars to prevent committing structures to memory too
8965 early. This flag is enabled by default at @option{-O} and higher.
8967 @item -fstore-merging
8968 @opindex fstore-merging
8969 Perform merging of narrow stores to consecutive memory addresses. This pass
8970 merges contiguous stores of immediate values narrower than a word into fewer
8971 wider stores to reduce the number of instructions. This is enabled by default
8972 at @option{-O2} and higher as well as @option{-Os}.
8976 Perform temporary expression replacement during the SSA->normal phase. Single
8977 use/single def temporaries are replaced at their use location with their
8978 defining expression. This results in non-GIMPLE code, but gives the expanders
8979 much more complex trees to work on resulting in better RTL generation. This is
8980 enabled by default at @option{-O} and higher.
8984 Perform straight-line strength reduction on trees. This recognizes related
8985 expressions involving multiplications and replaces them by less expensive
8986 calculations when possible. This is enabled by default at @option{-O} and
8989 @item -ftree-vectorize
8990 @opindex ftree-vectorize
8991 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8992 and @option{-ftree-slp-vectorize} if not explicitly specified.
8994 @item -ftree-loop-vectorize
8995 @opindex ftree-loop-vectorize
8996 Perform loop vectorization on trees. This flag is enabled by default at
8997 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8999 @item -ftree-slp-vectorize
9000 @opindex ftree-slp-vectorize
9001 Perform basic block vectorization on trees. This flag is enabled by default at
9002 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9004 @item -fvect-cost-model=@var{model}
9005 @opindex fvect-cost-model
9006 Alter the cost model used for vectorization. The @var{model} argument
9007 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9008 With the @samp{unlimited} model the vectorized code-path is assumed
9009 to be profitable while with the @samp{dynamic} model a runtime check
9010 guards the vectorized code-path to enable it only for iteration
9011 counts that will likely execute faster than when executing the original
9012 scalar loop. The @samp{cheap} model disables vectorization of
9013 loops where doing so would be cost prohibitive for example due to
9014 required runtime checks for data dependence or alignment but otherwise
9015 is equal to the @samp{dynamic} model.
9016 The default cost model depends on other optimization flags and is
9017 either @samp{dynamic} or @samp{cheap}.
9019 @item -fsimd-cost-model=@var{model}
9020 @opindex fsimd-cost-model
9021 Alter the cost model used for vectorization of loops marked with the OpenMP
9022 simd directive. The @var{model} argument should be one of
9023 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9024 have the same meaning as described in @option{-fvect-cost-model} and by
9025 default a cost model defined with @option{-fvect-cost-model} is used.
9029 Perform Value Range Propagation on trees. This is similar to the
9030 constant propagation pass, but instead of values, ranges of values are
9031 propagated. This allows the optimizers to remove unnecessary range
9032 checks like array bound checks and null pointer checks. This is
9033 enabled by default at @option{-O2} and higher. Null pointer check
9034 elimination is only done if @option{-fdelete-null-pointer-checks} is
9038 @opindex fsplit-paths
9039 Split paths leading to loop backedges. This can improve dead code
9040 elimination and common subexpression elimination. This is enabled by
9041 default at @option{-O2} and above.
9043 @item -fsplit-ivs-in-unroller
9044 @opindex fsplit-ivs-in-unroller
9045 Enables expression of values of induction variables in later iterations
9046 of the unrolled loop using the value in the first iteration. This breaks
9047 long dependency chains, thus improving efficiency of the scheduling passes.
9049 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9050 same effect. However, that is not reliable in cases where the loop body
9051 is more complicated than a single basic block. It also does not work at all
9052 on some architectures due to restrictions in the CSE pass.
9054 This optimization is enabled by default.
9056 @item -fvariable-expansion-in-unroller
9057 @opindex fvariable-expansion-in-unroller
9058 With this option, the compiler creates multiple copies of some
9059 local variables when unrolling a loop, which can result in superior code.
9061 @item -fpartial-inlining
9062 @opindex fpartial-inlining
9063 Inline parts of functions. This option has any effect only
9064 when inlining itself is turned on by the @option{-finline-functions}
9065 or @option{-finline-small-functions} options.
9067 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9069 @item -fpredictive-commoning
9070 @opindex fpredictive-commoning
9071 Perform predictive commoning optimization, i.e., reusing computations
9072 (especially memory loads and stores) performed in previous
9073 iterations of loops.
9075 This option is enabled at level @option{-O3}.
9077 @item -fprefetch-loop-arrays
9078 @opindex fprefetch-loop-arrays
9079 If supported by the target machine, generate instructions to prefetch
9080 memory to improve the performance of loops that access large arrays.
9082 This option may generate better or worse code; results are highly
9083 dependent on the structure of loops within the source code.
9085 Disabled at level @option{-Os}.
9087 @item -fno-printf-return-value
9088 @opindex fno-printf-return-value
9089 Do not substitute constants for known return value of formatted output
9090 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9091 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9092 transformation allows GCC to optimize or even eliminate branches based
9093 on the known return value of these functions called with arguments that
9094 are either constant, or whose values are known to be in a range that
9095 makes determining the exact return value possible. For example, when
9096 @option{-fprintf-return-value} is in effect, both the branch and the
9097 body of the @code{if} statement (but not the call to @code{snprint})
9098 can be optimized away when @code{i} is a 32-bit or smaller integer
9099 because the return value is guaranteed to be at most 8.
9103 if (snprintf (buf, "%08x", i) >= sizeof buf)
9107 The @option{-fprintf-return-value} option relies on other optimizations
9108 and yields best results with @option{-O2} and above. It works in tandem
9109 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9110 options. The @option{-fprintf-return-value} option is enabled by default.
9113 @itemx -fno-peephole2
9114 @opindex fno-peephole
9115 @opindex fno-peephole2
9116 Disable any machine-specific peephole optimizations. The difference
9117 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9118 are implemented in the compiler; some targets use one, some use the
9119 other, a few use both.
9121 @option{-fpeephole} is enabled by default.
9122 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9124 @item -fno-guess-branch-probability
9125 @opindex fno-guess-branch-probability
9126 Do not guess branch probabilities using heuristics.
9128 GCC uses heuristics to guess branch probabilities if they are
9129 not provided by profiling feedback (@option{-fprofile-arcs}). These
9130 heuristics are based on the control flow graph. If some branch probabilities
9131 are specified by @code{__builtin_expect}, then the heuristics are
9132 used to guess branch probabilities for the rest of the control flow graph,
9133 taking the @code{__builtin_expect} info into account. The interactions
9134 between the heuristics and @code{__builtin_expect} can be complex, and in
9135 some cases, it may be useful to disable the heuristics so that the effects
9136 of @code{__builtin_expect} are easier to understand.
9138 The default is @option{-fguess-branch-probability} at levels
9139 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9141 @item -freorder-blocks
9142 @opindex freorder-blocks
9143 Reorder basic blocks in the compiled function in order to reduce number of
9144 taken branches and improve code locality.
9146 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9148 @item -freorder-blocks-algorithm=@var{algorithm}
9149 @opindex freorder-blocks-algorithm
9150 Use the specified algorithm for basic block reordering. The
9151 @var{algorithm} argument can be @samp{simple}, which does not increase
9152 code size (except sometimes due to secondary effects like alignment),
9153 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9154 put all often executed code together, minimizing the number of branches
9155 executed by making extra copies of code.
9157 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9158 @samp{stc} at levels @option{-O2}, @option{-O3}.
9160 @item -freorder-blocks-and-partition
9161 @opindex freorder-blocks-and-partition
9162 In addition to reordering basic blocks in the compiled function, in order
9163 to reduce number of taken branches, partitions hot and cold basic blocks
9164 into separate sections of the assembly and @file{.o} files, to improve
9165 paging and cache locality performance.
9167 This optimization is automatically turned off in the presence of
9168 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9169 section attribute and on any architecture that does not support named
9170 sections. When @option{-fsplit-stack} is used this option is not
9171 enabled by default (to avoid linker errors), but may be enabled
9172 explicitly (if using a working linker).
9174 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9176 @item -freorder-functions
9177 @opindex freorder-functions
9178 Reorder functions in the object file in order to
9179 improve code locality. This is implemented by using special
9180 subsections @code{.text.hot} for most frequently executed functions and
9181 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9182 the linker so object file format must support named sections and linker must
9183 place them in a reasonable way.
9185 Also profile feedback must be available to make this option effective. See
9186 @option{-fprofile-arcs} for details.
9188 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9190 @item -fstrict-aliasing
9191 @opindex fstrict-aliasing
9192 Allow the compiler to assume the strictest aliasing rules applicable to
9193 the language being compiled. For C (and C++), this activates
9194 optimizations based on the type of expressions. In particular, an
9195 object of one type is assumed never to reside at the same address as an
9196 object of a different type, unless the types are almost the same. For
9197 example, an @code{unsigned int} can alias an @code{int}, but not a
9198 @code{void*} or a @code{double}. A character type may alias any other
9201 @anchor{Type-punning}Pay special attention to code like this:
9214 The practice of reading from a different union member than the one most
9215 recently written to (called ``type-punning'') is common. Even with
9216 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9217 is accessed through the union type. So, the code above works as
9218 expected. @xref{Structures unions enumerations and bit-fields
9219 implementation}. However, this code might not:
9230 Similarly, access by taking the address, casting the resulting pointer
9231 and dereferencing the result has undefined behavior, even if the cast
9232 uses a union type, e.g.:
9236 return ((union a_union *) &d)->i;
9240 The @option{-fstrict-aliasing} option is enabled at levels
9241 @option{-O2}, @option{-O3}, @option{-Os}.
9243 @item -falign-functions
9244 @itemx -falign-functions=@var{n}
9245 @itemx -falign-functions=@var{n}:@var{m}
9246 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9247 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9248 @opindex falign-functions
9249 Align the start of functions to the next power-of-two greater than
9250 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9251 the first @var{m} bytes of the function can be fetched by the CPU
9252 without crossing an @var{n}-byte alignment boundary.
9254 If @var{m} is not specified, it defaults to @var{n}.
9256 Examples: @option{-falign-functions=32} aligns functions to the next
9257 32-byte boundary, @option{-falign-functions=24} aligns to the next
9258 32-byte boundary only if this can be done by skipping 23 bytes or less,
9259 @option{-falign-functions=32:7} aligns to the next
9260 32-byte boundary only if this can be done by skipping 6 bytes or less.
9262 The second pair of @var{n2}:@var{m2} values allows you to specify
9263 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9264 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9265 otherwise aligns to the next 32-byte boundary if this can be done
9266 by skipping 2 bytes or less.
9267 If @var{m2} is not specified, it defaults to @var{n2}.
9269 Some assemblers only support this flag when @var{n} is a power of two;
9270 in that case, it is rounded up.
9272 @option{-fno-align-functions} and @option{-falign-functions=1} are
9273 equivalent and mean that functions are not aligned.
9275 If @var{n} is not specified or is zero, use a machine-dependent default.
9276 The maximum allowed @var{n} option value is 65536.
9278 Enabled at levels @option{-O2}, @option{-O3}.
9280 @item -flimit-function-alignment
9281 If this option is enabled, the compiler tries to avoid unnecessarily
9282 overaligning functions. It attempts to instruct the assembler to align
9283 by the amount specified by @option{-falign-functions}, but not to
9284 skip more bytes than the size of the function.
9286 @item -falign-labels
9287 @itemx -falign-labels=@var{n}
9288 @itemx -falign-labels=@var{n}:@var{m}
9289 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9290 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9291 @opindex falign-labels
9292 Align all branch targets to a power-of-two boundary.
9294 Parameters of this option are analogous to the @option{-falign-functions} option.
9295 @option{-fno-align-labels} and @option{-falign-labels=1} are
9296 equivalent and mean that labels are not aligned.
9298 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9299 are greater than this value, then their values are used instead.
9301 If @var{n} is not specified or is zero, use a machine-dependent default
9302 which is very likely to be @samp{1}, meaning no alignment.
9303 The maximum allowed @var{n} option value is 65536.
9305 Enabled at levels @option{-O2}, @option{-O3}.
9308 @itemx -falign-loops=@var{n}
9309 @itemx -falign-loops=@var{n}:@var{m}
9310 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9311 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9312 @opindex falign-loops
9313 Align loops to a power-of-two boundary. If the loops are executed
9314 many times, this makes up for any execution of the dummy padding
9317 Parameters of this option are analogous to the @option{-falign-functions} option.
9318 @option{-fno-align-loops} and @option{-falign-loops=1} are
9319 equivalent and mean that loops are not aligned.
9320 The maximum allowed @var{n} option value is 65536.
9322 If @var{n} is not specified or is zero, use a machine-dependent default.
9324 Enabled at levels @option{-O2}, @option{-O3}.
9327 @itemx -falign-jumps=@var{n}
9328 @itemx -falign-jumps=@var{n}:@var{m}
9329 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9330 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9331 @opindex falign-jumps
9332 Align branch targets to a power-of-two boundary, for branch targets
9333 where the targets can only be reached by jumping. In this case,
9334 no dummy operations need be executed.
9336 Parameters of this option are analogous to the @option{-falign-functions} option.
9337 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9338 equivalent and mean that loops are not aligned.
9340 If @var{n} is not specified or is zero, use a machine-dependent default.
9341 The maximum allowed @var{n} option value is 65536.
9343 Enabled at levels @option{-O2}, @option{-O3}.
9345 @item -funit-at-a-time
9346 @opindex funit-at-a-time
9347 This option is left for compatibility reasons. @option{-funit-at-a-time}
9348 has no effect, while @option{-fno-unit-at-a-time} implies
9349 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9353 @item -fno-toplevel-reorder
9354 @opindex fno-toplevel-reorder
9355 Do not reorder top-level functions, variables, and @code{asm}
9356 statements. Output them in the same order that they appear in the
9357 input file. When this option is used, unreferenced static variables
9358 are not removed. This option is intended to support existing code
9359 that relies on a particular ordering. For new code, it is better to
9360 use attributes when possible.
9362 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9363 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9368 Constructs webs as commonly used for register allocation purposes and assign
9369 each web individual pseudo register. This allows the register allocation pass
9370 to operate on pseudos directly, but also strengthens several other optimization
9371 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9372 however, make debugging impossible, since variables no longer stay in a
9375 Enabled by default with @option{-funroll-loops}.
9377 @item -fwhole-program
9378 @opindex fwhole-program
9379 Assume that the current compilation unit represents the whole program being
9380 compiled. All public functions and variables with the exception of @code{main}
9381 and those merged by attribute @code{externally_visible} become static functions
9382 and in effect are optimized more aggressively by interprocedural optimizers.
9384 This option should not be used in combination with @option{-flto}.
9385 Instead relying on a linker plugin should provide safer and more precise
9388 @item -flto[=@var{n}]
9390 This option runs the standard link-time optimizer. When invoked
9391 with source code, it generates GIMPLE (one of GCC's internal
9392 representations) and writes it to special ELF sections in the object
9393 file. When the object files are linked together, all the function
9394 bodies are read from these ELF sections and instantiated as if they
9395 had been part of the same translation unit.
9397 To use the link-time optimizer, @option{-flto} and optimization
9398 options should be specified at compile time and during the final link.
9399 It is recommended that you compile all the files participating in the
9400 same link with the same options and also specify those options at
9405 gcc -c -O2 -flto foo.c
9406 gcc -c -O2 -flto bar.c
9407 gcc -o myprog -flto -O2 foo.o bar.o
9410 The first two invocations to GCC save a bytecode representation
9411 of GIMPLE into special ELF sections inside @file{foo.o} and
9412 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9413 @file{foo.o} and @file{bar.o}, merges the two files into a single
9414 internal image, and compiles the result as usual. Since both
9415 @file{foo.o} and @file{bar.o} are merged into a single image, this
9416 causes all the interprocedural analyses and optimizations in GCC to
9417 work across the two files as if they were a single one. This means,
9418 for example, that the inliner is able to inline functions in
9419 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9421 Another (simpler) way to enable link-time optimization is:
9424 gcc -o myprog -flto -O2 foo.c bar.c
9427 The above generates bytecode for @file{foo.c} and @file{bar.c},
9428 merges them together into a single GIMPLE representation and optimizes
9429 them as usual to produce @file{myprog}.
9431 The only important thing to keep in mind is that to enable link-time
9432 optimizations you need to use the GCC driver to perform the link step.
9433 GCC then automatically performs link-time optimization if any of the
9434 objects involved were compiled with the @option{-flto} command-line option.
9436 should specify the optimization options to be used for link-time
9437 optimization though GCC tries to be clever at guessing an
9438 optimization level to use from the options used at compile time
9439 if you fail to specify one at link time. You can always override
9440 the automatic decision to do link-time optimization
9441 by passing @option{-fno-lto} to the link command.
9443 To make whole program optimization effective, it is necessary to make
9444 certain whole program assumptions. The compiler needs to know
9445 what functions and variables can be accessed by libraries and runtime
9446 outside of the link-time optimized unit. When supported by the linker,
9447 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9448 to the compiler about used and externally visible symbols. When
9449 the linker plugin is not available, @option{-fwhole-program} should be
9450 used to allow the compiler to make these assumptions, which leads
9451 to more aggressive optimization decisions.
9453 When @option{-fuse-linker-plugin} is not enabled, when a file is
9454 compiled with @option{-flto}, the generated object file is larger than
9455 a regular object file because it contains GIMPLE bytecodes and the usual
9456 final code (see @option{-ffat-lto-objects}. This means that
9457 object files with LTO information can be linked as normal object
9458 files; if @option{-fno-lto} is passed to the linker, no
9459 interprocedural optimizations are applied. Note that when
9460 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9461 but you cannot perform a regular, non-LTO link on them.
9463 Additionally, the optimization flags used to compile individual files
9464 are not necessarily related to those used at link time. For instance,
9467 gcc -c -O0 -ffat-lto-objects -flto foo.c
9468 gcc -c -O0 -ffat-lto-objects -flto bar.c
9469 gcc -o myprog -O3 foo.o bar.o
9472 This produces individual object files with unoptimized assembler
9473 code, but the resulting binary @file{myprog} is optimized at
9474 @option{-O3}. If, instead, the final binary is generated with
9475 @option{-fno-lto}, then @file{myprog} is not optimized.
9477 When producing the final binary, GCC only
9478 applies link-time optimizations to those files that contain bytecode.
9479 Therefore, you can mix and match object files and libraries with
9480 GIMPLE bytecodes and final object code. GCC automatically selects
9481 which files to optimize in LTO mode and which files to link without
9484 There are some code generation flags preserved by GCC when
9485 generating bytecodes, as they need to be used during the final link
9486 stage. Generally options specified at link time override those
9487 specified at compile time.
9489 If you do not specify an optimization level option @option{-O} at
9490 link time, then GCC uses the highest optimization level
9491 used when compiling the object files.
9493 Currently, the following options and their settings are taken from
9494 the first object file that explicitly specifies them:
9495 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9496 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9497 and all the @option{-m} target flags.
9499 Certain ABI-changing flags are required to match in all compilation units,
9500 and trying to override this at link time with a conflicting value
9501 is ignored. This includes options such as @option{-freg-struct-return}
9502 and @option{-fpcc-struct-return}.
9504 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9505 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9506 are passed through to the link stage and merged conservatively for
9507 conflicting translation units. Specifically
9508 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9509 precedence; and for example @option{-ffp-contract=off} takes precedence
9510 over @option{-ffp-contract=fast}. You can override them at link time.
9512 If LTO encounters objects with C linkage declared with incompatible
9513 types in separate translation units to be linked together (undefined
9514 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9515 issued. The behavior is still undefined at run time. Similar
9516 diagnostics may be raised for other languages.
9518 Another feature of LTO is that it is possible to apply interprocedural
9519 optimizations on files written in different languages:
9524 gfortran -c -flto baz.f90
9525 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9528 Notice that the final link is done with @command{g++} to get the C++
9529 runtime libraries and @option{-lgfortran} is added to get the Fortran
9530 runtime libraries. In general, when mixing languages in LTO mode, you
9531 should use the same link command options as when mixing languages in a
9532 regular (non-LTO) compilation.
9534 If object files containing GIMPLE bytecode are stored in a library archive, say
9535 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9536 are using a linker with plugin support. To create static libraries suitable
9537 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9538 and @command{ranlib};
9539 to show the symbols of object files with GIMPLE bytecode, use
9540 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9541 and @command{nm} have been compiled with plugin support. At link time, use the the
9542 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9543 the LTO optimization process:
9546 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9549 With the linker plugin enabled, the linker extracts the needed
9550 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9551 to make them part of the aggregated GIMPLE image to be optimized.
9553 If you are not using a linker with plugin support and/or do not
9554 enable the linker plugin, then the objects inside @file{libfoo.a}
9555 are extracted and linked as usual, but they do not participate
9556 in the LTO optimization process. In order to make a static library suitable
9557 for both LTO optimization and usual linkage, compile its object files with
9558 @option{-flto} @option{-ffat-lto-objects}.
9560 Link-time optimizations do not require the presence of the whole program to
9561 operate. If the program does not require any symbols to be exported, it is
9562 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9563 the interprocedural optimizers to use more aggressive assumptions which may
9564 lead to improved optimization opportunities.
9565 Use of @option{-fwhole-program} is not needed when linker plugin is
9566 active (see @option{-fuse-linker-plugin}).
9568 The current implementation of LTO makes no
9569 attempt to generate bytecode that is portable between different
9570 types of hosts. The bytecode files are versioned and there is a
9571 strict version check, so bytecode files generated in one version of
9572 GCC do not work with an older or newer version of GCC.
9574 Link-time optimization does not work well with generation of debugging
9575 information on systems other than those using a combination of ELF and
9578 If you specify the optional @var{n}, the optimization and code
9579 generation done at link time is executed in parallel using @var{n}
9580 parallel jobs by utilizing an installed @command{make} program. The
9581 environment variable @env{MAKE} may be used to override the program
9582 used. The default value for @var{n} is 1.
9584 You can also specify @option{-flto=jobserver} to use GNU make's
9585 job server mode to determine the number of parallel jobs. This
9586 is useful when the Makefile calling GCC is already executing in parallel.
9587 You must prepend a @samp{+} to the command recipe in the parent Makefile
9588 for this to work. This option likely only works if @env{MAKE} is
9591 @item -flto-partition=@var{alg}
9592 @opindex flto-partition
9593 Specify the partitioning algorithm used by the link-time optimizer.
9594 The value is either @samp{1to1} to specify a partitioning mirroring
9595 the original source files or @samp{balanced} to specify partitioning
9596 into equally sized chunks (whenever possible) or @samp{max} to create
9597 new partition for every symbol where possible. Specifying @samp{none}
9598 as an algorithm disables partitioning and streaming completely.
9599 The default value is @samp{balanced}. While @samp{1to1} can be used
9600 as an workaround for various code ordering issues, the @samp{max}
9601 partitioning is intended for internal testing only.
9602 The value @samp{one} specifies that exactly one partition should be
9603 used while the value @samp{none} bypasses partitioning and executes
9604 the link-time optimization step directly from the WPA phase.
9606 @item -flto-odr-type-merging
9607 @opindex flto-odr-type-merging
9608 Enable streaming of mangled types names of C++ types and their unification
9609 at link time. This increases size of LTO object files, but enables
9610 diagnostics about One Definition Rule violations.
9612 @item -flto-compression-level=@var{n}
9613 @opindex flto-compression-level
9614 This option specifies the level of compression used for intermediate
9615 language written to LTO object files, and is only meaningful in
9616 conjunction with LTO mode (@option{-flto}). Valid
9617 values are 0 (no compression) to 9 (maximum compression). Values
9618 outside this range are clamped to either 0 or 9. If the option is not
9619 given, a default balanced compression setting is used.
9621 @item -fuse-linker-plugin
9622 @opindex fuse-linker-plugin
9623 Enables the use of a linker plugin during link-time optimization. This
9624 option relies on plugin support in the linker, which is available in gold
9625 or in GNU ld 2.21 or newer.
9627 This option enables the extraction of object files with GIMPLE bytecode out
9628 of library archives. This improves the quality of optimization by exposing
9629 more code to the link-time optimizer. This information specifies what
9630 symbols can be accessed externally (by non-LTO object or during dynamic
9631 linking). Resulting code quality improvements on binaries (and shared
9632 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9633 See @option{-flto} for a description of the effect of this flag and how to
9636 This option is enabled by default when LTO support in GCC is enabled
9637 and GCC was configured for use with
9638 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9640 @item -ffat-lto-objects
9641 @opindex ffat-lto-objects
9642 Fat LTO objects are object files that contain both the intermediate language
9643 and the object code. This makes them usable for both LTO linking and normal
9644 linking. This option is effective only when compiling with @option{-flto}
9645 and is ignored at link time.
9647 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9648 requires the complete toolchain to be aware of LTO. It requires a linker with
9649 linker plugin support for basic functionality. Additionally,
9650 @command{nm}, @command{ar} and @command{ranlib}
9651 need to support linker plugins to allow a full-featured build environment
9652 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9653 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9654 to these tools. With non fat LTO makefiles need to be modified to use them.
9656 Note that modern binutils provide plugin auto-load mechanism.
9657 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
9658 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
9659 @command{gcc-ranlib}).
9661 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9664 @item -fcompare-elim
9665 @opindex fcompare-elim
9666 After register allocation and post-register allocation instruction splitting,
9667 identify arithmetic instructions that compute processor flags similar to a
9668 comparison operation based on that arithmetic. If possible, eliminate the
9669 explicit comparison operation.
9671 This pass only applies to certain targets that cannot explicitly represent
9672 the comparison operation before register allocation is complete.
9674 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9676 @item -fcprop-registers
9677 @opindex fcprop-registers
9678 After register allocation and post-register allocation instruction splitting,
9679 perform a copy-propagation pass to try to reduce scheduling dependencies
9680 and occasionally eliminate the copy.
9682 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9684 @item -fprofile-correction
9685 @opindex fprofile-correction
9686 Profiles collected using an instrumented binary for multi-threaded programs may
9687 be inconsistent due to missed counter updates. When this option is specified,
9688 GCC uses heuristics to correct or smooth out such inconsistencies. By
9689 default, GCC emits an error message when an inconsistent profile is detected.
9692 @itemx -fprofile-use=@var{path}
9693 @opindex fprofile-use
9694 Enable profile feedback-directed optimizations,
9695 and the following optimizations
9696 which are generally profitable only with profile feedback available:
9697 @option{-fbranch-probabilities}, @option{-fvpt},
9698 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9699 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9701 Before you can use this option, you must first generate profiling information.
9702 @xref{Instrumentation Options}, for information about the
9703 @option{-fprofile-generate} option.
9705 By default, GCC emits an error message if the feedback profiles do not
9706 match the source code. This error can be turned into a warning by using
9707 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9710 If @var{path} is specified, GCC looks at the @var{path} to find
9711 the profile feedback data files. See @option{-fprofile-dir}.
9713 @item -fauto-profile
9714 @itemx -fauto-profile=@var{path}
9715 @opindex fauto-profile
9716 Enable sampling-based feedback-directed optimizations,
9717 and the following optimizations
9718 which are generally profitable only with profile feedback available:
9719 @option{-fbranch-probabilities}, @option{-fvpt},
9720 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9721 @option{-ftree-vectorize},
9722 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9723 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9724 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9726 @var{path} is the name of a file containing AutoFDO profile information.
9727 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9729 Producing an AutoFDO profile data file requires running your program
9730 with the @command{perf} utility on a supported GNU/Linux target system.
9731 For more information, see @uref{https://perf.wiki.kernel.org/}.
9735 perf record -e br_inst_retired:near_taken -b -o perf.data \
9739 Then use the @command{create_gcov} tool to convert the raw profile data
9740 to a format that can be used by GCC.@ You must also supply the
9741 unstripped binary for your program to this tool.
9742 See @uref{https://github.com/google/autofdo}.
9746 create_gcov --binary=your_program.unstripped --profile=perf.data \
9751 The following options control compiler behavior regarding floating-point
9752 arithmetic. These options trade off between speed and
9753 correctness. All must be specifically enabled.
9757 @opindex ffloat-store
9758 Do not store floating-point variables in registers, and inhibit other
9759 options that might change whether a floating-point value is taken from a
9762 @cindex floating-point precision
9763 This option prevents undesirable excess precision on machines such as
9764 the 68000 where the floating registers (of the 68881) keep more
9765 precision than a @code{double} is supposed to have. Similarly for the
9766 x86 architecture. For most programs, the excess precision does only
9767 good, but a few programs rely on the precise definition of IEEE floating
9768 point. Use @option{-ffloat-store} for such programs, after modifying
9769 them to store all pertinent intermediate computations into variables.
9771 @item -fexcess-precision=@var{style}
9772 @opindex fexcess-precision
9773 This option allows further control over excess precision on machines
9774 where floating-point operations occur in a format with more precision or
9775 range than the IEEE standard and interchange floating-point types. By
9776 default, @option{-fexcess-precision=fast} is in effect; this means that
9777 operations may be carried out in a wider precision than the types specified
9778 in the source if that would result in faster code, and it is unpredictable
9779 when rounding to the types specified in the source code takes place.
9780 When compiling C, if @option{-fexcess-precision=standard} is specified then
9781 excess precision follows the rules specified in ISO C99; in particular,
9782 both casts and assignments cause values to be rounded to their
9783 semantic types (whereas @option{-ffloat-store} only affects
9784 assignments). This option is enabled by default for C if a strict
9785 conformance option such as @option{-std=c99} is used.
9786 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9787 regardless of whether a strict conformance option is used.
9790 @option{-fexcess-precision=standard} is not implemented for languages
9791 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9792 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9793 semantics apply without excess precision, and in the latter, rounding
9798 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9799 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9800 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9801 @option{-fexcess-precision=fast}.
9803 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9805 This option is not turned on by any @option{-O} option besides
9806 @option{-Ofast} since it can result in incorrect output for programs
9807 that depend on an exact implementation of IEEE or ISO rules/specifications
9808 for math functions. It may, however, yield faster code for programs
9809 that do not require the guarantees of these specifications.
9811 @item -fno-math-errno
9812 @opindex fno-math-errno
9813 Do not set @code{errno} after calling math functions that are executed
9814 with a single instruction, e.g., @code{sqrt}. A program that relies on
9815 IEEE exceptions for math error handling may want to use this flag
9816 for speed while maintaining IEEE arithmetic compatibility.
9818 This option is not turned on by any @option{-O} option since
9819 it can result in incorrect output for programs that depend on
9820 an exact implementation of IEEE or ISO rules/specifications for
9821 math functions. It may, however, yield faster code for programs
9822 that do not require the guarantees of these specifications.
9824 The default is @option{-fmath-errno}.
9826 On Darwin systems, the math library never sets @code{errno}. There is
9827 therefore no reason for the compiler to consider the possibility that
9828 it might, and @option{-fno-math-errno} is the default.
9830 @item -funsafe-math-optimizations
9831 @opindex funsafe-math-optimizations
9833 Allow optimizations for floating-point arithmetic that (a) assume
9834 that arguments and results are valid and (b) may violate IEEE or
9835 ANSI standards. When used at link time, it may include libraries
9836 or startup files that change the default FPU control word or other
9837 similar optimizations.
9839 This option is not turned on by any @option{-O} option since
9840 it can result in incorrect output for programs that depend on
9841 an exact implementation of IEEE or ISO rules/specifications for
9842 math functions. It may, however, yield faster code for programs
9843 that do not require the guarantees of these specifications.
9844 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9845 @option{-fassociative-math} and @option{-freciprocal-math}.
9847 The default is @option{-fno-unsafe-math-optimizations}.
9849 @item -fassociative-math
9850 @opindex fassociative-math
9852 Allow re-association of operands in series of floating-point operations.
9853 This violates the ISO C and C++ language standard by possibly changing
9854 computation result. NOTE: re-ordering may change the sign of zero as
9855 well as ignore NaNs and inhibit or create underflow or overflow (and
9856 thus cannot be used on code that relies on rounding behavior like
9857 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9858 and thus may not be used when ordered comparisons are required.
9859 This option requires that both @option{-fno-signed-zeros} and
9860 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9861 much sense with @option{-frounding-math}. For Fortran the option
9862 is automatically enabled when both @option{-fno-signed-zeros} and
9863 @option{-fno-trapping-math} are in effect.
9865 The default is @option{-fno-associative-math}.
9867 @item -freciprocal-math
9868 @opindex freciprocal-math
9870 Allow the reciprocal of a value to be used instead of dividing by
9871 the value if this enables optimizations. For example @code{x / y}
9872 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9873 is subject to common subexpression elimination. Note that this loses
9874 precision and increases the number of flops operating on the value.
9876 The default is @option{-fno-reciprocal-math}.
9878 @item -ffinite-math-only
9879 @opindex ffinite-math-only
9880 Allow optimizations for floating-point arithmetic that assume
9881 that arguments and results are not NaNs or +-Infs.
9883 This option is not turned on by any @option{-O} option since
9884 it can result in incorrect output for programs that depend on
9885 an exact implementation of IEEE or ISO rules/specifications for
9886 math functions. It may, however, yield faster code for programs
9887 that do not require the guarantees of these specifications.
9889 The default is @option{-fno-finite-math-only}.
9891 @item -fno-signed-zeros
9892 @opindex fno-signed-zeros
9893 Allow optimizations for floating-point arithmetic that ignore the
9894 signedness of zero. IEEE arithmetic specifies the behavior of
9895 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9896 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9897 This option implies that the sign of a zero result isn't significant.
9899 The default is @option{-fsigned-zeros}.
9901 @item -fno-trapping-math
9902 @opindex fno-trapping-math
9903 Compile code assuming that floating-point operations cannot generate
9904 user-visible traps. These traps include division by zero, overflow,
9905 underflow, inexact result and invalid operation. This option requires
9906 that @option{-fno-signaling-nans} be in effect. Setting this option may
9907 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9909 This option should never be turned on by any @option{-O} option since
9910 it can result in incorrect output for programs that depend on
9911 an exact implementation of IEEE or ISO rules/specifications for
9914 The default is @option{-ftrapping-math}.
9916 @item -frounding-math
9917 @opindex frounding-math
9918 Disable transformations and optimizations that assume default floating-point
9919 rounding behavior. This is round-to-zero for all floating point
9920 to integer conversions, and round-to-nearest for all other arithmetic
9921 truncations. This option should be specified for programs that change
9922 the FP rounding mode dynamically, or that may be executed with a
9923 non-default rounding mode. This option disables constant folding of
9924 floating-point expressions at compile time (which may be affected by
9925 rounding mode) and arithmetic transformations that are unsafe in the
9926 presence of sign-dependent rounding modes.
9928 The default is @option{-fno-rounding-math}.
9930 This option is experimental and does not currently guarantee to
9931 disable all GCC optimizations that are affected by rounding mode.
9932 Future versions of GCC may provide finer control of this setting
9933 using C99's @code{FENV_ACCESS} pragma. This command-line option
9934 will be used to specify the default state for @code{FENV_ACCESS}.
9936 @item -fsignaling-nans
9937 @opindex fsignaling-nans
9938 Compile code assuming that IEEE signaling NaNs may generate user-visible
9939 traps during floating-point operations. Setting this option disables
9940 optimizations that may change the number of exceptions visible with
9941 signaling NaNs. This option implies @option{-ftrapping-math}.
9943 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9946 The default is @option{-fno-signaling-nans}.
9948 This option is experimental and does not currently guarantee to
9949 disable all GCC optimizations that affect signaling NaN behavior.
9951 @item -fno-fp-int-builtin-inexact
9952 @opindex fno-fp-int-builtin-inexact
9953 Do not allow the built-in functions @code{ceil}, @code{floor},
9954 @code{round} and @code{trunc}, and their @code{float} and @code{long
9955 double} variants, to generate code that raises the ``inexact''
9956 floating-point exception for noninteger arguments. ISO C99 and C11
9957 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9958 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9961 The default is @option{-ffp-int-builtin-inexact}, allowing the
9962 exception to be raised. This option does nothing unless
9963 @option{-ftrapping-math} is in effect.
9965 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9966 generate a call to a library function then the ``inexact'' exception
9967 may be raised if the library implementation does not follow TS 18661.
9969 @item -fsingle-precision-constant
9970 @opindex fsingle-precision-constant
9971 Treat floating-point constants as single precision instead of
9972 implicitly converting them to double-precision constants.
9974 @item -fcx-limited-range
9975 @opindex fcx-limited-range
9976 When enabled, this option states that a range reduction step is not
9977 needed when performing complex division. Also, there is no checking
9978 whether the result of a complex multiplication or division is @code{NaN
9979 + I*NaN}, with an attempt to rescue the situation in that case. The
9980 default is @option{-fno-cx-limited-range}, but is enabled by
9981 @option{-ffast-math}.
9983 This option controls the default setting of the ISO C99
9984 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9987 @item -fcx-fortran-rules
9988 @opindex fcx-fortran-rules
9989 Complex multiplication and division follow Fortran rules. Range
9990 reduction is done as part of complex division, but there is no checking
9991 whether the result of a complex multiplication or division is @code{NaN
9992 + I*NaN}, with an attempt to rescue the situation in that case.
9994 The default is @option{-fno-cx-fortran-rules}.
9998 The following options control optimizations that may improve
9999 performance, but are not enabled by any @option{-O} options. This
10000 section includes experimental options that may produce broken code.
10003 @item -fbranch-probabilities
10004 @opindex fbranch-probabilities
10005 After running a program compiled with @option{-fprofile-arcs}
10006 (@pxref{Instrumentation Options}),
10007 you can compile it a second time using
10008 @option{-fbranch-probabilities}, to improve optimizations based on
10009 the number of times each branch was taken. When a program
10010 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10011 counts to a file called @file{@var{sourcename}.gcda} for each source
10012 file. The information in this data file is very dependent on the
10013 structure of the generated code, so you must use the same source code
10014 and the same optimization options for both compilations.
10016 With @option{-fbranch-probabilities}, GCC puts a
10017 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10018 These can be used to improve optimization. Currently, they are only
10019 used in one place: in @file{reorg.c}, instead of guessing which path a
10020 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10021 exactly determine which path is taken more often.
10023 @item -fprofile-values
10024 @opindex fprofile-values
10025 If combined with @option{-fprofile-arcs}, it adds code so that some
10026 data about values of expressions in the program is gathered.
10028 With @option{-fbranch-probabilities}, it reads back the data gathered
10029 from profiling values of expressions for usage in optimizations.
10031 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10033 @item -fprofile-reorder-functions
10034 @opindex fprofile-reorder-functions
10035 Function reordering based on profile instrumentation collects
10036 first time of execution of a function and orders these functions
10037 in ascending order.
10039 Enabled with @option{-fprofile-use}.
10043 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10044 to add code to gather information about values of expressions.
10046 With @option{-fbranch-probabilities}, it reads back the data gathered
10047 and actually performs the optimizations based on them.
10048 Currently the optimizations include specialization of division operations
10049 using the knowledge about the value of the denominator.
10051 @item -frename-registers
10052 @opindex frename-registers
10053 Attempt to avoid false dependencies in scheduled code by making use
10054 of registers left over after register allocation. This optimization
10055 most benefits processors with lots of registers. Depending on the
10056 debug information format adopted by the target, however, it can
10057 make debugging impossible, since variables no longer stay in
10058 a ``home register''.
10060 Enabled by default with @option{-funroll-loops}.
10062 @item -fschedule-fusion
10063 @opindex fschedule-fusion
10064 Performs a target dependent pass over the instruction stream to schedule
10065 instructions of same type together because target machine can execute them
10066 more efficiently if they are adjacent to each other in the instruction flow.
10068 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10072 Perform tail duplication to enlarge superblock size. This transformation
10073 simplifies the control flow of the function allowing other optimizations to do
10076 Enabled with @option{-fprofile-use}.
10078 @item -funroll-loops
10079 @opindex funroll-loops
10080 Unroll loops whose number of iterations can be determined at compile time or
10081 upon entry to the loop. @option{-funroll-loops} implies
10082 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10083 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10084 a small constant number of iterations). This option makes code larger, and may
10085 or may not make it run faster.
10087 Enabled with @option{-fprofile-use}.
10089 @item -funroll-all-loops
10090 @opindex funroll-all-loops
10091 Unroll all loops, even if their number of iterations is uncertain when
10092 the loop is entered. This usually makes programs run more slowly.
10093 @option{-funroll-all-loops} implies the same options as
10094 @option{-funroll-loops}.
10097 @opindex fpeel-loops
10098 Peels loops for which there is enough information that they do not
10099 roll much (from profile feedback or static analysis). It also turns on
10100 complete loop peeling (i.e.@: complete removal of loops with small constant
10101 number of iterations).
10103 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10105 @item -fmove-loop-invariants
10106 @opindex fmove-loop-invariants
10107 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10108 at level @option{-O1}
10110 @item -fsplit-loops
10111 @opindex fsplit-loops
10112 Split a loop into two if it contains a condition that's always true
10113 for one side of the iteration space and false for the other.
10115 @item -funswitch-loops
10116 @opindex funswitch-loops
10117 Move branches with loop invariant conditions out of the loop, with duplicates
10118 of the loop on both branches (modified according to result of the condition).
10120 @item -ffunction-sections
10121 @itemx -fdata-sections
10122 @opindex ffunction-sections
10123 @opindex fdata-sections
10124 Place each function or data item into its own section in the output
10125 file if the target supports arbitrary sections. The name of the
10126 function or the name of the data item determines the section's name
10127 in the output file.
10129 Use these options on systems where the linker can perform optimizations to
10130 improve locality of reference in the instruction space. Most systems using the
10131 ELF object format have linkers with such optimizations. On AIX, the linker
10132 rearranges sections (CSECTs) based on the call graph. The performance impact
10135 Together with a linker garbage collection (linker @option{--gc-sections}
10136 option) these options may lead to smaller statically-linked executables (after
10139 On ELF/DWARF systems these options do not degenerate the quality of the debug
10140 information. There could be issues with other object files/debug info formats.
10142 Only use these options when there are significant benefits from doing so. When
10143 you specify these options, the assembler and linker create larger object and
10144 executable files and are also slower. These options affect code generation.
10145 They prevent optimizations by the compiler and assembler using relative
10146 locations inside a translation unit since the locations are unknown until
10147 link time. An example of such an optimization is relaxing calls to short call
10150 @item -fbranch-target-load-optimize
10151 @opindex fbranch-target-load-optimize
10152 Perform branch target register load optimization before prologue / epilogue
10154 The use of target registers can typically be exposed only during reload,
10155 thus hoisting loads out of loops and doing inter-block scheduling needs
10156 a separate optimization pass.
10158 @item -fbranch-target-load-optimize2
10159 @opindex fbranch-target-load-optimize2
10160 Perform branch target register load optimization after prologue / epilogue
10163 @item -fbtr-bb-exclusive
10164 @opindex fbtr-bb-exclusive
10165 When performing branch target register load optimization, don't reuse
10166 branch target registers within any basic block.
10169 @opindex fstdarg-opt
10170 Optimize the prologue of variadic argument functions with respect to usage of
10173 @item -fsection-anchors
10174 @opindex fsection-anchors
10175 Try to reduce the number of symbolic address calculations by using
10176 shared ``anchor'' symbols to address nearby objects. This transformation
10177 can help to reduce the number of GOT entries and GOT accesses on some
10180 For example, the implementation of the following function @code{foo}:
10183 static int a, b, c;
10184 int foo (void) @{ return a + b + c; @}
10188 usually calculates the addresses of all three variables, but if you
10189 compile it with @option{-fsection-anchors}, it accesses the variables
10190 from a common anchor point instead. The effect is similar to the
10191 following pseudocode (which isn't valid C):
10196 register int *xr = &x;
10197 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10201 Not all targets support this option.
10203 @item --param @var{name}=@var{value}
10205 In some places, GCC uses various constants to control the amount of
10206 optimization that is done. For example, GCC does not inline functions
10207 that contain more than a certain number of instructions. You can
10208 control some of these constants on the command line using the
10209 @option{--param} option.
10211 The names of specific parameters, and the meaning of the values, are
10212 tied to the internals of the compiler, and are subject to change
10213 without notice in future releases.
10215 In each case, the @var{value} is an integer. The allowable choices for
10219 @item predictable-branch-outcome
10220 When branch is predicted to be taken with probability lower than this threshold
10221 (in percent), then it is considered well predictable. The default is 10.
10223 @item max-rtl-if-conversion-insns
10224 RTL if-conversion tries to remove conditional branches around a block and
10225 replace them with conditionally executed instructions. This parameter
10226 gives the maximum number of instructions in a block which should be
10227 considered for if-conversion. The default is 10, though the compiler will
10228 also use other heuristics to decide whether if-conversion is likely to be
10231 @item max-rtl-if-conversion-predictable-cost
10232 @itemx max-rtl-if-conversion-unpredictable-cost
10233 RTL if-conversion will try to remove conditional branches around a block
10234 and replace them with conditionally executed instructions. These parameters
10235 give the maximum permissible cost for the sequence that would be generated
10236 by if-conversion depending on whether the branch is statically determined
10237 to be predictable or not. The units for this parameter are the same as
10238 those for the GCC internal seq_cost metric. The compiler will try to
10239 provide a reasonable default for this parameter using the BRANCH_COST
10242 @item max-crossjump-edges
10243 The maximum number of incoming edges to consider for cross-jumping.
10244 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10245 the number of edges incoming to each block. Increasing values mean
10246 more aggressive optimization, making the compilation time increase with
10247 probably small improvement in executable size.
10249 @item min-crossjump-insns
10250 The minimum number of instructions that must be matched at the end
10251 of two blocks before cross-jumping is performed on them. This
10252 value is ignored in the case where all instructions in the block being
10253 cross-jumped from are matched. The default value is 5.
10255 @item max-grow-copy-bb-insns
10256 The maximum code size expansion factor when copying basic blocks
10257 instead of jumping. The expansion is relative to a jump instruction.
10258 The default value is 8.
10260 @item max-goto-duplication-insns
10261 The maximum number of instructions to duplicate to a block that jumps
10262 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10263 passes, GCC factors computed gotos early in the compilation process,
10264 and unfactors them as late as possible. Only computed jumps at the
10265 end of a basic blocks with no more than max-goto-duplication-insns are
10266 unfactored. The default value is 8.
10268 @item max-delay-slot-insn-search
10269 The maximum number of instructions to consider when looking for an
10270 instruction to fill a delay slot. If more than this arbitrary number of
10271 instructions are searched, the time savings from filling the delay slot
10272 are minimal, so stop searching. Increasing values mean more
10273 aggressive optimization, making the compilation time increase with probably
10274 small improvement in execution time.
10276 @item max-delay-slot-live-search
10277 When trying to fill delay slots, the maximum number of instructions to
10278 consider when searching for a block with valid live register
10279 information. Increasing this arbitrarily chosen value means more
10280 aggressive optimization, increasing the compilation time. This parameter
10281 should be removed when the delay slot code is rewritten to maintain the
10282 control-flow graph.
10284 @item max-gcse-memory
10285 The approximate maximum amount of memory that can be allocated in
10286 order to perform the global common subexpression elimination
10287 optimization. If more memory than specified is required, the
10288 optimization is not done.
10290 @item max-gcse-insertion-ratio
10291 If the ratio of expression insertions to deletions is larger than this value
10292 for any expression, then RTL PRE inserts or removes the expression and thus
10293 leaves partially redundant computations in the instruction stream. The default value is 20.
10295 @item max-pending-list-length
10296 The maximum number of pending dependencies scheduling allows
10297 before flushing the current state and starting over. Large functions
10298 with few branches or calls can create excessively large lists which
10299 needlessly consume memory and resources.
10301 @item max-modulo-backtrack-attempts
10302 The maximum number of backtrack attempts the scheduler should make
10303 when modulo scheduling a loop. Larger values can exponentially increase
10306 @item max-inline-insns-single
10307 Several parameters control the tree inliner used in GCC@.
10308 This number sets the maximum number of instructions (counted in GCC's
10309 internal representation) in a single function that the tree inliner
10310 considers for inlining. This only affects functions declared
10311 inline and methods implemented in a class declaration (C++).
10312 The default value is 400.
10314 @item max-inline-insns-auto
10315 When you use @option{-finline-functions} (included in @option{-O3}),
10316 a lot of functions that would otherwise not be considered for inlining
10317 by the compiler are investigated. To those functions, a different
10318 (more restrictive) limit compared to functions declared inline can
10320 The default value is 30.
10322 @item inline-min-speedup
10323 When estimated performance improvement of caller + callee runtime exceeds this
10324 threshold (in percent), the function can be inlined regardless of the limit on
10325 @option{--param max-inline-insns-single} and @option{--param
10326 max-inline-insns-auto}.
10327 The default value is 15.
10329 @item large-function-insns
10330 The limit specifying really large functions. For functions larger than this
10331 limit after inlining, inlining is constrained by
10332 @option{--param large-function-growth}. This parameter is useful primarily
10333 to avoid extreme compilation time caused by non-linear algorithms used by the
10335 The default value is 2700.
10337 @item large-function-growth
10338 Specifies maximal growth of large function caused by inlining in percents.
10339 The default value is 100 which limits large function growth to 2.0 times
10342 @item large-unit-insns
10343 The limit specifying large translation unit. Growth caused by inlining of
10344 units larger than this limit is limited by @option{--param inline-unit-growth}.
10345 For small units this might be too tight.
10346 For example, consider a unit consisting of function A
10347 that is inline and B that just calls A three times. If B is small relative to
10348 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10349 large units consisting of small inlineable functions, however, the overall unit
10350 growth limit is needed to avoid exponential explosion of code size. Thus for
10351 smaller units, the size is increased to @option{--param large-unit-insns}
10352 before applying @option{--param inline-unit-growth}. The default is 10000.
10354 @item inline-unit-growth
10355 Specifies maximal overall growth of the compilation unit caused by inlining.
10356 The default value is 20 which limits unit growth to 1.2 times the original
10357 size. Cold functions (either marked cold via an attribute or by profile
10358 feedback) are not accounted into the unit size.
10360 @item ipcp-unit-growth
10361 Specifies maximal overall growth of the compilation unit caused by
10362 interprocedural constant propagation. The default value is 10 which limits
10363 unit growth to 1.1 times the original size.
10365 @item large-stack-frame
10366 The limit specifying large stack frames. While inlining the algorithm is trying
10367 to not grow past this limit too much. The default value is 256 bytes.
10369 @item large-stack-frame-growth
10370 Specifies maximal growth of large stack frames caused by inlining in percents.
10371 The default value is 1000 which limits large stack frame growth to 11 times
10374 @item max-inline-insns-recursive
10375 @itemx max-inline-insns-recursive-auto
10376 Specifies the maximum number of instructions an out-of-line copy of a
10377 self-recursive inline
10378 function can grow into by performing recursive inlining.
10380 @option{--param max-inline-insns-recursive} applies to functions
10382 For functions not declared inline, recursive inlining
10383 happens only when @option{-finline-functions} (included in @option{-O3}) is
10384 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10385 default value is 450.
10387 @item max-inline-recursive-depth
10388 @itemx max-inline-recursive-depth-auto
10389 Specifies the maximum recursion depth used for recursive inlining.
10391 @option{--param max-inline-recursive-depth} applies to functions
10392 declared inline. For functions not declared inline, recursive inlining
10393 happens only when @option{-finline-functions} (included in @option{-O3}) is
10394 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10395 default value is 8.
10397 @item min-inline-recursive-probability
10398 Recursive inlining is profitable only for function having deep recursion
10399 in average and can hurt for function having little recursion depth by
10400 increasing the prologue size or complexity of function body to other
10403 When profile feedback is available (see @option{-fprofile-generate}) the actual
10404 recursion depth can be guessed from the probability that function recurses
10405 via a given call expression. This parameter limits inlining only to call
10406 expressions whose probability exceeds the given threshold (in percents).
10407 The default value is 10.
10409 @item early-inlining-insns
10410 Specify growth that the early inliner can make. In effect it increases
10411 the amount of inlining for code having a large abstraction penalty.
10412 The default value is 14.
10414 @item max-early-inliner-iterations
10415 Limit of iterations of the early inliner. This basically bounds
10416 the number of nested indirect calls the early inliner can resolve.
10417 Deeper chains are still handled by late inlining.
10419 @item comdat-sharing-probability
10420 Probability (in percent) that C++ inline function with comdat visibility
10421 are shared across multiple compilation units. The default value is 20.
10423 @item profile-func-internal-id
10424 A parameter to control whether to use function internal id in profile
10425 database lookup. If the value is 0, the compiler uses an id that
10426 is based on function assembler name and filename, which makes old profile
10427 data more tolerant to source changes such as function reordering etc.
10428 The default value is 0.
10430 @item min-vect-loop-bound
10431 The minimum number of iterations under which loops are not vectorized
10432 when @option{-ftree-vectorize} is used. The number of iterations after
10433 vectorization needs to be greater than the value specified by this option
10434 to allow vectorization. The default value is 0.
10436 @item gcse-cost-distance-ratio
10437 Scaling factor in calculation of maximum distance an expression
10438 can be moved by GCSE optimizations. This is currently supported only in the
10439 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10440 is with simple expressions, i.e., the expressions that have cost
10441 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10442 hoisting of simple expressions. The default value is 10.
10444 @item gcse-unrestricted-cost
10445 Cost, roughly measured as the cost of a single typical machine
10446 instruction, at which GCSE optimizations do not constrain
10447 the distance an expression can travel. This is currently
10448 supported only in the code hoisting pass. The lesser the cost,
10449 the more aggressive code hoisting is. Specifying 0
10450 allows all expressions to travel unrestricted distances.
10451 The default value is 3.
10453 @item max-hoist-depth
10454 The depth of search in the dominator tree for expressions to hoist.
10455 This is used to avoid quadratic behavior in hoisting algorithm.
10456 The value of 0 does not limit on the search, but may slow down compilation
10457 of huge functions. The default value is 30.
10459 @item max-tail-merge-comparisons
10460 The maximum amount of similar bbs to compare a bb with. This is used to
10461 avoid quadratic behavior in tree tail merging. The default value is 10.
10463 @item max-tail-merge-iterations
10464 The maximum amount of iterations of the pass over the function. This is used to
10465 limit compilation time in tree tail merging. The default value is 2.
10467 @item store-merging-allow-unaligned
10468 Allow the store merging pass to introduce unaligned stores if it is legal to
10469 do so. The default value is 1.
10471 @item max-stores-to-merge
10472 The maximum number of stores to attempt to merge into wider stores in the store
10473 merging pass. The minimum value is 2 and the default is 64.
10475 @item max-unrolled-insns
10476 The maximum number of instructions that a loop may have to be unrolled.
10477 If a loop is unrolled, this parameter also determines how many times
10478 the loop code is unrolled.
10480 @item max-average-unrolled-insns
10481 The maximum number of instructions biased by probabilities of their execution
10482 that a loop may have to be unrolled. If a loop is unrolled,
10483 this parameter also determines how many times the loop code is unrolled.
10485 @item max-unroll-times
10486 The maximum number of unrollings of a single loop.
10488 @item max-peeled-insns
10489 The maximum number of instructions that a loop may have to be peeled.
10490 If a loop is peeled, this parameter also determines how many times
10491 the loop code is peeled.
10493 @item max-peel-times
10494 The maximum number of peelings of a single loop.
10496 @item max-peel-branches
10497 The maximum number of branches on the hot path through the peeled sequence.
10499 @item max-completely-peeled-insns
10500 The maximum number of insns of a completely peeled loop.
10502 @item max-completely-peel-times
10503 The maximum number of iterations of a loop to be suitable for complete peeling.
10505 @item max-completely-peel-loop-nest-depth
10506 The maximum depth of a loop nest suitable for complete peeling.
10508 @item max-unswitch-insns
10509 The maximum number of insns of an unswitched loop.
10511 @item max-unswitch-level
10512 The maximum number of branches unswitched in a single loop.
10514 @item max-loop-headers-insns
10515 The maximum number of insns in loop header duplicated by the copy loop headers
10518 @item lim-expensive
10519 The minimum cost of an expensive expression in the loop invariant motion.
10521 @item iv-consider-all-candidates-bound
10522 Bound on number of candidates for induction variables, below which
10523 all candidates are considered for each use in induction variable
10524 optimizations. If there are more candidates than this,
10525 only the most relevant ones are considered to avoid quadratic time complexity.
10527 @item iv-max-considered-uses
10528 The induction variable optimizations give up on loops that contain more
10529 induction variable uses.
10531 @item iv-always-prune-cand-set-bound
10532 If the number of candidates in the set is smaller than this value,
10533 always try to remove unnecessary ivs from the set
10534 when adding a new one.
10536 @item avg-loop-niter
10537 Average number of iterations of a loop.
10539 @item dse-max-object-size
10540 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10541 Larger values may result in larger compilation times.
10543 @item dse-max-alias-queries-per-store
10544 Maximum number of queries into the alias oracle per store.
10545 Larger values result in larger compilation times and may result in more
10546 removed dead stores.
10548 @item scev-max-expr-size
10549 Bound on size of expressions used in the scalar evolutions analyzer.
10550 Large expressions slow the analyzer.
10552 @item scev-max-expr-complexity
10553 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10554 Complex expressions slow the analyzer.
10556 @item max-tree-if-conversion-phi-args
10557 Maximum number of arguments in a PHI supported by TREE if conversion
10558 unless the loop is marked with simd pragma.
10560 @item vect-max-version-for-alignment-checks
10561 The maximum number of run-time checks that can be performed when
10562 doing loop versioning for alignment in the vectorizer.
10564 @item vect-max-version-for-alias-checks
10565 The maximum number of run-time checks that can be performed when
10566 doing loop versioning for alias in the vectorizer.
10568 @item vect-max-peeling-for-alignment
10569 The maximum number of loop peels to enhance access alignment
10570 for vectorizer. Value -1 means no limit.
10572 @item max-iterations-to-track
10573 The maximum number of iterations of a loop the brute-force algorithm
10574 for analysis of the number of iterations of the loop tries to evaluate.
10576 @item hot-bb-count-ws-permille
10577 A basic block profile count is considered hot if it contributes to
10578 the given permillage (i.e. 0...1000) of the entire profiled execution.
10580 @item hot-bb-frequency-fraction
10581 Select fraction of the entry block frequency of executions of basic block in
10582 function given basic block needs to have to be considered hot.
10584 @item max-predicted-iterations
10585 The maximum number of loop iterations we predict statically. This is useful
10586 in cases where a function contains a single loop with known bound and
10587 another loop with unknown bound.
10588 The known number of iterations is predicted correctly, while
10589 the unknown number of iterations average to roughly 10. This means that the
10590 loop without bounds appears artificially cold relative to the other one.
10592 @item builtin-expect-probability
10593 Control the probability of the expression having the specified value. This
10594 parameter takes a percentage (i.e. 0 ... 100) as input.
10595 The default probability of 90 is obtained empirically.
10597 @item align-threshold
10599 Select fraction of the maximal frequency of executions of a basic block in
10600 a function to align the basic block.
10602 @item align-loop-iterations
10604 A loop expected to iterate at least the selected number of iterations is
10607 @item tracer-dynamic-coverage
10608 @itemx tracer-dynamic-coverage-feedback
10610 This value is used to limit superblock formation once the given percentage of
10611 executed instructions is covered. This limits unnecessary code size
10614 The @option{tracer-dynamic-coverage-feedback} parameter
10615 is used only when profile
10616 feedback is available. The real profiles (as opposed to statically estimated
10617 ones) are much less balanced allowing the threshold to be larger value.
10619 @item tracer-max-code-growth
10620 Stop tail duplication once code growth has reached given percentage. This is
10621 a rather artificial limit, as most of the duplicates are eliminated later in
10622 cross jumping, so it may be set to much higher values than is the desired code
10625 @item tracer-min-branch-ratio
10627 Stop reverse growth when the reverse probability of best edge is less than this
10628 threshold (in percent).
10630 @item tracer-min-branch-probability
10631 @itemx tracer-min-branch-probability-feedback
10633 Stop forward growth if the best edge has probability lower than this
10636 Similarly to @option{tracer-dynamic-coverage} two parameters are
10637 provided. @option{tracer-min-branch-probability-feedback} is used for
10638 compilation with profile feedback and @option{tracer-min-branch-probability}
10639 compilation without. The value for compilation with profile feedback
10640 needs to be more conservative (higher) in order to make tracer
10643 @item stack-clash-protection-guard-size
10644 Specify the size of the operating system provided stack guard as
10645 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10646 Acceptable values are between 12 and 30. Higher values may reduce the
10647 number of explicit probes, but a value larger than the operating system
10648 provided guard will leave code vulnerable to stack clash style attacks.
10650 @item stack-clash-protection-probe-interval
10651 Stack clash protection involves probing stack space as it is allocated. This
10652 param controls the maximum distance between probes into the stack as 2 raised
10653 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10654 12. Higher values may reduce the number of explicit probes, but a value
10655 larger than the operating system provided guard will leave code vulnerable to
10656 stack clash style attacks.
10658 @item max-cse-path-length
10660 The maximum number of basic blocks on path that CSE considers.
10663 @item max-cse-insns
10664 The maximum number of instructions CSE processes before flushing.
10665 The default is 1000.
10667 @item ggc-min-expand
10669 GCC uses a garbage collector to manage its own memory allocation. This
10670 parameter specifies the minimum percentage by which the garbage
10671 collector's heap should be allowed to expand between collections.
10672 Tuning this may improve compilation speed; it has no effect on code
10675 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10676 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10677 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10678 GCC is not able to calculate RAM on a particular platform, the lower
10679 bound of 30% is used. Setting this parameter and
10680 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10681 every opportunity. This is extremely slow, but can be useful for
10684 @item ggc-min-heapsize
10686 Minimum size of the garbage collector's heap before it begins bothering
10687 to collect garbage. The first collection occurs after the heap expands
10688 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10689 tuning this may improve compilation speed, and has no effect on code
10692 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10693 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10694 with a lower bound of 4096 (four megabytes) and an upper bound of
10695 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10696 particular platform, the lower bound is used. Setting this parameter
10697 very large effectively disables garbage collection. Setting this
10698 parameter and @option{ggc-min-expand} to zero causes a full collection
10699 to occur at every opportunity.
10701 @item max-reload-search-insns
10702 The maximum number of instruction reload should look backward for equivalent
10703 register. Increasing values mean more aggressive optimization, making the
10704 compilation time increase with probably slightly better performance.
10705 The default value is 100.
10707 @item max-cselib-memory-locations
10708 The maximum number of memory locations cselib should take into account.
10709 Increasing values mean more aggressive optimization, making the compilation time
10710 increase with probably slightly better performance. The default value is 500.
10712 @item max-sched-ready-insns
10713 The maximum number of instructions ready to be issued the scheduler should
10714 consider at any given time during the first scheduling pass. Increasing
10715 values mean more thorough searches, making the compilation time increase
10716 with probably little benefit. The default value is 100.
10718 @item max-sched-region-blocks
10719 The maximum number of blocks in a region to be considered for
10720 interblock scheduling. The default value is 10.
10722 @item max-pipeline-region-blocks
10723 The maximum number of blocks in a region to be considered for
10724 pipelining in the selective scheduler. The default value is 15.
10726 @item max-sched-region-insns
10727 The maximum number of insns in a region to be considered for
10728 interblock scheduling. The default value is 100.
10730 @item max-pipeline-region-insns
10731 The maximum number of insns in a region to be considered for
10732 pipelining in the selective scheduler. The default value is 200.
10734 @item min-spec-prob
10735 The minimum probability (in percents) of reaching a source block
10736 for interblock speculative scheduling. The default value is 40.
10738 @item max-sched-extend-regions-iters
10739 The maximum number of iterations through CFG to extend regions.
10740 A value of 0 (the default) disables region extensions.
10742 @item max-sched-insn-conflict-delay
10743 The maximum conflict delay for an insn to be considered for speculative motion.
10744 The default value is 3.
10746 @item sched-spec-prob-cutoff
10747 The minimal probability of speculation success (in percents), so that
10748 speculative insns are scheduled.
10749 The default value is 40.
10751 @item sched-state-edge-prob-cutoff
10752 The minimum probability an edge must have for the scheduler to save its
10754 The default value is 10.
10756 @item sched-mem-true-dep-cost
10757 Minimal distance (in CPU cycles) between store and load targeting same
10758 memory locations. The default value is 1.
10760 @item selsched-max-lookahead
10761 The maximum size of the lookahead window of selective scheduling. It is a
10762 depth of search for available instructions.
10763 The default value is 50.
10765 @item selsched-max-sched-times
10766 The maximum number of times that an instruction is scheduled during
10767 selective scheduling. This is the limit on the number of iterations
10768 through which the instruction may be pipelined. The default value is 2.
10770 @item selsched-insns-to-rename
10771 The maximum number of best instructions in the ready list that are considered
10772 for renaming in the selective scheduler. The default value is 2.
10775 The minimum value of stage count that swing modulo scheduler
10776 generates. The default value is 2.
10778 @item max-last-value-rtl
10779 The maximum size measured as number of RTLs that can be recorded in an expression
10780 in combiner for a pseudo register as last known value of that register. The default
10783 @item max-combine-insns
10784 The maximum number of instructions the RTL combiner tries to combine.
10785 The default value is 2 at @option{-Og} and 4 otherwise.
10787 @item integer-share-limit
10788 Small integer constants can use a shared data structure, reducing the
10789 compiler's memory usage and increasing its speed. This sets the maximum
10790 value of a shared integer constant. The default value is 256.
10792 @item ssp-buffer-size
10793 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10794 protection when @option{-fstack-protection} is used.
10796 @item min-size-for-stack-sharing
10797 The minimum size of variables taking part in stack slot sharing when not
10798 optimizing. The default value is 32.
10800 @item max-jump-thread-duplication-stmts
10801 Maximum number of statements allowed in a block that needs to be
10802 duplicated when threading jumps.
10804 @item max-fields-for-field-sensitive
10805 Maximum number of fields in a structure treated in
10806 a field sensitive manner during pointer analysis. The default is zero
10807 for @option{-O0} and @option{-O1},
10808 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10810 @item prefetch-latency
10811 Estimate on average number of instructions that are executed before
10812 prefetch finishes. The distance prefetched ahead is proportional
10813 to this constant. Increasing this number may also lead to less
10814 streams being prefetched (see @option{simultaneous-prefetches}).
10816 @item simultaneous-prefetches
10817 Maximum number of prefetches that can run at the same time.
10819 @item l1-cache-line-size
10820 The size of cache line in L1 cache, in bytes.
10822 @item l1-cache-size
10823 The size of L1 cache, in kilobytes.
10825 @item l2-cache-size
10826 The size of L2 cache, in kilobytes.
10828 @item prefetch-dynamic-strides
10829 Whether the loop array prefetch pass should issue software prefetch hints
10830 for strides that are non-constant. In some cases this may be
10831 beneficial, though the fact the stride is non-constant may make it
10832 hard to predict when there is clear benefit to issuing these hints.
10834 Set to 1, the default, if the prefetch hints should be issued for non-constant
10835 strides. Set to 0 if prefetch hints should be issued only for strides that
10836 are known to be constant and below @option{prefetch-minimum-stride}.
10838 @item prefetch-minimum-stride
10839 Minimum constant stride, in bytes, to start using prefetch hints for. If
10840 the stride is less than this threshold, prefetch hints will not be issued.
10842 This setting is useful for processors that have hardware prefetchers, in
10843 which case there may be conflicts between the hardware prefetchers and
10844 the software prefetchers. If the hardware prefetchers have a maximum
10845 stride they can handle, it should be used here to improve the use of
10846 software prefetchers.
10848 A value of -1, the default, means we don't have a threshold and therefore
10849 prefetch hints can be issued for any constant stride.
10851 This setting is only useful for strides that are known and constant.
10853 @item loop-interchange-max-num-stmts
10854 The maximum number of stmts in a loop to be interchanged.
10856 @item loop-interchange-stride-ratio
10857 The minimum ratio between stride of two loops for interchange to be profitable.
10859 @item min-insn-to-prefetch-ratio
10860 The minimum ratio between the number of instructions and the
10861 number of prefetches to enable prefetching in a loop.
10863 @item prefetch-min-insn-to-mem-ratio
10864 The minimum ratio between the number of instructions and the
10865 number of memory references to enable prefetching in a loop.
10867 @item use-canonical-types
10868 Whether the compiler should use the ``canonical'' type system. By
10869 default, this should always be 1, which uses a more efficient internal
10870 mechanism for comparing types in C++ and Objective-C++. However, if
10871 bugs in the canonical type system are causing compilation failures,
10872 set this value to 0 to disable canonical types.
10874 @item switch-conversion-max-branch-ratio
10875 Switch initialization conversion refuses to create arrays that are
10876 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10877 branches in the switch.
10879 @item max-partial-antic-length
10880 Maximum length of the partial antic set computed during the tree
10881 partial redundancy elimination optimization (@option{-ftree-pre}) when
10882 optimizing at @option{-O3} and above. For some sorts of source code
10883 the enhanced partial redundancy elimination optimization can run away,
10884 consuming all of the memory available on the host machine. This
10885 parameter sets a limit on the length of the sets that are computed,
10886 which prevents the runaway behavior. Setting a value of 0 for
10887 this parameter allows an unlimited set length.
10889 @item sccvn-max-scc-size
10890 Maximum size of a strongly connected component (SCC) during SCCVN
10891 processing. If this limit is hit, SCCVN processing for the whole
10892 function is not done and optimizations depending on it are
10893 disabled. The default maximum SCC size is 10000.
10895 @item sccvn-max-alias-queries-per-access
10896 Maximum number of alias-oracle queries we perform when looking for
10897 redundancies for loads and stores. If this limit is hit the search
10898 is aborted and the load or store is not considered redundant. The
10899 number of queries is algorithmically limited to the number of
10900 stores on all paths from the load to the function entry.
10901 The default maximum number of queries is 1000.
10903 @item ira-max-loops-num
10904 IRA uses regional register allocation by default. If a function
10905 contains more loops than the number given by this parameter, only at most
10906 the given number of the most frequently-executed loops form regions
10907 for regional register allocation. The default value of the
10910 @item ira-max-conflict-table-size
10911 Although IRA uses a sophisticated algorithm to compress the conflict
10912 table, the table can still require excessive amounts of memory for
10913 huge functions. If the conflict table for a function could be more
10914 than the size in MB given by this parameter, the register allocator
10915 instead uses a faster, simpler, and lower-quality
10916 algorithm that does not require building a pseudo-register conflict table.
10917 The default value of the parameter is 2000.
10919 @item ira-loop-reserved-regs
10920 IRA can be used to evaluate more accurate register pressure in loops
10921 for decisions to move loop invariants (see @option{-O3}). The number
10922 of available registers reserved for some other purposes is given
10923 by this parameter. The default value of the parameter is 2, which is
10924 the minimal number of registers needed by typical instructions.
10925 This value is the best found from numerous experiments.
10927 @item lra-inheritance-ebb-probability-cutoff
10928 LRA tries to reuse values reloaded in registers in subsequent insns.
10929 This optimization is called inheritance. EBB is used as a region to
10930 do this optimization. The parameter defines a minimal fall-through
10931 edge probability in percentage used to add BB to inheritance EBB in
10932 LRA. The default value of the parameter is 40. The value was chosen
10933 from numerous runs of SPEC2000 on x86-64.
10935 @item loop-invariant-max-bbs-in-loop
10936 Loop invariant motion can be very expensive, both in compilation time and
10937 in amount of needed compile-time memory, with very large loops. Loops
10938 with more basic blocks than this parameter won't have loop invariant
10939 motion optimization performed on them. The default value of the
10940 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10942 @item loop-max-datarefs-for-datadeps
10943 Building data dependencies is expensive for very large loops. This
10944 parameter limits the number of data references in loops that are
10945 considered for data dependence analysis. These large loops are no
10946 handled by the optimizations using loop data dependencies.
10947 The default value is 1000.
10949 @item max-vartrack-size
10950 Sets a maximum number of hash table slots to use during variable
10951 tracking dataflow analysis of any function. If this limit is exceeded
10952 with variable tracking at assignments enabled, analysis for that
10953 function is retried without it, after removing all debug insns from
10954 the function. If the limit is exceeded even without debug insns, var
10955 tracking analysis is completely disabled for the function. Setting
10956 the parameter to zero makes it unlimited.
10958 @item max-vartrack-expr-depth
10959 Sets a maximum number of recursion levels when attempting to map
10960 variable names or debug temporaries to value expressions. This trades
10961 compilation time for more complete debug information. If this is set too
10962 low, value expressions that are available and could be represented in
10963 debug information may end up not being used; setting this higher may
10964 enable the compiler to find more complex debug expressions, but compile
10965 time and memory use may grow. The default is 12.
10967 @item max-debug-marker-count
10968 Sets a threshold on the number of debug markers (e.g. begin stmt
10969 markers) to avoid complexity explosion at inlining or expanding to RTL.
10970 If a function has more such gimple stmts than the set limit, such stmts
10971 will be dropped from the inlined copy of a function, and from its RTL
10972 expansion. The default is 100000.
10974 @item min-nondebug-insn-uid
10975 Use uids starting at this parameter for nondebug insns. The range below
10976 the parameter is reserved exclusively for debug insns created by
10977 @option{-fvar-tracking-assignments}, but debug insns may get
10978 (non-overlapping) uids above it if the reserved range is exhausted.
10980 @item ipa-sra-ptr-growth-factor
10981 IPA-SRA replaces a pointer to an aggregate with one or more new
10982 parameters only when their cumulative size is less or equal to
10983 @option{ipa-sra-ptr-growth-factor} times the size of the original
10986 @item sra-max-scalarization-size-Ospeed
10987 @itemx sra-max-scalarization-size-Osize
10988 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10989 replace scalar parts of aggregates with uses of independent scalar
10990 variables. These parameters control the maximum size, in storage units,
10991 of aggregate which is considered for replacement when compiling for
10993 (@option{sra-max-scalarization-size-Ospeed}) or size
10994 (@option{sra-max-scalarization-size-Osize}) respectively.
10996 @item tm-max-aggregate-size
10997 When making copies of thread-local variables in a transaction, this
10998 parameter specifies the size in bytes after which variables are
10999 saved with the logging functions as opposed to save/restore code
11000 sequence pairs. This option only applies when using
11003 @item graphite-max-nb-scop-params
11004 To avoid exponential effects in the Graphite loop transforms, the
11005 number of parameters in a Static Control Part (SCoP) is bounded. The
11006 default value is 10 parameters, a value of zero can be used to lift
11007 the bound. A variable whose value is unknown at compilation time and
11008 defined outside a SCoP is a parameter of the SCoP.
11010 @item loop-block-tile-size
11011 Loop blocking or strip mining transforms, enabled with
11012 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11013 loop in the loop nest by a given number of iterations. The strip
11014 length can be changed using the @option{loop-block-tile-size}
11015 parameter. The default value is 51 iterations.
11017 @item loop-unroll-jam-size
11018 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
11019 default value is 4.
11021 @item loop-unroll-jam-depth
11022 Specify the dimension to be unrolled (counting from the most inner loop)
11023 for the @option{-floop-unroll-and-jam}. The default value is 2.
11025 @item ipa-cp-value-list-size
11026 IPA-CP attempts to track all possible values and types passed to a function's
11027 parameter in order to propagate them and perform devirtualization.
11028 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11029 stores per one formal parameter of a function.
11031 @item ipa-cp-eval-threshold
11032 IPA-CP calculates its own score of cloning profitability heuristics
11033 and performs those cloning opportunities with scores that exceed
11034 @option{ipa-cp-eval-threshold}.
11036 @item ipa-cp-recursion-penalty
11037 Percentage penalty the recursive functions will receive when they
11038 are evaluated for cloning.
11040 @item ipa-cp-single-call-penalty
11041 Percentage penalty functions containing a single call to another
11042 function will receive when they are evaluated for cloning.
11045 @item ipa-max-agg-items
11046 IPA-CP is also capable to propagate a number of scalar values passed
11047 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11048 number of such values per one parameter.
11050 @item ipa-cp-loop-hint-bonus
11051 When IPA-CP determines that a cloning candidate would make the number
11052 of iterations of a loop known, it adds a bonus of
11053 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11056 @item ipa-cp-array-index-hint-bonus
11057 When IPA-CP determines that a cloning candidate would make the index of
11058 an array access known, it adds a bonus of
11059 @option{ipa-cp-array-index-hint-bonus} to the profitability
11060 score of the candidate.
11062 @item ipa-max-aa-steps
11063 During its analysis of function bodies, IPA-CP employs alias analysis
11064 in order to track values pointed to by function parameters. In order
11065 not spend too much time analyzing huge functions, it gives up and
11066 consider all memory clobbered after examining
11067 @option{ipa-max-aa-steps} statements modifying memory.
11069 @item lto-partitions
11070 Specify desired number of partitions produced during WHOPR compilation.
11071 The number of partitions should exceed the number of CPUs used for compilation.
11072 The default value is 32.
11074 @item lto-min-partition
11075 Size of minimal partition for WHOPR (in estimated instructions).
11076 This prevents expenses of splitting very small programs into too many
11079 @item lto-max-partition
11080 Size of max partition for WHOPR (in estimated instructions).
11081 to provide an upper bound for individual size of partition.
11082 Meant to be used only with balanced partitioning.
11084 @item cxx-max-namespaces-for-diagnostic-help
11085 The maximum number of namespaces to consult for suggestions when C++
11086 name lookup fails for an identifier. The default is 1000.
11088 @item sink-frequency-threshold
11089 The maximum relative execution frequency (in percents) of the target block
11090 relative to a statement's original block to allow statement sinking of a
11091 statement. Larger numbers result in more aggressive statement sinking.
11092 The default value is 75. A small positive adjustment is applied for
11093 statements with memory operands as those are even more profitable so sink.
11095 @item max-stores-to-sink
11096 The maximum number of conditional store pairs that can be sunk. Set to 0
11097 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11098 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
11100 @item allow-store-data-races
11101 Allow optimizers to introduce new data races on stores.
11102 Set to 1 to allow, otherwise to 0. This option is enabled by default
11103 at optimization level @option{-Ofast}.
11105 @item case-values-threshold
11106 The smallest number of different values for which it is best to use a
11107 jump-table instead of a tree of conditional branches. If the value is
11108 0, use the default for the machine. The default is 0.
11110 @item tree-reassoc-width
11111 Set the maximum number of instructions executed in parallel in
11112 reassociated tree. This parameter overrides target dependent
11113 heuristics used by default if has non zero value.
11115 @item sched-pressure-algorithm
11116 Choose between the two available implementations of
11117 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11118 and is the more likely to prevent instructions from being reordered.
11119 Algorithm 2 was designed to be a compromise between the relatively
11120 conservative approach taken by algorithm 1 and the rather aggressive
11121 approach taken by the default scheduler. It relies more heavily on
11122 having a regular register file and accurate register pressure classes.
11123 See @file{haifa-sched.c} in the GCC sources for more details.
11125 The default choice depends on the target.
11127 @item max-slsr-cand-scan
11128 Set the maximum number of existing candidates that are considered when
11129 seeking a basis for a new straight-line strength reduction candidate.
11132 Enable buffer overflow detection for global objects. This kind
11133 of protection is enabled by default if you are using
11134 @option{-fsanitize=address} option.
11135 To disable global objects protection use @option{--param asan-globals=0}.
11138 Enable buffer overflow detection for stack objects. This kind of
11139 protection is enabled by default when using @option{-fsanitize=address}.
11140 To disable stack protection use @option{--param asan-stack=0} option.
11142 @item asan-instrument-reads
11143 Enable buffer overflow detection for memory reads. This kind of
11144 protection is enabled by default when using @option{-fsanitize=address}.
11145 To disable memory reads protection use
11146 @option{--param asan-instrument-reads=0}.
11148 @item asan-instrument-writes
11149 Enable buffer overflow detection for memory writes. This kind of
11150 protection is enabled by default when using @option{-fsanitize=address}.
11151 To disable memory writes protection use
11152 @option{--param asan-instrument-writes=0} option.
11154 @item asan-memintrin
11155 Enable detection for built-in functions. This kind of protection
11156 is enabled by default when using @option{-fsanitize=address}.
11157 To disable built-in functions protection use
11158 @option{--param asan-memintrin=0}.
11160 @item asan-use-after-return
11161 Enable detection of use-after-return. This kind of protection
11162 is enabled by default when using the @option{-fsanitize=address} option.
11163 To disable it use @option{--param asan-use-after-return=0}.
11165 Note: By default the check is disabled at run time. To enable it,
11166 add @code{detect_stack_use_after_return=1} to the environment variable
11167 @env{ASAN_OPTIONS}.
11169 @item asan-instrumentation-with-call-threshold
11170 If number of memory accesses in function being instrumented
11171 is greater or equal to this number, use callbacks instead of inline checks.
11172 E.g. to disable inline code use
11173 @option{--param asan-instrumentation-with-call-threshold=0}.
11175 @item use-after-scope-direct-emission-threshold
11176 If the size of a local variable in bytes is smaller or equal to this
11177 number, directly poison (or unpoison) shadow memory instead of using
11178 run-time callbacks. The default value is 256.
11180 @item max-fsm-thread-path-insns
11181 Maximum number of instructions to copy when duplicating blocks on a
11182 finite state automaton jump thread path. The default is 100.
11184 @item max-fsm-thread-length
11185 Maximum number of basic blocks on a finite state automaton jump thread
11186 path. The default is 10.
11188 @item max-fsm-thread-paths
11189 Maximum number of new jump thread paths to create for a finite state
11190 automaton. The default is 50.
11192 @item parloops-chunk-size
11193 Chunk size of omp schedule for loops parallelized by parloops. The default
11196 @item parloops-schedule
11197 Schedule type of omp schedule for loops parallelized by parloops (static,
11198 dynamic, guided, auto, runtime). The default is static.
11200 @item parloops-min-per-thread
11201 The minimum number of iterations per thread of an innermost parallelized
11202 loop for which the parallelized variant is prefered over the single threaded
11203 one. The default is 100. Note that for a parallelized loop nest the
11204 minimum number of iterations of the outermost loop per thread is two.
11206 @item max-ssa-name-query-depth
11207 Maximum depth of recursion when querying properties of SSA names in things
11208 like fold routines. One level of recursion corresponds to following a
11211 @item hsa-gen-debug-stores
11212 Enable emission of special debug stores within HSA kernels which are
11213 then read and reported by libgomp plugin. Generation of these stores
11214 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11217 @item max-speculative-devirt-maydefs
11218 The maximum number of may-defs we analyze when looking for a must-def
11219 specifying the dynamic type of an object that invokes a virtual call
11220 we may be able to devirtualize speculatively.
11222 @item max-vrp-switch-assertions
11223 The maximum number of assertions to add along the default edge of a switch
11224 statement during VRP. The default is 10.
11226 @item unroll-jam-min-percent
11227 The minimum percentage of memory references that must be optimized
11228 away for the unroll-and-jam transformation to be considered profitable.
11230 @item unroll-jam-max-unroll
11231 The maximum number of times the outer loop should be unrolled by
11232 the unroll-and-jam transformation.
11236 @node Instrumentation Options
11237 @section Program Instrumentation Options
11238 @cindex instrumentation options
11239 @cindex program instrumentation options
11240 @cindex run-time error checking options
11241 @cindex profiling options
11242 @cindex options, program instrumentation
11243 @cindex options, run-time error checking
11244 @cindex options, profiling
11246 GCC supports a number of command-line options that control adding
11247 run-time instrumentation to the code it normally generates.
11248 For example, one purpose of instrumentation is collect profiling
11249 statistics for use in finding program hot spots, code coverage
11250 analysis, or profile-guided optimizations.
11251 Another class of program instrumentation is adding run-time checking
11252 to detect programming errors like invalid pointer
11253 dereferences or out-of-bounds array accesses, as well as deliberately
11254 hostile attacks such as stack smashing or C++ vtable hijacking.
11255 There is also a general hook which can be used to implement other
11256 forms of tracing or function-level instrumentation for debug or
11257 program analysis purposes.
11260 @cindex @command{prof}
11263 Generate extra code to write profile information suitable for the
11264 analysis program @command{prof}. You must use this option when compiling
11265 the source files you want data about, and you must also use it when
11268 @cindex @command{gprof}
11271 Generate extra code to write profile information suitable for the
11272 analysis program @command{gprof}. You must use this option when compiling
11273 the source files you want data about, and you must also use it when
11276 @item -fprofile-arcs
11277 @opindex fprofile-arcs
11278 Add code so that program flow @dfn{arcs} are instrumented. During
11279 execution the program records how many times each branch and call is
11280 executed and how many times it is taken or returns. On targets that support
11281 constructors with priority support, profiling properly handles constructors,
11282 destructors and C++ constructors (and destructors) of classes which are used
11283 as a type of a global variable.
11286 program exits it saves this data to a file called
11287 @file{@var{auxname}.gcda} for each source file. The data may be used for
11288 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11289 test coverage analysis (@option{-ftest-coverage}). Each object file's
11290 @var{auxname} is generated from the name of the output file, if
11291 explicitly specified and it is not the final executable, otherwise it is
11292 the basename of the source file. In both cases any suffix is removed
11293 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11294 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11295 @xref{Cross-profiling}.
11297 @cindex @command{gcov}
11301 This option is used to compile and link code instrumented for coverage
11302 analysis. The option is a synonym for @option{-fprofile-arcs}
11303 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11304 linking). See the documentation for those options for more details.
11309 Compile the source files with @option{-fprofile-arcs} plus optimization
11310 and code generation options. For test coverage analysis, use the
11311 additional @option{-ftest-coverage} option. You do not need to profile
11312 every source file in a program.
11315 Compile the source files additionally with @option{-fprofile-abs-path}
11316 to create absolute path names in the @file{.gcno} files. This allows
11317 @command{gcov} to find the correct sources in projects where compilations
11318 occur with different working directories.
11321 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11322 (the latter implies the former).
11325 Run the program on a representative workload to generate the arc profile
11326 information. This may be repeated any number of times. You can run
11327 concurrent instances of your program, and provided that the file system
11328 supports locking, the data files will be correctly updated. Unless
11329 a strict ISO C dialect option is in effect, @code{fork} calls are
11330 detected and correctly handled without double counting.
11333 For profile-directed optimizations, compile the source files again with
11334 the same optimization and code generation options plus
11335 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11336 Control Optimization}).
11339 For test coverage analysis, use @command{gcov} to produce human readable
11340 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11341 @command{gcov} documentation for further information.
11345 With @option{-fprofile-arcs}, for each function of your program GCC
11346 creates a program flow graph, then finds a spanning tree for the graph.
11347 Only arcs that are not on the spanning tree have to be instrumented: the
11348 compiler adds code to count the number of times that these arcs are
11349 executed. When an arc is the only exit or only entrance to a block, the
11350 instrumentation code can be added to the block; otherwise, a new basic
11351 block must be created to hold the instrumentation code.
11354 @item -ftest-coverage
11355 @opindex ftest-coverage
11356 Produce a notes file that the @command{gcov} code-coverage utility
11357 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11358 show program coverage. Each source file's note file is called
11359 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11360 above for a description of @var{auxname} and instructions on how to
11361 generate test coverage data. Coverage data matches the source files
11362 more closely if you do not optimize.
11364 @item -fprofile-abs-path
11365 @opindex fprofile-abs-path
11366 Automatically convert relative source file names to absolute path names
11367 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11368 sources in projects where compilations occur with different working
11371 @item -fprofile-dir=@var{path}
11372 @opindex fprofile-dir
11374 Set the directory to search for the profile data files in to @var{path}.
11375 This option affects only the profile data generated by
11376 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11377 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11378 and its related options. Both absolute and relative paths can be used.
11379 By default, GCC uses the current directory as @var{path}, thus the
11380 profile data file appears in the same directory as the object file.
11381 In order to prevent the file name clashing, if the object file name is
11382 not an absolute path, we mangle the absolute path of the
11383 @file{@var{sourcename}.gcda} file and use it as the file name of a
11386 When an executable is run in a massive parallel environment, it is recommended
11387 to save profile to different folders. That can be done with variables
11388 in @var{path} that are exported during run-time:
11396 value of environment variable @var{VAR}
11400 @item -fprofile-generate
11401 @itemx -fprofile-generate=@var{path}
11402 @opindex fprofile-generate
11404 Enable options usually used for instrumenting application to produce
11405 profile useful for later recompilation with profile feedback based
11406 optimization. You must use @option{-fprofile-generate} both when
11407 compiling and when linking your program.
11409 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11411 If @var{path} is specified, GCC looks at the @var{path} to find
11412 the profile feedback data files. See @option{-fprofile-dir}.
11414 To optimize the program based on the collected profile information, use
11415 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11417 @item -fprofile-update=@var{method}
11418 @opindex fprofile-update
11420 Alter the update method for an application instrumented for profile
11421 feedback based optimization. The @var{method} argument should be one of
11422 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11423 The first one is useful for single-threaded applications,
11424 while the second one prevents profile corruption by emitting thread-safe code.
11426 @strong{Warning:} When an application does not properly join all threads
11427 (or creates an detached thread), a profile file can be still corrupted.
11429 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11430 when supported by a target, or to @samp{single} otherwise. The GCC driver
11431 automatically selects @samp{prefer-atomic} when @option{-pthread}
11432 is present in the command line.
11434 @item -fsanitize=address
11435 @opindex fsanitize=address
11436 Enable AddressSanitizer, a fast memory error detector.
11437 Memory access instructions are instrumented to detect
11438 out-of-bounds and use-after-free bugs.
11439 The option enables @option{-fsanitize-address-use-after-scope}.
11440 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11441 more details. The run-time behavior can be influenced using the
11442 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11443 the available options are shown at startup of the instrumented program. See
11444 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11445 for a list of supported options.
11446 The option cannot be combined with @option{-fsanitize=thread}.
11448 @item -fsanitize=kernel-address
11449 @opindex fsanitize=kernel-address
11450 Enable AddressSanitizer for Linux kernel.
11451 See @uref{https://github.com/google/kasan/wiki} for more details.
11453 @item -fsanitize=pointer-compare
11454 @opindex fsanitize=pointer-compare
11455 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11456 The option must be combined with either @option{-fsanitize=kernel-address} or
11457 @option{-fsanitize=address}
11458 The option cannot be combined with @option{-fsanitize=thread}.
11459 Note: By default the check is disabled at run time. To enable it,
11460 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11461 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11462 invalid operation only when both pointers are non-null.
11464 @item -fsanitize=pointer-subtract
11465 @opindex fsanitize=pointer-subtract
11466 Instrument subtraction with pointer operands.
11467 The option must be combined with either @option{-fsanitize=kernel-address} or
11468 @option{-fsanitize=address}
11469 The option cannot be combined with @option{-fsanitize=thread}.
11470 Note: By default the check is disabled at run time. To enable it,
11471 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11472 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11473 invalid operation only when both pointers are non-null.
11475 @item -fsanitize=thread
11476 @opindex fsanitize=thread
11477 Enable ThreadSanitizer, a fast data race detector.
11478 Memory access instructions are instrumented to detect
11479 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11480 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11481 environment variable; see
11482 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11484 The option cannot be combined with @option{-fsanitize=address},
11485 @option{-fsanitize=leak}.
11487 Note that sanitized atomic builtins cannot throw exceptions when
11488 operating on invalid memory addresses with non-call exceptions
11489 (@option{-fnon-call-exceptions}).
11491 @item -fsanitize=leak
11492 @opindex fsanitize=leak
11493 Enable LeakSanitizer, a memory leak detector.
11494 This option only matters for linking of executables and
11495 the executable is linked against a library that overrides @code{malloc}
11496 and other allocator functions. See
11497 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11498 details. The run-time behavior can be influenced using the
11499 @env{LSAN_OPTIONS} environment variable.
11500 The option cannot be combined with @option{-fsanitize=thread}.
11502 @item -fsanitize=undefined
11503 @opindex fsanitize=undefined
11504 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11505 Various computations are instrumented to detect undefined behavior
11506 at runtime. Current suboptions are:
11510 @item -fsanitize=shift
11511 @opindex fsanitize=shift
11512 This option enables checking that the result of a shift operation is
11513 not undefined. Note that what exactly is considered undefined differs
11514 slightly between C and C++, as well as between ISO C90 and C99, etc.
11515 This option has two suboptions, @option{-fsanitize=shift-base} and
11516 @option{-fsanitize=shift-exponent}.
11518 @item -fsanitize=shift-exponent
11519 @opindex fsanitize=shift-exponent
11520 This option enables checking that the second argument of a shift operation
11521 is not negative and is smaller than the precision of the promoted first
11524 @item -fsanitize=shift-base
11525 @opindex fsanitize=shift-base
11526 If the second argument of a shift operation is within range, check that the
11527 result of a shift operation is not undefined. Note that what exactly is
11528 considered undefined differs slightly between C and C++, as well as between
11529 ISO C90 and C99, etc.
11531 @item -fsanitize=integer-divide-by-zero
11532 @opindex fsanitize=integer-divide-by-zero
11533 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11535 @item -fsanitize=unreachable
11536 @opindex fsanitize=unreachable
11537 With this option, the compiler turns the @code{__builtin_unreachable}
11538 call into a diagnostics message call instead. When reaching the
11539 @code{__builtin_unreachable} call, the behavior is undefined.
11541 @item -fsanitize=vla-bound
11542 @opindex fsanitize=vla-bound
11543 This option instructs the compiler to check that the size of a variable
11544 length array is positive.
11546 @item -fsanitize=null
11547 @opindex fsanitize=null
11548 This option enables pointer checking. Particularly, the application
11549 built with this option turned on will issue an error message when it
11550 tries to dereference a NULL pointer, or if a reference (possibly an
11551 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11552 on an object pointed by a NULL pointer.
11554 @item -fsanitize=return
11555 @opindex fsanitize=return
11556 This option enables return statement checking. Programs
11557 built with this option turned on will issue an error message
11558 when the end of a non-void function is reached without actually
11559 returning a value. This option works in C++ only.
11561 @item -fsanitize=signed-integer-overflow
11562 @opindex fsanitize=signed-integer-overflow
11563 This option enables signed integer overflow checking. We check that
11564 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11565 does not overflow in the signed arithmetics. Note, integer promotion
11566 rules must be taken into account. That is, the following is not an
11569 signed char a = SCHAR_MAX;
11573 @item -fsanitize=bounds
11574 @opindex fsanitize=bounds
11575 This option enables instrumentation of array bounds. Various out of bounds
11576 accesses are detected. Flexible array members, flexible array member-like
11577 arrays, and initializers of variables with static storage are not instrumented.
11579 @item -fsanitize=bounds-strict
11580 @opindex fsanitize=bounds-strict
11581 This option enables strict instrumentation of array bounds. Most out of bounds
11582 accesses are detected, including flexible array members and flexible array
11583 member-like arrays. Initializers of variables with static storage are not
11586 @item -fsanitize=alignment
11587 @opindex fsanitize=alignment
11589 This option enables checking of alignment of pointers when they are
11590 dereferenced, or when a reference is bound to insufficiently aligned target,
11591 or when a method or constructor is invoked on insufficiently aligned object.
11593 @item -fsanitize=object-size
11594 @opindex fsanitize=object-size
11595 This option enables instrumentation of memory references using the
11596 @code{__builtin_object_size} function. Various out of bounds pointer
11597 accesses are detected.
11599 @item -fsanitize=float-divide-by-zero
11600 @opindex fsanitize=float-divide-by-zero
11601 Detect floating-point division by zero. Unlike other similar options,
11602 @option{-fsanitize=float-divide-by-zero} is not enabled by
11603 @option{-fsanitize=undefined}, since floating-point division by zero can
11604 be a legitimate way of obtaining infinities and NaNs.
11606 @item -fsanitize=float-cast-overflow
11607 @opindex fsanitize=float-cast-overflow
11608 This option enables floating-point type to integer conversion checking.
11609 We check that the result of the conversion does not overflow.
11610 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11611 not enabled by @option{-fsanitize=undefined}.
11612 This option does not work well with @code{FE_INVALID} exceptions enabled.
11614 @item -fsanitize=nonnull-attribute
11615 @opindex fsanitize=nonnull-attribute
11617 This option enables instrumentation of calls, checking whether null values
11618 are not passed to arguments marked as requiring a non-null value by the
11619 @code{nonnull} function attribute.
11621 @item -fsanitize=returns-nonnull-attribute
11622 @opindex fsanitize=returns-nonnull-attribute
11624 This option enables instrumentation of return statements in functions
11625 marked with @code{returns_nonnull} function attribute, to detect returning
11626 of null values from such functions.
11628 @item -fsanitize=bool
11629 @opindex fsanitize=bool
11631 This option enables instrumentation of loads from bool. If a value other
11632 than 0/1 is loaded, a run-time error is issued.
11634 @item -fsanitize=enum
11635 @opindex fsanitize=enum
11637 This option enables instrumentation of loads from an enum type. If
11638 a value outside the range of values for the enum type is loaded,
11639 a run-time error is issued.
11641 @item -fsanitize=vptr
11642 @opindex fsanitize=vptr
11644 This option enables instrumentation of C++ member function calls, member
11645 accesses and some conversions between pointers to base and derived classes,
11646 to verify the referenced object has the correct dynamic type.
11648 @item -fsanitize=pointer-overflow
11649 @opindex fsanitize=pointer-overflow
11651 This option enables instrumentation of pointer arithmetics. If the pointer
11652 arithmetics overflows, a run-time error is issued.
11654 @item -fsanitize=builtin
11655 @opindex fsanitize=builtin
11657 This option enables instrumentation of arguments to selected builtin
11658 functions. If an invalid value is passed to such arguments, a run-time
11659 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11660 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11665 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11666 @option{-fsanitize=undefined} gives a diagnostic message.
11667 This currently works only for the C family of languages.
11669 @item -fno-sanitize=all
11670 @opindex fno-sanitize=all
11672 This option disables all previously enabled sanitizers.
11673 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11676 @item -fasan-shadow-offset=@var{number}
11677 @opindex fasan-shadow-offset
11678 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11679 It is useful for experimenting with different shadow memory layouts in
11680 Kernel AddressSanitizer.
11682 @item -fsanitize-sections=@var{s1},@var{s2},...
11683 @opindex fsanitize-sections
11684 Sanitize global variables in selected user-defined sections. @var{si} may
11687 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11688 @opindex fsanitize-recover
11689 @opindex fno-sanitize-recover
11690 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11691 mentioned in comma-separated list of @var{opts}. Enabling this option
11692 for a sanitizer component causes it to attempt to continue
11693 running the program as if no error happened. This means multiple
11694 runtime errors can be reported in a single program run, and the exit
11695 code of the program may indicate success even when errors
11696 have been reported. The @option{-fno-sanitize-recover=} option
11697 can be used to alter
11698 this behavior: only the first detected error is reported
11699 and program then exits with a non-zero exit code.
11701 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11702 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11703 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11704 @option{-fsanitize=bounds-strict},
11705 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11706 For these sanitizers error recovery is turned on by default,
11707 except @option{-fsanitize=address}, for which this feature is experimental.
11708 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11709 accepted, the former enables recovery for all sanitizers that support it,
11710 the latter disables recovery for all sanitizers that support it.
11712 Even if a recovery mode is turned on the compiler side, it needs to be also
11713 enabled on the runtime library side, otherwise the failures are still fatal.
11714 The runtime library defaults to @code{halt_on_error=0} for
11715 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11716 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11717 setting the @code{halt_on_error} flag in the corresponding environment variable.
11719 Syntax without an explicit @var{opts} parameter is deprecated. It is
11720 equivalent to specifying an @var{opts} list of:
11723 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11726 @item -fsanitize-address-use-after-scope
11727 @opindex fsanitize-address-use-after-scope
11728 Enable sanitization of local variables to detect use-after-scope bugs.
11729 The option sets @option{-fstack-reuse} to @samp{none}.
11731 @item -fsanitize-undefined-trap-on-error
11732 @opindex fsanitize-undefined-trap-on-error
11733 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11734 report undefined behavior using @code{__builtin_trap} rather than
11735 a @code{libubsan} library routine. The advantage of this is that the
11736 @code{libubsan} library is not needed and is not linked in, so this
11737 is usable even in freestanding environments.
11739 @item -fsanitize-coverage=trace-pc
11740 @opindex fsanitize-coverage=trace-pc
11741 Enable coverage-guided fuzzing code instrumentation.
11742 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11744 @item -fsanitize-coverage=trace-cmp
11745 @opindex fsanitize-coverage=trace-cmp
11746 Enable dataflow guided fuzzing code instrumentation.
11747 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11748 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11749 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11750 variable or @code{__sanitizer_cov_trace_const_cmp1},
11751 @code{__sanitizer_cov_trace_const_cmp2},
11752 @code{__sanitizer_cov_trace_const_cmp4} or
11753 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11754 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11755 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11756 @code{__sanitizer_cov_trace_switch} for switch statements.
11758 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11759 @opindex fcf-protection
11760 Enable code instrumentation of control-flow transfers to increase
11761 program security by checking that target addresses of control-flow
11762 transfer instructions (such as indirect function call, function return,
11763 indirect jump) are valid. This prevents diverting the flow of control
11764 to an unexpected target. This is intended to protect against such
11765 threats as Return-oriented Programming (ROP), and similarly
11766 call/jmp-oriented programming (COP/JOP).
11768 The value @code{branch} tells the compiler to implement checking of
11769 validity of control-flow transfer at the point of indirect branch
11770 instructions, i.e. call/jmp instructions. The value @code{return}
11771 implements checking of validity at the point of returning from a
11772 function. The value @code{full} is an alias for specifying both
11773 @code{branch} and @code{return}. The value @code{none} turns off
11776 The macro @code{__CET__} is defined when @option{-fcf-protection} is
11777 used. The first bit of @code{__CET__} is set to 1 for the value
11778 @code{branch} and the second bit of @code{__CET__} is set to 1 for
11781 You can also use the @code{nocf_check} attribute to identify
11782 which functions and calls should be skipped from instrumentation
11783 (@pxref{Function Attributes}).
11785 Currently the x86 GNU/Linux target provides an implementation based
11786 on Intel Control-flow Enforcement Technology (CET).
11788 @item -fstack-protector
11789 @opindex fstack-protector
11790 Emit extra code to check for buffer overflows, such as stack smashing
11791 attacks. This is done by adding a guard variable to functions with
11792 vulnerable objects. This includes functions that call @code{alloca}, and
11793 functions with buffers larger than 8 bytes. The guards are initialized
11794 when a function is entered and then checked when the function exits.
11795 If a guard check fails, an error message is printed and the program exits.
11797 @item -fstack-protector-all
11798 @opindex fstack-protector-all
11799 Like @option{-fstack-protector} except that all functions are protected.
11801 @item -fstack-protector-strong
11802 @opindex fstack-protector-strong
11803 Like @option{-fstack-protector} but includes additional functions to
11804 be protected --- those that have local array definitions, or have
11805 references to local frame addresses.
11807 @item -fstack-protector-explicit
11808 @opindex fstack-protector-explicit
11809 Like @option{-fstack-protector} but only protects those functions which
11810 have the @code{stack_protect} attribute.
11812 @item -fstack-check
11813 @opindex fstack-check
11814 Generate code to verify that you do not go beyond the boundary of the
11815 stack. You should specify this flag if you are running in an
11816 environment with multiple threads, but you only rarely need to specify it in
11817 a single-threaded environment since stack overflow is automatically
11818 detected on nearly all systems if there is only one stack.
11820 Note that this switch does not actually cause checking to be done; the
11821 operating system or the language runtime must do that. The switch causes
11822 generation of code to ensure that they see the stack being extended.
11824 You can additionally specify a string parameter: @samp{no} means no
11825 checking, @samp{generic} means force the use of old-style checking,
11826 @samp{specific} means use the best checking method and is equivalent
11827 to bare @option{-fstack-check}.
11829 Old-style checking is a generic mechanism that requires no specific
11830 target support in the compiler but comes with the following drawbacks:
11834 Modified allocation strategy for large objects: they are always
11835 allocated dynamically if their size exceeds a fixed threshold. Note this
11836 may change the semantics of some code.
11839 Fixed limit on the size of the static frame of functions: when it is
11840 topped by a particular function, stack checking is not reliable and
11841 a warning is issued by the compiler.
11844 Inefficiency: because of both the modified allocation strategy and the
11845 generic implementation, code performance is hampered.
11848 Note that old-style stack checking is also the fallback method for
11849 @samp{specific} if no target support has been added in the compiler.
11851 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
11852 and stack overflows. @samp{specific} is an excellent choice when compiling
11853 Ada code. It is not generally sufficient to protect against stack-clash
11854 attacks. To protect against those you want @samp{-fstack-clash-protection}.
11856 @item -fstack-clash-protection
11857 @opindex fstack-clash-protection
11858 Generate code to prevent stack clash style attacks. When this option is
11859 enabled, the compiler will only allocate one page of stack space at a time
11860 and each page is accessed immediately after allocation. Thus, it prevents
11861 allocations from jumping over any stack guard page provided by the
11864 Most targets do not fully support stack clash protection. However, on
11865 those targets @option{-fstack-clash-protection} will protect dynamic stack
11866 allocations. @option{-fstack-clash-protection} may also provide limited
11867 protection for static stack allocations if the target supports
11868 @option{-fstack-check=specific}.
11870 @item -fstack-limit-register=@var{reg}
11871 @itemx -fstack-limit-symbol=@var{sym}
11872 @itemx -fno-stack-limit
11873 @opindex fstack-limit-register
11874 @opindex fstack-limit-symbol
11875 @opindex fno-stack-limit
11876 Generate code to ensure that the stack does not grow beyond a certain value,
11877 either the value of a register or the address of a symbol. If a larger
11878 stack is required, a signal is raised at run time. For most targets,
11879 the signal is raised before the stack overruns the boundary, so
11880 it is possible to catch the signal without taking special precautions.
11882 For instance, if the stack starts at absolute address @samp{0x80000000}
11883 and grows downwards, you can use the flags
11884 @option{-fstack-limit-symbol=__stack_limit} and
11885 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11886 of 128KB@. Note that this may only work with the GNU linker.
11888 You can locally override stack limit checking by using the
11889 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11891 @item -fsplit-stack
11892 @opindex fsplit-stack
11893 Generate code to automatically split the stack before it overflows.
11894 The resulting program has a discontiguous stack which can only
11895 overflow if the program is unable to allocate any more memory. This
11896 is most useful when running threaded programs, as it is no longer
11897 necessary to calculate a good stack size to use for each thread. This
11898 is currently only implemented for the x86 targets running
11901 When code compiled with @option{-fsplit-stack} calls code compiled
11902 without @option{-fsplit-stack}, there may not be much stack space
11903 available for the latter code to run. If compiling all code,
11904 including library code, with @option{-fsplit-stack} is not an option,
11905 then the linker can fix up these calls so that the code compiled
11906 without @option{-fsplit-stack} always has a large stack. Support for
11907 this is implemented in the gold linker in GNU binutils release 2.21
11910 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11911 @opindex fvtable-verify
11912 This option is only available when compiling C++ code.
11913 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11914 feature that verifies at run time, for every virtual call, that
11915 the vtable pointer through which the call is made is valid for the type of
11916 the object, and has not been corrupted or overwritten. If an invalid vtable
11917 pointer is detected at run time, an error is reported and execution of the
11918 program is immediately halted.
11920 This option causes run-time data structures to be built at program startup,
11921 which are used for verifying the vtable pointers.
11922 The options @samp{std} and @samp{preinit}
11923 control the timing of when these data structures are built. In both cases the
11924 data structures are built before execution reaches @code{main}. Using
11925 @option{-fvtable-verify=std} causes the data structures to be built after
11926 shared libraries have been loaded and initialized.
11927 @option{-fvtable-verify=preinit} causes them to be built before shared
11928 libraries have been loaded and initialized.
11930 If this option appears multiple times in the command line with different
11931 values specified, @samp{none} takes highest priority over both @samp{std} and
11932 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11935 @opindex fvtv-debug
11936 When used in conjunction with @option{-fvtable-verify=std} or
11937 @option{-fvtable-verify=preinit}, causes debug versions of the
11938 runtime functions for the vtable verification feature to be called.
11939 This flag also causes the compiler to log information about which
11940 vtable pointers it finds for each class.
11941 This information is written to a file named @file{vtv_set_ptr_data.log}
11942 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11943 if that is defined or the current working directory otherwise.
11945 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11946 file, be sure to delete any existing one.
11949 @opindex fvtv-counts
11950 This is a debugging flag. When used in conjunction with
11951 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11952 causes the compiler to keep track of the total number of virtual calls
11953 it encounters and the number of verifications it inserts. It also
11954 counts the number of calls to certain run-time library functions
11955 that it inserts and logs this information for each compilation unit.
11956 The compiler writes this information to a file named
11957 @file{vtv_count_data.log} in the directory named by the environment
11958 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11959 directory otherwise. It also counts the size of the vtable pointer sets
11960 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11961 in the same directory.
11963 Note: This feature @emph{appends} data to the log files. To get fresh log
11964 files, be sure to delete any existing ones.
11966 @item -finstrument-functions
11967 @opindex finstrument-functions
11968 Generate instrumentation calls for entry and exit to functions. Just
11969 after function entry and just before function exit, the following
11970 profiling functions are called with the address of the current
11971 function and its call site. (On some platforms,
11972 @code{__builtin_return_address} does not work beyond the current
11973 function, so the call site information may not be available to the
11974 profiling functions otherwise.)
11977 void __cyg_profile_func_enter (void *this_fn,
11979 void __cyg_profile_func_exit (void *this_fn,
11983 The first argument is the address of the start of the current function,
11984 which may be looked up exactly in the symbol table.
11986 This instrumentation is also done for functions expanded inline in other
11987 functions. The profiling calls indicate where, conceptually, the
11988 inline function is entered and exited. This means that addressable
11989 versions of such functions must be available. If all your uses of a
11990 function are expanded inline, this may mean an additional expansion of
11991 code size. If you use @code{extern inline} in your C code, an
11992 addressable version of such functions must be provided. (This is
11993 normally the case anyway, but if you get lucky and the optimizer always
11994 expands the functions inline, you might have gotten away without
11995 providing static copies.)
11997 A function may be given the attribute @code{no_instrument_function}, in
11998 which case this instrumentation is not done. This can be used, for
11999 example, for the profiling functions listed above, high-priority
12000 interrupt routines, and any functions from which the profiling functions
12001 cannot safely be called (perhaps signal handlers, if the profiling
12002 routines generate output or allocate memory).
12004 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12005 @opindex finstrument-functions-exclude-file-list
12007 Set the list of functions that are excluded from instrumentation (see
12008 the description of @option{-finstrument-functions}). If the file that
12009 contains a function definition matches with one of @var{file}, then
12010 that function is not instrumented. The match is done on substrings:
12011 if the @var{file} parameter is a substring of the file name, it is
12012 considered to be a match.
12017 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12021 excludes any inline function defined in files whose pathnames
12022 contain @file{/bits/stl} or @file{include/sys}.
12024 If, for some reason, you want to include letter @samp{,} in one of
12025 @var{sym}, write @samp{\,}. For example,
12026 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12027 (note the single quote surrounding the option).
12029 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12030 @opindex finstrument-functions-exclude-function-list
12032 This is similar to @option{-finstrument-functions-exclude-file-list},
12033 but this option sets the list of function names to be excluded from
12034 instrumentation. The function name to be matched is its user-visible
12035 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12036 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12037 match is done on substrings: if the @var{sym} parameter is a substring
12038 of the function name, it is considered to be a match. For C99 and C++
12039 extended identifiers, the function name must be given in UTF-8, not
12040 using universal character names.
12042 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12043 @opindex fpatchable-function-entry
12044 Generate @var{N} NOPs right at the beginning
12045 of each function, with the function entry point before the @var{M}th NOP.
12046 If @var{M} is omitted, it defaults to @code{0} so the
12047 function entry points to the address just at the first NOP.
12048 The NOP instructions reserve extra space which can be used to patch in
12049 any desired instrumentation at run time, provided that the code segment
12050 is writable. The amount of space is controllable indirectly via
12051 the number of NOPs; the NOP instruction used corresponds to the instruction
12052 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12053 is target-specific and may also depend on the architecture variant and/or
12054 other compilation options.
12056 For run-time identification, the starting addresses of these areas,
12057 which correspond to their respective function entries minus @var{M},
12058 are additionally collected in the @code{__patchable_function_entries}
12059 section of the resulting binary.
12061 Note that the value of @code{__attribute__ ((patchable_function_entry
12062 (N,M)))} takes precedence over command-line option
12063 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12064 the area size or to remove it completely on a single function.
12065 If @code{N=0}, no pad location is recorded.
12067 The NOP instructions are inserted at---and maybe before, depending on
12068 @var{M}---the function entry address, even before the prologue.
12073 @node Preprocessor Options
12074 @section Options Controlling the Preprocessor
12075 @cindex preprocessor options
12076 @cindex options, preprocessor
12078 These options control the C preprocessor, which is run on each C source
12079 file before actual compilation.
12081 If you use the @option{-E} option, nothing is done except preprocessing.
12082 Some of these options make sense only together with @option{-E} because
12083 they cause the preprocessor output to be unsuitable for actual
12086 In addition to the options listed here, there are a number of options
12087 to control search paths for include files documented in
12088 @ref{Directory Options}.
12089 Options to control preprocessor diagnostics are listed in
12090 @ref{Warning Options}.
12093 @include cppopts.texi
12095 @item -Wp,@var{option}
12097 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12098 and pass @var{option} directly through to the preprocessor. If
12099 @var{option} contains commas, it is split into multiple options at the
12100 commas. However, many options are modified, translated or interpreted
12101 by the compiler driver before being passed to the preprocessor, and
12102 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12103 interface is undocumented and subject to change, so whenever possible
12104 you should avoid using @option{-Wp} and let the driver handle the
12107 @item -Xpreprocessor @var{option}
12108 @opindex Xpreprocessor
12109 Pass @var{option} as an option to the preprocessor. You can use this to
12110 supply system-specific preprocessor options that GCC does not
12113 If you want to pass an option that takes an argument, you must use
12114 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12116 @item -no-integrated-cpp
12117 @opindex no-integrated-cpp
12118 Perform preprocessing as a separate pass before compilation.
12119 By default, GCC performs preprocessing as an integrated part of
12120 input tokenization and parsing.
12121 If this option is provided, the appropriate language front end
12122 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12123 and Objective-C, respectively) is instead invoked twice,
12124 once for preprocessing only and once for actual compilation
12125 of the preprocessed input.
12126 This option may be useful in conjunction with the @option{-B} or
12127 @option{-wrapper} options to specify an alternate preprocessor or
12128 perform additional processing of the program source between
12129 normal preprocessing and compilation.
12133 @node Assembler Options
12134 @section Passing Options to the Assembler
12136 @c prevent bad page break with this line
12137 You can pass options to the assembler.
12140 @item -Wa,@var{option}
12142 Pass @var{option} as an option to the assembler. If @var{option}
12143 contains commas, it is split into multiple options at the commas.
12145 @item -Xassembler @var{option}
12146 @opindex Xassembler
12147 Pass @var{option} as an option to the assembler. You can use this to
12148 supply system-specific assembler options that GCC does not
12151 If you want to pass an option that takes an argument, you must use
12152 @option{-Xassembler} twice, once for the option and once for the argument.
12157 @section Options for Linking
12158 @cindex link options
12159 @cindex options, linking
12161 These options come into play when the compiler links object files into
12162 an executable output file. They are meaningless if the compiler is
12163 not doing a link step.
12167 @item @var{object-file-name}
12168 A file name that does not end in a special recognized suffix is
12169 considered to name an object file or library. (Object files are
12170 distinguished from libraries by the linker according to the file
12171 contents.) If linking is done, these object files are used as input
12180 If any of these options is used, then the linker is not run, and
12181 object file names should not be used as arguments. @xref{Overall
12184 @item -flinker-output=@var{type}
12185 @opindex -flinker-output
12186 This option controls the code generation of the link time optimizer. By
12187 default the linker output is determined by the linker plugin automatically. For
12188 debugging the compiler and in the case of incremental linking to non-lto object
12189 file is desired, it may be useful to control the type manually.
12191 If @var{type} is @samp{exec} the code generation is configured to produce static
12192 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12194 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12195 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12196 enabled automatically. This makes it possible to build shared libraries without
12197 position independent code on architectures this is possible, i.e. on x86.
12199 If @var{type} is @samp{pie} the code generation is configured to produce
12200 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12201 except that @option{-fpie} is not disabled if specified at compilation time.
12203 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12204 done. The sections containing intermediate code for link-time optimization are
12205 merged, pre-optimized, and output to the resulting object file. In addition, if
12206 @option{-ffat-lto-objects} is specified the binary code is produced for future
12207 non-lto linking. The object file produced by incremental linking will be smaller
12208 than a static library produced from the same object files. At link-time the
12209 result of incremental linking will also load faster to compiler than a static
12210 library assuming that majority of objects in the library are used.
12212 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12213 code generation is forced, final binary is produced and the intermediate code
12214 for later link-time optimization is stripped. When multiple object files are
12215 linked together the resulting code will be optimized better than with link time
12216 optimizations disabled (for example, the cross-module inlining will happen),
12217 most of benefits of whole program optimizations are however lost.
12219 During the incremental link (by @option{-r}) the linker plugin will default to
12220 @option{rel}. With current interfaces to GNU Binutils it is however not
12221 possible to link incrementally LTO objects and non-LTO objects into a single
12222 mixed object file. In the case any of object files in incremental link can not
12223 be used for link-time optimization the linker plugin will output warning and
12224 use @samp{nolto-rel}. To maintain the whole program optimization it is
12225 recommended to link such objects into static library instead. Alternatively it
12226 is possible to use H.J. Lu's binutils with support for mixed objects.
12229 @opindex fuse-ld=bfd
12230 Use the @command{bfd} linker instead of the default linker.
12232 @item -fuse-ld=gold
12233 @opindex fuse-ld=gold
12234 Use the @command{gold} linker instead of the default linker.
12237 @item -l@var{library}
12238 @itemx -l @var{library}
12240 Search the library named @var{library} when linking. (The second
12241 alternative with the library as a separate argument is only for
12242 POSIX compliance and is not recommended.)
12244 It makes a difference where in the command you write this option; the
12245 linker searches and processes libraries and object files in the order they
12246 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12247 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12248 to functions in @samp{z}, those functions may not be loaded.
12250 The linker searches a standard list of directories for the library,
12251 which is actually a file named @file{lib@var{library}.a}. The linker
12252 then uses this file as if it had been specified precisely by name.
12254 The directories searched include several standard system directories
12255 plus any that you specify with @option{-L}.
12257 Normally the files found this way are library files---archive files
12258 whose members are object files. The linker handles an archive file by
12259 scanning through it for members which define symbols that have so far
12260 been referenced but not defined. But if the file that is found is an
12261 ordinary object file, it is linked in the usual fashion. The only
12262 difference between using an @option{-l} option and specifying a file name
12263 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12264 and searches several directories.
12268 You need this special case of the @option{-l} option in order to
12269 link an Objective-C or Objective-C++ program.
12271 @item -nostartfiles
12272 @opindex nostartfiles
12273 Do not use the standard system startup files when linking.
12274 The standard system libraries are used normally, unless @option{-nostdlib}
12275 or @option{-nodefaultlibs} is used.
12277 @item -nodefaultlibs
12278 @opindex nodefaultlibs
12279 Do not use the standard system libraries when linking.
12280 Only the libraries you specify are passed to the linker, and options
12281 specifying linkage of the system libraries, such as @option{-static-libgcc}
12282 or @option{-shared-libgcc}, are ignored.
12283 The standard startup files are used normally, unless @option{-nostartfiles}
12286 The compiler may generate calls to @code{memcmp},
12287 @code{memset}, @code{memcpy} and @code{memmove}.
12288 These entries are usually resolved by entries in
12289 libc. These entry points should be supplied through some other
12290 mechanism when this option is specified.
12294 Do not use the standard system startup files or libraries when linking.
12295 No startup files and only the libraries you specify are passed to
12296 the linker, and options specifying linkage of the system libraries, such as
12297 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12299 The compiler may generate calls to @code{memcmp}, @code{memset},
12300 @code{memcpy} and @code{memmove}.
12301 These entries are usually resolved by entries in
12302 libc. These entry points should be supplied through some other
12303 mechanism when this option is specified.
12305 @cindex @option{-lgcc}, use with @option{-nostdlib}
12306 @cindex @option{-nostdlib} and unresolved references
12307 @cindex unresolved references and @option{-nostdlib}
12308 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12309 @cindex @option{-nodefaultlibs} and unresolved references
12310 @cindex unresolved references and @option{-nodefaultlibs}
12311 One of the standard libraries bypassed by @option{-nostdlib} and
12312 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12313 which GCC uses to overcome shortcomings of particular machines, or special
12314 needs for some languages.
12315 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12316 Collection (GCC) Internals},
12317 for more discussion of @file{libgcc.a}.)
12318 In most cases, you need @file{libgcc.a} even when you want to avoid
12319 other standard libraries. In other words, when you specify @option{-nostdlib}
12320 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12321 This ensures that you have no unresolved references to internal GCC
12322 library subroutines.
12323 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12324 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12325 GNU Compiler Collection (GCC) Internals}.)
12329 Produce a dynamically linked position independent executable on targets
12330 that support it. For predictable results, you must also specify the same
12331 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12332 or model suboptions) when you specify this linker option.
12336 Don't produce a dynamically linked position independent executable.
12339 @opindex static-pie
12340 Produce a static position independent executable on targets that support
12341 it. A static position independent executable is similar to a static
12342 executable, but can be loaded at any address without a dynamic linker.
12343 For predictable results, you must also specify the same set of options
12344 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12345 suboptions) when you specify this linker option.
12349 Link with the POSIX threads library. This option is supported on
12350 GNU/Linux targets, most other Unix derivatives, and also on
12351 x86 Cygwin and MinGW targets. On some targets this option also sets
12352 flags for the preprocessor, so it should be used consistently for both
12353 compilation and linking.
12357 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12358 that support it. This instructs the linker to add all symbols, not
12359 only used ones, to the dynamic symbol table. This option is needed
12360 for some uses of @code{dlopen} or to allow obtaining backtraces
12361 from within a program.
12365 Remove all symbol table and relocation information from the executable.
12369 On systems that support dynamic linking, this overrides @option{-pie}
12370 and prevents linking with the shared libraries. On other systems, this
12371 option has no effect.
12375 Produce a shared object which can then be linked with other objects to
12376 form an executable. Not all systems support this option. For predictable
12377 results, you must also specify the same set of options used for compilation
12378 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12379 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12380 needs to build supplementary stub code for constructors to work. On
12381 multi-libbed systems, @samp{gcc -shared} must select the correct support
12382 libraries to link against. Failing to supply the correct flags may lead
12383 to subtle defects. Supplying them in cases where they are not necessary
12386 @item -shared-libgcc
12387 @itemx -static-libgcc
12388 @opindex shared-libgcc
12389 @opindex static-libgcc
12390 On systems that provide @file{libgcc} as a shared library, these options
12391 force the use of either the shared or static version, respectively.
12392 If no shared version of @file{libgcc} was built when the compiler was
12393 configured, these options have no effect.
12395 There are several situations in which an application should use the
12396 shared @file{libgcc} instead of the static version. The most common
12397 of these is when the application wishes to throw and catch exceptions
12398 across different shared libraries. In that case, each of the libraries
12399 as well as the application itself should use the shared @file{libgcc}.
12401 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
12402 whenever you build a shared library or a main executable, because C++
12403 programs typically use exceptions, so this is the right thing to do.
12405 If, instead, you use the GCC driver to create shared libraries, you may
12406 find that they are not always linked with the shared @file{libgcc}.
12407 If GCC finds, at its configuration time, that you have a non-GNU linker
12408 or a GNU linker that does not support option @option{--eh-frame-hdr},
12409 it links the shared version of @file{libgcc} into shared libraries
12410 by default. Otherwise, it takes advantage of the linker and optimizes
12411 away the linking with the shared version of @file{libgcc}, linking with
12412 the static version of libgcc by default. This allows exceptions to
12413 propagate through such shared libraries, without incurring relocation
12414 costs at library load time.
12416 However, if a library or main executable is supposed to throw or catch
12417 exceptions, you must link it using the G++ driver, as appropriate
12418 for the languages used in the program, or using the option
12419 @option{-shared-libgcc}, such that it is linked with the shared
12422 @item -static-libasan
12423 @opindex static-libasan
12424 When the @option{-fsanitize=address} option is used to link a program,
12425 the GCC driver automatically links against @option{libasan}. If
12426 @file{libasan} is available as a shared library, and the @option{-static}
12427 option is not used, then this links against the shared version of
12428 @file{libasan}. The @option{-static-libasan} option directs the GCC
12429 driver to link @file{libasan} statically, without necessarily linking
12430 other libraries statically.
12432 @item -static-libtsan
12433 @opindex static-libtsan
12434 When the @option{-fsanitize=thread} option is used to link a program,
12435 the GCC driver automatically links against @option{libtsan}. If
12436 @file{libtsan} is available as a shared library, and the @option{-static}
12437 option is not used, then this links against the shared version of
12438 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12439 driver to link @file{libtsan} statically, without necessarily linking
12440 other libraries statically.
12442 @item -static-liblsan
12443 @opindex static-liblsan
12444 When the @option{-fsanitize=leak} option is used to link a program,
12445 the GCC driver automatically links against @option{liblsan}. If
12446 @file{liblsan} is available as a shared library, and the @option{-static}
12447 option is not used, then this links against the shared version of
12448 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12449 driver to link @file{liblsan} statically, without necessarily linking
12450 other libraries statically.
12452 @item -static-libubsan
12453 @opindex static-libubsan
12454 When the @option{-fsanitize=undefined} option is used to link a program,
12455 the GCC driver automatically links against @option{libubsan}. If
12456 @file{libubsan} is available as a shared library, and the @option{-static}
12457 option is not used, then this links against the shared version of
12458 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12459 driver to link @file{libubsan} statically, without necessarily linking
12460 other libraries statically.
12462 @item -static-libstdc++
12463 @opindex static-libstdc++
12464 When the @command{g++} program is used to link a C++ program, it
12465 normally automatically links against @option{libstdc++}. If
12466 @file{libstdc++} is available as a shared library, and the
12467 @option{-static} option is not used, then this links against the
12468 shared version of @file{libstdc++}. That is normally fine. However, it
12469 is sometimes useful to freeze the version of @file{libstdc++} used by
12470 the program without going all the way to a fully static link. The
12471 @option{-static-libstdc++} option directs the @command{g++} driver to
12472 link @file{libstdc++} statically, without necessarily linking other
12473 libraries statically.
12477 Bind references to global symbols when building a shared object. Warn
12478 about any unresolved references (unless overridden by the link editor
12479 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12482 @item -T @var{script}
12484 @cindex linker script
12485 Use @var{script} as the linker script. This option is supported by most
12486 systems using the GNU linker. On some targets, such as bare-board
12487 targets without an operating system, the @option{-T} option may be required
12488 when linking to avoid references to undefined symbols.
12490 @item -Xlinker @var{option}
12492 Pass @var{option} as an option to the linker. You can use this to
12493 supply system-specific linker options that GCC does not recognize.
12495 If you want to pass an option that takes a separate argument, you must use
12496 @option{-Xlinker} twice, once for the option and once for the argument.
12497 For example, to pass @option{-assert definitions}, you must write
12498 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12499 @option{-Xlinker "-assert definitions"}, because this passes the entire
12500 string as a single argument, which is not what the linker expects.
12502 When using the GNU linker, it is usually more convenient to pass
12503 arguments to linker options using the @option{@var{option}=@var{value}}
12504 syntax than as separate arguments. For example, you can specify
12505 @option{-Xlinker -Map=output.map} rather than
12506 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12507 this syntax for command-line options.
12509 @item -Wl,@var{option}
12511 Pass @var{option} as an option to the linker. If @var{option} contains
12512 commas, it is split into multiple options at the commas. You can use this
12513 syntax to pass an argument to the option.
12514 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12515 linker. When using the GNU linker, you can also get the same effect with
12516 @option{-Wl,-Map=output.map}.
12518 @item -u @var{symbol}
12520 Pretend the symbol @var{symbol} is undefined, to force linking of
12521 library modules to define it. You can use @option{-u} multiple times with
12522 different symbols to force loading of additional library modules.
12524 @item -z @var{keyword}
12526 @option{-z} is passed directly on to the linker along with the keyword
12527 @var{keyword}. See the section in the documentation of your linker for
12528 permitted values and their meanings.
12531 @node Directory Options
12532 @section Options for Directory Search
12533 @cindex directory options
12534 @cindex options, directory search
12535 @cindex search path
12537 These options specify directories to search for header files, for
12538 libraries and for parts of the compiler:
12541 @include cppdiropts.texi
12543 @item -iplugindir=@var{dir}
12544 @opindex iplugindir=
12545 Set the directory to search for plugins that are passed
12546 by @option{-fplugin=@var{name}} instead of
12547 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12548 to be used by the user, but only passed by the driver.
12552 Add directory @var{dir} to the list of directories to be searched
12555 @item -B@var{prefix}
12557 This option specifies where to find the executables, libraries,
12558 include files, and data files of the compiler itself.
12560 The compiler driver program runs one or more of the subprograms
12561 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12562 @var{prefix} as a prefix for each program it tries to run, both with and
12563 without @samp{@var{machine}/@var{version}/} for the corresponding target
12564 machine and compiler version.
12566 For each subprogram to be run, the compiler driver first tries the
12567 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12568 is not specified, the driver tries two standard prefixes,
12569 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12570 those results in a file name that is found, the unmodified program
12571 name is searched for using the directories specified in your
12572 @env{PATH} environment variable.
12574 The compiler checks to see if the path provided by @option{-B}
12575 refers to a directory, and if necessary it adds a directory
12576 separator character at the end of the path.
12578 @option{-B} prefixes that effectively specify directory names also apply
12579 to libraries in the linker, because the compiler translates these
12580 options into @option{-L} options for the linker. They also apply to
12581 include files in the preprocessor, because the compiler translates these
12582 options into @option{-isystem} options for the preprocessor. In this case,
12583 the compiler appends @samp{include} to the prefix.
12585 The runtime support file @file{libgcc.a} can also be searched for using
12586 the @option{-B} prefix, if needed. If it is not found there, the two
12587 standard prefixes above are tried, and that is all. The file is left
12588 out of the link if it is not found by those means.
12590 Another way to specify a prefix much like the @option{-B} prefix is to use
12591 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12594 As a special kludge, if the path provided by @option{-B} is
12595 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12596 9, then it is replaced by @file{[dir/]include}. This is to help
12597 with boot-strapping the compiler.
12599 @item -no-canonical-prefixes
12600 @opindex no-canonical-prefixes
12601 Do not expand any symbolic links, resolve references to @samp{/../}
12602 or @samp{/./}, or make the path absolute when generating a relative
12605 @item --sysroot=@var{dir}
12607 Use @var{dir} as the logical root directory for headers and libraries.
12608 For example, if the compiler normally searches for headers in
12609 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12610 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12612 If you use both this option and the @option{-isysroot} option, then
12613 the @option{--sysroot} option applies to libraries, but the
12614 @option{-isysroot} option applies to header files.
12616 The GNU linker (beginning with version 2.16) has the necessary support
12617 for this option. If your linker does not support this option, the
12618 header file aspect of @option{--sysroot} still works, but the
12619 library aspect does not.
12621 @item --no-sysroot-suffix
12622 @opindex no-sysroot-suffix
12623 For some targets, a suffix is added to the root directory specified
12624 with @option{--sysroot}, depending on the other options used, so that
12625 headers may for example be found in
12626 @file{@var{dir}/@var{suffix}/usr/include} instead of
12627 @file{@var{dir}/usr/include}. This option disables the addition of
12632 @node Code Gen Options
12633 @section Options for Code Generation Conventions
12634 @cindex code generation conventions
12635 @cindex options, code generation
12636 @cindex run-time options
12638 These machine-independent options control the interface conventions
12639 used in code generation.
12641 Most of them have both positive and negative forms; the negative form
12642 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12643 one of the forms is listed---the one that is not the default. You
12644 can figure out the other form by either removing @samp{no-} or adding
12648 @item -fstack-reuse=@var{reuse-level}
12649 @opindex fstack_reuse
12650 This option controls stack space reuse for user declared local/auto variables
12651 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12652 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12653 local variables and temporaries, @samp{named_vars} enables the reuse only for
12654 user defined local variables with names, and @samp{none} disables stack reuse
12655 completely. The default value is @samp{all}. The option is needed when the
12656 program extends the lifetime of a scoped local variable or a compiler generated
12657 temporary beyond the end point defined by the language. When a lifetime of
12658 a variable ends, and if the variable lives in memory, the optimizing compiler
12659 has the freedom to reuse its stack space with other temporaries or scoped
12660 local variables whose live range does not overlap with it. Legacy code extending
12661 local lifetime is likely to break with the stack reuse optimization.
12680 if (*p == 10) // out of scope use of local1
12691 A(int k) : i(k), j(k) @{ @}
12698 void foo(const A& ar)
12705 foo(A(10)); // temp object's lifetime ends when foo returns
12711 ap->i+= 10; // ap references out of scope temp whose space
12712 // is reused with a. What is the value of ap->i?
12717 The lifetime of a compiler generated temporary is well defined by the C++
12718 standard. When a lifetime of a temporary ends, and if the temporary lives
12719 in memory, the optimizing compiler has the freedom to reuse its stack
12720 space with other temporaries or scoped local variables whose live range
12721 does not overlap with it. However some of the legacy code relies on
12722 the behavior of older compilers in which temporaries' stack space is
12723 not reused, the aggressive stack reuse can lead to runtime errors. This
12724 option is used to control the temporary stack reuse optimization.
12728 This option generates traps for signed overflow on addition, subtraction,
12729 multiplication operations.
12730 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12731 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12732 @option{-fwrapv} being effective. Note that only active options override, so
12733 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12734 results in @option{-ftrapv} being effective.
12738 This option instructs the compiler to assume that signed arithmetic
12739 overflow of addition, subtraction and multiplication wraps around
12740 using twos-complement representation. This flag enables some optimizations
12741 and disables others.
12742 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12743 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12744 @option{-fwrapv} being effective. Note that only active options override, so
12745 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12746 results in @option{-ftrapv} being effective.
12748 @item -fwrapv-pointer
12749 @opindex fwrapv-pointer
12750 This option instructs the compiler to assume that pointer arithmetic
12751 overflow on addition and subtraction wraps around using twos-complement
12752 representation. This flag disables some optimizations which assume
12753 pointer overflow is invalid.
12755 @item -fstrict-overflow
12756 @opindex fstrict-overflow
12757 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
12758 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
12761 @opindex fexceptions
12762 Enable exception handling. Generates extra code needed to propagate
12763 exceptions. For some targets, this implies GCC generates frame
12764 unwind information for all functions, which can produce significant data
12765 size overhead, although it does not affect execution. If you do not
12766 specify this option, GCC enables it by default for languages like
12767 C++ that normally require exception handling, and disables it for
12768 languages like C that do not normally require it. However, you may need
12769 to enable this option when compiling C code that needs to interoperate
12770 properly with exception handlers written in C++. You may also wish to
12771 disable this option if you are compiling older C++ programs that don't
12772 use exception handling.
12774 @item -fnon-call-exceptions
12775 @opindex fnon-call-exceptions
12776 Generate code that allows trapping instructions to throw exceptions.
12777 Note that this requires platform-specific runtime support that does
12778 not exist everywhere. Moreover, it only allows @emph{trapping}
12779 instructions to throw exceptions, i.e.@: memory references or floating-point
12780 instructions. It does not allow exceptions to be thrown from
12781 arbitrary signal handlers such as @code{SIGALRM}.
12783 @item -fdelete-dead-exceptions
12784 @opindex fdelete-dead-exceptions
12785 Consider that instructions that may throw exceptions but don't otherwise
12786 contribute to the execution of the program can be optimized away.
12787 This option is enabled by default for the Ada front end, as permitted by
12788 the Ada language specification.
12789 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12791 @item -funwind-tables
12792 @opindex funwind-tables
12793 Similar to @option{-fexceptions}, except that it just generates any needed
12794 static data, but does not affect the generated code in any other way.
12795 You normally do not need to enable this option; instead, a language processor
12796 that needs this handling enables it on your behalf.
12798 @item -fasynchronous-unwind-tables
12799 @opindex fasynchronous-unwind-tables
12800 Generate unwind table in DWARF format, if supported by target machine. The
12801 table is exact at each instruction boundary, so it can be used for stack
12802 unwinding from asynchronous events (such as debugger or garbage collector).
12804 @item -fno-gnu-unique
12805 @opindex fno-gnu-unique
12806 On systems with recent GNU assembler and C library, the C++ compiler
12807 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12808 of template static data members and static local variables in inline
12809 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12810 is necessary to avoid problems with a library used by two different
12811 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12812 therefore disagreeing with the other one about the binding of the
12813 symbol. But this causes @code{dlclose} to be ignored for affected
12814 DSOs; if your program relies on reinitialization of a DSO via
12815 @code{dlclose} and @code{dlopen}, you can use
12816 @option{-fno-gnu-unique}.
12818 @item -fpcc-struct-return
12819 @opindex fpcc-struct-return
12820 Return ``short'' @code{struct} and @code{union} values in memory like
12821 longer ones, rather than in registers. This convention is less
12822 efficient, but it has the advantage of allowing intercallability between
12823 GCC-compiled files and files compiled with other compilers, particularly
12824 the Portable C Compiler (pcc).
12826 The precise convention for returning structures in memory depends
12827 on the target configuration macros.
12829 Short structures and unions are those whose size and alignment match
12830 that of some integer type.
12832 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12833 switch is not binary compatible with code compiled with the
12834 @option{-freg-struct-return} switch.
12835 Use it to conform to a non-default application binary interface.
12837 @item -freg-struct-return
12838 @opindex freg-struct-return
12839 Return @code{struct} and @code{union} values in registers when possible.
12840 This is more efficient for small structures than
12841 @option{-fpcc-struct-return}.
12843 If you specify neither @option{-fpcc-struct-return} nor
12844 @option{-freg-struct-return}, GCC defaults to whichever convention is
12845 standard for the target. If there is no standard convention, GCC
12846 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12847 the principal compiler. In those cases, we can choose the standard, and
12848 we chose the more efficient register return alternative.
12850 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12851 switch is not binary compatible with code compiled with the
12852 @option{-fpcc-struct-return} switch.
12853 Use it to conform to a non-default application binary interface.
12855 @item -fshort-enums
12856 @opindex fshort-enums
12857 Allocate to an @code{enum} type only as many bytes as it needs for the
12858 declared range of possible values. Specifically, the @code{enum} type
12859 is equivalent to the smallest integer type that has enough room.
12861 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12862 code that is not binary compatible with code generated without that switch.
12863 Use it to conform to a non-default application binary interface.
12865 @item -fshort-wchar
12866 @opindex fshort-wchar
12867 Override the underlying type for @code{wchar_t} to be @code{short
12868 unsigned int} instead of the default for the target. This option is
12869 useful for building programs to run under WINE@.
12871 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12872 code that is not binary compatible with code generated without that switch.
12873 Use it to conform to a non-default application binary interface.
12876 @opindex fno-common
12877 @cindex tentative definitions
12878 In C code, this option controls the placement of global variables
12879 defined without an initializer, known as @dfn{tentative definitions}
12880 in the C standard. Tentative definitions are distinct from declarations
12881 of a variable with the @code{extern} keyword, which do not allocate storage.
12883 Unix C compilers have traditionally allocated storage for
12884 uninitialized global variables in a common block. This allows the
12885 linker to resolve all tentative definitions of the same variable
12886 in different compilation units to the same object, or to a non-tentative
12888 This is the behavior specified by @option{-fcommon}, and is the default for
12889 GCC on most targets.
12890 On the other hand, this behavior is not required by ISO
12891 C, and on some targets may carry a speed or code size penalty on
12892 variable references.
12894 The @option{-fno-common} option specifies that the compiler should instead
12895 place uninitialized global variables in the data section of the object file.
12896 This inhibits the merging of tentative definitions by the linker so
12897 you get a multiple-definition error if the same
12898 variable is defined in more than one compilation unit.
12899 Compiling with @option{-fno-common} is useful on targets for which
12900 it provides better performance, or if you wish to verify that the
12901 program will work on other systems that always treat uninitialized
12902 variable definitions this way.
12906 Ignore the @code{#ident} directive.
12908 @item -finhibit-size-directive
12909 @opindex finhibit-size-directive
12910 Don't output a @code{.size} assembler directive, or anything else that
12911 would cause trouble if the function is split in the middle, and the
12912 two halves are placed at locations far apart in memory. This option is
12913 used when compiling @file{crtstuff.c}; you should not need to use it
12916 @item -fverbose-asm
12917 @opindex fverbose-asm
12918 Put extra commentary information in the generated assembly code to
12919 make it more readable. This option is generally only of use to those
12920 who actually need to read the generated assembly code (perhaps while
12921 debugging the compiler itself).
12923 @option{-fno-verbose-asm}, the default, causes the
12924 extra information to be omitted and is useful when comparing two assembler
12927 The added comments include:
12932 information on the compiler version and command-line options,
12935 the source code lines associated with the assembly instructions,
12936 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12939 hints on which high-level expressions correspond to
12940 the various assembly instruction operands.
12944 For example, given this C source file:
12952 for (i = 0; i < n; i++)
12959 compiling to (x86_64) assembly via @option{-S} and emitting the result
12960 direct to stdout via @option{-o} @option{-}
12963 gcc -S test.c -fverbose-asm -Os -o -
12966 gives output similar to this:
12970 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12977 .type test, @@function
12981 # test.c:4: int total = 0;
12982 xorl %eax, %eax # <retval>
12983 # test.c:6: for (i = 0; i < n; i++)
12984 xorl %edx, %edx # i
12986 # test.c:6: for (i = 0; i < n; i++)
12987 cmpl %edi, %edx # n, i
12989 # test.c:7: total += i * i;
12990 movl %edx, %ecx # i, tmp92
12991 imull %edx, %ecx # i, tmp92
12992 # test.c:6: for (i = 0; i < n; i++)
12994 # test.c:7: total += i * i;
12995 addl %ecx, %eax # tmp92, <retval>
13003 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13004 .section .note.GNU-stack,"",@@progbits
13007 The comments are intended for humans rather than machines and hence the
13008 precise format of the comments is subject to change.
13010 @item -frecord-gcc-switches
13011 @opindex frecord-gcc-switches
13012 This switch causes the command line used to invoke the
13013 compiler to be recorded into the object file that is being created.
13014 This switch is only implemented on some targets and the exact format
13015 of the recording is target and binary file format dependent, but it
13016 usually takes the form of a section containing ASCII text. This
13017 switch is related to the @option{-fverbose-asm} switch, but that
13018 switch only records information in the assembler output file as
13019 comments, so it never reaches the object file.
13020 See also @option{-grecord-gcc-switches} for another
13021 way of storing compiler options into the object file.
13025 @cindex global offset table
13027 Generate position-independent code (PIC) suitable for use in a shared
13028 library, if supported for the target machine. Such code accesses all
13029 constant addresses through a global offset table (GOT)@. The dynamic
13030 loader resolves the GOT entries when the program starts (the dynamic
13031 loader is not part of GCC; it is part of the operating system). If
13032 the GOT size for the linked executable exceeds a machine-specific
13033 maximum size, you get an error message from the linker indicating that
13034 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13035 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13036 on the m68k and RS/6000. The x86 has no such limit.)
13038 Position-independent code requires special support, and therefore works
13039 only on certain machines. For the x86, GCC supports PIC for System V
13040 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13041 position-independent.
13043 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13048 If supported for the target machine, emit position-independent code,
13049 suitable for dynamic linking and avoiding any limit on the size of the
13050 global offset table. This option makes a difference on AArch64, m68k,
13051 PowerPC and SPARC@.
13053 Position-independent code requires special support, and therefore works
13054 only on certain machines.
13056 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13063 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13064 generated position-independent code can be only linked into executables.
13065 Usually these options are used to compile code that will be linked using
13066 the @option{-pie} GCC option.
13068 @option{-fpie} and @option{-fPIE} both define the macros
13069 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13070 for @option{-fpie} and 2 for @option{-fPIE}.
13074 Do not use the PLT for external function calls in position-independent code.
13075 Instead, load the callee address at call sites from the GOT and branch to it.
13076 This leads to more efficient code by eliminating PLT stubs and exposing
13077 GOT loads to optimizations. On architectures such as 32-bit x86 where
13078 PLT stubs expect the GOT pointer in a specific register, this gives more
13079 register allocation freedom to the compiler.
13080 Lazy binding requires use of the PLT;
13081 with @option{-fno-plt} all external symbols are resolved at load time.
13083 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13084 through the PLT for specific external functions.
13086 In position-dependent code, a few targets also convert calls to
13087 functions that are marked to not use the PLT to use the GOT instead.
13089 @item -fno-jump-tables
13090 @opindex fno-jump-tables
13091 Do not use jump tables for switch statements even where it would be
13092 more efficient than other code generation strategies. This option is
13093 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13094 building code that forms part of a dynamic linker and cannot
13095 reference the address of a jump table. On some targets, jump tables
13096 do not require a GOT and this option is not needed.
13098 @item -ffixed-@var{reg}
13100 Treat the register named @var{reg} as a fixed register; generated code
13101 should never refer to it (except perhaps as a stack pointer, frame
13102 pointer or in some other fixed role).
13104 @var{reg} must be the name of a register. The register names accepted
13105 are machine-specific and are defined in the @code{REGISTER_NAMES}
13106 macro in the machine description macro file.
13108 This flag does not have a negative form, because it specifies a
13111 @item -fcall-used-@var{reg}
13112 @opindex fcall-used
13113 Treat the register named @var{reg} as an allocable register that is
13114 clobbered by function calls. It may be allocated for temporaries or
13115 variables that do not live across a call. Functions compiled this way
13116 do not save and restore the register @var{reg}.
13118 It is an error to use this flag with the frame pointer or stack pointer.
13119 Use of this flag for other registers that have fixed pervasive roles in
13120 the machine's execution model produces disastrous results.
13122 This flag does not have a negative form, because it specifies a
13125 @item -fcall-saved-@var{reg}
13126 @opindex fcall-saved
13127 Treat the register named @var{reg} as an allocable register saved by
13128 functions. It may be allocated even for temporaries or variables that
13129 live across a call. Functions compiled this way save and restore
13130 the register @var{reg} if they use it.
13132 It is an error to use this flag with the frame pointer or stack pointer.
13133 Use of this flag for other registers that have fixed pervasive roles in
13134 the machine's execution model produces disastrous results.
13136 A different sort of disaster results from the use of this flag for
13137 a register in which function values may be returned.
13139 This flag does not have a negative form, because it specifies a
13142 @item -fpack-struct[=@var{n}]
13143 @opindex fpack-struct
13144 Without a value specified, pack all structure members together without
13145 holes. When a value is specified (which must be a small power of two), pack
13146 structure members according to this value, representing the maximum
13147 alignment (that is, objects with default alignment requirements larger than
13148 this are output potentially unaligned at the next fitting location.
13150 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13151 code that is not binary compatible with code generated without that switch.
13152 Additionally, it makes the code suboptimal.
13153 Use it to conform to a non-default application binary interface.
13155 @item -fleading-underscore
13156 @opindex fleading-underscore
13157 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13158 change the way C symbols are represented in the object file. One use
13159 is to help link with legacy assembly code.
13161 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13162 generate code that is not binary compatible with code generated without that
13163 switch. Use it to conform to a non-default application binary interface.
13164 Not all targets provide complete support for this switch.
13166 @item -ftls-model=@var{model}
13167 @opindex ftls-model
13168 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13169 The @var{model} argument should be one of @samp{global-dynamic},
13170 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13171 Note that the choice is subject to optimization: the compiler may use
13172 a more efficient model for symbols not visible outside of the translation
13173 unit, or if @option{-fpic} is not given on the command line.
13175 The default without @option{-fpic} is @samp{initial-exec}; with
13176 @option{-fpic} the default is @samp{global-dynamic}.
13178 @item -ftrampolines
13179 @opindex ftrampolines
13180 For targets that normally need trampolines for nested functions, always
13181 generate them instead of using descriptors. Otherwise, for targets that
13182 do not need them, like for example HP-PA or IA-64, do nothing.
13184 A trampoline is a small piece of code that is created at run time on the
13185 stack when the address of a nested function is taken, and is used to call
13186 the nested function indirectly. Therefore, it requires the stack to be
13187 made executable in order for the program to work properly.
13189 @option{-fno-trampolines} is enabled by default on a language by language
13190 basis to let the compiler avoid generating them, if it computes that this
13191 is safe, and replace them with descriptors. Descriptors are made up of data
13192 only, but the generated code must be prepared to deal with them. As of this
13193 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13195 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13196 @option{-fno-trampolines} are not binary compatible if nested functions are
13197 present. This option must therefore be used on a program-wide basis and be
13198 manipulated with extreme care.
13200 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13201 @opindex fvisibility
13202 Set the default ELF image symbol visibility to the specified option---all
13203 symbols are marked with this unless overridden within the code.
13204 Using this feature can very substantially improve linking and
13205 load times of shared object libraries, produce more optimized
13206 code, provide near-perfect API export and prevent symbol clashes.
13207 It is @strong{strongly} recommended that you use this in any shared objects
13210 Despite the nomenclature, @samp{default} always means public; i.e.,
13211 available to be linked against from outside the shared object.
13212 @samp{protected} and @samp{internal} are pretty useless in real-world
13213 usage so the only other commonly used option is @samp{hidden}.
13214 The default if @option{-fvisibility} isn't specified is
13215 @samp{default}, i.e., make every symbol public.
13217 A good explanation of the benefits offered by ensuring ELF
13218 symbols have the correct visibility is given by ``How To Write
13219 Shared Libraries'' by Ulrich Drepper (which can be found at
13220 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13221 solution made possible by this option to marking things hidden when
13222 the default is public is to make the default hidden and mark things
13223 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13224 and @code{__attribute__ ((visibility("default")))} instead of
13225 @code{__declspec(dllexport)} you get almost identical semantics with
13226 identical syntax. This is a great boon to those working with
13227 cross-platform projects.
13229 For those adding visibility support to existing code, you may find
13230 @code{#pragma GCC visibility} of use. This works by you enclosing
13231 the declarations you wish to set visibility for with (for example)
13232 @code{#pragma GCC visibility push(hidden)} and
13233 @code{#pragma GCC visibility pop}.
13234 Bear in mind that symbol visibility should be viewed @strong{as
13235 part of the API interface contract} and thus all new code should
13236 always specify visibility when it is not the default; i.e., declarations
13237 only for use within the local DSO should @strong{always} be marked explicitly
13238 as hidden as so to avoid PLT indirection overheads---making this
13239 abundantly clear also aids readability and self-documentation of the code.
13240 Note that due to ISO C++ specification requirements, @code{operator new} and
13241 @code{operator delete} must always be of default visibility.
13243 Be aware that headers from outside your project, in particular system
13244 headers and headers from any other library you use, may not be
13245 expecting to be compiled with visibility other than the default. You
13246 may need to explicitly say @code{#pragma GCC visibility push(default)}
13247 before including any such headers.
13249 @code{extern} declarations are not affected by @option{-fvisibility}, so
13250 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13251 no modifications. However, this means that calls to @code{extern}
13252 functions with no explicit visibility use the PLT, so it is more
13253 effective to use @code{__attribute ((visibility))} and/or
13254 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13255 declarations should be treated as hidden.
13257 Note that @option{-fvisibility} does affect C++ vague linkage
13258 entities. This means that, for instance, an exception class that is
13259 be thrown between DSOs must be explicitly marked with default
13260 visibility so that the @samp{type_info} nodes are unified between
13263 An overview of these techniques, their benefits and how to use them
13264 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13266 @item -fstrict-volatile-bitfields
13267 @opindex fstrict-volatile-bitfields
13268 This option should be used if accesses to volatile bit-fields (or other
13269 structure fields, although the compiler usually honors those types
13270 anyway) should use a single access of the width of the
13271 field's type, aligned to a natural alignment if possible. For
13272 example, targets with memory-mapped peripheral registers might require
13273 all such accesses to be 16 bits wide; with this flag you can
13274 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13275 is 16 bits on these targets) to force GCC to use 16-bit accesses
13276 instead of, perhaps, a more efficient 32-bit access.
13278 If this option is disabled, the compiler uses the most efficient
13279 instruction. In the previous example, that might be a 32-bit load
13280 instruction, even though that accesses bytes that do not contain
13281 any portion of the bit-field, or memory-mapped registers unrelated to
13282 the one being updated.
13284 In some cases, such as when the @code{packed} attribute is applied to a
13285 structure field, it may not be possible to access the field with a single
13286 read or write that is correctly aligned for the target machine. In this
13287 case GCC falls back to generating multiple accesses rather than code that
13288 will fault or truncate the result at run time.
13290 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13291 not allowed to touch non bit-field members. It is therefore recommended
13292 to define all bits of the field's type as bit-field members.
13294 The default value of this option is determined by the application binary
13295 interface for the target processor.
13297 @item -fsync-libcalls
13298 @opindex fsync-libcalls
13299 This option controls whether any out-of-line instance of the @code{__sync}
13300 family of functions may be used to implement the C++11 @code{__atomic}
13301 family of functions.
13303 The default value of this option is enabled, thus the only useful form
13304 of the option is @option{-fno-sync-libcalls}. This option is used in
13305 the implementation of the @file{libatomic} runtime library.
13309 @node Developer Options
13310 @section GCC Developer Options
13311 @cindex developer options
13312 @cindex debugging GCC
13313 @cindex debug dump options
13314 @cindex dump options
13315 @cindex compilation statistics
13317 This section describes command-line options that are primarily of
13318 interest to GCC developers, including options to support compiler
13319 testing and investigation of compiler bugs and compile-time
13320 performance problems. This includes options that produce debug dumps
13321 at various points in the compilation; that print statistics such as
13322 memory use and execution time; and that print information about GCC's
13323 configuration, such as where it searches for libraries. You should
13324 rarely need to use any of these options for ordinary compilation and
13327 Many developer options that cause GCC to dump output to a file take an
13328 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13329 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13332 If @samp{=@var{filename}} is omitted, a default dump file name is
13333 constructed by concatenating the base dump file name, a pass number,
13334 phase letter, and pass name. The base dump file name is the name of
13335 output file produced by the compiler if explicitly specified and not
13336 an executable; otherwise it is the source file name.
13337 The pass number is determined by the order passes are registered with
13338 the compiler's pass manager.
13339 This is generally the same as the order of execution, but passes
13340 registered by plugins, target-specific passes, or passes that are
13341 otherwise registered late are numbered higher than the pass named
13342 @samp{final}, even if they are executed earlier. The phase letter is
13343 one of @samp{i} (inter-procedural analysis), @samp{l}
13344 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13345 The files are created in the directory of the output file.
13349 @item -d@var{letters}
13350 @itemx -fdump-rtl-@var{pass}
13351 @itemx -fdump-rtl-@var{pass}=@var{filename}
13353 @opindex fdump-rtl-@var{pass}
13354 Says to make debugging dumps during compilation at times specified by
13355 @var{letters}. This is used for debugging the RTL-based passes of the
13358 Some @option{-d@var{letters}} switches have different meaning when
13359 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13360 for information about preprocessor-specific dump options.
13362 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13363 @option{-d} option @var{letters}. Here are the possible
13364 letters for use in @var{pass} and @var{letters}, and their meanings:
13368 @item -fdump-rtl-alignments
13369 @opindex fdump-rtl-alignments
13370 Dump after branch alignments have been computed.
13372 @item -fdump-rtl-asmcons
13373 @opindex fdump-rtl-asmcons
13374 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13376 @item -fdump-rtl-auto_inc_dec
13377 @opindex fdump-rtl-auto_inc_dec
13378 Dump after auto-inc-dec discovery. This pass is only run on
13379 architectures that have auto inc or auto dec instructions.
13381 @item -fdump-rtl-barriers
13382 @opindex fdump-rtl-barriers
13383 Dump after cleaning up the barrier instructions.
13385 @item -fdump-rtl-bbpart
13386 @opindex fdump-rtl-bbpart
13387 Dump after partitioning hot and cold basic blocks.
13389 @item -fdump-rtl-bbro
13390 @opindex fdump-rtl-bbro
13391 Dump after block reordering.
13393 @item -fdump-rtl-btl1
13394 @itemx -fdump-rtl-btl2
13395 @opindex fdump-rtl-btl2
13396 @opindex fdump-rtl-btl2
13397 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13398 after the two branch
13399 target load optimization passes.
13401 @item -fdump-rtl-bypass
13402 @opindex fdump-rtl-bypass
13403 Dump after jump bypassing and control flow optimizations.
13405 @item -fdump-rtl-combine
13406 @opindex fdump-rtl-combine
13407 Dump after the RTL instruction combination pass.
13409 @item -fdump-rtl-compgotos
13410 @opindex fdump-rtl-compgotos
13411 Dump after duplicating the computed gotos.
13413 @item -fdump-rtl-ce1
13414 @itemx -fdump-rtl-ce2
13415 @itemx -fdump-rtl-ce3
13416 @opindex fdump-rtl-ce1
13417 @opindex fdump-rtl-ce2
13418 @opindex fdump-rtl-ce3
13419 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13420 @option{-fdump-rtl-ce3} enable dumping after the three
13421 if conversion passes.
13423 @item -fdump-rtl-cprop_hardreg
13424 @opindex fdump-rtl-cprop_hardreg
13425 Dump after hard register copy propagation.
13427 @item -fdump-rtl-csa
13428 @opindex fdump-rtl-csa
13429 Dump after combining stack adjustments.
13431 @item -fdump-rtl-cse1
13432 @itemx -fdump-rtl-cse2
13433 @opindex fdump-rtl-cse1
13434 @opindex fdump-rtl-cse2
13435 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13436 the two common subexpression elimination passes.
13438 @item -fdump-rtl-dce
13439 @opindex fdump-rtl-dce
13440 Dump after the standalone dead code elimination passes.
13442 @item -fdump-rtl-dbr
13443 @opindex fdump-rtl-dbr
13444 Dump after delayed branch scheduling.
13446 @item -fdump-rtl-dce1
13447 @itemx -fdump-rtl-dce2
13448 @opindex fdump-rtl-dce1
13449 @opindex fdump-rtl-dce2
13450 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13451 the two dead store elimination passes.
13453 @item -fdump-rtl-eh
13454 @opindex fdump-rtl-eh
13455 Dump after finalization of EH handling code.
13457 @item -fdump-rtl-eh_ranges
13458 @opindex fdump-rtl-eh_ranges
13459 Dump after conversion of EH handling range regions.
13461 @item -fdump-rtl-expand
13462 @opindex fdump-rtl-expand
13463 Dump after RTL generation.
13465 @item -fdump-rtl-fwprop1
13466 @itemx -fdump-rtl-fwprop2
13467 @opindex fdump-rtl-fwprop1
13468 @opindex fdump-rtl-fwprop2
13469 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13470 dumping after the two forward propagation passes.
13472 @item -fdump-rtl-gcse1
13473 @itemx -fdump-rtl-gcse2
13474 @opindex fdump-rtl-gcse1
13475 @opindex fdump-rtl-gcse2
13476 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13477 after global common subexpression elimination.
13479 @item -fdump-rtl-init-regs
13480 @opindex fdump-rtl-init-regs
13481 Dump after the initialization of the registers.
13483 @item -fdump-rtl-initvals
13484 @opindex fdump-rtl-initvals
13485 Dump after the computation of the initial value sets.
13487 @item -fdump-rtl-into_cfglayout
13488 @opindex fdump-rtl-into_cfglayout
13489 Dump after converting to cfglayout mode.
13491 @item -fdump-rtl-ira
13492 @opindex fdump-rtl-ira
13493 Dump after iterated register allocation.
13495 @item -fdump-rtl-jump
13496 @opindex fdump-rtl-jump
13497 Dump after the second jump optimization.
13499 @item -fdump-rtl-loop2
13500 @opindex fdump-rtl-loop2
13501 @option{-fdump-rtl-loop2} enables dumping after the rtl
13502 loop optimization passes.
13504 @item -fdump-rtl-mach
13505 @opindex fdump-rtl-mach
13506 Dump after performing the machine dependent reorganization pass, if that
13509 @item -fdump-rtl-mode_sw
13510 @opindex fdump-rtl-mode_sw
13511 Dump after removing redundant mode switches.
13513 @item -fdump-rtl-rnreg
13514 @opindex fdump-rtl-rnreg
13515 Dump after register renumbering.
13517 @item -fdump-rtl-outof_cfglayout
13518 @opindex fdump-rtl-outof_cfglayout
13519 Dump after converting from cfglayout mode.
13521 @item -fdump-rtl-peephole2
13522 @opindex fdump-rtl-peephole2
13523 Dump after the peephole pass.
13525 @item -fdump-rtl-postreload
13526 @opindex fdump-rtl-postreload
13527 Dump after post-reload optimizations.
13529 @item -fdump-rtl-pro_and_epilogue
13530 @opindex fdump-rtl-pro_and_epilogue
13531 Dump after generating the function prologues and epilogues.
13533 @item -fdump-rtl-sched1
13534 @itemx -fdump-rtl-sched2
13535 @opindex fdump-rtl-sched1
13536 @opindex fdump-rtl-sched2
13537 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13538 after the basic block scheduling passes.
13540 @item -fdump-rtl-ree
13541 @opindex fdump-rtl-ree
13542 Dump after sign/zero extension elimination.
13544 @item -fdump-rtl-seqabstr
13545 @opindex fdump-rtl-seqabstr
13546 Dump after common sequence discovery.
13548 @item -fdump-rtl-shorten
13549 @opindex fdump-rtl-shorten
13550 Dump after shortening branches.
13552 @item -fdump-rtl-sibling
13553 @opindex fdump-rtl-sibling
13554 Dump after sibling call optimizations.
13556 @item -fdump-rtl-split1
13557 @itemx -fdump-rtl-split2
13558 @itemx -fdump-rtl-split3
13559 @itemx -fdump-rtl-split4
13560 @itemx -fdump-rtl-split5
13561 @opindex fdump-rtl-split1
13562 @opindex fdump-rtl-split2
13563 @opindex fdump-rtl-split3
13564 @opindex fdump-rtl-split4
13565 @opindex fdump-rtl-split5
13566 These options enable dumping after five rounds of
13567 instruction splitting.
13569 @item -fdump-rtl-sms
13570 @opindex fdump-rtl-sms
13571 Dump after modulo scheduling. This pass is only run on some
13574 @item -fdump-rtl-stack
13575 @opindex fdump-rtl-stack
13576 Dump after conversion from GCC's ``flat register file'' registers to the
13577 x87's stack-like registers. This pass is only run on x86 variants.
13579 @item -fdump-rtl-subreg1
13580 @itemx -fdump-rtl-subreg2
13581 @opindex fdump-rtl-subreg1
13582 @opindex fdump-rtl-subreg2
13583 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13584 the two subreg expansion passes.
13586 @item -fdump-rtl-unshare
13587 @opindex fdump-rtl-unshare
13588 Dump after all rtl has been unshared.
13590 @item -fdump-rtl-vartrack
13591 @opindex fdump-rtl-vartrack
13592 Dump after variable tracking.
13594 @item -fdump-rtl-vregs
13595 @opindex fdump-rtl-vregs
13596 Dump after converting virtual registers to hard registers.
13598 @item -fdump-rtl-web
13599 @opindex fdump-rtl-web
13600 Dump after live range splitting.
13602 @item -fdump-rtl-regclass
13603 @itemx -fdump-rtl-subregs_of_mode_init
13604 @itemx -fdump-rtl-subregs_of_mode_finish
13605 @itemx -fdump-rtl-dfinit
13606 @itemx -fdump-rtl-dfinish
13607 @opindex fdump-rtl-regclass
13608 @opindex fdump-rtl-subregs_of_mode_init
13609 @opindex fdump-rtl-subregs_of_mode_finish
13610 @opindex fdump-rtl-dfinit
13611 @opindex fdump-rtl-dfinish
13612 These dumps are defined but always produce empty files.
13615 @itemx -fdump-rtl-all
13617 @opindex fdump-rtl-all
13618 Produce all the dumps listed above.
13622 Annotate the assembler output with miscellaneous debugging information.
13626 Dump all macro definitions, at the end of preprocessing, in addition to
13631 Produce a core dump whenever an error occurs.
13635 Annotate the assembler output with a comment indicating which
13636 pattern and alternative is used. The length and cost of each instruction are
13641 Dump the RTL in the assembler output as a comment before each instruction.
13642 Also turns on @option{-dp} annotation.
13646 Just generate RTL for a function instead of compiling it. Usually used
13647 with @option{-fdump-rtl-expand}.
13650 @item -fdump-noaddr
13651 @opindex fdump-noaddr
13652 When doing debugging dumps, suppress address output. This makes it more
13653 feasible to use diff on debugging dumps for compiler invocations with
13654 different compiler binaries and/or different
13655 text / bss / data / heap / stack / dso start locations.
13658 @opindex freport-bug
13659 Collect and dump debug information into a temporary file if an
13660 internal compiler error (ICE) occurs.
13662 @item -fdump-unnumbered
13663 @opindex fdump-unnumbered
13664 When doing debugging dumps, suppress instruction numbers and address output.
13665 This makes it more feasible to use diff on debugging dumps for compiler
13666 invocations with different options, in particular with and without
13669 @item -fdump-unnumbered-links
13670 @opindex fdump-unnumbered-links
13671 When doing debugging dumps (see @option{-d} option above), suppress
13672 instruction numbers for the links to the previous and next instructions
13675 @item -fdump-ipa-@var{switch}
13677 Control the dumping at various stages of inter-procedural analysis
13678 language tree to a file. The file name is generated by appending a
13679 switch specific suffix to the source file name, and the file is created
13680 in the same directory as the output file. The following dumps are
13685 Enables all inter-procedural analysis dumps.
13688 Dumps information about call-graph optimization, unused function removal,
13689 and inlining decisions.
13692 Dump after function inlining.
13696 @item -fdump-lang-all
13697 @itemx -fdump-lang-@var{switch}
13698 @itemx -fdump-lang-@var{switch}-@var{options}
13699 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13700 @opindex fdump-lang-all
13701 @opindex fdump-lang
13702 Control the dumping of language-specific information. The @var{options}
13703 and @var{filename} portions behave as described in the
13704 @option{-fdump-tree} option. The following @var{switch} values are
13710 Enable all language-specific dumps.
13713 Dump class hierarchy information. Virtual table information is emitted
13714 unless '@option{slim}' is specified. This option is applicable to C++ only.
13717 Dump the raw internal tree data. This option is applicable to C++ only.
13721 @item -fdump-passes
13722 @opindex fdump-passes
13723 Print on @file{stderr} the list of optimization passes that are turned
13724 on and off by the current command-line options.
13726 @item -fdump-statistics-@var{option}
13727 @opindex fdump-statistics
13728 Enable and control dumping of pass statistics in a separate file. The
13729 file name is generated by appending a suffix ending in
13730 @samp{.statistics} to the source file name, and the file is created in
13731 the same directory as the output file. If the @samp{-@var{option}}
13732 form is used, @samp{-stats} causes counters to be summed over the
13733 whole compilation unit while @samp{-details} dumps every event as
13734 the passes generate them. The default with no option is to sum
13735 counters for each function compiled.
13737 @item -fdump-tree-all
13738 @itemx -fdump-tree-@var{switch}
13739 @itemx -fdump-tree-@var{switch}-@var{options}
13740 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13741 @opindex fdump-tree-all
13742 @opindex fdump-tree
13743 Control the dumping at various stages of processing the intermediate
13744 language tree to a file. If the @samp{-@var{options}}
13745 form is used, @var{options} is a list of @samp{-} separated options
13746 which control the details of the dump. Not all options are applicable
13747 to all dumps; those that are not meaningful are ignored. The
13748 following options are available
13752 Print the address of each node. Usually this is not meaningful as it
13753 changes according to the environment and source file. Its primary use
13754 is for tying up a dump file with a debug environment.
13756 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13757 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13758 use working backward from mangled names in the assembly file.
13760 When dumping front-end intermediate representations, inhibit dumping
13761 of members of a scope or body of a function merely because that scope
13762 has been reached. Only dump such items when they are directly reachable
13763 by some other path.
13765 When dumping pretty-printed trees, this option inhibits dumping the
13766 bodies of control structures.
13768 When dumping RTL, print the RTL in slim (condensed) form instead of
13769 the default LISP-like representation.
13771 Print a raw representation of the tree. By default, trees are
13772 pretty-printed into a C-like representation.
13774 Enable more detailed dumps (not honored by every dump option). Also
13775 include information from the optimization passes.
13777 Enable dumping various statistics about the pass (not honored by every dump
13780 Enable showing basic block boundaries (disabled in raw dumps).
13782 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13783 dump a representation of the control flow graph suitable for viewing with
13784 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13785 the file is pretty-printed as a subgraph, so that GraphViz can render them
13786 all in a single plot.
13788 This option currently only works for RTL dumps, and the RTL is always
13789 dumped in slim form.
13791 Enable showing virtual operands for every statement.
13793 Enable showing line numbers for statements.
13795 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13797 Enable showing the tree dump for each statement.
13799 Enable showing the EH region number holding each statement.
13801 Enable showing scalar evolution analysis details.
13803 Enable showing optimization information (only available in certain
13806 Enable showing missed optimization information (only available in certain
13809 Enable other detailed optimization information (only available in
13812 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13813 and @option{lineno}.
13815 Turn on all optimization options, i.e., @option{optimized},
13816 @option{missed}, and @option{note}.
13819 To determine what tree dumps are available or find the dump for a pass
13820 of interest follow the steps below.
13824 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13825 look for a code that corresponds to the pass you are interested in.
13826 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13827 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13828 The number at the end distinguishes distinct invocations of the same pass.
13830 To enable the creation of the dump file, append the pass code to
13831 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13832 to enable the dump from the Early Value Range Propagation pass, invoke
13833 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13834 specify the name of the dump file. If you don't specify one, GCC
13835 creates as described below.
13837 Find the pass dump in a file whose name is composed of three components
13838 separated by a period: the name of the source file GCC was invoked to
13839 compile, a numeric suffix indicating the pass number followed by the
13840 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13841 and finally the pass code. For example, the Early VRP pass dump might
13842 be in a file named @file{myfile.c.038t.evrp} in the current working
13843 directory. Note that the numeric codes are not stable and may change
13844 from one version of GCC to another.
13848 @itemx -fopt-info-@var{options}
13849 @itemx -fopt-info-@var{options}=@var{filename}
13851 Controls optimization dumps from various optimization passes. If the
13852 @samp{-@var{options}} form is used, @var{options} is a list of
13853 @samp{-} separated option keywords to select the dump details and
13856 The @var{options} can be divided into two groups: options describing the
13857 verbosity of the dump, and options describing which optimizations
13858 should be included. The options from both the groups can be freely
13859 mixed as they are non-overlapping. However, in case of any conflicts,
13860 the later options override the earlier options on the command
13863 The following options control the dump verbosity:
13867 Print information when an optimization is successfully applied. It is
13868 up to a pass to decide which information is relevant. For example, the
13869 vectorizer passes print the source location of loops which are
13870 successfully vectorized.
13872 Print information about missed optimizations. Individual passes
13873 control which information to include in the output.
13875 Print verbose information about optimizations, such as certain
13876 transformations, more detailed messages about decisions etc.
13878 Print detailed optimization information. This includes
13879 @samp{optimized}, @samp{missed}, and @samp{note}.
13882 One or more of the following option keywords can be used to describe a
13883 group of optimizations:
13887 Enable dumps from all interprocedural optimizations.
13889 Enable dumps from all loop optimizations.
13891 Enable dumps from all inlining optimizations.
13893 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13895 Enable dumps from all vectorization optimizations.
13897 Enable dumps from all optimizations. This is a superset of
13898 the optimization groups listed above.
13901 If @var{options} is
13902 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13903 info about successful optimizations from all the passes.
13905 If the @var{filename} is provided, then the dumps from all the
13906 applicable optimizations are concatenated into the @var{filename}.
13907 Otherwise the dump is output onto @file{stderr}. Though multiple
13908 @option{-fopt-info} options are accepted, only one of them can include
13909 a @var{filename}. If other filenames are provided then all but the
13910 first such option are ignored.
13912 Note that the output @var{filename} is overwritten
13913 in case of multiple translation units. If a combined output from
13914 multiple translation units is desired, @file{stderr} should be used
13917 In the following example, the optimization info is output to
13926 gcc -O3 -fopt-info-missed=missed.all
13930 outputs missed optimization report from all the passes into
13931 @file{missed.all}, and this one:
13934 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13938 prints information about missed optimization opportunities from
13939 vectorization passes on @file{stderr}.
13940 Note that @option{-fopt-info-vec-missed} is equivalent to
13941 @option{-fopt-info-missed-vec}. The order of the optimization group
13942 names and message types listed after @option{-fopt-info} does not matter.
13944 As another example,
13946 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13950 outputs information about missed optimizations as well as
13951 optimized locations from all the inlining passes into
13957 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13961 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13962 in conflict since only one output file is allowed. In this case, only
13963 the first option takes effect and the subsequent options are
13964 ignored. Thus only @file{vec.miss} is produced which contains
13965 dumps from the vectorizer about missed opportunities.
13967 @item -fsched-verbose=@var{n}
13968 @opindex fsched-verbose
13969 On targets that use instruction scheduling, this option controls the
13970 amount of debugging output the scheduler prints to the dump files.
13972 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13973 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13974 For @var{n} greater than one, it also output basic block probabilities,
13975 detailed ready list information and unit/insn info. For @var{n} greater
13976 than two, it includes RTL at abort point, control-flow and regions info.
13977 And for @var{n} over four, @option{-fsched-verbose} also includes
13982 @item -fenable-@var{kind}-@var{pass}
13983 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13987 This is a set of options that are used to explicitly disable/enable
13988 optimization passes. These options are intended for use for debugging GCC.
13989 Compiler users should use regular options for enabling/disabling
13994 @item -fdisable-ipa-@var{pass}
13995 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13996 statically invoked in the compiler multiple times, the pass name should be
13997 appended with a sequential number starting from 1.
13999 @item -fdisable-rtl-@var{pass}
14000 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14001 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14002 statically invoked in the compiler multiple times, the pass name should be
14003 appended with a sequential number starting from 1. @var{range-list} is a
14004 comma-separated list of function ranges or assembler names. Each range is a number
14005 pair separated by a colon. The range is inclusive in both ends. If the range
14006 is trivial, the number pair can be simplified as a single number. If the
14007 function's call graph node's @var{uid} falls within one of the specified ranges,
14008 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14009 function header of a dump file, and the pass names can be dumped by using
14010 option @option{-fdump-passes}.
14012 @item -fdisable-tree-@var{pass}
14013 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14014 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14017 @item -fenable-ipa-@var{pass}
14018 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14019 statically invoked in the compiler multiple times, the pass name should be
14020 appended with a sequential number starting from 1.
14022 @item -fenable-rtl-@var{pass}
14023 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14024 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14025 description and examples.
14027 @item -fenable-tree-@var{pass}
14028 @itemx -fenable-tree-@var{pass}=@var{range-list}
14029 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14030 of option arguments.
14034 Here are some examples showing uses of these options.
14038 # disable ccp1 for all functions
14039 -fdisable-tree-ccp1
14040 # disable complete unroll for function whose cgraph node uid is 1
14041 -fenable-tree-cunroll=1
14042 # disable gcse2 for functions at the following ranges [1,1],
14043 # [300,400], and [400,1000]
14044 # disable gcse2 for functions foo and foo2
14045 -fdisable-rtl-gcse2=foo,foo2
14046 # disable early inlining
14047 -fdisable-tree-einline
14048 # disable ipa inlining
14049 -fdisable-ipa-inline
14050 # enable tree full unroll
14051 -fenable-tree-unroll
14056 @itemx -fchecking=@var{n}
14058 @opindex fno-checking
14059 Enable internal consistency checking. The default depends on
14060 the compiler configuration. @option{-fchecking=2} enables further
14061 internal consistency checking that might affect code generation.
14063 @item -frandom-seed=@var{string}
14064 @opindex frandom-seed
14065 This option provides a seed that GCC uses in place of
14066 random numbers in generating certain symbol names
14067 that have to be different in every compiled file. It is also used to
14068 place unique stamps in coverage data files and the object files that
14069 produce them. You can use the @option{-frandom-seed} option to produce
14070 reproducibly identical object files.
14072 The @var{string} can either be a number (decimal, octal or hex) or an
14073 arbitrary string (in which case it's converted to a number by
14076 The @var{string} should be different for every file you compile.
14079 @itemx -save-temps=cwd
14080 @opindex save-temps
14081 Store the usual ``temporary'' intermediate files permanently; place them
14082 in the current directory and name them based on the source file. Thus,
14083 compiling @file{foo.c} with @option{-c -save-temps} produces files
14084 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14085 preprocessed @file{foo.i} output file even though the compiler now
14086 normally uses an integrated preprocessor.
14088 When used in combination with the @option{-x} command-line option,
14089 @option{-save-temps} is sensible enough to avoid over writing an
14090 input source file with the same extension as an intermediate file.
14091 The corresponding intermediate file may be obtained by renaming the
14092 source file before using @option{-save-temps}.
14094 If you invoke GCC in parallel, compiling several different source
14095 files that share a common base name in different subdirectories or the
14096 same source file compiled for multiple output destinations, it is
14097 likely that the different parallel compilers will interfere with each
14098 other, and overwrite the temporary files. For instance:
14101 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14102 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14105 may result in @file{foo.i} and @file{foo.o} being written to
14106 simultaneously by both compilers.
14108 @item -save-temps=obj
14109 @opindex save-temps=obj
14110 Store the usual ``temporary'' intermediate files permanently. If the
14111 @option{-o} option is used, the temporary files are based on the
14112 object file. If the @option{-o} option is not used, the
14113 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14118 gcc -save-temps=obj -c foo.c
14119 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14120 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14124 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14125 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14126 @file{dir2/yfoobar.o}.
14128 @item -time@r{[}=@var{file}@r{]}
14130 Report the CPU time taken by each subprocess in the compilation
14131 sequence. For C source files, this is the compiler proper and assembler
14132 (plus the linker if linking is done).
14134 Without the specification of an output file, the output looks like this:
14141 The first number on each line is the ``user time'', that is time spent
14142 executing the program itself. The second number is ``system time'',
14143 time spent executing operating system routines on behalf of the program.
14144 Both numbers are in seconds.
14146 With the specification of an output file, the output is appended to the
14147 named file, and it looks like this:
14150 0.12 0.01 cc1 @var{options}
14151 0.00 0.01 as @var{options}
14154 The ``user time'' and the ``system time'' are moved before the program
14155 name, and the options passed to the program are displayed, so that one
14156 can later tell what file was being compiled, and with which options.
14158 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14159 @opindex fdump-final-insns
14160 Dump the final internal representation (RTL) to @var{file}. If the
14161 optional argument is omitted (or if @var{file} is @code{.}), the name
14162 of the dump file is determined by appending @code{.gkd} to the
14163 compilation output file name.
14165 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14166 @opindex fcompare-debug
14167 @opindex fno-compare-debug
14168 If no error occurs during compilation, run the compiler a second time,
14169 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14170 passed to the second compilation. Dump the final internal
14171 representation in both compilations, and print an error if they differ.
14173 If the equal sign is omitted, the default @option{-gtoggle} is used.
14175 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14176 and nonzero, implicitly enables @option{-fcompare-debug}. If
14177 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14178 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14181 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14182 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14183 of the final representation and the second compilation, preventing even
14184 @env{GCC_COMPARE_DEBUG} from taking effect.
14186 To verify full coverage during @option{-fcompare-debug} testing, set
14187 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14188 which GCC rejects as an invalid option in any actual compilation
14189 (rather than preprocessing, assembly or linking). To get just a
14190 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14191 not overridden} will do.
14193 @item -fcompare-debug-second
14194 @opindex fcompare-debug-second
14195 This option is implicitly passed to the compiler for the second
14196 compilation requested by @option{-fcompare-debug}, along with options to
14197 silence warnings, and omitting other options that would cause the compiler
14198 to produce output to files or to standard output as a side effect. Dump
14199 files and preserved temporary files are renamed so as to contain the
14200 @code{.gk} additional extension during the second compilation, to avoid
14201 overwriting those generated by the first.
14203 When this option is passed to the compiler driver, it causes the
14204 @emph{first} compilation to be skipped, which makes it useful for little
14205 other than debugging the compiler proper.
14209 Turn off generation of debug info, if leaving out this option
14210 generates it, or turn it on at level 2 otherwise. The position of this
14211 argument in the command line does not matter; it takes effect after all
14212 other options are processed, and it does so only once, no matter how
14213 many times it is given. This is mainly intended to be used with
14214 @option{-fcompare-debug}.
14216 @item -fvar-tracking-assignments-toggle
14217 @opindex fvar-tracking-assignments-toggle
14218 @opindex fno-var-tracking-assignments-toggle
14219 Toggle @option{-fvar-tracking-assignments}, in the same way that
14220 @option{-gtoggle} toggles @option{-g}.
14224 Makes the compiler print out each function name as it is compiled, and
14225 print some statistics about each pass when it finishes.
14227 @item -ftime-report
14228 @opindex ftime-report
14229 Makes the compiler print some statistics about the time consumed by each
14230 pass when it finishes.
14232 @item -ftime-report-details
14233 @opindex ftime-report-details
14234 Record the time consumed by infrastructure parts separately for each pass.
14236 @item -fira-verbose=@var{n}
14237 @opindex fira-verbose
14238 Control the verbosity of the dump file for the integrated register allocator.
14239 The default value is 5. If the value @var{n} is greater or equal to 10,
14240 the dump output is sent to stderr using the same format as @var{n} minus 10.
14243 @opindex flto-report
14244 Prints a report with internal details on the workings of the link-time
14245 optimizer. The contents of this report vary from version to version.
14246 It is meant to be useful to GCC developers when processing object
14247 files in LTO mode (via @option{-flto}).
14249 Disabled by default.
14251 @item -flto-report-wpa
14252 @opindex flto-report-wpa
14253 Like @option{-flto-report}, but only print for the WPA phase of Link
14257 @opindex fmem-report
14258 Makes the compiler print some statistics about permanent memory
14259 allocation when it finishes.
14261 @item -fmem-report-wpa
14262 @opindex fmem-report-wpa
14263 Makes the compiler print some statistics about permanent memory
14264 allocation for the WPA phase only.
14266 @item -fpre-ipa-mem-report
14267 @opindex fpre-ipa-mem-report
14268 @item -fpost-ipa-mem-report
14269 @opindex fpost-ipa-mem-report
14270 Makes the compiler print some statistics about permanent memory
14271 allocation before or after interprocedural optimization.
14273 @item -fprofile-report
14274 @opindex fprofile-report
14275 Makes the compiler print some statistics about consistency of the
14276 (estimated) profile and effect of individual passes.
14278 @item -fstack-usage
14279 @opindex fstack-usage
14280 Makes the compiler output stack usage information for the program, on a
14281 per-function basis. The filename for the dump is made by appending
14282 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14283 the output file, if explicitly specified and it is not an executable,
14284 otherwise it is the basename of the source file. An entry is made up
14289 The name of the function.
14293 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14296 The qualifier @code{static} means that the function manipulates the stack
14297 statically: a fixed number of bytes are allocated for the frame on function
14298 entry and released on function exit; no stack adjustments are otherwise made
14299 in the function. The second field is this fixed number of bytes.
14301 The qualifier @code{dynamic} means that the function manipulates the stack
14302 dynamically: in addition to the static allocation described above, stack
14303 adjustments are made in the body of the function, for example to push/pop
14304 arguments around function calls. If the qualifier @code{bounded} is also
14305 present, the amount of these adjustments is bounded at compile time and
14306 the second field is an upper bound of the total amount of stack used by
14307 the function. If it is not present, the amount of these adjustments is
14308 not bounded at compile time and the second field only represents the
14313 Emit statistics about front-end processing at the end of the compilation.
14314 This option is supported only by the C++ front end, and
14315 the information is generally only useful to the G++ development team.
14317 @item -fdbg-cnt-list
14318 @opindex fdbg-cnt-list
14319 Print the name and the counter upper bound for all debug counters.
14322 @item -fdbg-cnt=@var{counter-value-list}
14324 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14325 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14326 tuples which sets the lower and the upper bound of each debug
14327 counter @var{name}. The @var{lower_bound} is optional and is zero
14328 initialized if not set.
14329 All debug counters have the initial upper bound of @code{UINT_MAX};
14330 thus @code{dbg_cnt} returns true always unless the upper bound
14331 is set by this option.
14332 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14333 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14334 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14336 @item -print-file-name=@var{library}
14337 @opindex print-file-name
14338 Print the full absolute name of the library file @var{library} that
14339 would be used when linking---and don't do anything else. With this
14340 option, GCC does not compile or link anything; it just prints the
14343 @item -print-multi-directory
14344 @opindex print-multi-directory
14345 Print the directory name corresponding to the multilib selected by any
14346 other switches present in the command line. This directory is supposed
14347 to exist in @env{GCC_EXEC_PREFIX}.
14349 @item -print-multi-lib
14350 @opindex print-multi-lib
14351 Print the mapping from multilib directory names to compiler switches
14352 that enable them. The directory name is separated from the switches by
14353 @samp{;}, and each switch starts with an @samp{@@} instead of the
14354 @samp{-}, without spaces between multiple switches. This is supposed to
14355 ease shell processing.
14357 @item -print-multi-os-directory
14358 @opindex print-multi-os-directory
14359 Print the path to OS libraries for the selected
14360 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14361 present in the @file{lib} subdirectory and no multilibs are used, this is
14362 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14363 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14364 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14365 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14367 @item -print-multiarch
14368 @opindex print-multiarch
14369 Print the path to OS libraries for the selected multiarch,
14370 relative to some @file{lib} subdirectory.
14372 @item -print-prog-name=@var{program}
14373 @opindex print-prog-name
14374 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14376 @item -print-libgcc-file-name
14377 @opindex print-libgcc-file-name
14378 Same as @option{-print-file-name=libgcc.a}.
14380 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14381 but you do want to link with @file{libgcc.a}. You can do:
14384 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14387 @item -print-search-dirs
14388 @opindex print-search-dirs
14389 Print the name of the configured installation directory and a list of
14390 program and library directories @command{gcc} searches---and don't do anything else.
14392 This is useful when @command{gcc} prints the error message
14393 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14394 To resolve this you either need to put @file{cpp0} and the other compiler
14395 components where @command{gcc} expects to find them, or you can set the environment
14396 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14397 Don't forget the trailing @samp{/}.
14398 @xref{Environment Variables}.
14400 @item -print-sysroot
14401 @opindex print-sysroot
14402 Print the target sysroot directory that is used during
14403 compilation. This is the target sysroot specified either at configure
14404 time or using the @option{--sysroot} option, possibly with an extra
14405 suffix that depends on compilation options. If no target sysroot is
14406 specified, the option prints nothing.
14408 @item -print-sysroot-headers-suffix
14409 @opindex print-sysroot-headers-suffix
14410 Print the suffix added to the target sysroot when searching for
14411 headers, or give an error if the compiler is not configured with such
14412 a suffix---and don't do anything else.
14415 @opindex dumpmachine
14416 Print the compiler's target machine (for example,
14417 @samp{i686-pc-linux-gnu})---and don't do anything else.
14420 @opindex dumpversion
14421 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14422 anything else. This is the compiler version used in filesystem paths,
14423 specs, can be depending on how the compiler has been configured just
14424 a single number (major version), two numbers separated by dot (major and
14425 minor version) or three numbers separated by dots (major, minor and patchlevel
14428 @item -dumpfullversion
14429 @opindex dumpfullversion
14430 Print the full compiler version, always 3 numbers separated by dots,
14431 major, minor and patchlevel version.
14435 Print the compiler's built-in specs---and don't do anything else. (This
14436 is used when GCC itself is being built.) @xref{Spec Files}.
14439 @node Submodel Options
14440 @section Machine-Dependent Options
14441 @cindex submodel options
14442 @cindex specifying hardware config
14443 @cindex hardware models and configurations, specifying
14444 @cindex target-dependent options
14445 @cindex machine-dependent options
14447 Each target machine supported by GCC can have its own options---for
14448 example, to allow you to compile for a particular processor variant or
14449 ABI, or to control optimizations specific to that machine. By
14450 convention, the names of machine-specific options start with
14453 Some configurations of the compiler also support additional target-specific
14454 options, usually for compatibility with other compilers on the same
14457 @c This list is ordered alphanumerically by subsection name.
14458 @c It should be the same order and spelling as these options are listed
14459 @c in Machine Dependent Options
14462 * AArch64 Options::
14463 * Adapteva Epiphany Options::
14467 * Blackfin Options::
14472 * DEC Alpha Options::
14476 * GNU/Linux Options::
14486 * MicroBlaze Options::
14489 * MN10300 Options::
14493 * Nios II Options::
14494 * Nvidia PTX Options::
14496 * picoChip Options::
14497 * PowerPC Options::
14498 * PowerPC SPE Options::
14501 * RS/6000 and PowerPC Options::
14503 * S/390 and zSeries Options::
14506 * Solaris 2 Options::
14509 * System V Options::
14510 * TILE-Gx Options::
14511 * TILEPro Options::
14516 * VxWorks Options::
14518 * x86 Windows Options::
14519 * Xstormy16 Options::
14521 * zSeries Options::
14524 @node AArch64 Options
14525 @subsection AArch64 Options
14526 @cindex AArch64 Options
14528 These options are defined for AArch64 implementations:
14532 @item -mabi=@var{name}
14534 Generate code for the specified data model. Permissible values
14535 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14536 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14537 but long int and pointers are 64 bits.
14539 The default depends on the specific target configuration. Note that
14540 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14541 entire program with the same ABI, and link with a compatible set of libraries.
14544 @opindex mbig-endian
14545 Generate big-endian code. This is the default when GCC is configured for an
14546 @samp{aarch64_be-*-*} target.
14548 @item -mgeneral-regs-only
14549 @opindex mgeneral-regs-only
14550 Generate code which uses only the general-purpose registers. This will prevent
14551 the compiler from using floating-point and Advanced SIMD registers but will not
14552 impose any restrictions on the assembler.
14554 @item -mlittle-endian
14555 @opindex mlittle-endian
14556 Generate little-endian code. This is the default when GCC is configured for an
14557 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14559 @item -mcmodel=tiny
14560 @opindex mcmodel=tiny
14561 Generate code for the tiny code model. The program and its statically defined
14562 symbols must be within 1MB of each other. Programs can be statically or
14563 dynamically linked.
14565 @item -mcmodel=small
14566 @opindex mcmodel=small
14567 Generate code for the small code model. The program and its statically defined
14568 symbols must be within 4GB of each other. Programs can be statically or
14569 dynamically linked. This is the default code model.
14571 @item -mcmodel=large
14572 @opindex mcmodel=large
14573 Generate code for the large code model. This makes no assumptions about
14574 addresses and sizes of sections. Programs can be statically linked only.
14576 @item -mstrict-align
14577 @itemx -mno-strict-align
14578 @opindex mstrict-align
14579 @opindex mno-strict-align
14580 Avoid or allow generating memory accesses that may not be aligned on a natural
14581 object boundary as described in the architecture specification.
14583 @item -momit-leaf-frame-pointer
14584 @itemx -mno-omit-leaf-frame-pointer
14585 @opindex momit-leaf-frame-pointer
14586 @opindex mno-omit-leaf-frame-pointer
14587 Omit or keep the frame pointer in leaf functions. The former behavior is the
14590 @item -mtls-dialect=desc
14591 @opindex mtls-dialect=desc
14592 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14593 of TLS variables. This is the default.
14595 @item -mtls-dialect=traditional
14596 @opindex mtls-dialect=traditional
14597 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14600 @item -mtls-size=@var{size}
14602 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14603 This option requires binutils 2.26 or newer.
14605 @item -mfix-cortex-a53-835769
14606 @itemx -mno-fix-cortex-a53-835769
14607 @opindex mfix-cortex-a53-835769
14608 @opindex mno-fix-cortex-a53-835769
14609 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14610 This involves inserting a NOP instruction between memory instructions and
14611 64-bit integer multiply-accumulate instructions.
14613 @item -mfix-cortex-a53-843419
14614 @itemx -mno-fix-cortex-a53-843419
14615 @opindex mfix-cortex-a53-843419
14616 @opindex mno-fix-cortex-a53-843419
14617 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14618 This erratum workaround is made at link time and this will only pass the
14619 corresponding flag to the linker.
14621 @item -mlow-precision-recip-sqrt
14622 @itemx -mno-low-precision-recip-sqrt
14623 @opindex mlow-precision-recip-sqrt
14624 @opindex mno-low-precision-recip-sqrt
14625 Enable or disable the reciprocal square root approximation.
14626 This option only has an effect if @option{-ffast-math} or
14627 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14628 precision of reciprocal square root results to about 16 bits for
14629 single precision and to 32 bits for double precision.
14631 @item -mlow-precision-sqrt
14632 @itemx -mno-low-precision-sqrt
14633 @opindex -mlow-precision-sqrt
14634 @opindex -mno-low-precision-sqrt
14635 Enable or disable the square root approximation.
14636 This option only has an effect if @option{-ffast-math} or
14637 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14638 precision of square root results to about 16 bits for
14639 single precision and to 32 bits for double precision.
14640 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14642 @item -mlow-precision-div
14643 @itemx -mno-low-precision-div
14644 @opindex -mlow-precision-div
14645 @opindex -mno-low-precision-div
14646 Enable or disable the division approximation.
14647 This option only has an effect if @option{-ffast-math} or
14648 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14649 precision of division results to about 16 bits for
14650 single precision and to 32 bits for double precision.
14652 @item -march=@var{name}
14654 Specify the name of the target architecture and, optionally, one or
14655 more feature modifiers. This option has the form
14656 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14658 The permissible values for @var{arch} are @samp{armv8-a},
14659 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
14662 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
14663 support for the ARMv8.4-A architecture extensions.
14665 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14666 support for the ARMv8.3-A architecture extensions.
14668 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14669 support for the ARMv8.2-A architecture extensions.
14671 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14672 support for the ARMv8.1-A architecture extension. In particular, it
14673 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14675 The value @samp{native} is available on native AArch64 GNU/Linux and
14676 causes the compiler to pick the architecture of the host system. This
14677 option has no effect if the compiler is unable to recognize the
14678 architecture of the host system,
14680 The permissible values for @var{feature} are listed in the sub-section
14681 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14682 Feature Modifiers}. Where conflicting feature modifiers are
14683 specified, the right-most feature is used.
14685 GCC uses @var{name} to determine what kind of instructions it can emit
14686 when generating assembly code. If @option{-march} is specified
14687 without either of @option{-mtune} or @option{-mcpu} also being
14688 specified, the code is tuned to perform well across a range of target
14689 processors implementing the target architecture.
14691 @item -mtune=@var{name}
14693 Specify the name of the target processor for which GCC should tune the
14694 performance of the code. Permissible values for this option are:
14695 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14696 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14697 @samp{cortex-a76}, @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx},
14698 @samp{saphira}, @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14699 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14700 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14701 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14702 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14703 @samp{cortex-a76.cortex-a55}
14706 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14707 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14708 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
14709 should tune for a big.LITTLE system.
14711 Additionally on native AArch64 GNU/Linux systems the value
14712 @samp{native} tunes performance to the host system. This option has no effect
14713 if the compiler is unable to recognize the processor of the host system.
14715 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14716 are specified, the code is tuned to perform well across a range
14717 of target processors.
14719 This option cannot be suffixed by feature modifiers.
14721 @item -mcpu=@var{name}
14723 Specify the name of the target processor, optionally suffixed by one
14724 or more feature modifiers. This option has the form
14725 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14726 the permissible values for @var{cpu} are the same as those available
14727 for @option{-mtune}. The permissible values for @var{feature} are
14728 documented in the sub-section on
14729 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14730 Feature Modifiers}. Where conflicting feature modifiers are
14731 specified, the right-most feature is used.
14733 GCC uses @var{name} to determine what kind of instructions it can emit when
14734 generating assembly code (as if by @option{-march}) and to determine
14735 the target processor for which to tune for performance (as if
14736 by @option{-mtune}). Where this option is used in conjunction
14737 with @option{-march} or @option{-mtune}, those options take precedence
14738 over the appropriate part of this option.
14740 @item -moverride=@var{string}
14742 Override tuning decisions made by the back-end in response to a
14743 @option{-mtune=} switch. The syntax, semantics, and accepted values
14744 for @var{string} in this option are not guaranteed to be consistent
14747 This option is only intended to be useful when developing GCC.
14749 @item -mverbose-cost-dump
14750 @opindex mverbose-cost-dump
14751 Enable verbose cost model dumping in the debug dump files. This option is
14752 provided for use in debugging the compiler.
14754 @item -mpc-relative-literal-loads
14755 @itemx -mno-pc-relative-literal-loads
14756 @opindex mpc-relative-literal-loads
14757 @opindex mno-pc-relative-literal-loads
14758 Enable or disable PC-relative literal loads. With this option literal pools are
14759 accessed using a single instruction and emitted after each function. This
14760 limits the maximum size of functions to 1MB. This is enabled by default for
14761 @option{-mcmodel=tiny}.
14763 @item -msign-return-address=@var{scope}
14764 @opindex msign-return-address
14765 Select the function scope on which return address signing will be applied.
14766 Permissible values are @samp{none}, which disables return address signing,
14767 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14768 functions, and @samp{all}, which enables pointer signing for all functions. The
14769 default value is @samp{none}.
14771 @item -msve-vector-bits=@var{bits}
14772 @opindex msve-vector-bits
14773 Specify the number of bits in an SVE vector register. This option only has
14774 an effect when SVE is enabled.
14776 GCC supports two forms of SVE code generation: ``vector-length
14777 agnostic'' output that works with any size of vector register and
14778 ``vector-length specific'' output that only works when the vector
14779 registers are a particular size. Replacing @var{bits} with
14780 @samp{scalable} selects vector-length agnostic output while
14781 replacing it with a number selects vector-length specific output.
14782 The possible lengths in the latter case are: 128, 256, 512, 1024
14783 and 2048. @samp{scalable} is the default.
14785 At present, @samp{-msve-vector-bits=128} produces the same output
14786 as @samp{-msve-vector-bits=scalable}.
14790 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14791 @anchor{aarch64-feature-modifiers}
14792 @cindex @option{-march} feature modifiers
14793 @cindex @option{-mcpu} feature modifiers
14794 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14795 the following and their inverses @option{no@var{feature}}:
14799 Enable CRC extension. This is on by default for
14800 @option{-march=armv8.1-a}.
14802 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14805 Enable floating-point instructions. This is on by default for all possible
14806 values for options @option{-march} and @option{-mcpu}.
14808 Enable Advanced SIMD instructions. This also enables floating-point
14809 instructions. This is on by default for all possible values for options
14810 @option{-march} and @option{-mcpu}.
14812 Enable Scalable Vector Extension instructions. This also enables Advanced
14813 SIMD and floating-point instructions.
14815 Enable Large System Extension instructions. This is on by default for
14816 @option{-march=armv8.1-a}.
14818 Enable Round Double Multiply Accumulate instructions. This is on by default
14819 for @option{-march=armv8.1-a}.
14821 Enable FP16 extension. This also enables floating-point instructions.
14823 Enable FP16 fmla extension. This also enables FP16 extensions and
14824 floating-point instructions. This option is enabled by default for @option{-march=armv8.4-a}. Use of this option with architectures prior to Armv8.2-A is not supported.
14827 Enable the RcPc extension. This does not change code generation from GCC,
14828 but is passed on to the assembler, enabling inline asm statements to use
14829 instructions from the RcPc extension.
14831 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
14833 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
14836 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
14838 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
14839 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
14841 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
14842 Use of this option with architectures prior to Armv8.2-A is not supported.
14846 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
14847 which implies @option{fp}.
14848 Conversely, @option{nofp} implies @option{nosimd}, which implies
14849 @option{nocrypto}, @option{noaes} and @option{nosha2}.
14851 @node Adapteva Epiphany Options
14852 @subsection Adapteva Epiphany Options
14854 These @samp{-m} options are defined for Adapteva Epiphany:
14857 @item -mhalf-reg-file
14858 @opindex mhalf-reg-file
14859 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14860 That allows code to run on hardware variants that lack these registers.
14862 @item -mprefer-short-insn-regs
14863 @opindex mprefer-short-insn-regs
14864 Preferentially allocate registers that allow short instruction generation.
14865 This can result in increased instruction count, so this may either reduce or
14866 increase overall code size.
14868 @item -mbranch-cost=@var{num}
14869 @opindex mbranch-cost
14870 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14871 This cost is only a heuristic and is not guaranteed to produce
14872 consistent results across releases.
14876 Enable the generation of conditional moves.
14878 @item -mnops=@var{num}
14880 Emit @var{num} NOPs before every other generated instruction.
14882 @item -mno-soft-cmpsf
14883 @opindex mno-soft-cmpsf
14884 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14885 and test the flags. This is faster than a software comparison, but can
14886 get incorrect results in the presence of NaNs, or when two different small
14887 numbers are compared such that their difference is calculated as zero.
14888 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14889 software comparisons.
14891 @item -mstack-offset=@var{num}
14892 @opindex mstack-offset
14893 Set the offset between the top of the stack and the stack pointer.
14894 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14895 can be used by leaf functions without stack allocation.
14896 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14897 Note also that this option changes the ABI; compiling a program with a
14898 different stack offset than the libraries have been compiled with
14899 generally does not work.
14900 This option can be useful if you want to evaluate if a different stack
14901 offset would give you better code, but to actually use a different stack
14902 offset to build working programs, it is recommended to configure the
14903 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14905 @item -mno-round-nearest
14906 @opindex mno-round-nearest
14907 Make the scheduler assume that the rounding mode has been set to
14908 truncating. The default is @option{-mround-nearest}.
14911 @opindex mlong-calls
14912 If not otherwise specified by an attribute, assume all calls might be beyond
14913 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14914 function address into a register before performing a (otherwise direct) call.
14915 This is the default.
14917 @item -mshort-calls
14918 @opindex short-calls
14919 If not otherwise specified by an attribute, assume all direct calls are
14920 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14921 for direct calls. The default is @option{-mlong-calls}.
14925 Assume addresses can be loaded as 16-bit unsigned values. This does not
14926 apply to function addresses for which @option{-mlong-calls} semantics
14929 @item -mfp-mode=@var{mode}
14931 Set the prevailing mode of the floating-point unit.
14932 This determines the floating-point mode that is provided and expected
14933 at function call and return time. Making this mode match the mode you
14934 predominantly need at function start can make your programs smaller and
14935 faster by avoiding unnecessary mode switches.
14937 @var{mode} can be set to one the following values:
14941 Any mode at function entry is valid, and retained or restored when
14942 the function returns, and when it calls other functions.
14943 This mode is useful for compiling libraries or other compilation units
14944 you might want to incorporate into different programs with different
14945 prevailing FPU modes, and the convenience of being able to use a single
14946 object file outweighs the size and speed overhead for any extra
14947 mode switching that might be needed, compared with what would be needed
14948 with a more specific choice of prevailing FPU mode.
14951 This is the mode used for floating-point calculations with
14952 truncating (i.e.@: round towards zero) rounding mode. That includes
14953 conversion from floating point to integer.
14955 @item round-nearest
14956 This is the mode used for floating-point calculations with
14957 round-to-nearest-or-even rounding mode.
14960 This is the mode used to perform integer calculations in the FPU, e.g.@:
14961 integer multiply, or integer multiply-and-accumulate.
14964 The default is @option{-mfp-mode=caller}
14966 @item -mnosplit-lohi
14967 @itemx -mno-postinc
14968 @itemx -mno-postmodify
14969 @opindex mnosplit-lohi
14970 @opindex mno-postinc
14971 @opindex mno-postmodify
14972 Code generation tweaks that disable, respectively, splitting of 32-bit
14973 loads, generation of post-increment addresses, and generation of
14974 post-modify addresses. The defaults are @option{msplit-lohi},
14975 @option{-mpost-inc}, and @option{-mpost-modify}.
14977 @item -mnovect-double
14978 @opindex mno-vect-double
14979 Change the preferred SIMD mode to SImode. The default is
14980 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14982 @item -max-vect-align=@var{num}
14983 @opindex max-vect-align
14984 The maximum alignment for SIMD vector mode types.
14985 @var{num} may be 4 or 8. The default is 8.
14986 Note that this is an ABI change, even though many library function
14987 interfaces are unaffected if they don't use SIMD vector modes
14988 in places that affect size and/or alignment of relevant types.
14990 @item -msplit-vecmove-early
14991 @opindex msplit-vecmove-early
14992 Split vector moves into single word moves before reload. In theory this
14993 can give better register allocation, but so far the reverse seems to be
14994 generally the case.
14996 @item -m1reg-@var{reg}
14998 Specify a register to hold the constant @minus{}1, which makes loading small negative
14999 constants and certain bitmasks faster.
15000 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15001 which specify use of that register as a fixed register,
15002 and @samp{none}, which means that no register is used for this
15003 purpose. The default is @option{-m1reg-none}.
15008 @subsection ARC Options
15009 @cindex ARC options
15011 The following options control the architecture variant for which code
15014 @c architecture variants
15017 @item -mbarrel-shifter
15018 @opindex mbarrel-shifter
15019 Generate instructions supported by barrel shifter. This is the default
15020 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15023 @opindex mjli-alawys
15024 Force to call a function using jli_s instruction. This option is
15025 valid only for ARCv2 architecture.
15027 @item -mcpu=@var{cpu}
15029 Set architecture type, register usage, and instruction scheduling
15030 parameters for @var{cpu}. There are also shortcut alias options
15031 available for backward compatibility and convenience. Supported
15032 values for @var{cpu} are
15038 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15042 Compile for ARC601. Alias: @option{-mARC601}.
15047 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15048 This is the default when configured with @option{--with-cpu=arc700}@.
15051 Compile for ARC EM.
15054 Compile for ARC HS.
15057 Compile for ARC EM CPU with no hardware extensions.
15060 Compile for ARC EM4 CPU.
15063 Compile for ARC EM4 DMIPS CPU.
15066 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15070 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15071 double assist instructions.
15074 Compile for ARC HS CPU with no hardware extensions except the atomic
15078 Compile for ARC HS34 CPU.
15081 Compile for ARC HS38 CPU.
15084 Compile for ARC HS38 CPU with all hardware extensions on.
15087 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15089 @item arc600_mul32x16
15090 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15091 instructions enabled.
15094 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15095 instructions enabled.
15098 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15100 @item arc601_mul32x16
15101 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15102 instructions enabled.
15105 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15106 instructions enabled.
15109 Compile for ARC 700 on NPS400 chip.
15112 Compile for ARC EM minimalist configuration featuring reduced register
15119 @itemx -mdpfp-compact
15120 @opindex mdpfp-compact
15121 Generate double-precision FPX instructions, tuned for the compact
15125 @opindex mdpfp-fast
15126 Generate double-precision FPX instructions, tuned for the fast
15129 @item -mno-dpfp-lrsr
15130 @opindex mno-dpfp-lrsr
15131 Disable @code{lr} and @code{sr} instructions from using FPX extension
15136 Generate extended arithmetic instructions. Currently only
15137 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15138 supported. This is always enabled for @option{-mcpu=ARC700}.
15142 Do not generate @code{mpy}-family instructions for ARC700. This option is
15147 Generate 32x16-bit multiply and multiply-accumulate instructions.
15151 Generate @code{mul64} and @code{mulu64} instructions.
15152 Only valid for @option{-mcpu=ARC600}.
15156 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15161 @itemx -mspfp-compact
15162 @opindex mspfp-compact
15163 Generate single-precision FPX instructions, tuned for the compact
15167 @opindex mspfp-fast
15168 Generate single-precision FPX instructions, tuned for the fast
15173 Enable generation of ARC SIMD instructions via target-specific
15174 builtins. Only valid for @option{-mcpu=ARC700}.
15177 @opindex msoft-float
15178 This option ignored; it is provided for compatibility purposes only.
15179 Software floating-point code is emitted by default, and this default
15180 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15181 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15182 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15186 Generate @code{swap} instructions.
15190 This enables use of the locked load/store conditional extension to implement
15191 atomic memory built-in functions. Not available for ARC 6xx or ARC
15196 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15198 @item -mcode-density
15199 @opindex mcode-density
15200 Enable code density instructions for ARC EM.
15201 This option is on by default for ARC HS.
15205 Enable double load/store operations for ARC HS cores.
15207 @item -mtp-regno=@var{regno}
15209 Specify thread pointer register number.
15211 @item -mmpy-option=@var{multo}
15212 @opindex mmpy-option
15213 Compile ARCv2 code with a multiplier design option. You can specify
15214 the option using either a string or numeric value for @var{multo}.
15215 @samp{wlh1} is the default value. The recognized values are:
15220 No multiplier available.
15224 16x16 multiplier, fully pipelined.
15225 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15229 32x32 multiplier, fully
15230 pipelined (1 stage). The following instructions are additionally
15231 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15235 32x32 multiplier, fully pipelined
15236 (2 stages). The following instructions are additionally enabled: @code{mpy},
15237 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15241 Two 16x16 multipliers, blocking,
15242 sequential. The following instructions are additionally enabled: @code{mpy},
15243 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15247 One 16x16 multiplier, blocking,
15248 sequential. The following instructions are additionally enabled: @code{mpy},
15249 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15253 One 32x4 multiplier, blocking,
15254 sequential. The following instructions are additionally enabled: @code{mpy},
15255 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15259 ARC HS SIMD support.
15263 ARC HS SIMD support.
15267 ARC HS SIMD support.
15271 This option is only available for ARCv2 cores@.
15273 @item -mfpu=@var{fpu}
15275 Enables support for specific floating-point hardware extensions for ARCv2
15276 cores. Supported values for @var{fpu} are:
15281 Enables support for single-precision floating-point hardware
15285 Enables support for double-precision floating-point hardware
15286 extensions. The single-precision floating-point extension is also
15287 enabled. Not available for ARC EM@.
15290 Enables support for double-precision floating-point hardware
15291 extensions using double-precision assist instructions. The single-precision
15292 floating-point extension is also enabled. This option is
15293 only available for ARC EM@.
15296 Enables support for double-precision floating-point hardware
15297 extensions using double-precision assist instructions.
15298 The single-precision floating-point, square-root, and divide
15299 extensions are also enabled. This option is
15300 only available for ARC EM@.
15303 Enables support for double-precision floating-point hardware
15304 extensions using double-precision assist instructions.
15305 The single-precision floating-point and fused multiply and add
15306 hardware extensions are also enabled. This option is
15307 only available for ARC EM@.
15310 Enables support for double-precision floating-point hardware
15311 extensions using double-precision assist instructions.
15312 All single-precision floating-point hardware extensions are also
15313 enabled. This option is only available for ARC EM@.
15316 Enables support for single-precision floating-point, square-root and divide
15317 hardware extensions@.
15320 Enables support for double-precision floating-point, square-root and divide
15321 hardware extensions. This option
15322 includes option @samp{fpus_div}. Not available for ARC EM@.
15325 Enables support for single-precision floating-point and
15326 fused multiply and add hardware extensions@.
15329 Enables support for double-precision floating-point and
15330 fused multiply and add hardware extensions. This option
15331 includes option @samp{fpus_fma}. Not available for ARC EM@.
15334 Enables support for all single-precision floating-point hardware
15338 Enables support for all single- and double-precision floating-point
15339 hardware extensions. Not available for ARC EM@.
15343 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15344 @opindex mirq-ctrl-saved
15345 Specifies general-purposes registers that the processor automatically
15346 saves/restores on interrupt entry and exit. @var{register-range} is
15347 specified as two registers separated by a dash. The register range
15348 always starts with @code{r0}, the upper limit is @code{fp} register.
15349 @var{blink} and @var{lp_count} are optional. This option is only
15350 valid for ARC EM and ARC HS cores.
15352 @item -mrgf-banked-regs=@var{number}
15353 @opindex mrgf-banked-regs
15354 Specifies the number of registers replicated in second register bank
15355 on entry to fast interrupt. Fast interrupts are interrupts with the
15356 highest priority level P0. These interrupts save only PC and STATUS32
15357 registers to avoid memory transactions during interrupt entry and exit
15358 sequences. Use this option when you are using fast interrupts in an
15359 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15361 @item -mlpc-width=@var{width}
15362 @opindex mlpc-width
15363 Specify the width of the @code{lp_count} register. Valid values for
15364 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15365 fixed to 32 bits. If the width is less than 32, the compiler does not
15366 attempt to transform loops in your program to use the zero-delay loop
15367 mechanism unless it is known that the @code{lp_count} register can
15368 hold the required loop-counter value. Depending on the width
15369 specified, the compiler and run-time library might continue to use the
15370 loop mechanism for various needs. This option defines macro
15371 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15375 This option instructs the compiler to generate code for a 16-entry
15376 register file. This option defines the @code{__ARC_RF16__}
15377 preprocessor macro.
15381 The following options are passed through to the assembler, and also
15382 define preprocessor macro symbols.
15384 @c Flags used by the assembler, but for which we define preprocessor
15385 @c macro symbols as well.
15388 @opindex mdsp-packa
15389 Passed down to the assembler to enable the DSP Pack A extensions.
15390 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15395 Passed down to the assembler to enable the dual Viterbi butterfly
15396 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15397 option is deprecated.
15399 @c ARC700 4.10 extension instruction
15402 Passed down to the assembler to enable the locked load/store
15403 conditional extension. Also sets the preprocessor symbol
15408 Passed down to the assembler. Also sets the preprocessor symbol
15409 @code{__Xxmac_d16}. This option is deprecated.
15413 Passed down to the assembler. Also sets the preprocessor symbol
15414 @code{__Xxmac_24}. This option is deprecated.
15416 @c ARC700 4.10 extension instruction
15419 Passed down to the assembler to enable the 64-bit time-stamp counter
15420 extension instruction. Also sets the preprocessor symbol
15421 @code{__Xrtsc}. This option is deprecated.
15423 @c ARC700 4.10 extension instruction
15426 Passed down to the assembler to enable the swap byte ordering
15427 extension instruction. Also sets the preprocessor symbol
15431 @opindex mtelephony
15432 Passed down to the assembler to enable dual- and single-operand
15433 instructions for telephony. Also sets the preprocessor symbol
15434 @code{__Xtelephony}. This option is deprecated.
15438 Passed down to the assembler to enable the XY memory extension. Also
15439 sets the preprocessor symbol @code{__Xxy}.
15443 The following options control how the assembly code is annotated:
15445 @c Assembly annotation options
15449 Annotate assembler instructions with estimated addresses.
15451 @item -mannotate-align
15452 @opindex mannotate-align
15453 Explain what alignment considerations lead to the decision to make an
15454 instruction short or long.
15458 The following options are passed through to the linker:
15460 @c options passed through to the linker
15464 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15465 This option is enabled by default in tool chains built for
15466 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15467 when profiling is not requested.
15469 @item -marclinux_prof
15470 @opindex marclinux_prof
15471 Passed through to the linker, to specify use of the
15472 @code{arclinux_prof} emulation. This option is enabled by default in
15473 tool chains built for @w{@code{arc-linux-uclibc}} and
15474 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15478 The following options control the semantics of generated code:
15480 @c semantically relevant code generation options
15483 @opindex mlong-calls
15484 Generate calls as register indirect calls, thus providing access
15485 to the full 32-bit address range.
15487 @item -mmedium-calls
15488 @opindex mmedium-calls
15489 Don't use less than 25-bit addressing range for calls, which is the
15490 offset available for an unconditional branch-and-link
15491 instruction. Conditional execution of function calls is suppressed, to
15492 allow use of the 25-bit range, rather than the 21-bit range with
15493 conditional branch-and-link. This is the default for tool chains built
15494 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15498 Put definitions of externally-visible data in a small data section if
15499 that data is no bigger than @var{num} bytes. The default value of
15500 @var{num} is 4 for any ARC configuration, or 8 when we have double
15501 load/store operations.
15505 Do not generate sdata references. This is the default for tool chains
15506 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15509 @item -mvolatile-cache
15510 @opindex mvolatile-cache
15511 Use ordinarily cached memory accesses for volatile references. This is the
15514 @item -mno-volatile-cache
15515 @opindex mno-volatile-cache
15516 Enable cache bypass for volatile references.
15520 The following options fine tune code generation:
15521 @c code generation tuning options
15524 @opindex malign-call
15525 Do alignment optimizations for call instructions.
15527 @item -mauto-modify-reg
15528 @opindex mauto-modify-reg
15529 Enable the use of pre/post modify with register displacement.
15531 @item -mbbit-peephole
15532 @opindex mbbit-peephole
15533 Enable bbit peephole2.
15537 This option disables a target-specific pass in @file{arc_reorg} to
15538 generate compare-and-branch (@code{br@var{cc}}) instructions.
15539 It has no effect on
15540 generation of these instructions driven by the combiner pass.
15542 @item -mcase-vector-pcrel
15543 @opindex mcase-vector-pcrel
15544 Use PC-relative switch case tables to enable case table shortening.
15545 This is the default for @option{-Os}.
15547 @item -mcompact-casesi
15548 @opindex mcompact-casesi
15549 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15550 and only available for ARCv1 cores.
15552 @item -mno-cond-exec
15553 @opindex mno-cond-exec
15554 Disable the ARCompact-specific pass to generate conditional
15555 execution instructions.
15557 Due to delay slot scheduling and interactions between operand numbers,
15558 literal sizes, instruction lengths, and the support for conditional execution,
15559 the target-independent pass to generate conditional execution is often lacking,
15560 so the ARC port has kept a special pass around that tries to find more
15561 conditional execution generation opportunities after register allocation,
15562 branch shortening, and delay slot scheduling have been done. This pass
15563 generally, but not always, improves performance and code size, at the cost of
15564 extra compilation time, which is why there is an option to switch it off.
15565 If you have a problem with call instructions exceeding their allowable
15566 offset range because they are conditionalized, you should consider using
15567 @option{-mmedium-calls} instead.
15569 @item -mearly-cbranchsi
15570 @opindex mearly-cbranchsi
15571 Enable pre-reload use of the @code{cbranchsi} pattern.
15573 @item -mexpand-adddi
15574 @opindex mexpand-adddi
15575 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15576 @code{add.f}, @code{adc} etc. This option is deprecated.
15578 @item -mindexed-loads
15579 @opindex mindexed-loads
15580 Enable the use of indexed loads. This can be problematic because some
15581 optimizers then assume that indexed stores exist, which is not
15586 Enable Local Register Allocation. This is still experimental for ARC,
15587 so by default the compiler uses standard reload
15588 (i.e. @option{-mno-lra}).
15590 @item -mlra-priority-none
15591 @opindex mlra-priority-none
15592 Don't indicate any priority for target registers.
15594 @item -mlra-priority-compact
15595 @opindex mlra-priority-compact
15596 Indicate target register priority for r0..r3 / r12..r15.
15598 @item -mlra-priority-noncompact
15599 @opindex mlra-priority-noncompact
15600 Reduce target register priority for r0..r3 / r12..r15.
15602 @item -mno-millicode
15603 @opindex mno-millicode
15604 When optimizing for size (using @option{-Os}), prologues and epilogues
15605 that have to save or restore a large number of registers are often
15606 shortened by using call to a special function in libgcc; this is
15607 referred to as a @emph{millicode} call. As these calls can pose
15608 performance issues, and/or cause linking issues when linking in a
15609 nonstandard way, this option is provided to turn off millicode call
15613 @opindex mmixed-code
15614 Tweak register allocation to help 16-bit instruction generation.
15615 This generally has the effect of decreasing the average instruction size
15616 while increasing the instruction count.
15620 Enable @samp{q} instruction alternatives.
15621 This is the default for @option{-Os}.
15625 Enable @samp{Rcq} constraint handling.
15626 Most short code generation depends on this.
15627 This is the default.
15631 Enable @samp{Rcw} constraint handling.
15632 Most ccfsm condexec mostly depends on this.
15633 This is the default.
15635 @item -msize-level=@var{level}
15636 @opindex msize-level
15637 Fine-tune size optimization with regards to instruction lengths and alignment.
15638 The recognized values for @var{level} are:
15641 No size optimization. This level is deprecated and treated like @samp{1}.
15644 Short instructions are used opportunistically.
15647 In addition, alignment of loops and of code after barriers are dropped.
15650 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15654 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15655 the behavior when this is not set is equivalent to level @samp{1}.
15657 @item -mtune=@var{cpu}
15659 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15660 by @option{-mcpu=}.
15662 Supported values for @var{cpu} are
15666 Tune for ARC600 CPU.
15669 Tune for ARC601 CPU.
15672 Tune for ARC700 CPU with standard multiplier block.
15675 Tune for ARC700 CPU with XMAC block.
15678 Tune for ARC725D CPU.
15681 Tune for ARC750D CPU.
15685 @item -mmultcost=@var{num}
15687 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15688 normal instruction.
15690 @item -munalign-prob-threshold=@var{probability}
15691 @opindex munalign-prob-threshold
15692 Set probability threshold for unaligning branches.
15693 When tuning for @samp{ARC700} and optimizing for speed, branches without
15694 filled delay slot are preferably emitted unaligned and long, unless
15695 profiling indicates that the probability for the branch to be taken
15696 is below @var{probability}. @xref{Cross-profiling}.
15697 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15701 The following options are maintained for backward compatibility, but
15702 are now deprecated and will be removed in a future release:
15704 @c Deprecated options
15712 @opindex mbig-endian
15715 Compile code for big-endian targets. Use of these options is now
15716 deprecated. Big-endian code is supported by configuring GCC to build
15717 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15718 for which big endian is the default.
15720 @item -mlittle-endian
15721 @opindex mlittle-endian
15724 Compile code for little-endian targets. Use of these options is now
15725 deprecated. Little-endian code is supported by configuring GCC to build
15726 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15727 for which little endian is the default.
15729 @item -mbarrel_shifter
15730 @opindex mbarrel_shifter
15731 Replaced by @option{-mbarrel-shifter}.
15733 @item -mdpfp_compact
15734 @opindex mdpfp_compact
15735 Replaced by @option{-mdpfp-compact}.
15738 @opindex mdpfp_fast
15739 Replaced by @option{-mdpfp-fast}.
15742 @opindex mdsp_packa
15743 Replaced by @option{-mdsp-packa}.
15747 Replaced by @option{-mea}.
15751 Replaced by @option{-mmac-24}.
15755 Replaced by @option{-mmac-d16}.
15757 @item -mspfp_compact
15758 @opindex mspfp_compact
15759 Replaced by @option{-mspfp-compact}.
15762 @opindex mspfp_fast
15763 Replaced by @option{-mspfp-fast}.
15765 @item -mtune=@var{cpu}
15767 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15768 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15769 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15771 @item -multcost=@var{num}
15773 Replaced by @option{-mmultcost}.
15778 @subsection ARM Options
15779 @cindex ARM options
15781 These @samp{-m} options are defined for the ARM port:
15784 @item -mabi=@var{name}
15786 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15787 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15790 @opindex mapcs-frame
15791 Generate a stack frame that is compliant with the ARM Procedure Call
15792 Standard for all functions, even if this is not strictly necessary for
15793 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15794 with this option causes the stack frames not to be generated for
15795 leaf functions. The default is @option{-mno-apcs-frame}.
15796 This option is deprecated.
15800 This is a synonym for @option{-mapcs-frame} and is deprecated.
15803 @c not currently implemented
15804 @item -mapcs-stack-check
15805 @opindex mapcs-stack-check
15806 Generate code to check the amount of stack space available upon entry to
15807 every function (that actually uses some stack space). If there is
15808 insufficient space available then either the function
15809 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15810 called, depending upon the amount of stack space required. The runtime
15811 system is required to provide these functions. The default is
15812 @option{-mno-apcs-stack-check}, since this produces smaller code.
15814 @c not currently implemented
15815 @item -mapcs-reentrant
15816 @opindex mapcs-reentrant
15817 Generate reentrant, position-independent code. The default is
15818 @option{-mno-apcs-reentrant}.
15821 @item -mthumb-interwork
15822 @opindex mthumb-interwork
15823 Generate code that supports calling between the ARM and Thumb
15824 instruction sets. Without this option, on pre-v5 architectures, the
15825 two instruction sets cannot be reliably used inside one program. The
15826 default is @option{-mno-thumb-interwork}, since slightly larger code
15827 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15828 configurations this option is meaningless.
15830 @item -mno-sched-prolog
15831 @opindex mno-sched-prolog
15832 Prevent the reordering of instructions in the function prologue, or the
15833 merging of those instruction with the instructions in the function's
15834 body. This means that all functions start with a recognizable set
15835 of instructions (or in fact one of a choice from a small set of
15836 different function prologues), and this information can be used to
15837 locate the start of functions inside an executable piece of code. The
15838 default is @option{-msched-prolog}.
15840 @item -mfloat-abi=@var{name}
15841 @opindex mfloat-abi
15842 Specifies which floating-point ABI to use. Permissible values
15843 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15845 Specifying @samp{soft} causes GCC to generate output containing
15846 library calls for floating-point operations.
15847 @samp{softfp} allows the generation of code using hardware floating-point
15848 instructions, but still uses the soft-float calling conventions.
15849 @samp{hard} allows generation of floating-point instructions
15850 and uses FPU-specific calling conventions.
15852 The default depends on the specific target configuration. Note that
15853 the hard-float and soft-float ABIs are not link-compatible; you must
15854 compile your entire program with the same ABI, and link with a
15855 compatible set of libraries.
15857 @item -mlittle-endian
15858 @opindex mlittle-endian
15859 Generate code for a processor running in little-endian mode. This is
15860 the default for all standard configurations.
15863 @opindex mbig-endian
15864 Generate code for a processor running in big-endian mode; the default is
15865 to compile code for a little-endian processor.
15870 When linking a big-endian image select between BE8 and BE32 formats.
15871 The option has no effect for little-endian images and is ignored. The
15872 default is dependent on the selected target architecture. For ARMv6
15873 and later architectures the default is BE8, for older architectures
15874 the default is BE32. BE32 format has been deprecated by ARM.
15876 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
15878 This specifies the name of the target ARM architecture. GCC uses this
15879 name to determine what kind of instructions it can emit when generating
15880 assembly code. This option can be used in conjunction with or instead
15881 of the @option{-mcpu=} option.
15883 Permissible names are:
15885 @samp{armv5t}, @samp{armv5te},
15886 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
15887 @samp{armv6z}, @samp{armv6zk},
15888 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
15889 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
15893 @samp{armv6-m}, @samp{armv6s-m},
15894 @samp{armv7-m}, @samp{armv7e-m},
15895 @samp{armv8-m.base}, @samp{armv8-m.main},
15896 @samp{iwmmxt} and @samp{iwmmxt2}.
15898 Additionally, the following architectures, which lack support for the
15899 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
15901 Many of the architectures support extensions. These can be added by
15902 appending @samp{+@var{extension}} to the architecture name. Extension
15903 options are processed in order and capabilities accumulate. An extension
15904 will also enable any necessary base extensions
15905 upon which it depends. For example, the @samp{+crypto} extension
15906 will always enable the @samp{+simd} extension. The exception to the
15907 additive construction is for extensions that are prefixed with
15908 @samp{+no@dots{}}: these extensions disable the specified option and
15909 any other extensions that may depend on the presence of that
15912 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
15913 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
15914 entirely disabled by the @samp{+nofp} option that follows it.
15916 Most extension names are generically named, but have an effect that is
15917 dependent upon the architecture to which it is applied. For example,
15918 the @samp{+simd} option can be applied to both @samp{armv7-a} and
15919 @samp{armv8-a} architectures, but will enable the original ARMv7-A
15920 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
15921 variant for @samp{armv8-a}.
15923 The table below lists the supported extensions for each architecture.
15924 Architectures not mentioned do not support any extensions.
15937 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
15938 used as an alias for this extension.
15941 Disable the floating-point instructions.
15945 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
15948 The VFPv3 floating-point instructions, with 16 double-precision
15949 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15950 for this extension. Note that floating-point is not supported by the
15951 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
15952 ARMv7-R architectures.
15955 Disable the floating-point instructions.
15961 The VFPv3 floating-point instructions, with 16 double-precision
15962 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15963 for this extension.
15966 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15967 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
15968 for this extension.
15971 The VFPv3 floating-point instructions, with 32 double-precision
15974 @item +vfpv3-d16-fp16
15975 The VFPv3 floating-point instructions, with 16 double-precision
15976 registers and the half-precision floating-point conversion operations.
15979 The VFPv3 floating-point instructions, with 32 double-precision
15980 registers and the half-precision floating-point conversion operations.
15983 The VFPv4 floating-point instructions, with 16 double-precision
15987 The VFPv4 floating-point instructions, with 32 double-precision
15991 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15992 the half-precision floating-point conversion operations.
15995 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
15998 Disable the Advanced SIMD instructions (does not disable floating point).
16001 Disable the floating-point and Advanced SIMD instructions.
16005 The extended version of the ARMv7-A architecture with support for
16009 The VFPv4 floating-point instructions, with 16 double-precision registers.
16010 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16013 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16014 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16017 The VFPv3 floating-point instructions, with 16 double-precision
16021 The VFPv3 floating-point instructions, with 32 double-precision
16024 @item +vfpv3-d16-fp16
16025 The VFPv3 floating-point instructions, with 16 double-precision
16026 registers and the half-precision floating-point conversion operations.
16029 The VFPv3 floating-point instructions, with 32 double-precision
16030 registers and the half-precision floating-point conversion operations.
16033 The VFPv4 floating-point instructions, with 16 double-precision
16037 The VFPv4 floating-point instructions, with 32 double-precision
16041 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16042 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16045 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16046 the half-precision floating-point conversion operations.
16049 Disable the Advanced SIMD instructions (does not disable floating point).
16052 Disable the floating-point and Advanced SIMD instructions.
16058 The Cyclic Redundancy Check (CRC) instructions.
16060 The ARMv8-A Advanced SIMD and floating-point instructions.
16062 The cryptographic instructions.
16064 Disable the cryptographic instructions.
16066 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16072 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16075 The cryptographic instructions. This also enables the Advanced SIMD and
16076 floating-point instructions.
16079 Disable the cryptographic instructions.
16082 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16089 The half-precision floating-point data processing instructions.
16090 This also enables the Advanced SIMD and floating-point instructions.
16093 The half-precision floating-point fmla extension. This also enables
16094 the half-precision floating-point extension and Advanced SIMD and
16095 floating-point instructions.
16098 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16101 The cryptographic instructions. This also enables the Advanced SIMD and
16102 floating-point instructions.
16105 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16108 Disable the cryptographic extension.
16111 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16117 The half-precision floating-point data processing instructions.
16118 This also enables the Advanced SIMD and floating-point instructions as well
16119 as the Dot Product extension and the half-precision floating-point fmla
16123 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16124 Dot Product extension.
16127 The cryptographic instructions. This also enables the Advanced SIMD and
16128 floating-point instructions as well as the Dot Product extension.
16131 Disable the cryptographic extension.
16134 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16140 The single-precision VFPv3 floating-point instructions. The extension
16141 @samp{+vfpv3xd} can be used as an alias for this extension.
16144 The VFPv3 floating-point instructions with 16 double-precision registers.
16145 The extension +vfpv3-d16 can be used as an alias for this extension.
16148 Disable the floating-point extension.
16151 The ARM-state integer division instructions.
16154 Disable the ARM-state integer division extension.
16160 The single-precision VFPv4 floating-point instructions.
16163 The single-precision FPv5 floating-point instructions.
16166 The single- and double-precision FPv5 floating-point instructions.
16169 Disable the floating-point extensions.
16175 The DSP instructions.
16178 Disable the DSP extension.
16181 The single-precision floating-point instructions.
16184 The single- and double-precision floating-point instructions.
16187 Disable the floating-point extension.
16193 The Cyclic Redundancy Check (CRC) instructions.
16195 The single-precision FPv5 floating-point instructions.
16197 The ARMv8-A Advanced SIMD and floating-point instructions.
16199 The cryptographic instructions.
16201 Disable the cryptographic instructions.
16203 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16208 @option{-march=native} causes the compiler to auto-detect the architecture
16209 of the build computer. At present, this feature is only supported on
16210 GNU/Linux, and not all architectures are recognized. If the auto-detect
16211 is unsuccessful the option has no effect.
16213 @item -mtune=@var{name}
16215 This option specifies the name of the target ARM processor for
16216 which GCC should tune the performance of the code.
16217 For some ARM implementations better performance can be obtained by using
16219 Permissible names are: @samp{arm2}, @samp{arm250},
16220 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16221 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16222 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16223 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16225 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16226 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16227 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16228 @samp{strongarm1110},
16229 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16230 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16231 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16232 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16233 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16234 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16235 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16236 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16237 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16238 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16239 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16240 @samp{cortex-a76}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
16241 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
16249 @samp{cortex-m0plus},
16250 @samp{cortex-m1.small-multiply},
16251 @samp{cortex-m0.small-multiply},
16252 @samp{cortex-m0plus.small-multiply},
16254 @samp{marvell-pj4},
16255 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16256 @samp{fa526}, @samp{fa626},
16257 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16260 Additionally, this option can specify that GCC should tune the performance
16261 of the code for a big.LITTLE system. Permissible names are:
16262 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16263 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16264 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16265 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
16267 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16268 performance for a blend of processors within architecture @var{arch}.
16269 The aim is to generate code that run well on the current most popular
16270 processors, balancing between optimizations that benefit some CPUs in the
16271 range, and avoiding performance pitfalls of other CPUs. The effects of
16272 this option may change in future GCC versions as CPU models come and go.
16274 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16275 the extension options do not affect the tuning of the generated code.
16277 @option{-mtune=native} causes the compiler to auto-detect the CPU
16278 of the build computer. At present, this feature is only supported on
16279 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16280 unsuccessful the option has no effect.
16282 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16284 This specifies the name of the target ARM processor. GCC uses this name
16285 to derive the name of the target ARM architecture (as if specified
16286 by @option{-march}) and the ARM processor type for which to tune for
16287 performance (as if specified by @option{-mtune}). Where this option
16288 is used in conjunction with @option{-march} or @option{-mtune},
16289 those options take precedence over the appropriate part of this option.
16291 Many of the supported CPUs implement optional architectural
16292 extensions. Where this is so the architectural extensions are
16293 normally enabled by default. If implementations that lack the
16294 extension exist, then the extension syntax can be used to disable
16295 those extensions that have been omitted. For floating-point and
16296 Advanced SIMD (Neon) instructions, the settings of the options
16297 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16298 floating-point and Advanced SIMD instructions will only be used if
16299 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16300 @option{-mfpu} other than @samp{auto} will override the available
16301 floating-point and SIMD extension instructions.
16303 For example, @samp{cortex-a9} can be found in three major
16304 configurations: integer only, with just a floating-point unit or with
16305 floating-point and Advanced SIMD. The default is to enable all the
16306 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16307 be used to disable just the SIMD or both the SIMD and floating-point
16308 instructions respectively.
16310 Permissible names for this option are the same as those for
16313 The following extension options are common to the listed CPUs:
16317 Disable the DSP instructions on @samp{cortex-m33}.
16320 Disables the floating-point instructions on @samp{arm9e},
16321 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16322 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16323 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16324 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16325 Disables the floating-point and SIMD instructions on
16326 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16327 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16328 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16329 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16330 @samp{cortex-a53} and @samp{cortex-a55}.
16333 Disables the double-precision component of the floating-point instructions
16334 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16337 Disables the SIMD (but not floating-point) instructions on
16338 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16339 and @samp{cortex-a9}.
16342 Enables the cryptographic instructions on @samp{cortex-a32},
16343 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16344 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16345 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16346 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16347 @samp{cortex-a75.cortex-a55}.
16350 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16351 VFPv3 with 16 double-precision registers. It supports the following
16352 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16353 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16354 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16355 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16356 @option{-march=armv7-a}.
16358 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16359 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16360 See @option{-mtune} for more information.
16362 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16363 of the build computer. At present, this feature is only supported on
16364 GNU/Linux, and not all architectures are recognized. If the auto-detect
16365 is unsuccessful the option has no effect.
16367 @item -mfpu=@var{name}
16369 This specifies what floating-point hardware (or hardware emulation) is
16370 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16372 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16373 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16374 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16375 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16376 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16377 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16378 is an alias for @samp{vfpv2}.
16380 The setting @samp{auto} is the default and is special. It causes the
16381 compiler to select the floating-point and Advanced SIMD instructions
16382 based on the settings of @option{-mcpu} and @option{-march}.
16384 If the selected floating-point hardware includes the NEON extension
16385 (e.g. @option{-mfpu=neon}), note that floating-point
16386 operations are not generated by GCC's auto-vectorization pass unless
16387 @option{-funsafe-math-optimizations} is also specified. This is
16388 because NEON hardware does not fully implement the IEEE 754 standard for
16389 floating-point arithmetic (in particular denormal values are treated as
16390 zero), so the use of NEON instructions may lead to a loss of precision.
16392 You can also set the fpu name at function level by using the @code{target("fpu=")} function attributes (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16394 @item -mfp16-format=@var{name}
16395 @opindex mfp16-format
16396 Specify the format of the @code{__fp16} half-precision floating-point type.
16397 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16398 the default is @samp{none}, in which case the @code{__fp16} type is not
16399 defined. @xref{Half-Precision}, for more information.
16401 @item -mstructure-size-boundary=@var{n}
16402 @opindex mstructure-size-boundary
16403 The sizes of all structures and unions are rounded up to a multiple
16404 of the number of bits set by this option. Permissible values are 8, 32
16405 and 64. The default value varies for different toolchains. For the COFF
16406 targeted toolchain the default value is 8. A value of 64 is only allowed
16407 if the underlying ABI supports it.
16409 Specifying a larger number can produce faster, more efficient code, but
16410 can also increase the size of the program. Different values are potentially
16411 incompatible. Code compiled with one value cannot necessarily expect to
16412 work with code or libraries compiled with another value, if they exchange
16413 information using structures or unions.
16415 This option is deprecated.
16417 @item -mabort-on-noreturn
16418 @opindex mabort-on-noreturn
16419 Generate a call to the function @code{abort} at the end of a
16420 @code{noreturn} function. It is executed if the function tries to
16424 @itemx -mno-long-calls
16425 @opindex mlong-calls
16426 @opindex mno-long-calls
16427 Tells the compiler to perform function calls by first loading the
16428 address of the function into a register and then performing a subroutine
16429 call on this register. This switch is needed if the target function
16430 lies outside of the 64-megabyte addressing range of the offset-based
16431 version of subroutine call instruction.
16433 Even if this switch is enabled, not all function calls are turned
16434 into long calls. The heuristic is that static functions, functions
16435 that have the @code{short_call} attribute, functions that are inside
16436 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16437 definitions have already been compiled within the current compilation
16438 unit are not turned into long calls. The exceptions to this rule are
16439 that weak function definitions, functions with the @code{long_call}
16440 attribute or the @code{section} attribute, and functions that are within
16441 the scope of a @code{#pragma long_calls} directive are always
16442 turned into long calls.
16444 This feature is not enabled by default. Specifying
16445 @option{-mno-long-calls} restores the default behavior, as does
16446 placing the function calls within the scope of a @code{#pragma
16447 long_calls_off} directive. Note these switches have no effect on how
16448 the compiler generates code to handle function calls via function
16451 @item -msingle-pic-base
16452 @opindex msingle-pic-base
16453 Treat the register used for PIC addressing as read-only, rather than
16454 loading it in the prologue for each function. The runtime system is
16455 responsible for initializing this register with an appropriate value
16456 before execution begins.
16458 @item -mpic-register=@var{reg}
16459 @opindex mpic-register
16460 Specify the register to be used for PIC addressing.
16461 For standard PIC base case, the default is any suitable register
16462 determined by compiler. For single PIC base case, the default is
16463 @samp{R9} if target is EABI based or stack-checking is enabled,
16464 otherwise the default is @samp{R10}.
16466 @item -mpic-data-is-text-relative
16467 @opindex mpic-data-is-text-relative
16468 Assume that the displacement between the text and data segments is fixed
16469 at static link time. This permits using PC-relative addressing
16470 operations to access data known to be in the data segment. For
16471 non-VxWorks RTP targets, this option is enabled by default. When
16472 disabled on such targets, it will enable @option{-msingle-pic-base} by
16475 @item -mpoke-function-name
16476 @opindex mpoke-function-name
16477 Write the name of each function into the text section, directly
16478 preceding the function prologue. The generated code is similar to this:
16482 .ascii "arm_poke_function_name", 0
16485 .word 0xff000000 + (t1 - t0)
16486 arm_poke_function_name
16488 stmfd sp!, @{fp, ip, lr, pc@}
16492 When performing a stack backtrace, code can inspect the value of
16493 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16494 location @code{pc - 12} and the top 8 bits are set, then we know that
16495 there is a function name embedded immediately preceding this location
16496 and has length @code{((pc[-3]) & 0xff000000)}.
16503 Select between generating code that executes in ARM and Thumb
16504 states. The default for most configurations is to generate code
16505 that executes in ARM state, but the default can be changed by
16506 configuring GCC with the @option{--with-mode=}@var{state}
16509 You can also override the ARM and Thumb mode for each function
16510 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16511 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16514 @opindex mflip-thumb
16515 Switch ARM/Thumb modes on alternating functions.
16516 This option is provided for regression testing of mixed Thumb/ARM code
16517 generation, and is not intended for ordinary use in compiling code.
16520 @opindex mtpcs-frame
16521 Generate a stack frame that is compliant with the Thumb Procedure Call
16522 Standard for all non-leaf functions. (A leaf function is one that does
16523 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16525 @item -mtpcs-leaf-frame
16526 @opindex mtpcs-leaf-frame
16527 Generate a stack frame that is compliant with the Thumb Procedure Call
16528 Standard for all leaf functions. (A leaf function is one that does
16529 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16531 @item -mcallee-super-interworking
16532 @opindex mcallee-super-interworking
16533 Gives all externally visible functions in the file being compiled an ARM
16534 instruction set header which switches to Thumb mode before executing the
16535 rest of the function. This allows these functions to be called from
16536 non-interworking code. This option is not valid in AAPCS configurations
16537 because interworking is enabled by default.
16539 @item -mcaller-super-interworking
16540 @opindex mcaller-super-interworking
16541 Allows calls via function pointers (including virtual functions) to
16542 execute correctly regardless of whether the target code has been
16543 compiled for interworking or not. There is a small overhead in the cost
16544 of executing a function pointer if this option is enabled. This option
16545 is not valid in AAPCS configurations because interworking is enabled
16548 @item -mtp=@var{name}
16550 Specify the access model for the thread local storage pointer. The valid
16551 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16552 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16553 (supported in the arm6k architecture), and @samp{auto}, which uses the
16554 best available method for the selected processor. The default setting is
16557 @item -mtls-dialect=@var{dialect}
16558 @opindex mtls-dialect
16559 Specify the dialect to use for accessing thread local storage. Two
16560 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16561 @samp{gnu} dialect selects the original GNU scheme for supporting
16562 local and global dynamic TLS models. The @samp{gnu2} dialect
16563 selects the GNU descriptor scheme, which provides better performance
16564 for shared libraries. The GNU descriptor scheme is compatible with
16565 the original scheme, but does require new assembler, linker and
16566 library support. Initial and local exec TLS models are unaffected by
16567 this option and always use the original scheme.
16569 @item -mword-relocations
16570 @opindex mword-relocations
16571 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16572 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16573 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16576 @item -mfix-cortex-m3-ldrd
16577 @opindex mfix-cortex-m3-ldrd
16578 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16579 with overlapping destination and base registers are used. This option avoids
16580 generating these instructions. This option is enabled by default when
16581 @option{-mcpu=cortex-m3} is specified.
16583 @item -munaligned-access
16584 @itemx -mno-unaligned-access
16585 @opindex munaligned-access
16586 @opindex mno-unaligned-access
16587 Enables (or disables) reading and writing of 16- and 32- bit values
16588 from addresses that are not 16- or 32- bit aligned. By default
16589 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16590 ARMv8-M Baseline architectures, and enabled for all other
16591 architectures. If unaligned access is not enabled then words in packed
16592 data structures are accessed a byte at a time.
16594 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16595 generated object file to either true or false, depending upon the
16596 setting of this option. If unaligned access is enabled then the
16597 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16600 @item -mneon-for-64bits
16601 @opindex mneon-for-64bits
16602 Enables using Neon to handle scalar 64-bits operations. This is
16603 disabled by default since the cost of moving data from core registers
16606 @item -mslow-flash-data
16607 @opindex mslow-flash-data
16608 Assume loading data from flash is slower than fetching instruction.
16609 Therefore literal load is minimized for better performance.
16610 This option is only supported when compiling for ARMv7 M-profile and
16613 @item -masm-syntax-unified
16614 @opindex masm-syntax-unified
16615 Assume inline assembler is using unified asm syntax. The default is
16616 currently off which implies divided syntax. This option has no impact
16617 on Thumb2. However, this may change in future releases of GCC.
16618 Divided syntax should be considered deprecated.
16620 @item -mrestrict-it
16621 @opindex mrestrict-it
16622 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16623 IT blocks can only contain a single 16-bit instruction from a select
16624 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16626 @item -mprint-tune-info
16627 @opindex mprint-tune-info
16628 Print CPU tuning information as comment in assembler file. This is
16629 an option used only for regression testing of the compiler and not
16630 intended for ordinary use in compiling code. This option is disabled
16633 @item -mverbose-cost-dump
16634 @opindex mverbose-cost-dump
16635 Enable verbose cost model dumping in the debug dump files. This option is
16636 provided for use in debugging the compiler.
16639 @opindex mpure-code
16640 Do not allow constant data to be placed in code sections.
16641 Additionally, when compiling for ELF object format give all text sections the
16642 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16643 is only available when generating non-pic code for M-profile targets with the
16648 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16649 Development Tools Engineering Specification", which can be found on
16650 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16654 @subsection AVR Options
16655 @cindex AVR Options
16657 These options are defined for AVR implementations:
16660 @item -mmcu=@var{mcu}
16662 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16664 The default for this option is@tie{}@samp{avr2}.
16666 GCC supports the following AVR devices and ISAs:
16668 @include avr-mmcu.texi
16673 Assume that all data in static storage can be accessed by LDS / STS
16674 instructions. This option has only an effect on reduced Tiny devices like
16675 ATtiny40. See also the @code{absdata}
16676 @ref{AVR Variable Attributes,variable attribute}.
16678 @item -maccumulate-args
16679 @opindex maccumulate-args
16680 Accumulate outgoing function arguments and acquire/release the needed
16681 stack space for outgoing function arguments once in function
16682 prologue/epilogue. Without this option, outgoing arguments are pushed
16683 before calling a function and popped afterwards.
16685 Popping the arguments after the function call can be expensive on
16686 AVR so that accumulating the stack space might lead to smaller
16687 executables because arguments need not be removed from the
16688 stack after such a function call.
16690 This option can lead to reduced code size for functions that perform
16691 several calls to functions that get their arguments on the stack like
16692 calls to printf-like functions.
16694 @item -mbranch-cost=@var{cost}
16695 @opindex mbranch-cost
16696 Set the branch costs for conditional branch instructions to
16697 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16698 integers. The default branch cost is 0.
16700 @item -mcall-prologues
16701 @opindex mcall-prologues
16702 Functions prologues/epilogues are expanded as calls to appropriate
16703 subroutines. Code size is smaller.
16705 @item -mgas-isr-prologues
16706 @opindex mgas-isr-prologues
16707 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16708 instruction supported by GNU Binutils.
16709 If this option is on, the feature can still be disabled for individual
16710 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16711 function attribute. This feature is activated per default
16712 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16713 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16717 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16718 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16719 and @code{long long} is 4 bytes. Please note that this option does not
16720 conform to the C standards, but it results in smaller code
16723 @item -mmain-is-OS_task
16724 @opindex mmain-is-OS_task
16725 Do not save registers in @code{main}. The effect is the same like
16726 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
16727 to @code{main}. It is activated per default if optimization is on.
16729 @item -mn-flash=@var{num}
16731 Assume that the flash memory has a size of
16732 @var{num} times 64@tie{}KiB.
16734 @item -mno-interrupts
16735 @opindex mno-interrupts
16736 Generated code is not compatible with hardware interrupts.
16737 Code size is smaller.
16741 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16742 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16743 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16744 the assembler's command line and the @option{--relax} option to the
16745 linker's command line.
16747 Jump relaxing is performed by the linker because jump offsets are not
16748 known before code is located. Therefore, the assembler code generated by the
16749 compiler is the same, but the instructions in the executable may
16750 differ from instructions in the assembler code.
16752 Relaxing must be turned on if linker stubs are needed, see the
16753 section on @code{EIND} and linker stubs below.
16757 Assume that the device supports the Read-Modify-Write
16758 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16760 @item -mshort-calls
16761 @opindex mshort-calls
16763 Assume that @code{RJMP} and @code{RCALL} can target the whole
16766 This option is used internally for multilib selection. It is
16767 not an optimization option, and you don't need to set it by hand.
16771 Treat the stack pointer register as an 8-bit register,
16772 i.e.@: assume the high byte of the stack pointer is zero.
16773 In general, you don't need to set this option by hand.
16775 This option is used internally by the compiler to select and
16776 build multilibs for architectures @code{avr2} and @code{avr25}.
16777 These architectures mix devices with and without @code{SPH}.
16778 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16779 the compiler driver adds or removes this option from the compiler
16780 proper's command line, because the compiler then knows if the device
16781 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16786 Use address register @code{X} in a way proposed by the hardware. This means
16787 that @code{X} is only used in indirect, post-increment or
16788 pre-decrement addressing.
16790 Without this option, the @code{X} register may be used in the same way
16791 as @code{Y} or @code{Z} which then is emulated by additional
16793 For example, loading a value with @code{X+const} addressing with a
16794 small non-negative @code{const < 64} to a register @var{Rn} is
16798 adiw r26, const ; X += const
16799 ld @var{Rn}, X ; @var{Rn} = *X
16800 sbiw r26, const ; X -= const
16804 @opindex mtiny-stack
16805 Only change the lower 8@tie{}bits of the stack pointer.
16807 @item -mfract-convert-truncate
16808 @opindex mfract-convert-truncate
16809 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16812 @opindex nodevicelib
16813 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16815 @item -Waddr-space-convert
16816 @opindex Waddr-space-convert
16817 @opindex Wno-addr-space-convert
16818 Warn about conversions between address spaces in the case where the
16819 resulting address space is not contained in the incoming address space.
16821 @item -Wmisspelled-isr
16822 @opindex Wmisspelled-isr
16823 @opindex Wno-misspelled-isr
16824 Warn if the ISR is misspelled, i.e. without __vector prefix.
16825 Enabled by default.
16828 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16829 @cindex @code{EIND}
16830 Pointers in the implementation are 16@tie{}bits wide.
16831 The address of a function or label is represented as word address so
16832 that indirect jumps and calls can target any code address in the
16833 range of 64@tie{}Ki words.
16835 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16836 bytes of program memory space, there is a special function register called
16837 @code{EIND} that serves as most significant part of the target address
16838 when @code{EICALL} or @code{EIJMP} instructions are used.
16840 Indirect jumps and calls on these devices are handled as follows by
16841 the compiler and are subject to some limitations:
16846 The compiler never sets @code{EIND}.
16849 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16850 instructions or might read @code{EIND} directly in order to emulate an
16851 indirect call/jump by means of a @code{RET} instruction.
16854 The compiler assumes that @code{EIND} never changes during the startup
16855 code or during the application. In particular, @code{EIND} is not
16856 saved/restored in function or interrupt service routine
16860 For indirect calls to functions and computed goto, the linker
16861 generates @emph{stubs}. Stubs are jump pads sometimes also called
16862 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16863 The stub contains a direct jump to the desired address.
16866 Linker relaxation must be turned on so that the linker generates
16867 the stubs correctly in all situations. See the compiler option
16868 @option{-mrelax} and the linker option @option{--relax}.
16869 There are corner cases where the linker is supposed to generate stubs
16870 but aborts without relaxation and without a helpful error message.
16873 The default linker script is arranged for code with @code{EIND = 0}.
16874 If code is supposed to work for a setup with @code{EIND != 0}, a custom
16875 linker script has to be used in order to place the sections whose
16876 name start with @code{.trampolines} into the segment where @code{EIND}
16880 The startup code from libgcc never sets @code{EIND}.
16881 Notice that startup code is a blend of code from libgcc and AVR-LibC.
16882 For the impact of AVR-LibC on @code{EIND}, see the
16883 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
16886 It is legitimate for user-specific startup code to set up @code{EIND}
16887 early, for example by means of initialization code located in
16888 section @code{.init3}. Such code runs prior to general startup code
16889 that initializes RAM and calls constructors, but after the bit
16890 of startup code from AVR-LibC that sets @code{EIND} to the segment
16891 where the vector table is located.
16893 #include <avr/io.h>
16896 __attribute__((section(".init3"),naked,used,no_instrument_function))
16897 init3_set_eind (void)
16899 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
16900 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
16905 The @code{__trampolines_start} symbol is defined in the linker script.
16908 Stubs are generated automatically by the linker if
16909 the following two conditions are met:
16912 @item The address of a label is taken by means of the @code{gs} modifier
16913 (short for @emph{generate stubs}) like so:
16915 LDI r24, lo8(gs(@var{func}))
16916 LDI r25, hi8(gs(@var{func}))
16918 @item The final location of that label is in a code segment
16919 @emph{outside} the segment where the stubs are located.
16923 The compiler emits such @code{gs} modifiers for code labels in the
16924 following situations:
16926 @item Taking address of a function or code label.
16927 @item Computed goto.
16928 @item If prologue-save function is used, see @option{-mcall-prologues}
16929 command-line option.
16930 @item Switch/case dispatch tables. If you do not want such dispatch
16931 tables you can specify the @option{-fno-jump-tables} command-line option.
16932 @item C and C++ constructors/destructors called during startup/shutdown.
16933 @item If the tools hit a @code{gs()} modifier explained above.
16937 Jumping to non-symbolic addresses like so is @emph{not} supported:
16942 /* Call function at word address 0x2 */
16943 return ((int(*)(void)) 0x2)();
16947 Instead, a stub has to be set up, i.e.@: the function has to be called
16948 through a symbol (@code{func_4} in the example):
16953 extern int func_4 (void);
16955 /* Call function at byte address 0x4 */
16960 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
16961 Alternatively, @code{func_4} can be defined in the linker script.
16964 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
16965 @cindex @code{RAMPD}
16966 @cindex @code{RAMPX}
16967 @cindex @code{RAMPY}
16968 @cindex @code{RAMPZ}
16969 Some AVR devices support memories larger than the 64@tie{}KiB range
16970 that can be accessed with 16-bit pointers. To access memory locations
16971 outside this 64@tie{}KiB range, the content of a @code{RAMP}
16972 register is used as high part of the address:
16973 The @code{X}, @code{Y}, @code{Z} address register is concatenated
16974 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
16975 register, respectively, to get a wide address. Similarly,
16976 @code{RAMPD} is used together with direct addressing.
16980 The startup code initializes the @code{RAMP} special function
16981 registers with zero.
16984 If a @ref{AVR Named Address Spaces,named address space} other than
16985 generic or @code{__flash} is used, then @code{RAMPZ} is set
16986 as needed before the operation.
16989 If the device supports RAM larger than 64@tie{}KiB and the compiler
16990 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
16991 is reset to zero after the operation.
16994 If the device comes with a specific @code{RAMP} register, the ISR
16995 prologue/epilogue saves/restores that SFR and initializes it with
16996 zero in case the ISR code might (implicitly) use it.
16999 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17000 If you use inline assembler to read from locations outside the
17001 16-bit address range and change one of the @code{RAMP} registers,
17002 you must reset it to zero after the access.
17006 @subsubsection AVR Built-in Macros
17008 GCC defines several built-in macros so that the user code can test
17009 for the presence or absence of features. Almost any of the following
17010 built-in macros are deduced from device capabilities and thus
17011 triggered by the @option{-mmcu=} command-line option.
17013 For even more AVR-specific built-in macros see
17014 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17019 Build-in macro that resolves to a decimal number that identifies the
17020 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17021 Possible values are:
17023 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17024 @code{4}, @code{5}, @code{51}, @code{6}
17026 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17027 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17032 @code{102}, @code{103}, @code{104},
17033 @code{105}, @code{106}, @code{107}
17035 for @var{mcu}=@code{avrtiny},
17036 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17037 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17038 If @var{mcu} specifies a device, this built-in macro is set
17039 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17040 defined to @code{4}.
17042 @item __AVR_@var{Device}__
17043 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17044 the device's name. For example, @option{-mmcu=atmega8} defines the
17045 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17046 @code{__AVR_ATtiny261A__}, etc.
17048 The built-in macros' names follow
17049 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17050 the device name as from the AVR user manual. The difference between
17051 @var{Device} in the built-in macro and @var{device} in
17052 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17054 If @var{device} is not a device but only a core architecture like
17055 @samp{avr51}, this macro is not defined.
17057 @item __AVR_DEVICE_NAME__
17058 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17059 the device's name. For example, with @option{-mmcu=atmega8} the macro
17060 is defined to @code{atmega8}.
17062 If @var{device} is not a device but only a core architecture like
17063 @samp{avr51}, this macro is not defined.
17065 @item __AVR_XMEGA__
17066 The device / architecture belongs to the XMEGA family of devices.
17068 @item __AVR_HAVE_ELPM__
17069 The device has the @code{ELPM} instruction.
17071 @item __AVR_HAVE_ELPMX__
17072 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17073 R@var{n},Z+} instructions.
17075 @item __AVR_HAVE_MOVW__
17076 The device has the @code{MOVW} instruction to perform 16-bit
17077 register-register moves.
17079 @item __AVR_HAVE_LPMX__
17080 The device has the @code{LPM R@var{n},Z} and
17081 @code{LPM R@var{n},Z+} instructions.
17083 @item __AVR_HAVE_MUL__
17084 The device has a hardware multiplier.
17086 @item __AVR_HAVE_JMP_CALL__
17087 The device has the @code{JMP} and @code{CALL} instructions.
17088 This is the case for devices with more than 8@tie{}KiB of program
17091 @item __AVR_HAVE_EIJMP_EICALL__
17092 @itemx __AVR_3_BYTE_PC__
17093 The device has the @code{EIJMP} and @code{EICALL} instructions.
17094 This is the case for devices with more than 128@tie{}KiB of program memory.
17095 This also means that the program counter
17096 (PC) is 3@tie{}bytes wide.
17098 @item __AVR_2_BYTE_PC__
17099 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17100 with up to 128@tie{}KiB of program memory.
17102 @item __AVR_HAVE_8BIT_SP__
17103 @itemx __AVR_HAVE_16BIT_SP__
17104 The stack pointer (SP) register is treated as 8-bit respectively
17105 16-bit register by the compiler.
17106 The definition of these macros is affected by @option{-mtiny-stack}.
17108 @item __AVR_HAVE_SPH__
17110 The device has the SPH (high part of stack pointer) special function
17111 register or has an 8-bit stack pointer, respectively.
17112 The definition of these macros is affected by @option{-mmcu=} and
17113 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17116 @item __AVR_HAVE_RAMPD__
17117 @itemx __AVR_HAVE_RAMPX__
17118 @itemx __AVR_HAVE_RAMPY__
17119 @itemx __AVR_HAVE_RAMPZ__
17120 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17121 @code{RAMPZ} special function register, respectively.
17123 @item __NO_INTERRUPTS__
17124 This macro reflects the @option{-mno-interrupts} command-line option.
17126 @item __AVR_ERRATA_SKIP__
17127 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17128 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17129 instructions because of a hardware erratum. Skip instructions are
17130 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17131 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17134 @item __AVR_ISA_RMW__
17135 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17137 @item __AVR_SFR_OFFSET__=@var{offset}
17138 Instructions that can address I/O special function registers directly
17139 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17140 address as if addressed by an instruction to access RAM like @code{LD}
17141 or @code{STS}. This offset depends on the device architecture and has
17142 to be subtracted from the RAM address in order to get the
17143 respective I/O@tie{}address.
17145 @item __AVR_SHORT_CALLS__
17146 The @option{-mshort-calls} command line option is set.
17148 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17149 Some devices support reading from flash memory by means of @code{LD*}
17150 instructions. The flash memory is seen in the data address space
17151 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17152 is not defined, this feature is not available. If defined,
17153 the address space is linear and there is no need to put
17154 @code{.rodata} into RAM. This is handled by the default linker
17155 description file, and is currently available for
17156 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17157 there is no need to use address spaces like @code{__flash} or
17158 features like attribute @code{progmem} and @code{pgm_read_*}.
17160 @item __WITH_AVRLIBC__
17161 The compiler is configured to be used together with AVR-Libc.
17162 See the @option{--with-avrlibc} configure option.
17166 @node Blackfin Options
17167 @subsection Blackfin Options
17168 @cindex Blackfin Options
17171 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17173 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17174 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17175 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17176 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17177 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17178 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17179 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17180 @samp{bf561}, @samp{bf592}.
17182 The optional @var{sirevision} specifies the silicon revision of the target
17183 Blackfin processor. Any workarounds available for the targeted silicon revision
17184 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17185 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17186 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17187 hexadecimal digits representing the major and minor numbers in the silicon
17188 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17189 is not defined. If @var{sirevision} is @samp{any}, the
17190 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17191 If this optional @var{sirevision} is not used, GCC assumes the latest known
17192 silicon revision of the targeted Blackfin processor.
17194 GCC defines a preprocessor macro for the specified @var{cpu}.
17195 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17196 provided by libgloss to be linked in if @option{-msim} is not given.
17198 Without this option, @samp{bf532} is used as the processor by default.
17200 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17201 only the preprocessor macro is defined.
17205 Specifies that the program will be run on the simulator. This causes
17206 the simulator BSP provided by libgloss to be linked in. This option
17207 has effect only for @samp{bfin-elf} toolchain.
17208 Certain other options, such as @option{-mid-shared-library} and
17209 @option{-mfdpic}, imply @option{-msim}.
17211 @item -momit-leaf-frame-pointer
17212 @opindex momit-leaf-frame-pointer
17213 Don't keep the frame pointer in a register for leaf functions. This
17214 avoids the instructions to save, set up and restore frame pointers and
17215 makes an extra register available in leaf functions.
17217 @item -mspecld-anomaly
17218 @opindex mspecld-anomaly
17219 When enabled, the compiler ensures that the generated code does not
17220 contain speculative loads after jump instructions. If this option is used,
17221 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17223 @item -mno-specld-anomaly
17224 @opindex mno-specld-anomaly
17225 Don't generate extra code to prevent speculative loads from occurring.
17227 @item -mcsync-anomaly
17228 @opindex mcsync-anomaly
17229 When enabled, the compiler ensures that the generated code does not
17230 contain CSYNC or SSYNC instructions too soon after conditional branches.
17231 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17233 @item -mno-csync-anomaly
17234 @opindex mno-csync-anomaly
17235 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17236 occurring too soon after a conditional branch.
17240 When enabled, the compiler is free to take advantage of the knowledge that
17241 the entire program fits into the low 64k of memory.
17244 @opindex mno-low-64k
17245 Assume that the program is arbitrarily large. This is the default.
17247 @item -mstack-check-l1
17248 @opindex mstack-check-l1
17249 Do stack checking using information placed into L1 scratchpad memory by the
17252 @item -mid-shared-library
17253 @opindex mid-shared-library
17254 Generate code that supports shared libraries via the library ID method.
17255 This allows for execute in place and shared libraries in an environment
17256 without virtual memory management. This option implies @option{-fPIC}.
17257 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17259 @item -mno-id-shared-library
17260 @opindex mno-id-shared-library
17261 Generate code that doesn't assume ID-based shared libraries are being used.
17262 This is the default.
17264 @item -mleaf-id-shared-library
17265 @opindex mleaf-id-shared-library
17266 Generate code that supports shared libraries via the library ID method,
17267 but assumes that this library or executable won't link against any other
17268 ID shared libraries. That allows the compiler to use faster code for jumps
17271 @item -mno-leaf-id-shared-library
17272 @opindex mno-leaf-id-shared-library
17273 Do not assume that the code being compiled won't link against any ID shared
17274 libraries. Slower code is generated for jump and call insns.
17276 @item -mshared-library-id=n
17277 @opindex mshared-library-id
17278 Specifies the identification number of the ID-based shared library being
17279 compiled. Specifying a value of 0 generates more compact code; specifying
17280 other values forces the allocation of that number to the current
17281 library but is no more space- or time-efficient than omitting this option.
17285 Generate code that allows the data segment to be located in a different
17286 area of memory from the text segment. This allows for execute in place in
17287 an environment without virtual memory management by eliminating relocations
17288 against the text section.
17290 @item -mno-sep-data
17291 @opindex mno-sep-data
17292 Generate code that assumes that the data segment follows the text segment.
17293 This is the default.
17296 @itemx -mno-long-calls
17297 @opindex mlong-calls
17298 @opindex mno-long-calls
17299 Tells the compiler to perform function calls by first loading the
17300 address of the function into a register and then performing a subroutine
17301 call on this register. This switch is needed if the target function
17302 lies outside of the 24-bit addressing range of the offset-based
17303 version of subroutine call instruction.
17305 This feature is not enabled by default. Specifying
17306 @option{-mno-long-calls} restores the default behavior. Note these
17307 switches have no effect on how the compiler generates code to handle
17308 function calls via function pointers.
17312 Link with the fast floating-point library. This library relaxes some of
17313 the IEEE floating-point standard's rules for checking inputs against
17314 Not-a-Number (NAN), in the interest of performance.
17317 @opindex minline-plt
17318 Enable inlining of PLT entries in function calls to functions that are
17319 not known to bind locally. It has no effect without @option{-mfdpic}.
17322 @opindex mmulticore
17323 Build a standalone application for multicore Blackfin processors.
17324 This option causes proper start files and link scripts supporting
17325 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17326 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17328 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17329 selects the one-application-per-core programming model. Without
17330 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17331 programming model is used. In this model, the main function of Core B
17332 should be named as @code{coreb_main}.
17334 If this option is not used, the single-core application programming
17339 Build a standalone application for Core A of BF561 when using
17340 the one-application-per-core programming model. Proper start files
17341 and link scripts are used to support Core A, and the macro
17342 @code{__BFIN_COREA} is defined.
17343 This option can only be used in conjunction with @option{-mmulticore}.
17347 Build a standalone application for Core B of BF561 when using
17348 the one-application-per-core programming model. Proper start files
17349 and link scripts are used to support Core B, and the macro
17350 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17351 should be used instead of @code{main}.
17352 This option can only be used in conjunction with @option{-mmulticore}.
17356 Build a standalone application for SDRAM. Proper start files and
17357 link scripts are used to put the application into SDRAM, and the macro
17358 @code{__BFIN_SDRAM} is defined.
17359 The loader should initialize SDRAM before loading the application.
17363 Assume that ICPLBs are enabled at run time. This has an effect on certain
17364 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17365 are enabled; for standalone applications the default is off.
17369 @subsection C6X Options
17370 @cindex C6X Options
17373 @item -march=@var{name}
17375 This specifies the name of the target architecture. GCC uses this
17376 name to determine what kind of instructions it can emit when generating
17377 assembly code. Permissible names are: @samp{c62x},
17378 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17381 @opindex mbig-endian
17382 Generate code for a big-endian target.
17384 @item -mlittle-endian
17385 @opindex mlittle-endian
17386 Generate code for a little-endian target. This is the default.
17390 Choose startup files and linker script suitable for the simulator.
17392 @item -msdata=default
17393 @opindex msdata=default
17394 Put small global and static data in the @code{.neardata} section,
17395 which is pointed to by register @code{B14}. Put small uninitialized
17396 global and static data in the @code{.bss} section, which is adjacent
17397 to the @code{.neardata} section. Put small read-only data into the
17398 @code{.rodata} section. The corresponding sections used for large
17399 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17402 @opindex msdata=all
17403 Put all data, not just small objects, into the sections reserved for
17404 small data, and use addressing relative to the @code{B14} register to
17408 @opindex msdata=none
17409 Make no use of the sections reserved for small data, and use absolute
17410 addresses to access all data. Put all initialized global and static
17411 data in the @code{.fardata} section, and all uninitialized data in the
17412 @code{.far} section. Put all constant data into the @code{.const}
17417 @subsection CRIS Options
17418 @cindex CRIS Options
17420 These options are defined specifically for the CRIS ports.
17423 @item -march=@var{architecture-type}
17424 @itemx -mcpu=@var{architecture-type}
17427 Generate code for the specified architecture. The choices for
17428 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17429 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17430 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17433 @item -mtune=@var{architecture-type}
17435 Tune to @var{architecture-type} everything applicable about the generated
17436 code, except for the ABI and the set of available instructions. The
17437 choices for @var{architecture-type} are the same as for
17438 @option{-march=@var{architecture-type}}.
17440 @item -mmax-stack-frame=@var{n}
17441 @opindex mmax-stack-frame
17442 Warn when the stack frame of a function exceeds @var{n} bytes.
17448 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17449 @option{-march=v3} and @option{-march=v8} respectively.
17451 @item -mmul-bug-workaround
17452 @itemx -mno-mul-bug-workaround
17453 @opindex mmul-bug-workaround
17454 @opindex mno-mul-bug-workaround
17455 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17456 models where it applies. This option is active by default.
17460 Enable CRIS-specific verbose debug-related information in the assembly
17461 code. This option also has the effect of turning off the @samp{#NO_APP}
17462 formatted-code indicator to the assembler at the beginning of the
17467 Do not use condition-code results from previous instruction; always emit
17468 compare and test instructions before use of condition codes.
17470 @item -mno-side-effects
17471 @opindex mno-side-effects
17472 Do not emit instructions with side effects in addressing modes other than
17475 @item -mstack-align
17476 @itemx -mno-stack-align
17477 @itemx -mdata-align
17478 @itemx -mno-data-align
17479 @itemx -mconst-align
17480 @itemx -mno-const-align
17481 @opindex mstack-align
17482 @opindex mno-stack-align
17483 @opindex mdata-align
17484 @opindex mno-data-align
17485 @opindex mconst-align
17486 @opindex mno-const-align
17487 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17488 stack frame, individual data and constants to be aligned for the maximum
17489 single data access size for the chosen CPU model. The default is to
17490 arrange for 32-bit alignment. ABI details such as structure layout are
17491 not affected by these options.
17499 Similar to the stack- data- and const-align options above, these options
17500 arrange for stack frame, writable data and constants to all be 32-bit,
17501 16-bit or 8-bit aligned. The default is 32-bit alignment.
17503 @item -mno-prologue-epilogue
17504 @itemx -mprologue-epilogue
17505 @opindex mno-prologue-epilogue
17506 @opindex mprologue-epilogue
17507 With @option{-mno-prologue-epilogue}, the normal function prologue and
17508 epilogue which set up the stack frame are omitted and no return
17509 instructions or return sequences are generated in the code. Use this
17510 option only together with visual inspection of the compiled code: no
17511 warnings or errors are generated when call-saved registers must be saved,
17512 or storage for local variables needs to be allocated.
17516 @opindex mno-gotplt
17518 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17519 instruction sequences that load addresses for functions from the PLT part
17520 of the GOT rather than (traditional on other architectures) calls to the
17521 PLT@. The default is @option{-mgotplt}.
17525 Legacy no-op option only recognized with the cris-axis-elf and
17526 cris-axis-linux-gnu targets.
17530 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17534 This option, recognized for the cris-axis-elf, arranges
17535 to link with input-output functions from a simulator library. Code,
17536 initialized data and zero-initialized data are allocated consecutively.
17540 Like @option{-sim}, but pass linker options to locate initialized data at
17541 0x40000000 and zero-initialized data at 0x80000000.
17545 @subsection CR16 Options
17546 @cindex CR16 Options
17548 These options are defined specifically for the CR16 ports.
17554 Enable the use of multiply-accumulate instructions. Disabled by default.
17558 @opindex mcr16cplus
17560 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17565 Links the library libsim.a which is in compatible with simulator. Applicable
17566 to ELF compiler only.
17570 Choose integer type as 32-bit wide.
17574 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17576 @item -mdata-model=@var{model}
17577 @opindex mdata-model
17578 Choose a data model. The choices for @var{model} are @samp{near},
17579 @samp{far} or @samp{medium}. @samp{medium} is default.
17580 However, @samp{far} is not valid with @option{-mcr16c}, as the
17581 CR16C architecture does not support the far data model.
17584 @node Darwin Options
17585 @subsection Darwin Options
17586 @cindex Darwin options
17588 These options are defined for all architectures running the Darwin operating
17591 FSF GCC on Darwin does not create ``fat'' object files; it creates
17592 an object file for the single architecture that GCC was built to
17593 target. Apple's GCC on Darwin does create ``fat'' files if multiple
17594 @option{-arch} options are used; it does so by running the compiler or
17595 linker multiple times and joining the results together with
17598 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17599 @samp{i686}) is determined by the flags that specify the ISA
17600 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17601 @option{-force_cpusubtype_ALL} option can be used to override this.
17603 The Darwin tools vary in their behavior when presented with an ISA
17604 mismatch. The assembler, @file{as}, only permits instructions to
17605 be used that are valid for the subtype of the file it is generating,
17606 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17607 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17608 and prints an error if asked to create a shared library with a less
17609 restrictive subtype than its input files (for instance, trying to put
17610 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17611 for executables, @command{ld}, quietly gives the executable the most
17612 restrictive subtype of any of its input files.
17617 Add the framework directory @var{dir} to the head of the list of
17618 directories to be searched for header files. These directories are
17619 interleaved with those specified by @option{-I} options and are
17620 scanned in a left-to-right order.
17622 A framework directory is a directory with frameworks in it. A
17623 framework is a directory with a @file{Headers} and/or
17624 @file{PrivateHeaders} directory contained directly in it that ends
17625 in @file{.framework}. The name of a framework is the name of this
17626 directory excluding the @file{.framework}. Headers associated with
17627 the framework are found in one of those two directories, with
17628 @file{Headers} being searched first. A subframework is a framework
17629 directory that is in a framework's @file{Frameworks} directory.
17630 Includes of subframework headers can only appear in a header of a
17631 framework that contains the subframework, or in a sibling subframework
17632 header. Two subframeworks are siblings if they occur in the same
17633 framework. A subframework should not have the same name as a
17634 framework; a warning is issued if this is violated. Currently a
17635 subframework cannot have subframeworks; in the future, the mechanism
17636 may be extended to support this. The standard frameworks can be found
17637 in @file{/System/Library/Frameworks} and
17638 @file{/Library/Frameworks}. An example include looks like
17639 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17640 the name of the framework and @file{header.h} is found in the
17641 @file{PrivateHeaders} or @file{Headers} directory.
17643 @item -iframework@var{dir}
17644 @opindex iframework
17645 Like @option{-F} except the directory is a treated as a system
17646 directory. The main difference between this @option{-iframework} and
17647 @option{-F} is that with @option{-iframework} the compiler does not
17648 warn about constructs contained within header files found via
17649 @var{dir}. This option is valid only for the C family of languages.
17653 Emit debugging information for symbols that are used. For stabs
17654 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17655 This is by default ON@.
17659 Emit debugging information for all symbols and types.
17661 @item -mmacosx-version-min=@var{version}
17662 The earliest version of MacOS X that this executable will run on
17663 is @var{version}. Typical values of @var{version} include @code{10.1},
17664 @code{10.2}, and @code{10.3.9}.
17666 If the compiler was built to use the system's headers by default,
17667 then the default for this option is the system version on which the
17668 compiler is running, otherwise the default is to make choices that
17669 are compatible with as many systems and code bases as possible.
17673 Enable kernel development mode. The @option{-mkernel} option sets
17674 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17675 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17676 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17677 applicable. This mode also sets @option{-mno-altivec},
17678 @option{-msoft-float}, @option{-fno-builtin} and
17679 @option{-mlong-branch} for PowerPC targets.
17681 @item -mone-byte-bool
17682 @opindex mone-byte-bool
17683 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17684 By default @code{sizeof(bool)} is @code{4} when compiling for
17685 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17686 option has no effect on x86.
17688 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17689 to generate code that is not binary compatible with code generated
17690 without that switch. Using this switch may require recompiling all
17691 other modules in a program, including system libraries. Use this
17692 switch to conform to a non-default data model.
17694 @item -mfix-and-continue
17695 @itemx -ffix-and-continue
17696 @itemx -findirect-data
17697 @opindex mfix-and-continue
17698 @opindex ffix-and-continue
17699 @opindex findirect-data
17700 Generate code suitable for fast turnaround development, such as to
17701 allow GDB to dynamically load @file{.o} files into already-running
17702 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17703 are provided for backwards compatibility.
17707 Loads all members of static archive libraries.
17708 See man ld(1) for more information.
17710 @item -arch_errors_fatal
17711 @opindex arch_errors_fatal
17712 Cause the errors having to do with files that have the wrong architecture
17715 @item -bind_at_load
17716 @opindex bind_at_load
17717 Causes the output file to be marked such that the dynamic linker will
17718 bind all undefined references when the file is loaded or launched.
17722 Produce a Mach-o bundle format file.
17723 See man ld(1) for more information.
17725 @item -bundle_loader @var{executable}
17726 @opindex bundle_loader
17727 This option specifies the @var{executable} that will load the build
17728 output file being linked. See man ld(1) for more information.
17731 @opindex dynamiclib
17732 When passed this option, GCC produces a dynamic library instead of
17733 an executable when linking, using the Darwin @file{libtool} command.
17735 @item -force_cpusubtype_ALL
17736 @opindex force_cpusubtype_ALL
17737 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17738 one controlled by the @option{-mcpu} or @option{-march} option.
17740 @item -allowable_client @var{client_name}
17741 @itemx -client_name
17742 @itemx -compatibility_version
17743 @itemx -current_version
17745 @itemx -dependency-file
17747 @itemx -dylinker_install_name
17749 @itemx -exported_symbols_list
17752 @itemx -flat_namespace
17753 @itemx -force_flat_namespace
17754 @itemx -headerpad_max_install_names
17757 @itemx -install_name
17758 @itemx -keep_private_externs
17759 @itemx -multi_module
17760 @itemx -multiply_defined
17761 @itemx -multiply_defined_unused
17764 @itemx -no_dead_strip_inits_and_terms
17765 @itemx -nofixprebinding
17766 @itemx -nomultidefs
17768 @itemx -noseglinkedit
17769 @itemx -pagezero_size
17771 @itemx -prebind_all_twolevel_modules
17772 @itemx -private_bundle
17774 @itemx -read_only_relocs
17776 @itemx -sectobjectsymbols
17780 @itemx -sectobjectsymbols
17783 @itemx -segs_read_only_addr
17785 @itemx -segs_read_write_addr
17786 @itemx -seg_addr_table
17787 @itemx -seg_addr_table_filename
17788 @itemx -seglinkedit
17790 @itemx -segs_read_only_addr
17791 @itemx -segs_read_write_addr
17792 @itemx -single_module
17794 @itemx -sub_library
17796 @itemx -sub_umbrella
17797 @itemx -twolevel_namespace
17800 @itemx -unexported_symbols_list
17801 @itemx -weak_reference_mismatches
17802 @itemx -whatsloaded
17803 @opindex allowable_client
17804 @opindex client_name
17805 @opindex compatibility_version
17806 @opindex current_version
17807 @opindex dead_strip
17808 @opindex dependency-file
17809 @opindex dylib_file
17810 @opindex dylinker_install_name
17812 @opindex exported_symbols_list
17814 @opindex flat_namespace
17815 @opindex force_flat_namespace
17816 @opindex headerpad_max_install_names
17817 @opindex image_base
17819 @opindex install_name
17820 @opindex keep_private_externs
17821 @opindex multi_module
17822 @opindex multiply_defined
17823 @opindex multiply_defined_unused
17824 @opindex noall_load
17825 @opindex no_dead_strip_inits_and_terms
17826 @opindex nofixprebinding
17827 @opindex nomultidefs
17829 @opindex noseglinkedit
17830 @opindex pagezero_size
17832 @opindex prebind_all_twolevel_modules
17833 @opindex private_bundle
17834 @opindex read_only_relocs
17836 @opindex sectobjectsymbols
17839 @opindex sectcreate
17840 @opindex sectobjectsymbols
17843 @opindex segs_read_only_addr
17844 @opindex segs_read_write_addr
17845 @opindex seg_addr_table
17846 @opindex seg_addr_table_filename
17847 @opindex seglinkedit
17849 @opindex segs_read_only_addr
17850 @opindex segs_read_write_addr
17851 @opindex single_module
17853 @opindex sub_library
17854 @opindex sub_umbrella
17855 @opindex twolevel_namespace
17858 @opindex unexported_symbols_list
17859 @opindex weak_reference_mismatches
17860 @opindex whatsloaded
17861 These options are passed to the Darwin linker. The Darwin linker man page
17862 describes them in detail.
17865 @node DEC Alpha Options
17866 @subsection DEC Alpha Options
17868 These @samp{-m} options are defined for the DEC Alpha implementations:
17871 @item -mno-soft-float
17872 @itemx -msoft-float
17873 @opindex mno-soft-float
17874 @opindex msoft-float
17875 Use (do not use) the hardware floating-point instructions for
17876 floating-point operations. When @option{-msoft-float} is specified,
17877 functions in @file{libgcc.a} are used to perform floating-point
17878 operations. Unless they are replaced by routines that emulate the
17879 floating-point operations, or compiled in such a way as to call such
17880 emulations routines, these routines issue floating-point
17881 operations. If you are compiling for an Alpha without floating-point
17882 operations, you must ensure that the library is built so as not to call
17885 Note that Alpha implementations without floating-point operations are
17886 required to have floating-point registers.
17889 @itemx -mno-fp-regs
17891 @opindex mno-fp-regs
17892 Generate code that uses (does not use) the floating-point register set.
17893 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
17894 register set is not used, floating-point operands are passed in integer
17895 registers as if they were integers and floating-point results are passed
17896 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
17897 so any function with a floating-point argument or return value called by code
17898 compiled with @option{-mno-fp-regs} must also be compiled with that
17901 A typical use of this option is building a kernel that does not use,
17902 and hence need not save and restore, any floating-point registers.
17906 The Alpha architecture implements floating-point hardware optimized for
17907 maximum performance. It is mostly compliant with the IEEE floating-point
17908 standard. However, for full compliance, software assistance is
17909 required. This option generates code fully IEEE-compliant code
17910 @emph{except} that the @var{inexact-flag} is not maintained (see below).
17911 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
17912 defined during compilation. The resulting code is less efficient but is
17913 able to correctly support denormalized numbers and exceptional IEEE
17914 values such as not-a-number and plus/minus infinity. Other Alpha
17915 compilers call this option @option{-ieee_with_no_inexact}.
17917 @item -mieee-with-inexact
17918 @opindex mieee-with-inexact
17919 This is like @option{-mieee} except the generated code also maintains
17920 the IEEE @var{inexact-flag}. Turning on this option causes the
17921 generated code to implement fully-compliant IEEE math. In addition to
17922 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
17923 macro. On some Alpha implementations the resulting code may execute
17924 significantly slower than the code generated by default. Since there is
17925 very little code that depends on the @var{inexact-flag}, you should
17926 normally not specify this option. Other Alpha compilers call this
17927 option @option{-ieee_with_inexact}.
17929 @item -mfp-trap-mode=@var{trap-mode}
17930 @opindex mfp-trap-mode
17931 This option controls what floating-point related traps are enabled.
17932 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
17933 The trap mode can be set to one of four values:
17937 This is the default (normal) setting. The only traps that are enabled
17938 are the ones that cannot be disabled in software (e.g., division by zero
17942 In addition to the traps enabled by @samp{n}, underflow traps are enabled
17946 Like @samp{u}, but the instructions are marked to be safe for software
17947 completion (see Alpha architecture manual for details).
17950 Like @samp{su}, but inexact traps are enabled as well.
17953 @item -mfp-rounding-mode=@var{rounding-mode}
17954 @opindex mfp-rounding-mode
17955 Selects the IEEE rounding mode. Other Alpha compilers call this option
17956 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
17961 Normal IEEE rounding mode. Floating-point numbers are rounded towards
17962 the nearest machine number or towards the even machine number in case
17966 Round towards minus infinity.
17969 Chopped rounding mode. Floating-point numbers are rounded towards zero.
17972 Dynamic rounding mode. A field in the floating-point control register
17973 (@var{fpcr}, see Alpha architecture reference manual) controls the
17974 rounding mode in effect. The C library initializes this register for
17975 rounding towards plus infinity. Thus, unless your program modifies the
17976 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
17979 @item -mtrap-precision=@var{trap-precision}
17980 @opindex mtrap-precision
17981 In the Alpha architecture, floating-point traps are imprecise. This
17982 means without software assistance it is impossible to recover from a
17983 floating trap and program execution normally needs to be terminated.
17984 GCC can generate code that can assist operating system trap handlers
17985 in determining the exact location that caused a floating-point trap.
17986 Depending on the requirements of an application, different levels of
17987 precisions can be selected:
17991 Program precision. This option is the default and means a trap handler
17992 can only identify which program caused a floating-point exception.
17995 Function precision. The trap handler can determine the function that
17996 caused a floating-point exception.
17999 Instruction precision. The trap handler can determine the exact
18000 instruction that caused a floating-point exception.
18003 Other Alpha compilers provide the equivalent options called
18004 @option{-scope_safe} and @option{-resumption_safe}.
18006 @item -mieee-conformant
18007 @opindex mieee-conformant
18008 This option marks the generated code as IEEE conformant. You must not
18009 use this option unless you also specify @option{-mtrap-precision=i} and either
18010 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18011 is to emit the line @samp{.eflag 48} in the function prologue of the
18012 generated assembly file.
18014 @item -mbuild-constants
18015 @opindex mbuild-constants
18016 Normally GCC examines a 32- or 64-bit integer constant to
18017 see if it can construct it from smaller constants in two or three
18018 instructions. If it cannot, it outputs the constant as a literal and
18019 generates code to load it from the data segment at run time.
18021 Use this option to require GCC to construct @emph{all} integer constants
18022 using code, even if it takes more instructions (the maximum is six).
18024 You typically use this option to build a shared library dynamic
18025 loader. Itself a shared library, it must relocate itself in memory
18026 before it can find the variables and constants in its own data segment.
18044 Indicate whether GCC should generate code to use the optional BWX,
18045 CIX, FIX and MAX instruction sets. The default is to use the instruction
18046 sets supported by the CPU type specified via @option{-mcpu=} option or that
18047 of the CPU on which GCC was built if none is specified.
18050 @itemx -mfloat-ieee
18051 @opindex mfloat-vax
18052 @opindex mfloat-ieee
18053 Generate code that uses (does not use) VAX F and G floating-point
18054 arithmetic instead of IEEE single and double precision.
18056 @item -mexplicit-relocs
18057 @itemx -mno-explicit-relocs
18058 @opindex mexplicit-relocs
18059 @opindex mno-explicit-relocs
18060 Older Alpha assemblers provided no way to generate symbol relocations
18061 except via assembler macros. Use of these macros does not allow
18062 optimal instruction scheduling. GNU binutils as of version 2.12
18063 supports a new syntax that allows the compiler to explicitly mark
18064 which relocations should apply to which instructions. This option
18065 is mostly useful for debugging, as GCC detects the capabilities of
18066 the assembler when it is built and sets the default accordingly.
18069 @itemx -mlarge-data
18070 @opindex msmall-data
18071 @opindex mlarge-data
18072 When @option{-mexplicit-relocs} is in effect, static data is
18073 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18074 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18075 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18076 16-bit relocations off of the @code{$gp} register. This limits the
18077 size of the small data area to 64KB, but allows the variables to be
18078 directly accessed via a single instruction.
18080 The default is @option{-mlarge-data}. With this option the data area
18081 is limited to just below 2GB@. Programs that require more than 2GB of
18082 data must use @code{malloc} or @code{mmap} to allocate the data in the
18083 heap instead of in the program's data segment.
18085 When generating code for shared libraries, @option{-fpic} implies
18086 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18089 @itemx -mlarge-text
18090 @opindex msmall-text
18091 @opindex mlarge-text
18092 When @option{-msmall-text} is used, the compiler assumes that the
18093 code of the entire program (or shared library) fits in 4MB, and is
18094 thus reachable with a branch instruction. When @option{-msmall-data}
18095 is used, the compiler can assume that all local symbols share the
18096 same @code{$gp} value, and thus reduce the number of instructions
18097 required for a function call from 4 to 1.
18099 The default is @option{-mlarge-text}.
18101 @item -mcpu=@var{cpu_type}
18103 Set the instruction set and instruction scheduling parameters for
18104 machine type @var{cpu_type}. You can specify either the @samp{EV}
18105 style name or the corresponding chip number. GCC supports scheduling
18106 parameters for the EV4, EV5 and EV6 family of processors and
18107 chooses the default values for the instruction set from the processor
18108 you specify. If you do not specify a processor type, GCC defaults
18109 to the processor on which the compiler was built.
18111 Supported values for @var{cpu_type} are
18117 Schedules as an EV4 and has no instruction set extensions.
18121 Schedules as an EV5 and has no instruction set extensions.
18125 Schedules as an EV5 and supports the BWX extension.
18130 Schedules as an EV5 and supports the BWX and MAX extensions.
18134 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18138 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18141 Native toolchains also support the value @samp{native},
18142 which selects the best architecture option for the host processor.
18143 @option{-mcpu=native} has no effect if GCC does not recognize
18146 @item -mtune=@var{cpu_type}
18148 Set only the instruction scheduling parameters for machine type
18149 @var{cpu_type}. The instruction set is not changed.
18151 Native toolchains also support the value @samp{native},
18152 which selects the best architecture option for the host processor.
18153 @option{-mtune=native} has no effect if GCC does not recognize
18156 @item -mmemory-latency=@var{time}
18157 @opindex mmemory-latency
18158 Sets the latency the scheduler should assume for typical memory
18159 references as seen by the application. This number is highly
18160 dependent on the memory access patterns used by the application
18161 and the size of the external cache on the machine.
18163 Valid options for @var{time} are
18167 A decimal number representing clock cycles.
18173 The compiler contains estimates of the number of clock cycles for
18174 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18175 (also called Dcache, Scache, and Bcache), as well as to main memory.
18176 Note that L3 is only valid for EV5.
18182 @subsection FR30 Options
18183 @cindex FR30 Options
18185 These options are defined specifically for the FR30 port.
18189 @item -msmall-model
18190 @opindex msmall-model
18191 Use the small address space model. This can produce smaller code, but
18192 it does assume that all symbolic values and addresses fit into a
18197 Assume that runtime support has been provided and so there is no need
18198 to include the simulator library (@file{libsim.a}) on the linker
18204 @subsection FT32 Options
18205 @cindex FT32 Options
18207 These options are defined specifically for the FT32 port.
18213 Specifies that the program will be run on the simulator. This causes
18214 an alternate runtime startup and library to be linked.
18215 You must not use this option when generating programs that will run on
18216 real hardware; you must provide your own runtime library for whatever
18217 I/O functions are needed.
18221 Enable Local Register Allocation. This is still experimental for FT32,
18222 so by default the compiler uses standard reload.
18226 Do not use div and mod instructions.
18230 Enable use of the extended instructions of the FT32B processor.
18234 Compress all code using the Ft32B code compression scheme.
18238 Do not generate code that reads program memory.
18243 @subsection FRV Options
18244 @cindex FRV Options
18250 Only use the first 32 general-purpose registers.
18255 Use all 64 general-purpose registers.
18260 Use only the first 32 floating-point registers.
18265 Use all 64 floating-point registers.
18268 @opindex mhard-float
18270 Use hardware instructions for floating-point operations.
18273 @opindex msoft-float
18275 Use library routines for floating-point operations.
18280 Dynamically allocate condition code registers.
18285 Do not try to dynamically allocate condition code registers, only
18286 use @code{icc0} and @code{fcc0}.
18291 Change ABI to use double word insns.
18296 Do not use double word instructions.
18301 Use floating-point double instructions.
18304 @opindex mno-double
18306 Do not use floating-point double instructions.
18311 Use media instructions.
18316 Do not use media instructions.
18321 Use multiply and add/subtract instructions.
18324 @opindex mno-muladd
18326 Do not use multiply and add/subtract instructions.
18331 Select the FDPIC ABI, which uses function descriptors to represent
18332 pointers to functions. Without any PIC/PIE-related options, it
18333 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18334 assumes GOT entries and small data are within a 12-bit range from the
18335 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18336 are computed with 32 bits.
18337 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18340 @opindex minline-plt
18342 Enable inlining of PLT entries in function calls to functions that are
18343 not known to bind locally. It has no effect without @option{-mfdpic}.
18344 It's enabled by default if optimizing for speed and compiling for
18345 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18346 optimization option such as @option{-O3} or above is present in the
18352 Assume a large TLS segment when generating thread-local code.
18357 Do not assume a large TLS segment when generating thread-local code.
18362 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18363 that is known to be in read-only sections. It's enabled by default,
18364 except for @option{-fpic} or @option{-fpie}: even though it may help
18365 make the global offset table smaller, it trades 1 instruction for 4.
18366 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18367 one of which may be shared by multiple symbols, and it avoids the need
18368 for a GOT entry for the referenced symbol, so it's more likely to be a
18369 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18371 @item -multilib-library-pic
18372 @opindex multilib-library-pic
18374 Link with the (library, not FD) pic libraries. It's implied by
18375 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18376 @option{-fpic} without @option{-mfdpic}. You should never have to use
18380 @opindex mlinked-fp
18382 Follow the EABI requirement of always creating a frame pointer whenever
18383 a stack frame is allocated. This option is enabled by default and can
18384 be disabled with @option{-mno-linked-fp}.
18387 @opindex mlong-calls
18389 Use indirect addressing to call functions outside the current
18390 compilation unit. This allows the functions to be placed anywhere
18391 within the 32-bit address space.
18393 @item -malign-labels
18394 @opindex malign-labels
18396 Try to align labels to an 8-byte boundary by inserting NOPs into the
18397 previous packet. This option only has an effect when VLIW packing
18398 is enabled. It doesn't create new packets; it merely adds NOPs to
18401 @item -mlibrary-pic
18402 @opindex mlibrary-pic
18404 Generate position-independent EABI code.
18409 Use only the first four media accumulator registers.
18414 Use all eight media accumulator registers.
18419 Pack VLIW instructions.
18424 Do not pack VLIW instructions.
18427 @opindex mno-eflags
18429 Do not mark ABI switches in e_flags.
18432 @opindex mcond-move
18434 Enable the use of conditional-move instructions (default).
18436 This switch is mainly for debugging the compiler and will likely be removed
18437 in a future version.
18439 @item -mno-cond-move
18440 @opindex mno-cond-move
18442 Disable the use of conditional-move instructions.
18444 This switch is mainly for debugging the compiler and will likely be removed
18445 in a future version.
18450 Enable the use of conditional set instructions (default).
18452 This switch is mainly for debugging the compiler and will likely be removed
18453 in a future version.
18458 Disable the use of conditional set instructions.
18460 This switch is mainly for debugging the compiler and will likely be removed
18461 in a future version.
18464 @opindex mcond-exec
18466 Enable the use of conditional execution (default).
18468 This switch is mainly for debugging the compiler and will likely be removed
18469 in a future version.
18471 @item -mno-cond-exec
18472 @opindex mno-cond-exec
18474 Disable the use of conditional execution.
18476 This switch is mainly for debugging the compiler and will likely be removed
18477 in a future version.
18479 @item -mvliw-branch
18480 @opindex mvliw-branch
18482 Run a pass to pack branches into VLIW instructions (default).
18484 This switch is mainly for debugging the compiler and will likely be removed
18485 in a future version.
18487 @item -mno-vliw-branch
18488 @opindex mno-vliw-branch
18490 Do not run a pass to pack branches into VLIW instructions.
18492 This switch is mainly for debugging the compiler and will likely be removed
18493 in a future version.
18495 @item -mmulti-cond-exec
18496 @opindex mmulti-cond-exec
18498 Enable optimization of @code{&&} and @code{||} in conditional execution
18501 This switch is mainly for debugging the compiler and will likely be removed
18502 in a future version.
18504 @item -mno-multi-cond-exec
18505 @opindex mno-multi-cond-exec
18507 Disable optimization of @code{&&} and @code{||} in conditional execution.
18509 This switch is mainly for debugging the compiler and will likely be removed
18510 in a future version.
18512 @item -mnested-cond-exec
18513 @opindex mnested-cond-exec
18515 Enable nested conditional execution optimizations (default).
18517 This switch is mainly for debugging the compiler and will likely be removed
18518 in a future version.
18520 @item -mno-nested-cond-exec
18521 @opindex mno-nested-cond-exec
18523 Disable nested conditional execution optimizations.
18525 This switch is mainly for debugging the compiler and will likely be removed
18526 in a future version.
18528 @item -moptimize-membar
18529 @opindex moptimize-membar
18531 This switch removes redundant @code{membar} instructions from the
18532 compiler-generated code. It is enabled by default.
18534 @item -mno-optimize-membar
18535 @opindex mno-optimize-membar
18537 This switch disables the automatic removal of redundant @code{membar}
18538 instructions from the generated code.
18540 @item -mtomcat-stats
18541 @opindex mtomcat-stats
18543 Cause gas to print out tomcat statistics.
18545 @item -mcpu=@var{cpu}
18548 Select the processor type for which to generate code. Possible values are
18549 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
18550 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
18554 @node GNU/Linux Options
18555 @subsection GNU/Linux Options
18557 These @samp{-m} options are defined for GNU/Linux targets:
18562 Use the GNU C library. This is the default except
18563 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
18564 @samp{*-*-linux-*android*} targets.
18568 Use uClibc C library. This is the default on
18569 @samp{*-*-linux-*uclibc*} targets.
18573 Use the musl C library. This is the default on
18574 @samp{*-*-linux-*musl*} targets.
18578 Use Bionic C library. This is the default on
18579 @samp{*-*-linux-*android*} targets.
18583 Compile code compatible with Android platform. This is the default on
18584 @samp{*-*-linux-*android*} targets.
18586 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
18587 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
18588 this option makes the GCC driver pass Android-specific options to the linker.
18589 Finally, this option causes the preprocessor macro @code{__ANDROID__}
18592 @item -tno-android-cc
18593 @opindex tno-android-cc
18594 Disable compilation effects of @option{-mandroid}, i.e., do not enable
18595 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
18596 @option{-fno-rtti} by default.
18598 @item -tno-android-ld
18599 @opindex tno-android-ld
18600 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
18601 linking options to the linker.
18605 @node H8/300 Options
18606 @subsection H8/300 Options
18608 These @samp{-m} options are defined for the H8/300 implementations:
18613 Shorten some address references at link time, when possible; uses the
18614 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18615 ld, Using ld}, for a fuller description.
18619 Generate code for the H8/300H@.
18623 Generate code for the H8S@.
18627 Generate code for the H8S and H8/300H in the normal mode. This switch
18628 must be used either with @option{-mh} or @option{-ms}.
18632 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18636 Extended registers are stored on stack before execution of function
18637 with monitor attribute. Default option is @option{-mexr}.
18638 This option is valid only for H8S targets.
18642 Extended registers are not stored on stack before execution of function
18643 with monitor attribute. Default option is @option{-mno-exr}.
18644 This option is valid only for H8S targets.
18648 Make @code{int} data 32 bits by default.
18651 @opindex malign-300
18652 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18653 The default for the H8/300H and H8S is to align longs and floats on
18655 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18656 This option has no effect on the H8/300.
18660 @subsection HPPA Options
18661 @cindex HPPA Options
18663 These @samp{-m} options are defined for the HPPA family of computers:
18666 @item -march=@var{architecture-type}
18668 Generate code for the specified architecture. The choices for
18669 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18670 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18671 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18672 architecture option for your machine. Code compiled for lower numbered
18673 architectures runs on higher numbered architectures, but not the
18676 @item -mpa-risc-1-0
18677 @itemx -mpa-risc-1-1
18678 @itemx -mpa-risc-2-0
18679 @opindex mpa-risc-1-0
18680 @opindex mpa-risc-1-1
18681 @opindex mpa-risc-2-0
18682 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18684 @item -mcaller-copies
18685 @opindex mcaller-copies
18686 The caller copies function arguments passed by hidden reference. This
18687 option should be used with care as it is not compatible with the default
18688 32-bit runtime. However, only aggregates larger than eight bytes are
18689 passed by hidden reference and the option provides better compatibility
18692 @item -mjump-in-delay
18693 @opindex mjump-in-delay
18694 This option is ignored and provided for compatibility purposes only.
18696 @item -mdisable-fpregs
18697 @opindex mdisable-fpregs
18698 Prevent floating-point registers from being used in any manner. This is
18699 necessary for compiling kernels that perform lazy context switching of
18700 floating-point registers. If you use this option and attempt to perform
18701 floating-point operations, the compiler aborts.
18703 @item -mdisable-indexing
18704 @opindex mdisable-indexing
18705 Prevent the compiler from using indexing address modes. This avoids some
18706 rather obscure problems when compiling MIG generated code under MACH@.
18708 @item -mno-space-regs
18709 @opindex mno-space-regs
18710 Generate code that assumes the target has no space registers. This allows
18711 GCC to generate faster indirect calls and use unscaled index address modes.
18713 Such code is suitable for level 0 PA systems and kernels.
18715 @item -mfast-indirect-calls
18716 @opindex mfast-indirect-calls
18717 Generate code that assumes calls never cross space boundaries. This
18718 allows GCC to emit code that performs faster indirect calls.
18720 This option does not work in the presence of shared libraries or nested
18723 @item -mfixed-range=@var{register-range}
18724 @opindex mfixed-range
18725 Generate code treating the given register range as fixed registers.
18726 A fixed register is one that the register allocator cannot use. This is
18727 useful when compiling kernel code. A register range is specified as
18728 two registers separated by a dash. Multiple register ranges can be
18729 specified separated by a comma.
18731 @item -mlong-load-store
18732 @opindex mlong-load-store
18733 Generate 3-instruction load and store sequences as sometimes required by
18734 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18737 @item -mportable-runtime
18738 @opindex mportable-runtime
18739 Use the portable calling conventions proposed by HP for ELF systems.
18743 Enable the use of assembler directives only GAS understands.
18745 @item -mschedule=@var{cpu-type}
18747 Schedule code according to the constraints for the machine type
18748 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18749 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18750 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18751 proper scheduling option for your machine. The default scheduling is
18755 @opindex mlinker-opt
18756 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18757 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18758 linkers in which they give bogus error messages when linking some programs.
18761 @opindex msoft-float
18762 Generate output containing library calls for floating point.
18763 @strong{Warning:} the requisite libraries are not available for all HPPA
18764 targets. Normally the facilities of the machine's usual C compiler are
18765 used, but this cannot be done directly in cross-compilation. You must make
18766 your own arrangements to provide suitable library functions for
18769 @option{-msoft-float} changes the calling convention in the output file;
18770 therefore, it is only useful if you compile @emph{all} of a program with
18771 this option. In particular, you need to compile @file{libgcc.a}, the
18772 library that comes with GCC, with @option{-msoft-float} in order for
18777 Generate the predefine, @code{_SIO}, for server IO@. The default is
18778 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18779 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18780 options are available under HP-UX and HI-UX@.
18784 Use options specific to GNU @command{ld}.
18785 This passes @option{-shared} to @command{ld} when
18786 building a shared library. It is the default when GCC is configured,
18787 explicitly or implicitly, with the GNU linker. This option does not
18788 affect which @command{ld} is called; it only changes what parameters
18789 are passed to that @command{ld}.
18790 The @command{ld} that is called is determined by the
18791 @option{--with-ld} configure option, GCC's program search path, and
18792 finally by the user's @env{PATH}. The linker used by GCC can be printed
18793 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18794 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18798 Use options specific to HP @command{ld}.
18799 This passes @option{-b} to @command{ld} when building
18800 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18801 links. It is the default when GCC is configured, explicitly or
18802 implicitly, with the HP linker. This option does not affect
18803 which @command{ld} is called; it only changes what parameters are passed to that
18805 The @command{ld} that is called is determined by the @option{--with-ld}
18806 configure option, GCC's program search path, and finally by the user's
18807 @env{PATH}. The linker used by GCC can be printed using @samp{which
18808 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18809 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18812 @opindex mno-long-calls
18813 Generate code that uses long call sequences. This ensures that a call
18814 is always able to reach linker generated stubs. The default is to generate
18815 long calls only when the distance from the call site to the beginning
18816 of the function or translation unit, as the case may be, exceeds a
18817 predefined limit set by the branch type being used. The limits for
18818 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18819 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18822 Distances are measured from the beginning of functions when using the
18823 @option{-ffunction-sections} option, or when using the @option{-mgas}
18824 and @option{-mno-portable-runtime} options together under HP-UX with
18827 It is normally not desirable to use this option as it degrades
18828 performance. However, it may be useful in large applications,
18829 particularly when partial linking is used to build the application.
18831 The types of long calls used depends on the capabilities of the
18832 assembler and linker, and the type of code being generated. The
18833 impact on systems that support long absolute calls, and long pic
18834 symbol-difference or pc-relative calls should be relatively small.
18835 However, an indirect call is used on 32-bit ELF systems in pic code
18836 and it is quite long.
18838 @item -munix=@var{unix-std}
18840 Generate compiler predefines and select a startfile for the specified
18841 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18842 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18843 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18844 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18845 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18848 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18849 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18850 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18851 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18852 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18853 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18855 It is @emph{important} to note that this option changes the interfaces
18856 for various library routines. It also affects the operational behavior
18857 of the C library. Thus, @emph{extreme} care is needed in using this
18860 Library code that is intended to operate with more than one UNIX
18861 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18862 as appropriate. Most GNU software doesn't provide this capability.
18866 Suppress the generation of link options to search libdld.sl when the
18867 @option{-static} option is specified on HP-UX 10 and later.
18871 The HP-UX implementation of setlocale in libc has a dependency on
18872 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18873 when the @option{-static} option is specified, special link options
18874 are needed to resolve this dependency.
18876 On HP-UX 10 and later, the GCC driver adds the necessary options to
18877 link with libdld.sl when the @option{-static} option is specified.
18878 This causes the resulting binary to be dynamic. On the 64-bit port,
18879 the linkers generate dynamic binaries by default in any case. The
18880 @option{-nolibdld} option can be used to prevent the GCC driver from
18881 adding these link options.
18885 Add support for multithreading with the @dfn{dce thread} library
18886 under HP-UX@. This option sets flags for both the preprocessor and
18890 @node IA-64 Options
18891 @subsection IA-64 Options
18892 @cindex IA-64 Options
18894 These are the @samp{-m} options defined for the Intel IA-64 architecture.
18898 @opindex mbig-endian
18899 Generate code for a big-endian target. This is the default for HP-UX@.
18901 @item -mlittle-endian
18902 @opindex mlittle-endian
18903 Generate code for a little-endian target. This is the default for AIX5
18909 @opindex mno-gnu-as
18910 Generate (or don't) code for the GNU assembler. This is the default.
18911 @c Also, this is the default if the configure option @option{--with-gnu-as}
18917 @opindex mno-gnu-ld
18918 Generate (or don't) code for the GNU linker. This is the default.
18919 @c Also, this is the default if the configure option @option{--with-gnu-ld}
18924 Generate code that does not use a global pointer register. The result
18925 is not position independent code, and violates the IA-64 ABI@.
18927 @item -mvolatile-asm-stop
18928 @itemx -mno-volatile-asm-stop
18929 @opindex mvolatile-asm-stop
18930 @opindex mno-volatile-asm-stop
18931 Generate (or don't) a stop bit immediately before and after volatile asm
18934 @item -mregister-names
18935 @itemx -mno-register-names
18936 @opindex mregister-names
18937 @opindex mno-register-names
18938 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18939 the stacked registers. This may make assembler output more readable.
18945 Disable (or enable) optimizations that use the small data section. This may
18946 be useful for working around optimizer bugs.
18948 @item -mconstant-gp
18949 @opindex mconstant-gp
18950 Generate code that uses a single constant global pointer value. This is
18951 useful when compiling kernel code.
18955 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18956 This is useful when compiling firmware code.
18958 @item -minline-float-divide-min-latency
18959 @opindex minline-float-divide-min-latency
18960 Generate code for inline divides of floating-point values
18961 using the minimum latency algorithm.
18963 @item -minline-float-divide-max-throughput
18964 @opindex minline-float-divide-max-throughput
18965 Generate code for inline divides of floating-point values
18966 using the maximum throughput algorithm.
18968 @item -mno-inline-float-divide
18969 @opindex mno-inline-float-divide
18970 Do not generate inline code for divides of floating-point values.
18972 @item -minline-int-divide-min-latency
18973 @opindex minline-int-divide-min-latency
18974 Generate code for inline divides of integer values
18975 using the minimum latency algorithm.
18977 @item -minline-int-divide-max-throughput
18978 @opindex minline-int-divide-max-throughput
18979 Generate code for inline divides of integer values
18980 using the maximum throughput algorithm.
18982 @item -mno-inline-int-divide
18983 @opindex mno-inline-int-divide
18984 Do not generate inline code for divides of integer values.
18986 @item -minline-sqrt-min-latency
18987 @opindex minline-sqrt-min-latency
18988 Generate code for inline square roots
18989 using the minimum latency algorithm.
18991 @item -minline-sqrt-max-throughput
18992 @opindex minline-sqrt-max-throughput
18993 Generate code for inline square roots
18994 using the maximum throughput algorithm.
18996 @item -mno-inline-sqrt
18997 @opindex mno-inline-sqrt
18998 Do not generate inline code for @code{sqrt}.
19001 @itemx -mno-fused-madd
19002 @opindex mfused-madd
19003 @opindex mno-fused-madd
19004 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19005 instructions. The default is to use these instructions.
19007 @item -mno-dwarf2-asm
19008 @itemx -mdwarf2-asm
19009 @opindex mno-dwarf2-asm
19010 @opindex mdwarf2-asm
19011 Don't (or do) generate assembler code for the DWARF line number debugging
19012 info. This may be useful when not using the GNU assembler.
19014 @item -mearly-stop-bits
19015 @itemx -mno-early-stop-bits
19016 @opindex mearly-stop-bits
19017 @opindex mno-early-stop-bits
19018 Allow stop bits to be placed earlier than immediately preceding the
19019 instruction that triggered the stop bit. This can improve instruction
19020 scheduling, but does not always do so.
19022 @item -mfixed-range=@var{register-range}
19023 @opindex mfixed-range
19024 Generate code treating the given register range as fixed registers.
19025 A fixed register is one that the register allocator cannot use. This is
19026 useful when compiling kernel code. A register range is specified as
19027 two registers separated by a dash. Multiple register ranges can be
19028 specified separated by a comma.
19030 @item -mtls-size=@var{tls-size}
19032 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19035 @item -mtune=@var{cpu-type}
19037 Tune the instruction scheduling for a particular CPU, Valid values are
19038 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19039 and @samp{mckinley}.
19045 Generate code for a 32-bit or 64-bit environment.
19046 The 32-bit environment sets int, long and pointer to 32 bits.
19047 The 64-bit environment sets int to 32 bits and long and pointer
19048 to 64 bits. These are HP-UX specific flags.
19050 @item -mno-sched-br-data-spec
19051 @itemx -msched-br-data-spec
19052 @opindex mno-sched-br-data-spec
19053 @opindex msched-br-data-spec
19054 (Dis/En)able data speculative scheduling before reload.
19055 This results in generation of @code{ld.a} instructions and
19056 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19057 The default setting is disabled.
19059 @item -msched-ar-data-spec
19060 @itemx -mno-sched-ar-data-spec
19061 @opindex msched-ar-data-spec
19062 @opindex mno-sched-ar-data-spec
19063 (En/Dis)able data speculative scheduling after reload.
19064 This results in generation of @code{ld.a} instructions and
19065 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19066 The default setting is enabled.
19068 @item -mno-sched-control-spec
19069 @itemx -msched-control-spec
19070 @opindex mno-sched-control-spec
19071 @opindex msched-control-spec
19072 (Dis/En)able control speculative scheduling. This feature is
19073 available only during region scheduling (i.e.@: before reload).
19074 This results in generation of the @code{ld.s} instructions and
19075 the corresponding check instructions @code{chk.s}.
19076 The default setting is disabled.
19078 @item -msched-br-in-data-spec
19079 @itemx -mno-sched-br-in-data-spec
19080 @opindex msched-br-in-data-spec
19081 @opindex mno-sched-br-in-data-spec
19082 (En/Dis)able speculative scheduling of the instructions that
19083 are dependent on the data speculative loads before reload.
19084 This is effective only with @option{-msched-br-data-spec} enabled.
19085 The default setting is enabled.
19087 @item -msched-ar-in-data-spec
19088 @itemx -mno-sched-ar-in-data-spec
19089 @opindex msched-ar-in-data-spec
19090 @opindex mno-sched-ar-in-data-spec
19091 (En/Dis)able speculative scheduling of the instructions that
19092 are dependent on the data speculative loads after reload.
19093 This is effective only with @option{-msched-ar-data-spec} enabled.
19094 The default setting is enabled.
19096 @item -msched-in-control-spec
19097 @itemx -mno-sched-in-control-spec
19098 @opindex msched-in-control-spec
19099 @opindex mno-sched-in-control-spec
19100 (En/Dis)able speculative scheduling of the instructions that
19101 are dependent on the control speculative loads.
19102 This is effective only with @option{-msched-control-spec} enabled.
19103 The default setting is enabled.
19105 @item -mno-sched-prefer-non-data-spec-insns
19106 @itemx -msched-prefer-non-data-spec-insns
19107 @opindex mno-sched-prefer-non-data-spec-insns
19108 @opindex msched-prefer-non-data-spec-insns
19109 If enabled, data-speculative instructions are chosen for schedule
19110 only if there are no other choices at the moment. This makes
19111 the use of the data speculation much more conservative.
19112 The default setting is disabled.
19114 @item -mno-sched-prefer-non-control-spec-insns
19115 @itemx -msched-prefer-non-control-spec-insns
19116 @opindex mno-sched-prefer-non-control-spec-insns
19117 @opindex msched-prefer-non-control-spec-insns
19118 If enabled, control-speculative instructions are chosen for schedule
19119 only if there are no other choices at the moment. This makes
19120 the use of the control speculation much more conservative.
19121 The default setting is disabled.
19123 @item -mno-sched-count-spec-in-critical-path
19124 @itemx -msched-count-spec-in-critical-path
19125 @opindex mno-sched-count-spec-in-critical-path
19126 @opindex msched-count-spec-in-critical-path
19127 If enabled, speculative dependencies are considered during
19128 computation of the instructions priorities. This makes the use of the
19129 speculation a bit more conservative.
19130 The default setting is disabled.
19132 @item -msched-spec-ldc
19133 @opindex msched-spec-ldc
19134 Use a simple data speculation check. This option is on by default.
19136 @item -msched-control-spec-ldc
19137 @opindex msched-spec-ldc
19138 Use a simple check for control speculation. This option is on by default.
19140 @item -msched-stop-bits-after-every-cycle
19141 @opindex msched-stop-bits-after-every-cycle
19142 Place a stop bit after every cycle when scheduling. This option is on
19145 @item -msched-fp-mem-deps-zero-cost
19146 @opindex msched-fp-mem-deps-zero-cost
19147 Assume that floating-point stores and loads are not likely to cause a conflict
19148 when placed into the same instruction group. This option is disabled by
19151 @item -msel-sched-dont-check-control-spec
19152 @opindex msel-sched-dont-check-control-spec
19153 Generate checks for control speculation in selective scheduling.
19154 This flag is disabled by default.
19156 @item -msched-max-memory-insns=@var{max-insns}
19157 @opindex msched-max-memory-insns
19158 Limit on the number of memory insns per instruction group, giving lower
19159 priority to subsequent memory insns attempting to schedule in the same
19160 instruction group. Frequently useful to prevent cache bank conflicts.
19161 The default value is 1.
19163 @item -msched-max-memory-insns-hard-limit
19164 @opindex msched-max-memory-insns-hard-limit
19165 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19166 disallowing more than that number in an instruction group.
19167 Otherwise, the limit is ``soft'', meaning that non-memory operations
19168 are preferred when the limit is reached, but memory operations may still
19174 @subsection LM32 Options
19175 @cindex LM32 options
19177 These @option{-m} options are defined for the LatticeMico32 architecture:
19180 @item -mbarrel-shift-enabled
19181 @opindex mbarrel-shift-enabled
19182 Enable barrel-shift instructions.
19184 @item -mdivide-enabled
19185 @opindex mdivide-enabled
19186 Enable divide and modulus instructions.
19188 @item -mmultiply-enabled
19189 @opindex multiply-enabled
19190 Enable multiply instructions.
19192 @item -msign-extend-enabled
19193 @opindex msign-extend-enabled
19194 Enable sign extend instructions.
19196 @item -muser-enabled
19197 @opindex muser-enabled
19198 Enable user-defined instructions.
19203 @subsection M32C Options
19204 @cindex M32C options
19207 @item -mcpu=@var{name}
19209 Select the CPU for which code is generated. @var{name} may be one of
19210 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19211 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19212 the M32C/80 series.
19216 Specifies that the program will be run on the simulator. This causes
19217 an alternate runtime library to be linked in which supports, for
19218 example, file I/O@. You must not use this option when generating
19219 programs that will run on real hardware; you must provide your own
19220 runtime library for whatever I/O functions are needed.
19222 @item -memregs=@var{number}
19224 Specifies the number of memory-based pseudo-registers GCC uses
19225 during code generation. These pseudo-registers are used like real
19226 registers, so there is a tradeoff between GCC's ability to fit the
19227 code into available registers, and the performance penalty of using
19228 memory instead of registers. Note that all modules in a program must
19229 be compiled with the same value for this option. Because of that, you
19230 must not use this option with GCC's default runtime libraries.
19234 @node M32R/D Options
19235 @subsection M32R/D Options
19236 @cindex M32R/D options
19238 These @option{-m} options are defined for Renesas M32R/D architectures:
19243 Generate code for the M32R/2@.
19247 Generate code for the M32R/X@.
19251 Generate code for the M32R@. This is the default.
19253 @item -mmodel=small
19254 @opindex mmodel=small
19255 Assume all objects live in the lower 16MB of memory (so that their addresses
19256 can be loaded with the @code{ld24} instruction), and assume all subroutines
19257 are reachable with the @code{bl} instruction.
19258 This is the default.
19260 The addressability of a particular object can be set with the
19261 @code{model} attribute.
19263 @item -mmodel=medium
19264 @opindex mmodel=medium
19265 Assume objects may be anywhere in the 32-bit address space (the compiler
19266 generates @code{seth/add3} instructions to load their addresses), and
19267 assume all subroutines are reachable with the @code{bl} instruction.
19269 @item -mmodel=large
19270 @opindex mmodel=large
19271 Assume objects may be anywhere in the 32-bit address space (the compiler
19272 generates @code{seth/add3} instructions to load their addresses), and
19273 assume subroutines may not be reachable with the @code{bl} instruction
19274 (the compiler generates the much slower @code{seth/add3/jl}
19275 instruction sequence).
19278 @opindex msdata=none
19279 Disable use of the small data area. Variables are put into
19280 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19281 @code{section} attribute has been specified).
19282 This is the default.
19284 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19285 Objects may be explicitly put in the small data area with the
19286 @code{section} attribute using one of these sections.
19288 @item -msdata=sdata
19289 @opindex msdata=sdata
19290 Put small global and static data in the small data area, but do not
19291 generate special code to reference them.
19294 @opindex msdata=use
19295 Put small global and static data in the small data area, and generate
19296 special instructions to reference them.
19300 @cindex smaller data references
19301 Put global and static objects less than or equal to @var{num} bytes
19302 into the small data or BSS sections instead of the normal data or BSS
19303 sections. The default value of @var{num} is 8.
19304 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19305 for this option to have any effect.
19307 All modules should be compiled with the same @option{-G @var{num}} value.
19308 Compiling with different values of @var{num} may or may not work; if it
19309 doesn't the linker gives an error message---incorrect code is not
19314 Makes the M32R-specific code in the compiler display some statistics
19315 that might help in debugging programs.
19317 @item -malign-loops
19318 @opindex malign-loops
19319 Align all loops to a 32-byte boundary.
19321 @item -mno-align-loops
19322 @opindex mno-align-loops
19323 Do not enforce a 32-byte alignment for loops. This is the default.
19325 @item -missue-rate=@var{number}
19326 @opindex missue-rate=@var{number}
19327 Issue @var{number} instructions per cycle. @var{number} can only be 1
19330 @item -mbranch-cost=@var{number}
19331 @opindex mbranch-cost=@var{number}
19332 @var{number} can only be 1 or 2. If it is 1 then branches are
19333 preferred over conditional code, if it is 2, then the opposite applies.
19335 @item -mflush-trap=@var{number}
19336 @opindex mflush-trap=@var{number}
19337 Specifies the trap number to use to flush the cache. The default is
19338 12. Valid numbers are between 0 and 15 inclusive.
19340 @item -mno-flush-trap
19341 @opindex mno-flush-trap
19342 Specifies that the cache cannot be flushed by using a trap.
19344 @item -mflush-func=@var{name}
19345 @opindex mflush-func=@var{name}
19346 Specifies the name of the operating system function to call to flush
19347 the cache. The default is @samp{_flush_cache}, but a function call
19348 is only used if a trap is not available.
19350 @item -mno-flush-func
19351 @opindex mno-flush-func
19352 Indicates that there is no OS function for flushing the cache.
19356 @node M680x0 Options
19357 @subsection M680x0 Options
19358 @cindex M680x0 options
19360 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19361 The default settings depend on which architecture was selected when
19362 the compiler was configured; the defaults for the most common choices
19366 @item -march=@var{arch}
19368 Generate code for a specific M680x0 or ColdFire instruction set
19369 architecture. Permissible values of @var{arch} for M680x0
19370 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19371 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19372 architectures are selected according to Freescale's ISA classification
19373 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19374 @samp{isab} and @samp{isac}.
19376 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19377 code for a ColdFire target. The @var{arch} in this macro is one of the
19378 @option{-march} arguments given above.
19380 When used together, @option{-march} and @option{-mtune} select code
19381 that runs on a family of similar processors but that is optimized
19382 for a particular microarchitecture.
19384 @item -mcpu=@var{cpu}
19386 Generate code for a specific M680x0 or ColdFire processor.
19387 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19388 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19389 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19390 below, which also classifies the CPUs into families:
19392 @multitable @columnfractions 0.20 0.80
19393 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19394 @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}
19395 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19396 @item @samp{5206e} @tab @samp{5206e}
19397 @item @samp{5208} @tab @samp{5207} @samp{5208}
19398 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19399 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19400 @item @samp{5216} @tab @samp{5214} @samp{5216}
19401 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19402 @item @samp{5225} @tab @samp{5224} @samp{5225}
19403 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19404 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19405 @item @samp{5249} @tab @samp{5249}
19406 @item @samp{5250} @tab @samp{5250}
19407 @item @samp{5271} @tab @samp{5270} @samp{5271}
19408 @item @samp{5272} @tab @samp{5272}
19409 @item @samp{5275} @tab @samp{5274} @samp{5275}
19410 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19411 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19412 @item @samp{5307} @tab @samp{5307}
19413 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19414 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19415 @item @samp{5407} @tab @samp{5407}
19416 @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}
19419 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19420 @var{arch} is compatible with @var{cpu}. Other combinations of
19421 @option{-mcpu} and @option{-march} are rejected.
19423 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19424 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19425 where the value of @var{family} is given by the table above.
19427 @item -mtune=@var{tune}
19429 Tune the code for a particular microarchitecture within the
19430 constraints set by @option{-march} and @option{-mcpu}.
19431 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19432 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19433 and @samp{cpu32}. The ColdFire microarchitectures
19434 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19436 You can also use @option{-mtune=68020-40} for code that needs
19437 to run relatively well on 68020, 68030 and 68040 targets.
19438 @option{-mtune=68020-60} is similar but includes 68060 targets
19439 as well. These two options select the same tuning decisions as
19440 @option{-m68020-40} and @option{-m68020-60} respectively.
19442 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19443 when tuning for 680x0 architecture @var{arch}. It also defines
19444 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19445 option is used. If GCC is tuning for a range of architectures,
19446 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19447 it defines the macros for every architecture in the range.
19449 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19450 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19451 of the arguments given above.
19457 Generate output for a 68000. This is the default
19458 when the compiler is configured for 68000-based systems.
19459 It is equivalent to @option{-march=68000}.
19461 Use this option for microcontrollers with a 68000 or EC000 core,
19462 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19466 Generate output for a 68010. This is the default
19467 when the compiler is configured for 68010-based systems.
19468 It is equivalent to @option{-march=68010}.
19474 Generate output for a 68020. This is the default
19475 when the compiler is configured for 68020-based systems.
19476 It is equivalent to @option{-march=68020}.
19480 Generate output for a 68030. This is the default when the compiler is
19481 configured for 68030-based systems. It is equivalent to
19482 @option{-march=68030}.
19486 Generate output for a 68040. This is the default when the compiler is
19487 configured for 68040-based systems. It is equivalent to
19488 @option{-march=68040}.
19490 This option inhibits the use of 68881/68882 instructions that have to be
19491 emulated by software on the 68040. Use this option if your 68040 does not
19492 have code to emulate those instructions.
19496 Generate output for a 68060. This is the default when the compiler is
19497 configured for 68060-based systems. It is equivalent to
19498 @option{-march=68060}.
19500 This option inhibits the use of 68020 and 68881/68882 instructions that
19501 have to be emulated by software on the 68060. Use this option if your 68060
19502 does not have code to emulate those instructions.
19506 Generate output for a CPU32. This is the default
19507 when the compiler is configured for CPU32-based systems.
19508 It is equivalent to @option{-march=cpu32}.
19510 Use this option for microcontrollers with a
19511 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
19512 68336, 68340, 68341, 68349 and 68360.
19516 Generate output for a 520X ColdFire CPU@. This is the default
19517 when the compiler is configured for 520X-based systems.
19518 It is equivalent to @option{-mcpu=5206}, and is now deprecated
19519 in favor of that option.
19521 Use this option for microcontroller with a 5200 core, including
19522 the MCF5202, MCF5203, MCF5204 and MCF5206.
19526 Generate output for a 5206e ColdFire CPU@. The option is now
19527 deprecated in favor of the equivalent @option{-mcpu=5206e}.
19531 Generate output for a member of the ColdFire 528X family.
19532 The option is now deprecated in favor of the equivalent
19533 @option{-mcpu=528x}.
19537 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
19538 in favor of the equivalent @option{-mcpu=5307}.
19542 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
19543 in favor of the equivalent @option{-mcpu=5407}.
19547 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
19548 This includes use of hardware floating-point instructions.
19549 The option is equivalent to @option{-mcpu=547x}, and is now
19550 deprecated in favor of that option.
19554 Generate output for a 68040, without using any of the new instructions.
19555 This results in code that can run relatively efficiently on either a
19556 68020/68881 or a 68030 or a 68040. The generated code does use the
19557 68881 instructions that are emulated on the 68040.
19559 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
19563 Generate output for a 68060, without using any of the new instructions.
19564 This results in code that can run relatively efficiently on either a
19565 68020/68881 or a 68030 or a 68040. The generated code does use the
19566 68881 instructions that are emulated on the 68060.
19568 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
19572 @opindex mhard-float
19574 Generate floating-point instructions. This is the default for 68020
19575 and above, and for ColdFire devices that have an FPU@. It defines the
19576 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
19577 on ColdFire targets.
19580 @opindex msoft-float
19581 Do not generate floating-point instructions; use library calls instead.
19582 This is the default for 68000, 68010, and 68832 targets. It is also
19583 the default for ColdFire devices that have no FPU.
19589 Generate (do not generate) ColdFire hardware divide and remainder
19590 instructions. If @option{-march} is used without @option{-mcpu},
19591 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
19592 architectures. Otherwise, the default is taken from the target CPU
19593 (either the default CPU, or the one specified by @option{-mcpu}). For
19594 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
19595 @option{-mcpu=5206e}.
19597 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
19601 Consider type @code{int} to be 16 bits wide, like @code{short int}.
19602 Additionally, parameters passed on the stack are also aligned to a
19603 16-bit boundary even on targets whose API mandates promotion to 32-bit.
19607 Do not consider type @code{int} to be 16 bits wide. This is the default.
19610 @itemx -mno-bitfield
19611 @opindex mnobitfield
19612 @opindex mno-bitfield
19613 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19614 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19618 Do use the bit-field instructions. The @option{-m68020} option implies
19619 @option{-mbitfield}. This is the default if you use a configuration
19620 designed for a 68020.
19624 Use a different function-calling convention, in which functions
19625 that take a fixed number of arguments return with the @code{rtd}
19626 instruction, which pops their arguments while returning. This
19627 saves one instruction in the caller since there is no need to pop
19628 the arguments there.
19630 This calling convention is incompatible with the one normally
19631 used on Unix, so you cannot use it if you need to call libraries
19632 compiled with the Unix compiler.
19634 Also, you must provide function prototypes for all functions that
19635 take variable numbers of arguments (including @code{printf});
19636 otherwise incorrect code is generated for calls to those
19639 In addition, seriously incorrect code results if you call a
19640 function with too many arguments. (Normally, extra arguments are
19641 harmlessly ignored.)
19643 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19644 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19648 Do not use the calling conventions selected by @option{-mrtd}.
19649 This is the default.
19652 @itemx -mno-align-int
19653 @opindex malign-int
19654 @opindex mno-align-int
19655 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19656 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19657 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19658 Aligning variables on 32-bit boundaries produces code that runs somewhat
19659 faster on processors with 32-bit busses at the expense of more memory.
19661 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19662 aligns structures containing the above types differently than
19663 most published application binary interface specifications for the m68k.
19667 Use the pc-relative addressing mode of the 68000 directly, instead of
19668 using a global offset table. At present, this option implies @option{-fpic},
19669 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19670 not presently supported with @option{-mpcrel}, though this could be supported for
19671 68020 and higher processors.
19673 @item -mno-strict-align
19674 @itemx -mstrict-align
19675 @opindex mno-strict-align
19676 @opindex mstrict-align
19677 Do not (do) assume that unaligned memory references are handled by
19681 Generate code that allows the data segment to be located in a different
19682 area of memory from the text segment. This allows for execute-in-place in
19683 an environment without virtual memory management. This option implies
19686 @item -mno-sep-data
19687 Generate code that assumes that the data segment follows the text segment.
19688 This is the default.
19690 @item -mid-shared-library
19691 Generate code that supports shared libraries via the library ID method.
19692 This allows for execute-in-place and shared libraries in an environment
19693 without virtual memory management. This option implies @option{-fPIC}.
19695 @item -mno-id-shared-library
19696 Generate code that doesn't assume ID-based shared libraries are being used.
19697 This is the default.
19699 @item -mshared-library-id=n
19700 Specifies the identification number of the ID-based shared library being
19701 compiled. Specifying a value of 0 generates more compact code; specifying
19702 other values forces the allocation of that number to the current
19703 library, but is no more space- or time-efficient than omitting this option.
19709 When generating position-independent code for ColdFire, generate code
19710 that works if the GOT has more than 8192 entries. This code is
19711 larger and slower than code generated without this option. On M680x0
19712 processors, this option is not needed; @option{-fPIC} suffices.
19714 GCC normally uses a single instruction to load values from the GOT@.
19715 While this is relatively efficient, it only works if the GOT
19716 is smaller than about 64k. Anything larger causes the linker
19717 to report an error such as:
19719 @cindex relocation truncated to fit (ColdFire)
19721 relocation truncated to fit: R_68K_GOT16O foobar
19724 If this happens, you should recompile your code with @option{-mxgot}.
19725 It should then work with very large GOTs. However, code generated with
19726 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19727 the value of a global symbol.
19729 Note that some linkers, including newer versions of the GNU linker,
19730 can create multiple GOTs and sort GOT entries. If you have such a linker,
19731 you should only need to use @option{-mxgot} when compiling a single
19732 object file that accesses more than 8192 GOT entries. Very few do.
19734 These options have no effect unless GCC is generating
19735 position-independent code.
19737 @item -mlong-jump-table-offsets
19738 @opindex mlong-jump-table-offsets
19739 Use 32-bit offsets in @code{switch} tables. The default is to use
19744 @node MCore Options
19745 @subsection MCore Options
19746 @cindex MCore options
19748 These are the @samp{-m} options defined for the Motorola M*Core
19754 @itemx -mno-hardlit
19756 @opindex mno-hardlit
19757 Inline constants into the code stream if it can be done in two
19758 instructions or less.
19764 Use the divide instruction. (Enabled by default).
19766 @item -mrelax-immediate
19767 @itemx -mno-relax-immediate
19768 @opindex mrelax-immediate
19769 @opindex mno-relax-immediate
19770 Allow arbitrary-sized immediates in bit operations.
19772 @item -mwide-bitfields
19773 @itemx -mno-wide-bitfields
19774 @opindex mwide-bitfields
19775 @opindex mno-wide-bitfields
19776 Always treat bit-fields as @code{int}-sized.
19778 @item -m4byte-functions
19779 @itemx -mno-4byte-functions
19780 @opindex m4byte-functions
19781 @opindex mno-4byte-functions
19782 Force all functions to be aligned to a 4-byte boundary.
19784 @item -mcallgraph-data
19785 @itemx -mno-callgraph-data
19786 @opindex mcallgraph-data
19787 @opindex mno-callgraph-data
19788 Emit callgraph information.
19791 @itemx -mno-slow-bytes
19792 @opindex mslow-bytes
19793 @opindex mno-slow-bytes
19794 Prefer word access when reading byte quantities.
19796 @item -mlittle-endian
19797 @itemx -mbig-endian
19798 @opindex mlittle-endian
19799 @opindex mbig-endian
19800 Generate code for a little-endian target.
19806 Generate code for the 210 processor.
19810 Assume that runtime support has been provided and so omit the
19811 simulator library (@file{libsim.a)} from the linker command line.
19813 @item -mstack-increment=@var{size}
19814 @opindex mstack-increment
19815 Set the maximum amount for a single stack increment operation. Large
19816 values can increase the speed of programs that contain functions
19817 that need a large amount of stack space, but they can also trigger a
19818 segmentation fault if the stack is extended too much. The default
19824 @subsection MeP Options
19825 @cindex MeP options
19831 Enables the @code{abs} instruction, which is the absolute difference
19832 between two registers.
19836 Enables all the optional instructions---average, multiply, divide, bit
19837 operations, leading zero, absolute difference, min/max, clip, and
19843 Enables the @code{ave} instruction, which computes the average of two
19846 @item -mbased=@var{n}
19848 Variables of size @var{n} bytes or smaller are placed in the
19849 @code{.based} section by default. Based variables use the @code{$tp}
19850 register as a base register, and there is a 128-byte limit to the
19851 @code{.based} section.
19855 Enables the bit operation instructions---bit test (@code{btstm}), set
19856 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19857 test-and-set (@code{tas}).
19859 @item -mc=@var{name}
19861 Selects which section constant data is placed in. @var{name} may
19862 be @samp{tiny}, @samp{near}, or @samp{far}.
19866 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19867 useful unless you also provide @option{-mminmax}.
19869 @item -mconfig=@var{name}
19871 Selects one of the built-in core configurations. Each MeP chip has
19872 one or more modules in it; each module has a core CPU and a variety of
19873 coprocessors, optional instructions, and peripherals. The
19874 @code{MeP-Integrator} tool, not part of GCC, provides these
19875 configurations through this option; using this option is the same as
19876 using all the corresponding command-line options. The default
19877 configuration is @samp{default}.
19881 Enables the coprocessor instructions. By default, this is a 32-bit
19882 coprocessor. Note that the coprocessor is normally enabled via the
19883 @option{-mconfig=} option.
19887 Enables the 32-bit coprocessor's instructions.
19891 Enables the 64-bit coprocessor's instructions.
19895 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19899 Causes constant variables to be placed in the @code{.near} section.
19903 Enables the @code{div} and @code{divu} instructions.
19907 Generate big-endian code.
19911 Generate little-endian code.
19913 @item -mio-volatile
19914 @opindex mio-volatile
19915 Tells the compiler that any variable marked with the @code{io}
19916 attribute is to be considered volatile.
19920 Causes variables to be assigned to the @code{.far} section by default.
19924 Enables the @code{leadz} (leading zero) instruction.
19928 Causes variables to be assigned to the @code{.near} section by default.
19932 Enables the @code{min} and @code{max} instructions.
19936 Enables the multiplication and multiply-accumulate instructions.
19940 Disables all the optional instructions enabled by @option{-mall-opts}.
19944 Enables the @code{repeat} and @code{erepeat} instructions, used for
19945 low-overhead looping.
19949 Causes all variables to default to the @code{.tiny} section. Note
19950 that there is a 65536-byte limit to this section. Accesses to these
19951 variables use the @code{%gp} base register.
19955 Enables the saturation instructions. Note that the compiler does not
19956 currently generate these itself, but this option is included for
19957 compatibility with other tools, like @code{as}.
19961 Link the SDRAM-based runtime instead of the default ROM-based runtime.
19965 Link the simulator run-time libraries.
19969 Link the simulator runtime libraries, excluding built-in support
19970 for reset and exception vectors and tables.
19974 Causes all functions to default to the @code{.far} section. Without
19975 this option, functions default to the @code{.near} section.
19977 @item -mtiny=@var{n}
19979 Variables that are @var{n} bytes or smaller are allocated to the
19980 @code{.tiny} section. These variables use the @code{$gp} base
19981 register. The default for this option is 4, but note that there's a
19982 65536-byte limit to the @code{.tiny} section.
19986 @node MicroBlaze Options
19987 @subsection MicroBlaze Options
19988 @cindex MicroBlaze Options
19993 @opindex msoft-float
19994 Use software emulation for floating point (default).
19997 @opindex mhard-float
19998 Use hardware floating-point instructions.
20002 Do not optimize block moves, use @code{memcpy}.
20004 @item -mno-clearbss
20005 @opindex mno-clearbss
20006 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20008 @item -mcpu=@var{cpu-type}
20010 Use features of, and schedule code for, the given CPU.
20011 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20012 where @var{X} is a major version, @var{YY} is the minor version, and
20013 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20014 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
20016 @item -mxl-soft-mul
20017 @opindex mxl-soft-mul
20018 Use software multiply emulation (default).
20020 @item -mxl-soft-div
20021 @opindex mxl-soft-div
20022 Use software emulation for divides (default).
20024 @item -mxl-barrel-shift
20025 @opindex mxl-barrel-shift
20026 Use the hardware barrel shifter.
20028 @item -mxl-pattern-compare
20029 @opindex mxl-pattern-compare
20030 Use pattern compare instructions.
20032 @item -msmall-divides
20033 @opindex msmall-divides
20034 Use table lookup optimization for small signed integer divisions.
20036 @item -mxl-stack-check
20037 @opindex mxl-stack-check
20038 This option is deprecated. Use @option{-fstack-check} instead.
20041 @opindex mxl-gp-opt
20042 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20044 @item -mxl-multiply-high
20045 @opindex mxl-multiply-high
20046 Use multiply high instructions for high part of 32x32 multiply.
20048 @item -mxl-float-convert
20049 @opindex mxl-float-convert
20050 Use hardware floating-point conversion instructions.
20052 @item -mxl-float-sqrt
20053 @opindex mxl-float-sqrt
20054 Use hardware floating-point square root instruction.
20057 @opindex mbig-endian
20058 Generate code for a big-endian target.
20060 @item -mlittle-endian
20061 @opindex mlittle-endian
20062 Generate code for a little-endian target.
20065 @opindex mxl-reorder
20066 Use reorder instructions (swap and byte reversed load/store).
20068 @item -mxl-mode-@var{app-model}
20069 Select application model @var{app-model}. Valid models are
20072 normal executable (default), uses startup code @file{crt0.o}.
20074 @item -mpic-data-is-text-relative
20075 @opindex mpic-data-is-text-relative
20076 Assume that the displacement between the text and data segments is fixed
20077 at static link time. This allows data to be referenced by offset from start of
20078 text address instead of GOT since PC-relative addressing is not supported.
20081 for use with Xilinx Microprocessor Debugger (XMD) based
20082 software intrusive debug agent called xmdstub. This uses startup file
20083 @file{crt1.o} and sets the start address of the program to 0x800.
20086 for applications that are loaded using a bootloader.
20087 This model uses startup file @file{crt2.o} which does not contain a processor
20088 reset vector handler. This is suitable for transferring control on a
20089 processor reset to the bootloader rather than the application.
20092 for applications that do not require any of the
20093 MicroBlaze vectors. This option may be useful for applications running
20094 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20097 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20098 @option{-mxl-mode-@var{app-model}}.
20103 @subsection MIPS Options
20104 @cindex MIPS options
20110 Generate big-endian code.
20114 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20117 @item -march=@var{arch}
20119 Generate code that runs on @var{arch}, which can be the name of a
20120 generic MIPS ISA, or the name of a particular processor.
20122 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20123 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20124 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20125 @samp{mips64r5} and @samp{mips64r6}.
20126 The processor names are:
20127 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20128 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20129 @samp{5kc}, @samp{5kf},
20131 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20132 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20133 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20134 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20135 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20136 @samp{i6400}, @samp{i6500},
20138 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
20140 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20141 @samp{m5100}, @samp{m5101},
20142 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20144 @samp{p5600}, @samp{p6600},
20145 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20146 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20147 @samp{rm7000}, @samp{rm9000},
20148 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20151 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20152 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20153 @samp{xlr} and @samp{xlp}.
20154 The special value @samp{from-abi} selects the
20155 most compatible architecture for the selected ABI (that is,
20156 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20158 The native Linux/GNU toolchain also supports the value @samp{native},
20159 which selects the best architecture option for the host processor.
20160 @option{-march=native} has no effect if GCC does not recognize
20163 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20164 (for example, @option{-march=r2k}). Prefixes are optional, and
20165 @samp{vr} may be written @samp{r}.
20167 Names of the form @samp{@var{n}f2_1} refer to processors with
20168 FPUs clocked at half the rate of the core, names of the form
20169 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20170 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20171 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20172 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20173 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20174 accepted as synonyms for @samp{@var{n}f1_1}.
20176 GCC defines two macros based on the value of this option. The first
20177 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20178 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20179 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20180 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20181 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20183 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20184 above. In other words, it has the full prefix and does not
20185 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20186 the macro names the resolved architecture (either @code{"mips1"} or
20187 @code{"mips3"}). It names the default architecture when no
20188 @option{-march} option is given.
20190 @item -mtune=@var{arch}
20192 Optimize for @var{arch}. Among other things, this option controls
20193 the way instructions are scheduled, and the perceived cost of arithmetic
20194 operations. The list of @var{arch} values is the same as for
20197 When this option is not used, GCC optimizes for the processor
20198 specified by @option{-march}. By using @option{-march} and
20199 @option{-mtune} together, it is possible to generate code that
20200 runs on a family of processors, but optimize the code for one
20201 particular member of that family.
20203 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20204 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20205 @option{-march} ones described above.
20209 Equivalent to @option{-march=mips1}.
20213 Equivalent to @option{-march=mips2}.
20217 Equivalent to @option{-march=mips3}.
20221 Equivalent to @option{-march=mips4}.
20225 Equivalent to @option{-march=mips32}.
20229 Equivalent to @option{-march=mips32r3}.
20233 Equivalent to @option{-march=mips32r5}.
20237 Equivalent to @option{-march=mips32r6}.
20241 Equivalent to @option{-march=mips64}.
20245 Equivalent to @option{-march=mips64r2}.
20249 Equivalent to @option{-march=mips64r3}.
20253 Equivalent to @option{-march=mips64r5}.
20257 Equivalent to @option{-march=mips64r6}.
20262 @opindex mno-mips16
20263 Generate (do not generate) MIPS16 code. If GCC is targeting a
20264 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20266 MIPS16 code generation can also be controlled on a per-function basis
20267 by means of @code{mips16} and @code{nomips16} attributes.
20268 @xref{Function Attributes}, for more information.
20270 @item -mflip-mips16
20271 @opindex mflip-mips16
20272 Generate MIPS16 code on alternating functions. This option is provided
20273 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20274 not intended for ordinary use in compiling user code.
20276 @item -minterlink-compressed
20277 @itemx -mno-interlink-compressed
20278 @opindex minterlink-compressed
20279 @opindex mno-interlink-compressed
20280 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20281 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20283 For example, code using the standard ISA encoding cannot jump directly
20284 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20285 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20286 knows that the target of the jump is not compressed.
20288 @item -minterlink-mips16
20289 @itemx -mno-interlink-mips16
20290 @opindex minterlink-mips16
20291 @opindex mno-interlink-mips16
20292 Aliases of @option{-minterlink-compressed} and
20293 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20294 and are retained for backwards compatibility.
20306 Generate code for the given ABI@.
20308 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20309 generates 64-bit code when you select a 64-bit architecture, but you
20310 can use @option{-mgp32} to get 32-bit code instead.
20312 For information about the O64 ABI, see
20313 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20315 GCC supports a variant of the o32 ABI in which floating-point registers
20316 are 64 rather than 32 bits wide. You can select this combination with
20317 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20318 and @code{mfhc1} instructions and is therefore only supported for
20319 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20321 The register assignments for arguments and return values remain the
20322 same, but each scalar value is passed in a single 64-bit register
20323 rather than a pair of 32-bit registers. For example, scalar
20324 floating-point values are returned in @samp{$f0} only, not a
20325 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20326 remains the same in that the even-numbered double-precision registers
20329 Two additional variants of the o32 ABI are supported to enable
20330 a transition from 32-bit to 64-bit registers. These are FPXX
20331 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20332 The FPXX extension mandates that all code must execute correctly
20333 when run using 32-bit or 64-bit registers. The code can be interlinked
20334 with either FP32 or FP64, but not both.
20335 The FP64A extension is similar to the FP64 extension but forbids the
20336 use of odd-numbered single-precision registers. This can be used
20337 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20338 processors and allows both FP32 and FP64A code to interlink and
20339 run in the same process without changing FPU modes.
20342 @itemx -mno-abicalls
20344 @opindex mno-abicalls
20345 Generate (do not generate) code that is suitable for SVR4-style
20346 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20351 Generate (do not generate) code that is fully position-independent,
20352 and that can therefore be linked into shared libraries. This option
20353 only affects @option{-mabicalls}.
20355 All @option{-mabicalls} code has traditionally been position-independent,
20356 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20357 as an extension, the GNU toolchain allows executables to use absolute
20358 accesses for locally-binding symbols. It can also use shorter GP
20359 initialization sequences and generate direct calls to locally-defined
20360 functions. This mode is selected by @option{-mno-shared}.
20362 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20363 objects that can only be linked by the GNU linker. However, the option
20364 does not affect the ABI of the final executable; it only affects the ABI
20365 of relocatable objects. Using @option{-mno-shared} generally makes
20366 executables both smaller and quicker.
20368 @option{-mshared} is the default.
20374 Assume (do not assume) that the static and dynamic linkers
20375 support PLTs and copy relocations. This option only affects
20376 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20377 has no effect without @option{-msym32}.
20379 You can make @option{-mplt} the default by configuring
20380 GCC with @option{--with-mips-plt}. The default is
20381 @option{-mno-plt} otherwise.
20387 Lift (do not lift) the usual restrictions on the size of the global
20390 GCC normally uses a single instruction to load values from the GOT@.
20391 While this is relatively efficient, it only works if the GOT
20392 is smaller than about 64k. Anything larger causes the linker
20393 to report an error such as:
20395 @cindex relocation truncated to fit (MIPS)
20397 relocation truncated to fit: R_MIPS_GOT16 foobar
20400 If this happens, you should recompile your code with @option{-mxgot}.
20401 This works with very large GOTs, although the code is also
20402 less efficient, since it takes three instructions to fetch the
20403 value of a global symbol.
20405 Note that some linkers can create multiple GOTs. If you have such a
20406 linker, you should only need to use @option{-mxgot} when a single object
20407 file accesses more than 64k's worth of GOT entries. Very few do.
20409 These options have no effect unless GCC is generating position
20414 Assume that general-purpose registers are 32 bits wide.
20418 Assume that general-purpose registers are 64 bits wide.
20422 Assume that floating-point registers are 32 bits wide.
20426 Assume that floating-point registers are 64 bits wide.
20430 Do not assume the width of floating-point registers.
20433 @opindex mhard-float
20434 Use floating-point coprocessor instructions.
20437 @opindex msoft-float
20438 Do not use floating-point coprocessor instructions. Implement
20439 floating-point calculations using library calls instead.
20443 Equivalent to @option{-msoft-float}, but additionally asserts that the
20444 program being compiled does not perform any floating-point operations.
20445 This option is presently supported only by some bare-metal MIPS
20446 configurations, where it may select a special set of libraries
20447 that lack all floating-point support (including, for example, the
20448 floating-point @code{printf} formats).
20449 If code compiled with @option{-mno-float} accidentally contains
20450 floating-point operations, it is likely to suffer a link-time
20451 or run-time failure.
20453 @item -msingle-float
20454 @opindex msingle-float
20455 Assume that the floating-point coprocessor only supports single-precision
20458 @item -mdouble-float
20459 @opindex mdouble-float
20460 Assume that the floating-point coprocessor supports double-precision
20461 operations. This is the default.
20464 @itemx -mno-odd-spreg
20465 @opindex modd-spreg
20466 @opindex mno-odd-spreg
20467 Enable the use of odd-numbered single-precision floating-point registers
20468 for the o32 ABI. This is the default for processors that are known to
20469 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20473 @itemx -mabs=legacy
20475 @opindex mabs=legacy
20476 These options control the treatment of the special not-a-number (NaN)
20477 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20478 @code{neg.@i{fmt}} machine instructions.
20480 By default or when @option{-mabs=legacy} is used the legacy
20481 treatment is selected. In this case these instructions are considered
20482 arithmetic and avoided where correct operation is required and the
20483 input operand might be a NaN. A longer sequence of instructions that
20484 manipulate the sign bit of floating-point datum manually is used
20485 instead unless the @option{-ffinite-math-only} option has also been
20488 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20489 this case these instructions are considered non-arithmetic and therefore
20490 operating correctly in all cases, including in particular where the
20491 input operand is a NaN. These instructions are therefore always used
20492 for the respective operations.
20495 @itemx -mnan=legacy
20497 @opindex mnan=legacy
20498 These options control the encoding of the special not-a-number (NaN)
20499 IEEE 754 floating-point data.
20501 The @option{-mnan=legacy} option selects the legacy encoding. In this
20502 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20503 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
20504 by the first bit of their trailing significand field being 1.
20506 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
20507 this case qNaNs are denoted by the first bit of their trailing
20508 significand field being 1, whereas sNaNs are denoted by the first bit of
20509 their trailing significand field being 0.
20511 The default is @option{-mnan=legacy} unless GCC has been configured with
20512 @option{--with-nan=2008}.
20518 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
20519 implement atomic memory built-in functions. When neither option is
20520 specified, GCC uses the instructions if the target architecture
20523 @option{-mllsc} is useful if the runtime environment can emulate the
20524 instructions and @option{-mno-llsc} can be useful when compiling for
20525 nonstandard ISAs. You can make either option the default by
20526 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
20527 respectively. @option{--with-llsc} is the default for some
20528 configurations; see the installation documentation for details.
20534 Use (do not use) revision 1 of the MIPS DSP ASE@.
20535 @xref{MIPS DSP Built-in Functions}. This option defines the
20536 preprocessor macro @code{__mips_dsp}. It also defines
20537 @code{__mips_dsp_rev} to 1.
20543 Use (do not use) revision 2 of the MIPS DSP ASE@.
20544 @xref{MIPS DSP Built-in Functions}. This option defines the
20545 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
20546 It also defines @code{__mips_dsp_rev} to 2.
20549 @itemx -mno-smartmips
20550 @opindex msmartmips
20551 @opindex mno-smartmips
20552 Use (do not use) the MIPS SmartMIPS ASE.
20554 @item -mpaired-single
20555 @itemx -mno-paired-single
20556 @opindex mpaired-single
20557 @opindex mno-paired-single
20558 Use (do not use) paired-single floating-point instructions.
20559 @xref{MIPS Paired-Single Support}. This option requires
20560 hardware floating-point support to be enabled.
20566 Use (do not use) MIPS Digital Media Extension instructions.
20567 This option can only be used when generating 64-bit code and requires
20568 hardware floating-point support to be enabled.
20573 @opindex mno-mips3d
20574 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
20575 The option @option{-mips3d} implies @option{-mpaired-single}.
20578 @itemx -mno-micromips
20579 @opindex mmicromips
20580 @opindex mno-mmicromips
20581 Generate (do not generate) microMIPS code.
20583 MicroMIPS code generation can also be controlled on a per-function basis
20584 by means of @code{micromips} and @code{nomicromips} attributes.
20585 @xref{Function Attributes}, for more information.
20591 Use (do not use) MT Multithreading instructions.
20597 Use (do not use) the MIPS MCU ASE instructions.
20603 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20609 Use (do not use) the MIPS Virtualization (VZ) instructions.
20615 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20621 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
20627 Use (do not use) the MIPS Global INValidate (GINV) instructions.
20631 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20632 an explanation of the default and the way that the pointer size is
20637 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20639 The default size of @code{int}s, @code{long}s and pointers depends on
20640 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20641 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20642 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20643 or the same size as integer registers, whichever is smaller.
20649 Assume (do not assume) that all symbols have 32-bit values, regardless
20650 of the selected ABI@. This option is useful in combination with
20651 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20652 to generate shorter and faster references to symbolic addresses.
20656 Put definitions of externally-visible data in a small data section
20657 if that data is no bigger than @var{num} bytes. GCC can then generate
20658 more efficient accesses to the data; see @option{-mgpopt} for details.
20660 The default @option{-G} option depends on the configuration.
20662 @item -mlocal-sdata
20663 @itemx -mno-local-sdata
20664 @opindex mlocal-sdata
20665 @opindex mno-local-sdata
20666 Extend (do not extend) the @option{-G} behavior to local data too,
20667 such as to static variables in C@. @option{-mlocal-sdata} is the
20668 default for all configurations.
20670 If the linker complains that an application is using too much small data,
20671 you might want to try rebuilding the less performance-critical parts with
20672 @option{-mno-local-sdata}. You might also want to build large
20673 libraries with @option{-mno-local-sdata}, so that the libraries leave
20674 more room for the main program.
20676 @item -mextern-sdata
20677 @itemx -mno-extern-sdata
20678 @opindex mextern-sdata
20679 @opindex mno-extern-sdata
20680 Assume (do not assume) that externally-defined data is in
20681 a small data section if the size of that data is within the @option{-G} limit.
20682 @option{-mextern-sdata} is the default for all configurations.
20684 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20685 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20686 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20687 is placed in a small data section. If @var{Var} is defined by another
20688 module, you must either compile that module with a high-enough
20689 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20690 definition. If @var{Var} is common, you must link the application
20691 with a high-enough @option{-G} setting.
20693 The easiest way of satisfying these restrictions is to compile
20694 and link every module with the same @option{-G} option. However,
20695 you may wish to build a library that supports several different
20696 small data limits. You can do this by compiling the library with
20697 the highest supported @option{-G} setting and additionally using
20698 @option{-mno-extern-sdata} to stop the library from making assumptions
20699 about externally-defined data.
20705 Use (do not use) GP-relative accesses for symbols that are known to be
20706 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20707 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20710 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20711 might not hold the value of @code{_gp}. For example, if the code is
20712 part of a library that might be used in a boot monitor, programs that
20713 call boot monitor routines pass an unknown value in @code{$gp}.
20714 (In such situations, the boot monitor itself is usually compiled
20715 with @option{-G0}.)
20717 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20718 @option{-mno-extern-sdata}.
20720 @item -membedded-data
20721 @itemx -mno-embedded-data
20722 @opindex membedded-data
20723 @opindex mno-embedded-data
20724 Allocate variables to the read-only data section first if possible, then
20725 next in the small data section if possible, otherwise in data. This gives
20726 slightly slower code than the default, but reduces the amount of RAM required
20727 when executing, and thus may be preferred for some embedded systems.
20729 @item -muninit-const-in-rodata
20730 @itemx -mno-uninit-const-in-rodata
20731 @opindex muninit-const-in-rodata
20732 @opindex mno-uninit-const-in-rodata
20733 Put uninitialized @code{const} variables in the read-only data section.
20734 This option is only meaningful in conjunction with @option{-membedded-data}.
20736 @item -mcode-readable=@var{setting}
20737 @opindex mcode-readable
20738 Specify whether GCC may generate code that reads from executable sections.
20739 There are three possible settings:
20742 @item -mcode-readable=yes
20743 Instructions may freely access executable sections. This is the
20746 @item -mcode-readable=pcrel
20747 MIPS16 PC-relative load instructions can access executable sections,
20748 but other instructions must not do so. This option is useful on 4KSc
20749 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20750 It is also useful on processors that can be configured to have a dual
20751 instruction/data SRAM interface and that, like the M4K, automatically
20752 redirect PC-relative loads to the instruction RAM.
20754 @item -mcode-readable=no
20755 Instructions must not access executable sections. This option can be
20756 useful on targets that are configured to have a dual instruction/data
20757 SRAM interface but that (unlike the M4K) do not automatically redirect
20758 PC-relative loads to the instruction RAM.
20761 @item -msplit-addresses
20762 @itemx -mno-split-addresses
20763 @opindex msplit-addresses
20764 @opindex mno-split-addresses
20765 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20766 relocation operators. This option has been superseded by
20767 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20769 @item -mexplicit-relocs
20770 @itemx -mno-explicit-relocs
20771 @opindex mexplicit-relocs
20772 @opindex mno-explicit-relocs
20773 Use (do not use) assembler relocation operators when dealing with symbolic
20774 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20775 is to use assembler macros instead.
20777 @option{-mexplicit-relocs} is the default if GCC was configured
20778 to use an assembler that supports relocation operators.
20780 @item -mcheck-zero-division
20781 @itemx -mno-check-zero-division
20782 @opindex mcheck-zero-division
20783 @opindex mno-check-zero-division
20784 Trap (do not trap) on integer division by zero.
20786 The default is @option{-mcheck-zero-division}.
20788 @item -mdivide-traps
20789 @itemx -mdivide-breaks
20790 @opindex mdivide-traps
20791 @opindex mdivide-breaks
20792 MIPS systems check for division by zero by generating either a
20793 conditional trap or a break instruction. Using traps results in
20794 smaller code, but is only supported on MIPS II and later. Also, some
20795 versions of the Linux kernel have a bug that prevents trap from
20796 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20797 allow conditional traps on architectures that support them and
20798 @option{-mdivide-breaks} to force the use of breaks.
20800 The default is usually @option{-mdivide-traps}, but this can be
20801 overridden at configure time using @option{--with-divide=breaks}.
20802 Divide-by-zero checks can be completely disabled using
20803 @option{-mno-check-zero-division}.
20805 @item -mload-store-pairs
20806 @itemx -mno-load-store-pairs
20807 @opindex mload-store-pairs
20808 @opindex mno-load-store-pairs
20809 Enable (disable) an optimization that pairs consecutive load or store
20810 instructions to enable load/store bonding. This option is enabled by
20811 default but only takes effect when the selected architecture is known
20812 to support bonding.
20817 @opindex mno-memcpy
20818 Force (do not force) the use of @code{memcpy} for non-trivial block
20819 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20820 most constant-sized copies.
20823 @itemx -mno-long-calls
20824 @opindex mlong-calls
20825 @opindex mno-long-calls
20826 Disable (do not disable) use of the @code{jal} instruction. Calling
20827 functions using @code{jal} is more efficient but requires the caller
20828 and callee to be in the same 256 megabyte segment.
20830 This option has no effect on abicalls code. The default is
20831 @option{-mno-long-calls}.
20837 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20838 instructions, as provided by the R4650 ISA@.
20844 Enable (disable) use of the @code{madd} and @code{msub} integer
20845 instructions. The default is @option{-mimadd} on architectures
20846 that support @code{madd} and @code{msub} except for the 74k
20847 architecture where it was found to generate slower code.
20850 @itemx -mno-fused-madd
20851 @opindex mfused-madd
20852 @opindex mno-fused-madd
20853 Enable (disable) use of the floating-point multiply-accumulate
20854 instructions, when they are available. The default is
20855 @option{-mfused-madd}.
20857 On the R8000 CPU when multiply-accumulate instructions are used,
20858 the intermediate product is calculated to infinite precision
20859 and is not subject to the FCSR Flush to Zero bit. This may be
20860 undesirable in some circumstances. On other processors the result
20861 is numerically identical to the equivalent computation using
20862 separate multiply, add, subtract and negate instructions.
20866 Tell the MIPS assembler to not run its preprocessor over user
20867 assembler files (with a @samp{.s} suffix) when assembling them.
20870 @itemx -mno-fix-24k
20872 @opindex mno-fix-24k
20873 Work around the 24K E48 (lost data on stores during refill) errata.
20874 The workarounds are implemented by the assembler rather than by GCC@.
20877 @itemx -mno-fix-r4000
20878 @opindex mfix-r4000
20879 @opindex mno-fix-r4000
20880 Work around certain R4000 CPU errata:
20883 A double-word or a variable shift may give an incorrect result if executed
20884 immediately after starting an integer division.
20886 A double-word or a variable shift may give an incorrect result if executed
20887 while an integer multiplication is in progress.
20889 An integer division may give an incorrect result if started in a delay slot
20890 of a taken branch or a jump.
20894 @itemx -mno-fix-r4400
20895 @opindex mfix-r4400
20896 @opindex mno-fix-r4400
20897 Work around certain R4400 CPU errata:
20900 A double-word or a variable shift may give an incorrect result if executed
20901 immediately after starting an integer division.
20905 @itemx -mno-fix-r10000
20906 @opindex mfix-r10000
20907 @opindex mno-fix-r10000
20908 Work around certain R10000 errata:
20911 @code{ll}/@code{sc} sequences may not behave atomically on revisions
20912 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20915 This option can only be used if the target architecture supports
20916 branch-likely instructions. @option{-mfix-r10000} is the default when
20917 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
20921 @itemx -mno-fix-rm7000
20922 @opindex mfix-rm7000
20923 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
20924 workarounds are implemented by the assembler rather than by GCC@.
20927 @itemx -mno-fix-vr4120
20928 @opindex mfix-vr4120
20929 Work around certain VR4120 errata:
20932 @code{dmultu} does not always produce the correct result.
20934 @code{div} and @code{ddiv} do not always produce the correct result if one
20935 of the operands is negative.
20937 The workarounds for the division errata rely on special functions in
20938 @file{libgcc.a}. At present, these functions are only provided by
20939 the @code{mips64vr*-elf} configurations.
20941 Other VR4120 errata require a NOP to be inserted between certain pairs of
20942 instructions. These errata are handled by the assembler, not by GCC itself.
20945 @opindex mfix-vr4130
20946 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
20947 workarounds are implemented by the assembler rather than by GCC,
20948 although GCC avoids using @code{mflo} and @code{mfhi} if the
20949 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
20950 instructions are available instead.
20953 @itemx -mno-fix-sb1
20955 Work around certain SB-1 CPU core errata.
20956 (This flag currently works around the SB-1 revision 2
20957 ``F1'' and ``F2'' floating-point errata.)
20959 @item -mr10k-cache-barrier=@var{setting}
20960 @opindex mr10k-cache-barrier
20961 Specify whether GCC should insert cache barriers to avoid the
20962 side effects of speculation on R10K processors.
20964 In common with many processors, the R10K tries to predict the outcome
20965 of a conditional branch and speculatively executes instructions from
20966 the ``taken'' branch. It later aborts these instructions if the
20967 predicted outcome is wrong. However, on the R10K, even aborted
20968 instructions can have side effects.
20970 This problem only affects kernel stores and, depending on the system,
20971 kernel loads. As an example, a speculatively-executed store may load
20972 the target memory into cache and mark the cache line as dirty, even if
20973 the store itself is later aborted. If a DMA operation writes to the
20974 same area of memory before the ``dirty'' line is flushed, the cached
20975 data overwrites the DMA-ed data. See the R10K processor manual
20976 for a full description, including other potential problems.
20978 One workaround is to insert cache barrier instructions before every memory
20979 access that might be speculatively executed and that might have side
20980 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
20981 controls GCC's implementation of this workaround. It assumes that
20982 aborted accesses to any byte in the following regions does not have
20987 the memory occupied by the current function's stack frame;
20990 the memory occupied by an incoming stack argument;
20993 the memory occupied by an object with a link-time-constant address.
20996 It is the kernel's responsibility to ensure that speculative
20997 accesses to these regions are indeed safe.
20999 If the input program contains a function declaration such as:
21005 then the implementation of @code{foo} must allow @code{j foo} and
21006 @code{jal foo} to be executed speculatively. GCC honors this
21007 restriction for functions it compiles itself. It expects non-GCC
21008 functions (such as hand-written assembly code) to do the same.
21010 The option has three forms:
21013 @item -mr10k-cache-barrier=load-store
21014 Insert a cache barrier before a load or store that might be
21015 speculatively executed and that might have side effects even
21018 @item -mr10k-cache-barrier=store
21019 Insert a cache barrier before a store that might be speculatively
21020 executed and that might have side effects even if aborted.
21022 @item -mr10k-cache-barrier=none
21023 Disable the insertion of cache barriers. This is the default setting.
21026 @item -mflush-func=@var{func}
21027 @itemx -mno-flush-func
21028 @opindex mflush-func
21029 Specifies the function to call to flush the I and D caches, or to not
21030 call any such function. If called, the function must take the same
21031 arguments as the common @code{_flush_func}, that is, the address of the
21032 memory range for which the cache is being flushed, the size of the
21033 memory range, and the number 3 (to flush both caches). The default
21034 depends on the target GCC was configured for, but commonly is either
21035 @code{_flush_func} or @code{__cpu_flush}.
21037 @item mbranch-cost=@var{num}
21038 @opindex mbranch-cost
21039 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21040 This cost is only a heuristic and is not guaranteed to produce
21041 consistent results across releases. A zero cost redundantly selects
21042 the default, which is based on the @option{-mtune} setting.
21044 @item -mbranch-likely
21045 @itemx -mno-branch-likely
21046 @opindex mbranch-likely
21047 @opindex mno-branch-likely
21048 Enable or disable use of Branch Likely instructions, regardless of the
21049 default for the selected architecture. By default, Branch Likely
21050 instructions may be generated if they are supported by the selected
21051 architecture. An exception is for the MIPS32 and MIPS64 architectures
21052 and processors that implement those architectures; for those, Branch
21053 Likely instructions are not be generated by default because the MIPS32
21054 and MIPS64 architectures specifically deprecate their use.
21056 @item -mcompact-branches=never
21057 @itemx -mcompact-branches=optimal
21058 @itemx -mcompact-branches=always
21059 @opindex mcompact-branches=never
21060 @opindex mcompact-branches=optimal
21061 @opindex mcompact-branches=always
21062 These options control which form of branches will be generated. The
21063 default is @option{-mcompact-branches=optimal}.
21065 The @option{-mcompact-branches=never} option ensures that compact branch
21066 instructions will never be generated.
21068 The @option{-mcompact-branches=always} option ensures that a compact
21069 branch instruction will be generated if available. If a compact branch
21070 instruction is not available, a delay slot form of the branch will be
21073 This option is supported from MIPS Release 6 onwards.
21075 The @option{-mcompact-branches=optimal} option will cause a delay slot
21076 branch to be used if one is available in the current ISA and the delay
21077 slot is successfully filled. If the delay slot is not filled, a compact
21078 branch will be chosen if one is available.
21080 @item -mfp-exceptions
21081 @itemx -mno-fp-exceptions
21082 @opindex mfp-exceptions
21083 Specifies whether FP exceptions are enabled. This affects how
21084 FP instructions are scheduled for some processors.
21085 The default is that FP exceptions are
21088 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21089 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21092 @item -mvr4130-align
21093 @itemx -mno-vr4130-align
21094 @opindex mvr4130-align
21095 The VR4130 pipeline is two-way superscalar, but can only issue two
21096 instructions together if the first one is 8-byte aligned. When this
21097 option is enabled, GCC aligns pairs of instructions that it
21098 thinks should execute in parallel.
21100 This option only has an effect when optimizing for the VR4130.
21101 It normally makes code faster, but at the expense of making it bigger.
21102 It is enabled by default at optimization level @option{-O3}.
21107 Enable (disable) generation of @code{synci} instructions on
21108 architectures that support it. The @code{synci} instructions (if
21109 enabled) are generated when @code{__builtin___clear_cache} is
21112 This option defaults to @option{-mno-synci}, but the default can be
21113 overridden by configuring GCC with @option{--with-synci}.
21115 When compiling code for single processor systems, it is generally safe
21116 to use @code{synci}. However, on many multi-core (SMP) systems, it
21117 does not invalidate the instruction caches on all cores and may lead
21118 to undefined behavior.
21120 @item -mrelax-pic-calls
21121 @itemx -mno-relax-pic-calls
21122 @opindex mrelax-pic-calls
21123 Try to turn PIC calls that are normally dispatched via register
21124 @code{$25} into direct calls. This is only possible if the linker can
21125 resolve the destination at link time and if the destination is within
21126 range for a direct call.
21128 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21129 an assembler and a linker that support the @code{.reloc} assembly
21130 directive and @option{-mexplicit-relocs} is in effect. With
21131 @option{-mno-explicit-relocs}, this optimization can be performed by the
21132 assembler and the linker alone without help from the compiler.
21134 @item -mmcount-ra-address
21135 @itemx -mno-mcount-ra-address
21136 @opindex mmcount-ra-address
21137 @opindex mno-mcount-ra-address
21138 Emit (do not emit) code that allows @code{_mcount} to modify the
21139 calling function's return address. When enabled, this option extends
21140 the usual @code{_mcount} interface with a new @var{ra-address}
21141 parameter, which has type @code{intptr_t *} and is passed in register
21142 @code{$12}. @code{_mcount} can then modify the return address by
21143 doing both of the following:
21146 Returning the new address in register @code{$31}.
21148 Storing the new address in @code{*@var{ra-address}},
21149 if @var{ra-address} is nonnull.
21152 The default is @option{-mno-mcount-ra-address}.
21154 @item -mframe-header-opt
21155 @itemx -mno-frame-header-opt
21156 @opindex mframe-header-opt
21157 Enable (disable) frame header optimization in the o32 ABI. When using the
21158 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21159 function to write out register arguments. When enabled, this optimization
21160 will suppress the allocation of the frame header if it can be determined that
21163 This optimization is off by default at all optimization levels.
21166 @itemx -mno-lxc1-sxc1
21167 @opindex mlxc1-sxc1
21168 When applicable, enable (disable) the generation of @code{lwxc1},
21169 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21174 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21175 @code{madd.d} and related instructions. Enabled by default.
21180 @subsection MMIX Options
21181 @cindex MMIX Options
21183 These options are defined for the MMIX:
21187 @itemx -mno-libfuncs
21189 @opindex mno-libfuncs
21190 Specify that intrinsic library functions are being compiled, passing all
21191 values in registers, no matter the size.
21194 @itemx -mno-epsilon
21196 @opindex mno-epsilon
21197 Generate floating-point comparison instructions that compare with respect
21198 to the @code{rE} epsilon register.
21200 @item -mabi=mmixware
21202 @opindex mabi=mmixware
21204 Generate code that passes function parameters and return values that (in
21205 the called function) are seen as registers @code{$0} and up, as opposed to
21206 the GNU ABI which uses global registers @code{$231} and up.
21208 @item -mzero-extend
21209 @itemx -mno-zero-extend
21210 @opindex mzero-extend
21211 @opindex mno-zero-extend
21212 When reading data from memory in sizes shorter than 64 bits, use (do not
21213 use) zero-extending load instructions by default, rather than
21214 sign-extending ones.
21217 @itemx -mno-knuthdiv
21219 @opindex mno-knuthdiv
21220 Make the result of a division yielding a remainder have the same sign as
21221 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21222 remainder follows the sign of the dividend. Both methods are
21223 arithmetically valid, the latter being almost exclusively used.
21225 @item -mtoplevel-symbols
21226 @itemx -mno-toplevel-symbols
21227 @opindex mtoplevel-symbols
21228 @opindex mno-toplevel-symbols
21229 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21230 code can be used with the @code{PREFIX} assembly directive.
21234 Generate an executable in the ELF format, rather than the default
21235 @samp{mmo} format used by the @command{mmix} simulator.
21237 @item -mbranch-predict
21238 @itemx -mno-branch-predict
21239 @opindex mbranch-predict
21240 @opindex mno-branch-predict
21241 Use (do not use) the probable-branch instructions, when static branch
21242 prediction indicates a probable branch.
21244 @item -mbase-addresses
21245 @itemx -mno-base-addresses
21246 @opindex mbase-addresses
21247 @opindex mno-base-addresses
21248 Generate (do not generate) code that uses @emph{base addresses}. Using a
21249 base address automatically generates a request (handled by the assembler
21250 and the linker) for a constant to be set up in a global register. The
21251 register is used for one or more base address requests within the range 0
21252 to 255 from the value held in the register. The generally leads to short
21253 and fast code, but the number of different data items that can be
21254 addressed is limited. This means that a program that uses lots of static
21255 data may require @option{-mno-base-addresses}.
21257 @item -msingle-exit
21258 @itemx -mno-single-exit
21259 @opindex msingle-exit
21260 @opindex mno-single-exit
21261 Force (do not force) generated code to have a single exit point in each
21265 @node MN10300 Options
21266 @subsection MN10300 Options
21267 @cindex MN10300 options
21269 These @option{-m} options are defined for Matsushita MN10300 architectures:
21274 Generate code to avoid bugs in the multiply instructions for the MN10300
21275 processors. This is the default.
21277 @item -mno-mult-bug
21278 @opindex mno-mult-bug
21279 Do not generate code to avoid bugs in the multiply instructions for the
21280 MN10300 processors.
21284 Generate code using features specific to the AM33 processor.
21288 Do not generate code using features specific to the AM33 processor. This
21293 Generate code using features specific to the AM33/2.0 processor.
21297 Generate code using features specific to the AM34 processor.
21299 @item -mtune=@var{cpu-type}
21301 Use the timing characteristics of the indicated CPU type when
21302 scheduling instructions. This does not change the targeted processor
21303 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21304 @samp{am33-2} or @samp{am34}.
21306 @item -mreturn-pointer-on-d0
21307 @opindex mreturn-pointer-on-d0
21308 When generating a function that returns a pointer, return the pointer
21309 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21310 only in @code{a0}, and attempts to call such functions without a prototype
21311 result in errors. Note that this option is on by default; use
21312 @option{-mno-return-pointer-on-d0} to disable it.
21316 Do not link in the C run-time initialization object file.
21320 Indicate to the linker that it should perform a relaxation optimization pass
21321 to shorten branches, calls and absolute memory addresses. This option only
21322 has an effect when used on the command line for the final link step.
21324 This option makes symbolic debugging impossible.
21328 Allow the compiler to generate @emph{Long Instruction Word}
21329 instructions if the target is the @samp{AM33} or later. This is the
21330 default. This option defines the preprocessor macro @code{__LIW__}.
21334 Do not allow the compiler to generate @emph{Long Instruction Word}
21335 instructions. This option defines the preprocessor macro
21340 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21341 instructions if the target is the @samp{AM33} or later. This is the
21342 default. This option defines the preprocessor macro @code{__SETLB__}.
21346 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21347 instructions. This option defines the preprocessor macro
21348 @code{__NO_SETLB__}.
21352 @node Moxie Options
21353 @subsection Moxie Options
21354 @cindex Moxie Options
21360 Generate big-endian code. This is the default for @samp{moxie-*-*}
21365 Generate little-endian code.
21369 Generate mul.x and umul.x instructions. This is the default for
21370 @samp{moxiebox-*-*} configurations.
21374 Do not link in the C run-time initialization object file.
21378 @node MSP430 Options
21379 @subsection MSP430 Options
21380 @cindex MSP430 Options
21382 These options are defined for the MSP430:
21388 Force assembly output to always use hex constants. Normally such
21389 constants are signed decimals, but this option is available for
21390 testsuite and/or aesthetic purposes.
21394 Select the MCU to target. This is used to create a C preprocessor
21395 symbol based upon the MCU name, converted to upper case and pre- and
21396 post-fixed with @samp{__}. This in turn is used by the
21397 @file{msp430.h} header file to select an MCU-specific supplementary
21400 The option also sets the ISA to use. If the MCU name is one that is
21401 known to only support the 430 ISA then that is selected, otherwise the
21402 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21403 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21404 name selects the 430X ISA.
21406 In addition an MCU-specific linker script is added to the linker
21407 command line. The script's name is the name of the MCU with
21408 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21409 command line defines the C preprocessor symbol @code{__XXX__} and
21410 cause the linker to search for a script called @file{xxx.ld}.
21412 This option is also passed on to the assembler.
21415 @itemx -mno-warn-mcu
21417 @opindex mno-warn-mcu
21418 This option enables or disables warnings about conflicts between the
21419 MCU name specified by the @option{-mmcu} option and the ISA set by the
21420 @option{-mcpu} option and/or the hardware multiply support set by the
21421 @option{-mhwmult} option. It also toggles warnings about unrecognized
21422 MCU names. This option is on by default.
21426 Specifies the ISA to use. Accepted values are @samp{msp430},
21427 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21428 @option{-mmcu=} option should be used to select the ISA.
21432 Link to the simulator runtime libraries and linker script. Overrides
21433 any scripts that would be selected by the @option{-mmcu=} option.
21437 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21441 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21445 This option is passed to the assembler and linker, and allows the
21446 linker to perform certain optimizations that cannot be done until
21451 Describes the type of hardware multiply supported by the target.
21452 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21453 for the original 16-bit-only multiply supported by early MCUs.
21454 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21455 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21456 A value of @samp{auto} can also be given. This tells GCC to deduce
21457 the hardware multiply support based upon the MCU name provided by the
21458 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21459 the MCU name is not recognized then no hardware multiply support is
21460 assumed. @code{auto} is the default setting.
21462 Hardware multiplies are normally performed by calling a library
21463 routine. This saves space in the generated code. When compiling at
21464 @option{-O3} or higher however the hardware multiplier is invoked
21465 inline. This makes for bigger, but faster code.
21467 The hardware multiply routines disable interrupts whilst running and
21468 restore the previous interrupt state when they finish. This makes
21469 them safe to use inside interrupt handlers as well as in normal code.
21473 Enable the use of a minimum runtime environment - no static
21474 initializers or constructors. This is intended for memory-constrained
21475 devices. The compiler includes special symbols in some objects
21476 that tell the linker and runtime which code fragments are required.
21478 @item -mcode-region=
21479 @itemx -mdata-region=
21480 @opindex mcode-region
21481 @opindex mdata-region
21482 These options tell the compiler where to place functions and data that
21483 do not have one of the @code{lower}, @code{upper}, @code{either} or
21484 @code{section} attributes. Possible values are @code{lower},
21485 @code{upper}, @code{either} or @code{any}. The first three behave
21486 like the corresponding attribute. The fourth possible value -
21487 @code{any} - is the default. It leaves placement entirely up to the
21488 linker script and how it assigns the standard sections
21489 (@code{.text}, @code{.data}, etc) to the memory regions.
21491 @item -msilicon-errata=
21492 @opindex msilicon-errata
21493 This option passes on a request to assembler to enable the fixes for
21494 the named silicon errata.
21496 @item -msilicon-errata-warn=
21497 @opindex msilicon-errata-warn
21498 This option passes on a request to the assembler to enable warning
21499 messages when a silicon errata might need to be applied.
21503 @node NDS32 Options
21504 @subsection NDS32 Options
21505 @cindex NDS32 Options
21507 These options are defined for NDS32 implementations:
21512 @opindex mbig-endian
21513 Generate code in big-endian mode.
21515 @item -mlittle-endian
21516 @opindex mlittle-endian
21517 Generate code in little-endian mode.
21519 @item -mreduced-regs
21520 @opindex mreduced-regs
21521 Use reduced-set registers for register allocation.
21524 @opindex mfull-regs
21525 Use full-set registers for register allocation.
21529 Generate conditional move instructions.
21533 Do not generate conditional move instructions.
21537 Generate performance extension instructions.
21539 @item -mno-ext-perf
21540 @opindex mno-perf-ext
21541 Do not generate performance extension instructions.
21545 Generate performance extension 2 instructions.
21547 @item -mno-ext-perf2
21548 @opindex mno-perf-ext
21549 Do not generate performance extension 2 instructions.
21553 Generate string extension instructions.
21555 @item -mno-ext-string
21556 @opindex mno-perf-ext
21557 Do not generate string extension instructions.
21561 Generate v3 push25/pop25 instructions.
21564 @opindex mno-v3push
21565 Do not generate v3 push25/pop25 instructions.
21569 Generate 16-bit instructions.
21572 @opindex mno-16-bit
21573 Do not generate 16-bit instructions.
21575 @item -misr-vector-size=@var{num}
21576 @opindex misr-vector-size
21577 Specify the size of each interrupt vector, which must be 4 or 16.
21579 @item -mcache-block-size=@var{num}
21580 @opindex mcache-block-size
21581 Specify the size of each cache block,
21582 which must be a power of 2 between 4 and 512.
21584 @item -march=@var{arch}
21586 Specify the name of the target architecture.
21588 @item -mcmodel=@var{code-model}
21590 Set the code model to one of
21593 All the data and read-only data segments must be within 512KB addressing space.
21594 The text segment must be within 16MB addressing space.
21595 @item @samp{medium}
21596 The data segment must be within 512KB while the read-only data segment can be
21597 within 4GB addressing space. The text segment should be still within 16MB
21600 All the text and data segments can be within 4GB addressing space.
21604 @opindex mctor-dtor
21605 Enable constructor/destructor feature.
21609 Guide linker to relax instructions.
21613 @node Nios II Options
21614 @subsection Nios II Options
21615 @cindex Nios II options
21616 @cindex Altera Nios II options
21618 These are the options defined for the Altera Nios II processor.
21624 @cindex smaller data references
21625 Put global and static objects less than or equal to @var{num} bytes
21626 into the small data or BSS sections instead of the normal data or BSS
21627 sections. The default value of @var{num} is 8.
21629 @item -mgpopt=@var{option}
21634 Generate (do not generate) GP-relative accesses. The following
21635 @var{option} names are recognized:
21640 Do not generate GP-relative accesses.
21643 Generate GP-relative accesses for small data objects that are not
21644 external, weak, or uninitialized common symbols.
21645 Also use GP-relative addressing for objects that
21646 have been explicitly placed in a small data section via a @code{section}
21650 As for @samp{local}, but also generate GP-relative accesses for
21651 small data objects that are external, weak, or common. If you use this option,
21652 you must ensure that all parts of your program (including libraries) are
21653 compiled with the same @option{-G} setting.
21656 Generate GP-relative accesses for all data objects in the program. If you
21657 use this option, the entire data and BSS segments
21658 of your program must fit in 64K of memory and you must use an appropriate
21659 linker script to allocate them within the addressable range of the
21663 Generate GP-relative addresses for function pointers as well as data
21664 pointers. If you use this option, the entire text, data, and BSS segments
21665 of your program must fit in 64K of memory and you must use an appropriate
21666 linker script to allocate them within the addressable range of the
21671 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21672 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21674 The default is @option{-mgpopt} except when @option{-fpic} or
21675 @option{-fPIC} is specified to generate position-independent code.
21676 Note that the Nios II ABI does not permit GP-relative accesses from
21679 You may need to specify @option{-mno-gpopt} explicitly when building
21680 programs that include large amounts of small data, including large
21681 GOT data sections. In this case, the 16-bit offset for GP-relative
21682 addressing may not be large enough to allow access to the entire
21683 small data section.
21685 @item -mgprel-sec=@var{regexp}
21686 @opindex mgprel-sec
21687 This option specifies additional section names that can be accessed via
21688 GP-relative addressing. It is most useful in conjunction with
21689 @code{section} attributes on variable declarations
21690 (@pxref{Common Variable Attributes}) and a custom linker script.
21691 The @var{regexp} is a POSIX Extended Regular Expression.
21693 This option does not affect the behavior of the @option{-G} option, and
21694 and the specified sections are in addition to the standard @code{.sdata}
21695 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
21697 @item -mr0rel-sec=@var{regexp}
21698 @opindex mr0rel-sec
21699 This option specifies names of sections that can be accessed via a
21700 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
21701 of the 32-bit address space. It is most useful in conjunction with
21702 @code{section} attributes on variable declarations
21703 (@pxref{Common Variable Attributes}) and a custom linker script.
21704 The @var{regexp} is a POSIX Extended Regular Expression.
21706 In contrast to the use of GP-relative addressing for small data,
21707 zero-based addressing is never generated by default and there are no
21708 conventional section names used in standard linker scripts for sections
21709 in the low or high areas of memory.
21715 Generate little-endian (default) or big-endian (experimental) code,
21718 @item -march=@var{arch}
21720 This specifies the name of the target Nios II architecture. GCC uses this
21721 name to determine what kind of instructions it can emit when generating
21722 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21724 The preprocessor macro @code{__nios2_arch__} is available to programs,
21725 with value 1 or 2, indicating the targeted ISA level.
21727 @item -mbypass-cache
21728 @itemx -mno-bypass-cache
21729 @opindex mno-bypass-cache
21730 @opindex mbypass-cache
21731 Force all load and store instructions to always bypass cache by
21732 using I/O variants of the instructions. The default is not to
21735 @item -mno-cache-volatile
21736 @itemx -mcache-volatile
21737 @opindex mcache-volatile
21738 @opindex mno-cache-volatile
21739 Volatile memory access bypass the cache using the I/O variants of
21740 the load and store instructions. The default is not to bypass the cache.
21742 @item -mno-fast-sw-div
21743 @itemx -mfast-sw-div
21744 @opindex mno-fast-sw-div
21745 @opindex mfast-sw-div
21746 Do not use table-based fast divide for small numbers. The default
21747 is to use the fast divide at @option{-O3} and above.
21751 @itemx -mno-hw-mulx
21755 @opindex mno-hw-mul
21757 @opindex mno-hw-mulx
21759 @opindex mno-hw-div
21761 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21762 instructions by the compiler. The default is to emit @code{mul}
21763 and not emit @code{div} and @code{mulx}.
21769 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21770 CDX (code density) instructions. Enabling these instructions also
21771 requires @option{-march=r2}. Since these instructions are optional
21772 extensions to the R2 architecture, the default is not to emit them.
21774 @item -mcustom-@var{insn}=@var{N}
21775 @itemx -mno-custom-@var{insn}
21776 @opindex mcustom-@var{insn}
21777 @opindex mno-custom-@var{insn}
21778 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21779 custom instruction with encoding @var{N} when generating code that uses
21780 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21781 instruction 253 for single-precision floating-point add operations instead
21782 of the default behavior of using a library call.
21784 The following values of @var{insn} are supported. Except as otherwise
21785 noted, floating-point operations are expected to be implemented with
21786 normal IEEE 754 semantics and correspond directly to the C operators or the
21787 equivalent GCC built-in functions (@pxref{Other Builtins}).
21789 Single-precision floating point:
21792 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21793 Binary arithmetic operations.
21799 Unary absolute value.
21801 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21802 Comparison operations.
21804 @item @samp{fmins}, @samp{fmaxs}
21805 Floating-point minimum and maximum. These instructions are only
21806 generated if @option{-ffinite-math-only} is specified.
21808 @item @samp{fsqrts}
21809 Unary square root operation.
21811 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21812 Floating-point trigonometric and exponential functions. These instructions
21813 are only generated if @option{-funsafe-math-optimizations} is also specified.
21817 Double-precision floating point:
21820 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21821 Binary arithmetic operations.
21827 Unary absolute value.
21829 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21830 Comparison operations.
21832 @item @samp{fmind}, @samp{fmaxd}
21833 Double-precision minimum and maximum. These instructions are only
21834 generated if @option{-ffinite-math-only} is specified.
21836 @item @samp{fsqrtd}
21837 Unary square root operation.
21839 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21840 Double-precision trigonometric and exponential functions. These instructions
21841 are only generated if @option{-funsafe-math-optimizations} is also specified.
21847 @item @samp{fextsd}
21848 Conversion from single precision to double precision.
21850 @item @samp{ftruncds}
21851 Conversion from double precision to single precision.
21853 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21854 Conversion from floating point to signed or unsigned integer types, with
21855 truncation towards zero.
21858 Conversion from single-precision floating point to signed integer,
21859 rounding to the nearest integer and ties away from zero.
21860 This corresponds to the @code{__builtin_lroundf} function when
21861 @option{-fno-math-errno} is used.
21863 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21864 Conversion from signed or unsigned integer types to floating-point types.
21868 In addition, all of the following transfer instructions for internal
21869 registers X and Y must be provided to use any of the double-precision
21870 floating-point instructions. Custom instructions taking two
21871 double-precision source operands expect the first operand in the
21872 64-bit register X. The other operand (or only operand of a unary
21873 operation) is given to the custom arithmetic instruction with the
21874 least significant half in source register @var{src1} and the most
21875 significant half in @var{src2}. A custom instruction that returns a
21876 double-precision result returns the most significant 32 bits in the
21877 destination register and the other half in 32-bit register Y.
21878 GCC automatically generates the necessary code sequences to write
21879 register X and/or read register Y when double-precision floating-point
21880 instructions are used.
21885 Write @var{src1} into the least significant half of X and @var{src2} into
21886 the most significant half of X.
21889 Write @var{src1} into Y.
21891 @item @samp{frdxhi}, @samp{frdxlo}
21892 Read the most or least (respectively) significant half of X and store it in
21896 Read the value of Y and store it into @var{dest}.
21899 Note that you can gain more local control over generation of Nios II custom
21900 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
21901 and @code{target("no-custom-@var{insn}")} function attributes
21902 (@pxref{Function Attributes})
21903 or pragmas (@pxref{Function Specific Option Pragmas}).
21905 @item -mcustom-fpu-cfg=@var{name}
21906 @opindex mcustom-fpu-cfg
21908 This option enables a predefined, named set of custom instruction encodings
21909 (see @option{-mcustom-@var{insn}} above).
21910 Currently, the following sets are defined:
21912 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
21913 @gccoptlist{-mcustom-fmuls=252 @gol
21914 -mcustom-fadds=253 @gol
21915 -mcustom-fsubs=254 @gol
21916 -fsingle-precision-constant}
21918 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
21919 @gccoptlist{-mcustom-fmuls=252 @gol
21920 -mcustom-fadds=253 @gol
21921 -mcustom-fsubs=254 @gol
21922 -mcustom-fdivs=255 @gol
21923 -fsingle-precision-constant}
21925 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
21926 @gccoptlist{-mcustom-floatus=243 @gol
21927 -mcustom-fixsi=244 @gol
21928 -mcustom-floatis=245 @gol
21929 -mcustom-fcmpgts=246 @gol
21930 -mcustom-fcmples=249 @gol
21931 -mcustom-fcmpeqs=250 @gol
21932 -mcustom-fcmpnes=251 @gol
21933 -mcustom-fmuls=252 @gol
21934 -mcustom-fadds=253 @gol
21935 -mcustom-fsubs=254 @gol
21936 -mcustom-fdivs=255 @gol
21937 -fsingle-precision-constant}
21939 Custom instruction assignments given by individual
21940 @option{-mcustom-@var{insn}=} options override those given by
21941 @option{-mcustom-fpu-cfg=}, regardless of the
21942 order of the options on the command line.
21944 Note that you can gain more local control over selection of a FPU
21945 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
21946 function attribute (@pxref{Function Attributes})
21947 or pragma (@pxref{Function Specific Option Pragmas}).
21951 These additional @samp{-m} options are available for the Altera Nios II
21952 ELF (bare-metal) target:
21958 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
21959 startup and termination code, and is typically used in conjunction with
21960 @option{-msys-crt0=} to specify the location of the alternate startup code
21961 provided by the HAL BSP.
21965 Link with a limited version of the C library, @option{-lsmallc}, rather than
21968 @item -msys-crt0=@var{startfile}
21970 @var{startfile} is the file name of the startfile (crt0) to use
21971 when linking. This option is only useful in conjunction with @option{-mhal}.
21973 @item -msys-lib=@var{systemlib}
21975 @var{systemlib} is the library name of the library that provides
21976 low-level system calls required by the C library,
21977 e.g. @code{read} and @code{write}.
21978 This option is typically used to link with a library provided by a HAL BSP.
21982 @node Nvidia PTX Options
21983 @subsection Nvidia PTX Options
21984 @cindex Nvidia PTX options
21985 @cindex nvptx options
21987 These options are defined for Nvidia PTX:
21995 Generate code for 32-bit or 64-bit ABI.
21998 @opindex mmainkernel
21999 Link in code for a __main kernel. This is for stand-alone instead of
22000 offloading execution.
22004 Apply partitioned execution optimizations. This is the default when any
22005 level of optimization is selected.
22008 @opindex msoft-stack
22009 Generate code that does not use @code{.local} memory
22010 directly for stack storage. Instead, a per-warp stack pointer is
22011 maintained explicitly. This enables variable-length stack allocation (with
22012 variable-length arrays or @code{alloca}), and when global memory is used for
22013 underlying storage, makes it possible to access automatic variables from other
22014 threads, or with atomic instructions. This code generation variant is used
22015 for OpenMP offloading, but the option is exposed on its own for the purpose
22016 of testing the compiler; to generate code suitable for linking into programs
22017 using OpenMP offloading, use option @option{-mgomp}.
22019 @item -muniform-simt
22020 @opindex muniform-simt
22021 Switch to code generation variant that allows to execute all threads in each
22022 warp, while maintaining memory state and side effects as if only one thread
22023 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22024 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22025 current lane index equals the master lane index), and the register being
22026 assigned is copied via a shuffle instruction from the master lane. Outside of
22027 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22028 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22029 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22030 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22031 with current lane index to compute the master lane index.
22035 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22036 @option{-muniform-simt} options, and selects corresponding multilib variant.
22040 @node PDP-11 Options
22041 @subsection PDP-11 Options
22042 @cindex PDP-11 Options
22044 These options are defined for the PDP-11:
22049 Use hardware FPP floating point. This is the default. (FIS floating
22050 point on the PDP-11/40 is not supported.) Implies -m45.
22053 @opindex msoft-float
22054 Do not use hardware floating point.
22058 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22062 Return floating-point results in memory. This is the default.
22066 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22070 Generate code for a PDP-11/45. This is the default.
22074 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22080 Use 16-bit @code{int}. This is the default.
22086 Use 32-bit @code{int}.
22089 @itemx -mno-float32
22091 @opindex mno-float32
22092 Use 64-bit @code{float}. This is the default.
22095 @itemx -mno-float64
22097 @opindex mno-float64
22098 Use 32-bit @code{float}.
22102 Target has split instruction and data space. Implies -m45.
22106 Use Unix assembler syntax.
22110 Use DEC assembler syntax.
22114 Use GNU assembler syntax. This is the default.
22117 @node picoChip Options
22118 @subsection picoChip Options
22119 @cindex picoChip options
22121 These @samp{-m} options are defined for picoChip implementations:
22125 @item -mae=@var{ae_type}
22127 Set the instruction set, register set, and instruction scheduling
22128 parameters for array element type @var{ae_type}. Supported values
22129 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22131 @option{-mae=ANY} selects a completely generic AE type. Code
22132 generated with this option runs on any of the other AE types. The
22133 code is not as efficient as it would be if compiled for a specific
22134 AE type, and some types of operation (e.g., multiplication) do not
22135 work properly on all types of AE.
22137 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22138 for compiled code, and is the default.
22140 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22141 option may suffer from poor performance of byte (char) manipulation,
22142 since the DSP AE does not provide hardware support for byte load/stores.
22144 @item -msymbol-as-address
22145 Enable the compiler to directly use a symbol name as an address in a
22146 load/store instruction, without first loading it into a
22147 register. Typically, the use of this option generates larger
22148 programs, which run faster than when the option isn't used. However, the
22149 results vary from program to program, so it is left as a user option,
22150 rather than being permanently enabled.
22152 @item -mno-inefficient-warnings
22153 Disables warnings about the generation of inefficient code. These
22154 warnings can be generated, for example, when compiling code that
22155 performs byte-level memory operations on the MAC AE type. The MAC AE has
22156 no hardware support for byte-level memory operations, so all byte
22157 load/stores must be synthesized from word load/store operations. This is
22158 inefficient and a warning is generated to indicate
22159 that you should rewrite the code to avoid byte operations, or to target
22160 an AE type that has the necessary hardware support. This option disables
22165 @node PowerPC Options
22166 @subsection PowerPC Options
22167 @cindex PowerPC options
22169 These are listed under @xref{RS/6000 and PowerPC Options}.
22171 @node PowerPC SPE Options
22172 @subsection PowerPC SPE Options
22173 @cindex PowerPC SPE options
22175 These @samp{-m} options are defined for PowerPC SPE:
22180 @itemx -mno-popcntb
22184 @opindex mno-popcntb
22185 You use these options to specify which instructions are available on the
22186 processor you are using. The default value of these options is
22187 determined when configuring GCC@. Specifying the
22188 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22189 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22190 rather than the options listed above.
22192 The @option{-mmfcrf} option allows GCC to generate the move from
22193 condition register field instruction implemented on the POWER4
22194 processor and other processors that support the PowerPC V2.01
22196 The @option{-mpopcntb} option allows GCC to generate the popcount and
22197 double-precision FP reciprocal estimate instruction implemented on the
22198 POWER5 processor and other processors that support the PowerPC V2.02
22201 @item -mcpu=@var{cpu_type}
22203 Set architecture type, register usage, and
22204 instruction scheduling parameters for machine type @var{cpu_type}.
22205 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22208 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22209 endian), with an appropriate, generic processor model assumed for
22210 scheduling purposes.
22212 Specifying @samp{native} as cpu type detects and selects the
22213 architecture option that corresponds to the host processor of the
22214 system performing the compilation.
22215 @option{-mcpu=native} has no effect if GCC does not recognize the
22218 The other options specify a specific processor. Code generated under
22219 those options runs best on that processor, and may not run at all on
22222 The @option{-mcpu} options automatically enable or disable the
22225 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22226 -mpopcntb -mpopcntd @gol
22227 -msingle-float -mdouble-float @gol
22230 The particular options set for any particular CPU varies between
22231 compiler versions, depending on what setting seems to produce optimal
22232 code for that CPU; it doesn't necessarily reflect the actual hardware's
22233 capabilities. If you wish to set an individual option to a particular
22234 value, you may specify it after the @option{-mcpu} option, like
22235 @option{-mcpu=8548}.
22237 @item -mtune=@var{cpu_type}
22239 Set the instruction scheduling parameters for machine type
22240 @var{cpu_type}, but do not set the architecture type or register usage,
22241 as @option{-mcpu=@var{cpu_type}} does. The same
22242 values for @var{cpu_type} are used for @option{-mtune} as for
22243 @option{-mcpu}. If both are specified, the code generated uses the
22244 architecture and registers set by @option{-mcpu}, but the
22245 scheduling parameters set by @option{-mtune}.
22248 @opindex msecure-plt
22249 Generate code that allows @command{ld} and @command{ld.so}
22250 to build executables and shared
22251 libraries with non-executable @code{.plt} and @code{.got} sections.
22253 32-bit SYSV ABI option.
22257 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22259 requires @code{.plt} and @code{.got}
22260 sections that are both writable and executable.
22261 This is a PowerPC 32-bit SYSV ABI option.
22267 This switch enables or disables the generation of ISEL instructions.
22269 @item -misel=@var{yes/no}
22270 This switch has been deprecated. Use @option{-misel} and
22271 @option{-mno-isel} instead.
22277 This switch enables or disables the generation of SPE simd
22280 @item -mspe=@var{yes/no}
22281 This option has been deprecated. Use @option{-mspe} and
22282 @option{-mno-spe} instead.
22285 @itemx -mno-float128
22287 @opindex mno-float128
22288 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22289 and use either software emulation for IEEE 128-bit floating point or
22290 hardware instructions.
22292 @item -mfloat-gprs=@var{yes/single/double/no}
22293 @itemx -mfloat-gprs
22294 @opindex mfloat-gprs
22295 This switch enables or disables the generation of floating-point
22296 operations on the general-purpose registers for architectures that
22299 The argument @samp{yes} or @samp{single} enables the use of
22300 single-precision floating-point operations.
22302 The argument @samp{double} enables the use of single and
22303 double-precision floating-point operations.
22305 The argument @samp{no} disables floating-point operations on the
22306 general-purpose registers.
22308 This option is currently only available on the MPC854x.
22311 @itemx -mno-fp-in-toc
22312 @itemx -mno-sum-in-toc
22313 @itemx -mminimal-toc
22315 @opindex mno-fp-in-toc
22316 @opindex mno-sum-in-toc
22317 @opindex mminimal-toc
22318 Modify generation of the TOC (Table Of Contents), which is created for
22319 every executable file. The @option{-mfull-toc} option is selected by
22320 default. In that case, GCC allocates at least one TOC entry for
22321 each unique non-automatic variable reference in your program. GCC
22322 also places floating-point constants in the TOC@. However, only
22323 16,384 entries are available in the TOC@.
22325 If you receive a linker error message that saying you have overflowed
22326 the available TOC space, you can reduce the amount of TOC space used
22327 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22328 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22329 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22330 generate code to calculate the sum of an address and a constant at
22331 run time instead of putting that sum into the TOC@. You may specify one
22332 or both of these options. Each causes GCC to produce very slightly
22333 slower and larger code at the expense of conserving TOC space.
22335 If you still run out of space in the TOC even when you specify both of
22336 these options, specify @option{-mminimal-toc} instead. This option causes
22337 GCC to make only one TOC entry for every file. When you specify this
22338 option, GCC produces code that is slower and larger but which
22339 uses extremely little TOC space. You may wish to use this option
22340 only on files that contain less frequently-executed code.
22344 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
22347 @itemx -mno-xl-compat
22348 @opindex mxl-compat
22349 @opindex mno-xl-compat
22350 Produce code that conforms more closely to IBM XL compiler semantics
22351 when using AIX-compatible ABI@. Pass floating-point arguments to
22352 prototyped functions beyond the register save area (RSA) on the stack
22353 in addition to argument FPRs. Do not assume that most significant
22354 double in 128-bit long double value is properly rounded when comparing
22355 values and converting to double. Use XL symbol names for long double
22358 The AIX calling convention was extended but not initially documented to
22359 handle an obscure K&R C case of calling a function that takes the
22360 address of its arguments with fewer arguments than declared. IBM XL
22361 compilers access floating-point arguments that do not fit in the
22362 RSA from the stack when a subroutine is compiled without
22363 optimization. Because always storing floating-point arguments on the
22364 stack is inefficient and rarely needed, this option is not enabled by
22365 default and only is necessary when calling subroutines compiled by IBM
22366 XL compilers without optimization.
22368 @item -malign-natural
22369 @itemx -malign-power
22370 @opindex malign-natural
22371 @opindex malign-power
22372 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22373 @option{-malign-natural} overrides the ABI-defined alignment of larger
22374 types, such as floating-point doubles, on their natural size-based boundary.
22375 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22376 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22378 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22382 @itemx -mhard-float
22383 @opindex msoft-float
22384 @opindex mhard-float
22385 Generate code that does not use (uses) the floating-point register set.
22386 Software floating-point emulation is provided if you use the
22387 @option{-msoft-float} option, and pass the option to GCC when linking.
22389 @item -msingle-float
22390 @itemx -mdouble-float
22391 @opindex msingle-float
22392 @opindex mdouble-float
22393 Generate code for single- or double-precision floating-point operations.
22394 @option{-mdouble-float} implies @option{-msingle-float}.
22397 @itemx -mno-multiple
22399 @opindex mno-multiple
22400 Generate code that uses (does not use) the load multiple word
22401 instructions and the store multiple word instructions. These
22402 instructions are generated by default on POWER systems, and not
22403 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22404 PowerPC systems, since those instructions do not work when the
22405 processor is in little-endian mode. The exceptions are PPC740 and
22406 PPC750 which permit these instructions in little-endian mode.
22411 @opindex mno-update
22412 Generate code that uses (does not use) the load or store instructions
22413 that update the base register to the address of the calculated memory
22414 location. These instructions are generated by default. If you use
22415 @option{-mno-update}, there is a small window between the time that the
22416 stack pointer is updated and the address of the previous frame is
22417 stored, which means code that walks the stack frame across interrupts or
22418 signals may get corrupted data.
22420 @item -mavoid-indexed-addresses
22421 @itemx -mno-avoid-indexed-addresses
22422 @opindex mavoid-indexed-addresses
22423 @opindex mno-avoid-indexed-addresses
22424 Generate code that tries to avoid (not avoid) the use of indexed load
22425 or store instructions. These instructions can incur a performance
22426 penalty on Power6 processors in certain situations, such as when
22427 stepping through large arrays that cross a 16M boundary. This option
22428 is enabled by default when targeting Power6 and disabled otherwise.
22431 @itemx -mno-fused-madd
22432 @opindex mfused-madd
22433 @opindex mno-fused-madd
22434 Generate code that uses (does not use) the floating-point multiply and
22435 accumulate instructions. These instructions are generated by default
22436 if hardware floating point is used. The machine-dependent
22437 @option{-mfused-madd} option is now mapped to the machine-independent
22438 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22439 mapped to @option{-ffp-contract=off}.
22441 @item -mno-strict-align
22442 @itemx -mstrict-align
22443 @opindex mno-strict-align
22444 @opindex mstrict-align
22445 On System V.4 and embedded PowerPC systems do not (do) assume that
22446 unaligned memory references are handled by the system.
22448 @item -mrelocatable
22449 @itemx -mno-relocatable
22450 @opindex mrelocatable
22451 @opindex mno-relocatable
22452 Generate code that allows (does not allow) a static executable to be
22453 relocated to a different address at run time. A simple embedded
22454 PowerPC system loader should relocate the entire contents of
22455 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22456 a table of 32-bit addresses generated by this option. For this to
22457 work, all objects linked together must be compiled with
22458 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22459 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22461 @item -mrelocatable-lib
22462 @itemx -mno-relocatable-lib
22463 @opindex mrelocatable-lib
22464 @opindex mno-relocatable-lib
22465 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22466 @code{.fixup} section to allow static executables to be relocated at
22467 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22468 alignment of @option{-mrelocatable}. Objects compiled with
22469 @option{-mrelocatable-lib} may be linked with objects compiled with
22470 any combination of the @option{-mrelocatable} options.
22476 On System V.4 and embedded PowerPC systems do not (do) assume that
22477 register 2 contains a pointer to a global area pointing to the addresses
22478 used in the program.
22481 @itemx -mlittle-endian
22483 @opindex mlittle-endian
22484 On System V.4 and embedded PowerPC systems compile code for the
22485 processor in little-endian mode. The @option{-mlittle-endian} option is
22486 the same as @option{-mlittle}.
22489 @itemx -mbig-endian
22491 @opindex mbig-endian
22492 On System V.4 and embedded PowerPC systems compile code for the
22493 processor in big-endian mode. The @option{-mbig-endian} option is
22494 the same as @option{-mbig}.
22496 @item -mdynamic-no-pic
22497 @opindex mdynamic-no-pic
22498 On Darwin and Mac OS X systems, compile code so that it is not
22499 relocatable, but that its external references are relocatable. The
22500 resulting code is suitable for applications, but not shared
22503 @item -msingle-pic-base
22504 @opindex msingle-pic-base
22505 Treat the register used for PIC addressing as read-only, rather than
22506 loading it in the prologue for each function. The runtime system is
22507 responsible for initializing this register with an appropriate value
22508 before execution begins.
22510 @item -mprioritize-restricted-insns=@var{priority}
22511 @opindex mprioritize-restricted-insns
22512 This option controls the priority that is assigned to
22513 dispatch-slot restricted instructions during the second scheduling
22514 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22515 or @samp{2} to assign no, highest, or second-highest (respectively)
22516 priority to dispatch-slot restricted
22519 @item -msched-costly-dep=@var{dependence_type}
22520 @opindex msched-costly-dep
22521 This option controls which dependences are considered costly
22522 by the target during instruction scheduling. The argument
22523 @var{dependence_type} takes one of the following values:
22527 No dependence is costly.
22530 All dependences are costly.
22532 @item @samp{true_store_to_load}
22533 A true dependence from store to load is costly.
22535 @item @samp{store_to_load}
22536 Any dependence from store to load is costly.
22539 Any dependence for which the latency is greater than or equal to
22540 @var{number} is costly.
22543 @item -minsert-sched-nops=@var{scheme}
22544 @opindex minsert-sched-nops
22545 This option controls which NOP insertion scheme is used during
22546 the second scheduling pass. The argument @var{scheme} takes one of the
22554 Pad with NOPs any dispatch group that has vacant issue slots,
22555 according to the scheduler's grouping.
22557 @item @samp{regroup_exact}
22558 Insert NOPs to force costly dependent insns into
22559 separate groups. Insert exactly as many NOPs as needed to force an insn
22560 to a new group, according to the estimated processor grouping.
22563 Insert NOPs to force costly dependent insns into
22564 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22568 @opindex mcall-sysv
22569 On System V.4 and embedded PowerPC systems compile code using calling
22570 conventions that adhere to the March 1995 draft of the System V
22571 Application Binary Interface, PowerPC processor supplement. This is the
22572 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22574 @item -mcall-sysv-eabi
22576 @opindex mcall-sysv-eabi
22577 @opindex mcall-eabi
22578 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22580 @item -mcall-sysv-noeabi
22581 @opindex mcall-sysv-noeabi
22582 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22584 @item -mcall-aixdesc
22586 On System V.4 and embedded PowerPC systems compile code for the AIX
22590 @opindex mcall-linux
22591 On System V.4 and embedded PowerPC systems compile code for the
22592 Linux-based GNU system.
22594 @item -mcall-freebsd
22595 @opindex mcall-freebsd
22596 On System V.4 and embedded PowerPC systems compile code for the
22597 FreeBSD operating system.
22599 @item -mcall-netbsd
22600 @opindex mcall-netbsd
22601 On System V.4 and embedded PowerPC systems compile code for the
22602 NetBSD operating system.
22604 @item -mcall-openbsd
22605 @opindex mcall-netbsd
22606 On System V.4 and embedded PowerPC systems compile code for the
22607 OpenBSD operating system.
22609 @item -maix-struct-return
22610 @opindex maix-struct-return
22611 Return all structures in memory (as specified by the AIX ABI)@.
22613 @item -msvr4-struct-return
22614 @opindex msvr4-struct-return
22615 Return structures smaller than 8 bytes in registers (as specified by the
22618 @item -mabi=@var{abi-type}
22620 Extend the current ABI with a particular extension, or remove such extension.
22621 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22622 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22623 @samp{elfv1}, @samp{elfv2}@.
22627 Extend the current ABI with SPE ABI extensions. This does not change
22628 the default ABI, instead it adds the SPE ABI extensions to the current
22632 @opindex mabi=no-spe
22633 Disable Book-E SPE ABI extensions for the current ABI@.
22635 @item -mabi=ibmlongdouble
22636 @opindex mabi=ibmlongdouble
22637 Change the current ABI to use IBM extended-precision long double.
22638 This is not likely to work if your system defaults to using IEEE
22639 extended-precision long double. If you change the long double type
22640 from IEEE extended-precision, the compiler will issue a warning unless
22641 you use the @option{-Wno-psabi} option.
22643 @item -mabi=ieeelongdouble
22644 @opindex mabi=ieeelongdouble
22645 Change the current ABI to use IEEE extended-precision long double.
22646 This is not likely to work if your system defaults to using IBM
22647 extended-precision long double. If you change the long double type
22648 from IBM extended-precision, the compiler will issue a warning unless
22649 you use the @option{-Wno-psabi} option.
22652 @opindex mabi=elfv1
22653 Change the current ABI to use the ELFv1 ABI.
22654 This is the default ABI for big-endian PowerPC 64-bit Linux.
22655 Overriding the default ABI requires special system support and is
22656 likely to fail in spectacular ways.
22659 @opindex mabi=elfv2
22660 Change the current ABI to use the ELFv2 ABI.
22661 This is the default ABI for little-endian PowerPC 64-bit Linux.
22662 Overriding the default ABI requires special system support and is
22663 likely to fail in spectacular ways.
22665 @item -mgnu-attribute
22666 @itemx -mno-gnu-attribute
22667 @opindex mgnu-attribute
22668 @opindex mno-gnu-attribute
22669 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22670 .gnu.attributes section that specify ABI variations in function
22671 parameters or return values.
22674 @itemx -mno-prototype
22675 @opindex mprototype
22676 @opindex mno-prototype
22677 On System V.4 and embedded PowerPC systems assume that all calls to
22678 variable argument functions are properly prototyped. Otherwise, the
22679 compiler must insert an instruction before every non-prototyped call to
22680 set or clear bit 6 of the condition code register (@code{CR}) to
22681 indicate whether floating-point values are passed in the floating-point
22682 registers in case the function takes variable arguments. With
22683 @option{-mprototype}, only calls to prototyped variable argument functions
22684 set or clear the bit.
22688 On embedded PowerPC systems, assume that the startup module is called
22689 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22690 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22695 On embedded PowerPC systems, assume that the startup module is called
22696 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22701 On embedded PowerPC systems, assume that the startup module is called
22702 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22705 @item -myellowknife
22706 @opindex myellowknife
22707 On embedded PowerPC systems, assume that the startup module is called
22708 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22713 On System V.4 and embedded PowerPC systems, specify that you are
22714 compiling for a VxWorks system.
22718 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22719 header to indicate that @samp{eabi} extended relocations are used.
22725 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22726 Embedded Applications Binary Interface (EABI), which is a set of
22727 modifications to the System V.4 specifications. Selecting @option{-meabi}
22728 means that the stack is aligned to an 8-byte boundary, a function
22729 @code{__eabi} is called from @code{main} to set up the EABI
22730 environment, and the @option{-msdata} option can use both @code{r2} and
22731 @code{r13} to point to two separate small data areas. Selecting
22732 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22733 no EABI initialization function is called from @code{main}, and the
22734 @option{-msdata} option only uses @code{r13} to point to a single
22735 small data area. The @option{-meabi} option is on by default if you
22736 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22739 @opindex msdata=eabi
22740 On System V.4 and embedded PowerPC systems, put small initialized
22741 @code{const} global and static data in the @code{.sdata2} section, which
22742 is pointed to by register @code{r2}. Put small initialized
22743 non-@code{const} global and static data in the @code{.sdata} section,
22744 which is pointed to by register @code{r13}. Put small uninitialized
22745 global and static data in the @code{.sbss} section, which is adjacent to
22746 the @code{.sdata} section. The @option{-msdata=eabi} option is
22747 incompatible with the @option{-mrelocatable} option. The
22748 @option{-msdata=eabi} option also sets the @option{-memb} option.
22751 @opindex msdata=sysv
22752 On System V.4 and embedded PowerPC systems, put small global and static
22753 data in the @code{.sdata} section, which is pointed to by register
22754 @code{r13}. Put small uninitialized global and static data in the
22755 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22756 The @option{-msdata=sysv} option is incompatible with the
22757 @option{-mrelocatable} option.
22759 @item -msdata=default
22761 @opindex msdata=default
22763 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22764 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22765 same as @option{-msdata=sysv}.
22768 @opindex msdata=data
22769 On System V.4 and embedded PowerPC systems, put small global
22770 data in the @code{.sdata} section. Put small uninitialized global
22771 data in the @code{.sbss} section. Do not use register @code{r13}
22772 to address small data however. This is the default behavior unless
22773 other @option{-msdata} options are used.
22777 @opindex msdata=none
22779 On embedded PowerPC systems, put all initialized global and static data
22780 in the @code{.data} section, and all uninitialized data in the
22781 @code{.bss} section.
22783 @item -mblock-move-inline-limit=@var{num}
22784 @opindex mblock-move-inline-limit
22785 Inline all block moves (such as calls to @code{memcpy} or structure
22786 copies) less than or equal to @var{num} bytes. The minimum value for
22787 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22788 targets. The default value is target-specific.
22792 @cindex smaller data references (PowerPC)
22793 @cindex .sdata/.sdata2 references (PowerPC)
22794 On embedded PowerPC systems, put global and static items less than or
22795 equal to @var{num} bytes into the small data or BSS sections instead of
22796 the normal data or BSS section. By default, @var{num} is 8. The
22797 @option{-G @var{num}} switch is also passed to the linker.
22798 All modules should be compiled with the same @option{-G @var{num}} value.
22801 @itemx -mno-regnames
22803 @opindex mno-regnames
22804 On System V.4 and embedded PowerPC systems do (do not) emit register
22805 names in the assembly language output using symbolic forms.
22808 @itemx -mno-longcall
22810 @opindex mno-longcall
22811 By default assume that all calls are far away so that a longer and more
22812 expensive calling sequence is required. This is required for calls
22813 farther than 32 megabytes (33,554,432 bytes) from the current location.
22814 A short call is generated if the compiler knows
22815 the call cannot be that far away. This setting can be overridden by
22816 the @code{shortcall} function attribute, or by @code{#pragma
22819 Some linkers are capable of detecting out-of-range calls and generating
22820 glue code on the fly. On these systems, long calls are unnecessary and
22821 generate slower code. As of this writing, the AIX linker can do this,
22822 as can the GNU linker for PowerPC/64. It is planned to add this feature
22823 to the GNU linker for 32-bit PowerPC systems as well.
22825 In the future, GCC may ignore all longcall specifications
22826 when the linker is known to generate glue.
22828 @item -mtls-markers
22829 @itemx -mno-tls-markers
22830 @opindex mtls-markers
22831 @opindex mno-tls-markers
22832 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22833 specifying the function argument. The relocation allows the linker to
22834 reliably associate function call with argument setup instructions for
22835 TLS optimization, which in turn allows GCC to better schedule the
22841 This option enables use of the reciprocal estimate and
22842 reciprocal square root estimate instructions with additional
22843 Newton-Raphson steps to increase precision instead of doing a divide or
22844 square root and divide for floating-point arguments. You should use
22845 the @option{-ffast-math} option when using @option{-mrecip} (or at
22846 least @option{-funsafe-math-optimizations},
22847 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22848 @option{-fno-trapping-math}). Note that while the throughput of the
22849 sequence is generally higher than the throughput of the non-reciprocal
22850 instruction, the precision of the sequence can be decreased by up to 2
22851 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22854 @item -mrecip=@var{opt}
22855 @opindex mrecip=opt
22856 This option controls which reciprocal estimate instructions
22857 may be used. @var{opt} is a comma-separated list of options, which may
22858 be preceded by a @code{!} to invert the option:
22863 Enable all estimate instructions.
22866 Enable the default instructions, equivalent to @option{-mrecip}.
22869 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22872 Enable the reciprocal approximation instructions for both
22873 single and double precision.
22876 Enable the single-precision reciprocal approximation instructions.
22879 Enable the double-precision reciprocal approximation instructions.
22882 Enable the reciprocal square root approximation instructions for both
22883 single and double precision.
22886 Enable the single-precision reciprocal square root approximation instructions.
22889 Enable the double-precision reciprocal square root approximation instructions.
22893 So, for example, @option{-mrecip=all,!rsqrtd} enables
22894 all of the reciprocal estimate instructions, except for the
22895 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22896 which handle the double-precision reciprocal square root calculations.
22898 @item -mrecip-precision
22899 @itemx -mno-recip-precision
22900 @opindex mrecip-precision
22901 Assume (do not assume) that the reciprocal estimate instructions
22902 provide higher-precision estimates than is mandated by the PowerPC
22903 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22904 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22905 The double-precision square root estimate instructions are not generated by
22906 default on low-precision machines, since they do not provide an
22907 estimate that converges after three steps.
22909 @item -mpointers-to-nested-functions
22910 @itemx -mno-pointers-to-nested-functions
22911 @opindex mpointers-to-nested-functions
22912 Generate (do not generate) code to load up the static chain register
22913 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22914 systems where a function pointer points to a 3-word descriptor giving
22915 the function address, TOC value to be loaded in register @code{r2}, and
22916 static chain value to be loaded in register @code{r11}. The
22917 @option{-mpointers-to-nested-functions} is on by default. You cannot
22918 call through pointers to nested functions or pointers
22919 to functions compiled in other languages that use the static chain if
22920 you use @option{-mno-pointers-to-nested-functions}.
22922 @item -msave-toc-indirect
22923 @itemx -mno-save-toc-indirect
22924 @opindex msave-toc-indirect
22925 Generate (do not generate) code to save the TOC value in the reserved
22926 stack location in the function prologue if the function calls through
22927 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22928 saved in the prologue, it is saved just before the call through the
22929 pointer. The @option{-mno-save-toc-indirect} option is the default.
22931 @item -mcompat-align-parm
22932 @itemx -mno-compat-align-parm
22933 @opindex mcompat-align-parm
22934 Generate (do not generate) code to pass structure parameters with a
22935 maximum alignment of 64 bits, for compatibility with older versions
22938 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22939 structure parameter on a 128-bit boundary when that structure contained
22940 a member requiring 128-bit alignment. This is corrected in more
22941 recent versions of GCC. This option may be used to generate code
22942 that is compatible with functions compiled with older versions of
22945 The @option{-mno-compat-align-parm} option is the default.
22947 @item -mstack-protector-guard=@var{guard}
22948 @itemx -mstack-protector-guard-reg=@var{reg}
22949 @itemx -mstack-protector-guard-offset=@var{offset}
22950 @itemx -mstack-protector-guard-symbol=@var{symbol}
22951 @opindex mstack-protector-guard
22952 @opindex mstack-protector-guard-reg
22953 @opindex mstack-protector-guard-offset
22954 @opindex mstack-protector-guard-symbol
22955 Generate stack protection code using canary at @var{guard}. Supported
22956 locations are @samp{global} for global canary or @samp{tls} for per-thread
22957 canary in the TLS block (the default with GNU libc version 2.4 or later).
22959 With the latter choice the options
22960 @option{-mstack-protector-guard-reg=@var{reg}} and
22961 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
22962 which register to use as base register for reading the canary, and from what
22963 offset from that base register. The default for those is as specified in the
22964 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
22965 the offset with a symbol reference to a canary in the TLS block.
22969 @node RISC-V Options
22970 @subsection RISC-V Options
22971 @cindex RISC-V Options
22973 These command-line options are defined for RISC-V targets:
22976 @item -mbranch-cost=@var{n}
22977 @opindex mbranch-cost
22978 Set the cost of branches to roughly @var{n} instructions.
22983 When generating PIC code, do or don't allow the use of PLTs. Ignored for
22984 non-PIC. The default is @option{-mplt}.
22986 @item -mabi=@var{ABI-string}
22988 Specify integer and floating-point calling convention. @var{ABI-string}
22989 contains two parts: the size of integer types and the registers used for
22990 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
22991 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
22992 32-bit), and that floating-point values up to 64 bits wide are passed in F
22993 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
22994 allows the compiler to generate code that uses the F and D extensions but only
22995 allows floating-point values up to 32 bits long to be passed in registers; or
22996 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
22997 passed in registers.
22999 The default for this argument is system dependent, users who want a specific
23000 calling convention should specify one explicitly. The valid calling
23001 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23002 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23003 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23004 invalid because the ABI requires 64-bit values be passed in F registers, but F
23005 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23006 only be used with the @samp{rv32e} architecture. This ABI is not well
23007 specified at present, and is subject to change.
23012 Do or don't use hardware floating-point divide and square root instructions.
23013 This requires the F or D extensions for floating-point registers. The default
23014 is to use them if the specified architecture has these instructions.
23019 Do or don't use hardware instructions for integer division. This requires the
23020 M extension. The default is to use them if the specified architecture has
23021 these instructions.
23023 @item -march=@var{ISA-string}
23025 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
23026 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23029 @item -mtune=@var{processor-string}
23031 Optimize the output for the given processor, specified by microarchitecture
23034 @item -mpreferred-stack-boundary=@var{num}
23035 @opindex mpreferred-stack-boundary
23036 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23037 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23038 the default is 4 (16 bytes or 128-bits).
23040 @strong{Warning:} If you use this switch, then you must build all modules with
23041 the same value, including any libraries. This includes the system libraries
23042 and startup modules.
23044 @item -msmall-data-limit=@var{n}
23045 @opindex msmall-data-limit
23046 Put global and static data smaller than @var{n} bytes into a special section
23049 @item -msave-restore
23050 @itemx -mno-save-restore
23051 @opindex msave-restore
23052 Do or don't use smaller but slower prologue and epilogue code that uses
23053 library function calls. The default is to use fast inline prologues and
23056 @item -mstrict-align
23057 @itemx -mno-strict-align
23058 @opindex mstrict-align
23059 Do not or do generate unaligned memory accesses. The default is set depending
23060 on whether the processor we are optimizing for supports fast unaligned access
23063 @item -mcmodel=medlow
23064 @opindex mcmodel=medlow
23065 Generate code for the medium-low code model. The program and its statically
23066 defined symbols must lie within a single 2 GiB address range and must lie
23067 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23068 statically or dynamically linked. This is the default code model.
23070 @item -mcmodel=medany
23071 @opindex mcmodel=medany
23072 Generate code for the medium-any code model. The program and its statically
23073 defined symbols must be within any single 2 GiB address range. Programs can be
23074 statically or dynamically linked.
23076 @item -mexplicit-relocs
23077 @itemx -mno-exlicit-relocs
23078 Use or do not use assembler relocation operators when dealing with symbolic
23079 addresses. The alternative is to use assembler macros instead, which may
23080 limit optimization.
23084 Take advantage of linker relaxations to reduce the number of instructions
23085 required to materialize symbol addresses. The default is to take advantage of
23086 linker relaxations.
23091 @subsection RL78 Options
23092 @cindex RL78 Options
23098 Links in additional target libraries to support operation within a
23107 Specifies the type of hardware multiplication and division support to
23108 be used. The simplest is @code{none}, which uses software for both
23109 multiplication and division. This is the default. The @code{g13}
23110 value is for the hardware multiply/divide peripheral found on the
23111 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23112 the multiplication and division instructions supported by the RL78/G14
23113 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23114 the value @code{mg10} is an alias for @code{none}.
23116 In addition a C preprocessor macro is defined, based upon the setting
23117 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23118 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23125 Specifies the RL78 core to target. The default is the G14 core, also
23126 known as an S3 core or just RL78. The G13 or S2 core does not have
23127 multiply or divide instructions, instead it uses a hardware peripheral
23128 for these operations. The G10 or S1 core does not have register
23129 banks, so it uses a different calling convention.
23131 If this option is set it also selects the type of hardware multiply
23132 support to use, unless this is overridden by an explicit
23133 @option{-mmul=none} option on the command line. Thus specifying
23134 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23135 peripheral and specifying @option{-mcpu=g10} disables the use of
23136 hardware multiplications altogether.
23138 Note, although the RL78/G14 core is the default target, specifying
23139 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23140 change the behavior of the toolchain since it also enables G14
23141 hardware multiply support. If these options are not specified on the
23142 command line then software multiplication routines will be used even
23143 though the code targets the RL78 core. This is for backwards
23144 compatibility with older toolchains which did not have hardware
23145 multiply and divide support.
23147 In addition a C preprocessor macro is defined, based upon the setting
23148 of this option. Possible values are: @code{__RL78_G10__},
23149 @code{__RL78_G13__} or @code{__RL78_G14__}.
23159 These are aliases for the corresponding @option{-mcpu=} option. They
23160 are provided for backwards compatibility.
23164 Allow the compiler to use all of the available registers. By default
23165 registers @code{r24..r31} are reserved for use in interrupt handlers.
23166 With this option enabled these registers can be used in ordinary
23169 @item -m64bit-doubles
23170 @itemx -m32bit-doubles
23171 @opindex m64bit-doubles
23172 @opindex m32bit-doubles
23173 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23174 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23175 @option{-m32bit-doubles}.
23177 @item -msave-mduc-in-interrupts
23178 @itemx -mno-save-mduc-in-interrupts
23179 @opindex msave-mduc-in-interrupts
23180 @opindex mno-save-mduc-in-interrupts
23181 Specifies that interrupt handler functions should preserve the
23182 MDUC registers. This is only necessary if normal code might use
23183 the MDUC registers, for example because it performs multiplication
23184 and division operations. The default is to ignore the MDUC registers
23185 as this makes the interrupt handlers faster. The target option -mg13
23186 needs to be passed for this to work as this feature is only available
23187 on the G13 target (S2 core). The MDUC registers will only be saved
23188 if the interrupt handler performs a multiplication or division
23189 operation or it calls another function.
23193 @node RS/6000 and PowerPC Options
23194 @subsection IBM RS/6000 and PowerPC Options
23195 @cindex RS/6000 and PowerPC Options
23196 @cindex IBM RS/6000 and PowerPC Options
23198 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23200 @item -mpowerpc-gpopt
23201 @itemx -mno-powerpc-gpopt
23202 @itemx -mpowerpc-gfxopt
23203 @itemx -mno-powerpc-gfxopt
23206 @itemx -mno-powerpc64
23210 @itemx -mno-popcntb
23212 @itemx -mno-popcntd
23221 @itemx -mno-hard-dfp
23222 @opindex mpowerpc-gpopt
23223 @opindex mno-powerpc-gpopt
23224 @opindex mpowerpc-gfxopt
23225 @opindex mno-powerpc-gfxopt
23226 @opindex mpowerpc64
23227 @opindex mno-powerpc64
23231 @opindex mno-popcntb
23233 @opindex mno-popcntd
23239 @opindex mno-mfpgpr
23241 @opindex mno-hard-dfp
23242 You use these options to specify which instructions are available on the
23243 processor you are using. The default value of these options is
23244 determined when configuring GCC@. Specifying the
23245 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23246 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23247 rather than the options listed above.
23249 Specifying @option{-mpowerpc-gpopt} allows
23250 GCC to use the optional PowerPC architecture instructions in the
23251 General Purpose group, including floating-point square root. Specifying
23252 @option{-mpowerpc-gfxopt} allows GCC to
23253 use the optional PowerPC architecture instructions in the Graphics
23254 group, including floating-point select.
23256 The @option{-mmfcrf} option allows GCC to generate the move from
23257 condition register field instruction implemented on the POWER4
23258 processor and other processors that support the PowerPC V2.01
23260 The @option{-mpopcntb} option allows GCC to generate the popcount and
23261 double-precision FP reciprocal estimate instruction implemented on the
23262 POWER5 processor and other processors that support the PowerPC V2.02
23264 The @option{-mpopcntd} option allows GCC to generate the popcount
23265 instruction implemented on the POWER7 processor and other processors
23266 that support the PowerPC V2.06 architecture.
23267 The @option{-mfprnd} option allows GCC to generate the FP round to
23268 integer instructions implemented on the POWER5+ processor and other
23269 processors that support the PowerPC V2.03 architecture.
23270 The @option{-mcmpb} option allows GCC to generate the compare bytes
23271 instruction implemented on the POWER6 processor and other processors
23272 that support the PowerPC V2.05 architecture.
23273 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23274 general-purpose register instructions implemented on the POWER6X
23275 processor and other processors that support the extended PowerPC V2.05
23277 The @option{-mhard-dfp} option allows GCC to generate the decimal
23278 floating-point instructions implemented on some POWER processors.
23280 The @option{-mpowerpc64} option allows GCC to generate the additional
23281 64-bit instructions that are found in the full PowerPC64 architecture
23282 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23283 @option{-mno-powerpc64}.
23285 @item -mcpu=@var{cpu_type}
23287 Set architecture type, register usage, and
23288 instruction scheduling parameters for machine type @var{cpu_type}.
23289 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23290 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23291 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23292 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23293 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23294 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23295 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23296 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23297 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23298 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23299 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23300 @samp{rs64}, and @samp{native}.
23302 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23303 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23304 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23305 architecture machine types, with an appropriate, generic processor
23306 model assumed for scheduling purposes.
23308 Specifying @samp{native} as cpu type detects and selects the
23309 architecture option that corresponds to the host processor of the
23310 system performing the compilation.
23311 @option{-mcpu=native} has no effect if GCC does not recognize the
23314 The other options specify a specific processor. Code generated under
23315 those options runs best on that processor, and may not run at all on
23318 The @option{-mcpu} options automatically enable or disable the
23321 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23322 -mpopcntb -mpopcntd -mpowerpc64 @gol
23323 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
23324 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23325 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
23326 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23328 The particular options set for any particular CPU varies between
23329 compiler versions, depending on what setting seems to produce optimal
23330 code for that CPU; it doesn't necessarily reflect the actual hardware's
23331 capabilities. If you wish to set an individual option to a particular
23332 value, you may specify it after the @option{-mcpu} option, like
23333 @option{-mcpu=970 -mno-altivec}.
23335 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23336 not enabled or disabled by the @option{-mcpu} option at present because
23337 AIX does not have full support for these options. You may still
23338 enable or disable them individually if you're sure it'll work in your
23341 @item -mtune=@var{cpu_type}
23343 Set the instruction scheduling parameters for machine type
23344 @var{cpu_type}, but do not set the architecture type or register usage,
23345 as @option{-mcpu=@var{cpu_type}} does. The same
23346 values for @var{cpu_type} are used for @option{-mtune} as for
23347 @option{-mcpu}. If both are specified, the code generated uses the
23348 architecture and registers set by @option{-mcpu}, but the
23349 scheduling parameters set by @option{-mtune}.
23351 @item -mcmodel=small
23352 @opindex mcmodel=small
23353 Generate PowerPC64 code for the small model: The TOC is limited to
23356 @item -mcmodel=medium
23357 @opindex mcmodel=medium
23358 Generate PowerPC64 code for the medium model: The TOC and other static
23359 data may be up to a total of 4G in size. This is the default for 64-bit
23362 @item -mcmodel=large
23363 @opindex mcmodel=large
23364 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23365 in size. Other data and code is only limited by the 64-bit address
23369 @itemx -mno-altivec
23371 @opindex mno-altivec
23372 Generate code that uses (does not use) AltiVec instructions, and also
23373 enable the use of built-in functions that allow more direct access to
23374 the AltiVec instruction set. You may also need to set
23375 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23378 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23379 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23380 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23381 match array element order corresponding to the endianness of the
23382 target. That is, element zero identifies the leftmost element in a
23383 vector register when targeting a big-endian platform, and identifies
23384 the rightmost element in a vector register when targeting a
23385 little-endian platform.
23388 @opindex maltivec=be
23389 Generate AltiVec instructions using big-endian element order,
23390 regardless of whether the target is big- or little-endian. This is
23391 the default when targeting a big-endian platform. Using this option
23392 is currently deprecated. Support for this feature will be removed in
23395 The element order is used to interpret element numbers in AltiVec
23396 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23397 @code{vec_insert}. By default, these match array element order
23398 corresponding to the endianness for the target.
23401 @opindex maltivec=le
23402 Generate AltiVec instructions using little-endian element order,
23403 regardless of whether the target is big- or little-endian. This is
23404 the default when targeting a little-endian platform. This option is
23405 currently ignored when targeting a big-endian platform.
23407 The element order is used to interpret element numbers in AltiVec
23408 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23409 @code{vec_insert}. By default, these match array element order
23410 corresponding to the endianness for the target.
23415 @opindex mno-vrsave
23416 Generate VRSAVE instructions when generating AltiVec code.
23419 @opindex msecure-plt
23420 Generate code that allows @command{ld} and @command{ld.so}
23421 to build executables and shared
23422 libraries with non-executable @code{.plt} and @code{.got} sections.
23424 32-bit SYSV ABI option.
23428 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23430 requires @code{.plt} and @code{.got}
23431 sections that are both writable and executable.
23432 This is a PowerPC 32-bit SYSV ABI option.
23438 This switch enables or disables the generation of ISEL instructions.
23440 @item -misel=@var{yes/no}
23441 This switch has been deprecated. Use @option{-misel} and
23442 @option{-mno-isel} instead.
23448 Generate code that uses (does not use) vector/scalar (VSX)
23449 instructions, and also enable the use of built-in functions that allow
23450 more direct access to the VSX instruction set.
23455 @opindex mno-crypto
23456 Enable the use (disable) of the built-in functions that allow direct
23457 access to the cryptographic instructions that were added in version
23458 2.07 of the PowerPC ISA.
23464 Enable (disable) the use of the built-in functions that allow direct
23465 access to the Hardware Transactional Memory (HTM) instructions that
23466 were added in version 2.07 of the PowerPC ISA.
23468 @item -mpower8-fusion
23469 @itemx -mno-power8-fusion
23470 @opindex mpower8-fusion
23471 @opindex mno-power8-fusion
23472 Generate code that keeps (does not keeps) some integer operations
23473 adjacent so that the instructions can be fused together on power8 and
23476 @item -mpower8-vector
23477 @itemx -mno-power8-vector
23478 @opindex mpower8-vector
23479 @opindex mno-power8-vector
23480 Generate code that uses (does not use) the vector and scalar
23481 instructions that were added in version 2.07 of the PowerPC ISA. Also
23482 enable the use of built-in functions that allow more direct access to
23483 the vector instructions.
23485 @item -mquad-memory
23486 @itemx -mno-quad-memory
23487 @opindex mquad-memory
23488 @opindex mno-quad-memory
23489 Generate code that uses (does not use) the non-atomic quad word memory
23490 instructions. The @option{-mquad-memory} option requires use of
23493 @item -mquad-memory-atomic
23494 @itemx -mno-quad-memory-atomic
23495 @opindex mquad-memory-atomic
23496 @opindex mno-quad-memory-atomic
23497 Generate code that uses (does not use) the atomic quad word memory
23498 instructions. The @option{-mquad-memory-atomic} option requires use of
23502 @itemx -mno-float128
23504 @opindex mno-float128
23505 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23506 and use either software emulation for IEEE 128-bit floating point or
23507 hardware instructions.
23509 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
23510 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
23511 use the IEEE 128-bit floating point support. The IEEE 128-bit
23512 floating point support only works on PowerPC Linux systems.
23514 The default for @option{-mfloat128} is enabled on PowerPC Linux
23515 systems using the VSX instruction set, and disabled on other systems.
23517 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
23518 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
23519 point support will also enable the generation of ISA 3.0 IEEE 128-bit
23520 floating point instructions. Otherwise, if you do not specify to
23521 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
23522 system, IEEE 128-bit floating point will be done with software
23525 @item -mfloat128-hardware
23526 @itemx -mno-float128-hardware
23527 @opindex mfloat128-hardware
23528 @opindex mno-float128-hardware
23529 Enable/disable using ISA 3.0 hardware instructions to support the
23530 @var{__float128} data type.
23532 The default for @option{-mfloat128-hardware} is enabled on PowerPC
23533 Linux systems using the ISA 3.0 instruction set, and disabled on other
23540 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23541 targets (including GNU/Linux). The 32-bit environment sets int, long
23542 and pointer to 32 bits and generates code that runs on any PowerPC
23543 variant. The 64-bit environment sets int to 32 bits and long and
23544 pointer to 64 bits, and generates code for PowerPC64, as for
23545 @option{-mpowerpc64}.
23548 @itemx -mno-fp-in-toc
23549 @itemx -mno-sum-in-toc
23550 @itemx -mminimal-toc
23552 @opindex mno-fp-in-toc
23553 @opindex mno-sum-in-toc
23554 @opindex mminimal-toc
23555 Modify generation of the TOC (Table Of Contents), which is created for
23556 every executable file. The @option{-mfull-toc} option is selected by
23557 default. In that case, GCC allocates at least one TOC entry for
23558 each unique non-automatic variable reference in your program. GCC
23559 also places floating-point constants in the TOC@. However, only
23560 16,384 entries are available in the TOC@.
23562 If you receive a linker error message that saying you have overflowed
23563 the available TOC space, you can reduce the amount of TOC space used
23564 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23565 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23566 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23567 generate code to calculate the sum of an address and a constant at
23568 run time instead of putting that sum into the TOC@. You may specify one
23569 or both of these options. Each causes GCC to produce very slightly
23570 slower and larger code at the expense of conserving TOC space.
23572 If you still run out of space in the TOC even when you specify both of
23573 these options, specify @option{-mminimal-toc} instead. This option causes
23574 GCC to make only one TOC entry for every file. When you specify this
23575 option, GCC produces code that is slower and larger but which
23576 uses extremely little TOC space. You may wish to use this option
23577 only on files that contain less frequently-executed code.
23583 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
23584 @code{long} type, and the infrastructure needed to support them.
23585 Specifying @option{-maix64} implies @option{-mpowerpc64},
23586 while @option{-maix32} disables the 64-bit ABI and
23587 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
23590 @itemx -mno-xl-compat
23591 @opindex mxl-compat
23592 @opindex mno-xl-compat
23593 Produce code that conforms more closely to IBM XL compiler semantics
23594 when using AIX-compatible ABI@. Pass floating-point arguments to
23595 prototyped functions beyond the register save area (RSA) on the stack
23596 in addition to argument FPRs. Do not assume that most significant
23597 double in 128-bit long double value is properly rounded when comparing
23598 values and converting to double. Use XL symbol names for long double
23601 The AIX calling convention was extended but not initially documented to
23602 handle an obscure K&R C case of calling a function that takes the
23603 address of its arguments with fewer arguments than declared. IBM XL
23604 compilers access floating-point arguments that do not fit in the
23605 RSA from the stack when a subroutine is compiled without
23606 optimization. Because always storing floating-point arguments on the
23607 stack is inefficient and rarely needed, this option is not enabled by
23608 default and only is necessary when calling subroutines compiled by IBM
23609 XL compilers without optimization.
23613 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
23614 application written to use message passing with special startup code to
23615 enable the application to run. The system must have PE installed in the
23616 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
23617 must be overridden with the @option{-specs=} option to specify the
23618 appropriate directory location. The Parallel Environment does not
23619 support threads, so the @option{-mpe} option and the @option{-pthread}
23620 option are incompatible.
23622 @item -malign-natural
23623 @itemx -malign-power
23624 @opindex malign-natural
23625 @opindex malign-power
23626 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23627 @option{-malign-natural} overrides the ABI-defined alignment of larger
23628 types, such as floating-point doubles, on their natural size-based boundary.
23629 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23630 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23632 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23636 @itemx -mhard-float
23637 @opindex msoft-float
23638 @opindex mhard-float
23639 Generate code that does not use (uses) the floating-point register set.
23640 Software floating-point emulation is provided if you use the
23641 @option{-msoft-float} option, and pass the option to GCC when linking.
23644 @itemx -mno-multiple
23646 @opindex mno-multiple
23647 Generate code that uses (does not use) the load multiple word
23648 instructions and the store multiple word instructions. These
23649 instructions are generated by default on POWER systems, and not
23650 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23651 PowerPC systems, since those instructions do not work when the
23652 processor is in little-endian mode. The exceptions are PPC740 and
23653 PPC750 which permit these instructions in little-endian mode.
23658 @opindex mno-update
23659 Generate code that uses (does not use) the load or store instructions
23660 that update the base register to the address of the calculated memory
23661 location. These instructions are generated by default. If you use
23662 @option{-mno-update}, there is a small window between the time that the
23663 stack pointer is updated and the address of the previous frame is
23664 stored, which means code that walks the stack frame across interrupts or
23665 signals may get corrupted data.
23667 @item -mavoid-indexed-addresses
23668 @itemx -mno-avoid-indexed-addresses
23669 @opindex mavoid-indexed-addresses
23670 @opindex mno-avoid-indexed-addresses
23671 Generate code that tries to avoid (not avoid) the use of indexed load
23672 or store instructions. These instructions can incur a performance
23673 penalty on Power6 processors in certain situations, such as when
23674 stepping through large arrays that cross a 16M boundary. This option
23675 is enabled by default when targeting Power6 and disabled otherwise.
23678 @itemx -mno-fused-madd
23679 @opindex mfused-madd
23680 @opindex mno-fused-madd
23681 Generate code that uses (does not use) the floating-point multiply and
23682 accumulate instructions. These instructions are generated by default
23683 if hardware floating point is used. The machine-dependent
23684 @option{-mfused-madd} option is now mapped to the machine-independent
23685 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23686 mapped to @option{-ffp-contract=off}.
23692 Generate code that uses (does not use) the half-word multiply and
23693 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
23694 These instructions are generated by default when targeting those
23701 Generate code that uses (does not use) the string-search @samp{dlmzb}
23702 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
23703 generated by default when targeting those processors.
23705 @item -mno-bit-align
23707 @opindex mno-bit-align
23708 @opindex mbit-align
23709 On System V.4 and embedded PowerPC systems do not (do) force structures
23710 and unions that contain bit-fields to be aligned to the base type of the
23713 For example, by default a structure containing nothing but 8
23714 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
23715 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
23716 the structure is aligned to a 1-byte boundary and is 1 byte in
23719 @item -mno-strict-align
23720 @itemx -mstrict-align
23721 @opindex mno-strict-align
23722 @opindex mstrict-align
23723 On System V.4 and embedded PowerPC systems do not (do) assume that
23724 unaligned memory references are handled by the system.
23726 @item -mrelocatable
23727 @itemx -mno-relocatable
23728 @opindex mrelocatable
23729 @opindex mno-relocatable
23730 Generate code that allows (does not allow) a static executable to be
23731 relocated to a different address at run time. A simple embedded
23732 PowerPC system loader should relocate the entire contents of
23733 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23734 a table of 32-bit addresses generated by this option. For this to
23735 work, all objects linked together must be compiled with
23736 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23737 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23739 @item -mrelocatable-lib
23740 @itemx -mno-relocatable-lib
23741 @opindex mrelocatable-lib
23742 @opindex mno-relocatable-lib
23743 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23744 @code{.fixup} section to allow static executables to be relocated at
23745 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23746 alignment of @option{-mrelocatable}. Objects compiled with
23747 @option{-mrelocatable-lib} may be linked with objects compiled with
23748 any combination of the @option{-mrelocatable} options.
23754 On System V.4 and embedded PowerPC systems do not (do) assume that
23755 register 2 contains a pointer to a global area pointing to the addresses
23756 used in the program.
23759 @itemx -mlittle-endian
23761 @opindex mlittle-endian
23762 On System V.4 and embedded PowerPC systems compile code for the
23763 processor in little-endian mode. The @option{-mlittle-endian} option is
23764 the same as @option{-mlittle}.
23767 @itemx -mbig-endian
23769 @opindex mbig-endian
23770 On System V.4 and embedded PowerPC systems compile code for the
23771 processor in big-endian mode. The @option{-mbig-endian} option is
23772 the same as @option{-mbig}.
23774 @item -mdynamic-no-pic
23775 @opindex mdynamic-no-pic
23776 On Darwin and Mac OS X systems, compile code so that it is not
23777 relocatable, but that its external references are relocatable. The
23778 resulting code is suitable for applications, but not shared
23781 @item -msingle-pic-base
23782 @opindex msingle-pic-base
23783 Treat the register used for PIC addressing as read-only, rather than
23784 loading it in the prologue for each function. The runtime system is
23785 responsible for initializing this register with an appropriate value
23786 before execution begins.
23788 @item -mprioritize-restricted-insns=@var{priority}
23789 @opindex mprioritize-restricted-insns
23790 This option controls the priority that is assigned to
23791 dispatch-slot restricted instructions during the second scheduling
23792 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23793 or @samp{2} to assign no, highest, or second-highest (respectively)
23794 priority to dispatch-slot restricted
23797 @item -msched-costly-dep=@var{dependence_type}
23798 @opindex msched-costly-dep
23799 This option controls which dependences are considered costly
23800 by the target during instruction scheduling. The argument
23801 @var{dependence_type} takes one of the following values:
23805 No dependence is costly.
23808 All dependences are costly.
23810 @item @samp{true_store_to_load}
23811 A true dependence from store to load is costly.
23813 @item @samp{store_to_load}
23814 Any dependence from store to load is costly.
23817 Any dependence for which the latency is greater than or equal to
23818 @var{number} is costly.
23821 @item -minsert-sched-nops=@var{scheme}
23822 @opindex minsert-sched-nops
23823 This option controls which NOP insertion scheme is used during
23824 the second scheduling pass. The argument @var{scheme} takes one of the
23832 Pad with NOPs any dispatch group that has vacant issue slots,
23833 according to the scheduler's grouping.
23835 @item @samp{regroup_exact}
23836 Insert NOPs to force costly dependent insns into
23837 separate groups. Insert exactly as many NOPs as needed to force an insn
23838 to a new group, according to the estimated processor grouping.
23841 Insert NOPs to force costly dependent insns into
23842 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23846 @opindex mcall-sysv
23847 On System V.4 and embedded PowerPC systems compile code using calling
23848 conventions that adhere to the March 1995 draft of the System V
23849 Application Binary Interface, PowerPC processor supplement. This is the
23850 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23852 @item -mcall-sysv-eabi
23854 @opindex mcall-sysv-eabi
23855 @opindex mcall-eabi
23856 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23858 @item -mcall-sysv-noeabi
23859 @opindex mcall-sysv-noeabi
23860 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23862 @item -mcall-aixdesc
23864 On System V.4 and embedded PowerPC systems compile code for the AIX
23868 @opindex mcall-linux
23869 On System V.4 and embedded PowerPC systems compile code for the
23870 Linux-based GNU system.
23872 @item -mcall-freebsd
23873 @opindex mcall-freebsd
23874 On System V.4 and embedded PowerPC systems compile code for the
23875 FreeBSD operating system.
23877 @item -mcall-netbsd
23878 @opindex mcall-netbsd
23879 On System V.4 and embedded PowerPC systems compile code for the
23880 NetBSD operating system.
23882 @item -mcall-openbsd
23883 @opindex mcall-netbsd
23884 On System V.4 and embedded PowerPC systems compile code for the
23885 OpenBSD operating system.
23887 @item -mtraceback=@var{traceback_type}
23888 @opindex mtraceback
23889 Select the type of traceback table. Valid values for @var{traceback_type}
23890 are @samp{full}, @samp{part}, and @samp{no}.
23892 @item -maix-struct-return
23893 @opindex maix-struct-return
23894 Return all structures in memory (as specified by the AIX ABI)@.
23896 @item -msvr4-struct-return
23897 @opindex msvr4-struct-return
23898 Return structures smaller than 8 bytes in registers (as specified by the
23901 @item -mabi=@var{abi-type}
23903 Extend the current ABI with a particular extension, or remove such extension.
23904 Valid values are @samp{altivec}, @samp{no-altivec},
23905 @samp{ibmlongdouble}, @samp{ieeelongdouble},
23906 @samp{elfv1}, @samp{elfv2}@.
23908 @item -mabi=ibmlongdouble
23909 @opindex mabi=ibmlongdouble
23910 Change the current ABI to use IBM extended-precision long double.
23911 This is not likely to work if your system defaults to using IEEE
23912 extended-precision long double. If you change the long double type
23913 from IEEE extended-precision, the compiler will issue a warning unless
23914 you use the @option{-Wno-psabi} option.
23916 @item -mabi=ieeelongdouble
23917 @opindex mabi=ieeelongdouble
23918 Change the current ABI to use IEEE extended-precision long double.
23919 This is not likely to work if your system defaults to using IBM
23920 extended-precision long double. If you change the long double type
23921 from IBM extended-precision, the compiler will issue a warning unless
23922 you use the @option{-Wno-psabi} option.
23925 @opindex mabi=elfv1
23926 Change the current ABI to use the ELFv1 ABI.
23927 This is the default ABI for big-endian PowerPC 64-bit Linux.
23928 Overriding the default ABI requires special system support and is
23929 likely to fail in spectacular ways.
23932 @opindex mabi=elfv2
23933 Change the current ABI to use the ELFv2 ABI.
23934 This is the default ABI for little-endian PowerPC 64-bit Linux.
23935 Overriding the default ABI requires special system support and is
23936 likely to fail in spectacular ways.
23938 @item -mgnu-attribute
23939 @itemx -mno-gnu-attribute
23940 @opindex mgnu-attribute
23941 @opindex mno-gnu-attribute
23942 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23943 .gnu.attributes section that specify ABI variations in function
23944 parameters or return values.
23947 @itemx -mno-prototype
23948 @opindex mprototype
23949 @opindex mno-prototype
23950 On System V.4 and embedded PowerPC systems assume that all calls to
23951 variable argument functions are properly prototyped. Otherwise, the
23952 compiler must insert an instruction before every non-prototyped call to
23953 set or clear bit 6 of the condition code register (@code{CR}) to
23954 indicate whether floating-point values are passed in the floating-point
23955 registers in case the function takes variable arguments. With
23956 @option{-mprototype}, only calls to prototyped variable argument functions
23957 set or clear the bit.
23961 On embedded PowerPC systems, assume that the startup module is called
23962 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23963 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23968 On embedded PowerPC systems, assume that the startup module is called
23969 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23974 On embedded PowerPC systems, assume that the startup module is called
23975 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23978 @item -myellowknife
23979 @opindex myellowknife
23980 On embedded PowerPC systems, assume that the startup module is called
23981 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23986 On System V.4 and embedded PowerPC systems, specify that you are
23987 compiling for a VxWorks system.
23991 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23992 header to indicate that @samp{eabi} extended relocations are used.
23998 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23999 Embedded Applications Binary Interface (EABI), which is a set of
24000 modifications to the System V.4 specifications. Selecting @option{-meabi}
24001 means that the stack is aligned to an 8-byte boundary, a function
24002 @code{__eabi} is called from @code{main} to set up the EABI
24003 environment, and the @option{-msdata} option can use both @code{r2} and
24004 @code{r13} to point to two separate small data areas. Selecting
24005 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24006 no EABI initialization function is called from @code{main}, and the
24007 @option{-msdata} option only uses @code{r13} to point to a single
24008 small data area. The @option{-meabi} option is on by default if you
24009 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24012 @opindex msdata=eabi
24013 On System V.4 and embedded PowerPC systems, put small initialized
24014 @code{const} global and static data in the @code{.sdata2} section, which
24015 is pointed to by register @code{r2}. Put small initialized
24016 non-@code{const} global and static data in the @code{.sdata} section,
24017 which is pointed to by register @code{r13}. Put small uninitialized
24018 global and static data in the @code{.sbss} section, which is adjacent to
24019 the @code{.sdata} section. The @option{-msdata=eabi} option is
24020 incompatible with the @option{-mrelocatable} option. The
24021 @option{-msdata=eabi} option also sets the @option{-memb} option.
24024 @opindex msdata=sysv
24025 On System V.4 and embedded PowerPC systems, put small global and static
24026 data in the @code{.sdata} section, which is pointed to by register
24027 @code{r13}. Put small uninitialized global and static data in the
24028 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24029 The @option{-msdata=sysv} option is incompatible with the
24030 @option{-mrelocatable} option.
24032 @item -msdata=default
24034 @opindex msdata=default
24036 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24037 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24038 same as @option{-msdata=sysv}.
24041 @opindex msdata=data
24042 On System V.4 and embedded PowerPC systems, put small global
24043 data in the @code{.sdata} section. Put small uninitialized global
24044 data in the @code{.sbss} section. Do not use register @code{r13}
24045 to address small data however. This is the default behavior unless
24046 other @option{-msdata} options are used.
24050 @opindex msdata=none
24052 On embedded PowerPC systems, put all initialized global and static data
24053 in the @code{.data} section, and all uninitialized data in the
24054 @code{.bss} section.
24056 @item -mreadonly-in-sdata
24057 @opindex mreadonly-in-sdata
24058 @opindex mno-readonly-in-sdata
24059 Put read-only objects in the @code{.sdata} section as well. This is the
24062 @item -mblock-move-inline-limit=@var{num}
24063 @opindex mblock-move-inline-limit
24064 Inline all block moves (such as calls to @code{memcpy} or structure
24065 copies) less than or equal to @var{num} bytes. The minimum value for
24066 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24067 targets. The default value is target-specific.
24069 @item -mblock-compare-inline-limit=@var{num}
24070 @opindex mblock-compare-inline-limit
24071 Generate non-looping inline code for all block compares (such as calls
24072 to @code{memcmp} or structure compares) less than or equal to @var{num}
24073 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24074 block compare is disabled. The default value is target-specific.
24076 @item -mblock-compare-inline-loop-limit=@var{num}
24077 @opindex mblock-compare-inline-loop-limit
24078 Generate an inline expansion using loop code for all block compares that
24079 are less than or equal to @var{num} bytes, but greater than the limit
24080 for non-loop inline block compare expansion. If the block length is not
24081 constant, at most @var{num} bytes will be compared before @code{memcmp}
24082 is called to compare the remainder of the block. The default value is
24085 @item -mstring-compare-inline-limit=@var{num}
24086 @opindex mstring-compare-inline-limit
24087 Generate at most @var{num} pairs of load instructions to compare the
24088 string inline. If the difference or end of string is not found at the
24089 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24090 take care of the rest of the comparison. The default is 8 pairs of
24091 loads, which will compare 64 bytes on a 64-bit target and 32 bytes on a
24096 @cindex smaller data references (PowerPC)
24097 @cindex .sdata/.sdata2 references (PowerPC)
24098 On embedded PowerPC systems, put global and static items less than or
24099 equal to @var{num} bytes into the small data or BSS sections instead of
24100 the normal data or BSS section. By default, @var{num} is 8. The
24101 @option{-G @var{num}} switch is also passed to the linker.
24102 All modules should be compiled with the same @option{-G @var{num}} value.
24105 @itemx -mno-regnames
24107 @opindex mno-regnames
24108 On System V.4 and embedded PowerPC systems do (do not) emit register
24109 names in the assembly language output using symbolic forms.
24112 @itemx -mno-longcall
24114 @opindex mno-longcall
24115 By default assume that all calls are far away so that a longer and more
24116 expensive calling sequence is required. This is required for calls
24117 farther than 32 megabytes (33,554,432 bytes) from the current location.
24118 A short call is generated if the compiler knows
24119 the call cannot be that far away. This setting can be overridden by
24120 the @code{shortcall} function attribute, or by @code{#pragma
24123 Some linkers are capable of detecting out-of-range calls and generating
24124 glue code on the fly. On these systems, long calls are unnecessary and
24125 generate slower code. As of this writing, the AIX linker can do this,
24126 as can the GNU linker for PowerPC/64. It is planned to add this feature
24127 to the GNU linker for 32-bit PowerPC systems as well.
24129 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24130 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24131 addresses represent the callee and the branch island. The
24132 Darwin/PPC linker prefers the first address and generates a @code{bl
24133 callee} if the PPC @code{bl} instruction reaches the callee directly;
24134 otherwise, the linker generates @code{bl L42} to call the branch
24135 island. The branch island is appended to the body of the
24136 calling function; it computes the full 32-bit address of the callee
24139 On Mach-O (Darwin) systems, this option directs the compiler emit to
24140 the glue for every direct call, and the Darwin linker decides whether
24141 to use or discard it.
24143 In the future, GCC may ignore all longcall specifications
24144 when the linker is known to generate glue.
24146 @item -mtls-markers
24147 @itemx -mno-tls-markers
24148 @opindex mtls-markers
24149 @opindex mno-tls-markers
24150 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24151 specifying the function argument. The relocation allows the linker to
24152 reliably associate function call with argument setup instructions for
24153 TLS optimization, which in turn allows GCC to better schedule the
24159 This option enables use of the reciprocal estimate and
24160 reciprocal square root estimate instructions with additional
24161 Newton-Raphson steps to increase precision instead of doing a divide or
24162 square root and divide for floating-point arguments. You should use
24163 the @option{-ffast-math} option when using @option{-mrecip} (or at
24164 least @option{-funsafe-math-optimizations},
24165 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24166 @option{-fno-trapping-math}). Note that while the throughput of the
24167 sequence is generally higher than the throughput of the non-reciprocal
24168 instruction, the precision of the sequence can be decreased by up to 2
24169 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24172 @item -mrecip=@var{opt}
24173 @opindex mrecip=opt
24174 This option controls which reciprocal estimate instructions
24175 may be used. @var{opt} is a comma-separated list of options, which may
24176 be preceded by a @code{!} to invert the option:
24181 Enable all estimate instructions.
24184 Enable the default instructions, equivalent to @option{-mrecip}.
24187 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24190 Enable the reciprocal approximation instructions for both
24191 single and double precision.
24194 Enable the single-precision reciprocal approximation instructions.
24197 Enable the double-precision reciprocal approximation instructions.
24200 Enable the reciprocal square root approximation instructions for both
24201 single and double precision.
24204 Enable the single-precision reciprocal square root approximation instructions.
24207 Enable the double-precision reciprocal square root approximation instructions.
24211 So, for example, @option{-mrecip=all,!rsqrtd} enables
24212 all of the reciprocal estimate instructions, except for the
24213 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24214 which handle the double-precision reciprocal square root calculations.
24216 @item -mrecip-precision
24217 @itemx -mno-recip-precision
24218 @opindex mrecip-precision
24219 Assume (do not assume) that the reciprocal estimate instructions
24220 provide higher-precision estimates than is mandated by the PowerPC
24221 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24222 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24223 The double-precision square root estimate instructions are not generated by
24224 default on low-precision machines, since they do not provide an
24225 estimate that converges after three steps.
24227 @item -mveclibabi=@var{type}
24228 @opindex mveclibabi
24229 Specifies the ABI type to use for vectorizing intrinsics using an
24230 external library. The only type supported at present is @samp{mass},
24231 which specifies to use IBM's Mathematical Acceleration Subsystem
24232 (MASS) libraries for vectorizing intrinsics using external libraries.
24233 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24234 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24235 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24236 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24237 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24238 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24239 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24240 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24241 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24242 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24243 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24244 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24245 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24246 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24247 for power7. Both @option{-ftree-vectorize} and
24248 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24249 libraries must be specified at link time.
24254 Generate (do not generate) the @code{friz} instruction when the
24255 @option{-funsafe-math-optimizations} option is used to optimize
24256 rounding of floating-point values to 64-bit integer and back to floating
24257 point. The @code{friz} instruction does not return the same value if
24258 the floating-point number is too large to fit in an integer.
24260 @item -mpointers-to-nested-functions
24261 @itemx -mno-pointers-to-nested-functions
24262 @opindex mpointers-to-nested-functions
24263 Generate (do not generate) code to load up the static chain register
24264 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24265 systems where a function pointer points to a 3-word descriptor giving
24266 the function address, TOC value to be loaded in register @code{r2}, and
24267 static chain value to be loaded in register @code{r11}. The
24268 @option{-mpointers-to-nested-functions} is on by default. You cannot
24269 call through pointers to nested functions or pointers
24270 to functions compiled in other languages that use the static chain if
24271 you use @option{-mno-pointers-to-nested-functions}.
24273 @item -msave-toc-indirect
24274 @itemx -mno-save-toc-indirect
24275 @opindex msave-toc-indirect
24276 Generate (do not generate) code to save the TOC value in the reserved
24277 stack location in the function prologue if the function calls through
24278 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24279 saved in the prologue, it is saved just before the call through the
24280 pointer. The @option{-mno-save-toc-indirect} option is the default.
24282 @item -mcompat-align-parm
24283 @itemx -mno-compat-align-parm
24284 @opindex mcompat-align-parm
24285 Generate (do not generate) code to pass structure parameters with a
24286 maximum alignment of 64 bits, for compatibility with older versions
24289 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24290 structure parameter on a 128-bit boundary when that structure contained
24291 a member requiring 128-bit alignment. This is corrected in more
24292 recent versions of GCC. This option may be used to generate code
24293 that is compatible with functions compiled with older versions of
24296 The @option{-mno-compat-align-parm} option is the default.
24298 @item -mstack-protector-guard=@var{guard}
24299 @itemx -mstack-protector-guard-reg=@var{reg}
24300 @itemx -mstack-protector-guard-offset=@var{offset}
24301 @itemx -mstack-protector-guard-symbol=@var{symbol}
24302 @opindex mstack-protector-guard
24303 @opindex mstack-protector-guard-reg
24304 @opindex mstack-protector-guard-offset
24305 @opindex mstack-protector-guard-symbol
24306 Generate stack protection code using canary at @var{guard}. Supported
24307 locations are @samp{global} for global canary or @samp{tls} for per-thread
24308 canary in the TLS block (the default with GNU libc version 2.4 or later).
24310 With the latter choice the options
24311 @option{-mstack-protector-guard-reg=@var{reg}} and
24312 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24313 which register to use as base register for reading the canary, and from what
24314 offset from that base register. The default for those is as specified in the
24315 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24316 the offset with a symbol reference to a canary in the TLS block.
24320 @subsection RX Options
24323 These command-line options are defined for RX targets:
24326 @item -m64bit-doubles
24327 @itemx -m32bit-doubles
24328 @opindex m64bit-doubles
24329 @opindex m32bit-doubles
24330 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24331 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24332 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24333 works on 32-bit values, which is why the default is
24334 @option{-m32bit-doubles}.
24340 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24341 floating-point hardware. The default is enabled for the RX600
24342 series and disabled for the RX200 series.
24344 Floating-point instructions are only generated for 32-bit floating-point
24345 values, however, so the FPU hardware is not used for doubles if the
24346 @option{-m64bit-doubles} option is used.
24348 @emph{Note} If the @option{-fpu} option is enabled then
24349 @option{-funsafe-math-optimizations} is also enabled automatically.
24350 This is because the RX FPU instructions are themselves unsafe.
24352 @item -mcpu=@var{name}
24354 Selects the type of RX CPU to be targeted. Currently three types are
24355 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24356 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24358 The only difference between @samp{RX600} and @samp{RX610} is that the
24359 @samp{RX610} does not support the @code{MVTIPL} instruction.
24361 The @samp{RX200} series does not have a hardware floating-point unit
24362 and so @option{-nofpu} is enabled by default when this type is
24365 @item -mbig-endian-data
24366 @itemx -mlittle-endian-data
24367 @opindex mbig-endian-data
24368 @opindex mlittle-endian-data
24369 Store data (but not code) in the big-endian format. The default is
24370 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24373 @item -msmall-data-limit=@var{N}
24374 @opindex msmall-data-limit
24375 Specifies the maximum size in bytes of global and static variables
24376 which can be placed into the small data area. Using the small data
24377 area can lead to smaller and faster code, but the size of area is
24378 limited and it is up to the programmer to ensure that the area does
24379 not overflow. Also when the small data area is used one of the RX's
24380 registers (usually @code{r13}) is reserved for use pointing to this
24381 area, so it is no longer available for use by the compiler. This
24382 could result in slower and/or larger code if variables are pushed onto
24383 the stack instead of being held in this register.
24385 Note, common variables (variables that have not been initialized) and
24386 constants are not placed into the small data area as they are assigned
24387 to other sections in the output executable.
24389 The default value is zero, which disables this feature. Note, this
24390 feature is not enabled by default with higher optimization levels
24391 (@option{-O2} etc) because of the potentially detrimental effects of
24392 reserving a register. It is up to the programmer to experiment and
24393 discover whether this feature is of benefit to their program. See the
24394 description of the @option{-mpid} option for a description of how the
24395 actual register to hold the small data area pointer is chosen.
24401 Use the simulator runtime. The default is to use the libgloss
24402 board-specific runtime.
24404 @item -mas100-syntax
24405 @itemx -mno-as100-syntax
24406 @opindex mas100-syntax
24407 @opindex mno-as100-syntax
24408 When generating assembler output use a syntax that is compatible with
24409 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24410 assembler, but it has some restrictions so it is not generated by default.
24412 @item -mmax-constant-size=@var{N}
24413 @opindex mmax-constant-size
24414 Specifies the maximum size, in bytes, of a constant that can be used as
24415 an operand in a RX instruction. Although the RX instruction set does
24416 allow constants of up to 4 bytes in length to be used in instructions,
24417 a longer value equates to a longer instruction. Thus in some
24418 circumstances it can be beneficial to restrict the size of constants
24419 that are used in instructions. Constants that are too big are instead
24420 placed into a constant pool and referenced via register indirection.
24422 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24423 or 4 means that constants of any size are allowed.
24427 Enable linker relaxation. Linker relaxation is a process whereby the
24428 linker attempts to reduce the size of a program by finding shorter
24429 versions of various instructions. Disabled by default.
24431 @item -mint-register=@var{N}
24432 @opindex mint-register
24433 Specify the number of registers to reserve for fast interrupt handler
24434 functions. The value @var{N} can be between 0 and 4. A value of 1
24435 means that register @code{r13} is reserved for the exclusive use
24436 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24437 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24438 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24439 A value of 0, the default, does not reserve any registers.
24441 @item -msave-acc-in-interrupts
24442 @opindex msave-acc-in-interrupts
24443 Specifies that interrupt handler functions should preserve the
24444 accumulator register. This is only necessary if normal code might use
24445 the accumulator register, for example because it performs 64-bit
24446 multiplications. The default is to ignore the accumulator as this
24447 makes the interrupt handlers faster.
24453 Enables the generation of position independent data. When enabled any
24454 access to constant data is done via an offset from a base address
24455 held in a register. This allows the location of constant data to be
24456 determined at run time without requiring the executable to be
24457 relocated, which is a benefit to embedded applications with tight
24458 memory constraints. Data that can be modified is not affected by this
24461 Note, using this feature reserves a register, usually @code{r13}, for
24462 the constant data base address. This can result in slower and/or
24463 larger code, especially in complicated functions.
24465 The actual register chosen to hold the constant data base address
24466 depends upon whether the @option{-msmall-data-limit} and/or the
24467 @option{-mint-register} command-line options are enabled. Starting
24468 with register @code{r13} and proceeding downwards, registers are
24469 allocated first to satisfy the requirements of @option{-mint-register},
24470 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24471 is possible for the small data area register to be @code{r8} if both
24472 @option{-mint-register=4} and @option{-mpid} are specified on the
24475 By default this feature is not enabled. The default can be restored
24476 via the @option{-mno-pid} command-line option.
24478 @item -mno-warn-multiple-fast-interrupts
24479 @itemx -mwarn-multiple-fast-interrupts
24480 @opindex mno-warn-multiple-fast-interrupts
24481 @opindex mwarn-multiple-fast-interrupts
24482 Prevents GCC from issuing a warning message if it finds more than one
24483 fast interrupt handler when it is compiling a file. The default is to
24484 issue a warning for each extra fast interrupt handler found, as the RX
24485 only supports one such interrupt.
24487 @item -mallow-string-insns
24488 @itemx -mno-allow-string-insns
24489 @opindex mallow-string-insns
24490 @opindex mno-allow-string-insns
24491 Enables or disables the use of the string manipulation instructions
24492 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24493 @code{SWHILE} and also the @code{RMPA} instruction. These
24494 instructions may prefetch data, which is not safe to do if accessing
24495 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24496 for more information).
24498 The default is to allow these instructions, but it is not possible for
24499 GCC to reliably detect all circumstances where a string instruction
24500 might be used to access an I/O register, so their use cannot be
24501 disabled automatically. Instead it is reliant upon the programmer to
24502 use the @option{-mno-allow-string-insns} option if their program
24503 accesses I/O space.
24505 When the instructions are enabled GCC defines the C preprocessor
24506 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
24507 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
24513 Use only (or not only) @code{JSR} instructions to access functions.
24514 This option can be used when code size exceeds the range of @code{BSR}
24515 instructions. Note that @option{-mno-jsr} does not mean to not use
24516 @code{JSR} but instead means that any type of branch may be used.
24519 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
24520 has special significance to the RX port when used with the
24521 @code{interrupt} function attribute. This attribute indicates a
24522 function intended to process fast interrupts. GCC ensures
24523 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
24524 and/or @code{r13} and only provided that the normal use of the
24525 corresponding registers have been restricted via the
24526 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
24529 @node S/390 and zSeries Options
24530 @subsection S/390 and zSeries Options
24531 @cindex S/390 and zSeries Options
24533 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
24537 @itemx -msoft-float
24538 @opindex mhard-float
24539 @opindex msoft-float
24540 Use (do not use) the hardware floating-point instructions and registers
24541 for floating-point operations. When @option{-msoft-float} is specified,
24542 functions in @file{libgcc.a} are used to perform floating-point
24543 operations. When @option{-mhard-float} is specified, the compiler
24544 generates IEEE floating-point instructions. This is the default.
24547 @itemx -mno-hard-dfp
24549 @opindex mno-hard-dfp
24550 Use (do not use) the hardware decimal-floating-point instructions for
24551 decimal-floating-point operations. When @option{-mno-hard-dfp} is
24552 specified, functions in @file{libgcc.a} are used to perform
24553 decimal-floating-point operations. When @option{-mhard-dfp} is
24554 specified, the compiler generates decimal-floating-point hardware
24555 instructions. This is the default for @option{-march=z9-ec} or higher.
24557 @item -mlong-double-64
24558 @itemx -mlong-double-128
24559 @opindex mlong-double-64
24560 @opindex mlong-double-128
24561 These switches control the size of @code{long double} type. A size
24562 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24563 type. This is the default.
24566 @itemx -mno-backchain
24567 @opindex mbackchain
24568 @opindex mno-backchain
24569 Store (do not store) the address of the caller's frame as backchain pointer
24570 into the callee's stack frame.
24571 A backchain may be needed to allow debugging using tools that do not understand
24572 DWARF call frame information.
24573 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
24574 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
24575 the backchain is placed into the topmost word of the 96/160 byte register
24578 In general, code compiled with @option{-mbackchain} is call-compatible with
24579 code compiled with @option{-mmo-backchain}; however, use of the backchain
24580 for debugging purposes usually requires that the whole binary is built with
24581 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
24582 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24583 to build a linux kernel use @option{-msoft-float}.
24585 The default is to not maintain the backchain.
24587 @item -mpacked-stack
24588 @itemx -mno-packed-stack
24589 @opindex mpacked-stack
24590 @opindex mno-packed-stack
24591 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
24592 specified, the compiler uses the all fields of the 96/160 byte register save
24593 area only for their default purpose; unused fields still take up stack space.
24594 When @option{-mpacked-stack} is specified, register save slots are densely
24595 packed at the top of the register save area; unused space is reused for other
24596 purposes, allowing for more efficient use of the available stack space.
24597 However, when @option{-mbackchain} is also in effect, the topmost word of
24598 the save area is always used to store the backchain, and the return address
24599 register is always saved two words below the backchain.
24601 As long as the stack frame backchain is not used, code generated with
24602 @option{-mpacked-stack} is call-compatible with code generated with
24603 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
24604 S/390 or zSeries generated code that uses the stack frame backchain at run
24605 time, not just for debugging purposes. Such code is not call-compatible
24606 with code compiled with @option{-mpacked-stack}. Also, note that the
24607 combination of @option{-mbackchain},
24608 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24609 to build a linux kernel use @option{-msoft-float}.
24611 The default is to not use the packed stack layout.
24614 @itemx -mno-small-exec
24615 @opindex msmall-exec
24616 @opindex mno-small-exec
24617 Generate (or do not generate) code using the @code{bras} instruction
24618 to do subroutine calls.
24619 This only works reliably if the total executable size does not
24620 exceed 64k. The default is to use the @code{basr} instruction instead,
24621 which does not have this limitation.
24627 When @option{-m31} is specified, generate code compliant to the
24628 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
24629 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
24630 particular to generate 64-bit instructions. For the @samp{s390}
24631 targets, the default is @option{-m31}, while the @samp{s390x}
24632 targets default to @option{-m64}.
24638 When @option{-mzarch} is specified, generate code using the
24639 instructions available on z/Architecture.
24640 When @option{-mesa} is specified, generate code using the
24641 instructions available on ESA/390. Note that @option{-mesa} is
24642 not possible with @option{-m64}.
24643 When generating code compliant to the GNU/Linux for S/390 ABI,
24644 the default is @option{-mesa}. When generating code compliant
24645 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
24651 The @option{-mhtm} option enables a set of builtins making use of
24652 instructions available with the transactional execution facility
24653 introduced with the IBM zEnterprise EC12 machine generation
24654 @ref{S/390 System z Built-in Functions}.
24655 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
24661 When @option{-mvx} is specified, generate code using the instructions
24662 available with the vector extension facility introduced with the IBM
24663 z13 machine generation.
24664 This option changes the ABI for some vector type values with regard to
24665 alignment and calling conventions. In case vector type values are
24666 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
24667 command will be added to mark the resulting binary with the ABI used.
24668 @option{-mvx} is enabled by default when using @option{-march=z13}.
24671 @itemx -mno-zvector
24673 @opindex mno-zvector
24674 The @option{-mzvector} option enables vector language extensions and
24675 builtins using instructions available with the vector extension
24676 facility introduced with the IBM z13 machine generation.
24677 This option adds support for @samp{vector} to be used as a keyword to
24678 define vector type variables and arguments. @samp{vector} is only
24679 available when GNU extensions are enabled. It will not be expanded
24680 when requesting strict standard compliance e.g. with @option{-std=c99}.
24681 In addition to the GCC low-level builtins @option{-mzvector} enables
24682 a set of builtins added for compatibility with AltiVec-style
24683 implementations like Power and Cell. In order to make use of these
24684 builtins the header file @file{vecintrin.h} needs to be included.
24685 @option{-mzvector} is disabled by default.
24691 Generate (or do not generate) code using the @code{mvcle} instruction
24692 to perform block moves. When @option{-mno-mvcle} is specified,
24693 use a @code{mvc} loop instead. This is the default unless optimizing for
24700 Print (or do not print) additional debug information when compiling.
24701 The default is to not print debug information.
24703 @item -march=@var{cpu-type}
24705 Generate code that runs on @var{cpu-type}, which is the name of a
24706 system representing a certain processor type. Possible values for
24707 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
24708 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
24709 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
24712 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
24713 @samp{g6} are deprecated and will be removed with future releases.
24715 Specifying @samp{native} as cpu type can be used to select the best
24716 architecture option for the host processor.
24717 @option{-march=native} has no effect if GCC does not recognize the
24720 @item -mtune=@var{cpu-type}
24722 Tune to @var{cpu-type} everything applicable about the generated code,
24723 except for the ABI and the set of available instructions.
24724 The list of @var{cpu-type} values is the same as for @option{-march}.
24725 The default is the value used for @option{-march}.
24728 @itemx -mno-tpf-trace
24729 @opindex mtpf-trace
24730 @opindex mno-tpf-trace
24731 Generate code that adds (does not add) in TPF OS specific branches to trace
24732 routines in the operating system. This option is off by default, even
24733 when compiling for the TPF OS@.
24736 @itemx -mno-fused-madd
24737 @opindex mfused-madd
24738 @opindex mno-fused-madd
24739 Generate code that uses (does not use) the floating-point multiply and
24740 accumulate instructions. These instructions are generated by default if
24741 hardware floating point is used.
24743 @item -mwarn-framesize=@var{framesize}
24744 @opindex mwarn-framesize
24745 Emit a warning if the current function exceeds the given frame size. Because
24746 this is a compile-time check it doesn't need to be a real problem when the program
24747 runs. It is intended to identify functions that most probably cause
24748 a stack overflow. It is useful to be used in an environment with limited stack
24749 size e.g.@: the linux kernel.
24751 @item -mwarn-dynamicstack
24752 @opindex mwarn-dynamicstack
24753 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
24754 arrays. This is generally a bad idea with a limited stack size.
24756 @item -mstack-guard=@var{stack-guard}
24757 @itemx -mstack-size=@var{stack-size}
24758 @opindex mstack-guard
24759 @opindex mstack-size
24760 If these options are provided the S/390 back end emits additional instructions in
24761 the function prologue that trigger a trap if the stack size is @var{stack-guard}
24762 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
24763 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
24764 the frame size of the compiled function is chosen.
24765 These options are intended to be used to help debugging stack overflow problems.
24766 The additionally emitted code causes only little overhead and hence can also be
24767 used in production-like systems without greater performance degradation. The given
24768 values have to be exact powers of 2 and @var{stack-size} has to be greater than
24769 @var{stack-guard} without exceeding 64k.
24770 In order to be efficient the extra code makes the assumption that the stack starts
24771 at an address aligned to the value given by @var{stack-size}.
24772 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
24774 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
24776 If the hotpatch option is enabled, a ``hot-patching'' function
24777 prologue is generated for all functions in the compilation unit.
24778 The funtion label is prepended with the given number of two-byte
24779 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
24780 the label, 2 * @var{post-halfwords} bytes are appended, using the
24781 largest NOP like instructions the architecture allows (maximum
24784 If both arguments are zero, hotpatching is disabled.
24786 This option can be overridden for individual functions with the
24787 @code{hotpatch} attribute.
24790 @node Score Options
24791 @subsection Score Options
24792 @cindex Score Options
24794 These options are defined for Score implementations:
24799 Compile code for big-endian mode. This is the default.
24803 Compile code for little-endian mode.
24807 Disable generation of @code{bcnz} instructions.
24811 Enable generation of unaligned load and store instructions.
24815 Enable the use of multiply-accumulate instructions. Disabled by default.
24819 Specify the SCORE5 as the target architecture.
24823 Specify the SCORE5U of the target architecture.
24827 Specify the SCORE7 as the target architecture. This is the default.
24831 Specify the SCORE7D as the target architecture.
24835 @subsection SH Options
24837 These @samp{-m} options are defined for the SH implementations:
24842 Generate code for the SH1.
24846 Generate code for the SH2.
24849 Generate code for the SH2e.
24853 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
24854 that the floating-point unit is not used.
24856 @item -m2a-single-only
24857 @opindex m2a-single-only
24858 Generate code for the SH2a-FPU, in such a way that no double-precision
24859 floating-point operations are used.
24862 @opindex m2a-single
24863 Generate code for the SH2a-FPU assuming the floating-point unit is in
24864 single-precision mode by default.
24868 Generate code for the SH2a-FPU assuming the floating-point unit is in
24869 double-precision mode by default.
24873 Generate code for the SH3.
24877 Generate code for the SH3e.
24881 Generate code for the SH4 without a floating-point unit.
24883 @item -m4-single-only
24884 @opindex m4-single-only
24885 Generate code for the SH4 with a floating-point unit that only
24886 supports single-precision arithmetic.
24890 Generate code for the SH4 assuming the floating-point unit is in
24891 single-precision mode by default.
24895 Generate code for the SH4.
24899 Generate code for SH4-100.
24901 @item -m4-100-nofpu
24902 @opindex m4-100-nofpu
24903 Generate code for SH4-100 in such a way that the
24904 floating-point unit is not used.
24906 @item -m4-100-single
24907 @opindex m4-100-single
24908 Generate code for SH4-100 assuming the floating-point unit is in
24909 single-precision mode by default.
24911 @item -m4-100-single-only
24912 @opindex m4-100-single-only
24913 Generate code for SH4-100 in such a way that no double-precision
24914 floating-point operations are used.
24918 Generate code for SH4-200.
24920 @item -m4-200-nofpu
24921 @opindex m4-200-nofpu
24922 Generate code for SH4-200 without in such a way that the
24923 floating-point unit is not used.
24925 @item -m4-200-single
24926 @opindex m4-200-single
24927 Generate code for SH4-200 assuming the floating-point unit is in
24928 single-precision mode by default.
24930 @item -m4-200-single-only
24931 @opindex m4-200-single-only
24932 Generate code for SH4-200 in such a way that no double-precision
24933 floating-point operations are used.
24937 Generate code for SH4-300.
24939 @item -m4-300-nofpu
24940 @opindex m4-300-nofpu
24941 Generate code for SH4-300 without in such a way that the
24942 floating-point unit is not used.
24944 @item -m4-300-single
24945 @opindex m4-300-single
24946 Generate code for SH4-300 in such a way that no double-precision
24947 floating-point operations are used.
24949 @item -m4-300-single-only
24950 @opindex m4-300-single-only
24951 Generate code for SH4-300 in such a way that no double-precision
24952 floating-point operations are used.
24956 Generate code for SH4-340 (no MMU, no FPU).
24960 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
24965 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
24966 floating-point unit is not used.
24968 @item -m4a-single-only
24969 @opindex m4a-single-only
24970 Generate code for the SH4a, in such a way that no double-precision
24971 floating-point operations are used.
24974 @opindex m4a-single
24975 Generate code for the SH4a assuming the floating-point unit is in
24976 single-precision mode by default.
24980 Generate code for the SH4a.
24984 Same as @option{-m4a-nofpu}, except that it implicitly passes
24985 @option{-dsp} to the assembler. GCC doesn't generate any DSP
24986 instructions at the moment.
24990 Compile code for the processor in big-endian mode.
24994 Compile code for the processor in little-endian mode.
24998 Align doubles at 64-bit boundaries. Note that this changes the calling
24999 conventions, and thus some functions from the standard C library do
25000 not work unless you recompile it first with @option{-mdalign}.
25004 Shorten some address references at link time, when possible; uses the
25005 linker option @option{-relax}.
25009 Use 32-bit offsets in @code{switch} tables. The default is to use
25014 Enable the use of bit manipulation instructions on SH2A.
25018 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25019 alignment constraints.
25023 Comply with the calling conventions defined by Renesas.
25026 @opindex mno-renesas
25027 Comply with the calling conventions defined for GCC before the Renesas
25028 conventions were available. This option is the default for all
25029 targets of the SH toolchain.
25032 @opindex mnomacsave
25033 Mark the @code{MAC} register as call-clobbered, even if
25034 @option{-mrenesas} is given.
25040 Control the IEEE compliance of floating-point comparisons, which affects the
25041 handling of cases where the result of a comparison is unordered. By default
25042 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25043 enabled @option{-mno-ieee} is implicitly set, which results in faster
25044 floating-point greater-equal and less-equal comparisons. The implicit settings
25045 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25047 @item -minline-ic_invalidate
25048 @opindex minline-ic_invalidate
25049 Inline code to invalidate instruction cache entries after setting up
25050 nested function trampolines.
25051 This option has no effect if @option{-musermode} is in effect and the selected
25052 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
25054 If the selected code generation option does not allow the use of the @code{icbi}
25055 instruction, and @option{-musermode} is not in effect, the inlined code
25056 manipulates the instruction cache address array directly with an associative
25057 write. This not only requires privileged mode at run time, but it also
25058 fails if the cache line had been mapped via the TLB and has become unmapped.
25062 Dump instruction size and location in the assembly code.
25065 @opindex mpadstruct
25066 This option is deprecated. It pads structures to multiple of 4 bytes,
25067 which is incompatible with the SH ABI@.
25069 @item -matomic-model=@var{model}
25070 @opindex matomic-model=@var{model}
25071 Sets the model of atomic operations and additional parameters as a comma
25072 separated list. For details on the atomic built-in functions see
25073 @ref{__atomic Builtins}. The following models and parameters are supported:
25078 Disable compiler generated atomic sequences and emit library calls for atomic
25079 operations. This is the default if the target is not @code{sh*-*-linux*}.
25082 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25083 built-in functions. The generated atomic sequences require additional support
25084 from the interrupt/exception handling code of the system and are only suitable
25085 for SH3* and SH4* single-core systems. This option is enabled by default when
25086 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25087 this option also partially utilizes the hardware atomic instructions
25088 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25089 @samp{strict} is specified.
25092 Generate software atomic sequences that use a variable in the thread control
25093 block. This is a variation of the gUSA sequences which can also be used on
25094 SH1* and SH2* targets. The generated atomic sequences require additional
25095 support from the interrupt/exception handling code of the system and are only
25096 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25097 parameter has to be specified as well.
25100 Generate software atomic sequences that temporarily disable interrupts by
25101 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25102 in privileged mode and is only suitable for single-core systems. Additional
25103 support from the interrupt/exception handling code of the system is not
25104 required. This model is enabled by default when the target is
25105 @code{sh*-*-linux*} and SH1* or SH2*.
25108 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25109 instructions only. This is only available on SH4A and is suitable for
25110 multi-core systems. Since the hardware instructions support only 32 bit atomic
25111 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25112 Code compiled with this option is also compatible with other software
25113 atomic model interrupt/exception handling systems if executed on an SH4A
25114 system. Additional support from the interrupt/exception handling code of the
25115 system is not required for this model.
25118 This parameter specifies the offset in bytes of the variable in the thread
25119 control block structure that should be used by the generated atomic sequences
25120 when the @samp{soft-tcb} model has been selected. For other models this
25121 parameter is ignored. The specified value must be an integer multiple of four
25122 and in the range 0-1020.
25125 This parameter prevents mixed usage of multiple atomic models, even if they
25126 are compatible, and makes the compiler generate atomic sequences of the
25127 specified model only.
25133 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25134 Notice that depending on the particular hardware and software configuration
25135 this can degrade overall performance due to the operand cache line flushes
25136 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25137 processors the @code{tas.b} instruction must be used with caution since it
25138 can result in data corruption for certain cache configurations.
25141 @opindex mprefergot
25142 When generating position-independent code, emit function calls using
25143 the Global Offset Table instead of the Procedure Linkage Table.
25146 @itemx -mno-usermode
25148 @opindex mno-usermode
25149 Don't allow (allow) the compiler generating privileged mode code. Specifying
25150 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25151 inlined code would not work in user mode. @option{-musermode} is the default
25152 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25153 @option{-musermode} has no effect, since there is no user mode.
25155 @item -multcost=@var{number}
25156 @opindex multcost=@var{number}
25157 Set the cost to assume for a multiply insn.
25159 @item -mdiv=@var{strategy}
25160 @opindex mdiv=@var{strategy}
25161 Set the division strategy to be used for integer division operations.
25162 @var{strategy} can be one of:
25167 Calls a library function that uses the single-step division instruction
25168 @code{div1} to perform the operation. Division by zero calculates an
25169 unspecified result and does not trap. This is the default except for SH4,
25170 SH2A and SHcompact.
25173 Calls a library function that performs the operation in double precision
25174 floating point. Division by zero causes a floating-point exception. This is
25175 the default for SHcompact with FPU. Specifying this for targets that do not
25176 have a double precision FPU defaults to @code{call-div1}.
25179 Calls a library function that uses a lookup table for small divisors and
25180 the @code{div1} instruction with case distinction for larger divisors. Division
25181 by zero calculates an unspecified result and does not trap. This is the default
25182 for SH4. Specifying this for targets that do not have dynamic shift
25183 instructions defaults to @code{call-div1}.
25187 When a division strategy has not been specified the default strategy is
25188 selected based on the current target. For SH2A the default strategy is to
25189 use the @code{divs} and @code{divu} instructions instead of library function
25192 @item -maccumulate-outgoing-args
25193 @opindex maccumulate-outgoing-args
25194 Reserve space once for outgoing arguments in the function prologue rather
25195 than around each call. Generally beneficial for performance and size. Also
25196 needed for unwinding to avoid changing the stack frame around conditional code.
25198 @item -mdivsi3_libfunc=@var{name}
25199 @opindex mdivsi3_libfunc=@var{name}
25200 Set the name of the library function used for 32-bit signed division to
25202 This only affects the name used in the @samp{call} division strategies, and
25203 the compiler still expects the same sets of input/output/clobbered registers as
25204 if this option were not present.
25206 @item -mfixed-range=@var{register-range}
25207 @opindex mfixed-range
25208 Generate code treating the given register range as fixed registers.
25209 A fixed register is one that the register allocator can not use. This is
25210 useful when compiling kernel code. A register range is specified as
25211 two registers separated by a dash. Multiple register ranges can be
25212 specified separated by a comma.
25214 @item -mbranch-cost=@var{num}
25215 @opindex mbranch-cost=@var{num}
25216 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25217 make the compiler try to generate more branch-free code if possible.
25218 If not specified the value is selected depending on the processor type that
25219 is being compiled for.
25222 @itemx -mno-zdcbranch
25223 @opindex mzdcbranch
25224 @opindex mno-zdcbranch
25225 Assume (do not assume) that zero displacement conditional branch instructions
25226 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25227 compiler prefers zero displacement branch code sequences. This is
25228 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25229 disabled by specifying @option{-mno-zdcbranch}.
25231 @item -mcbranch-force-delay-slot
25232 @opindex mcbranch-force-delay-slot
25233 Force the usage of delay slots for conditional branches, which stuffs the delay
25234 slot with a @code{nop} if a suitable instruction cannot be found. By default
25235 this option is disabled. It can be enabled to work around hardware bugs as
25236 found in the original SH7055.
25239 @itemx -mno-fused-madd
25240 @opindex mfused-madd
25241 @opindex mno-fused-madd
25242 Generate code that uses (does not use) the floating-point multiply and
25243 accumulate instructions. These instructions are generated by default
25244 if hardware floating point is used. The machine-dependent
25245 @option{-mfused-madd} option is now mapped to the machine-independent
25246 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25247 mapped to @option{-ffp-contract=off}.
25253 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25254 and cosine approximations. The option @option{-mfsca} must be used in
25255 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25256 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25257 approximations even if @option{-funsafe-math-optimizations} is in effect.
25263 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25264 reciprocal square root approximations. The option @option{-mfsrra} must be used
25265 in combination with @option{-funsafe-math-optimizations} and
25266 @option{-ffinite-math-only}. It is enabled by default when generating code for
25267 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25268 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25271 @item -mpretend-cmove
25272 @opindex mpretend-cmove
25273 Prefer zero-displacement conditional branches for conditional move instruction
25274 patterns. This can result in faster code on the SH4 processor.
25278 Generate code using the FDPIC ABI.
25282 @node Solaris 2 Options
25283 @subsection Solaris 2 Options
25284 @cindex Solaris 2 options
25286 These @samp{-m} options are supported on Solaris 2:
25289 @item -mclear-hwcap
25290 @opindex mclear-hwcap
25291 @option{-mclear-hwcap} tells the compiler to remove the hardware
25292 capabilities generated by the Solaris assembler. This is only necessary
25293 when object files use ISA extensions not supported by the current
25294 machine, but check at runtime whether or not to use them.
25296 @item -mimpure-text
25297 @opindex mimpure-text
25298 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25299 the compiler to not pass @option{-z text} to the linker when linking a
25300 shared object. Using this option, you can link position-dependent
25301 code into a shared object.
25303 @option{-mimpure-text} suppresses the ``relocations remain against
25304 allocatable but non-writable sections'' linker error message.
25305 However, the necessary relocations trigger copy-on-write, and the
25306 shared object is not actually shared across processes. Instead of
25307 using @option{-mimpure-text}, you should compile all source code with
25308 @option{-fpic} or @option{-fPIC}.
25312 These switches are supported in addition to the above on Solaris 2:
25317 This is a synonym for @option{-pthread}.
25320 @node SPARC Options
25321 @subsection SPARC Options
25322 @cindex SPARC options
25324 These @samp{-m} options are supported on the SPARC:
25327 @item -mno-app-regs
25329 @opindex mno-app-regs
25331 Specify @option{-mapp-regs} to generate output using the global registers
25332 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25333 global register 1, each global register 2 through 4 is then treated as an
25334 allocable register that is clobbered by function calls. This is the default.
25336 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25337 specify @option{-mno-app-regs}. You should compile libraries and system
25338 software with this option.
25344 With @option{-mflat}, the compiler does not generate save/restore instructions
25345 and uses a ``flat'' or single register window model. This model is compatible
25346 with the regular register window model. The local registers and the input
25347 registers (0--5) are still treated as ``call-saved'' registers and are
25348 saved on the stack as needed.
25350 With @option{-mno-flat} (the default), the compiler generates save/restore
25351 instructions (except for leaf functions). This is the normal operating mode.
25354 @itemx -mhard-float
25356 @opindex mhard-float
25357 Generate output containing floating-point instructions. This is the
25361 @itemx -msoft-float
25363 @opindex msoft-float
25364 Generate output containing library calls for floating point.
25365 @strong{Warning:} the requisite libraries are not available for all SPARC
25366 targets. Normally the facilities of the machine's usual C compiler are
25367 used, but this cannot be done directly in cross-compilation. You must make
25368 your own arrangements to provide suitable library functions for
25369 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25370 @samp{sparclite-*-*} do provide software floating-point support.
25372 @option{-msoft-float} changes the calling convention in the output file;
25373 therefore, it is only useful if you compile @emph{all} of a program with
25374 this option. In particular, you need to compile @file{libgcc.a}, the
25375 library that comes with GCC, with @option{-msoft-float} in order for
25378 @item -mhard-quad-float
25379 @opindex mhard-quad-float
25380 Generate output containing quad-word (long double) floating-point
25383 @item -msoft-quad-float
25384 @opindex msoft-quad-float
25385 Generate output containing library calls for quad-word (long double)
25386 floating-point instructions. The functions called are those specified
25387 in the SPARC ABI@. This is the default.
25389 As of this writing, there are no SPARC implementations that have hardware
25390 support for the quad-word floating-point instructions. They all invoke
25391 a trap handler for one of these instructions, and then the trap handler
25392 emulates the effect of the instruction. Because of the trap handler overhead,
25393 this is much slower than calling the ABI library routines. Thus the
25394 @option{-msoft-quad-float} option is the default.
25396 @item -mno-unaligned-doubles
25397 @itemx -munaligned-doubles
25398 @opindex mno-unaligned-doubles
25399 @opindex munaligned-doubles
25400 Assume that doubles have 8-byte alignment. This is the default.
25402 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25403 alignment only if they are contained in another type, or if they have an
25404 absolute address. Otherwise, it assumes they have 4-byte alignment.
25405 Specifying this option avoids some rare compatibility problems with code
25406 generated by other compilers. It is not the default because it results
25407 in a performance loss, especially for floating-point code.
25410 @itemx -mno-user-mode
25411 @opindex muser-mode
25412 @opindex mno-user-mode
25413 Do not generate code that can only run in supervisor mode. This is relevant
25414 only for the @code{casa} instruction emitted for the LEON3 processor. This
25417 @item -mfaster-structs
25418 @itemx -mno-faster-structs
25419 @opindex mfaster-structs
25420 @opindex mno-faster-structs
25421 With @option{-mfaster-structs}, the compiler assumes that structures
25422 should have 8-byte alignment. This enables the use of pairs of
25423 @code{ldd} and @code{std} instructions for copies in structure
25424 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25425 However, the use of this changed alignment directly violates the SPARC
25426 ABI@. Thus, it's intended only for use on targets where the developer
25427 acknowledges that their resulting code is not directly in line with
25428 the rules of the ABI@.
25430 @item -mstd-struct-return
25431 @itemx -mno-std-struct-return
25432 @opindex mstd-struct-return
25433 @opindex mno-std-struct-return
25434 With @option{-mstd-struct-return}, the compiler generates checking code
25435 in functions returning structures or unions to detect size mismatches
25436 between the two sides of function calls, as per the 32-bit ABI@.
25438 The default is @option{-mno-std-struct-return}. This option has no effect
25445 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25446 so @option{-mno-lra} needs to be passed to get old Reload.
25448 @item -mcpu=@var{cpu_type}
25450 Set the instruction set, register set, and instruction scheduling parameters
25451 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25452 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25453 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25454 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25455 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25456 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25458 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25459 which selects the best architecture option for the host processor.
25460 @option{-mcpu=native} has no effect if GCC does not recognize
25463 Default instruction scheduling parameters are used for values that select
25464 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25465 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25467 Here is a list of each supported architecture and their supported
25475 supersparc, hypersparc, leon, leon3
25478 f930, f934, sparclite86x
25484 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25488 By default (unless configured otherwise), GCC generates code for the V7
25489 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25490 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25491 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25492 SPARCStation 1, 2, IPX etc.
25494 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25495 architecture. The only difference from V7 code is that the compiler emits
25496 the integer multiply and integer divide instructions which exist in SPARC-V8
25497 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25498 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25501 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25502 the SPARC architecture. This adds the integer multiply, integer divide step
25503 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
25504 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
25505 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
25506 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
25507 MB86934 chip, which is the more recent SPARClite with FPU@.
25509 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
25510 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
25511 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
25512 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
25513 optimizes it for the TEMIC SPARClet chip.
25515 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
25516 architecture. This adds 64-bit integer and floating-point move instructions,
25517 3 additional floating-point condition code registers and conditional move
25518 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
25519 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
25520 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
25521 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25522 @option{-mcpu=niagara}, the compiler additionally optimizes it for
25523 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
25524 additionally optimizes it for Sun UltraSPARC T2 chips. With
25525 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
25526 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
25527 additionally optimizes it for Sun UltraSPARC T4 chips. With
25528 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
25529 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
25530 additionally optimizes it for Oracle M8 chips.
25532 @item -mtune=@var{cpu_type}
25534 Set the instruction scheduling parameters for machine type
25535 @var{cpu_type}, but do not set the instruction set or register set that the
25536 option @option{-mcpu=@var{cpu_type}} does.
25538 The same values for @option{-mcpu=@var{cpu_type}} can be used for
25539 @option{-mtune=@var{cpu_type}}, but the only useful values are those
25540 that select a particular CPU implementation. Those are
25541 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
25542 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
25543 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
25544 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
25545 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
25546 and GNU/Linux toolchains, @samp{native} can also be used.
25551 @opindex mno-v8plus
25552 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
25553 difference from the V8 ABI is that the global and out registers are
25554 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
25555 mode for all SPARC-V9 processors.
25561 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
25562 Visual Instruction Set extensions. The default is @option{-mno-vis}.
25568 With @option{-mvis2}, GCC generates code that takes advantage of
25569 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
25570 default is @option{-mvis2} when targeting a cpu that supports such
25571 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
25572 also sets @option{-mvis}.
25578 With @option{-mvis3}, GCC generates code that takes advantage of
25579 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
25580 default is @option{-mvis3} when targeting a cpu that supports such
25581 instructions, such as niagara-3 and later. Setting @option{-mvis3}
25582 also sets @option{-mvis2} and @option{-mvis}.
25588 With @option{-mvis4}, GCC generates code that takes advantage of
25589 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
25590 default is @option{-mvis4} when targeting a cpu that supports such
25591 instructions, such as niagara-7 and later. Setting @option{-mvis4}
25592 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
25598 With @option{-mvis4b}, GCC generates code that takes advantage of
25599 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
25600 the additional VIS instructions introduced in the Oracle SPARC
25601 Architecture 2017. The default is @option{-mvis4b} when targeting a
25602 cpu that supports such instructions, such as m8 and later. Setting
25603 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
25604 @option{-mvis2} and @option{-mvis}.
25609 @opindex mno-cbcond
25610 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
25611 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
25612 when targeting a CPU that supports such instructions, such as Niagara-4 and
25619 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
25620 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
25621 when targeting a CPU that supports such instructions, such as Niagara-3 and
25627 @opindex mno-fsmuld
25628 With @option{-mfsmuld}, GCC generates code that takes advantage of the
25629 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
25630 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
25631 or V9 with FPU except @option{-mcpu=leon}.
25637 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
25638 Population Count instruction. The default is @option{-mpopc}
25639 when targeting a CPU that supports such an instruction, such as Niagara-2 and
25646 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
25647 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
25648 when targeting a CPU that supports such an instruction, such as Niagara-7 and
25652 @opindex mfix-at697f
25653 Enable the documented workaround for the single erratum of the Atmel AT697F
25654 processor (which corresponds to erratum #13 of the AT697E processor).
25657 @opindex mfix-ut699
25658 Enable the documented workarounds for the floating-point errata and the data
25659 cache nullify errata of the UT699 processor.
25662 @opindex mfix-ut700
25663 Enable the documented workaround for the back-to-back store errata of
25664 the UT699E/UT700 processor.
25666 @item -mfix-gr712rc
25667 @opindex mfix-gr712rc
25668 Enable the documented workaround for the back-to-back store errata of
25669 the GR712RC processor.
25672 These @samp{-m} options are supported in addition to the above
25673 on SPARC-V9 processors in 64-bit environments:
25680 Generate code for a 32-bit or 64-bit environment.
25681 The 32-bit environment sets int, long and pointer to 32 bits.
25682 The 64-bit environment sets int to 32 bits and long and pointer
25685 @item -mcmodel=@var{which}
25687 Set the code model to one of
25691 The Medium/Low code model: 64-bit addresses, programs
25692 must be linked in the low 32 bits of memory. Programs can be statically
25693 or dynamically linked.
25696 The Medium/Middle code model: 64-bit addresses, programs
25697 must be linked in the low 44 bits of memory, the text and data segments must
25698 be less than 2GB in size and the data segment must be located within 2GB of
25702 The Medium/Anywhere code model: 64-bit addresses, programs
25703 may be linked anywhere in memory, the text and data segments must be less
25704 than 2GB in size and the data segment must be located within 2GB of the
25708 The Medium/Anywhere code model for embedded systems:
25709 64-bit addresses, the text and data segments must be less than 2GB in
25710 size, both starting anywhere in memory (determined at link time). The
25711 global register %g4 points to the base of the data segment. Programs
25712 are statically linked and PIC is not supported.
25715 @item -mmemory-model=@var{mem-model}
25716 @opindex mmemory-model
25717 Set the memory model in force on the processor to one of
25721 The default memory model for the processor and operating system.
25724 Relaxed Memory Order
25727 Partial Store Order
25733 Sequential Consistency
25736 These memory models are formally defined in Appendix D of the SPARC-V9
25737 architecture manual, as set in the processor's @code{PSTATE.MM} field.
25740 @itemx -mno-stack-bias
25741 @opindex mstack-bias
25742 @opindex mno-stack-bias
25743 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
25744 frame pointer if present, are offset by @minus{}2047 which must be added back
25745 when making stack frame references. This is the default in 64-bit mode.
25746 Otherwise, assume no such offset is present.
25750 @subsection SPU Options
25751 @cindex SPU options
25753 These @samp{-m} options are supported on the SPU:
25757 @itemx -merror-reloc
25758 @opindex mwarn-reloc
25759 @opindex merror-reloc
25761 The loader for SPU does not handle dynamic relocations. By default, GCC
25762 gives an error when it generates code that requires a dynamic
25763 relocation. @option{-mno-error-reloc} disables the error,
25764 @option{-mwarn-reloc} generates a warning instead.
25767 @itemx -munsafe-dma
25769 @opindex munsafe-dma
25771 Instructions that initiate or test completion of DMA must not be
25772 reordered with respect to loads and stores of the memory that is being
25774 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
25775 memory accesses, but that can lead to inefficient code in places where the
25776 memory is known to not change. Rather than mark the memory as volatile,
25777 you can use @option{-msafe-dma} to tell the compiler to treat
25778 the DMA instructions as potentially affecting all memory.
25780 @item -mbranch-hints
25781 @opindex mbranch-hints
25783 By default, GCC generates a branch hint instruction to avoid
25784 pipeline stalls for always-taken or probably-taken branches. A hint
25785 is not generated closer than 8 instructions away from its branch.
25786 There is little reason to disable them, except for debugging purposes,
25787 or to make an object a little bit smaller.
25791 @opindex msmall-mem
25792 @opindex mlarge-mem
25794 By default, GCC generates code assuming that addresses are never larger
25795 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
25796 a full 32-bit address.
25801 By default, GCC links against startup code that assumes the SPU-style
25802 main function interface (which has an unconventional parameter list).
25803 With @option{-mstdmain}, GCC links your program against startup
25804 code that assumes a C99-style interface to @code{main}, including a
25805 local copy of @code{argv} strings.
25807 @item -mfixed-range=@var{register-range}
25808 @opindex mfixed-range
25809 Generate code treating the given register range as fixed registers.
25810 A fixed register is one that the register allocator cannot use. This is
25811 useful when compiling kernel code. A register range is specified as
25812 two registers separated by a dash. Multiple register ranges can be
25813 specified separated by a comma.
25819 Compile code assuming that pointers to the PPU address space accessed
25820 via the @code{__ea} named address space qualifier are either 32 or 64
25821 bits wide. The default is 32 bits. As this is an ABI-changing option,
25822 all object code in an executable must be compiled with the same setting.
25824 @item -maddress-space-conversion
25825 @itemx -mno-address-space-conversion
25826 @opindex maddress-space-conversion
25827 @opindex mno-address-space-conversion
25828 Allow/disallow treating the @code{__ea} address space as superset
25829 of the generic address space. This enables explicit type casts
25830 between @code{__ea} and generic pointer as well as implicit
25831 conversions of generic pointers to @code{__ea} pointers. The
25832 default is to allow address space pointer conversions.
25834 @item -mcache-size=@var{cache-size}
25835 @opindex mcache-size
25836 This option controls the version of libgcc that the compiler links to an
25837 executable and selects a software-managed cache for accessing variables
25838 in the @code{__ea} address space with a particular cache size. Possible
25839 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
25840 and @samp{128}. The default cache size is 64KB.
25842 @item -matomic-updates
25843 @itemx -mno-atomic-updates
25844 @opindex matomic-updates
25845 @opindex mno-atomic-updates
25846 This option controls the version of libgcc that the compiler links to an
25847 executable and selects whether atomic updates to the software-managed
25848 cache of PPU-side variables are used. If you use atomic updates, changes
25849 to a PPU variable from SPU code using the @code{__ea} named address space
25850 qualifier do not interfere with changes to other PPU variables residing
25851 in the same cache line from PPU code. If you do not use atomic updates,
25852 such interference may occur; however, writing back cache lines is
25853 more efficient. The default behavior is to use atomic updates.
25856 @itemx -mdual-nops=@var{n}
25857 @opindex mdual-nops
25858 By default, GCC inserts NOPs to increase dual issue when it expects
25859 it to increase performance. @var{n} can be a value from 0 to 10. A
25860 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
25861 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
25863 @item -mhint-max-nops=@var{n}
25864 @opindex mhint-max-nops
25865 Maximum number of NOPs to insert for a branch hint. A branch hint must
25866 be at least 8 instructions away from the branch it is affecting. GCC
25867 inserts up to @var{n} NOPs to enforce this, otherwise it does not
25868 generate the branch hint.
25870 @item -mhint-max-distance=@var{n}
25871 @opindex mhint-max-distance
25872 The encoding of the branch hint instruction limits the hint to be within
25873 256 instructions of the branch it is affecting. By default, GCC makes
25874 sure it is within 125.
25877 @opindex msafe-hints
25878 Work around a hardware bug that causes the SPU to stall indefinitely.
25879 By default, GCC inserts the @code{hbrp} instruction to make sure
25880 this stall won't happen.
25884 @node System V Options
25885 @subsection Options for System V
25887 These additional options are available on System V Release 4 for
25888 compatibility with other compilers on those systems:
25893 Create a shared object.
25894 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
25898 Identify the versions of each tool used by the compiler, in a
25899 @code{.ident} assembler directive in the output.
25903 Refrain from adding @code{.ident} directives to the output file (this is
25906 @item -YP,@var{dirs}
25908 Search the directories @var{dirs}, and no others, for libraries
25909 specified with @option{-l}.
25911 @item -Ym,@var{dir}
25913 Look in the directory @var{dir} to find the M4 preprocessor.
25914 The assembler uses this option.
25915 @c This is supposed to go with a -Yd for predefined M4 macro files, but
25916 @c the generic assembler that comes with Solaris takes just -Ym.
25919 @node TILE-Gx Options
25920 @subsection TILE-Gx Options
25921 @cindex TILE-Gx options
25923 These @samp{-m} options are supported on the TILE-Gx:
25926 @item -mcmodel=small
25927 @opindex mcmodel=small
25928 Generate code for the small model. The distance for direct calls is
25929 limited to 500M in either direction. PC-relative addresses are 32
25930 bits. Absolute addresses support the full address range.
25932 @item -mcmodel=large
25933 @opindex mcmodel=large
25934 Generate code for the large model. There is no limitation on call
25935 distance, pc-relative addresses, or absolute addresses.
25937 @item -mcpu=@var{name}
25939 Selects the type of CPU to be targeted. Currently the only supported
25940 type is @samp{tilegx}.
25946 Generate code for a 32-bit or 64-bit environment. The 32-bit
25947 environment sets int, long, and pointer to 32 bits. The 64-bit
25948 environment sets int to 32 bits and long and pointer to 64 bits.
25951 @itemx -mlittle-endian
25952 @opindex mbig-endian
25953 @opindex mlittle-endian
25954 Generate code in big/little endian mode, respectively.
25957 @node TILEPro Options
25958 @subsection TILEPro Options
25959 @cindex TILEPro options
25961 These @samp{-m} options are supported on the TILEPro:
25964 @item -mcpu=@var{name}
25966 Selects the type of CPU to be targeted. Currently the only supported
25967 type is @samp{tilepro}.
25971 Generate code for a 32-bit environment, which sets int, long, and
25972 pointer to 32 bits. This is the only supported behavior so the flag
25973 is essentially ignored.
25977 @subsection V850 Options
25978 @cindex V850 Options
25980 These @samp{-m} options are defined for V850 implementations:
25984 @itemx -mno-long-calls
25985 @opindex mlong-calls
25986 @opindex mno-long-calls
25987 Treat all calls as being far away (near). If calls are assumed to be
25988 far away, the compiler always loads the function's address into a
25989 register, and calls indirect through the pointer.
25995 Do not optimize (do optimize) basic blocks that use the same index
25996 pointer 4 or more times to copy pointer into the @code{ep} register, and
25997 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
25998 option is on by default if you optimize.
26000 @item -mno-prolog-function
26001 @itemx -mprolog-function
26002 @opindex mno-prolog-function
26003 @opindex mprolog-function
26004 Do not use (do use) external functions to save and restore registers
26005 at the prologue and epilogue of a function. The external functions
26006 are slower, but use less code space if more than one function saves
26007 the same number of registers. The @option{-mprolog-function} option
26008 is on by default if you optimize.
26012 Try to make the code as small as possible. At present, this just turns
26013 on the @option{-mep} and @option{-mprolog-function} options.
26015 @item -mtda=@var{n}
26017 Put static or global variables whose size is @var{n} bytes or less into
26018 the tiny data area that register @code{ep} points to. The tiny data
26019 area can hold up to 256 bytes in total (128 bytes for byte references).
26021 @item -msda=@var{n}
26023 Put static or global variables whose size is @var{n} bytes or less into
26024 the small data area that register @code{gp} points to. The small data
26025 area can hold up to 64 kilobytes.
26027 @item -mzda=@var{n}
26029 Put static or global variables whose size is @var{n} bytes or less into
26030 the first 32 kilobytes of memory.
26034 Specify that the target processor is the V850.
26038 Specify that the target processor is the V850E3V5. The preprocessor
26039 constant @code{__v850e3v5__} is defined if this option is used.
26043 Specify that the target processor is the V850E3V5. This is an alias for
26044 the @option{-mv850e3v5} option.
26048 Specify that the target processor is the V850E2V3. The preprocessor
26049 constant @code{__v850e2v3__} is defined if this option is used.
26053 Specify that the target processor is the V850E2. The preprocessor
26054 constant @code{__v850e2__} is defined if this option is used.
26058 Specify that the target processor is the V850E1. The preprocessor
26059 constants @code{__v850e1__} and @code{__v850e__} are defined if
26060 this option is used.
26064 Specify that the target processor is the V850ES. This is an alias for
26065 the @option{-mv850e1} option.
26069 Specify that the target processor is the V850E@. The preprocessor
26070 constant @code{__v850e__} is defined if this option is used.
26072 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26073 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26074 are defined then a default target processor is chosen and the
26075 relevant @samp{__v850*__} preprocessor constant is defined.
26077 The preprocessor constants @code{__v850} and @code{__v851__} are always
26078 defined, regardless of which processor variant is the target.
26080 @item -mdisable-callt
26081 @itemx -mno-disable-callt
26082 @opindex mdisable-callt
26083 @opindex mno-disable-callt
26084 This option suppresses generation of the @code{CALLT} instruction for the
26085 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26088 This option is enabled by default when the RH850 ABI is
26089 in use (see @option{-mrh850-abi}), and disabled by default when the
26090 GCC ABI is in use. If @code{CALLT} instructions are being generated
26091 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26097 Pass on (or do not pass on) the @option{-mrelax} command-line option
26101 @itemx -mno-long-jumps
26102 @opindex mlong-jumps
26103 @opindex mno-long-jumps
26104 Disable (or re-enable) the generation of PC-relative jump instructions.
26107 @itemx -mhard-float
26108 @opindex msoft-float
26109 @opindex mhard-float
26110 Disable (or re-enable) the generation of hardware floating point
26111 instructions. This option is only significant when the target
26112 architecture is @samp{V850E2V3} or higher. If hardware floating point
26113 instructions are being generated then the C preprocessor symbol
26114 @code{__FPU_OK__} is defined, otherwise the symbol
26115 @code{__NO_FPU__} is defined.
26119 Enables the use of the e3v5 LOOP instruction. The use of this
26120 instruction is not enabled by default when the e3v5 architecture is
26121 selected because its use is still experimental.
26125 @opindex mrh850-abi
26127 Enables support for the RH850 version of the V850 ABI. This is the
26128 default. With this version of the ABI the following rules apply:
26132 Integer sized structures and unions are returned via a memory pointer
26133 rather than a register.
26136 Large structures and unions (more than 8 bytes in size) are passed by
26140 Functions are aligned to 16-bit boundaries.
26143 The @option{-m8byte-align} command-line option is supported.
26146 The @option{-mdisable-callt} command-line option is enabled by
26147 default. The @option{-mno-disable-callt} command-line option is not
26151 When this version of the ABI is enabled the C preprocessor symbol
26152 @code{__V850_RH850_ABI__} is defined.
26156 Enables support for the old GCC version of the V850 ABI. With this
26157 version of the ABI the following rules apply:
26161 Integer sized structures and unions are returned in register @code{r10}.
26164 Large structures and unions (more than 8 bytes in size) are passed by
26168 Functions are aligned to 32-bit boundaries, unless optimizing for
26172 The @option{-m8byte-align} command-line option is not supported.
26175 The @option{-mdisable-callt} command-line option is supported but not
26176 enabled by default.
26179 When this version of the ABI is enabled the C preprocessor symbol
26180 @code{__V850_GCC_ABI__} is defined.
26182 @item -m8byte-align
26183 @itemx -mno-8byte-align
26184 @opindex m8byte-align
26185 @opindex mno-8byte-align
26186 Enables support for @code{double} and @code{long long} types to be
26187 aligned on 8-byte boundaries. The default is to restrict the
26188 alignment of all objects to at most 4-bytes. When
26189 @option{-m8byte-align} is in effect the C preprocessor symbol
26190 @code{__V850_8BYTE_ALIGN__} is defined.
26193 @opindex mbig-switch
26194 Generate code suitable for big switch tables. Use this option only if
26195 the assembler/linker complain about out of range branches within a switch
26200 This option causes r2 and r5 to be used in the code generated by
26201 the compiler. This setting is the default.
26203 @item -mno-app-regs
26204 @opindex mno-app-regs
26205 This option causes r2 and r5 to be treated as fixed registers.
26210 @subsection VAX Options
26211 @cindex VAX options
26213 These @samp{-m} options are defined for the VAX:
26218 Do not output certain jump instructions (@code{aobleq} and so on)
26219 that the Unix assembler for the VAX cannot handle across long
26224 Do output those jump instructions, on the assumption that the
26225 GNU assembler is being used.
26229 Output code for G-format floating-point numbers instead of D-format.
26232 @node Visium Options
26233 @subsection Visium Options
26234 @cindex Visium options
26240 A program which performs file I/O and is destined to run on an MCM target
26241 should be linked with this option. It causes the libraries libc.a and
26242 libdebug.a to be linked. The program should be run on the target under
26243 the control of the GDB remote debugging stub.
26247 A program which performs file I/O and is destined to run on the simulator
26248 should be linked with option. This causes libraries libc.a and libsim.a to
26252 @itemx -mhard-float
26254 @opindex mhard-float
26255 Generate code containing floating-point instructions. This is the
26259 @itemx -msoft-float
26261 @opindex msoft-float
26262 Generate code containing library calls for floating-point.
26264 @option{-msoft-float} changes the calling convention in the output file;
26265 therefore, it is only useful if you compile @emph{all} of a program with
26266 this option. In particular, you need to compile @file{libgcc.a}, the
26267 library that comes with GCC, with @option{-msoft-float} in order for
26270 @item -mcpu=@var{cpu_type}
26272 Set the instruction set, register set, and instruction scheduling parameters
26273 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26274 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26276 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26278 By default (unless configured otherwise), GCC generates code for the GR5
26279 variant of the Visium architecture.
26281 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26282 architecture. The only difference from GR5 code is that the compiler will
26283 generate block move instructions.
26285 @item -mtune=@var{cpu_type}
26287 Set the instruction scheduling parameters for machine type @var{cpu_type},
26288 but do not set the instruction set or register set that the option
26289 @option{-mcpu=@var{cpu_type}} would.
26293 Generate code for the supervisor mode, where there are no restrictions on
26294 the access to general registers. This is the default.
26297 @opindex muser-mode
26298 Generate code for the user mode, where the access to some general registers
26299 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26300 mode; on the GR6, only registers r29 to r31 are affected.
26304 @subsection VMS Options
26306 These @samp{-m} options are defined for the VMS implementations:
26309 @item -mvms-return-codes
26310 @opindex mvms-return-codes
26311 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26312 condition (e.g.@ error) codes.
26314 @item -mdebug-main=@var{prefix}
26315 @opindex mdebug-main=@var{prefix}
26316 Flag the first routine whose name starts with @var{prefix} as the main
26317 routine for the debugger.
26321 Default to 64-bit memory allocation routines.
26323 @item -mpointer-size=@var{size}
26324 @opindex mpointer-size=@var{size}
26325 Set the default size of pointers. Possible options for @var{size} are
26326 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26327 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26328 The later option disables @code{pragma pointer_size}.
26331 @node VxWorks Options
26332 @subsection VxWorks Options
26333 @cindex VxWorks Options
26335 The options in this section are defined for all VxWorks targets.
26336 Options specific to the target hardware are listed with the other
26337 options for that target.
26342 GCC can generate code for both VxWorks kernels and real time processes
26343 (RTPs). This option switches from the former to the latter. It also
26344 defines the preprocessor macro @code{__RTP__}.
26347 @opindex non-static
26348 Link an RTP executable against shared libraries rather than static
26349 libraries. The options @option{-static} and @option{-shared} can
26350 also be used for RTPs (@pxref{Link Options}); @option{-static}
26357 These options are passed down to the linker. They are defined for
26358 compatibility with Diab.
26361 @opindex Xbind-lazy
26362 Enable lazy binding of function calls. This option is equivalent to
26363 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26367 Disable lazy binding of function calls. This option is the default and
26368 is defined for compatibility with Diab.
26372 @subsection x86 Options
26373 @cindex x86 Options
26375 These @samp{-m} options are defined for the x86 family of computers.
26379 @item -march=@var{cpu-type}
26381 Generate instructions for the machine type @var{cpu-type}. In contrast to
26382 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26383 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26384 to generate code that may not run at all on processors other than the one
26385 indicated. Specifying @option{-march=@var{cpu-type}} implies
26386 @option{-mtune=@var{cpu-type}}.
26388 The choices for @var{cpu-type} are:
26392 This selects the CPU to generate code for at compilation time by determining
26393 the processor type of the compiling machine. Using @option{-march=native}
26394 enables all instruction subsets supported by the local machine (hence
26395 the result might not run on different machines). Using @option{-mtune=native}
26396 produces code optimized for the local machine under the constraints
26397 of the selected instruction set.
26400 A generic CPU with 64-bit extensions.
26403 Original Intel i386 CPU@.
26406 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26410 Intel Pentium CPU with no MMX support.
26413 Intel Lakemont MCU, based on Intel Pentium CPU.
26416 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26419 Intel Pentium Pro CPU@.
26422 When used with @option{-march}, the Pentium Pro
26423 instruction set is used, so the code runs on all i686 family chips.
26424 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26427 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26432 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26436 Intel Pentium M; low-power version of Intel Pentium III CPU
26437 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26441 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26444 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26448 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26449 SSE2 and SSE3 instruction set support.
26452 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26453 instruction set support.
26456 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26457 SSE4.1, SSE4.2 and POPCNT instruction set support.
26460 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26461 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26464 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26465 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26468 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26469 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26470 instruction set support.
26473 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26474 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26475 BMI, BMI2 and F16C instruction set support.
26478 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26479 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26480 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26483 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26484 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26485 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26486 XSAVES instruction set support.
26489 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26490 instruction set support.
26493 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26494 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26497 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26498 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
26499 instruction set support.
26501 @item goldmont-plus
26502 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26503 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
26504 PTWRITE, RDPID, SGX and UMIP instruction set support.
26507 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26508 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
26509 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
26512 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26513 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26514 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
26515 AVX512CD instruction set support.
26518 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26519 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26520 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
26521 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26523 @item skylake-avx512
26524 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26525 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26526 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
26527 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
26530 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26531 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26532 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26533 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26534 AVX512IFMA, SHA and UMIP instruction set support.
26536 @item icelake-client
26537 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26538 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26539 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26540 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26541 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26542 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
26544 @item icelake-server
26545 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26546 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26547 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26548 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26549 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26550 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
26554 AMD K6 CPU with MMX instruction set support.
26558 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
26561 @itemx athlon-tbird
26562 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
26568 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
26569 instruction set support.
26575 Processors based on the AMD K8 core with x86-64 instruction set support,
26576 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
26577 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
26578 instruction set extensions.)
26581 @itemx opteron-sse3
26582 @itemx athlon64-sse3
26583 Improved versions of AMD K8 cores with SSE3 instruction set support.
26587 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
26588 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
26589 instruction set extensions.)
26592 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
26593 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
26594 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
26596 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26597 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
26598 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
26601 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26602 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
26603 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
26604 64-bit instruction set extensions.
26606 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26607 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
26608 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
26609 SSE4.2, ABM and 64-bit instruction set extensions.
26612 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
26613 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
26614 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
26615 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
26616 instruction set extensions.
26619 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
26620 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
26621 instruction set extensions.)
26624 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
26625 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
26626 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
26629 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
26633 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
26634 instruction set support.
26637 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
26638 (No scheduling is implemented for this chip.)
26641 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
26642 (No scheduling is implemented for this chip.)
26645 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26646 (No scheduling is implemented for this chip.)
26649 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
26650 (No scheduling is implemented for this chip.)
26653 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
26654 (No scheduling is implemented for this chip.)
26657 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26658 (No scheduling is implemented for this chip.)
26661 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
26662 (No scheduling is implemented for this chip.)
26665 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
26666 AVX and AVX2 instruction set support.
26667 (No scheduling is implemented for this chip.)
26670 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26671 instruction set support.
26672 (No scheduling is implemented for this chip.)
26675 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26676 instruction set support.
26677 (No scheduling is implemented for this chip.)
26680 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26681 instruction set support.
26682 (No scheduling is implemented for this chip.)
26685 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26686 instruction set support.
26687 (No scheduling is implemented for this chip.)
26690 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26691 instruction set support.
26692 (No scheduling is implemented for this chip.)
26695 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26696 instruction set support.
26697 (No scheduling is implemented for this chip.)
26700 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
26703 @item -mtune=@var{cpu-type}
26705 Tune to @var{cpu-type} everything applicable about the generated code, except
26706 for the ABI and the set of available instructions.
26707 While picking a specific @var{cpu-type} schedules things appropriately
26708 for that particular chip, the compiler does not generate any code that
26709 cannot run on the default machine type unless you use a
26710 @option{-march=@var{cpu-type}} option.
26711 For example, if GCC is configured for i686-pc-linux-gnu
26712 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
26713 but still runs on i686 machines.
26715 The choices for @var{cpu-type} are the same as for @option{-march}.
26716 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
26720 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
26721 If you know the CPU on which your code will run, then you should use
26722 the corresponding @option{-mtune} or @option{-march} option instead of
26723 @option{-mtune=generic}. But, if you do not know exactly what CPU users
26724 of your application will have, then you should use this option.
26726 As new processors are deployed in the marketplace, the behavior of this
26727 option will change. Therefore, if you upgrade to a newer version of
26728 GCC, code generation controlled by this option will change to reflect
26730 that are most common at the time that version of GCC is released.
26732 There is no @option{-march=generic} option because @option{-march}
26733 indicates the instruction set the compiler can use, and there is no
26734 generic instruction set applicable to all processors. In contrast,
26735 @option{-mtune} indicates the processor (or, in this case, collection of
26736 processors) for which the code is optimized.
26739 Produce code optimized for the most current Intel processors, which are
26740 Haswell and Silvermont for this version of GCC. If you know the CPU
26741 on which your code will run, then you should use the corresponding
26742 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
26743 But, if you want your application performs better on both Haswell and
26744 Silvermont, then you should use this option.
26746 As new Intel processors are deployed in the marketplace, the behavior of
26747 this option will change. Therefore, if you upgrade to a newer version of
26748 GCC, code generation controlled by this option will change to reflect
26749 the most current Intel processors at the time that version of GCC is
26752 There is no @option{-march=intel} option because @option{-march} indicates
26753 the instruction set the compiler can use, and there is no common
26754 instruction set applicable to all processors. In contrast,
26755 @option{-mtune} indicates the processor (or, in this case, collection of
26756 processors) for which the code is optimized.
26759 @item -mcpu=@var{cpu-type}
26761 A deprecated synonym for @option{-mtune}.
26763 @item -mfpmath=@var{unit}
26765 Generate floating-point arithmetic for selected unit @var{unit}. The choices
26766 for @var{unit} are:
26770 Use the standard 387 floating-point coprocessor present on the majority of chips and
26771 emulated otherwise. Code compiled with this option runs almost everywhere.
26772 The temporary results are computed in 80-bit precision instead of the precision
26773 specified by the type, resulting in slightly different results compared to most
26774 of other chips. See @option{-ffloat-store} for more detailed description.
26776 This is the default choice for non-Darwin x86-32 targets.
26779 Use scalar floating-point instructions present in the SSE instruction set.
26780 This instruction set is supported by Pentium III and newer chips,
26781 and in the AMD line
26782 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
26783 instruction set supports only single-precision arithmetic, thus the double and
26784 extended-precision arithmetic are still done using 387. A later version, present
26785 only in Pentium 4 and AMD x86-64 chips, supports double-precision
26788 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
26789 or @option{-msse2} switches to enable SSE extensions and make this option
26790 effective. For the x86-64 compiler, these extensions are enabled by default.
26792 The resulting code should be considerably faster in the majority of cases and avoid
26793 the numerical instability problems of 387 code, but may break some existing
26794 code that expects temporaries to be 80 bits.
26796 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
26797 and the default choice for x86-32 targets with the SSE2 instruction set
26798 when @option{-ffast-math} is enabled.
26803 Attempt to utilize both instruction sets at once. This effectively doubles the
26804 amount of available registers, and on chips with separate execution units for
26805 387 and SSE the execution resources too. Use this option with care, as it is
26806 still experimental, because the GCC register allocator does not model separate
26807 functional units well, resulting in unstable performance.
26810 @item -masm=@var{dialect}
26811 @opindex masm=@var{dialect}
26812 Output assembly instructions using selected @var{dialect}. Also affects
26813 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
26814 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
26815 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
26816 not support @samp{intel}.
26819 @itemx -mno-ieee-fp
26821 @opindex mno-ieee-fp
26822 Control whether or not the compiler uses IEEE floating-point
26823 comparisons. These correctly handle the case where the result of a
26824 comparison is unordered.
26827 @itemx -mhard-float
26829 @opindex mhard-float
26830 Generate output containing 80387 instructions for floating point.
26833 @itemx -msoft-float
26835 @opindex msoft-float
26836 Generate output containing library calls for floating point.
26838 @strong{Warning:} the requisite libraries are not part of GCC@.
26839 Normally the facilities of the machine's usual C compiler are used, but
26840 this cannot be done directly in cross-compilation. You must make your
26841 own arrangements to provide suitable library functions for
26844 On machines where a function returns floating-point results in the 80387
26845 register stack, some floating-point opcodes may be emitted even if
26846 @option{-msoft-float} is used.
26848 @item -mno-fp-ret-in-387
26849 @opindex mno-fp-ret-in-387
26850 Do not use the FPU registers for return values of functions.
26852 The usual calling convention has functions return values of types
26853 @code{float} and @code{double} in an FPU register, even if there
26854 is no FPU@. The idea is that the operating system should emulate
26857 The option @option{-mno-fp-ret-in-387} causes such values to be returned
26858 in ordinary CPU registers instead.
26860 @item -mno-fancy-math-387
26861 @opindex mno-fancy-math-387
26862 Some 387 emulators do not support the @code{sin}, @code{cos} and
26863 @code{sqrt} instructions for the 387. Specify this option to avoid
26864 generating those instructions.
26865 This option is overridden when @option{-march}
26866 indicates that the target CPU always has an FPU and so the
26867 instruction does not need emulation. These
26868 instructions are not generated unless you also use the
26869 @option{-funsafe-math-optimizations} switch.
26871 @item -malign-double
26872 @itemx -mno-align-double
26873 @opindex malign-double
26874 @opindex mno-align-double
26875 Control whether GCC aligns @code{double}, @code{long double}, and
26876 @code{long long} variables on a two-word boundary or a one-word
26877 boundary. Aligning @code{double} variables on a two-word boundary
26878 produces code that runs somewhat faster on a Pentium at the
26879 expense of more memory.
26881 On x86-64, @option{-malign-double} is enabled by default.
26883 @strong{Warning:} if you use the @option{-malign-double} switch,
26884 structures containing the above types are aligned differently than
26885 the published application binary interface specifications for the x86-32
26886 and are not binary compatible with structures in code compiled
26887 without that switch.
26889 @item -m96bit-long-double
26890 @itemx -m128bit-long-double
26891 @opindex m96bit-long-double
26892 @opindex m128bit-long-double
26893 These switches control the size of @code{long double} type. The x86-32
26894 application binary interface specifies the size to be 96 bits,
26895 so @option{-m96bit-long-double} is the default in 32-bit mode.
26897 Modern architectures (Pentium and newer) prefer @code{long double}
26898 to be aligned to an 8- or 16-byte boundary. In arrays or structures
26899 conforming to the ABI, this is not possible. So specifying
26900 @option{-m128bit-long-double} aligns @code{long double}
26901 to a 16-byte boundary by padding the @code{long double} with an additional
26904 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
26905 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
26907 Notice that neither of these options enable any extra precision over the x87
26908 standard of 80 bits for a @code{long double}.
26910 @strong{Warning:} if you override the default value for your target ABI, this
26911 changes the size of
26912 structures and arrays containing @code{long double} variables,
26913 as well as modifying the function calling convention for functions taking
26914 @code{long double}. Hence they are not binary-compatible
26915 with code compiled without that switch.
26917 @item -mlong-double-64
26918 @itemx -mlong-double-80
26919 @itemx -mlong-double-128
26920 @opindex mlong-double-64
26921 @opindex mlong-double-80
26922 @opindex mlong-double-128
26923 These switches control the size of @code{long double} type. A size
26924 of 64 bits makes the @code{long double} type equivalent to the @code{double}
26925 type. This is the default for 32-bit Bionic C library. A size
26926 of 128 bits makes the @code{long double} type equivalent to the
26927 @code{__float128} type. This is the default for 64-bit Bionic C library.
26929 @strong{Warning:} if you override the default value for your target ABI, this
26930 changes the size of
26931 structures and arrays containing @code{long double} variables,
26932 as well as modifying the function calling convention for functions taking
26933 @code{long double}. Hence they are not binary-compatible
26934 with code compiled without that switch.
26936 @item -malign-data=@var{type}
26937 @opindex malign-data
26938 Control how GCC aligns variables. Supported values for @var{type} are
26939 @samp{compat} uses increased alignment value compatible uses GCC 4.8
26940 and earlier, @samp{abi} uses alignment value as specified by the
26941 psABI, and @samp{cacheline} uses increased alignment value to match
26942 the cache line size. @samp{compat} is the default.
26944 @item -mlarge-data-threshold=@var{threshold}
26945 @opindex mlarge-data-threshold
26946 When @option{-mcmodel=medium} is specified, data objects larger than
26947 @var{threshold} are placed in the large data section. This value must be the
26948 same across all objects linked into the binary, and defaults to 65535.
26952 Use a different function-calling convention, in which functions that
26953 take a fixed number of arguments return with the @code{ret @var{num}}
26954 instruction, which pops their arguments while returning. This saves one
26955 instruction in the caller since there is no need to pop the arguments
26958 You can specify that an individual function is called with this calling
26959 sequence with the function attribute @code{stdcall}. You can also
26960 override the @option{-mrtd} option by using the function attribute
26961 @code{cdecl}. @xref{Function Attributes}.
26963 @strong{Warning:} this calling convention is incompatible with the one
26964 normally used on Unix, so you cannot use it if you need to call
26965 libraries compiled with the Unix compiler.
26967 Also, you must provide function prototypes for all functions that
26968 take variable numbers of arguments (including @code{printf});
26969 otherwise incorrect code is generated for calls to those
26972 In addition, seriously incorrect code results if you call a
26973 function with too many arguments. (Normally, extra arguments are
26974 harmlessly ignored.)
26976 @item -mregparm=@var{num}
26978 Control how many registers are used to pass integer arguments. By
26979 default, no registers are used to pass arguments, and at most 3
26980 registers can be used. You can control this behavior for a specific
26981 function by using the function attribute @code{regparm}.
26982 @xref{Function Attributes}.
26984 @strong{Warning:} if you use this switch, and
26985 @var{num} is nonzero, then you must build all modules with the same
26986 value, including any libraries. This includes the system libraries and
26990 @opindex msseregparm
26991 Use SSE register passing conventions for float and double arguments
26992 and return values. You can control this behavior for a specific
26993 function by using the function attribute @code{sseregparm}.
26994 @xref{Function Attributes}.
26996 @strong{Warning:} if you use this switch then you must build all
26997 modules with the same value, including any libraries. This includes
26998 the system libraries and startup modules.
27000 @item -mvect8-ret-in-mem
27001 @opindex mvect8-ret-in-mem
27002 Return 8-byte vectors in memory instead of MMX registers. This is the
27003 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27004 Studio compilers until version 12. Later compiler versions (starting
27005 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27006 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27007 you need to remain compatible with existing code produced by those
27008 previous compiler versions or older versions of GCC@.
27017 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27018 is specified, the significands of results of floating-point operations are
27019 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27020 significands of results of floating-point operations to 53 bits (double
27021 precision) and @option{-mpc80} rounds the significands of results of
27022 floating-point operations to 64 bits (extended double precision), which is
27023 the default. When this option is used, floating-point operations in higher
27024 precisions are not available to the programmer without setting the FPU
27025 control word explicitly.
27027 Setting the rounding of floating-point operations to less than the default
27028 80 bits can speed some programs by 2% or more. Note that some mathematical
27029 libraries assume that extended-precision (80-bit) floating-point operations
27030 are enabled by default; routines in such libraries could suffer significant
27031 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27032 when this option is used to set the precision to less than extended precision.
27034 @item -mstackrealign
27035 @opindex mstackrealign
27036 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27037 option generates an alternate prologue and epilogue that realigns the
27038 run-time stack if necessary. This supports mixing legacy codes that keep
27039 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27040 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27041 applicable to individual functions.
27043 @item -mpreferred-stack-boundary=@var{num}
27044 @opindex mpreferred-stack-boundary
27045 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27046 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27047 the default is 4 (16 bytes or 128 bits).
27049 @strong{Warning:} When generating code for the x86-64 architecture with
27050 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27051 used to keep the stack boundary aligned to 8 byte boundary. Since
27052 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27053 intended to be used in controlled environment where stack space is
27054 important limitation. This option leads to wrong code when functions
27055 compiled with 16 byte stack alignment (such as functions from a standard
27056 library) are called with misaligned stack. In this case, SSE
27057 instructions may lead to misaligned memory access traps. In addition,
27058 variable arguments are handled incorrectly for 16 byte aligned
27059 objects (including x87 long double and __int128), leading to wrong
27060 results. You must build all modules with
27061 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27062 includes the system libraries and startup modules.
27064 @item -mincoming-stack-boundary=@var{num}
27065 @opindex mincoming-stack-boundary
27066 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27067 boundary. If @option{-mincoming-stack-boundary} is not specified,
27068 the one specified by @option{-mpreferred-stack-boundary} is used.
27070 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27071 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27072 suffer significant run time performance penalties. On Pentium III, the
27073 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27074 properly if it is not 16-byte aligned.
27076 To ensure proper alignment of this values on the stack, the stack boundary
27077 must be as aligned as that required by any value stored on the stack.
27078 Further, every function must be generated such that it keeps the stack
27079 aligned. Thus calling a function compiled with a higher preferred
27080 stack boundary from a function compiled with a lower preferred stack
27081 boundary most likely misaligns the stack. It is recommended that
27082 libraries that use callbacks always use the default setting.
27084 This extra alignment does consume extra stack space, and generally
27085 increases code size. Code that is sensitive to stack space usage, such
27086 as embedded systems and operating system kernels, may want to reduce the
27087 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27144 @itemx -mavx512ifma
27145 @opindex mavx512ifma
27147 @itemx -mavx512vbmi
27148 @opindex mavx512vbmi
27159 @itemx -mclflushopt
27160 @opindex mclflushopt
27183 @itemx -mprefetchwt1
27184 @opindex mprefetchwt1
27242 @itemx -mavx512vbmi2
27243 @opindex mavx512vbmi2
27254 @itemx -mvpclmulqdq
27255 @opindex mvpclmulqdq
27257 @itemx -mavx512bitalg
27258 @opindex mavx512bitalg
27264 @opindex mmovdir64b
27266 @itemx -mavx512vpopcntdq
27267 @opindex mavx512vpopcntdq
27271 These switches enable the use of instructions in the MMX, SSE,
27272 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27273 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27274 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27275 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27276 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27277 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27278 sets. Each has a corresponding @option{-mno-} option to disable use of these
27281 These extensions are also available as built-in functions: see
27282 @ref{x86 Built-in Functions}, for details of the functions enabled and
27283 disabled by these switches.
27285 To generate SSE/SSE2 instructions automatically from floating-point
27286 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27288 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27289 generates new AVX instructions or AVX equivalence for all SSEx instructions
27292 These options enable GCC to use these extended instructions in
27293 generated code, even without @option{-mfpmath=sse}. Applications that
27294 perform run-time CPU detection must compile separate files for each
27295 supported architecture, using the appropriate flags. In particular,
27296 the file containing the CPU detection code should be compiled without
27299 @item -mdump-tune-features
27300 @opindex mdump-tune-features
27301 This option instructs GCC to dump the names of the x86 performance
27302 tuning features and default settings. The names can be used in
27303 @option{-mtune-ctrl=@var{feature-list}}.
27305 @item -mtune-ctrl=@var{feature-list}
27306 @opindex mtune-ctrl=@var{feature-list}
27307 This option is used to do fine grain control of x86 code generation features.
27308 @var{feature-list} is a comma separated list of @var{feature} names. See also
27309 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27310 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27311 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27312 developers. Using it may lead to code paths not covered by testing and can
27313 potentially result in compiler ICEs or runtime errors.
27316 @opindex mno-default
27317 This option instructs GCC to turn off all tunable features. See also
27318 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27322 This option instructs GCC to emit a @code{cld} instruction in the prologue
27323 of functions that use string instructions. String instructions depend on
27324 the DF flag to select between autoincrement or autodecrement mode. While the
27325 ABI specifies the DF flag to be cleared on function entry, some operating
27326 systems violate this specification by not clearing the DF flag in their
27327 exception dispatchers. The exception handler can be invoked with the DF flag
27328 set, which leads to wrong direction mode when string instructions are used.
27329 This option can be enabled by default on 32-bit x86 targets by configuring
27330 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27331 instructions can be suppressed with the @option{-mno-cld} compiler option
27335 @opindex mvzeroupper
27336 This option instructs GCC to emit a @code{vzeroupper} instruction
27337 before a transfer of control flow out of the function to minimize
27338 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27341 @item -mprefer-avx128
27342 @opindex mprefer-avx128
27343 This option instructs GCC to use 128-bit AVX instructions instead of
27344 256-bit AVX instructions in the auto-vectorizer.
27346 @item -mprefer-vector-width=@var{opt}
27347 @opindex mprefer-vector-width
27348 This option instructs GCC to use @var{opt}-bit vector width in instructions
27349 instead of default on the selected platform.
27353 No extra limitations applied to GCC other than defined by the selected platform.
27356 Prefer 128-bit vector width for instructions.
27359 Prefer 256-bit vector width for instructions.
27362 Prefer 512-bit vector width for instructions.
27367 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27368 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27369 objects. This is useful for atomic updates of data structures exceeding one
27370 machine word in size. The compiler uses this instruction to implement
27371 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27372 128-bit integers, a library call is always used.
27376 This option enables generation of @code{SAHF} instructions in 64-bit code.
27377 Early Intel Pentium 4 CPUs with Intel 64 support,
27378 prior to the introduction of Pentium 4 G1 step in December 2005,
27379 lacked the @code{LAHF} and @code{SAHF} instructions
27380 which are supported by AMD64.
27381 These are load and store instructions, respectively, for certain status flags.
27382 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27383 @code{drem}, and @code{remainder} built-in functions;
27384 see @ref{Other Builtins} for details.
27388 This option enables use of the @code{movbe} instruction to implement
27389 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27393 The @option{-mshstk} option enables shadow stack built-in functions
27394 from x86 Control-flow Enforcement Technology (CET).
27398 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27399 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27400 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27404 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27405 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27406 with an additional Newton-Raphson step
27407 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27408 (and their vectorized
27409 variants) for single-precision floating-point arguments. These instructions
27410 are generated only when @option{-funsafe-math-optimizations} is enabled
27411 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27412 Note that while the throughput of the sequence is higher than the throughput
27413 of the non-reciprocal instruction, the precision of the sequence can be
27414 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27416 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27417 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27418 combination), and doesn't need @option{-mrecip}.
27420 Also note that GCC emits the above sequence with additional Newton-Raphson step
27421 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27422 already with @option{-ffast-math} (or the above option combination), and
27423 doesn't need @option{-mrecip}.
27425 @item -mrecip=@var{opt}
27426 @opindex mrecip=opt
27427 This option controls which reciprocal estimate instructions
27428 may be used. @var{opt} is a comma-separated list of options, which may
27429 be preceded by a @samp{!} to invert the option:
27433 Enable all estimate instructions.
27436 Enable the default instructions, equivalent to @option{-mrecip}.
27439 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27442 Enable the approximation for scalar division.
27445 Enable the approximation for vectorized division.
27448 Enable the approximation for scalar square root.
27451 Enable the approximation for vectorized square root.
27454 So, for example, @option{-mrecip=all,!sqrt} enables
27455 all of the reciprocal approximations, except for square root.
27457 @item -mveclibabi=@var{type}
27458 @opindex mveclibabi
27459 Specifies the ABI type to use for vectorizing intrinsics using an
27460 external library. Supported values for @var{type} are @samp{svml}
27461 for the Intel short
27462 vector math library and @samp{acml} for the AMD math core library.
27463 To use this option, both @option{-ftree-vectorize} and
27464 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27465 ABI-compatible library must be specified at link time.
27467 GCC currently emits calls to @code{vmldExp2},
27468 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
27469 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27470 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27471 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27472 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
27473 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27474 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27475 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27476 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27477 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27478 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27479 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27480 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27481 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27482 when @option{-mveclibabi=acml} is used.
27484 @item -mabi=@var{name}
27486 Generate code for the specified calling convention. Permissible values
27487 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
27488 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
27489 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
27490 You can control this behavior for specific functions by
27491 using the function attributes @code{ms_abi} and @code{sysv_abi}.
27492 @xref{Function Attributes}.
27494 @item -mforce-indirect-call
27495 @opindex mforce-indirect-call
27496 Force all calls to functions to be indirect. This is useful
27497 when using Intel Processor Trace where it generates more precise timing
27498 information for function calls.
27500 @item -mcall-ms2sysv-xlogues
27501 @opindex mcall-ms2sysv-xlogues
27502 @opindex mno-call-ms2sysv-xlogues
27503 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
27504 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
27505 default, the code for saving and restoring these registers is emitted inline,
27506 resulting in fairly lengthy prologues and epilogues. Using
27507 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
27508 use stubs in the static portion of libgcc to perform these saves and restores,
27509 thus reducing function size at the cost of a few extra instructions.
27511 @item -mtls-dialect=@var{type}
27512 @opindex mtls-dialect
27513 Generate code to access thread-local storage using the @samp{gnu} or
27514 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
27515 @samp{gnu2} is more efficient, but it may add compile- and run-time
27516 requirements that cannot be satisfied on all systems.
27519 @itemx -mno-push-args
27520 @opindex mpush-args
27521 @opindex mno-push-args
27522 Use PUSH operations to store outgoing parameters. This method is shorter
27523 and usually equally fast as method using SUB/MOV operations and is enabled
27524 by default. In some cases disabling it may improve performance because of
27525 improved scheduling and reduced dependencies.
27527 @item -maccumulate-outgoing-args
27528 @opindex maccumulate-outgoing-args
27529 If enabled, the maximum amount of space required for outgoing arguments is
27530 computed in the function prologue. This is faster on most modern CPUs
27531 because of reduced dependencies, improved scheduling and reduced stack usage
27532 when the preferred stack boundary is not equal to 2. The drawback is a notable
27533 increase in code size. This switch implies @option{-mno-push-args}.
27537 Support thread-safe exception handling on MinGW. Programs that rely
27538 on thread-safe exception handling must compile and link all code with the
27539 @option{-mthreads} option. When compiling, @option{-mthreads} defines
27540 @option{-D_MT}; when linking, it links in a special thread helper library
27541 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
27543 @item -mms-bitfields
27544 @itemx -mno-ms-bitfields
27545 @opindex mms-bitfields
27546 @opindex mno-ms-bitfields
27548 Enable/disable bit-field layout compatible with the native Microsoft
27551 If @code{packed} is used on a structure, or if bit-fields are used,
27552 it may be that the Microsoft ABI lays out the structure differently
27553 than the way GCC normally does. Particularly when moving packed
27554 data between functions compiled with GCC and the native Microsoft compiler
27555 (either via function call or as data in a file), it may be necessary to access
27558 This option is enabled by default for Microsoft Windows
27559 targets. This behavior can also be controlled locally by use of variable
27560 or type attributes. For more information, see @ref{x86 Variable Attributes}
27561 and @ref{x86 Type Attributes}.
27563 The Microsoft structure layout algorithm is fairly simple with the exception
27564 of the bit-field packing.
27565 The padding and alignment of members of structures and whether a bit-field
27566 can straddle a storage-unit boundary are determine by these rules:
27569 @item Structure members are stored sequentially in the order in which they are
27570 declared: the first member has the lowest memory address and the last member
27573 @item Every data object has an alignment requirement. The alignment requirement
27574 for all data except structures, unions, and arrays is either the size of the
27575 object or the current packing size (specified with either the
27576 @code{aligned} attribute or the @code{pack} pragma),
27577 whichever is less. For structures, unions, and arrays,
27578 the alignment requirement is the largest alignment requirement of its members.
27579 Every object is allocated an offset so that:
27582 offset % alignment_requirement == 0
27585 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
27586 unit if the integral types are the same size and if the next bit-field fits
27587 into the current allocation unit without crossing the boundary imposed by the
27588 common alignment requirements of the bit-fields.
27591 MSVC interprets zero-length bit-fields in the following ways:
27594 @item If a zero-length bit-field is inserted between two bit-fields that
27595 are normally coalesced, the bit-fields are not coalesced.
27602 unsigned long bf_1 : 12;
27604 unsigned long bf_2 : 12;
27609 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
27610 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
27612 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
27613 alignment of the zero-length bit-field is greater than the member that follows it,
27614 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
27635 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
27636 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
27637 bit-field does not affect the alignment of @code{bar} or, as a result, the size
27640 Taking this into account, it is important to note the following:
27643 @item If a zero-length bit-field follows a normal bit-field, the type of the
27644 zero-length bit-field may affect the alignment of the structure as whole. For
27645 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
27646 normal bit-field, and is of type short.
27648 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
27649 still affect the alignment of the structure:
27660 Here, @code{t4} takes up 4 bytes.
27663 @item Zero-length bit-fields following non-bit-field members are ignored:
27675 Here, @code{t5} takes up 2 bytes.
27679 @item -mno-align-stringops
27680 @opindex mno-align-stringops
27681 Do not align the destination of inlined string operations. This switch reduces
27682 code size and improves performance in case the destination is already aligned,
27683 but GCC doesn't know about it.
27685 @item -minline-all-stringops
27686 @opindex minline-all-stringops
27687 By default GCC inlines string operations only when the destination is
27688 known to be aligned to least a 4-byte boundary.
27689 This enables more inlining and increases code
27690 size, but may improve performance of code that depends on fast
27691 @code{memcpy}, @code{strlen},
27692 and @code{memset} for short lengths.
27694 @item -minline-stringops-dynamically
27695 @opindex minline-stringops-dynamically
27696 For string operations of unknown size, use run-time checks with
27697 inline code for small blocks and a library call for large blocks.
27699 @item -mstringop-strategy=@var{alg}
27700 @opindex mstringop-strategy=@var{alg}
27701 Override the internal decision heuristic for the particular algorithm to use
27702 for inlining string operations. The allowed values for @var{alg} are:
27708 Expand using i386 @code{rep} prefix of the specified size.
27712 @itemx unrolled_loop
27713 Expand into an inline loop.
27716 Always use a library call.
27719 @item -mmemcpy-strategy=@var{strategy}
27720 @opindex mmemcpy-strategy=@var{strategy}
27721 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
27722 should be inlined and what inline algorithm to use when the expected size
27723 of the copy operation is known. @var{strategy}
27724 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
27725 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
27726 the max byte size with which inline algorithm @var{alg} is allowed. For the last
27727 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
27728 in the list must be specified in increasing order. The minimal byte size for
27729 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
27732 @item -mmemset-strategy=@var{strategy}
27733 @opindex mmemset-strategy=@var{strategy}
27734 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
27735 @code{__builtin_memset} expansion.
27737 @item -momit-leaf-frame-pointer
27738 @opindex momit-leaf-frame-pointer
27739 Don't keep the frame pointer in a register for leaf functions. This
27740 avoids the instructions to save, set up, and restore frame pointers and
27741 makes an extra register available in leaf functions. The option
27742 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
27743 which might make debugging harder.
27745 @item -mtls-direct-seg-refs
27746 @itemx -mno-tls-direct-seg-refs
27747 @opindex mtls-direct-seg-refs
27748 Controls whether TLS variables may be accessed with offsets from the
27749 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
27750 or whether the thread base pointer must be added. Whether or not this
27751 is valid depends on the operating system, and whether it maps the
27752 segment to cover the entire TLS area.
27754 For systems that use the GNU C Library, the default is on.
27757 @itemx -mno-sse2avx
27759 Specify that the assembler should encode SSE instructions with VEX
27760 prefix. The option @option{-mavx} turns this on by default.
27765 If profiling is active (@option{-pg}), put the profiling
27766 counter call before the prologue.
27767 Note: On x86 architectures the attribute @code{ms_hook_prologue}
27768 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
27770 @item -mrecord-mcount
27771 @itemx -mno-record-mcount
27772 @opindex mrecord-mcount
27773 If profiling is active (@option{-pg}), generate a __mcount_loc section
27774 that contains pointers to each profiling call. This is useful for
27775 automatically patching and out calls.
27778 @itemx -mno-nop-mcount
27779 @opindex mnop-mcount
27780 If profiling is active (@option{-pg}), generate the calls to
27781 the profiling functions as NOPs. This is useful when they
27782 should be patched in later dynamically. This is likely only
27783 useful together with @option{-mrecord-mcount}.
27785 @item -mskip-rax-setup
27786 @itemx -mno-skip-rax-setup
27787 @opindex mskip-rax-setup
27788 When generating code for the x86-64 architecture with SSE extensions
27789 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
27790 register when there are no variable arguments passed in vector registers.
27792 @strong{Warning:} Since RAX register is used to avoid unnecessarily
27793 saving vector registers on stack when passing variable arguments, the
27794 impacts of this option are callees may waste some stack space,
27795 misbehave or jump to a random location. GCC 4.4 or newer don't have
27796 those issues, regardless the RAX register value.
27799 @itemx -mno-8bit-idiv
27800 @opindex m8bit-idiv
27801 On some processors, like Intel Atom, 8-bit unsigned integer divide is
27802 much faster than 32-bit/64-bit integer divide. This option generates a
27803 run-time check. If both dividend and divisor are within range of 0
27804 to 255, 8-bit unsigned integer divide is used instead of
27805 32-bit/64-bit integer divide.
27807 @item -mavx256-split-unaligned-load
27808 @itemx -mavx256-split-unaligned-store
27809 @opindex mavx256-split-unaligned-load
27810 @opindex mavx256-split-unaligned-store
27811 Split 32-byte AVX unaligned load and store.
27813 @item -mstack-protector-guard=@var{guard}
27814 @itemx -mstack-protector-guard-reg=@var{reg}
27815 @itemx -mstack-protector-guard-offset=@var{offset}
27816 @opindex mstack-protector-guard
27817 @opindex mstack-protector-guard-reg
27818 @opindex mstack-protector-guard-offset
27819 Generate stack protection code using canary at @var{guard}. Supported
27820 locations are @samp{global} for global canary or @samp{tls} for per-thread
27821 canary in the TLS block (the default). This option has effect only when
27822 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
27824 With the latter choice the options
27825 @option{-mstack-protector-guard-reg=@var{reg}} and
27826 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27827 which segment register (@code{%fs} or @code{%gs}) to use as base register
27828 for reading the canary, and from what offset from that base register.
27829 The default for those is as specified in the relevant ABI.
27831 @item -mmitigate-rop
27832 @opindex mmitigate-rop
27833 Try to avoid generating code sequences that contain unintended return
27834 opcodes, to mitigate against certain forms of attack. At the moment,
27835 this option is limited in what it can do and should not be relied
27836 on to provide serious protection.
27838 @item -mgeneral-regs-only
27839 @opindex mgeneral-regs-only
27840 Generate code that uses only the general-purpose registers. This
27841 prevents the compiler from using floating-point, vector, mask and bound
27844 @item -mindirect-branch=@var{choice}
27845 @opindex -mindirect-branch
27846 Convert indirect call and jump with @var{choice}. The default is
27847 @samp{keep}, which keeps indirect call and jump unmodified.
27848 @samp{thunk} converts indirect call and jump to call and return thunk.
27849 @samp{thunk-inline} converts indirect call and jump to inlined call
27850 and return thunk. @samp{thunk-extern} converts indirect call and jump
27851 to external call and return thunk provided in a separate object file.
27852 You can control this behavior for a specific function by using the
27853 function attribute @code{indirect_branch}. @xref{Function Attributes}.
27855 Note that @option{-mcmodel=large} is incompatible with
27856 @option{-mindirect-branch=thunk} and
27857 @option{-mindirect-branch=thunk-extern} since the thunk function may
27858 not be reachable in the large code model.
27860 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
27861 @option{-fcf-protection=branch} since the external thunk can not be modified
27862 to disable control-flow check.
27864 @item -mfunction-return=@var{choice}
27865 @opindex -mfunction-return
27866 Convert function return with @var{choice}. The default is @samp{keep},
27867 which keeps function return unmodified. @samp{thunk} converts function
27868 return to call and return thunk. @samp{thunk-inline} converts function
27869 return to inlined call and return thunk. @samp{thunk-extern} converts
27870 function return to external call and return thunk provided in a separate
27871 object file. You can control this behavior for a specific function by
27872 using the function attribute @code{function_return}.
27873 @xref{Function Attributes}.
27875 Note that @option{-mcmodel=large} is incompatible with
27876 @option{-mfunction-return=thunk} and
27877 @option{-mfunction-return=thunk-extern} since the thunk function may
27878 not be reachable in the large code model.
27881 @item -mindirect-branch-register
27882 @opindex -mindirect-branch-register
27883 Force indirect call and jump via register.
27887 These @samp{-m} switches are supported in addition to the above
27888 on x86-64 processors in 64-bit environments.
27901 Generate code for a 16-bit, 32-bit or 64-bit environment.
27902 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
27904 generates code that runs on any i386 system.
27906 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
27907 types to 64 bits, and generates code for the x86-64 architecture.
27908 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
27909 and @option{-mdynamic-no-pic} options.
27911 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
27913 generates code for the x86-64 architecture.
27915 The @option{-m16} option is the same as @option{-m32}, except for that
27916 it outputs the @code{.code16gcc} assembly directive at the beginning of
27917 the assembly output so that the binary can run in 16-bit mode.
27919 The @option{-miamcu} option generates code which conforms to Intel MCU
27920 psABI. It requires the @option{-m32} option to be turned on.
27922 @item -mno-red-zone
27923 @opindex mno-red-zone
27924 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
27925 by the x86-64 ABI; it is a 128-byte area beyond the location of the
27926 stack pointer that is not modified by signal or interrupt handlers
27927 and therefore can be used for temporary data without adjusting the stack
27928 pointer. The flag @option{-mno-red-zone} disables this red zone.
27930 @item -mcmodel=small
27931 @opindex mcmodel=small
27932 Generate code for the small code model: the program and its symbols must
27933 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
27934 Programs can be statically or dynamically linked. This is the default
27937 @item -mcmodel=kernel
27938 @opindex mcmodel=kernel
27939 Generate code for the kernel code model. The kernel runs in the
27940 negative 2 GB of the address space.
27941 This model has to be used for Linux kernel code.
27943 @item -mcmodel=medium
27944 @opindex mcmodel=medium
27945 Generate code for the medium model: the program is linked in the lower 2
27946 GB of the address space. Small symbols are also placed there. Symbols
27947 with sizes larger than @option{-mlarge-data-threshold} are put into
27948 large data or BSS sections and can be located above 2GB. Programs can
27949 be statically or dynamically linked.
27951 @item -mcmodel=large
27952 @opindex mcmodel=large
27953 Generate code for the large model. This model makes no assumptions
27954 about addresses and sizes of sections.
27956 @item -maddress-mode=long
27957 @opindex maddress-mode=long
27958 Generate code for long address mode. This is only supported for 64-bit
27959 and x32 environments. It is the default address mode for 64-bit
27962 @item -maddress-mode=short
27963 @opindex maddress-mode=short
27964 Generate code for short address mode. This is only supported for 32-bit
27965 and x32 environments. It is the default address mode for 32-bit and
27969 @node x86 Windows Options
27970 @subsection x86 Windows Options
27971 @cindex x86 Windows Options
27972 @cindex Windows Options for x86
27974 These additional options are available for Microsoft Windows targets:
27980 specifies that a console application is to be generated, by
27981 instructing the linker to set the PE header subsystem type
27982 required for console applications.
27983 This option is available for Cygwin and MinGW targets and is
27984 enabled by default on those targets.
27988 This option is available for Cygwin and MinGW targets. It
27989 specifies that a DLL---a dynamic link library---is to be
27990 generated, enabling the selection of the required runtime
27991 startup object and entry point.
27993 @item -mnop-fun-dllimport
27994 @opindex mnop-fun-dllimport
27995 This option is available for Cygwin and MinGW targets. It
27996 specifies that the @code{dllimport} attribute should be ignored.
28000 This option is available for MinGW targets. It specifies
28001 that MinGW-specific thread support is to be used.
28005 This option is available for MinGW-w64 targets. It causes
28006 the @code{UNICODE} preprocessor macro to be predefined, and
28007 chooses Unicode-capable runtime startup code.
28011 This option is available for Cygwin and MinGW targets. It
28012 specifies that the typical Microsoft Windows predefined macros are to
28013 be set in the pre-processor, but does not influence the choice
28014 of runtime library/startup code.
28018 This option is available for Cygwin and MinGW targets. It
28019 specifies that a GUI application is to be generated by
28020 instructing the linker to set the PE header subsystem type
28023 @item -fno-set-stack-executable
28024 @opindex fno-set-stack-executable
28025 This option is available for MinGW targets. It specifies that
28026 the executable flag for the stack used by nested functions isn't
28027 set. This is necessary for binaries running in kernel mode of
28028 Microsoft Windows, as there the User32 API, which is used to set executable
28029 privileges, isn't available.
28031 @item -fwritable-relocated-rdata
28032 @opindex fno-writable-relocated-rdata
28033 This option is available for MinGW and Cygwin targets. It specifies
28034 that relocated-data in read-only section is put into the @code{.data}
28035 section. This is a necessary for older runtimes not supporting
28036 modification of @code{.rdata} sections for pseudo-relocation.
28038 @item -mpe-aligned-commons
28039 @opindex mpe-aligned-commons
28040 This option is available for Cygwin and MinGW targets. It
28041 specifies that the GNU extension to the PE file format that
28042 permits the correct alignment of COMMON variables should be
28043 used when generating code. It is enabled by default if
28044 GCC detects that the target assembler found during configuration
28045 supports the feature.
28048 See also under @ref{x86 Options} for standard options.
28050 @node Xstormy16 Options
28051 @subsection Xstormy16 Options
28052 @cindex Xstormy16 Options
28054 These options are defined for Xstormy16:
28059 Choose startup files and linker script suitable for the simulator.
28062 @node Xtensa Options
28063 @subsection Xtensa Options
28064 @cindex Xtensa Options
28066 These options are supported for Xtensa targets:
28070 @itemx -mno-const16
28072 @opindex mno-const16
28073 Enable or disable use of @code{CONST16} instructions for loading
28074 constant values. The @code{CONST16} instruction is currently not a
28075 standard option from Tensilica. When enabled, @code{CONST16}
28076 instructions are always used in place of the standard @code{L32R}
28077 instructions. The use of @code{CONST16} is enabled by default only if
28078 the @code{L32R} instruction is not available.
28081 @itemx -mno-fused-madd
28082 @opindex mfused-madd
28083 @opindex mno-fused-madd
28084 Enable or disable use of fused multiply/add and multiply/subtract
28085 instructions in the floating-point option. This has no effect if the
28086 floating-point option is not also enabled. Disabling fused multiply/add
28087 and multiply/subtract instructions forces the compiler to use separate
28088 instructions for the multiply and add/subtract operations. This may be
28089 desirable in some cases where strict IEEE 754-compliant results are
28090 required: the fused multiply add/subtract instructions do not round the
28091 intermediate result, thereby producing results with @emph{more} bits of
28092 precision than specified by the IEEE standard. Disabling fused multiply
28093 add/subtract instructions also ensures that the program output is not
28094 sensitive to the compiler's ability to combine multiply and add/subtract
28097 @item -mserialize-volatile
28098 @itemx -mno-serialize-volatile
28099 @opindex mserialize-volatile
28100 @opindex mno-serialize-volatile
28101 When this option is enabled, GCC inserts @code{MEMW} instructions before
28102 @code{volatile} memory references to guarantee sequential consistency.
28103 The default is @option{-mserialize-volatile}. Use
28104 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28106 @item -mforce-no-pic
28107 @opindex mforce-no-pic
28108 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28109 position-independent code (PIC), this option disables PIC for compiling
28112 @item -mtext-section-literals
28113 @itemx -mno-text-section-literals
28114 @opindex mtext-section-literals
28115 @opindex mno-text-section-literals
28116 These options control the treatment of literal pools. The default is
28117 @option{-mno-text-section-literals}, which places literals in a separate
28118 section in the output file. This allows the literal pool to be placed
28119 in a data RAM/ROM, and it also allows the linker to combine literal
28120 pools from separate object files to remove redundant literals and
28121 improve code size. With @option{-mtext-section-literals}, the literals
28122 are interspersed in the text section in order to keep them as close as
28123 possible to their references. This may be necessary for large assembly
28124 files. Literals for each function are placed right before that function.
28126 @item -mauto-litpools
28127 @itemx -mno-auto-litpools
28128 @opindex mauto-litpools
28129 @opindex mno-auto-litpools
28130 These options control the treatment of literal pools. The default is
28131 @option{-mno-auto-litpools}, which places literals in a separate
28132 section in the output file unless @option{-mtext-section-literals} is
28133 used. With @option{-mauto-litpools} the literals are interspersed in
28134 the text section by the assembler. Compiler does not produce explicit
28135 @code{.literal} directives and loads literals into registers with
28136 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28137 do relaxation and place literals as necessary. This option allows
28138 assembler to create several literal pools per function and assemble
28139 very big functions, which may not be possible with
28140 @option{-mtext-section-literals}.
28142 @item -mtarget-align
28143 @itemx -mno-target-align
28144 @opindex mtarget-align
28145 @opindex mno-target-align
28146 When this option is enabled, GCC instructs the assembler to
28147 automatically align instructions to reduce branch penalties at the
28148 expense of some code density. The assembler attempts to widen density
28149 instructions to align branch targets and the instructions following call
28150 instructions. If there are not enough preceding safe density
28151 instructions to align a target, no widening is performed. The
28152 default is @option{-mtarget-align}. These options do not affect the
28153 treatment of auto-aligned instructions like @code{LOOP}, which the
28154 assembler always aligns, either by widening density instructions or
28155 by inserting NOP instructions.
28158 @itemx -mno-longcalls
28159 @opindex mlongcalls
28160 @opindex mno-longcalls
28161 When this option is enabled, GCC instructs the assembler to translate
28162 direct calls to indirect calls unless it can determine that the target
28163 of a direct call is in the range allowed by the call instruction. This
28164 translation typically occurs for calls to functions in other source
28165 files. Specifically, the assembler translates a direct @code{CALL}
28166 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28167 The default is @option{-mno-longcalls}. This option should be used in
28168 programs where the call target can potentially be out of range. This
28169 option is implemented in the assembler, not the compiler, so the
28170 assembly code generated by GCC still shows direct call
28171 instructions---look at the disassembled object code to see the actual
28172 instructions. Note that the assembler uses an indirect call for
28173 every cross-file call, not just those that really are out of range.
28176 @node zSeries Options
28177 @subsection zSeries Options
28178 @cindex zSeries options
28180 These are listed under @xref{S/390 and zSeries Options}.
28186 @section Specifying Subprocesses and the Switches to Pass to Them
28189 @command{gcc} is a driver program. It performs its job by invoking a
28190 sequence of other programs to do the work of compiling, assembling and
28191 linking. GCC interprets its command-line parameters and uses these to
28192 deduce which programs it should invoke, and which command-line options
28193 it ought to place on their command lines. This behavior is controlled
28194 by @dfn{spec strings}. In most cases there is one spec string for each
28195 program that GCC can invoke, but a few programs have multiple spec
28196 strings to control their behavior. The spec strings built into GCC can
28197 be overridden by using the @option{-specs=} command-line switch to specify
28200 @dfn{Spec files} are plain-text files that are used to construct spec
28201 strings. They consist of a sequence of directives separated by blank
28202 lines. The type of directive is determined by the first non-whitespace
28203 character on the line, which can be one of the following:
28206 @item %@var{command}
28207 Issues a @var{command} to the spec file processor. The commands that can
28211 @item %include <@var{file}>
28212 @cindex @code{%include}
28213 Search for @var{file} and insert its text at the current point in the
28216 @item %include_noerr <@var{file}>
28217 @cindex @code{%include_noerr}
28218 Just like @samp{%include}, but do not generate an error message if the include
28219 file cannot be found.
28221 @item %rename @var{old_name} @var{new_name}
28222 @cindex @code{%rename}
28223 Rename the spec string @var{old_name} to @var{new_name}.
28227 @item *[@var{spec_name}]:
28228 This tells the compiler to create, override or delete the named spec
28229 string. All lines after this directive up to the next directive or
28230 blank line are considered to be the text for the spec string. If this
28231 results in an empty string then the spec is deleted. (Or, if the
28232 spec did not exist, then nothing happens.) Otherwise, if the spec
28233 does not currently exist a new spec is created. If the spec does
28234 exist then its contents are overridden by the text of this
28235 directive, unless the first character of that text is the @samp{+}
28236 character, in which case the text is appended to the spec.
28238 @item [@var{suffix}]:
28239 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28240 and up to the next directive or blank line are considered to make up the
28241 spec string for the indicated suffix. When the compiler encounters an
28242 input file with the named suffix, it processes the spec string in
28243 order to work out how to compile that file. For example:
28247 z-compile -input %i
28250 This says that any input file whose name ends in @samp{.ZZ} should be
28251 passed to the program @samp{z-compile}, which should be invoked with the
28252 command-line switch @option{-input} and with the result of performing the
28253 @samp{%i} substitution. (See below.)
28255 As an alternative to providing a spec string, the text following a
28256 suffix directive can be one of the following:
28259 @item @@@var{language}
28260 This says that the suffix is an alias for a known @var{language}. This is
28261 similar to using the @option{-x} command-line switch to GCC to specify a
28262 language explicitly. For example:
28269 Says that .ZZ files are, in fact, C++ source files.
28272 This causes an error messages saying:
28275 @var{name} compiler not installed on this system.
28279 GCC already has an extensive list of suffixes built into it.
28280 This directive adds an entry to the end of the list of suffixes, but
28281 since the list is searched from the end backwards, it is effectively
28282 possible to override earlier entries using this technique.
28286 GCC has the following spec strings built into it. Spec files can
28287 override these strings or create their own. Note that individual
28288 targets can also add their own spec strings to this list.
28291 asm Options to pass to the assembler
28292 asm_final Options to pass to the assembler post-processor
28293 cpp Options to pass to the C preprocessor
28294 cc1 Options to pass to the C compiler
28295 cc1plus Options to pass to the C++ compiler
28296 endfile Object files to include at the end of the link
28297 link Options to pass to the linker
28298 lib Libraries to include on the command line to the linker
28299 libgcc Decides which GCC support library to pass to the linker
28300 linker Sets the name of the linker
28301 predefines Defines to be passed to the C preprocessor
28302 signed_char Defines to pass to CPP to say whether @code{char} is signed
28304 startfile Object files to include at the start of the link
28307 Here is a small example of a spec file:
28310 %rename lib old_lib
28313 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28316 This example renames the spec called @samp{lib} to @samp{old_lib} and
28317 then overrides the previous definition of @samp{lib} with a new one.
28318 The new definition adds in some extra command-line options before
28319 including the text of the old definition.
28321 @dfn{Spec strings} are a list of command-line options to be passed to their
28322 corresponding program. In addition, the spec strings can contain
28323 @samp{%}-prefixed sequences to substitute variable text or to
28324 conditionally insert text into the command line. Using these constructs
28325 it is possible to generate quite complex command lines.
28327 Here is a table of all defined @samp{%}-sequences for spec
28328 strings. Note that spaces are not generated automatically around the
28329 results of expanding these sequences. Therefore you can concatenate them
28330 together or combine them with constant text in a single argument.
28334 Substitute one @samp{%} into the program name or argument.
28337 Substitute the name of the input file being processed.
28340 Substitute the basename of the input file being processed.
28341 This is the substring up to (and not including) the last period
28342 and not including the directory.
28345 This is the same as @samp{%b}, but include the file suffix (text after
28349 Marks the argument containing or following the @samp{%d} as a
28350 temporary file name, so that that file is deleted if GCC exits
28351 successfully. Unlike @samp{%g}, this contributes no text to the
28354 @item %g@var{suffix}
28355 Substitute a file name that has suffix @var{suffix} and is chosen
28356 once per compilation, and mark the argument in the same way as
28357 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28358 name is now chosen in a way that is hard to predict even when previously
28359 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28360 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28361 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28362 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28363 was simply substituted with a file name chosen once per compilation,
28364 without regard to any appended suffix (which was therefore treated
28365 just like ordinary text), making such attacks more likely to succeed.
28367 @item %u@var{suffix}
28368 Like @samp{%g}, but generates a new temporary file name
28369 each time it appears instead of once per compilation.
28371 @item %U@var{suffix}
28372 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28373 new one if there is no such last file name. In the absence of any
28374 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28375 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28376 involves the generation of two distinct file names, one
28377 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28378 simply substituted with a file name chosen for the previous @samp{%u},
28379 without regard to any appended suffix.
28381 @item %j@var{suffix}
28382 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28383 writable, and if @option{-save-temps} is not used;
28384 otherwise, substitute the name
28385 of a temporary file, just like @samp{%u}. This temporary file is not
28386 meant for communication between processes, but rather as a junk
28387 disposal mechanism.
28389 @item %|@var{suffix}
28390 @itemx %m@var{suffix}
28391 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28392 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28393 all. These are the two most common ways to instruct a program that it
28394 should read from standard input or write to standard output. If you
28395 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28396 construct: see for example @file{f/lang-specs.h}.
28398 @item %.@var{SUFFIX}
28399 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28400 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28401 terminated by the next space or %.
28404 Marks the argument containing or following the @samp{%w} as the
28405 designated output file of this compilation. This puts the argument
28406 into the sequence of arguments that @samp{%o} substitutes.
28409 Substitutes the names of all the output files, with spaces
28410 automatically placed around them. You should write spaces
28411 around the @samp{%o} as well or the results are undefined.
28412 @samp{%o} is for use in the specs for running the linker.
28413 Input files whose names have no recognized suffix are not compiled
28414 at all, but they are included among the output files, so they are
28418 Substitutes the suffix for object files. Note that this is
28419 handled specially when it immediately follows @samp{%g, %u, or %U},
28420 because of the need for those to form complete file names. The
28421 handling is such that @samp{%O} is treated exactly as if it had already
28422 been substituted, except that @samp{%g, %u, and %U} do not currently
28423 support additional @var{suffix} characters following @samp{%O} as they do
28424 following, for example, @samp{.o}.
28427 Substitutes the standard macro predefinitions for the
28428 current target machine. Use this when running @command{cpp}.
28431 Like @samp{%p}, but puts @samp{__} before and after the name of each
28432 predefined macro, except for macros that start with @samp{__} or with
28433 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28437 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28438 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28439 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28440 and @option{-imultilib} as necessary.
28443 Current argument is the name of a library or startup file of some sort.
28444 Search for that file in a standard list of directories and substitute
28445 the full name found. The current working directory is included in the
28446 list of directories scanned.
28449 Current argument is the name of a linker script. Search for that file
28450 in the current list of directories to scan for libraries. If the file
28451 is located insert a @option{--script} option into the command line
28452 followed by the full path name found. If the file is not found then
28453 generate an error message. Note: the current working directory is not
28457 Print @var{str} as an error message. @var{str} is terminated by a newline.
28458 Use this when inconsistent options are detected.
28460 @item %(@var{name})
28461 Substitute the contents of spec string @var{name} at this point.
28463 @item %x@{@var{option}@}
28464 Accumulate an option for @samp{%X}.
28467 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
28471 Output the accumulated assembler options specified by @option{-Wa}.
28474 Output the accumulated preprocessor options specified by @option{-Wp}.
28477 Process the @code{asm} spec. This is used to compute the
28478 switches to be passed to the assembler.
28481 Process the @code{asm_final} spec. This is a spec string for
28482 passing switches to an assembler post-processor, if such a program is
28486 Process the @code{link} spec. This is the spec for computing the
28487 command line passed to the linker. Typically it makes use of the
28488 @samp{%L %G %S %D and %E} sequences.
28491 Dump out a @option{-L} option for each directory that GCC believes might
28492 contain startup files. If the target supports multilibs then the
28493 current multilib directory is prepended to each of these paths.
28496 Process the @code{lib} spec. This is a spec string for deciding which
28497 libraries are included on the command line to the linker.
28500 Process the @code{libgcc} spec. This is a spec string for deciding
28501 which GCC support library is included on the command line to the linker.
28504 Process the @code{startfile} spec. This is a spec for deciding which
28505 object files are the first ones passed to the linker. Typically
28506 this might be a file named @file{crt0.o}.
28509 Process the @code{endfile} spec. This is a spec string that specifies
28510 the last object files that are passed to the linker.
28513 Process the @code{cpp} spec. This is used to construct the arguments
28514 to be passed to the C preprocessor.
28517 Process the @code{cc1} spec. This is used to construct the options to be
28518 passed to the actual C compiler (@command{cc1}).
28521 Process the @code{cc1plus} spec. This is used to construct the options to be
28522 passed to the actual C++ compiler (@command{cc1plus}).
28525 Substitute the variable part of a matched option. See below.
28526 Note that each comma in the substituted string is replaced by
28530 Remove all occurrences of @code{-S} from the command line. Note---this
28531 command is position dependent. @samp{%} commands in the spec string
28532 before this one see @code{-S}, @samp{%} commands in the spec string
28533 after this one do not.
28535 @item %:@var{function}(@var{args})
28536 Call the named function @var{function}, passing it @var{args}.
28537 @var{args} is first processed as a nested spec string, then split
28538 into an argument vector in the usual fashion. The function returns
28539 a string which is processed as if it had appeared literally as part
28540 of the current spec.
28542 The following built-in spec functions are provided:
28545 @item @code{getenv}
28546 The @code{getenv} spec function takes two arguments: an environment
28547 variable name and a string. If the environment variable is not
28548 defined, a fatal error is issued. Otherwise, the return value is the
28549 value of the environment variable concatenated with the string. For
28550 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
28553 %:getenv(TOPDIR /include)
28556 expands to @file{/path/to/top/include}.
28558 @item @code{if-exists}
28559 The @code{if-exists} spec function takes one argument, an absolute
28560 pathname to a file. If the file exists, @code{if-exists} returns the
28561 pathname. Here is a small example of its usage:
28565 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
28568 @item @code{if-exists-else}
28569 The @code{if-exists-else} spec function is similar to the @code{if-exists}
28570 spec function, except that it takes two arguments. The first argument is
28571 an absolute pathname to a file. If the file exists, @code{if-exists-else}
28572 returns the pathname. If it does not exist, it returns the second argument.
28573 This way, @code{if-exists-else} can be used to select one file or another,
28574 based on the existence of the first. Here is a small example of its usage:
28578 crt0%O%s %:if-exists(crti%O%s) \
28579 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
28582 @item @code{replace-outfile}
28583 The @code{replace-outfile} spec function takes two arguments. It looks for the
28584 first argument in the outfiles array and replaces it with the second argument. Here
28585 is a small example of its usage:
28588 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
28591 @item @code{remove-outfile}
28592 The @code{remove-outfile} spec function takes one argument. It looks for the
28593 first argument in the outfiles array and removes it. Here is a small example
28597 %:remove-outfile(-lm)
28600 @item @code{pass-through-libs}
28601 The @code{pass-through-libs} spec function takes any number of arguments. It
28602 finds any @option{-l} options and any non-options ending in @file{.a} (which it
28603 assumes are the names of linker input library archive files) and returns a
28604 result containing all the found arguments each prepended by
28605 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
28606 intended to be passed to the LTO linker plugin.
28609 %:pass-through-libs(%G %L %G)
28612 @item @code{print-asm-header}
28613 The @code{print-asm-header} function takes no arguments and simply
28614 prints a banner like:
28620 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
28623 It is used to separate compiler options from assembler options
28624 in the @option{--target-help} output.
28628 Substitutes the @code{-S} switch, if that switch is given to GCC@.
28629 If that switch is not specified, this substitutes nothing. Note that
28630 the leading dash is omitted when specifying this option, and it is
28631 automatically inserted if the substitution is performed. Thus the spec
28632 string @samp{%@{foo@}} matches the command-line option @option{-foo}
28633 and outputs the command-line option @option{-foo}.
28636 Like %@{@code{S}@} but mark last argument supplied within as a file to be
28637 deleted on failure.
28640 Substitutes all the switches specified to GCC whose names start
28641 with @code{-S}, but which also take an argument. This is used for
28642 switches like @option{-o}, @option{-D}, @option{-I}, etc.
28643 GCC considers @option{-o foo} as being
28644 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
28645 text, including the space. Thus two arguments are generated.
28648 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
28649 (the order of @code{S} and @code{T} in the spec is not significant).
28650 There can be any number of ampersand-separated variables; for each the
28651 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
28654 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
28657 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
28660 Substitutes @code{X} if one or more switches whose names start with
28661 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
28662 once, no matter how many such switches appeared. However, if @code{%*}
28663 appears somewhere in @code{X}, then @code{X} is substituted once
28664 for each matching switch, with the @code{%*} replaced by the part of
28665 that switch matching the @code{*}.
28667 If @code{%*} appears as the last part of a spec sequence then a space
28668 is added after the end of the last substitution. If there is more
28669 text in the sequence, however, then a space is not generated. This
28670 allows the @code{%*} substitution to be used as part of a larger
28671 string. For example, a spec string like this:
28674 %@{mcu=*:--script=%*/memory.ld@}
28678 when matching an option like @option{-mcu=newchip} produces:
28681 --script=newchip/memory.ld
28685 Substitutes @code{X}, if processing a file with suffix @code{S}.
28688 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
28691 Substitutes @code{X}, if processing a file for language @code{S}.
28694 Substitutes @code{X}, if not processing a file for language @code{S}.
28697 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
28698 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
28699 @code{*} sequences as well, although they have a stronger binding than
28700 the @samp{|}. If @code{%*} appears in @code{X}, all of the
28701 alternatives must be starred, and only the first matching alternative
28704 For example, a spec string like this:
28707 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
28711 outputs the following command-line options from the following input
28712 command-line options:
28717 -d fred.c -foo -baz -boggle
28718 -d jim.d -bar -baz -boggle
28721 @item %@{S:X; T:Y; :D@}
28723 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
28724 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
28725 be as many clauses as you need. This may be combined with @code{.},
28726 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
28731 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
28732 or similar construct can use a backslash to ignore the special meaning
28733 of the character following it, thus allowing literal matching of a
28734 character that is otherwise specially treated. For example,
28735 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
28736 @option{-std=iso9899:1999} option is given.
28738 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
28739 construct may contain other nested @samp{%} constructs or spaces, or
28740 even newlines. They are processed as usual, as described above.
28741 Trailing white space in @code{X} is ignored. White space may also
28742 appear anywhere on the left side of the colon in these constructs,
28743 except between @code{.} or @code{*} and the corresponding word.
28745 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
28746 handled specifically in these constructs. If another value of
28747 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
28748 @option{-W} switch is found later in the command line, the earlier
28749 switch value is ignored, except with @{@code{S}*@} where @code{S} is
28750 just one letter, which passes all matching options.
28752 The character @samp{|} at the beginning of the predicate text is used to
28753 indicate that a command should be piped to the following command, but
28754 only if @option{-pipe} is specified.
28756 It is built into GCC which switches take arguments and which do not.
28757 (You might think it would be useful to generalize this to allow each
28758 compiler's spec to say which switches take arguments. But this cannot
28759 be done in a consistent fashion. GCC cannot even decide which input
28760 files have been specified without knowing which switches take arguments,
28761 and it must know which input files to compile in order to tell which
28764 GCC also knows implicitly that arguments starting in @option{-l} are to be
28765 treated as compiler output files, and passed to the linker in their
28766 proper position among the other output files.
28768 @node Environment Variables
28769 @section Environment Variables Affecting GCC
28770 @cindex environment variables
28772 @c man begin ENVIRONMENT
28773 This section describes several environment variables that affect how GCC
28774 operates. Some of them work by specifying directories or prefixes to use
28775 when searching for various kinds of files. Some are used to specify other
28776 aspects of the compilation environment.
28778 Note that you can also specify places to search using options such as
28779 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
28780 take precedence over places specified using environment variables, which
28781 in turn take precedence over those specified by the configuration of GCC@.
28782 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
28783 GNU Compiler Collection (GCC) Internals}.
28788 @c @itemx LC_COLLATE
28790 @c @itemx LC_MONETARY
28791 @c @itemx LC_NUMERIC
28796 @c @findex LC_COLLATE
28797 @findex LC_MESSAGES
28798 @c @findex LC_MONETARY
28799 @c @findex LC_NUMERIC
28803 These environment variables control the way that GCC uses
28804 localization information which allows GCC to work with different
28805 national conventions. GCC inspects the locale categories
28806 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
28807 so. These locale categories can be set to any value supported by your
28808 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
28809 Kingdom encoded in UTF-8.
28811 The @env{LC_CTYPE} environment variable specifies character
28812 classification. GCC uses it to determine the character boundaries in
28813 a string; this is needed for some multibyte encodings that contain quote
28814 and escape characters that are otherwise interpreted as a string
28817 The @env{LC_MESSAGES} environment variable specifies the language to
28818 use in diagnostic messages.
28820 If the @env{LC_ALL} environment variable is set, it overrides the value
28821 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
28822 and @env{LC_MESSAGES} default to the value of the @env{LANG}
28823 environment variable. If none of these variables are set, GCC
28824 defaults to traditional C English behavior.
28828 If @env{TMPDIR} is set, it specifies the directory to use for temporary
28829 files. GCC uses temporary files to hold the output of one stage of
28830 compilation which is to be used as input to the next stage: for example,
28831 the output of the preprocessor, which is the input to the compiler
28834 @item GCC_COMPARE_DEBUG
28835 @findex GCC_COMPARE_DEBUG
28836 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
28837 @option{-fcompare-debug} to the compiler driver. See the documentation
28838 of this option for more details.
28840 @item GCC_EXEC_PREFIX
28841 @findex GCC_EXEC_PREFIX
28842 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
28843 names of the subprograms executed by the compiler. No slash is added
28844 when this prefix is combined with the name of a subprogram, but you can
28845 specify a prefix that ends with a slash if you wish.
28847 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
28848 an appropriate prefix to use based on the pathname it is invoked with.
28850 If GCC cannot find the subprogram using the specified prefix, it
28851 tries looking in the usual places for the subprogram.
28853 The default value of @env{GCC_EXEC_PREFIX} is
28854 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
28855 the installed compiler. In many cases @var{prefix} is the value
28856 of @code{prefix} when you ran the @file{configure} script.
28858 Other prefixes specified with @option{-B} take precedence over this prefix.
28860 This prefix is also used for finding files such as @file{crt0.o} that are
28863 In addition, the prefix is used in an unusual way in finding the
28864 directories to search for header files. For each of the standard
28865 directories whose name normally begins with @samp{/usr/local/lib/gcc}
28866 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
28867 replacing that beginning with the specified prefix to produce an
28868 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
28869 @file{foo/bar} just before it searches the standard directory
28870 @file{/usr/local/lib/bar}.
28871 If a standard directory begins with the configured
28872 @var{prefix} then the value of @var{prefix} is replaced by
28873 @env{GCC_EXEC_PREFIX} when looking for header files.
28875 @item COMPILER_PATH
28876 @findex COMPILER_PATH
28877 The value of @env{COMPILER_PATH} is a colon-separated list of
28878 directories, much like @env{PATH}. GCC tries the directories thus
28879 specified when searching for subprograms, if it cannot find the
28880 subprograms using @env{GCC_EXEC_PREFIX}.
28883 @findex LIBRARY_PATH
28884 The value of @env{LIBRARY_PATH} is a colon-separated list of
28885 directories, much like @env{PATH}. When configured as a native compiler,
28886 GCC tries the directories thus specified when searching for special
28887 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
28888 using GCC also uses these directories when searching for ordinary
28889 libraries for the @option{-l} option (but directories specified with
28890 @option{-L} come first).
28894 @cindex locale definition
28895 This variable is used to pass locale information to the compiler. One way in
28896 which this information is used is to determine the character set to be used
28897 when character literals, string literals and comments are parsed in C and C++.
28898 When the compiler is configured to allow multibyte characters,
28899 the following values for @env{LANG} are recognized:
28903 Recognize JIS characters.
28905 Recognize SJIS characters.
28907 Recognize EUCJP characters.
28910 If @env{LANG} is not defined, or if it has some other value, then the
28911 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
28912 recognize and translate multibyte characters.
28916 Some additional environment variables affect the behavior of the
28919 @include cppenv.texi
28923 @node Precompiled Headers
28924 @section Using Precompiled Headers
28925 @cindex precompiled headers
28926 @cindex speed of compilation
28928 Often large projects have many header files that are included in every
28929 source file. The time the compiler takes to process these header files
28930 over and over again can account for nearly all of the time required to
28931 build the project. To make builds faster, GCC allows you to
28932 @dfn{precompile} a header file.
28934 To create a precompiled header file, simply compile it as you would any
28935 other file, if necessary using the @option{-x} option to make the driver
28936 treat it as a C or C++ header file. You may want to use a
28937 tool like @command{make} to keep the precompiled header up-to-date when
28938 the headers it contains change.
28940 A precompiled header file is searched for when @code{#include} is
28941 seen in the compilation. As it searches for the included file
28942 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
28943 compiler looks for a precompiled header in each directory just before it
28944 looks for the include file in that directory. The name searched for is
28945 the name specified in the @code{#include} with @samp{.gch} appended. If
28946 the precompiled header file cannot be used, it is ignored.
28948 For instance, if you have @code{#include "all.h"}, and you have
28949 @file{all.h.gch} in the same directory as @file{all.h}, then the
28950 precompiled header file is used if possible, and the original
28951 header is used otherwise.
28953 Alternatively, you might decide to put the precompiled header file in a
28954 directory and use @option{-I} to ensure that directory is searched
28955 before (or instead of) the directory containing the original header.
28956 Then, if you want to check that the precompiled header file is always
28957 used, you can put a file of the same name as the original header in this
28958 directory containing an @code{#error} command.
28960 This also works with @option{-include}. So yet another way to use
28961 precompiled headers, good for projects not designed with precompiled
28962 header files in mind, is to simply take most of the header files used by
28963 a project, include them from another header file, precompile that header
28964 file, and @option{-include} the precompiled header. If the header files
28965 have guards against multiple inclusion, they are skipped because
28966 they've already been included (in the precompiled header).
28968 If you need to precompile the same header file for different
28969 languages, targets, or compiler options, you can instead make a
28970 @emph{directory} named like @file{all.h.gch}, and put each precompiled
28971 header in the directory, perhaps using @option{-o}. It doesn't matter
28972 what you call the files in the directory; every precompiled header in
28973 the directory is considered. The first precompiled header
28974 encountered in the directory that is valid for this compilation is
28975 used; they're searched in no particular order.
28977 There are many other possibilities, limited only by your imagination,
28978 good sense, and the constraints of your build system.
28980 A precompiled header file can be used only when these conditions apply:
28984 Only one precompiled header can be used in a particular compilation.
28987 A precompiled header cannot be used once the first C token is seen. You
28988 can have preprocessor directives before a precompiled header; you cannot
28989 include a precompiled header from inside another header.
28992 The precompiled header file must be produced for the same language as
28993 the current compilation. You cannot use a C precompiled header for a C++
28997 The precompiled header file must have been produced by the same compiler
28998 binary as the current compilation is using.
29001 Any macros defined before the precompiled header is included must
29002 either be defined in the same way as when the precompiled header was
29003 generated, or must not affect the precompiled header, which usually
29004 means that they don't appear in the precompiled header at all.
29006 The @option{-D} option is one way to define a macro before a
29007 precompiled header is included; using a @code{#define} can also do it.
29008 There are also some options that define macros implicitly, like
29009 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29012 @item If debugging information is output when using the precompiled
29013 header, using @option{-g} or similar, the same kind of debugging information
29014 must have been output when building the precompiled header. However,
29015 a precompiled header built using @option{-g} can be used in a compilation
29016 when no debugging information is being output.
29018 @item The same @option{-m} options must generally be used when building
29019 and using the precompiled header. @xref{Submodel Options},
29020 for any cases where this rule is relaxed.
29022 @item Each of the following options must be the same when building and using
29023 the precompiled header:
29025 @gccoptlist{-fexceptions}
29028 Some other command-line options starting with @option{-f},
29029 @option{-p}, or @option{-O} must be defined in the same way as when
29030 the precompiled header was generated. At present, it's not clear
29031 which options are safe to change and which are not; the safest choice
29032 is to use exactly the same options when generating and using the
29033 precompiled header. The following are known to be safe:
29035 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29036 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29037 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29042 For all of these except the last, the compiler automatically
29043 ignores the precompiled header if the conditions aren't met. If you
29044 find an option combination that doesn't work and doesn't cause the
29045 precompiled header to be ignored, please consider filing a bug report,
29048 If you do use differing options when generating and using the
29049 precompiled header, the actual behavior is a mixture of the
29050 behavior for the options. For instance, if you use @option{-g} to
29051 generate the precompiled header but not when using it, you may or may
29052 not get debugging information for routines in the precompiled header.