1 @c Copyright (C) 1988-2020 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-2020 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.
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
141 @xref{Option Index}, for an index to GCC's options.
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
155 * Warning Options:: How picky should the compiler be?
156 * Static Analyzer Options:: More expensive warnings.
157 * Debugging Options:: Producing debuggable code.
158 * Optimize Options:: How much optimization?
159 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
160 * Preprocessor Options:: Controlling header files and macro definitions.
161 Also, getting dependency information for Make.
162 * Assembler Options:: Passing options to the assembler.
163 * Link Options:: Specifying libraries and so on.
164 * Directory Options:: Where to find header files and libraries.
165 Where to find the compiler executable files.
166 * Code Gen Options:: Specifying conventions for function calls, data layout
168 * Developer Options:: Printing GCC configuration info, statistics, and
170 * Submodel Options:: Target-specific options, such as compiling for a
171 specific processor variant.
172 * Spec Files:: How to pass switches to sub-processes.
173 * Environment Variables:: Env vars that affect GCC.
174 * Precompiled Headers:: Compiling a header once, and using it many times.
180 @section Option Summary
182 Here is a summary of all the options, grouped by type. Explanations are
183 in the following sections.
186 @item Overall Options
187 @xref{Overall Options,,Options Controlling the Kind of Output}.
188 @gccoptlist{-c -S -E -o @var{file} @gol
189 -dumpbase @var{dumpbase} -dumpbase-ext @var{auxdropsuf} @gol
190 -dumpdir @var{dumppfx} -x @var{language} @gol
191 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
192 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
193 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
194 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
195 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
197 @item C Language Options
198 @xref{C Dialect Options,,Options Controlling C Dialect}.
199 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
200 -fpermitted-flt-eval-methods=@var{standard} @gol
201 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
202 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
203 -fhosted -ffreestanding @gol
204 -fopenacc -fopenacc-dim=@var{geom} @gol
205 -fopenmp -fopenmp-simd @gol
206 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
207 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
208 -fsigned-bitfields -fsigned-char @gol
209 -funsigned-bitfields -funsigned-char}
211 @item C++ Language Options
212 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
213 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
214 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
215 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
216 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
217 -fno-elide-constructors @gol
218 -fno-enforce-eh-specs @gol
219 -fno-gnu-keywords @gol
220 -fno-implicit-templates @gol
221 -fno-implicit-inline-templates @gol
222 -fno-implement-inlines -fms-extensions @gol
223 -fnew-inheriting-ctors @gol
224 -fnew-ttp-matching @gol
225 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
226 -fno-optional-diags -fpermissive @gol
227 -fno-pretty-templates @gol
228 -fno-rtti -fsized-deallocation @gol
229 -ftemplate-backtrace-limit=@var{n} @gol
230 -ftemplate-depth=@var{n} @gol
231 -fno-threadsafe-statics -fuse-cxa-atexit @gol
232 -fno-weak -nostdinc++ @gol
233 -fvisibility-inlines-hidden @gol
234 -fvisibility-ms-compat @gol
235 -fext-numeric-literals @gol
236 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
237 -Wno-class-conversion -Wclass-memaccess @gol
238 -Wcomma-subscript -Wconditionally-supported @gol
239 -Wno-conversion-null -Wctor-dtor-privacy -Wno-delete-incomplete @gol
240 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
241 -Weffc++ -Wextra-semi -Wno-inaccessible-base @gol
242 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
243 -Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-tags @gol
244 -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
245 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
246 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
247 -Wredundant-move -Wredundant-tags @gol
248 -Wreorder -Wregister @gol
249 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
250 -Wno-non-template-friend -Wold-style-cast @gol
251 -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
252 -Wsized-deallocation -Wsuggest-final-methods @gol
253 -Wsuggest-final-types -Wsuggest-override @gol
254 -Wno-terminate -Wuseless-cast -Wvirtual-inheritance @gol
255 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
257 @item Objective-C and Objective-C++ Language Options
258 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
259 Objective-C and Objective-C++ Dialects}.
260 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
261 -fgnu-runtime -fnext-runtime @gol
262 -fno-nil-receivers @gol
263 -fobjc-abi-version=@var{n} @gol
264 -fobjc-call-cxx-cdtors @gol
265 -fobjc-direct-dispatch @gol
266 -fobjc-exceptions @gol
269 -fobjc-std=objc1 @gol
270 -fno-local-ivars @gol
271 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
272 -freplace-objc-classes @gol
275 -Wassign-intercept -Wno-property-assign-default @gol
276 -Wno-protocol -Wselector @gol
277 -Wstrict-selector-match @gol
278 -Wundeclared-selector}
280 @item Diagnostic Message Formatting Options
281 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
282 @gccoptlist{-fmessage-length=@var{n} @gol
283 -fdiagnostics-plain-output @gol
284 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
285 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
286 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
287 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
288 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
289 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
290 -fno-diagnostics-show-cwe @gol
291 -fdiagnostics-minimum-margin-width=@var{width} @gol
292 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
293 -fdiagnostics-show-template-tree -fno-elide-type @gol
294 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
295 -fdiagnostics-show-path-depths @gol
296 -fno-show-column @gol
297 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol
298 -fdiagnostics-column-origin=@var{origin}}
300 @item Warning Options
301 @xref{Warning Options,,Options to Request or Suppress Warnings}.
302 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
303 -pedantic-errors @gol
304 -w -Wextra -Wall -Wabi=@var{n} @gol
305 -Waddress -Wno-address-of-packed-member -Waggregate-return @gol
306 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol
307 -Walloca -Walloca-larger-than=@var{byte-size} @gol
308 -Wno-aggressive-loop-optimizations @gol
309 -Warith-conversion @gol
310 -Warray-bounds -Warray-bounds=@var{n} @gol
311 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
312 -Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
313 -Wno-builtin-declaration-mismatch @gol
314 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
315 -Wc11-c2x-compat @gol
316 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
318 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
319 -Wchar-subscripts @gol
320 -Wclobbered -Wcomment @gol
321 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
322 -Wdangling-else -Wdate-time @gol
323 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
324 -Wdisabled-optimization @gol
325 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
326 -Wno-div-by-zero -Wdouble-promotion @gol
327 -Wduplicated-branches -Wduplicated-cond @gol
328 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
329 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
330 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
331 -Wno-format-contains-nul -Wno-format-extra-args @gol
332 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
333 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
334 -Wformat-y2k -Wframe-address @gol
335 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
336 -Wno-if-not-aligned -Wno-ignored-attributes @gol
337 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
338 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
339 -Wno-implicit-function-declaration -Wno-implicit-int @gol
340 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
341 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
342 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
343 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
344 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
345 -Wmemset-elt-size -Wmemset-transposed-args @gol
346 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
347 -Wmissing-field-initializers -Wmissing-format-attribute @gol
348 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
349 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
350 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
351 -Wnull-dereference -Wno-odr -Wopenmp-simd @gol
352 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
353 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
354 -Wparentheses -Wno-pedantic-ms-format @gol
355 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
356 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
357 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
358 -Wno-scalar-storage-order -Wsequence-point @gol
359 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
360 -Wno-shadow-ivar @gol
361 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
362 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
363 -Wsign-compare -Wsign-conversion @gol
364 -Wno-sizeof-array-argument @gol
365 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
366 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
367 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
368 -Wstring-compare @gol
369 -Wno-stringop-overflow -Wno-stringop-overread @gol
370 -Wno-stringop-truncation @gol
371 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
372 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
373 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
374 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
375 -Wtype-limits -Wundef @gol
376 -Wuninitialized -Wunknown-pragmas @gol
377 -Wunsuffixed-float-constants -Wunused @gol
378 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
379 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
380 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
382 -Wunused-parameter -Wno-unused-result @gol
383 -Wunused-value -Wunused-variable @gol
384 -Wno-varargs -Wvariadic-macros @gol
385 -Wvector-operation-performance @gol
386 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
387 -Wvolatile-register-var -Wwrite-strings @gol
388 -Wzero-length-bounds}
390 @item Static Analyzer Options
393 -fanalyzer-call-summaries @gol
394 -fanalyzer-checker=@var{name} @gol
395 -fanalyzer-fine-grained @gol
396 -fanalyzer-state-merge @gol
397 -fanalyzer-state-purge @gol
398 -fanalyzer-transitivity @gol
399 -fanalyzer-verbose-edges @gol
400 -fanalyzer-verbose-state-changes @gol
401 -fanalyzer-verbosity=@var{level} @gol
403 -fdump-analyzer-stderr @gol
404 -fdump-analyzer-callgraph @gol
405 -fdump-analyzer-exploded-graph @gol
406 -fdump-analyzer-exploded-nodes @gol
407 -fdump-analyzer-exploded-nodes-2 @gol
408 -fdump-analyzer-exploded-nodes-3 @gol
409 -fdump-analyzer-state-purge @gol
410 -fdump-analyzer-supergraph @gol
411 -Wno-analyzer-double-fclose @gol
412 -Wno-analyzer-double-free @gol
413 -Wno-analyzer-exposure-through-output-file @gol
414 -Wno-analyzer-file-leak @gol
415 -Wno-analyzer-free-of-non-heap @gol
416 -Wno-analyzer-malloc-leak @gol
417 -Wno-analyzer-mismatching-deallocation @gol
418 -Wno-analyzer-null-argument @gol
419 -Wno-analyzer-null-dereference @gol
420 -Wno-analyzer-possible-null-argument @gol
421 -Wno-analyzer-possible-null-dereference @gol
422 -Wno-analyzer-stale-setjmp-buffer @gol
423 -Wno-analyzer-tainted-array-index @gol
424 -Wanalyzer-too-complex @gol
425 -Wno-analyzer-unsafe-call-within-signal-handler @gol
426 -Wno-analyzer-use-after-free @gol
427 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
428 -Wno-analyzer-use-of-uninitialized-value @gol
431 @item C and Objective-C-only Warning Options
432 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
433 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
434 -Wold-style-declaration -Wold-style-definition @gol
435 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
436 -Wdeclaration-after-statement -Wpointer-sign}
438 @item Debugging Options
439 @xref{Debugging Options,,Options for Debugging Your Program}.
440 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
441 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
442 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
443 -gas-loc-support -gno-as-loc-support @gol
444 -gas-locview-support -gno-as-locview-support @gol
445 -gcolumn-info -gno-column-info @gol
446 -gstatement-frontiers -gno-statement-frontiers @gol
447 -gvariable-location-views -gno-variable-location-views @gol
448 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
449 -ginline-points -gno-inline-points @gol
450 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
451 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
452 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
453 -fno-eliminate-unused-debug-types @gol
454 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
455 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
456 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
457 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
458 -fvar-tracking -fvar-tracking-assignments}
460 @item Optimization Options
461 @xref{Optimize Options,,Options that Control Optimization}.
462 @gccoptlist{-faggressive-loop-optimizations @gol
463 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
464 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
465 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
466 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
467 -fno-allocation-dce -fallow-store-data-races @gol
468 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
469 -fauto-inc-dec -fbranch-probabilities @gol
471 -fcombine-stack-adjustments -fconserve-stack @gol
472 -fcompare-elim -fcprop-registers -fcrossjumping @gol
473 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
474 -fcx-limited-range @gol
475 -fdata-sections -fdce -fdelayed-branch @gol
476 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
477 -fdevirtualize-at-ltrans -fdse @gol
478 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
479 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
481 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
482 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
483 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
484 -fif-conversion2 -findirect-inlining @gol
485 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
486 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
487 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
488 -fipa-reference -fipa-reference-addressable @gol
489 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
490 -flive-patching=@var{level} @gol
491 -fira-region=@var{region} -fira-hoist-pressure @gol
492 -fira-loop-pressure -fno-ira-share-save-slots @gol
493 -fno-ira-share-spill-slots @gol
494 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
495 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
496 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
497 -floop-block -floop-interchange -floop-strip-mine @gol
498 -floop-unroll-and-jam -floop-nest-optimize @gol
499 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
500 -flto-partition=@var{alg} -fmerge-all-constants @gol
501 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
502 -fmove-loop-invariants -fno-branch-count-reg @gol
503 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
504 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
505 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
506 -fno-sched-spec -fno-signed-zeros @gol
507 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
508 -fomit-frame-pointer -foptimize-sibling-calls @gol
509 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
510 -fprefetch-loop-arrays @gol
511 -fprofile-correction @gol
512 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
513 -fprofile-values -fprofile-reorder-functions @gol
514 -freciprocal-math -free -frename-registers -freorder-blocks @gol
515 -freorder-blocks-algorithm=@var{algorithm} @gol
516 -freorder-blocks-and-partition -freorder-functions @gol
517 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
518 -frounding-math -fsave-optimization-record @gol
519 -fsched2-use-superblocks -fsched-pressure @gol
520 -fsched-spec-load -fsched-spec-load-dangerous @gol
521 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
522 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
523 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
524 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
525 -fschedule-fusion @gol
526 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
527 -fselective-scheduling -fselective-scheduling2 @gol
528 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
529 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
530 -fsignaling-nans @gol
531 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
533 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
534 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
535 -fthread-jumps -ftracer -ftree-bit-ccp @gol
536 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
537 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
538 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
539 -ftree-loop-if-convert -ftree-loop-im @gol
540 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
541 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
542 -ftree-loop-vectorize @gol
543 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
544 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
545 -ftree-switch-conversion -ftree-tail-merge @gol
546 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
547 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
548 -funsafe-math-optimizations -funswitch-loops @gol
549 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
550 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
551 --param @var{name}=@var{value}
552 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
554 @item Program Instrumentation Options
555 @xref{Instrumentation Options,,Program Instrumentation Options}.
556 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
557 -fprofile-abs-path @gol
558 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
559 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
560 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
561 -fprofile-exclude-files=@var{regex} -fprofile-reproducibility @gol
562 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
563 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
564 -fsanitize-undefined-trap-on-error -fbounds-check @gol
565 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
566 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
567 -fstack-protector-explicit -fstack-check @gol
568 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
569 -fno-stack-limit -fsplit-stack @gol
570 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
571 -fvtv-counts -fvtv-debug @gol
572 -finstrument-functions @gol
573 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
574 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
576 @item Preprocessor Options
577 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
578 @gccoptlist{-A@var{question}=@var{answer} @gol
579 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
580 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
581 -dD -dI -dM -dN -dU @gol
582 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
583 -fexec-charset=@var{charset} -fextended-identifiers @gol
584 -finput-charset=@var{charset} -flarge-source-files @gol
585 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
586 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
587 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
588 -fwide-exec-charset=@var{charset} -fworking-directory @gol
589 -H -imacros @var{file} -include @var{file} @gol
590 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
591 -no-integrated-cpp -P -pthread -remap @gol
592 -traditional -traditional-cpp -trigraphs @gol
593 -U@var{macro} -undef @gol
594 -Wp,@var{option} -Xpreprocessor @var{option}}
596 @item Assembler Options
597 @xref{Assembler Options,,Passing Options to the Assembler}.
598 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
601 @xref{Link Options,,Options for Linking}.
602 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
603 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
604 -e @var{entry} --entry=@var{entry} @gol
605 -pie -pthread -r -rdynamic @gol
606 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
607 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
608 -shared -shared-libgcc -symbolic @gol
609 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
610 -u @var{symbol} -z @var{keyword}}
612 @item Directory Options
613 @xref{Directory Options,,Options for Directory Search}.
614 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
615 -idirafter @var{dir} @gol
616 -imacros @var{file} -imultilib @var{dir} @gol
617 -iplugindir=@var{dir} -iprefix @var{file} @gol
618 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
619 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
620 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
621 -nostdinc -nostdinc++ --sysroot=@var{dir}}
623 @item Code Generation Options
624 @xref{Code Gen Options,,Options for Code Generation Conventions}.
625 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
626 -ffixed-@var{reg} -fexceptions @gol
627 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
628 -fasynchronous-unwind-tables @gol
630 -finhibit-size-directive -fcommon -fno-ident @gol
631 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
632 -fno-jump-tables @gol
633 -frecord-gcc-switches @gol
634 -freg-struct-return -fshort-enums -fshort-wchar @gol
635 -fverbose-asm -fpack-struct[=@var{n}] @gol
636 -fleading-underscore -ftls-model=@var{model} @gol
637 -fstack-reuse=@var{reuse_level} @gol
638 -ftrampolines -ftrapv -fwrapv @gol
639 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
640 -fstrict-volatile-bitfields -fsync-libcalls}
642 @item Developer Options
643 @xref{Developer Options,,GCC Developer Options}.
644 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
645 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
646 -fchecking -fchecking=@var{n}
647 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
648 -fdisable-ipa-@var{pass_name} @gol
649 -fdisable-rtl-@var{pass_name} @gol
650 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
651 -fdisable-tree-@var{pass_name} @gol
652 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
653 -fdump-debug -fdump-earlydebug @gol
654 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
655 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
656 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
658 -fdump-lang-@var{switch} @gol
659 -fdump-lang-@var{switch}-@var{options} @gol
660 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
662 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
663 -fdump-statistics @gol
665 -fdump-tree-@var{switch} @gol
666 -fdump-tree-@var{switch}-@var{options} @gol
667 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
668 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
669 -fenable-@var{kind}-@var{pass} @gol
670 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
671 -fira-verbose=@var{n} @gol
672 -flto-report -flto-report-wpa -fmem-report-wpa @gol
673 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
674 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
675 -fprofile-report @gol
676 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
677 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
678 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
679 -fvar-tracking-assignments-toggle -gtoggle @gol
680 -print-file-name=@var{library} -print-libgcc-file-name @gol
681 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
682 -print-prog-name=@var{program} -print-search-dirs -Q @gol
683 -print-sysroot -print-sysroot-headers-suffix @gol
684 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
686 @item Machine-Dependent Options
687 @xref{Submodel Options,,Machine-Dependent Options}.
688 @c This list is ordered alphanumerically by subsection name.
689 @c Try and put the significant identifier (CPU or system) first,
690 @c so users have a clue at guessing where the ones they want will be.
692 @emph{AArch64 Options}
693 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
694 -mgeneral-regs-only @gol
695 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
696 -mstrict-align -mno-strict-align @gol
697 -momit-leaf-frame-pointer @gol
698 -mtls-dialect=desc -mtls-dialect=traditional @gol
699 -mtls-size=@var{size} @gol
700 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
701 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
702 -mpc-relative-literal-loads @gol
703 -msign-return-address=@var{scope} @gol
704 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
705 +@var{b-key}]|@var{bti} @gol
706 -mharden-sls=@var{opts} @gol
707 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
708 -moverride=@var{string} -mverbose-cost-dump @gol
709 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
710 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
713 @emph{Adapteva Epiphany Options}
714 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
715 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
716 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
717 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
718 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
719 -msplit-vecmove-early -m1reg-@var{reg}}
721 @emph{AMD GCN Options}
722 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
725 @gccoptlist{-mbarrel-shifter -mjli-always @gol
726 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
727 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
728 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
729 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
730 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
731 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
732 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
733 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
734 -mvolatile-cache -mtp-regno=@var{regno} @gol
735 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
736 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
737 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
738 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
739 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
740 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
741 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
742 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
745 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
746 -mabi=@var{name} @gol
747 -mapcs-stack-check -mno-apcs-stack-check @gol
748 -mapcs-reentrant -mno-apcs-reentrant @gol
749 -mgeneral-regs-only @gol
750 -msched-prolog -mno-sched-prolog @gol
751 -mlittle-endian -mbig-endian @gol
753 -mfloat-abi=@var{name} @gol
754 -mfp16-format=@var{name}
755 -mthumb-interwork -mno-thumb-interwork @gol
756 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
757 -mtune=@var{name} -mprint-tune-info @gol
758 -mstructure-size-boundary=@var{n} @gol
759 -mabort-on-noreturn @gol
760 -mlong-calls -mno-long-calls @gol
761 -msingle-pic-base -mno-single-pic-base @gol
762 -mpic-register=@var{reg} @gol
763 -mnop-fun-dllimport @gol
764 -mpoke-function-name @gol
765 -mthumb -marm -mflip-thumb @gol
766 -mtpcs-frame -mtpcs-leaf-frame @gol
767 -mcaller-super-interworking -mcallee-super-interworking @gol
768 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
769 -mword-relocations @gol
770 -mfix-cortex-m3-ldrd @gol
771 -munaligned-access @gol
772 -mneon-for-64bits @gol
773 -mslow-flash-data @gol
774 -masm-syntax-unified @gol
776 -mverbose-cost-dump @gol
782 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
783 -mbranch-cost=@var{cost} @gol
784 -mcall-prologues -mgas-isr-prologues -mint8 @gol
785 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
786 -mn_flash=@var{size} -mno-interrupts @gol
787 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
788 -mfract-convert-truncate @gol
789 -mshort-calls -nodevicelib -nodevicespecs @gol
790 -Waddr-space-convert -Wmisspelled-isr}
792 @emph{Blackfin Options}
793 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
794 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
795 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
796 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
797 -mno-id-shared-library -mshared-library-id=@var{n} @gol
798 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
799 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
800 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
804 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
805 -msim -msdata=@var{sdata-type}}
808 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
809 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
810 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
811 -mstack-align -mdata-align -mconst-align @gol
812 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
813 -melf -maout -melinux -mlinux -sim -sim2 @gol
814 -mmul-bug-workaround -mno-mul-bug-workaround}
817 @gccoptlist{-mmac @gol
818 -mcr16cplus -mcr16c @gol
819 -msim -mint32 -mbit-ops
820 -mdata-model=@var{model}}
823 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
824 -mbig-endian -EB -mlittle-endian -EL @gol
825 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
826 -mfloat-abi=@var{name} @gol
827 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
828 -mdsp -medsp -mvdsp @gol
829 -mdiv -msmart -mhigh-registers -manchor @gol
830 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
831 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
833 @emph{Darwin Options}
834 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
835 -arch_only -bind_at_load -bundle -bundle_loader @gol
836 -client_name -compatibility_version -current_version @gol
838 -dependency-file -dylib_file -dylinker_install_name @gol
839 -dynamic -dynamiclib -exported_symbols_list @gol
840 -filelist -flat_namespace -force_cpusubtype_ALL @gol
841 -force_flat_namespace -headerpad_max_install_names @gol
843 -image_base -init -install_name -keep_private_externs @gol
844 -multi_module -multiply_defined -multiply_defined_unused @gol
845 -noall_load -no_dead_strip_inits_and_terms @gol
846 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
847 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
848 -private_bundle -read_only_relocs -sectalign @gol
849 -sectobjectsymbols -whyload -seg1addr @gol
850 -sectcreate -sectobjectsymbols -sectorder @gol
851 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
852 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
853 -segprot -segs_read_only_addr -segs_read_write_addr @gol
854 -single_module -static -sub_library -sub_umbrella @gol
855 -twolevel_namespace -umbrella -undefined @gol
856 -unexported_symbols_list -weak_reference_mismatches @gol
857 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
858 -mkernel -mone-byte-bool}
860 @emph{DEC Alpha Options}
861 @gccoptlist{-mno-fp-regs -msoft-float @gol
862 -mieee -mieee-with-inexact -mieee-conformant @gol
863 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
864 -mtrap-precision=@var{mode} -mbuild-constants @gol
865 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
866 -mbwx -mmax -mfix -mcix @gol
867 -mfloat-vax -mfloat-ieee @gol
868 -mexplicit-relocs -msmall-data -mlarge-data @gol
869 -msmall-text -mlarge-text @gol
870 -mmemory-latency=@var{time}}
873 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
874 -mframe-limit=@var{bytes} -mxbpf}
877 @gccoptlist{-msmall-model -mno-lsim}
880 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
883 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
884 -mhard-float -msoft-float @gol
885 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
886 -mdouble -mno-double @gol
887 -mmedia -mno-media -mmuladd -mno-muladd @gol
888 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
889 -mlinked-fp -mlong-calls -malign-labels @gol
890 -mlibrary-pic -macc-4 -macc-8 @gol
891 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
892 -moptimize-membar -mno-optimize-membar @gol
893 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
894 -mvliw-branch -mno-vliw-branch @gol
895 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
896 -mno-nested-cond-exec -mtomcat-stats @gol
900 @emph{GNU/Linux Options}
901 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
902 -tno-android-cc -tno-android-ld}
904 @emph{H8/300 Options}
905 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
908 @gccoptlist{-march=@var{architecture-type} @gol
909 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
910 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
911 -mfixed-range=@var{register-range} @gol
912 -mjump-in-delay -mlinker-opt -mlong-calls @gol
913 -mlong-load-store -mno-disable-fpregs @gol
914 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
915 -mno-jump-in-delay -mno-long-load-store @gol
916 -mno-portable-runtime -mno-soft-float @gol
917 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
918 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
919 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
920 -munix=@var{unix-std} -nolibdld -static -threads}
923 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
924 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
925 -mconstant-gp -mauto-pic -mfused-madd @gol
926 -minline-float-divide-min-latency @gol
927 -minline-float-divide-max-throughput @gol
928 -mno-inline-float-divide @gol
929 -minline-int-divide-min-latency @gol
930 -minline-int-divide-max-throughput @gol
931 -mno-inline-int-divide @gol
932 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
933 -mno-inline-sqrt @gol
934 -mdwarf2-asm -mearly-stop-bits @gol
935 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
936 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
937 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
938 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
939 -msched-spec-ldc -msched-spec-control-ldc @gol
940 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
941 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
942 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
943 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
946 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
947 -msign-extend-enabled -muser-enabled}
949 @emph{M32R/D Options}
950 @gccoptlist{-m32r2 -m32rx -m32r @gol
952 -malign-loops -mno-align-loops @gol
953 -missue-rate=@var{number} @gol
954 -mbranch-cost=@var{number} @gol
955 -mmodel=@var{code-size-model-type} @gol
956 -msdata=@var{sdata-type} @gol
957 -mno-flush-func -mflush-func=@var{name} @gol
958 -mno-flush-trap -mflush-trap=@var{number} @gol
962 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
964 @emph{M680x0 Options}
965 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
966 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
967 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
968 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
969 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
970 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
971 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
972 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
973 -mxgot -mno-xgot -mlong-jump-table-offsets}
976 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
977 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
978 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
979 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
980 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
983 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
984 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
985 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
986 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
989 @emph{MicroBlaze Options}
990 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
991 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
992 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
993 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
994 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
995 -mpic-data-is-text-relative}
998 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
999 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
1000 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
1001 -mips16 -mno-mips16 -mflip-mips16 @gol
1002 -minterlink-compressed -mno-interlink-compressed @gol
1003 -minterlink-mips16 -mno-interlink-mips16 @gol
1004 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
1005 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
1006 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
1007 -mno-float -msingle-float -mdouble-float @gol
1008 -modd-spreg -mno-odd-spreg @gol
1009 -mabs=@var{mode} -mnan=@var{encoding} @gol
1010 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1011 -mmcu -mmno-mcu @gol
1013 -mvirt -mno-virt @gol
1016 -mginv -mno-ginv @gol
1017 -mmicromips -mno-micromips @gol
1019 -mloongson-mmi -mno-loongson-mmi @gol
1020 -mloongson-ext -mno-loongson-ext @gol
1021 -mloongson-ext2 -mno-loongson-ext2 @gol
1022 -mfpu=@var{fpu-type} @gol
1023 -msmartmips -mno-smartmips @gol
1024 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1025 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1026 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1027 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1028 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1029 -membedded-data -mno-embedded-data @gol
1030 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1031 -mcode-readable=@var{setting} @gol
1032 -msplit-addresses -mno-split-addresses @gol
1033 -mexplicit-relocs -mno-explicit-relocs @gol
1034 -mcheck-zero-division -mno-check-zero-division @gol
1035 -mdivide-traps -mdivide-breaks @gol
1036 -mload-store-pairs -mno-load-store-pairs @gol
1037 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1038 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1039 -mfix-24k -mno-fix-24k @gol
1040 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1041 -mfix-r5900 -mno-fix-r5900 @gol
1042 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1043 -mfix-vr4120 -mno-fix-vr4120 @gol
1044 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1045 -mflush-func=@var{func} -mno-flush-func @gol
1046 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1047 -mcompact-branches=@var{policy} @gol
1048 -mfp-exceptions -mno-fp-exceptions @gol
1049 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1050 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1051 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1052 -mframe-header-opt -mno-frame-header-opt}
1055 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1056 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1057 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1058 -mno-base-addresses -msingle-exit -mno-single-exit}
1060 @emph{MN10300 Options}
1061 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1062 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1063 -mtune=@var{cpu-type} @gol
1064 -mreturn-pointer-on-d0 @gol
1065 -mno-crt0 -mrelax -mliw -msetlb}
1067 @emph{Moxie Options}
1068 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1070 @emph{MSP430 Options}
1071 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1073 -mcode-region= -mdata-region= @gol
1074 -msilicon-errata= -msilicon-errata-warn= @gol
1075 -mhwmult= -minrt -mtiny-printf -mmax-inline-shift=}
1077 @emph{NDS32 Options}
1078 @gccoptlist{-mbig-endian -mlittle-endian @gol
1079 -mreduced-regs -mfull-regs @gol
1080 -mcmov -mno-cmov @gol
1081 -mext-perf -mno-ext-perf @gol
1082 -mext-perf2 -mno-ext-perf2 @gol
1083 -mext-string -mno-ext-string @gol
1084 -mv3push -mno-v3push @gol
1085 -m16bit -mno-16bit @gol
1086 -misr-vector-size=@var{num} @gol
1087 -mcache-block-size=@var{num} @gol
1088 -march=@var{arch} @gol
1089 -mcmodel=@var{code-model} @gol
1090 -mctor-dtor -mrelax}
1092 @emph{Nios II Options}
1093 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1094 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1096 -mno-bypass-cache -mbypass-cache @gol
1097 -mno-cache-volatile -mcache-volatile @gol
1098 -mno-fast-sw-div -mfast-sw-div @gol
1099 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1100 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1101 -mcustom-fpu-cfg=@var{name} @gol
1102 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1103 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1105 @emph{Nvidia PTX Options}
1106 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1108 @emph{OpenRISC Options}
1109 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1110 -msoft-mul -msoft-div @gol
1111 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1112 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1114 @emph{PDP-11 Options}
1115 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1116 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1117 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1119 @emph{picoChip Options}
1120 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1121 -msymbol-as-address -mno-inefficient-warnings}
1123 @emph{PowerPC Options}
1124 See RS/6000 and PowerPC Options.
1127 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1128 -mabi=@var{variant} @gol}
1130 @emph{RISC-V Options}
1131 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1133 -mabi=@var{ABI-string} @gol
1134 -mfdiv -mno-fdiv @gol
1136 -march=@var{ISA-string} @gol
1137 -mtune=@var{processor-string} @gol
1138 -mpreferred-stack-boundary=@var{num} @gol
1139 -msmall-data-limit=@var{N-bytes} @gol
1140 -msave-restore -mno-save-restore @gol
1141 -mshorten-memrefs -mno-shorten-memrefs @gol
1142 -mstrict-align -mno-strict-align @gol
1143 -mcmodel=medlow -mcmodel=medany @gol
1144 -mexplicit-relocs -mno-explicit-relocs @gol
1145 -mrelax -mno-relax @gol
1146 -mriscv-attribute -mmo-riscv-attribute @gol
1147 -malign-data=@var{type} @gol
1148 +-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1149 +-mstack-protector-guard-offset=@var{offset}}
1152 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1153 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1154 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1156 @emph{RS/6000 and PowerPC Options}
1157 @gccoptlist{-mcpu=@var{cpu-type} @gol
1158 -mtune=@var{cpu-type} @gol
1159 -mcmodel=@var{code-model} @gol
1161 -maltivec -mno-altivec @gol
1162 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1163 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1164 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1165 -mfprnd -mno-fprnd @gol
1166 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1167 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1168 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1169 -malign-power -malign-natural @gol
1170 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1171 -mupdate -mno-update @gol
1172 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1173 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1174 -mstrict-align -mno-strict-align -mrelocatable @gol
1175 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1176 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1177 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1178 -mprioritize-restricted-insns=@var{priority} @gol
1179 -msched-costly-dep=@var{dependence_type} @gol
1180 -minsert-sched-nops=@var{scheme} @gol
1181 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1182 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1183 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1184 -mtraceback=@var{traceback_type} @gol
1185 -maix-struct-return -msvr4-struct-return @gol
1186 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1187 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1188 -mblock-move-inline-limit=@var{num} @gol
1189 -mblock-compare-inline-limit=@var{num} @gol
1190 -mblock-compare-inline-loop-limit=@var{num} @gol
1191 -mno-block-ops-unaligned-vsx @gol
1192 -mstring-compare-inline-limit=@var{num} @gol
1193 -misel -mno-isel @gol
1194 -mvrsave -mno-vrsave @gol
1195 -mmulhw -mno-mulhw @gol
1196 -mdlmzb -mno-dlmzb @gol
1197 -mprototype -mno-prototype @gol
1198 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1199 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1200 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1201 -mno-recip-precision @gol
1202 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1203 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1204 -msave-toc-indirect -mno-save-toc-indirect @gol
1205 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1206 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1207 -mquad-memory -mno-quad-memory @gol
1208 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1209 -mcompat-align-parm -mno-compat-align-parm @gol
1210 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1211 -mgnu-attribute -mno-gnu-attribute @gol
1212 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1213 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1214 -mpcrel -mno-pcrel -mmma -mno-mmma}
1217 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1219 -mbig-endian-data -mlittle-endian-data @gol
1222 -mas100-syntax -mno-as100-syntax@gol
1224 -mmax-constant-size=@gol
1227 -mallow-string-insns -mno-allow-string-insns@gol
1229 -mno-warn-multiple-fast-interrupts@gol
1230 -msave-acc-in-interrupts}
1232 @emph{S/390 and zSeries Options}
1233 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1234 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1235 -mlong-double-64 -mlong-double-128 @gol
1236 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1237 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1238 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1239 -mhtm -mvx -mzvector @gol
1240 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1241 -mfused-madd -mno-fused-madd @gol
1242 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1243 -mhotpatch=@var{halfwords},@var{halfwords}}
1245 @emph{Score Options}
1246 @gccoptlist{-meb -mel @gol
1250 -mscore5 -mscore5u -mscore7 -mscore7d}
1253 @gccoptlist{-m1 -m2 -m2e @gol
1254 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1256 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1257 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1258 -mb -ml -mdalign -mrelax @gol
1259 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1260 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1261 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1262 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1263 -maccumulate-outgoing-args @gol
1264 -matomic-model=@var{atomic-model} @gol
1265 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1266 -mcbranch-force-delay-slot @gol
1267 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1268 -mpretend-cmove -mtas}
1270 @emph{Solaris 2 Options}
1271 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1274 @emph{SPARC Options}
1275 @gccoptlist{-mcpu=@var{cpu-type} @gol
1276 -mtune=@var{cpu-type} @gol
1277 -mcmodel=@var{code-model} @gol
1278 -mmemory-model=@var{mem-model} @gol
1279 -m32 -m64 -mapp-regs -mno-app-regs @gol
1280 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1281 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1282 -mhard-quad-float -msoft-quad-float @gol
1283 -mstack-bias -mno-stack-bias @gol
1284 -mstd-struct-return -mno-std-struct-return @gol
1285 -munaligned-doubles -mno-unaligned-doubles @gol
1286 -muser-mode -mno-user-mode @gol
1287 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1288 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1289 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1290 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1291 -mpopc -mno-popc -msubxc -mno-subxc @gol
1292 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1295 @emph{System V Options}
1296 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1298 @emph{TILE-Gx Options}
1299 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1300 -mcmodel=@var{code-model}}
1302 @emph{TILEPro Options}
1303 @gccoptlist{-mcpu=@var{cpu} -m32}
1306 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1307 -mprolog-function -mno-prolog-function -mspace @gol
1308 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1309 -mapp-regs -mno-app-regs @gol
1310 -mdisable-callt -mno-disable-callt @gol
1311 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1312 -mv850e -mv850 -mv850e3v5 @gol
1323 @gccoptlist{-mg -mgnu -munix}
1325 @emph{Visium Options}
1326 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1327 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1330 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1331 -mpointer-size=@var{size}}
1333 @emph{VxWorks Options}
1334 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1335 -Xbind-lazy -Xbind-now}
1338 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1339 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1340 -mfpmath=@var{unit} @gol
1341 -masm=@var{dialect} -mno-fancy-math-387 @gol
1342 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1343 -mno-wide-multiply -mrtd -malign-double @gol
1344 -mpreferred-stack-boundary=@var{num} @gol
1345 -mincoming-stack-boundary=@var{num} @gol
1346 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1347 -mrecip -mrecip=@var{opt} @gol
1348 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1349 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1350 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1351 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1352 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1353 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1354 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1355 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1356 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1357 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1358 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1359 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1360 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1361 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1362 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1363 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1364 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1365 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1366 -mregparm=@var{num} -msseregparm @gol
1367 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1368 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1369 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1370 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1371 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1372 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1373 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1374 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1375 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1376 -mstack-protector-guard-reg=@var{reg} @gol
1377 -mstack-protector-guard-offset=@var{offset} @gol
1378 -mstack-protector-guard-symbol=@var{symbol} @gol
1379 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1380 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1381 -mindirect-branch-register}
1383 @emph{x86 Windows Options}
1384 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1385 -mnop-fun-dllimport -mthread @gol
1386 -municode -mwin32 -mwindows -fno-set-stack-executable}
1388 @emph{Xstormy16 Options}
1391 @emph{Xtensa Options}
1392 @gccoptlist{-mconst16 -mno-const16 @gol
1393 -mfused-madd -mno-fused-madd @gol
1395 -mserialize-volatile -mno-serialize-volatile @gol
1396 -mtext-section-literals -mno-text-section-literals @gol
1397 -mauto-litpools -mno-auto-litpools @gol
1398 -mtarget-align -mno-target-align @gol
1399 -mlongcalls -mno-longcalls @gol
1400 -mabi=@var{abi-type}}
1402 @emph{zSeries Options}
1403 See S/390 and zSeries Options.
1407 @node Overall Options
1408 @section Options Controlling the Kind of Output
1410 Compilation can involve up to four stages: preprocessing, compilation
1411 proper, assembly and linking, always in that order. GCC is capable of
1412 preprocessing and compiling several files either into several
1413 assembler input files, or into one assembler input file; then each
1414 assembler input file produces an object file, and linking combines all
1415 the object files (those newly compiled, and those specified as input)
1416 into an executable file.
1418 @cindex file name suffix
1419 For any given input file, the file name suffix determines what kind of
1420 compilation is done:
1424 C source code that must be preprocessed.
1427 C source code that should not be preprocessed.
1430 C++ source code that should not be preprocessed.
1433 Objective-C source code. Note that you must link with the @file{libobjc}
1434 library to make an Objective-C program work.
1437 Objective-C source code that should not be preprocessed.
1441 Objective-C++ source code. Note that you must link with the @file{libobjc}
1442 library to make an Objective-C++ program work. Note that @samp{.M} refers
1443 to a literal capital M@.
1445 @item @var{file}.mii
1446 Objective-C++ source code that should not be preprocessed.
1449 C, C++, Objective-C or Objective-C++ header file to be turned into a
1450 precompiled header (default), or C, C++ header file to be turned into an
1451 Ada spec (via the @option{-fdump-ada-spec} switch).
1454 @itemx @var{file}.cp
1455 @itemx @var{file}.cxx
1456 @itemx @var{file}.cpp
1457 @itemx @var{file}.CPP
1458 @itemx @var{file}.c++
1460 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1461 the last two letters must both be literally @samp{x}. Likewise,
1462 @samp{.C} refers to a literal capital C@.
1466 Objective-C++ source code that must be preprocessed.
1468 @item @var{file}.mii
1469 Objective-C++ source code that should not be preprocessed.
1473 @itemx @var{file}.hp
1474 @itemx @var{file}.hxx
1475 @itemx @var{file}.hpp
1476 @itemx @var{file}.HPP
1477 @itemx @var{file}.h++
1478 @itemx @var{file}.tcc
1479 C++ header file to be turned into a precompiled header or Ada spec.
1482 @itemx @var{file}.for
1483 @itemx @var{file}.ftn
1484 Fixed form Fortran source code that should not be preprocessed.
1487 @itemx @var{file}.FOR
1488 @itemx @var{file}.fpp
1489 @itemx @var{file}.FPP
1490 @itemx @var{file}.FTN
1491 Fixed form Fortran source code that must be preprocessed (with the traditional
1494 @item @var{file}.f90
1495 @itemx @var{file}.f95
1496 @itemx @var{file}.f03
1497 @itemx @var{file}.f08
1498 Free form Fortran source code that should not be preprocessed.
1500 @item @var{file}.F90
1501 @itemx @var{file}.F95
1502 @itemx @var{file}.F03
1503 @itemx @var{file}.F08
1504 Free form Fortran source code that must be preprocessed (with the
1505 traditional preprocessor).
1510 @item @var{file}.brig
1511 BRIG files (binary representation of HSAIL).
1520 D documentation code (Ddoc).
1522 @item @var{file}.ads
1523 Ada source code file that contains a library unit declaration (a
1524 declaration of a package, subprogram, or generic, or a generic
1525 instantiation), or a library unit renaming declaration (a package,
1526 generic, or subprogram renaming declaration). Such files are also
1529 @item @var{file}.adb
1530 Ada source code file containing a library unit body (a subprogram or
1531 package body). Such files are also called @dfn{bodies}.
1533 @c GCC also knows about some suffixes for languages not yet included:
1541 @itemx @var{file}.sx
1542 Assembler code that must be preprocessed.
1545 An object file to be fed straight into linking.
1546 Any file name with no recognized suffix is treated this way.
1550 You can specify the input language explicitly with the @option{-x} option:
1553 @item -x @var{language}
1554 Specify explicitly the @var{language} for the following input files
1555 (rather than letting the compiler choose a default based on the file
1556 name suffix). This option applies to all following input files until
1557 the next @option{-x} option. Possible values for @var{language} are:
1559 c c-header cpp-output
1560 c++ c++-header c++-cpp-output
1561 objective-c objective-c-header objective-c-cpp-output
1562 objective-c++ objective-c++-header objective-c++-cpp-output
1563 assembler assembler-with-cpp
1566 f77 f77-cpp-input f95 f95-cpp-input
1572 Turn off any specification of a language, so that subsequent files are
1573 handled according to their file name suffixes (as they are if @option{-x}
1574 has not been used at all).
1577 If you only want some of the stages of compilation, you can use
1578 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1579 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1580 @command{gcc} is to stop. Note that some combinations (for example,
1581 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1586 Compile or assemble the source files, but do not link. The linking
1587 stage simply is not done. The ultimate output is in the form of an
1588 object file for each source file.
1590 By default, the object file name for a source file is made by replacing
1591 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1593 Unrecognized input files, not requiring compilation or assembly, are
1598 Stop after the stage of compilation proper; do not assemble. The output
1599 is in the form of an assembler code file for each non-assembler input
1602 By default, the assembler file name for a source file is made by
1603 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1605 Input files that don't require compilation are ignored.
1609 Stop after the preprocessing stage; do not run the compiler proper. The
1610 output is in the form of preprocessed source code, which is sent to the
1613 Input files that don't require preprocessing are ignored.
1615 @cindex output file option
1618 Place the primary output in file @var{file}. This applies to whatever
1619 sort of output is being produced, whether it be an executable file, an
1620 object file, an assembler file or preprocessed C code.
1622 If @option{-o} is not specified, the default is to put an executable
1623 file in @file{a.out}, the object file for
1624 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1625 assembler file in @file{@var{source}.s}, a precompiled header file in
1626 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1629 Though @option{-o} names only the primary output, it also affects the
1630 naming of auxiliary and dump outputs. See the examples below. Unless
1631 overridden, both auxiliary outputs and dump outputs are placed in the
1632 same directory as the primary output. In auxiliary outputs, the suffix
1633 of the input file is replaced with that of the auxiliary output file
1634 type; in dump outputs, the suffix of the dump file is appended to the
1635 input file suffix. In compilation commands, the base name of both
1636 auxiliary and dump outputs is that of the primary output; in compile and
1637 link commands, the primary output name, minus the executable suffix, is
1638 combined with the input file name. If both share the same base name,
1639 disregarding the suffix, the result of the combination is that base
1640 name, otherwise, they are concatenated, separated by a dash.
1646 will use @file{foo.o} as the primary output, and place aux outputs and
1647 dumps next to it, e.g., aux file @file{foo.dwo} for
1648 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1649 @option{-fdump-rtl-final}.
1651 If a non-linker output file is explicitly specified, aux and dump files
1652 by default take the same base name:
1655 gcc -c foo.c -o dir/foobar.o ...
1658 will name aux outputs @file{dir/foobar.*} and dump outputs
1659 @file{dir/foobar.c.*}.
1661 A linker output will instead prefix aux and dump outputs:
1664 gcc foo.c bar.c -o dir/foobar ...
1667 will generally name aux outputs @file{dir/foobar-foo.*} and
1668 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1669 @file{dir/foobar-bar.c.*}.
1671 The one exception to the above is when the executable shares the base
1672 name with the single input:
1675 gcc foo.c -o dir/foo ...
1678 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1679 named @file{dir/foo.c.*}.
1681 The location and the names of auxiliary and dump outputs can be adjusted
1682 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1683 @option{-dumpdir}, @option{-save-temps=cwd}, and
1684 @option{-save-temps=obj}.
1687 @item -dumpbase @var{dumpbase}
1689 This option sets the base name for auxiliary and dump output files. It
1690 does not affect the name of the primary output file. Intermediate
1691 outputs, when preserved, are not regarded as primary outputs, but as
1695 gcc -save-temps -S foo.c
1698 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1699 then compiles to the (implied) output file @file{foo.s}, whereas:
1702 gcc -save-temps -dumpbase save-foo -c foo.c
1705 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1706 an intermediate, thus auxiliary output), and then assembles to the
1707 (implied) output file @file{foo.o}.
1709 Absent this option, dump and aux files take their names from the input
1710 file, or from the (non-linker) output file, if one is explicitly
1711 specified: dump output files (e.g. those requested by @option{-fdump-*}
1712 options) with the input name suffix, and aux output files (those
1713 requested by other non-dump options, e.g. @code{-save-temps},
1714 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1716 Similar suffix differentiation of dump and aux outputs can be attained
1717 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1718 @option{-dumpbase-ext .suf}.
1720 If @var{dumpbase} is explicitly specified with any directory component,
1721 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1722 @option{-save-temps=*}) is ignored, and instead of appending to it,
1723 @var{dumpbase} fully overrides it:
1726 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1727 -dumpdir pfx- -save-temps=cwd ...
1730 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1731 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1732 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1734 When @option{-dumpbase} is specified in a command that compiles multiple
1735 inputs, or that compiles and then links, it may be combined with
1736 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1737 file is compiled using the combined @var{dumppfx}, and default values
1738 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1742 gcc foo.c bar.c -c -dumpbase main ...
1745 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1746 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1747 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1748 and @file{main-bar.*}.
1750 An empty string specified as @var{dumpbase} avoids the influence of the
1751 output basename in the naming of auxiliary and dump outputs during
1752 compilation, computing default values :
1755 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1758 will name aux outputs @file{dir/foo.*} and dump outputs
1759 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1760 name, but the directory still defaults to that of the output.
1762 The empty-string dumpbase does not prevent the use of the output
1763 basename for outputs during linking:
1766 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1769 The compilation of the source files will name auxiliary outputs
1770 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1771 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1772 linking will use @file{dir/foobar.} as the prefix for dumps and
1776 @item -dumpbase-ext @var{auxdropsuf}
1777 @opindex dumpbase-ext
1778 When forming the name of an auxiliary (but not a dump) output file, drop
1779 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1780 suffixes. If not specified, this option defaults to the suffix of a
1781 default @var{dumpbase}, i.e., the suffix of the input file when
1782 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1783 is combined with @var{dumppfx}.
1786 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1789 creates @file{dir/foo.o} as the main output, and generates auxiliary
1790 outputs in @file{dir/x-foo.*}, taking the location of the primary
1791 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1792 outputs retain the suffix: @file{dir/x-foo.c.*}.
1794 This option is disregarded if it does not match the suffix of a
1795 specified @var{dumpbase}, except as an alternative to the executable
1796 suffix when appending the linker output base name to @var{dumppfx}, as
1800 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1803 creates @file{main.out} as the primary output, and avoids overwriting
1804 the auxiliary and dump outputs by using the executable name minus
1805 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1806 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1807 @file{main-foo.c.*} and @file{main-bar.c.*}.
1810 @item -dumpdir @var{dumppfx}
1812 When forming the name of an auxiliary or dump output file, use
1813 @var{dumppfx} as a prefix:
1816 gcc -dumpdir pfx- -c foo.c ...
1819 creates @file{foo.o} as the primary output, and auxiliary outputs named
1820 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1821 @var{dumpbase} derived from the default primary output, derived in turn
1822 from the input name. Dump outputs also take the input name suffix:
1825 If @var{dumppfx} is to be used as a directory name, it must end with a
1826 directory separator:
1829 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1832 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1833 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1834 default @var{dumpbase} derived from the primary output name. Dump
1835 outputs also take the input name suffix: @file{dir/bar.c.*}.
1837 It defaults to the location of the output file; options
1838 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1839 default, just like an explicit @option{-dumpdir} option. In case
1840 multiple such options are given, the last one prevails:
1843 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1846 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1847 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1848 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1849 default for @option{-save-temps}, nor that the output directory is
1850 implicitly the current directory. Dump outputs are named
1853 When compiling from multiple input files, if @option{-dumpbase} is
1854 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1855 are appended to (or override, if containing any directory components) an
1856 explicit or defaulted @var{dumppfx}, so that each of the multiple
1857 compilations gets differently-named aux and dump outputs.
1860 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1863 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1864 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1865 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1866 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1867 single-input compilation:
1870 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1873 that, applying @option{-dumpbase} to a single source, does not compute
1874 and append a separate @var{dumpbase} per input file. Its auxiliary and
1875 dump outputs go in @file{dir/pfx-main.*}.
1877 When compiling and then linking from multiple input files, a defaulted
1878 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1879 transformation above (e.g. the compilation of @file{foo.c} and
1880 @file{bar.c} above, but without @option{-c}). If neither
1881 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1882 base name, minus @var{auxdropsuf}, if specified, or the executable
1883 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1884 instead. Note, however, that unlike earlier cases of linking:
1887 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1890 does not append the output name @file{main} to @var{dumppfx}, because
1891 @option{-dumpdir} is explicitly specified. The goal is that the
1892 explicitly-specified @var{dumppfx} may contain the specified output name
1893 as part of the prefix, if desired; only an explicitly-specified
1894 @option{-dumpbase} would be combined with it, in order to avoid simply
1895 discarding a meaningful option.
1897 When compiling and then linking from a single input file, the linker
1898 output base name will only be appended to the default @var{dumppfx} as
1899 above if it does not share the base name with the single input file
1900 name. This has been covered in single-input linking cases above, but
1901 not with an explicit @option{-dumpdir} that inhibits the combination,
1902 even if overridden by @option{-save-temps=*}:
1905 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1908 Auxiliary outputs are named @file{foo.*}, and dump outputs
1909 @file{foo.c.*}, in the current working directory as ultimately requested
1910 by @option{-save-temps=cwd}.
1912 Summing it all up for an intuitive though slightly imprecise data flow:
1913 the primary output name is broken into a directory part and a basename
1914 part; @var{dumppfx} is set to the former, unless overridden by
1915 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1916 to the latter, unless overriden by @option{-dumpbase}. If there are
1917 multiple inputs or linking, this @var{dumpbase} may be combined with
1918 @var{dumppfx} and taken from each input file. Auxiliary output names
1919 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1920 minus suffix, and the auxiliary output suffix; dump output names are
1921 only different in that the suffix from @var{dumpbase} is retained.
1923 When it comes to auxiliary and dump outputs created during LTO
1924 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1925 given or as derived from the linker output name but not from inputs,
1926 even in cases in which this combination would not otherwise be used as
1927 such, is passed down with a trailing period replacing the compiler-added
1928 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1929 being involved in linking, this program does not normally get any
1930 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1932 When running sub-compilers, @command{lto-wrapper} appends LTO stage
1933 names to the received @var{dumppfx}, ensures it contains a directory
1934 component so that it overrides any @option{-dumpdir}, and passes that as
1935 @option{-dumpbase} to sub-compilers.
1939 Print (on standard error output) the commands executed to run the stages
1940 of compilation. Also print the version number of the compiler driver
1941 program and of the preprocessor and the compiler proper.
1945 Like @option{-v} except the commands are not executed and arguments
1946 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1947 This is useful for shell scripts to capture the driver-generated command lines.
1951 Print (on the standard output) a description of the command-line options
1952 understood by @command{gcc}. If the @option{-v} option is also specified
1953 then @option{--help} is also passed on to the various processes
1954 invoked by @command{gcc}, so that they can display the command-line options
1955 they accept. If the @option{-Wextra} option has also been specified
1956 (prior to the @option{--help} option), then command-line options that
1957 have no documentation associated with them are also displayed.
1960 @opindex target-help
1961 Print (on the standard output) a description of target-specific command-line
1962 options for each tool. For some targets extra target-specific
1963 information may also be printed.
1965 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1966 Print (on the standard output) a description of the command-line
1967 options understood by the compiler that fit into all specified classes
1968 and qualifiers. These are the supported classes:
1971 @item @samp{optimizers}
1972 Display all of the optimization options supported by the
1975 @item @samp{warnings}
1976 Display all of the options controlling warning messages
1977 produced by the compiler.
1980 Display target-specific options. Unlike the
1981 @option{--target-help} option however, target-specific options of the
1982 linker and assembler are not displayed. This is because those
1983 tools do not currently support the extended @option{--help=} syntax.
1986 Display the values recognized by the @option{--param}
1989 @item @var{language}
1990 Display the options supported for @var{language}, where
1991 @var{language} is the name of one of the languages supported in this
1992 version of GCC@. If an option is supported by all languages, one needs
1993 to select @samp{common} class.
1996 Display the options that are common to all languages.
1999 These are the supported qualifiers:
2002 @item @samp{undocumented}
2003 Display only those options that are undocumented.
2006 Display options taking an argument that appears after an equal
2007 sign in the same continuous piece of text, such as:
2008 @samp{--help=target}.
2010 @item @samp{separate}
2011 Display options taking an argument that appears as a separate word
2012 following the original option, such as: @samp{-o output-file}.
2015 Thus for example to display all the undocumented target-specific
2016 switches supported by the compiler, use:
2019 --help=target,undocumented
2022 The sense of a qualifier can be inverted by prefixing it with the
2023 @samp{^} character, so for example to display all binary warning
2024 options (i.e., ones that are either on or off and that do not take an
2025 argument) that have a description, use:
2028 --help=warnings,^joined,^undocumented
2031 The argument to @option{--help=} should not consist solely of inverted
2034 Combining several classes is possible, although this usually
2035 restricts the output so much that there is nothing to display. One
2036 case where it does work, however, is when one of the classes is
2037 @var{target}. For example, to display all the target-specific
2038 optimization options, use:
2041 --help=target,optimizers
2044 The @option{--help=} option can be repeated on the command line. Each
2045 successive use displays its requested class of options, skipping
2046 those that have already been displayed. If @option{--help} is also
2047 specified anywhere on the command line then this takes precedence
2048 over any @option{--help=} option.
2050 If the @option{-Q} option appears on the command line before the
2051 @option{--help=} option, then the descriptive text displayed by
2052 @option{--help=} is changed. Instead of describing the displayed
2053 options, an indication is given as to whether the option is enabled,
2054 disabled or set to a specific value (assuming that the compiler
2055 knows this at the point where the @option{--help=} option is used).
2057 Here is a truncated example from the ARM port of @command{gcc}:
2060 % gcc -Q -mabi=2 --help=target -c
2061 The following options are target specific:
2063 -mabort-on-noreturn [disabled]
2067 The output is sensitive to the effects of previous command-line
2068 options, so for example it is possible to find out which optimizations
2069 are enabled at @option{-O2} by using:
2072 -Q -O2 --help=optimizers
2075 Alternatively you can discover which binary optimizations are enabled
2076 by @option{-O3} by using:
2079 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2080 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2081 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2086 Display the version number and copyrights of the invoked GCC@.
2088 @item -pass-exit-codes
2089 @opindex pass-exit-codes
2090 Normally the @command{gcc} program exits with the code of 1 if any
2091 phase of the compiler returns a non-success return code. If you specify
2092 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2093 the numerically highest error produced by any phase returning an error
2094 indication. The C, C++, and Fortran front ends return 4 if an internal
2095 compiler error is encountered.
2099 Use pipes rather than temporary files for communication between the
2100 various stages of compilation. This fails to work on some systems where
2101 the assembler is unable to read from a pipe; but the GNU assembler has
2104 @item -specs=@var{file}
2106 Process @var{file} after the compiler reads in the standard @file{specs}
2107 file, in order to override the defaults which the @command{gcc} driver
2108 program uses when determining what switches to pass to @command{cc1},
2109 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2110 @option{-specs=@var{file}} can be specified on the command line, and they
2111 are processed in order, from left to right. @xref{Spec Files}, for
2112 information about the format of the @var{file}.
2116 Invoke all subcommands under a wrapper program. The name of the
2117 wrapper program and its parameters are passed as a comma separated
2121 gcc -c t.c -wrapper gdb,--args
2125 This invokes all subprograms of @command{gcc} under
2126 @samp{gdb --args}, thus the invocation of @command{cc1} is
2127 @samp{gdb --args cc1 @dots{}}.
2129 @item -ffile-prefix-map=@var{old}=@var{new}
2130 @opindex ffile-prefix-map
2131 When compiling files residing in directory @file{@var{old}}, record
2132 any references to them in the result of the compilation as if the
2133 files resided in directory @file{@var{new}} instead. Specifying this
2134 option is equivalent to specifying all the individual
2135 @option{-f*-prefix-map} options. This can be used to make reproducible
2136 builds that are location independent. See also
2137 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
2139 @item -fplugin=@var{name}.so
2141 Load the plugin code in file @var{name}.so, assumed to be a
2142 shared object to be dlopen'd by the compiler. The base name of
2143 the shared object file is used to identify the plugin for the
2144 purposes of argument parsing (See
2145 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2146 Each plugin should define the callback functions specified in the
2149 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2150 @opindex fplugin-arg
2151 Define an argument called @var{key} with a value of @var{value}
2152 for the plugin called @var{name}.
2154 @item -fdump-ada-spec@r{[}-slim@r{]}
2155 @opindex fdump-ada-spec
2156 For C and C++ source and include files, generate corresponding Ada specs.
2157 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2158 GNAT User's Guide}, which provides detailed documentation on this feature.
2160 @item -fada-spec-parent=@var{unit}
2161 @opindex fada-spec-parent
2162 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2163 Ada specs as child units of parent @var{unit}.
2165 @item -fdump-go-spec=@var{file}
2166 @opindex fdump-go-spec
2167 For input files in any language, generate corresponding Go
2168 declarations in @var{file}. This generates Go @code{const},
2169 @code{type}, @code{var}, and @code{func} declarations which may be a
2170 useful way to start writing a Go interface to code written in some
2173 @include @value{srcdir}/../libiberty/at-file.texi
2177 @section Compiling C++ Programs
2179 @cindex suffixes for C++ source
2180 @cindex C++ source file suffixes
2181 C++ source files conventionally use one of the suffixes @samp{.C},
2182 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2183 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2184 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2185 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2186 files with these names and compiles them as C++ programs even if you
2187 call the compiler the same way as for compiling C programs (usually
2188 with the name @command{gcc}).
2192 However, the use of @command{gcc} does not add the C++ library.
2193 @command{g++} is a program that calls GCC and automatically specifies linking
2194 against the C++ library. It treats @samp{.c},
2195 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2196 files unless @option{-x} is used. This program is also useful when
2197 precompiling a C header file with a @samp{.h} extension for use in C++
2198 compilations. On many systems, @command{g++} is also installed with
2199 the name @command{c++}.
2201 @cindex invoking @command{g++}
2202 When you compile C++ programs, you may specify many of the same
2203 command-line options that you use for compiling programs in any
2204 language; or command-line options meaningful for C and related
2205 languages; or options that are meaningful only for C++ programs.
2206 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2207 explanations of options for languages related to C@.
2208 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2209 explanations of options that are meaningful only for C++ programs.
2211 @node C Dialect Options
2212 @section Options Controlling C Dialect
2213 @cindex dialect options
2214 @cindex language dialect options
2215 @cindex options, dialect
2217 The following options control the dialect of C (or languages derived
2218 from C, such as C++, Objective-C and Objective-C++) that the compiler
2222 @cindex ANSI support
2226 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2227 equivalent to @option{-std=c++98}.
2229 This turns off certain features of GCC that are incompatible with ISO
2230 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2231 such as the @code{asm} and @code{typeof} keywords, and
2232 predefined macros such as @code{unix} and @code{vax} that identify the
2233 type of system you are using. It also enables the undesirable and
2234 rarely used ISO trigraph feature. For the C compiler,
2235 it disables recognition of C++ style @samp{//} comments as well as
2236 the @code{inline} keyword.
2238 The alternate keywords @code{__asm__}, @code{__extension__},
2239 @code{__inline__} and @code{__typeof__} continue to work despite
2240 @option{-ansi}. You would not want to use them in an ISO C program, of
2241 course, but it is useful to put them in header files that might be included
2242 in compilations done with @option{-ansi}. Alternate predefined macros
2243 such as @code{__unix__} and @code{__vax__} are also available, with or
2244 without @option{-ansi}.
2246 The @option{-ansi} option does not cause non-ISO programs to be
2247 rejected gratuitously. For that, @option{-Wpedantic} is required in
2248 addition to @option{-ansi}. @xref{Warning Options}.
2250 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2251 option is used. Some header files may notice this macro and refrain
2252 from declaring certain functions or defining certain macros that the
2253 ISO standard doesn't call for; this is to avoid interfering with any
2254 programs that might use these names for other things.
2256 Functions that are normally built in but do not have semantics
2257 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2258 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2259 built-in functions provided by GCC}, for details of the functions
2264 Determine the language standard. @xref{Standards,,Language Standards
2265 Supported by GCC}, for details of these standard versions. This option
2266 is currently only supported when compiling C or C++.
2268 The compiler can accept several base standards, such as @samp{c90} or
2269 @samp{c++98}, and GNU dialects of those standards, such as
2270 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2271 compiler accepts all programs following that standard plus those
2272 using GNU extensions that do not contradict it. For example,
2273 @option{-std=c90} turns off certain features of GCC that are
2274 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2275 keywords, but not other GNU extensions that do not have a meaning in
2276 ISO C90, such as omitting the middle term of a @code{?:}
2277 expression. On the other hand, when a GNU dialect of a standard is
2278 specified, all features supported by the compiler are enabled, even when
2279 those features change the meaning of the base standard. As a result, some
2280 strict-conforming programs may be rejected. The particular standard
2281 is used by @option{-Wpedantic} to identify which features are GNU
2282 extensions given that version of the standard. For example
2283 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2284 comments, while @option{-std=gnu99 -Wpedantic} does not.
2286 A value for this option must be provided; possible values are
2292 Support all ISO C90 programs (certain GNU extensions that conflict
2293 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2295 @item iso9899:199409
2296 ISO C90 as modified in amendment 1.
2302 ISO C99. This standard is substantially completely supported, modulo
2303 bugs and floating-point issues
2304 (mainly but not entirely relating to optional C99 features from
2305 Annexes F and G). See
2306 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
2307 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2312 ISO C11, the 2011 revision of the ISO C standard. This standard is
2313 substantially completely supported, modulo bugs, floating-point issues
2314 (mainly but not entirely relating to optional C11 features from
2315 Annexes F and G) and the optional Annexes K (Bounds-checking
2316 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2322 ISO C17, the 2017 revision of the ISO C standard
2323 (published in 2018). This standard is
2324 same as C11 except for corrections of defects (all of which are also
2325 applied with @option{-std=c11}) and a new value of
2326 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2329 The next version of the ISO C standard, still under development. The
2330 support for this version is experimental and incomplete.
2334 GNU dialect of ISO C90 (including some C99 features).
2338 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2342 GNU dialect of ISO C11.
2343 The name @samp{gnu1x} is deprecated.
2347 GNU dialect of ISO C17. This is the default for C code.
2350 The next version of the ISO C standard, still under development, plus
2351 GNU extensions. The support for this version is experimental and
2356 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2357 additional defect reports. Same as @option{-ansi} for C++ code.
2361 GNU dialect of @option{-std=c++98}.
2365 The 2011 ISO C++ standard plus amendments.
2366 The name @samp{c++0x} is deprecated.
2370 GNU dialect of @option{-std=c++11}.
2371 The name @samp{gnu++0x} is deprecated.
2375 The 2014 ISO C++ standard plus amendments.
2376 The name @samp{c++1y} is deprecated.
2380 GNU dialect of @option{-std=c++14}.
2381 The name @samp{gnu++1y} is deprecated.
2385 The 2017 ISO C++ standard plus amendments.
2386 The name @samp{c++1z} is deprecated.
2390 GNU dialect of @option{-std=c++17}.
2391 This is the default for C++ code.
2392 The name @samp{gnu++1z} is deprecated.
2396 The next revision of the ISO C++ standard, planned for
2397 2020. Support is highly experimental, and will almost certainly
2398 change in incompatible ways in future releases.
2402 GNU dialect of @option{-std=c++20}. Support is highly experimental,
2403 and will almost certainly change in incompatible ways in future
2407 @item -fgnu89-inline
2408 @opindex fgnu89-inline
2409 The option @option{-fgnu89-inline} tells GCC to use the traditional
2410 GNU semantics for @code{inline} functions when in C99 mode.
2411 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2412 Using this option is roughly equivalent to adding the
2413 @code{gnu_inline} function attribute to all inline functions
2414 (@pxref{Function Attributes}).
2416 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2417 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2418 specifies the default behavior).
2419 This option is not supported in @option{-std=c90} or
2420 @option{-std=gnu90} mode.
2422 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2423 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2424 in effect for @code{inline} functions. @xref{Common Predefined
2425 Macros,,,cpp,The C Preprocessor}.
2427 @item -fpermitted-flt-eval-methods=@var{style}
2428 @opindex fpermitted-flt-eval-methods
2429 @opindex fpermitted-flt-eval-methods=c11
2430 @opindex fpermitted-flt-eval-methods=ts-18661-3
2431 ISO/IEC TS 18661-3 defines new permissible values for
2432 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2433 a semantic type that is an interchange or extended format should be
2434 evaluated to the precision and range of that type. These new values are
2435 a superset of those permitted under C99/C11, which does not specify the
2436 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2437 conforming to C11 may not have been written expecting the possibility of
2440 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2441 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2442 or the extended set of values specified in ISO/IEC TS 18661-3.
2444 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2446 The default when in a standards compliant mode (@option{-std=c11} or similar)
2447 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2448 dialect (@option{-std=gnu11} or similar) is
2449 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2451 @item -aux-info @var{filename}
2453 Output to the given filename prototyped declarations for all functions
2454 declared and/or defined in a translation unit, including those in header
2455 files. This option is silently ignored in any language other than C@.
2457 Besides declarations, the file indicates, in comments, the origin of
2458 each declaration (source file and line), whether the declaration was
2459 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2460 @samp{O} for old, respectively, in the first character after the line
2461 number and the colon), and whether it came from a declaration or a
2462 definition (@samp{C} or @samp{F}, respectively, in the following
2463 character). In the case of function definitions, a K&R-style list of
2464 arguments followed by their declarations is also provided, inside
2465 comments, after the declaration.
2467 @item -fallow-parameterless-variadic-functions
2468 @opindex fallow-parameterless-variadic-functions
2469 Accept variadic functions without named parameters.
2471 Although it is possible to define such a function, this is not very
2472 useful as it is not possible to read the arguments. This is only
2473 supported for C as this construct is allowed by C++.
2478 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2479 keyword, so that code can use these words as identifiers. You can use
2480 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2481 instead. @option{-ansi} implies @option{-fno-asm}.
2483 In C++, this switch only affects the @code{typeof} keyword, since
2484 @code{asm} and @code{inline} are standard keywords. You may want to
2485 use the @option{-fno-gnu-keywords} flag instead, which has the same
2486 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2487 switch only affects the @code{asm} and @code{typeof} keywords, since
2488 @code{inline} is a standard keyword in ISO C99.
2491 @itemx -fno-builtin-@var{function}
2492 @opindex fno-builtin
2494 @cindex built-in functions
2495 Don't recognize built-in functions that do not begin with
2496 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2497 functions provided by GCC}, for details of the functions affected,
2498 including those which are not built-in functions when @option{-ansi} or
2499 @option{-std} options for strict ISO C conformance are used because they
2500 do not have an ISO standard meaning.
2502 GCC normally generates special code to handle certain built-in functions
2503 more efficiently; for instance, calls to @code{alloca} may become single
2504 instructions which adjust the stack directly, and calls to @code{memcpy}
2505 may become inline copy loops. The resulting code is often both smaller
2506 and faster, but since the function calls no longer appear as such, you
2507 cannot set a breakpoint on those calls, nor can you change the behavior
2508 of the functions by linking with a different library. In addition,
2509 when a function is recognized as a built-in function, GCC may use
2510 information about that function to warn about problems with calls to
2511 that function, or to generate more efficient code, even if the
2512 resulting code still contains calls to that function. For example,
2513 warnings are given with @option{-Wformat} for bad calls to
2514 @code{printf} when @code{printf} is built in and @code{strlen} is
2515 known not to modify global memory.
2517 With the @option{-fno-builtin-@var{function}} option
2518 only the built-in function @var{function} is
2519 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2520 function is named that is not built-in in this version of GCC, this
2521 option is ignored. There is no corresponding
2522 @option{-fbuiltin-@var{function}} option; if you wish to enable
2523 built-in functions selectively when using @option{-fno-builtin} or
2524 @option{-ffreestanding}, you may define macros such as:
2527 #define abs(n) __builtin_abs ((n))
2528 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2534 Enable parsing of function definitions marked with @code{__GIMPLE}.
2535 This is an experimental feature that allows unit testing of GIMPLE
2540 @cindex hosted environment
2542 Assert that compilation targets a hosted environment. This implies
2543 @option{-fbuiltin}. A hosted environment is one in which the
2544 entire standard library is available, and in which @code{main} has a return
2545 type of @code{int}. Examples are nearly everything except a kernel.
2546 This is equivalent to @option{-fno-freestanding}.
2548 @item -ffreestanding
2549 @opindex ffreestanding
2550 @cindex hosted environment
2552 Assert that compilation targets a freestanding environment. This
2553 implies @option{-fno-builtin}. A freestanding environment
2554 is one in which the standard library may not exist, and program startup may
2555 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2556 This is equivalent to @option{-fno-hosted}.
2558 @xref{Standards,,Language Standards Supported by GCC}, for details of
2559 freestanding and hosted environments.
2563 @cindex OpenACC accelerator programming
2564 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2565 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2566 compiler generates accelerated code according to the OpenACC Application
2567 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2568 implies @option{-pthread}, and thus is only supported on targets that
2569 have support for @option{-pthread}.
2571 @item -fopenacc-dim=@var{geom}
2572 @opindex fopenacc-dim
2573 @cindex OpenACC accelerator programming
2574 Specify default compute dimensions for parallel offload regions that do
2575 not explicitly specify. The @var{geom} value is a triple of
2576 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2577 can be omitted, to use a target-specific default value.
2581 @cindex OpenMP parallel
2582 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2583 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2584 compiler generates parallel code according to the OpenMP Application
2585 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2586 implies @option{-pthread}, and thus is only supported on targets that
2587 have support for @option{-pthread}. @option{-fopenmp} implies
2588 @option{-fopenmp-simd}.
2591 @opindex fopenmp-simd
2594 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2595 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2600 When the option @option{-fgnu-tm} is specified, the compiler
2601 generates code for the Linux variant of Intel's current Transactional
2602 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2603 an experimental feature whose interface may change in future versions
2604 of GCC, as the official specification changes. Please note that not
2605 all architectures are supported for this feature.
2607 For more information on GCC's support for transactional memory,
2608 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2609 Transactional Memory Library}.
2611 Note that the transactional memory feature is not supported with
2612 non-call exceptions (@option{-fnon-call-exceptions}).
2614 @item -fms-extensions
2615 @opindex fms-extensions
2616 Accept some non-standard constructs used in Microsoft header files.
2618 In C++ code, this allows member names in structures to be similar
2619 to previous types declarations.
2628 Some cases of unnamed fields in structures and unions are only
2629 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2630 fields within structs/unions}, for details.
2632 Note that this option is off for all targets except for x86
2633 targets using ms-abi.
2635 @item -fplan9-extensions
2636 @opindex fplan9-extensions
2637 Accept some non-standard constructs used in Plan 9 code.
2639 This enables @option{-fms-extensions}, permits passing pointers to
2640 structures with anonymous fields to functions that expect pointers to
2641 elements of the type of the field, and permits referring to anonymous
2642 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2643 struct/union fields within structs/unions}, for details. This is only
2644 supported for C, not C++.
2646 @item -fcond-mismatch
2647 @opindex fcond-mismatch
2648 Allow conditional expressions with mismatched types in the second and
2649 third arguments. The value of such an expression is void. This option
2650 is not supported for C++.
2652 @item -flax-vector-conversions
2653 @opindex flax-vector-conversions
2654 Allow implicit conversions between vectors with differing numbers of
2655 elements and/or incompatible element types. This option should not be
2658 @item -funsigned-char
2659 @opindex funsigned-char
2660 Let the type @code{char} be unsigned, like @code{unsigned char}.
2662 Each kind of machine has a default for what @code{char} should
2663 be. It is either like @code{unsigned char} by default or like
2664 @code{signed char} by default.
2666 Ideally, a portable program should always use @code{signed char} or
2667 @code{unsigned char} when it depends on the signedness of an object.
2668 But many programs have been written to use plain @code{char} and
2669 expect it to be signed, or expect it to be unsigned, depending on the
2670 machines they were written for. This option, and its inverse, let you
2671 make such a program work with the opposite default.
2673 The type @code{char} is always a distinct type from each of
2674 @code{signed char} or @code{unsigned char}, even though its behavior
2675 is always just like one of those two.
2678 @opindex fsigned-char
2679 Let the type @code{char} be signed, like @code{signed char}.
2681 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2682 the negative form of @option{-funsigned-char}. Likewise, the option
2683 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2685 @item -fsigned-bitfields
2686 @itemx -funsigned-bitfields
2687 @itemx -fno-signed-bitfields
2688 @itemx -fno-unsigned-bitfields
2689 @opindex fsigned-bitfields
2690 @opindex funsigned-bitfields
2691 @opindex fno-signed-bitfields
2692 @opindex fno-unsigned-bitfields
2693 These options control whether a bit-field is signed or unsigned, when the
2694 declaration does not use either @code{signed} or @code{unsigned}. By
2695 default, such a bit-field is signed, because this is consistent: the
2696 basic integer types such as @code{int} are signed types.
2698 @item -fsso-struct=@var{endianness}
2699 @opindex fsso-struct
2700 Set the default scalar storage order of structures and unions to the
2701 specified endianness. The accepted values are @samp{big-endian},
2702 @samp{little-endian} and @samp{native} for the native endianness of
2703 the target (the default). This option is not supported for C++.
2705 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2706 code that is not binary compatible with code generated without it if the
2707 specified endianness is not the native endianness of the target.
2710 @node C++ Dialect Options
2711 @section Options Controlling C++ Dialect
2713 @cindex compiler options, C++
2714 @cindex C++ options, command-line
2715 @cindex options, C++
2716 This section describes the command-line options that are only meaningful
2717 for C++ programs. You can also use most of the GNU compiler options
2718 regardless of what language your program is in. For example, you
2719 might compile a file @file{firstClass.C} like this:
2722 g++ -g -fstrict-enums -O -c firstClass.C
2726 In this example, only @option{-fstrict-enums} is an option meant
2727 only for C++ programs; you can use the other options with any
2728 language supported by GCC@.
2730 Some options for compiling C programs, such as @option{-std}, are also
2731 relevant for C++ programs.
2732 @xref{C Dialect Options,,Options Controlling C Dialect}.
2734 Here is a list of options that are @emph{only} for compiling C++ programs:
2738 @item -fabi-version=@var{n}
2739 @opindex fabi-version
2740 Use version @var{n} of the C++ ABI@. The default is version 0.
2742 Version 0 refers to the version conforming most closely to
2743 the C++ ABI specification. Therefore, the ABI obtained using version 0
2744 will change in different versions of G++ as ABI bugs are fixed.
2746 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2748 Version 2 is the version of the C++ ABI that first appeared in G++
2749 3.4, and was the default through G++ 4.9.
2751 Version 3 corrects an error in mangling a constant address as a
2754 Version 4, which first appeared in G++ 4.5, implements a standard
2755 mangling for vector types.
2757 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2758 attribute const/volatile on function pointer types, decltype of a
2759 plain decl, and use of a function parameter in the declaration of
2762 Version 6, which first appeared in G++ 4.7, corrects the promotion
2763 behavior of C++11 scoped enums and the mangling of template argument
2764 packs, const/static_cast, prefix ++ and --, and a class scope function
2765 used as a template argument.
2767 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2768 builtin type and corrects the mangling of lambdas in default argument
2771 Version 8, which first appeared in G++ 4.9, corrects the substitution
2772 behavior of function types with function-cv-qualifiers.
2774 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2777 Version 10, which first appeared in G++ 6.1, adds mangling of
2778 attributes that affect type identity, such as ia32 calling convention
2779 attributes (e.g.@: @samp{stdcall}).
2781 Version 11, which first appeared in G++ 7, corrects the mangling of
2782 sizeof... expressions and operator names. For multiple entities with
2783 the same name within a function, that are declared in different scopes,
2784 the mangling now changes starting with the twelfth occurrence. It also
2785 implies @option{-fnew-inheriting-ctors}.
2787 Version 12, which first appeared in G++ 8, corrects the calling
2788 conventions for empty classes on the x86_64 target and for classes
2789 with only deleted copy/move constructors. It accidentally changes the
2790 calling convention for classes with a deleted copy constructor and a
2791 trivial move constructor.
2793 Version 13, which first appeared in G++ 8.2, fixes the accidental
2794 change in version 12.
2796 Version 14, which first appeared in G++ 10, corrects the mangling of
2797 the nullptr expression.
2799 See also @option{-Wabi}.
2801 @item -fabi-compat-version=@var{n}
2802 @opindex fabi-compat-version
2803 On targets that support strong aliases, G++
2804 works around mangling changes by creating an alias with the correct
2805 mangled name when defining a symbol with an incorrect mangled name.
2806 This switch specifies which ABI version to use for the alias.
2808 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2809 compatibility). If another ABI version is explicitly selected, this
2810 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2811 use @option{-fabi-compat-version=2}.
2813 If this option is not provided but @option{-Wabi=@var{n}} is, that
2814 version is used for compatibility aliases. If this option is provided
2815 along with @option{-Wabi} (without the version), the version from this
2816 option is used for the warning.
2818 @item -fno-access-control
2819 @opindex fno-access-control
2820 @opindex faccess-control
2821 Turn off all access checking. This switch is mainly useful for working
2822 around bugs in the access control code.
2825 @opindex faligned-new
2826 Enable support for C++17 @code{new} of types that require more
2827 alignment than @code{void* ::operator new(std::size_t)} provides. A
2828 numeric argument such as @code{-faligned-new=32} can be used to
2829 specify how much alignment (in bytes) is provided by that function,
2830 but few users will need to override the default of
2831 @code{alignof(std::max_align_t)}.
2833 This flag is enabled by default for @option{-std=c++17}.
2838 @opindex fno-char8_t
2839 Enable support for @code{char8_t} as adopted for C++20. This includes
2840 the addition of a new @code{char8_t} fundamental type, changes to the
2841 types of UTF-8 string and character literals, new signatures for
2842 user-defined literals, associated standard library updates, and new
2843 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2845 This option enables functions to be overloaded for ordinary and UTF-8
2849 int f(const char *); // #1
2850 int f(const char8_t *); // #2
2851 int v1 = f("text"); // Calls #1
2852 int v2 = f(u8"text"); // Calls #2
2856 and introduces new signatures for user-defined literals:
2859 int operator""_udl1(char8_t);
2860 int v3 = u8'x'_udl1;
2861 int operator""_udl2(const char8_t*, std::size_t);
2862 int v4 = u8"text"_udl2;
2863 template<typename T, T...> int operator""_udl3();
2864 int v5 = u8"text"_udl3;
2868 The change to the types of UTF-8 string and character literals introduces
2869 incompatibilities with ISO C++11 and later standards. For example, the
2870 following code is well-formed under ISO C++11, but is ill-formed when
2871 @option{-fchar8_t} is specified.
2874 char ca[] = u8"xx"; // error: char-array initialized from wide
2876 const char *cp = u8"xx";// error: invalid conversion from
2877 // `const char8_t*' to `const char*'
2879 auto v = f(u8"xx"); // error: invalid conversion from
2880 // `const char8_t*' to `const char*'
2881 std::string s@{u8"xx"@}; // error: no matching function for call to
2882 // `std::basic_string<char>::basic_string()'
2883 using namespace std::literals;
2884 s = u8"xx"s; // error: conversion from
2885 // `basic_string<char8_t>' to non-scalar
2886 // type `basic_string<char>' requested
2891 Check that the pointer returned by @code{operator new} is non-null
2892 before attempting to modify the storage allocated. This check is
2893 normally unnecessary because the C++ standard specifies that
2894 @code{operator new} only returns @code{0} if it is declared
2895 @code{throw()}, in which case the compiler always checks the
2896 return value even without this option. In all other cases, when
2897 @code{operator new} has a non-empty exception specification, memory
2898 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2899 @samp{new (nothrow)}.
2902 @itemx -fconcepts-ts
2904 @opindex fconcepts-ts
2905 Below @option{-std=c++20}, @option{-fconcepts} enables support for the
2906 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2908 With @option{-std=c++20} and above, Concepts are part of the language
2909 standard, so @option{-fconcepts} defaults to on. But the standard
2910 specification of Concepts differs significantly from the TS, so some
2911 constructs that were allowed in the TS but didn't make it into the
2912 standard can still be enabled by @option{-fconcepts-ts}.
2914 @item -fconstexpr-depth=@var{n}
2915 @opindex fconstexpr-depth
2916 Set the maximum nested evaluation depth for C++11 constexpr functions
2917 to @var{n}. A limit is needed to detect endless recursion during
2918 constant expression evaluation. The minimum specified by the standard
2921 @item -fconstexpr-cache-depth=@var{n}
2922 @opindex fconstexpr-cache-depth
2923 Set the maximum level of nested evaluation depth for C++11 constexpr
2924 functions that will be cached to @var{n}. This is a heuristic that
2925 trades off compilation speed (when the cache avoids repeated
2926 calculations) against memory consumption (when the cache grows very
2927 large from highly recursive evaluations). The default is 8. Very few
2928 users are likely to want to adjust it, but if your code does heavy
2929 constexpr calculations you might want to experiment to find which
2930 value works best for you.
2932 @item -fconstexpr-loop-limit=@var{n}
2933 @opindex fconstexpr-loop-limit
2934 Set the maximum number of iterations for a loop in C++14 constexpr functions
2935 to @var{n}. A limit is needed to detect infinite loops during
2936 constant expression evaluation. The default is 262144 (1<<18).
2938 @item -fconstexpr-ops-limit=@var{n}
2939 @opindex fconstexpr-ops-limit
2940 Set the maximum number of operations during a single constexpr evaluation.
2941 Even when number of iterations of a single loop is limited with the above limit,
2942 if there are several nested loops and each of them has many iterations but still
2943 smaller than the above limit, or if in a body of some loop or even outside
2944 of a loop too many expressions need to be evaluated, the resulting constexpr
2945 evaluation might take too long.
2946 The default is 33554432 (1<<25).
2949 @opindex fcoroutines
2950 Enable support for the C++ coroutines extension (experimental).
2952 @item -fno-elide-constructors
2953 @opindex fno-elide-constructors
2954 @opindex felide-constructors
2955 The C++ standard allows an implementation to omit creating a temporary
2956 that is only used to initialize another object of the same type.
2957 Specifying this option disables that optimization, and forces G++ to
2958 call the copy constructor in all cases. This option also causes G++
2959 to call trivial member functions which otherwise would be expanded inline.
2961 In C++17, the compiler is required to omit these temporaries, but this
2962 option still affects trivial member functions.
2964 @item -fno-enforce-eh-specs
2965 @opindex fno-enforce-eh-specs
2966 @opindex fenforce-eh-specs
2967 Don't generate code to check for violation of exception specifications
2968 at run time. This option violates the C++ standard, but may be useful
2969 for reducing code size in production builds, much like defining
2970 @code{NDEBUG}. This does not give user code permission to throw
2971 exceptions in violation of the exception specifications; the compiler
2972 still optimizes based on the specifications, so throwing an
2973 unexpected exception results in undefined behavior at run time.
2975 @item -fextern-tls-init
2976 @itemx -fno-extern-tls-init
2977 @opindex fextern-tls-init
2978 @opindex fno-extern-tls-init
2979 The C++11 and OpenMP standards allow @code{thread_local} and
2980 @code{threadprivate} variables to have dynamic (runtime)
2981 initialization. To support this, any use of such a variable goes
2982 through a wrapper function that performs any necessary initialization.
2983 When the use and definition of the variable are in the same
2984 translation unit, this overhead can be optimized away, but when the
2985 use is in a different translation unit there is significant overhead
2986 even if the variable doesn't actually need dynamic initialization. If
2987 the programmer can be sure that no use of the variable in a
2988 non-defining TU needs to trigger dynamic initialization (either
2989 because the variable is statically initialized, or a use of the
2990 variable in the defining TU will be executed before any uses in
2991 another TU), they can avoid this overhead with the
2992 @option{-fno-extern-tls-init} option.
2994 On targets that support symbol aliases, the default is
2995 @option{-fextern-tls-init}. On targets that do not support symbol
2996 aliases, the default is @option{-fno-extern-tls-init}.
2998 @item -fno-gnu-keywords
2999 @opindex fno-gnu-keywords
3000 @opindex fgnu-keywords
3001 Do not recognize @code{typeof} as a keyword, so that code can use this
3002 word as an identifier. You can use the keyword @code{__typeof__} instead.
3003 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3004 @option{-std=c++98}, @option{-std=c++11}, etc.
3006 @item -fno-implicit-templates
3007 @opindex fno-implicit-templates
3008 @opindex fimplicit-templates
3009 Never emit code for non-inline templates that are instantiated
3010 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3011 If you use this option, you must take care to structure your code to
3012 include all the necessary explicit instantiations to avoid getting
3013 undefined symbols at link time.
3014 @xref{Template Instantiation}, for more information.
3016 @item -fno-implicit-inline-templates
3017 @opindex fno-implicit-inline-templates
3018 @opindex fimplicit-inline-templates
3019 Don't emit code for implicit instantiations of inline templates, either.
3020 The default is to handle inlines differently so that compiles with and
3021 without optimization need the same set of explicit instantiations.
3023 @item -fno-implement-inlines
3024 @opindex fno-implement-inlines
3025 @opindex fimplement-inlines
3026 To save space, do not emit out-of-line copies of inline functions
3027 controlled by @code{#pragma implementation}. This causes linker
3028 errors if these functions are not inlined everywhere they are called.
3030 @item -fms-extensions
3031 @opindex fms-extensions
3032 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3033 int and getting a pointer to member function via non-standard syntax.
3035 @item -fnew-inheriting-ctors
3036 @opindex fnew-inheriting-ctors
3037 Enable the P0136 adjustment to the semantics of C++11 constructor
3038 inheritance. This is part of C++17 but also considered to be a Defect
3039 Report against C++11 and C++14. This flag is enabled by default
3040 unless @option{-fabi-version=10} or lower is specified.
3042 @item -fnew-ttp-matching
3043 @opindex fnew-ttp-matching
3044 Enable the P0522 resolution to Core issue 150, template template
3045 parameters and default arguments: this allows a template with default
3046 template arguments as an argument for a template template parameter
3047 with fewer template parameters. This flag is enabled by default for
3048 @option{-std=c++17}.
3050 @item -fno-nonansi-builtins
3051 @opindex fno-nonansi-builtins
3052 @opindex fnonansi-builtins
3053 Disable built-in declarations of functions that are not mandated by
3054 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3055 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3058 @opindex fnothrow-opt
3059 Treat a @code{throw()} exception specification as if it were a
3060 @code{noexcept} specification to reduce or eliminate the text size
3061 overhead relative to a function with no exception specification. If
3062 the function has local variables of types with non-trivial
3063 destructors, the exception specification actually makes the
3064 function smaller because the EH cleanups for those variables can be
3065 optimized away. The semantic effect is that an exception thrown out of
3066 a function with such an exception specification results in a call
3067 to @code{terminate} rather than @code{unexpected}.
3069 @item -fno-operator-names
3070 @opindex fno-operator-names
3071 @opindex foperator-names
3072 Do not treat the operator name keywords @code{and}, @code{bitand},
3073 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3074 synonyms as keywords.
3076 @item -fno-optional-diags
3077 @opindex fno-optional-diags
3078 @opindex foptional-diags
3079 Disable diagnostics that the standard says a compiler does not need to
3080 issue. Currently, the only such diagnostic issued by G++ is the one for
3081 a name having multiple meanings within a class.
3084 @opindex fpermissive
3085 Downgrade some diagnostics about nonconformant code from errors to
3086 warnings. Thus, using @option{-fpermissive} allows some
3087 nonconforming code to compile.
3089 @item -fno-pretty-templates
3090 @opindex fno-pretty-templates
3091 @opindex fpretty-templates
3092 When an error message refers to a specialization of a function
3093 template, the compiler normally prints the signature of the
3094 template followed by the template arguments and any typedefs or
3095 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3096 rather than @code{void f(int)}) so that it's clear which template is
3097 involved. When an error message refers to a specialization of a class
3098 template, the compiler omits any template arguments that match
3099 the default template arguments for that template. If either of these
3100 behaviors make it harder to understand the error message rather than
3101 easier, you can use @option{-fno-pretty-templates} to disable them.
3106 Disable generation of information about every class with virtual
3107 functions for use by the C++ run-time type identification features
3108 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3109 of the language, you can save some space by using this flag. Note that
3110 exception handling uses the same information, but G++ generates it as
3111 needed. The @code{dynamic_cast} operator can still be used for casts that
3112 do not require run-time type information, i.e.@: casts to @code{void *} or to
3113 unambiguous base classes.
3115 Mixing code compiled with @option{-frtti} with that compiled with
3116 @option{-fno-rtti} may not work. For example, programs may
3117 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3118 for a class compiled with @option{-frtti}.
3120 @item -fsized-deallocation
3121 @opindex fsized-deallocation
3122 Enable the built-in global declarations
3124 void operator delete (void *, std::size_t) noexcept;
3125 void operator delete[] (void *, std::size_t) noexcept;
3127 as introduced in C++14. This is useful for user-defined replacement
3128 deallocation functions that, for example, use the size of the object
3129 to make deallocation faster. Enabled by default under
3130 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3131 warns about places that might want to add a definition.
3133 @item -fstrict-enums
3134 @opindex fstrict-enums
3135 Allow the compiler to optimize using the assumption that a value of
3136 enumerated type can only be one of the values of the enumeration (as
3137 defined in the C++ standard; basically, a value that can be
3138 represented in the minimum number of bits needed to represent all the
3139 enumerators). This assumption may not be valid if the program uses a
3140 cast to convert an arbitrary integer value to the enumerated type.
3142 @item -fstrong-eval-order
3143 @opindex fstrong-eval-order
3144 Evaluate member access, array subscripting, and shift expressions in
3145 left-to-right order, and evaluate assignment in right-to-left order,
3146 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3147 @option{-fstrong-eval-order=some} enables just the ordering of member
3148 access and shift expressions, and is the default without
3149 @option{-std=c++17}.
3151 @item -ftemplate-backtrace-limit=@var{n}
3152 @opindex ftemplate-backtrace-limit
3153 Set the maximum number of template instantiation notes for a single
3154 warning or error to @var{n}. The default value is 10.
3156 @item -ftemplate-depth=@var{n}
3157 @opindex ftemplate-depth
3158 Set the maximum instantiation depth for template classes to @var{n}.
3159 A limit on the template instantiation depth is needed to detect
3160 endless recursions during template class instantiation. ANSI/ISO C++
3161 conforming programs must not rely on a maximum depth greater than 17
3162 (changed to 1024 in C++11). The default value is 900, as the compiler
3163 can run out of stack space before hitting 1024 in some situations.
3165 @item -fno-threadsafe-statics
3166 @opindex fno-threadsafe-statics
3167 @opindex fthreadsafe-statics
3168 Do not emit the extra code to use the routines specified in the C++
3169 ABI for thread-safe initialization of local statics. You can use this
3170 option to reduce code size slightly in code that doesn't need to be
3173 @item -fuse-cxa-atexit
3174 @opindex fuse-cxa-atexit
3175 Register destructors for objects with static storage duration with the
3176 @code{__cxa_atexit} function rather than the @code{atexit} function.
3177 This option is required for fully standards-compliant handling of static
3178 destructors, but only works if your C library supports
3179 @code{__cxa_atexit}.
3181 @item -fno-use-cxa-get-exception-ptr
3182 @opindex fno-use-cxa-get-exception-ptr
3183 @opindex fuse-cxa-get-exception-ptr
3184 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3185 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3186 if the runtime routine is not available.
3188 @item -fvisibility-inlines-hidden
3189 @opindex fvisibility-inlines-hidden
3190 This switch declares that the user does not attempt to compare
3191 pointers to inline functions or methods where the addresses of the two functions
3192 are taken in different shared objects.
3194 The effect of this is that GCC may, effectively, mark inline methods with
3195 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3196 appear in the export table of a DSO and do not require a PLT indirection
3197 when used within the DSO@. Enabling this option can have a dramatic effect
3198 on load and link times of a DSO as it massively reduces the size of the
3199 dynamic export table when the library makes heavy use of templates.
3201 The behavior of this switch is not quite the same as marking the
3202 methods as hidden directly, because it does not affect static variables
3203 local to the function or cause the compiler to deduce that
3204 the function is defined in only one shared object.
3206 You may mark a method as having a visibility explicitly to negate the
3207 effect of the switch for that method. For example, if you do want to
3208 compare pointers to a particular inline method, you might mark it as
3209 having default visibility. Marking the enclosing class with explicit
3210 visibility has no effect.
3212 Explicitly instantiated inline methods are unaffected by this option
3213 as their linkage might otherwise cross a shared library boundary.
3214 @xref{Template Instantiation}.
3216 @item -fvisibility-ms-compat
3217 @opindex fvisibility-ms-compat
3218 This flag attempts to use visibility settings to make GCC's C++
3219 linkage model compatible with that of Microsoft Visual Studio.
3221 The flag makes these changes to GCC's linkage model:
3225 It sets the default visibility to @code{hidden}, like
3226 @option{-fvisibility=hidden}.
3229 Types, but not their members, are not hidden by default.
3232 The One Definition Rule is relaxed for types without explicit
3233 visibility specifications that are defined in more than one
3234 shared object: those declarations are permitted if they are
3235 permitted when this option is not used.
3238 In new code it is better to use @option{-fvisibility=hidden} and
3239 export those classes that are intended to be externally visible.
3240 Unfortunately it is possible for code to rely, perhaps accidentally,
3241 on the Visual Studio behavior.
3243 Among the consequences of these changes are that static data members
3244 of the same type with the same name but defined in different shared
3245 objects are different, so changing one does not change the other;
3246 and that pointers to function members defined in different shared
3247 objects may not compare equal. When this flag is given, it is a
3248 violation of the ODR to define types with the same name differently.
3253 Do not use weak symbol support, even if it is provided by the linker.
3254 By default, G++ uses weak symbols if they are available. This
3255 option exists only for testing, and should not be used by end-users;
3256 it results in inferior code and has no benefits. This option may
3257 be removed in a future release of G++.
3259 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3260 @opindex fext-numeric-literals
3261 @opindex fno-ext-numeric-literals
3262 Accept imaginary, fixed-point, or machine-defined
3263 literal number suffixes as GNU extensions.
3264 When this option is turned off these suffixes are treated
3265 as C++11 user-defined literal numeric suffixes.
3266 This is on by default for all pre-C++11 dialects and all GNU dialects:
3267 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3268 @option{-std=gnu++14}.
3269 This option is off by default
3270 for ISO C++11 onwards (@option{-std=c++11}, ...).
3274 Do not search for header files in the standard directories specific to
3275 C++, but do still search the other standard directories. (This option
3276 is used when building the C++ library.)
3279 In addition, these warning options have meanings only for C++ programs:
3282 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3284 Warn when a type with an ABI tag is used in a context that does not
3285 have that ABI tag. See @ref{C++ Attributes} for more information
3288 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3289 @opindex Wcomma-subscript
3290 @opindex Wno-comma-subscript
3291 Warn about uses of a comma expression within a subscripting expression.
3292 This usage was deprecated in C++20. However, a comma expression wrapped
3293 in @code{( )} is not deprecated. Example:
3297 void f(int *a, int b, int c) @{
3298 a[b,c]; // deprecated
3304 Enabled by default with @option{-std=c++20}.
3306 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3307 @opindex Wctor-dtor-privacy
3308 @opindex Wno-ctor-dtor-privacy
3309 Warn when a class seems unusable because all the constructors or
3310 destructors in that class are private, and it has neither friends nor
3311 public static member functions. Also warn if there are no non-private
3312 methods, and there's at least one private member function that isn't
3313 a constructor or destructor.
3315 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3316 @opindex Wdelete-non-virtual-dtor
3317 @opindex Wno-delete-non-virtual-dtor
3318 Warn when @code{delete} is used to destroy an instance of a class that
3319 has virtual functions and non-virtual destructor. It is unsafe to delete
3320 an instance of a derived class through a pointer to a base class if the
3321 base class does not have a virtual destructor. This warning is enabled
3324 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3325 @opindex Wdeprecated-copy
3326 @opindex Wno-deprecated-copy
3327 Warn that the implicit declaration of a copy constructor or copy
3328 assignment operator is deprecated if the class has a user-provided
3329 copy constructor or copy assignment operator, in C++11 and up. This
3330 warning is enabled by @option{-Wextra}. With
3331 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3332 user-provided destructor.
3334 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3335 @opindex Winit-list-lifetime
3336 @opindex Wno-init-list-lifetime
3337 Do not warn about uses of @code{std::initializer_list} that are likely
3338 to result in dangling pointers. Since the underlying array for an
3339 @code{initializer_list} is handled like a normal C++ temporary object,
3340 it is easy to inadvertently keep a pointer to the array past the end
3341 of the array's lifetime. For example:
3345 If a function returns a temporary @code{initializer_list}, or a local
3346 @code{initializer_list} variable, the array's lifetime ends at the end
3347 of the return statement, so the value returned has a dangling pointer.
3350 If a new-expression creates an @code{initializer_list}, the array only
3351 lives until the end of the enclosing full-expression, so the
3352 @code{initializer_list} in the heap has a dangling pointer.
3355 When an @code{initializer_list} variable is assigned from a
3356 brace-enclosed initializer list, the temporary array created for the
3357 right side of the assignment only lives until the end of the
3358 full-expression, so at the next statement the @code{initializer_list}
3359 variable has a dangling pointer.
3362 // li's initial underlying array lives as long as li
3363 std::initializer_list<int> li = @{ 1,2,3 @};
3364 // assignment changes li to point to a temporary array
3366 // now the temporary is gone and li has a dangling pointer
3367 int i = li.begin()[0] // undefined behavior
3371 When a list constructor stores the @code{begin} pointer from the
3372 @code{initializer_list} argument, this doesn't extend the lifetime of
3373 the array, so if a class variable is constructed from a temporary
3374 @code{initializer_list}, the pointer is left dangling by the end of
3375 the variable declaration statement.
3379 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3380 @opindex Wliteral-suffix
3381 @opindex Wno-literal-suffix
3382 Do not warn when a string or character literal is followed by a
3383 ud-suffix which does not begin with an underscore. As a conforming
3384 extension, GCC treats such suffixes as separate preprocessing tokens
3385 in order to maintain backwards compatibility with code that uses
3386 formatting macros from @code{<inttypes.h>}. For example:
3389 #define __STDC_FORMAT_MACROS
3390 #include <inttypes.h>
3395 printf("My int64: %" PRId64"\n", i64);
3399 In this case, @code{PRId64} is treated as a separate preprocessing token.
3401 This option also controls warnings when a user-defined literal
3402 operator is declared with a literal suffix identifier that doesn't
3403 begin with an underscore. Literal suffix identifiers that don't begin
3404 with an underscore are reserved for future standardization.
3406 These warnings are enabled by default.
3408 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3410 @opindex Wno-narrowing
3411 For C++11 and later standards, narrowing conversions are diagnosed by default,
3412 as required by the standard. A narrowing conversion from a constant produces
3413 an error, and a narrowing conversion from a non-constant produces a warning,
3414 but @option{-Wno-narrowing} suppresses the diagnostic.
3415 Note that this does not affect the meaning of well-formed code;
3416 narrowing conversions are still considered ill-formed in SFINAE contexts.
3418 With @option{-Wnarrowing} in C++98, warn when a narrowing
3419 conversion prohibited by C++11 occurs within
3423 int i = @{ 2.2 @}; // error: narrowing from double to int
3426 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3428 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3430 @opindex Wno-noexcept
3431 Warn when a noexcept-expression evaluates to false because of a call
3432 to a function that does not have a non-throwing exception
3433 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3434 the compiler to never throw an exception.
3436 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3437 @opindex Wnoexcept-type
3438 @opindex Wno-noexcept-type
3439 Warn if the C++17 feature making @code{noexcept} part of a function
3440 type changes the mangled name of a symbol relative to C++14. Enabled
3441 by @option{-Wabi} and @option{-Wc++17-compat}.
3446 template <class T> void f(T t) @{ t(); @};
3448 void h() @{ f(g); @}
3452 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3453 C++17 it calls @code{f<void(*)()noexcept>}.
3455 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3456 @opindex Wclass-memaccess
3457 @opindex Wno-class-memaccess
3458 Warn when the destination of a call to a raw memory function such as
3459 @code{memset} or @code{memcpy} is an object of class type, and when writing
3460 into such an object might bypass the class non-trivial or deleted constructor
3461 or copy assignment, violate const-correctness or encapsulation, or corrupt
3462 virtual table pointers. Modifying the representation of such objects may
3463 violate invariants maintained by member functions of the class. For example,
3464 the call to @code{memset} below is undefined because it modifies a non-trivial
3465 class object and is, therefore, diagnosed. The safe way to either initialize
3466 or clear the storage of objects of such types is by using the appropriate
3467 constructor or assignment operator, if one is available.
3469 std::string str = "abc";
3470 memset (&str, 0, sizeof str);
3472 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3473 Explicitly casting the pointer to the class object to @code{void *} or
3474 to a type that can be safely accessed by the raw memory function suppresses
3477 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3478 @opindex Wnon-virtual-dtor
3479 @opindex Wno-non-virtual-dtor
3480 Warn when a class has virtual functions and an accessible non-virtual
3481 destructor itself or in an accessible polymorphic base class, in which
3482 case it is possible but unsafe to delete an instance of a derived
3483 class through a pointer to the class itself or base class. This
3484 warning is automatically enabled if @option{-Weffc++} is specified.
3486 @item -Wregister @r{(C++ and Objective-C++ only)}
3488 @opindex Wno-register
3489 Warn on uses of the @code{register} storage class specifier, except
3490 when it is part of the GNU @ref{Explicit Register Variables} extension.
3491 The use of the @code{register} keyword as storage class specifier has
3492 been deprecated in C++11 and removed in C++17.
3493 Enabled by default with @option{-std=c++17}.
3495 @item -Wreorder @r{(C++ and Objective-C++ only)}
3497 @opindex Wno-reorder
3498 @cindex reordering, warning
3499 @cindex warning for reordering of member initializers
3500 Warn when the order of member initializers given in the code does not
3501 match the order in which they must be executed. For instance:
3507 A(): j (0), i (1) @{ @}
3512 The compiler rearranges the member initializers for @code{i}
3513 and @code{j} to match the declaration order of the members, emitting
3514 a warning to that effect. This warning is enabled by @option{-Wall}.
3516 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3517 @opindex Wpessimizing-move
3518 @opindex Wno-pessimizing-move
3519 This warning warns when a call to @code{std::move} prevents copy
3520 elision. A typical scenario when copy elision can occur is when returning in
3521 a function with a class return type, when the expression being returned is the
3522 name of a non-volatile automatic object, and is not a function parameter, and
3523 has the same type as the function return type.
3533 return std::move (t);
3537 But in this example, the @code{std::move} call prevents copy elision.
3539 This warning is enabled by @option{-Wall}.
3541 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3542 @opindex Wredundant-move
3543 @opindex Wno-redundant-move
3544 This warning warns about redundant calls to @code{std::move}; that is, when
3545 a move operation would have been performed even without the @code{std::move}
3546 call. This happens because the compiler is forced to treat the object as if
3547 it were an rvalue in certain situations such as returning a local variable,
3548 where copy elision isn't applicable. Consider:
3557 return std::move (t);
3561 Here, the @code{std::move} call is redundant. Because G++ implements Core
3562 Issue 1579, another example is:
3565 struct T @{ // convertible to U
3575 return std::move (t);
3578 In this example, copy elision isn't applicable because the type of the
3579 expression being returned and the function return type differ, yet G++
3580 treats the return value as if it were designated by an rvalue.
3582 This warning is enabled by @option{-Wextra}.
3584 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3585 @opindex Wredundant-tags
3586 @opindex Wno-redundant-tags
3587 Warn about redundant class-key and enum-key in references to class types
3588 and enumerated types in contexts where the key can be eliminated without
3589 causing an ambiguity. For example:
3593 struct foo *p; // warn that keyword struct can be eliminated
3597 On the other hand, in this example there is no warning:
3601 void foo (); // "hides" struct foo
3602 void bar (struct foo&); // no warning, keyword struct is necessary
3605 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3606 @opindex Wsubobject-linkage
3607 @opindex Wno-subobject-linkage
3609 if a class type has a base or a field whose type uses the anonymous
3610 namespace or depends on a type with no linkage. If a type A depends on
3611 a type B with no or internal linkage, defining it in multiple
3612 translation units would be an ODR violation because the meaning of B
3613 is different in each translation unit. If A only appears in a single
3614 translation unit, the best way to silence the warning is to give it
3615 internal linkage by putting it in an anonymous namespace as well. The
3616 compiler doesn't give this warning for types defined in the main .C
3617 file, as those are unlikely to have multiple definitions.
3618 @option{-Wsubobject-linkage} is enabled by default.
3620 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3623 Warn about violations of the following style guidelines from Scott Meyers'
3624 @cite{Effective C++} series of books:
3628 Define a copy constructor and an assignment operator for classes
3629 with dynamically-allocated memory.
3632 Prefer initialization to assignment in constructors.
3635 Have @code{operator=} return a reference to @code{*this}.
3638 Don't try to return a reference when you must return an object.
3641 Distinguish between prefix and postfix forms of increment and
3642 decrement operators.
3645 Never overload @code{&&}, @code{||}, or @code{,}.
3649 This option also enables @option{-Wnon-virtual-dtor}, which is also
3650 one of the effective C++ recommendations. However, the check is
3651 extended to warn about the lack of virtual destructor in accessible
3652 non-polymorphic bases classes too.
3654 When selecting this option, be aware that the standard library
3655 headers do not obey all of these guidelines; use @samp{grep -v}
3656 to filter out those warnings.
3658 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3659 @opindex Wstrict-null-sentinel
3660 @opindex Wno-strict-null-sentinel
3661 Warn about the use of an uncasted @code{NULL} as sentinel. When
3662 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3663 to @code{__null}. Although it is a null pointer constant rather than a
3664 null pointer, it is guaranteed to be of the same size as a pointer.
3665 But this use is not portable across different compilers.
3667 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3668 @opindex Wno-non-template-friend
3669 @opindex Wnon-template-friend
3670 Disable warnings when non-template friend functions are declared
3671 within a template. In very old versions of GCC that predate implementation
3672 of the ISO standard, declarations such as
3673 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3674 could be interpreted as a particular specialization of a template
3675 function; the warning exists to diagnose compatibility problems,
3676 and is enabled by default.
3678 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3679 @opindex Wold-style-cast
3680 @opindex Wno-old-style-cast
3681 Warn if an old-style (C-style) cast to a non-void type is used within
3682 a C++ program. The new-style casts (@code{dynamic_cast},
3683 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3684 less vulnerable to unintended effects and much easier to search for.
3686 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3687 @opindex Woverloaded-virtual
3688 @opindex Wno-overloaded-virtual
3689 @cindex overloaded virtual function, warning
3690 @cindex warning for overloaded virtual function
3691 Warn when a function declaration hides virtual functions from a
3692 base class. For example, in:
3699 struct B: public A @{
3704 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3715 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3716 @opindex Wno-pmf-conversions
3717 @opindex Wpmf-conversions
3718 Disable the diagnostic for converting a bound pointer to member function
3721 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3722 @opindex Wsign-promo
3723 @opindex Wno-sign-promo
3724 Warn when overload resolution chooses a promotion from unsigned or
3725 enumerated type to a signed type, over a conversion to an unsigned type of
3726 the same size. Previous versions of G++ tried to preserve
3727 unsignedness, but the standard mandates the current behavior.
3729 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3731 @opindex Wno-templates
3732 Warn when a primary template declaration is encountered. Some coding
3733 rules disallow templates, and this may be used to enforce that rule.
3734 The warning is inactive inside a system header file, such as the STL, so
3735 one can still use the STL. One may also instantiate or specialize
3738 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
3739 @opindex Wmismatched-tags
3740 @opindex Wno-mismatched-tags
3741 Warn for declarations of structs, classes, and class templates and their
3742 specializations with a class-key that does not match either the definition
3743 or the first declaration if no definition is provided.
3745 For example, the declaration of @code{struct Object} in the argument list
3746 of @code{draw} triggers the warning. To avoid it, either remove the redundant
3747 class-key @code{struct} or replace it with @code{class} to match its definition.
3751 virtual ~Object () = 0;
3753 void draw (struct Object*);
3756 It is not wrong to declare a class with the class-key @code{struct} as
3757 the example above shows. The @option{-Wmismatched-tags} option is intended
3758 to help achieve a consistent style of class declarations. In code that is
3759 intended to be portable to Windows-based compilers the warning helps prevent
3760 unresolved references due to the difference in the mangling of symbols
3761 declared with different class-keys. The option can be used either on its
3762 own or in conjunction with @option{-Wredundant-tags}.
3764 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3765 @opindex Wmultiple-inheritance
3766 @opindex Wno-multiple-inheritance
3767 Warn when a class is defined with multiple direct base classes. Some
3768 coding rules disallow multiple inheritance, and this may be used to
3769 enforce that rule. The warning is inactive inside a system header file,
3770 such as the STL, so one can still use the STL. One may also define
3771 classes that indirectly use multiple inheritance.
3773 @item -Wvirtual-inheritance
3774 @opindex Wvirtual-inheritance
3775 @opindex Wno-virtual-inheritance
3776 Warn when a class is defined with a virtual direct base class. Some
3777 coding rules disallow multiple inheritance, and this may be used to
3778 enforce that rule. The warning is inactive inside a system header file,
3779 such as the STL, so one can still use the STL. One may also define
3780 classes that indirectly use virtual inheritance.
3782 @item -Wno-virtual-move-assign
3783 @opindex Wvirtual-move-assign
3784 @opindex Wno-virtual-move-assign
3785 Suppress warnings about inheriting from a virtual base with a
3786 non-trivial C++11 move assignment operator. This is dangerous because
3787 if the virtual base is reachable along more than one path, it is
3788 moved multiple times, which can mean both objects end up in the
3789 moved-from state. If the move assignment operator is written to avoid
3790 moving from a moved-from object, this warning can be disabled.
3793 @opindex Wnamespaces
3794 @opindex Wno-namespaces
3795 Warn when a namespace definition is opened. Some coding rules disallow
3796 namespaces, and this may be used to enforce that rule. The warning is
3797 inactive inside a system header file, such as the STL, so one can still
3798 use the STL. One may also use using directives and qualified names.
3800 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3802 @opindex Wno-terminate
3803 Disable the warning about a throw-expression that will immediately
3804 result in a call to @code{terminate}.
3806 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3807 @opindex Wno-class-conversion
3808 @opindex Wclass-conversion
3809 Do not warn when a conversion function converts an
3810 object to the same type, to a base class of that type, or to void; such
3811 a conversion function will never be called.
3813 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3815 @opindex Wno-volatile
3816 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3817 postfix and prefix @code{++} and @code{--} expressions of
3818 @code{volatile}-qualified types, using simple assignments where the left
3819 operand is a @code{volatile}-qualified non-class type for their value,
3820 compound assignments where the left operand is a @code{volatile}-qualified
3821 non-class type, @code{volatile}-qualified function return type,
3822 @code{volatile}-qualified parameter type, and structured bindings of a
3823 @code{volatile}-qualified type. This usage was deprecated in C++20.
3825 Enabled by default with @option{-std=c++20}.
3827 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
3828 @opindex Wzero-as-null-pointer-constant
3829 @opindex Wno-zero-as-null-pointer-constant
3830 Warn when a literal @samp{0} is used as null pointer constant. This can
3831 be useful to facilitate the conversion to @code{nullptr} in C++11.
3834 @opindex Waligned-new
3835 @opindex Wno-aligned-new
3836 Warn about a new-expression of a type that requires greater alignment
3837 than the @code{alignof(std::max_align_t)} but uses an allocation
3838 function without an explicit alignment parameter. This option is
3839 enabled by @option{-Wall}.
3841 Normally this only warns about global allocation functions, but
3842 @option{-Waligned-new=all} also warns about class member allocation
3845 @item -Wno-placement-new
3846 @itemx -Wplacement-new=@var{n}
3847 @opindex Wplacement-new
3848 @opindex Wno-placement-new
3849 Warn about placement new expressions with undefined behavior, such as
3850 constructing an object in a buffer that is smaller than the type of
3851 the object. For example, the placement new expression below is diagnosed
3852 because it attempts to construct an array of 64 integers in a buffer only
3858 This warning is enabled by default.
3861 @item -Wplacement-new=1
3862 This is the default warning level of @option{-Wplacement-new}. At this
3863 level the warning is not issued for some strictly undefined constructs that
3864 GCC allows as extensions for compatibility with legacy code. For example,
3865 the following @code{new} expression is not diagnosed at this level even
3866 though it has undefined behavior according to the C++ standard because
3867 it writes past the end of the one-element array.
3869 struct S @{ int n, a[1]; @};
3870 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3871 new (s->a)int [32]();
3874 @item -Wplacement-new=2
3875 At this level, in addition to diagnosing all the same constructs as at level
3876 1, a diagnostic is also issued for placement new expressions that construct
3877 an object in the last member of structure whose type is an array of a single
3878 element and whose size is less than the size of the object being constructed.
3879 While the previous example would be diagnosed, the following construct makes
3880 use of the flexible member array extension to avoid the warning at level 2.
3882 struct S @{ int n, a[]; @};
3883 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3884 new (s->a)int [32]();
3890 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
3891 @opindex Wcatch-value
3892 @opindex Wno-catch-value
3893 Warn about catch handlers that do not catch via reference.
3894 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
3895 warn about polymorphic class types that are caught by value.
3896 With @option{-Wcatch-value=2} warn about all class types that are caught
3897 by value. With @option{-Wcatch-value=3} warn about all types that are
3898 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
3900 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
3901 @opindex Wconditionally-supported
3902 @opindex Wno-conditionally-supported
3903 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3905 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
3906 @opindex Wdelete-incomplete
3907 @opindex Wno-delete-incomplete
3908 Do not warn when deleting a pointer to incomplete type, which may cause
3909 undefined behavior at runtime. This warning is enabled by default.
3911 @item -Wextra-semi @r{(C++, Objective-C++ only)}
3912 @opindex Wextra-semi
3913 @opindex Wno-extra-semi
3914 Warn about redundant semicolons after in-class function definitions.
3916 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
3917 @opindex Winaccessible-base
3918 @opindex Wno-inaccessible-base
3919 This option controls warnings
3920 when a base class is inaccessible in a class derived from it due to
3921 ambiguity. The warning is enabled by default.
3922 Note that the warning for ambiguous virtual
3923 bases is enabled by the @option{-Wextra} option.
3926 struct A @{ int a; @};
3930 struct C : B, A @{ @};
3934 @item -Wno-inherited-variadic-ctor
3935 @opindex Winherited-variadic-ctor
3936 @opindex Wno-inherited-variadic-ctor
3937 Suppress warnings about use of C++11 inheriting constructors when the
3938 base class inherited from has a C variadic constructor; the warning is
3939 on by default because the ellipsis is not inherited.
3941 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
3942 @opindex Wno-invalid-offsetof
3943 @opindex Winvalid-offsetof
3944 Suppress warnings from applying the @code{offsetof} macro to a non-POD
3945 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
3946 to a non-standard-layout type is undefined. In existing C++ implementations,
3947 however, @code{offsetof} typically gives meaningful results.
3948 This flag is for users who are aware that they are
3949 writing nonportable code and who have deliberately chosen to ignore the
3952 The restrictions on @code{offsetof} may be relaxed in a future version
3953 of the C++ standard.
3955 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
3956 @opindex Wsized-deallocation
3957 @opindex Wno-sized-deallocation
3958 Warn about a definition of an unsized deallocation function
3960 void operator delete (void *) noexcept;
3961 void operator delete[] (void *) noexcept;
3963 without a definition of the corresponding sized deallocation function
3965 void operator delete (void *, std::size_t) noexcept;
3966 void operator delete[] (void *, std::size_t) noexcept;
3968 or vice versa. Enabled by @option{-Wextra} along with
3969 @option{-fsized-deallocation}.
3971 @item -Wsuggest-final-types
3972 @opindex Wno-suggest-final-types
3973 @opindex Wsuggest-final-types
3974 Warn about types with virtual methods where code quality would be improved
3975 if the type were declared with the C++11 @code{final} specifier,
3977 declared in an anonymous namespace. This allows GCC to more aggressively
3978 devirtualize the polymorphic calls. This warning is more effective with
3979 link-time optimization,
3980 where the information about the class hierarchy graph is
3983 @item -Wsuggest-final-methods
3984 @opindex Wno-suggest-final-methods
3985 @opindex Wsuggest-final-methods
3986 Warn about virtual methods where code quality would be improved if the method
3987 were declared with the C++11 @code{final} specifier,
3988 or, if possible, its type were
3989 declared in an anonymous namespace or with the @code{final} specifier.
3991 more effective with link-time optimization, where the information about the
3992 class hierarchy graph is more complete. It is recommended to first consider
3993 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
3996 @item -Wsuggest-override
3997 @opindex Wsuggest-override
3998 @opindex Wno-suggest-override
3999 Warn about overriding virtual functions that are not marked with the
4000 @code{override} keyword.
4002 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4003 @opindex Wuseless-cast
4004 @opindex Wno-useless-cast
4005 Warn when an expression is casted to its own type.
4007 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4008 @opindex Wconversion-null
4009 @opindex Wno-conversion-null
4010 Do not warn for conversions between @code{NULL} and non-pointer
4011 types. @option{-Wconversion-null} is enabled by default.
4015 @node Objective-C and Objective-C++ Dialect Options
4016 @section Options Controlling Objective-C and Objective-C++ Dialects
4018 @cindex compiler options, Objective-C and Objective-C++
4019 @cindex Objective-C and Objective-C++ options, command-line
4020 @cindex options, Objective-C and Objective-C++
4021 (NOTE: This manual does not describe the Objective-C and Objective-C++
4022 languages themselves. @xref{Standards,,Language Standards
4023 Supported by GCC}, for references.)
4025 This section describes the command-line options that are only meaningful
4026 for Objective-C and Objective-C++ programs. You can also use most of
4027 the language-independent GNU compiler options.
4028 For example, you might compile a file @file{some_class.m} like this:
4031 gcc -g -fgnu-runtime -O -c some_class.m
4035 In this example, @option{-fgnu-runtime} is an option meant only for
4036 Objective-C and Objective-C++ programs; you can use the other options with
4037 any language supported by GCC@.
4039 Note that since Objective-C is an extension of the C language, Objective-C
4040 compilations may also use options specific to the C front-end (e.g.,
4041 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4042 C++-specific options (e.g., @option{-Wabi}).
4044 Here is a list of options that are @emph{only} for compiling Objective-C
4045 and Objective-C++ programs:
4048 @item -fconstant-string-class=@var{class-name}
4049 @opindex fconstant-string-class
4050 Use @var{class-name} as the name of the class to instantiate for each
4051 literal string specified with the syntax @code{@@"@dots{}"}. The default
4052 class name is @code{NXConstantString} if the GNU runtime is being used, and
4053 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4054 @option{-fconstant-cfstrings} option, if also present, overrides the
4055 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4056 to be laid out as constant CoreFoundation strings.
4059 @opindex fgnu-runtime
4060 Generate object code compatible with the standard GNU Objective-C
4061 runtime. This is the default for most types of systems.
4063 @item -fnext-runtime
4064 @opindex fnext-runtime
4065 Generate output compatible with the NeXT runtime. This is the default
4066 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4067 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4070 @item -fno-nil-receivers
4071 @opindex fno-nil-receivers
4072 @opindex fnil-receivers
4073 Assume that all Objective-C message dispatches (@code{[receiver
4074 message:arg]}) in this translation unit ensure that the receiver is
4075 not @code{nil}. This allows for more efficient entry points in the
4076 runtime to be used. This option is only available in conjunction with
4077 the NeXT runtime and ABI version 0 or 1.
4079 @item -fobjc-abi-version=@var{n}
4080 @opindex fobjc-abi-version
4081 Use version @var{n} of the Objective-C ABI for the selected runtime.
4082 This option is currently supported only for the NeXT runtime. In that
4083 case, Version 0 is the traditional (32-bit) ABI without support for
4084 properties and other Objective-C 2.0 additions. Version 1 is the
4085 traditional (32-bit) ABI with support for properties and other
4086 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4087 nothing is specified, the default is Version 0 on 32-bit target
4088 machines, and Version 2 on 64-bit target machines.
4090 @item -fobjc-call-cxx-cdtors
4091 @opindex fobjc-call-cxx-cdtors
4092 For each Objective-C class, check if any of its instance variables is a
4093 C++ object with a non-trivial default constructor. If so, synthesize a
4094 special @code{- (id) .cxx_construct} instance method which runs
4095 non-trivial default constructors on any such instance variables, in order,
4096 and then return @code{self}. Similarly, check if any instance variable
4097 is a C++ object with a non-trivial destructor, and if so, synthesize a
4098 special @code{- (void) .cxx_destruct} method which runs
4099 all such default destructors, in reverse order.
4101 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4102 methods thusly generated only operate on instance variables
4103 declared in the current Objective-C class, and not those inherited
4104 from superclasses. It is the responsibility of the Objective-C
4105 runtime to invoke all such methods in an object's inheritance
4106 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4107 by the runtime immediately after a new object instance is allocated;
4108 the @code{- (void) .cxx_destruct} methods are invoked immediately
4109 before the runtime deallocates an object instance.
4111 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4112 support for invoking the @code{- (id) .cxx_construct} and
4113 @code{- (void) .cxx_destruct} methods.
4115 @item -fobjc-direct-dispatch
4116 @opindex fobjc-direct-dispatch
4117 Allow fast jumps to the message dispatcher. On Darwin this is
4118 accomplished via the comm page.
4120 @item -fobjc-exceptions
4121 @opindex fobjc-exceptions
4122 Enable syntactic support for structured exception handling in
4123 Objective-C, similar to what is offered by C++. This option
4124 is required to use the Objective-C keywords @code{@@try},
4125 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4126 @code{@@synchronized}. This option is available with both the GNU
4127 runtime and the NeXT runtime (but not available in conjunction with
4128 the NeXT runtime on Mac OS X 10.2 and earlier).
4132 Enable garbage collection (GC) in Objective-C and Objective-C++
4133 programs. This option is only available with the NeXT runtime; the
4134 GNU runtime has a different garbage collection implementation that
4135 does not require special compiler flags.
4137 @item -fobjc-nilcheck
4138 @opindex fobjc-nilcheck
4139 For the NeXT runtime with version 2 of the ABI, check for a nil
4140 receiver in method invocations before doing the actual method call.
4141 This is the default and can be disabled using
4142 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4143 checked for nil in this way no matter what this flag is set to.
4144 Currently this flag does nothing when the GNU runtime, or an older
4145 version of the NeXT runtime ABI, is used.
4147 @item -fobjc-std=objc1
4149 Conform to the language syntax of Objective-C 1.0, the language
4150 recognized by GCC 4.0. This only affects the Objective-C additions to
4151 the C/C++ language; it does not affect conformance to C/C++ standards,
4152 which is controlled by the separate C/C++ dialect option flags. When
4153 this option is used with the Objective-C or Objective-C++ compiler,
4154 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4155 This is useful if you need to make sure that your Objective-C code can
4156 be compiled with older versions of GCC@.
4158 @item -freplace-objc-classes
4159 @opindex freplace-objc-classes
4160 Emit a special marker instructing @command{ld(1)} not to statically link in
4161 the resulting object file, and allow @command{dyld(1)} to load it in at
4162 run time instead. This is used in conjunction with the Fix-and-Continue
4163 debugging mode, where the object file in question may be recompiled and
4164 dynamically reloaded in the course of program execution, without the need
4165 to restart the program itself. Currently, Fix-and-Continue functionality
4166 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4171 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4172 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4173 compile time) with static class references that get initialized at load time,
4174 which improves run-time performance. Specifying the @option{-fzero-link} flag
4175 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4176 to be retained. This is useful in Zero-Link debugging mode, since it allows
4177 for individual class implementations to be modified during program execution.
4178 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4179 regardless of command-line options.
4181 @item -fno-local-ivars
4182 @opindex fno-local-ivars
4183 @opindex flocal-ivars
4184 By default instance variables in Objective-C can be accessed as if
4185 they were local variables from within the methods of the class they're
4186 declared in. This can lead to shadowing between instance variables
4187 and other variables declared either locally inside a class method or
4188 globally with the same name. Specifying the @option{-fno-local-ivars}
4189 flag disables this behavior thus avoiding variable shadowing issues.
4191 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4192 @opindex fivar-visibility
4193 Set the default instance variable visibility to the specified option
4194 so that instance variables declared outside the scope of any access
4195 modifier directives default to the specified visibility.
4199 Dump interface declarations for all classes seen in the source file to a
4200 file named @file{@var{sourcename}.decl}.
4202 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4203 @opindex Wassign-intercept
4204 @opindex Wno-assign-intercept
4205 Warn whenever an Objective-C assignment is being intercepted by the
4208 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4209 @opindex Wproperty-assign-default
4210 @opindex Wno-property-assign-default
4211 Do not warn if a property for an Objective-C object has no assign
4212 semantics specified.
4214 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4215 @opindex Wno-protocol
4217 If a class is declared to implement a protocol, a warning is issued for
4218 every method in the protocol that is not implemented by the class. The
4219 default behavior is to issue a warning for every method not explicitly
4220 implemented in the class, even if a method implementation is inherited
4221 from the superclass. If you use the @option{-Wno-protocol} option, then
4222 methods inherited from the superclass are considered to be implemented,
4223 and no warning is issued for them.
4225 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4227 @opindex Wno-selector
4228 Warn if multiple methods of different types for the same selector are
4229 found during compilation. The check is performed on the list of methods
4230 in the final stage of compilation. Additionally, a check is performed
4231 for each selector appearing in a @code{@@selector(@dots{})}
4232 expression, and a corresponding method for that selector has been found
4233 during compilation. Because these checks scan the method table only at
4234 the end of compilation, these warnings are not produced if the final
4235 stage of compilation is not reached, for example because an error is
4236 found during compilation, or because the @option{-fsyntax-only} option is
4239 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4240 @opindex Wstrict-selector-match
4241 @opindex Wno-strict-selector-match
4242 Warn if multiple methods with differing argument and/or return types are
4243 found for a given selector when attempting to send a message using this
4244 selector to a receiver of type @code{id} or @code{Class}. When this flag
4245 is off (which is the default behavior), the compiler omits such warnings
4246 if any differences found are confined to types that share the same size
4249 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4250 @opindex Wundeclared-selector
4251 @opindex Wno-undeclared-selector
4252 Warn if a @code{@@selector(@dots{})} expression referring to an
4253 undeclared selector is found. A selector is considered undeclared if no
4254 method with that name has been declared before the
4255 @code{@@selector(@dots{})} expression, either explicitly in an
4256 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4257 an @code{@@implementation} section. This option always performs its
4258 checks as soon as a @code{@@selector(@dots{})} expression is found,
4259 while @option{-Wselector} only performs its checks in the final stage of
4260 compilation. This also enforces the coding style convention
4261 that methods and selectors must be declared before being used.
4263 @item -print-objc-runtime-info
4264 @opindex print-objc-runtime-info
4265 Generate C header describing the largest structure that is passed by
4270 @node Diagnostic Message Formatting Options
4271 @section Options to Control Diagnostic Messages Formatting
4272 @cindex options to control diagnostics formatting
4273 @cindex diagnostic messages
4274 @cindex message formatting
4276 Traditionally, diagnostic messages have been formatted irrespective of
4277 the output device's aspect (e.g.@: its width, @dots{}). You can use the
4278 options described below
4279 to control the formatting algorithm for diagnostic messages,
4280 e.g.@: how many characters per line, how often source location
4281 information should be reported. Note that some language front ends may not
4282 honor these options.
4285 @item -fmessage-length=@var{n}
4286 @opindex fmessage-length
4287 Try to format error messages so that they fit on lines of about
4288 @var{n} characters. If @var{n} is zero, then no line-wrapping is
4289 done; each error message appears on a single line. This is the
4290 default for all front ends.
4292 Note - this option also affects the display of the @samp{#error} and
4293 @samp{#warning} pre-processor directives, and the @samp{deprecated}
4294 function/type/variable attribute. It does not however affect the
4295 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4297 @item -fdiagnostics-plain-output
4298 This option requests that diagnostic output look as plain as possible, which
4299 may be useful when running @command{dejagnu} or other utilities that need to
4300 parse diagnostics output and prefer that it remain more stable over time.
4301 @option{-fdiagnostics-plain-output} is currently equivalent to the following
4303 @gccoptlist{-fno-diagnostics-show-caret @gol
4304 -fno-diagnostics-show-line-numbers @gol
4305 -fdiagnostics-color=never @gol
4306 -fdiagnostics-urls=never}
4307 In the future, if GCC changes the default appearance of its diagnostics, the
4308 corresponding option to disable the new behavior will be added to this list.
4310 @item -fdiagnostics-show-location=once
4311 @opindex fdiagnostics-show-location
4312 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
4313 reporter to emit source location information @emph{once}; that is, in
4314 case the message is too long to fit on a single physical line and has to
4315 be wrapped, the source location won't be emitted (as prefix) again,
4316 over and over, in subsequent continuation lines. This is the default
4319 @item -fdiagnostics-show-location=every-line
4320 Only meaningful in line-wrapping mode. Instructs the diagnostic
4321 messages reporter to emit the same source location information (as
4322 prefix) for physical lines that result from the process of breaking
4323 a message which is too long to fit on a single line.
4325 @item -fdiagnostics-color[=@var{WHEN}]
4326 @itemx -fno-diagnostics-color
4327 @opindex fdiagnostics-color
4328 @cindex highlight, color
4329 @vindex GCC_COLORS @r{environment variable}
4330 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
4331 or @samp{auto}. The default depends on how the compiler has been configured,
4332 it can be any of the above @var{WHEN} options or also @samp{never}
4333 if @env{GCC_COLORS} environment variable isn't present in the environment,
4334 and @samp{auto} otherwise.
4335 @samp{auto} makes GCC use color only when the standard error is a terminal,
4336 and when not executing in an emacs shell.
4337 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4338 aliases for @option{-fdiagnostics-color=always} and
4339 @option{-fdiagnostics-color=never}, respectively.
4341 The colors are defined by the environment variable @env{GCC_COLORS}.
4342 Its value is a colon-separated list of capabilities and Select Graphic
4343 Rendition (SGR) substrings. SGR commands are interpreted by the
4344 terminal or terminal emulator. (See the section in the documentation
4345 of your text terminal for permitted values and their meanings as
4346 character attributes.) These substring values are integers in decimal
4347 representation and can be concatenated with semicolons.
4348 Common values to concatenate include
4350 @samp{4} for underline,
4352 @samp{7} for inverse,
4353 @samp{39} for default foreground color,
4354 @samp{30} to @samp{37} for foreground colors,
4355 @samp{90} to @samp{97} for 16-color mode foreground colors,
4356 @samp{38;5;0} to @samp{38;5;255}
4357 for 88-color and 256-color modes foreground colors,
4358 @samp{49} for default background color,
4359 @samp{40} to @samp{47} for background colors,
4360 @samp{100} to @samp{107} for 16-color mode background colors,
4361 and @samp{48;5;0} to @samp{48;5;255}
4362 for 88-color and 256-color modes background colors.
4364 The default @env{GCC_COLORS} is
4366 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4367 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4368 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4372 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4373 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4374 @samp{01} is bold, and @samp{31} is red.
4375 Setting @env{GCC_COLORS} to the empty string disables colors.
4376 Supported capabilities are as follows.
4380 @vindex error GCC_COLORS @r{capability}
4381 SGR substring for error: markers.
4384 @vindex warning GCC_COLORS @r{capability}
4385 SGR substring for warning: markers.
4388 @vindex note GCC_COLORS @r{capability}
4389 SGR substring for note: markers.
4392 @vindex path GCC_COLORS @r{capability}
4393 SGR substring for colorizing paths of control-flow events as printed
4394 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4395 individual events and lines indicating interprocedural calls and returns.
4398 @vindex range1 GCC_COLORS @r{capability}
4399 SGR substring for first additional range.
4402 @vindex range2 GCC_COLORS @r{capability}
4403 SGR substring for second additional range.
4406 @vindex locus GCC_COLORS @r{capability}
4407 SGR substring for location information, @samp{file:line} or
4408 @samp{file:line:column} etc.
4411 @vindex quote GCC_COLORS @r{capability}
4412 SGR substring for information printed within quotes.
4415 @vindex fixit-insert GCC_COLORS @r{capability}
4416 SGR substring for fix-it hints suggesting text to
4417 be inserted or replaced.
4420 @vindex fixit-delete GCC_COLORS @r{capability}
4421 SGR substring for fix-it hints suggesting text to
4424 @item diff-filename=
4425 @vindex diff-filename GCC_COLORS @r{capability}
4426 SGR substring for filename headers within generated patches.
4429 @vindex diff-hunk GCC_COLORS @r{capability}
4430 SGR substring for the starts of hunks within generated patches.
4433 @vindex diff-delete GCC_COLORS @r{capability}
4434 SGR substring for deleted lines within generated patches.
4437 @vindex diff-insert GCC_COLORS @r{capability}
4438 SGR substring for inserted lines within generated patches.
4441 @vindex type-diff GCC_COLORS @r{capability}
4442 SGR substring for highlighting mismatching types within template
4443 arguments in the C++ frontend.
4446 @item -fdiagnostics-urls[=@var{WHEN}]
4447 @opindex fdiagnostics-urls
4449 @vindex GCC_URLS @r{environment variable}
4450 @vindex TERM_URLS @r{environment variable}
4451 Use escape sequences to embed URLs in diagnostics. For example, when
4452 @option{-fdiagnostics-show-option} emits text showing the command-line
4453 option controlling a diagnostic, embed a URL for documentation of that
4456 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4457 @samp{auto} makes GCC use URL escape sequences only when the standard error
4458 is a terminal, and when not executing in an emacs shell or any graphical
4459 terminal which is known to be incompatible with this feature, see below.
4461 The default depends on how the compiler has been configured.
4462 It can be any of the above @var{WHEN} options.
4464 GCC can also be configured (via the
4465 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4466 so that the default is affected by environment variables.
4467 Under such a configuration, GCC defaults to using @samp{auto}
4468 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4469 present and non-empty in the environment of the compiler, or @samp{never}
4472 However, even with @option{-fdiagnostics-urls=always} the behavior is
4473 dependent on those environment variables:
4474 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4475 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4476 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4477 Any other non-empty value enables the feature.
4478 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4479 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4480 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4482 At this time GCC tries to detect also a few terminals that are known to
4483 not implement the URL feature, and have bugs or at least had bugs in
4484 some versions that are still in use, where the URL escapes are likely
4485 to misbehave, i.e. print garbage on the screen.
4486 That list is currently xfce4-terminal, certain known to be buggy
4487 gnome-terminal versions, the linux console, and mingw.
4488 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4490 @item -fno-diagnostics-show-option
4491 @opindex fno-diagnostics-show-option
4492 @opindex fdiagnostics-show-option
4493 By default, each diagnostic emitted includes text indicating the
4494 command-line option that directly controls the diagnostic (if such an
4495 option is known to the diagnostic machinery). Specifying the
4496 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4498 @item -fno-diagnostics-show-caret
4499 @opindex fno-diagnostics-show-caret
4500 @opindex fdiagnostics-show-caret
4501 By default, each diagnostic emitted includes the original source line
4502 and a caret @samp{^} indicating the column. This option suppresses this
4503 information. The source line is truncated to @var{n} characters, if
4504 the @option{-fmessage-length=n} option is given. When the output is done
4505 to the terminal, the width is limited to the width given by the
4506 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4508 @item -fno-diagnostics-show-labels
4509 @opindex fno-diagnostics-show-labels
4510 @opindex fdiagnostics-show-labels
4511 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4512 diagnostics can label ranges of source code with pertinent information, such
4513 as the types of expressions:
4516 printf ("foo %s bar", long_i + long_j);
4522 This option suppresses the printing of these labels (in the example above,
4523 the vertical bars and the ``char *'' and ``long int'' text).
4525 @item -fno-diagnostics-show-cwe
4526 @opindex fno-diagnostics-show-cwe
4527 @opindex fdiagnostics-show-cwe
4528 Diagnostic messages can optionally have an associated
4529 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4530 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4531 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4532 By default, if this information is present, it will be printed with
4533 the diagnostic. This option suppresses the printing of this metadata.
4535 @item -fno-diagnostics-show-line-numbers
4536 @opindex fno-diagnostics-show-line-numbers
4537 @opindex fdiagnostics-show-line-numbers
4538 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4539 a left margin is printed, showing line numbers. This option suppresses this
4542 @item -fdiagnostics-minimum-margin-width=@var{width}
4543 @opindex fdiagnostics-minimum-margin-width
4544 This option controls the minimum width of the left margin printed by
4545 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4547 @item -fdiagnostics-parseable-fixits
4548 @opindex fdiagnostics-parseable-fixits
4549 Emit fix-it hints in a machine-parseable format, suitable for consumption
4550 by IDEs. For each fix-it, a line will be printed after the relevant
4551 diagnostic, starting with the string ``fix-it:''. For example:
4554 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4557 The location is expressed as a half-open range, expressed as a count of
4558 bytes, starting at byte 1 for the initial column. In the above example,
4559 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4563 00000000011111111112222222222
4564 12345678901234567890123456789
4565 gtk_widget_showall (dlg);
4570 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4571 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4572 (e.g. vertical tab as ``\013'').
4574 An empty replacement string indicates that the given range is to be removed.
4575 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4576 be inserted at the given position.
4578 @item -fdiagnostics-generate-patch
4579 @opindex fdiagnostics-generate-patch
4580 Print fix-it hints to stderr in unified diff format, after any diagnostics
4581 are printed. For example:
4588 void show_cb(GtkDialog *dlg)
4590 - gtk_widget_showall(dlg);
4591 + gtk_widget_show_all(dlg);
4596 The diff may or may not be colorized, following the same rules
4597 as for diagnostics (see @option{-fdiagnostics-color}).
4599 @item -fdiagnostics-show-template-tree
4600 @opindex fdiagnostics-show-template-tree
4602 In the C++ frontend, when printing diagnostics showing mismatching
4603 template types, such as:
4606 could not convert 'std::map<int, std::vector<double> >()'
4607 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4610 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4611 tree-like structure showing the common and differing parts of the types,
4621 The parts that differ are highlighted with color (``double'' and
4622 ``float'' in this case).
4624 @item -fno-elide-type
4625 @opindex fno-elide-type
4626 @opindex felide-type
4627 By default when the C++ frontend prints diagnostics showing mismatching
4628 template types, common parts of the types are printed as ``[...]'' to
4629 simplify the error message. For example:
4632 could not convert 'std::map<int, std::vector<double> >()'
4633 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4636 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4637 This flag also affects the output of the
4638 @option{-fdiagnostics-show-template-tree} flag.
4640 @item -fdiagnostics-path-format=@var{KIND}
4641 @opindex fdiagnostics-path-format
4642 Specify how to print paths of control-flow events for diagnostics that
4643 have such a path associated with them.
4645 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4648 @samp{none} means to not print diagnostic paths.
4650 @samp{separate-events} means to print a separate ``note'' diagnostic for
4651 each event within the diagnostic. For example:
4654 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4655 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4656 test.c:27:3: note: (2) when 'i < count'
4657 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4660 @samp{inline-events} means to print the events ``inline'' within the source
4661 code. This view attempts to consolidate the events into runs of
4662 sufficiently-close events, printing them as labelled ranges within the source.
4664 For example, the same events as above might be printed as:
4669 | 25 | list = PyList_New(0);
4672 | | (1) when 'PyList_New' fails, returning NULL
4674 | 27 | for (i = 0; i < count; i++) @{
4677 | | (2) when 'i < count'
4678 | 28 | item = PyLong_FromLong(random());
4679 | 29 | PyList_Append(list, item);
4680 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4682 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4686 Interprocedural control flow is shown by grouping the events by stack frame,
4687 and using indentation to show how stack frames are nested, pushed, and popped.
4697 | | (1) entering 'test'
4698 | 134 | boxed_int *obj = make_boxed_int (i);
4699 | | ~~~~~~~~~~~~~~~~~~
4701 | | (2) calling 'make_boxed_int'
4703 +--> 'make_boxed_int': events 3-4
4708 | | (3) entering 'make_boxed_int'
4709 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4710 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4712 | | (4) calling 'wrapped_malloc'
4714 +--> 'wrapped_malloc': events 5-6
4719 | | (5) entering 'wrapped_malloc'
4720 | 8 | return malloc (size);
4723 | | (6) calling 'malloc'
4729 | 138 | free_boxed_int (obj);
4730 | | ^~~~~~~~~~~~~~~~~~~~
4732 | | (7) calling 'free_boxed_int'
4737 @item -fdiagnostics-show-path-depths
4738 @opindex fdiagnostics-show-path-depths
4739 This option provides additional information when printing control-flow paths
4740 associated with a diagnostic.
4742 If this is option is provided then the stack depth will be printed for
4743 each run of events within @option{-fdiagnostics-path-format=separate-events}.
4745 This is intended for use by GCC developers and plugin developers when
4746 debugging diagnostics that report interprocedural control flow.
4748 @item -fno-show-column
4749 @opindex fno-show-column
4750 @opindex fshow-column
4751 Do not print column numbers in diagnostics. This may be necessary if
4752 diagnostics are being scanned by a program that does not understand the
4753 column numbers, such as @command{dejagnu}.
4755 @item -fdiagnostics-column-unit=@var{UNIT}
4756 @opindex fdiagnostics-column-unit
4757 Select the units for the column number. This affects traditional diagnostics
4758 (in the absence of @option{-fno-show-column}), as well as JSON format
4759 diagnostics if requested.
4761 The default @var{UNIT}, @samp{display}, considers the number of display
4762 columns occupied by each character. This may be larger than the number
4763 of bytes required to encode the character, in the case of tab
4764 characters, or it may be smaller, in the case of multibyte characters.
4765 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
4766 display column, and its UTF-8 encoding requires two bytes; the character
4767 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
4768 its UTF-8 encoding requires four bytes.
4770 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
4771 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
4773 @item -fdiagnostics-column-origin=@var{ORIGIN}
4774 @opindex fdiagnostics-column-origin
4775 Select the origin for column numbers, i.e. the column number assigned to the
4776 first column. The default value of 1 corresponds to traditional GCC
4777 behavior and to the GNU style guide. Some utilities may perform better with an
4778 origin of 0; any non-negative value may be specified.
4780 @item -fdiagnostics-format=@var{FORMAT}
4781 @opindex fdiagnostics-format
4782 Select a different format for printing diagnostics.
4783 @var{FORMAT} is @samp{text} or @samp{json}.
4784 The default is @samp{text}.
4786 The @samp{json} format consists of a top-level JSON array containing JSON
4787 objects representing the diagnostics.
4789 The JSON is emitted as one line, without formatting; the examples below
4790 have been formatted for clarity.
4792 Diagnostics can have child diagnostics. For example, this error and note:
4795 misleading-indentation.c:15:3: warning: this 'if' clause does not
4796 guard... [-Wmisleading-indentation]
4799 misleading-indentation.c:17:5: note: ...this statement, but the latter
4800 is misleadingly indented as if it were guarded by the 'if'
4806 might be printed in JSON form (after formatting) like this:
4815 "display-column": 3,
4818 "file": "misleading-indentation.c",
4822 "display-column": 4,
4825 "file": "misleading-indentation.c",
4830 "message": "this \u2018if\u2019 clause does not guard...",
4831 "option": "-Wmisleading-indentation",
4832 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4839 "display-column": 5,
4842 "file": "misleading-indentation.c",
4847 "message": "...this statement, but the latter is @dots{}"
4857 where the @code{note} is a child of the @code{warning}.
4859 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4860 an @code{option} key describing the command-line option controlling the
4863 A diagnostic can contain zero or more locations. Each location has an
4864 optional @code{label} string and up to three positions within it: a
4865 @code{caret} position and optional @code{start} and @code{finish} positions.
4866 A position is described by a @code{file} name, a @code{line} number, and
4867 three numbers indicating a column position:
4871 @code{display-column} counts display columns, accounting for tabs and
4872 multibyte characters.
4875 @code{byte-column} counts raw bytes.
4878 @code{column} is equal to one of
4879 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
4883 All three columns are relative to the origin specified by
4884 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
4885 be set, for instance, to 0 for compatibility with other utilities that
4886 number columns from 0. The column origin is recorded in the JSON output in
4887 the @code{column-origin} tag. In the remaining examples below, the extra
4888 column number outputs have been omitted for brevity.
4890 For example, this error:
4893 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4894 'struct s'@} and 'T' @{aka 'struct t'@})
4895 64 | return callee_4a () + callee_4b ();
4896 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4898 | | T @{aka struct t@}
4899 | S @{aka struct s@}
4903 has three locations. Its primary location is at the ``+'' token at column
4904 23. It has two secondary locations, describing the left and right-hand sides
4905 of the expression, which have labels. It might be printed in JSON form as:
4914 "column": 23, "file": "bad-binary-ops.c", "line": 64
4919 "column": 10, "file": "bad-binary-ops.c", "line": 64
4922 "column": 21, "file": "bad-binary-ops.c", "line": 64
4924 "label": "S @{aka struct s@}"
4928 "column": 25, "file": "bad-binary-ops.c", "line": 64
4931 "column": 36, "file": "bad-binary-ops.c", "line": 64
4933 "label": "T @{aka struct t@}"
4936 "message": "invalid operands to binary + @dots{}"
4940 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4941 consisting of half-open intervals, similar to the output of
4942 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4943 with a replacement fix-it hint:
4946 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4948 8 | return ptr->colour;
4954 might be printed in JSON form as:
4989 "message": "\u2018struct s\u2019 has no member named @dots{}"
4994 where the fix-it hint suggests replacing the text from @code{start} up
4995 to but not including @code{next} with @code{string}'s value. Deletions
4996 are expressed via an empty value for @code{string}, insertions by
4997 having @code{start} equal @code{next}.
4999 If the diagnostic has a path of control-flow events associated with it,
5000 it has a @code{path} array of objects representing the events. Each
5001 event object has a @code{description} string, a @code{location} object,
5002 along with a @code{function} string and a @code{depth} number for
5003 representing interprocedural paths. The @code{function} represents the
5004 current function at that event, and the @code{depth} represents the
5005 stack depth relative to some baseline: the higher, the more frames are
5008 For example, the intraprocedural example shown for
5009 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5015 "description": "when 'PyList_New' fails, returning NULL",
5025 "description": "when 'i < count'",
5035 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5048 @node Warning Options
5049 @section Options to Request or Suppress Warnings
5050 @cindex options to control warnings
5051 @cindex warning messages
5052 @cindex messages, warning
5053 @cindex suppressing warnings
5055 Warnings are diagnostic messages that report constructions that
5056 are not inherently erroneous but that are risky or suggest there
5057 may have been an error.
5059 The following language-independent options do not enable specific
5060 warnings but control the kinds of diagnostics produced by GCC@.
5063 @cindex syntax checking
5065 @opindex fsyntax-only
5066 Check the code for syntax errors, but don't do anything beyond that.
5068 @item -fmax-errors=@var{n}
5069 @opindex fmax-errors
5070 Limits the maximum number of error messages to @var{n}, at which point
5071 GCC bails out rather than attempting to continue processing the source
5072 code. If @var{n} is 0 (the default), there is no limit on the number
5073 of error messages produced. If @option{-Wfatal-errors} is also
5074 specified, then @option{-Wfatal-errors} takes precedence over this
5079 Inhibit all warning messages.
5084 Make all warnings into errors.
5089 Make the specified warning into an error. The specifier for a warning
5090 is appended; for example @option{-Werror=switch} turns the warnings
5091 controlled by @option{-Wswitch} into errors. This switch takes a
5092 negative form, to be used to negate @option{-Werror} for specific
5093 warnings; for example @option{-Wno-error=switch} makes
5094 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5097 The warning message for each controllable warning includes the
5098 option that controls the warning. That option can then be used with
5099 @option{-Werror=} and @option{-Wno-error=} as described above.
5100 (Printing of the option in the warning message can be disabled using the
5101 @option{-fno-diagnostics-show-option} flag.)
5103 Note that specifying @option{-Werror=}@var{foo} automatically implies
5104 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5107 @item -Wfatal-errors
5108 @opindex Wfatal-errors
5109 @opindex Wno-fatal-errors
5110 This option causes the compiler to abort compilation on the first error
5111 occurred rather than trying to keep going and printing further error
5116 You can request many specific warnings with options beginning with
5117 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5118 implicit declarations. Each of these specific warning options also
5119 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5120 example, @option{-Wno-implicit}. This manual lists only one of the
5121 two forms, whichever is not the default. For further
5122 language-specific options also refer to @ref{C++ Dialect Options} and
5123 @ref{Objective-C and Objective-C++ Dialect Options}.
5124 Additional warnings can be produced by enabling the static analyzer;
5125 @xref{Static Analyzer Options}.
5127 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5128 options, such as @option{-Wunused}, which may turn on further options,
5129 such as @option{-Wunused-value}. The combined effect of positive and
5130 negative forms is that more specific options have priority over less
5131 specific ones, independently of their position in the command-line. For
5132 options of the same specificity, the last one takes effect. Options
5133 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5134 as if they appeared at the end of the command-line.
5136 When an unrecognized warning option is requested (e.g.,
5137 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5138 that the option is not recognized. However, if the @option{-Wno-} form
5139 is used, the behavior is slightly different: no diagnostic is
5140 produced for @option{-Wno-unknown-warning} unless other diagnostics
5141 are being produced. This allows the use of new @option{-Wno-} options
5142 with old compilers, but if something goes wrong, the compiler
5143 warns that an unrecognized option is present.
5145 The effectiveness of some warnings depends on optimizations also being
5146 enabled. For example @option{-Wsuggest-final-types} is more effective
5147 with link-time optimization and @option{-Wmaybe-uninitialized} does not
5148 warn at all unless optimization is enabled.
5155 @opindex Wno-pedantic
5156 Issue all the warnings demanded by strict ISO C and ISO C++;
5157 reject all programs that use forbidden extensions, and some other
5158 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5159 version of the ISO C standard specified by any @option{-std} option used.
5161 Valid ISO C and ISO C++ programs should compile properly with or without
5162 this option (though a rare few require @option{-ansi} or a
5163 @option{-std} option specifying the required version of ISO C)@. However,
5164 without this option, certain GNU extensions and traditional C and C++
5165 features are supported as well. With this option, they are rejected.
5167 @option{-Wpedantic} does not cause warning messages for use of the
5168 alternate keywords whose names begin and end with @samp{__}. This alternate
5169 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5170 i.e. @samp{__intN__}.
5171 Pedantic warnings are also disabled in the expression that follows
5172 @code{__extension__}. However, only system header files should use
5173 these escape routes; application programs should avoid them.
5174 @xref{Alternate Keywords}.
5176 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5177 C conformance. They soon find that it does not do quite what they want:
5178 it finds some non-ISO practices, but not all---only those for which
5179 ISO C @emph{requires} a diagnostic, and some others for which
5180 diagnostics have been added.
5182 A feature to report any failure to conform to ISO C might be useful in
5183 some instances, but would require considerable additional work and would
5184 be quite different from @option{-Wpedantic}. We don't have plans to
5185 support such a feature in the near future.
5187 Where the standard specified with @option{-std} represents a GNU
5188 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5189 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5190 extended dialect is based. Warnings from @option{-Wpedantic} are given
5191 where they are required by the base standard. (It does not make sense
5192 for such warnings to be given only for features not in the specified GNU
5193 C dialect, since by definition the GNU dialects of C include all
5194 features the compiler supports with the given option, and there would be
5195 nothing to warn about.)
5197 @item -pedantic-errors
5198 @opindex pedantic-errors
5199 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5200 requires a diagnostic, in some cases where there is undefined behavior
5201 at compile-time and in some other cases that do not prevent compilation
5202 of programs that are valid according to the standard. This is not
5203 equivalent to @option{-Werror=pedantic}, since there are errors enabled
5204 by this option and not enabled by the latter and vice versa.
5209 This enables all the warnings about constructions that some users
5210 consider questionable, and that are easy to avoid (or modify to
5211 prevent the warning), even in conjunction with macros. This also
5212 enables some language-specific warnings described in @ref{C++ Dialect
5213 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5215 @option{-Wall} turns on the following warning flags:
5217 @gccoptlist{-Waddress @gol
5218 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
5220 -Wbool-operation @gol
5221 -Wc++11-compat -Wc++14-compat @gol
5222 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
5223 -Wchar-subscripts @gol
5225 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5226 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5227 -Wenum-conversion @r{in C/ObjC;} @gol
5229 -Wformat-overflow @gol
5230 -Wformat-truncation @gol
5231 -Wint-in-bool-context @gol
5232 -Wimplicit @r{(C and Objective-C only)} @gol
5233 -Wimplicit-int @r{(C and Objective-C only)} @gol
5234 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5235 -Winit-self @r{(only for C++)} @gol
5236 -Wlogical-not-parentheses @gol
5237 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
5238 -Wmaybe-uninitialized @gol
5239 -Wmemset-elt-size @gol
5240 -Wmemset-transposed-args @gol
5241 -Wmisleading-indentation @r{(only for C/C++)} @gol
5242 -Wmissing-attributes @gol
5243 -Wmissing-braces @r{(only for C/ObjC)} @gol
5244 -Wmultistatement-macros @gol
5245 -Wnarrowing @r{(only for C++)} @gol
5247 -Wnonnull-compare @gol
5250 -Wpessimizing-move @r{(only for C++)} @gol
5255 -Wsequence-point @gol
5256 -Wsign-compare @r{(only in C++)} @gol
5257 -Wsizeof-pointer-div @gol
5258 -Wsizeof-pointer-memaccess @gol
5259 -Wstrict-aliasing @gol
5260 -Wstrict-overflow=1 @gol
5262 -Wtautological-compare @gol
5264 -Wuninitialized @gol
5265 -Wunknown-pragmas @gol
5266 -Wunused-function @gol
5269 -Wunused-variable @gol
5270 -Wvolatile-register-var @gol
5271 -Wzero-length-bounds}
5273 Note that some warning flags are not implied by @option{-Wall}. Some of
5274 them warn about constructions that users generally do not consider
5275 questionable, but which occasionally you might wish to check for;
5276 others warn about constructions that are necessary or hard to avoid in
5277 some cases, and there is no simple way to modify the code to suppress
5278 the warning. Some of them are enabled by @option{-Wextra} but many of
5279 them must be enabled individually.
5285 This enables some extra warning flags that are not enabled by
5286 @option{-Wall}. (This option used to be called @option{-W}. The older
5287 name is still supported, but the newer name is more descriptive.)
5289 @gccoptlist{-Wclobbered @gol
5290 -Wcast-function-type @gol
5291 -Wdeprecated-copy @r{(C++ only)} @gol
5293 -Wignored-qualifiers @gol
5294 -Wimplicit-fallthrough=3 @gol
5295 -Wmissing-field-initializers @gol
5296 -Wmissing-parameter-type @r{(C only)} @gol
5297 -Wold-style-declaration @r{(C only)} @gol
5298 -Woverride-init @gol
5299 -Wsign-compare @r{(C only)} @gol
5300 -Wstring-compare @gol
5301 -Wredundant-move @r{(only for C++)} @gol
5303 -Wuninitialized @gol
5304 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
5305 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5306 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5309 The option @option{-Wextra} also prints warning messages for the
5315 A pointer is compared against integer zero with @code{<}, @code{<=},
5316 @code{>}, or @code{>=}.
5319 (C++ only) An enumerator and a non-enumerator both appear in a
5320 conditional expression.
5323 (C++ only) Ambiguous virtual bases.
5326 (C++ only) Subscripting an array that has been declared @code{register}.
5329 (C++ only) Taking the address of a variable that has been declared
5333 (C++ only) A base class is not initialized in the copy constructor
5338 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
5342 Warn about code affected by ABI changes. This includes code that may
5343 not be compatible with the vendor-neutral C++ ABI as well as the psABI
5344 for the particular target.
5346 Since G++ now defaults to updating the ABI with each major release,
5347 normally @option{-Wabi} warns only about C++ ABI compatibility
5348 problems if there is a check added later in a release series for an
5349 ABI issue discovered since the initial release. @option{-Wabi} warns
5350 about more things if an older ABI version is selected (with
5351 @option{-fabi-version=@var{n}}).
5353 @option{-Wabi} can also be used with an explicit version number to
5354 warn about C++ ABI compatibility with a particular @option{-fabi-version}
5355 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
5356 @option{-fabi-version=2}.
5358 If an explicit version number is provided and
5359 @option{-fabi-compat-version} is not specified, the version number
5360 from this option is used for compatibility aliases. If no explicit
5361 version number is provided with this option, but
5362 @option{-fabi-compat-version} is specified, that version number is
5363 used for C++ ABI warnings.
5365 Although an effort has been made to warn about
5366 all such cases, there are probably some cases that are not warned about,
5367 even though G++ is generating incompatible code. There may also be
5368 cases where warnings are emitted even though the code that is generated
5371 You should rewrite your code to avoid these warnings if you are
5372 concerned about the fact that code generated by G++ may not be binary
5373 compatible with code generated by other compilers.
5375 Known incompatibilities in @option{-fabi-version=2} (which was the
5376 default from GCC 3.4 to 4.9) include:
5381 A template with a non-type template parameter of reference type was
5382 mangled incorrectly:
5385 template <int &> struct S @{@};
5389 This was fixed in @option{-fabi-version=3}.
5392 SIMD vector types declared using @code{__attribute ((vector_size))} were
5393 mangled in a non-standard way that does not allow for overloading of
5394 functions taking vectors of different sizes.
5396 The mangling was changed in @option{-fabi-version=4}.
5399 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5400 qualifiers, and @code{decltype} of a plain declaration was folded away.
5402 These mangling issues were fixed in @option{-fabi-version=5}.
5405 Scoped enumerators passed as arguments to a variadic function are
5406 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5407 On most targets this does not actually affect the parameter passing
5408 ABI, as there is no way to pass an argument smaller than @code{int}.
5410 Also, the ABI changed the mangling of template argument packs,
5411 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5412 a class scope function used as a template argument.
5414 These issues were corrected in @option{-fabi-version=6}.
5417 Lambdas in default argument scope were mangled incorrectly, and the
5418 ABI changed the mangling of @code{nullptr_t}.
5420 These issues were corrected in @option{-fabi-version=7}.
5423 When mangling a function type with function-cv-qualifiers, the
5424 un-qualified function type was incorrectly treated as a substitution
5427 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5430 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5431 unaligned accesses. Note that this did not affect the ABI of a
5432 function with a @code{nullptr_t} parameter, as parameters have a
5435 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5438 Target-specific attributes that affect the identity of a type, such as
5439 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5440 did not affect the mangled name, leading to name collisions when
5441 function pointers were used as template arguments.
5443 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5447 This option also enables warnings about psABI-related changes.
5448 The known psABI changes at this point include:
5453 For SysV/x86-64, unions with @code{long double} members are
5454 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5455 the case. For example:
5465 @code{union U} is now always passed in memory.
5469 @item -Wchar-subscripts
5470 @opindex Wchar-subscripts
5471 @opindex Wno-char-subscripts
5472 Warn if an array subscript has type @code{char}. This is a common cause
5473 of error, as programmers often forget that this type is signed on some
5475 This warning is enabled by @option{-Wall}.
5477 @item -Wno-coverage-mismatch
5478 @opindex Wno-coverage-mismatch
5479 @opindex Wcoverage-mismatch
5480 Warn if feedback profiles do not match when using the
5481 @option{-fprofile-use} option.
5482 If a source file is changed between compiling with @option{-fprofile-generate}
5483 and with @option{-fprofile-use}, the files with the profile feedback can fail
5484 to match the source file and GCC cannot use the profile feedback
5485 information. By default, this warning is enabled and is treated as an
5486 error. @option{-Wno-coverage-mismatch} can be used to disable the
5487 warning or @option{-Wno-error=coverage-mismatch} can be used to
5488 disable the error. Disabling the error for this warning can result in
5489 poorly optimized code and is useful only in the
5490 case of very minor changes such as bug fixes to an existing code-base.
5491 Completely disabling the warning is not recommended.
5494 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5497 Suppress warning messages emitted by @code{#warning} directives.
5499 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5500 @opindex Wdouble-promotion
5501 @opindex Wno-double-promotion
5502 Give a warning when a value of type @code{float} is implicitly
5503 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5504 floating-point unit implement @code{float} in hardware, but emulate
5505 @code{double} in software. On such a machine, doing computations
5506 using @code{double} values is much more expensive because of the
5507 overhead required for software emulation.
5509 It is easy to accidentally do computations with @code{double} because
5510 floating-point literals are implicitly of type @code{double}. For
5514 float area(float radius)
5516 return 3.14159 * radius * radius;
5520 the compiler performs the entire computation with @code{double}
5521 because the floating-point literal is a @code{double}.
5523 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5524 @opindex Wduplicate-decl-specifier
5525 @opindex Wno-duplicate-decl-specifier
5526 Warn if a declaration has duplicate @code{const}, @code{volatile},
5527 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5531 @itemx -Wformat=@var{n}
5534 @opindex ffreestanding
5535 @opindex fno-builtin
5537 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5538 the arguments supplied have types appropriate to the format string
5539 specified, and that the conversions specified in the format string make
5540 sense. This includes standard functions, and others specified by format
5541 attributes (@pxref{Function Attributes}), in the @code{printf},
5542 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5543 not in the C standard) families (or other target-specific families).
5544 Which functions are checked without format attributes having been
5545 specified depends on the standard version selected, and such checks of
5546 functions without the attribute specified are disabled by
5547 @option{-ffreestanding} or @option{-fno-builtin}.
5549 The formats are checked against the format features supported by GNU
5550 libc version 2.2. These include all ISO C90 and C99 features, as well
5551 as features from the Single Unix Specification and some BSD and GNU
5552 extensions. Other library implementations may not support all these
5553 features; GCC does not support warning about features that go beyond a
5554 particular library's limitations. However, if @option{-Wpedantic} is used
5555 with @option{-Wformat}, warnings are given about format features not
5556 in the selected standard version (but not for @code{strfmon} formats,
5557 since those are not in any version of the C standard). @xref{C Dialect
5558 Options,,Options Controlling C Dialect}.
5565 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5566 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
5567 @option{-Wformat} also checks for null format arguments for several
5568 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
5569 aspects of this level of format checking can be disabled by the
5570 options: @option{-Wno-format-contains-nul},
5571 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5572 @option{-Wformat} is enabled by @option{-Wall}.
5576 Enable @option{-Wformat} plus additional format checks. Currently
5577 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5581 @item -Wno-format-contains-nul
5582 @opindex Wno-format-contains-nul
5583 @opindex Wformat-contains-nul
5584 If @option{-Wformat} is specified, do not warn about format strings that
5587 @item -Wno-format-extra-args
5588 @opindex Wno-format-extra-args
5589 @opindex Wformat-extra-args
5590 If @option{-Wformat} is specified, do not warn about excess arguments to a
5591 @code{printf} or @code{scanf} format function. The C standard specifies
5592 that such arguments are ignored.
5594 Where the unused arguments lie between used arguments that are
5595 specified with @samp{$} operand number specifications, normally
5596 warnings are still given, since the implementation could not know what
5597 type to pass to @code{va_arg} to skip the unused arguments. However,
5598 in the case of @code{scanf} formats, this option suppresses the
5599 warning if the unused arguments are all pointers, since the Single
5600 Unix Specification says that such unused arguments are allowed.
5602 @item -Wformat-overflow
5603 @itemx -Wformat-overflow=@var{level}
5604 @opindex Wformat-overflow
5605 @opindex Wno-format-overflow
5606 Warn about calls to formatted input/output functions such as @code{sprintf}
5607 and @code{vsprintf} that might overflow the destination buffer. When the
5608 exact number of bytes written by a format directive cannot be determined
5609 at compile-time it is estimated based on heuristics that depend on the
5610 @var{level} argument and on optimization. While enabling optimization
5611 will in most cases improve the accuracy of the warning, it may also
5612 result in false positives.
5615 @item -Wformat-overflow
5616 @itemx -Wformat-overflow=1
5617 @opindex Wformat-overflow
5618 @opindex Wno-format-overflow
5619 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5620 employs a conservative approach that warns only about calls that most
5621 likely overflow the buffer. At this level, numeric arguments to format
5622 directives with unknown values are assumed to have the value of one, and
5623 strings of unknown length to be empty. Numeric arguments that are known
5624 to be bounded to a subrange of their type, or string arguments whose output
5625 is bounded either by their directive's precision or by a finite set of
5626 string literals, are assumed to take on the value within the range that
5627 results in the most bytes on output. For example, the call to @code{sprintf}
5628 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5629 the terminating NUL character (@code{'\0'}) appended by the function
5630 to the destination buffer will be written past its end. Increasing
5631 the size of the buffer by a single byte is sufficient to avoid the
5632 warning, though it may not be sufficient to avoid the overflow.
5635 void f (int a, int b)
5638 sprintf (buf, "a = %i, b = %i\n", a, b);
5642 @item -Wformat-overflow=2
5643 Level @var{2} warns also about calls that might overflow the destination
5644 buffer given an argument of sufficient length or magnitude. At level
5645 @var{2}, unknown numeric arguments are assumed to have the minimum
5646 representable value for signed types with a precision greater than 1, and
5647 the maximum representable value otherwise. Unknown string arguments whose
5648 length cannot be assumed to be bounded either by the directive's precision,
5649 or by a finite set of string literals they may evaluate to, or the character
5650 array they may point to, are assumed to be 1 character long.
5652 At level @var{2}, the call in the example above is again diagnosed, but
5653 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5654 @code{%i} directive will write some of its digits beyond the end of
5655 the destination buffer. To make the call safe regardless of the values
5656 of the two variables, the size of the destination buffer must be increased
5657 to at least 34 bytes. GCC includes the minimum size of the buffer in
5658 an informational note following the warning.
5660 An alternative to increasing the size of the destination buffer is to
5661 constrain the range of formatted values. The maximum length of string
5662 arguments can be bounded by specifying the precision in the format
5663 directive. When numeric arguments of format directives can be assumed
5664 to be bounded by less than the precision of their type, choosing
5665 an appropriate length modifier to the format specifier will reduce
5666 the required buffer size. For example, if @var{a} and @var{b} in the
5667 example above can be assumed to be within the precision of
5668 the @code{short int} type then using either the @code{%hi} format
5669 directive or casting the argument to @code{short} reduces the maximum
5670 required size of the buffer to 24 bytes.
5673 void f (int a, int b)
5676 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5681 @item -Wno-format-zero-length
5682 @opindex Wno-format-zero-length
5683 @opindex Wformat-zero-length
5684 If @option{-Wformat} is specified, do not warn about zero-length formats.
5685 The C standard specifies that zero-length formats are allowed.
5687 @item -Wformat-nonliteral
5688 @opindex Wformat-nonliteral
5689 @opindex Wno-format-nonliteral
5690 If @option{-Wformat} is specified, also warn if the format string is not a
5691 string literal and so cannot be checked, unless the format function
5692 takes its format arguments as a @code{va_list}.
5694 @item -Wformat-security
5695 @opindex Wformat-security
5696 @opindex Wno-format-security
5697 If @option{-Wformat} is specified, also warn about uses of format
5698 functions that represent possible security problems. At present, this
5699 warns about calls to @code{printf} and @code{scanf} functions where the
5700 format string is not a string literal and there are no format arguments,
5701 as in @code{printf (foo);}. This may be a security hole if the format
5702 string came from untrusted input and contains @samp{%n}. (This is
5703 currently a subset of what @option{-Wformat-nonliteral} warns about, but
5704 in future warnings may be added to @option{-Wformat-security} that are not
5705 included in @option{-Wformat-nonliteral}.)
5707 @item -Wformat-signedness
5708 @opindex Wformat-signedness
5709 @opindex Wno-format-signedness
5710 If @option{-Wformat} is specified, also warn if the format string
5711 requires an unsigned argument and the argument is signed and vice versa.
5713 @item -Wformat-truncation
5714 @itemx -Wformat-truncation=@var{level}
5715 @opindex Wformat-truncation
5716 @opindex Wno-format-truncation
5717 Warn about calls to formatted input/output functions such as @code{snprintf}
5718 and @code{vsnprintf} that might result in output truncation. When the exact
5719 number of bytes written by a format directive cannot be determined at
5720 compile-time it is estimated based on heuristics that depend on
5721 the @var{level} argument and on optimization. While enabling optimization
5722 will in most cases improve the accuracy of the warning, it may also result
5723 in false positives. Except as noted otherwise, the option uses the same
5724 logic @option{-Wformat-overflow}.
5727 @item -Wformat-truncation
5728 @itemx -Wformat-truncation=1
5729 @opindex Wformat-truncation
5730 @opindex Wno-format-truncation
5731 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
5732 employs a conservative approach that warns only about calls to bounded
5733 functions whose return value is unused and that will most likely result
5734 in output truncation.
5736 @item -Wformat-truncation=2
5737 Level @var{2} warns also about calls to bounded functions whose return
5738 value is used and that might result in truncation given an argument of
5739 sufficient length or magnitude.
5743 @opindex Wformat-y2k
5744 @opindex Wno-format-y2k
5745 If @option{-Wformat} is specified, also warn about @code{strftime}
5746 formats that may yield only a two-digit year.
5750 @opindex Wno-nonnull
5751 Warn about passing a null pointer for arguments marked as
5752 requiring a non-null value by the @code{nonnull} function attribute.
5754 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
5755 can be disabled with the @option{-Wno-nonnull} option.
5757 @item -Wnonnull-compare
5758 @opindex Wnonnull-compare
5759 @opindex Wno-nonnull-compare
5760 Warn when comparing an argument marked with the @code{nonnull}
5761 function attribute against null inside the function.
5763 @option{-Wnonnull-compare} is included in @option{-Wall}. It
5764 can be disabled with the @option{-Wno-nonnull-compare} option.
5766 @item -Wnull-dereference
5767 @opindex Wnull-dereference
5768 @opindex Wno-null-dereference
5769 Warn if the compiler detects paths that trigger erroneous or
5770 undefined behavior due to dereferencing a null pointer. This option
5771 is only active when @option{-fdelete-null-pointer-checks} is active,
5772 which is enabled by optimizations in most targets. The precision of
5773 the warnings depends on the optimization options used.
5775 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
5777 @opindex Wno-init-self
5778 Warn about uninitialized variables that are initialized with themselves.
5779 Note this option can only be used with the @option{-Wuninitialized} option.
5781 For example, GCC warns about @code{i} being uninitialized in the
5782 following snippet only when @option{-Winit-self} has been specified:
5793 This warning is enabled by @option{-Wall} in C++.
5795 @item -Wno-implicit-int @r{(C and Objective-C only)}
5796 @opindex Wimplicit-int
5797 @opindex Wno-implicit-int
5798 This option controls warnings when a declaration does not specify a type.
5799 This warning is enabled by default in C99 and later dialects of C,
5800 and also by @option{-Wall}.
5802 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
5803 @opindex Wimplicit-function-declaration
5804 @opindex Wno-implicit-function-declaration
5805 This option controls warnings when a function is used before being declared.
5806 This warning is enabled by default in C99 and later dialects of C,
5807 and also by @option{-Wall}.
5808 The warning is made into an error by @option{-pedantic-errors}.
5810 @item -Wimplicit @r{(C and Objective-C only)}
5812 @opindex Wno-implicit
5813 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
5814 This warning is enabled by @option{-Wall}.
5816 @item -Wimplicit-fallthrough
5817 @opindex Wimplicit-fallthrough
5818 @opindex Wno-implicit-fallthrough
5819 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
5820 and @option{-Wno-implicit-fallthrough} is the same as
5821 @option{-Wimplicit-fallthrough=0}.
5823 @item -Wimplicit-fallthrough=@var{n}
5824 @opindex Wimplicit-fallthrough=
5825 Warn when a switch case falls through. For example:
5843 This warning does not warn when the last statement of a case cannot
5844 fall through, e.g. when there is a return statement or a call to function
5845 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
5846 also takes into account control flow statements, such as ifs, and only
5847 warns when appropriate. E.g.@:
5857 @} else if (i < 1) @{
5867 Since there are occasions where a switch case fall through is desirable,
5868 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
5869 to be used along with a null statement to suppress this warning that
5870 would normally occur:
5878 __attribute__ ((fallthrough));
5885 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
5886 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
5887 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
5888 Instead of these attributes, it is also possible to add a fallthrough comment
5889 to silence the warning. The whole body of the C or C++ style comment should
5890 match the given regular expressions listed below. The option argument @var{n}
5891 specifies what kind of comments are accepted:
5895 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
5897 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
5898 expression, any comment is used as fallthrough comment.
5900 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
5901 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
5903 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5904 following regular expressions:
5908 @item @code{-fallthrough}
5910 @item @code{@@fallthrough@@}
5912 @item @code{lint -fallthrough[ \t]*}
5914 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5916 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5918 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5922 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5923 following regular expressions:
5927 @item @code{-fallthrough}
5929 @item @code{@@fallthrough@@}
5931 @item @code{lint -fallthrough[ \t]*}
5933 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5937 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5938 fallthrough comments, only attributes disable the warning.
5942 The comment needs to be followed after optional whitespace and other comments
5943 by @code{case} or @code{default} keywords or by a user label that precedes some
5944 @code{case} or @code{default} label.
5959 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5961 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5962 @opindex Wif-not-aligned
5963 @opindex Wno-if-not-aligned
5964 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
5965 should be issued. These warnings are enabled by default.
5967 @item -Wignored-qualifiers @r{(C and C++ only)}
5968 @opindex Wignored-qualifiers
5969 @opindex Wno-ignored-qualifiers
5970 Warn if the return type of a function has a type qualifier
5971 such as @code{const}. For ISO C such a type qualifier has no effect,
5972 since the value returned by a function is not an lvalue.
5973 For C++, the warning is only emitted for scalar types or @code{void}.
5974 ISO C prohibits qualified @code{void} return types on function
5975 definitions, so such return types always receive a warning
5976 even without this option.
5978 This warning is also enabled by @option{-Wextra}.
5980 @item -Wno-ignored-attributes @r{(C and C++ only)}
5981 @opindex Wignored-attributes
5982 @opindex Wno-ignored-attributes
5983 This option controls warnings when an attribute is ignored.
5984 This is different from the
5985 @option{-Wattributes} option in that it warns whenever the compiler decides
5986 to drop an attribute, not that the attribute is either unknown, used in a
5987 wrong place, etc. This warning is enabled by default.
5992 Warn if the type of @code{main} is suspicious. @code{main} should be
5993 a function with external linkage, returning int, taking either zero
5994 arguments, two, or three arguments of appropriate types. This warning
5995 is enabled by default in C++ and is enabled by either @option{-Wall}
5996 or @option{-Wpedantic}.
5998 @item -Wmisleading-indentation @r{(C and C++ only)}
5999 @opindex Wmisleading-indentation
6000 @opindex Wno-misleading-indentation
6001 Warn when the indentation of the code does not reflect the block structure.
6002 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6003 @code{for} clauses with a guarded statement that does not use braces,
6004 followed by an unguarded statement with the same indentation.
6006 In the following example, the call to ``bar'' is misleadingly indented as
6007 if it were guarded by the ``if'' conditional.
6010 if (some_condition ())
6012 bar (); /* Gotcha: this is not guarded by the "if". */
6015 In the case of mixed tabs and spaces, the warning uses the
6016 @option{-ftabstop=} option to determine if the statements line up
6019 The warning is not issued for code involving multiline preprocessor logic
6020 such as the following example.
6025 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6031 The warning is not issued after a @code{#line} directive, since this
6032 typically indicates autogenerated code, and no assumptions can be made
6033 about the layout of the file that the directive references.
6035 This warning is enabled by @option{-Wall} in C and C++.
6037 @item -Wmissing-attributes
6038 @opindex Wmissing-attributes
6039 @opindex Wno-missing-attributes
6040 Warn when a declaration of a function is missing one or more attributes
6041 that a related function is declared with and whose absence may adversely
6042 affect the correctness or efficiency of generated code. For example,
6043 the warning is issued for declarations of aliases that use attributes
6044 to specify less restrictive requirements than those of their targets.
6045 This typically represents a potential optimization opportunity.
6046 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6047 issued when the alias is more restrictive than the target, which could
6048 lead to incorrect code generation.
6049 Attributes considered include @code{alloc_align}, @code{alloc_size},
6050 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6051 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6052 @code{returns_nonnull}, and @code{returns_twice}.
6054 In C++, the warning is issued when an explicit specialization of a primary
6055 template declared with attribute @code{alloc_align}, @code{alloc_size},
6056 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6057 or @code{nonnull} is declared without it. Attributes @code{deprecated},
6058 @code{error}, and @code{warning} suppress the warning.
6059 (@pxref{Function Attributes}).
6061 You can use the @code{copy} attribute to apply the same
6062 set of attributes to a declaration as that on another declaration without
6063 explicitly enumerating the attributes. This attribute can be applied
6064 to declarations of functions (@pxref{Common Function Attributes}),
6065 variables (@pxref{Common Variable Attributes}), or types
6066 (@pxref{Common Type Attributes}).
6068 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6070 For example, since the declaration of the primary function template
6071 below makes use of both attribute @code{malloc} and @code{alloc_size}
6072 the declaration of the explicit specialization of the template is
6073 diagnosed because it is missing one of the attributes.
6077 T* __attribute__ ((malloc, alloc_size (1)))
6081 void* __attribute__ ((malloc)) // missing alloc_size
6082 allocate<void> (size_t);
6085 @item -Wmissing-braces
6086 @opindex Wmissing-braces
6087 @opindex Wno-missing-braces
6088 Warn if an aggregate or union initializer is not fully bracketed. In
6089 the following example, the initializer for @code{a} is not fully
6090 bracketed, but that for @code{b} is fully bracketed.
6093 int a[2][2] = @{ 0, 1, 2, 3 @};
6094 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6097 This warning is enabled by @option{-Wall}.
6099 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
6100 @opindex Wmissing-include-dirs
6101 @opindex Wno-missing-include-dirs
6102 Warn if a user-supplied include directory does not exist.
6104 @item -Wno-missing-profile
6105 @opindex Wmissing-profile
6106 @opindex Wno-missing-profile
6107 This option controls warnings if feedback profiles are missing when using the
6108 @option{-fprofile-use} option.
6109 This option diagnoses those cases where a new function or a new file is added
6110 between compiling with @option{-fprofile-generate} and with
6111 @option{-fprofile-use}, without regenerating the profiles.
6112 In these cases, the profile feedback data files do not contain any
6113 profile feedback information for
6114 the newly added function or file respectively. Also, in the case when profile
6115 count data (.gcda) files are removed, GCC cannot use any profile feedback
6116 information. In all these cases, warnings are issued to inform you that a
6117 profile generation step is due.
6118 Ignoring the warning can result in poorly optimized code.
6119 @option{-Wno-missing-profile} can be used to
6120 disable the warning, but this is not recommended and should be done only
6121 when non-existent profile data is justified.
6123 @item -Wmultistatement-macros
6124 @opindex Wmultistatement-macros
6125 @opindex Wno-multistatement-macros
6126 Warn about unsafe multiple statement macros that appear to be guarded
6127 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6128 @code{while}, in which only the first statement is actually guarded after
6129 the macro is expanded.
6134 #define DOIT x++; y++
6139 will increment @code{y} unconditionally, not just when @code{c} holds.
6140 The can usually be fixed by wrapping the macro in a do-while loop:
6142 #define DOIT do @{ x++; y++; @} while (0)
6147 This warning is enabled by @option{-Wall} in C and C++.
6150 @opindex Wparentheses
6151 @opindex Wno-parentheses
6152 Warn if parentheses are omitted in certain contexts, such
6153 as when there is an assignment in a context where a truth value
6154 is expected, or when operators are nested whose precedence people
6155 often get confused about.
6157 Also warn if a comparison like @code{x<=y<=z} appears; this is
6158 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6159 interpretation from that of ordinary mathematical notation.
6161 Also warn for dangerous uses of the GNU extension to
6162 @code{?:} with omitted middle operand. When the condition
6163 in the @code{?}: operator is a boolean expression, the omitted value is
6164 always 1. Often programmers expect it to be a value computed
6165 inside the conditional expression instead.
6167 For C++ this also warns for some cases of unnecessary parentheses in
6168 declarations, which can indicate an attempt at a function call instead
6172 // Declares a local variable called mymutex.
6173 std::unique_lock<std::mutex> (mymutex);
6174 // User meant std::unique_lock<std::mutex> lock (mymutex);
6178 This warning is enabled by @option{-Wall}.
6180 @item -Wsequence-point
6181 @opindex Wsequence-point
6182 @opindex Wno-sequence-point
6183 Warn about code that may have undefined semantics because of violations
6184 of sequence point rules in the C and C++ standards.
6186 The C and C++ standards define the order in which expressions in a C/C++
6187 program are evaluated in terms of @dfn{sequence points}, which represent
6188 a partial ordering between the execution of parts of the program: those
6189 executed before the sequence point, and those executed after it. These
6190 occur after the evaluation of a full expression (one which is not part
6191 of a larger expression), after the evaluation of the first operand of a
6192 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6193 function is called (but after the evaluation of its arguments and the
6194 expression denoting the called function), and in certain other places.
6195 Other than as expressed by the sequence point rules, the order of
6196 evaluation of subexpressions of an expression is not specified. All
6197 these rules describe only a partial order rather than a total order,
6198 since, for example, if two functions are called within one expression
6199 with no sequence point between them, the order in which the functions
6200 are called is not specified. However, the standards committee have
6201 ruled that function calls do not overlap.
6203 It is not specified when between sequence points modifications to the
6204 values of objects take effect. Programs whose behavior depends on this
6205 have undefined behavior; the C and C++ standards specify that ``Between
6206 the previous and next sequence point an object shall have its stored
6207 value modified at most once by the evaluation of an expression.
6208 Furthermore, the prior value shall be read only to determine the value
6209 to be stored.''. If a program breaks these rules, the results on any
6210 particular implementation are entirely unpredictable.
6212 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6213 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
6214 diagnosed by this option, and it may give an occasional false positive
6215 result, but in general it has been found fairly effective at detecting
6216 this sort of problem in programs.
6218 The C++17 standard will define the order of evaluation of operands in
6219 more cases: in particular it requires that the right-hand side of an
6220 assignment be evaluated before the left-hand side, so the above
6221 examples are no longer undefined. But this option will still warn
6222 about them, to help people avoid writing code that is undefined in C
6223 and earlier revisions of C++.
6225 The standard is worded confusingly, therefore there is some debate
6226 over the precise meaning of the sequence point rules in subtle cases.
6227 Links to discussions of the problem, including proposed formal
6228 definitions, may be found on the GCC readings page, at
6229 @uref{http://gcc.gnu.org/@/readings.html}.
6231 This warning is enabled by @option{-Wall} for C and C++.
6233 @item -Wno-return-local-addr
6234 @opindex Wno-return-local-addr
6235 @opindex Wreturn-local-addr
6236 Do not warn about returning a pointer (or in C++, a reference) to a
6237 variable that goes out of scope after the function returns.
6240 @opindex Wreturn-type
6241 @opindex Wno-return-type
6242 Warn whenever a function is defined with a return type that defaults
6243 to @code{int}. Also warn about any @code{return} statement with no
6244 return value in a function whose return type is not @code{void}
6245 (falling off the end of the function body is considered returning
6248 For C only, warn about a @code{return} statement with an expression in a
6249 function whose return type is @code{void}, unless the expression type is
6250 also @code{void}. As a GNU extension, the latter case is accepted
6251 without a warning unless @option{-Wpedantic} is used. Attempting
6252 to use the return value of a non-@code{void} function other than @code{main}
6253 that flows off the end by reaching the closing curly brace that terminates
6254 the function is undefined.
6256 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
6257 than @code{main} results in undefined behavior even when the value of
6258 the function is not used.
6260 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
6262 @item -Wno-shift-count-negative
6263 @opindex Wshift-count-negative
6264 @opindex Wno-shift-count-negative
6265 Controls warnings if a shift count is negative.
6266 This warning is enabled by default.
6268 @item -Wno-shift-count-overflow
6269 @opindex Wshift-count-overflow
6270 @opindex Wno-shift-count-overflow
6271 Controls warnings if a shift count is greater than or equal to the bit width
6272 of the type. This warning is enabled by default.
6274 @item -Wshift-negative-value
6275 @opindex Wshift-negative-value
6276 @opindex Wno-shift-negative-value
6277 Warn if left shifting a negative value. This warning is enabled by
6278 @option{-Wextra} in C99 and C++11 modes (and newer).
6280 @item -Wno-shift-overflow
6281 @itemx -Wshift-overflow=@var{n}
6282 @opindex Wshift-overflow
6283 @opindex Wno-shift-overflow
6284 These options control warnings about left shift overflows.
6287 @item -Wshift-overflow=1
6288 This is the warning level of @option{-Wshift-overflow} and is enabled
6289 by default in C99 and C++11 modes (and newer). This warning level does
6290 not warn about left-shifting 1 into the sign bit. (However, in C, such
6291 an overflow is still rejected in contexts where an integer constant expression
6292 is required.) No warning is emitted in C++20 mode (and newer), as signed left
6295 @item -Wshift-overflow=2
6296 This warning level also warns about left-shifting 1 into the sign bit,
6297 unless C++14 mode (or newer) is active.
6303 Warn whenever a @code{switch} statement has an index of enumerated type
6304 and lacks a @code{case} for one or more of the named codes of that
6305 enumeration. (The presence of a @code{default} label prevents this
6306 warning.) @code{case} labels outside the enumeration range also
6307 provoke warnings when this option is used (even if there is a
6308 @code{default} label).
6309 This warning is enabled by @option{-Wall}.
6311 @item -Wswitch-default
6312 @opindex Wswitch-default
6313 @opindex Wno-switch-default
6314 Warn whenever a @code{switch} statement does not have a @code{default}
6318 @opindex Wswitch-enum
6319 @opindex Wno-switch-enum
6320 Warn whenever a @code{switch} statement has an index of enumerated type
6321 and lacks a @code{case} for one or more of the named codes of that
6322 enumeration. @code{case} labels outside the enumeration range also
6323 provoke warnings when this option is used. The only difference
6324 between @option{-Wswitch} and this option is that this option gives a
6325 warning about an omitted enumeration code even if there is a
6326 @code{default} label.
6328 @item -Wno-switch-bool
6329 @opindex Wswitch-bool
6330 @opindex Wno-switch-bool
6331 Do not warn when a @code{switch} statement has an index of boolean type
6332 and the case values are outside the range of a boolean type.
6333 It is possible to suppress this warning by casting the controlling
6334 expression to a type other than @code{bool}. For example:
6337 switch ((int) (a == 4))
6343 This warning is enabled by default for C and C++ programs.
6345 @item -Wno-switch-outside-range
6346 @opindex Wswitch-outside-range
6347 @opindex Wno-switch-outside-range
6348 This option controls warnings when a @code{switch} case has a value
6349 that is outside of its
6350 respective type range. This warning is enabled by default for
6353 @item -Wno-switch-unreachable
6354 @opindex Wswitch-unreachable
6355 @opindex Wno-switch-unreachable
6356 Do not warn when a @code{switch} statement contains statements between the
6357 controlling expression and the first case label, which will never be
6358 executed. For example:
6370 @option{-Wswitch-unreachable} does not warn if the statement between the
6371 controlling expression and the first case label is just a declaration:
6384 This warning is enabled by default for C and C++ programs.
6386 @item -Wsync-nand @r{(C and C++ only)}
6388 @opindex Wno-sync-nand
6389 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6390 built-in functions are used. These functions changed semantics in GCC 4.4.
6392 @item -Wunused-but-set-parameter
6393 @opindex Wunused-but-set-parameter
6394 @opindex Wno-unused-but-set-parameter
6395 Warn whenever a function parameter is assigned to, but otherwise unused
6396 (aside from its declaration).
6398 To suppress this warning use the @code{unused} attribute
6399 (@pxref{Variable Attributes}).
6401 This warning is also enabled by @option{-Wunused} together with
6404 @item -Wunused-but-set-variable
6405 @opindex Wunused-but-set-variable
6406 @opindex Wno-unused-but-set-variable
6407 Warn whenever a local variable is assigned to, but otherwise unused
6408 (aside from its declaration).
6409 This warning is enabled by @option{-Wall}.
6411 To suppress this warning use the @code{unused} attribute
6412 (@pxref{Variable Attributes}).
6414 This warning is also enabled by @option{-Wunused}, which is enabled
6417 @item -Wunused-function
6418 @opindex Wunused-function
6419 @opindex Wno-unused-function
6420 Warn whenever a static function is declared but not defined or a
6421 non-inline static function is unused.
6422 This warning is enabled by @option{-Wall}.
6424 @item -Wunused-label
6425 @opindex Wunused-label
6426 @opindex Wno-unused-label
6427 Warn whenever a label is declared but not used.
6428 This warning is enabled by @option{-Wall}.
6430 To suppress this warning use the @code{unused} attribute
6431 (@pxref{Variable Attributes}).
6433 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6434 @opindex Wunused-local-typedefs
6435 @opindex Wno-unused-local-typedefs
6436 Warn when a typedef locally defined in a function is not used.
6437 This warning is enabled by @option{-Wall}.
6439 @item -Wunused-parameter
6440 @opindex Wunused-parameter
6441 @opindex Wno-unused-parameter
6442 Warn whenever a function parameter is unused aside from its declaration.
6444 To suppress this warning use the @code{unused} attribute
6445 (@pxref{Variable Attributes}).
6447 @item -Wno-unused-result
6448 @opindex Wunused-result
6449 @opindex Wno-unused-result
6450 Do not warn if a caller of a function marked with attribute
6451 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6452 its return value. The default is @option{-Wunused-result}.
6454 @item -Wunused-variable
6455 @opindex Wunused-variable
6456 @opindex Wno-unused-variable
6457 Warn whenever a local or static variable is unused aside from its
6458 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6459 but not for C++. This warning is enabled by @option{-Wall}.
6461 To suppress this warning use the @code{unused} attribute
6462 (@pxref{Variable Attributes}).
6464 @item -Wunused-const-variable
6465 @itemx -Wunused-const-variable=@var{n}
6466 @opindex Wunused-const-variable
6467 @opindex Wno-unused-const-variable
6468 Warn whenever a constant static variable is unused aside from its declaration.
6469 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6470 for C, but not for C++. In C this declares variable storage, but in C++ this
6471 is not an error since const variables take the place of @code{#define}s.
6473 To suppress this warning use the @code{unused} attribute
6474 (@pxref{Variable Attributes}).
6477 @item -Wunused-const-variable=1
6478 This is the warning level that is enabled by @option{-Wunused-variable} for
6479 C. It warns only about unused static const variables defined in the main
6480 compilation unit, but not about static const variables declared in any
6483 @item -Wunused-const-variable=2
6484 This warning level also warns for unused constant static variables in
6485 headers (excluding system headers). This is the warning level of
6486 @option{-Wunused-const-variable} and must be explicitly requested since
6487 in C++ this isn't an error and in C it might be harder to clean up all
6491 @item -Wunused-value
6492 @opindex Wunused-value
6493 @opindex Wno-unused-value
6494 Warn whenever a statement computes a result that is explicitly not
6495 used. To suppress this warning cast the unused expression to
6496 @code{void}. This includes an expression-statement or the left-hand
6497 side of a comma expression that contains no side effects. For example,
6498 an expression such as @code{x[i,j]} causes a warning, while
6499 @code{x[(void)i,j]} does not.
6501 This warning is enabled by @option{-Wall}.
6506 All the above @option{-Wunused} options combined.
6508 In order to get a warning about an unused function parameter, you must
6509 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6510 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6512 @item -Wuninitialized
6513 @opindex Wuninitialized
6514 @opindex Wno-uninitialized
6515 Warn if an automatic variable is used without first being initialized.
6516 In C++, warn if a non-static reference or non-static @code{const}
6517 member appears in a class without constructors.
6519 If you want to warn about code that uses the uninitialized value of the
6520 variable in its own initializer, use the @option{-Winit-self} option.
6522 These warnings occur for individual uninitialized elements of
6523 structure, union or array variables as well as for variables that are
6524 uninitialized as a whole. They do not occur for variables or elements
6525 declared @code{volatile}. Because these warnings depend on
6526 optimization, the exact variables or elements for which there are
6527 warnings depend on the precise optimization options and version of GCC
6530 Note that there may be no warning about a variable that is used only
6531 to compute a value that itself is never used, because such
6532 computations may be deleted by data flow analysis before the warnings
6535 @item -Wno-invalid-memory-model
6536 @opindex Winvalid-memory-model
6537 @opindex Wno-invalid-memory-model
6538 This option controls warnings
6539 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6540 and the C11 atomic generic functions with a memory consistency argument
6541 that is either invalid for the operation or outside the range of values
6542 of the @code{memory_order} enumeration. For example, since the
6543 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6544 defined for the relaxed, release, and sequentially consistent memory
6545 orders the following code is diagnosed:
6550 __atomic_store_n (i, 0, memory_order_consume);
6554 @option{-Winvalid-memory-model} is enabled by default.
6556 @item -Wmaybe-uninitialized
6557 @opindex Wmaybe-uninitialized
6558 @opindex Wno-maybe-uninitialized
6559 For an automatic (i.e.@: local) variable, if there exists a path from the
6560 function entry to a use of the variable that is initialized, but there exist
6561 some other paths for which the variable is not initialized, the compiler
6562 emits a warning if it cannot prove the uninitialized paths are not
6563 executed at run time.
6565 These warnings are only possible in optimizing compilation, because otherwise
6566 GCC does not keep track of the state of variables.
6568 These warnings are made optional because GCC may not be able to determine when
6569 the code is correct in spite of appearing to have an error. Here is one
6570 example of how this can happen:
6590 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6591 always initialized, but GCC doesn't know this. To suppress the
6592 warning, you need to provide a default case with assert(0) or
6595 @cindex @code{longjmp} warnings
6596 This option also warns when a non-volatile automatic variable might be
6597 changed by a call to @code{longjmp}.
6598 The compiler sees only the calls to @code{setjmp}. It cannot know
6599 where @code{longjmp} will be called; in fact, a signal handler could
6600 call it at any point in the code. As a result, you may get a warning
6601 even when there is in fact no problem because @code{longjmp} cannot
6602 in fact be called at the place that would cause a problem.
6604 Some spurious warnings can be avoided if you declare all the functions
6605 you use that never return as @code{noreturn}. @xref{Function
6608 This warning is enabled by @option{-Wall} or @option{-Wextra}.
6610 @item -Wunknown-pragmas
6611 @opindex Wunknown-pragmas
6612 @opindex Wno-unknown-pragmas
6613 @cindex warning for unknown pragmas
6614 @cindex unknown pragmas, warning
6615 @cindex pragmas, warning of unknown
6616 Warn when a @code{#pragma} directive is encountered that is not understood by
6617 GCC@. If this command-line option is used, warnings are even issued
6618 for unknown pragmas in system header files. This is not the case if
6619 the warnings are only enabled by the @option{-Wall} command-line option.
6622 @opindex Wno-pragmas
6624 Do not warn about misuses of pragmas, such as incorrect parameters,
6625 invalid syntax, or conflicts between pragmas. See also
6626 @option{-Wunknown-pragmas}.
6628 @item -Wno-prio-ctor-dtor
6629 @opindex Wno-prio-ctor-dtor
6630 @opindex Wprio-ctor-dtor
6631 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6632 The use of constructor and destructor attributes allow you to assign a
6633 priority to the constructor/destructor to control its order of execution
6634 before @code{main} is called or after it returns. The priority values must be
6635 greater than 100 as the compiler reserves priority values between 0--100 for
6638 @item -Wstrict-aliasing
6639 @opindex Wstrict-aliasing
6640 @opindex Wno-strict-aliasing
6641 This option is only active when @option{-fstrict-aliasing} is active.
6642 It warns about code that might break the strict aliasing rules that the
6643 compiler is using for optimization. The warning does not catch all
6644 cases, but does attempt to catch the more common pitfalls. It is
6645 included in @option{-Wall}.
6646 It is equivalent to @option{-Wstrict-aliasing=3}
6648 @item -Wstrict-aliasing=n
6649 @opindex Wstrict-aliasing=n
6650 This option is only active when @option{-fstrict-aliasing} is active.
6651 It warns about code that might break the strict aliasing rules that the
6652 compiler is using for optimization.
6653 Higher levels correspond to higher accuracy (fewer false positives).
6654 Higher levels also correspond to more effort, similar to the way @option{-O}
6656 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
6658 Level 1: Most aggressive, quick, least accurate.
6659 Possibly useful when higher levels
6660 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
6661 false negatives. However, it has many false positives.
6662 Warns for all pointer conversions between possibly incompatible types,
6663 even if never dereferenced. Runs in the front end only.
6665 Level 2: Aggressive, quick, not too precise.
6666 May still have many false positives (not as many as level 1 though),
6667 and few false negatives (but possibly more than level 1).
6668 Unlike level 1, it only warns when an address is taken. Warns about
6669 incomplete types. Runs in the front end only.
6671 Level 3 (default for @option{-Wstrict-aliasing}):
6672 Should have very few false positives and few false
6673 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
6674 Takes care of the common pun+dereference pattern in the front end:
6675 @code{*(int*)&some_float}.
6676 If optimization is enabled, it also runs in the back end, where it deals
6677 with multiple statement cases using flow-sensitive points-to information.
6678 Only warns when the converted pointer is dereferenced.
6679 Does not warn about incomplete types.
6681 @item -Wstrict-overflow
6682 @itemx -Wstrict-overflow=@var{n}
6683 @opindex Wstrict-overflow
6684 @opindex Wno-strict-overflow
6685 This option is only active when signed overflow is undefined.
6686 It warns about cases where the compiler optimizes based on the
6687 assumption that signed overflow does not occur. Note that it does not
6688 warn about all cases where the code might overflow: it only warns
6689 about cases where the compiler implements some optimization. Thus
6690 this warning depends on the optimization level.
6692 An optimization that assumes that signed overflow does not occur is
6693 perfectly safe if the values of the variables involved are such that
6694 overflow never does, in fact, occur. Therefore this warning can
6695 easily give a false positive: a warning about code that is not
6696 actually a problem. To help focus on important issues, several
6697 warning levels are defined. No warnings are issued for the use of
6698 undefined signed overflow when estimating how many iterations a loop
6699 requires, in particular when determining whether a loop will be
6703 @item -Wstrict-overflow=1
6704 Warn about cases that are both questionable and easy to avoid. For
6705 example the compiler simplifies
6706 @code{x + 1 > x} to @code{1}. This level of
6707 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
6708 are not, and must be explicitly requested.
6710 @item -Wstrict-overflow=2
6711 Also warn about other cases where a comparison is simplified to a
6712 constant. For example: @code{abs (x) >= 0}. This can only be
6713 simplified when signed integer overflow is undefined, because
6714 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
6715 zero. @option{-Wstrict-overflow} (with no level) is the same as
6716 @option{-Wstrict-overflow=2}.
6718 @item -Wstrict-overflow=3
6719 Also warn about other cases where a comparison is simplified. For
6720 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
6722 @item -Wstrict-overflow=4
6723 Also warn about other simplifications not covered by the above cases.
6724 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
6726 @item -Wstrict-overflow=5
6727 Also warn about cases where the compiler reduces the magnitude of a
6728 constant involved in a comparison. For example: @code{x + 2 > y} is
6729 simplified to @code{x + 1 >= y}. This is reported only at the
6730 highest warning level because this simplification applies to many
6731 comparisons, so this warning level gives a very large number of
6735 @item -Wstring-compare
6736 @opindex Wstring-compare
6737 @opindex Wno-string-compare
6738 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
6739 determined to be either zero or non-zero in tests for such equality
6740 owing to the length of one argument being greater than the size of
6741 the array the other argument is stored in (or the bound in the case
6742 of @code{strncmp}). Such calls could be mistakes. For example,
6743 the call to @code{strcmp} below is diagnosed because its result is
6744 necessarily non-zero irrespective of the contents of the array @code{a}.
6750 strcpy (d, "string");
6752 if (0 == strcmp (a, d)) // cannot be true
6753 puts ("a and d are the same");
6757 @option{-Wstring-compare} is enabled by @option{-Wextra}.
6759 @item -Wno-stringop-overflow
6760 @item -Wstringop-overflow
6761 @itemx -Wstringop-overflow=@var{type}
6762 @opindex Wstringop-overflow
6763 @opindex Wno-stringop-overflow
6764 Warn for calls to string manipulation functions such as @code{memcpy} and
6765 @code{strcpy} that are determined to overflow the destination buffer. The
6766 optional argument is one greater than the type of Object Size Checking to
6767 perform to determine the size of the destination. @xref{Object Size Checking}.
6768 The argument is meaningful only for functions that operate on character arrays
6769 but not for raw memory functions like @code{memcpy} which always make use
6770 of Object Size type-0. The option also warns for calls that specify a size
6771 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
6772 The option produces the best results with optimization enabled but can detect
6773 a small subset of simple buffer overflows even without optimization in
6774 calls to the GCC built-in functions like @code{__builtin_memcpy} that
6775 correspond to the standard functions. In any case, the option warns about
6776 just a subset of buffer overflows detected by the corresponding overflow
6777 checking built-ins. For example, the option issues a warning for
6778 the @code{strcpy} call below because it copies at least 5 characters
6779 (the string @code{"blue"} including the terminating NUL) into the buffer
6783 enum Color @{ blue, purple, yellow @};
6784 const char* f (enum Color clr)
6786 static char buf [4];
6790 case blue: str = "blue"; break;
6791 case purple: str = "purple"; break;
6792 case yellow: str = "yellow"; break;
6795 return strcpy (buf, str); // warning here
6799 Option @option{-Wstringop-overflow=2} is enabled by default.
6801 @item -Wno-stringop-overread
6802 @opindex Wstringop-overread
6803 @opindex Wno-stringop-overread
6804 Warn for calls to string manipulation functions such as @code{memchr},
6805 @code{strcpy} that are determined to read past the end of the source
6808 Option @option{-Wstringop-overread} is enabled by default.
6811 @item -Wstringop-overflow
6812 @itemx -Wstringop-overflow=1
6813 @opindex Wstringop-overflow
6814 @opindex Wno-stringop-overflow
6815 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
6816 to determine the sizes of destination objects. This is the default setting
6817 of the option. At this setting the option does not warn for writes past
6818 the end of subobjects of larger objects accessed by pointers unless the
6819 size of the largest surrounding object is known. When the destination may
6820 be one of several objects it is assumed to be the largest one of them. On
6821 Linux systems, when optimization is enabled at this setting the option warns
6822 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
6825 @item -Wstringop-overflow=2
6826 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
6827 to determine the sizes of destination objects. At this setting the option
6828 warna about overflows when writing to members of the largest complete
6829 objects whose exact size is known. However, it does not warn for excessive
6830 writes to the same members of unknown objects referenced by pointers since
6831 they may point to arrays containing unknown numbers of elements.
6833 @item -Wstringop-overflow=3
6834 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
6835 to determine the sizes of destination objects. At this setting the option
6836 warns about overflowing the smallest object or data member. This is the
6837 most restrictive setting of the option that may result in warnings for safe
6840 @item -Wstringop-overflow=4
6841 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
6842 to determine the sizes of destination objects. At this setting the option
6843 warns about overflowing any data members, and when the destination is
6844 one of several objects it uses the size of the largest of them to decide
6845 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
6846 setting of the option may result in warnings for benign code.
6849 @item -Wno-stringop-truncation
6850 @opindex Wstringop-truncation
6851 @opindex Wno-stringop-truncation
6852 Do not warn for calls to bounded string manipulation functions
6853 such as @code{strncat},
6854 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
6855 or leave the destination unchanged.
6857 In the following example, the call to @code{strncat} specifies a bound that
6858 is less than the length of the source string. As a result, the copy of
6859 the source will be truncated and so the call is diagnosed. To avoid the
6860 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
6863 void append (char *buf, size_t bufsize)
6865 strncat (buf, ".txt", 3);
6869 As another example, the following call to @code{strncpy} results in copying
6870 to @code{d} just the characters preceding the terminating NUL, without
6871 appending the NUL to the end. Assuming the result of @code{strncpy} is
6872 necessarily a NUL-terminated string is a common mistake, and so the call
6873 is diagnosed. To avoid the warning when the result is not expected to be
6874 NUL-terminated, call @code{memcpy} instead.
6877 void copy (char *d, const char *s)
6879 strncpy (d, s, strlen (s));
6883 In the following example, the call to @code{strncpy} specifies the size
6884 of the destination buffer as the bound. If the length of the source
6885 string is equal to or greater than this size the result of the copy will
6886 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
6887 the warning, specify @code{sizeof buf - 1} as the bound and set the last
6888 element of the buffer to @code{NUL}.
6891 void copy (const char *s)
6894 strncpy (buf, s, sizeof buf);
6899 In situations where a character array is intended to store a sequence
6900 of bytes with no terminating @code{NUL} such an array may be annotated
6901 with attribute @code{nonstring} to avoid this warning. Such arrays,
6902 however, are not suitable arguments to functions that expect
6903 @code{NUL}-terminated strings. To help detect accidental misuses of
6904 such arrays GCC issues warnings unless it can prove that the use is
6905 safe. @xref{Common Variable Attributes}.
6907 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
6908 @opindex Wsuggest-attribute=
6909 @opindex Wno-suggest-attribute=
6910 Warn for cases where adding an attribute may be beneficial. The
6911 attributes currently supported are listed below.
6914 @item -Wsuggest-attribute=pure
6915 @itemx -Wsuggest-attribute=const
6916 @itemx -Wsuggest-attribute=noreturn
6917 @itemx -Wmissing-noreturn
6918 @itemx -Wsuggest-attribute=malloc
6919 @opindex Wsuggest-attribute=pure
6920 @opindex Wno-suggest-attribute=pure
6921 @opindex Wsuggest-attribute=const
6922 @opindex Wno-suggest-attribute=const
6923 @opindex Wsuggest-attribute=noreturn
6924 @opindex Wno-suggest-attribute=noreturn
6925 @opindex Wmissing-noreturn
6926 @opindex Wno-missing-noreturn
6927 @opindex Wsuggest-attribute=malloc
6928 @opindex Wno-suggest-attribute=malloc
6930 Warn about functions that might be candidates for attributes
6931 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6932 only warns for functions visible in other compilation units or (in the case of
6933 @code{pure} and @code{const}) if it cannot prove that the function returns
6934 normally. A function returns normally if it doesn't contain an infinite loop or
6935 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6936 requires option @option{-fipa-pure-const}, which is enabled by default at
6937 @option{-O} and higher. Higher optimization levels improve the accuracy
6940 @item -Wsuggest-attribute=format
6941 @itemx -Wmissing-format-attribute
6942 @opindex Wsuggest-attribute=format
6943 @opindex Wmissing-format-attribute
6944 @opindex Wno-suggest-attribute=format
6945 @opindex Wno-missing-format-attribute
6949 Warn about function pointers that might be candidates for @code{format}
6950 attributes. Note these are only possible candidates, not absolute ones.
6951 GCC guesses that function pointers with @code{format} attributes that
6952 are used in assignment, initialization, parameter passing or return
6953 statements should have a corresponding @code{format} attribute in the
6954 resulting type. I.e.@: the left-hand side of the assignment or
6955 initialization, the type of the parameter variable, or the return type
6956 of the containing function respectively should also have a @code{format}
6957 attribute to avoid the warning.
6959 GCC also warns about function definitions that might be
6960 candidates for @code{format} attributes. Again, these are only
6961 possible candidates. GCC guesses that @code{format} attributes
6962 might be appropriate for any function that calls a function like
6963 @code{vprintf} or @code{vscanf}, but this might not always be the
6964 case, and some functions for which @code{format} attributes are
6965 appropriate may not be detected.
6967 @item -Wsuggest-attribute=cold
6968 @opindex Wsuggest-attribute=cold
6969 @opindex Wno-suggest-attribute=cold
6971 Warn about functions that might be candidates for @code{cold} attribute. This
6972 is based on static detection and generally only warns about functions which
6973 always leads to a call to another @code{cold} function such as wrappers of
6974 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6978 @opindex Wno-alloc-zero
6979 @opindex Walloc-zero
6980 Warn about calls to allocation functions decorated with attribute
6981 @code{alloc_size} that specify zero bytes, including those to the built-in
6982 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6983 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6984 when called with a zero size differs among implementations (and in the case
6985 of @code{realloc} has been deprecated) relying on it may result in subtle
6986 portability bugs and should be avoided.
6988 @item -Walloc-size-larger-than=@var{byte-size}
6989 @opindex Walloc-size-larger-than=
6990 @opindex Wno-alloc-size-larger-than
6991 Warn about calls to functions decorated with attribute @code{alloc_size}
6992 that attempt to allocate objects larger than the specified number of bytes,
6993 or where the result of the size computation in an integer type with infinite
6994 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6995 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6996 Warnings controlled by the option can be disabled either by specifying
6997 @var{byte-size} of @samp{SIZE_MAX} or more or by
6998 @option{-Wno-alloc-size-larger-than}.
6999 @xref{Function Attributes}.
7001 @item -Wno-alloc-size-larger-than
7002 @opindex Wno-alloc-size-larger-than
7003 Disable @option{-Walloc-size-larger-than=} warnings. The option is
7004 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7010 This option warns on all uses of @code{alloca} in the source.
7012 @item -Walloca-larger-than=@var{byte-size}
7013 @opindex Walloca-larger-than=
7014 @opindex Wno-alloca-larger-than
7015 This option warns on calls to @code{alloca} with an integer argument whose
7016 value is either zero, or that is not bounded by a controlling predicate
7017 that limits its value to at most @var{byte-size}. It also warns for calls
7018 to @code{alloca} where the bound value is unknown. Arguments of non-integer
7019 types are considered unbounded even if they appear to be constrained to
7022 For example, a bounded case of @code{alloca} could be:
7025 void func (size_t n)
7036 In the above example, passing @code{-Walloca-larger-than=1000} would not
7037 issue a warning because the call to @code{alloca} is known to be at most
7038 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
7039 the compiler would emit a warning.
7041 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7042 controlling predicate constraining its integer argument. For example:
7047 void *p = alloca (n);
7052 If @code{-Walloca-larger-than=500} were passed, the above would trigger
7053 a warning, but this time because of the lack of bounds checking.
7055 Note, that even seemingly correct code involving signed integers could
7059 void func (signed int n)
7069 In the above example, @var{n} could be negative, causing a larger than
7070 expected argument to be implicitly cast into the @code{alloca} call.
7072 This option also warns when @code{alloca} is used in a loop.
7074 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
7075 but is usually only effective when @option{-ftree-vrp} is active (default
7076 for @option{-O2} and above).
7078 See also @option{-Wvla-larger-than=}@samp{byte-size}.
7080 @item -Wno-alloca-larger-than
7081 @opindex Wno-alloca-larger-than
7082 Disable @option{-Walloca-larger-than=} warnings. The option is
7083 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
7085 @item -Warith-conversion
7086 @opindex Warith-conversion
7087 @opindex Wno-arith-conversion
7088 Do warn about implicit conversions from arithmetic operations even
7089 when conversion of the operands to the same type cannot change their
7090 values. This affects warnings from @option{-Wconversion},
7091 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7095 void f (char c, int i)
7097 c = c + i; // warns with @option{-Wconversion}
7098 c = c + 1; // only warns with @option{-Warith-conversion}
7103 @item -Warray-bounds
7104 @itemx -Warray-bounds=@var{n}
7105 @opindex Wno-array-bounds
7106 @opindex Warray-bounds
7107 This option is only active when @option{-ftree-vrp} is active
7108 (default for @option{-O2} and above). It warns about subscripts to arrays
7109 that are always out of bounds. This warning is enabled by @option{-Wall}.
7112 @item -Warray-bounds=1
7113 This is the warning level of @option{-Warray-bounds} and is enabled
7114 by @option{-Wall}; higher levels are not, and must be explicitly requested.
7116 @item -Warray-bounds=2
7117 This warning level also warns about out of bounds access for
7118 arrays at the end of a struct and for arrays accessed through
7119 pointers. This warning level may give a larger number of
7120 false positives and is deactivated by default.
7123 @item -Wattribute-alias=@var{n}
7124 @itemx -Wno-attribute-alias
7125 @opindex Wattribute-alias
7126 @opindex Wno-attribute-alias
7127 Warn about declarations using the @code{alias} and similar attributes whose
7128 target is incompatible with the type of the alias.
7129 @xref{Function Attributes,,Declaring Attributes of Functions}.
7132 @item -Wattribute-alias=1
7133 The default warning level of the @option{-Wattribute-alias} option diagnoses
7134 incompatibilities between the type of the alias declaration and that of its
7135 target. Such incompatibilities are typically indicative of bugs.
7137 @item -Wattribute-alias=2
7139 At this level @option{-Wattribute-alias} also diagnoses cases where
7140 the attributes of the alias declaration are more restrictive than the
7141 attributes applied to its target. These mismatches can potentially
7142 result in incorrect code generation. In other cases they may be
7143 benign and could be resolved simply by adding the missing attribute to
7144 the target. For comparison, see the @option{-Wmissing-attributes}
7145 option, which controls diagnostics when the alias declaration is less
7146 restrictive than the target, rather than more restrictive.
7148 Attributes considered include @code{alloc_align}, @code{alloc_size},
7149 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7150 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7151 @code{returns_nonnull}, and @code{returns_twice}.
7154 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
7155 This is the default. You can disable these warnings with either
7156 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
7158 @item -Wbool-compare
7159 @opindex Wno-bool-compare
7160 @opindex Wbool-compare
7161 Warn about boolean expression compared with an integer value different from
7162 @code{true}/@code{false}. For instance, the following comparison is
7167 if ((n > 1) == 2) @{ @dots{} @}
7169 This warning is enabled by @option{-Wall}.
7171 @item -Wbool-operation
7172 @opindex Wno-bool-operation
7173 @opindex Wbool-operation
7174 Warn about suspicious operations on expressions of a boolean type. For
7175 instance, bitwise negation of a boolean is very likely a bug in the program.
7176 For C, this warning also warns about incrementing or decrementing a boolean,
7177 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
7178 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
7180 This warning is enabled by @option{-Wall}.
7182 @item -Wduplicated-branches
7183 @opindex Wno-duplicated-branches
7184 @opindex Wduplicated-branches
7185 Warn when an if-else has identical branches. This warning detects cases like
7192 It doesn't warn when both branches contain just a null statement. This warning
7193 also warn for conditional operators:
7195 int i = x ? *p : *p;
7198 @item -Wduplicated-cond
7199 @opindex Wno-duplicated-cond
7200 @opindex Wduplicated-cond
7201 Warn about duplicated conditions in an if-else-if chain. For instance,
7202 warn for the following code:
7204 if (p->q != NULL) @{ @dots{} @}
7205 else if (p->q != NULL) @{ @dots{} @}
7208 @item -Wframe-address
7209 @opindex Wno-frame-address
7210 @opindex Wframe-address
7211 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
7212 is called with an argument greater than 0. Such calls may return indeterminate
7213 values or crash the program. The warning is included in @option{-Wall}.
7215 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
7216 @opindex Wno-discarded-qualifiers
7217 @opindex Wdiscarded-qualifiers
7218 Do not warn if type qualifiers on pointers are being discarded.
7219 Typically, the compiler warns if a @code{const char *} variable is
7220 passed to a function that takes a @code{char *} parameter. This option
7221 can be used to suppress such a warning.
7223 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
7224 @opindex Wno-discarded-array-qualifiers
7225 @opindex Wdiscarded-array-qualifiers
7226 Do not warn if type qualifiers on arrays which are pointer targets
7227 are being discarded. Typically, the compiler warns if a
7228 @code{const int (*)[]} variable is passed to a function that
7229 takes a @code{int (*)[]} parameter. This option can be used to
7230 suppress such a warning.
7232 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
7233 @opindex Wno-incompatible-pointer-types
7234 @opindex Wincompatible-pointer-types
7235 Do not warn when there is a conversion between pointers that have incompatible
7236 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
7237 which warns for pointer argument passing or assignment with different
7240 @item -Wno-int-conversion @r{(C and Objective-C only)}
7241 @opindex Wno-int-conversion
7242 @opindex Wint-conversion
7243 Do not warn about incompatible integer to pointer and pointer to integer
7244 conversions. This warning is about implicit conversions; for explicit
7245 conversions the warnings @option{-Wno-int-to-pointer-cast} and
7246 @option{-Wno-pointer-to-int-cast} may be used.
7248 @item -Wzero-length-bounds
7249 @opindex Wzero-length-bounds
7250 @opindex Wzero-length-bounds
7251 Warn about accesses to elements of zero-length array members that might
7252 overlap other members of the same object. Declaring interior zero-length
7253 arrays is discouraged because accesses to them are undefined. See
7256 For example, the first two stores in function @code{bad} are diagnosed
7257 because the array elements overlap the subsequent members @code{b} and
7258 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
7259 because it is beyond the bounds of the enclosing object.
7262 struct X @{ int a[0]; int b, c; @};
7267 x.a[0] = 0; // -Wzero-length-bounds
7268 x.a[1] = 1; // -Wzero-length-bounds
7269 x.a[2] = 2; // -Warray-bounds
7273 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
7275 @item -Wno-div-by-zero
7276 @opindex Wno-div-by-zero
7277 @opindex Wdiv-by-zero
7278 Do not warn about compile-time integer division by zero. Floating-point
7279 division by zero is not warned about, as it can be a legitimate way of
7280 obtaining infinities and NaNs.
7282 @item -Wsystem-headers
7283 @opindex Wsystem-headers
7284 @opindex Wno-system-headers
7285 @cindex warnings from system headers
7286 @cindex system headers, warnings from
7287 Print warning messages for constructs found in system header files.
7288 Warnings from system headers are normally suppressed, on the assumption
7289 that they usually do not indicate real problems and would only make the
7290 compiler output harder to read. Using this command-line option tells
7291 GCC to emit warnings from system headers as if they occurred in user
7292 code. However, note that using @option{-Wall} in conjunction with this
7293 option does @emph{not} warn about unknown pragmas in system
7294 headers---for that, @option{-Wunknown-pragmas} must also be used.
7296 @item -Wtautological-compare
7297 @opindex Wtautological-compare
7298 @opindex Wno-tautological-compare
7299 Warn if a self-comparison always evaluates to true or false. This
7300 warning detects various mistakes such as:
7304 if (i > i) @{ @dots{} @}
7307 This warning also warns about bitwise comparisons that always evaluate
7308 to true or false, for instance:
7310 if ((a & 16) == 10) @{ @dots{} @}
7312 will always be false.
7314 This warning is enabled by @option{-Wall}.
7317 @opindex Wtrampolines
7318 @opindex Wno-trampolines
7319 Warn about trampolines generated for pointers to nested functions.
7320 A trampoline is a small piece of data or code that is created at run
7321 time on the stack when the address of a nested function is taken, and is
7322 used to call the nested function indirectly. For some targets, it is
7323 made up of data only and thus requires no special treatment. But, for
7324 most targets, it is made up of code and thus requires the stack to be
7325 made executable in order for the program to work properly.
7328 @opindex Wfloat-equal
7329 @opindex Wno-float-equal
7330 Warn if floating-point values are used in equality comparisons.
7332 The idea behind this is that sometimes it is convenient (for the
7333 programmer) to consider floating-point values as approximations to
7334 infinitely precise real numbers. If you are doing this, then you need
7335 to compute (by analyzing the code, or in some other way) the maximum or
7336 likely maximum error that the computation introduces, and allow for it
7337 when performing comparisons (and when producing output, but that's a
7338 different problem). In particular, instead of testing for equality, you
7339 should check to see whether the two values have ranges that overlap; and
7340 this is done with the relational operators, so equality comparisons are
7343 @item -Wtraditional @r{(C and Objective-C only)}
7344 @opindex Wtraditional
7345 @opindex Wno-traditional
7346 Warn about certain constructs that behave differently in traditional and
7347 ISO C@. Also warn about ISO C constructs that have no traditional C
7348 equivalent, and/or problematic constructs that should be avoided.
7352 Macro parameters that appear within string literals in the macro body.
7353 In traditional C macro replacement takes place within string literals,
7354 but in ISO C it does not.
7357 In traditional C, some preprocessor directives did not exist.
7358 Traditional preprocessors only considered a line to be a directive
7359 if the @samp{#} appeared in column 1 on the line. Therefore
7360 @option{-Wtraditional} warns about directives that traditional C
7361 understands but ignores because the @samp{#} does not appear as the
7362 first character on the line. It also suggests you hide directives like
7363 @code{#pragma} not understood by traditional C by indenting them. Some
7364 traditional implementations do not recognize @code{#elif}, so this option
7365 suggests avoiding it altogether.
7368 A function-like macro that appears without arguments.
7371 The unary plus operator.
7374 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
7375 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
7376 constants.) Note, these suffixes appear in macros defined in the system
7377 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
7378 Use of these macros in user code might normally lead to spurious
7379 warnings, however GCC's integrated preprocessor has enough context to
7380 avoid warning in these cases.
7383 A function declared external in one block and then used after the end of
7387 A @code{switch} statement has an operand of type @code{long}.
7390 A non-@code{static} function declaration follows a @code{static} one.
7391 This construct is not accepted by some traditional C compilers.
7394 The ISO type of an integer constant has a different width or
7395 signedness from its traditional type. This warning is only issued if
7396 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
7397 typically represent bit patterns, are not warned about.
7400 Usage of ISO string concatenation is detected.
7403 Initialization of automatic aggregates.
7406 Identifier conflicts with labels. Traditional C lacks a separate
7407 namespace for labels.
7410 Initialization of unions. If the initializer is zero, the warning is
7411 omitted. This is done under the assumption that the zero initializer in
7412 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7413 initializer warnings and relies on default initialization to zero in the
7417 Conversions by prototypes between fixed/floating-point values and vice
7418 versa. The absence of these prototypes when compiling with traditional
7419 C causes serious problems. This is a subset of the possible
7420 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7423 Use of ISO C style function definitions. This warning intentionally is
7424 @emph{not} issued for prototype declarations or variadic functions
7425 because these ISO C features appear in your code when using
7426 libiberty's traditional C compatibility macros, @code{PARAMS} and
7427 @code{VPARAMS}. This warning is also bypassed for nested functions
7428 because that feature is already a GCC extension and thus not relevant to
7429 traditional C compatibility.
7432 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7433 @opindex Wtraditional-conversion
7434 @opindex Wno-traditional-conversion
7435 Warn if a prototype causes a type conversion that is different from what
7436 would happen to the same argument in the absence of a prototype. This
7437 includes conversions of fixed point to floating and vice versa, and
7438 conversions changing the width or signedness of a fixed-point argument
7439 except when the same as the default promotion.
7441 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7442 @opindex Wdeclaration-after-statement
7443 @opindex Wno-declaration-after-statement
7444 Warn when a declaration is found after a statement in a block. This
7445 construct, known from C++, was introduced with ISO C99 and is by default
7446 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
7451 Warn whenever a local variable or type declaration shadows another
7452 variable, parameter, type, class member (in C++), or instance variable
7453 (in Objective-C) or whenever a built-in function is shadowed. Note
7454 that in C++, the compiler warns if a local variable shadows an
7455 explicit typedef, but not if it shadows a struct/class/enum.
7456 If this warning is enabled, it includes also all instances of
7457 local shadowing. This means that @option{-Wno-shadow=local}
7458 and @option{-Wno-shadow=compatible-local} are ignored when
7459 @option{-Wshadow} is used.
7460 Same as @option{-Wshadow=global}.
7462 @item -Wno-shadow-ivar @r{(Objective-C only)}
7463 @opindex Wno-shadow-ivar
7464 @opindex Wshadow-ivar
7465 Do not warn whenever a local variable shadows an instance variable in an
7468 @item -Wshadow=global
7469 @opindex Wshadow=global
7470 Warn for any shadowing.
7471 Same as @option{-Wshadow}.
7473 @item -Wshadow=local
7474 @opindex Wshadow=local
7475 Warn when a local variable shadows another local variable or parameter.
7477 @item -Wshadow=compatible-local
7478 @opindex Wshadow=compatible-local
7479 Warn when a local variable shadows another local variable or parameter
7480 whose type is compatible with that of the shadowing variable. In C++,
7481 type compatibility here means the type of the shadowing variable can be
7482 converted to that of the shadowed variable. The creation of this flag
7483 (in addition to @option{-Wshadow=local}) is based on the idea that when
7484 a local variable shadows another one of incompatible type, it is most
7485 likely intentional, not a bug or typo, as shown in the following example:
7489 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7491 for (int i = 0; i < N; ++i)
7500 Since the two variable @code{i} in the example above have incompatible types,
7501 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7502 Because their types are incompatible, if a programmer accidentally uses one
7503 in place of the other, type checking is expected to catch that and emit an
7504 error or warning. Use of this flag instead of @option{-Wshadow=local} can
7505 possibly reduce the number of warnings triggered by intentional shadowing.
7506 Note that this also means that shadowing @code{const char *i} by
7507 @code{char *i} does not emit a warning.
7509 This warning is also enabled by @option{-Wshadow=local}.
7511 @item -Wlarger-than=@var{byte-size}
7512 @opindex Wlarger-than=
7513 @opindex Wlarger-than-@var{byte-size}
7514 Warn whenever an object is defined whose size exceeds @var{byte-size}.
7515 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7516 Warnings controlled by the option can be disabled either by specifying
7517 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
7519 Also warn for calls to bounded functions such as @code{memchr} or
7520 @code{strnlen} that specify a bound greater than the largest possible
7521 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
7522 can only be disabled by @option{-Wno-larger-than}.
7524 @item -Wno-larger-than
7525 @opindex Wno-larger-than
7526 Disable @option{-Wlarger-than=} warnings. The option is equivalent
7527 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7529 @item -Wframe-larger-than=@var{byte-size}
7530 @opindex Wframe-larger-than=
7531 @opindex Wno-frame-larger-than
7532 Warn if the size of a function frame exceeds @var{byte-size}.
7533 The computation done to determine the stack frame size is approximate
7534 and not conservative.
7535 The actual requirements may be somewhat greater than @var{byte-size}
7536 even if you do not get a warning. In addition, any space allocated
7537 via @code{alloca}, variable-length arrays, or related constructs
7538 is not included by the compiler when determining
7539 whether or not to issue a warning.
7540 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7541 Warnings controlled by the option can be disabled either by specifying
7542 @var{byte-size} of @samp{SIZE_MAX} or more or by
7543 @option{-Wno-frame-larger-than}.
7545 @item -Wno-frame-larger-than
7546 @opindex Wno-frame-larger-than
7547 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
7548 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7550 @item -Wno-free-nonheap-object
7551 @opindex Wno-free-nonheap-object
7552 @opindex Wfree-nonheap-object
7553 Do not warn when attempting to free an object that was not allocated
7556 @item -Wstack-usage=@var{byte-size}
7557 @opindex Wstack-usage
7558 @opindex Wno-stack-usage
7559 Warn if the stack usage of a function might exceed @var{byte-size}.
7560 The computation done to determine the stack usage is conservative.
7561 Any space allocated via @code{alloca}, variable-length arrays, or related
7562 constructs is included by the compiler when determining whether or not to
7565 The message is in keeping with the output of @option{-fstack-usage}.
7569 If the stack usage is fully static but exceeds the specified amount, it's:
7572 warning: stack usage is 1120 bytes
7575 If the stack usage is (partly) dynamic but bounded, it's:
7578 warning: stack usage might be 1648 bytes
7581 If the stack usage is (partly) dynamic and not bounded, it's:
7584 warning: stack usage might be unbounded
7588 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
7589 Warnings controlled by the option can be disabled either by specifying
7590 @var{byte-size} of @samp{SIZE_MAX} or more or by
7591 @option{-Wno-stack-usage}.
7593 @item -Wno-stack-usage
7594 @opindex Wno-stack-usage
7595 Disable @option{-Wstack-usage=} warnings. The option is equivalent
7596 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
7598 @item -Wunsafe-loop-optimizations
7599 @opindex Wunsafe-loop-optimizations
7600 @opindex Wno-unsafe-loop-optimizations
7601 Warn if the loop cannot be optimized because the compiler cannot
7602 assume anything on the bounds of the loop indices. With
7603 @option{-funsafe-loop-optimizations} warn if the compiler makes
7606 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
7607 @opindex Wno-pedantic-ms-format
7608 @opindex Wpedantic-ms-format
7609 When used in combination with @option{-Wformat}
7610 and @option{-pedantic} without GNU extensions, this option
7611 disables the warnings about non-ISO @code{printf} / @code{scanf} format
7612 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
7613 which depend on the MS runtime.
7615 @item -Wpointer-arith
7616 @opindex Wpointer-arith
7617 @opindex Wno-pointer-arith
7618 Warn about anything that depends on the ``size of'' a function type or
7619 of @code{void}. GNU C assigns these types a size of 1, for
7620 convenience in calculations with @code{void *} pointers and pointers
7621 to functions. In C++, warn also when an arithmetic operation involves
7622 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
7624 @item -Wno-pointer-compare
7625 @opindex Wpointer-compare
7626 @opindex Wno-pointer-compare
7627 Do not warn if a pointer is compared with a zero character constant.
7629 means that the pointer was meant to be dereferenced. For example:
7632 const char *p = foo ();
7637 Note that the code above is invalid in C++11.
7639 This warning is enabled by default.
7642 @opindex Wtype-limits
7643 @opindex Wno-type-limits
7644 Warn if a comparison is always true or always false due to the limited
7645 range of the data type, but do not warn for constant expressions. For
7646 example, warn if an unsigned variable is compared against zero with
7647 @code{<} or @code{>=}. This warning is also enabled by
7650 @item -Wabsolute-value @r{(C and Objective-C only)}
7651 @opindex Wabsolute-value
7652 @opindex Wno-absolute-value
7653 Warn for calls to standard functions that compute the absolute value
7654 of an argument when a more appropriate standard function is available.
7655 For example, calling @code{abs(3.14)} triggers the warning because the
7656 appropriate function to call to compute the absolute value of a double
7657 argument is @code{fabs}. The option also triggers warnings when the
7658 argument in a call to such a function has an unsigned type. This
7659 warning can be suppressed with an explicit type cast and it is also
7660 enabled by @option{-Wextra}.
7662 @include cppwarnopts.texi
7664 @item -Wbad-function-cast @r{(C and Objective-C only)}
7665 @opindex Wbad-function-cast
7666 @opindex Wno-bad-function-cast
7667 Warn when a function call is cast to a non-matching type.
7668 For example, warn if a call to a function returning an integer type
7669 is cast to a pointer type.
7671 @item -Wc90-c99-compat @r{(C and Objective-C only)}
7672 @opindex Wc90-c99-compat
7673 @opindex Wno-c90-c99-compat
7674 Warn about features not present in ISO C90, but present in ISO C99.
7675 For instance, warn about use of variable length arrays, @code{long long}
7676 type, @code{bool} type, compound literals, designated initializers, and so
7677 on. This option is independent of the standards mode. Warnings are disabled
7678 in the expression that follows @code{__extension__}.
7680 @item -Wc99-c11-compat @r{(C and Objective-C only)}
7681 @opindex Wc99-c11-compat
7682 @opindex Wno-c99-c11-compat
7683 Warn about features not present in ISO C99, but present in ISO C11.
7684 For instance, warn about use of anonymous structures and unions,
7685 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
7686 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
7687 and so on. This option is independent of the standards mode. Warnings are
7688 disabled in the expression that follows @code{__extension__}.
7690 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
7691 @opindex Wc11-c2x-compat
7692 @opindex Wno-c11-c2x-compat
7693 Warn about features not present in ISO C11, but present in ISO C2X.
7694 For instance, warn about omitting the string in @code{_Static_assert},
7695 use of @samp{[[]]} syntax for attributes, use of decimal
7696 floating-point types, and so on. This option is independent of the
7697 standards mode. Warnings are disabled in the expression that follows
7698 @code{__extension__}.
7700 @item -Wc++-compat @r{(C and Objective-C only)}
7701 @opindex Wc++-compat
7702 @opindex Wno-c++-compat
7703 Warn about ISO C constructs that are outside of the common subset of
7704 ISO C and ISO C++, e.g.@: request for implicit conversion from
7705 @code{void *} to a pointer to non-@code{void} type.
7707 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
7708 @opindex Wc++11-compat
7709 @opindex Wno-c++11-compat
7710 Warn about C++ constructs whose meaning differs between ISO C++ 1998
7711 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
7712 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
7713 enabled by @option{-Wall}.
7715 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
7716 @opindex Wc++14-compat
7717 @opindex Wno-c++14-compat
7718 Warn about C++ constructs whose meaning differs between ISO C++ 2011
7719 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
7721 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
7722 @opindex Wc++17-compat
7723 @opindex Wno-c++17-compat
7724 Warn about C++ constructs whose meaning differs between ISO C++ 2014
7725 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
7727 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
7728 @opindex Wc++20-compat
7729 @opindex Wno-c++20-compat
7730 Warn about C++ constructs whose meaning differs between ISO C++ 2017
7731 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
7735 @opindex Wno-cast-qual
7736 Warn whenever a pointer is cast so as to remove a type qualifier from
7737 the target type. For example, warn if a @code{const char *} is cast
7738 to an ordinary @code{char *}.
7740 Also warn when making a cast that introduces a type qualifier in an
7741 unsafe way. For example, casting @code{char **} to @code{const char **}
7742 is unsafe, as in this example:
7745 /* p is char ** value. */
7746 const char **q = (const char **) p;
7747 /* Assignment of readonly string to const char * is OK. */
7749 /* Now char** pointer points to read-only memory. */
7754 @opindex Wcast-align
7755 @opindex Wno-cast-align
7756 Warn whenever a pointer is cast such that the required alignment of the
7757 target is increased. For example, warn if a @code{char *} is cast to
7758 an @code{int *} on machines where integers can only be accessed at
7759 two- or four-byte boundaries.
7761 @item -Wcast-align=strict
7762 @opindex Wcast-align=strict
7763 Warn whenever a pointer is cast such that the required alignment of the
7764 target is increased. For example, warn if a @code{char *} is cast to
7765 an @code{int *} regardless of the target machine.
7767 @item -Wcast-function-type
7768 @opindex Wcast-function-type
7769 @opindex Wno-cast-function-type
7770 Warn when a function pointer is cast to an incompatible function pointer.
7771 In a cast involving function types with a variable argument list only
7772 the types of initial arguments that are provided are considered.
7773 Any parameter of pointer-type matches any other pointer-type. Any benign
7774 differences in integral types are ignored, like @code{int} vs.@: @code{long}
7775 on ILP32 targets. Likewise type qualifiers are ignored. The function
7776 type @code{void (*) (void)} is special and matches everything, which can
7777 be used to suppress this warning.
7778 In a cast involving pointer to member types this warning warns whenever
7779 the type cast is changing the pointer to member type.
7780 This warning is enabled by @option{-Wextra}.
7782 @item -Wwrite-strings
7783 @opindex Wwrite-strings
7784 @opindex Wno-write-strings
7785 When compiling C, give string constants the type @code{const
7786 char[@var{length}]} so that copying the address of one into a
7787 non-@code{const} @code{char *} pointer produces a warning. These
7788 warnings help you find at compile time code that can try to write
7789 into a string constant, but only if you have been very careful about
7790 using @code{const} in declarations and prototypes. Otherwise, it is
7791 just a nuisance. This is why we did not make @option{-Wall} request
7794 When compiling C++, warn about the deprecated conversion from string
7795 literals to @code{char *}. This warning is enabled by default for C++
7800 @opindex Wno-clobbered
7801 Warn for variables that might be changed by @code{longjmp} or
7802 @code{vfork}. This warning is also enabled by @option{-Wextra}.
7805 @opindex Wconversion
7806 @opindex Wno-conversion
7807 Warn for implicit conversions that may alter a value. This includes
7808 conversions between real and integer, like @code{abs (x)} when
7809 @code{x} is @code{double}; conversions between signed and unsigned,
7810 like @code{unsigned ui = -1}; and conversions to smaller types, like
7811 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
7812 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7813 changed by the conversion like in @code{abs (2.0)}. Warnings about
7814 conversions between signed and unsigned integers can be disabled by
7815 using @option{-Wno-sign-conversion}.
7817 For C++, also warn for confusing overload resolution for user-defined
7818 conversions; and conversions that never use a type conversion
7819 operator: conversions to @code{void}, the same type, a base class or a
7820 reference to them. Warnings about conversions between signed and
7821 unsigned integers are disabled by default in C++ unless
7822 @option{-Wsign-conversion} is explicitly enabled.
7824 Warnings about conversion from arithmetic on a small type back to that
7825 type are only given with @option{-Warith-conversion}.
7827 @item -Wdangling-else
7828 @opindex Wdangling-else
7829 @opindex Wno-dangling-else
7830 Warn about constructions where there may be confusion to which
7831 @code{if} statement an @code{else} branch belongs. Here is an example of
7846 In C/C++, every @code{else} branch belongs to the innermost possible
7847 @code{if} statement, which in this example is @code{if (b)}. This is
7848 often not what the programmer expected, as illustrated in the above
7849 example by indentation the programmer chose. When there is the
7850 potential for this confusion, GCC issues a warning when this flag
7851 is specified. To eliminate the warning, add explicit braces around
7852 the innermost @code{if} statement so there is no way the @code{else}
7853 can belong to the enclosing @code{if}. The resulting code
7870 This warning is enabled by @option{-Wparentheses}.
7874 @opindex Wno-date-time
7875 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7876 are encountered as they might prevent bit-wise-identical reproducible
7880 @opindex Wempty-body
7881 @opindex Wno-empty-body
7882 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7883 while} statement. This warning is also enabled by @option{-Wextra}.
7885 @item -Wno-endif-labels
7886 @opindex Wendif-labels
7887 @opindex Wno-endif-labels
7888 Do not warn about stray tokens after @code{#else} and @code{#endif}.
7890 @item -Wenum-compare
7891 @opindex Wenum-compare
7892 @opindex Wno-enum-compare
7893 Warn about a comparison between values of different enumerated types.
7894 In C++ enumerated type mismatches in conditional expressions are also
7895 diagnosed and the warning is enabled by default. In C this warning is
7896 enabled by @option{-Wall}.
7898 @item -Wenum-conversion @r{(C, Objective-C only)}
7899 @opindex Wenum-conversion
7900 @opindex Wno-enum-conversion
7901 Warn when a value of enumerated type is implicitly converted to a
7902 different enumerated type. This warning is enabled by @option{-Wextra}.
7904 @item -Wjump-misses-init @r{(C, Objective-C only)}
7905 @opindex Wjump-misses-init
7906 @opindex Wno-jump-misses-init
7907 Warn if a @code{goto} statement or a @code{switch} statement jumps
7908 forward across the initialization of a variable, or jumps backward to a
7909 label after the variable has been initialized. This only warns about
7910 variables that are initialized when they are declared. This warning is
7911 only supported for C and Objective-C; in C++ this sort of branch is an
7914 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7915 can be disabled with the @option{-Wno-jump-misses-init} option.
7917 @item -Wsign-compare
7918 @opindex Wsign-compare
7919 @opindex Wno-sign-compare
7920 @cindex warning for comparison of signed and unsigned values
7921 @cindex comparison of signed and unsigned values, warning
7922 @cindex signed and unsigned values, comparison warning
7923 Warn when a comparison between signed and unsigned values could produce
7924 an incorrect result when the signed value is converted to unsigned.
7925 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7926 also enabled by @option{-Wextra}.
7928 @item -Wsign-conversion
7929 @opindex Wsign-conversion
7930 @opindex Wno-sign-conversion
7931 Warn for implicit conversions that may change the sign of an integer
7932 value, like assigning a signed integer expression to an unsigned
7933 integer variable. An explicit cast silences the warning. In C, this
7934 option is enabled also by @option{-Wconversion}.
7936 @item -Wfloat-conversion
7937 @opindex Wfloat-conversion
7938 @opindex Wno-float-conversion
7939 Warn for implicit conversions that reduce the precision of a real value.
7940 This includes conversions from real to integer, and from higher precision
7941 real to lower precision real values. This option is also enabled by
7942 @option{-Wconversion}.
7944 @item -Wno-scalar-storage-order
7945 @opindex Wno-scalar-storage-order
7946 @opindex Wscalar-storage-order
7947 Do not warn on suspicious constructs involving reverse scalar storage order.
7949 @item -Wsizeof-pointer-div
7950 @opindex Wsizeof-pointer-div
7951 @opindex Wno-sizeof-pointer-div
7952 Warn for suspicious divisions of two sizeof expressions that divide
7953 the pointer size by the element size, which is the usual way to compute
7954 the array size but won't work out correctly with pointers. This warning
7955 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7956 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7958 @item -Wsizeof-pointer-memaccess
7959 @opindex Wsizeof-pointer-memaccess
7960 @opindex Wno-sizeof-pointer-memaccess
7961 Warn for suspicious length parameters to certain string and memory built-in
7962 functions if the argument uses @code{sizeof}. This warning triggers for
7963 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7964 an array, but a pointer, and suggests a possible fix, or about
7965 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7966 also warns about calls to bounded string copy functions like @code{strncat}
7967 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7968 the source array. For example, in the following function the call to
7969 @code{strncat} specifies the size of the source string as the bound. That
7970 is almost certainly a mistake and so the call is diagnosed.
7972 void make_file (const char *name)
7974 char path[PATH_MAX];
7975 strncpy (path, name, sizeof path - 1);
7976 strncat (path, ".text", sizeof ".text");
7981 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7983 @item -Wno-sizeof-array-argument
7984 @opindex Wsizeof-array-argument
7985 @opindex Wno-sizeof-array-argument
7986 Do not warn when the @code{sizeof} operator is applied to a parameter that is
7987 declared as an array in a function definition. This warning is enabled by
7988 default for C and C++ programs.
7990 @item -Wmemset-elt-size
7991 @opindex Wmemset-elt-size
7992 @opindex Wno-memset-elt-size
7993 Warn for suspicious calls to the @code{memset} built-in function, if the
7994 first argument references an array, and the third argument is a number
7995 equal to the number of elements, but not equal to the size of the array
7996 in memory. This indicates that the user has omitted a multiplication by
7997 the element size. This warning is enabled by @option{-Wall}.
7999 @item -Wmemset-transposed-args
8000 @opindex Wmemset-transposed-args
8001 @opindex Wno-memset-transposed-args
8002 Warn for suspicious calls to the @code{memset} built-in function where
8003 the second argument is not zero and the third argument is zero. For
8004 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
8005 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
8006 is only emitted if the third argument is a literal zero. Otherwise, if
8007 it is an expression that is folded to zero, or a cast of zero to some
8008 type, it is far less likely that the arguments have been mistakenly
8009 transposed and no warning is emitted. This warning is enabled
8014 @opindex Wno-address
8015 Warn about suspicious uses of memory addresses. These include using
8016 the address of a function in a conditional expression, such as
8017 @code{void func(void); if (func)}, and comparisons against the memory
8018 address of a string literal, such as @code{if (x == "abc")}. Such
8019 uses typically indicate a programmer error: the address of a function
8020 always evaluates to true, so their use in a conditional usually
8021 indicate that the programmer forgot the parentheses in a function
8022 call; and comparisons against string literals result in unspecified
8023 behavior and are not portable in C, so they usually indicate that the
8024 programmer intended to use @code{strcmp}. This warning is enabled by
8027 @item -Wno-address-of-packed-member
8028 @opindex Waddress-of-packed-member
8029 @opindex Wno-address-of-packed-member
8030 Do not warn when the address of packed member of struct or union is taken,
8031 which usually results in an unaligned pointer value. This is
8035 @opindex Wlogical-op
8036 @opindex Wno-logical-op
8037 Warn about suspicious uses of logical operators in expressions.
8038 This includes using logical operators in contexts where a
8039 bit-wise operator is likely to be expected. Also warns when
8040 the operands of a logical operator are the same:
8043 if (a < 0 && a < 0) @{ @dots{} @}
8046 @item -Wlogical-not-parentheses
8047 @opindex Wlogical-not-parentheses
8048 @opindex Wno-logical-not-parentheses
8049 Warn about logical not used on the left hand side operand of a comparison.
8050 This option does not warn if the right operand is considered to be a boolean
8051 expression. Its purpose is to detect suspicious code like the following:
8055 if (!a > 1) @{ @dots{} @}
8058 It is possible to suppress the warning by wrapping the LHS into
8061 if ((!a) > 1) @{ @dots{} @}
8064 This warning is enabled by @option{-Wall}.
8066 @item -Waggregate-return
8067 @opindex Waggregate-return
8068 @opindex Wno-aggregate-return
8069 Warn if any functions that return structures or unions are defined or
8070 called. (In languages where you can return an array, this also elicits
8073 @item -Wno-aggressive-loop-optimizations
8074 @opindex Wno-aggressive-loop-optimizations
8075 @opindex Waggressive-loop-optimizations
8076 Warn if in a loop with constant number of iterations the compiler detects
8077 undefined behavior in some statement during one or more of the iterations.
8079 @item -Wno-attributes
8080 @opindex Wno-attributes
8081 @opindex Wattributes
8082 Do not warn if an unexpected @code{__attribute__} is used, such as
8083 unrecognized attributes, function attributes applied to variables,
8084 etc. This does not stop errors for incorrect use of supported
8087 @item -Wno-builtin-declaration-mismatch
8088 @opindex Wno-builtin-declaration-mismatch
8089 @opindex Wbuiltin-declaration-mismatch
8090 Warn if a built-in function is declared with an incompatible signature
8091 or as a non-function, or when a built-in function declared with a type
8092 that does not include a prototype is called with arguments whose promoted
8093 types do not match those expected by the function. When @option{-Wextra}
8094 is specified, also warn when a built-in function that takes arguments is
8095 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
8096 warning is enabled by default. To avoid the warning include the appropriate
8097 header to bring the prototypes of built-in functions into scope.
8099 For example, the call to @code{memset} below is diagnosed by the warning
8100 because the function expects a value of type @code{size_t} as its argument
8101 but the type of @code{32} is @code{int}. With @option{-Wextra},
8102 the declaration of the function is diagnosed as well.
8104 extern void* memset ();
8107 memset (d, '\0', 32);
8111 @item -Wno-builtin-macro-redefined
8112 @opindex Wno-builtin-macro-redefined
8113 @opindex Wbuiltin-macro-redefined
8114 Do not warn if certain built-in macros are redefined. This suppresses
8115 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
8116 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
8118 @item -Wstrict-prototypes @r{(C and Objective-C only)}
8119 @opindex Wstrict-prototypes
8120 @opindex Wno-strict-prototypes
8121 Warn if a function is declared or defined without specifying the
8122 argument types. (An old-style function definition is permitted without
8123 a warning if preceded by a declaration that specifies the argument
8126 @item -Wold-style-declaration @r{(C and Objective-C only)}
8127 @opindex Wold-style-declaration
8128 @opindex Wno-old-style-declaration
8129 Warn for obsolescent usages, according to the C Standard, in a
8130 declaration. For example, warn if storage-class specifiers like
8131 @code{static} are not the first things in a declaration. This warning
8132 is also enabled by @option{-Wextra}.
8134 @item -Wold-style-definition @r{(C and Objective-C only)}
8135 @opindex Wold-style-definition
8136 @opindex Wno-old-style-definition
8137 Warn if an old-style function definition is used. A warning is given
8138 even if there is a previous prototype. A definition using @samp{()}
8139 is not considered an old-style definition in C2X mode, because it is
8140 equivalent to @samp{(void)} in that case, but is considered an
8141 old-style definition for older standards.
8143 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
8144 @opindex Wmissing-parameter-type
8145 @opindex Wno-missing-parameter-type
8146 A function parameter is declared without a type specifier in K&R-style
8153 This warning is also enabled by @option{-Wextra}.
8155 @item -Wmissing-prototypes @r{(C and Objective-C only)}
8156 @opindex Wmissing-prototypes
8157 @opindex Wno-missing-prototypes
8158 Warn if a global function is defined without a previous prototype
8159 declaration. This warning is issued even if the definition itself
8160 provides a prototype. Use this option to detect global functions
8161 that do not have a matching prototype declaration in a header file.
8162 This option is not valid for C++ because all function declarations
8163 provide prototypes and a non-matching declaration declares an
8164 overload rather than conflict with an earlier declaration.
8165 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
8167 @item -Wmissing-declarations
8168 @opindex Wmissing-declarations
8169 @opindex Wno-missing-declarations
8170 Warn if a global function is defined without a previous declaration.
8171 Do so even if the definition itself provides a prototype.
8172 Use this option to detect global functions that are not declared in
8173 header files. In C, no warnings are issued for functions with previous
8174 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
8175 missing prototypes. In C++, no warnings are issued for function templates,
8176 or for inline functions, or for functions in anonymous namespaces.
8178 @item -Wmissing-field-initializers
8179 @opindex Wmissing-field-initializers
8180 @opindex Wno-missing-field-initializers
8184 Warn if a structure's initializer has some fields missing. For
8185 example, the following code causes such a warning, because
8186 @code{x.h} is implicitly zero:
8189 struct s @{ int f, g, h; @};
8190 struct s x = @{ 3, 4 @};
8193 This option does not warn about designated initializers, so the following
8194 modification does not trigger a warning:
8197 struct s @{ int f, g, h; @};
8198 struct s x = @{ .f = 3, .g = 4 @};
8201 In C this option does not warn about the universal zero initializer
8205 struct s @{ int f, g, h; @};
8206 struct s x = @{ 0 @};
8209 Likewise, in C++ this option does not warn about the empty @{ @}
8210 initializer, for example:
8213 struct s @{ int f, g, h; @};
8217 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
8218 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
8220 @item -Wno-multichar
8221 @opindex Wno-multichar
8223 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
8224 Usually they indicate a typo in the user's code, as they have
8225 implementation-defined values, and should not be used in portable code.
8227 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
8228 @opindex Wnormalized=
8229 @opindex Wnormalized
8230 @opindex Wno-normalized
8233 @cindex character set, input normalization
8234 In ISO C and ISO C++, two identifiers are different if they are
8235 different sequences of characters. However, sometimes when characters
8236 outside the basic ASCII character set are used, you can have two
8237 different character sequences that look the same. To avoid confusion,
8238 the ISO 10646 standard sets out some @dfn{normalization rules} which
8239 when applied ensure that two sequences that look the same are turned into
8240 the same sequence. GCC can warn you if you are using identifiers that
8241 have not been normalized; this option controls that warning.
8243 There are four levels of warning supported by GCC@. The default is
8244 @option{-Wnormalized=nfc}, which warns about any identifier that is
8245 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
8246 recommended form for most uses. It is equivalent to
8247 @option{-Wnormalized}.
8249 Unfortunately, there are some characters allowed in identifiers by
8250 ISO C and ISO C++ that, when turned into NFC, are not allowed in
8251 identifiers. That is, there's no way to use these symbols in portable
8252 ISO C or C++ and have all your identifiers in NFC@.
8253 @option{-Wnormalized=id} suppresses the warning for these characters.
8254 It is hoped that future versions of the standards involved will correct
8255 this, which is why this option is not the default.
8257 You can switch the warning off for all characters by writing
8258 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
8259 only do this if you are using some other normalization scheme (like
8260 ``D''), because otherwise you can easily create bugs that are
8261 literally impossible to see.
8263 Some characters in ISO 10646 have distinct meanings but look identical
8264 in some fonts or display methodologies, especially once formatting has
8265 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
8266 LETTER N'', displays just like a regular @code{n} that has been
8267 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
8268 normalization scheme to convert all these into a standard form as
8269 well, and GCC warns if your code is not in NFKC if you use
8270 @option{-Wnormalized=nfkc}. This warning is comparable to warning
8271 about every identifier that contains the letter O because it might be
8272 confused with the digit 0, and so is not the default, but may be
8273 useful as a local coding convention if the programming environment
8274 cannot be fixed to display these characters distinctly.
8276 @item -Wno-attribute-warning
8277 @opindex Wno-attribute-warning
8278 @opindex Wattribute-warning
8279 Do not warn about usage of functions (@pxref{Function Attributes})
8280 declared with @code{warning} attribute. By default, this warning is
8281 enabled. @option{-Wno-attribute-warning} can be used to disable the
8282 warning or @option{-Wno-error=attribute-warning} can be used to
8283 disable the error when compiled with @option{-Werror} flag.
8285 @item -Wno-deprecated
8286 @opindex Wno-deprecated
8287 @opindex Wdeprecated
8288 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
8290 @item -Wno-deprecated-declarations
8291 @opindex Wno-deprecated-declarations
8292 @opindex Wdeprecated-declarations
8293 Do not warn about uses of functions (@pxref{Function Attributes}),
8294 variables (@pxref{Variable Attributes}), and types (@pxref{Type
8295 Attributes}) marked as deprecated by using the @code{deprecated}
8299 @opindex Wno-overflow
8301 Do not warn about compile-time overflow in constant expressions.
8306 Warn about One Definition Rule violations during link-time optimization.
8310 @opindex Wopenmp-simd
8311 @opindex Wno-openmp-simd
8312 Warn if the vectorizer cost model overrides the OpenMP
8313 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
8314 option can be used to relax the cost model.
8316 @item -Woverride-init @r{(C and Objective-C only)}
8317 @opindex Woverride-init
8318 @opindex Wno-override-init
8322 Warn if an initialized field without side effects is overridden when
8323 using designated initializers (@pxref{Designated Inits, , Designated
8326 This warning is included in @option{-Wextra}. To get other
8327 @option{-Wextra} warnings without this one, use @option{-Wextra
8328 -Wno-override-init}.
8330 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
8331 @opindex Woverride-init-side-effects
8332 @opindex Wno-override-init-side-effects
8333 Do not warn if an initialized field with side effects is overridden when
8334 using designated initializers (@pxref{Designated Inits, , Designated
8335 Initializers}). This warning is enabled by default.
8340 Warn if a structure is given the packed attribute, but the packed
8341 attribute has no effect on the layout or size of the structure.
8342 Such structures may be mis-aligned for little benefit. For
8343 instance, in this code, the variable @code{f.x} in @code{struct bar}
8344 is misaligned even though @code{struct bar} does not itself
8345 have the packed attribute:
8352 @} __attribute__((packed));
8360 @item -Wnopacked-bitfield-compat
8361 @opindex Wpacked-bitfield-compat
8362 @opindex Wno-packed-bitfield-compat
8363 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
8364 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
8365 the change can lead to differences in the structure layout. GCC
8366 informs you when the offset of such a field has changed in GCC 4.4.
8367 For example there is no longer a 4-bit padding between field @code{a}
8368 and @code{b} in this structure:
8375 @} __attribute__ ((packed));
8378 This warning is enabled by default. Use
8379 @option{-Wno-packed-bitfield-compat} to disable this warning.
8381 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
8382 @opindex Wpacked-not-aligned
8383 @opindex Wno-packed-not-aligned
8384 Warn if a structure field with explicitly specified alignment in a
8385 packed struct or union is misaligned. For example, a warning will
8386 be issued on @code{struct S}, like, @code{warning: alignment 1 of
8387 'struct S' is less than 8}, in this code:
8391 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
8392 struct __attribute__ ((packed)) S @{
8398 This warning is enabled by @option{-Wall}.
8403 Warn if padding is included in a structure, either to align an element
8404 of the structure or to align the whole structure. Sometimes when this
8405 happens it is possible to rearrange the fields of the structure to
8406 reduce the padding and so make the structure smaller.
8408 @item -Wredundant-decls
8409 @opindex Wredundant-decls
8410 @opindex Wno-redundant-decls
8411 Warn if anything is declared more than once in the same scope, even in
8412 cases where multiple declaration is valid and changes nothing.
8416 @opindex Wno-restrict
8417 Warn when an object referenced by a @code{restrict}-qualified parameter
8418 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8419 argument, or when copies between such objects overlap. For example,
8420 the call to the @code{strcpy} function below attempts to truncate the string
8421 by replacing its initial characters with the last four. However, because
8422 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8423 the call is diagnosed.
8428 char a[] = "abcd1234";
8433 The @option{-Wrestrict} option detects some instances of simple overlap
8434 even without optimization but works best at @option{-O2} and above. It
8435 is included in @option{-Wall}.
8437 @item -Wnested-externs @r{(C and Objective-C only)}
8438 @opindex Wnested-externs
8439 @opindex Wno-nested-externs
8440 Warn if an @code{extern} declaration is encountered within a function.
8445 Warn if a function that is declared as inline cannot be inlined.
8446 Even with this option, the compiler does not warn about failures to
8447 inline functions declared in system headers.
8449 The compiler uses a variety of heuristics to determine whether or not
8450 to inline a function. For example, the compiler takes into account
8451 the size of the function being inlined and the amount of inlining
8452 that has already been done in the current function. Therefore,
8453 seemingly insignificant changes in the source program can cause the
8454 warnings produced by @option{-Winline} to appear or disappear.
8456 @item -Wint-in-bool-context
8457 @opindex Wint-in-bool-context
8458 @opindex Wno-int-in-bool-context
8459 Warn for suspicious use of integer values where boolean values are expected,
8460 such as conditional expressions (?:) using non-boolean integer constants in
8461 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
8462 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
8463 for all kinds of multiplications regardless of the data type.
8464 This warning is enabled by @option{-Wall}.
8466 @item -Wno-int-to-pointer-cast
8467 @opindex Wno-int-to-pointer-cast
8468 @opindex Wint-to-pointer-cast
8469 Suppress warnings from casts to pointer type of an integer of a
8470 different size. In C++, casting to a pointer type of smaller size is
8471 an error. @option{Wint-to-pointer-cast} is enabled by default.
8474 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8475 @opindex Wno-pointer-to-int-cast
8476 @opindex Wpointer-to-int-cast
8477 Suppress warnings from casts from a pointer to an integer type of a
8481 @opindex Winvalid-pch
8482 @opindex Wno-invalid-pch
8483 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8484 the search path but cannot be used.
8488 @opindex Wno-long-long
8489 Warn if @code{long long} type is used. This is enabled by either
8490 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8491 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
8493 @item -Wvariadic-macros
8494 @opindex Wvariadic-macros
8495 @opindex Wno-variadic-macros
8496 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8497 alternate syntax is used in ISO C99 mode. This is enabled by either
8498 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
8499 messages, use @option{-Wno-variadic-macros}.
8503 @opindex Wno-varargs
8504 Do not warn upon questionable usage of the macros used to handle variable
8505 arguments like @code{va_start}. These warnings are enabled by default.
8507 @item -Wvector-operation-performance
8508 @opindex Wvector-operation-performance
8509 @opindex Wno-vector-operation-performance
8510 Warn if vector operation is not implemented via SIMD capabilities of the
8511 architecture. Mainly useful for the performance tuning.
8512 Vector operation can be implemented @code{piecewise}, which means that the
8513 scalar operation is performed on every vector element;
8514 @code{in parallel}, which means that the vector operation is implemented
8515 using scalars of wider type, which normally is more performance efficient;
8516 and @code{as a single scalar}, which means that vector fits into a
8522 Warn if a variable-length array is used in the code.
8523 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8524 the variable-length array.
8526 @item -Wvla-larger-than=@var{byte-size}
8527 @opindex Wvla-larger-than=
8528 @opindex Wno-vla-larger-than
8529 If this option is used, the compiler warns for declarations of
8530 variable-length arrays whose size is either unbounded, or bounded
8531 by an argument that allows the array size to exceed @var{byte-size}
8532 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8533 works, but with variable-length arrays.
8535 Note that GCC may optimize small variable-length arrays of a known
8536 value into plain arrays, so this warning may not get triggered for
8539 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8540 is typically only effective when @option{-ftree-vrp} is active (default
8541 for @option{-O2} and above).
8543 See also @option{-Walloca-larger-than=@var{byte-size}}.
8545 @item -Wno-vla-larger-than
8546 @opindex Wno-vla-larger-than
8547 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
8548 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8550 @item -Wvolatile-register-var
8551 @opindex Wvolatile-register-var
8552 @opindex Wno-volatile-register-var
8553 Warn if a register variable is declared volatile. The volatile
8554 modifier does not inhibit all optimizations that may eliminate reads
8555 and/or writes to register variables. This warning is enabled by
8558 @item -Wdisabled-optimization
8559 @opindex Wdisabled-optimization
8560 @opindex Wno-disabled-optimization
8561 Warn if a requested optimization pass is disabled. This warning does
8562 not generally indicate that there is anything wrong with your code; it
8563 merely indicates that GCC's optimizers are unable to handle the code
8564 effectively. Often, the problem is that your code is too big or too
8565 complex; GCC refuses to optimize programs when the optimization
8566 itself is likely to take inordinate amounts of time.
8568 @item -Wpointer-sign @r{(C and Objective-C only)}
8569 @opindex Wpointer-sign
8570 @opindex Wno-pointer-sign
8571 Warn for pointer argument passing or assignment with different signedness.
8572 This option is only supported for C and Objective-C@. It is implied by
8573 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
8574 @option{-Wno-pointer-sign}.
8576 @item -Wstack-protector
8577 @opindex Wstack-protector
8578 @opindex Wno-stack-protector
8579 This option is only active when @option{-fstack-protector} is active. It
8580 warns about functions that are not protected against stack smashing.
8582 @item -Woverlength-strings
8583 @opindex Woverlength-strings
8584 @opindex Wno-overlength-strings
8585 Warn about string constants that are longer than the ``minimum
8586 maximum'' length specified in the C standard. Modern compilers
8587 generally allow string constants that are much longer than the
8588 standard's minimum limit, but very portable programs should avoid
8589 using longer strings.
8591 The limit applies @emph{after} string constant concatenation, and does
8592 not count the trailing NUL@. In C90, the limit was 509 characters; in
8593 C99, it was raised to 4095. C++98 does not specify a normative
8594 minimum maximum, so we do not diagnose overlength strings in C++@.
8596 This option is implied by @option{-Wpedantic}, and can be disabled with
8597 @option{-Wno-overlength-strings}.
8599 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
8600 @opindex Wunsuffixed-float-constants
8601 @opindex Wno-unsuffixed-float-constants
8603 Issue a warning for any floating constant that does not have
8604 a suffix. When used together with @option{-Wsystem-headers} it
8605 warns about such constants in system header files. This can be useful
8606 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
8607 from the decimal floating-point extension to C99.
8609 @item -Wno-lto-type-mismatch
8610 @opindex Wlto-type-mismatch
8611 @opindex Wno-lto-type-mismatch
8613 During the link-time optimization, do not warn about type mismatches in
8614 global declarations from different compilation units.
8615 Requires @option{-flto} to be enabled. Enabled by default.
8617 @item -Wno-designated-init @r{(C and Objective-C only)}
8618 @opindex Wdesignated-init
8619 @opindex Wno-designated-init
8620 Suppress warnings when a positional initializer is used to initialize
8621 a structure that has been marked with the @code{designated_init}
8626 @node Static Analyzer Options
8627 @section Options That Control Static Analysis
8633 @opindex fno-analyzer
8634 This option enables an static analysis of program flow which looks
8635 for ``interesting'' interprocedural paths through the
8636 code, and issues warnings for problems found on them.
8638 This analysis is much more expensive than other GCC warnings.
8640 Enabling this option effectively enables the following warnings:
8643 -Wanalyzer-double-fclose @gol
8644 -Wanalyzer-double-free @gol
8645 -Wanalyzer-exposure-through-output-file @gol
8646 -Wanalyzer-file-leak @gol
8647 -Wanalyzer-free-of-non-heap @gol
8648 -Wanalyzer-malloc-leak @gol
8649 -Wanalyzer-mismatching-deallocation @gol
8650 -Wanalyzer-possible-null-argument @gol
8651 -Wanalyzer-possible-null-dereference @gol
8652 -Wanalyzer-null-argument @gol
8653 -Wanalyzer-null-dereference @gol
8654 -Wanalyzer-stale-setjmp-buffer @gol
8655 -Wanalyzer-tainted-array-index @gol
8656 -Wanalyzer-unsafe-call-within-signal-handler @gol
8657 -Wanalyzer-use-after-free @gol
8658 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
8661 This option is only available if GCC was configured with analyzer
8664 @item -Wanalyzer-too-complex
8665 @opindex Wanalyzer-too-complex
8666 @opindex Wno-analyzer-too-complex
8667 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
8668 to attempt to explore the control flow and data flow in the program,
8669 but these can be defeated by sufficiently complicated code.
8671 By default, the analysis silently stops if the code is too
8672 complicated for the analyzer to fully explore and it reaches an internal
8673 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
8675 @item -Wno-analyzer-double-fclose
8676 @opindex Wanalyzer-double-fclose
8677 @opindex Wno-analyzer-double-fclose
8678 This warning requires @option{-fanalyzer}, which enables it; use
8679 @option{-Wno-analyzer-double-fclose} to disable it.
8681 This diagnostic warns for paths through the code in which a @code{FILE *}
8682 can have @code{fclose} called on it more than once.
8684 @item -Wno-analyzer-double-free
8685 @opindex Wanalyzer-double-free
8686 @opindex Wno-analyzer-double-free
8687 This warning requires @option{-fanalyzer}, which enables it; use
8688 @option{-Wno-analyzer-double-free} to disable it.
8690 This diagnostic warns for paths through the code in which a pointer
8691 can have @code{free} called on it more than once.
8693 @item -Wno-analyzer-exposure-through-output-file
8694 @opindex Wanalyzer-exposure-through-output-file
8695 @opindex Wno-analyzer-exposure-through-output-file
8696 This warning requires @option{-fanalyzer}, which enables it; use
8697 @option{-Wno-analyzer-exposure-through-output-file}
8700 This diagnostic warns for paths through the code in which a
8701 security-sensitive value is written to an output file
8702 (such as writing a password to a log file).
8704 @item -Wno-analyzer-file-leak
8705 @opindex Wanalyzer-file-leak
8706 @opindex Wno-analyzer-file-leak
8707 This warning requires @option{-fanalyzer}, which enables it; use
8708 @option{-Wno-analyzer-file-leak}
8711 This diagnostic warns for paths through the code in which a
8712 @code{<stdio.h>} @code{FILE *} stream object is leaked.
8714 @item -Wno-analyzer-free-of-non-heap
8715 @opindex Wanalyzer-free-of-non-heap
8716 @opindex Wno-analyzer-free-of-non-heap
8717 This warning requires @option{-fanalyzer}, which enables it; use
8718 @option{-Wno-analyzer-free-of-non-heap}
8721 This diagnostic warns for paths through the code in which @code{free}
8722 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
8724 @item -Wno-analyzer-malloc-leak
8725 @opindex Wanalyzer-malloc-leak
8726 @opindex Wno-analyzer-malloc-leak
8727 This warning requires @option{-fanalyzer}, which enables it; use
8728 @option{-Wno-analyzer-malloc-leak}
8731 This diagnostic warns for paths through the code in which a
8732 pointer allocated via @code{malloc} is leaked.
8734 @item -Wno-analyzer-mismatching-deallocation
8735 @opindex Wanalyzer-mismatching-deallocation
8736 @opindex Wno-analyzer-mismatching-deallocation
8737 This warning requires @option{-fanalyzer}, which enables it; use
8738 @option{-Wno-analyzer-mismatching-deallocation}
8741 This diagnostic warns for paths through the code in which the
8742 wrong deallocation function is called on a pointer value, based on
8743 which function was used to allocate the pointer value.
8745 @item -Wno-analyzer-possible-null-argument
8746 @opindex Wanalyzer-possible-null-argument
8747 @opindex Wno-analyzer-possible-null-argument
8748 This warning requires @option{-fanalyzer}, which enables it; use
8749 @option{-Wno-analyzer-possible-null-argument} to disable it.
8751 This diagnostic warns for paths through the code in which a
8752 possibly-NULL value is passed to a function argument marked
8753 with @code{__attribute__((nonnull))} as requiring a non-NULL
8756 @item -Wno-analyzer-possible-null-dereference
8757 @opindex Wanalyzer-possible-null-dereference
8758 @opindex Wno-analyzer-possible-null-dereference
8759 This warning requires @option{-fanalyzer}, which enables it; use
8760 @option{-Wno-analyzer-possible-null-dereference} to disable it.
8762 This diagnostic warns for paths through the code in which a
8763 possibly-NULL value is dereferenced.
8765 @item -Wno-analyzer-null-argument
8766 @opindex Wanalyzer-null-argument
8767 @opindex Wno-analyzer-null-argument
8768 This warning requires @option{-fanalyzer}, which enables it; use
8769 @option{-Wno-analyzer-null-argument} to disable it.
8771 This diagnostic warns for paths through the code in which a
8772 value known to be NULL is passed to a function argument marked
8773 with @code{__attribute__((nonnull))} as requiring a non-NULL
8776 @item -Wno-analyzer-null-dereference
8777 @opindex Wanalyzer-null-dereference
8778 @opindex Wno-analyzer-null-dereference
8779 This warning requires @option{-fanalyzer}, which enables it; use
8780 @option{-Wno-analyzer-null-dereference} to disable it.
8782 This diagnostic warns for paths through the code in which a
8783 value known to be NULL is dereferenced.
8785 @item -Wno-analyzer-stale-setjmp-buffer
8786 @opindex Wanalyzer-stale-setjmp-buffer
8787 @opindex Wno-analyzer-stale-setjmp-buffer
8788 This warning requires @option{-fanalyzer}, which enables it; use
8789 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
8791 This diagnostic warns for paths through the code in which
8792 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
8793 to a @code{setjmp} call in a function that has returned.
8795 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
8796 location, it records the stack frame. The stack frame becomes invalid
8797 when the function containing the @code{setjmp} call returns. Attempting
8798 to rewind to it via @code{longjmp} would reference a stack frame that
8799 no longer exists, and likely lead to a crash (or worse).
8801 @item -Wno-analyzer-tainted-array-index
8802 @opindex Wanalyzer-tainted-array-index
8803 @opindex Wno-analyzer-tainted-array-index
8804 This warning requires both @option{-fanalyzer} and
8805 @option{-fanalyzer-checker=taint} to enable it;
8806 use @option{-Wno-analyzer-tainted-array-index} to disable it.
8808 This diagnostic warns for paths through the code in which a value
8809 that could be under an attacker's control is used as the index
8810 of an array access without being sanitized.
8812 @item -Wno-analyzer-unsafe-call-within-signal-handler
8813 @opindex Wanalyzer-unsafe-call-within-signal-handler
8814 @opindex Wno-analyzer-unsafe-call-within-signal-handler
8815 This warning requires @option{-fanalyzer}, which enables it; use
8816 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
8818 This diagnostic warns for paths through the code in which a
8819 function known to be async-signal-unsafe (such as @code{fprintf}) is
8820 called from a signal handler.
8822 @item -Wno-analyzer-use-after-free
8823 @opindex Wanalyzer-use-after-free
8824 @opindex Wno-analyzer-use-after-free
8825 This warning requires @option{-fanalyzer}, which enables it; use
8826 @option{-Wno-analyzer-use-after-free} to disable it.
8828 This diagnostic warns for paths through the code in which a
8829 pointer is used after @code{free} is called on it.
8831 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8832 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
8833 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
8834 This warning requires @option{-fanalyzer}, which enables it; use
8835 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
8838 This diagnostic warns for paths through the code in which a pointer
8839 is dereferenced that points to a variable in a stale stack frame.
8843 Pertinent parameters for controlling the exploration are:
8844 @option{--param analyzer-bb-explosion-factor=@var{value}},
8845 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
8846 @option{--param analyzer-max-recursion-depth=@var{value}}, and
8847 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
8849 The following options control the analyzer.
8853 @item -fanalyzer-call-summaries
8854 @opindex fanalyzer-call-summaries
8855 @opindex fno-analyzer-call-summaries
8856 Simplify interprocedural analysis by computing the effect of certain calls,
8857 rather than exploring all paths through the function from callsite to each
8860 If enabled, call summaries are only used for functions with more than one
8861 call site, and that are sufficiently complicated (as per
8862 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
8864 @item -fanalyzer-checker=@var{name}
8865 @opindex fanalyzer-checker
8866 Restrict the analyzer to run just the named checker, and enable it.
8868 Some checkers are disabled by default (even with @option{-fanalyzer}),
8869 such as the @code{taint} checker that implements
8870 @option{-Wanalyzer-tainted-array-index}, and this option is required
8873 @item -fanalyzer-fine-grained
8874 @opindex fanalyzer-fine-grained
8875 @opindex fno-analyzer-fine-grained
8876 This option is intended for analyzer developers.
8878 Internally the analyzer builds an ``exploded graph'' that combines
8879 control flow graphs with data flow information.
8881 By default, an edge in this graph can contain the effects of a run
8882 of multiple statements within a basic block. With
8883 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
8885 @item -fanalyzer-show-duplicate-count
8886 @opindex fanalyzer-show-duplicate-count
8887 @opindex fno-analyzer-show-duplicate-count
8888 This option is intended for analyzer developers: if multiple diagnostics
8889 have been detected as being duplicates of each other, it emits a note when
8890 reporting the best diagnostic, giving the number of additional diagnostics
8891 that were suppressed by the deduplication logic.
8893 @item -fno-analyzer-state-merge
8894 @opindex fanalyzer-state-merge
8895 @opindex fno-analyzer-state-merge
8896 This option is intended for analyzer developers.
8898 By default the analyzer attempts to simplify analysis by merging
8899 sufficiently similar states at each program point as it builds its
8900 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
8901 merging can be suppressed, for debugging state-handling issues.
8903 @item -fno-analyzer-state-purge
8904 @opindex fanalyzer-state-purge
8905 @opindex fno-analyzer-state-purge
8906 This option is intended for analyzer developers.
8908 By default the analyzer attempts to simplify analysis by purging
8909 aspects of state at a program point that appear to no longer be relevant
8910 e.g. the values of locals that aren't accessed later in the function
8911 and which aren't relevant to leak analysis.
8913 With @option{-fno-analyzer-state-purge} this purging of state can
8914 be suppressed, for debugging state-handling issues.
8916 @item -fanalyzer-transitivity
8917 @opindex fanalyzer-transitivity
8918 @opindex fno-analyzer-transitivity
8919 This option enables transitivity of constraints within the analyzer.
8921 @item -fanalyzer-verbose-edges
8922 This option is intended for analyzer developers. It enables more
8923 verbose, lower-level detail in the descriptions of control flow
8924 within diagnostic paths.
8926 @item -fanalyzer-verbose-state-changes
8927 This option is intended for analyzer developers. It enables more
8928 verbose, lower-level detail in the descriptions of events relating
8929 to state machines within diagnostic paths.
8931 @item -fanalyzer-verbosity=@var{level}
8932 This option controls the complexity of the control flow paths that are
8933 emitted for analyzer diagnostics.
8935 The @var{level} can be one of:
8939 At this level, interprocedural call and return events are displayed,
8940 along with the most pertinent state-change events relating to
8941 a diagnostic. For example, for a double-@code{free} diagnostic,
8942 both calls to @code{free} will be shown.
8945 As per the previous level, but also show events for the entry
8949 As per the previous level, but also show events relating to
8950 control flow that are significant to triggering the issue
8951 (e.g. ``true path taken'' at a conditional).
8953 This level is the default.
8956 As per the previous level, but show all control flow events, not
8957 just significant ones.
8960 This level is intended for analyzer developers; it adds various
8961 other events intended for debugging the analyzer.
8965 @item -fdump-analyzer
8966 @opindex fdump-analyzer
8967 Dump internal details about what the analyzer is doing to
8968 @file{@var{file}.analyzer.txt}.
8969 This option is overridden by @option{-fdump-analyzer-stderr}.
8971 @item -fdump-analyzer-stderr
8972 @opindex fdump-analyzer-stderr
8973 Dump internal details about what the analyzer is doing to stderr.
8974 This option overrides @option{-fdump-analyzer}.
8976 @item -fdump-analyzer-callgraph
8977 @opindex fdump-analyzer-callgraph
8978 Dump a representation of the call graph suitable for viewing with
8979 GraphViz to @file{@var{file}.callgraph.dot}.
8981 @item -fdump-analyzer-exploded-graph
8982 @opindex fdump-analyzer-exploded-graph
8983 Dump a representation of the ``exploded graph'' suitable for viewing with
8984 GraphViz to @file{@var{file}.eg.dot}.
8985 Nodes are color-coded based on state-machine states to emphasize
8988 @item -fdump-analyzer-exploded-nodes
8989 @opindex dump-analyzer-exploded-nodes
8990 Emit diagnostics showing where nodes in the ``exploded graph'' are
8991 in relation to the program source.
8993 @item -fdump-analyzer-exploded-nodes-2
8994 @opindex dump-analyzer-exploded-nodes-2
8995 Dump a textual representation of the ``exploded graph'' to
8996 @file{@var{file}.eg.txt}.
8998 @item -fdump-analyzer-exploded-nodes-3
8999 @opindex dump-analyzer-exploded-nodes-3
9000 Dump a textual representation of the ``exploded graph'' to
9001 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
9002 This is typically a large number of dump files.
9004 @item -fdump-analyzer-state-purge
9005 @opindex fdump-analyzer-state-purge
9006 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
9007 ``supergraph'' suitable for viewing with GraphViz, but annotate the
9008 graph with information on what state will be purged at each node.
9009 The graph is written to @file{@var{file}.state-purge.dot}.
9011 @item -fdump-analyzer-supergraph
9012 @opindex fdump-analyzer-supergraph
9013 Dump representations of the ``supergraph'' suitable for viewing with
9014 GraphViz to @file{@var{file}.supergraph.dot} and to
9015 @file{@var{file}.supergraph-eg.dot}. These show all of the
9016 control flow graphs in the program, with interprocedural edges for
9017 calls and returns. The second dump contains annotations showing nodes
9018 in the ``exploded graph'' and diagnostics associated with them.
9022 @node Debugging Options
9023 @section Options for Debugging Your Program
9024 @cindex options, debugging
9025 @cindex debugging information options
9027 To tell GCC to emit extra information for use by a debugger, in almost
9028 all cases you need only to add @option{-g} to your other options.
9030 GCC allows you to use @option{-g} with
9031 @option{-O}. The shortcuts taken by optimized code may occasionally
9032 be surprising: some variables you declared may not exist
9033 at all; flow of control may briefly move where you did not expect it;
9034 some statements may not be executed because they compute constant
9035 results or their values are already at hand; some statements may
9036 execute in different places because they have been moved out of loops.
9037 Nevertheless it is possible to debug optimized output. This makes
9038 it reasonable to use the optimizer for programs that might have bugs.
9040 If you are not using some other optimization option, consider
9041 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
9042 With no @option{-O} option at all, some compiler passes that collect
9043 information useful for debugging do not run at all, so that
9044 @option{-Og} may result in a better debugging experience.
9049 Produce debugging information in the operating system's native format
9050 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
9053 On most systems that use stabs format, @option{-g} enables use of extra
9054 debugging information that only GDB can use; this extra information
9055 makes debugging work better in GDB but probably makes other debuggers
9057 refuse to read the program. If you want to control for certain whether
9058 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
9059 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
9063 Produce debugging information for use by GDB@. This means to use the
9064 most expressive format available (DWARF, stabs, or the native format
9065 if neither of those are supported), including GDB extensions if at all
9069 @itemx -gdwarf-@var{version}
9071 Produce debugging information in DWARF format (if that is supported).
9072 The value of @var{version} may be either 2, 3, 4 or 5; the default version
9073 for most targets is 4. DWARF Version 5 is only experimental.
9075 Note that with DWARF Version 2, some ports require and always
9076 use some non-conflicting DWARF 3 extensions in the unwind tables.
9078 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
9079 for maximum benefit.
9081 GCC no longer supports DWARF Version 1, which is substantially
9082 different than Version 2 and later. For historical reasons, some
9083 other DWARF-related options such as
9084 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
9085 in their names, but apply to all currently-supported versions of DWARF.
9089 Produce debugging information in stabs format (if that is supported),
9090 without GDB extensions. This is the format used by DBX on most BSD
9091 systems. On MIPS, Alpha and System V Release 4 systems this option
9092 produces stabs debugging output that is not understood by DBX@.
9093 On System V Release 4 systems this option requires the GNU assembler.
9097 Produce debugging information in stabs format (if that is supported),
9098 using GNU extensions understood only by the GNU debugger (GDB)@. The
9099 use of these extensions is likely to make other debuggers crash or
9100 refuse to read the program.
9104 Produce debugging information in XCOFF format (if that is supported).
9105 This is the format used by the DBX debugger on IBM RS/6000 systems.
9109 Produce debugging information in XCOFF format (if that is supported),
9110 using GNU extensions understood only by the GNU debugger (GDB)@. The
9111 use of these extensions is likely to make other debuggers crash or
9112 refuse to read the program, and may cause assemblers other than the GNU
9113 assembler (GAS) to fail with an error.
9117 Produce debugging information in Alpha/VMS debug format (if that is
9118 supported). This is the format used by DEBUG on Alpha/VMS systems.
9121 @itemx -ggdb@var{level}
9122 @itemx -gstabs@var{level}
9123 @itemx -gxcoff@var{level}
9124 @itemx -gvms@var{level}
9125 Request debugging information and also use @var{level} to specify how
9126 much information. The default level is 2.
9128 Level 0 produces no debug information at all. Thus, @option{-g0} negates
9131 Level 1 produces minimal information, enough for making backtraces in
9132 parts of the program that you don't plan to debug. This includes
9133 descriptions of functions and external variables, and line number
9134 tables, but no information about local variables.
9136 Level 3 includes extra information, such as all the macro definitions
9137 present in the program. Some debuggers support macro expansion when
9138 you use @option{-g3}.
9140 If you use multiple @option{-g} options, with or without level numbers,
9141 the last such option is the one that is effective.
9143 @option{-gdwarf} does not accept a concatenated debug level, to avoid
9144 confusion with @option{-gdwarf-@var{level}}.
9145 Instead use an additional @option{-g@var{level}} option to change the
9146 debug level for DWARF.
9148 @item -fno-eliminate-unused-debug-symbols
9149 @opindex feliminate-unused-debug-symbols
9150 @opindex fno-eliminate-unused-debug-symbols
9151 By default, no debug information is produced for symbols that are not actually
9152 used. Use this option if you want debug information for all symbols.
9154 @item -femit-class-debug-always
9155 @opindex femit-class-debug-always
9156 Instead of emitting debugging information for a C++ class in only one
9157 object file, emit it in all object files using the class. This option
9158 should be used only with debuggers that are unable to handle the way GCC
9159 normally emits debugging information for classes because using this
9160 option increases the size of debugging information by as much as a
9163 @item -fno-merge-debug-strings
9164 @opindex fmerge-debug-strings
9165 @opindex fno-merge-debug-strings
9166 Direct the linker to not merge together strings in the debugging
9167 information that are identical in different object files. Merging is
9168 not supported by all assemblers or linkers. Merging decreases the size
9169 of the debug information in the output file at the cost of increasing
9170 link processing time. Merging is enabled by default.
9172 @item -fdebug-prefix-map=@var{old}=@var{new}
9173 @opindex fdebug-prefix-map
9174 When compiling files residing in directory @file{@var{old}}, record
9175 debugging information describing them as if the files resided in
9176 directory @file{@var{new}} instead. This can be used to replace a
9177 build-time path with an install-time path in the debug info. It can
9178 also be used to change an absolute path to a relative path by using
9179 @file{.} for @var{new}. This can give more reproducible builds, which
9180 are location independent, but may require an extra command to tell GDB
9181 where to find the source files. See also @option{-ffile-prefix-map}.
9183 @item -fvar-tracking
9184 @opindex fvar-tracking
9185 Run variable tracking pass. It computes where variables are stored at each
9186 position in code. Better debugging information is then generated
9187 (if the debugging information format supports this information).
9189 It is enabled by default when compiling with optimization (@option{-Os},
9190 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
9191 the debug info format supports it.
9193 @item -fvar-tracking-assignments
9194 @opindex fvar-tracking-assignments
9195 @opindex fno-var-tracking-assignments
9196 Annotate assignments to user variables early in the compilation and
9197 attempt to carry the annotations over throughout the compilation all the
9198 way to the end, in an attempt to improve debug information while
9199 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
9201 It can be enabled even if var-tracking is disabled, in which case
9202 annotations are created and maintained, but discarded at the end.
9203 By default, this flag is enabled together with @option{-fvar-tracking},
9204 except when selective scheduling is enabled.
9207 @opindex gsplit-dwarf
9208 If DWARF debugging information is enabled, separate as much debugging
9209 information as possible into a separate output file with the extension
9210 @file{.dwo}. This option allows the build system to avoid linking files with
9211 debug information. To be useful, this option requires a debugger capable of
9212 reading @file{.dwo} files.
9214 @item -gdescribe-dies
9215 @opindex gdescribe-dies
9216 Add description attributes to some DWARF DIEs that have no name attribute,
9217 such as artificial variables, external references and call site
9222 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
9224 @item -ggnu-pubnames
9225 @opindex ggnu-pubnames
9226 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
9227 suitable for conversion into a GDB@ index. This option is only useful
9228 with a linker that can produce GDB@ index version 7.
9230 @item -fdebug-types-section
9231 @opindex fdebug-types-section
9232 @opindex fno-debug-types-section
9233 When using DWARF Version 4 or higher, type DIEs can be put into
9234 their own @code{.debug_types} section instead of making them part of the
9235 @code{.debug_info} section. It is more efficient to put them in a separate
9236 comdat section since the linker can then remove duplicates.
9237 But not all DWARF consumers support @code{.debug_types} sections yet
9238 and on some objects @code{.debug_types} produces larger instead of smaller
9239 debugging information.
9241 @item -grecord-gcc-switches
9242 @itemx -gno-record-gcc-switches
9243 @opindex grecord-gcc-switches
9244 @opindex gno-record-gcc-switches
9245 This switch causes the command-line options used to invoke the
9246 compiler that may affect code generation to be appended to the
9247 DW_AT_producer attribute in DWARF debugging information. The options
9248 are concatenated with spaces separating them from each other and from
9249 the compiler version.
9250 It is enabled by default.
9251 See also @option{-frecord-gcc-switches} for another
9252 way of storing compiler options into the object file.
9254 @item -gstrict-dwarf
9255 @opindex gstrict-dwarf
9256 Disallow using extensions of later DWARF standard version than selected
9257 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
9258 DWARF extensions from later standard versions is allowed.
9260 @item -gno-strict-dwarf
9261 @opindex gno-strict-dwarf
9262 Allow using extensions of later DWARF standard version than selected with
9263 @option{-gdwarf-@var{version}}.
9265 @item -gas-loc-support
9266 @opindex gas-loc-support
9267 Inform the compiler that the assembler supports @code{.loc} directives.
9268 It may then use them for the assembler to generate DWARF2+ line number
9271 This is generally desirable, because assembler-generated line-number
9272 tables are a lot more compact than those the compiler can generate
9275 This option will be enabled by default if, at GCC configure time, the
9276 assembler was found to support such directives.
9278 @item -gno-as-loc-support
9279 @opindex gno-as-loc-support
9280 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
9281 line number tables are to be generated.
9283 @item -gas-locview-support
9284 @opindex gas-locview-support
9285 Inform the compiler that the assembler supports @code{view} assignment
9286 and reset assertion checking in @code{.loc} directives.
9288 This option will be enabled by default if, at GCC configure time, the
9289 assembler was found to support them.
9291 @item -gno-as-locview-support
9292 Force GCC to assign view numbers internally, if
9293 @option{-gvariable-location-views} are explicitly requested.
9296 @itemx -gno-column-info
9297 @opindex gcolumn-info
9298 @opindex gno-column-info
9299 Emit location column information into DWARF debugging information, rather
9300 than just file and line.
9301 This option is enabled by default.
9303 @item -gstatement-frontiers
9304 @itemx -gno-statement-frontiers
9305 @opindex gstatement-frontiers
9306 @opindex gno-statement-frontiers
9307 This option causes GCC to create markers in the internal representation
9308 at the beginning of statements, and to keep them roughly in place
9309 throughout compilation, using them to guide the output of @code{is_stmt}
9310 markers in the line number table. This is enabled by default when
9311 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
9312 @dots{}), and outputting DWARF 2 debug information at the normal level.
9314 @item -gvariable-location-views
9315 @itemx -gvariable-location-views=incompat5
9316 @itemx -gno-variable-location-views
9317 @opindex gvariable-location-views
9318 @opindex gvariable-location-views=incompat5
9319 @opindex gno-variable-location-views
9320 Augment variable location lists with progressive view numbers implied
9321 from the line number table. This enables debug information consumers to
9322 inspect state at certain points of the program, even if no instructions
9323 associated with the corresponding source locations are present at that
9324 point. If the assembler lacks support for view numbers in line number
9325 tables, this will cause the compiler to emit the line number table,
9326 which generally makes them somewhat less compact. The augmented line
9327 number tables and location lists are fully backward-compatible, so they
9328 can be consumed by debug information consumers that are not aware of
9329 these augmentations, but they won't derive any benefit from them either.
9331 This is enabled by default when outputting DWARF 2 debug information at
9332 the normal level, as long as there is assembler support,
9333 @option{-fvar-tracking-assignments} is enabled and
9334 @option{-gstrict-dwarf} is not. When assembler support is not
9335 available, this may still be enabled, but it will force GCC to output
9336 internal line number tables, and if
9337 @option{-ginternal-reset-location-views} is not enabled, that will most
9338 certainly lead to silently mismatching location views.
9340 There is a proposed representation for view numbers that is not backward
9341 compatible with the location list format introduced in DWARF 5, that can
9342 be enabled with @option{-gvariable-location-views=incompat5}. This
9343 option may be removed in the future, is only provided as a reference
9344 implementation of the proposed representation. Debug information
9345 consumers are not expected to support this extended format, and they
9346 would be rendered unable to decode location lists using it.
9348 @item -ginternal-reset-location-views
9349 @itemx -gno-internal-reset-location-views
9350 @opindex ginternal-reset-location-views
9351 @opindex gno-internal-reset-location-views
9352 Attempt to determine location views that can be omitted from location
9353 view lists. This requires the compiler to have very accurate insn
9354 length estimates, which isn't always the case, and it may cause
9355 incorrect view lists to be generated silently when using an assembler
9356 that does not support location view lists. The GNU assembler will flag
9357 any such error as a @code{view number mismatch}. This is only enabled
9358 on ports that define a reliable estimation function.
9360 @item -ginline-points
9361 @itemx -gno-inline-points
9362 @opindex ginline-points
9363 @opindex gno-inline-points
9364 Generate extended debug information for inlined functions. Location
9365 view tracking markers are inserted at inlined entry points, so that
9366 address and view numbers can be computed and output in debug
9367 information. This can be enabled independently of location views, in
9368 which case the view numbers won't be output, but it can only be enabled
9369 along with statement frontiers, and it is only enabled by default if
9370 location views are enabled.
9372 @item -gz@r{[}=@var{type}@r{]}
9374 Produce compressed debug sections in DWARF format, if that is supported.
9375 If @var{type} is not given, the default type depends on the capabilities
9376 of the assembler and linker used. @var{type} may be one of
9377 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
9378 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
9379 compression in traditional GNU format). If the linker doesn't support
9380 writing compressed debug sections, the option is rejected. Otherwise,
9381 if the assembler does not support them, @option{-gz} is silently ignored
9382 when producing object files.
9384 @item -femit-struct-debug-baseonly
9385 @opindex femit-struct-debug-baseonly
9386 Emit debug information for struct-like types
9387 only when the base name of the compilation source file
9388 matches the base name of file in which the struct is defined.
9390 This option substantially reduces the size of debugging information,
9391 but at significant potential loss in type information to the debugger.
9392 See @option{-femit-struct-debug-reduced} for a less aggressive option.
9393 See @option{-femit-struct-debug-detailed} for more detailed control.
9395 This option works only with DWARF debug output.
9397 @item -femit-struct-debug-reduced
9398 @opindex femit-struct-debug-reduced
9399 Emit debug information for struct-like types
9400 only when the base name of the compilation source file
9401 matches the base name of file in which the type is defined,
9402 unless the struct is a template or defined in a system header.
9404 This option significantly reduces the size of debugging information,
9405 with some potential loss in type information to the debugger.
9406 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
9407 See @option{-femit-struct-debug-detailed} for more detailed control.
9409 This option works only with DWARF debug output.
9411 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9412 @opindex femit-struct-debug-detailed
9413 Specify the struct-like types
9414 for which the compiler generates debug information.
9415 The intent is to reduce duplicate struct debug information
9416 between different object files within the same program.
9418 This option is a detailed version of
9419 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
9420 which serves for most needs.
9422 A specification has the syntax@*
9423 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
9425 The optional first word limits the specification to
9426 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
9427 A struct type is used directly when it is the type of a variable, member.
9428 Indirect uses arise through pointers to structs.
9429 That is, when use of an incomplete struct is valid, the use is indirect.
9431 @samp{struct one direct; struct two * indirect;}.
9433 The optional second word limits the specification to
9434 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
9435 Generic structs are a bit complicated to explain.
9436 For C++, these are non-explicit specializations of template classes,
9437 or non-template classes within the above.
9438 Other programming languages have generics,
9439 but @option{-femit-struct-debug-detailed} does not yet implement them.
9441 The third word specifies the source files for those
9442 structs for which the compiler should emit debug information.
9443 The values @samp{none} and @samp{any} have the normal meaning.
9444 The value @samp{base} means that
9445 the base of name of the file in which the type declaration appears
9446 must match the base of the name of the main compilation file.
9447 In practice, this means that when compiling @file{foo.c}, debug information
9448 is generated for types declared in that file and @file{foo.h},
9449 but not other header files.
9450 The value @samp{sys} means those types satisfying @samp{base}
9451 or declared in system or compiler headers.
9453 You may need to experiment to determine the best settings for your application.
9455 The default is @option{-femit-struct-debug-detailed=all}.
9457 This option works only with DWARF debug output.
9459 @item -fno-dwarf2-cfi-asm
9460 @opindex fdwarf2-cfi-asm
9461 @opindex fno-dwarf2-cfi-asm
9462 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
9463 instead of using GAS @code{.cfi_*} directives.
9465 @item -fno-eliminate-unused-debug-types
9466 @opindex feliminate-unused-debug-types
9467 @opindex fno-eliminate-unused-debug-types
9468 Normally, when producing DWARF output, GCC avoids producing debug symbol
9469 output for types that are nowhere used in the source file being compiled.
9470 Sometimes it is useful to have GCC emit debugging
9471 information for all types declared in a compilation
9472 unit, regardless of whether or not they are actually used
9473 in that compilation unit, for example
9474 if, in the debugger, you want to cast a value to a type that is
9475 not actually used in your program (but is declared). More often,
9476 however, this results in a significant amount of wasted space.
9479 @node Optimize Options
9480 @section Options That Control Optimization
9481 @cindex optimize options
9482 @cindex options, optimization
9484 These options control various sorts of optimizations.
9486 Without any optimization option, the compiler's goal is to reduce the
9487 cost of compilation and to make debugging produce the expected
9488 results. Statements are independent: if you stop the program with a
9489 breakpoint between statements, you can then assign a new value to any
9490 variable or change the program counter to any other statement in the
9491 function and get exactly the results you expect from the source
9494 Turning on optimization flags makes the compiler attempt to improve
9495 the performance and/or code size at the expense of compilation time
9496 and possibly the ability to debug the program.
9498 The compiler performs optimization based on the knowledge it has of the
9499 program. Compiling multiple files at once to a single output file mode allows
9500 the compiler to use information gained from all of the files when compiling
9503 Not all optimizations are controlled directly by a flag. Only
9504 optimizations that have a flag are listed in this section.
9506 Most optimizations are completely disabled at @option{-O0} or if an
9507 @option{-O} level is not set on the command line, even if individual
9508 optimization flags are specified. Similarly, @option{-Og} suppresses
9509 many optimization passes.
9511 Depending on the target and how GCC was configured, a slightly different
9512 set of optimizations may be enabled at each @option{-O} level than
9513 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
9514 to find out the exact set of optimizations that are enabled at each level.
9515 @xref{Overall Options}, for examples.
9522 Optimize. Optimizing compilation takes somewhat more time, and a lot
9523 more memory for a large function.
9525 With @option{-O}, the compiler tries to reduce code size and execution
9526 time, without performing any optimizations that take a great deal of
9529 @c Note that in addition to the default_options_table list in opts.c,
9530 @c several optimization flags default to true but control optimization
9531 @c passes that are explicitly disabled at -O0.
9533 @option{-O} turns on the following optimization flags:
9535 @c Please keep the following list alphabetized.
9536 @gccoptlist{-fauto-inc-dec @gol
9537 -fbranch-count-reg @gol
9538 -fcombine-stack-adjustments @gol
9540 -fcprop-registers @gol
9543 -fdelayed-branch @gol
9545 -fforward-propagate @gol
9546 -fguess-branch-probability @gol
9547 -fif-conversion @gol
9548 -fif-conversion2 @gol
9549 -finline-functions-called-once @gol
9551 -fipa-pure-const @gol
9552 -fipa-reference @gol
9553 -fipa-reference-addressable @gol
9554 -fmerge-constants @gol
9555 -fmove-loop-invariants @gol
9556 -fomit-frame-pointer @gol
9557 -freorder-blocks @gol
9559 -fshrink-wrap-separate @gol
9560 -fsplit-wide-types @gol
9566 -ftree-coalesce-vars @gol
9567 -ftree-copy-prop @gol
9569 -ftree-dominator-opts @gol
9571 -ftree-forwprop @gol
9575 -ftree-scev-cprop @gol
9584 Optimize even more. GCC performs nearly all supported optimizations
9585 that do not involve a space-speed tradeoff.
9586 As compared to @option{-O}, this option increases both compilation time
9587 and the performance of the generated code.
9589 @option{-O2} turns on all optimization flags specified by @option{-O}. It
9590 also turns on the following optimization flags:
9592 @c Please keep the following list alphabetized!
9593 @gccoptlist{-falign-functions -falign-jumps @gol
9594 -falign-labels -falign-loops @gol
9596 -fcode-hoisting @gol
9598 -fcse-follow-jumps -fcse-skip-blocks @gol
9599 -fdelete-null-pointer-checks @gol
9600 -fdevirtualize -fdevirtualize-speculatively @gol
9601 -fexpensive-optimizations @gol
9603 -fgcse -fgcse-lm @gol
9604 -fhoist-adjacent-loads @gol
9605 -finline-functions @gol
9606 -finline-small-functions @gol
9607 -findirect-inlining @gol
9608 -fipa-bit-cp -fipa-cp -fipa-icf @gol
9609 -fipa-ra -fipa-sra -fipa-vrp @gol
9610 -fisolate-erroneous-paths-dereference @gol
9612 -foptimize-sibling-calls @gol
9613 -foptimize-strlen @gol
9614 -fpartial-inlining @gol
9616 -freorder-blocks-algorithm=stc @gol
9617 -freorder-blocks-and-partition -freorder-functions @gol
9618 -frerun-cse-after-loop @gol
9619 -fschedule-insns -fschedule-insns2 @gol
9620 -fsched-interblock -fsched-spec @gol
9621 -fstore-merging @gol
9622 -fstrict-aliasing @gol
9624 -ftree-builtin-call-dce @gol
9626 -ftree-switch-conversion -ftree-tail-merge @gol
9629 Please note the warning under @option{-fgcse} about
9630 invoking @option{-O2} on programs that use computed gotos.
9634 Optimize yet more. @option{-O3} turns on all optimizations specified
9635 by @option{-O2} and also turns on the following optimization flags:
9637 @c Please keep the following list alphabetized!
9638 @gccoptlist{-fgcse-after-reload @gol
9640 -floop-interchange @gol
9641 -floop-unroll-and-jam @gol
9643 -fpredictive-commoning @gol
9646 -ftree-loop-distribution @gol
9647 -ftree-loop-vectorize @gol
9648 -ftree-partial-pre @gol
9649 -ftree-slp-vectorize @gol
9650 -funswitch-loops @gol
9651 -fvect-cost-model @gol
9652 -fvect-cost-model=dynamic @gol
9653 -fversion-loops-for-strides}
9657 Reduce compilation time and make debugging produce the expected
9658 results. This is the default.
9662 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
9663 except those that often increase code size:
9665 @gccoptlist{-falign-functions -falign-jumps @gol
9666 -falign-labels -falign-loops @gol
9667 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
9669 It also enables @option{-finline-functions}, causes the compiler to tune for
9670 code size rather than execution speed, and performs further optimizations
9671 designed to reduce code size.
9675 Disregard strict standards compliance. @option{-Ofast} enables all
9676 @option{-O3} optimizations. It also enables optimizations that are not
9677 valid for all standard-compliant programs.
9678 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
9679 and the Fortran-specific @option{-fstack-arrays}, unless
9680 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
9684 Optimize debugging experience. @option{-Og} should be the optimization
9685 level of choice for the standard edit-compile-debug cycle, offering
9686 a reasonable level of optimization while maintaining fast compilation
9687 and a good debugging experience. It is a better choice than @option{-O0}
9688 for producing debuggable code because some compiler passes
9689 that collect debug information are disabled at @option{-O0}.
9691 Like @option{-O0}, @option{-Og} completely disables a number of
9692 optimization passes so that individual options controlling them have
9693 no effect. Otherwise @option{-Og} enables all @option{-O1}
9694 optimization flags except for those that may interfere with debugging:
9696 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
9697 -fdse -fif-conversion -fif-conversion2 @gol
9698 -finline-functions-called-once @gol
9699 -fmove-loop-invariants -fssa-phiopt @gol
9700 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
9704 If you use multiple @option{-O} options, with or without level numbers,
9705 the last such option is the one that is effective.
9707 Options of the form @option{-f@var{flag}} specify machine-independent
9708 flags. Most flags have both positive and negative forms; the negative
9709 form of @option{-ffoo} is @option{-fno-foo}. In the table
9710 below, only one of the forms is listed---the one you typically
9711 use. You can figure out the other form by either removing @samp{no-}
9714 The following options control specific optimizations. They are either
9715 activated by @option{-O} options or are related to ones that are. You
9716 can use the following flags in the rare cases when ``fine-tuning'' of
9717 optimizations to be performed is desired.
9720 @item -fno-defer-pop
9721 @opindex fno-defer-pop
9723 For machines that must pop arguments after a function call, always pop
9724 the arguments as soon as each function returns.
9725 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
9726 this allows the compiler to let arguments accumulate on the stack for several
9727 function calls and pop them all at once.
9729 @item -fforward-propagate
9730 @opindex fforward-propagate
9731 Perform a forward propagation pass on RTL@. The pass tries to combine two
9732 instructions and checks if the result can be simplified. If loop unrolling
9733 is active, two passes are performed and the second is scheduled after
9736 This option is enabled by default at optimization levels @option{-O},
9737 @option{-O2}, @option{-O3}, @option{-Os}.
9739 @item -ffp-contract=@var{style}
9740 @opindex ffp-contract
9741 @option{-ffp-contract=off} disables floating-point expression contraction.
9742 @option{-ffp-contract=fast} enables floating-point expression contraction
9743 such as forming of fused multiply-add operations if the target has
9744 native support for them.
9745 @option{-ffp-contract=on} enables floating-point expression contraction
9746 if allowed by the language standard. This is currently not implemented
9747 and treated equal to @option{-ffp-contract=off}.
9749 The default is @option{-ffp-contract=fast}.
9751 @item -fomit-frame-pointer
9752 @opindex fomit-frame-pointer
9753 Omit the frame pointer in functions that don't need one. This avoids the
9754 instructions to save, set up and restore the frame pointer; on many targets
9755 it also makes an extra register available.
9757 On some targets this flag has no effect because the standard calling sequence
9758 always uses a frame pointer, so it cannot be omitted.
9760 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
9761 is used in all functions. Several targets always omit the frame pointer in
9764 Enabled by default at @option{-O} and higher.
9766 @item -foptimize-sibling-calls
9767 @opindex foptimize-sibling-calls
9768 Optimize sibling and tail recursive calls.
9770 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9772 @item -foptimize-strlen
9773 @opindex foptimize-strlen
9774 Optimize various standard C string functions (e.g.@: @code{strlen},
9775 @code{strchr} or @code{strcpy}) and
9776 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
9778 Enabled at levels @option{-O2}, @option{-O3}.
9783 Do not expand any functions inline apart from those marked with
9784 the @code{always_inline} attribute. This is the default when not
9787 Single functions can be exempted from inlining by marking them
9788 with the @code{noinline} attribute.
9790 @item -finline-small-functions
9791 @opindex finline-small-functions
9792 Integrate functions into their callers when their body is smaller than expected
9793 function call code (so overall size of program gets smaller). The compiler
9794 heuristically decides which functions are simple enough to be worth integrating
9795 in this way. This inlining applies to all functions, even those not declared
9798 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9800 @item -findirect-inlining
9801 @opindex findirect-inlining
9802 Inline also indirect calls that are discovered to be known at compile
9803 time thanks to previous inlining. This option has any effect only
9804 when inlining itself is turned on by the @option{-finline-functions}
9805 or @option{-finline-small-functions} options.
9807 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9809 @item -finline-functions
9810 @opindex finline-functions
9811 Consider all functions for inlining, even if they are not declared inline.
9812 The compiler heuristically decides which functions are worth integrating
9815 If all calls to a given function are integrated, and the function is
9816 declared @code{static}, then the function is normally not output as
9817 assembler code in its own right.
9819 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
9820 by @option{-fprofile-use} and @option{-fauto-profile}.
9822 @item -finline-functions-called-once
9823 @opindex finline-functions-called-once
9824 Consider all @code{static} functions called once for inlining into their
9825 caller even if they are not marked @code{inline}. If a call to a given
9826 function is integrated, then the function is not output as assembler code
9829 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
9830 but not @option{-Og}.
9832 @item -fearly-inlining
9833 @opindex fearly-inlining
9834 Inline functions marked by @code{always_inline} and functions whose body seems
9835 smaller than the function call overhead early before doing
9836 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
9837 makes profiling significantly cheaper and usually inlining faster on programs
9838 having large chains of nested wrapper functions.
9844 Perform interprocedural scalar replacement of aggregates, removal of
9845 unused parameters and replacement of parameters passed by reference
9846 by parameters passed by value.
9848 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
9850 @item -finline-limit=@var{n}
9851 @opindex finline-limit
9852 By default, GCC limits the size of functions that can be inlined. This flag
9853 allows coarse control of this limit. @var{n} is the size of functions that
9854 can be inlined in number of pseudo instructions.
9856 Inlining is actually controlled by a number of parameters, which may be
9857 specified individually by using @option{--param @var{name}=@var{value}}.
9858 The @option{-finline-limit=@var{n}} option sets some of these parameters
9862 @item max-inline-insns-single
9863 is set to @var{n}/2.
9864 @item max-inline-insns-auto
9865 is set to @var{n}/2.
9868 See below for a documentation of the individual
9869 parameters controlling inlining and for the defaults of these parameters.
9871 @emph{Note:} there may be no value to @option{-finline-limit} that results
9872 in default behavior.
9874 @emph{Note:} pseudo instruction represents, in this particular context, an
9875 abstract measurement of function's size. In no way does it represent a count
9876 of assembly instructions and as such its exact meaning might change from one
9877 release to an another.
9879 @item -fno-keep-inline-dllexport
9880 @opindex fno-keep-inline-dllexport
9881 @opindex fkeep-inline-dllexport
9882 This is a more fine-grained version of @option{-fkeep-inline-functions},
9883 which applies only to functions that are declared using the @code{dllexport}
9884 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
9887 @item -fkeep-inline-functions
9888 @opindex fkeep-inline-functions
9889 In C, emit @code{static} functions that are declared @code{inline}
9890 into the object file, even if the function has been inlined into all
9891 of its callers. This switch does not affect functions using the
9892 @code{extern inline} extension in GNU C90@. In C++, emit any and all
9893 inline functions into the object file.
9895 @item -fkeep-static-functions
9896 @opindex fkeep-static-functions
9897 Emit @code{static} functions into the object file, even if the function
9900 @item -fkeep-static-consts
9901 @opindex fkeep-static-consts
9902 Emit variables declared @code{static const} when optimization isn't turned
9903 on, even if the variables aren't referenced.
9905 GCC enables this option by default. If you want to force the compiler to
9906 check if a variable is referenced, regardless of whether or not
9907 optimization is turned on, use the @option{-fno-keep-static-consts} option.
9909 @item -fmerge-constants
9910 @opindex fmerge-constants
9911 Attempt to merge identical constants (string constants and floating-point
9912 constants) across compilation units.
9914 This option is the default for optimized compilation if the assembler and
9915 linker support it. Use @option{-fno-merge-constants} to inhibit this
9918 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9920 @item -fmerge-all-constants
9921 @opindex fmerge-all-constants
9922 Attempt to merge identical constants and identical variables.
9924 This option implies @option{-fmerge-constants}. In addition to
9925 @option{-fmerge-constants} this considers e.g.@: even constant initialized
9926 arrays or initialized constant variables with integral or floating-point
9927 types. Languages like C or C++ require each variable, including multiple
9928 instances of the same variable in recursive calls, to have distinct locations,
9929 so using this option results in non-conforming
9932 @item -fmodulo-sched
9933 @opindex fmodulo-sched
9934 Perform swing modulo scheduling immediately before the first scheduling
9935 pass. This pass looks at innermost loops and reorders their
9936 instructions by overlapping different iterations.
9938 @item -fmodulo-sched-allow-regmoves
9939 @opindex fmodulo-sched-allow-regmoves
9940 Perform more aggressive SMS-based modulo scheduling with register moves
9941 allowed. By setting this flag certain anti-dependences edges are
9942 deleted, which triggers the generation of reg-moves based on the
9943 life-range analysis. This option is effective only with
9944 @option{-fmodulo-sched} enabled.
9946 @item -fno-branch-count-reg
9947 @opindex fno-branch-count-reg
9948 @opindex fbranch-count-reg
9949 Disable the optimization pass that scans for opportunities to use
9950 ``decrement and branch'' instructions on a count register instead of
9951 instruction sequences that decrement a register, compare it against zero, and
9952 then branch based upon the result. This option is only meaningful on
9953 architectures that support such instructions, which include x86, PowerPC,
9954 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
9955 doesn't remove the decrement and branch instructions from the generated
9956 instruction stream introduced by other optimization passes.
9958 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
9959 except for @option{-Og}.
9961 @item -fno-function-cse
9962 @opindex fno-function-cse
9963 @opindex ffunction-cse
9964 Do not put function addresses in registers; make each instruction that
9965 calls a constant function contain the function's address explicitly.
9967 This option results in less efficient code, but some strange hacks
9968 that alter the assembler output may be confused by the optimizations
9969 performed when this option is not used.
9971 The default is @option{-ffunction-cse}
9973 @item -fno-zero-initialized-in-bss
9974 @opindex fno-zero-initialized-in-bss
9975 @opindex fzero-initialized-in-bss
9976 If the target supports a BSS section, GCC by default puts variables that
9977 are initialized to zero into BSS@. This can save space in the resulting
9980 This option turns off this behavior because some programs explicitly
9981 rely on variables going to the data section---e.g., so that the
9982 resulting executable can find the beginning of that section and/or make
9983 assumptions based on that.
9985 The default is @option{-fzero-initialized-in-bss}.
9987 @item -fthread-jumps
9988 @opindex fthread-jumps
9989 Perform optimizations that check to see if a jump branches to a
9990 location where another comparison subsumed by the first is found. If
9991 so, the first branch is redirected to either the destination of the
9992 second branch or a point immediately following it, depending on whether
9993 the condition is known to be true or false.
9995 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9997 @item -fsplit-wide-types
9998 @opindex fsplit-wide-types
9999 When using a type that occupies multiple registers, such as @code{long
10000 long} on a 32-bit system, split the registers apart and allocate them
10001 independently. This normally generates better code for those types,
10002 but may make debugging more difficult.
10004 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
10007 @item -fsplit-wide-types-early
10008 @opindex fsplit-wide-types-early
10009 Fully split wide types early, instead of very late.
10010 This option has no effect unless @option{-fsplit-wide-types} is turned on.
10012 This is the default on some targets.
10014 @item -fcse-follow-jumps
10015 @opindex fcse-follow-jumps
10016 In common subexpression elimination (CSE), scan through jump instructions
10017 when the target of the jump is not reached by any other path. For
10018 example, when CSE encounters an @code{if} statement with an
10019 @code{else} clause, CSE follows the jump when the condition
10022 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10024 @item -fcse-skip-blocks
10025 @opindex fcse-skip-blocks
10026 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
10027 follow jumps that conditionally skip over blocks. When CSE
10028 encounters a simple @code{if} statement with no else clause,
10029 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
10030 body of the @code{if}.
10032 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10034 @item -frerun-cse-after-loop
10035 @opindex frerun-cse-after-loop
10036 Re-run common subexpression elimination after loop optimizations are
10039 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10043 Perform a global common subexpression elimination pass.
10044 This pass also performs global constant and copy propagation.
10046 @emph{Note:} When compiling a program using computed gotos, a GCC
10047 extension, you may get better run-time performance if you disable
10048 the global common subexpression elimination pass by adding
10049 @option{-fno-gcse} to the command line.
10051 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10055 When @option{-fgcse-lm} is enabled, global common subexpression elimination
10056 attempts to move loads that are only killed by stores into themselves. This
10057 allows a loop containing a load/store sequence to be changed to a load outside
10058 the loop, and a copy/store within the loop.
10060 Enabled by default when @option{-fgcse} is enabled.
10064 When @option{-fgcse-sm} is enabled, a store motion pass is run after
10065 global common subexpression elimination. This pass attempts to move
10066 stores out of loops. When used in conjunction with @option{-fgcse-lm},
10067 loops containing a load/store sequence can be changed to a load before
10068 the loop and a store after the loop.
10070 Not enabled at any optimization level.
10074 When @option{-fgcse-las} is enabled, the global common subexpression
10075 elimination pass eliminates redundant loads that come after stores to the
10076 same memory location (both partial and full redundancies).
10078 Not enabled at any optimization level.
10080 @item -fgcse-after-reload
10081 @opindex fgcse-after-reload
10082 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
10083 pass is performed after reload. The purpose of this pass is to clean up
10084 redundant spilling.
10086 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10088 @item -faggressive-loop-optimizations
10089 @opindex faggressive-loop-optimizations
10090 This option tells the loop optimizer to use language constraints to
10091 derive bounds for the number of iterations of a loop. This assumes that
10092 loop code does not invoke undefined behavior by for example causing signed
10093 integer overflows or out-of-bound array accesses. The bounds for the
10094 number of iterations of a loop are used to guide loop unrolling and peeling
10095 and loop exit test optimizations.
10096 This option is enabled by default.
10098 @item -funconstrained-commons
10099 @opindex funconstrained-commons
10100 This option tells the compiler that variables declared in common blocks
10101 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
10102 prevents certain optimizations that depend on knowing the array bounds.
10104 @item -fcrossjumping
10105 @opindex fcrossjumping
10106 Perform cross-jumping transformation.
10107 This transformation unifies equivalent code and saves code size. The
10108 resulting code may or may not perform better than without cross-jumping.
10110 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10112 @item -fauto-inc-dec
10113 @opindex fauto-inc-dec
10114 Combine increments or decrements of addresses with memory accesses.
10115 This pass is always skipped on architectures that do not have
10116 instructions to support this. Enabled by default at @option{-O} and
10117 higher on architectures that support this.
10121 Perform dead code elimination (DCE) on RTL@.
10122 Enabled by default at @option{-O} and higher.
10126 Perform dead store elimination (DSE) on RTL@.
10127 Enabled by default at @option{-O} and higher.
10129 @item -fif-conversion
10130 @opindex fif-conversion
10131 Attempt to transform conditional jumps into branch-less equivalents. This
10132 includes use of conditional moves, min, max, set flags and abs instructions, and
10133 some tricks doable by standard arithmetics. The use of conditional execution
10134 on chips where it is available is controlled by @option{-fif-conversion2}.
10136 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
10137 not with @option{-Og}.
10139 @item -fif-conversion2
10140 @opindex fif-conversion2
10141 Use conditional execution (where available) to transform conditional jumps into
10142 branch-less equivalents.
10144 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
10145 not with @option{-Og}.
10147 @item -fdeclone-ctor-dtor
10148 @opindex fdeclone-ctor-dtor
10149 The C++ ABI requires multiple entry points for constructors and
10150 destructors: one for a base subobject, one for a complete object, and
10151 one for a virtual destructor that calls operator delete afterwards.
10152 For a hierarchy with virtual bases, the base and complete variants are
10153 clones, which means two copies of the function. With this option, the
10154 base and complete variants are changed to be thunks that call a common
10157 Enabled by @option{-Os}.
10159 @item -fdelete-null-pointer-checks
10160 @opindex fdelete-null-pointer-checks
10161 Assume that programs cannot safely dereference null pointers, and that
10162 no code or data element resides at address zero.
10163 This option enables simple constant
10164 folding optimizations at all optimization levels. In addition, other
10165 optimization passes in GCC use this flag to control global dataflow
10166 analyses that eliminate useless checks for null pointers; these assume
10167 that a memory access to address zero always results in a trap, so
10168 that if a pointer is checked after it has already been dereferenced,
10171 Note however that in some environments this assumption is not true.
10172 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
10173 for programs that depend on that behavior.
10175 This option is enabled by default on most targets. On Nios II ELF, it
10176 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
10178 Passes that use the dataflow information
10179 are enabled independently at different optimization levels.
10181 @item -fdevirtualize
10182 @opindex fdevirtualize
10183 Attempt to convert calls to virtual functions to direct calls. This
10184 is done both within a procedure and interprocedurally as part of
10185 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
10186 propagation (@option{-fipa-cp}).
10187 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10189 @item -fdevirtualize-speculatively
10190 @opindex fdevirtualize-speculatively
10191 Attempt to convert calls to virtual functions to speculative direct calls.
10192 Based on the analysis of the type inheritance graph, determine for a given call
10193 the set of likely targets. If the set is small, preferably of size 1, change
10194 the call into a conditional deciding between direct and indirect calls. The
10195 speculative calls enable more optimizations, such as inlining. When they seem
10196 useless after further optimization, they are converted back into original form.
10198 @item -fdevirtualize-at-ltrans
10199 @opindex fdevirtualize-at-ltrans
10200 Stream extra information needed for aggressive devirtualization when running
10201 the link-time optimizer in local transformation mode.
10202 This option enables more devirtualization but
10203 significantly increases the size of streamed data. For this reason it is
10204 disabled by default.
10206 @item -fexpensive-optimizations
10207 @opindex fexpensive-optimizations
10208 Perform a number of minor optimizations that are relatively expensive.
10210 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10214 Attempt to remove redundant extension instructions. This is especially
10215 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
10216 registers after writing to their lower 32-bit half.
10218 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
10219 @option{-O3}, @option{-Os}.
10221 @item -fno-lifetime-dse
10222 @opindex fno-lifetime-dse
10223 @opindex flifetime-dse
10224 In C++ the value of an object is only affected by changes within its
10225 lifetime: when the constructor begins, the object has an indeterminate
10226 value, and any changes during the lifetime of the object are dead when
10227 the object is destroyed. Normally dead store elimination will take
10228 advantage of this; if your code relies on the value of the object
10229 storage persisting beyond the lifetime of the object, you can use this
10230 flag to disable this optimization. To preserve stores before the
10231 constructor starts (e.g.@: because your operator new clears the object
10232 storage) but still treat the object as dead after the destructor, you
10233 can use @option{-flifetime-dse=1}. The default behavior can be
10234 explicitly selected with @option{-flifetime-dse=2}.
10235 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
10237 @item -flive-range-shrinkage
10238 @opindex flive-range-shrinkage
10239 Attempt to decrease register pressure through register live range
10240 shrinkage. This is helpful for fast processors with small or moderate
10241 size register sets.
10243 @item -fira-algorithm=@var{algorithm}
10244 @opindex fira-algorithm
10245 Use the specified coloring algorithm for the integrated register
10246 allocator. The @var{algorithm} argument can be @samp{priority}, which
10247 specifies Chow's priority coloring, or @samp{CB}, which specifies
10248 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
10249 for all architectures, but for those targets that do support it, it is
10250 the default because it generates better code.
10252 @item -fira-region=@var{region}
10253 @opindex fira-region
10254 Use specified regions for the integrated register allocator. The
10255 @var{region} argument should be one of the following:
10260 Use all loops as register allocation regions.
10261 This can give the best results for machines with a small and/or
10262 irregular register set.
10265 Use all loops except for loops with small register pressure
10266 as the regions. This value usually gives
10267 the best results in most cases and for most architectures,
10268 and is enabled by default when compiling with optimization for speed
10269 (@option{-O}, @option{-O2}, @dots{}).
10272 Use all functions as a single region.
10273 This typically results in the smallest code size, and is enabled by default for
10274 @option{-Os} or @option{-O0}.
10278 @item -fira-hoist-pressure
10279 @opindex fira-hoist-pressure
10280 Use IRA to evaluate register pressure in the code hoisting pass for
10281 decisions to hoist expressions. This option usually results in smaller
10282 code, but it can slow the compiler down.
10284 This option is enabled at level @option{-Os} for all targets.
10286 @item -fira-loop-pressure
10287 @opindex fira-loop-pressure
10288 Use IRA to evaluate register pressure in loops for decisions to move
10289 loop invariants. This option usually results in generation
10290 of faster and smaller code on machines with large register files (>= 32
10291 registers), but it can slow the compiler down.
10293 This option is enabled at level @option{-O3} for some targets.
10295 @item -fno-ira-share-save-slots
10296 @opindex fno-ira-share-save-slots
10297 @opindex fira-share-save-slots
10298 Disable sharing of stack slots used for saving call-used hard
10299 registers living through a call. Each hard register gets a
10300 separate stack slot, and as a result function stack frames are
10303 @item -fno-ira-share-spill-slots
10304 @opindex fno-ira-share-spill-slots
10305 @opindex fira-share-spill-slots
10306 Disable sharing of stack slots allocated for pseudo-registers. Each
10307 pseudo-register that does not get a hard register gets a separate
10308 stack slot, and as a result function stack frames are larger.
10311 @opindex flra-remat
10312 Enable CFG-sensitive rematerialization in LRA. Instead of loading
10313 values of spilled pseudos, LRA tries to rematerialize (recalculate)
10314 values if it is profitable.
10316 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10318 @item -fdelayed-branch
10319 @opindex fdelayed-branch
10320 If supported for the target machine, attempt to reorder instructions
10321 to exploit instruction slots available after delayed branch
10324 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
10325 but not at @option{-Og}.
10327 @item -fschedule-insns
10328 @opindex fschedule-insns
10329 If supported for the target machine, attempt to reorder instructions to
10330 eliminate execution stalls due to required data being unavailable. This
10331 helps machines that have slow floating point or memory load instructions
10332 by allowing other instructions to be issued until the result of the load
10333 or floating-point instruction is required.
10335 Enabled at levels @option{-O2}, @option{-O3}.
10337 @item -fschedule-insns2
10338 @opindex fschedule-insns2
10339 Similar to @option{-fschedule-insns}, but requests an additional pass of
10340 instruction scheduling after register allocation has been done. This is
10341 especially useful on machines with a relatively small number of
10342 registers and where memory load instructions take more than one cycle.
10344 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10346 @item -fno-sched-interblock
10347 @opindex fno-sched-interblock
10348 @opindex fsched-interblock
10349 Disable instruction scheduling across basic blocks, which
10350 is normally enabled when scheduling before register allocation, i.e.@:
10351 with @option{-fschedule-insns} or at @option{-O2} or higher.
10353 @item -fno-sched-spec
10354 @opindex fno-sched-spec
10355 @opindex fsched-spec
10356 Disable speculative motion of non-load instructions, which
10357 is normally enabled when scheduling before register allocation, i.e.@:
10358 with @option{-fschedule-insns} or at @option{-O2} or higher.
10360 @item -fsched-pressure
10361 @opindex fsched-pressure
10362 Enable register pressure sensitive insn scheduling before register
10363 allocation. This only makes sense when scheduling before register
10364 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
10365 @option{-O2} or higher. Usage of this option can improve the
10366 generated code and decrease its size by preventing register pressure
10367 increase above the number of available hard registers and subsequent
10368 spills in register allocation.
10370 @item -fsched-spec-load
10371 @opindex fsched-spec-load
10372 Allow speculative motion of some load instructions. This only makes
10373 sense when scheduling before register allocation, i.e.@: with
10374 @option{-fschedule-insns} or at @option{-O2} or higher.
10376 @item -fsched-spec-load-dangerous
10377 @opindex fsched-spec-load-dangerous
10378 Allow speculative motion of more load instructions. This only makes
10379 sense when scheduling before register allocation, i.e.@: with
10380 @option{-fschedule-insns} or at @option{-O2} or higher.
10382 @item -fsched-stalled-insns
10383 @itemx -fsched-stalled-insns=@var{n}
10384 @opindex fsched-stalled-insns
10385 Define how many insns (if any) can be moved prematurely from the queue
10386 of stalled insns into the ready list during the second scheduling pass.
10387 @option{-fno-sched-stalled-insns} means that no insns are moved
10388 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
10389 on how many queued insns can be moved prematurely.
10390 @option{-fsched-stalled-insns} without a value is equivalent to
10391 @option{-fsched-stalled-insns=1}.
10393 @item -fsched-stalled-insns-dep
10394 @itemx -fsched-stalled-insns-dep=@var{n}
10395 @opindex fsched-stalled-insns-dep
10396 Define how many insn groups (cycles) are examined for a dependency
10397 on a stalled insn that is a candidate for premature removal from the queue
10398 of stalled insns. This has an effect only during the second scheduling pass,
10399 and only if @option{-fsched-stalled-insns} is used.
10400 @option{-fno-sched-stalled-insns-dep} is equivalent to
10401 @option{-fsched-stalled-insns-dep=0}.
10402 @option{-fsched-stalled-insns-dep} without a value is equivalent to
10403 @option{-fsched-stalled-insns-dep=1}.
10405 @item -fsched2-use-superblocks
10406 @opindex fsched2-use-superblocks
10407 When scheduling after register allocation, use superblock scheduling.
10408 This allows motion across basic block boundaries,
10409 resulting in faster schedules. This option is experimental, as not all machine
10410 descriptions used by GCC model the CPU closely enough to avoid unreliable
10411 results from the algorithm.
10413 This only makes sense when scheduling after register allocation, i.e.@: with
10414 @option{-fschedule-insns2} or at @option{-O2} or higher.
10416 @item -fsched-group-heuristic
10417 @opindex fsched-group-heuristic
10418 Enable the group heuristic in the scheduler. This heuristic favors
10419 the instruction that belongs to a schedule group. This is enabled
10420 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10421 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10423 @item -fsched-critical-path-heuristic
10424 @opindex fsched-critical-path-heuristic
10425 Enable the critical-path heuristic in the scheduler. This heuristic favors
10426 instructions on the critical path. This is enabled by default when
10427 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10428 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10430 @item -fsched-spec-insn-heuristic
10431 @opindex fsched-spec-insn-heuristic
10432 Enable the speculative instruction heuristic in the scheduler. This
10433 heuristic favors speculative instructions with greater dependency weakness.
10434 This is enabled by default when scheduling is enabled, i.e.@:
10435 with @option{-fschedule-insns} or @option{-fschedule-insns2}
10436 or at @option{-O2} or higher.
10438 @item -fsched-rank-heuristic
10439 @opindex fsched-rank-heuristic
10440 Enable the rank heuristic in the scheduler. This heuristic favors
10441 the instruction belonging to a basic block with greater size or frequency.
10442 This is enabled by default when scheduling is enabled, i.e.@:
10443 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10444 at @option{-O2} or higher.
10446 @item -fsched-last-insn-heuristic
10447 @opindex fsched-last-insn-heuristic
10448 Enable the last-instruction heuristic in the scheduler. This heuristic
10449 favors the instruction that is less dependent on the last instruction
10450 scheduled. This is enabled by default when scheduling is enabled,
10451 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10452 at @option{-O2} or higher.
10454 @item -fsched-dep-count-heuristic
10455 @opindex fsched-dep-count-heuristic
10456 Enable the dependent-count heuristic in the scheduler. This heuristic
10457 favors the instruction that has more instructions depending on it.
10458 This is enabled by default when scheduling is enabled, i.e.@:
10459 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10460 at @option{-O2} or higher.
10462 @item -freschedule-modulo-scheduled-loops
10463 @opindex freschedule-modulo-scheduled-loops
10464 Modulo scheduling is performed before traditional scheduling. If a loop
10465 is modulo scheduled, later scheduling passes may change its schedule.
10466 Use this option to control that behavior.
10468 @item -fselective-scheduling
10469 @opindex fselective-scheduling
10470 Schedule instructions using selective scheduling algorithm. Selective
10471 scheduling runs instead of the first scheduler pass.
10473 @item -fselective-scheduling2
10474 @opindex fselective-scheduling2
10475 Schedule instructions using selective scheduling algorithm. Selective
10476 scheduling runs instead of the second scheduler pass.
10478 @item -fsel-sched-pipelining
10479 @opindex fsel-sched-pipelining
10480 Enable software pipelining of innermost loops during selective scheduling.
10481 This option has no effect unless one of @option{-fselective-scheduling} or
10482 @option{-fselective-scheduling2} is turned on.
10484 @item -fsel-sched-pipelining-outer-loops
10485 @opindex fsel-sched-pipelining-outer-loops
10486 When pipelining loops during selective scheduling, also pipeline outer loops.
10487 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
10489 @item -fsemantic-interposition
10490 @opindex fsemantic-interposition
10491 Some object formats, like ELF, allow interposing of symbols by the
10493 This means that for symbols exported from the DSO, the compiler cannot perform
10494 interprocedural propagation, inlining and other optimizations in anticipation
10495 that the function or variable in question may change. While this feature is
10496 useful, for example, to rewrite memory allocation functions by a debugging
10497 implementation, it is expensive in the terms of code quality.
10498 With @option{-fno-semantic-interposition} the compiler assumes that
10499 if interposition happens for functions the overwriting function will have
10500 precisely the same semantics (and side effects).
10501 Similarly if interposition happens
10502 for variables, the constructor of the variable will be the same. The flag
10503 has no effect for functions explicitly declared inline
10504 (where it is never allowed for interposition to change semantics)
10505 and for symbols explicitly declared weak.
10507 @item -fshrink-wrap
10508 @opindex fshrink-wrap
10509 Emit function prologues only before parts of the function that need it,
10510 rather than at the top of the function. This flag is enabled by default at
10511 @option{-O} and higher.
10513 @item -fshrink-wrap-separate
10514 @opindex fshrink-wrap-separate
10515 Shrink-wrap separate parts of the prologue and epilogue separately, so that
10516 those parts are only executed when needed.
10517 This option is on by default, but has no effect unless @option{-fshrink-wrap}
10518 is also turned on and the target supports this.
10520 @item -fcaller-saves
10521 @opindex fcaller-saves
10522 Enable allocation of values to registers that are clobbered by
10523 function calls, by emitting extra instructions to save and restore the
10524 registers around such calls. Such allocation is done only when it
10525 seems to result in better code.
10527 This option is always enabled by default on certain machines, usually
10528 those which have no call-preserved registers to use instead.
10530 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10532 @item -fcombine-stack-adjustments
10533 @opindex fcombine-stack-adjustments
10534 Tracks stack adjustments (pushes and pops) and stack memory references
10535 and then tries to find ways to combine them.
10537 Enabled by default at @option{-O1} and higher.
10541 Use caller save registers for allocation if those registers are not used by
10542 any called function. In that case it is not necessary to save and restore
10543 them around calls. This is only possible if called functions are part of
10544 same compilation unit as current function and they are compiled before it.
10546 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
10547 is disabled if generated code will be instrumented for profiling
10548 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
10549 exactly (this happens on targets that do not expose prologues
10550 and epilogues in RTL).
10552 @item -fconserve-stack
10553 @opindex fconserve-stack
10554 Attempt to minimize stack usage. The compiler attempts to use less
10555 stack space, even if that makes the program slower. This option
10556 implies setting the @option{large-stack-frame} parameter to 100
10557 and the @option{large-stack-frame-growth} parameter to 400.
10559 @item -ftree-reassoc
10560 @opindex ftree-reassoc
10561 Perform reassociation on trees. This flag is enabled by default
10562 at @option{-O} and higher.
10564 @item -fcode-hoisting
10565 @opindex fcode-hoisting
10566 Perform code hoisting. Code hoisting tries to move the
10567 evaluation of expressions executed on all paths to the function exit
10568 as early as possible. This is especially useful as a code size
10569 optimization, but it often helps for code speed as well.
10570 This flag is enabled by default at @option{-O2} and higher.
10574 Perform partial redundancy elimination (PRE) on trees. This flag is
10575 enabled by default at @option{-O2} and @option{-O3}.
10577 @item -ftree-partial-pre
10578 @opindex ftree-partial-pre
10579 Make partial redundancy elimination (PRE) more aggressive. This flag is
10580 enabled by default at @option{-O3}.
10582 @item -ftree-forwprop
10583 @opindex ftree-forwprop
10584 Perform forward propagation on trees. This flag is enabled by default
10585 at @option{-O} and higher.
10589 Perform full redundancy elimination (FRE) on trees. The difference
10590 between FRE and PRE is that FRE only considers expressions
10591 that are computed on all paths leading to the redundant computation.
10592 This analysis is faster than PRE, though it exposes fewer redundancies.
10593 This flag is enabled by default at @option{-O} and higher.
10595 @item -ftree-phiprop
10596 @opindex ftree-phiprop
10597 Perform hoisting of loads from conditional pointers on trees. This
10598 pass is enabled by default at @option{-O} and higher.
10600 @item -fhoist-adjacent-loads
10601 @opindex fhoist-adjacent-loads
10602 Speculatively hoist loads from both branches of an if-then-else if the
10603 loads are from adjacent locations in the same structure and the target
10604 architecture has a conditional move instruction. This flag is enabled
10605 by default at @option{-O2} and higher.
10607 @item -ftree-copy-prop
10608 @opindex ftree-copy-prop
10609 Perform copy propagation on trees. This pass eliminates unnecessary
10610 copy operations. This flag is enabled by default at @option{-O} and
10613 @item -fipa-pure-const
10614 @opindex fipa-pure-const
10615 Discover which functions are pure or constant.
10616 Enabled by default at @option{-O} and higher.
10618 @item -fipa-reference
10619 @opindex fipa-reference
10620 Discover which static variables do not escape the
10622 Enabled by default at @option{-O} and higher.
10624 @item -fipa-reference-addressable
10625 @opindex fipa-reference-addressable
10626 Discover read-only, write-only and non-addressable static variables.
10627 Enabled by default at @option{-O} and higher.
10629 @item -fipa-stack-alignment
10630 @opindex fipa-stack-alignment
10631 Reduce stack alignment on call sites if possible.
10632 Enabled by default.
10636 Perform interprocedural pointer analysis and interprocedural modification
10637 and reference analysis. This option can cause excessive memory and
10638 compile-time usage on large compilation units. It is not enabled by
10639 default at any optimization level.
10641 @item -fipa-profile
10642 @opindex fipa-profile
10643 Perform interprocedural profile propagation. The functions called only from
10644 cold functions are marked as cold. Also functions executed once (such as
10645 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
10646 functions and loop less parts of functions executed once are then optimized for
10648 Enabled by default at @option{-O} and higher.
10652 Perform interprocedural constant propagation.
10653 This optimization analyzes the program to determine when values passed
10654 to functions are constants and then optimizes accordingly.
10655 This optimization can substantially increase performance
10656 if the application has constants passed to functions.
10657 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
10658 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10660 @item -fipa-cp-clone
10661 @opindex fipa-cp-clone
10662 Perform function cloning to make interprocedural constant propagation stronger.
10663 When enabled, interprocedural constant propagation performs function cloning
10664 when externally visible function can be called with constant arguments.
10665 Because this optimization can create multiple copies of functions,
10666 it may significantly increase code size
10667 (see @option{--param ipa-cp-unit-growth=@var{value}}).
10668 This flag is enabled by default at @option{-O3}.
10669 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10672 @opindex fipa-bit-cp
10673 When enabled, perform interprocedural bitwise constant
10674 propagation. This flag is enabled by default at @option{-O2} and
10675 by @option{-fprofile-use} and @option{-fauto-profile}.
10676 It requires that @option{-fipa-cp} is enabled.
10680 When enabled, perform interprocedural propagation of value
10681 ranges. This flag is enabled by default at @option{-O2}. It requires
10682 that @option{-fipa-cp} is enabled.
10686 Perform Identical Code Folding for functions and read-only variables.
10687 The optimization reduces code size and may disturb unwind stacks by replacing
10688 a function by equivalent one with a different name. The optimization works
10689 more effectively with link-time optimization enabled.
10691 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
10692 works on different levels and thus the optimizations are not same - there are
10693 equivalences that are found only by GCC and equivalences found only by Gold.
10695 This flag is enabled by default at @option{-O2} and @option{-Os}.
10697 @item -flive-patching=@var{level}
10698 @opindex flive-patching
10699 Control GCC's optimizations to produce output suitable for live-patching.
10701 If the compiler's optimization uses a function's body or information extracted
10702 from its body to optimize/change another function, the latter is called an
10703 impacted function of the former. If a function is patched, its impacted
10704 functions should be patched too.
10706 The impacted functions are determined by the compiler's interprocedural
10707 optimizations. For example, a caller is impacted when inlining a function
10709 cloning a function and changing its caller to call this new clone,
10710 or extracting a function's pureness/constness information to optimize
10711 its direct or indirect callers, etc.
10713 Usually, the more IPA optimizations enabled, the larger the number of
10714 impacted functions for each function. In order to control the number of
10715 impacted functions and more easily compute the list of impacted function,
10716 IPA optimizations can be partially enabled at two different levels.
10718 The @var{level} argument should be one of the following:
10724 Only enable inlining and cloning optimizations, which includes inlining,
10725 cloning, interprocedural scalar replacement of aggregates and partial inlining.
10726 As a result, when patching a function, all its callers and its clones'
10727 callers are impacted, therefore need to be patched as well.
10729 @option{-flive-patching=inline-clone} disables the following optimization flags:
10730 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
10731 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
10732 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
10733 -fipa-stack-alignment}
10735 @item inline-only-static
10737 Only enable inlining of static functions.
10738 As a result, when patching a static function, all its callers are impacted
10739 and so need to be patched as well.
10741 In addition to all the flags that @option{-flive-patching=inline-clone}
10743 @option{-flive-patching=inline-only-static} disables the following additional
10744 optimization flags:
10745 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
10749 When @option{-flive-patching} is specified without any value, the default value
10750 is @var{inline-clone}.
10752 This flag is disabled by default.
10754 Note that @option{-flive-patching} is not supported with link-time optimization
10757 @item -fisolate-erroneous-paths-dereference
10758 @opindex fisolate-erroneous-paths-dereference
10759 Detect paths that trigger erroneous or undefined behavior due to
10760 dereferencing a null pointer. Isolate those paths from the main control
10761 flow and turn the statement with erroneous or undefined behavior into a trap.
10762 This flag is enabled by default at @option{-O2} and higher and depends on
10763 @option{-fdelete-null-pointer-checks} also being enabled.
10765 @item -fisolate-erroneous-paths-attribute
10766 @opindex fisolate-erroneous-paths-attribute
10767 Detect paths that trigger erroneous or undefined behavior due to a null value
10768 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
10769 attribute. Isolate those paths from the main control flow and turn the
10770 statement with erroneous or undefined behavior into a trap. This is not
10771 currently enabled, but may be enabled by @option{-O2} in the future.
10774 @opindex ftree-sink
10775 Perform forward store motion on trees. This flag is
10776 enabled by default at @option{-O} and higher.
10778 @item -ftree-bit-ccp
10779 @opindex ftree-bit-ccp
10780 Perform sparse conditional bit constant propagation on trees and propagate
10781 pointer alignment information.
10782 This pass only operates on local scalar variables and is enabled by default
10783 at @option{-O1} and higher, except for @option{-Og}.
10784 It requires that @option{-ftree-ccp} is enabled.
10788 Perform sparse conditional constant propagation (CCP) on trees. This
10789 pass only operates on local scalar variables and is enabled by default
10790 at @option{-O} and higher.
10792 @item -fssa-backprop
10793 @opindex fssa-backprop
10794 Propagate information about uses of a value up the definition chain
10795 in order to simplify the definitions. For example, this pass strips
10796 sign operations if the sign of a value never matters. The flag is
10797 enabled by default at @option{-O} and higher.
10800 @opindex fssa-phiopt
10801 Perform pattern matching on SSA PHI nodes to optimize conditional
10802 code. This pass is enabled by default at @option{-O1} and higher,
10803 except for @option{-Og}.
10805 @item -ftree-switch-conversion
10806 @opindex ftree-switch-conversion
10807 Perform conversion of simple initializations in a switch to
10808 initializations from a scalar array. This flag is enabled by default
10809 at @option{-O2} and higher.
10811 @item -ftree-tail-merge
10812 @opindex ftree-tail-merge
10813 Look for identical code sequences. When found, replace one with a jump to the
10814 other. This optimization is known as tail merging or cross jumping. This flag
10815 is enabled by default at @option{-O2} and higher. The compilation time
10817 be limited using @option{max-tail-merge-comparisons} parameter and
10818 @option{max-tail-merge-iterations} parameter.
10822 Perform dead code elimination (DCE) on trees. This flag is enabled by
10823 default at @option{-O} and higher.
10825 @item -ftree-builtin-call-dce
10826 @opindex ftree-builtin-call-dce
10827 Perform conditional dead code elimination (DCE) for calls to built-in functions
10828 that may set @code{errno} but are otherwise free of side effects. This flag is
10829 enabled by default at @option{-O2} and higher if @option{-Os} is not also
10832 @item -ffinite-loops
10833 @opindex ffinite-loops
10834 @opindex fno-finite-loops
10835 Assume that a loop with an exit will eventually take the exit and not loop
10836 indefinitely. This allows the compiler to remove loops that otherwise have
10837 no side-effects, not considering eventual endless looping as such.
10839 This option is enabled by default at @option{-O2} for C++ with -std=c++11
10842 @item -ftree-dominator-opts
10843 @opindex ftree-dominator-opts
10844 Perform a variety of simple scalar cleanups (constant/copy
10845 propagation, redundancy elimination, range propagation and expression
10846 simplification) based on a dominator tree traversal. This also
10847 performs jump threading (to reduce jumps to jumps). This flag is
10848 enabled by default at @option{-O} and higher.
10852 Perform dead store elimination (DSE) on trees. A dead store is a store into
10853 a memory location that is later overwritten by another store without
10854 any intervening loads. In this case the earlier store can be deleted. This
10855 flag is enabled by default at @option{-O} and higher.
10859 Perform loop header copying on trees. This is beneficial since it increases
10860 effectiveness of code motion optimizations. It also saves one jump. This flag
10861 is enabled by default at @option{-O} and higher. It is not enabled
10862 for @option{-Os}, since it usually increases code size.
10864 @item -ftree-loop-optimize
10865 @opindex ftree-loop-optimize
10866 Perform loop optimizations on trees. This flag is enabled by default
10867 at @option{-O} and higher.
10869 @item -ftree-loop-linear
10870 @itemx -floop-strip-mine
10871 @itemx -floop-block
10872 @opindex ftree-loop-linear
10873 @opindex floop-strip-mine
10874 @opindex floop-block
10875 Perform loop nest optimizations. Same as
10876 @option{-floop-nest-optimize}. To use this code transformation, GCC has
10877 to be configured with @option{--with-isl} to enable the Graphite loop
10878 transformation infrastructure.
10880 @item -fgraphite-identity
10881 @opindex fgraphite-identity
10882 Enable the identity transformation for graphite. For every SCoP we generate
10883 the polyhedral representation and transform it back to gimple. Using
10884 @option{-fgraphite-identity} we can check the costs or benefits of the
10885 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
10886 are also performed by the code generator isl, like index splitting and
10887 dead code elimination in loops.
10889 @item -floop-nest-optimize
10890 @opindex floop-nest-optimize
10891 Enable the isl based loop nest optimizer. This is a generic loop nest
10892 optimizer based on the Pluto optimization algorithms. It calculates a loop
10893 structure optimized for data-locality and parallelism. This option
10896 @item -floop-parallelize-all
10897 @opindex floop-parallelize-all
10898 Use the Graphite data dependence analysis to identify loops that can
10899 be parallelized. Parallelize all the loops that can be analyzed to
10900 not contain loop carried dependences without checking that it is
10901 profitable to parallelize the loops.
10903 @item -ftree-coalesce-vars
10904 @opindex ftree-coalesce-vars
10905 While transforming the program out of the SSA representation, attempt to
10906 reduce copying by coalescing versions of different user-defined
10907 variables, instead of just compiler temporaries. This may severely
10908 limit the ability to debug an optimized program compiled with
10909 @option{-fno-var-tracking-assignments}. In the negated form, this flag
10910 prevents SSA coalescing of user variables. This option is enabled by
10911 default if optimization is enabled, and it does very little otherwise.
10913 @item -ftree-loop-if-convert
10914 @opindex ftree-loop-if-convert
10915 Attempt to transform conditional jumps in the innermost loops to
10916 branch-less equivalents. The intent is to remove control-flow from
10917 the innermost loops in order to improve the ability of the
10918 vectorization pass to handle these loops. This is enabled by default
10919 if vectorization is enabled.
10921 @item -ftree-loop-distribution
10922 @opindex ftree-loop-distribution
10923 Perform loop distribution. This flag can improve cache performance on
10924 big loop bodies and allow further loop optimizations, like
10925 parallelization or vectorization, to take place. For example, the loop
10941 This flag is enabled by default at @option{-O3}.
10942 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10944 @item -ftree-loop-distribute-patterns
10945 @opindex ftree-loop-distribute-patterns
10946 Perform loop distribution of patterns that can be code generated with
10947 calls to a library. This flag is enabled by default at @option{-O2} and
10948 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
10950 This pass distributes the initialization loops and generates a call to
10951 memset zero. For example, the loop
10967 and the initialization loop is transformed into a call to memset zero.
10968 This flag is enabled by default at @option{-O3}.
10969 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10971 @item -floop-interchange
10972 @opindex floop-interchange
10973 Perform loop interchange outside of graphite. This flag can improve cache
10974 performance on loop nest and allow further loop optimizations, like
10975 vectorization, to take place. For example, the loop
10977 for (int i = 0; i < N; i++)
10978 for (int j = 0; j < N; j++)
10979 for (int k = 0; k < N; k++)
10980 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10984 for (int i = 0; i < N; i++)
10985 for (int k = 0; k < N; k++)
10986 for (int j = 0; j < N; j++)
10987 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10989 This flag is enabled by default at @option{-O3}.
10990 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10992 @item -floop-unroll-and-jam
10993 @opindex floop-unroll-and-jam
10994 Apply unroll and jam transformations on feasible loops. In a loop
10995 nest this unrolls the outer loop by some factor and fuses the resulting
10996 multiple inner loops. This flag is enabled by default at @option{-O3}.
10997 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10999 @item -ftree-loop-im
11000 @opindex ftree-loop-im
11001 Perform loop invariant motion on trees. This pass moves only invariants that
11002 are hard to handle at RTL level (function calls, operations that expand to
11003 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
11004 operands of conditions that are invariant out of the loop, so that we can use
11005 just trivial invariantness analysis in loop unswitching. The pass also includes
11008 @item -ftree-loop-ivcanon
11009 @opindex ftree-loop-ivcanon
11010 Create a canonical counter for number of iterations in loops for which
11011 determining number of iterations requires complicated analysis. Later
11012 optimizations then may determine the number easily. Useful especially
11013 in connection with unrolling.
11015 @item -ftree-scev-cprop
11016 @opindex ftree-scev-cprop
11017 Perform final value replacement. If a variable is modified in a loop
11018 in such a way that its value when exiting the loop can be determined using
11019 only its initial value and the number of loop iterations, replace uses of
11020 the final value by such a computation, provided it is sufficiently cheap.
11021 This reduces data dependencies and may allow further simplifications.
11022 Enabled by default at @option{-O} and higher.
11026 Perform induction variable optimizations (strength reduction, induction
11027 variable merging and induction variable elimination) on trees.
11029 @item -ftree-parallelize-loops=n
11030 @opindex ftree-parallelize-loops
11031 Parallelize loops, i.e., split their iteration space to run in n threads.
11032 This is only possible for loops whose iterations are independent
11033 and can be arbitrarily reordered. The optimization is only
11034 profitable on multiprocessor machines, for loops that are CPU-intensive,
11035 rather than constrained e.g.@: by memory bandwidth. This option
11036 implies @option{-pthread}, and thus is only supported on targets
11037 that have support for @option{-pthread}.
11041 Perform function-local points-to analysis on trees. This flag is
11042 enabled by default at @option{-O1} and higher, except for @option{-Og}.
11046 Perform scalar replacement of aggregates. This pass replaces structure
11047 references with scalars to prevent committing structures to memory too
11048 early. This flag is enabled by default at @option{-O1} and higher,
11049 except for @option{-Og}.
11051 @item -fstore-merging
11052 @opindex fstore-merging
11053 Perform merging of narrow stores to consecutive memory addresses. This pass
11054 merges contiguous stores of immediate values narrower than a word into fewer
11055 wider stores to reduce the number of instructions. This is enabled by default
11056 at @option{-O2} and higher as well as @option{-Os}.
11060 Perform temporary expression replacement during the SSA->normal phase. Single
11061 use/single def temporaries are replaced at their use location with their
11062 defining expression. This results in non-GIMPLE code, but gives the expanders
11063 much more complex trees to work on resulting in better RTL generation. This is
11064 enabled by default at @option{-O} and higher.
11067 @opindex ftree-slsr
11068 Perform straight-line strength reduction on trees. This recognizes related
11069 expressions involving multiplications and replaces them by less expensive
11070 calculations when possible. This is enabled by default at @option{-O} and
11073 @item -ftree-vectorize
11074 @opindex ftree-vectorize
11075 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
11076 and @option{-ftree-slp-vectorize} if not explicitly specified.
11078 @item -ftree-loop-vectorize
11079 @opindex ftree-loop-vectorize
11080 Perform loop vectorization on trees. This flag is enabled by default at
11081 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11082 and @option{-fauto-profile}.
11084 @item -ftree-slp-vectorize
11085 @opindex ftree-slp-vectorize
11086 Perform basic block vectorization on trees. This flag is enabled by default at
11087 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11088 and @option{-fauto-profile}.
11090 @item -fvect-cost-model=@var{model}
11091 @opindex fvect-cost-model
11092 Alter the cost model used for vectorization. The @var{model} argument
11093 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
11094 With the @samp{unlimited} model the vectorized code-path is assumed
11095 to be profitable while with the @samp{dynamic} model a runtime check
11096 guards the vectorized code-path to enable it only for iteration
11097 counts that will likely execute faster than when executing the original
11098 scalar loop. The @samp{cheap} model disables vectorization of
11099 loops where doing so would be cost prohibitive for example due to
11100 required runtime checks for data dependence or alignment but otherwise
11101 is equal to the @samp{dynamic} model.
11102 The default cost model depends on other optimization flags and is
11103 either @samp{dynamic} or @samp{cheap}.
11105 @item -fsimd-cost-model=@var{model}
11106 @opindex fsimd-cost-model
11107 Alter the cost model used for vectorization of loops marked with the OpenMP
11108 simd directive. The @var{model} argument should be one of
11109 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
11110 have the same meaning as described in @option{-fvect-cost-model} and by
11111 default a cost model defined with @option{-fvect-cost-model} is used.
11115 Perform Value Range Propagation on trees. This is similar to the
11116 constant propagation pass, but instead of values, ranges of values are
11117 propagated. This allows the optimizers to remove unnecessary range
11118 checks like array bound checks and null pointer checks. This is
11119 enabled by default at @option{-O2} and higher. Null pointer check
11120 elimination is only done if @option{-fdelete-null-pointer-checks} is
11123 @item -fsplit-paths
11124 @opindex fsplit-paths
11125 Split paths leading to loop backedges. This can improve dead code
11126 elimination and common subexpression elimination. This is enabled by
11127 default at @option{-O3} and above.
11129 @item -fsplit-ivs-in-unroller
11130 @opindex fsplit-ivs-in-unroller
11131 Enables expression of values of induction variables in later iterations
11132 of the unrolled loop using the value in the first iteration. This breaks
11133 long dependency chains, thus improving efficiency of the scheduling passes.
11135 A combination of @option{-fweb} and CSE is often sufficient to obtain the
11136 same effect. However, that is not reliable in cases where the loop body
11137 is more complicated than a single basic block. It also does not work at all
11138 on some architectures due to restrictions in the CSE pass.
11140 This optimization is enabled by default.
11142 @item -fvariable-expansion-in-unroller
11143 @opindex fvariable-expansion-in-unroller
11144 With this option, the compiler creates multiple copies of some
11145 local variables when unrolling a loop, which can result in superior code.
11147 This optimization is enabled by default for PowerPC targets, but disabled
11148 by default otherwise.
11150 @item -fpartial-inlining
11151 @opindex fpartial-inlining
11152 Inline parts of functions. This option has any effect only
11153 when inlining itself is turned on by the @option{-finline-functions}
11154 or @option{-finline-small-functions} options.
11156 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11158 @item -fpredictive-commoning
11159 @opindex fpredictive-commoning
11160 Perform predictive commoning optimization, i.e., reusing computations
11161 (especially memory loads and stores) performed in previous
11162 iterations of loops.
11164 This option is enabled at level @option{-O3}.
11165 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11167 @item -fprefetch-loop-arrays
11168 @opindex fprefetch-loop-arrays
11169 If supported by the target machine, generate instructions to prefetch
11170 memory to improve the performance of loops that access large arrays.
11172 This option may generate better or worse code; results are highly
11173 dependent on the structure of loops within the source code.
11175 Disabled at level @option{-Os}.
11177 @item -fno-printf-return-value
11178 @opindex fno-printf-return-value
11179 @opindex fprintf-return-value
11180 Do not substitute constants for known return value of formatted output
11181 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
11182 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
11183 transformation allows GCC to optimize or even eliminate branches based
11184 on the known return value of these functions called with arguments that
11185 are either constant, or whose values are known to be in a range that
11186 makes determining the exact return value possible. For example, when
11187 @option{-fprintf-return-value} is in effect, both the branch and the
11188 body of the @code{if} statement (but not the call to @code{snprint})
11189 can be optimized away when @code{i} is a 32-bit or smaller integer
11190 because the return value is guaranteed to be at most 8.
11194 if (snprintf (buf, "%08x", i) >= sizeof buf)
11198 The @option{-fprintf-return-value} option relies on other optimizations
11199 and yields best results with @option{-O2} and above. It works in tandem
11200 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
11201 options. The @option{-fprintf-return-value} option is enabled by default.
11203 @item -fno-peephole
11204 @itemx -fno-peephole2
11205 @opindex fno-peephole
11207 @opindex fno-peephole2
11208 @opindex fpeephole2
11209 Disable any machine-specific peephole optimizations. The difference
11210 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
11211 are implemented in the compiler; some targets use one, some use the
11212 other, a few use both.
11214 @option{-fpeephole} is enabled by default.
11215 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11217 @item -fno-guess-branch-probability
11218 @opindex fno-guess-branch-probability
11219 @opindex fguess-branch-probability
11220 Do not guess branch probabilities using heuristics.
11222 GCC uses heuristics to guess branch probabilities if they are
11223 not provided by profiling feedback (@option{-fprofile-arcs}). These
11224 heuristics are based on the control flow graph. If some branch probabilities
11225 are specified by @code{__builtin_expect}, then the heuristics are
11226 used to guess branch probabilities for the rest of the control flow graph,
11227 taking the @code{__builtin_expect} info into account. The interactions
11228 between the heuristics and @code{__builtin_expect} can be complex, and in
11229 some cases, it may be useful to disable the heuristics so that the effects
11230 of @code{__builtin_expect} are easier to understand.
11232 It is also possible to specify expected probability of the expression
11233 with @code{__builtin_expect_with_probability} built-in function.
11235 The default is @option{-fguess-branch-probability} at levels
11236 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11238 @item -freorder-blocks
11239 @opindex freorder-blocks
11240 Reorder basic blocks in the compiled function in order to reduce number of
11241 taken branches and improve code locality.
11243 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11245 @item -freorder-blocks-algorithm=@var{algorithm}
11246 @opindex freorder-blocks-algorithm
11247 Use the specified algorithm for basic block reordering. The
11248 @var{algorithm} argument can be @samp{simple}, which does not increase
11249 code size (except sometimes due to secondary effects like alignment),
11250 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
11251 put all often executed code together, minimizing the number of branches
11252 executed by making extra copies of code.
11254 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
11255 @samp{stc} at levels @option{-O2}, @option{-O3}.
11257 @item -freorder-blocks-and-partition
11258 @opindex freorder-blocks-and-partition
11259 In addition to reordering basic blocks in the compiled function, in order
11260 to reduce number of taken branches, partitions hot and cold basic blocks
11261 into separate sections of the assembly and @file{.o} files, to improve
11262 paging and cache locality performance.
11264 This optimization is automatically turned off in the presence of
11265 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
11266 section attribute and on any architecture that does not support named
11267 sections. When @option{-fsplit-stack} is used this option is not
11268 enabled by default (to avoid linker errors), but may be enabled
11269 explicitly (if using a working linker).
11271 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
11273 @item -freorder-functions
11274 @opindex freorder-functions
11275 Reorder functions in the object file in order to
11276 improve code locality. This is implemented by using special
11277 subsections @code{.text.hot} for most frequently executed functions and
11278 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
11279 the linker so object file format must support named sections and linker must
11280 place them in a reasonable way.
11282 This option isn't effective unless you either provide profile feedback
11283 (see @option{-fprofile-arcs} for details) or manually annotate functions with
11284 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
11286 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11288 @item -fstrict-aliasing
11289 @opindex fstrict-aliasing
11290 Allow the compiler to assume the strictest aliasing rules applicable to
11291 the language being compiled. For C (and C++), this activates
11292 optimizations based on the type of expressions. In particular, an
11293 object of one type is assumed never to reside at the same address as an
11294 object of a different type, unless the types are almost the same. For
11295 example, an @code{unsigned int} can alias an @code{int}, but not a
11296 @code{void*} or a @code{double}. A character type may alias any other
11299 @anchor{Type-punning}Pay special attention to code like this:
11312 The practice of reading from a different union member than the one most
11313 recently written to (called ``type-punning'') is common. Even with
11314 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
11315 is accessed through the union type. So, the code above works as
11316 expected. @xref{Structures unions enumerations and bit-fields
11317 implementation}. However, this code might not:
11328 Similarly, access by taking the address, casting the resulting pointer
11329 and dereferencing the result has undefined behavior, even if the cast
11330 uses a union type, e.g.:
11334 return ((union a_union *) &d)->i;
11338 The @option{-fstrict-aliasing} option is enabled at levels
11339 @option{-O2}, @option{-O3}, @option{-Os}.
11341 @item -falign-functions
11342 @itemx -falign-functions=@var{n}
11343 @itemx -falign-functions=@var{n}:@var{m}
11344 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
11345 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
11346 @opindex falign-functions
11347 Align the start of functions to the next power-of-two greater than or
11348 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
11349 least the first @var{m} bytes of the function can be fetched by the CPU
11350 without crossing an @var{n}-byte alignment boundary.
11352 If @var{m} is not specified, it defaults to @var{n}.
11354 Examples: @option{-falign-functions=32} aligns functions to the next
11355 32-byte boundary, @option{-falign-functions=24} aligns to the next
11356 32-byte boundary only if this can be done by skipping 23 bytes or less,
11357 @option{-falign-functions=32:7} aligns to the next
11358 32-byte boundary only if this can be done by skipping 6 bytes or less.
11360 The second pair of @var{n2}:@var{m2} values allows you to specify
11361 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
11362 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
11363 otherwise aligns to the next 32-byte boundary if this can be done
11364 by skipping 2 bytes or less.
11365 If @var{m2} is not specified, it defaults to @var{n2}.
11367 Some assemblers only support this flag when @var{n} is a power of two;
11368 in that case, it is rounded up.
11370 @option{-fno-align-functions} and @option{-falign-functions=1} are
11371 equivalent and mean that functions are not aligned.
11373 If @var{n} is not specified or is zero, use a machine-dependent default.
11374 The maximum allowed @var{n} option value is 65536.
11376 Enabled at levels @option{-O2}, @option{-O3}.
11378 @item -flimit-function-alignment
11379 If this option is enabled, the compiler tries to avoid unnecessarily
11380 overaligning functions. It attempts to instruct the assembler to align
11381 by the amount specified by @option{-falign-functions}, but not to
11382 skip more bytes than the size of the function.
11384 @item -falign-labels
11385 @itemx -falign-labels=@var{n}
11386 @itemx -falign-labels=@var{n}:@var{m}
11387 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
11388 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
11389 @opindex falign-labels
11390 Align all branch targets to a power-of-two boundary.
11392 Parameters of this option are analogous to the @option{-falign-functions} option.
11393 @option{-fno-align-labels} and @option{-falign-labels=1} are
11394 equivalent and mean that labels are not aligned.
11396 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
11397 are greater than this value, then their values are used instead.
11399 If @var{n} is not specified or is zero, use a machine-dependent default
11400 which is very likely to be @samp{1}, meaning no alignment.
11401 The maximum allowed @var{n} option value is 65536.
11403 Enabled at levels @option{-O2}, @option{-O3}.
11405 @item -falign-loops
11406 @itemx -falign-loops=@var{n}
11407 @itemx -falign-loops=@var{n}:@var{m}
11408 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
11409 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
11410 @opindex falign-loops
11411 Align loops to a power-of-two boundary. If the loops are executed
11412 many times, this makes up for any execution of the dummy padding
11415 If @option{-falign-labels} is greater than this value, then its value
11418 Parameters of this option are analogous to the @option{-falign-functions} option.
11419 @option{-fno-align-loops} and @option{-falign-loops=1} are
11420 equivalent and mean that loops are not aligned.
11421 The maximum allowed @var{n} option value is 65536.
11423 If @var{n} is not specified or is zero, use a machine-dependent default.
11425 Enabled at levels @option{-O2}, @option{-O3}.
11427 @item -falign-jumps
11428 @itemx -falign-jumps=@var{n}
11429 @itemx -falign-jumps=@var{n}:@var{m}
11430 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
11431 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
11432 @opindex falign-jumps
11433 Align branch targets to a power-of-two boundary, for branch targets
11434 where the targets can only be reached by jumping. In this case,
11435 no dummy operations need be executed.
11437 If @option{-falign-labels} is greater than this value, then its value
11440 Parameters of this option are analogous to the @option{-falign-functions} option.
11441 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
11442 equivalent and mean that loops are not aligned.
11444 If @var{n} is not specified or is zero, use a machine-dependent default.
11445 The maximum allowed @var{n} option value is 65536.
11447 Enabled at levels @option{-O2}, @option{-O3}.
11449 @item -fno-allocation-dce
11450 @opindex fno-allocation-dce
11451 Do not remove unused C++ allocations in dead code elimination.
11453 @item -fallow-store-data-races
11454 @opindex fallow-store-data-races
11455 Allow the compiler to introduce new data races on stores.
11457 Enabled at level @option{-Ofast}.
11459 @item -funit-at-a-time
11460 @opindex funit-at-a-time
11461 This option is left for compatibility reasons. @option{-funit-at-a-time}
11462 has no effect, while @option{-fno-unit-at-a-time} implies
11463 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
11465 Enabled by default.
11467 @item -fno-toplevel-reorder
11468 @opindex fno-toplevel-reorder
11469 @opindex ftoplevel-reorder
11470 Do not reorder top-level functions, variables, and @code{asm}
11471 statements. Output them in the same order that they appear in the
11472 input file. When this option is used, unreferenced static variables
11473 are not removed. This option is intended to support existing code
11474 that relies on a particular ordering. For new code, it is better to
11475 use attributes when possible.
11477 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
11478 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
11479 Additionally @option{-fno-toplevel-reorder} implies
11480 @option{-fno-section-anchors}.
11484 Constructs webs as commonly used for register allocation purposes and assign
11485 each web individual pseudo register. This allows the register allocation pass
11486 to operate on pseudos directly, but also strengthens several other optimization
11487 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
11488 however, make debugging impossible, since variables no longer stay in a
11491 Enabled by default with @option{-funroll-loops}.
11493 @item -fwhole-program
11494 @opindex fwhole-program
11495 Assume that the current compilation unit represents the whole program being
11496 compiled. All public functions and variables with the exception of @code{main}
11497 and those merged by attribute @code{externally_visible} become static functions
11498 and in effect are optimized more aggressively by interprocedural optimizers.
11500 This option should not be used in combination with @option{-flto}.
11501 Instead relying on a linker plugin should provide safer and more precise
11504 @item -flto[=@var{n}]
11506 This option runs the standard link-time optimizer. When invoked
11507 with source code, it generates GIMPLE (one of GCC's internal
11508 representations) and writes it to special ELF sections in the object
11509 file. When the object files are linked together, all the function
11510 bodies are read from these ELF sections and instantiated as if they
11511 had been part of the same translation unit.
11513 To use the link-time optimizer, @option{-flto} and optimization
11514 options should be specified at compile time and during the final link.
11515 It is recommended that you compile all the files participating in the
11516 same link with the same options and also specify those options at
11521 gcc -c -O2 -flto foo.c
11522 gcc -c -O2 -flto bar.c
11523 gcc -o myprog -flto -O2 foo.o bar.o
11526 The first two invocations to GCC save a bytecode representation
11527 of GIMPLE into special ELF sections inside @file{foo.o} and
11528 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
11529 @file{foo.o} and @file{bar.o}, merges the two files into a single
11530 internal image, and compiles the result as usual. Since both
11531 @file{foo.o} and @file{bar.o} are merged into a single image, this
11532 causes all the interprocedural analyses and optimizations in GCC to
11533 work across the two files as if they were a single one. This means,
11534 for example, that the inliner is able to inline functions in
11535 @file{bar.o} into functions in @file{foo.o} and vice-versa.
11537 Another (simpler) way to enable link-time optimization is:
11540 gcc -o myprog -flto -O2 foo.c bar.c
11543 The above generates bytecode for @file{foo.c} and @file{bar.c},
11544 merges them together into a single GIMPLE representation and optimizes
11545 them as usual to produce @file{myprog}.
11547 The important thing to keep in mind is that to enable link-time
11548 optimizations you need to use the GCC driver to perform the link step.
11549 GCC automatically performs link-time optimization if any of the
11550 objects involved were compiled with the @option{-flto} command-line option.
11551 You can always override
11552 the automatic decision to do link-time optimization
11553 by passing @option{-fno-lto} to the link command.
11555 To make whole program optimization effective, it is necessary to make
11556 certain whole program assumptions. The compiler needs to know
11557 what functions and variables can be accessed by libraries and runtime
11558 outside of the link-time optimized unit. When supported by the linker,
11559 the linker plugin (see @option{-fuse-linker-plugin}) passes information
11560 to the compiler about used and externally visible symbols. When
11561 the linker plugin is not available, @option{-fwhole-program} should be
11562 used to allow the compiler to make these assumptions, which leads
11563 to more aggressive optimization decisions.
11565 When a file is compiled with @option{-flto} without
11566 @option{-fuse-linker-plugin}, the generated object file is larger than
11567 a regular object file because it contains GIMPLE bytecodes and the usual
11568 final code (see @option{-ffat-lto-objects}. This means that
11569 object files with LTO information can be linked as normal object
11570 files; if @option{-fno-lto} is passed to the linker, no
11571 interprocedural optimizations are applied. Note that when
11572 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
11573 but you cannot perform a regular, non-LTO link on them.
11575 When producing the final binary, GCC only
11576 applies link-time optimizations to those files that contain bytecode.
11577 Therefore, you can mix and match object files and libraries with
11578 GIMPLE bytecodes and final object code. GCC automatically selects
11579 which files to optimize in LTO mode and which files to link without
11580 further processing.
11582 Generally, options specified at link time override those
11583 specified at compile time, although in some cases GCC attempts to infer
11584 link-time options from the settings used to compile the input files.
11586 If you do not specify an optimization level option @option{-O} at
11587 link time, then GCC uses the highest optimization level
11588 used when compiling the object files. Note that it is generally
11589 ineffective to specify an optimization level option only at link time and
11590 not at compile time, for two reasons. First, compiling without
11591 optimization suppresses compiler passes that gather information
11592 needed for effective optimization at link time. Second, some early
11593 optimization passes can be performed only at compile time and
11596 There are some code generation flags preserved by GCC when
11597 generating bytecodes, as they need to be used during the final link.
11598 Currently, the following options and their settings are taken from
11599 the first object file that explicitly specifies them:
11600 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
11601 @option{-fgnu-tm} and all the @option{-m} target flags.
11603 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
11604 @option{-fPIE} are combined based on the following scheme:
11607 @option{-fPIC} + @option{-fpic} = @option{-fpic}
11608 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
11609 @option{-fpic/-fPIC} + (no option) = (no option)
11610 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
11611 @option{-fpic} + @option{-fPIE} = @option{-fpie}
11612 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
11615 Certain ABI-changing flags are required to match in all compilation units,
11616 and trying to override this at link time with a conflicting value
11617 is ignored. This includes options such as @option{-freg-struct-return}
11618 and @option{-fpcc-struct-return}.
11620 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
11621 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
11622 are passed through to the link stage and merged conservatively for
11623 conflicting translation units. Specifically
11624 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
11625 precedence; and for example @option{-ffp-contract=off} takes precedence
11626 over @option{-ffp-contract=fast}. You can override them at link time.
11628 Diagnostic options such as @option{-Wstringop-overflow} are passed
11629 through to the link stage and their setting matches that of the
11630 compile-step at function granularity. Note that this matters only
11631 for diagnostics emitted during optimization. Note that code
11632 transforms such as inlining can lead to warnings being enabled
11633 or disabled for regions if code not consistent with the setting
11636 When you need to pass options to the assembler via @option{-Wa} or
11637 @option{-Xassembler} make sure to either compile such translation
11638 units with @option{-fno-lto} or consistently use the same assembler
11639 options on all translation units. You can alternatively also
11640 specify assembler options at LTO link time.
11642 To enable debug info generation you need to supply @option{-g} at
11643 compile time. If any of the input files at link time were built
11644 with debug info generation enabled the link will enable debug info
11645 generation as well. Any elaborate debug info settings
11646 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
11647 at the linker command line and mixing different settings in different
11648 translation units is discouraged.
11650 If LTO encounters objects with C linkage declared with incompatible
11651 types in separate translation units to be linked together (undefined
11652 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
11653 issued. The behavior is still undefined at run time. Similar
11654 diagnostics may be raised for other languages.
11656 Another feature of LTO is that it is possible to apply interprocedural
11657 optimizations on files written in different languages:
11661 g++ -c -flto bar.cc
11662 gfortran -c -flto baz.f90
11663 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11666 Notice that the final link is done with @command{g++} to get the C++
11667 runtime libraries and @option{-lgfortran} is added to get the Fortran
11668 runtime libraries. In general, when mixing languages in LTO mode, you
11669 should use the same link command options as when mixing languages in a
11670 regular (non-LTO) compilation.
11672 If object files containing GIMPLE bytecode are stored in a library archive, say
11673 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
11674 are using a linker with plugin support. To create static libraries suitable
11675 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
11676 and @command{ranlib};
11677 to show the symbols of object files with GIMPLE bytecode, use
11678 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
11679 and @command{nm} have been compiled with plugin support. At link time, use the
11680 flag @option{-fuse-linker-plugin} to ensure that the library participates in
11681 the LTO optimization process:
11684 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11687 With the linker plugin enabled, the linker extracts the needed
11688 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
11689 to make them part of the aggregated GIMPLE image to be optimized.
11691 If you are not using a linker with plugin support and/or do not
11692 enable the linker plugin, then the objects inside @file{libfoo.a}
11693 are extracted and linked as usual, but they do not participate
11694 in the LTO optimization process. In order to make a static library suitable
11695 for both LTO optimization and usual linkage, compile its object files with
11696 @option{-flto} @option{-ffat-lto-objects}.
11698 Link-time optimizations do not require the presence of the whole program to
11699 operate. If the program does not require any symbols to be exported, it is
11700 possible to combine @option{-flto} and @option{-fwhole-program} to allow
11701 the interprocedural optimizers to use more aggressive assumptions which may
11702 lead to improved optimization opportunities.
11703 Use of @option{-fwhole-program} is not needed when linker plugin is
11704 active (see @option{-fuse-linker-plugin}).
11706 The current implementation of LTO makes no
11707 attempt to generate bytecode that is portable between different
11708 types of hosts. The bytecode files are versioned and there is a
11709 strict version check, so bytecode files generated in one version of
11710 GCC do not work with an older or newer version of GCC.
11712 Link-time optimization does not work well with generation of debugging
11713 information on systems other than those using a combination of ELF and
11716 If you specify the optional @var{n}, the optimization and code
11717 generation done at link time is executed in parallel using @var{n}
11718 parallel jobs by utilizing an installed @command{make} program. The
11719 environment variable @env{MAKE} may be used to override the program
11722 You can also specify @option{-flto=jobserver} to use GNU make's
11723 job server mode to determine the number of parallel jobs. This
11724 is useful when the Makefile calling GCC is already executing in parallel.
11725 You must prepend a @samp{+} to the command recipe in the parent Makefile
11726 for this to work. This option likely only works if @env{MAKE} is
11727 GNU make. Even without the option value, GCC tries to automatically
11728 detect a running GNU make's job server.
11730 Use @option{-flto=auto} to use GNU make's job server, if available,
11731 or otherwise fall back to autodetection of the number of CPU threads
11732 present in your system.
11734 @item -flto-partition=@var{alg}
11735 @opindex flto-partition
11736 Specify the partitioning algorithm used by the link-time optimizer.
11737 The value is either @samp{1to1} to specify a partitioning mirroring
11738 the original source files or @samp{balanced} to specify partitioning
11739 into equally sized chunks (whenever possible) or @samp{max} to create
11740 new partition for every symbol where possible. Specifying @samp{none}
11741 as an algorithm disables partitioning and streaming completely.
11742 The default value is @samp{balanced}. While @samp{1to1} can be used
11743 as an workaround for various code ordering issues, the @samp{max}
11744 partitioning is intended for internal testing only.
11745 The value @samp{one} specifies that exactly one partition should be
11746 used while the value @samp{none} bypasses partitioning and executes
11747 the link-time optimization step directly from the WPA phase.
11749 @item -flto-compression-level=@var{n}
11750 @opindex flto-compression-level
11751 This option specifies the level of compression used for intermediate
11752 language written to LTO object files, and is only meaningful in
11753 conjunction with LTO mode (@option{-flto}). Valid
11754 values are 0 (no compression) to 9 (maximum compression). Values
11755 outside this range are clamped to either 0 or 9. If the option is not
11756 given, a default balanced compression setting is used.
11758 @item -fuse-linker-plugin
11759 @opindex fuse-linker-plugin
11760 Enables the use of a linker plugin during link-time optimization. This
11761 option relies on plugin support in the linker, which is available in gold
11762 or in GNU ld 2.21 or newer.
11764 This option enables the extraction of object files with GIMPLE bytecode out
11765 of library archives. This improves the quality of optimization by exposing
11766 more code to the link-time optimizer. This information specifies what
11767 symbols can be accessed externally (by non-LTO object or during dynamic
11768 linking). Resulting code quality improvements on binaries (and shared
11769 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
11770 See @option{-flto} for a description of the effect of this flag and how to
11773 This option is enabled by default when LTO support in GCC is enabled
11774 and GCC was configured for use with
11775 a linker supporting plugins (GNU ld 2.21 or newer or gold).
11777 @item -ffat-lto-objects
11778 @opindex ffat-lto-objects
11779 Fat LTO objects are object files that contain both the intermediate language
11780 and the object code. This makes them usable for both LTO linking and normal
11781 linking. This option is effective only when compiling with @option{-flto}
11782 and is ignored at link time.
11784 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
11785 requires the complete toolchain to be aware of LTO. It requires a linker with
11786 linker plugin support for basic functionality. Additionally,
11787 @command{nm}, @command{ar} and @command{ranlib}
11788 need to support linker plugins to allow a full-featured build environment
11789 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
11790 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
11791 to these tools. With non fat LTO makefiles need to be modified to use them.
11793 Note that modern binutils provide plugin auto-load mechanism.
11794 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
11795 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
11796 @command{gcc-ranlib}).
11798 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
11801 @item -fcompare-elim
11802 @opindex fcompare-elim
11803 After register allocation and post-register allocation instruction splitting,
11804 identify arithmetic instructions that compute processor flags similar to a
11805 comparison operation based on that arithmetic. If possible, eliminate the
11806 explicit comparison operation.
11808 This pass only applies to certain targets that cannot explicitly represent
11809 the comparison operation before register allocation is complete.
11811 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11813 @item -fcprop-registers
11814 @opindex fcprop-registers
11815 After register allocation and post-register allocation instruction splitting,
11816 perform a copy-propagation pass to try to reduce scheduling dependencies
11817 and occasionally eliminate the copy.
11819 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11821 @item -fprofile-correction
11822 @opindex fprofile-correction
11823 Profiles collected using an instrumented binary for multi-threaded programs may
11824 be inconsistent due to missed counter updates. When this option is specified,
11825 GCC uses heuristics to correct or smooth out such inconsistencies. By
11826 default, GCC emits an error message when an inconsistent profile is detected.
11828 This option is enabled by @option{-fauto-profile}.
11830 @item -fprofile-partial-training
11831 @opindex fprofile-partial-training
11832 With @code{-fprofile-use} all portions of programs not executed during train
11833 run are optimized agressively for size rather than speed. In some cases it is
11834 not practical to train all possible hot paths in the program. (For
11835 example, program may contain functions specific for a given hardware and
11836 trianing may not cover all hardware configurations program is run on.) With
11837 @code{-fprofile-partial-training} profile feedback will be ignored for all
11838 functions not executed during the train run leading them to be optimized as if
11839 they were compiled without profile feedback. This leads to better performance
11840 when train run is not representative but also leads to significantly bigger
11843 @item -fprofile-use
11844 @itemx -fprofile-use=@var{path}
11845 @opindex fprofile-use
11846 Enable profile feedback-directed optimizations,
11847 and the following optimizations, many of which
11848 are generally profitable only with profile feedback available:
11850 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11851 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11852 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11853 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11854 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11855 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11856 -fprofile-reorder-functions}
11858 Before you can use this option, you must first generate profiling information.
11859 @xref{Instrumentation Options}, for information about the
11860 @option{-fprofile-generate} option.
11862 By default, GCC emits an error message if the feedback profiles do not
11863 match the source code. This error can be turned into a warning by using
11864 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
11865 optimized code. Additionally, by default, GCC also emits a warning message if
11866 the feedback profiles do not exist (see @option{-Wmissing-profile}).
11868 If @var{path} is specified, GCC looks at the @var{path} to find
11869 the profile feedback data files. See @option{-fprofile-dir}.
11871 @item -fauto-profile
11872 @itemx -fauto-profile=@var{path}
11873 @opindex fauto-profile
11874 Enable sampling-based feedback-directed optimizations,
11875 and the following optimizations,
11876 many of which are generally profitable only with profile feedback available:
11878 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11879 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11880 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11881 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11882 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11883 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11884 -fprofile-correction}
11886 @var{path} is the name of a file containing AutoFDO profile information.
11887 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
11889 Producing an AutoFDO profile data file requires running your program
11890 with the @command{perf} utility on a supported GNU/Linux target system.
11891 For more information, see @uref{https://perf.wiki.kernel.org/}.
11895 perf record -e br_inst_retired:near_taken -b -o perf.data \
11899 Then use the @command{create_gcov} tool to convert the raw profile data
11900 to a format that can be used by GCC.@ You must also supply the
11901 unstripped binary for your program to this tool.
11902 See @uref{https://github.com/google/autofdo}.
11906 create_gcov --binary=your_program.unstripped --profile=perf.data \
11907 --gcov=profile.afdo
11911 The following options control compiler behavior regarding floating-point
11912 arithmetic. These options trade off between speed and
11913 correctness. All must be specifically enabled.
11916 @item -ffloat-store
11917 @opindex ffloat-store
11918 Do not store floating-point variables in registers, and inhibit other
11919 options that might change whether a floating-point value is taken from a
11920 register or memory.
11922 @cindex floating-point precision
11923 This option prevents undesirable excess precision on machines such as
11924 the 68000 where the floating registers (of the 68881) keep more
11925 precision than a @code{double} is supposed to have. Similarly for the
11926 x86 architecture. For most programs, the excess precision does only
11927 good, but a few programs rely on the precise definition of IEEE floating
11928 point. Use @option{-ffloat-store} for such programs, after modifying
11929 them to store all pertinent intermediate computations into variables.
11931 @item -fexcess-precision=@var{style}
11932 @opindex fexcess-precision
11933 This option allows further control over excess precision on machines
11934 where floating-point operations occur in a format with more precision or
11935 range than the IEEE standard and interchange floating-point types. By
11936 default, @option{-fexcess-precision=fast} is in effect; this means that
11937 operations may be carried out in a wider precision than the types specified
11938 in the source if that would result in faster code, and it is unpredictable
11939 when rounding to the types specified in the source code takes place.
11940 When compiling C, if @option{-fexcess-precision=standard} is specified then
11941 excess precision follows the rules specified in ISO C99; in particular,
11942 both casts and assignments cause values to be rounded to their
11943 semantic types (whereas @option{-ffloat-store} only affects
11944 assignments). This option is enabled by default for C if a strict
11945 conformance option such as @option{-std=c99} is used.
11946 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
11947 regardless of whether a strict conformance option is used.
11950 @option{-fexcess-precision=standard} is not implemented for languages
11951 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
11952 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
11953 semantics apply without excess precision, and in the latter, rounding
11957 @opindex ffast-math
11958 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
11959 @option{-ffinite-math-only}, @option{-fno-rounding-math},
11960 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
11961 @option{-fexcess-precision=fast}.
11963 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
11965 This option is not turned on by any @option{-O} option besides
11966 @option{-Ofast} since it can result in incorrect output for programs
11967 that depend on an exact implementation of IEEE or ISO rules/specifications
11968 for math functions. It may, however, yield faster code for programs
11969 that do not require the guarantees of these specifications.
11971 @item -fno-math-errno
11972 @opindex fno-math-errno
11973 @opindex fmath-errno
11974 Do not set @code{errno} after calling math functions that are executed
11975 with a single instruction, e.g., @code{sqrt}. A program that relies on
11976 IEEE exceptions for math error handling may want to use this flag
11977 for speed while maintaining IEEE arithmetic compatibility.
11979 This option is not turned on by any @option{-O} option since
11980 it can result in incorrect output for programs that depend on
11981 an exact implementation of IEEE or ISO rules/specifications for
11982 math functions. It may, however, yield faster code for programs
11983 that do not require the guarantees of these specifications.
11985 The default is @option{-fmath-errno}.
11987 On Darwin systems, the math library never sets @code{errno}. There is
11988 therefore no reason for the compiler to consider the possibility that
11989 it might, and @option{-fno-math-errno} is the default.
11991 @item -funsafe-math-optimizations
11992 @opindex funsafe-math-optimizations
11994 Allow optimizations for floating-point arithmetic that (a) assume
11995 that arguments and results are valid and (b) may violate IEEE or
11996 ANSI standards. When used at link time, it may include libraries
11997 or startup files that change the default FPU control word or other
11998 similar optimizations.
12000 This option is not turned on by any @option{-O} option since
12001 it can result in incorrect output for programs that depend on
12002 an exact implementation of IEEE or ISO rules/specifications for
12003 math functions. It may, however, yield faster code for programs
12004 that do not require the guarantees of these specifications.
12005 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
12006 @option{-fassociative-math} and @option{-freciprocal-math}.
12008 The default is @option{-fno-unsafe-math-optimizations}.
12010 @item -fassociative-math
12011 @opindex fassociative-math
12013 Allow re-association of operands in series of floating-point operations.
12014 This violates the ISO C and C++ language standard by possibly changing
12015 computation result. NOTE: re-ordering may change the sign of zero as
12016 well as ignore NaNs and inhibit or create underflow or overflow (and
12017 thus cannot be used on code that relies on rounding behavior like
12018 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
12019 and thus may not be used when ordered comparisons are required.
12020 This option requires that both @option{-fno-signed-zeros} and
12021 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
12022 much sense with @option{-frounding-math}. For Fortran the option
12023 is automatically enabled when both @option{-fno-signed-zeros} and
12024 @option{-fno-trapping-math} are in effect.
12026 The default is @option{-fno-associative-math}.
12028 @item -freciprocal-math
12029 @opindex freciprocal-math
12031 Allow the reciprocal of a value to be used instead of dividing by
12032 the value if this enables optimizations. For example @code{x / y}
12033 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
12034 is subject to common subexpression elimination. Note that this loses
12035 precision and increases the number of flops operating on the value.
12037 The default is @option{-fno-reciprocal-math}.
12039 @item -ffinite-math-only
12040 @opindex ffinite-math-only
12041 Allow optimizations for floating-point arithmetic that assume
12042 that arguments and results are not NaNs or +-Infs.
12044 This option is not turned on by any @option{-O} option since
12045 it can result in incorrect output for programs that depend on
12046 an exact implementation of IEEE or ISO rules/specifications for
12047 math functions. It may, however, yield faster code for programs
12048 that do not require the guarantees of these specifications.
12050 The default is @option{-fno-finite-math-only}.
12052 @item -fno-signed-zeros
12053 @opindex fno-signed-zeros
12054 @opindex fsigned-zeros
12055 Allow optimizations for floating-point arithmetic that ignore the
12056 signedness of zero. IEEE arithmetic specifies the behavior of
12057 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
12058 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
12059 This option implies that the sign of a zero result isn't significant.
12061 The default is @option{-fsigned-zeros}.
12063 @item -fno-trapping-math
12064 @opindex fno-trapping-math
12065 @opindex ftrapping-math
12066 Compile code assuming that floating-point operations cannot generate
12067 user-visible traps. These traps include division by zero, overflow,
12068 underflow, inexact result and invalid operation. This option requires
12069 that @option{-fno-signaling-nans} be in effect. Setting this option may
12070 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
12072 This option should never be turned on by any @option{-O} option since
12073 it can result in incorrect output for programs that depend on
12074 an exact implementation of IEEE or ISO rules/specifications for
12077 The default is @option{-ftrapping-math}.
12079 @item -frounding-math
12080 @opindex frounding-math
12081 Disable transformations and optimizations that assume default floating-point
12082 rounding behavior. This is round-to-zero for all floating point
12083 to integer conversions, and round-to-nearest for all other arithmetic
12084 truncations. This option should be specified for programs that change
12085 the FP rounding mode dynamically, or that may be executed with a
12086 non-default rounding mode. This option disables constant folding of
12087 floating-point expressions at compile time (which may be affected by
12088 rounding mode) and arithmetic transformations that are unsafe in the
12089 presence of sign-dependent rounding modes.
12091 The default is @option{-fno-rounding-math}.
12093 This option is experimental and does not currently guarantee to
12094 disable all GCC optimizations that are affected by rounding mode.
12095 Future versions of GCC may provide finer control of this setting
12096 using C99's @code{FENV_ACCESS} pragma. This command-line option
12097 will be used to specify the default state for @code{FENV_ACCESS}.
12099 @item -fsignaling-nans
12100 @opindex fsignaling-nans
12101 Compile code assuming that IEEE signaling NaNs may generate user-visible
12102 traps during floating-point operations. Setting this option disables
12103 optimizations that may change the number of exceptions visible with
12104 signaling NaNs. This option implies @option{-ftrapping-math}.
12106 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
12109 The default is @option{-fno-signaling-nans}.
12111 This option is experimental and does not currently guarantee to
12112 disable all GCC optimizations that affect signaling NaN behavior.
12114 @item -fno-fp-int-builtin-inexact
12115 @opindex fno-fp-int-builtin-inexact
12116 @opindex ffp-int-builtin-inexact
12117 Do not allow the built-in functions @code{ceil}, @code{floor},
12118 @code{round} and @code{trunc}, and their @code{float} and @code{long
12119 double} variants, to generate code that raises the ``inexact''
12120 floating-point exception for noninteger arguments. ISO C99 and C11
12121 allow these functions to raise the ``inexact'' exception, but ISO/IEC
12122 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
12123 ISO C2X, does not allow these functions to do so.
12125 The default is @option{-ffp-int-builtin-inexact}, allowing the
12126 exception to be raised, unless C2X or a later C standard is selected.
12127 This option does nothing unless @option{-ftrapping-math} is in effect.
12129 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
12130 generate a call to a library function then the ``inexact'' exception
12131 may be raised if the library implementation does not follow TS 18661.
12133 @item -fsingle-precision-constant
12134 @opindex fsingle-precision-constant
12135 Treat floating-point constants as single precision instead of
12136 implicitly converting them to double-precision constants.
12138 @item -fcx-limited-range
12139 @opindex fcx-limited-range
12140 When enabled, this option states that a range reduction step is not
12141 needed when performing complex division. Also, there is no checking
12142 whether the result of a complex multiplication or division is @code{NaN
12143 + I*NaN}, with an attempt to rescue the situation in that case. The
12144 default is @option{-fno-cx-limited-range}, but is enabled by
12145 @option{-ffast-math}.
12147 This option controls the default setting of the ISO C99
12148 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
12151 @item -fcx-fortran-rules
12152 @opindex fcx-fortran-rules
12153 Complex multiplication and division follow Fortran rules. Range
12154 reduction is done as part of complex division, but there is no checking
12155 whether the result of a complex multiplication or division is @code{NaN
12156 + I*NaN}, with an attempt to rescue the situation in that case.
12158 The default is @option{-fno-cx-fortran-rules}.
12162 The following options control optimizations that may improve
12163 performance, but are not enabled by any @option{-O} options. This
12164 section includes experimental options that may produce broken code.
12167 @item -fbranch-probabilities
12168 @opindex fbranch-probabilities
12169 After running a program compiled with @option{-fprofile-arcs}
12170 (@pxref{Instrumentation Options}),
12171 you can compile it a second time using
12172 @option{-fbranch-probabilities}, to improve optimizations based on
12173 the number of times each branch was taken. When a program
12174 compiled with @option{-fprofile-arcs} exits, it saves arc execution
12175 counts to a file called @file{@var{sourcename}.gcda} for each source
12176 file. The information in this data file is very dependent on the
12177 structure of the generated code, so you must use the same source code
12178 and the same optimization options for both compilations.
12180 With @option{-fbranch-probabilities}, GCC puts a
12181 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
12182 These can be used to improve optimization. Currently, they are only
12183 used in one place: in @file{reorg.c}, instead of guessing which path a
12184 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
12185 exactly determine which path is taken more often.
12187 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12189 @item -fprofile-values
12190 @opindex fprofile-values
12191 If combined with @option{-fprofile-arcs}, it adds code so that some
12192 data about values of expressions in the program is gathered.
12194 With @option{-fbranch-probabilities}, it reads back the data gathered
12195 from profiling values of expressions for usage in optimizations.
12197 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
12198 @option{-fauto-profile}.
12200 @item -fprofile-reorder-functions
12201 @opindex fprofile-reorder-functions
12202 Function reordering based on profile instrumentation collects
12203 first time of execution of a function and orders these functions
12204 in ascending order.
12206 Enabled with @option{-fprofile-use}.
12210 If combined with @option{-fprofile-arcs}, this option instructs the compiler
12211 to add code to gather information about values of expressions.
12213 With @option{-fbranch-probabilities}, it reads back the data gathered
12214 and actually performs the optimizations based on them.
12215 Currently the optimizations include specialization of division operations
12216 using the knowledge about the value of the denominator.
12218 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
12220 @item -frename-registers
12221 @opindex frename-registers
12222 Attempt to avoid false dependencies in scheduled code by making use
12223 of registers left over after register allocation. This optimization
12224 most benefits processors with lots of registers. Depending on the
12225 debug information format adopted by the target, however, it can
12226 make debugging impossible, since variables no longer stay in
12227 a ``home register''.
12229 Enabled by default with @option{-funroll-loops}.
12231 @item -fschedule-fusion
12232 @opindex fschedule-fusion
12233 Performs a target dependent pass over the instruction stream to schedule
12234 instructions of same type together because target machine can execute them
12235 more efficiently if they are adjacent to each other in the instruction flow.
12237 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12241 Perform tail duplication to enlarge superblock size. This transformation
12242 simplifies the control flow of the function allowing other optimizations to do
12245 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12247 @item -funroll-loops
12248 @opindex funroll-loops
12249 Unroll loops whose number of iterations can be determined at compile time or
12250 upon entry to the loop. @option{-funroll-loops} implies
12251 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
12252 It also turns on complete loop peeling (i.e.@: complete removal of loops with
12253 a small constant number of iterations). This option makes code larger, and may
12254 or may not make it run faster.
12256 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12258 @item -funroll-all-loops
12259 @opindex funroll-all-loops
12260 Unroll all loops, even if their number of iterations is uncertain when
12261 the loop is entered. This usually makes programs run more slowly.
12262 @option{-funroll-all-loops} implies the same options as
12263 @option{-funroll-loops}.
12266 @opindex fpeel-loops
12267 Peels loops for which there is enough information that they do not
12268 roll much (from profile feedback or static analysis). It also turns on
12269 complete loop peeling (i.e.@: complete removal of loops with small constant
12270 number of iterations).
12272 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
12274 @item -fmove-loop-invariants
12275 @opindex fmove-loop-invariants
12276 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
12277 at level @option{-O1} and higher, except for @option{-Og}.
12279 @item -fsplit-loops
12280 @opindex fsplit-loops
12281 Split a loop into two if it contains a condition that's always true
12282 for one side of the iteration space and false for the other.
12284 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12286 @item -funswitch-loops
12287 @opindex funswitch-loops
12288 Move branches with loop invariant conditions out of the loop, with duplicates
12289 of the loop on both branches (modified according to result of the condition).
12291 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12293 @item -fversion-loops-for-strides
12294 @opindex fversion-loops-for-strides
12295 If a loop iterates over an array with a variable stride, create another
12296 version of the loop that assumes the stride is always one. For example:
12299 for (int i = 0; i < n; ++i)
12300 x[i * stride] = @dots{};
12307 for (int i = 0; i < n; ++i)
12310 for (int i = 0; i < n; ++i)
12311 x[i * stride] = @dots{};
12314 This is particularly useful for assumed-shape arrays in Fortran where
12315 (for example) it allows better vectorization assuming contiguous accesses.
12316 This flag is enabled by default at @option{-O3}.
12317 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12319 @item -ffunction-sections
12320 @itemx -fdata-sections
12321 @opindex ffunction-sections
12322 @opindex fdata-sections
12323 Place each function or data item into its own section in the output
12324 file if the target supports arbitrary sections. The name of the
12325 function or the name of the data item determines the section's name
12326 in the output file.
12328 Use these options on systems where the linker can perform optimizations to
12329 improve locality of reference in the instruction space. Most systems using the
12330 ELF object format have linkers with such optimizations. On AIX, the linker
12331 rearranges sections (CSECTs) based on the call graph. The performance impact
12334 Together with a linker garbage collection (linker @option{--gc-sections}
12335 option) these options may lead to smaller statically-linked executables (after
12338 On ELF/DWARF systems these options do not degenerate the quality of the debug
12339 information. There could be issues with other object files/debug info formats.
12341 Only use these options when there are significant benefits from doing so. When
12342 you specify these options, the assembler and linker create larger object and
12343 executable files and are also slower. These options affect code generation.
12344 They prevent optimizations by the compiler and assembler using relative
12345 locations inside a translation unit since the locations are unknown until
12346 link time. An example of such an optimization is relaxing calls to short call
12350 @opindex fstdarg-opt
12351 Optimize the prologue of variadic argument functions with respect to usage of
12354 @item -fsection-anchors
12355 @opindex fsection-anchors
12356 Try to reduce the number of symbolic address calculations by using
12357 shared ``anchor'' symbols to address nearby objects. This transformation
12358 can help to reduce the number of GOT entries and GOT accesses on some
12361 For example, the implementation of the following function @code{foo}:
12364 static int a, b, c;
12365 int foo (void) @{ return a + b + c; @}
12369 usually calculates the addresses of all three variables, but if you
12370 compile it with @option{-fsection-anchors}, it accesses the variables
12371 from a common anchor point instead. The effect is similar to the
12372 following pseudocode (which isn't valid C):
12377 register int *xr = &x;
12378 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
12382 Not all targets support this option.
12384 @item --param @var{name}=@var{value}
12386 In some places, GCC uses various constants to control the amount of
12387 optimization that is done. For example, GCC does not inline functions
12388 that contain more than a certain number of instructions. You can
12389 control some of these constants on the command line using the
12390 @option{--param} option.
12392 The names of specific parameters, and the meaning of the values, are
12393 tied to the internals of the compiler, and are subject to change
12394 without notice in future releases.
12396 In order to get minimal, maximal and default value of a parameter,
12397 one can use @option{--help=param -Q} options.
12399 In each case, the @var{value} is an integer. The following choices
12400 of @var{name} are recognized for all targets:
12403 @item predictable-branch-outcome
12404 When branch is predicted to be taken with probability lower than this threshold
12405 (in percent), then it is considered well predictable.
12407 @item max-rtl-if-conversion-insns
12408 RTL if-conversion tries to remove conditional branches around a block and
12409 replace them with conditionally executed instructions. This parameter
12410 gives the maximum number of instructions in a block which should be
12411 considered for if-conversion. The compiler will
12412 also use other heuristics to decide whether if-conversion is likely to be
12415 @item max-rtl-if-conversion-predictable-cost
12416 @itemx max-rtl-if-conversion-unpredictable-cost
12417 RTL if-conversion will try to remove conditional branches around a block
12418 and replace them with conditionally executed instructions. These parameters
12419 give the maximum permissible cost for the sequence that would be generated
12420 by if-conversion depending on whether the branch is statically determined
12421 to be predictable or not. The units for this parameter are the same as
12422 those for the GCC internal seq_cost metric. The compiler will try to
12423 provide a reasonable default for this parameter using the BRANCH_COST
12426 @item max-crossjump-edges
12427 The maximum number of incoming edges to consider for cross-jumping.
12428 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
12429 the number of edges incoming to each block. Increasing values mean
12430 more aggressive optimization, making the compilation time increase with
12431 probably small improvement in executable size.
12433 @item min-crossjump-insns
12434 The minimum number of instructions that must be matched at the end
12435 of two blocks before cross-jumping is performed on them. This
12436 value is ignored in the case where all instructions in the block being
12437 cross-jumped from are matched.
12439 @item max-grow-copy-bb-insns
12440 The maximum code size expansion factor when copying basic blocks
12441 instead of jumping. The expansion is relative to a jump instruction.
12443 @item max-goto-duplication-insns
12444 The maximum number of instructions to duplicate to a block that jumps
12445 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
12446 passes, GCC factors computed gotos early in the compilation process,
12447 and unfactors them as late as possible. Only computed jumps at the
12448 end of a basic blocks with no more than max-goto-duplication-insns are
12451 @item max-delay-slot-insn-search
12452 The maximum number of instructions to consider when looking for an
12453 instruction to fill a delay slot. If more than this arbitrary number of
12454 instructions are searched, the time savings from filling the delay slot
12455 are minimal, so stop searching. Increasing values mean more
12456 aggressive optimization, making the compilation time increase with probably
12457 small improvement in execution time.
12459 @item max-delay-slot-live-search
12460 When trying to fill delay slots, the maximum number of instructions to
12461 consider when searching for a block with valid live register
12462 information. Increasing this arbitrarily chosen value means more
12463 aggressive optimization, increasing the compilation time. This parameter
12464 should be removed when the delay slot code is rewritten to maintain the
12465 control-flow graph.
12467 @item max-gcse-memory
12468 The approximate maximum amount of memory that can be allocated in
12469 order to perform the global common subexpression elimination
12470 optimization. If more memory than specified is required, the
12471 optimization is not done.
12473 @item max-gcse-insertion-ratio
12474 If the ratio of expression insertions to deletions is larger than this value
12475 for any expression, then RTL PRE inserts or removes the expression and thus
12476 leaves partially redundant computations in the instruction stream.
12478 @item max-pending-list-length
12479 The maximum number of pending dependencies scheduling allows
12480 before flushing the current state and starting over. Large functions
12481 with few branches or calls can create excessively large lists which
12482 needlessly consume memory and resources.
12484 @item max-modulo-backtrack-attempts
12485 The maximum number of backtrack attempts the scheduler should make
12486 when modulo scheduling a loop. Larger values can exponentially increase
12489 @item max-inline-insns-single
12490 Several parameters control the tree inliner used in GCC@. This number sets the
12491 maximum number of instructions (counted in GCC's internal representation) in a
12492 single function that the tree inliner considers for inlining. This only
12493 affects functions declared inline and methods implemented in a class
12497 @item max-inline-insns-auto
12498 When you use @option{-finline-functions} (included in @option{-O3}),
12499 a lot of functions that would otherwise not be considered for inlining
12500 by the compiler are investigated. To those functions, a different
12501 (more restrictive) limit compared to functions declared inline can
12502 be applied (@option{--param max-inline-insns-auto}).
12504 @item max-inline-insns-small
12505 This is bound applied to calls which are considered relevant with
12506 @option{-finline-small-functions}.
12508 @item max-inline-insns-size
12509 This is bound applied to calls which are optimized for size. Small growth
12510 may be desirable to anticipate optimization oppurtunities exposed by inlining.
12512 @item uninlined-function-insns
12513 Number of instructions accounted by inliner for function overhead such as
12514 function prologue and epilogue.
12516 @item uninlined-function-time
12517 Extra time accounted by inliner for function overhead such as time needed to
12518 execute function prologue and epilogue
12520 @item inline-heuristics-hint-percent
12521 The scale (in percents) applied to @option{inline-insns-single},
12522 @option{inline-insns-single-O2}, @option{inline-insns-auto}
12523 when inline heuristics hints that inlining is
12524 very profitable (will enable later optimizations).
12526 @item uninlined-thunk-insns
12527 @item uninlined-thunk-time
12528 Same as @option{--param uninlined-function-insns} and
12529 @option{--param uninlined-function-time} but applied to function thunks
12531 @item inline-min-speedup
12532 When estimated performance improvement of caller + callee runtime exceeds this
12533 threshold (in percent), the function can be inlined regardless of the limit on
12534 @option{--param max-inline-insns-single} and @option{--param
12535 max-inline-insns-auto}.
12537 @item large-function-insns
12538 The limit specifying really large functions. For functions larger than this
12539 limit after inlining, inlining is constrained by
12540 @option{--param large-function-growth}. This parameter is useful primarily
12541 to avoid extreme compilation time caused by non-linear algorithms used by the
12544 @item large-function-growth
12545 Specifies maximal growth of large function caused by inlining in percents.
12546 For example, parameter value 100 limits large function growth to 2.0 times
12549 @item large-unit-insns
12550 The limit specifying large translation unit. Growth caused by inlining of
12551 units larger than this limit is limited by @option{--param inline-unit-growth}.
12552 For small units this might be too tight.
12553 For example, consider a unit consisting of function A
12554 that is inline and B that just calls A three times. If B is small relative to
12555 A, the growth of unit is 300\% and yet such inlining is very sane. For very
12556 large units consisting of small inlineable functions, however, the overall unit
12557 growth limit is needed to avoid exponential explosion of code size. Thus for
12558 smaller units, the size is increased to @option{--param large-unit-insns}
12559 before applying @option{--param inline-unit-growth}.
12561 @item inline-unit-growth
12562 Specifies maximal overall growth of the compilation unit caused by inlining.
12563 For example, parameter value 20 limits unit growth to 1.2 times the original
12564 size. Cold functions (either marked cold via an attribute or by profile
12565 feedback) are not accounted into the unit size.
12567 @item ipa-cp-unit-growth
12568 Specifies maximal overall growth of the compilation unit caused by
12569 interprocedural constant propagation. For example, parameter value 10 limits
12570 unit growth to 1.1 times the original size.
12572 @item large-stack-frame
12573 The limit specifying large stack frames. While inlining the algorithm is trying
12574 to not grow past this limit too much.
12576 @item large-stack-frame-growth
12577 Specifies maximal growth of large stack frames caused by inlining in percents.
12578 For example, parameter value 1000 limits large stack frame growth to 11 times
12581 @item max-inline-insns-recursive
12582 @itemx max-inline-insns-recursive-auto
12583 Specifies the maximum number of instructions an out-of-line copy of a
12584 self-recursive inline
12585 function can grow into by performing recursive inlining.
12587 @option{--param max-inline-insns-recursive} applies to functions
12589 For functions not declared inline, recursive inlining
12590 happens only when @option{-finline-functions} (included in @option{-O3}) is
12591 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
12593 @item max-inline-recursive-depth
12594 @itemx max-inline-recursive-depth-auto
12595 Specifies the maximum recursion depth used for recursive inlining.
12597 @option{--param max-inline-recursive-depth} applies to functions
12598 declared inline. For functions not declared inline, recursive inlining
12599 happens only when @option{-finline-functions} (included in @option{-O3}) is
12600 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
12602 @item min-inline-recursive-probability
12603 Recursive inlining is profitable only for function having deep recursion
12604 in average and can hurt for function having little recursion depth by
12605 increasing the prologue size or complexity of function body to other
12608 When profile feedback is available (see @option{-fprofile-generate}) the actual
12609 recursion depth can be guessed from the probability that function recurses
12610 via a given call expression. This parameter limits inlining only to call
12611 expressions whose probability exceeds the given threshold (in percents).
12613 @item early-inlining-insns
12614 Specify growth that the early inliner can make. In effect it increases
12615 the amount of inlining for code having a large abstraction penalty.
12617 @item max-early-inliner-iterations
12618 Limit of iterations of the early inliner. This basically bounds
12619 the number of nested indirect calls the early inliner can resolve.
12620 Deeper chains are still handled by late inlining.
12622 @item comdat-sharing-probability
12623 Probability (in percent) that C++ inline function with comdat visibility
12624 are shared across multiple compilation units.
12626 @item profile-func-internal-id
12627 A parameter to control whether to use function internal id in profile
12628 database lookup. If the value is 0, the compiler uses an id that
12629 is based on function assembler name and filename, which makes old profile
12630 data more tolerant to source changes such as function reordering etc.
12632 @item min-vect-loop-bound
12633 The minimum number of iterations under which loops are not vectorized
12634 when @option{-ftree-vectorize} is used. The number of iterations after
12635 vectorization needs to be greater than the value specified by this option
12636 to allow vectorization.
12638 @item gcse-cost-distance-ratio
12639 Scaling factor in calculation of maximum distance an expression
12640 can be moved by GCSE optimizations. This is currently supported only in the
12641 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
12642 is with simple expressions, i.e., the expressions that have cost
12643 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
12644 hoisting of simple expressions.
12646 @item gcse-unrestricted-cost
12647 Cost, roughly measured as the cost of a single typical machine
12648 instruction, at which GCSE optimizations do not constrain
12649 the distance an expression can travel. This is currently
12650 supported only in the code hoisting pass. The lesser the cost,
12651 the more aggressive code hoisting is. Specifying 0
12652 allows all expressions to travel unrestricted distances.
12654 @item max-hoist-depth
12655 The depth of search in the dominator tree for expressions to hoist.
12656 This is used to avoid quadratic behavior in hoisting algorithm.
12657 The value of 0 does not limit on the search, but may slow down compilation
12660 @item max-tail-merge-comparisons
12661 The maximum amount of similar bbs to compare a bb with. This is used to
12662 avoid quadratic behavior in tree tail merging.
12664 @item max-tail-merge-iterations
12665 The maximum amount of iterations of the pass over the function. This is used to
12666 limit compilation time in tree tail merging.
12668 @item store-merging-allow-unaligned
12669 Allow the store merging pass to introduce unaligned stores if it is legal to
12672 @item max-stores-to-merge
12673 The maximum number of stores to attempt to merge into wider stores in the store
12676 @item max-unrolled-insns
12677 The maximum number of instructions that a loop may have to be unrolled.
12678 If a loop is unrolled, this parameter also determines how many times
12679 the loop code is unrolled.
12681 @item max-average-unrolled-insns
12682 The maximum number of instructions biased by probabilities of their execution
12683 that a loop may have to be unrolled. If a loop is unrolled,
12684 this parameter also determines how many times the loop code is unrolled.
12686 @item max-unroll-times
12687 The maximum number of unrollings of a single loop.
12689 @item max-peeled-insns
12690 The maximum number of instructions that a loop may have to be peeled.
12691 If a loop is peeled, this parameter also determines how many times
12692 the loop code is peeled.
12694 @item max-peel-times
12695 The maximum number of peelings of a single loop.
12697 @item max-peel-branches
12698 The maximum number of branches on the hot path through the peeled sequence.
12700 @item max-completely-peeled-insns
12701 The maximum number of insns of a completely peeled loop.
12703 @item max-completely-peel-times
12704 The maximum number of iterations of a loop to be suitable for complete peeling.
12706 @item max-completely-peel-loop-nest-depth
12707 The maximum depth of a loop nest suitable for complete peeling.
12709 @item max-unswitch-insns
12710 The maximum number of insns of an unswitched loop.
12712 @item max-unswitch-level
12713 The maximum number of branches unswitched in a single loop.
12715 @item lim-expensive
12716 The minimum cost of an expensive expression in the loop invariant motion.
12718 @item min-loop-cond-split-prob
12719 When FDO profile information is available, @option{min-loop-cond-split-prob}
12720 specifies minimum threshold for probability of semi-invariant condition
12721 statement to trigger loop split.
12723 @item iv-consider-all-candidates-bound
12724 Bound on number of candidates for induction variables, below which
12725 all candidates are considered for each use in induction variable
12726 optimizations. If there are more candidates than this,
12727 only the most relevant ones are considered to avoid quadratic time complexity.
12729 @item iv-max-considered-uses
12730 The induction variable optimizations give up on loops that contain more
12731 induction variable uses.
12733 @item iv-always-prune-cand-set-bound
12734 If the number of candidates in the set is smaller than this value,
12735 always try to remove unnecessary ivs from the set
12736 when adding a new one.
12738 @item avg-loop-niter
12739 Average number of iterations of a loop.
12741 @item dse-max-object-size
12742 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
12743 Larger values may result in larger compilation times.
12745 @item dse-max-alias-queries-per-store
12746 Maximum number of queries into the alias oracle per store.
12747 Larger values result in larger compilation times and may result in more
12748 removed dead stores.
12750 @item scev-max-expr-size
12751 Bound on size of expressions used in the scalar evolutions analyzer.
12752 Large expressions slow the analyzer.
12754 @item scev-max-expr-complexity
12755 Bound on the complexity of the expressions in the scalar evolutions analyzer.
12756 Complex expressions slow the analyzer.
12758 @item max-tree-if-conversion-phi-args
12759 Maximum number of arguments in a PHI supported by TREE if conversion
12760 unless the loop is marked with simd pragma.
12762 @item vect-max-version-for-alignment-checks
12763 The maximum number of run-time checks that can be performed when
12764 doing loop versioning for alignment in the vectorizer.
12766 @item vect-max-version-for-alias-checks
12767 The maximum number of run-time checks that can be performed when
12768 doing loop versioning for alias in the vectorizer.
12770 @item vect-max-peeling-for-alignment
12771 The maximum number of loop peels to enhance access alignment
12772 for vectorizer. Value -1 means no limit.
12774 @item max-iterations-to-track
12775 The maximum number of iterations of a loop the brute-force algorithm
12776 for analysis of the number of iterations of the loop tries to evaluate.
12778 @item hot-bb-count-fraction
12779 The denominator n of fraction 1/n of the maximal execution count of a
12780 basic block in the entire program that a basic block needs to at least
12781 have in order to be considered hot. The default is 10000, which means
12782 that a basic block is considered hot if its execution count is greater
12783 than 1/10000 of the maximal execution count. 0 means that it is never
12784 considered hot. Used in non-LTO mode.
12786 @item hot-bb-count-ws-permille
12787 The number of most executed permilles, ranging from 0 to 1000, of the
12788 profiled execution of the entire program to which the execution count
12789 of a basic block must be part of in order to be considered hot. The
12790 default is 990, which means that a basic block is considered hot if
12791 its execution count contributes to the upper 990 permilles, or 99.0%,
12792 of the profiled execution of the entire program. 0 means that it is
12793 never considered hot. Used in LTO mode.
12795 @item hot-bb-frequency-fraction
12796 The denominator n of fraction 1/n of the execution frequency of the
12797 entry block of a function that a basic block of this function needs
12798 to at least have in order to be considered hot. The default is 1000,
12799 which means that a basic block is considered hot in a function if it
12800 is executed more frequently than 1/1000 of the frequency of the entry
12801 block of the function. 0 means that it is never considered hot.
12803 @item unlikely-bb-count-fraction
12804 The denominator n of fraction 1/n of the number of profiled runs of
12805 the entire program below which the execution count of a basic block
12806 must be in order for the basic block to be considered unlikely executed.
12807 The default is 20, which means that a basic block is considered unlikely
12808 executed if it is executed in fewer than 1/20, or 5%, of the runs of
12809 the program. 0 means that it is always considered unlikely executed.
12811 @item max-predicted-iterations
12812 The maximum number of loop iterations we predict statically. This is useful
12813 in cases where a function contains a single loop with known bound and
12814 another loop with unknown bound.
12815 The known number of iterations is predicted correctly, while
12816 the unknown number of iterations average to roughly 10. This means that the
12817 loop without bounds appears artificially cold relative to the other one.
12819 @item builtin-expect-probability
12820 Control the probability of the expression having the specified value. This
12821 parameter takes a percentage (i.e.@: 0 ... 100) as input.
12823 @item builtin-string-cmp-inline-length
12824 The maximum length of a constant string for a builtin string cmp call
12825 eligible for inlining.
12827 @item align-threshold
12829 Select fraction of the maximal frequency of executions of a basic block in
12830 a function to align the basic block.
12832 @item align-loop-iterations
12834 A loop expected to iterate at least the selected number of iterations is
12837 @item tracer-dynamic-coverage
12838 @itemx tracer-dynamic-coverage-feedback
12840 This value is used to limit superblock formation once the given percentage of
12841 executed instructions is covered. This limits unnecessary code size
12844 The @option{tracer-dynamic-coverage-feedback} parameter
12845 is used only when profile
12846 feedback is available. The real profiles (as opposed to statically estimated
12847 ones) are much less balanced allowing the threshold to be larger value.
12849 @item tracer-max-code-growth
12850 Stop tail duplication once code growth has reached given percentage. This is
12851 a rather artificial limit, as most of the duplicates are eliminated later in
12852 cross jumping, so it may be set to much higher values than is the desired code
12855 @item tracer-min-branch-ratio
12857 Stop reverse growth when the reverse probability of best edge is less than this
12858 threshold (in percent).
12860 @item tracer-min-branch-probability
12861 @itemx tracer-min-branch-probability-feedback
12863 Stop forward growth if the best edge has probability lower than this
12866 Similarly to @option{tracer-dynamic-coverage} two parameters are
12867 provided. @option{tracer-min-branch-probability-feedback} is used for
12868 compilation with profile feedback and @option{tracer-min-branch-probability}
12869 compilation without. The value for compilation with profile feedback
12870 needs to be more conservative (higher) in order to make tracer
12873 @item stack-clash-protection-guard-size
12874 Specify the size of the operating system provided stack guard as
12875 2 raised to @var{num} bytes. Higher values may reduce the
12876 number of explicit probes, but a value larger than the operating system
12877 provided guard will leave code vulnerable to stack clash style attacks.
12879 @item stack-clash-protection-probe-interval
12880 Stack clash protection involves probing stack space as it is allocated. This
12881 param controls the maximum distance between probes into the stack as 2 raised
12882 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
12883 larger than the operating system provided guard will leave code vulnerable to
12884 stack clash style attacks.
12886 @item max-cse-path-length
12888 The maximum number of basic blocks on path that CSE considers.
12890 @item max-cse-insns
12891 The maximum number of instructions CSE processes before flushing.
12893 @item ggc-min-expand
12895 GCC uses a garbage collector to manage its own memory allocation. This
12896 parameter specifies the minimum percentage by which the garbage
12897 collector's heap should be allowed to expand between collections.
12898 Tuning this may improve compilation speed; it has no effect on code
12901 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
12902 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
12903 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
12904 GCC is not able to calculate RAM on a particular platform, the lower
12905 bound of 30% is used. Setting this parameter and
12906 @option{ggc-min-heapsize} to zero causes a full collection to occur at
12907 every opportunity. This is extremely slow, but can be useful for
12910 @item ggc-min-heapsize
12912 Minimum size of the garbage collector's heap before it begins bothering
12913 to collect garbage. The first collection occurs after the heap expands
12914 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
12915 tuning this may improve compilation speed, and has no effect on code
12918 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
12919 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
12920 with a lower bound of 4096 (four megabytes) and an upper bound of
12921 131072 (128 megabytes). If GCC is not able to calculate RAM on a
12922 particular platform, the lower bound is used. Setting this parameter
12923 very large effectively disables garbage collection. Setting this
12924 parameter and @option{ggc-min-expand} to zero causes a full collection
12925 to occur at every opportunity.
12927 @item max-reload-search-insns
12928 The maximum number of instruction reload should look backward for equivalent
12929 register. Increasing values mean more aggressive optimization, making the
12930 compilation time increase with probably slightly better performance.
12932 @item max-cselib-memory-locations
12933 The maximum number of memory locations cselib should take into account.
12934 Increasing values mean more aggressive optimization, making the compilation time
12935 increase with probably slightly better performance.
12937 @item max-sched-ready-insns
12938 The maximum number of instructions ready to be issued the scheduler should
12939 consider at any given time during the first scheduling pass. Increasing
12940 values mean more thorough searches, making the compilation time increase
12941 with probably little benefit.
12943 @item max-sched-region-blocks
12944 The maximum number of blocks in a region to be considered for
12945 interblock scheduling.
12947 @item max-pipeline-region-blocks
12948 The maximum number of blocks in a region to be considered for
12949 pipelining in the selective scheduler.
12951 @item max-sched-region-insns
12952 The maximum number of insns in a region to be considered for
12953 interblock scheduling.
12955 @item max-pipeline-region-insns
12956 The maximum number of insns in a region to be considered for
12957 pipelining in the selective scheduler.
12959 @item min-spec-prob
12960 The minimum probability (in percents) of reaching a source block
12961 for interblock speculative scheduling.
12963 @item max-sched-extend-regions-iters
12964 The maximum number of iterations through CFG to extend regions.
12965 A value of 0 disables region extensions.
12967 @item max-sched-insn-conflict-delay
12968 The maximum conflict delay for an insn to be considered for speculative motion.
12970 @item sched-spec-prob-cutoff
12971 The minimal probability of speculation success (in percents), so that
12972 speculative insns are scheduled.
12974 @item sched-state-edge-prob-cutoff
12975 The minimum probability an edge must have for the scheduler to save its
12978 @item sched-mem-true-dep-cost
12979 Minimal distance (in CPU cycles) between store and load targeting same
12982 @item selsched-max-lookahead
12983 The maximum size of the lookahead window of selective scheduling. It is a
12984 depth of search for available instructions.
12986 @item selsched-max-sched-times
12987 The maximum number of times that an instruction is scheduled during
12988 selective scheduling. This is the limit on the number of iterations
12989 through which the instruction may be pipelined.
12991 @item selsched-insns-to-rename
12992 The maximum number of best instructions in the ready list that are considered
12993 for renaming in the selective scheduler.
12996 The minimum value of stage count that swing modulo scheduler
12999 @item max-last-value-rtl
13000 The maximum size measured as number of RTLs that can be recorded in an expression
13001 in combiner for a pseudo register as last known value of that register.
13003 @item max-combine-insns
13004 The maximum number of instructions the RTL combiner tries to combine.
13006 @item integer-share-limit
13007 Small integer constants can use a shared data structure, reducing the
13008 compiler's memory usage and increasing its speed. This sets the maximum
13009 value of a shared integer constant.
13011 @item ssp-buffer-size
13012 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
13013 protection when @option{-fstack-protection} is used.
13015 @item min-size-for-stack-sharing
13016 The minimum size of variables taking part in stack slot sharing when not
13019 @item max-jump-thread-duplication-stmts
13020 Maximum number of statements allowed in a block that needs to be
13021 duplicated when threading jumps.
13023 @item max-fields-for-field-sensitive
13024 Maximum number of fields in a structure treated in
13025 a field sensitive manner during pointer analysis.
13027 @item prefetch-latency
13028 Estimate on average number of instructions that are executed before
13029 prefetch finishes. The distance prefetched ahead is proportional
13030 to this constant. Increasing this number may also lead to less
13031 streams being prefetched (see @option{simultaneous-prefetches}).
13033 @item simultaneous-prefetches
13034 Maximum number of prefetches that can run at the same time.
13036 @item l1-cache-line-size
13037 The size of cache line in L1 data cache, in bytes.
13039 @item l1-cache-size
13040 The size of L1 data cache, in kilobytes.
13042 @item l2-cache-size
13043 The size of L2 data cache, in kilobytes.
13045 @item prefetch-dynamic-strides
13046 Whether the loop array prefetch pass should issue software prefetch hints
13047 for strides that are non-constant. In some cases this may be
13048 beneficial, though the fact the stride is non-constant may make it
13049 hard to predict when there is clear benefit to issuing these hints.
13051 Set to 1 if the prefetch hints should be issued for non-constant
13052 strides. Set to 0 if prefetch hints should be issued only for strides that
13053 are known to be constant and below @option{prefetch-minimum-stride}.
13055 @item prefetch-minimum-stride
13056 Minimum constant stride, in bytes, to start using prefetch hints for. If
13057 the stride is less than this threshold, prefetch hints will not be issued.
13059 This setting is useful for processors that have hardware prefetchers, in
13060 which case there may be conflicts between the hardware prefetchers and
13061 the software prefetchers. If the hardware prefetchers have a maximum
13062 stride they can handle, it should be used here to improve the use of
13063 software prefetchers.
13065 A value of -1 means we don't have a threshold and therefore
13066 prefetch hints can be issued for any constant stride.
13068 This setting is only useful for strides that are known and constant.
13070 @item loop-interchange-max-num-stmts
13071 The maximum number of stmts in a loop to be interchanged.
13073 @item loop-interchange-stride-ratio
13074 The minimum ratio between stride of two loops for interchange to be profitable.
13076 @item min-insn-to-prefetch-ratio
13077 The minimum ratio between the number of instructions and the
13078 number of prefetches to enable prefetching in a loop.
13080 @item prefetch-min-insn-to-mem-ratio
13081 The minimum ratio between the number of instructions and the
13082 number of memory references to enable prefetching in a loop.
13084 @item use-canonical-types
13085 Whether the compiler should use the ``canonical'' type system.
13086 Should always be 1, which uses a more efficient internal
13087 mechanism for comparing types in C++ and Objective-C++. However, if
13088 bugs in the canonical type system are causing compilation failures,
13089 set this value to 0 to disable canonical types.
13091 @item switch-conversion-max-branch-ratio
13092 Switch initialization conversion refuses to create arrays that are
13093 bigger than @option{switch-conversion-max-branch-ratio} times the number of
13094 branches in the switch.
13096 @item max-partial-antic-length
13097 Maximum length of the partial antic set computed during the tree
13098 partial redundancy elimination optimization (@option{-ftree-pre}) when
13099 optimizing at @option{-O3} and above. For some sorts of source code
13100 the enhanced partial redundancy elimination optimization can run away,
13101 consuming all of the memory available on the host machine. This
13102 parameter sets a limit on the length of the sets that are computed,
13103 which prevents the runaway behavior. Setting a value of 0 for
13104 this parameter allows an unlimited set length.
13106 @item rpo-vn-max-loop-depth
13107 Maximum loop depth that is value-numbered optimistically.
13108 When the limit hits the innermost
13109 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
13110 loop nest are value-numbered optimistically and the remaining ones not.
13112 @item sccvn-max-alias-queries-per-access
13113 Maximum number of alias-oracle queries we perform when looking for
13114 redundancies for loads and stores. If this limit is hit the search
13115 is aborted and the load or store is not considered redundant. The
13116 number of queries is algorithmically limited to the number of
13117 stores on all paths from the load to the function entry.
13119 @item ira-max-loops-num
13120 IRA uses regional register allocation by default. If a function
13121 contains more loops than the number given by this parameter, only at most
13122 the given number of the most frequently-executed loops form regions
13123 for regional register allocation.
13125 @item ira-max-conflict-table-size
13126 Although IRA uses a sophisticated algorithm to compress the conflict
13127 table, the table can still require excessive amounts of memory for
13128 huge functions. If the conflict table for a function could be more
13129 than the size in MB given by this parameter, the register allocator
13130 instead uses a faster, simpler, and lower-quality
13131 algorithm that does not require building a pseudo-register conflict table.
13133 @item ira-loop-reserved-regs
13134 IRA can be used to evaluate more accurate register pressure in loops
13135 for decisions to move loop invariants (see @option{-O3}). The number
13136 of available registers reserved for some other purposes is given
13137 by this parameter. Default of the parameter
13138 is the best found from numerous experiments.
13140 @item lra-inheritance-ebb-probability-cutoff
13141 LRA tries to reuse values reloaded in registers in subsequent insns.
13142 This optimization is called inheritance. EBB is used as a region to
13143 do this optimization. The parameter defines a minimal fall-through
13144 edge probability in percentage used to add BB to inheritance EBB in
13145 LRA. The default value was chosen
13146 from numerous runs of SPEC2000 on x86-64.
13148 @item loop-invariant-max-bbs-in-loop
13149 Loop invariant motion can be very expensive, both in compilation time and
13150 in amount of needed compile-time memory, with very large loops. Loops
13151 with more basic blocks than this parameter won't have loop invariant
13152 motion optimization performed on them.
13154 @item loop-max-datarefs-for-datadeps
13155 Building data dependencies is expensive for very large loops. This
13156 parameter limits the number of data references in loops that are
13157 considered for data dependence analysis. These large loops are no
13158 handled by the optimizations using loop data dependencies.
13160 @item max-vartrack-size
13161 Sets a maximum number of hash table slots to use during variable
13162 tracking dataflow analysis of any function. If this limit is exceeded
13163 with variable tracking at assignments enabled, analysis for that
13164 function is retried without it, after removing all debug insns from
13165 the function. If the limit is exceeded even without debug insns, var
13166 tracking analysis is completely disabled for the function. Setting
13167 the parameter to zero makes it unlimited.
13169 @item max-vartrack-expr-depth
13170 Sets a maximum number of recursion levels when attempting to map
13171 variable names or debug temporaries to value expressions. This trades
13172 compilation time for more complete debug information. If this is set too
13173 low, value expressions that are available and could be represented in
13174 debug information may end up not being used; setting this higher may
13175 enable the compiler to find more complex debug expressions, but compile
13176 time and memory use may grow.
13178 @item max-debug-marker-count
13179 Sets a threshold on the number of debug markers (e.g.@: begin stmt
13180 markers) to avoid complexity explosion at inlining or expanding to RTL.
13181 If a function has more such gimple stmts than the set limit, such stmts
13182 will be dropped from the inlined copy of a function, and from its RTL
13185 @item min-nondebug-insn-uid
13186 Use uids starting at this parameter for nondebug insns. The range below
13187 the parameter is reserved exclusively for debug insns created by
13188 @option{-fvar-tracking-assignments}, but debug insns may get
13189 (non-overlapping) uids above it if the reserved range is exhausted.
13191 @item ipa-sra-ptr-growth-factor
13192 IPA-SRA replaces a pointer to an aggregate with one or more new
13193 parameters only when their cumulative size is less or equal to
13194 @option{ipa-sra-ptr-growth-factor} times the size of the original
13197 @item ipa-sra-max-replacements
13198 Maximum pieces of an aggregate that IPA-SRA tracks. As a
13199 consequence, it is also the maximum number of replacements of a formal
13202 @item sra-max-scalarization-size-Ospeed
13203 @itemx sra-max-scalarization-size-Osize
13204 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
13205 replace scalar parts of aggregates with uses of independent scalar
13206 variables. These parameters control the maximum size, in storage units,
13207 of aggregate which is considered for replacement when compiling for
13209 (@option{sra-max-scalarization-size-Ospeed}) or size
13210 (@option{sra-max-scalarization-size-Osize}) respectively.
13212 @item sra-max-propagations
13213 The maximum number of artificial accesses that Scalar Replacement of
13214 Aggregates (SRA) will track, per one local variable, in order to
13215 facilitate copy propagation.
13217 @item tm-max-aggregate-size
13218 When making copies of thread-local variables in a transaction, this
13219 parameter specifies the size in bytes after which variables are
13220 saved with the logging functions as opposed to save/restore code
13221 sequence pairs. This option only applies when using
13224 @item graphite-max-nb-scop-params
13225 To avoid exponential effects in the Graphite loop transforms, the
13226 number of parameters in a Static Control Part (SCoP) is bounded.
13227 A value of zero can be used to lift
13228 the bound. A variable whose value is unknown at compilation time and
13229 defined outside a SCoP is a parameter of the SCoP.
13231 @item loop-block-tile-size
13232 Loop blocking or strip mining transforms, enabled with
13233 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
13234 loop in the loop nest by a given number of iterations. The strip
13235 length can be changed using the @option{loop-block-tile-size}
13238 @item ipa-cp-value-list-size
13239 IPA-CP attempts to track all possible values and types passed to a function's
13240 parameter in order to propagate them and perform devirtualization.
13241 @option{ipa-cp-value-list-size} is the maximum number of values and types it
13242 stores per one formal parameter of a function.
13244 @item ipa-cp-eval-threshold
13245 IPA-CP calculates its own score of cloning profitability heuristics
13246 and performs those cloning opportunities with scores that exceed
13247 @option{ipa-cp-eval-threshold}.
13249 @item ipa-cp-max-recursive-depth
13250 Maximum depth of recursive cloning for self-recursive function.
13252 @item ipa-cp-min-recursive-probability
13253 Recursive cloning only when the probability of call being executed exceeds
13256 @item ipa-cp-recursion-penalty
13257 Percentage penalty the recursive functions will receive when they
13258 are evaluated for cloning.
13260 @item ipa-cp-single-call-penalty
13261 Percentage penalty functions containing a single call to another
13262 function will receive when they are evaluated for cloning.
13264 @item ipa-max-agg-items
13265 IPA-CP is also capable to propagate a number of scalar values passed
13266 in an aggregate. @option{ipa-max-agg-items} controls the maximum
13267 number of such values per one parameter.
13269 @item ipa-cp-loop-hint-bonus
13270 When IPA-CP determines that a cloning candidate would make the number
13271 of iterations of a loop known, it adds a bonus of
13272 @option{ipa-cp-loop-hint-bonus} to the profitability score of
13275 @item ipa-max-aa-steps
13276 During its analysis of function bodies, IPA-CP employs alias analysis
13277 in order to track values pointed to by function parameters. In order
13278 not spend too much time analyzing huge functions, it gives up and
13279 consider all memory clobbered after examining
13280 @option{ipa-max-aa-steps} statements modifying memory.
13282 @item ipa-max-switch-predicate-bounds
13283 Maximal number of boundary endpoints of case ranges of switch statement.
13284 For switch exceeding this limit, IPA-CP will not construct cloning cost
13285 predicate, which is used to estimate cloning benefit, for default case
13286 of the switch statement.
13288 @item ipa-max-param-expr-ops
13289 IPA-CP will analyze conditional statement that references some function
13290 parameter to estimate benefit for cloning upon certain constant value.
13291 But if number of operations in a parameter expression exceeds
13292 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
13293 one, and is not handled by IPA analysis.
13295 @item lto-partitions
13296 Specify desired number of partitions produced during WHOPR compilation.
13297 The number of partitions should exceed the number of CPUs used for compilation.
13299 @item lto-min-partition
13300 Size of minimal partition for WHOPR (in estimated instructions).
13301 This prevents expenses of splitting very small programs into too many
13304 @item lto-max-partition
13305 Size of max partition for WHOPR (in estimated instructions).
13306 to provide an upper bound for individual size of partition.
13307 Meant to be used only with balanced partitioning.
13309 @item lto-max-streaming-parallelism
13310 Maximal number of parallel processes used for LTO streaming.
13312 @item cxx-max-namespaces-for-diagnostic-help
13313 The maximum number of namespaces to consult for suggestions when C++
13314 name lookup fails for an identifier.
13316 @item sink-frequency-threshold
13317 The maximum relative execution frequency (in percents) of the target block
13318 relative to a statement's original block to allow statement sinking of a
13319 statement. Larger numbers result in more aggressive statement sinking.
13320 A small positive adjustment is applied for
13321 statements with memory operands as those are even more profitable so sink.
13323 @item max-stores-to-sink
13324 The maximum number of conditional store pairs that can be sunk. Set to 0
13325 if either vectorization (@option{-ftree-vectorize}) or if-conversion
13326 (@option{-ftree-loop-if-convert}) is disabled.
13328 @item case-values-threshold
13329 The smallest number of different values for which it is best to use a
13330 jump-table instead of a tree of conditional branches. If the value is
13331 0, use the default for the machine.
13333 @item jump-table-max-growth-ratio-for-size
13334 The maximum code size growth ratio when expanding
13335 into a jump table (in percent). The parameter is used when
13336 optimizing for size.
13338 @item jump-table-max-growth-ratio-for-speed
13339 The maximum code size growth ratio when expanding
13340 into a jump table (in percent). The parameter is used when
13341 optimizing for speed.
13343 @item tree-reassoc-width
13344 Set the maximum number of instructions executed in parallel in
13345 reassociated tree. This parameter overrides target dependent
13346 heuristics used by default if has non zero value.
13348 @item sched-pressure-algorithm
13349 Choose between the two available implementations of
13350 @option{-fsched-pressure}. Algorithm 1 is the original implementation
13351 and is the more likely to prevent instructions from being reordered.
13352 Algorithm 2 was designed to be a compromise between the relatively
13353 conservative approach taken by algorithm 1 and the rather aggressive
13354 approach taken by the default scheduler. It relies more heavily on
13355 having a regular register file and accurate register pressure classes.
13356 See @file{haifa-sched.c} in the GCC sources for more details.
13358 The default choice depends on the target.
13360 @item max-slsr-cand-scan
13361 Set the maximum number of existing candidates that are considered when
13362 seeking a basis for a new straight-line strength reduction candidate.
13365 Enable buffer overflow detection for global objects. This kind
13366 of protection is enabled by default if you are using
13367 @option{-fsanitize=address} option.
13368 To disable global objects protection use @option{--param asan-globals=0}.
13371 Enable buffer overflow detection for stack objects. This kind of
13372 protection is enabled by default when using @option{-fsanitize=address}.
13373 To disable stack protection use @option{--param asan-stack=0} option.
13375 @item asan-instrument-reads
13376 Enable buffer overflow detection for memory reads. This kind of
13377 protection is enabled by default when using @option{-fsanitize=address}.
13378 To disable memory reads protection use
13379 @option{--param asan-instrument-reads=0}.
13381 @item asan-instrument-writes
13382 Enable buffer overflow detection for memory writes. This kind of
13383 protection is enabled by default when using @option{-fsanitize=address}.
13384 To disable memory writes protection use
13385 @option{--param asan-instrument-writes=0} option.
13387 @item asan-memintrin
13388 Enable detection for built-in functions. This kind of protection
13389 is enabled by default when using @option{-fsanitize=address}.
13390 To disable built-in functions protection use
13391 @option{--param asan-memintrin=0}.
13393 @item asan-use-after-return
13394 Enable detection of use-after-return. This kind of protection
13395 is enabled by default when using the @option{-fsanitize=address} option.
13396 To disable it use @option{--param asan-use-after-return=0}.
13398 Note: By default the check is disabled at run time. To enable it,
13399 add @code{detect_stack_use_after_return=1} to the environment variable
13400 @env{ASAN_OPTIONS}.
13402 @item asan-instrumentation-with-call-threshold
13403 If number of memory accesses in function being instrumented
13404 is greater or equal to this number, use callbacks instead of inline checks.
13405 E.g. to disable inline code use
13406 @option{--param asan-instrumentation-with-call-threshold=0}.
13408 @item use-after-scope-direct-emission-threshold
13409 If the size of a local variable in bytes is smaller or equal to this
13410 number, directly poison (or unpoison) shadow memory instead of using
13411 run-time callbacks.
13413 @item max-fsm-thread-path-insns
13414 Maximum number of instructions to copy when duplicating blocks on a
13415 finite state automaton jump thread path.
13417 @item max-fsm-thread-length
13418 Maximum number of basic blocks on a finite state automaton jump thread
13421 @item max-fsm-thread-paths
13422 Maximum number of new jump thread paths to create for a finite state
13425 @item parloops-chunk-size
13426 Chunk size of omp schedule for loops parallelized by parloops.
13428 @item parloops-schedule
13429 Schedule type of omp schedule for loops parallelized by parloops (static,
13430 dynamic, guided, auto, runtime).
13432 @item parloops-min-per-thread
13433 The minimum number of iterations per thread of an innermost parallelized
13434 loop for which the parallelized variant is preferred over the single threaded
13435 one. Note that for a parallelized loop nest the
13436 minimum number of iterations of the outermost loop per thread is two.
13438 @item max-ssa-name-query-depth
13439 Maximum depth of recursion when querying properties of SSA names in things
13440 like fold routines. One level of recursion corresponds to following a
13443 @item max-speculative-devirt-maydefs
13444 The maximum number of may-defs we analyze when looking for a must-def
13445 specifying the dynamic type of an object that invokes a virtual call
13446 we may be able to devirtualize speculatively.
13448 @item max-vrp-switch-assertions
13449 The maximum number of assertions to add along the default edge of a switch
13450 statement during VRP.
13452 @item unroll-jam-min-percent
13453 The minimum percentage of memory references that must be optimized
13454 away for the unroll-and-jam transformation to be considered profitable.
13456 @item unroll-jam-max-unroll
13457 The maximum number of times the outer loop should be unrolled by
13458 the unroll-and-jam transformation.
13460 @item max-rtl-if-conversion-unpredictable-cost
13461 Maximum permissible cost for the sequence that would be generated
13462 by the RTL if-conversion pass for a branch that is considered unpredictable.
13464 @item max-variable-expansions-in-unroller
13465 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
13466 of times that an individual variable will be expanded during loop unrolling.
13468 @item tracer-min-branch-probability-feedback
13469 Stop forward growth if the probability of best edge is less than
13470 this threshold (in percent). Used when profile feedback is available.
13472 @item partial-inlining-entry-probability
13473 Maximum probability of the entry BB of split region
13474 (in percent relative to entry BB of the function)
13475 to make partial inlining happen.
13477 @item max-tracked-strlens
13478 Maximum number of strings for which strlen optimization pass will
13479 track string lengths.
13481 @item gcse-after-reload-partial-fraction
13482 The threshold ratio for performing partial redundancy
13483 elimination after reload.
13485 @item gcse-after-reload-critical-fraction
13486 The threshold ratio of critical edges execution count that
13487 permit performing redundancy elimination after reload.
13489 @item max-loop-header-insns
13490 The maximum number of insns in loop header duplicated
13491 by the copy loop headers pass.
13493 @item vect-epilogues-nomask
13494 Enable loop epilogue vectorization using smaller vector size.
13496 @item vect-partial-vector-usage
13497 Controls when the loop vectorizer considers using partial vector loads
13498 and stores as an alternative to falling back to scalar code. 0 stops
13499 the vectorizer from ever using partial vector loads and stores. 1 allows
13500 partial vector loads and stores if vectorization removes the need for the
13501 code to iterate. 2 allows partial vector loads and stores in all loops.
13502 The parameter only has an effect on targets that support partial
13503 vector loads and stores.
13505 @item slp-max-insns-in-bb
13506 Maximum number of instructions in basic block to be
13507 considered for SLP vectorization.
13509 @item avoid-fma-max-bits
13510 Maximum number of bits for which we avoid creating FMAs.
13512 @item sms-loop-average-count-threshold
13513 A threshold on the average loop count considered by the swing modulo scheduler.
13515 @item sms-dfa-history
13516 The number of cycles the swing modulo scheduler considers when checking
13517 conflicts using DFA.
13519 @item max-inline-insns-recursive-auto
13520 The maximum number of instructions non-inline function
13521 can grow to via recursive inlining.
13523 @item graphite-allow-codegen-errors
13524 Whether codegen errors should be ICEs when @option{-fchecking}.
13526 @item sms-max-ii-factor
13527 A factor for tuning the upper bound that swing modulo scheduler
13528 uses for scheduling a loop.
13530 @item lra-max-considered-reload-pseudos
13531 The max number of reload pseudos which are considered during
13532 spilling a non-reload pseudo.
13534 @item max-pow-sqrt-depth
13535 Maximum depth of sqrt chains to use when synthesizing exponentiation
13536 by a real constant.
13538 @item max-dse-active-local-stores
13539 Maximum number of active local stores in RTL dead store elimination.
13541 @item asan-instrument-allocas
13542 Enable asan allocas/VLAs protection.
13544 @item max-iterations-computation-cost
13545 Bound on the cost of an expression to compute the number of iterations.
13547 @item max-isl-operations
13548 Maximum number of isl operations, 0 means unlimited.
13550 @item graphite-max-arrays-per-scop
13551 Maximum number of arrays per scop.
13553 @item max-vartrack-reverse-op-size
13554 Max. size of loc list for which reverse ops should be added.
13556 @item tracer-dynamic-coverage-feedback
13557 The percentage of function, weighted by execution frequency,
13558 that must be covered by trace formation.
13559 Used when profile feedback is available.
13561 @item max-inline-recursive-depth-auto
13562 The maximum depth of recursive inlining for non-inline functions.
13564 @item fsm-scale-path-stmts
13565 Scale factor to apply to the number of statements in a threading path
13566 when comparing to the number of (scaled) blocks.
13568 @item fsm-maximum-phi-arguments
13569 Maximum number of arguments a PHI may have before the FSM threader
13570 will not try to thread through its block.
13572 @item uninit-control-dep-attempts
13573 Maximum number of nested calls to search for control dependencies
13574 during uninitialized variable analysis.
13576 @item sra-max-scalarization-size-Osize
13577 Maximum size, in storage units, of an aggregate
13578 which should be considered for scalarization when compiling for size.
13580 @item fsm-scale-path-blocks
13581 Scale factor to apply to the number of blocks in a threading path
13582 when comparing to the number of (scaled) statements.
13584 @item sched-autopref-queue-depth
13585 Hardware autoprefetcher scheduler model control flag.
13586 Number of lookahead cycles the model looks into; at '
13587 ' only enable instruction sorting heuristic.
13589 @item loop-versioning-max-inner-insns
13590 The maximum number of instructions that an inner loop can have
13591 before the loop versioning pass considers it too big to copy.
13593 @item loop-versioning-max-outer-insns
13594 The maximum number of instructions that an outer loop can have
13595 before the loop versioning pass considers it too big to copy,
13596 discounting any instructions in inner loops that directly benefit
13599 @item ssa-name-def-chain-limit
13600 The maximum number of SSA_NAME assignments to follow in determining
13601 a property of a variable such as its value. This limits the number
13602 of iterations or recursive calls GCC performs when optimizing certain
13603 statements or when determining their validity prior to issuing
13606 @item store-merging-max-size
13607 Maximum size of a single store merging region in bytes.
13609 @item hash-table-verification-limit
13610 The number of elements for which hash table verification is done
13611 for each searched element.
13613 @item max-find-base-term-values
13614 Maximum number of VALUEs handled during a single find_base_term call.
13616 @item analyzer-max-enodes-per-program-point
13617 The maximum number of exploded nodes per program point within
13618 the analyzer, before terminating analysis of that point.
13620 @item analyzer-min-snodes-for-call-summary
13621 The minimum number of supernodes within a function for the
13622 analyzer to consider summarizing its effects at call sites.
13624 @item analyzer-max-recursion-depth
13625 The maximum number of times a callsite can appear in a call stack
13626 within the analyzer, before terminating analysis of a call that would
13629 @item gimple-fe-computed-hot-bb-threshold
13630 The number of executions of a basic block which is considered hot.
13631 The parameter is used only in GIMPLE FE.
13633 @item analyzer-bb-explosion-factor
13634 The maximum number of 'after supernode' exploded nodes within the analyzer
13635 per supernode, before terminating analysis.
13639 The following choices of @var{name} are available on AArch64 targets:
13642 @item aarch64-sve-compare-costs
13643 When vectorizing for SVE, consider using ``unpacked'' vectors for
13644 smaller elements and use the cost model to pick the cheapest approach.
13645 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
13647 Using unpacked vectors includes storing smaller elements in larger
13648 containers and accessing elements with extending loads and truncating
13651 @item aarch64-float-recp-precision
13652 The number of Newton iterations for calculating the reciprocal for float type.
13653 The precision of division is proportional to this param when division
13654 approximation is enabled. The default value is 1.
13656 @item aarch64-double-recp-precision
13657 The number of Newton iterations for calculating the reciprocal for double type.
13658 The precision of division is propotional to this param when division
13659 approximation is enabled. The default value is 2.
13665 @node Instrumentation Options
13666 @section Program Instrumentation Options
13667 @cindex instrumentation options
13668 @cindex program instrumentation options
13669 @cindex run-time error checking options
13670 @cindex profiling options
13671 @cindex options, program instrumentation
13672 @cindex options, run-time error checking
13673 @cindex options, profiling
13675 GCC supports a number of command-line options that control adding
13676 run-time instrumentation to the code it normally generates.
13677 For example, one purpose of instrumentation is collect profiling
13678 statistics for use in finding program hot spots, code coverage
13679 analysis, or profile-guided optimizations.
13680 Another class of program instrumentation is adding run-time checking
13681 to detect programming errors like invalid pointer
13682 dereferences or out-of-bounds array accesses, as well as deliberately
13683 hostile attacks such as stack smashing or C++ vtable hijacking.
13684 There is also a general hook which can be used to implement other
13685 forms of tracing or function-level instrumentation for debug or
13686 program analysis purposes.
13689 @cindex @command{prof}
13690 @cindex @command{gprof}
13695 Generate extra code to write profile information suitable for the
13696 analysis program @command{prof} (for @option{-p}) or @command{gprof}
13697 (for @option{-pg}). You must use this option when compiling
13698 the source files you want data about, and you must also use it when
13701 You can use the function attribute @code{no_instrument_function} to
13702 suppress profiling of individual functions when compiling with these options.
13703 @xref{Common Function Attributes}.
13705 @item -fprofile-arcs
13706 @opindex fprofile-arcs
13707 Add code so that program flow @dfn{arcs} are instrumented. During
13708 execution the program records how many times each branch and call is
13709 executed and how many times it is taken or returns. On targets that support
13710 constructors with priority support, profiling properly handles constructors,
13711 destructors and C++ constructors (and destructors) of classes which are used
13712 as a type of a global variable.
13715 program exits it saves this data to a file called
13716 @file{@var{auxname}.gcda} for each source file. The data may be used for
13717 profile-directed optimizations (@option{-fbranch-probabilities}), or for
13718 test coverage analysis (@option{-ftest-coverage}). Each object file's
13719 @var{auxname} is generated from the name of the output file, if
13720 explicitly specified and it is not the final executable, otherwise it is
13721 the basename of the source file. In both cases any suffix is removed
13722 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
13723 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
13724 @xref{Cross-profiling}.
13726 @cindex @command{gcov}
13730 This option is used to compile and link code instrumented for coverage
13731 analysis. The option is a synonym for @option{-fprofile-arcs}
13732 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
13733 linking). See the documentation for those options for more details.
13738 Compile the source files with @option{-fprofile-arcs} plus optimization
13739 and code generation options. For test coverage analysis, use the
13740 additional @option{-ftest-coverage} option. You do not need to profile
13741 every source file in a program.
13744 Compile the source files additionally with @option{-fprofile-abs-path}
13745 to create absolute path names in the @file{.gcno} files. This allows
13746 @command{gcov} to find the correct sources in projects where compilations
13747 occur with different working directories.
13750 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
13751 (the latter implies the former).
13754 Run the program on a representative workload to generate the arc profile
13755 information. This may be repeated any number of times. You can run
13756 concurrent instances of your program, and provided that the file system
13757 supports locking, the data files will be correctly updated. Unless
13758 a strict ISO C dialect option is in effect, @code{fork} calls are
13759 detected and correctly handled without double counting.
13762 For profile-directed optimizations, compile the source files again with
13763 the same optimization and code generation options plus
13764 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
13765 Control Optimization}).
13768 For test coverage analysis, use @command{gcov} to produce human readable
13769 information from the @file{.gcno} and @file{.gcda} files. Refer to the
13770 @command{gcov} documentation for further information.
13774 With @option{-fprofile-arcs}, for each function of your program GCC
13775 creates a program flow graph, then finds a spanning tree for the graph.
13776 Only arcs that are not on the spanning tree have to be instrumented: the
13777 compiler adds code to count the number of times that these arcs are
13778 executed. When an arc is the only exit or only entrance to a block, the
13779 instrumentation code can be added to the block; otherwise, a new basic
13780 block must be created to hold the instrumentation code.
13783 @item -ftest-coverage
13784 @opindex ftest-coverage
13785 Produce a notes file that the @command{gcov} code-coverage utility
13786 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
13787 show program coverage. Each source file's note file is called
13788 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
13789 above for a description of @var{auxname} and instructions on how to
13790 generate test coverage data. Coverage data matches the source files
13791 more closely if you do not optimize.
13793 @item -fprofile-abs-path
13794 @opindex fprofile-abs-path
13795 Automatically convert relative source file names to absolute path names
13796 in the @file{.gcno} files. This allows @command{gcov} to find the correct
13797 sources in projects where compilations occur with different working
13800 @item -fprofile-dir=@var{path}
13801 @opindex fprofile-dir
13803 Set the directory to search for the profile data files in to @var{path}.
13804 This option affects only the profile data generated by
13805 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
13806 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
13807 and its related options. Both absolute and relative paths can be used.
13808 By default, GCC uses the current directory as @var{path}, thus the
13809 profile data file appears in the same directory as the object file.
13810 In order to prevent the file name clashing, if the object file name is
13811 not an absolute path, we mangle the absolute path of the
13812 @file{@var{sourcename}.gcda} file and use it as the file name of a
13813 @file{.gcda} file. See similar option @option{-fprofile-note}.
13815 When an executable is run in a massive parallel environment, it is recommended
13816 to save profile to different folders. That can be done with variables
13817 in @var{path} that are exported during run-time:
13825 value of environment variable @var{VAR}
13829 @item -fprofile-generate
13830 @itemx -fprofile-generate=@var{path}
13831 @opindex fprofile-generate
13833 Enable options usually used for instrumenting application to produce
13834 profile useful for later recompilation with profile feedback based
13835 optimization. You must use @option{-fprofile-generate} both when
13836 compiling and when linking your program.
13838 The following options are enabled:
13839 @option{-fprofile-arcs}, @option{-fprofile-values},
13840 @option{-finline-functions}, and @option{-fipa-bit-cp}.
13842 If @var{path} is specified, GCC looks at the @var{path} to find
13843 the profile feedback data files. See @option{-fprofile-dir}.
13845 To optimize the program based on the collected profile information, use
13846 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
13848 @item -fprofile-note=@var{path}
13849 @opindex fprofile-note
13851 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
13852 location. If you combine the option with multiple source files,
13853 the @file{.gcno} file will be overwritten.
13855 @item -fprofile-prefix-path=@var{path}
13856 @opindex fprofile-prefix-path
13858 This option can be used in combination with
13859 @option{profile-generate=}@var{profile_dir} and
13860 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
13861 directory of built source tree. By default @var{profile_dir} will contain
13862 files with mangled absolute paths of all object files in the built project.
13863 This is not desirable when directory used to build the instrumented binary
13864 differs from the directory used to build the binary optimized with profile
13865 feedback because the profile data will not be found during the optimized build.
13866 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
13867 pointing to the base directory of the build can be used to strip the irrelevant
13868 part of the path and keep all file names relative to the main build directory.
13870 @item -fprofile-update=@var{method}
13871 @opindex fprofile-update
13873 Alter the update method for an application instrumented for profile
13874 feedback based optimization. The @var{method} argument should be one of
13875 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
13876 The first one is useful for single-threaded applications,
13877 while the second one prevents profile corruption by emitting thread-safe code.
13879 @strong{Warning:} When an application does not properly join all threads
13880 (or creates an detached thread), a profile file can be still corrupted.
13882 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
13883 when supported by a target, or to @samp{single} otherwise. The GCC driver
13884 automatically selects @samp{prefer-atomic} when @option{-pthread}
13885 is present in the command line.
13887 @item -fprofile-filter-files=@var{regex}
13888 @opindex fprofile-filter-files
13890 Instrument only functions from files whose name matches
13891 any of the regular expressions (separated by semi-colons).
13893 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
13894 only @file{main.c} and all C files starting with 'module'.
13896 @item -fprofile-exclude-files=@var{regex}
13897 @opindex fprofile-exclude-files
13899 Instrument only functions from files whose name does not match
13900 any of the regular expressions (separated by semi-colons).
13902 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
13903 of all files that are located in the @file{/usr/} folder.
13905 @item -fprofile-reproducible
13906 @opindex fprofile-reproducible
13907 Control level of reproducibility of profile gathered by
13908 @code{-fprofile-generate}. This makes it possible to rebuild program
13909 with same outcome which is useful, for example, for distribution
13912 With @option{-fprofile-reproducibility=serial} the profile gathered by
13913 @option{-fprofile-generate} is reproducible provided the trained program
13914 behaves the same at each invocation of the train run, it is not
13915 multi-threaded and profile data streaming is always done in the same
13916 order. Note that profile streaming happens at the end of program run but
13917 also before @code{fork} function is invoked.
13919 Note that it is quite common that execution counts of some part of
13920 programs depends, for example, on length of temporary file names or
13921 memory space randomization (that may affect hash-table collision rate).
13922 Such non-reproducible part of programs may be annotated by
13923 @code{no_instrument_function} function attribute. @code{gcov-dump} with
13924 @option{-l} can be used to dump gathered data and verify that they are
13925 indeed reproducible.
13927 With @option{-fprofile-reproducibility=parallel-runs} collected profile
13928 stays reproducible regardless the order of streaming of the data into
13929 gcda files. This setting makes it possible to run multiple instances of
13930 instrumented program in parallel (such as with @code{make -j}). This
13931 reduces quality of gathered data, in particular of indirect call
13934 @item -fsanitize=address
13935 @opindex fsanitize=address
13936 Enable AddressSanitizer, a fast memory error detector.
13937 Memory access instructions are instrumented to detect
13938 out-of-bounds and use-after-free bugs.
13939 The option enables @option{-fsanitize-address-use-after-scope}.
13940 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
13941 more details. The run-time behavior can be influenced using the
13942 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
13943 the available options are shown at startup of the instrumented program. See
13944 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
13945 for a list of supported options.
13946 The option cannot be combined with @option{-fsanitize=thread}.
13948 @item -fsanitize=kernel-address
13949 @opindex fsanitize=kernel-address
13950 Enable AddressSanitizer for Linux kernel.
13951 See @uref{https://github.com/google/kasan/wiki} for more details.
13953 @item -fsanitize=pointer-compare
13954 @opindex fsanitize=pointer-compare
13955 Instrument comparison operation (<, <=, >, >=) with pointer operands.
13956 The option must be combined with either @option{-fsanitize=kernel-address} or
13957 @option{-fsanitize=address}
13958 The option cannot be combined with @option{-fsanitize=thread}.
13959 Note: By default the check is disabled at run time. To enable it,
13960 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13961 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13962 invalid operation only when both pointers are non-null.
13964 @item -fsanitize=pointer-subtract
13965 @opindex fsanitize=pointer-subtract
13966 Instrument subtraction with pointer operands.
13967 The option must be combined with either @option{-fsanitize=kernel-address} or
13968 @option{-fsanitize=address}
13969 The option cannot be combined with @option{-fsanitize=thread}.
13970 Note: By default the check is disabled at run time. To enable it,
13971 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13972 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13973 invalid operation only when both pointers are non-null.
13975 @item -fsanitize=thread
13976 @opindex fsanitize=thread
13977 Enable ThreadSanitizer, a fast data race detector.
13978 Memory access instructions are instrumented to detect
13979 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
13980 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
13981 environment variable; see
13982 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
13984 The option cannot be combined with @option{-fsanitize=address},
13985 @option{-fsanitize=leak}.
13987 Note that sanitized atomic builtins cannot throw exceptions when
13988 operating on invalid memory addresses with non-call exceptions
13989 (@option{-fnon-call-exceptions}).
13991 @item -fsanitize=leak
13992 @opindex fsanitize=leak
13993 Enable LeakSanitizer, a memory leak detector.
13994 This option only matters for linking of executables and
13995 the executable is linked against a library that overrides @code{malloc}
13996 and other allocator functions. See
13997 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
13998 details. The run-time behavior can be influenced using the
13999 @env{LSAN_OPTIONS} environment variable.
14000 The option cannot be combined with @option{-fsanitize=thread}.
14002 @item -fsanitize=undefined
14003 @opindex fsanitize=undefined
14004 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
14005 Various computations are instrumented to detect undefined behavior
14006 at runtime. Current suboptions are:
14010 @item -fsanitize=shift
14011 @opindex fsanitize=shift
14012 This option enables checking that the result of a shift operation is
14013 not undefined. Note that what exactly is considered undefined differs
14014 slightly between C and C++, as well as between ISO C90 and C99, etc.
14015 This option has two suboptions, @option{-fsanitize=shift-base} and
14016 @option{-fsanitize=shift-exponent}.
14018 @item -fsanitize=shift-exponent
14019 @opindex fsanitize=shift-exponent
14020 This option enables checking that the second argument of a shift operation
14021 is not negative and is smaller than the precision of the promoted first
14024 @item -fsanitize=shift-base
14025 @opindex fsanitize=shift-base
14026 If the second argument of a shift operation is within range, check that the
14027 result of a shift operation is not undefined. Note that what exactly is
14028 considered undefined differs slightly between C and C++, as well as between
14029 ISO C90 and C99, etc.
14031 @item -fsanitize=integer-divide-by-zero
14032 @opindex fsanitize=integer-divide-by-zero
14033 Detect integer division by zero as well as @code{INT_MIN / -1} division.
14035 @item -fsanitize=unreachable
14036 @opindex fsanitize=unreachable
14037 With this option, the compiler turns the @code{__builtin_unreachable}
14038 call into a diagnostics message call instead. When reaching the
14039 @code{__builtin_unreachable} call, the behavior is undefined.
14041 @item -fsanitize=vla-bound
14042 @opindex fsanitize=vla-bound
14043 This option instructs the compiler to check that the size of a variable
14044 length array is positive.
14046 @item -fsanitize=null
14047 @opindex fsanitize=null
14048 This option enables pointer checking. Particularly, the application
14049 built with this option turned on will issue an error message when it
14050 tries to dereference a NULL pointer, or if a reference (possibly an
14051 rvalue reference) is bound to a NULL pointer, or if a method is invoked
14052 on an object pointed by a NULL pointer.
14054 @item -fsanitize=return
14055 @opindex fsanitize=return
14056 This option enables return statement checking. Programs
14057 built with this option turned on will issue an error message
14058 when the end of a non-void function is reached without actually
14059 returning a value. This option works in C++ only.
14061 @item -fsanitize=signed-integer-overflow
14062 @opindex fsanitize=signed-integer-overflow
14063 This option enables signed integer overflow checking. We check that
14064 the result of @code{+}, @code{*}, and both unary and binary @code{-}
14065 does not overflow in the signed arithmetics. Note, integer promotion
14066 rules must be taken into account. That is, the following is not an
14069 signed char a = SCHAR_MAX;
14073 @item -fsanitize=bounds
14074 @opindex fsanitize=bounds
14075 This option enables instrumentation of array bounds. Various out of bounds
14076 accesses are detected. Flexible array members, flexible array member-like
14077 arrays, and initializers of variables with static storage are not instrumented.
14079 @item -fsanitize=bounds-strict
14080 @opindex fsanitize=bounds-strict
14081 This option enables strict instrumentation of array bounds. Most out of bounds
14082 accesses are detected, including flexible array members and flexible array
14083 member-like arrays. Initializers of variables with static storage are not
14086 @item -fsanitize=alignment
14087 @opindex fsanitize=alignment
14089 This option enables checking of alignment of pointers when they are
14090 dereferenced, or when a reference is bound to insufficiently aligned target,
14091 or when a method or constructor is invoked on insufficiently aligned object.
14093 @item -fsanitize=object-size
14094 @opindex fsanitize=object-size
14095 This option enables instrumentation of memory references using the
14096 @code{__builtin_object_size} function. Various out of bounds pointer
14097 accesses are detected.
14099 @item -fsanitize=float-divide-by-zero
14100 @opindex fsanitize=float-divide-by-zero
14101 Detect floating-point division by zero. Unlike other similar options,
14102 @option{-fsanitize=float-divide-by-zero} is not enabled by
14103 @option{-fsanitize=undefined}, since floating-point division by zero can
14104 be a legitimate way of obtaining infinities and NaNs.
14106 @item -fsanitize=float-cast-overflow
14107 @opindex fsanitize=float-cast-overflow
14108 This option enables floating-point type to integer conversion checking.
14109 We check that the result of the conversion does not overflow.
14110 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
14111 not enabled by @option{-fsanitize=undefined}.
14112 This option does not work well with @code{FE_INVALID} exceptions enabled.
14114 @item -fsanitize=nonnull-attribute
14115 @opindex fsanitize=nonnull-attribute
14117 This option enables instrumentation of calls, checking whether null values
14118 are not passed to arguments marked as requiring a non-null value by the
14119 @code{nonnull} function attribute.
14121 @item -fsanitize=returns-nonnull-attribute
14122 @opindex fsanitize=returns-nonnull-attribute
14124 This option enables instrumentation of return statements in functions
14125 marked with @code{returns_nonnull} function attribute, to detect returning
14126 of null values from such functions.
14128 @item -fsanitize=bool
14129 @opindex fsanitize=bool
14131 This option enables instrumentation of loads from bool. If a value other
14132 than 0/1 is loaded, a run-time error is issued.
14134 @item -fsanitize=enum
14135 @opindex fsanitize=enum
14137 This option enables instrumentation of loads from an enum type. If
14138 a value outside the range of values for the enum type is loaded,
14139 a run-time error is issued.
14141 @item -fsanitize=vptr
14142 @opindex fsanitize=vptr
14144 This option enables instrumentation of C++ member function calls, member
14145 accesses and some conversions between pointers to base and derived classes,
14146 to verify the referenced object has the correct dynamic type.
14148 @item -fsanitize=pointer-overflow
14149 @opindex fsanitize=pointer-overflow
14151 This option enables instrumentation of pointer arithmetics. If the pointer
14152 arithmetics overflows, a run-time error is issued.
14154 @item -fsanitize=builtin
14155 @opindex fsanitize=builtin
14157 This option enables instrumentation of arguments to selected builtin
14158 functions. If an invalid value is passed to such arguments, a run-time
14159 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
14160 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
14165 While @option{-ftrapv} causes traps for signed overflows to be emitted,
14166 @option{-fsanitize=undefined} gives a diagnostic message.
14167 This currently works only for the C family of languages.
14169 @item -fno-sanitize=all
14170 @opindex fno-sanitize=all
14172 This option disables all previously enabled sanitizers.
14173 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
14176 @item -fasan-shadow-offset=@var{number}
14177 @opindex fasan-shadow-offset
14178 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
14179 It is useful for experimenting with different shadow memory layouts in
14180 Kernel AddressSanitizer.
14182 @item -fsanitize-sections=@var{s1},@var{s2},...
14183 @opindex fsanitize-sections
14184 Sanitize global variables in selected user-defined sections. @var{si} may
14187 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
14188 @opindex fsanitize-recover
14189 @opindex fno-sanitize-recover
14190 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
14191 mentioned in comma-separated list of @var{opts}. Enabling this option
14192 for a sanitizer component causes it to attempt to continue
14193 running the program as if no error happened. This means multiple
14194 runtime errors can be reported in a single program run, and the exit
14195 code of the program may indicate success even when errors
14196 have been reported. The @option{-fno-sanitize-recover=} option
14197 can be used to alter
14198 this behavior: only the first detected error is reported
14199 and program then exits with a non-zero exit code.
14201 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
14202 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
14203 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
14204 @option{-fsanitize=bounds-strict},
14205 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
14206 For these sanitizers error recovery is turned on by default,
14207 except @option{-fsanitize=address}, for which this feature is experimental.
14208 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
14209 accepted, the former enables recovery for all sanitizers that support it,
14210 the latter disables recovery for all sanitizers that support it.
14212 Even if a recovery mode is turned on the compiler side, it needs to be also
14213 enabled on the runtime library side, otherwise the failures are still fatal.
14214 The runtime library defaults to @code{halt_on_error=0} for
14215 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
14216 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
14217 setting the @code{halt_on_error} flag in the corresponding environment variable.
14219 Syntax without an explicit @var{opts} parameter is deprecated. It is
14220 equivalent to specifying an @var{opts} list of:
14223 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
14226 @item -fsanitize-address-use-after-scope
14227 @opindex fsanitize-address-use-after-scope
14228 Enable sanitization of local variables to detect use-after-scope bugs.
14229 The option sets @option{-fstack-reuse} to @samp{none}.
14231 @item -fsanitize-undefined-trap-on-error
14232 @opindex fsanitize-undefined-trap-on-error
14233 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
14234 report undefined behavior using @code{__builtin_trap} rather than
14235 a @code{libubsan} library routine. The advantage of this is that the
14236 @code{libubsan} library is not needed and is not linked in, so this
14237 is usable even in freestanding environments.
14239 @item -fsanitize-coverage=trace-pc
14240 @opindex fsanitize-coverage=trace-pc
14241 Enable coverage-guided fuzzing code instrumentation.
14242 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
14244 @item -fsanitize-coverage=trace-cmp
14245 @opindex fsanitize-coverage=trace-cmp
14246 Enable dataflow guided fuzzing code instrumentation.
14247 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
14248 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
14249 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
14250 variable or @code{__sanitizer_cov_trace_const_cmp1},
14251 @code{__sanitizer_cov_trace_const_cmp2},
14252 @code{__sanitizer_cov_trace_const_cmp4} or
14253 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
14254 operand constant, @code{__sanitizer_cov_trace_cmpf} or
14255 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
14256 @code{__sanitizer_cov_trace_switch} for switch statements.
14258 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
14259 @opindex fcf-protection
14260 Enable code instrumentation of control-flow transfers to increase
14261 program security by checking that target addresses of control-flow
14262 transfer instructions (such as indirect function call, function return,
14263 indirect jump) are valid. This prevents diverting the flow of control
14264 to an unexpected target. This is intended to protect against such
14265 threats as Return-oriented Programming (ROP), and similarly
14266 call/jmp-oriented programming (COP/JOP).
14268 The value @code{branch} tells the compiler to implement checking of
14269 validity of control-flow transfer at the point of indirect branch
14270 instructions, i.e.@: call/jmp instructions. The value @code{return}
14271 implements checking of validity at the point of returning from a
14272 function. The value @code{full} is an alias for specifying both
14273 @code{branch} and @code{return}. The value @code{none} turns off
14276 The value @code{check} is used for the final link with link-time
14277 optimization (LTO). An error is issued if LTO object files are
14278 compiled with different @option{-fcf-protection} values. The
14279 value @code{check} is ignored at the compile time.
14281 The macro @code{__CET__} is defined when @option{-fcf-protection} is
14282 used. The first bit of @code{__CET__} is set to 1 for the value
14283 @code{branch} and the second bit of @code{__CET__} is set to 1 for
14286 You can also use the @code{nocf_check} attribute to identify
14287 which functions and calls should be skipped from instrumentation
14288 (@pxref{Function Attributes}).
14290 Currently the x86 GNU/Linux target provides an implementation based
14291 on Intel Control-flow Enforcement Technology (CET).
14293 @item -fstack-protector
14294 @opindex fstack-protector
14295 Emit extra code to check for buffer overflows, such as stack smashing
14296 attacks. This is done by adding a guard variable to functions with
14297 vulnerable objects. This includes functions that call @code{alloca}, and
14298 functions with buffers larger than or equal to 8 bytes. The guards are
14299 initialized when a function is entered and then checked when the function
14300 exits. If a guard check fails, an error message is printed and the program
14301 exits. Only variables that are actually allocated on the stack are
14302 considered, optimized away variables or variables allocated in registers
14305 @item -fstack-protector-all
14306 @opindex fstack-protector-all
14307 Like @option{-fstack-protector} except that all functions are protected.
14309 @item -fstack-protector-strong
14310 @opindex fstack-protector-strong
14311 Like @option{-fstack-protector} but includes additional functions to
14312 be protected --- those that have local array definitions, or have
14313 references to local frame addresses. Only variables that are actually
14314 allocated on the stack are considered, optimized away variables or variables
14315 allocated in registers don't count.
14317 @item -fstack-protector-explicit
14318 @opindex fstack-protector-explicit
14319 Like @option{-fstack-protector} but only protects those functions which
14320 have the @code{stack_protect} attribute.
14322 @item -fstack-check
14323 @opindex fstack-check
14324 Generate code to verify that you do not go beyond the boundary of the
14325 stack. You should specify this flag if you are running in an
14326 environment with multiple threads, but you only rarely need to specify it in
14327 a single-threaded environment since stack overflow is automatically
14328 detected on nearly all systems if there is only one stack.
14330 Note that this switch does not actually cause checking to be done; the
14331 operating system or the language runtime must do that. The switch causes
14332 generation of code to ensure that they see the stack being extended.
14334 You can additionally specify a string parameter: @samp{no} means no
14335 checking, @samp{generic} means force the use of old-style checking,
14336 @samp{specific} means use the best checking method and is equivalent
14337 to bare @option{-fstack-check}.
14339 Old-style checking is a generic mechanism that requires no specific
14340 target support in the compiler but comes with the following drawbacks:
14344 Modified allocation strategy for large objects: they are always
14345 allocated dynamically if their size exceeds a fixed threshold. Note this
14346 may change the semantics of some code.
14349 Fixed limit on the size of the static frame of functions: when it is
14350 topped by a particular function, stack checking is not reliable and
14351 a warning is issued by the compiler.
14354 Inefficiency: because of both the modified allocation strategy and the
14355 generic implementation, code performance is hampered.
14358 Note that old-style stack checking is also the fallback method for
14359 @samp{specific} if no target support has been added in the compiler.
14361 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
14362 and stack overflows. @samp{specific} is an excellent choice when compiling
14363 Ada code. It is not generally sufficient to protect against stack-clash
14364 attacks. To protect against those you want @samp{-fstack-clash-protection}.
14366 @item -fstack-clash-protection
14367 @opindex fstack-clash-protection
14368 Generate code to prevent stack clash style attacks. When this option is
14369 enabled, the compiler will only allocate one page of stack space at a time
14370 and each page is accessed immediately after allocation. Thus, it prevents
14371 allocations from jumping over any stack guard page provided by the
14374 Most targets do not fully support stack clash protection. However, on
14375 those targets @option{-fstack-clash-protection} will protect dynamic stack
14376 allocations. @option{-fstack-clash-protection} may also provide limited
14377 protection for static stack allocations if the target supports
14378 @option{-fstack-check=specific}.
14380 @item -fstack-limit-register=@var{reg}
14381 @itemx -fstack-limit-symbol=@var{sym}
14382 @itemx -fno-stack-limit
14383 @opindex fstack-limit-register
14384 @opindex fstack-limit-symbol
14385 @opindex fno-stack-limit
14386 Generate code to ensure that the stack does not grow beyond a certain value,
14387 either the value of a register or the address of a symbol. If a larger
14388 stack is required, a signal is raised at run time. For most targets,
14389 the signal is raised before the stack overruns the boundary, so
14390 it is possible to catch the signal without taking special precautions.
14392 For instance, if the stack starts at absolute address @samp{0x80000000}
14393 and grows downwards, you can use the flags
14394 @option{-fstack-limit-symbol=__stack_limit} and
14395 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
14396 of 128KB@. Note that this may only work with the GNU linker.
14398 You can locally override stack limit checking by using the
14399 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
14401 @item -fsplit-stack
14402 @opindex fsplit-stack
14403 Generate code to automatically split the stack before it overflows.
14404 The resulting program has a discontiguous stack which can only
14405 overflow if the program is unable to allocate any more memory. This
14406 is most useful when running threaded programs, as it is no longer
14407 necessary to calculate a good stack size to use for each thread. This
14408 is currently only implemented for the x86 targets running
14411 When code compiled with @option{-fsplit-stack} calls code compiled
14412 without @option{-fsplit-stack}, there may not be much stack space
14413 available for the latter code to run. If compiling all code,
14414 including library code, with @option{-fsplit-stack} is not an option,
14415 then the linker can fix up these calls so that the code compiled
14416 without @option{-fsplit-stack} always has a large stack. Support for
14417 this is implemented in the gold linker in GNU binutils release 2.21
14420 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
14421 @opindex fvtable-verify
14422 This option is only available when compiling C++ code.
14423 It turns on (or off, if using @option{-fvtable-verify=none}) the security
14424 feature that verifies at run time, for every virtual call, that
14425 the vtable pointer through which the call is made is valid for the type of
14426 the object, and has not been corrupted or overwritten. If an invalid vtable
14427 pointer is detected at run time, an error is reported and execution of the
14428 program is immediately halted.
14430 This option causes run-time data structures to be built at program startup,
14431 which are used for verifying the vtable pointers.
14432 The options @samp{std} and @samp{preinit}
14433 control the timing of when these data structures are built. In both cases the
14434 data structures are built before execution reaches @code{main}. Using
14435 @option{-fvtable-verify=std} causes the data structures to be built after
14436 shared libraries have been loaded and initialized.
14437 @option{-fvtable-verify=preinit} causes them to be built before shared
14438 libraries have been loaded and initialized.
14440 If this option appears multiple times in the command line with different
14441 values specified, @samp{none} takes highest priority over both @samp{std} and
14442 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
14445 @opindex fvtv-debug
14446 When used in conjunction with @option{-fvtable-verify=std} or
14447 @option{-fvtable-verify=preinit}, causes debug versions of the
14448 runtime functions for the vtable verification feature to be called.
14449 This flag also causes the compiler to log information about which
14450 vtable pointers it finds for each class.
14451 This information is written to a file named @file{vtv_set_ptr_data.log}
14452 in the directory named by the environment variable @env{VTV_LOGS_DIR}
14453 if that is defined or the current working directory otherwise.
14455 Note: This feature @emph{appends} data to the log file. If you want a fresh log
14456 file, be sure to delete any existing one.
14459 @opindex fvtv-counts
14460 This is a debugging flag. When used in conjunction with
14461 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
14462 causes the compiler to keep track of the total number of virtual calls
14463 it encounters and the number of verifications it inserts. It also
14464 counts the number of calls to certain run-time library functions
14465 that it inserts and logs this information for each compilation unit.
14466 The compiler writes this information to a file named
14467 @file{vtv_count_data.log} in the directory named by the environment
14468 variable @env{VTV_LOGS_DIR} if that is defined or the current working
14469 directory otherwise. It also counts the size of the vtable pointer sets
14470 for each class, and writes this information to @file{vtv_class_set_sizes.log}
14471 in the same directory.
14473 Note: This feature @emph{appends} data to the log files. To get fresh log
14474 files, be sure to delete any existing ones.
14476 @item -finstrument-functions
14477 @opindex finstrument-functions
14478 Generate instrumentation calls for entry and exit to functions. Just
14479 after function entry and just before function exit, the following
14480 profiling functions are called with the address of the current
14481 function and its call site. (On some platforms,
14482 @code{__builtin_return_address} does not work beyond the current
14483 function, so the call site information may not be available to the
14484 profiling functions otherwise.)
14487 void __cyg_profile_func_enter (void *this_fn,
14489 void __cyg_profile_func_exit (void *this_fn,
14493 The first argument is the address of the start of the current function,
14494 which may be looked up exactly in the symbol table.
14496 This instrumentation is also done for functions expanded inline in other
14497 functions. The profiling calls indicate where, conceptually, the
14498 inline function is entered and exited. This means that addressable
14499 versions of such functions must be available. If all your uses of a
14500 function are expanded inline, this may mean an additional expansion of
14501 code size. If you use @code{extern inline} in your C code, an
14502 addressable version of such functions must be provided. (This is
14503 normally the case anyway, but if you get lucky and the optimizer always
14504 expands the functions inline, you might have gotten away without
14505 providing static copies.)
14507 A function may be given the attribute @code{no_instrument_function}, in
14508 which case this instrumentation is not done. This can be used, for
14509 example, for the profiling functions listed above, high-priority
14510 interrupt routines, and any functions from which the profiling functions
14511 cannot safely be called (perhaps signal handlers, if the profiling
14512 routines generate output or allocate memory).
14513 @xref{Common Function Attributes}.
14515 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
14516 @opindex finstrument-functions-exclude-file-list
14518 Set the list of functions that are excluded from instrumentation (see
14519 the description of @option{-finstrument-functions}). If the file that
14520 contains a function definition matches with one of @var{file}, then
14521 that function is not instrumented. The match is done on substrings:
14522 if the @var{file} parameter is a substring of the file name, it is
14523 considered to be a match.
14528 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14532 excludes any inline function defined in files whose pathnames
14533 contain @file{/bits/stl} or @file{include/sys}.
14535 If, for some reason, you want to include letter @samp{,} in one of
14536 @var{sym}, write @samp{\,}. For example,
14537 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
14538 (note the single quote surrounding the option).
14540 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
14541 @opindex finstrument-functions-exclude-function-list
14543 This is similar to @option{-finstrument-functions-exclude-file-list},
14544 but this option sets the list of function names to be excluded from
14545 instrumentation. The function name to be matched is its user-visible
14546 name, such as @code{vector<int> blah(const vector<int> &)}, not the
14547 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
14548 match is done on substrings: if the @var{sym} parameter is a substring
14549 of the function name, it is considered to be a match. For C99 and C++
14550 extended identifiers, the function name must be given in UTF-8, not
14551 using universal character names.
14553 @item -fpatchable-function-entry=@var{N}[,@var{M}]
14554 @opindex fpatchable-function-entry
14555 Generate @var{N} NOPs right at the beginning
14556 of each function, with the function entry point before the @var{M}th NOP.
14557 If @var{M} is omitted, it defaults to @code{0} so the
14558 function entry points to the address just at the first NOP.
14559 The NOP instructions reserve extra space which can be used to patch in
14560 any desired instrumentation at run time, provided that the code segment
14561 is writable. The amount of space is controllable indirectly via
14562 the number of NOPs; the NOP instruction used corresponds to the instruction
14563 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
14564 is target-specific and may also depend on the architecture variant and/or
14565 other compilation options.
14567 For run-time identification, the starting addresses of these areas,
14568 which correspond to their respective function entries minus @var{M},
14569 are additionally collected in the @code{__patchable_function_entries}
14570 section of the resulting binary.
14572 Note that the value of @code{__attribute__ ((patchable_function_entry
14573 (N,M)))} takes precedence over command-line option
14574 @option{-fpatchable-function-entry=N,M}. This can be used to increase
14575 the area size or to remove it completely on a single function.
14576 If @code{N=0}, no pad location is recorded.
14578 The NOP instructions are inserted at---and maybe before, depending on
14579 @var{M}---the function entry address, even before the prologue.
14581 The maximum value of @var{N} and @var{M} is 65535.
14585 @node Preprocessor Options
14586 @section Options Controlling the Preprocessor
14587 @cindex preprocessor options
14588 @cindex options, preprocessor
14590 These options control the C preprocessor, which is run on each C source
14591 file before actual compilation.
14593 If you use the @option{-E} option, nothing is done except preprocessing.
14594 Some of these options make sense only together with @option{-E} because
14595 they cause the preprocessor output to be unsuitable for actual
14598 In addition to the options listed here, there are a number of options
14599 to control search paths for include files documented in
14600 @ref{Directory Options}.
14601 Options to control preprocessor diagnostics are listed in
14602 @ref{Warning Options}.
14605 @include cppopts.texi
14607 @item -Wp,@var{option}
14609 You can use @option{-Wp,@var{option}} to bypass the compiler driver
14610 and pass @var{option} directly through to the preprocessor. If
14611 @var{option} contains commas, it is split into multiple options at the
14612 commas. However, many options are modified, translated or interpreted
14613 by the compiler driver before being passed to the preprocessor, and
14614 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
14615 interface is undocumented and subject to change, so whenever possible
14616 you should avoid using @option{-Wp} and let the driver handle the
14619 @item -Xpreprocessor @var{option}
14620 @opindex Xpreprocessor
14621 Pass @var{option} as an option to the preprocessor. You can use this to
14622 supply system-specific preprocessor options that GCC does not
14625 If you want to pass an option that takes an argument, you must use
14626 @option{-Xpreprocessor} twice, once for the option and once for the argument.
14628 @item -no-integrated-cpp
14629 @opindex no-integrated-cpp
14630 Perform preprocessing as a separate pass before compilation.
14631 By default, GCC performs preprocessing as an integrated part of
14632 input tokenization and parsing.
14633 If this option is provided, the appropriate language front end
14634 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
14635 and Objective-C, respectively) is instead invoked twice,
14636 once for preprocessing only and once for actual compilation
14637 of the preprocessed input.
14638 This option may be useful in conjunction with the @option{-B} or
14639 @option{-wrapper} options to specify an alternate preprocessor or
14640 perform additional processing of the program source between
14641 normal preprocessing and compilation.
14643 @item -flarge-source-files
14644 @opindex flarge-source-files
14645 Adjust GCC to expect large source files, at the expense of slower
14646 compilation and higher memory usage.
14648 Specifically, GCC normally tracks both column numbers and line numbers
14649 within source files and it normally prints both of these numbers in
14650 diagnostics. However, once it has processed a certain number of source
14651 lines, it stops tracking column numbers and only tracks line numbers.
14652 This means that diagnostics for later lines do not include column numbers.
14653 It also means that options like @option{-Wmisleading-indentation} cease to work
14654 at that point, although the compiler prints a note if this happens.
14655 Passing @option{-flarge-source-files} significantly increases the number
14656 of source lines that GCC can process before it stops tracking columns.
14660 @node Assembler Options
14661 @section Passing Options to the Assembler
14663 @c prevent bad page break with this line
14664 You can pass options to the assembler.
14667 @item -Wa,@var{option}
14669 Pass @var{option} as an option to the assembler. If @var{option}
14670 contains commas, it is split into multiple options at the commas.
14672 @item -Xassembler @var{option}
14673 @opindex Xassembler
14674 Pass @var{option} as an option to the assembler. You can use this to
14675 supply system-specific assembler options that GCC does not
14678 If you want to pass an option that takes an argument, you must use
14679 @option{-Xassembler} twice, once for the option and once for the argument.
14684 @section Options for Linking
14685 @cindex link options
14686 @cindex options, linking
14688 These options come into play when the compiler links object files into
14689 an executable output file. They are meaningless if the compiler is
14690 not doing a link step.
14694 @item @var{object-file-name}
14695 A file name that does not end in a special recognized suffix is
14696 considered to name an object file or library. (Object files are
14697 distinguished from libraries by the linker according to the file
14698 contents.) If linking is done, these object files are used as input
14707 If any of these options is used, then the linker is not run, and
14708 object file names should not be used as arguments. @xref{Overall
14711 @item -flinker-output=@var{type}
14712 @opindex flinker-output
14713 This option controls code generation of the link-time optimizer. By
14714 default the linker output is automatically determined by the linker
14715 plugin. For debugging the compiler and if incremental linking with a
14716 non-LTO object file is desired, it may be useful to control the type
14719 If @var{type} is @samp{exec}, code generation produces a static
14720 binary. In this case @option{-fpic} and @option{-fpie} are both
14723 If @var{type} is @samp{dyn}, code generation produces a shared
14724 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
14725 but not enabled automatically. This allows to build shared libraries
14726 without position-independent code on architectures where this is
14727 possible, i.e.@: on x86.
14729 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
14730 executable. This results in similar optimizations as @samp{exec}
14731 except that @option{-fpie} is not disabled if specified at compilation
14734 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
14735 done. The sections containing intermediate code for link-time optimization are
14736 merged, pre-optimized, and output to the resulting object file. In addition, if
14737 @option{-ffat-lto-objects} is specified, binary code is produced for future
14738 non-LTO linking. The object file produced by incremental linking is smaller
14739 than a static library produced from the same object files. At link time the
14740 result of incremental linking also loads faster than a static
14741 library assuming that the majority of objects in the library are used.
14743 Finally @samp{nolto-rel} configures the compiler for incremental linking where
14744 code generation is forced, a final binary is produced, and the intermediate
14745 code for later link-time optimization is stripped. When multiple object files
14746 are linked together the resulting code is better optimized than with
14747 link-time optimizations disabled (for example, cross-module inlining
14748 happens), but most of benefits of whole program optimizations are lost.
14750 During the incremental link (by @option{-r}) the linker plugin defaults to
14751 @option{rel}. With current interfaces to GNU Binutils it is however not
14752 possible to incrementally link LTO objects and non-LTO objects into a single
14753 mixed object file. If any of object files in incremental link cannot
14754 be used for link-time optimization, the linker plugin issues a warning and
14755 uses @samp{nolto-rel}. To maintain whole program optimization, it is
14756 recommended to link such objects into static library instead. Alternatively it
14757 is possible to use H.J. Lu's binutils with support for mixed objects.
14760 @opindex fuse-ld=bfd
14761 Use the @command{bfd} linker instead of the default linker.
14763 @item -fuse-ld=gold
14764 @opindex fuse-ld=gold
14765 Use the @command{gold} linker instead of the default linker.
14768 @opindex fuse-ld=lld
14769 Use the LLVM @command{lld} linker instead of the default linker.
14772 @item -l@var{library}
14773 @itemx -l @var{library}
14775 Search the library named @var{library} when linking. (The second
14776 alternative with the library as a separate argument is only for
14777 POSIX compliance and is not recommended.)
14779 The @option{-l} option is passed directly to the linker by GCC. Refer
14780 to your linker documentation for exact details. The general
14781 description below applies to the GNU linker.
14783 The linker searches a standard list of directories for the library.
14784 The directories searched include several standard system directories
14785 plus any that you specify with @option{-L}.
14787 Static libraries are archives of object files, and have file names
14788 like @file{lib@var{library}.a}. Some targets also support shared
14789 libraries, which typically have names like @file{lib@var{library}.so}.
14790 If both static and shared libraries are found, the linker gives
14791 preference to linking with the shared library unless the
14792 @option{-static} option is used.
14794 It makes a difference where in the command you write this option; the
14795 linker searches and processes libraries and object files in the order they
14796 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
14797 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
14798 to functions in @samp{z}, those functions may not be loaded.
14802 You need this special case of the @option{-l} option in order to
14803 link an Objective-C or Objective-C++ program.
14805 @item -nostartfiles
14806 @opindex nostartfiles
14807 Do not use the standard system startup files when linking.
14808 The standard system libraries are used normally, unless @option{-nostdlib},
14809 @option{-nolibc}, or @option{-nodefaultlibs} is used.
14811 @item -nodefaultlibs
14812 @opindex nodefaultlibs
14813 Do not use the standard system libraries when linking.
14814 Only the libraries you specify are passed to the linker, and options
14815 specifying linkage of the system libraries, such as @option{-static-libgcc}
14816 or @option{-shared-libgcc}, are ignored.
14817 The standard startup files are used normally, unless @option{-nostartfiles}
14820 The compiler may generate calls to @code{memcmp},
14821 @code{memset}, @code{memcpy} and @code{memmove}.
14822 These entries are usually resolved by entries in
14823 libc. These entry points should be supplied through some other
14824 mechanism when this option is specified.
14828 Do not use the C library or system libraries tightly coupled with it when
14829 linking. Still link with the startup files, @file{libgcc} or toolchain
14830 provided language support libraries such as @file{libgnat}, @file{libgfortran}
14831 or @file{libstdc++} unless options preventing their inclusion are used as
14832 well. This typically removes @option{-lc} from the link command line, as well
14833 as system libraries that normally go with it and become meaningless when
14834 absence of a C library is assumed, for example @option{-lpthread} or
14835 @option{-lm} in some configurations. This is intended for bare-board
14836 targets when there is indeed no C library available.
14840 Do not use the standard system startup files or libraries when linking.
14841 No startup files and only the libraries you specify are passed to
14842 the linker, and options specifying linkage of the system libraries, such as
14843 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
14845 The compiler may generate calls to @code{memcmp}, @code{memset},
14846 @code{memcpy} and @code{memmove}.
14847 These entries are usually resolved by entries in
14848 libc. These entry points should be supplied through some other
14849 mechanism when this option is specified.
14851 @cindex @option{-lgcc}, use with @option{-nostdlib}
14852 @cindex @option{-nostdlib} and unresolved references
14853 @cindex unresolved references and @option{-nostdlib}
14854 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14855 @cindex @option{-nodefaultlibs} and unresolved references
14856 @cindex unresolved references and @option{-nodefaultlibs}
14857 One of the standard libraries bypassed by @option{-nostdlib} and
14858 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14859 which GCC uses to overcome shortcomings of particular machines, or special
14860 needs for some languages.
14861 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14862 Collection (GCC) Internals},
14863 for more discussion of @file{libgcc.a}.)
14864 In most cases, you need @file{libgcc.a} even when you want to avoid
14865 other standard libraries. In other words, when you specify @option{-nostdlib}
14866 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14867 This ensures that you have no unresolved references to internal GCC
14868 library subroutines.
14869 (An example of such an internal subroutine is @code{__main}, used to ensure C++
14870 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
14871 GNU Compiler Collection (GCC) Internals}.)
14873 @item -e @var{entry}
14874 @itemx --entry=@var{entry}
14878 Specify that the program entry point is @var{entry}. The argument is
14879 interpreted by the linker; the GNU linker accepts either a symbol name
14884 Produce a dynamically linked position independent executable on targets
14885 that support it. For predictable results, you must also specify the same
14886 set of options used for compilation (@option{-fpie}, @option{-fPIE},
14887 or model suboptions) when you specify this linker option.
14891 Don't produce a dynamically linked position independent executable.
14894 @opindex static-pie
14895 Produce a static position independent executable on targets that support
14896 it. A static position independent executable is similar to a static
14897 executable, but can be loaded at any address without a dynamic linker.
14898 For predictable results, you must also specify the same set of options
14899 used for compilation (@option{-fpie}, @option{-fPIE}, or model
14900 suboptions) when you specify this linker option.
14904 Link with the POSIX threads library. This option is supported on
14905 GNU/Linux targets, most other Unix derivatives, and also on
14906 x86 Cygwin and MinGW targets. On some targets this option also sets
14907 flags for the preprocessor, so it should be used consistently for both
14908 compilation and linking.
14912 Produce a relocatable object as output. This is also known as partial
14917 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14918 that support it. This instructs the linker to add all symbols, not
14919 only used ones, to the dynamic symbol table. This option is needed
14920 for some uses of @code{dlopen} or to allow obtaining backtraces
14921 from within a program.
14925 Remove all symbol table and relocation information from the executable.
14929 On systems that support dynamic linking, this overrides @option{-pie}
14930 and prevents linking with the shared libraries. On other systems, this
14931 option has no effect.
14935 Produce a shared object which can then be linked with other objects to
14936 form an executable. Not all systems support this option. For predictable
14937 results, you must also specify the same set of options used for compilation
14938 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
14939 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
14940 needs to build supplementary stub code for constructors to work. On
14941 multi-libbed systems, @samp{gcc -shared} must select the correct support
14942 libraries to link against. Failing to supply the correct flags may lead
14943 to subtle defects. Supplying them in cases where they are not necessary
14946 @item -shared-libgcc
14947 @itemx -static-libgcc
14948 @opindex shared-libgcc
14949 @opindex static-libgcc
14950 On systems that provide @file{libgcc} as a shared library, these options
14951 force the use of either the shared or static version, respectively.
14952 If no shared version of @file{libgcc} was built when the compiler was
14953 configured, these options have no effect.
14955 There are several situations in which an application should use the
14956 shared @file{libgcc} instead of the static version. The most common
14957 of these is when the application wishes to throw and catch exceptions
14958 across different shared libraries. In that case, each of the libraries
14959 as well as the application itself should use the shared @file{libgcc}.
14961 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
14962 whenever you build a shared library or a main executable, because C++
14963 programs typically use exceptions, so this is the right thing to do.
14965 If, instead, you use the GCC driver to create shared libraries, you may
14966 find that they are not always linked with the shared @file{libgcc}.
14967 If GCC finds, at its configuration time, that you have a non-GNU linker
14968 or a GNU linker that does not support option @option{--eh-frame-hdr},
14969 it links the shared version of @file{libgcc} into shared libraries
14970 by default. Otherwise, it takes advantage of the linker and optimizes
14971 away the linking with the shared version of @file{libgcc}, linking with
14972 the static version of libgcc by default. This allows exceptions to
14973 propagate through such shared libraries, without incurring relocation
14974 costs at library load time.
14976 However, if a library or main executable is supposed to throw or catch
14977 exceptions, you must link it using the G++ driver, or using the option
14978 @option{-shared-libgcc}, such that it is linked with the shared
14981 @item -static-libasan
14982 @opindex static-libasan
14983 When the @option{-fsanitize=address} option is used to link a program,
14984 the GCC driver automatically links against @option{libasan}. If
14985 @file{libasan} is available as a shared library, and the @option{-static}
14986 option is not used, then this links against the shared version of
14987 @file{libasan}. The @option{-static-libasan} option directs the GCC
14988 driver to link @file{libasan} statically, without necessarily linking
14989 other libraries statically.
14991 @item -static-libtsan
14992 @opindex static-libtsan
14993 When the @option{-fsanitize=thread} option is used to link a program,
14994 the GCC driver automatically links against @option{libtsan}. If
14995 @file{libtsan} is available as a shared library, and the @option{-static}
14996 option is not used, then this links against the shared version of
14997 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
14998 driver to link @file{libtsan} statically, without necessarily linking
14999 other libraries statically.
15001 @item -static-liblsan
15002 @opindex static-liblsan
15003 When the @option{-fsanitize=leak} option is used to link a program,
15004 the GCC driver automatically links against @option{liblsan}. If
15005 @file{liblsan} is available as a shared library, and the @option{-static}
15006 option is not used, then this links against the shared version of
15007 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
15008 driver to link @file{liblsan} statically, without necessarily linking
15009 other libraries statically.
15011 @item -static-libubsan
15012 @opindex static-libubsan
15013 When the @option{-fsanitize=undefined} option is used to link a program,
15014 the GCC driver automatically links against @option{libubsan}. If
15015 @file{libubsan} is available as a shared library, and the @option{-static}
15016 option is not used, then this links against the shared version of
15017 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
15018 driver to link @file{libubsan} statically, without necessarily linking
15019 other libraries statically.
15021 @item -static-libstdc++
15022 @opindex static-libstdc++
15023 When the @command{g++} program is used to link a C++ program, it
15024 normally automatically links against @option{libstdc++}. If
15025 @file{libstdc++} is available as a shared library, and the
15026 @option{-static} option is not used, then this links against the
15027 shared version of @file{libstdc++}. That is normally fine. However, it
15028 is sometimes useful to freeze the version of @file{libstdc++} used by
15029 the program without going all the way to a fully static link. The
15030 @option{-static-libstdc++} option directs the @command{g++} driver to
15031 link @file{libstdc++} statically, without necessarily linking other
15032 libraries statically.
15036 Bind references to global symbols when building a shared object. Warn
15037 about any unresolved references (unless overridden by the link editor
15038 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
15041 @item -T @var{script}
15043 @cindex linker script
15044 Use @var{script} as the linker script. This option is supported by most
15045 systems using the GNU linker. On some targets, such as bare-board
15046 targets without an operating system, the @option{-T} option may be required
15047 when linking to avoid references to undefined symbols.
15049 @item -Xlinker @var{option}
15051 Pass @var{option} as an option to the linker. You can use this to
15052 supply system-specific linker options that GCC does not recognize.
15054 If you want to pass an option that takes a separate argument, you must use
15055 @option{-Xlinker} twice, once for the option and once for the argument.
15056 For example, to pass @option{-assert definitions}, you must write
15057 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
15058 @option{-Xlinker "-assert definitions"}, because this passes the entire
15059 string as a single argument, which is not what the linker expects.
15061 When using the GNU linker, it is usually more convenient to pass
15062 arguments to linker options using the @option{@var{option}=@var{value}}
15063 syntax than as separate arguments. For example, you can specify
15064 @option{-Xlinker -Map=output.map} rather than
15065 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
15066 this syntax for command-line options.
15068 @item -Wl,@var{option}
15070 Pass @var{option} as an option to the linker. If @var{option} contains
15071 commas, it is split into multiple options at the commas. You can use this
15072 syntax to pass an argument to the option.
15073 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
15074 linker. When using the GNU linker, you can also get the same effect with
15075 @option{-Wl,-Map=output.map}.
15077 @item -u @var{symbol}
15079 Pretend the symbol @var{symbol} is undefined, to force linking of
15080 library modules to define it. You can use @option{-u} multiple times with
15081 different symbols to force loading of additional library modules.
15083 @item -z @var{keyword}
15085 @option{-z} is passed directly on to the linker along with the keyword
15086 @var{keyword}. See the section in the documentation of your linker for
15087 permitted values and their meanings.
15090 @node Directory Options
15091 @section Options for Directory Search
15092 @cindex directory options
15093 @cindex options, directory search
15094 @cindex search path
15096 These options specify directories to search for header files, for
15097 libraries and for parts of the compiler:
15100 @include cppdiropts.texi
15102 @item -iplugindir=@var{dir}
15103 @opindex iplugindir=
15104 Set the directory to search for plugins that are passed
15105 by @option{-fplugin=@var{name}} instead of
15106 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
15107 to be used by the user, but only passed by the driver.
15111 Add directory @var{dir} to the list of directories to be searched
15114 @item -B@var{prefix}
15116 This option specifies where to find the executables, libraries,
15117 include files, and data files of the compiler itself.
15119 The compiler driver program runs one or more of the subprograms
15120 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
15121 @var{prefix} as a prefix for each program it tries to run, both with and
15122 without @samp{@var{machine}/@var{version}/} for the corresponding target
15123 machine and compiler version.
15125 For each subprogram to be run, the compiler driver first tries the
15126 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
15127 is not specified, the driver tries two standard prefixes,
15128 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
15129 those results in a file name that is found, the unmodified program
15130 name is searched for using the directories specified in your
15131 @env{PATH} environment variable.
15133 The compiler checks to see if the path provided by @option{-B}
15134 refers to a directory, and if necessary it adds a directory
15135 separator character at the end of the path.
15137 @option{-B} prefixes that effectively specify directory names also apply
15138 to libraries in the linker, because the compiler translates these
15139 options into @option{-L} options for the linker. They also apply to
15140 include files in the preprocessor, because the compiler translates these
15141 options into @option{-isystem} options for the preprocessor. In this case,
15142 the compiler appends @samp{include} to the prefix.
15144 The runtime support file @file{libgcc.a} can also be searched for using
15145 the @option{-B} prefix, if needed. If it is not found there, the two
15146 standard prefixes above are tried, and that is all. The file is left
15147 out of the link if it is not found by those means.
15149 Another way to specify a prefix much like the @option{-B} prefix is to use
15150 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
15153 As a special kludge, if the path provided by @option{-B} is
15154 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
15155 9, then it is replaced by @file{[dir/]include}. This is to help
15156 with boot-strapping the compiler.
15158 @item -no-canonical-prefixes
15159 @opindex no-canonical-prefixes
15160 Do not expand any symbolic links, resolve references to @samp{/../}
15161 or @samp{/./}, or make the path absolute when generating a relative
15164 @item --sysroot=@var{dir}
15166 Use @var{dir} as the logical root directory for headers and libraries.
15167 For example, if the compiler normally searches for headers in
15168 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
15169 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
15171 If you use both this option and the @option{-isysroot} option, then
15172 the @option{--sysroot} option applies to libraries, but the
15173 @option{-isysroot} option applies to header files.
15175 The GNU linker (beginning with version 2.16) has the necessary support
15176 for this option. If your linker does not support this option, the
15177 header file aspect of @option{--sysroot} still works, but the
15178 library aspect does not.
15180 @item --no-sysroot-suffix
15181 @opindex no-sysroot-suffix
15182 For some targets, a suffix is added to the root directory specified
15183 with @option{--sysroot}, depending on the other options used, so that
15184 headers may for example be found in
15185 @file{@var{dir}/@var{suffix}/usr/include} instead of
15186 @file{@var{dir}/usr/include}. This option disables the addition of
15191 @node Code Gen Options
15192 @section Options for Code Generation Conventions
15193 @cindex code generation conventions
15194 @cindex options, code generation
15195 @cindex run-time options
15197 These machine-independent options control the interface conventions
15198 used in code generation.
15200 Most of them have both positive and negative forms; the negative form
15201 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
15202 one of the forms is listed---the one that is not the default. You
15203 can figure out the other form by either removing @samp{no-} or adding
15207 @item -fstack-reuse=@var{reuse-level}
15208 @opindex fstack_reuse
15209 This option controls stack space reuse for user declared local/auto variables
15210 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
15211 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
15212 local variables and temporaries, @samp{named_vars} enables the reuse only for
15213 user defined local variables with names, and @samp{none} disables stack reuse
15214 completely. The default value is @samp{all}. The option is needed when the
15215 program extends the lifetime of a scoped local variable or a compiler generated
15216 temporary beyond the end point defined by the language. When a lifetime of
15217 a variable ends, and if the variable lives in memory, the optimizing compiler
15218 has the freedom to reuse its stack space with other temporaries or scoped
15219 local variables whose live range does not overlap with it. Legacy code extending
15220 local lifetime is likely to break with the stack reuse optimization.
15239 if (*p == 10) // out of scope use of local1
15250 A(int k) : i(k), j(k) @{ @}
15257 void foo(const A& ar)
15264 foo(A(10)); // temp object's lifetime ends when foo returns
15270 ap->i+= 10; // ap references out of scope temp whose space
15271 // is reused with a. What is the value of ap->i?
15276 The lifetime of a compiler generated temporary is well defined by the C++
15277 standard. When a lifetime of a temporary ends, and if the temporary lives
15278 in memory, the optimizing compiler has the freedom to reuse its stack
15279 space with other temporaries or scoped local variables whose live range
15280 does not overlap with it. However some of the legacy code relies on
15281 the behavior of older compilers in which temporaries' stack space is
15282 not reused, the aggressive stack reuse can lead to runtime errors. This
15283 option is used to control the temporary stack reuse optimization.
15287 This option generates traps for signed overflow on addition, subtraction,
15288 multiplication operations.
15289 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
15290 @option{-ftrapv} @option{-fwrapv} on the command-line results in
15291 @option{-fwrapv} being effective. Note that only active options override, so
15292 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
15293 results in @option{-ftrapv} being effective.
15297 This option instructs the compiler to assume that signed arithmetic
15298 overflow of addition, subtraction and multiplication wraps around
15299 using twos-complement representation. This flag enables some optimizations
15300 and disables others.
15301 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
15302 @option{-ftrapv} @option{-fwrapv} on the command-line results in
15303 @option{-fwrapv} being effective. Note that only active options override, so
15304 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
15305 results in @option{-ftrapv} being effective.
15307 @item -fwrapv-pointer
15308 @opindex fwrapv-pointer
15309 This option instructs the compiler to assume that pointer arithmetic
15310 overflow on addition and subtraction wraps around using twos-complement
15311 representation. This flag disables some optimizations which assume
15312 pointer overflow is invalid.
15314 @item -fstrict-overflow
15315 @opindex fstrict-overflow
15316 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
15317 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
15320 @opindex fexceptions
15321 Enable exception handling. Generates extra code needed to propagate
15322 exceptions. For some targets, this implies GCC generates frame
15323 unwind information for all functions, which can produce significant data
15324 size overhead, although it does not affect execution. If you do not
15325 specify this option, GCC enables it by default for languages like
15326 C++ that normally require exception handling, and disables it for
15327 languages like C that do not normally require it. However, you may need
15328 to enable this option when compiling C code that needs to interoperate
15329 properly with exception handlers written in C++. You may also wish to
15330 disable this option if you are compiling older C++ programs that don't
15331 use exception handling.
15333 @item -fnon-call-exceptions
15334 @opindex fnon-call-exceptions
15335 Generate code that allows trapping instructions to throw exceptions.
15336 Note that this requires platform-specific runtime support that does
15337 not exist everywhere. Moreover, it only allows @emph{trapping}
15338 instructions to throw exceptions, i.e.@: memory references or floating-point
15339 instructions. It does not allow exceptions to be thrown from
15340 arbitrary signal handlers such as @code{SIGALRM}.
15342 @item -fdelete-dead-exceptions
15343 @opindex fdelete-dead-exceptions
15344 Consider that instructions that may throw exceptions but don't otherwise
15345 contribute to the execution of the program can be optimized away.
15346 This option is enabled by default for the Ada front end, as permitted by
15347 the Ada language specification.
15348 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
15350 @item -funwind-tables
15351 @opindex funwind-tables
15352 Similar to @option{-fexceptions}, except that it just generates any needed
15353 static data, but does not affect the generated code in any other way.
15354 You normally do not need to enable this option; instead, a language processor
15355 that needs this handling enables it on your behalf.
15357 @item -fasynchronous-unwind-tables
15358 @opindex fasynchronous-unwind-tables
15359 Generate unwind table in DWARF format, if supported by target machine. The
15360 table is exact at each instruction boundary, so it can be used for stack
15361 unwinding from asynchronous events (such as debugger or garbage collector).
15363 @item -fno-gnu-unique
15364 @opindex fno-gnu-unique
15365 @opindex fgnu-unique
15366 On systems with recent GNU assembler and C library, the C++ compiler
15367 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
15368 of template static data members and static local variables in inline
15369 functions are unique even in the presence of @code{RTLD_LOCAL}; this
15370 is necessary to avoid problems with a library used by two different
15371 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
15372 therefore disagreeing with the other one about the binding of the
15373 symbol. But this causes @code{dlclose} to be ignored for affected
15374 DSOs; if your program relies on reinitialization of a DSO via
15375 @code{dlclose} and @code{dlopen}, you can use
15376 @option{-fno-gnu-unique}.
15378 @item -fpcc-struct-return
15379 @opindex fpcc-struct-return
15380 Return ``short'' @code{struct} and @code{union} values in memory like
15381 longer ones, rather than in registers. This convention is less
15382 efficient, but it has the advantage of allowing intercallability between
15383 GCC-compiled files and files compiled with other compilers, particularly
15384 the Portable C Compiler (pcc).
15386 The precise convention for returning structures in memory depends
15387 on the target configuration macros.
15389 Short structures and unions are those whose size and alignment match
15390 that of some integer type.
15392 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
15393 switch is not binary compatible with code compiled with the
15394 @option{-freg-struct-return} switch.
15395 Use it to conform to a non-default application binary interface.
15397 @item -freg-struct-return
15398 @opindex freg-struct-return
15399 Return @code{struct} and @code{union} values in registers when possible.
15400 This is more efficient for small structures than
15401 @option{-fpcc-struct-return}.
15403 If you specify neither @option{-fpcc-struct-return} nor
15404 @option{-freg-struct-return}, GCC defaults to whichever convention is
15405 standard for the target. If there is no standard convention, GCC
15406 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
15407 the principal compiler. In those cases, we can choose the standard, and
15408 we chose the more efficient register return alternative.
15410 @strong{Warning:} code compiled with the @option{-freg-struct-return}
15411 switch is not binary compatible with code compiled with the
15412 @option{-fpcc-struct-return} switch.
15413 Use it to conform to a non-default application binary interface.
15415 @item -fshort-enums
15416 @opindex fshort-enums
15417 Allocate to an @code{enum} type only as many bytes as it needs for the
15418 declared range of possible values. Specifically, the @code{enum} type
15419 is equivalent to the smallest integer type that has enough room.
15421 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
15422 code that is not binary compatible with code generated without that switch.
15423 Use it to conform to a non-default application binary interface.
15425 @item -fshort-wchar
15426 @opindex fshort-wchar
15427 Override the underlying type for @code{wchar_t} to be @code{short
15428 unsigned int} instead of the default for the target. This option is
15429 useful for building programs to run under WINE@.
15431 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
15432 code that is not binary compatible with code generated without that switch.
15433 Use it to conform to a non-default application binary interface.
15437 @opindex fno-common
15438 @cindex tentative definitions
15439 In C code, this option controls the placement of global variables
15440 defined without an initializer, known as @dfn{tentative definitions}
15441 in the C standard. Tentative definitions are distinct from declarations
15442 of a variable with the @code{extern} keyword, which do not allocate storage.
15444 The default is @option{-fno-common}, which specifies that the compiler places
15445 uninitialized global variables in the BSS section of the object file.
15446 This inhibits the merging of tentative definitions by the linker so you get a
15447 multiple-definition error if the same variable is accidentally defined in more
15448 than one compilation unit.
15450 The @option{-fcommon} places uninitialized global variables in a common block.
15451 This allows the linker to resolve all tentative definitions of the same variable
15452 in different compilation units to the same object, or to a non-tentative
15453 definition. This behavior is inconsistent with C++, and on many targets implies
15454 a speed and code size penalty on global variable references. It is mainly
15455 useful to enable legacy code to link without errors.
15460 Ignore the @code{#ident} directive.
15462 @item -finhibit-size-directive
15463 @opindex finhibit-size-directive
15464 Don't output a @code{.size} assembler directive, or anything else that
15465 would cause trouble if the function is split in the middle, and the
15466 two halves are placed at locations far apart in memory. This option is
15467 used when compiling @file{crtstuff.c}; you should not need to use it
15470 @item -fverbose-asm
15471 @opindex fverbose-asm
15472 Put extra commentary information in the generated assembly code to
15473 make it more readable. This option is generally only of use to those
15474 who actually need to read the generated assembly code (perhaps while
15475 debugging the compiler itself).
15477 @option{-fno-verbose-asm}, the default, causes the
15478 extra information to be omitted and is useful when comparing two assembler
15481 The added comments include:
15486 information on the compiler version and command-line options,
15489 the source code lines associated with the assembly instructions,
15490 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15493 hints on which high-level expressions correspond to
15494 the various assembly instruction operands.
15498 For example, given this C source file:
15506 for (i = 0; i < n; i++)
15513 compiling to (x86_64) assembly via @option{-S} and emitting the result
15514 direct to stdout via @option{-o} @option{-}
15517 gcc -S test.c -fverbose-asm -Os -o -
15520 gives output similar to this:
15524 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15531 .type test, @@function
15535 # test.c:4: int total = 0;
15536 xorl %eax, %eax # <retval>
15537 # test.c:6: for (i = 0; i < n; i++)
15538 xorl %edx, %edx # i
15540 # test.c:6: for (i = 0; i < n; i++)
15541 cmpl %edi, %edx # n, i
15543 # test.c:7: total += i * i;
15544 movl %edx, %ecx # i, tmp92
15545 imull %edx, %ecx # i, tmp92
15546 # test.c:6: for (i = 0; i < n; i++)
15548 # test.c:7: total += i * i;
15549 addl %ecx, %eax # tmp92, <retval>
15557 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15558 .section .note.GNU-stack,"",@@progbits
15561 The comments are intended for humans rather than machines and hence the
15562 precise format of the comments is subject to change.
15564 @item -frecord-gcc-switches
15565 @opindex frecord-gcc-switches
15566 This switch causes the command line used to invoke the
15567 compiler to be recorded into the object file that is being created.
15568 This switch is only implemented on some targets and the exact format
15569 of the recording is target and binary file format dependent, but it
15570 usually takes the form of a section containing ASCII text. This
15571 switch is related to the @option{-fverbose-asm} switch, but that
15572 switch only records information in the assembler output file as
15573 comments, so it never reaches the object file.
15574 See also @option{-grecord-gcc-switches} for another
15575 way of storing compiler options into the object file.
15579 @cindex global offset table
15581 Generate position-independent code (PIC) suitable for use in a shared
15582 library, if supported for the target machine. Such code accesses all
15583 constant addresses through a global offset table (GOT)@. The dynamic
15584 loader resolves the GOT entries when the program starts (the dynamic
15585 loader is not part of GCC; it is part of the operating system). If
15586 the GOT size for the linked executable exceeds a machine-specific
15587 maximum size, you get an error message from the linker indicating that
15588 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
15589 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
15590 on the m68k and RS/6000. The x86 has no such limit.)
15592 Position-independent code requires special support, and therefore works
15593 only on certain machines. For the x86, GCC supports PIC for System V
15594 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
15595 position-independent.
15597 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15602 If supported for the target machine, emit position-independent code,
15603 suitable for dynamic linking and avoiding any limit on the size of the
15604 global offset table. This option makes a difference on AArch64, m68k,
15605 PowerPC and SPARC@.
15607 Position-independent code requires special support, and therefore works
15608 only on certain machines.
15610 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15617 These options are similar to @option{-fpic} and @option{-fPIC}, but the
15618 generated position-independent code can be only linked into executables.
15619 Usually these options are used to compile code that will be linked using
15620 the @option{-pie} GCC option.
15622 @option{-fpie} and @option{-fPIE} both define the macros
15623 @code{__pie__} and @code{__PIE__}. The macros have the value 1
15624 for @option{-fpie} and 2 for @option{-fPIE}.
15629 Do not use the PLT for external function calls in position-independent code.
15630 Instead, load the callee address at call sites from the GOT and branch to it.
15631 This leads to more efficient code by eliminating PLT stubs and exposing
15632 GOT loads to optimizations. On architectures such as 32-bit x86 where
15633 PLT stubs expect the GOT pointer in a specific register, this gives more
15634 register allocation freedom to the compiler.
15635 Lazy binding requires use of the PLT;
15636 with @option{-fno-plt} all external symbols are resolved at load time.
15638 Alternatively, the function attribute @code{noplt} can be used to avoid calls
15639 through the PLT for specific external functions.
15641 In position-dependent code, a few targets also convert calls to
15642 functions that are marked to not use the PLT to use the GOT instead.
15644 @item -fno-jump-tables
15645 @opindex fno-jump-tables
15646 @opindex fjump-tables
15647 Do not use jump tables for switch statements even where it would be
15648 more efficient than other code generation strategies. This option is
15649 of use in conjunction with @option{-fpic} or @option{-fPIC} for
15650 building code that forms part of a dynamic linker and cannot
15651 reference the address of a jump table. On some targets, jump tables
15652 do not require a GOT and this option is not needed.
15654 @item -ffixed-@var{reg}
15656 Treat the register named @var{reg} as a fixed register; generated code
15657 should never refer to it (except perhaps as a stack pointer, frame
15658 pointer or in some other fixed role).
15660 @var{reg} must be the name of a register. The register names accepted
15661 are machine-specific and are defined in the @code{REGISTER_NAMES}
15662 macro in the machine description macro file.
15664 This flag does not have a negative form, because it specifies a
15667 @item -fcall-used-@var{reg}
15668 @opindex fcall-used
15669 Treat the register named @var{reg} as an allocable register that is
15670 clobbered by function calls. It may be allocated for temporaries or
15671 variables that do not live across a call. Functions compiled this way
15672 do not save and restore the register @var{reg}.
15674 It is an error to use this flag with the frame pointer or stack pointer.
15675 Use of this flag for other registers that have fixed pervasive roles in
15676 the machine's execution model produces disastrous results.
15678 This flag does not have a negative form, because it specifies a
15681 @item -fcall-saved-@var{reg}
15682 @opindex fcall-saved
15683 Treat the register named @var{reg} as an allocable register saved by
15684 functions. It may be allocated even for temporaries or variables that
15685 live across a call. Functions compiled this way save and restore
15686 the register @var{reg} if they use it.
15688 It is an error to use this flag with the frame pointer or stack pointer.
15689 Use of this flag for other registers that have fixed pervasive roles in
15690 the machine's execution model produces disastrous results.
15692 A different sort of disaster results from the use of this flag for
15693 a register in which function values may be returned.
15695 This flag does not have a negative form, because it specifies a
15698 @item -fpack-struct[=@var{n}]
15699 @opindex fpack-struct
15700 Without a value specified, pack all structure members together without
15701 holes. When a value is specified (which must be a small power of two), pack
15702 structure members according to this value, representing the maximum
15703 alignment (that is, objects with default alignment requirements larger than
15704 this are output potentially unaligned at the next fitting location.
15706 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
15707 code that is not binary compatible with code generated without that switch.
15708 Additionally, it makes the code suboptimal.
15709 Use it to conform to a non-default application binary interface.
15711 @item -fleading-underscore
15712 @opindex fleading-underscore
15713 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
15714 change the way C symbols are represented in the object file. One use
15715 is to help link with legacy assembly code.
15717 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
15718 generate code that is not binary compatible with code generated without that
15719 switch. Use it to conform to a non-default application binary interface.
15720 Not all targets provide complete support for this switch.
15722 @item -ftls-model=@var{model}
15723 @opindex ftls-model
15724 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
15725 The @var{model} argument should be one of @samp{global-dynamic},
15726 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
15727 Note that the choice is subject to optimization: the compiler may use
15728 a more efficient model for symbols not visible outside of the translation
15729 unit, or if @option{-fpic} is not given on the command line.
15731 The default without @option{-fpic} is @samp{initial-exec}; with
15732 @option{-fpic} the default is @samp{global-dynamic}.
15734 @item -ftrampolines
15735 @opindex ftrampolines
15736 For targets that normally need trampolines for nested functions, always
15737 generate them instead of using descriptors. Otherwise, for targets that
15738 do not need them, like for example HP-PA or IA-64, do nothing.
15740 A trampoline is a small piece of code that is created at run time on the
15741 stack when the address of a nested function is taken, and is used to call
15742 the nested function indirectly. Therefore, it requires the stack to be
15743 made executable in order for the program to work properly.
15745 @option{-fno-trampolines} is enabled by default on a language by language
15746 basis to let the compiler avoid generating them, if it computes that this
15747 is safe, and replace them with descriptors. Descriptors are made up of data
15748 only, but the generated code must be prepared to deal with them. As of this
15749 writing, @option{-fno-trampolines} is enabled by default only for Ada.
15751 Moreover, code compiled with @option{-ftrampolines} and code compiled with
15752 @option{-fno-trampolines} are not binary compatible if nested functions are
15753 present. This option must therefore be used on a program-wide basis and be
15754 manipulated with extreme care.
15756 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
15757 @opindex fvisibility
15758 Set the default ELF image symbol visibility to the specified option---all
15759 symbols are marked with this unless overridden within the code.
15760 Using this feature can very substantially improve linking and
15761 load times of shared object libraries, produce more optimized
15762 code, provide near-perfect API export and prevent symbol clashes.
15763 It is @strong{strongly} recommended that you use this in any shared objects
15766 Despite the nomenclature, @samp{default} always means public; i.e.,
15767 available to be linked against from outside the shared object.
15768 @samp{protected} and @samp{internal} are pretty useless in real-world
15769 usage so the only other commonly used option is @samp{hidden}.
15770 The default if @option{-fvisibility} isn't specified is
15771 @samp{default}, i.e., make every symbol public.
15773 A good explanation of the benefits offered by ensuring ELF
15774 symbols have the correct visibility is given by ``How To Write
15775 Shared Libraries'' by Ulrich Drepper (which can be found at
15776 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
15777 solution made possible by this option to marking things hidden when
15778 the default is public is to make the default hidden and mark things
15779 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
15780 and @code{__attribute__ ((visibility("default")))} instead of
15781 @code{__declspec(dllexport)} you get almost identical semantics with
15782 identical syntax. This is a great boon to those working with
15783 cross-platform projects.
15785 For those adding visibility support to existing code, you may find
15786 @code{#pragma GCC visibility} of use. This works by you enclosing
15787 the declarations you wish to set visibility for with (for example)
15788 @code{#pragma GCC visibility push(hidden)} and
15789 @code{#pragma GCC visibility pop}.
15790 Bear in mind that symbol visibility should be viewed @strong{as
15791 part of the API interface contract} and thus all new code should
15792 always specify visibility when it is not the default; i.e., declarations
15793 only for use within the local DSO should @strong{always} be marked explicitly
15794 as hidden as so to avoid PLT indirection overheads---making this
15795 abundantly clear also aids readability and self-documentation of the code.
15796 Note that due to ISO C++ specification requirements, @code{operator new} and
15797 @code{operator delete} must always be of default visibility.
15799 Be aware that headers from outside your project, in particular system
15800 headers and headers from any other library you use, may not be
15801 expecting to be compiled with visibility other than the default. You
15802 may need to explicitly say @code{#pragma GCC visibility push(default)}
15803 before including any such headers.
15805 @code{extern} declarations are not affected by @option{-fvisibility}, so
15806 a lot of code can be recompiled with @option{-fvisibility=hidden} with
15807 no modifications. However, this means that calls to @code{extern}
15808 functions with no explicit visibility use the PLT, so it is more
15809 effective to use @code{__attribute ((visibility))} and/or
15810 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
15811 declarations should be treated as hidden.
15813 Note that @option{-fvisibility} does affect C++ vague linkage
15814 entities. This means that, for instance, an exception class that is
15815 be thrown between DSOs must be explicitly marked with default
15816 visibility so that the @samp{type_info} nodes are unified between
15819 An overview of these techniques, their benefits and how to use them
15820 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
15822 @item -fstrict-volatile-bitfields
15823 @opindex fstrict-volatile-bitfields
15824 This option should be used if accesses to volatile bit-fields (or other
15825 structure fields, although the compiler usually honors those types
15826 anyway) should use a single access of the width of the
15827 field's type, aligned to a natural alignment if possible. For
15828 example, targets with memory-mapped peripheral registers might require
15829 all such accesses to be 16 bits wide; with this flag you can
15830 declare all peripheral bit-fields as @code{unsigned short} (assuming short
15831 is 16 bits on these targets) to force GCC to use 16-bit accesses
15832 instead of, perhaps, a more efficient 32-bit access.
15834 If this option is disabled, the compiler uses the most efficient
15835 instruction. In the previous example, that might be a 32-bit load
15836 instruction, even though that accesses bytes that do not contain
15837 any portion of the bit-field, or memory-mapped registers unrelated to
15838 the one being updated.
15840 In some cases, such as when the @code{packed} attribute is applied to a
15841 structure field, it may not be possible to access the field with a single
15842 read or write that is correctly aligned for the target machine. In this
15843 case GCC falls back to generating multiple accesses rather than code that
15844 will fault or truncate the result at run time.
15846 Note: Due to restrictions of the C/C++11 memory model, write accesses are
15847 not allowed to touch non bit-field members. It is therefore recommended
15848 to define all bits of the field's type as bit-field members.
15850 The default value of this option is determined by the application binary
15851 interface for the target processor.
15853 @item -fsync-libcalls
15854 @opindex fsync-libcalls
15855 This option controls whether any out-of-line instance of the @code{__sync}
15856 family of functions may be used to implement the C++11 @code{__atomic}
15857 family of functions.
15859 The default value of this option is enabled, thus the only useful form
15860 of the option is @option{-fno-sync-libcalls}. This option is used in
15861 the implementation of the @file{libatomic} runtime library.
15865 @node Developer Options
15866 @section GCC Developer Options
15867 @cindex developer options
15868 @cindex debugging GCC
15869 @cindex debug dump options
15870 @cindex dump options
15871 @cindex compilation statistics
15873 This section describes command-line options that are primarily of
15874 interest to GCC developers, including options to support compiler
15875 testing and investigation of compiler bugs and compile-time
15876 performance problems. This includes options that produce debug dumps
15877 at various points in the compilation; that print statistics such as
15878 memory use and execution time; and that print information about GCC's
15879 configuration, such as where it searches for libraries. You should
15880 rarely need to use any of these options for ordinary compilation and
15883 Many developer options that cause GCC to dump output to a file take an
15884 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
15885 or @samp{-} to dump to standard output, and @samp{stderr} for standard
15888 If @samp{=@var{filename}} is omitted, a default dump file name is
15889 constructed by concatenating the base dump file name, a pass number,
15890 phase letter, and pass name. The base dump file name is the name of
15891 output file produced by the compiler if explicitly specified and not
15892 an executable; otherwise it is the source file name.
15893 The pass number is determined by the order passes are registered with
15894 the compiler's pass manager.
15895 This is generally the same as the order of execution, but passes
15896 registered by plugins, target-specific passes, or passes that are
15897 otherwise registered late are numbered higher than the pass named
15898 @samp{final}, even if they are executed earlier. The phase letter is
15899 one of @samp{i} (inter-procedural analysis), @samp{l}
15900 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
15901 The files are created in the directory of the output file.
15905 @item -fcallgraph-info
15906 @itemx -fcallgraph-info=@var{MARKERS}
15907 @opindex fcallgraph-info
15908 Makes the compiler output callgraph information for the program, on a
15909 per-object-file basis. The information is generated in the common VCG
15910 format. It can be decorated with additional, per-node and/or per-edge
15911 information, if a list of comma-separated markers is additionally
15912 specified. When the @code{su} marker is specified, the callgraph is
15913 decorated with stack usage information; it is equivalent to
15914 @option{-fstack-usage}. When the @code{da} marker is specified, the
15915 callgraph is decorated with information about dynamically allocated
15918 When compiling with @option{-flto}, no callgraph information is output
15919 along with the object file. At LTO link time, @option{-fcallgraph-info}
15920 may generate multiple callgraph information files next to intermediate
15923 @item -d@var{letters}
15924 @itemx -fdump-rtl-@var{pass}
15925 @itemx -fdump-rtl-@var{pass}=@var{filename}
15927 @opindex fdump-rtl-@var{pass}
15928 Says to make debugging dumps during compilation at times specified by
15929 @var{letters}. This is used for debugging the RTL-based passes of the
15932 Some @option{-d@var{letters}} switches have different meaning when
15933 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
15934 for information about preprocessor-specific dump options.
15936 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
15937 @option{-d} option @var{letters}. Here are the possible
15938 letters for use in @var{pass} and @var{letters}, and their meanings:
15942 @item -fdump-rtl-alignments
15943 @opindex fdump-rtl-alignments
15944 Dump after branch alignments have been computed.
15946 @item -fdump-rtl-asmcons
15947 @opindex fdump-rtl-asmcons
15948 Dump after fixing rtl statements that have unsatisfied in/out constraints.
15950 @item -fdump-rtl-auto_inc_dec
15951 @opindex fdump-rtl-auto_inc_dec
15952 Dump after auto-inc-dec discovery. This pass is only run on
15953 architectures that have auto inc or auto dec instructions.
15955 @item -fdump-rtl-barriers
15956 @opindex fdump-rtl-barriers
15957 Dump after cleaning up the barrier instructions.
15959 @item -fdump-rtl-bbpart
15960 @opindex fdump-rtl-bbpart
15961 Dump after partitioning hot and cold basic blocks.
15963 @item -fdump-rtl-bbro
15964 @opindex fdump-rtl-bbro
15965 Dump after block reordering.
15967 @item -fdump-rtl-btl1
15968 @itemx -fdump-rtl-btl2
15969 @opindex fdump-rtl-btl2
15970 @opindex fdump-rtl-btl2
15971 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
15972 after the two branch
15973 target load optimization passes.
15975 @item -fdump-rtl-bypass
15976 @opindex fdump-rtl-bypass
15977 Dump after jump bypassing and control flow optimizations.
15979 @item -fdump-rtl-combine
15980 @opindex fdump-rtl-combine
15981 Dump after the RTL instruction combination pass.
15983 @item -fdump-rtl-compgotos
15984 @opindex fdump-rtl-compgotos
15985 Dump after duplicating the computed gotos.
15987 @item -fdump-rtl-ce1
15988 @itemx -fdump-rtl-ce2
15989 @itemx -fdump-rtl-ce3
15990 @opindex fdump-rtl-ce1
15991 @opindex fdump-rtl-ce2
15992 @opindex fdump-rtl-ce3
15993 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
15994 @option{-fdump-rtl-ce3} enable dumping after the three
15995 if conversion passes.
15997 @item -fdump-rtl-cprop_hardreg
15998 @opindex fdump-rtl-cprop_hardreg
15999 Dump after hard register copy propagation.
16001 @item -fdump-rtl-csa
16002 @opindex fdump-rtl-csa
16003 Dump after combining stack adjustments.
16005 @item -fdump-rtl-cse1
16006 @itemx -fdump-rtl-cse2
16007 @opindex fdump-rtl-cse1
16008 @opindex fdump-rtl-cse2
16009 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
16010 the two common subexpression elimination passes.
16012 @item -fdump-rtl-dce
16013 @opindex fdump-rtl-dce
16014 Dump after the standalone dead code elimination passes.
16016 @item -fdump-rtl-dbr
16017 @opindex fdump-rtl-dbr
16018 Dump after delayed branch scheduling.
16020 @item -fdump-rtl-dce1
16021 @itemx -fdump-rtl-dce2
16022 @opindex fdump-rtl-dce1
16023 @opindex fdump-rtl-dce2
16024 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
16025 the two dead store elimination passes.
16027 @item -fdump-rtl-eh
16028 @opindex fdump-rtl-eh
16029 Dump after finalization of EH handling code.
16031 @item -fdump-rtl-eh_ranges
16032 @opindex fdump-rtl-eh_ranges
16033 Dump after conversion of EH handling range regions.
16035 @item -fdump-rtl-expand
16036 @opindex fdump-rtl-expand
16037 Dump after RTL generation.
16039 @item -fdump-rtl-fwprop1
16040 @itemx -fdump-rtl-fwprop2
16041 @opindex fdump-rtl-fwprop1
16042 @opindex fdump-rtl-fwprop2
16043 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
16044 dumping after the two forward propagation passes.
16046 @item -fdump-rtl-gcse1
16047 @itemx -fdump-rtl-gcse2
16048 @opindex fdump-rtl-gcse1
16049 @opindex fdump-rtl-gcse2
16050 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
16051 after global common subexpression elimination.
16053 @item -fdump-rtl-init-regs
16054 @opindex fdump-rtl-init-regs
16055 Dump after the initialization of the registers.
16057 @item -fdump-rtl-initvals
16058 @opindex fdump-rtl-initvals
16059 Dump after the computation of the initial value sets.
16061 @item -fdump-rtl-into_cfglayout
16062 @opindex fdump-rtl-into_cfglayout
16063 Dump after converting to cfglayout mode.
16065 @item -fdump-rtl-ira
16066 @opindex fdump-rtl-ira
16067 Dump after iterated register allocation.
16069 @item -fdump-rtl-jump
16070 @opindex fdump-rtl-jump
16071 Dump after the second jump optimization.
16073 @item -fdump-rtl-loop2
16074 @opindex fdump-rtl-loop2
16075 @option{-fdump-rtl-loop2} enables dumping after the rtl
16076 loop optimization passes.
16078 @item -fdump-rtl-mach
16079 @opindex fdump-rtl-mach
16080 Dump after performing the machine dependent reorganization pass, if that
16083 @item -fdump-rtl-mode_sw
16084 @opindex fdump-rtl-mode_sw
16085 Dump after removing redundant mode switches.
16087 @item -fdump-rtl-rnreg
16088 @opindex fdump-rtl-rnreg
16089 Dump after register renumbering.
16091 @item -fdump-rtl-outof_cfglayout
16092 @opindex fdump-rtl-outof_cfglayout
16093 Dump after converting from cfglayout mode.
16095 @item -fdump-rtl-peephole2
16096 @opindex fdump-rtl-peephole2
16097 Dump after the peephole pass.
16099 @item -fdump-rtl-postreload
16100 @opindex fdump-rtl-postreload
16101 Dump after post-reload optimizations.
16103 @item -fdump-rtl-pro_and_epilogue
16104 @opindex fdump-rtl-pro_and_epilogue
16105 Dump after generating the function prologues and epilogues.
16107 @item -fdump-rtl-sched1
16108 @itemx -fdump-rtl-sched2
16109 @opindex fdump-rtl-sched1
16110 @opindex fdump-rtl-sched2
16111 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
16112 after the basic block scheduling passes.
16114 @item -fdump-rtl-ree
16115 @opindex fdump-rtl-ree
16116 Dump after sign/zero extension elimination.
16118 @item -fdump-rtl-seqabstr
16119 @opindex fdump-rtl-seqabstr
16120 Dump after common sequence discovery.
16122 @item -fdump-rtl-shorten
16123 @opindex fdump-rtl-shorten
16124 Dump after shortening branches.
16126 @item -fdump-rtl-sibling
16127 @opindex fdump-rtl-sibling
16128 Dump after sibling call optimizations.
16130 @item -fdump-rtl-split1
16131 @itemx -fdump-rtl-split2
16132 @itemx -fdump-rtl-split3
16133 @itemx -fdump-rtl-split4
16134 @itemx -fdump-rtl-split5
16135 @opindex fdump-rtl-split1
16136 @opindex fdump-rtl-split2
16137 @opindex fdump-rtl-split3
16138 @opindex fdump-rtl-split4
16139 @opindex fdump-rtl-split5
16140 These options enable dumping after five rounds of
16141 instruction splitting.
16143 @item -fdump-rtl-sms
16144 @opindex fdump-rtl-sms
16145 Dump after modulo scheduling. This pass is only run on some
16148 @item -fdump-rtl-stack
16149 @opindex fdump-rtl-stack
16150 Dump after conversion from GCC's ``flat register file'' registers to the
16151 x87's stack-like registers. This pass is only run on x86 variants.
16153 @item -fdump-rtl-subreg1
16154 @itemx -fdump-rtl-subreg2
16155 @opindex fdump-rtl-subreg1
16156 @opindex fdump-rtl-subreg2
16157 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
16158 the two subreg expansion passes.
16160 @item -fdump-rtl-unshare
16161 @opindex fdump-rtl-unshare
16162 Dump after all rtl has been unshared.
16164 @item -fdump-rtl-vartrack
16165 @opindex fdump-rtl-vartrack
16166 Dump after variable tracking.
16168 @item -fdump-rtl-vregs
16169 @opindex fdump-rtl-vregs
16170 Dump after converting virtual registers to hard registers.
16172 @item -fdump-rtl-web
16173 @opindex fdump-rtl-web
16174 Dump after live range splitting.
16176 @item -fdump-rtl-regclass
16177 @itemx -fdump-rtl-subregs_of_mode_init
16178 @itemx -fdump-rtl-subregs_of_mode_finish
16179 @itemx -fdump-rtl-dfinit
16180 @itemx -fdump-rtl-dfinish
16181 @opindex fdump-rtl-regclass
16182 @opindex fdump-rtl-subregs_of_mode_init
16183 @opindex fdump-rtl-subregs_of_mode_finish
16184 @opindex fdump-rtl-dfinit
16185 @opindex fdump-rtl-dfinish
16186 These dumps are defined but always produce empty files.
16189 @itemx -fdump-rtl-all
16191 @opindex fdump-rtl-all
16192 Produce all the dumps listed above.
16196 Annotate the assembler output with miscellaneous debugging information.
16200 Dump all macro definitions, at the end of preprocessing, in addition to
16205 Produce a core dump whenever an error occurs.
16209 Annotate the assembler output with a comment indicating which
16210 pattern and alternative is used. The length and cost of each instruction are
16215 Dump the RTL in the assembler output as a comment before each instruction.
16216 Also turns on @option{-dp} annotation.
16220 Just generate RTL for a function instead of compiling it. Usually used
16221 with @option{-fdump-rtl-expand}.
16225 @opindex fdump-debug
16226 Dump debugging information generated during the debug
16229 @item -fdump-earlydebug
16230 @opindex fdump-earlydebug
16231 Dump debugging information generated during the early debug
16234 @item -fdump-noaddr
16235 @opindex fdump-noaddr
16236 When doing debugging dumps, suppress address output. This makes it more
16237 feasible to use diff on debugging dumps for compiler invocations with
16238 different compiler binaries and/or different
16239 text / bss / data / heap / stack / dso start locations.
16242 @opindex freport-bug
16243 Collect and dump debug information into a temporary file if an
16244 internal compiler error (ICE) occurs.
16246 @item -fdump-unnumbered
16247 @opindex fdump-unnumbered
16248 When doing debugging dumps, suppress instruction numbers and address output.
16249 This makes it more feasible to use diff on debugging dumps for compiler
16250 invocations with different options, in particular with and without
16253 @item -fdump-unnumbered-links
16254 @opindex fdump-unnumbered-links
16255 When doing debugging dumps (see @option{-d} option above), suppress
16256 instruction numbers for the links to the previous and next instructions
16259 @item -fdump-ipa-@var{switch}
16260 @itemx -fdump-ipa-@var{switch}-@var{options}
16262 Control the dumping at various stages of inter-procedural analysis
16263 language tree to a file. The file name is generated by appending a
16264 switch specific suffix to the source file name, and the file is created
16265 in the same directory as the output file. The following dumps are
16270 Enables all inter-procedural analysis dumps.
16273 Dumps information about call-graph optimization, unused function removal,
16274 and inlining decisions.
16277 Dump after function inlining.
16281 Additionally, the options @option{-optimized}, @option{-missed},
16282 @option{-note}, and @option{-all} can be provided, with the same meaning
16283 as for @option{-fopt-info}, defaulting to @option{-optimized}.
16285 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
16286 information on callsites that were inlined, along with callsites
16287 that were not inlined.
16289 By default, the dump will contain messages about successful
16290 optimizations (equivalent to @option{-optimized}) together with
16291 low-level details about the analysis.
16293 @item -fdump-lang-all
16294 @itemx -fdump-lang-@var{switch}
16295 @itemx -fdump-lang-@var{switch}-@var{options}
16296 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
16297 @opindex fdump-lang-all
16298 @opindex fdump-lang
16299 Control the dumping of language-specific information. The @var{options}
16300 and @var{filename} portions behave as described in the
16301 @option{-fdump-tree} option. The following @var{switch} values are
16307 Enable all language-specific dumps.
16310 Dump class hierarchy information. Virtual table information is emitted
16311 unless '@option{slim}' is specified. This option is applicable to C++ only.
16314 Dump the raw internal tree data. This option is applicable to C++ only.
16318 @item -fdump-passes
16319 @opindex fdump-passes
16320 Print on @file{stderr} the list of optimization passes that are turned
16321 on and off by the current command-line options.
16323 @item -fdump-statistics-@var{option}
16324 @opindex fdump-statistics
16325 Enable and control dumping of pass statistics in a separate file. The
16326 file name is generated by appending a suffix ending in
16327 @samp{.statistics} to the source file name, and the file is created in
16328 the same directory as the output file. If the @samp{-@var{option}}
16329 form is used, @samp{-stats} causes counters to be summed over the
16330 whole compilation unit while @samp{-details} dumps every event as
16331 the passes generate them. The default with no option is to sum
16332 counters for each function compiled.
16334 @item -fdump-tree-all
16335 @itemx -fdump-tree-@var{switch}
16336 @itemx -fdump-tree-@var{switch}-@var{options}
16337 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
16338 @opindex fdump-tree-all
16339 @opindex fdump-tree
16340 Control the dumping at various stages of processing the intermediate
16341 language tree to a file. If the @samp{-@var{options}}
16342 form is used, @var{options} is a list of @samp{-} separated options
16343 which control the details of the dump. Not all options are applicable
16344 to all dumps; those that are not meaningful are ignored. The
16345 following options are available
16349 Print the address of each node. Usually this is not meaningful as it
16350 changes according to the environment and source file. Its primary use
16351 is for tying up a dump file with a debug environment.
16353 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
16354 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
16355 use working backward from mangled names in the assembly file.
16357 When dumping front-end intermediate representations, inhibit dumping
16358 of members of a scope or body of a function merely because that scope
16359 has been reached. Only dump such items when they are directly reachable
16360 by some other path.
16362 When dumping pretty-printed trees, this option inhibits dumping the
16363 bodies of control structures.
16365 When dumping RTL, print the RTL in slim (condensed) form instead of
16366 the default LISP-like representation.
16368 Print a raw representation of the tree. By default, trees are
16369 pretty-printed into a C-like representation.
16371 Enable more detailed dumps (not honored by every dump option). Also
16372 include information from the optimization passes.
16374 Enable dumping various statistics about the pass (not honored by every dump
16377 Enable showing basic block boundaries (disabled in raw dumps).
16379 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
16380 dump a representation of the control flow graph suitable for viewing with
16381 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
16382 the file is pretty-printed as a subgraph, so that GraphViz can render them
16383 all in a single plot.
16385 This option currently only works for RTL dumps, and the RTL is always
16386 dumped in slim form.
16388 Enable showing virtual operands for every statement.
16390 Enable showing line numbers for statements.
16392 Enable showing the unique ID (@code{DECL_UID}) for each variable.
16394 Enable showing the tree dump for each statement.
16396 Enable showing the EH region number holding each statement.
16398 Enable showing scalar evolution analysis details.
16400 Enable showing optimization information (only available in certain
16403 Enable showing missed optimization information (only available in certain
16406 Enable other detailed optimization information (only available in
16409 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
16410 and @option{lineno}.
16412 Turn on all optimization options, i.e., @option{optimized},
16413 @option{missed}, and @option{note}.
16416 To determine what tree dumps are available or find the dump for a pass
16417 of interest follow the steps below.
16421 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
16422 look for a code that corresponds to the pass you are interested in.
16423 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
16424 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
16425 The number at the end distinguishes distinct invocations of the same pass.
16427 To enable the creation of the dump file, append the pass code to
16428 the @option{-fdump-} option prefix and invoke GCC with it. For example,
16429 to enable the dump from the Early Value Range Propagation pass, invoke
16430 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
16431 specify the name of the dump file. If you don't specify one, GCC
16432 creates as described below.
16434 Find the pass dump in a file whose name is composed of three components
16435 separated by a period: the name of the source file GCC was invoked to
16436 compile, a numeric suffix indicating the pass number followed by the
16437 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
16438 and finally the pass code. For example, the Early VRP pass dump might
16439 be in a file named @file{myfile.c.038t.evrp} in the current working
16440 directory. Note that the numeric codes are not stable and may change
16441 from one version of GCC to another.
16445 @itemx -fopt-info-@var{options}
16446 @itemx -fopt-info-@var{options}=@var{filename}
16448 Controls optimization dumps from various optimization passes. If the
16449 @samp{-@var{options}} form is used, @var{options} is a list of
16450 @samp{-} separated option keywords to select the dump details and
16453 The @var{options} can be divided into three groups:
16456 options describing what kinds of messages should be emitted,
16458 options describing the verbosity of the dump, and
16460 options describing which optimizations should be included.
16462 The options from each group can be freely mixed as they are
16463 non-overlapping. However, in case of any conflicts,
16464 the later options override the earlier options on the command
16467 The following options control which kinds of messages should be emitted:
16471 Print information when an optimization is successfully applied. It is
16472 up to a pass to decide which information is relevant. For example, the
16473 vectorizer passes print the source location of loops which are
16474 successfully vectorized.
16476 Print information about missed optimizations. Individual passes
16477 control which information to include in the output.
16479 Print verbose information about optimizations, such as certain
16480 transformations, more detailed messages about decisions etc.
16482 Print detailed optimization information. This includes
16483 @samp{optimized}, @samp{missed}, and @samp{note}.
16486 The following option controls the dump verbosity:
16490 By default, only ``high-level'' messages are emitted. This option enables
16491 additional, more detailed, messages, which are likely to only be of interest
16495 One or more of the following option keywords can be used to describe a
16496 group of optimizations:
16500 Enable dumps from all interprocedural optimizations.
16502 Enable dumps from all loop optimizations.
16504 Enable dumps from all inlining optimizations.
16506 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
16508 Enable dumps from all vectorization optimizations.
16510 Enable dumps from all optimizations. This is a superset of
16511 the optimization groups listed above.
16514 If @var{options} is
16515 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
16516 about successful optimizations from all the passes, omitting messages
16517 that are treated as ``internals''.
16519 If the @var{filename} is provided, then the dumps from all the
16520 applicable optimizations are concatenated into the @var{filename}.
16521 Otherwise the dump is output onto @file{stderr}. Though multiple
16522 @option{-fopt-info} options are accepted, only one of them can include
16523 a @var{filename}. If other filenames are provided then all but the
16524 first such option are ignored.
16526 Note that the output @var{filename} is overwritten
16527 in case of multiple translation units. If a combined output from
16528 multiple translation units is desired, @file{stderr} should be used
16531 In the following example, the optimization info is output to
16540 gcc -O3 -fopt-info-missed=missed.all
16544 outputs missed optimization report from all the passes into
16545 @file{missed.all}, and this one:
16548 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16552 prints information about missed optimization opportunities from
16553 vectorization passes on @file{stderr}.
16554 Note that @option{-fopt-info-vec-missed} is equivalent to
16555 @option{-fopt-info-missed-vec}. The order of the optimization group
16556 names and message types listed after @option{-fopt-info} does not matter.
16558 As another example,
16560 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16564 outputs information about missed optimizations as well as
16565 optimized locations from all the inlining passes into
16571 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16575 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
16576 in conflict since only one output file is allowed. In this case, only
16577 the first option takes effect and the subsequent options are
16578 ignored. Thus only @file{vec.miss} is produced which contains
16579 dumps from the vectorizer about missed opportunities.
16581 @item -fsave-optimization-record
16582 @opindex fsave-optimization-record
16583 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
16584 were performed, for those optimizations that support @option{-fopt-info}.
16586 This option is experimental and the format of the data within the
16587 compressed JSON file is subject to change.
16589 It is roughly equivalent to a machine-readable version of
16590 @option{-fopt-info-all}, as a collection of messages with source file,
16591 line number and column number, with the following additional data for
16597 the execution count of the code being optimized, along with metadata about
16598 whether this was from actual profile data, or just an estimate, allowing
16599 consumers to prioritize messages by code hotness,
16602 the function name of the code being optimized, where applicable,
16605 the ``inlining chain'' for the code being optimized, so that when
16606 a function is inlined into several different places (which might
16607 themselves be inlined), the reader can distinguish between the copies,
16610 objects identifying those parts of the message that refer to expressions,
16611 statements or symbol-table nodes, which of these categories they are, and,
16612 when available, their source code location,
16615 the GCC pass that emitted the message, and
16618 the location in GCC's own code from which the message was emitted
16622 Additionally, some messages are logically nested within other
16623 messages, reflecting implementation details of the optimization
16626 @item -fsched-verbose=@var{n}
16627 @opindex fsched-verbose
16628 On targets that use instruction scheduling, this option controls the
16629 amount of debugging output the scheduler prints to the dump files.
16631 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
16632 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
16633 For @var{n} greater than one, it also output basic block probabilities,
16634 detailed ready list information and unit/insn info. For @var{n} greater
16635 than two, it includes RTL at abort point, control-flow and regions info.
16636 And for @var{n} over four, @option{-fsched-verbose} also includes
16641 @item -fenable-@var{kind}-@var{pass}
16642 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
16646 This is a set of options that are used to explicitly disable/enable
16647 optimization passes. These options are intended for use for debugging GCC.
16648 Compiler users should use regular options for enabling/disabling
16653 @item -fdisable-ipa-@var{pass}
16654 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16655 statically invoked in the compiler multiple times, the pass name should be
16656 appended with a sequential number starting from 1.
16658 @item -fdisable-rtl-@var{pass}
16659 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
16660 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
16661 statically invoked in the compiler multiple times, the pass name should be
16662 appended with a sequential number starting from 1. @var{range-list} is a
16663 comma-separated list of function ranges or assembler names. Each range is a number
16664 pair separated by a colon. The range is inclusive in both ends. If the range
16665 is trivial, the number pair can be simplified as a single number. If the
16666 function's call graph node's @var{uid} falls within one of the specified ranges,
16667 the @var{pass} is disabled for that function. The @var{uid} is shown in the
16668 function header of a dump file, and the pass names can be dumped by using
16669 option @option{-fdump-passes}.
16671 @item -fdisable-tree-@var{pass}
16672 @itemx -fdisable-tree-@var{pass}=@var{range-list}
16673 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
16676 @item -fenable-ipa-@var{pass}
16677 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16678 statically invoked in the compiler multiple times, the pass name should be
16679 appended with a sequential number starting from 1.
16681 @item -fenable-rtl-@var{pass}
16682 @itemx -fenable-rtl-@var{pass}=@var{range-list}
16683 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
16684 description and examples.
16686 @item -fenable-tree-@var{pass}
16687 @itemx -fenable-tree-@var{pass}=@var{range-list}
16688 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
16689 of option arguments.
16693 Here are some examples showing uses of these options.
16697 # disable ccp1 for all functions
16698 -fdisable-tree-ccp1
16699 # disable complete unroll for function whose cgraph node uid is 1
16700 -fenable-tree-cunroll=1
16701 # disable gcse2 for functions at the following ranges [1,1],
16702 # [300,400], and [400,1000]
16703 # disable gcse2 for functions foo and foo2
16704 -fdisable-rtl-gcse2=foo,foo2
16705 # disable early inlining
16706 -fdisable-tree-einline
16707 # disable ipa inlining
16708 -fdisable-ipa-inline
16709 # enable tree full unroll
16710 -fenable-tree-unroll
16715 @itemx -fchecking=@var{n}
16717 @opindex fno-checking
16718 Enable internal consistency checking. The default depends on
16719 the compiler configuration. @option{-fchecking=2} enables further
16720 internal consistency checking that might affect code generation.
16722 @item -frandom-seed=@var{string}
16723 @opindex frandom-seed
16724 This option provides a seed that GCC uses in place of
16725 random numbers in generating certain symbol names
16726 that have to be different in every compiled file. It is also used to
16727 place unique stamps in coverage data files and the object files that
16728 produce them. You can use the @option{-frandom-seed} option to produce
16729 reproducibly identical object files.
16731 The @var{string} can either be a number (decimal, octal or hex) or an
16732 arbitrary string (in which case it's converted to a number by
16735 The @var{string} should be different for every file you compile.
16738 @opindex save-temps
16739 Store the usual ``temporary'' intermediate files permanently; name them
16740 as auxiliary output files, as specified described under
16741 @option{-dumpbase} and @option{-dumpdir}.
16743 When used in combination with the @option{-x} command-line option,
16744 @option{-save-temps} is sensible enough to avoid overwriting an
16745 input source file with the same extension as an intermediate file.
16746 The corresponding intermediate file may be obtained by renaming the
16747 source file before using @option{-save-temps}.
16749 @item -save-temps=cwd
16750 @opindex save-temps=cwd
16751 Equivalent to @option{-save-temps -dumpdir ./}.
16753 @item -save-temps=obj
16754 @opindex save-temps=obj
16755 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
16756 @file{outdir/} is the directory of the output file specified after the
16757 @option{-o} option, including any directory separators. If the
16758 @option{-o} option is not used, the @option{-save-temps=obj} switch
16759 behaves like @option{-save-temps=cwd}.
16761 @item -time@r{[}=@var{file}@r{]}
16763 Report the CPU time taken by each subprocess in the compilation
16764 sequence. For C source files, this is the compiler proper and assembler
16765 (plus the linker if linking is done).
16767 Without the specification of an output file, the output looks like this:
16774 The first number on each line is the ``user time'', that is time spent
16775 executing the program itself. The second number is ``system time'',
16776 time spent executing operating system routines on behalf of the program.
16777 Both numbers are in seconds.
16779 With the specification of an output file, the output is appended to the
16780 named file, and it looks like this:
16783 0.12 0.01 cc1 @var{options}
16784 0.00 0.01 as @var{options}
16787 The ``user time'' and the ``system time'' are moved before the program
16788 name, and the options passed to the program are displayed, so that one
16789 can later tell what file was being compiled, and with which options.
16791 @item -fdump-final-insns@r{[}=@var{file}@r{]}
16792 @opindex fdump-final-insns
16793 Dump the final internal representation (RTL) to @var{file}. If the
16794 optional argument is omitted (or if @var{file} is @code{.}), the name
16795 of the dump file is determined by appending @code{.gkd} to the
16796 dump base name, see @option{-dumpbase}.
16798 @item -fcompare-debug@r{[}=@var{opts}@r{]}
16799 @opindex fcompare-debug
16800 @opindex fno-compare-debug
16801 If no error occurs during compilation, run the compiler a second time,
16802 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
16803 passed to the second compilation. Dump the final internal
16804 representation in both compilations, and print an error if they differ.
16806 If the equal sign is omitted, the default @option{-gtoggle} is used.
16808 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
16809 and nonzero, implicitly enables @option{-fcompare-debug}. If
16810 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
16811 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
16814 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
16815 is equivalent to @option{-fno-compare-debug}, which disables the dumping
16816 of the final representation and the second compilation, preventing even
16817 @env{GCC_COMPARE_DEBUG} from taking effect.
16819 To verify full coverage during @option{-fcompare-debug} testing, set
16820 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
16821 which GCC rejects as an invalid option in any actual compilation
16822 (rather than preprocessing, assembly or linking). To get just a
16823 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
16824 not overridden} will do.
16826 @item -fcompare-debug-second
16827 @opindex fcompare-debug-second
16828 This option is implicitly passed to the compiler for the second
16829 compilation requested by @option{-fcompare-debug}, along with options to
16830 silence warnings, and omitting other options that would cause the compiler
16831 to produce output to files or to standard output as a side effect. Dump
16832 files and preserved temporary files are renamed so as to contain the
16833 @code{.gk} additional extension during the second compilation, to avoid
16834 overwriting those generated by the first.
16836 When this option is passed to the compiler driver, it causes the
16837 @emph{first} compilation to be skipped, which makes it useful for little
16838 other than debugging the compiler proper.
16842 Turn off generation of debug info, if leaving out this option
16843 generates it, or turn it on at level 2 otherwise. The position of this
16844 argument in the command line does not matter; it takes effect after all
16845 other options are processed, and it does so only once, no matter how
16846 many times it is given. This is mainly intended to be used with
16847 @option{-fcompare-debug}.
16849 @item -fvar-tracking-assignments-toggle
16850 @opindex fvar-tracking-assignments-toggle
16851 @opindex fno-var-tracking-assignments-toggle
16852 Toggle @option{-fvar-tracking-assignments}, in the same way that
16853 @option{-gtoggle} toggles @option{-g}.
16857 Makes the compiler print out each function name as it is compiled, and
16858 print some statistics about each pass when it finishes.
16860 @item -ftime-report
16861 @opindex ftime-report
16862 Makes the compiler print some statistics about the time consumed by each
16863 pass when it finishes.
16865 @item -ftime-report-details
16866 @opindex ftime-report-details
16867 Record the time consumed by infrastructure parts separately for each pass.
16869 @item -fira-verbose=@var{n}
16870 @opindex fira-verbose
16871 Control the verbosity of the dump file for the integrated register allocator.
16872 The default value is 5. If the value @var{n} is greater or equal to 10,
16873 the dump output is sent to stderr using the same format as @var{n} minus 10.
16876 @opindex flto-report
16877 Prints a report with internal details on the workings of the link-time
16878 optimizer. The contents of this report vary from version to version.
16879 It is meant to be useful to GCC developers when processing object
16880 files in LTO mode (via @option{-flto}).
16882 Disabled by default.
16884 @item -flto-report-wpa
16885 @opindex flto-report-wpa
16886 Like @option{-flto-report}, but only print for the WPA phase of link-time
16890 @opindex fmem-report
16891 Makes the compiler print some statistics about permanent memory
16892 allocation when it finishes.
16894 @item -fmem-report-wpa
16895 @opindex fmem-report-wpa
16896 Makes the compiler print some statistics about permanent memory
16897 allocation for the WPA phase only.
16899 @item -fpre-ipa-mem-report
16900 @opindex fpre-ipa-mem-report
16901 @item -fpost-ipa-mem-report
16902 @opindex fpost-ipa-mem-report
16903 Makes the compiler print some statistics about permanent memory
16904 allocation before or after interprocedural optimization.
16906 @item -fprofile-report
16907 @opindex fprofile-report
16908 Makes the compiler print some statistics about consistency of the
16909 (estimated) profile and effect of individual passes.
16911 @item -fstack-usage
16912 @opindex fstack-usage
16913 Makes the compiler output stack usage information for the program, on a
16914 per-function basis. The filename for the dump is made by appending
16915 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
16916 the output file, if explicitly specified and it is not an executable,
16917 otherwise it is the basename of the source file. An entry is made up
16922 The name of the function.
16926 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
16929 The qualifier @code{static} means that the function manipulates the stack
16930 statically: a fixed number of bytes are allocated for the frame on function
16931 entry and released on function exit; no stack adjustments are otherwise made
16932 in the function. The second field is this fixed number of bytes.
16934 The qualifier @code{dynamic} means that the function manipulates the stack
16935 dynamically: in addition to the static allocation described above, stack
16936 adjustments are made in the body of the function, for example to push/pop
16937 arguments around function calls. If the qualifier @code{bounded} is also
16938 present, the amount of these adjustments is bounded at compile time and
16939 the second field is an upper bound of the total amount of stack used by
16940 the function. If it is not present, the amount of these adjustments is
16941 not bounded at compile time and the second field only represents the
16946 Emit statistics about front-end processing at the end of the compilation.
16947 This option is supported only by the C++ front end, and
16948 the information is generally only useful to the G++ development team.
16950 @item -fdbg-cnt-list
16951 @opindex fdbg-cnt-list
16952 Print the name and the counter upper bound for all debug counters.
16955 @item -fdbg-cnt=@var{counter-value-list}
16957 Set the internal debug counter lower and upper bound. @var{counter-value-list}
16958 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
16959 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
16960 the name of the counter and list of closed intervals.
16961 The @var{lower_bound} is optional and is zero
16962 initialized if not set.
16963 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
16964 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
16965 eleventh invocation.
16966 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
16968 @item -print-file-name=@var{library}
16969 @opindex print-file-name
16970 Print the full absolute name of the library file @var{library} that
16971 would be used when linking---and don't do anything else. With this
16972 option, GCC does not compile or link anything; it just prints the
16975 @item -print-multi-directory
16976 @opindex print-multi-directory
16977 Print the directory name corresponding to the multilib selected by any
16978 other switches present in the command line. This directory is supposed
16979 to exist in @env{GCC_EXEC_PREFIX}.
16981 @item -print-multi-lib
16982 @opindex print-multi-lib
16983 Print the mapping from multilib directory names to compiler switches
16984 that enable them. The directory name is separated from the switches by
16985 @samp{;}, and each switch starts with an @samp{@@} instead of the
16986 @samp{-}, without spaces between multiple switches. This is supposed to
16987 ease shell processing.
16989 @item -print-multi-os-directory
16990 @opindex print-multi-os-directory
16991 Print the path to OS libraries for the selected
16992 multilib, relative to some @file{lib} subdirectory. If OS libraries are
16993 present in the @file{lib} subdirectory and no multilibs are used, this is
16994 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
16995 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
16996 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
16997 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
16999 @item -print-multiarch
17000 @opindex print-multiarch
17001 Print the path to OS libraries for the selected multiarch,
17002 relative to some @file{lib} subdirectory.
17004 @item -print-prog-name=@var{program}
17005 @opindex print-prog-name
17006 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
17008 @item -print-libgcc-file-name
17009 @opindex print-libgcc-file-name
17010 Same as @option{-print-file-name=libgcc.a}.
17012 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
17013 but you do want to link with @file{libgcc.a}. You can do:
17016 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
17019 @item -print-search-dirs
17020 @opindex print-search-dirs
17021 Print the name of the configured installation directory and a list of
17022 program and library directories @command{gcc} searches---and don't do anything else.
17024 This is useful when @command{gcc} prints the error message
17025 @samp{installation problem, cannot exec cpp0: No such file or directory}.
17026 To resolve this you either need to put @file{cpp0} and the other compiler
17027 components where @command{gcc} expects to find them, or you can set the environment
17028 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
17029 Don't forget the trailing @samp{/}.
17030 @xref{Environment Variables}.
17032 @item -print-sysroot
17033 @opindex print-sysroot
17034 Print the target sysroot directory that is used during
17035 compilation. This is the target sysroot specified either at configure
17036 time or using the @option{--sysroot} option, possibly with an extra
17037 suffix that depends on compilation options. If no target sysroot is
17038 specified, the option prints nothing.
17040 @item -print-sysroot-headers-suffix
17041 @opindex print-sysroot-headers-suffix
17042 Print the suffix added to the target sysroot when searching for
17043 headers, or give an error if the compiler is not configured with such
17044 a suffix---and don't do anything else.
17047 @opindex dumpmachine
17048 Print the compiler's target machine (for example,
17049 @samp{i686-pc-linux-gnu})---and don't do anything else.
17052 @opindex dumpversion
17053 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
17054 anything else. This is the compiler version used in filesystem paths and
17055 specs. Depending on how the compiler has been configured it can be just
17056 a single number (major version), two numbers separated by a dot (major and
17057 minor version) or three numbers separated by dots (major, minor and patchlevel
17060 @item -dumpfullversion
17061 @opindex dumpfullversion
17062 Print the full compiler version---and don't do anything else. The output is
17063 always three numbers separated by dots, major, minor and patchlevel version.
17067 Print the compiler's built-in specs---and don't do anything else. (This
17068 is used when GCC itself is being built.) @xref{Spec Files}.
17071 @node Submodel Options
17072 @section Machine-Dependent Options
17073 @cindex submodel options
17074 @cindex specifying hardware config
17075 @cindex hardware models and configurations, specifying
17076 @cindex target-dependent options
17077 @cindex machine-dependent options
17079 Each target machine supported by GCC can have its own options---for
17080 example, to allow you to compile for a particular processor variant or
17081 ABI, or to control optimizations specific to that machine. By
17082 convention, the names of machine-specific options start with
17085 Some configurations of the compiler also support additional target-specific
17086 options, usually for compatibility with other compilers on the same
17089 @c This list is ordered alphanumerically by subsection name.
17090 @c It should be the same order and spelling as these options are listed
17091 @c in Machine Dependent Options
17094 * AArch64 Options::
17095 * Adapteva Epiphany Options::
17096 * AMD GCN Options::
17100 * Blackfin Options::
17106 * DEC Alpha Options::
17111 * GNU/Linux Options::
17121 * MicroBlaze Options::
17124 * MN10300 Options::
17128 * Nios II Options::
17129 * Nvidia PTX Options::
17130 * OpenRISC Options::
17132 * picoChip Options::
17133 * PowerPC Options::
17137 * RS/6000 and PowerPC Options::
17139 * S/390 and zSeries Options::
17142 * Solaris 2 Options::
17144 * System V Options::
17145 * TILE-Gx Options::
17146 * TILEPro Options::
17151 * VxWorks Options::
17153 * x86 Windows Options::
17154 * Xstormy16 Options::
17156 * zSeries Options::
17159 @node AArch64 Options
17160 @subsection AArch64 Options
17161 @cindex AArch64 Options
17163 These options are defined for AArch64 implementations:
17167 @item -mabi=@var{name}
17169 Generate code for the specified data model. Permissible values
17170 are @samp{ilp32} for SysV-like data model where int, long int and pointers
17171 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
17172 but long int and pointers are 64 bits.
17174 The default depends on the specific target configuration. Note that
17175 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
17176 entire program with the same ABI, and link with a compatible set of libraries.
17179 @opindex mbig-endian
17180 Generate big-endian code. This is the default when GCC is configured for an
17181 @samp{aarch64_be-*-*} target.
17183 @item -mgeneral-regs-only
17184 @opindex mgeneral-regs-only
17185 Generate code which uses only the general-purpose registers. This will prevent
17186 the compiler from using floating-point and Advanced SIMD registers but will not
17187 impose any restrictions on the assembler.
17189 @item -mlittle-endian
17190 @opindex mlittle-endian
17191 Generate little-endian code. This is the default when GCC is configured for an
17192 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
17194 @item -mcmodel=tiny
17195 @opindex mcmodel=tiny
17196 Generate code for the tiny code model. The program and its statically defined
17197 symbols must be within 1MB of each other. Programs can be statically or
17198 dynamically linked.
17200 @item -mcmodel=small
17201 @opindex mcmodel=small
17202 Generate code for the small code model. The program and its statically defined
17203 symbols must be within 4GB of each other. Programs can be statically or
17204 dynamically linked. This is the default code model.
17206 @item -mcmodel=large
17207 @opindex mcmodel=large
17208 Generate code for the large code model. This makes no assumptions about
17209 addresses and sizes of sections. Programs can be statically linked only. The
17210 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
17211 @option{-fpic} and @option{-fPIC}.
17213 @item -mstrict-align
17214 @itemx -mno-strict-align
17215 @opindex mstrict-align
17216 @opindex mno-strict-align
17217 Avoid or allow generating memory accesses that may not be aligned on a natural
17218 object boundary as described in the architecture specification.
17220 @item -momit-leaf-frame-pointer
17221 @itemx -mno-omit-leaf-frame-pointer
17222 @opindex momit-leaf-frame-pointer
17223 @opindex mno-omit-leaf-frame-pointer
17224 Omit or keep the frame pointer in leaf functions. The former behavior is the
17227 @item -mstack-protector-guard=@var{guard}
17228 @itemx -mstack-protector-guard-reg=@var{reg}
17229 @itemx -mstack-protector-guard-offset=@var{offset}
17230 @opindex mstack-protector-guard
17231 @opindex mstack-protector-guard-reg
17232 @opindex mstack-protector-guard-offset
17233 Generate stack protection code using canary at @var{guard}. Supported
17234 locations are @samp{global} for a global canary or @samp{sysreg} for a
17235 canary in an appropriate system register.
17237 With the latter choice the options
17238 @option{-mstack-protector-guard-reg=@var{reg}} and
17239 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
17240 which system register to use as base register for reading the canary,
17241 and from what offset from that base register. There is no default
17242 register or offset as this is entirely for use within the Linux
17245 @item -mtls-dialect=desc
17246 @opindex mtls-dialect=desc
17247 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
17248 of TLS variables. This is the default.
17250 @item -mtls-dialect=traditional
17251 @opindex mtls-dialect=traditional
17252 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
17255 @item -mtls-size=@var{size}
17257 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
17258 This option requires binutils 2.26 or newer.
17260 @item -mfix-cortex-a53-835769
17261 @itemx -mno-fix-cortex-a53-835769
17262 @opindex mfix-cortex-a53-835769
17263 @opindex mno-fix-cortex-a53-835769
17264 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
17265 This involves inserting a NOP instruction between memory instructions and
17266 64-bit integer multiply-accumulate instructions.
17268 @item -mfix-cortex-a53-843419
17269 @itemx -mno-fix-cortex-a53-843419
17270 @opindex mfix-cortex-a53-843419
17271 @opindex mno-fix-cortex-a53-843419
17272 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
17273 This erratum workaround is made at link time and this will only pass the
17274 corresponding flag to the linker.
17276 @item -mlow-precision-recip-sqrt
17277 @itemx -mno-low-precision-recip-sqrt
17278 @opindex mlow-precision-recip-sqrt
17279 @opindex mno-low-precision-recip-sqrt
17280 Enable or disable the reciprocal square root approximation.
17281 This option only has an effect if @option{-ffast-math} or
17282 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
17283 precision of reciprocal square root results to about 16 bits for
17284 single precision and to 32 bits for double precision.
17286 @item -mlow-precision-sqrt
17287 @itemx -mno-low-precision-sqrt
17288 @opindex mlow-precision-sqrt
17289 @opindex mno-low-precision-sqrt
17290 Enable or disable the square root approximation.
17291 This option only has an effect if @option{-ffast-math} or
17292 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
17293 precision of square root results to about 16 bits for
17294 single precision and to 32 bits for double precision.
17295 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
17297 @item -mlow-precision-div
17298 @itemx -mno-low-precision-div
17299 @opindex mlow-precision-div
17300 @opindex mno-low-precision-div
17301 Enable or disable the division approximation.
17302 This option only has an effect if @option{-ffast-math} or
17303 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
17304 precision of division results to about 16 bits for
17305 single precision and to 32 bits for double precision.
17307 @item -mtrack-speculation
17308 @itemx -mno-track-speculation
17309 Enable or disable generation of additional code to track speculative
17310 execution through conditional branches. The tracking state can then
17311 be used by the compiler when expanding calls to
17312 @code{__builtin_speculation_safe_copy} to permit a more efficient code
17313 sequence to be generated.
17315 @item -moutline-atomics
17316 @itemx -mno-outline-atomics
17317 Enable or disable calls to out-of-line helpers to implement atomic operations.
17318 These helpers will, at runtime, determine if the LSE instructions from
17319 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
17320 instructions that are present in the base ARMv8.0 ISA.
17322 This option is only applicable when compiling for the base ARMv8.0
17323 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
17324 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
17325 used directly. The same applies when using @option{-mcpu=} when the
17326 selected cpu supports the @samp{lse} feature.
17327 This option is on by default.
17329 @item -march=@var{name}
17331 Specify the name of the target architecture and, optionally, one or
17332 more feature modifiers. This option has the form
17333 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
17335 The table below summarizes the permissible values for @var{arch}
17336 and the features that they enable by default:
17338 @multitable @columnfractions 0.20 0.20 0.60
17339 @headitem @var{arch} value @tab Architecture @tab Includes by default
17340 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
17341 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
17342 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
17343 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}
17344 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+fp16fml}, @samp{+dotprod}
17345 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
17346 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
17349 The value @samp{native} is available on native AArch64 GNU/Linux and
17350 causes the compiler to pick the architecture of the host system. This
17351 option has no effect if the compiler is unable to recognize the
17352 architecture of the host system,
17354 The permissible values for @var{feature} are listed in the sub-section
17355 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
17356 Feature Modifiers}. Where conflicting feature modifiers are
17357 specified, the right-most feature is used.
17359 GCC uses @var{name} to determine what kind of instructions it can emit
17360 when generating assembly code. If @option{-march} is specified
17361 without either of @option{-mtune} or @option{-mcpu} also being
17362 specified, the code is tuned to perform well across a range of target
17363 processors implementing the target architecture.
17365 @item -mtune=@var{name}
17367 Specify the name of the target processor for which GCC should tune the
17368 performance of the code. Permissible values for this option are:
17369 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17370 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17371 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17372 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
17373 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
17374 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
17375 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
17376 @samp{octeontx81}, @samp{octeontx83},
17377 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
17378 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
17379 @samp{octeontx2f95mm},
17381 @samp{thunderx}, @samp{thunderxt88},
17382 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
17383 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
17384 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17385 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17386 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
17389 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17390 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17391 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
17392 should tune for a big.LITTLE system.
17394 Additionally on native AArch64 GNU/Linux systems the value
17395 @samp{native} tunes performance to the host system. This option has no effect
17396 if the compiler is unable to recognize the processor of the host system.
17398 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
17399 are specified, the code is tuned to perform well across a range
17400 of target processors.
17402 This option cannot be suffixed by feature modifiers.
17404 @item -mcpu=@var{name}
17406 Specify the name of the target processor, optionally suffixed by one
17407 or more feature modifiers. This option has the form
17408 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
17409 the permissible values for @var{cpu} are the same as those available
17410 for @option{-mtune}. The permissible values for @var{feature} are
17411 documented in the sub-section on
17412 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
17413 Feature Modifiers}. Where conflicting feature modifiers are
17414 specified, the right-most feature is used.
17416 GCC uses @var{name} to determine what kind of instructions it can emit when
17417 generating assembly code (as if by @option{-march}) and to determine
17418 the target processor for which to tune for performance (as if
17419 by @option{-mtune}). Where this option is used in conjunction
17420 with @option{-march} or @option{-mtune}, those options take precedence
17421 over the appropriate part of this option.
17423 @item -moverride=@var{string}
17425 Override tuning decisions made by the back-end in response to a
17426 @option{-mtune=} switch. The syntax, semantics, and accepted values
17427 for @var{string} in this option are not guaranteed to be consistent
17430 This option is only intended to be useful when developing GCC.
17432 @item -mverbose-cost-dump
17433 @opindex mverbose-cost-dump
17434 Enable verbose cost model dumping in the debug dump files. This option is
17435 provided for use in debugging the compiler.
17437 @item -mpc-relative-literal-loads
17438 @itemx -mno-pc-relative-literal-loads
17439 @opindex mpc-relative-literal-loads
17440 @opindex mno-pc-relative-literal-loads
17441 Enable or disable PC-relative literal loads. With this option literal pools are
17442 accessed using a single instruction and emitted after each function. This
17443 limits the maximum size of functions to 1MB. This is enabled by default for
17444 @option{-mcmodel=tiny}.
17446 @item -msign-return-address=@var{scope}
17447 @opindex msign-return-address
17448 Select the function scope on which return address signing will be applied.
17449 Permissible values are @samp{none}, which disables return address signing,
17450 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
17451 functions, and @samp{all}, which enables pointer signing for all functions. The
17452 default value is @samp{none}. This option has been deprecated by
17453 -mbranch-protection.
17455 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
17456 @opindex mbranch-protection
17457 Select the branch protection features to use.
17458 @samp{none} is the default and turns off all types of branch protection.
17459 @samp{standard} turns on all types of branch protection features. If a feature
17460 has additional tuning options, then @samp{standard} sets it to its standard
17462 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
17463 level: signing functions that save the return address to memory (non-leaf
17464 functions will practically always do this) using the a-key. The optional
17465 argument @samp{leaf} can be used to extend the signing to include leaf
17466 functions. The optional argument @samp{b-key} can be used to sign the functions
17467 with the B-key instead of the A-key.
17468 @samp{bti} turns on branch target identification mechanism.
17470 @item -mharden-sls=@var{opts}
17471 @opindex mharden-sls
17472 Enable compiler hardening against straight line speculation (SLS).
17473 @var{opts} is a comma-separated list of the following options:
17478 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
17479 @samp{-mharden-sls=none} disables all SLS hardening.
17481 @item -msve-vector-bits=@var{bits}
17482 @opindex msve-vector-bits
17483 Specify the number of bits in an SVE vector register. This option only has
17484 an effect when SVE is enabled.
17486 GCC supports two forms of SVE code generation: ``vector-length
17487 agnostic'' output that works with any size of vector register and
17488 ``vector-length specific'' output that allows GCC to make assumptions
17489 about the vector length when it is useful for optimization reasons.
17490 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
17491 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
17492 Specifying @samp{scalable} selects vector-length agnostic
17493 output. At present @samp{-msve-vector-bits=128} also generates vector-length
17494 agnostic output for big-endian targets. All other values generate
17495 vector-length specific code. The behavior of these values may change
17496 in future releases and no value except @samp{scalable} should be
17497 relied on for producing code that is portable across different
17498 hardware SVE vector lengths.
17500 The default is @samp{-msve-vector-bits=scalable}, which produces
17501 vector-length agnostic code.
17504 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
17505 @anchor{aarch64-feature-modifiers}
17506 @cindex @option{-march} feature modifiers
17507 @cindex @option{-mcpu} feature modifiers
17508 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
17509 the following and their inverses @option{no@var{feature}}:
17513 Enable CRC extension. This is on by default for
17514 @option{-march=armv8.1-a}.
17516 Enable Crypto extension. This also enables Advanced SIMD and floating-point
17519 Enable floating-point instructions. This is on by default for all possible
17520 values for options @option{-march} and @option{-mcpu}.
17522 Enable Advanced SIMD instructions. This also enables floating-point
17523 instructions. This is on by default for all possible values for options
17524 @option{-march} and @option{-mcpu}.
17526 Enable Scalable Vector Extension instructions. This also enables Advanced
17527 SIMD and floating-point instructions.
17529 Enable Large System Extension instructions. This is on by default for
17530 @option{-march=armv8.1-a}.
17532 Enable Round Double Multiply Accumulate instructions. This is on by default
17533 for @option{-march=armv8.1-a}.
17535 Enable FP16 extension. This also enables floating-point instructions.
17537 Enable FP16 fmla extension. This also enables FP16 extensions and
17538 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.
17541 Enable the RcPc extension. This does not change code generation from GCC,
17542 but is passed on to the assembler, enabling inline asm statements to use
17543 instructions from the RcPc extension.
17545 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17547 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
17550 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
17552 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
17553 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
17555 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
17556 Use of this option with architectures prior to Armv8.2-A is not supported.
17558 Enable the Statistical Profiling extension. This option is only to enable the
17559 extension at the assembler level and does not affect code generation.
17561 Enable the Armv8.5-a Random Number instructions. This option is only to
17562 enable the extension at the assembler level and does not affect code
17565 Enable the Armv8.5-a Memory Tagging Extensions.
17566 Use of this option with architectures prior to Armv8.5-A is not supported.
17568 Enable the Armv8-a Speculation Barrier instruction. This option is only to
17569 enable the extension at the assembler level and does not affect code
17570 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17572 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
17573 is only to enable the extension at the assembler level and does not affect code
17574 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17576 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
17577 This option is only to enable the extension at the assembler level and does
17578 not affect code generation. This option is enabled by default for
17579 @option{-march=armv8.5-a}.
17581 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
17584 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
17586 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17588 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17590 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
17592 Enable the Transactional Memory Extension.
17594 Enable 8-bit Integer Matrix Multiply instructions. This also enables
17595 Advanced SIMD and floating-point instructions. This option is enabled by
17596 default for @option{-march=armv8.6-a}. Use of this option with architectures
17597 prior to Armv8.2-A is not supported.
17599 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
17600 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17603 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
17604 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17607 Enable brain half-precision floating-point instructions. This also enables
17608 Advanced SIMD and floating-point instructions. This option is enabled by
17609 default for @option{-march=armv8.6-a}. Use of this option with architectures
17610 prior to Armv8.2-A is not supported.
17614 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
17615 which implies @option{fp}.
17616 Conversely, @option{nofp} implies @option{nosimd}, which implies
17617 @option{nocrypto}, @option{noaes} and @option{nosha2}.
17619 @node Adapteva Epiphany Options
17620 @subsection Adapteva Epiphany Options
17622 These @samp{-m} options are defined for Adapteva Epiphany:
17625 @item -mhalf-reg-file
17626 @opindex mhalf-reg-file
17627 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
17628 That allows code to run on hardware variants that lack these registers.
17630 @item -mprefer-short-insn-regs
17631 @opindex mprefer-short-insn-regs
17632 Preferentially allocate registers that allow short instruction generation.
17633 This can result in increased instruction count, so this may either reduce or
17634 increase overall code size.
17636 @item -mbranch-cost=@var{num}
17637 @opindex mbranch-cost
17638 Set the cost of branches to roughly @var{num} ``simple'' instructions.
17639 This cost is only a heuristic and is not guaranteed to produce
17640 consistent results across releases.
17644 Enable the generation of conditional moves.
17646 @item -mnops=@var{num}
17648 Emit @var{num} NOPs before every other generated instruction.
17650 @item -mno-soft-cmpsf
17651 @opindex mno-soft-cmpsf
17652 @opindex msoft-cmpsf
17653 For single-precision floating-point comparisons, emit an @code{fsub} instruction
17654 and test the flags. This is faster than a software comparison, but can
17655 get incorrect results in the presence of NaNs, or when two different small
17656 numbers are compared such that their difference is calculated as zero.
17657 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
17658 software comparisons.
17660 @item -mstack-offset=@var{num}
17661 @opindex mstack-offset
17662 Set the offset between the top of the stack and the stack pointer.
17663 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
17664 can be used by leaf functions without stack allocation.
17665 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
17666 Note also that this option changes the ABI; compiling a program with a
17667 different stack offset than the libraries have been compiled with
17668 generally does not work.
17669 This option can be useful if you want to evaluate if a different stack
17670 offset would give you better code, but to actually use a different stack
17671 offset to build working programs, it is recommended to configure the
17672 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
17674 @item -mno-round-nearest
17675 @opindex mno-round-nearest
17676 @opindex mround-nearest
17677 Make the scheduler assume that the rounding mode has been set to
17678 truncating. The default is @option{-mround-nearest}.
17681 @opindex mlong-calls
17682 If not otherwise specified by an attribute, assume all calls might be beyond
17683 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
17684 function address into a register before performing a (otherwise direct) call.
17685 This is the default.
17687 @item -mshort-calls
17688 @opindex short-calls
17689 If not otherwise specified by an attribute, assume all direct calls are
17690 in the range of the @code{b} / @code{bl} instructions, so use these instructions
17691 for direct calls. The default is @option{-mlong-calls}.
17695 Assume addresses can be loaded as 16-bit unsigned values. This does not
17696 apply to function addresses for which @option{-mlong-calls} semantics
17699 @item -mfp-mode=@var{mode}
17701 Set the prevailing mode of the floating-point unit.
17702 This determines the floating-point mode that is provided and expected
17703 at function call and return time. Making this mode match the mode you
17704 predominantly need at function start can make your programs smaller and
17705 faster by avoiding unnecessary mode switches.
17707 @var{mode} can be set to one the following values:
17711 Any mode at function entry is valid, and retained or restored when
17712 the function returns, and when it calls other functions.
17713 This mode is useful for compiling libraries or other compilation units
17714 you might want to incorporate into different programs with different
17715 prevailing FPU modes, and the convenience of being able to use a single
17716 object file outweighs the size and speed overhead for any extra
17717 mode switching that might be needed, compared with what would be needed
17718 with a more specific choice of prevailing FPU mode.
17721 This is the mode used for floating-point calculations with
17722 truncating (i.e.@: round towards zero) rounding mode. That includes
17723 conversion from floating point to integer.
17725 @item round-nearest
17726 This is the mode used for floating-point calculations with
17727 round-to-nearest-or-even rounding mode.
17730 This is the mode used to perform integer calculations in the FPU, e.g.@:
17731 integer multiply, or integer multiply-and-accumulate.
17734 The default is @option{-mfp-mode=caller}
17736 @item -mno-split-lohi
17737 @itemx -mno-postinc
17738 @itemx -mno-postmodify
17739 @opindex mno-split-lohi
17740 @opindex msplit-lohi
17741 @opindex mno-postinc
17743 @opindex mno-postmodify
17744 @opindex mpostmodify
17745 Code generation tweaks that disable, respectively, splitting of 32-bit
17746 loads, generation of post-increment addresses, and generation of
17747 post-modify addresses. The defaults are @option{msplit-lohi},
17748 @option{-mpost-inc}, and @option{-mpost-modify}.
17750 @item -mnovect-double
17751 @opindex mno-vect-double
17752 @opindex mvect-double
17753 Change the preferred SIMD mode to SImode. The default is
17754 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
17756 @item -max-vect-align=@var{num}
17757 @opindex max-vect-align
17758 The maximum alignment for SIMD vector mode types.
17759 @var{num} may be 4 or 8. The default is 8.
17760 Note that this is an ABI change, even though many library function
17761 interfaces are unaffected if they don't use SIMD vector modes
17762 in places that affect size and/or alignment of relevant types.
17764 @item -msplit-vecmove-early
17765 @opindex msplit-vecmove-early
17766 Split vector moves into single word moves before reload. In theory this
17767 can give better register allocation, but so far the reverse seems to be
17768 generally the case.
17770 @item -m1reg-@var{reg}
17772 Specify a register to hold the constant @minus{}1, which makes loading small negative
17773 constants and certain bitmasks faster.
17774 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
17775 which specify use of that register as a fixed register,
17776 and @samp{none}, which means that no register is used for this
17777 purpose. The default is @option{-m1reg-none}.
17781 @node AMD GCN Options
17782 @subsection AMD GCN Options
17783 @cindex AMD GCN Options
17785 These options are defined specifically for the AMD GCN port.
17789 @item -march=@var{gpu}
17791 @itemx -mtune=@var{gpu}
17793 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
17799 Compile for GCN3 Fiji devices (gfx803).
17802 Compile for GCN5 Vega 10 devices (gfx900).
17805 Compile for GCN5 Vega 20 devices (gfx906).
17809 @item -mstack-size=@var{bytes}
17810 @opindex mstack-size
17811 Specify how many @var{bytes} of stack space will be requested for each GPU
17812 thread (wave-front). Beware that there may be many threads and limited memory
17813 available. The size of the stack allocation may also have an impact on
17814 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
17820 @subsection ARC Options
17821 @cindex ARC options
17823 The following options control the architecture variant for which code
17826 @c architecture variants
17829 @item -mbarrel-shifter
17830 @opindex mbarrel-shifter
17831 Generate instructions supported by barrel shifter. This is the default
17832 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
17835 @opindex mjli-alawys
17836 Force to call a function using jli_s instruction. This option is
17837 valid only for ARCv2 architecture.
17839 @item -mcpu=@var{cpu}
17841 Set architecture type, register usage, and instruction scheduling
17842 parameters for @var{cpu}. There are also shortcut alias options
17843 available for backward compatibility and convenience. Supported
17844 values for @var{cpu} are
17850 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
17854 Compile for ARC601. Alias: @option{-mARC601}.
17859 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
17860 This is the default when configured with @option{--with-cpu=arc700}@.
17863 Compile for ARC EM.
17866 Compile for ARC HS.
17869 Compile for ARC EM CPU with no hardware extensions.
17872 Compile for ARC EM4 CPU.
17875 Compile for ARC EM4 DMIPS CPU.
17878 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
17882 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
17883 double assist instructions.
17886 Compile for ARC HS CPU with no hardware extensions except the atomic
17890 Compile for ARC HS34 CPU.
17893 Compile for ARC HS38 CPU.
17896 Compile for ARC HS38 CPU with all hardware extensions on.
17899 Compile for ARC 600 CPU with @code{norm} instructions enabled.
17901 @item arc600_mul32x16
17902 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
17903 instructions enabled.
17906 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
17907 instructions enabled.
17910 Compile for ARC 601 CPU with @code{norm} instructions enabled.
17912 @item arc601_mul32x16
17913 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
17914 instructions enabled.
17917 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
17918 instructions enabled.
17921 Compile for ARC 700 on NPS400 chip.
17924 Compile for ARC EM minimalist configuration featuring reduced register
17931 @itemx -mdpfp-compact
17932 @opindex mdpfp-compact
17933 Generate double-precision FPX instructions, tuned for the compact
17937 @opindex mdpfp-fast
17938 Generate double-precision FPX instructions, tuned for the fast
17941 @item -mno-dpfp-lrsr
17942 @opindex mno-dpfp-lrsr
17943 Disable @code{lr} and @code{sr} instructions from using FPX extension
17948 Generate extended arithmetic instructions. Currently only
17949 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
17950 supported. Only valid for @option{-mcpu=ARC700}.
17955 Do not generate @code{mpy}-family instructions for ARC700. This option is
17960 Generate 32x16-bit multiply and multiply-accumulate instructions.
17964 Generate @code{mul64} and @code{mulu64} instructions.
17965 Only valid for @option{-mcpu=ARC600}.
17969 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
17974 @itemx -mspfp-compact
17975 @opindex mspfp-compact
17976 Generate single-precision FPX instructions, tuned for the compact
17980 @opindex mspfp-fast
17981 Generate single-precision FPX instructions, tuned for the fast
17986 Enable generation of ARC SIMD instructions via target-specific
17987 builtins. Only valid for @option{-mcpu=ARC700}.
17990 @opindex msoft-float
17991 This option ignored; it is provided for compatibility purposes only.
17992 Software floating-point code is emitted by default, and this default
17993 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
17994 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
17995 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
17999 Generate @code{swap} instructions.
18003 This enables use of the locked load/store conditional extension to implement
18004 atomic memory built-in functions. Not available for ARC 6xx or ARC
18009 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
18011 @item -mcode-density
18012 @opindex mcode-density
18013 Enable code density instructions for ARC EM.
18014 This option is on by default for ARC HS.
18018 Enable double load/store operations for ARC HS cores.
18020 @item -mtp-regno=@var{regno}
18022 Specify thread pointer register number.
18024 @item -mmpy-option=@var{multo}
18025 @opindex mmpy-option
18026 Compile ARCv2 code with a multiplier design option. You can specify
18027 the option using either a string or numeric value for @var{multo}.
18028 @samp{wlh1} is the default value. The recognized values are:
18033 No multiplier available.
18037 16x16 multiplier, fully pipelined.
18038 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
18042 32x32 multiplier, fully
18043 pipelined (1 stage). The following instructions are additionally
18044 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18048 32x32 multiplier, fully pipelined
18049 (2 stages). The following instructions are additionally enabled: @code{mpy},
18050 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18054 Two 16x16 multipliers, blocking,
18055 sequential. The following instructions are additionally enabled: @code{mpy},
18056 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18060 One 16x16 multiplier, blocking,
18061 sequential. The following instructions are additionally enabled: @code{mpy},
18062 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18066 One 32x4 multiplier, blocking,
18067 sequential. The following instructions are additionally enabled: @code{mpy},
18068 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18072 ARC HS SIMD support.
18076 ARC HS SIMD support.
18080 ARC HS SIMD support.
18084 This option is only available for ARCv2 cores@.
18086 @item -mfpu=@var{fpu}
18088 Enables support for specific floating-point hardware extensions for ARCv2
18089 cores. Supported values for @var{fpu} are:
18094 Enables support for single-precision floating-point hardware
18098 Enables support for double-precision floating-point hardware
18099 extensions. The single-precision floating-point extension is also
18100 enabled. Not available for ARC EM@.
18103 Enables support for double-precision floating-point hardware
18104 extensions using double-precision assist instructions. The single-precision
18105 floating-point extension is also enabled. This option is
18106 only available for ARC EM@.
18109 Enables support for double-precision floating-point hardware
18110 extensions using double-precision assist instructions.
18111 The single-precision floating-point, square-root, and divide
18112 extensions are also enabled. This option is
18113 only available for ARC EM@.
18116 Enables support for double-precision floating-point hardware
18117 extensions using double-precision assist instructions.
18118 The single-precision floating-point and fused multiply and add
18119 hardware extensions are also enabled. This option is
18120 only available for ARC EM@.
18123 Enables support for double-precision floating-point hardware
18124 extensions using double-precision assist instructions.
18125 All single-precision floating-point hardware extensions are also
18126 enabled. This option is only available for ARC EM@.
18129 Enables support for single-precision floating-point, square-root and divide
18130 hardware extensions@.
18133 Enables support for double-precision floating-point, square-root and divide
18134 hardware extensions. This option
18135 includes option @samp{fpus_div}. Not available for ARC EM@.
18138 Enables support for single-precision floating-point and
18139 fused multiply and add hardware extensions@.
18142 Enables support for double-precision floating-point and
18143 fused multiply and add hardware extensions. This option
18144 includes option @samp{fpus_fma}. Not available for ARC EM@.
18147 Enables support for all single-precision floating-point hardware
18151 Enables support for all single- and double-precision floating-point
18152 hardware extensions. Not available for ARC EM@.
18156 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
18157 @opindex mirq-ctrl-saved
18158 Specifies general-purposes registers that the processor automatically
18159 saves/restores on interrupt entry and exit. @var{register-range} is
18160 specified as two registers separated by a dash. The register range
18161 always starts with @code{r0}, the upper limit is @code{fp} register.
18162 @var{blink} and @var{lp_count} are optional. This option is only
18163 valid for ARC EM and ARC HS cores.
18165 @item -mrgf-banked-regs=@var{number}
18166 @opindex mrgf-banked-regs
18167 Specifies the number of registers replicated in second register bank
18168 on entry to fast interrupt. Fast interrupts are interrupts with the
18169 highest priority level P0. These interrupts save only PC and STATUS32
18170 registers to avoid memory transactions during interrupt entry and exit
18171 sequences. Use this option when you are using fast interrupts in an
18172 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
18174 @item -mlpc-width=@var{width}
18175 @opindex mlpc-width
18176 Specify the width of the @code{lp_count} register. Valid values for
18177 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
18178 fixed to 32 bits. If the width is less than 32, the compiler does not
18179 attempt to transform loops in your program to use the zero-delay loop
18180 mechanism unless it is known that the @code{lp_count} register can
18181 hold the required loop-counter value. Depending on the width
18182 specified, the compiler and run-time library might continue to use the
18183 loop mechanism for various needs. This option defines macro
18184 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
18188 This option instructs the compiler to generate code for a 16-entry
18189 register file. This option defines the @code{__ARC_RF16__}
18190 preprocessor macro.
18192 @item -mbranch-index
18193 @opindex mbranch-index
18194 Enable use of @code{bi} or @code{bih} instructions to implement jump
18199 The following options are passed through to the assembler, and also
18200 define preprocessor macro symbols.
18202 @c Flags used by the assembler, but for which we define preprocessor
18203 @c macro symbols as well.
18206 @opindex mdsp-packa
18207 Passed down to the assembler to enable the DSP Pack A extensions.
18208 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
18213 Passed down to the assembler to enable the dual Viterbi butterfly
18214 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
18215 option is deprecated.
18217 @c ARC700 4.10 extension instruction
18220 Passed down to the assembler to enable the locked load/store
18221 conditional extension. Also sets the preprocessor symbol
18226 Passed down to the assembler. Also sets the preprocessor symbol
18227 @code{__Xxmac_d16}. This option is deprecated.
18231 Passed down to the assembler. Also sets the preprocessor symbol
18232 @code{__Xxmac_24}. This option is deprecated.
18234 @c ARC700 4.10 extension instruction
18237 Passed down to the assembler to enable the 64-bit time-stamp counter
18238 extension instruction. Also sets the preprocessor symbol
18239 @code{__Xrtsc}. This option is deprecated.
18241 @c ARC700 4.10 extension instruction
18244 Passed down to the assembler to enable the swap byte ordering
18245 extension instruction. Also sets the preprocessor symbol
18249 @opindex mtelephony
18250 Passed down to the assembler to enable dual- and single-operand
18251 instructions for telephony. Also sets the preprocessor symbol
18252 @code{__Xtelephony}. This option is deprecated.
18256 Passed down to the assembler to enable the XY memory extension. Also
18257 sets the preprocessor symbol @code{__Xxy}.
18261 The following options control how the assembly code is annotated:
18263 @c Assembly annotation options
18267 Annotate assembler instructions with estimated addresses.
18269 @item -mannotate-align
18270 @opindex mannotate-align
18271 Explain what alignment considerations lead to the decision to make an
18272 instruction short or long.
18276 The following options are passed through to the linker:
18278 @c options passed through to the linker
18282 Passed through to the linker, to specify use of the @code{arclinux} emulation.
18283 This option is enabled by default in tool chains built for
18284 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
18285 when profiling is not requested.
18287 @item -marclinux_prof
18288 @opindex marclinux_prof
18289 Passed through to the linker, to specify use of the
18290 @code{arclinux_prof} emulation. This option is enabled by default in
18291 tool chains built for @w{@code{arc-linux-uclibc}} and
18292 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
18296 The following options control the semantics of generated code:
18298 @c semantically relevant code generation options
18301 @opindex mlong-calls
18302 Generate calls as register indirect calls, thus providing access
18303 to the full 32-bit address range.
18305 @item -mmedium-calls
18306 @opindex mmedium-calls
18307 Don't use less than 25-bit addressing range for calls, which is the
18308 offset available for an unconditional branch-and-link
18309 instruction. Conditional execution of function calls is suppressed, to
18310 allow use of the 25-bit range, rather than the 21-bit range with
18311 conditional branch-and-link. This is the default for tool chains built
18312 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
18316 Put definitions of externally-visible data in a small data section if
18317 that data is no bigger than @var{num} bytes. The default value of
18318 @var{num} is 4 for any ARC configuration, or 8 when we have double
18319 load/store operations.
18324 Do not generate sdata references. This is the default for tool chains
18325 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
18328 @item -mvolatile-cache
18329 @opindex mvolatile-cache
18330 Use ordinarily cached memory accesses for volatile references. This is the
18333 @item -mno-volatile-cache
18334 @opindex mno-volatile-cache
18335 @opindex mvolatile-cache
18336 Enable cache bypass for volatile references.
18340 The following options fine tune code generation:
18341 @c code generation tuning options
18344 @opindex malign-call
18345 Do alignment optimizations for call instructions.
18347 @item -mauto-modify-reg
18348 @opindex mauto-modify-reg
18349 Enable the use of pre/post modify with register displacement.
18351 @item -mbbit-peephole
18352 @opindex mbbit-peephole
18353 Enable bbit peephole2.
18357 This option disables a target-specific pass in @file{arc_reorg} to
18358 generate compare-and-branch (@code{br@var{cc}}) instructions.
18359 It has no effect on
18360 generation of these instructions driven by the combiner pass.
18362 @item -mcase-vector-pcrel
18363 @opindex mcase-vector-pcrel
18364 Use PC-relative switch case tables to enable case table shortening.
18365 This is the default for @option{-Os}.
18367 @item -mcompact-casesi
18368 @opindex mcompact-casesi
18369 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
18370 and only available for ARCv1 cores. This option is deprecated.
18372 @item -mno-cond-exec
18373 @opindex mno-cond-exec
18374 Disable the ARCompact-specific pass to generate conditional
18375 execution instructions.
18377 Due to delay slot scheduling and interactions between operand numbers,
18378 literal sizes, instruction lengths, and the support for conditional execution,
18379 the target-independent pass to generate conditional execution is often lacking,
18380 so the ARC port has kept a special pass around that tries to find more
18381 conditional execution generation opportunities after register allocation,
18382 branch shortening, and delay slot scheduling have been done. This pass
18383 generally, but not always, improves performance and code size, at the cost of
18384 extra compilation time, which is why there is an option to switch it off.
18385 If you have a problem with call instructions exceeding their allowable
18386 offset range because they are conditionalized, you should consider using
18387 @option{-mmedium-calls} instead.
18389 @item -mearly-cbranchsi
18390 @opindex mearly-cbranchsi
18391 Enable pre-reload use of the @code{cbranchsi} pattern.
18393 @item -mexpand-adddi
18394 @opindex mexpand-adddi
18395 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
18396 @code{add.f}, @code{adc} etc. This option is deprecated.
18398 @item -mindexed-loads
18399 @opindex mindexed-loads
18400 Enable the use of indexed loads. This can be problematic because some
18401 optimizers then assume that indexed stores exist, which is not
18406 Enable Local Register Allocation. This is still experimental for ARC,
18407 so by default the compiler uses standard reload
18408 (i.e.@: @option{-mno-lra}).
18410 @item -mlra-priority-none
18411 @opindex mlra-priority-none
18412 Don't indicate any priority for target registers.
18414 @item -mlra-priority-compact
18415 @opindex mlra-priority-compact
18416 Indicate target register priority for r0..r3 / r12..r15.
18418 @item -mlra-priority-noncompact
18419 @opindex mlra-priority-noncompact
18420 Reduce target register priority for r0..r3 / r12..r15.
18423 @opindex mmillicode
18424 When optimizing for size (using @option{-Os}), prologues and epilogues
18425 that have to save or restore a large number of registers are often
18426 shortened by using call to a special function in libgcc; this is
18427 referred to as a @emph{millicode} call. As these calls can pose
18428 performance issues, and/or cause linking issues when linking in a
18429 nonstandard way, this option is provided to turn on or off millicode
18432 @item -mcode-density-frame
18433 @opindex mcode-density-frame
18434 This option enable the compiler to emit @code{enter} and @code{leave}
18435 instructions. These instructions are only valid for CPUs with
18436 code-density feature.
18439 @opindex mmixed-code
18440 Tweak register allocation to help 16-bit instruction generation.
18441 This generally has the effect of decreasing the average instruction size
18442 while increasing the instruction count.
18446 Ths option is deprecated. Enable @samp{q} instruction alternatives.
18447 This is the default for @option{-Os}.
18451 Enable @samp{Rcq} constraint handling.
18452 Most short code generation depends on this.
18453 This is the default.
18457 Enable @samp{Rcw} constraint handling.
18458 Most ccfsm condexec mostly depends on this.
18459 This is the default.
18461 @item -msize-level=@var{level}
18462 @opindex msize-level
18463 Fine-tune size optimization with regards to instruction lengths and alignment.
18464 The recognized values for @var{level} are:
18467 No size optimization. This level is deprecated and treated like @samp{1}.
18470 Short instructions are used opportunistically.
18473 In addition, alignment of loops and of code after barriers are dropped.
18476 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
18480 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
18481 the behavior when this is not set is equivalent to level @samp{1}.
18483 @item -mtune=@var{cpu}
18485 Set instruction scheduling parameters for @var{cpu}, overriding any implied
18486 by @option{-mcpu=}.
18488 Supported values for @var{cpu} are
18492 Tune for ARC600 CPU.
18495 Tune for ARC601 CPU.
18498 Tune for ARC700 CPU with standard multiplier block.
18501 Tune for ARC700 CPU with XMAC block.
18504 Tune for ARC725D CPU.
18507 Tune for ARC750D CPU.
18511 @item -mmultcost=@var{num}
18513 Cost to assume for a multiply instruction, with @samp{4} being equal to a
18514 normal instruction.
18516 @item -munalign-prob-threshold=@var{probability}
18517 @opindex munalign-prob-threshold
18518 Set probability threshold for unaligning branches.
18519 When tuning for @samp{ARC700} and optimizing for speed, branches without
18520 filled delay slot are preferably emitted unaligned and long, unless
18521 profiling indicates that the probability for the branch to be taken
18522 is below @var{probability}. @xref{Cross-profiling}.
18523 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
18527 The following options are maintained for backward compatibility, but
18528 are now deprecated and will be removed in a future release:
18530 @c Deprecated options
18538 @opindex mbig-endian
18541 Compile code for big-endian targets. Use of these options is now
18542 deprecated. Big-endian code is supported by configuring GCC to build
18543 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
18544 for which big endian is the default.
18546 @item -mlittle-endian
18547 @opindex mlittle-endian
18550 Compile code for little-endian targets. Use of these options is now
18551 deprecated. Little-endian code is supported by configuring GCC to build
18552 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
18553 for which little endian is the default.
18555 @item -mbarrel_shifter
18556 @opindex mbarrel_shifter
18557 Replaced by @option{-mbarrel-shifter}.
18559 @item -mdpfp_compact
18560 @opindex mdpfp_compact
18561 Replaced by @option{-mdpfp-compact}.
18564 @opindex mdpfp_fast
18565 Replaced by @option{-mdpfp-fast}.
18568 @opindex mdsp_packa
18569 Replaced by @option{-mdsp-packa}.
18573 Replaced by @option{-mea}.
18577 Replaced by @option{-mmac-24}.
18581 Replaced by @option{-mmac-d16}.
18583 @item -mspfp_compact
18584 @opindex mspfp_compact
18585 Replaced by @option{-mspfp-compact}.
18588 @opindex mspfp_fast
18589 Replaced by @option{-mspfp-fast}.
18591 @item -mtune=@var{cpu}
18593 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
18594 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
18595 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
18597 @item -multcost=@var{num}
18599 Replaced by @option{-mmultcost}.
18604 @subsection ARM Options
18605 @cindex ARM options
18607 These @samp{-m} options are defined for the ARM port:
18610 @item -mabi=@var{name}
18612 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
18613 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
18616 @opindex mapcs-frame
18617 Generate a stack frame that is compliant with the ARM Procedure Call
18618 Standard for all functions, even if this is not strictly necessary for
18619 correct execution of the code. Specifying @option{-fomit-frame-pointer}
18620 with this option causes the stack frames not to be generated for
18621 leaf functions. The default is @option{-mno-apcs-frame}.
18622 This option is deprecated.
18626 This is a synonym for @option{-mapcs-frame} and is deprecated.
18629 @c not currently implemented
18630 @item -mapcs-stack-check
18631 @opindex mapcs-stack-check
18632 Generate code to check the amount of stack space available upon entry to
18633 every function (that actually uses some stack space). If there is
18634 insufficient space available then either the function
18635 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
18636 called, depending upon the amount of stack space required. The runtime
18637 system is required to provide these functions. The default is
18638 @option{-mno-apcs-stack-check}, since this produces smaller code.
18640 @c not currently implemented
18641 @item -mapcs-reentrant
18642 @opindex mapcs-reentrant
18643 Generate reentrant, position-independent code. The default is
18644 @option{-mno-apcs-reentrant}.
18647 @item -mthumb-interwork
18648 @opindex mthumb-interwork
18649 Generate code that supports calling between the ARM and Thumb
18650 instruction sets. Without this option, on pre-v5 architectures, the
18651 two instruction sets cannot be reliably used inside one program. The
18652 default is @option{-mno-thumb-interwork}, since slightly larger code
18653 is generated when @option{-mthumb-interwork} is specified. In AAPCS
18654 configurations this option is meaningless.
18656 @item -mno-sched-prolog
18657 @opindex mno-sched-prolog
18658 @opindex msched-prolog
18659 Prevent the reordering of instructions in the function prologue, or the
18660 merging of those instruction with the instructions in the function's
18661 body. This means that all functions start with a recognizable set
18662 of instructions (or in fact one of a choice from a small set of
18663 different function prologues), and this information can be used to
18664 locate the start of functions inside an executable piece of code. The
18665 default is @option{-msched-prolog}.
18667 @item -mfloat-abi=@var{name}
18668 @opindex mfloat-abi
18669 Specifies which floating-point ABI to use. Permissible values
18670 are: @samp{soft}, @samp{softfp} and @samp{hard}.
18672 Specifying @samp{soft} causes GCC to generate output containing
18673 library calls for floating-point operations.
18674 @samp{softfp} allows the generation of code using hardware floating-point
18675 instructions, but still uses the soft-float calling conventions.
18676 @samp{hard} allows generation of floating-point instructions
18677 and uses FPU-specific calling conventions.
18679 The default depends on the specific target configuration. Note that
18680 the hard-float and soft-float ABIs are not link-compatible; you must
18681 compile your entire program with the same ABI, and link with a
18682 compatible set of libraries.
18684 @item -mgeneral-regs-only
18685 @opindex mgeneral-regs-only
18686 Generate code which uses only the general-purpose registers. This will prevent
18687 the compiler from using floating-point and Advanced SIMD registers but will not
18688 impose any restrictions on the assembler.
18690 @item -mlittle-endian
18691 @opindex mlittle-endian
18692 Generate code for a processor running in little-endian mode. This is
18693 the default for all standard configurations.
18696 @opindex mbig-endian
18697 Generate code for a processor running in big-endian mode; the default is
18698 to compile code for a little-endian processor.
18703 When linking a big-endian image select between BE8 and BE32 formats.
18704 The option has no effect for little-endian images and is ignored. The
18705 default is dependent on the selected target architecture. For ARMv6
18706 and later architectures the default is BE8, for older architectures
18707 the default is BE32. BE32 format has been deprecated by ARM.
18709 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
18711 This specifies the name of the target ARM architecture. GCC uses this
18712 name to determine what kind of instructions it can emit when generating
18713 assembly code. This option can be used in conjunction with or instead
18714 of the @option{-mcpu=} option.
18716 Permissible names are:
18718 @samp{armv5t}, @samp{armv5te},
18719 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
18720 @samp{armv6z}, @samp{armv6zk},
18721 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
18722 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
18728 @samp{armv6-m}, @samp{armv6s-m},
18729 @samp{armv7-m}, @samp{armv7e-m},
18730 @samp{armv8-m.base}, @samp{armv8-m.main},
18731 @samp{armv8.1-m.main},
18732 @samp{iwmmxt} and @samp{iwmmxt2}.
18734 Additionally, the following architectures, which lack support for the
18735 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
18737 Many of the architectures support extensions. These can be added by
18738 appending @samp{+@var{extension}} to the architecture name. Extension
18739 options are processed in order and capabilities accumulate. An extension
18740 will also enable any necessary base extensions
18741 upon which it depends. For example, the @samp{+crypto} extension
18742 will always enable the @samp{+simd} extension. The exception to the
18743 additive construction is for extensions that are prefixed with
18744 @samp{+no@dots{}}: these extensions disable the specified option and
18745 any other extensions that may depend on the presence of that
18748 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
18749 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
18750 entirely disabled by the @samp{+nofp} option that follows it.
18752 Most extension names are generically named, but have an effect that is
18753 dependent upon the architecture to which it is applied. For example,
18754 the @samp{+simd} option can be applied to both @samp{armv7-a} and
18755 @samp{armv8-a} architectures, but will enable the original ARMv7-A
18756 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
18757 variant for @samp{armv8-a}.
18759 The table below lists the supported extensions for each architecture.
18760 Architectures not mentioned do not support any extensions.
18773 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
18774 used as an alias for this extension.
18777 Disable the floating-point instructions.
18781 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
18784 The VFPv3 floating-point instructions, with 16 double-precision
18785 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18786 for this extension. Note that floating-point is not supported by the
18787 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
18788 ARMv7-R architectures.
18791 Disable the floating-point instructions.
18797 The multiprocessing extension.
18800 The security extension.
18803 The VFPv3 floating-point instructions, with 16 double-precision
18804 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18805 for this extension.
18808 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18809 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
18810 for this extension.
18813 The VFPv3 floating-point instructions, with 32 double-precision
18816 @item +vfpv3-d16-fp16
18817 The VFPv3 floating-point instructions, with 16 double-precision
18818 registers and the half-precision floating-point conversion operations.
18821 The VFPv3 floating-point instructions, with 32 double-precision
18822 registers and the half-precision floating-point conversion operations.
18825 The VFPv4 floating-point instructions, with 16 double-precision
18829 The VFPv4 floating-point instructions, with 32 double-precision
18833 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18834 the half-precision floating-point conversion operations.
18837 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
18840 Disable the Advanced SIMD instructions (does not disable floating point).
18843 Disable the floating-point and Advanced SIMD instructions.
18847 The extended version of the ARMv7-A architecture with support for
18851 The VFPv4 floating-point instructions, with 16 double-precision registers.
18852 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
18855 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
18856 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
18859 The VFPv3 floating-point instructions, with 16 double-precision
18863 The VFPv3 floating-point instructions, with 32 double-precision
18866 @item +vfpv3-d16-fp16
18867 The VFPv3 floating-point instructions, with 16 double-precision
18868 registers and the half-precision floating-point conversion operations.
18871 The VFPv3 floating-point instructions, with 32 double-precision
18872 registers and the half-precision floating-point conversion operations.
18875 The VFPv4 floating-point instructions, with 16 double-precision
18879 The VFPv4 floating-point instructions, with 32 double-precision
18883 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18884 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
18887 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18888 the half-precision floating-point conversion operations.
18891 Disable the Advanced SIMD instructions (does not disable floating point).
18894 Disable the floating-point and Advanced SIMD instructions.
18900 The Cyclic Redundancy Check (CRC) instructions.
18902 The ARMv8-A Advanced SIMD and floating-point instructions.
18904 The cryptographic instructions.
18906 Disable the cryptographic instructions.
18908 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18910 Speculation Barrier Instruction.
18912 Execution and Data Prediction Restriction Instructions.
18918 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18921 The cryptographic instructions. This also enables the Advanced SIMD and
18922 floating-point instructions.
18925 Disable the cryptographic instructions.
18928 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18931 Speculation Barrier Instruction.
18934 Execution and Data Prediction Restriction Instructions.
18941 The half-precision floating-point data processing instructions.
18942 This also enables the Advanced SIMD and floating-point instructions.
18945 The half-precision floating-point fmla extension. This also enables
18946 the half-precision floating-point extension and Advanced SIMD and
18947 floating-point instructions.
18950 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18953 The cryptographic instructions. This also enables the Advanced SIMD and
18954 floating-point instructions.
18957 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
18960 Disable the cryptographic extension.
18963 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18966 Speculation Barrier Instruction.
18969 Execution and Data Prediction Restriction Instructions.
18972 8-bit Integer Matrix Multiply instructions.
18973 This also enables Advanced SIMD and floating-point instructions.
18976 Brain half-precision floating-point instructions.
18977 This also enables Advanced SIMD and floating-point instructions.
18983 The half-precision floating-point data processing instructions.
18984 This also enables the Advanced SIMD and floating-point instructions as well
18985 as the Dot Product extension and the half-precision floating-point fmla
18989 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18990 Dot Product extension.
18993 The cryptographic instructions. This also enables the Advanced SIMD and
18994 floating-point instructions as well as the Dot Product extension.
18997 Disable the cryptographic extension.
19000 Disable the floating-point, Advanced SIMD and cryptographic instructions.
19003 Speculation Barrier Instruction.
19006 Execution and Data Prediction Restriction Instructions.
19009 8-bit Integer Matrix Multiply instructions.
19010 This also enables Advanced SIMD and floating-point instructions.
19013 Brain half-precision floating-point instructions.
19014 This also enables Advanced SIMD and floating-point instructions.
19020 The half-precision floating-point data processing instructions.
19021 This also enables the Advanced SIMD and floating-point instructions as well
19022 as the Dot Product extension and the half-precision floating-point fmla
19026 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
19027 Dot Product extension.
19030 The cryptographic instructions. This also enables the Advanced SIMD and
19031 floating-point instructions as well as the Dot Product extension.
19034 Disable the cryptographic extension.
19037 Disable the floating-point, Advanced SIMD and cryptographic instructions.
19040 8-bit Integer Matrix Multiply instructions.
19041 This also enables Advanced SIMD and floating-point instructions.
19044 Brain half-precision floating-point instructions.
19045 This also enables Advanced SIMD and floating-point instructions.
19051 The half-precision floating-point data processing instructions.
19052 This also enables the Advanced SIMD and floating-point instructions as well
19053 as the Dot Product extension and the half-precision floating-point fmla
19057 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
19058 Dot Product extension.
19061 The cryptographic instructions. This also enables the Advanced SIMD and
19062 floating-point instructions as well as the Dot Product extension.
19065 Disable the cryptographic extension.
19068 Disable the floating-point, Advanced SIMD and cryptographic instructions.
19071 8-bit Integer Matrix Multiply instructions.
19072 This also enables Advanced SIMD and floating-point instructions.
19075 Brain half-precision floating-point instructions.
19076 This also enables Advanced SIMD and floating-point instructions.
19082 The single-precision VFPv3 floating-point instructions. The extension
19083 @samp{+vfpv3xd} can be used as an alias for this extension.
19086 The VFPv3 floating-point instructions with 16 double-precision registers.
19087 The extension +vfpv3-d16 can be used as an alias for this extension.
19089 @item +vfpv3xd-d16-fp16
19090 The single-precision VFPv3 floating-point instructions with 16 double-precision
19091 registers and the half-precision floating-point conversion operations.
19093 @item +vfpv3-d16-fp16
19094 The VFPv3 floating-point instructions with 16 double-precision
19095 registers and the half-precision floating-point conversion operations.
19098 Disable the floating-point extension.
19101 The ARM-state integer division instructions.
19104 Disable the ARM-state integer division extension.
19110 The single-precision VFPv4 floating-point instructions.
19113 The single-precision FPv5 floating-point instructions.
19116 The single- and double-precision FPv5 floating-point instructions.
19119 Disable the floating-point extensions.
19122 @item armv8.1-m.main
19126 The DSP instructions.
19129 The M-Profile Vector Extension (MVE) integer instructions.
19132 The M-Profile Vector Extension (MVE) integer and single precision
19133 floating-point instructions.
19136 The single-precision floating-point instructions.
19139 The single- and double-precision floating-point instructions.
19142 Disable the floating-point extension.
19144 @item +cdecp0, +cdecp1, ... , +cdecp7
19145 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
19146 to the numbers given in the options in the range 0 to 7.
19152 The DSP instructions.
19155 Disable the DSP extension.
19158 The single-precision floating-point instructions.
19161 The single- and double-precision floating-point instructions.
19164 Disable the floating-point extension.
19166 @item +cdecp0, +cdecp1, ... , +cdecp7
19167 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
19168 to the numbers given in the options in the range 0 to 7.
19174 The Cyclic Redundancy Check (CRC) instructions.
19176 The single-precision FPv5 floating-point instructions.
19178 The ARMv8-A Advanced SIMD and floating-point instructions.
19180 The cryptographic instructions.
19182 Disable the cryptographic instructions.
19184 Disable the floating-point, Advanced SIMD and cryptographic instructions.
19189 @option{-march=native} causes the compiler to auto-detect the architecture
19190 of the build computer. At present, this feature is only supported on
19191 GNU/Linux, and not all architectures are recognized. If the auto-detect
19192 is unsuccessful the option has no effect.
19194 @item -mtune=@var{name}
19196 This option specifies the name of the target ARM processor for
19197 which GCC should tune the performance of the code.
19198 For some ARM implementations better performance can be obtained by using
19200 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
19201 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
19202 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
19203 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
19204 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
19205 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
19206 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
19207 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
19208 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
19209 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
19210 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
19211 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
19212 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
19213 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
19214 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
19215 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
19216 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
19217 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
19218 @samp{cortex-m35p}, @samp{cortex-m55},
19219 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
19220 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
19221 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
19222 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
19223 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
19225 Additionally, this option can specify that GCC should tune the performance
19226 of the code for a big.LITTLE system. Permissible names are:
19227 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
19228 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
19229 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
19230 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
19232 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
19233 performance for a blend of processors within architecture @var{arch}.
19234 The aim is to generate code that run well on the current most popular
19235 processors, balancing between optimizations that benefit some CPUs in the
19236 range, and avoiding performance pitfalls of other CPUs. The effects of
19237 this option may change in future GCC versions as CPU models come and go.
19239 @option{-mtune} permits the same extension options as @option{-mcpu}, but
19240 the extension options do not affect the tuning of the generated code.
19242 @option{-mtune=native} causes the compiler to auto-detect the CPU
19243 of the build computer. At present, this feature is only supported on
19244 GNU/Linux, and not all architectures are recognized. If the auto-detect is
19245 unsuccessful the option has no effect.
19247 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
19249 This specifies the name of the target ARM processor. GCC uses this name
19250 to derive the name of the target ARM architecture (as if specified
19251 by @option{-march}) and the ARM processor type for which to tune for
19252 performance (as if specified by @option{-mtune}). Where this option
19253 is used in conjunction with @option{-march} or @option{-mtune},
19254 those options take precedence over the appropriate part of this option.
19256 Many of the supported CPUs implement optional architectural
19257 extensions. Where this is so the architectural extensions are
19258 normally enabled by default. If implementations that lack the
19259 extension exist, then the extension syntax can be used to disable
19260 those extensions that have been omitted. For floating-point and
19261 Advanced SIMD (Neon) instructions, the settings of the options
19262 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
19263 floating-point and Advanced SIMD instructions will only be used if
19264 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
19265 @option{-mfpu} other than @samp{auto} will override the available
19266 floating-point and SIMD extension instructions.
19268 For example, @samp{cortex-a9} can be found in three major
19269 configurations: integer only, with just a floating-point unit or with
19270 floating-point and Advanced SIMD. The default is to enable all the
19271 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
19272 be used to disable just the SIMD or both the SIMD and floating-point
19273 instructions respectively.
19275 Permissible names for this option are the same as those for
19278 The following extension options are common to the listed CPUs:
19282 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
19285 Disables the floating-point instructions on @samp{arm9e},
19286 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
19287 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
19288 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
19289 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
19290 Disables the floating-point and SIMD instructions on
19291 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
19292 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
19293 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
19294 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
19295 @samp{cortex-a53} and @samp{cortex-a55}.
19298 Disables the double-precision component of the floating-point instructions
19299 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
19303 Disables the SIMD (but not floating-point) instructions on
19304 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
19305 and @samp{cortex-a9}.
19308 Enables the cryptographic instructions on @samp{cortex-a32},
19309 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
19310 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
19311 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
19312 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
19313 @samp{cortex-a75.cortex-a55}.
19316 Additionally the @samp{generic-armv7-a} pseudo target defaults to
19317 VFPv3 with 16 double-precision registers. It supports the following
19318 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
19319 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
19320 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
19321 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
19322 the extensions to @option{-march=armv7-a}.
19324 @option{-mcpu=generic-@var{arch}} is also permissible, and is
19325 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
19326 See @option{-mtune} for more information.
19328 @option{-mcpu=native} causes the compiler to auto-detect the CPU
19329 of the build computer. At present, this feature is only supported on
19330 GNU/Linux, and not all architectures are recognized. If the auto-detect
19331 is unsuccessful the option has no effect.
19333 @item -mfpu=@var{name}
19335 This specifies what floating-point hardware (or hardware emulation) is
19336 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
19338 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
19339 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
19340 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
19341 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
19342 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
19343 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
19344 is an alias for @samp{vfpv2}.
19346 The setting @samp{auto} is the default and is special. It causes the
19347 compiler to select the floating-point and Advanced SIMD instructions
19348 based on the settings of @option{-mcpu} and @option{-march}.
19350 If the selected floating-point hardware includes the NEON extension
19351 (e.g.@: @option{-mfpu=neon}), note that floating-point
19352 operations are not generated by GCC's auto-vectorization pass unless
19353 @option{-funsafe-math-optimizations} is also specified. This is
19354 because NEON hardware does not fully implement the IEEE 754 standard for
19355 floating-point arithmetic (in particular denormal values are treated as
19356 zero), so the use of NEON instructions may lead to a loss of precision.
19358 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}).
19360 @item -mfp16-format=@var{name}
19361 @opindex mfp16-format
19362 Specify the format of the @code{__fp16} half-precision floating-point type.
19363 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
19364 the default is @samp{none}, in which case the @code{__fp16} type is not
19365 defined. @xref{Half-Precision}, for more information.
19367 @item -mstructure-size-boundary=@var{n}
19368 @opindex mstructure-size-boundary
19369 The sizes of all structures and unions are rounded up to a multiple
19370 of the number of bits set by this option. Permissible values are 8, 32
19371 and 64. The default value varies for different toolchains. For the COFF
19372 targeted toolchain the default value is 8. A value of 64 is only allowed
19373 if the underlying ABI supports it.
19375 Specifying a larger number can produce faster, more efficient code, but
19376 can also increase the size of the program. Different values are potentially
19377 incompatible. Code compiled with one value cannot necessarily expect to
19378 work with code or libraries compiled with another value, if they exchange
19379 information using structures or unions.
19381 This option is deprecated.
19383 @item -mabort-on-noreturn
19384 @opindex mabort-on-noreturn
19385 Generate a call to the function @code{abort} at the end of a
19386 @code{noreturn} function. It is executed if the function tries to
19390 @itemx -mno-long-calls
19391 @opindex mlong-calls
19392 @opindex mno-long-calls
19393 Tells the compiler to perform function calls by first loading the
19394 address of the function into a register and then performing a subroutine
19395 call on this register. This switch is needed if the target function
19396 lies outside of the 64-megabyte addressing range of the offset-based
19397 version of subroutine call instruction.
19399 Even if this switch is enabled, not all function calls are turned
19400 into long calls. The heuristic is that static functions, functions
19401 that have the @code{short_call} attribute, functions that are inside
19402 the scope of a @code{#pragma no_long_calls} directive, and functions whose
19403 definitions have already been compiled within the current compilation
19404 unit are not turned into long calls. The exceptions to this rule are
19405 that weak function definitions, functions with the @code{long_call}
19406 attribute or the @code{section} attribute, and functions that are within
19407 the scope of a @code{#pragma long_calls} directive are always
19408 turned into long calls.
19410 This feature is not enabled by default. Specifying
19411 @option{-mno-long-calls} restores the default behavior, as does
19412 placing the function calls within the scope of a @code{#pragma
19413 long_calls_off} directive. Note these switches have no effect on how
19414 the compiler generates code to handle function calls via function
19417 @item -msingle-pic-base
19418 @opindex msingle-pic-base
19419 Treat the register used for PIC addressing as read-only, rather than
19420 loading it in the prologue for each function. The runtime system is
19421 responsible for initializing this register with an appropriate value
19422 before execution begins.
19424 @item -mpic-register=@var{reg}
19425 @opindex mpic-register
19426 Specify the register to be used for PIC addressing.
19427 For standard PIC base case, the default is any suitable register
19428 determined by compiler. For single PIC base case, the default is
19429 @samp{R9} if target is EABI based or stack-checking is enabled,
19430 otherwise the default is @samp{R10}.
19432 @item -mpic-data-is-text-relative
19433 @opindex mpic-data-is-text-relative
19434 Assume that the displacement between the text and data segments is fixed
19435 at static link time. This permits using PC-relative addressing
19436 operations to access data known to be in the data segment. For
19437 non-VxWorks RTP targets, this option is enabled by default. When
19438 disabled on such targets, it will enable @option{-msingle-pic-base} by
19441 @item -mpoke-function-name
19442 @opindex mpoke-function-name
19443 Write the name of each function into the text section, directly
19444 preceding the function prologue. The generated code is similar to this:
19448 .ascii "arm_poke_function_name", 0
19451 .word 0xff000000 + (t1 - t0)
19452 arm_poke_function_name
19454 stmfd sp!, @{fp, ip, lr, pc@}
19458 When performing a stack backtrace, code can inspect the value of
19459 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
19460 location @code{pc - 12} and the top 8 bits are set, then we know that
19461 there is a function name embedded immediately preceding this location
19462 and has length @code{((pc[-3]) & 0xff000000)}.
19469 Select between generating code that executes in ARM and Thumb
19470 states. The default for most configurations is to generate code
19471 that executes in ARM state, but the default can be changed by
19472 configuring GCC with the @option{--with-mode=}@var{state}
19475 You can also override the ARM and Thumb mode for each function
19476 by using the @code{target("thumb")} and @code{target("arm")} function attributes
19477 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
19480 @opindex mflip-thumb
19481 Switch ARM/Thumb modes on alternating functions.
19482 This option is provided for regression testing of mixed Thumb/ARM code
19483 generation, and is not intended for ordinary use in compiling code.
19486 @opindex mtpcs-frame
19487 Generate a stack frame that is compliant with the Thumb Procedure Call
19488 Standard for all non-leaf functions. (A leaf function is one that does
19489 not call any other functions.) The default is @option{-mno-tpcs-frame}.
19491 @item -mtpcs-leaf-frame
19492 @opindex mtpcs-leaf-frame
19493 Generate a stack frame that is compliant with the Thumb Procedure Call
19494 Standard for all leaf functions. (A leaf function is one that does
19495 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
19497 @item -mcallee-super-interworking
19498 @opindex mcallee-super-interworking
19499 Gives all externally visible functions in the file being compiled an ARM
19500 instruction set header which switches to Thumb mode before executing the
19501 rest of the function. This allows these functions to be called from
19502 non-interworking code. This option is not valid in AAPCS configurations
19503 because interworking is enabled by default.
19505 @item -mcaller-super-interworking
19506 @opindex mcaller-super-interworking
19507 Allows calls via function pointers (including virtual functions) to
19508 execute correctly regardless of whether the target code has been
19509 compiled for interworking or not. There is a small overhead in the cost
19510 of executing a function pointer if this option is enabled. This option
19511 is not valid in AAPCS configurations because interworking is enabled
19514 @item -mtp=@var{name}
19516 Specify the access model for the thread local storage pointer. The valid
19517 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
19518 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
19519 (supported in the arm6k architecture), and @samp{auto}, which uses the
19520 best available method for the selected processor. The default setting is
19523 @item -mtls-dialect=@var{dialect}
19524 @opindex mtls-dialect
19525 Specify the dialect to use for accessing thread local storage. Two
19526 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
19527 @samp{gnu} dialect selects the original GNU scheme for supporting
19528 local and global dynamic TLS models. The @samp{gnu2} dialect
19529 selects the GNU descriptor scheme, which provides better performance
19530 for shared libraries. The GNU descriptor scheme is compatible with
19531 the original scheme, but does require new assembler, linker and
19532 library support. Initial and local exec TLS models are unaffected by
19533 this option and always use the original scheme.
19535 @item -mword-relocations
19536 @opindex mword-relocations
19537 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
19538 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
19539 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
19540 is specified. This option conflicts with @option{-mslow-flash-data}.
19542 @item -mfix-cortex-m3-ldrd
19543 @opindex mfix-cortex-m3-ldrd
19544 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
19545 with overlapping destination and base registers are used. This option avoids
19546 generating these instructions. This option is enabled by default when
19547 @option{-mcpu=cortex-m3} is specified.
19549 @item -munaligned-access
19550 @itemx -mno-unaligned-access
19551 @opindex munaligned-access
19552 @opindex mno-unaligned-access
19553 Enables (or disables) reading and writing of 16- and 32- bit values
19554 from addresses that are not 16- or 32- bit aligned. By default
19555 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19556 ARMv8-M Baseline architectures, and enabled for all other
19557 architectures. If unaligned access is not enabled then words in packed
19558 data structures are accessed a byte at a time.
19560 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
19561 generated object file to either true or false, depending upon the
19562 setting of this option. If unaligned access is enabled then the
19563 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
19566 @item -mneon-for-64bits
19567 @opindex mneon-for-64bits
19568 This option is deprecated and has no effect.
19570 @item -mslow-flash-data
19571 @opindex mslow-flash-data
19572 Assume loading data from flash is slower than fetching instruction.
19573 Therefore literal load is minimized for better performance.
19574 This option is only supported when compiling for ARMv7 M-profile and
19575 off by default. It conflicts with @option{-mword-relocations}.
19577 @item -masm-syntax-unified
19578 @opindex masm-syntax-unified
19579 Assume inline assembler is using unified asm syntax. The default is
19580 currently off which implies divided syntax. This option has no impact
19581 on Thumb2. However, this may change in future releases of GCC.
19582 Divided syntax should be considered deprecated.
19584 @item -mrestrict-it
19585 @opindex mrestrict-it
19586 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
19587 IT blocks can only contain a single 16-bit instruction from a select
19588 set of instructions. This option is on by default for ARMv8-A Thumb mode.
19590 @item -mprint-tune-info
19591 @opindex mprint-tune-info
19592 Print CPU tuning information as comment in assembler file. This is
19593 an option used only for regression testing of the compiler and not
19594 intended for ordinary use in compiling code. This option is disabled
19597 @item -mverbose-cost-dump
19598 @opindex mverbose-cost-dump
19599 Enable verbose cost model dumping in the debug dump files. This option is
19600 provided for use in debugging the compiler.
19603 @opindex mpure-code
19604 Do not allow constant data to be placed in code sections.
19605 Additionally, when compiling for ELF object format give all text sections the
19606 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
19607 is only available when generating non-pic code for M-profile targets.
19611 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
19612 Development Tools Engineering Specification", which can be found on
19613 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
19619 Select the FDPIC ABI, which uses 64-bit function descriptors to
19620 represent pointers to functions. When the compiler is configured for
19621 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
19622 and implies @option{-fPIE} if none of the PIC/PIE-related options is
19623 provided. On other targets, it only enables the FDPIC-specific code
19624 generation features, and the user should explicitly provide the
19625 PIC/PIE-related options as needed.
19627 Note that static linking is not supported because it would still
19628 involve the dynamic linker when the program self-relocates. If such
19629 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
19631 The opposite @option{-mno-fdpic} option is useful (and required) to
19632 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
19633 toolchain as the one used to build the userland programs.
19638 @subsection AVR Options
19639 @cindex AVR Options
19641 These options are defined for AVR implementations:
19644 @item -mmcu=@var{mcu}
19646 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19648 The default for this option is@tie{}@samp{avr2}.
19650 GCC supports the following AVR devices and ISAs:
19652 @include avr-mmcu.texi
19657 Assume that all data in static storage can be accessed by LDS / STS
19658 instructions. This option has only an effect on reduced Tiny devices like
19659 ATtiny40. See also the @code{absdata}
19660 @ref{AVR Variable Attributes,variable attribute}.
19662 @item -maccumulate-args
19663 @opindex maccumulate-args
19664 Accumulate outgoing function arguments and acquire/release the needed
19665 stack space for outgoing function arguments once in function
19666 prologue/epilogue. Without this option, outgoing arguments are pushed
19667 before calling a function and popped afterwards.
19669 Popping the arguments after the function call can be expensive on
19670 AVR so that accumulating the stack space might lead to smaller
19671 executables because arguments need not be removed from the
19672 stack after such a function call.
19674 This option can lead to reduced code size for functions that perform
19675 several calls to functions that get their arguments on the stack like
19676 calls to printf-like functions.
19678 @item -mbranch-cost=@var{cost}
19679 @opindex mbranch-cost
19680 Set the branch costs for conditional branch instructions to
19681 @var{cost}. Reasonable values for @var{cost} are small, non-negative
19682 integers. The default branch cost is 0.
19684 @item -mcall-prologues
19685 @opindex mcall-prologues
19686 Functions prologues/epilogues are expanded as calls to appropriate
19687 subroutines. Code size is smaller.
19689 @item -mdouble=@var{bits}
19690 @itemx -mlong-double=@var{bits}
19692 @opindex mlong-double
19693 Set the size (in bits) of the @code{double} or @code{long double} type,
19694 respectively. Possible values for @var{bits} are 32 and 64.
19695 Whether or not a specific value for @var{bits} is allowed depends on
19696 the @code{--with-double=} and @code{--with-long-double=}
19697 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
19698 and the same applies for the default values of the options.
19700 @item -mgas-isr-prologues
19701 @opindex mgas-isr-prologues
19702 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
19703 instruction supported by GNU Binutils.
19704 If this option is on, the feature can still be disabled for individual
19705 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
19706 function attribute. This feature is activated per default
19707 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
19708 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
19712 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
19713 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
19714 and @code{long long} is 4 bytes. Please note that this option does not
19715 conform to the C standards, but it results in smaller code
19718 @item -mmain-is-OS_task
19719 @opindex mmain-is-OS_task
19720 Do not save registers in @code{main}. The effect is the same like
19721 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
19722 to @code{main}. It is activated per default if optimization is on.
19724 @item -mn-flash=@var{num}
19726 Assume that the flash memory has a size of
19727 @var{num} times 64@tie{}KiB.
19729 @item -mno-interrupts
19730 @opindex mno-interrupts
19731 Generated code is not compatible with hardware interrupts.
19732 Code size is smaller.
19736 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
19737 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
19738 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
19739 the assembler's command line and the @option{--relax} option to the
19740 linker's command line.
19742 Jump relaxing is performed by the linker because jump offsets are not
19743 known before code is located. Therefore, the assembler code generated by the
19744 compiler is the same, but the instructions in the executable may
19745 differ from instructions in the assembler code.
19747 Relaxing must be turned on if linker stubs are needed, see the
19748 section on @code{EIND} and linker stubs below.
19752 Assume that the device supports the Read-Modify-Write
19753 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
19755 @item -mshort-calls
19756 @opindex mshort-calls
19758 Assume that @code{RJMP} and @code{RCALL} can target the whole
19761 This option is used internally for multilib selection. It is
19762 not an optimization option, and you don't need to set it by hand.
19766 Treat the stack pointer register as an 8-bit register,
19767 i.e.@: assume the high byte of the stack pointer is zero.
19768 In general, you don't need to set this option by hand.
19770 This option is used internally by the compiler to select and
19771 build multilibs for architectures @code{avr2} and @code{avr25}.
19772 These architectures mix devices with and without @code{SPH}.
19773 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
19774 the compiler driver adds or removes this option from the compiler
19775 proper's command line, because the compiler then knows if the device
19776 or architecture has an 8-bit stack pointer and thus no @code{SPH}
19781 Use address register @code{X} in a way proposed by the hardware. This means
19782 that @code{X} is only used in indirect, post-increment or
19783 pre-decrement addressing.
19785 Without this option, the @code{X} register may be used in the same way
19786 as @code{Y} or @code{Z} which then is emulated by additional
19788 For example, loading a value with @code{X+const} addressing with a
19789 small non-negative @code{const < 64} to a register @var{Rn} is
19793 adiw r26, const ; X += const
19794 ld @var{Rn}, X ; @var{Rn} = *X
19795 sbiw r26, const ; X -= const
19799 @opindex mtiny-stack
19800 Only change the lower 8@tie{}bits of the stack pointer.
19802 @item -mfract-convert-truncate
19803 @opindex mfract-convert-truncate
19804 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
19807 @opindex nodevicelib
19808 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
19810 @item -nodevicespecs
19811 @opindex nodevicespecs
19812 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
19813 command line. The user takes responsibility for supplying the sub-processes
19814 like compiler proper, assembler and linker with appropriate command line
19815 options. This means that the user has to supply her private device specs
19816 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
19817 more need for option @option{-mmcu=@var{mcu}}.
19819 This option can also serve as a replacement for the older way of
19820 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
19821 which contains a folder named @code{device-specs} which contains a specs file named
19822 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
19824 @item -Waddr-space-convert
19825 @opindex Waddr-space-convert
19826 @opindex Wno-addr-space-convert
19827 Warn about conversions between address spaces in the case where the
19828 resulting address space is not contained in the incoming address space.
19830 @item -Wmisspelled-isr
19831 @opindex Wmisspelled-isr
19832 @opindex Wno-misspelled-isr
19833 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
19834 Enabled by default.
19837 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
19838 @cindex @code{EIND}
19839 Pointers in the implementation are 16@tie{}bits wide.
19840 The address of a function or label is represented as word address so
19841 that indirect jumps and calls can target any code address in the
19842 range of 64@tie{}Ki words.
19844 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
19845 bytes of program memory space, there is a special function register called
19846 @code{EIND} that serves as most significant part of the target address
19847 when @code{EICALL} or @code{EIJMP} instructions are used.
19849 Indirect jumps and calls on these devices are handled as follows by
19850 the compiler and are subject to some limitations:
19855 The compiler never sets @code{EIND}.
19858 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
19859 instructions or might read @code{EIND} directly in order to emulate an
19860 indirect call/jump by means of a @code{RET} instruction.
19863 The compiler assumes that @code{EIND} never changes during the startup
19864 code or during the application. In particular, @code{EIND} is not
19865 saved/restored in function or interrupt service routine
19869 For indirect calls to functions and computed goto, the linker
19870 generates @emph{stubs}. Stubs are jump pads sometimes also called
19871 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
19872 The stub contains a direct jump to the desired address.
19875 Linker relaxation must be turned on so that the linker generates
19876 the stubs correctly in all situations. See the compiler option
19877 @option{-mrelax} and the linker option @option{--relax}.
19878 There are corner cases where the linker is supposed to generate stubs
19879 but aborts without relaxation and without a helpful error message.
19882 The default linker script is arranged for code with @code{EIND = 0}.
19883 If code is supposed to work for a setup with @code{EIND != 0}, a custom
19884 linker script has to be used in order to place the sections whose
19885 name start with @code{.trampolines} into the segment where @code{EIND}
19889 The startup code from libgcc never sets @code{EIND}.
19890 Notice that startup code is a blend of code from libgcc and AVR-LibC.
19891 For the impact of AVR-LibC on @code{EIND}, see the
19892 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
19895 It is legitimate for user-specific startup code to set up @code{EIND}
19896 early, for example by means of initialization code located in
19897 section @code{.init3}. Such code runs prior to general startup code
19898 that initializes RAM and calls constructors, but after the bit
19899 of startup code from AVR-LibC that sets @code{EIND} to the segment
19900 where the vector table is located.
19902 #include <avr/io.h>
19905 __attribute__((section(".init3"),naked,used,no_instrument_function))
19906 init3_set_eind (void)
19908 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19909 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19914 The @code{__trampolines_start} symbol is defined in the linker script.
19917 Stubs are generated automatically by the linker if
19918 the following two conditions are met:
19921 @item The address of a label is taken by means of the @code{gs} modifier
19922 (short for @emph{generate stubs}) like so:
19924 LDI r24, lo8(gs(@var{func}))
19925 LDI r25, hi8(gs(@var{func}))
19927 @item The final location of that label is in a code segment
19928 @emph{outside} the segment where the stubs are located.
19932 The compiler emits such @code{gs} modifiers for code labels in the
19933 following situations:
19935 @item Taking address of a function or code label.
19936 @item Computed goto.
19937 @item If prologue-save function is used, see @option{-mcall-prologues}
19938 command-line option.
19939 @item Switch/case dispatch tables. If you do not want such dispatch
19940 tables you can specify the @option{-fno-jump-tables} command-line option.
19941 @item C and C++ constructors/destructors called during startup/shutdown.
19942 @item If the tools hit a @code{gs()} modifier explained above.
19946 Jumping to non-symbolic addresses like so is @emph{not} supported:
19951 /* Call function at word address 0x2 */
19952 return ((int(*)(void)) 0x2)();
19956 Instead, a stub has to be set up, i.e.@: the function has to be called
19957 through a symbol (@code{func_4} in the example):
19962 extern int func_4 (void);
19964 /* Call function at byte address 0x4 */
19969 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
19970 Alternatively, @code{func_4} can be defined in the linker script.
19973 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
19974 @cindex @code{RAMPD}
19975 @cindex @code{RAMPX}
19976 @cindex @code{RAMPY}
19977 @cindex @code{RAMPZ}
19978 Some AVR devices support memories larger than the 64@tie{}KiB range
19979 that can be accessed with 16-bit pointers. To access memory locations
19980 outside this 64@tie{}KiB range, the content of a @code{RAMP}
19981 register is used as high part of the address:
19982 The @code{X}, @code{Y}, @code{Z} address register is concatenated
19983 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
19984 register, respectively, to get a wide address. Similarly,
19985 @code{RAMPD} is used together with direct addressing.
19989 The startup code initializes the @code{RAMP} special function
19990 registers with zero.
19993 If a @ref{AVR Named Address Spaces,named address space} other than
19994 generic or @code{__flash} is used, then @code{RAMPZ} is set
19995 as needed before the operation.
19998 If the device supports RAM larger than 64@tie{}KiB and the compiler
19999 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
20000 is reset to zero after the operation.
20003 If the device comes with a specific @code{RAMP} register, the ISR
20004 prologue/epilogue saves/restores that SFR and initializes it with
20005 zero in case the ISR code might (implicitly) use it.
20008 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
20009 If you use inline assembler to read from locations outside the
20010 16-bit address range and change one of the @code{RAMP} registers,
20011 you must reset it to zero after the access.
20015 @subsubsection AVR Built-in Macros
20017 GCC defines several built-in macros so that the user code can test
20018 for the presence or absence of features. Almost any of the following
20019 built-in macros are deduced from device capabilities and thus
20020 triggered by the @option{-mmcu=} command-line option.
20022 For even more AVR-specific built-in macros see
20023 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
20028 Build-in macro that resolves to a decimal number that identifies the
20029 architecture and depends on the @option{-mmcu=@var{mcu}} option.
20030 Possible values are:
20032 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
20033 @code{4}, @code{5}, @code{51}, @code{6}
20035 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
20036 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
20041 @code{102}, @code{103}, @code{104},
20042 @code{105}, @code{106}, @code{107}
20044 for @var{mcu}=@code{avrtiny},
20045 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
20046 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
20047 If @var{mcu} specifies a device, this built-in macro is set
20048 accordingly. For example, with @option{-mmcu=atmega8} the macro is
20049 defined to @code{4}.
20051 @item __AVR_@var{Device}__
20052 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
20053 the device's name. For example, @option{-mmcu=atmega8} defines the
20054 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
20055 @code{__AVR_ATtiny261A__}, etc.
20057 The built-in macros' names follow
20058 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
20059 the device name as from the AVR user manual. The difference between
20060 @var{Device} in the built-in macro and @var{device} in
20061 @option{-mmcu=@var{device}} is that the latter is always lowercase.
20063 If @var{device} is not a device but only a core architecture like
20064 @samp{avr51}, this macro is not defined.
20066 @item __AVR_DEVICE_NAME__
20067 Setting @option{-mmcu=@var{device}} defines this built-in macro to
20068 the device's name. For example, with @option{-mmcu=atmega8} the macro
20069 is defined to @code{atmega8}.
20071 If @var{device} is not a device but only a core architecture like
20072 @samp{avr51}, this macro is not defined.
20074 @item __AVR_XMEGA__
20075 The device / architecture belongs to the XMEGA family of devices.
20077 @item __AVR_HAVE_ELPM__
20078 The device has the @code{ELPM} instruction.
20080 @item __AVR_HAVE_ELPMX__
20081 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
20082 R@var{n},Z+} instructions.
20084 @item __AVR_HAVE_MOVW__
20085 The device has the @code{MOVW} instruction to perform 16-bit
20086 register-register moves.
20088 @item __AVR_HAVE_LPMX__
20089 The device has the @code{LPM R@var{n},Z} and
20090 @code{LPM R@var{n},Z+} instructions.
20092 @item __AVR_HAVE_MUL__
20093 The device has a hardware multiplier.
20095 @item __AVR_HAVE_JMP_CALL__
20096 The device has the @code{JMP} and @code{CALL} instructions.
20097 This is the case for devices with more than 8@tie{}KiB of program
20100 @item __AVR_HAVE_EIJMP_EICALL__
20101 @itemx __AVR_3_BYTE_PC__
20102 The device has the @code{EIJMP} and @code{EICALL} instructions.
20103 This is the case for devices with more than 128@tie{}KiB of program memory.
20104 This also means that the program counter
20105 (PC) is 3@tie{}bytes wide.
20107 @item __AVR_2_BYTE_PC__
20108 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
20109 with up to 128@tie{}KiB of program memory.
20111 @item __AVR_HAVE_8BIT_SP__
20112 @itemx __AVR_HAVE_16BIT_SP__
20113 The stack pointer (SP) register is treated as 8-bit respectively
20114 16-bit register by the compiler.
20115 The definition of these macros is affected by @option{-mtiny-stack}.
20117 @item __AVR_HAVE_SPH__
20119 The device has the SPH (high part of stack pointer) special function
20120 register or has an 8-bit stack pointer, respectively.
20121 The definition of these macros is affected by @option{-mmcu=} and
20122 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
20125 @item __AVR_HAVE_RAMPD__
20126 @itemx __AVR_HAVE_RAMPX__
20127 @itemx __AVR_HAVE_RAMPY__
20128 @itemx __AVR_HAVE_RAMPZ__
20129 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
20130 @code{RAMPZ} special function register, respectively.
20132 @item __NO_INTERRUPTS__
20133 This macro reflects the @option{-mno-interrupts} command-line option.
20135 @item __AVR_ERRATA_SKIP__
20136 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
20137 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
20138 instructions because of a hardware erratum. Skip instructions are
20139 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
20140 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
20143 @item __AVR_ISA_RMW__
20144 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
20146 @item __AVR_SFR_OFFSET__=@var{offset}
20147 Instructions that can address I/O special function registers directly
20148 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
20149 address as if addressed by an instruction to access RAM like @code{LD}
20150 or @code{STS}. This offset depends on the device architecture and has
20151 to be subtracted from the RAM address in order to get the
20152 respective I/O@tie{}address.
20154 @item __AVR_SHORT_CALLS__
20155 The @option{-mshort-calls} command line option is set.
20157 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
20158 Some devices support reading from flash memory by means of @code{LD*}
20159 instructions. The flash memory is seen in the data address space
20160 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
20161 is not defined, this feature is not available. If defined,
20162 the address space is linear and there is no need to put
20163 @code{.rodata} into RAM. This is handled by the default linker
20164 description file, and is currently available for
20165 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
20166 there is no need to use address spaces like @code{__flash} or
20167 features like attribute @code{progmem} and @code{pgm_read_*}.
20169 @item __WITH_AVRLIBC__
20170 The compiler is configured to be used together with AVR-Libc.
20171 See the @option{--with-avrlibc} configure option.
20173 @item __HAVE_DOUBLE_MULTILIB__
20174 Defined if @option{-mdouble=} acts as a multilib option.
20176 @item __HAVE_DOUBLE32__
20177 @itemx __HAVE_DOUBLE64__
20178 Defined if the compiler supports 32-bit double resp. 64-bit double.
20179 The actual layout is specified by option @option{-mdouble=}.
20181 @item __DEFAULT_DOUBLE__
20182 The size in bits of @code{double} if @option{-mdouble=} is not set.
20183 To test the layout of @code{double} in a program, use the built-in
20184 macro @code{__SIZEOF_DOUBLE__}.
20186 @item __HAVE_LONG_DOUBLE32__
20187 @itemx __HAVE_LONG_DOUBLE64__
20188 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
20189 @itemx __DEFAULT_LONG_DOUBLE__
20190 Same as above, but for @code{long double} instead of @code{double}.
20192 @item __WITH_DOUBLE_COMPARISON__
20193 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
20194 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
20195 and is defined to @code{2} or @code{3}.
20197 @item __WITH_LIBF7_LIBGCC__
20198 @itemx __WITH_LIBF7_MATH__
20199 @itemx __WITH_LIBF7_MATH_SYMBOLS__
20200 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
20201 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
20205 @node Blackfin Options
20206 @subsection Blackfin Options
20207 @cindex Blackfin Options
20210 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
20212 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
20213 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
20214 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
20215 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
20216 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
20217 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
20218 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
20219 @samp{bf561}, @samp{bf592}.
20221 The optional @var{sirevision} specifies the silicon revision of the target
20222 Blackfin processor. Any workarounds available for the targeted silicon revision
20223 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
20224 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
20225 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
20226 hexadecimal digits representing the major and minor numbers in the silicon
20227 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
20228 is not defined. If @var{sirevision} is @samp{any}, the
20229 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
20230 If this optional @var{sirevision} is not used, GCC assumes the latest known
20231 silicon revision of the targeted Blackfin processor.
20233 GCC defines a preprocessor macro for the specified @var{cpu}.
20234 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
20235 provided by libgloss to be linked in if @option{-msim} is not given.
20237 Without this option, @samp{bf532} is used as the processor by default.
20239 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
20240 only the preprocessor macro is defined.
20244 Specifies that the program will be run on the simulator. This causes
20245 the simulator BSP provided by libgloss to be linked in. This option
20246 has effect only for @samp{bfin-elf} toolchain.
20247 Certain other options, such as @option{-mid-shared-library} and
20248 @option{-mfdpic}, imply @option{-msim}.
20250 @item -momit-leaf-frame-pointer
20251 @opindex momit-leaf-frame-pointer
20252 Don't keep the frame pointer in a register for leaf functions. This
20253 avoids the instructions to save, set up and restore frame pointers and
20254 makes an extra register available in leaf functions.
20256 @item -mspecld-anomaly
20257 @opindex mspecld-anomaly
20258 When enabled, the compiler ensures that the generated code does not
20259 contain speculative loads after jump instructions. If this option is used,
20260 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
20262 @item -mno-specld-anomaly
20263 @opindex mno-specld-anomaly
20264 @opindex mspecld-anomaly
20265 Don't generate extra code to prevent speculative loads from occurring.
20267 @item -mcsync-anomaly
20268 @opindex mcsync-anomaly
20269 When enabled, the compiler ensures that the generated code does not
20270 contain CSYNC or SSYNC instructions too soon after conditional branches.
20271 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
20273 @item -mno-csync-anomaly
20274 @opindex mno-csync-anomaly
20275 @opindex mcsync-anomaly
20276 Don't generate extra code to prevent CSYNC or SSYNC instructions from
20277 occurring too soon after a conditional branch.
20281 When enabled, the compiler is free to take advantage of the knowledge that
20282 the entire program fits into the low 64k of memory.
20285 @opindex mno-low64k
20286 Assume that the program is arbitrarily large. This is the default.
20288 @item -mstack-check-l1
20289 @opindex mstack-check-l1
20290 Do stack checking using information placed into L1 scratchpad memory by the
20293 @item -mid-shared-library
20294 @opindex mid-shared-library
20295 Generate code that supports shared libraries via the library ID method.
20296 This allows for execute in place and shared libraries in an environment
20297 without virtual memory management. This option implies @option{-fPIC}.
20298 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20300 @item -mno-id-shared-library
20301 @opindex mno-id-shared-library
20302 @opindex mid-shared-library
20303 Generate code that doesn't assume ID-based shared libraries are being used.
20304 This is the default.
20306 @item -mleaf-id-shared-library
20307 @opindex mleaf-id-shared-library
20308 Generate code that supports shared libraries via the library ID method,
20309 but assumes that this library or executable won't link against any other
20310 ID shared libraries. That allows the compiler to use faster code for jumps
20313 @item -mno-leaf-id-shared-library
20314 @opindex mno-leaf-id-shared-library
20315 @opindex mleaf-id-shared-library
20316 Do not assume that the code being compiled won't link against any ID shared
20317 libraries. Slower code is generated for jump and call insns.
20319 @item -mshared-library-id=n
20320 @opindex mshared-library-id
20321 Specifies the identification number of the ID-based shared library being
20322 compiled. Specifying a value of 0 generates more compact code; specifying
20323 other values forces the allocation of that number to the current
20324 library but is no more space- or time-efficient than omitting this option.
20328 Generate code that allows the data segment to be located in a different
20329 area of memory from the text segment. This allows for execute in place in
20330 an environment without virtual memory management by eliminating relocations
20331 against the text section.
20333 @item -mno-sep-data
20334 @opindex mno-sep-data
20336 Generate code that assumes that the data segment follows the text segment.
20337 This is the default.
20340 @itemx -mno-long-calls
20341 @opindex mlong-calls
20342 @opindex mno-long-calls
20343 Tells the compiler to perform function calls by first loading the
20344 address of the function into a register and then performing a subroutine
20345 call on this register. This switch is needed if the target function
20346 lies outside of the 24-bit addressing range of the offset-based
20347 version of subroutine call instruction.
20349 This feature is not enabled by default. Specifying
20350 @option{-mno-long-calls} restores the default behavior. Note these
20351 switches have no effect on how the compiler generates code to handle
20352 function calls via function pointers.
20356 Link with the fast floating-point library. This library relaxes some of
20357 the IEEE floating-point standard's rules for checking inputs against
20358 Not-a-Number (NAN), in the interest of performance.
20361 @opindex minline-plt
20362 Enable inlining of PLT entries in function calls to functions that are
20363 not known to bind locally. It has no effect without @option{-mfdpic}.
20366 @opindex mmulticore
20367 Build a standalone application for multicore Blackfin processors.
20368 This option causes proper start files and link scripts supporting
20369 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
20370 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
20372 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
20373 selects the one-application-per-core programming model. Without
20374 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
20375 programming model is used. In this model, the main function of Core B
20376 should be named as @code{coreb_main}.
20378 If this option is not used, the single-core application programming
20383 Build a standalone application for Core A of BF561 when using
20384 the one-application-per-core programming model. Proper start files
20385 and link scripts are used to support Core A, and the macro
20386 @code{__BFIN_COREA} is defined.
20387 This option can only be used in conjunction with @option{-mmulticore}.
20391 Build a standalone application for Core B of BF561 when using
20392 the one-application-per-core programming model. Proper start files
20393 and link scripts are used to support Core B, and the macro
20394 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
20395 should be used instead of @code{main}.
20396 This option can only be used in conjunction with @option{-mmulticore}.
20400 Build a standalone application for SDRAM. Proper start files and
20401 link scripts are used to put the application into SDRAM, and the macro
20402 @code{__BFIN_SDRAM} is defined.
20403 The loader should initialize SDRAM before loading the application.
20407 Assume that ICPLBs are enabled at run time. This has an effect on certain
20408 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
20409 are enabled; for standalone applications the default is off.
20413 @subsection C6X Options
20414 @cindex C6X Options
20417 @item -march=@var{name}
20419 This specifies the name of the target architecture. GCC uses this
20420 name to determine what kind of instructions it can emit when generating
20421 assembly code. Permissible names are: @samp{c62x},
20422 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
20425 @opindex mbig-endian
20426 Generate code for a big-endian target.
20428 @item -mlittle-endian
20429 @opindex mlittle-endian
20430 Generate code for a little-endian target. This is the default.
20434 Choose startup files and linker script suitable for the simulator.
20436 @item -msdata=default
20437 @opindex msdata=default
20438 Put small global and static data in the @code{.neardata} section,
20439 which is pointed to by register @code{B14}. Put small uninitialized
20440 global and static data in the @code{.bss} section, which is adjacent
20441 to the @code{.neardata} section. Put small read-only data into the
20442 @code{.rodata} section. The corresponding sections used for large
20443 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
20446 @opindex msdata=all
20447 Put all data, not just small objects, into the sections reserved for
20448 small data, and use addressing relative to the @code{B14} register to
20452 @opindex msdata=none
20453 Make no use of the sections reserved for small data, and use absolute
20454 addresses to access all data. Put all initialized global and static
20455 data in the @code{.fardata} section, and all uninitialized data in the
20456 @code{.far} section. Put all constant data into the @code{.const}
20461 @subsection CRIS Options
20462 @cindex CRIS Options
20464 These options are defined specifically for the CRIS ports.
20467 @item -march=@var{architecture-type}
20468 @itemx -mcpu=@var{architecture-type}
20471 Generate code for the specified architecture. The choices for
20472 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
20473 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
20474 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
20477 @item -mtune=@var{architecture-type}
20479 Tune to @var{architecture-type} everything applicable about the generated
20480 code, except for the ABI and the set of available instructions. The
20481 choices for @var{architecture-type} are the same as for
20482 @option{-march=@var{architecture-type}}.
20484 @item -mmax-stack-frame=@var{n}
20485 @opindex mmax-stack-frame
20486 Warn when the stack frame of a function exceeds @var{n} bytes.
20492 The options @option{-metrax4} and @option{-metrax100} are synonyms for
20493 @option{-march=v3} and @option{-march=v8} respectively.
20495 @item -mmul-bug-workaround
20496 @itemx -mno-mul-bug-workaround
20497 @opindex mmul-bug-workaround
20498 @opindex mno-mul-bug-workaround
20499 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
20500 models where it applies. This option is active by default.
20504 Enable CRIS-specific verbose debug-related information in the assembly
20505 code. This option also has the effect of turning off the @samp{#NO_APP}
20506 formatted-code indicator to the assembler at the beginning of the
20511 Do not use condition-code results from previous instruction; always emit
20512 compare and test instructions before use of condition codes.
20514 @item -mno-side-effects
20515 @opindex mno-side-effects
20516 @opindex mside-effects
20517 Do not emit instructions with side effects in addressing modes other than
20520 @item -mstack-align
20521 @itemx -mno-stack-align
20522 @itemx -mdata-align
20523 @itemx -mno-data-align
20524 @itemx -mconst-align
20525 @itemx -mno-const-align
20526 @opindex mstack-align
20527 @opindex mno-stack-align
20528 @opindex mdata-align
20529 @opindex mno-data-align
20530 @opindex mconst-align
20531 @opindex mno-const-align
20532 These options (@samp{no-} options) arrange (eliminate arrangements) for the
20533 stack frame, individual data and constants to be aligned for the maximum
20534 single data access size for the chosen CPU model. The default is to
20535 arrange for 32-bit alignment. ABI details such as structure layout are
20536 not affected by these options.
20544 Similar to the stack- data- and const-align options above, these options
20545 arrange for stack frame, writable data and constants to all be 32-bit,
20546 16-bit or 8-bit aligned. The default is 32-bit alignment.
20548 @item -mno-prologue-epilogue
20549 @itemx -mprologue-epilogue
20550 @opindex mno-prologue-epilogue
20551 @opindex mprologue-epilogue
20552 With @option{-mno-prologue-epilogue}, the normal function prologue and
20553 epilogue which set up the stack frame are omitted and no return
20554 instructions or return sequences are generated in the code. Use this
20555 option only together with visual inspection of the compiled code: no
20556 warnings or errors are generated when call-saved registers must be saved,
20557 or storage for local variables needs to be allocated.
20561 @opindex mno-gotplt
20563 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
20564 instruction sequences that load addresses for functions from the PLT part
20565 of the GOT rather than (traditional on other architectures) calls to the
20566 PLT@. The default is @option{-mgotplt}.
20570 Legacy no-op option only recognized with the cris-axis-elf and
20571 cris-axis-linux-gnu targets.
20575 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
20579 This option, recognized for the cris-axis-elf, arranges
20580 to link with input-output functions from a simulator library. Code,
20581 initialized data and zero-initialized data are allocated consecutively.
20585 Like @option{-sim}, but pass linker options to locate initialized data at
20586 0x40000000 and zero-initialized data at 0x80000000.
20590 @subsection CR16 Options
20591 @cindex CR16 Options
20593 These options are defined specifically for the CR16 ports.
20599 Enable the use of multiply-accumulate instructions. Disabled by default.
20603 @opindex mcr16cplus
20605 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
20610 Links the library libsim.a which is in compatible with simulator. Applicable
20611 to ELF compiler only.
20615 Choose integer type as 32-bit wide.
20619 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
20621 @item -mdata-model=@var{model}
20622 @opindex mdata-model
20623 Choose a data model. The choices for @var{model} are @samp{near},
20624 @samp{far} or @samp{medium}. @samp{medium} is default.
20625 However, @samp{far} is not valid with @option{-mcr16c}, as the
20626 CR16C architecture does not support the far data model.
20629 @node C-SKY Options
20630 @subsection C-SKY Options
20631 @cindex C-SKY Options
20633 GCC supports these options when compiling for C-SKY V2 processors.
20637 @item -march=@var{arch}
20639 Specify the C-SKY target architecture. Valid values for @var{arch} are:
20640 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
20641 The default is @samp{ck810}.
20643 @item -mcpu=@var{cpu}
20645 Specify the C-SKY target processor. Valid values for @var{cpu} are:
20646 @samp{ck801}, @samp{ck801t},
20647 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
20648 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
20649 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
20650 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
20651 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
20652 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
20653 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
20654 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
20655 @samp{ck803eftr1}, @samp{ck803efhtr1},
20656 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
20657 @samp{ck803sef}, @samp{ck803seft},
20658 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
20659 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
20660 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
20661 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
20664 @opindex mbig-endian
20667 @itemx -mlittle-endian
20668 @opindex mlittle-endian
20672 Select big- or little-endian code. The default is little-endian.
20674 @item -mfloat-abi=@var{name}
20675 @opindex mfloat-abi
20676 Specifies which floating-point ABI to use. Permissible values
20677 are: @samp{soft}, @samp{softfp} and @samp{hard}.
20679 Specifying @samp{soft} causes GCC to generate output containing
20680 library calls for floating-point operations.
20681 @samp{softfp} allows the generation of code using hardware floating-point
20682 instructions, but still uses the soft-float calling conventions.
20683 @samp{hard} allows generation of floating-point instructions
20684 and uses FPU-specific calling conventions.
20686 The default depends on the specific target configuration. Note that
20687 the hard-float and soft-float ABIs are not link-compatible; you must
20688 compile your entire program with the same ABI, and link with a
20689 compatible set of libraries.
20692 @opindex mhard-float
20693 @itemx -msoft-float
20694 @opindex msoft-float
20696 Select hardware or software floating-point implementations.
20697 The default is soft float.
20699 @item -mdouble-float
20700 @itemx -mno-double-float
20701 @opindex mdouble-float
20702 When @option{-mhard-float} is in effect, enable generation of
20703 double-precision float instructions. This is the default except
20704 when compiling for CK803.
20709 When @option{-mhard-float} is in effect, enable generation of
20710 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
20711 This is the default except when compiling for CK803.
20713 @item -mfpu=@var{fpu}
20715 Select the floating-point processor. This option can only be used with
20716 @option{-mhard-float}.
20717 Values for @var{fpu} are
20718 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
20719 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
20720 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
20725 Enable the extended @code{lrw} instruction. This option defaults to on
20726 for CK801 and off otherwise.
20731 Enable interrupt stack instructions; the default is off.
20733 The @option{-mistack} option is required to handle the
20734 @code{interrupt} and @code{isr} function attributes
20735 (@pxref{C-SKY Function Attributes}).
20739 Enable multiprocessor instructions; the default is off.
20743 Enable coprocessor instructions; the default is off.
20747 Enable coprocessor instructions; the default is off.
20751 Enable C-SKY security instructions; the default is off.
20755 Enable C-SKY trust instructions; the default is off.
20763 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
20764 All of these options default to off.
20769 Generate divide instructions. Default is off.
20774 Generate code for Smart Mode, using only registers numbered 0-7 to allow
20775 use of 16-bit instructions. This option is ignored for CK801 where this
20776 is the required behavior, and it defaults to on for CK802.
20777 For other targets, the default is off.
20779 @item -mhigh-registers
20780 @itemx -mno-high-registers
20781 @opindex mhigh-registers
20782 Generate code using the high registers numbered 16-31. This option
20783 is not supported on CK801, CK802, or CK803, and is enabled by default
20784 for other processors.
20789 Generate code using global anchor symbol addresses.
20792 @itemx -mno-pushpop
20794 Generate code using @code{push} and @code{pop} instructions. This option
20797 @item -mmultiple-stld
20799 @itemx -mno-multiple-stld
20801 @opindex mmultiple-stld
20802 Generate code using @code{stm} and @code{ldm} instructions. This option
20803 isn't supported on CK801 but is enabled by default on other processors.
20806 @itemx -mno-constpool
20807 @opindex mconstpool
20808 Create constant pools in the compiler instead of deferring it to the
20809 assembler. This option is the default and required for correct code
20810 generation on CK801 and CK802, and is optional on other processors.
20813 @item -mno-stack-size
20814 @opindex mstack-size
20815 Emit @code{.stack_size} directives for each function in the assembly
20816 output. This option defaults to off.
20821 Generate code for the C-SKY compiler runtime instead of libgcc. This
20822 option defaults to off.
20824 @item -mbranch-cost=@var{n}
20825 @opindex mbranch-cost=
20826 Set the branch costs to roughly @code{n} instructions. The default is 1.
20828 @item -msched-prolog
20829 @itemx -mno-sched-prolog
20830 @opindex msched-prolog
20831 Permit scheduling of function prologue and epilogue sequences. Using
20832 this option can result in code that is not compliant with the C-SKY V2 ABI
20833 prologue requirements and that cannot be debugged or backtraced.
20834 It is disabled by default.
20838 @node Darwin Options
20839 @subsection Darwin Options
20840 @cindex Darwin options
20842 These options are defined for all architectures running the Darwin operating
20845 FSF GCC on Darwin does not create ``fat'' object files; it creates
20846 an object file for the single architecture that GCC was built to
20847 target. Apple's GCC on Darwin does create ``fat'' files if multiple
20848 @option{-arch} options are used; it does so by running the compiler or
20849 linker multiple times and joining the results together with
20852 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
20853 @samp{i686}) is determined by the flags that specify the ISA
20854 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
20855 @option{-force_cpusubtype_ALL} option can be used to override this.
20857 The Darwin tools vary in their behavior when presented with an ISA
20858 mismatch. The assembler, @file{as}, only permits instructions to
20859 be used that are valid for the subtype of the file it is generating,
20860 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
20861 The linker for shared libraries, @file{/usr/bin/libtool}, fails
20862 and prints an error if asked to create a shared library with a less
20863 restrictive subtype than its input files (for instance, trying to put
20864 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
20865 for executables, @command{ld}, quietly gives the executable the most
20866 restrictive subtype of any of its input files.
20871 Add the framework directory @var{dir} to the head of the list of
20872 directories to be searched for header files. These directories are
20873 interleaved with those specified by @option{-I} options and are
20874 scanned in a left-to-right order.
20876 A framework directory is a directory with frameworks in it. A
20877 framework is a directory with a @file{Headers} and/or
20878 @file{PrivateHeaders} directory contained directly in it that ends
20879 in @file{.framework}. The name of a framework is the name of this
20880 directory excluding the @file{.framework}. Headers associated with
20881 the framework are found in one of those two directories, with
20882 @file{Headers} being searched first. A subframework is a framework
20883 directory that is in a framework's @file{Frameworks} directory.
20884 Includes of subframework headers can only appear in a header of a
20885 framework that contains the subframework, or in a sibling subframework
20886 header. Two subframeworks are siblings if they occur in the same
20887 framework. A subframework should not have the same name as a
20888 framework; a warning is issued if this is violated. Currently a
20889 subframework cannot have subframeworks; in the future, the mechanism
20890 may be extended to support this. The standard frameworks can be found
20891 in @file{/System/Library/Frameworks} and
20892 @file{/Library/Frameworks}. An example include looks like
20893 @code{#include <Framework/header.h>}, where @file{Framework} denotes
20894 the name of the framework and @file{header.h} is found in the
20895 @file{PrivateHeaders} or @file{Headers} directory.
20897 @item -iframework@var{dir}
20898 @opindex iframework
20899 Like @option{-F} except the directory is a treated as a system
20900 directory. The main difference between this @option{-iframework} and
20901 @option{-F} is that with @option{-iframework} the compiler does not
20902 warn about constructs contained within header files found via
20903 @var{dir}. This option is valid only for the C family of languages.
20907 Emit debugging information for symbols that are used. For stabs
20908 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
20909 This is by default ON@.
20913 Emit debugging information for all symbols and types.
20915 @item -mmacosx-version-min=@var{version}
20916 The earliest version of MacOS X that this executable will run on
20917 is @var{version}. Typical values of @var{version} include @code{10.1},
20918 @code{10.2}, and @code{10.3.9}.
20920 If the compiler was built to use the system's headers by default,
20921 then the default for this option is the system version on which the
20922 compiler is running, otherwise the default is to make choices that
20923 are compatible with as many systems and code bases as possible.
20927 Enable kernel development mode. The @option{-mkernel} option sets
20928 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
20929 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
20930 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
20931 applicable. This mode also sets @option{-mno-altivec},
20932 @option{-msoft-float}, @option{-fno-builtin} and
20933 @option{-mlong-branch} for PowerPC targets.
20935 @item -mone-byte-bool
20936 @opindex mone-byte-bool
20937 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
20938 By default @code{sizeof(bool)} is @code{4} when compiling for
20939 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
20940 option has no effect on x86.
20942 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
20943 to generate code that is not binary compatible with code generated
20944 without that switch. Using this switch may require recompiling all
20945 other modules in a program, including system libraries. Use this
20946 switch to conform to a non-default data model.
20948 @item -mfix-and-continue
20949 @itemx -ffix-and-continue
20950 @itemx -findirect-data
20951 @opindex mfix-and-continue
20952 @opindex ffix-and-continue
20953 @opindex findirect-data
20954 Generate code suitable for fast turnaround development, such as to
20955 allow GDB to dynamically load @file{.o} files into already-running
20956 programs. @option{-findirect-data} and @option{-ffix-and-continue}
20957 are provided for backwards compatibility.
20961 Loads all members of static archive libraries.
20962 See man ld(1) for more information.
20964 @item -arch_errors_fatal
20965 @opindex arch_errors_fatal
20966 Cause the errors having to do with files that have the wrong architecture
20969 @item -bind_at_load
20970 @opindex bind_at_load
20971 Causes the output file to be marked such that the dynamic linker will
20972 bind all undefined references when the file is loaded or launched.
20976 Produce a Mach-o bundle format file.
20977 See man ld(1) for more information.
20979 @item -bundle_loader @var{executable}
20980 @opindex bundle_loader
20981 This option specifies the @var{executable} that will load the build
20982 output file being linked. See man ld(1) for more information.
20985 @opindex dynamiclib
20986 When passed this option, GCC produces a dynamic library instead of
20987 an executable when linking, using the Darwin @file{libtool} command.
20989 @item -force_cpusubtype_ALL
20990 @opindex force_cpusubtype_ALL
20991 This causes GCC's output file to have the @samp{ALL} subtype, instead of
20992 one controlled by the @option{-mcpu} or @option{-march} option.
20994 @item -allowable_client @var{client_name}
20995 @itemx -client_name
20996 @itemx -compatibility_version
20997 @itemx -current_version
20999 @itemx -dependency-file
21001 @itemx -dylinker_install_name
21003 @itemx -exported_symbols_list
21006 @itemx -flat_namespace
21007 @itemx -force_flat_namespace
21008 @itemx -headerpad_max_install_names
21011 @itemx -install_name
21012 @itemx -keep_private_externs
21013 @itemx -multi_module
21014 @itemx -multiply_defined
21015 @itemx -multiply_defined_unused
21018 @itemx -no_dead_strip_inits_and_terms
21019 @itemx -nofixprebinding
21020 @itemx -nomultidefs
21022 @itemx -noseglinkedit
21023 @itemx -pagezero_size
21025 @itemx -prebind_all_twolevel_modules
21026 @itemx -private_bundle
21028 @itemx -read_only_relocs
21030 @itemx -sectobjectsymbols
21034 @itemx -sectobjectsymbols
21037 @itemx -segs_read_only_addr
21039 @itemx -segs_read_write_addr
21040 @itemx -seg_addr_table
21041 @itemx -seg_addr_table_filename
21042 @itemx -seglinkedit
21044 @itemx -segs_read_only_addr
21045 @itemx -segs_read_write_addr
21046 @itemx -single_module
21048 @itemx -sub_library
21050 @itemx -sub_umbrella
21051 @itemx -twolevel_namespace
21054 @itemx -unexported_symbols_list
21055 @itemx -weak_reference_mismatches
21056 @itemx -whatsloaded
21057 @opindex allowable_client
21058 @opindex client_name
21059 @opindex compatibility_version
21060 @opindex current_version
21061 @opindex dead_strip
21062 @opindex dependency-file
21063 @opindex dylib_file
21064 @opindex dylinker_install_name
21066 @opindex exported_symbols_list
21068 @opindex flat_namespace
21069 @opindex force_flat_namespace
21070 @opindex headerpad_max_install_names
21071 @opindex image_base
21073 @opindex install_name
21074 @opindex keep_private_externs
21075 @opindex multi_module
21076 @opindex multiply_defined
21077 @opindex multiply_defined_unused
21078 @opindex noall_load
21079 @opindex no_dead_strip_inits_and_terms
21080 @opindex nofixprebinding
21081 @opindex nomultidefs
21083 @opindex noseglinkedit
21084 @opindex pagezero_size
21086 @opindex prebind_all_twolevel_modules
21087 @opindex private_bundle
21088 @opindex read_only_relocs
21090 @opindex sectobjectsymbols
21093 @opindex sectcreate
21094 @opindex sectobjectsymbols
21097 @opindex segs_read_only_addr
21098 @opindex segs_read_write_addr
21099 @opindex seg_addr_table
21100 @opindex seg_addr_table_filename
21101 @opindex seglinkedit
21103 @opindex segs_read_only_addr
21104 @opindex segs_read_write_addr
21105 @opindex single_module
21107 @opindex sub_library
21108 @opindex sub_umbrella
21109 @opindex twolevel_namespace
21112 @opindex unexported_symbols_list
21113 @opindex weak_reference_mismatches
21114 @opindex whatsloaded
21115 These options are passed to the Darwin linker. The Darwin linker man page
21116 describes them in detail.
21119 @node DEC Alpha Options
21120 @subsection DEC Alpha Options
21122 These @samp{-m} options are defined for the DEC Alpha implementations:
21125 @item -mno-soft-float
21126 @itemx -msoft-float
21127 @opindex mno-soft-float
21128 @opindex msoft-float
21129 Use (do not use) the hardware floating-point instructions for
21130 floating-point operations. When @option{-msoft-float} is specified,
21131 functions in @file{libgcc.a} are used to perform floating-point
21132 operations. Unless they are replaced by routines that emulate the
21133 floating-point operations, or compiled in such a way as to call such
21134 emulations routines, these routines issue floating-point
21135 operations. If you are compiling for an Alpha without floating-point
21136 operations, you must ensure that the library is built so as not to call
21139 Note that Alpha implementations without floating-point operations are
21140 required to have floating-point registers.
21143 @itemx -mno-fp-regs
21145 @opindex mno-fp-regs
21146 Generate code that uses (does not use) the floating-point register set.
21147 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
21148 register set is not used, floating-point operands are passed in integer
21149 registers as if they were integers and floating-point results are passed
21150 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
21151 so any function with a floating-point argument or return value called by code
21152 compiled with @option{-mno-fp-regs} must also be compiled with that
21155 A typical use of this option is building a kernel that does not use,
21156 and hence need not save and restore, any floating-point registers.
21160 The Alpha architecture implements floating-point hardware optimized for
21161 maximum performance. It is mostly compliant with the IEEE floating-point
21162 standard. However, for full compliance, software assistance is
21163 required. This option generates code fully IEEE-compliant code
21164 @emph{except} that the @var{inexact-flag} is not maintained (see below).
21165 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
21166 defined during compilation. The resulting code is less efficient but is
21167 able to correctly support denormalized numbers and exceptional IEEE
21168 values such as not-a-number and plus/minus infinity. Other Alpha
21169 compilers call this option @option{-ieee_with_no_inexact}.
21171 @item -mieee-with-inexact
21172 @opindex mieee-with-inexact
21173 This is like @option{-mieee} except the generated code also maintains
21174 the IEEE @var{inexact-flag}. Turning on this option causes the
21175 generated code to implement fully-compliant IEEE math. In addition to
21176 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
21177 macro. On some Alpha implementations the resulting code may execute
21178 significantly slower than the code generated by default. Since there is
21179 very little code that depends on the @var{inexact-flag}, you should
21180 normally not specify this option. Other Alpha compilers call this
21181 option @option{-ieee_with_inexact}.
21183 @item -mfp-trap-mode=@var{trap-mode}
21184 @opindex mfp-trap-mode
21185 This option controls what floating-point related traps are enabled.
21186 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
21187 The trap mode can be set to one of four values:
21191 This is the default (normal) setting. The only traps that are enabled
21192 are the ones that cannot be disabled in software (e.g., division by zero
21196 In addition to the traps enabled by @samp{n}, underflow traps are enabled
21200 Like @samp{u}, but the instructions are marked to be safe for software
21201 completion (see Alpha architecture manual for details).
21204 Like @samp{su}, but inexact traps are enabled as well.
21207 @item -mfp-rounding-mode=@var{rounding-mode}
21208 @opindex mfp-rounding-mode
21209 Selects the IEEE rounding mode. Other Alpha compilers call this option
21210 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
21215 Normal IEEE rounding mode. Floating-point numbers are rounded towards
21216 the nearest machine number or towards the even machine number in case
21220 Round towards minus infinity.
21223 Chopped rounding mode. Floating-point numbers are rounded towards zero.
21226 Dynamic rounding mode. A field in the floating-point control register
21227 (@var{fpcr}, see Alpha architecture reference manual) controls the
21228 rounding mode in effect. The C library initializes this register for
21229 rounding towards plus infinity. Thus, unless your program modifies the
21230 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
21233 @item -mtrap-precision=@var{trap-precision}
21234 @opindex mtrap-precision
21235 In the Alpha architecture, floating-point traps are imprecise. This
21236 means without software assistance it is impossible to recover from a
21237 floating trap and program execution normally needs to be terminated.
21238 GCC can generate code that can assist operating system trap handlers
21239 in determining the exact location that caused a floating-point trap.
21240 Depending on the requirements of an application, different levels of
21241 precisions can be selected:
21245 Program precision. This option is the default and means a trap handler
21246 can only identify which program caused a floating-point exception.
21249 Function precision. The trap handler can determine the function that
21250 caused a floating-point exception.
21253 Instruction precision. The trap handler can determine the exact
21254 instruction that caused a floating-point exception.
21257 Other Alpha compilers provide the equivalent options called
21258 @option{-scope_safe} and @option{-resumption_safe}.
21260 @item -mieee-conformant
21261 @opindex mieee-conformant
21262 This option marks the generated code as IEEE conformant. You must not
21263 use this option unless you also specify @option{-mtrap-precision=i} and either
21264 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
21265 is to emit the line @samp{.eflag 48} in the function prologue of the
21266 generated assembly file.
21268 @item -mbuild-constants
21269 @opindex mbuild-constants
21270 Normally GCC examines a 32- or 64-bit integer constant to
21271 see if it can construct it from smaller constants in two or three
21272 instructions. If it cannot, it outputs the constant as a literal and
21273 generates code to load it from the data segment at run time.
21275 Use this option to require GCC to construct @emph{all} integer constants
21276 using code, even if it takes more instructions (the maximum is six).
21278 You typically use this option to build a shared library dynamic
21279 loader. Itself a shared library, it must relocate itself in memory
21280 before it can find the variables and constants in its own data segment.
21298 Indicate whether GCC should generate code to use the optional BWX,
21299 CIX, FIX and MAX instruction sets. The default is to use the instruction
21300 sets supported by the CPU type specified via @option{-mcpu=} option or that
21301 of the CPU on which GCC was built if none is specified.
21304 @itemx -mfloat-ieee
21305 @opindex mfloat-vax
21306 @opindex mfloat-ieee
21307 Generate code that uses (does not use) VAX F and G floating-point
21308 arithmetic instead of IEEE single and double precision.
21310 @item -mexplicit-relocs
21311 @itemx -mno-explicit-relocs
21312 @opindex mexplicit-relocs
21313 @opindex mno-explicit-relocs
21314 Older Alpha assemblers provided no way to generate symbol relocations
21315 except via assembler macros. Use of these macros does not allow
21316 optimal instruction scheduling. GNU binutils as of version 2.12
21317 supports a new syntax that allows the compiler to explicitly mark
21318 which relocations should apply to which instructions. This option
21319 is mostly useful for debugging, as GCC detects the capabilities of
21320 the assembler when it is built and sets the default accordingly.
21323 @itemx -mlarge-data
21324 @opindex msmall-data
21325 @opindex mlarge-data
21326 When @option{-mexplicit-relocs} is in effect, static data is
21327 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
21328 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
21329 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
21330 16-bit relocations off of the @code{$gp} register. This limits the
21331 size of the small data area to 64KB, but allows the variables to be
21332 directly accessed via a single instruction.
21334 The default is @option{-mlarge-data}. With this option the data area
21335 is limited to just below 2GB@. Programs that require more than 2GB of
21336 data must use @code{malloc} or @code{mmap} to allocate the data in the
21337 heap instead of in the program's data segment.
21339 When generating code for shared libraries, @option{-fpic} implies
21340 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
21343 @itemx -mlarge-text
21344 @opindex msmall-text
21345 @opindex mlarge-text
21346 When @option{-msmall-text} is used, the compiler assumes that the
21347 code of the entire program (or shared library) fits in 4MB, and is
21348 thus reachable with a branch instruction. When @option{-msmall-data}
21349 is used, the compiler can assume that all local symbols share the
21350 same @code{$gp} value, and thus reduce the number of instructions
21351 required for a function call from 4 to 1.
21353 The default is @option{-mlarge-text}.
21355 @item -mcpu=@var{cpu_type}
21357 Set the instruction set and instruction scheduling parameters for
21358 machine type @var{cpu_type}. You can specify either the @samp{EV}
21359 style name or the corresponding chip number. GCC supports scheduling
21360 parameters for the EV4, EV5 and EV6 family of processors and
21361 chooses the default values for the instruction set from the processor
21362 you specify. If you do not specify a processor type, GCC defaults
21363 to the processor on which the compiler was built.
21365 Supported values for @var{cpu_type} are
21371 Schedules as an EV4 and has no instruction set extensions.
21375 Schedules as an EV5 and has no instruction set extensions.
21379 Schedules as an EV5 and supports the BWX extension.
21384 Schedules as an EV5 and supports the BWX and MAX extensions.
21388 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
21392 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
21395 Native toolchains also support the value @samp{native},
21396 which selects the best architecture option for the host processor.
21397 @option{-mcpu=native} has no effect if GCC does not recognize
21400 @item -mtune=@var{cpu_type}
21402 Set only the instruction scheduling parameters for machine type
21403 @var{cpu_type}. The instruction set is not changed.
21405 Native toolchains also support the value @samp{native},
21406 which selects the best architecture option for the host processor.
21407 @option{-mtune=native} has no effect if GCC does not recognize
21410 @item -mmemory-latency=@var{time}
21411 @opindex mmemory-latency
21412 Sets the latency the scheduler should assume for typical memory
21413 references as seen by the application. This number is highly
21414 dependent on the memory access patterns used by the application
21415 and the size of the external cache on the machine.
21417 Valid options for @var{time} are
21421 A decimal number representing clock cycles.
21427 The compiler contains estimates of the number of clock cycles for
21428 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21429 (also called Dcache, Scache, and Bcache), as well as to main memory.
21430 Note that L3 is only valid for EV5.
21436 @subsection eBPF Options
21437 @cindex eBPF Options
21440 @item -mframe-limit=@var{bytes}
21441 This specifies the hard limit for frame sizes, in bytes. Currently,
21442 the value that can be specified should be less than or equal to
21443 @samp{32767}. Defaults to whatever limit is imposed by the version of
21444 the Linux kernel targeted.
21446 @item -mkernel=@var{version}
21448 This specifies the minimum version of the kernel that will run the
21449 compiled program. GCC uses this version to determine which
21450 instructions to use, what kernel helpers to allow, etc. Currently,
21451 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
21452 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
21453 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
21454 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
21455 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
21456 @samp{5.2}, @samp{latest} and @samp{native}.
21459 @opindex mbig-endian
21460 Generate code for a big-endian target.
21462 @item -mlittle-endian
21463 @opindex mlittle-endian
21464 Generate code for a little-endian target. This is the default.
21467 Generate code for an expanded version of BPF, which relaxes some of
21468 the restrictions imposed by the BPF architecture:
21470 @item Save and restore callee-saved registers at function entry and
21471 exit, respectively.
21476 @subsection FR30 Options
21477 @cindex FR30 Options
21479 These options are defined specifically for the FR30 port.
21483 @item -msmall-model
21484 @opindex msmall-model
21485 Use the small address space model. This can produce smaller code, but
21486 it does assume that all symbolic values and addresses fit into a
21491 Assume that runtime support has been provided and so there is no need
21492 to include the simulator library (@file{libsim.a}) on the linker
21498 @subsection FT32 Options
21499 @cindex FT32 Options
21501 These options are defined specifically for the FT32 port.
21507 Specifies that the program will be run on the simulator. This causes
21508 an alternate runtime startup and library to be linked.
21509 You must not use this option when generating programs that will run on
21510 real hardware; you must provide your own runtime library for whatever
21511 I/O functions are needed.
21515 Enable Local Register Allocation. This is still experimental for FT32,
21516 so by default the compiler uses standard reload.
21520 Do not use div and mod instructions.
21524 Enable use of the extended instructions of the FT32B processor.
21528 Compress all code using the Ft32B code compression scheme.
21532 Do not generate code that reads program memory.
21537 @subsection FRV Options
21538 @cindex FRV Options
21544 Only use the first 32 general-purpose registers.
21549 Use all 64 general-purpose registers.
21554 Use only the first 32 floating-point registers.
21559 Use all 64 floating-point registers.
21562 @opindex mhard-float
21564 Use hardware instructions for floating-point operations.
21567 @opindex msoft-float
21569 Use library routines for floating-point operations.
21574 Dynamically allocate condition code registers.
21579 Do not try to dynamically allocate condition code registers, only
21580 use @code{icc0} and @code{fcc0}.
21585 Change ABI to use double word insns.
21591 Do not use double word instructions.
21596 Use floating-point double instructions.
21599 @opindex mno-double
21601 Do not use floating-point double instructions.
21606 Use media instructions.
21611 Do not use media instructions.
21616 Use multiply and add/subtract instructions.
21619 @opindex mno-muladd
21621 Do not use multiply and add/subtract instructions.
21626 Select the FDPIC ABI, which uses function descriptors to represent
21627 pointers to functions. Without any PIC/PIE-related options, it
21628 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
21629 assumes GOT entries and small data are within a 12-bit range from the
21630 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
21631 are computed with 32 bits.
21632 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21635 @opindex minline-plt
21637 Enable inlining of PLT entries in function calls to functions that are
21638 not known to bind locally. It has no effect without @option{-mfdpic}.
21639 It's enabled by default if optimizing for speed and compiling for
21640 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
21641 optimization option such as @option{-O3} or above is present in the
21647 Assume a large TLS segment when generating thread-local code.
21652 Do not assume a large TLS segment when generating thread-local code.
21657 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
21658 that is known to be in read-only sections. It's enabled by default,
21659 except for @option{-fpic} or @option{-fpie}: even though it may help
21660 make the global offset table smaller, it trades 1 instruction for 4.
21661 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
21662 one of which may be shared by multiple symbols, and it avoids the need
21663 for a GOT entry for the referenced symbol, so it's more likely to be a
21664 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
21666 @item -multilib-library-pic
21667 @opindex multilib-library-pic
21669 Link with the (library, not FD) pic libraries. It's implied by
21670 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
21671 @option{-fpic} without @option{-mfdpic}. You should never have to use
21675 @opindex mlinked-fp
21677 Follow the EABI requirement of always creating a frame pointer whenever
21678 a stack frame is allocated. This option is enabled by default and can
21679 be disabled with @option{-mno-linked-fp}.
21682 @opindex mlong-calls
21684 Use indirect addressing to call functions outside the current
21685 compilation unit. This allows the functions to be placed anywhere
21686 within the 32-bit address space.
21688 @item -malign-labels
21689 @opindex malign-labels
21691 Try to align labels to an 8-byte boundary by inserting NOPs into the
21692 previous packet. This option only has an effect when VLIW packing
21693 is enabled. It doesn't create new packets; it merely adds NOPs to
21696 @item -mlibrary-pic
21697 @opindex mlibrary-pic
21699 Generate position-independent EABI code.
21704 Use only the first four media accumulator registers.
21709 Use all eight media accumulator registers.
21714 Pack VLIW instructions.
21719 Do not pack VLIW instructions.
21722 @opindex mno-eflags
21724 Do not mark ABI switches in e_flags.
21727 @opindex mcond-move
21729 Enable the use of conditional-move instructions (default).
21731 This switch is mainly for debugging the compiler and will likely be removed
21732 in a future version.
21734 @item -mno-cond-move
21735 @opindex mno-cond-move
21737 Disable the use of conditional-move instructions.
21739 This switch is mainly for debugging the compiler and will likely be removed
21740 in a future version.
21745 Enable the use of conditional set instructions (default).
21747 This switch is mainly for debugging the compiler and will likely be removed
21748 in a future version.
21753 Disable the use of conditional set instructions.
21755 This switch is mainly for debugging the compiler and will likely be removed
21756 in a future version.
21759 @opindex mcond-exec
21761 Enable the use of conditional execution (default).
21763 This switch is mainly for debugging the compiler and will likely be removed
21764 in a future version.
21766 @item -mno-cond-exec
21767 @opindex mno-cond-exec
21769 Disable the use of conditional execution.
21771 This switch is mainly for debugging the compiler and will likely be removed
21772 in a future version.
21774 @item -mvliw-branch
21775 @opindex mvliw-branch
21777 Run a pass to pack branches into VLIW instructions (default).
21779 This switch is mainly for debugging the compiler and will likely be removed
21780 in a future version.
21782 @item -mno-vliw-branch
21783 @opindex mno-vliw-branch
21785 Do not run a pass to pack branches into VLIW instructions.
21787 This switch is mainly for debugging the compiler and will likely be removed
21788 in a future version.
21790 @item -mmulti-cond-exec
21791 @opindex mmulti-cond-exec
21793 Enable optimization of @code{&&} and @code{||} in conditional execution
21796 This switch is mainly for debugging the compiler and will likely be removed
21797 in a future version.
21799 @item -mno-multi-cond-exec
21800 @opindex mno-multi-cond-exec
21802 Disable optimization of @code{&&} and @code{||} in conditional execution.
21804 This switch is mainly for debugging the compiler and will likely be removed
21805 in a future version.
21807 @item -mnested-cond-exec
21808 @opindex mnested-cond-exec
21810 Enable nested conditional execution optimizations (default).
21812 This switch is mainly for debugging the compiler and will likely be removed
21813 in a future version.
21815 @item -mno-nested-cond-exec
21816 @opindex mno-nested-cond-exec
21818 Disable nested conditional execution optimizations.
21820 This switch is mainly for debugging the compiler and will likely be removed
21821 in a future version.
21823 @item -moptimize-membar
21824 @opindex moptimize-membar
21826 This switch removes redundant @code{membar} instructions from the
21827 compiler-generated code. It is enabled by default.
21829 @item -mno-optimize-membar
21830 @opindex mno-optimize-membar
21831 @opindex moptimize-membar
21833 This switch disables the automatic removal of redundant @code{membar}
21834 instructions from the generated code.
21836 @item -mtomcat-stats
21837 @opindex mtomcat-stats
21839 Cause gas to print out tomcat statistics.
21841 @item -mcpu=@var{cpu}
21844 Select the processor type for which to generate code. Possible values are
21845 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
21846 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
21850 @node GNU/Linux Options
21851 @subsection GNU/Linux Options
21853 These @samp{-m} options are defined for GNU/Linux targets:
21858 Use the GNU C library. This is the default except
21859 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
21860 @samp{*-*-linux-*android*} targets.
21864 Use uClibc C library. This is the default on
21865 @samp{*-*-linux-*uclibc*} targets.
21869 Use the musl C library. This is the default on
21870 @samp{*-*-linux-*musl*} targets.
21874 Use Bionic C library. This is the default on
21875 @samp{*-*-linux-*android*} targets.
21879 Compile code compatible with Android platform. This is the default on
21880 @samp{*-*-linux-*android*} targets.
21882 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
21883 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
21884 this option makes the GCC driver pass Android-specific options to the linker.
21885 Finally, this option causes the preprocessor macro @code{__ANDROID__}
21888 @item -tno-android-cc
21889 @opindex tno-android-cc
21890 Disable compilation effects of @option{-mandroid}, i.e., do not enable
21891 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
21892 @option{-fno-rtti} by default.
21894 @item -tno-android-ld
21895 @opindex tno-android-ld
21896 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
21897 linking options to the linker.
21901 @node H8/300 Options
21902 @subsection H8/300 Options
21904 These @samp{-m} options are defined for the H8/300 implementations:
21909 Shorten some address references at link time, when possible; uses the
21910 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
21911 ld, Using ld}, for a fuller description.
21915 Generate code for the H8/300H@.
21919 Generate code for the H8S@.
21923 Generate code for the H8S and H8/300H in the normal mode. This switch
21924 must be used either with @option{-mh} or @option{-ms}.
21928 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
21932 Extended registers are stored on stack before execution of function
21933 with monitor attribute. Default option is @option{-mexr}.
21934 This option is valid only for H8S targets.
21939 Extended registers are not stored on stack before execution of function
21940 with monitor attribute. Default option is @option{-mno-exr}.
21941 This option is valid only for H8S targets.
21945 Make @code{int} data 32 bits by default.
21948 @opindex malign-300
21949 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
21950 The default for the H8/300H and H8S is to align longs and floats on
21952 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
21953 This option has no effect on the H8/300.
21957 @subsection HPPA Options
21958 @cindex HPPA Options
21960 These @samp{-m} options are defined for the HPPA family of computers:
21963 @item -march=@var{architecture-type}
21965 Generate code for the specified architecture. The choices for
21966 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
21967 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
21968 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
21969 architecture option for your machine. Code compiled for lower numbered
21970 architectures runs on higher numbered architectures, but not the
21973 @item -mpa-risc-1-0
21974 @itemx -mpa-risc-1-1
21975 @itemx -mpa-risc-2-0
21976 @opindex mpa-risc-1-0
21977 @opindex mpa-risc-1-1
21978 @opindex mpa-risc-2-0
21979 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
21981 @item -mcaller-copies
21982 @opindex mcaller-copies
21983 The caller copies function arguments passed by hidden reference. This
21984 option should be used with care as it is not compatible with the default
21985 32-bit runtime. However, only aggregates larger than eight bytes are
21986 passed by hidden reference and the option provides better compatibility
21989 @item -mjump-in-delay
21990 @opindex mjump-in-delay
21991 This option is ignored and provided for compatibility purposes only.
21993 @item -mdisable-fpregs
21994 @opindex mdisable-fpregs
21995 Prevent floating-point registers from being used in any manner. This is
21996 necessary for compiling kernels that perform lazy context switching of
21997 floating-point registers. If you use this option and attempt to perform
21998 floating-point operations, the compiler aborts.
22000 @item -mdisable-indexing
22001 @opindex mdisable-indexing
22002 Prevent the compiler from using indexing address modes. This avoids some
22003 rather obscure problems when compiling MIG generated code under MACH@.
22005 @item -mno-space-regs
22006 @opindex mno-space-regs
22007 @opindex mspace-regs
22008 Generate code that assumes the target has no space registers. This allows
22009 GCC to generate faster indirect calls and use unscaled index address modes.
22011 Such code is suitable for level 0 PA systems and kernels.
22013 @item -mfast-indirect-calls
22014 @opindex mfast-indirect-calls
22015 Generate code that assumes calls never cross space boundaries. This
22016 allows GCC to emit code that performs faster indirect calls.
22018 This option does not work in the presence of shared libraries or nested
22021 @item -mfixed-range=@var{register-range}
22022 @opindex mfixed-range
22023 Generate code treating the given register range as fixed registers.
22024 A fixed register is one that the register allocator cannot use. This is
22025 useful when compiling kernel code. A register range is specified as
22026 two registers separated by a dash. Multiple register ranges can be
22027 specified separated by a comma.
22029 @item -mlong-load-store
22030 @opindex mlong-load-store
22031 Generate 3-instruction load and store sequences as sometimes required by
22032 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
22035 @item -mportable-runtime
22036 @opindex mportable-runtime
22037 Use the portable calling conventions proposed by HP for ELF systems.
22041 Enable the use of assembler directives only GAS understands.
22043 @item -mschedule=@var{cpu-type}
22045 Schedule code according to the constraints for the machine type
22046 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
22047 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
22048 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
22049 proper scheduling option for your machine. The default scheduling is
22053 @opindex mlinker-opt
22054 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
22055 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
22056 linkers in which they give bogus error messages when linking some programs.
22059 @opindex msoft-float
22060 Generate output containing library calls for floating point.
22061 @strong{Warning:} the requisite libraries are not available for all HPPA
22062 targets. Normally the facilities of the machine's usual C compiler are
22063 used, but this cannot be done directly in cross-compilation. You must make
22064 your own arrangements to provide suitable library functions for
22067 @option{-msoft-float} changes the calling convention in the output file;
22068 therefore, it is only useful if you compile @emph{all} of a program with
22069 this option. In particular, you need to compile @file{libgcc.a}, the
22070 library that comes with GCC, with @option{-msoft-float} in order for
22075 Generate the predefine, @code{_SIO}, for server IO@. The default is
22076 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
22077 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
22078 options are available under HP-UX and HI-UX@.
22082 Use options specific to GNU @command{ld}.
22083 This passes @option{-shared} to @command{ld} when
22084 building a shared library. It is the default when GCC is configured,
22085 explicitly or implicitly, with the GNU linker. This option does not
22086 affect which @command{ld} is called; it only changes what parameters
22087 are passed to that @command{ld}.
22088 The @command{ld} that is called is determined by the
22089 @option{--with-ld} configure option, GCC's program search path, and
22090 finally by the user's @env{PATH}. The linker used by GCC can be printed
22091 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
22092 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
22096 Use options specific to HP @command{ld}.
22097 This passes @option{-b} to @command{ld} when building
22098 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
22099 links. It is the default when GCC is configured, explicitly or
22100 implicitly, with the HP linker. This option does not affect
22101 which @command{ld} is called; it only changes what parameters are passed to that
22103 The @command{ld} that is called is determined by the @option{--with-ld}
22104 configure option, GCC's program search path, and finally by the user's
22105 @env{PATH}. The linker used by GCC can be printed using @samp{which
22106 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
22107 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
22110 @opindex mno-long-calls
22111 @opindex mlong-calls
22112 Generate code that uses long call sequences. This ensures that a call
22113 is always able to reach linker generated stubs. The default is to generate
22114 long calls only when the distance from the call site to the beginning
22115 of the function or translation unit, as the case may be, exceeds a
22116 predefined limit set by the branch type being used. The limits for
22117 normal calls are 7,600,000 and 240,000 bytes, respectively for the
22118 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
22121 Distances are measured from the beginning of functions when using the
22122 @option{-ffunction-sections} option, or when using the @option{-mgas}
22123 and @option{-mno-portable-runtime} options together under HP-UX with
22126 It is normally not desirable to use this option as it degrades
22127 performance. However, it may be useful in large applications,
22128 particularly when partial linking is used to build the application.
22130 The types of long calls used depends on the capabilities of the
22131 assembler and linker, and the type of code being generated. The
22132 impact on systems that support long absolute calls, and long pic
22133 symbol-difference or pc-relative calls should be relatively small.
22134 However, an indirect call is used on 32-bit ELF systems in pic code
22135 and it is quite long.
22137 @item -munix=@var{unix-std}
22139 Generate compiler predefines and select a startfile for the specified
22140 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
22141 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
22142 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
22143 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
22144 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
22147 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
22148 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
22149 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
22150 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
22151 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
22152 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
22154 It is @emph{important} to note that this option changes the interfaces
22155 for various library routines. It also affects the operational behavior
22156 of the C library. Thus, @emph{extreme} care is needed in using this
22159 Library code that is intended to operate with more than one UNIX
22160 standard must test, set and restore the variable @code{__xpg4_extended_mask}
22161 as appropriate. Most GNU software doesn't provide this capability.
22165 Suppress the generation of link options to search libdld.sl when the
22166 @option{-static} option is specified on HP-UX 10 and later.
22170 The HP-UX implementation of setlocale in libc has a dependency on
22171 libdld.sl. There isn't an archive version of libdld.sl. Thus,
22172 when the @option{-static} option is specified, special link options
22173 are needed to resolve this dependency.
22175 On HP-UX 10 and later, the GCC driver adds the necessary options to
22176 link with libdld.sl when the @option{-static} option is specified.
22177 This causes the resulting binary to be dynamic. On the 64-bit port,
22178 the linkers generate dynamic binaries by default in any case. The
22179 @option{-nolibdld} option can be used to prevent the GCC driver from
22180 adding these link options.
22184 Add support for multithreading with the @dfn{dce thread} library
22185 under HP-UX@. This option sets flags for both the preprocessor and
22189 @node IA-64 Options
22190 @subsection IA-64 Options
22191 @cindex IA-64 Options
22193 These are the @samp{-m} options defined for the Intel IA-64 architecture.
22197 @opindex mbig-endian
22198 Generate code for a big-endian target. This is the default for HP-UX@.
22200 @item -mlittle-endian
22201 @opindex mlittle-endian
22202 Generate code for a little-endian target. This is the default for AIX5
22208 @opindex mno-gnu-as
22209 Generate (or don't) code for the GNU assembler. This is the default.
22210 @c Also, this is the default if the configure option @option{--with-gnu-as}
22216 @opindex mno-gnu-ld
22217 Generate (or don't) code for the GNU linker. This is the default.
22218 @c Also, this is the default if the configure option @option{--with-gnu-ld}
22223 Generate code that does not use a global pointer register. The result
22224 is not position independent code, and violates the IA-64 ABI@.
22226 @item -mvolatile-asm-stop
22227 @itemx -mno-volatile-asm-stop
22228 @opindex mvolatile-asm-stop
22229 @opindex mno-volatile-asm-stop
22230 Generate (or don't) a stop bit immediately before and after volatile asm
22233 @item -mregister-names
22234 @itemx -mno-register-names
22235 @opindex mregister-names
22236 @opindex mno-register-names
22237 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
22238 the stacked registers. This may make assembler output more readable.
22244 Disable (or enable) optimizations that use the small data section. This may
22245 be useful for working around optimizer bugs.
22247 @item -mconstant-gp
22248 @opindex mconstant-gp
22249 Generate code that uses a single constant global pointer value. This is
22250 useful when compiling kernel code.
22254 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
22255 This is useful when compiling firmware code.
22257 @item -minline-float-divide-min-latency
22258 @opindex minline-float-divide-min-latency
22259 Generate code for inline divides of floating-point values
22260 using the minimum latency algorithm.
22262 @item -minline-float-divide-max-throughput
22263 @opindex minline-float-divide-max-throughput
22264 Generate code for inline divides of floating-point values
22265 using the maximum throughput algorithm.
22267 @item -mno-inline-float-divide
22268 @opindex mno-inline-float-divide
22269 Do not generate inline code for divides of floating-point values.
22271 @item -minline-int-divide-min-latency
22272 @opindex minline-int-divide-min-latency
22273 Generate code for inline divides of integer values
22274 using the minimum latency algorithm.
22276 @item -minline-int-divide-max-throughput
22277 @opindex minline-int-divide-max-throughput
22278 Generate code for inline divides of integer values
22279 using the maximum throughput algorithm.
22281 @item -mno-inline-int-divide
22282 @opindex mno-inline-int-divide
22283 @opindex minline-int-divide
22284 Do not generate inline code for divides of integer values.
22286 @item -minline-sqrt-min-latency
22287 @opindex minline-sqrt-min-latency
22288 Generate code for inline square roots
22289 using the minimum latency algorithm.
22291 @item -minline-sqrt-max-throughput
22292 @opindex minline-sqrt-max-throughput
22293 Generate code for inline square roots
22294 using the maximum throughput algorithm.
22296 @item -mno-inline-sqrt
22297 @opindex mno-inline-sqrt
22298 Do not generate inline code for @code{sqrt}.
22301 @itemx -mno-fused-madd
22302 @opindex mfused-madd
22303 @opindex mno-fused-madd
22304 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
22305 instructions. The default is to use these instructions.
22307 @item -mno-dwarf2-asm
22308 @itemx -mdwarf2-asm
22309 @opindex mno-dwarf2-asm
22310 @opindex mdwarf2-asm
22311 Don't (or do) generate assembler code for the DWARF line number debugging
22312 info. This may be useful when not using the GNU assembler.
22314 @item -mearly-stop-bits
22315 @itemx -mno-early-stop-bits
22316 @opindex mearly-stop-bits
22317 @opindex mno-early-stop-bits
22318 Allow stop bits to be placed earlier than immediately preceding the
22319 instruction that triggered the stop bit. This can improve instruction
22320 scheduling, but does not always do so.
22322 @item -mfixed-range=@var{register-range}
22323 @opindex mfixed-range
22324 Generate code treating the given register range as fixed registers.
22325 A fixed register is one that the register allocator cannot use. This is
22326 useful when compiling kernel code. A register range is specified as
22327 two registers separated by a dash. Multiple register ranges can be
22328 specified separated by a comma.
22330 @item -mtls-size=@var{tls-size}
22332 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
22335 @item -mtune=@var{cpu-type}
22337 Tune the instruction scheduling for a particular CPU, Valid values are
22338 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
22339 and @samp{mckinley}.
22345 Generate code for a 32-bit or 64-bit environment.
22346 The 32-bit environment sets int, long and pointer to 32 bits.
22347 The 64-bit environment sets int to 32 bits and long and pointer
22348 to 64 bits. These are HP-UX specific flags.
22350 @item -mno-sched-br-data-spec
22351 @itemx -msched-br-data-spec
22352 @opindex mno-sched-br-data-spec
22353 @opindex msched-br-data-spec
22354 (Dis/En)able data speculative scheduling before reload.
22355 This results in generation of @code{ld.a} instructions and
22356 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
22357 The default setting is disabled.
22359 @item -msched-ar-data-spec
22360 @itemx -mno-sched-ar-data-spec
22361 @opindex msched-ar-data-spec
22362 @opindex mno-sched-ar-data-spec
22363 (En/Dis)able data speculative scheduling after reload.
22364 This results in generation of @code{ld.a} instructions and
22365 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
22366 The default setting is enabled.
22368 @item -mno-sched-control-spec
22369 @itemx -msched-control-spec
22370 @opindex mno-sched-control-spec
22371 @opindex msched-control-spec
22372 (Dis/En)able control speculative scheduling. This feature is
22373 available only during region scheduling (i.e.@: before reload).
22374 This results in generation of the @code{ld.s} instructions and
22375 the corresponding check instructions @code{chk.s}.
22376 The default setting is disabled.
22378 @item -msched-br-in-data-spec
22379 @itemx -mno-sched-br-in-data-spec
22380 @opindex msched-br-in-data-spec
22381 @opindex mno-sched-br-in-data-spec
22382 (En/Dis)able speculative scheduling of the instructions that
22383 are dependent on the data speculative loads before reload.
22384 This is effective only with @option{-msched-br-data-spec} enabled.
22385 The default setting is enabled.
22387 @item -msched-ar-in-data-spec
22388 @itemx -mno-sched-ar-in-data-spec
22389 @opindex msched-ar-in-data-spec
22390 @opindex mno-sched-ar-in-data-spec
22391 (En/Dis)able speculative scheduling of the instructions that
22392 are dependent on the data speculative loads after reload.
22393 This is effective only with @option{-msched-ar-data-spec} enabled.
22394 The default setting is enabled.
22396 @item -msched-in-control-spec
22397 @itemx -mno-sched-in-control-spec
22398 @opindex msched-in-control-spec
22399 @opindex mno-sched-in-control-spec
22400 (En/Dis)able speculative scheduling of the instructions that
22401 are dependent on the control speculative loads.
22402 This is effective only with @option{-msched-control-spec} enabled.
22403 The default setting is enabled.
22405 @item -mno-sched-prefer-non-data-spec-insns
22406 @itemx -msched-prefer-non-data-spec-insns
22407 @opindex mno-sched-prefer-non-data-spec-insns
22408 @opindex msched-prefer-non-data-spec-insns
22409 If enabled, data-speculative instructions are chosen for schedule
22410 only if there are no other choices at the moment. This makes
22411 the use of the data speculation much more conservative.
22412 The default setting is disabled.
22414 @item -mno-sched-prefer-non-control-spec-insns
22415 @itemx -msched-prefer-non-control-spec-insns
22416 @opindex mno-sched-prefer-non-control-spec-insns
22417 @opindex msched-prefer-non-control-spec-insns
22418 If enabled, control-speculative instructions are chosen for schedule
22419 only if there are no other choices at the moment. This makes
22420 the use of the control speculation much more conservative.
22421 The default setting is disabled.
22423 @item -mno-sched-count-spec-in-critical-path
22424 @itemx -msched-count-spec-in-critical-path
22425 @opindex mno-sched-count-spec-in-critical-path
22426 @opindex msched-count-spec-in-critical-path
22427 If enabled, speculative dependencies are considered during
22428 computation of the instructions priorities. This makes the use of the
22429 speculation a bit more conservative.
22430 The default setting is disabled.
22432 @item -msched-spec-ldc
22433 @opindex msched-spec-ldc
22434 Use a simple data speculation check. This option is on by default.
22436 @item -msched-control-spec-ldc
22437 @opindex msched-spec-ldc
22438 Use a simple check for control speculation. This option is on by default.
22440 @item -msched-stop-bits-after-every-cycle
22441 @opindex msched-stop-bits-after-every-cycle
22442 Place a stop bit after every cycle when scheduling. This option is on
22445 @item -msched-fp-mem-deps-zero-cost
22446 @opindex msched-fp-mem-deps-zero-cost
22447 Assume that floating-point stores and loads are not likely to cause a conflict
22448 when placed into the same instruction group. This option is disabled by
22451 @item -msel-sched-dont-check-control-spec
22452 @opindex msel-sched-dont-check-control-spec
22453 Generate checks for control speculation in selective scheduling.
22454 This flag is disabled by default.
22456 @item -msched-max-memory-insns=@var{max-insns}
22457 @opindex msched-max-memory-insns
22458 Limit on the number of memory insns per instruction group, giving lower
22459 priority to subsequent memory insns attempting to schedule in the same
22460 instruction group. Frequently useful to prevent cache bank conflicts.
22461 The default value is 1.
22463 @item -msched-max-memory-insns-hard-limit
22464 @opindex msched-max-memory-insns-hard-limit
22465 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
22466 disallowing more than that number in an instruction group.
22467 Otherwise, the limit is ``soft'', meaning that non-memory operations
22468 are preferred when the limit is reached, but memory operations may still
22474 @subsection LM32 Options
22475 @cindex LM32 options
22477 These @option{-m} options are defined for the LatticeMico32 architecture:
22480 @item -mbarrel-shift-enabled
22481 @opindex mbarrel-shift-enabled
22482 Enable barrel-shift instructions.
22484 @item -mdivide-enabled
22485 @opindex mdivide-enabled
22486 Enable divide and modulus instructions.
22488 @item -mmultiply-enabled
22489 @opindex multiply-enabled
22490 Enable multiply instructions.
22492 @item -msign-extend-enabled
22493 @opindex msign-extend-enabled
22494 Enable sign extend instructions.
22496 @item -muser-enabled
22497 @opindex muser-enabled
22498 Enable user-defined instructions.
22503 @subsection M32C Options
22504 @cindex M32C options
22507 @item -mcpu=@var{name}
22509 Select the CPU for which code is generated. @var{name} may be one of
22510 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
22511 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
22512 the M32C/80 series.
22516 Specifies that the program will be run on the simulator. This causes
22517 an alternate runtime library to be linked in which supports, for
22518 example, file I/O@. You must not use this option when generating
22519 programs that will run on real hardware; you must provide your own
22520 runtime library for whatever I/O functions are needed.
22522 @item -memregs=@var{number}
22524 Specifies the number of memory-based pseudo-registers GCC uses
22525 during code generation. These pseudo-registers are used like real
22526 registers, so there is a tradeoff between GCC's ability to fit the
22527 code into available registers, and the performance penalty of using
22528 memory instead of registers. Note that all modules in a program must
22529 be compiled with the same value for this option. Because of that, you
22530 must not use this option with GCC's default runtime libraries.
22534 @node M32R/D Options
22535 @subsection M32R/D Options
22536 @cindex M32R/D options
22538 These @option{-m} options are defined for Renesas M32R/D architectures:
22543 Generate code for the M32R/2@.
22547 Generate code for the M32R/X@.
22551 Generate code for the M32R@. This is the default.
22553 @item -mmodel=small
22554 @opindex mmodel=small
22555 Assume all objects live in the lower 16MB of memory (so that their addresses
22556 can be loaded with the @code{ld24} instruction), and assume all subroutines
22557 are reachable with the @code{bl} instruction.
22558 This is the default.
22560 The addressability of a particular object can be set with the
22561 @code{model} attribute.
22563 @item -mmodel=medium
22564 @opindex mmodel=medium
22565 Assume objects may be anywhere in the 32-bit address space (the compiler
22566 generates @code{seth/add3} instructions to load their addresses), and
22567 assume all subroutines are reachable with the @code{bl} instruction.
22569 @item -mmodel=large
22570 @opindex mmodel=large
22571 Assume objects may be anywhere in the 32-bit address space (the compiler
22572 generates @code{seth/add3} instructions to load their addresses), and
22573 assume subroutines may not be reachable with the @code{bl} instruction
22574 (the compiler generates the much slower @code{seth/add3/jl}
22575 instruction sequence).
22578 @opindex msdata=none
22579 Disable use of the small data area. Variables are put into
22580 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
22581 @code{section} attribute has been specified).
22582 This is the default.
22584 The small data area consists of sections @code{.sdata} and @code{.sbss}.
22585 Objects may be explicitly put in the small data area with the
22586 @code{section} attribute using one of these sections.
22588 @item -msdata=sdata
22589 @opindex msdata=sdata
22590 Put small global and static data in the small data area, but do not
22591 generate special code to reference them.
22594 @opindex msdata=use
22595 Put small global and static data in the small data area, and generate
22596 special instructions to reference them.
22600 @cindex smaller data references
22601 Put global and static objects less than or equal to @var{num} bytes
22602 into the small data or BSS sections instead of the normal data or BSS
22603 sections. The default value of @var{num} is 8.
22604 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
22605 for this option to have any effect.
22607 All modules should be compiled with the same @option{-G @var{num}} value.
22608 Compiling with different values of @var{num} may or may not work; if it
22609 doesn't the linker gives an error message---incorrect code is not
22614 Makes the M32R-specific code in the compiler display some statistics
22615 that might help in debugging programs.
22617 @item -malign-loops
22618 @opindex malign-loops
22619 Align all loops to a 32-byte boundary.
22621 @item -mno-align-loops
22622 @opindex mno-align-loops
22623 Do not enforce a 32-byte alignment for loops. This is the default.
22625 @item -missue-rate=@var{number}
22626 @opindex missue-rate=@var{number}
22627 Issue @var{number} instructions per cycle. @var{number} can only be 1
22630 @item -mbranch-cost=@var{number}
22631 @opindex mbranch-cost=@var{number}
22632 @var{number} can only be 1 or 2. If it is 1 then branches are
22633 preferred over conditional code, if it is 2, then the opposite applies.
22635 @item -mflush-trap=@var{number}
22636 @opindex mflush-trap=@var{number}
22637 Specifies the trap number to use to flush the cache. The default is
22638 12. Valid numbers are between 0 and 15 inclusive.
22640 @item -mno-flush-trap
22641 @opindex mno-flush-trap
22642 Specifies that the cache cannot be flushed by using a trap.
22644 @item -mflush-func=@var{name}
22645 @opindex mflush-func=@var{name}
22646 Specifies the name of the operating system function to call to flush
22647 the cache. The default is @samp{_flush_cache}, but a function call
22648 is only used if a trap is not available.
22650 @item -mno-flush-func
22651 @opindex mno-flush-func
22652 Indicates that there is no OS function for flushing the cache.
22656 @node M680x0 Options
22657 @subsection M680x0 Options
22658 @cindex M680x0 options
22660 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
22661 The default settings depend on which architecture was selected when
22662 the compiler was configured; the defaults for the most common choices
22666 @item -march=@var{arch}
22668 Generate code for a specific M680x0 or ColdFire instruction set
22669 architecture. Permissible values of @var{arch} for M680x0
22670 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
22671 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
22672 architectures are selected according to Freescale's ISA classification
22673 and the permissible values are: @samp{isaa}, @samp{isaaplus},
22674 @samp{isab} and @samp{isac}.
22676 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
22677 code for a ColdFire target. The @var{arch} in this macro is one of the
22678 @option{-march} arguments given above.
22680 When used together, @option{-march} and @option{-mtune} select code
22681 that runs on a family of similar processors but that is optimized
22682 for a particular microarchitecture.
22684 @item -mcpu=@var{cpu}
22686 Generate code for a specific M680x0 or ColdFire processor.
22687 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
22688 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
22689 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
22690 below, which also classifies the CPUs into families:
22692 @multitable @columnfractions 0.20 0.80
22693 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
22694 @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}
22695 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
22696 @item @samp{5206e} @tab @samp{5206e}
22697 @item @samp{5208} @tab @samp{5207} @samp{5208}
22698 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
22699 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
22700 @item @samp{5216} @tab @samp{5214} @samp{5216}
22701 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
22702 @item @samp{5225} @tab @samp{5224} @samp{5225}
22703 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
22704 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
22705 @item @samp{5249} @tab @samp{5249}
22706 @item @samp{5250} @tab @samp{5250}
22707 @item @samp{5271} @tab @samp{5270} @samp{5271}
22708 @item @samp{5272} @tab @samp{5272}
22709 @item @samp{5275} @tab @samp{5274} @samp{5275}
22710 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
22711 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
22712 @item @samp{5307} @tab @samp{5307}
22713 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
22714 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
22715 @item @samp{5407} @tab @samp{5407}
22716 @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}
22719 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
22720 @var{arch} is compatible with @var{cpu}. Other combinations of
22721 @option{-mcpu} and @option{-march} are rejected.
22723 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
22724 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
22725 where the value of @var{family} is given by the table above.
22727 @item -mtune=@var{tune}
22729 Tune the code for a particular microarchitecture within the
22730 constraints set by @option{-march} and @option{-mcpu}.
22731 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
22732 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
22733 and @samp{cpu32}. The ColdFire microarchitectures
22734 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
22736 You can also use @option{-mtune=68020-40} for code that needs
22737 to run relatively well on 68020, 68030 and 68040 targets.
22738 @option{-mtune=68020-60} is similar but includes 68060 targets
22739 as well. These two options select the same tuning decisions as
22740 @option{-m68020-40} and @option{-m68020-60} respectively.
22742 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
22743 when tuning for 680x0 architecture @var{arch}. It also defines
22744 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
22745 option is used. If GCC is tuning for a range of architectures,
22746 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
22747 it defines the macros for every architecture in the range.
22749 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
22750 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
22751 of the arguments given above.
22757 Generate output for a 68000. This is the default
22758 when the compiler is configured for 68000-based systems.
22759 It is equivalent to @option{-march=68000}.
22761 Use this option for microcontrollers with a 68000 or EC000 core,
22762 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22766 Generate output for a 68010. This is the default
22767 when the compiler is configured for 68010-based systems.
22768 It is equivalent to @option{-march=68010}.
22774 Generate output for a 68020. This is the default
22775 when the compiler is configured for 68020-based systems.
22776 It is equivalent to @option{-march=68020}.
22780 Generate output for a 68030. This is the default when the compiler is
22781 configured for 68030-based systems. It is equivalent to
22782 @option{-march=68030}.
22786 Generate output for a 68040. This is the default when the compiler is
22787 configured for 68040-based systems. It is equivalent to
22788 @option{-march=68040}.
22790 This option inhibits the use of 68881/68882 instructions that have to be
22791 emulated by software on the 68040. Use this option if your 68040 does not
22792 have code to emulate those instructions.
22796 Generate output for a 68060. This is the default when the compiler is
22797 configured for 68060-based systems. It is equivalent to
22798 @option{-march=68060}.
22800 This option inhibits the use of 68020 and 68881/68882 instructions that
22801 have to be emulated by software on the 68060. Use this option if your 68060
22802 does not have code to emulate those instructions.
22806 Generate output for a CPU32. This is the default
22807 when the compiler is configured for CPU32-based systems.
22808 It is equivalent to @option{-march=cpu32}.
22810 Use this option for microcontrollers with a
22811 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
22812 68336, 68340, 68341, 68349 and 68360.
22816 Generate output for a 520X ColdFire CPU@. This is the default
22817 when the compiler is configured for 520X-based systems.
22818 It is equivalent to @option{-mcpu=5206}, and is now deprecated
22819 in favor of that option.
22821 Use this option for microcontroller with a 5200 core, including
22822 the MCF5202, MCF5203, MCF5204 and MCF5206.
22826 Generate output for a 5206e ColdFire CPU@. The option is now
22827 deprecated in favor of the equivalent @option{-mcpu=5206e}.
22831 Generate output for a member of the ColdFire 528X family.
22832 The option is now deprecated in favor of the equivalent
22833 @option{-mcpu=528x}.
22837 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
22838 in favor of the equivalent @option{-mcpu=5307}.
22842 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
22843 in favor of the equivalent @option{-mcpu=5407}.
22847 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
22848 This includes use of hardware floating-point instructions.
22849 The option is equivalent to @option{-mcpu=547x}, and is now
22850 deprecated in favor of that option.
22854 Generate output for a 68040, without using any of the new instructions.
22855 This results in code that can run relatively efficiently on either a
22856 68020/68881 or a 68030 or a 68040. The generated code does use the
22857 68881 instructions that are emulated on the 68040.
22859 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
22863 Generate output for a 68060, without using any of the new instructions.
22864 This results in code that can run relatively efficiently on either a
22865 68020/68881 or a 68030 or a 68040. The generated code does use the
22866 68881 instructions that are emulated on the 68060.
22868 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
22872 @opindex mhard-float
22874 Generate floating-point instructions. This is the default for 68020
22875 and above, and for ColdFire devices that have an FPU@. It defines the
22876 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
22877 on ColdFire targets.
22880 @opindex msoft-float
22881 Do not generate floating-point instructions; use library calls instead.
22882 This is the default for 68000, 68010, and 68832 targets. It is also
22883 the default for ColdFire devices that have no FPU.
22889 Generate (do not generate) ColdFire hardware divide and remainder
22890 instructions. If @option{-march} is used without @option{-mcpu},
22891 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
22892 architectures. Otherwise, the default is taken from the target CPU
22893 (either the default CPU, or the one specified by @option{-mcpu}). For
22894 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
22895 @option{-mcpu=5206e}.
22897 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
22901 Consider type @code{int} to be 16 bits wide, like @code{short int}.
22902 Additionally, parameters passed on the stack are also aligned to a
22903 16-bit boundary even on targets whose API mandates promotion to 32-bit.
22907 Do not consider type @code{int} to be 16 bits wide. This is the default.
22910 @itemx -mno-bitfield
22911 @opindex mnobitfield
22912 @opindex mno-bitfield
22913 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
22914 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
22918 Do use the bit-field instructions. The @option{-m68020} option implies
22919 @option{-mbitfield}. This is the default if you use a configuration
22920 designed for a 68020.
22924 Use a different function-calling convention, in which functions
22925 that take a fixed number of arguments return with the @code{rtd}
22926 instruction, which pops their arguments while returning. This
22927 saves one instruction in the caller since there is no need to pop
22928 the arguments there.
22930 This calling convention is incompatible with the one normally
22931 used on Unix, so you cannot use it if you need to call libraries
22932 compiled with the Unix compiler.
22934 Also, you must provide function prototypes for all functions that
22935 take variable numbers of arguments (including @code{printf});
22936 otherwise incorrect code is generated for calls to those
22939 In addition, seriously incorrect code results if you call a
22940 function with too many arguments. (Normally, extra arguments are
22941 harmlessly ignored.)
22943 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
22944 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22946 The default is @option{-mno-rtd}.
22949 @itemx -mno-align-int
22950 @opindex malign-int
22951 @opindex mno-align-int
22952 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
22953 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
22954 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
22955 Aligning variables on 32-bit boundaries produces code that runs somewhat
22956 faster on processors with 32-bit busses at the expense of more memory.
22958 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
22959 aligns structures containing the above types differently than
22960 most published application binary interface specifications for the m68k.
22963 Use the pc-relative addressing mode of the 68000 directly, instead of
22964 using a global offset table. At present, this option implies @option{-fpic},
22965 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
22966 not presently supported with @option{-mpcrel}, though this could be supported for
22967 68020 and higher processors.
22969 @item -mno-strict-align
22970 @itemx -mstrict-align
22971 @opindex mno-strict-align
22972 @opindex mstrict-align
22973 Do not (do) assume that unaligned memory references are handled by
22977 Generate code that allows the data segment to be located in a different
22978 area of memory from the text segment. This allows for execute-in-place in
22979 an environment without virtual memory management. This option implies
22982 @item -mno-sep-data
22983 Generate code that assumes that the data segment follows the text segment.
22984 This is the default.
22986 @item -mid-shared-library
22987 Generate code that supports shared libraries via the library ID method.
22988 This allows for execute-in-place and shared libraries in an environment
22989 without virtual memory management. This option implies @option{-fPIC}.
22991 @item -mno-id-shared-library
22992 Generate code that doesn't assume ID-based shared libraries are being used.
22993 This is the default.
22995 @item -mshared-library-id=n
22996 Specifies the identification number of the ID-based shared library being
22997 compiled. Specifying a value of 0 generates more compact code; specifying
22998 other values forces the allocation of that number to the current
22999 library, but is no more space- or time-efficient than omitting this option.
23005 When generating position-independent code for ColdFire, generate code
23006 that works if the GOT has more than 8192 entries. This code is
23007 larger and slower than code generated without this option. On M680x0
23008 processors, this option is not needed; @option{-fPIC} suffices.
23010 GCC normally uses a single instruction to load values from the GOT@.
23011 While this is relatively efficient, it only works if the GOT
23012 is smaller than about 64k. Anything larger causes the linker
23013 to report an error such as:
23015 @cindex relocation truncated to fit (ColdFire)
23017 relocation truncated to fit: R_68K_GOT16O foobar
23020 If this happens, you should recompile your code with @option{-mxgot}.
23021 It should then work with very large GOTs. However, code generated with
23022 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
23023 the value of a global symbol.
23025 Note that some linkers, including newer versions of the GNU linker,
23026 can create multiple GOTs and sort GOT entries. If you have such a linker,
23027 you should only need to use @option{-mxgot} when compiling a single
23028 object file that accesses more than 8192 GOT entries. Very few do.
23030 These options have no effect unless GCC is generating
23031 position-independent code.
23033 @item -mlong-jump-table-offsets
23034 @opindex mlong-jump-table-offsets
23035 Use 32-bit offsets in @code{switch} tables. The default is to use
23040 @node MCore Options
23041 @subsection MCore Options
23042 @cindex MCore options
23044 These are the @samp{-m} options defined for the Motorola M*Core
23050 @itemx -mno-hardlit
23052 @opindex mno-hardlit
23053 Inline constants into the code stream if it can be done in two
23054 instructions or less.
23060 Use the divide instruction. (Enabled by default).
23062 @item -mrelax-immediate
23063 @itemx -mno-relax-immediate
23064 @opindex mrelax-immediate
23065 @opindex mno-relax-immediate
23066 Allow arbitrary-sized immediates in bit operations.
23068 @item -mwide-bitfields
23069 @itemx -mno-wide-bitfields
23070 @opindex mwide-bitfields
23071 @opindex mno-wide-bitfields
23072 Always treat bit-fields as @code{int}-sized.
23074 @item -m4byte-functions
23075 @itemx -mno-4byte-functions
23076 @opindex m4byte-functions
23077 @opindex mno-4byte-functions
23078 Force all functions to be aligned to a 4-byte boundary.
23080 @item -mcallgraph-data
23081 @itemx -mno-callgraph-data
23082 @opindex mcallgraph-data
23083 @opindex mno-callgraph-data
23084 Emit callgraph information.
23087 @itemx -mno-slow-bytes
23088 @opindex mslow-bytes
23089 @opindex mno-slow-bytes
23090 Prefer word access when reading byte quantities.
23092 @item -mlittle-endian
23093 @itemx -mbig-endian
23094 @opindex mlittle-endian
23095 @opindex mbig-endian
23096 Generate code for a little-endian target.
23102 Generate code for the 210 processor.
23106 Assume that runtime support has been provided and so omit the
23107 simulator library (@file{libsim.a)} from the linker command line.
23109 @item -mstack-increment=@var{size}
23110 @opindex mstack-increment
23111 Set the maximum amount for a single stack increment operation. Large
23112 values can increase the speed of programs that contain functions
23113 that need a large amount of stack space, but they can also trigger a
23114 segmentation fault if the stack is extended too much. The default
23120 @subsection MeP Options
23121 @cindex MeP options
23127 Enables the @code{abs} instruction, which is the absolute difference
23128 between two registers.
23132 Enables all the optional instructions---average, multiply, divide, bit
23133 operations, leading zero, absolute difference, min/max, clip, and
23139 Enables the @code{ave} instruction, which computes the average of two
23142 @item -mbased=@var{n}
23144 Variables of size @var{n} bytes or smaller are placed in the
23145 @code{.based} section by default. Based variables use the @code{$tp}
23146 register as a base register, and there is a 128-byte limit to the
23147 @code{.based} section.
23151 Enables the bit operation instructions---bit test (@code{btstm}), set
23152 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
23153 test-and-set (@code{tas}).
23155 @item -mc=@var{name}
23157 Selects which section constant data is placed in. @var{name} may
23158 be @samp{tiny}, @samp{near}, or @samp{far}.
23162 Enables the @code{clip} instruction. Note that @option{-mclip} is not
23163 useful unless you also provide @option{-mminmax}.
23165 @item -mconfig=@var{name}
23167 Selects one of the built-in core configurations. Each MeP chip has
23168 one or more modules in it; each module has a core CPU and a variety of
23169 coprocessors, optional instructions, and peripherals. The
23170 @code{MeP-Integrator} tool, not part of GCC, provides these
23171 configurations through this option; using this option is the same as
23172 using all the corresponding command-line options. The default
23173 configuration is @samp{default}.
23177 Enables the coprocessor instructions. By default, this is a 32-bit
23178 coprocessor. Note that the coprocessor is normally enabled via the
23179 @option{-mconfig=} option.
23183 Enables the 32-bit coprocessor's instructions.
23187 Enables the 64-bit coprocessor's instructions.
23191 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
23195 Causes constant variables to be placed in the @code{.near} section.
23199 Enables the @code{div} and @code{divu} instructions.
23203 Generate big-endian code.
23207 Generate little-endian code.
23209 @item -mio-volatile
23210 @opindex mio-volatile
23211 Tells the compiler that any variable marked with the @code{io}
23212 attribute is to be considered volatile.
23216 Causes variables to be assigned to the @code{.far} section by default.
23220 Enables the @code{leadz} (leading zero) instruction.
23224 Causes variables to be assigned to the @code{.near} section by default.
23228 Enables the @code{min} and @code{max} instructions.
23232 Enables the multiplication and multiply-accumulate instructions.
23236 Disables all the optional instructions enabled by @option{-mall-opts}.
23240 Enables the @code{repeat} and @code{erepeat} instructions, used for
23241 low-overhead looping.
23245 Causes all variables to default to the @code{.tiny} section. Note
23246 that there is a 65536-byte limit to this section. Accesses to these
23247 variables use the @code{%gp} base register.
23251 Enables the saturation instructions. Note that the compiler does not
23252 currently generate these itself, but this option is included for
23253 compatibility with other tools, like @code{as}.
23257 Link the SDRAM-based runtime instead of the default ROM-based runtime.
23261 Link the simulator run-time libraries.
23265 Link the simulator runtime libraries, excluding built-in support
23266 for reset and exception vectors and tables.
23270 Causes all functions to default to the @code{.far} section. Without
23271 this option, functions default to the @code{.near} section.
23273 @item -mtiny=@var{n}
23275 Variables that are @var{n} bytes or smaller are allocated to the
23276 @code{.tiny} section. These variables use the @code{$gp} base
23277 register. The default for this option is 4, but note that there's a
23278 65536-byte limit to the @code{.tiny} section.
23282 @node MicroBlaze Options
23283 @subsection MicroBlaze Options
23284 @cindex MicroBlaze Options
23289 @opindex msoft-float
23290 Use software emulation for floating point (default).
23293 @opindex mhard-float
23294 Use hardware floating-point instructions.
23298 Do not optimize block moves, use @code{memcpy}.
23300 @item -mno-clearbss
23301 @opindex mno-clearbss
23302 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
23304 @item -mcpu=@var{cpu-type}
23306 Use features of, and schedule code for, the given CPU.
23307 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
23308 where @var{X} is a major version, @var{YY} is the minor version, and
23309 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
23310 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
23312 @item -mxl-soft-mul
23313 @opindex mxl-soft-mul
23314 Use software multiply emulation (default).
23316 @item -mxl-soft-div
23317 @opindex mxl-soft-div
23318 Use software emulation for divides (default).
23320 @item -mxl-barrel-shift
23321 @opindex mxl-barrel-shift
23322 Use the hardware barrel shifter.
23324 @item -mxl-pattern-compare
23325 @opindex mxl-pattern-compare
23326 Use pattern compare instructions.
23328 @item -msmall-divides
23329 @opindex msmall-divides
23330 Use table lookup optimization for small signed integer divisions.
23332 @item -mxl-stack-check
23333 @opindex mxl-stack-check
23334 This option is deprecated. Use @option{-fstack-check} instead.
23337 @opindex mxl-gp-opt
23338 Use GP-relative @code{.sdata}/@code{.sbss} sections.
23340 @item -mxl-multiply-high
23341 @opindex mxl-multiply-high
23342 Use multiply high instructions for high part of 32x32 multiply.
23344 @item -mxl-float-convert
23345 @opindex mxl-float-convert
23346 Use hardware floating-point conversion instructions.
23348 @item -mxl-float-sqrt
23349 @opindex mxl-float-sqrt
23350 Use hardware floating-point square root instruction.
23353 @opindex mbig-endian
23354 Generate code for a big-endian target.
23356 @item -mlittle-endian
23357 @opindex mlittle-endian
23358 Generate code for a little-endian target.
23361 @opindex mxl-reorder
23362 Use reorder instructions (swap and byte reversed load/store).
23364 @item -mxl-mode-@var{app-model}
23365 Select application model @var{app-model}. Valid models are
23368 normal executable (default), uses startup code @file{crt0.o}.
23370 @item -mpic-data-is-text-relative
23371 @opindex mpic-data-is-text-relative
23372 Assume that the displacement between the text and data segments is fixed
23373 at static link time. This allows data to be referenced by offset from start of
23374 text address instead of GOT since PC-relative addressing is not supported.
23377 for use with Xilinx Microprocessor Debugger (XMD) based
23378 software intrusive debug agent called xmdstub. This uses startup file
23379 @file{crt1.o} and sets the start address of the program to 0x800.
23382 for applications that are loaded using a bootloader.
23383 This model uses startup file @file{crt2.o} which does not contain a processor
23384 reset vector handler. This is suitable for transferring control on a
23385 processor reset to the bootloader rather than the application.
23388 for applications that do not require any of the
23389 MicroBlaze vectors. This option may be useful for applications running
23390 within a monitoring application. This model uses @file{crt3.o} as a startup file.
23393 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
23394 @option{-mxl-mode-@var{app-model}}.
23399 @subsection MIPS Options
23400 @cindex MIPS options
23406 Generate big-endian code.
23410 Generate little-endian code. This is the default for @samp{mips*el-*-*}
23413 @item -march=@var{arch}
23415 Generate code that runs on @var{arch}, which can be the name of a
23416 generic MIPS ISA, or the name of a particular processor.
23418 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
23419 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
23420 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
23421 @samp{mips64r5} and @samp{mips64r6}.
23422 The processor names are:
23423 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
23424 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
23425 @samp{5kc}, @samp{5kf},
23427 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
23428 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
23429 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
23430 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
23431 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
23432 @samp{i6400}, @samp{i6500},
23434 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
23435 @samp{gs464e}, @samp{gs264e},
23437 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
23438 @samp{m5100}, @samp{m5101},
23439 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
23441 @samp{p5600}, @samp{p6600},
23442 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
23443 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
23444 @samp{r6000}, @samp{r8000},
23445 @samp{rm7000}, @samp{rm9000},
23446 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
23449 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
23450 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
23451 @samp{xlr} and @samp{xlp}.
23452 The special value @samp{from-abi} selects the
23453 most compatible architecture for the selected ABI (that is,
23454 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
23456 The native Linux/GNU toolchain also supports the value @samp{native},
23457 which selects the best architecture option for the host processor.
23458 @option{-march=native} has no effect if GCC does not recognize
23461 In processor names, a final @samp{000} can be abbreviated as @samp{k}
23462 (for example, @option{-march=r2k}). Prefixes are optional, and
23463 @samp{vr} may be written @samp{r}.
23465 Names of the form @samp{@var{n}f2_1} refer to processors with
23466 FPUs clocked at half the rate of the core, names of the form
23467 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
23468 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
23469 processors with FPUs clocked a ratio of 3:2 with respect to the core.
23470 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
23471 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
23472 accepted as synonyms for @samp{@var{n}f1_1}.
23474 GCC defines two macros based on the value of this option. The first
23475 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
23476 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
23477 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
23478 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
23479 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
23481 Note that the @code{_MIPS_ARCH} macro uses the processor names given
23482 above. In other words, it has the full prefix and does not
23483 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
23484 the macro names the resolved architecture (either @code{"mips1"} or
23485 @code{"mips3"}). It names the default architecture when no
23486 @option{-march} option is given.
23488 @item -mtune=@var{arch}
23490 Optimize for @var{arch}. Among other things, this option controls
23491 the way instructions are scheduled, and the perceived cost of arithmetic
23492 operations. The list of @var{arch} values is the same as for
23495 When this option is not used, GCC optimizes for the processor
23496 specified by @option{-march}. By using @option{-march} and
23497 @option{-mtune} together, it is possible to generate code that
23498 runs on a family of processors, but optimize the code for one
23499 particular member of that family.
23501 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
23502 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
23503 @option{-march} ones described above.
23507 Equivalent to @option{-march=mips1}.
23511 Equivalent to @option{-march=mips2}.
23515 Equivalent to @option{-march=mips3}.
23519 Equivalent to @option{-march=mips4}.
23523 Equivalent to @option{-march=mips32}.
23527 Equivalent to @option{-march=mips32r3}.
23531 Equivalent to @option{-march=mips32r5}.
23535 Equivalent to @option{-march=mips32r6}.
23539 Equivalent to @option{-march=mips64}.
23543 Equivalent to @option{-march=mips64r2}.
23547 Equivalent to @option{-march=mips64r3}.
23551 Equivalent to @option{-march=mips64r5}.
23555 Equivalent to @option{-march=mips64r6}.
23560 @opindex mno-mips16
23561 Generate (do not generate) MIPS16 code. If GCC is targeting a
23562 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
23564 MIPS16 code generation can also be controlled on a per-function basis
23565 by means of @code{mips16} and @code{nomips16} attributes.
23566 @xref{Function Attributes}, for more information.
23568 @item -mflip-mips16
23569 @opindex mflip-mips16
23570 Generate MIPS16 code on alternating functions. This option is provided
23571 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
23572 not intended for ordinary use in compiling user code.
23574 @item -minterlink-compressed
23575 @itemx -mno-interlink-compressed
23576 @opindex minterlink-compressed
23577 @opindex mno-interlink-compressed
23578 Require (do not require) that code using the standard (uncompressed) MIPS ISA
23579 be link-compatible with MIPS16 and microMIPS code, and vice versa.
23581 For example, code using the standard ISA encoding cannot jump directly
23582 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
23583 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
23584 knows that the target of the jump is not compressed.
23586 @item -minterlink-mips16
23587 @itemx -mno-interlink-mips16
23588 @opindex minterlink-mips16
23589 @opindex mno-interlink-mips16
23590 Aliases of @option{-minterlink-compressed} and
23591 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
23592 and are retained for backwards compatibility.
23604 Generate code for the given ABI@.
23606 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23607 generates 64-bit code when you select a 64-bit architecture, but you
23608 can use @option{-mgp32} to get 32-bit code instead.
23610 For information about the O64 ABI, see
23611 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
23613 GCC supports a variant of the o32 ABI in which floating-point registers
23614 are 64 rather than 32 bits wide. You can select this combination with
23615 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
23616 and @code{mfhc1} instructions and is therefore only supported for
23617 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23619 The register assignments for arguments and return values remain the
23620 same, but each scalar value is passed in a single 64-bit register
23621 rather than a pair of 32-bit registers. For example, scalar
23622 floating-point values are returned in @samp{$f0} only, not a
23623 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
23624 remains the same in that the even-numbered double-precision registers
23627 Two additional variants of the o32 ABI are supported to enable
23628 a transition from 32-bit to 64-bit registers. These are FPXX
23629 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
23630 The FPXX extension mandates that all code must execute correctly
23631 when run using 32-bit or 64-bit registers. The code can be interlinked
23632 with either FP32 or FP64, but not both.
23633 The FP64A extension is similar to the FP64 extension but forbids the
23634 use of odd-numbered single-precision registers. This can be used
23635 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
23636 processors and allows both FP32 and FP64A code to interlink and
23637 run in the same process without changing FPU modes.
23640 @itemx -mno-abicalls
23642 @opindex mno-abicalls
23643 Generate (do not generate) code that is suitable for SVR4-style
23644 dynamic objects. @option{-mabicalls} is the default for SVR4-based
23649 Generate (do not generate) code that is fully position-independent,
23650 and that can therefore be linked into shared libraries. This option
23651 only affects @option{-mabicalls}.
23653 All @option{-mabicalls} code has traditionally been position-independent,
23654 regardless of options like @option{-fPIC} and @option{-fpic}. However,
23655 as an extension, the GNU toolchain allows executables to use absolute
23656 accesses for locally-binding symbols. It can also use shorter GP
23657 initialization sequences and generate direct calls to locally-defined
23658 functions. This mode is selected by @option{-mno-shared}.
23660 @option{-mno-shared} depends on binutils 2.16 or higher and generates
23661 objects that can only be linked by the GNU linker. However, the option
23662 does not affect the ABI of the final executable; it only affects the ABI
23663 of relocatable objects. Using @option{-mno-shared} generally makes
23664 executables both smaller and quicker.
23666 @option{-mshared} is the default.
23672 Assume (do not assume) that the static and dynamic linkers
23673 support PLTs and copy relocations. This option only affects
23674 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
23675 has no effect without @option{-msym32}.
23677 You can make @option{-mplt} the default by configuring
23678 GCC with @option{--with-mips-plt}. The default is
23679 @option{-mno-plt} otherwise.
23685 Lift (do not lift) the usual restrictions on the size of the global
23688 GCC normally uses a single instruction to load values from the GOT@.
23689 While this is relatively efficient, it only works if the GOT
23690 is smaller than about 64k. Anything larger causes the linker
23691 to report an error such as:
23693 @cindex relocation truncated to fit (MIPS)
23695 relocation truncated to fit: R_MIPS_GOT16 foobar
23698 If this happens, you should recompile your code with @option{-mxgot}.
23699 This works with very large GOTs, although the code is also
23700 less efficient, since it takes three instructions to fetch the
23701 value of a global symbol.
23703 Note that some linkers can create multiple GOTs. If you have such a
23704 linker, you should only need to use @option{-mxgot} when a single object
23705 file accesses more than 64k's worth of GOT entries. Very few do.
23707 These options have no effect unless GCC is generating position
23712 Assume that general-purpose registers are 32 bits wide.
23716 Assume that general-purpose registers are 64 bits wide.
23720 Assume that floating-point registers are 32 bits wide.
23724 Assume that floating-point registers are 64 bits wide.
23728 Do not assume the width of floating-point registers.
23731 @opindex mhard-float
23732 Use floating-point coprocessor instructions.
23735 @opindex msoft-float
23736 Do not use floating-point coprocessor instructions. Implement
23737 floating-point calculations using library calls instead.
23741 Equivalent to @option{-msoft-float}, but additionally asserts that the
23742 program being compiled does not perform any floating-point operations.
23743 This option is presently supported only by some bare-metal MIPS
23744 configurations, where it may select a special set of libraries
23745 that lack all floating-point support (including, for example, the
23746 floating-point @code{printf} formats).
23747 If code compiled with @option{-mno-float} accidentally contains
23748 floating-point operations, it is likely to suffer a link-time
23749 or run-time failure.
23751 @item -msingle-float
23752 @opindex msingle-float
23753 Assume that the floating-point coprocessor only supports single-precision
23756 @item -mdouble-float
23757 @opindex mdouble-float
23758 Assume that the floating-point coprocessor supports double-precision
23759 operations. This is the default.
23762 @itemx -mno-odd-spreg
23763 @opindex modd-spreg
23764 @opindex mno-odd-spreg
23765 Enable the use of odd-numbered single-precision floating-point registers
23766 for the o32 ABI. This is the default for processors that are known to
23767 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
23771 @itemx -mabs=legacy
23773 @opindex mabs=legacy
23774 These options control the treatment of the special not-a-number (NaN)
23775 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
23776 @code{neg.@i{fmt}} machine instructions.
23778 By default or when @option{-mabs=legacy} is used the legacy
23779 treatment is selected. In this case these instructions are considered
23780 arithmetic and avoided where correct operation is required and the
23781 input operand might be a NaN. A longer sequence of instructions that
23782 manipulate the sign bit of floating-point datum manually is used
23783 instead unless the @option{-ffinite-math-only} option has also been
23786 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
23787 this case these instructions are considered non-arithmetic and therefore
23788 operating correctly in all cases, including in particular where the
23789 input operand is a NaN. These instructions are therefore always used
23790 for the respective operations.
23793 @itemx -mnan=legacy
23795 @opindex mnan=legacy
23796 These options control the encoding of the special not-a-number (NaN)
23797 IEEE 754 floating-point data.
23799 The @option{-mnan=legacy} option selects the legacy encoding. In this
23800 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23801 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
23802 by the first bit of their trailing significand field being 1.
23804 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
23805 this case qNaNs are denoted by the first bit of their trailing
23806 significand field being 1, whereas sNaNs are denoted by the first bit of
23807 their trailing significand field being 0.
23809 The default is @option{-mnan=legacy} unless GCC has been configured with
23810 @option{--with-nan=2008}.
23816 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
23817 implement atomic memory built-in functions. When neither option is
23818 specified, GCC uses the instructions if the target architecture
23821 @option{-mllsc} is useful if the runtime environment can emulate the
23822 instructions and @option{-mno-llsc} can be useful when compiling for
23823 nonstandard ISAs. You can make either option the default by
23824 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
23825 respectively. @option{--with-llsc} is the default for some
23826 configurations; see the installation documentation for details.
23832 Use (do not use) revision 1 of the MIPS DSP ASE@.
23833 @xref{MIPS DSP Built-in Functions}. This option defines the
23834 preprocessor macro @code{__mips_dsp}. It also defines
23835 @code{__mips_dsp_rev} to 1.
23841 Use (do not use) revision 2 of the MIPS DSP ASE@.
23842 @xref{MIPS DSP Built-in Functions}. This option defines the
23843 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
23844 It also defines @code{__mips_dsp_rev} to 2.
23847 @itemx -mno-smartmips
23848 @opindex msmartmips
23849 @opindex mno-smartmips
23850 Use (do not use) the MIPS SmartMIPS ASE.
23852 @item -mpaired-single
23853 @itemx -mno-paired-single
23854 @opindex mpaired-single
23855 @opindex mno-paired-single
23856 Use (do not use) paired-single floating-point instructions.
23857 @xref{MIPS Paired-Single Support}. This option requires
23858 hardware floating-point support to be enabled.
23864 Use (do not use) MIPS Digital Media Extension instructions.
23865 This option can only be used when generating 64-bit code and requires
23866 hardware floating-point support to be enabled.
23871 @opindex mno-mips3d
23872 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
23873 The option @option{-mips3d} implies @option{-mpaired-single}.
23876 @itemx -mno-micromips
23877 @opindex mmicromips
23878 @opindex mno-mmicromips
23879 Generate (do not generate) microMIPS code.
23881 MicroMIPS code generation can also be controlled on a per-function basis
23882 by means of @code{micromips} and @code{nomicromips} attributes.
23883 @xref{Function Attributes}, for more information.
23889 Use (do not use) MT Multithreading instructions.
23895 Use (do not use) the MIPS MCU ASE instructions.
23901 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23907 Use (do not use) the MIPS Virtualization (VZ) instructions.
23913 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
23919 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
23925 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23927 @item -mloongson-mmi
23928 @itemx -mno-loongson-mmi
23929 @opindex mloongson-mmi
23930 @opindex mno-loongson-mmi
23931 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
23933 @item -mloongson-ext
23934 @itemx -mno-loongson-ext
23935 @opindex mloongson-ext
23936 @opindex mno-loongson-ext
23937 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23939 @item -mloongson-ext2
23940 @itemx -mno-loongson-ext2
23941 @opindex mloongson-ext2
23942 @opindex mno-loongson-ext2
23943 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
23947 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
23948 an explanation of the default and the way that the pointer size is
23953 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
23955 The default size of @code{int}s, @code{long}s and pointers depends on
23956 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
23957 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
23958 32-bit @code{long}s. Pointers are the same size as @code{long}s,
23959 or the same size as integer registers, whichever is smaller.
23965 Assume (do not assume) that all symbols have 32-bit values, regardless
23966 of the selected ABI@. This option is useful in combination with
23967 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
23968 to generate shorter and faster references to symbolic addresses.
23972 Put definitions of externally-visible data in a small data section
23973 if that data is no bigger than @var{num} bytes. GCC can then generate
23974 more efficient accesses to the data; see @option{-mgpopt} for details.
23976 The default @option{-G} option depends on the configuration.
23978 @item -mlocal-sdata
23979 @itemx -mno-local-sdata
23980 @opindex mlocal-sdata
23981 @opindex mno-local-sdata
23982 Extend (do not extend) the @option{-G} behavior to local data too,
23983 such as to static variables in C@. @option{-mlocal-sdata} is the
23984 default for all configurations.
23986 If the linker complains that an application is using too much small data,
23987 you might want to try rebuilding the less performance-critical parts with
23988 @option{-mno-local-sdata}. You might also want to build large
23989 libraries with @option{-mno-local-sdata}, so that the libraries leave
23990 more room for the main program.
23992 @item -mextern-sdata
23993 @itemx -mno-extern-sdata
23994 @opindex mextern-sdata
23995 @opindex mno-extern-sdata
23996 Assume (do not assume) that externally-defined data is in
23997 a small data section if the size of that data is within the @option{-G} limit.
23998 @option{-mextern-sdata} is the default for all configurations.
24000 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
24001 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
24002 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
24003 is placed in a small data section. If @var{Var} is defined by another
24004 module, you must either compile that module with a high-enough
24005 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
24006 definition. If @var{Var} is common, you must link the application
24007 with a high-enough @option{-G} setting.
24009 The easiest way of satisfying these restrictions is to compile
24010 and link every module with the same @option{-G} option. However,
24011 you may wish to build a library that supports several different
24012 small data limits. You can do this by compiling the library with
24013 the highest supported @option{-G} setting and additionally using
24014 @option{-mno-extern-sdata} to stop the library from making assumptions
24015 about externally-defined data.
24021 Use (do not use) GP-relative accesses for symbols that are known to be
24022 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
24023 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
24026 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
24027 might not hold the value of @code{_gp}. For example, if the code is
24028 part of a library that might be used in a boot monitor, programs that
24029 call boot monitor routines pass an unknown value in @code{$gp}.
24030 (In such situations, the boot monitor itself is usually compiled
24031 with @option{-G0}.)
24033 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
24034 @option{-mno-extern-sdata}.
24036 @item -membedded-data
24037 @itemx -mno-embedded-data
24038 @opindex membedded-data
24039 @opindex mno-embedded-data
24040 Allocate variables to the read-only data section first if possible, then
24041 next in the small data section if possible, otherwise in data. This gives
24042 slightly slower code than the default, but reduces the amount of RAM required
24043 when executing, and thus may be preferred for some embedded systems.
24045 @item -muninit-const-in-rodata
24046 @itemx -mno-uninit-const-in-rodata
24047 @opindex muninit-const-in-rodata
24048 @opindex mno-uninit-const-in-rodata
24049 Put uninitialized @code{const} variables in the read-only data section.
24050 This option is only meaningful in conjunction with @option{-membedded-data}.
24052 @item -mcode-readable=@var{setting}
24053 @opindex mcode-readable
24054 Specify whether GCC may generate code that reads from executable sections.
24055 There are three possible settings:
24058 @item -mcode-readable=yes
24059 Instructions may freely access executable sections. This is the
24062 @item -mcode-readable=pcrel
24063 MIPS16 PC-relative load instructions can access executable sections,
24064 but other instructions must not do so. This option is useful on 4KSc
24065 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
24066 It is also useful on processors that can be configured to have a dual
24067 instruction/data SRAM interface and that, like the M4K, automatically
24068 redirect PC-relative loads to the instruction RAM.
24070 @item -mcode-readable=no
24071 Instructions must not access executable sections. This option can be
24072 useful on targets that are configured to have a dual instruction/data
24073 SRAM interface but that (unlike the M4K) do not automatically redirect
24074 PC-relative loads to the instruction RAM.
24077 @item -msplit-addresses
24078 @itemx -mno-split-addresses
24079 @opindex msplit-addresses
24080 @opindex mno-split-addresses
24081 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
24082 relocation operators. This option has been superseded by
24083 @option{-mexplicit-relocs} but is retained for backwards compatibility.
24085 @item -mexplicit-relocs
24086 @itemx -mno-explicit-relocs
24087 @opindex mexplicit-relocs
24088 @opindex mno-explicit-relocs
24089 Use (do not use) assembler relocation operators when dealing with symbolic
24090 addresses. The alternative, selected by @option{-mno-explicit-relocs},
24091 is to use assembler macros instead.
24093 @option{-mexplicit-relocs} is the default if GCC was configured
24094 to use an assembler that supports relocation operators.
24096 @item -mcheck-zero-division
24097 @itemx -mno-check-zero-division
24098 @opindex mcheck-zero-division
24099 @opindex mno-check-zero-division
24100 Trap (do not trap) on integer division by zero.
24102 The default is @option{-mcheck-zero-division}.
24104 @item -mdivide-traps
24105 @itemx -mdivide-breaks
24106 @opindex mdivide-traps
24107 @opindex mdivide-breaks
24108 MIPS systems check for division by zero by generating either a
24109 conditional trap or a break instruction. Using traps results in
24110 smaller code, but is only supported on MIPS II and later. Also, some
24111 versions of the Linux kernel have a bug that prevents trap from
24112 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
24113 allow conditional traps on architectures that support them and
24114 @option{-mdivide-breaks} to force the use of breaks.
24116 The default is usually @option{-mdivide-traps}, but this can be
24117 overridden at configure time using @option{--with-divide=breaks}.
24118 Divide-by-zero checks can be completely disabled using
24119 @option{-mno-check-zero-division}.
24121 @item -mload-store-pairs
24122 @itemx -mno-load-store-pairs
24123 @opindex mload-store-pairs
24124 @opindex mno-load-store-pairs
24125 Enable (disable) an optimization that pairs consecutive load or store
24126 instructions to enable load/store bonding. This option is enabled by
24127 default but only takes effect when the selected architecture is known
24128 to support bonding.
24133 @opindex mno-memcpy
24134 Force (do not force) the use of @code{memcpy} for non-trivial block
24135 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
24136 most constant-sized copies.
24139 @itemx -mno-long-calls
24140 @opindex mlong-calls
24141 @opindex mno-long-calls
24142 Disable (do not disable) use of the @code{jal} instruction. Calling
24143 functions using @code{jal} is more efficient but requires the caller
24144 and callee to be in the same 256 megabyte segment.
24146 This option has no effect on abicalls code. The default is
24147 @option{-mno-long-calls}.
24153 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
24154 instructions, as provided by the R4650 ISA@.
24160 Enable (disable) use of the @code{madd} and @code{msub} integer
24161 instructions. The default is @option{-mimadd} on architectures
24162 that support @code{madd} and @code{msub} except for the 74k
24163 architecture where it was found to generate slower code.
24166 @itemx -mno-fused-madd
24167 @opindex mfused-madd
24168 @opindex mno-fused-madd
24169 Enable (disable) use of the floating-point multiply-accumulate
24170 instructions, when they are available. The default is
24171 @option{-mfused-madd}.
24173 On the R8000 CPU when multiply-accumulate instructions are used,
24174 the intermediate product is calculated to infinite precision
24175 and is not subject to the FCSR Flush to Zero bit. This may be
24176 undesirable in some circumstances. On other processors the result
24177 is numerically identical to the equivalent computation using
24178 separate multiply, add, subtract and negate instructions.
24182 Tell the MIPS assembler to not run its preprocessor over user
24183 assembler files (with a @samp{.s} suffix) when assembling them.
24186 @itemx -mno-fix-24k
24188 @opindex mno-fix-24k
24189 Work around the 24K E48 (lost data on stores during refill) errata.
24190 The workarounds are implemented by the assembler rather than by GCC@.
24193 @itemx -mno-fix-r4000
24194 @opindex mfix-r4000
24195 @opindex mno-fix-r4000
24196 Work around certain R4000 CPU errata:
24199 A double-word or a variable shift may give an incorrect result if executed
24200 immediately after starting an integer division.
24202 A double-word or a variable shift may give an incorrect result if executed
24203 while an integer multiplication is in progress.
24205 An integer division may give an incorrect result if started in a delay slot
24206 of a taken branch or a jump.
24210 @itemx -mno-fix-r4400
24211 @opindex mfix-r4400
24212 @opindex mno-fix-r4400
24213 Work around certain R4400 CPU errata:
24216 A double-word or a variable shift may give an incorrect result if executed
24217 immediately after starting an integer division.
24221 @itemx -mno-fix-r10000
24222 @opindex mfix-r10000
24223 @opindex mno-fix-r10000
24224 Work around certain R10000 errata:
24227 @code{ll}/@code{sc} sequences may not behave atomically on revisions
24228 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
24231 This option can only be used if the target architecture supports
24232 branch-likely instructions. @option{-mfix-r10000} is the default when
24233 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
24237 @itemx -mno-fix-r5900
24238 @opindex mfix-r5900
24239 Do not attempt to schedule the preceding instruction into the delay slot
24240 of a branch instruction placed at the end of a short loop of six
24241 instructions or fewer and always schedule a @code{nop} instruction there
24242 instead. The short loop bug under certain conditions causes loops to
24243 execute only once or twice, due to a hardware bug in the R5900 chip. The
24244 workaround is implemented by the assembler rather than by GCC@.
24247 @itemx -mno-fix-rm7000
24248 @opindex mfix-rm7000
24249 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
24250 workarounds are implemented by the assembler rather than by GCC@.
24253 @itemx -mno-fix-vr4120
24254 @opindex mfix-vr4120
24255 Work around certain VR4120 errata:
24258 @code{dmultu} does not always produce the correct result.
24260 @code{div} and @code{ddiv} do not always produce the correct result if one
24261 of the operands is negative.
24263 The workarounds for the division errata rely on special functions in
24264 @file{libgcc.a}. At present, these functions are only provided by
24265 the @code{mips64vr*-elf} configurations.
24267 Other VR4120 errata require a NOP to be inserted between certain pairs of
24268 instructions. These errata are handled by the assembler, not by GCC itself.
24271 @opindex mfix-vr4130
24272 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
24273 workarounds are implemented by the assembler rather than by GCC,
24274 although GCC avoids using @code{mflo} and @code{mfhi} if the
24275 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
24276 instructions are available instead.
24279 @itemx -mno-fix-sb1
24281 Work around certain SB-1 CPU core errata.
24282 (This flag currently works around the SB-1 revision 2
24283 ``F1'' and ``F2'' floating-point errata.)
24285 @item -mr10k-cache-barrier=@var{setting}
24286 @opindex mr10k-cache-barrier
24287 Specify whether GCC should insert cache barriers to avoid the
24288 side effects of speculation on R10K processors.
24290 In common with many processors, the R10K tries to predict the outcome
24291 of a conditional branch and speculatively executes instructions from
24292 the ``taken'' branch. It later aborts these instructions if the
24293 predicted outcome is wrong. However, on the R10K, even aborted
24294 instructions can have side effects.
24296 This problem only affects kernel stores and, depending on the system,
24297 kernel loads. As an example, a speculatively-executed store may load
24298 the target memory into cache and mark the cache line as dirty, even if
24299 the store itself is later aborted. If a DMA operation writes to the
24300 same area of memory before the ``dirty'' line is flushed, the cached
24301 data overwrites the DMA-ed data. See the R10K processor manual
24302 for a full description, including other potential problems.
24304 One workaround is to insert cache barrier instructions before every memory
24305 access that might be speculatively executed and that might have side
24306 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
24307 controls GCC's implementation of this workaround. It assumes that
24308 aborted accesses to any byte in the following regions does not have
24313 the memory occupied by the current function's stack frame;
24316 the memory occupied by an incoming stack argument;
24319 the memory occupied by an object with a link-time-constant address.
24322 It is the kernel's responsibility to ensure that speculative
24323 accesses to these regions are indeed safe.
24325 If the input program contains a function declaration such as:
24331 then the implementation of @code{foo} must allow @code{j foo} and
24332 @code{jal foo} to be executed speculatively. GCC honors this
24333 restriction for functions it compiles itself. It expects non-GCC
24334 functions (such as hand-written assembly code) to do the same.
24336 The option has three forms:
24339 @item -mr10k-cache-barrier=load-store
24340 Insert a cache barrier before a load or store that might be
24341 speculatively executed and that might have side effects even
24344 @item -mr10k-cache-barrier=store
24345 Insert a cache barrier before a store that might be speculatively
24346 executed and that might have side effects even if aborted.
24348 @item -mr10k-cache-barrier=none
24349 Disable the insertion of cache barriers. This is the default setting.
24352 @item -mflush-func=@var{func}
24353 @itemx -mno-flush-func
24354 @opindex mflush-func
24355 Specifies the function to call to flush the I and D caches, or to not
24356 call any such function. If called, the function must take the same
24357 arguments as the common @code{_flush_func}, that is, the address of the
24358 memory range for which the cache is being flushed, the size of the
24359 memory range, and the number 3 (to flush both caches). The default
24360 depends on the target GCC was configured for, but commonly is either
24361 @code{_flush_func} or @code{__cpu_flush}.
24363 @item mbranch-cost=@var{num}
24364 @opindex mbranch-cost
24365 Set the cost of branches to roughly @var{num} ``simple'' instructions.
24366 This cost is only a heuristic and is not guaranteed to produce
24367 consistent results across releases. A zero cost redundantly selects
24368 the default, which is based on the @option{-mtune} setting.
24370 @item -mbranch-likely
24371 @itemx -mno-branch-likely
24372 @opindex mbranch-likely
24373 @opindex mno-branch-likely
24374 Enable or disable use of Branch Likely instructions, regardless of the
24375 default for the selected architecture. By default, Branch Likely
24376 instructions may be generated if they are supported by the selected
24377 architecture. An exception is for the MIPS32 and MIPS64 architectures
24378 and processors that implement those architectures; for those, Branch
24379 Likely instructions are not be generated by default because the MIPS32
24380 and MIPS64 architectures specifically deprecate their use.
24382 @item -mcompact-branches=never
24383 @itemx -mcompact-branches=optimal
24384 @itemx -mcompact-branches=always
24385 @opindex mcompact-branches=never
24386 @opindex mcompact-branches=optimal
24387 @opindex mcompact-branches=always
24388 These options control which form of branches will be generated. The
24389 default is @option{-mcompact-branches=optimal}.
24391 The @option{-mcompact-branches=never} option ensures that compact branch
24392 instructions will never be generated.
24394 The @option{-mcompact-branches=always} option ensures that a compact
24395 branch instruction will be generated if available. If a compact branch
24396 instruction is not available, a delay slot form of the branch will be
24399 This option is supported from MIPS Release 6 onwards.
24401 The @option{-mcompact-branches=optimal} option will cause a delay slot
24402 branch to be used if one is available in the current ISA and the delay
24403 slot is successfully filled. If the delay slot is not filled, a compact
24404 branch will be chosen if one is available.
24406 @item -mfp-exceptions
24407 @itemx -mno-fp-exceptions
24408 @opindex mfp-exceptions
24409 Specifies whether FP exceptions are enabled. This affects how
24410 FP instructions are scheduled for some processors.
24411 The default is that FP exceptions are
24414 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
24415 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
24418 @item -mvr4130-align
24419 @itemx -mno-vr4130-align
24420 @opindex mvr4130-align
24421 The VR4130 pipeline is two-way superscalar, but can only issue two
24422 instructions together if the first one is 8-byte aligned. When this
24423 option is enabled, GCC aligns pairs of instructions that it
24424 thinks should execute in parallel.
24426 This option only has an effect when optimizing for the VR4130.
24427 It normally makes code faster, but at the expense of making it bigger.
24428 It is enabled by default at optimization level @option{-O3}.
24433 Enable (disable) generation of @code{synci} instructions on
24434 architectures that support it. The @code{synci} instructions (if
24435 enabled) are generated when @code{__builtin___clear_cache} is
24438 This option defaults to @option{-mno-synci}, but the default can be
24439 overridden by configuring GCC with @option{--with-synci}.
24441 When compiling code for single processor systems, it is generally safe
24442 to use @code{synci}. However, on many multi-core (SMP) systems, it
24443 does not invalidate the instruction caches on all cores and may lead
24444 to undefined behavior.
24446 @item -mrelax-pic-calls
24447 @itemx -mno-relax-pic-calls
24448 @opindex mrelax-pic-calls
24449 Try to turn PIC calls that are normally dispatched via register
24450 @code{$25} into direct calls. This is only possible if the linker can
24451 resolve the destination at link time and if the destination is within
24452 range for a direct call.
24454 @option{-mrelax-pic-calls} is the default if GCC was configured to use
24455 an assembler and a linker that support the @code{.reloc} assembly
24456 directive and @option{-mexplicit-relocs} is in effect. With
24457 @option{-mno-explicit-relocs}, this optimization can be performed by the
24458 assembler and the linker alone without help from the compiler.
24460 @item -mmcount-ra-address
24461 @itemx -mno-mcount-ra-address
24462 @opindex mmcount-ra-address
24463 @opindex mno-mcount-ra-address
24464 Emit (do not emit) code that allows @code{_mcount} to modify the
24465 calling function's return address. When enabled, this option extends
24466 the usual @code{_mcount} interface with a new @var{ra-address}
24467 parameter, which has type @code{intptr_t *} and is passed in register
24468 @code{$12}. @code{_mcount} can then modify the return address by
24469 doing both of the following:
24472 Returning the new address in register @code{$31}.
24474 Storing the new address in @code{*@var{ra-address}},
24475 if @var{ra-address} is nonnull.
24478 The default is @option{-mno-mcount-ra-address}.
24480 @item -mframe-header-opt
24481 @itemx -mno-frame-header-opt
24482 @opindex mframe-header-opt
24483 Enable (disable) frame header optimization in the o32 ABI. When using the
24484 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
24485 function to write out register arguments. When enabled, this optimization
24486 will suppress the allocation of the frame header if it can be determined that
24489 This optimization is off by default at all optimization levels.
24492 @itemx -mno-lxc1-sxc1
24493 @opindex mlxc1-sxc1
24494 When applicable, enable (disable) the generation of @code{lwxc1},
24495 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
24500 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
24501 @code{madd.d} and related instructions. Enabled by default.
24506 @subsection MMIX Options
24507 @cindex MMIX Options
24509 These options are defined for the MMIX:
24513 @itemx -mno-libfuncs
24515 @opindex mno-libfuncs
24516 Specify that intrinsic library functions are being compiled, passing all
24517 values in registers, no matter the size.
24520 @itemx -mno-epsilon
24522 @opindex mno-epsilon
24523 Generate floating-point comparison instructions that compare with respect
24524 to the @code{rE} epsilon register.
24526 @item -mabi=mmixware
24528 @opindex mabi=mmixware
24530 Generate code that passes function parameters and return values that (in
24531 the called function) are seen as registers @code{$0} and up, as opposed to
24532 the GNU ABI which uses global registers @code{$231} and up.
24534 @item -mzero-extend
24535 @itemx -mno-zero-extend
24536 @opindex mzero-extend
24537 @opindex mno-zero-extend
24538 When reading data from memory in sizes shorter than 64 bits, use (do not
24539 use) zero-extending load instructions by default, rather than
24540 sign-extending ones.
24543 @itemx -mno-knuthdiv
24545 @opindex mno-knuthdiv
24546 Make the result of a division yielding a remainder have the same sign as
24547 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
24548 remainder follows the sign of the dividend. Both methods are
24549 arithmetically valid, the latter being almost exclusively used.
24551 @item -mtoplevel-symbols
24552 @itemx -mno-toplevel-symbols
24553 @opindex mtoplevel-symbols
24554 @opindex mno-toplevel-symbols
24555 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
24556 code can be used with the @code{PREFIX} assembly directive.
24560 Generate an executable in the ELF format, rather than the default
24561 @samp{mmo} format used by the @command{mmix} simulator.
24563 @item -mbranch-predict
24564 @itemx -mno-branch-predict
24565 @opindex mbranch-predict
24566 @opindex mno-branch-predict
24567 Use (do not use) the probable-branch instructions, when static branch
24568 prediction indicates a probable branch.
24570 @item -mbase-addresses
24571 @itemx -mno-base-addresses
24572 @opindex mbase-addresses
24573 @opindex mno-base-addresses
24574 Generate (do not generate) code that uses @emph{base addresses}. Using a
24575 base address automatically generates a request (handled by the assembler
24576 and the linker) for a constant to be set up in a global register. The
24577 register is used for one or more base address requests within the range 0
24578 to 255 from the value held in the register. The generally leads to short
24579 and fast code, but the number of different data items that can be
24580 addressed is limited. This means that a program that uses lots of static
24581 data may require @option{-mno-base-addresses}.
24583 @item -msingle-exit
24584 @itemx -mno-single-exit
24585 @opindex msingle-exit
24586 @opindex mno-single-exit
24587 Force (do not force) generated code to have a single exit point in each
24591 @node MN10300 Options
24592 @subsection MN10300 Options
24593 @cindex MN10300 options
24595 These @option{-m} options are defined for Matsushita MN10300 architectures:
24600 Generate code to avoid bugs in the multiply instructions for the MN10300
24601 processors. This is the default.
24603 @item -mno-mult-bug
24604 @opindex mno-mult-bug
24605 Do not generate code to avoid bugs in the multiply instructions for the
24606 MN10300 processors.
24610 Generate code using features specific to the AM33 processor.
24614 Do not generate code using features specific to the AM33 processor. This
24619 Generate code using features specific to the AM33/2.0 processor.
24623 Generate code using features specific to the AM34 processor.
24625 @item -mtune=@var{cpu-type}
24627 Use the timing characteristics of the indicated CPU type when
24628 scheduling instructions. This does not change the targeted processor
24629 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
24630 @samp{am33-2} or @samp{am34}.
24632 @item -mreturn-pointer-on-d0
24633 @opindex mreturn-pointer-on-d0
24634 When generating a function that returns a pointer, return the pointer
24635 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
24636 only in @code{a0}, and attempts to call such functions without a prototype
24637 result in errors. Note that this option is on by default; use
24638 @option{-mno-return-pointer-on-d0} to disable it.
24642 Do not link in the C run-time initialization object file.
24646 Indicate to the linker that it should perform a relaxation optimization pass
24647 to shorten branches, calls and absolute memory addresses. This option only
24648 has an effect when used on the command line for the final link step.
24650 This option makes symbolic debugging impossible.
24654 Allow the compiler to generate @emph{Long Instruction Word}
24655 instructions if the target is the @samp{AM33} or later. This is the
24656 default. This option defines the preprocessor macro @code{__LIW__}.
24660 Do not allow the compiler to generate @emph{Long Instruction Word}
24661 instructions. This option defines the preprocessor macro
24666 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
24667 instructions if the target is the @samp{AM33} or later. This is the
24668 default. This option defines the preprocessor macro @code{__SETLB__}.
24672 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
24673 instructions. This option defines the preprocessor macro
24674 @code{__NO_SETLB__}.
24678 @node Moxie Options
24679 @subsection Moxie Options
24680 @cindex Moxie Options
24686 Generate big-endian code. This is the default for @samp{moxie-*-*}
24691 Generate little-endian code.
24695 Generate mul.x and umul.x instructions. This is the default for
24696 @samp{moxiebox-*-*} configurations.
24700 Do not link in the C run-time initialization object file.
24704 @node MSP430 Options
24705 @subsection MSP430 Options
24706 @cindex MSP430 Options
24708 These options are defined for the MSP430:
24714 Force assembly output to always use hex constants. Normally such
24715 constants are signed decimals, but this option is available for
24716 testsuite and/or aesthetic purposes.
24720 Select the MCU to target. This is used to create a C preprocessor
24721 symbol based upon the MCU name, converted to upper case and pre- and
24722 post-fixed with @samp{__}. This in turn is used by the
24723 @file{msp430.h} header file to select an MCU-specific supplementary
24726 The option also sets the ISA to use. If the MCU name is one that is
24727 known to only support the 430 ISA then that is selected, otherwise the
24728 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
24729 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
24730 name selects the 430X ISA.
24732 In addition an MCU-specific linker script is added to the linker
24733 command line. The script's name is the name of the MCU with
24734 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
24735 command line defines the C preprocessor symbol @code{__XXX__} and
24736 cause the linker to search for a script called @file{xxx.ld}.
24738 The ISA and hardware multiply supported for the different MCUs is hard-coded
24739 into GCC. However, an external @samp{devices.csv} file can be used to
24740 extend device support beyond those that have been hard-coded.
24742 GCC searches for the @samp{devices.csv} file using the following methods in the
24743 given precedence order, where the first method takes precendence over the
24744 second which takes precedence over the third.
24747 @item Include path specified with @code{-I} and @code{-L}
24748 @samp{devices.csv} will be searched for in each of the directories specified by
24749 include paths and linker library search paths.
24750 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
24751 Define the value of the global environment variable
24752 @samp{MSP430_GCC_INCLUDE_DIR}
24753 to the full path to the directory containing devices.csv, and GCC will search
24754 this directory for devices.csv. If devices.csv is found, this directory will
24755 also be registered as an include path, and linker library path. Header files
24756 and linker scripts in this directory can therefore be used without manually
24757 specifying @code{-I} and @code{-L} on the command line.
24758 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
24759 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
24760 toolchain root directory. This directory does not exist in a default
24761 installation, but if the user has created it and copied @samp{devices.csv}
24762 there, then the MCU data will be read. As above, this directory will
24763 also be registered as an include path, and linker library path.
24766 If none of the above search methods find @samp{devices.csv}, then the
24767 hard-coded MCU data is used.
24771 @itemx -mno-warn-mcu
24773 @opindex mno-warn-mcu
24774 This option enables or disables warnings about conflicts between the
24775 MCU name specified by the @option{-mmcu} option and the ISA set by the
24776 @option{-mcpu} option and/or the hardware multiply support set by the
24777 @option{-mhwmult} option. It also toggles warnings about unrecognized
24778 MCU names. This option is on by default.
24782 Specifies the ISA to use. Accepted values are @samp{msp430},
24783 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
24784 @option{-mmcu=} option should be used to select the ISA.
24788 Link to the simulator runtime libraries and linker script. Overrides
24789 any scripts that would be selected by the @option{-mmcu=} option.
24793 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
24797 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
24801 This option is passed to the assembler and linker, and allows the
24802 linker to perform certain optimizations that cannot be done until
24807 Describes the type of hardware multiply supported by the target.
24808 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
24809 for the original 16-bit-only multiply supported by early MCUs.
24810 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
24811 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
24812 A value of @samp{auto} can also be given. This tells GCC to deduce
24813 the hardware multiply support based upon the MCU name provided by the
24814 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
24815 the MCU name is not recognized then no hardware multiply support is
24816 assumed. @code{auto} is the default setting.
24818 Hardware multiplies are normally performed by calling a library
24819 routine. This saves space in the generated code. When compiling at
24820 @option{-O3} or higher however the hardware multiplier is invoked
24821 inline. This makes for bigger, but faster code.
24823 The hardware multiply routines disable interrupts whilst running and
24824 restore the previous interrupt state when they finish. This makes
24825 them safe to use inside interrupt handlers as well as in normal code.
24829 Enable the use of a minimum runtime environment - no static
24830 initializers or constructors. This is intended for memory-constrained
24831 devices. The compiler includes special symbols in some objects
24832 that tell the linker and runtime which code fragments are required.
24834 @item -mtiny-printf
24835 @opindex mtiny-printf
24836 Enable reduced code size @code{printf} and @code{puts} library functions.
24837 The @samp{tiny} implementations of these functions are not reentrant, so
24838 must be used with caution in multi-threaded applications.
24840 Support for streams has been removed and the string to be printed will
24841 always be sent to stdout via the @code{write} syscall. The string is not
24842 buffered before it is sent to write.
24844 This option requires Newlib Nano IO, so GCC must be configured with
24845 @samp{--enable-newlib-nano-formatted-io}.
24847 @item -mmax-inline-shift=
24848 @opindex mmax-inline-shift=
24849 This option takes an integer between 0 and 64 inclusive, and sets
24850 the maximum number of inline shift instructions which should be emitted to
24851 perform a shift operation by a constant amount. When this value needs to be
24852 exceeded, an mspabi helper function is used instead. The default value is 4.
24854 This only affects cases where a shift by multiple positions cannot be
24855 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
24857 Shifts of a 32-bit value are at least twice as costly, so the value passed for
24858 this option is divided by 2 and the resulting value used instead.
24860 @item -mcode-region=
24861 @itemx -mdata-region=
24862 @opindex mcode-region
24863 @opindex mdata-region
24864 These options tell the compiler where to place functions and data that
24865 do not have one of the @code{lower}, @code{upper}, @code{either} or
24866 @code{section} attributes. Possible values are @code{lower},
24867 @code{upper}, @code{either} or @code{any}. The first three behave
24868 like the corresponding attribute. The fourth possible value -
24869 @code{any} - is the default. It leaves placement entirely up to the
24870 linker script and how it assigns the standard sections
24871 (@code{.text}, @code{.data}, etc) to the memory regions.
24873 @item -msilicon-errata=
24874 @opindex msilicon-errata
24875 This option passes on a request to assembler to enable the fixes for
24876 the named silicon errata.
24878 @item -msilicon-errata-warn=
24879 @opindex msilicon-errata-warn
24880 This option passes on a request to the assembler to enable warning
24881 messages when a silicon errata might need to be applied.
24883 @item -mwarn-devices-csv
24884 @itemx -mno-warn-devices-csv
24885 @opindex mwarn-devices-csv
24886 @opindex mno-warn-devices-csv
24887 Warn if @samp{devices.csv} is not found or there are problem parsing it
24892 @node NDS32 Options
24893 @subsection NDS32 Options
24894 @cindex NDS32 Options
24896 These options are defined for NDS32 implementations:
24901 @opindex mbig-endian
24902 Generate code in big-endian mode.
24904 @item -mlittle-endian
24905 @opindex mlittle-endian
24906 Generate code in little-endian mode.
24908 @item -mreduced-regs
24909 @opindex mreduced-regs
24910 Use reduced-set registers for register allocation.
24913 @opindex mfull-regs
24914 Use full-set registers for register allocation.
24918 Generate conditional move instructions.
24922 Do not generate conditional move instructions.
24926 Generate performance extension instructions.
24928 @item -mno-ext-perf
24929 @opindex mno-ext-perf
24930 Do not generate performance extension instructions.
24933 @opindex mext-perf2
24934 Generate performance extension 2 instructions.
24936 @item -mno-ext-perf2
24937 @opindex mno-ext-perf2
24938 Do not generate performance extension 2 instructions.
24941 @opindex mext-string
24942 Generate string extension instructions.
24944 @item -mno-ext-string
24945 @opindex mno-ext-string
24946 Do not generate string extension instructions.
24950 Generate v3 push25/pop25 instructions.
24953 @opindex mno-v3push
24954 Do not generate v3 push25/pop25 instructions.
24958 Generate 16-bit instructions.
24961 @opindex mno-16-bit
24962 Do not generate 16-bit instructions.
24964 @item -misr-vector-size=@var{num}
24965 @opindex misr-vector-size
24966 Specify the size of each interrupt vector, which must be 4 or 16.
24968 @item -mcache-block-size=@var{num}
24969 @opindex mcache-block-size
24970 Specify the size of each cache block,
24971 which must be a power of 2 between 4 and 512.
24973 @item -march=@var{arch}
24975 Specify the name of the target architecture.
24977 @item -mcmodel=@var{code-model}
24979 Set the code model to one of
24982 All the data and read-only data segments must be within 512KB addressing space.
24983 The text segment must be within 16MB addressing space.
24984 @item @samp{medium}
24985 The data segment must be within 512KB while the read-only data segment can be
24986 within 4GB addressing space. The text segment should be still within 16MB
24989 All the text and data segments can be within 4GB addressing space.
24993 @opindex mctor-dtor
24994 Enable constructor/destructor feature.
24998 Guide linker to relax instructions.
25002 @node Nios II Options
25003 @subsection Nios II Options
25004 @cindex Nios II options
25005 @cindex Altera Nios II options
25007 These are the options defined for the Altera Nios II processor.
25013 @cindex smaller data references
25014 Put global and static objects less than or equal to @var{num} bytes
25015 into the small data or BSS sections instead of the normal data or BSS
25016 sections. The default value of @var{num} is 8.
25018 @item -mgpopt=@var{option}
25023 Generate (do not generate) GP-relative accesses. The following
25024 @var{option} names are recognized:
25029 Do not generate GP-relative accesses.
25032 Generate GP-relative accesses for small data objects that are not
25033 external, weak, or uninitialized common symbols.
25034 Also use GP-relative addressing for objects that
25035 have been explicitly placed in a small data section via a @code{section}
25039 As for @samp{local}, but also generate GP-relative accesses for
25040 small data objects that are external, weak, or common. If you use this option,
25041 you must ensure that all parts of your program (including libraries) are
25042 compiled with the same @option{-G} setting.
25045 Generate GP-relative accesses for all data objects in the program. If you
25046 use this option, the entire data and BSS segments
25047 of your program must fit in 64K of memory and you must use an appropriate
25048 linker script to allocate them within the addressable range of the
25052 Generate GP-relative addresses for function pointers as well as data
25053 pointers. If you use this option, the entire text, data, and BSS segments
25054 of your program must fit in 64K of memory and you must use an appropriate
25055 linker script to allocate them within the addressable range of the
25060 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
25061 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
25063 The default is @option{-mgpopt} except when @option{-fpic} or
25064 @option{-fPIC} is specified to generate position-independent code.
25065 Note that the Nios II ABI does not permit GP-relative accesses from
25068 You may need to specify @option{-mno-gpopt} explicitly when building
25069 programs that include large amounts of small data, including large
25070 GOT data sections. In this case, the 16-bit offset for GP-relative
25071 addressing may not be large enough to allow access to the entire
25072 small data section.
25074 @item -mgprel-sec=@var{regexp}
25075 @opindex mgprel-sec
25076 This option specifies additional section names that can be accessed via
25077 GP-relative addressing. It is most useful in conjunction with
25078 @code{section} attributes on variable declarations
25079 (@pxref{Common Variable Attributes}) and a custom linker script.
25080 The @var{regexp} is a POSIX Extended Regular Expression.
25082 This option does not affect the behavior of the @option{-G} option, and
25083 the specified sections are in addition to the standard @code{.sdata}
25084 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
25086 @item -mr0rel-sec=@var{regexp}
25087 @opindex mr0rel-sec
25088 This option specifies names of sections that can be accessed via a
25089 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
25090 of the 32-bit address space. It is most useful in conjunction with
25091 @code{section} attributes on variable declarations
25092 (@pxref{Common Variable Attributes}) and a custom linker script.
25093 The @var{regexp} is a POSIX Extended Regular Expression.
25095 In contrast to the use of GP-relative addressing for small data,
25096 zero-based addressing is never generated by default and there are no
25097 conventional section names used in standard linker scripts for sections
25098 in the low or high areas of memory.
25104 Generate little-endian (default) or big-endian (experimental) code,
25107 @item -march=@var{arch}
25109 This specifies the name of the target Nios II architecture. GCC uses this
25110 name to determine what kind of instructions it can emit when generating
25111 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
25113 The preprocessor macro @code{__nios2_arch__} is available to programs,
25114 with value 1 or 2, indicating the targeted ISA level.
25116 @item -mbypass-cache
25117 @itemx -mno-bypass-cache
25118 @opindex mno-bypass-cache
25119 @opindex mbypass-cache
25120 Force all load and store instructions to always bypass cache by
25121 using I/O variants of the instructions. The default is not to
25124 @item -mno-cache-volatile
25125 @itemx -mcache-volatile
25126 @opindex mcache-volatile
25127 @opindex mno-cache-volatile
25128 Volatile memory access bypass the cache using the I/O variants of
25129 the load and store instructions. The default is not to bypass the cache.
25131 @item -mno-fast-sw-div
25132 @itemx -mfast-sw-div
25133 @opindex mno-fast-sw-div
25134 @opindex mfast-sw-div
25135 Do not use table-based fast divide for small numbers. The default
25136 is to use the fast divide at @option{-O3} and above.
25140 @itemx -mno-hw-mulx
25144 @opindex mno-hw-mul
25146 @opindex mno-hw-mulx
25148 @opindex mno-hw-div
25150 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
25151 instructions by the compiler. The default is to emit @code{mul}
25152 and not emit @code{div} and @code{mulx}.
25158 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
25159 CDX (code density) instructions. Enabling these instructions also
25160 requires @option{-march=r2}. Since these instructions are optional
25161 extensions to the R2 architecture, the default is not to emit them.
25163 @item -mcustom-@var{insn}=@var{N}
25164 @itemx -mno-custom-@var{insn}
25165 @opindex mcustom-@var{insn}
25166 @opindex mno-custom-@var{insn}
25167 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
25168 custom instruction with encoding @var{N} when generating code that uses
25169 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
25170 instruction 253 for single-precision floating-point add operations instead
25171 of the default behavior of using a library call.
25173 The following values of @var{insn} are supported. Except as otherwise
25174 noted, floating-point operations are expected to be implemented with
25175 normal IEEE 754 semantics and correspond directly to the C operators or the
25176 equivalent GCC built-in functions (@pxref{Other Builtins}).
25178 Single-precision floating point:
25181 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
25182 Binary arithmetic operations.
25188 Unary absolute value.
25190 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
25191 Comparison operations.
25193 @item @samp{fmins}, @samp{fmaxs}
25194 Floating-point minimum and maximum. These instructions are only
25195 generated if @option{-ffinite-math-only} is specified.
25197 @item @samp{fsqrts}
25198 Unary square root operation.
25200 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
25201 Floating-point trigonometric and exponential functions. These instructions
25202 are only generated if @option{-funsafe-math-optimizations} is also specified.
25206 Double-precision floating point:
25209 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
25210 Binary arithmetic operations.
25216 Unary absolute value.
25218 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
25219 Comparison operations.
25221 @item @samp{fmind}, @samp{fmaxd}
25222 Double-precision minimum and maximum. These instructions are only
25223 generated if @option{-ffinite-math-only} is specified.
25225 @item @samp{fsqrtd}
25226 Unary square root operation.
25228 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
25229 Double-precision trigonometric and exponential functions. These instructions
25230 are only generated if @option{-funsafe-math-optimizations} is also specified.
25236 @item @samp{fextsd}
25237 Conversion from single precision to double precision.
25239 @item @samp{ftruncds}
25240 Conversion from double precision to single precision.
25242 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
25243 Conversion from floating point to signed or unsigned integer types, with
25244 truncation towards zero.
25247 Conversion from single-precision floating point to signed integer,
25248 rounding to the nearest integer and ties away from zero.
25249 This corresponds to the @code{__builtin_lroundf} function when
25250 @option{-fno-math-errno} is used.
25252 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
25253 Conversion from signed or unsigned integer types to floating-point types.
25257 In addition, all of the following transfer instructions for internal
25258 registers X and Y must be provided to use any of the double-precision
25259 floating-point instructions. Custom instructions taking two
25260 double-precision source operands expect the first operand in the
25261 64-bit register X. The other operand (or only operand of a unary
25262 operation) is given to the custom arithmetic instruction with the
25263 least significant half in source register @var{src1} and the most
25264 significant half in @var{src2}. A custom instruction that returns a
25265 double-precision result returns the most significant 32 bits in the
25266 destination register and the other half in 32-bit register Y.
25267 GCC automatically generates the necessary code sequences to write
25268 register X and/or read register Y when double-precision floating-point
25269 instructions are used.
25274 Write @var{src1} into the least significant half of X and @var{src2} into
25275 the most significant half of X.
25278 Write @var{src1} into Y.
25280 @item @samp{frdxhi}, @samp{frdxlo}
25281 Read the most or least (respectively) significant half of X and store it in
25285 Read the value of Y and store it into @var{dest}.
25288 Note that you can gain more local control over generation of Nios II custom
25289 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
25290 and @code{target("no-custom-@var{insn}")} function attributes
25291 (@pxref{Function Attributes})
25292 or pragmas (@pxref{Function Specific Option Pragmas}).
25294 @item -mcustom-fpu-cfg=@var{name}
25295 @opindex mcustom-fpu-cfg
25297 This option enables a predefined, named set of custom instruction encodings
25298 (see @option{-mcustom-@var{insn}} above).
25299 Currently, the following sets are defined:
25301 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
25302 @gccoptlist{-mcustom-fmuls=252 @gol
25303 -mcustom-fadds=253 @gol
25304 -mcustom-fsubs=254 @gol
25305 -fsingle-precision-constant}
25307 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
25308 @gccoptlist{-mcustom-fmuls=252 @gol
25309 -mcustom-fadds=253 @gol
25310 -mcustom-fsubs=254 @gol
25311 -mcustom-fdivs=255 @gol
25312 -fsingle-precision-constant}
25314 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
25315 @gccoptlist{-mcustom-floatus=243 @gol
25316 -mcustom-fixsi=244 @gol
25317 -mcustom-floatis=245 @gol
25318 -mcustom-fcmpgts=246 @gol
25319 -mcustom-fcmples=249 @gol
25320 -mcustom-fcmpeqs=250 @gol
25321 -mcustom-fcmpnes=251 @gol
25322 -mcustom-fmuls=252 @gol
25323 -mcustom-fadds=253 @gol
25324 -mcustom-fsubs=254 @gol
25325 -mcustom-fdivs=255 @gol
25326 -fsingle-precision-constant}
25328 Custom instruction assignments given by individual
25329 @option{-mcustom-@var{insn}=} options override those given by
25330 @option{-mcustom-fpu-cfg=}, regardless of the
25331 order of the options on the command line.
25333 Note that you can gain more local control over selection of a FPU
25334 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
25335 function attribute (@pxref{Function Attributes})
25336 or pragma (@pxref{Function Specific Option Pragmas}).
25340 These additional @samp{-m} options are available for the Altera Nios II
25341 ELF (bare-metal) target:
25347 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
25348 startup and termination code, and is typically used in conjunction with
25349 @option{-msys-crt0=} to specify the location of the alternate startup code
25350 provided by the HAL BSP.
25354 Link with a limited version of the C library, @option{-lsmallc}, rather than
25357 @item -msys-crt0=@var{startfile}
25359 @var{startfile} is the file name of the startfile (crt0) to use
25360 when linking. This option is only useful in conjunction with @option{-mhal}.
25362 @item -msys-lib=@var{systemlib}
25364 @var{systemlib} is the library name of the library that provides
25365 low-level system calls required by the C library,
25366 e.g.@: @code{read} and @code{write}.
25367 This option is typically used to link with a library provided by a HAL BSP.
25371 @node Nvidia PTX Options
25372 @subsection Nvidia PTX Options
25373 @cindex Nvidia PTX options
25374 @cindex nvptx options
25376 These options are defined for Nvidia PTX:
25384 Generate code for 32-bit or 64-bit ABI.
25386 @item -misa=@var{ISA-string}
25388 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
25389 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
25390 @samp{sm_35}. The default ISA is sm_30.
25393 @opindex mmainkernel
25394 Link in code for a __main kernel. This is for stand-alone instead of
25395 offloading execution.
25399 Apply partitioned execution optimizations. This is the default when any
25400 level of optimization is selected.
25403 @opindex msoft-stack
25404 Generate code that does not use @code{.local} memory
25405 directly for stack storage. Instead, a per-warp stack pointer is
25406 maintained explicitly. This enables variable-length stack allocation (with
25407 variable-length arrays or @code{alloca}), and when global memory is used for
25408 underlying storage, makes it possible to access automatic variables from other
25409 threads, or with atomic instructions. This code generation variant is used
25410 for OpenMP offloading, but the option is exposed on its own for the purpose
25411 of testing the compiler; to generate code suitable for linking into programs
25412 using OpenMP offloading, use option @option{-mgomp}.
25414 @item -muniform-simt
25415 @opindex muniform-simt
25416 Switch to code generation variant that allows to execute all threads in each
25417 warp, while maintaining memory state and side effects as if only one thread
25418 in each warp was active outside of OpenMP SIMD regions. All atomic operations
25419 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
25420 current lane index equals the master lane index), and the register being
25421 assigned is copied via a shuffle instruction from the master lane. Outside of
25422 SIMD regions lane 0 is the master; inside, each thread sees itself as the
25423 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
25424 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
25425 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
25426 with current lane index to compute the master lane index.
25430 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
25431 @option{-muniform-simt} options, and selects corresponding multilib variant.
25435 @node OpenRISC Options
25436 @subsection OpenRISC Options
25437 @cindex OpenRISC Options
25439 These options are defined for OpenRISC:
25443 @item -mboard=@var{name}
25445 Configure a board specific runtime. This will be passed to the linker for
25446 newlib board library linking. The default is @code{or1ksim}.
25450 This option is ignored; it is for compatibility purposes only. This used to
25451 select linker and preprocessor options for use with newlib.
25457 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
25458 This default is hardware divide.
25464 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
25465 This default is hardware multiply.
25468 @itemx -mhard-float
25469 @opindex msoft-float
25470 @opindex mhard-float
25471 Select software or hardware for floating point operations.
25472 The default is software.
25474 @item -mdouble-float
25475 @opindex mdouble-float
25476 When @option{-mhard-float} is selected, enables generation of double-precision
25477 floating point instructions. By default functions from @file{libgcc} are used
25478 to perform double-precision floating point operations.
25480 @item -munordered-float
25481 @opindex munordered-float
25482 When @option{-mhard-float} is selected, enables generation of unordered
25483 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
25484 functions from @file{libgcc} are used to perform unordered floating point
25485 compare and set flag operations.
25489 Enable generation of conditional move (@code{l.cmov}) instructions. By
25490 default the equivalent will be generated using set and branch.
25494 Enable generation of rotate right (@code{l.ror}) instructions. By default
25495 functions from @file{libgcc} are used to perform rotate right operations.
25499 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
25500 By default functions from @file{libgcc} are used to perform rotate right with
25501 immediate operations.
25505 Enable generation of sign extension (@code{l.ext*}) instructions. By default
25506 memory loads are used to perform sign extension.
25510 Enable generation of compare and set flag with immediate (@code{l.sf*i})
25511 instructions. By default extra instructions will be generated to store the
25512 immediate to a register first.
25516 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
25517 @code{l.slli}) instructions. By default extra instructions will be generated
25518 to store the immediate to a register first.
25523 @node PDP-11 Options
25524 @subsection PDP-11 Options
25525 @cindex PDP-11 Options
25527 These options are defined for the PDP-11:
25532 Use hardware FPP floating point. This is the default. (FIS floating
25533 point on the PDP-11/40 is not supported.) Implies -m45.
25536 @opindex msoft-float
25537 Do not use hardware floating point.
25541 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
25545 Return floating-point results in memory. This is the default.
25549 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
25553 Generate code for a PDP-11/45. This is the default.
25557 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
25563 Use 16-bit @code{int}. This is the default.
25569 Use 32-bit @code{int}.
25573 Target has split instruction and data space. Implies -m45.
25577 Use Unix assembler syntax.
25581 Use DEC assembler syntax.
25585 Use GNU assembler syntax. This is the default.
25589 Use the new LRA register allocator. By default, the old ``reload''
25593 @node picoChip Options
25594 @subsection picoChip Options
25595 @cindex picoChip options
25597 These @samp{-m} options are defined for picoChip implementations:
25601 @item -mae=@var{ae_type}
25603 Set the instruction set, register set, and instruction scheduling
25604 parameters for array element type @var{ae_type}. Supported values
25605 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
25607 @option{-mae=ANY} selects a completely generic AE type. Code
25608 generated with this option runs on any of the other AE types. The
25609 code is not as efficient as it would be if compiled for a specific
25610 AE type, and some types of operation (e.g., multiplication) do not
25611 work properly on all types of AE.
25613 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
25614 for compiled code, and is the default.
25616 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
25617 option may suffer from poor performance of byte (char) manipulation,
25618 since the DSP AE does not provide hardware support for byte load/stores.
25620 @item -msymbol-as-address
25621 Enable the compiler to directly use a symbol name as an address in a
25622 load/store instruction, without first loading it into a
25623 register. Typically, the use of this option generates larger
25624 programs, which run faster than when the option isn't used. However, the
25625 results vary from program to program, so it is left as a user option,
25626 rather than being permanently enabled.
25628 @item -mno-inefficient-warnings
25629 Disables warnings about the generation of inefficient code. These
25630 warnings can be generated, for example, when compiling code that
25631 performs byte-level memory operations on the MAC AE type. The MAC AE has
25632 no hardware support for byte-level memory operations, so all byte
25633 load/stores must be synthesized from word load/store operations. This is
25634 inefficient and a warning is generated to indicate
25635 that you should rewrite the code to avoid byte operations, or to target
25636 an AE type that has the necessary hardware support. This option disables
25641 @node PowerPC Options
25642 @subsection PowerPC Options
25643 @cindex PowerPC options
25645 These are listed under @xref{RS/6000 and PowerPC Options}.
25648 @subsection PRU Options
25649 @cindex PRU Options
25651 These command-line options are defined for PRU target:
25656 Link with a minimum runtime environment, with no support for static
25657 initializers and constructors. Using this option can significantly reduce
25658 the size of the final ELF binary. Beware that the compiler could still
25659 generate code with static initializers and constructors. It is up to the
25660 programmer to ensure that the source program will not use those features.
25662 @item -mmcu=@var{mcu}
25664 Specify the PRU MCU variant to use. Check Newlib for the exact list of
25669 Make GCC pass the @option{--no-relax} command-line option to the linker
25670 instead of the @option{--relax} option.
25674 Allow (or do not allow) GCC to use the LOOP instruction.
25676 @item -mabi=@var{variant}
25678 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
25679 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
25680 more naturally with certain GCC assumptions. These are the differences:
25683 @item Function Pointer Size
25684 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
25685 supports only 32-bit data and code pointers.
25687 @item Optional Return Value Pointer
25688 Function return values larger than 64 bits are passed by using a hidden
25689 pointer as the first argument of the function. TI ABI, though, mandates that
25690 the pointer can be NULL in case the caller is not using the returned value.
25691 GNU always passes and expects a valid return value pointer.
25695 The current @option{-mabi=ti} implementation simply raises a compile error
25696 when any of the above code constructs is detected. As a consequence
25697 the standard C library cannot be built and it is omitted when linking with
25700 Relaxation is a GNU feature and for safety reasons is disabled when using
25701 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
25702 instructions, so the GNU linker cannot adjust them when shortening adjacent
25703 LDI32 pseudo instructions.
25707 @node RISC-V Options
25708 @subsection RISC-V Options
25709 @cindex RISC-V Options
25711 These command-line options are defined for RISC-V targets:
25714 @item -mbranch-cost=@var{n}
25715 @opindex mbranch-cost
25716 Set the cost of branches to roughly @var{n} instructions.
25721 When generating PIC code, do or don't allow the use of PLTs. Ignored for
25722 non-PIC. The default is @option{-mplt}.
25724 @item -mabi=@var{ABI-string}
25726 Specify integer and floating-point calling convention. @var{ABI-string}
25727 contains two parts: the size of integer types and the registers used for
25728 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
25729 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
25730 32-bit), and that floating-point values up to 64 bits wide are passed in F
25731 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
25732 allows the compiler to generate code that uses the F and D extensions but only
25733 allows floating-point values up to 32 bits long to be passed in registers; or
25734 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
25735 passed in registers.
25737 The default for this argument is system dependent, users who want a specific
25738 calling convention should specify one explicitly. The valid calling
25739 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
25740 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
25741 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
25742 invalid because the ABI requires 64-bit values be passed in F registers, but F
25743 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
25744 only be used with the @samp{rv32e} architecture. This ABI is not well
25745 specified at present, and is subject to change.
25750 Do or don't use hardware floating-point divide and square root instructions.
25751 This requires the F or D extensions for floating-point registers. The default
25752 is to use them if the specified architecture has these instructions.
25757 Do or don't use hardware instructions for integer division. This requires the
25758 M extension. The default is to use them if the specified architecture has
25759 these instructions.
25761 @item -march=@var{ISA-string}
25763 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
25764 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
25767 @item -mtune=@var{processor-string}
25769 Optimize the output for the given processor, specified by microarchitecture
25770 name. Permissible values for this option are: @samp{rocket},
25771 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
25774 When @option{-mtune=} is not specified, the default is @samp{rocket}.
25776 The @samp{size} choice is not intended for use by end-users. This is used
25777 when @option{-Os} is specified. It overrides the instruction cost info
25778 provided by @option{-mtune=}, but does not override the pipeline info. This
25779 helps reduce code size while still giving good performance.
25781 @item -mpreferred-stack-boundary=@var{num}
25782 @opindex mpreferred-stack-boundary
25783 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25784 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
25785 the default is 4 (16 bytes or 128-bits).
25787 @strong{Warning:} If you use this switch, then you must build all modules with
25788 the same value, including any libraries. This includes the system libraries
25789 and startup modules.
25791 @item -msmall-data-limit=@var{n}
25792 @opindex msmall-data-limit
25793 Put global and static data smaller than @var{n} bytes into a special section
25796 @item -msave-restore
25797 @itemx -mno-save-restore
25798 @opindex msave-restore
25799 Do or don't use smaller but slower prologue and epilogue code that uses
25800 library function calls. The default is to use fast inline prologues and
25803 @item -mshorten-memrefs
25804 @itemx -mno-shorten-memrefs
25805 @opindex mshorten-memrefs
25806 Do or do not attempt to make more use of compressed load/store instructions by
25807 replacing a load/store of 'base register + large offset' with a new load/store
25808 of 'new base + small offset'. If the new base gets stored in a compressed
25809 register, then the new load/store can be compressed. Currently targets 32-bit
25810 integer load/stores only.
25812 @item -mstrict-align
25813 @itemx -mno-strict-align
25814 @opindex mstrict-align
25815 Do not or do generate unaligned memory accesses. The default is set depending
25816 on whether the processor we are optimizing for supports fast unaligned access
25819 @item -mcmodel=medlow
25820 @opindex mcmodel=medlow
25821 Generate code for the medium-low code model. The program and its statically
25822 defined symbols must lie within a single 2 GiB address range and must lie
25823 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
25824 statically or dynamically linked. This is the default code model.
25826 @item -mcmodel=medany
25827 @opindex mcmodel=medany
25828 Generate code for the medium-any code model. The program and its statically
25829 defined symbols must be within any single 2 GiB address range. Programs can be
25830 statically or dynamically linked.
25832 @item -mexplicit-relocs
25833 @itemx -mno-exlicit-relocs
25834 Use or do not use assembler relocation operators when dealing with symbolic
25835 addresses. The alternative is to use assembler macros instead, which may
25836 limit optimization.
25840 Take advantage of linker relaxations to reduce the number of instructions
25841 required to materialize symbol addresses. The default is to take advantage of
25842 linker relaxations.
25844 @item -memit-attribute
25845 @itemx -mno-emit-attribute
25846 Emit (do not emit) RISC-V attribute to record extra information into ELF
25847 objects. This feature requires at least binutils 2.32.
25849 @item -malign-data=@var{type}
25850 @opindex malign-data
25851 Control how GCC aligns variables and constants of array, structure, or union
25852 types. Supported values for @var{type} are @samp{xlen} which uses x register
25853 width as the alignment value, and @samp{natural} which uses natural alignment.
25854 @samp{xlen} is the default.
25856 @item -mstack-protector-guard=@var{guard}
25857 @itemx -mstack-protector-guard-reg=@var{reg}
25858 @itemx -mstack-protector-guard-offset=@var{offset}
25859 @opindex mstack-protector-guard
25860 @opindex mstack-protector-guard-reg
25861 @opindex mstack-protector-guard-offset
25862 Generate stack protection code using canary at @var{guard}. Supported
25863 locations are @samp{global} for a global canary or @samp{tls} for per-thread
25864 canary in the TLS block.
25866 With the latter choice the options
25867 @option{-mstack-protector-guard-reg=@var{reg}} and
25868 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25869 which register to use as base register for reading the canary,
25870 and from what offset from that base register. There is no default
25871 register or offset as this is entirely for use within the Linux
25876 @subsection RL78 Options
25877 @cindex RL78 Options
25883 Links in additional target libraries to support operation within a
25892 Specifies the type of hardware multiplication and division support to
25893 be used. The simplest is @code{none}, which uses software for both
25894 multiplication and division. This is the default. The @code{g13}
25895 value is for the hardware multiply/divide peripheral found on the
25896 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
25897 the multiplication and division instructions supported by the RL78/G14
25898 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
25899 the value @code{mg10} is an alias for @code{none}.
25901 In addition a C preprocessor macro is defined, based upon the setting
25902 of this option. Possible values are: @code{__RL78_MUL_NONE__},
25903 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
25910 Specifies the RL78 core to target. The default is the G14 core, also
25911 known as an S3 core or just RL78. The G13 or S2 core does not have
25912 multiply or divide instructions, instead it uses a hardware peripheral
25913 for these operations. The G10 or S1 core does not have register
25914 banks, so it uses a different calling convention.
25916 If this option is set it also selects the type of hardware multiply
25917 support to use, unless this is overridden by an explicit
25918 @option{-mmul=none} option on the command line. Thus specifying
25919 @option{-mcpu=g13} enables the use of the G13 hardware multiply
25920 peripheral and specifying @option{-mcpu=g10} disables the use of
25921 hardware multiplications altogether.
25923 Note, although the RL78/G14 core is the default target, specifying
25924 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
25925 change the behavior of the toolchain since it also enables G14
25926 hardware multiply support. If these options are not specified on the
25927 command line then software multiplication routines will be used even
25928 though the code targets the RL78 core. This is for backwards
25929 compatibility with older toolchains which did not have hardware
25930 multiply and divide support.
25932 In addition a C preprocessor macro is defined, based upon the setting
25933 of this option. Possible values are: @code{__RL78_G10__},
25934 @code{__RL78_G13__} or @code{__RL78_G14__}.
25944 These are aliases for the corresponding @option{-mcpu=} option. They
25945 are provided for backwards compatibility.
25949 Allow the compiler to use all of the available registers. By default
25950 registers @code{r24..r31} are reserved for use in interrupt handlers.
25951 With this option enabled these registers can be used in ordinary
25954 @item -m64bit-doubles
25955 @itemx -m32bit-doubles
25956 @opindex m64bit-doubles
25957 @opindex m32bit-doubles
25958 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25959 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25960 @option{-m32bit-doubles}.
25962 @item -msave-mduc-in-interrupts
25963 @itemx -mno-save-mduc-in-interrupts
25964 @opindex msave-mduc-in-interrupts
25965 @opindex mno-save-mduc-in-interrupts
25966 Specifies that interrupt handler functions should preserve the
25967 MDUC registers. This is only necessary if normal code might use
25968 the MDUC registers, for example because it performs multiplication
25969 and division operations. The default is to ignore the MDUC registers
25970 as this makes the interrupt handlers faster. The target option -mg13
25971 needs to be passed for this to work as this feature is only available
25972 on the G13 target (S2 core). The MDUC registers will only be saved
25973 if the interrupt handler performs a multiplication or division
25974 operation or it calls another function.
25978 @node RS/6000 and PowerPC Options
25979 @subsection IBM RS/6000 and PowerPC Options
25980 @cindex RS/6000 and PowerPC Options
25981 @cindex IBM RS/6000 and PowerPC Options
25983 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
25985 @item -mpowerpc-gpopt
25986 @itemx -mno-powerpc-gpopt
25987 @itemx -mpowerpc-gfxopt
25988 @itemx -mno-powerpc-gfxopt
25991 @itemx -mno-powerpc64
25995 @itemx -mno-popcntb
25997 @itemx -mno-popcntd
26004 @itemx -mno-hard-dfp
26005 @opindex mpowerpc-gpopt
26006 @opindex mno-powerpc-gpopt
26007 @opindex mpowerpc-gfxopt
26008 @opindex mno-powerpc-gfxopt
26009 @opindex mpowerpc64
26010 @opindex mno-powerpc64
26014 @opindex mno-popcntb
26016 @opindex mno-popcntd
26022 @opindex mno-hard-dfp
26023 You use these options to specify which instructions are available on the
26024 processor you are using. The default value of these options is
26025 determined when configuring GCC@. Specifying the
26026 @option{-mcpu=@var{cpu_type}} overrides the specification of these
26027 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
26028 rather than the options listed above.
26030 Specifying @option{-mpowerpc-gpopt} allows
26031 GCC to use the optional PowerPC architecture instructions in the
26032 General Purpose group, including floating-point square root. Specifying
26033 @option{-mpowerpc-gfxopt} allows GCC to
26034 use the optional PowerPC architecture instructions in the Graphics
26035 group, including floating-point select.
26037 The @option{-mmfcrf} option allows GCC to generate the move from
26038 condition register field instruction implemented on the POWER4
26039 processor and other processors that support the PowerPC V2.01
26041 The @option{-mpopcntb} option allows GCC to generate the popcount and
26042 double-precision FP reciprocal estimate instruction implemented on the
26043 POWER5 processor and other processors that support the PowerPC V2.02
26045 The @option{-mpopcntd} option allows GCC to generate the popcount
26046 instruction implemented on the POWER7 processor and other processors
26047 that support the PowerPC V2.06 architecture.
26048 The @option{-mfprnd} option allows GCC to generate the FP round to
26049 integer instructions implemented on the POWER5+ processor and other
26050 processors that support the PowerPC V2.03 architecture.
26051 The @option{-mcmpb} option allows GCC to generate the compare bytes
26052 instruction implemented on the POWER6 processor and other processors
26053 that support the PowerPC V2.05 architecture.
26054 The @option{-mhard-dfp} option allows GCC to generate the decimal
26055 floating-point instructions implemented on some POWER processors.
26057 The @option{-mpowerpc64} option allows GCC to generate the additional
26058 64-bit instructions that are found in the full PowerPC64 architecture
26059 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
26060 @option{-mno-powerpc64}.
26062 @item -mcpu=@var{cpu_type}
26064 Set architecture type, register usage, and
26065 instruction scheduling parameters for machine type @var{cpu_type}.
26066 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
26067 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
26068 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
26069 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
26070 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
26071 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
26072 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
26073 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
26074 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
26075 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
26076 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
26077 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
26079 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
26080 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
26081 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
26082 architecture machine types, with an appropriate, generic processor
26083 model assumed for scheduling purposes.
26085 Specifying @samp{native} as cpu type detects and selects the
26086 architecture option that corresponds to the host processor of the
26087 system performing the compilation.
26088 @option{-mcpu=native} has no effect if GCC does not recognize the
26091 The other options specify a specific processor. Code generated under
26092 those options runs best on that processor, and may not run at all on
26095 The @option{-mcpu} options automatically enable or disable the
26098 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
26099 -mpopcntb -mpopcntd -mpowerpc64 @gol
26100 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
26101 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
26102 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
26103 -mquad-memory -mquad-memory-atomic -mfloat128 @gol
26104 -mfloat128-hardware -mprefixed -mpcrel -mmma}
26106 The particular options set for any particular CPU varies between
26107 compiler versions, depending on what setting seems to produce optimal
26108 code for that CPU; it doesn't necessarily reflect the actual hardware's
26109 capabilities. If you wish to set an individual option to a particular
26110 value, you may specify it after the @option{-mcpu} option, like
26111 @option{-mcpu=970 -mno-altivec}.
26113 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
26114 not enabled or disabled by the @option{-mcpu} option at present because
26115 AIX does not have full support for these options. You may still
26116 enable or disable them individually if you're sure it'll work in your
26119 @item -mtune=@var{cpu_type}
26121 Set the instruction scheduling parameters for machine type
26122 @var{cpu_type}, but do not set the architecture type or register usage,
26123 as @option{-mcpu=@var{cpu_type}} does. The same
26124 values for @var{cpu_type} are used for @option{-mtune} as for
26125 @option{-mcpu}. If both are specified, the code generated uses the
26126 architecture and registers set by @option{-mcpu}, but the
26127 scheduling parameters set by @option{-mtune}.
26129 @item -mcmodel=small
26130 @opindex mcmodel=small
26131 Generate PowerPC64 code for the small model: The TOC is limited to
26134 @item -mcmodel=medium
26135 @opindex mcmodel=medium
26136 Generate PowerPC64 code for the medium model: The TOC and other static
26137 data may be up to a total of 4G in size. This is the default for 64-bit
26140 @item -mcmodel=large
26141 @opindex mcmodel=large
26142 Generate PowerPC64 code for the large model: The TOC may be up to 4G
26143 in size. Other data and code is only limited by the 64-bit address
26147 @itemx -mno-altivec
26149 @opindex mno-altivec
26150 Generate code that uses (does not use) AltiVec instructions, and also
26151 enable the use of built-in functions that allow more direct access to
26152 the AltiVec instruction set. You may also need to set
26153 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
26156 When @option{-maltivec} is used, the element order for AltiVec intrinsics
26157 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
26158 match array element order corresponding to the endianness of the
26159 target. That is, element zero identifies the leftmost element in a
26160 vector register when targeting a big-endian platform, and identifies
26161 the rightmost element in a vector register when targeting a
26162 little-endian platform.
26167 @opindex mno-vrsave
26168 Generate VRSAVE instructions when generating AltiVec code.
26171 @opindex msecure-plt
26172 Generate code that allows @command{ld} and @command{ld.so}
26173 to build executables and shared
26174 libraries with non-executable @code{.plt} and @code{.got} sections.
26176 32-bit SYSV ABI option.
26180 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
26182 requires @code{.plt} and @code{.got}
26183 sections that are both writable and executable.
26184 This is a PowerPC 32-bit SYSV ABI option.
26190 This switch enables or disables the generation of ISEL instructions.
26196 Generate code that uses (does not use) vector/scalar (VSX)
26197 instructions, and also enable the use of built-in functions that allow
26198 more direct access to the VSX instruction set.
26203 @opindex mno-crypto
26204 Enable the use (disable) of the built-in functions that allow direct
26205 access to the cryptographic instructions that were added in version
26206 2.07 of the PowerPC ISA.
26212 Enable (disable) the use of the built-in functions that allow direct
26213 access to the Hardware Transactional Memory (HTM) instructions that
26214 were added in version 2.07 of the PowerPC ISA.
26216 @item -mpower8-fusion
26217 @itemx -mno-power8-fusion
26218 @opindex mpower8-fusion
26219 @opindex mno-power8-fusion
26220 Generate code that keeps (does not keeps) some integer operations
26221 adjacent so that the instructions can be fused together on power8 and
26224 @item -mpower8-vector
26225 @itemx -mno-power8-vector
26226 @opindex mpower8-vector
26227 @opindex mno-power8-vector
26228 Generate code that uses (does not use) the vector and scalar
26229 instructions that were added in version 2.07 of the PowerPC ISA. Also
26230 enable the use of built-in functions that allow more direct access to
26231 the vector instructions.
26233 @item -mquad-memory
26234 @itemx -mno-quad-memory
26235 @opindex mquad-memory
26236 @opindex mno-quad-memory
26237 Generate code that uses (does not use) the non-atomic quad word memory
26238 instructions. The @option{-mquad-memory} option requires use of
26241 @item -mquad-memory-atomic
26242 @itemx -mno-quad-memory-atomic
26243 @opindex mquad-memory-atomic
26244 @opindex mno-quad-memory-atomic
26245 Generate code that uses (does not use) the atomic quad word memory
26246 instructions. The @option{-mquad-memory-atomic} option requires use of
26250 @itemx -mno-float128
26252 @opindex mno-float128
26253 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
26254 and use either software emulation for IEEE 128-bit floating point or
26255 hardware instructions.
26257 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
26258 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
26259 use the IEEE 128-bit floating point support. The IEEE 128-bit
26260 floating point support only works on PowerPC Linux systems.
26262 The default for @option{-mfloat128} is enabled on PowerPC Linux
26263 systems using the VSX instruction set, and disabled on other systems.
26265 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
26266 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
26267 point support will also enable the generation of ISA 3.0 IEEE 128-bit
26268 floating point instructions. Otherwise, if you do not specify to
26269 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
26270 system, IEEE 128-bit floating point will be done with software
26273 @item -mfloat128-hardware
26274 @itemx -mno-float128-hardware
26275 @opindex mfloat128-hardware
26276 @opindex mno-float128-hardware
26277 Enable/disable using ISA 3.0 hardware instructions to support the
26278 @var{__float128} data type.
26280 The default for @option{-mfloat128-hardware} is enabled on PowerPC
26281 Linux systems using the ISA 3.0 instruction set, and disabled on other
26288 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
26289 targets (including GNU/Linux). The 32-bit environment sets int, long
26290 and pointer to 32 bits and generates code that runs on any PowerPC
26291 variant. The 64-bit environment sets int to 32 bits and long and
26292 pointer to 64 bits, and generates code for PowerPC64, as for
26293 @option{-mpowerpc64}.
26296 @itemx -mno-fp-in-toc
26297 @itemx -mno-sum-in-toc
26298 @itemx -mminimal-toc
26300 @opindex mno-fp-in-toc
26301 @opindex mno-sum-in-toc
26302 @opindex mminimal-toc
26303 Modify generation of the TOC (Table Of Contents), which is created for
26304 every executable file. The @option{-mfull-toc} option is selected by
26305 default. In that case, GCC allocates at least one TOC entry for
26306 each unique non-automatic variable reference in your program. GCC
26307 also places floating-point constants in the TOC@. However, only
26308 16,384 entries are available in the TOC@.
26310 If you receive a linker error message that saying you have overflowed
26311 the available TOC space, you can reduce the amount of TOC space used
26312 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
26313 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
26314 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
26315 generate code to calculate the sum of an address and a constant at
26316 run time instead of putting that sum into the TOC@. You may specify one
26317 or both of these options. Each causes GCC to produce very slightly
26318 slower and larger code at the expense of conserving TOC space.
26320 If you still run out of space in the TOC even when you specify both of
26321 these options, specify @option{-mminimal-toc} instead. This option causes
26322 GCC to make only one TOC entry for every file. When you specify this
26323 option, GCC produces code that is slower and larger but which
26324 uses extremely little TOC space. You may wish to use this option
26325 only on files that contain less frequently-executed code.
26331 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
26332 @code{long} type, and the infrastructure needed to support them.
26333 Specifying @option{-maix64} implies @option{-mpowerpc64},
26334 while @option{-maix32} disables the 64-bit ABI and
26335 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
26338 @itemx -mno-xl-compat
26339 @opindex mxl-compat
26340 @opindex mno-xl-compat
26341 Produce code that conforms more closely to IBM XL compiler semantics
26342 when using AIX-compatible ABI@. Pass floating-point arguments to
26343 prototyped functions beyond the register save area (RSA) on the stack
26344 in addition to argument FPRs. Do not assume that most significant
26345 double in 128-bit long double value is properly rounded when comparing
26346 values and converting to double. Use XL symbol names for long double
26349 The AIX calling convention was extended but not initially documented to
26350 handle an obscure K&R C case of calling a function that takes the
26351 address of its arguments with fewer arguments than declared. IBM XL
26352 compilers access floating-point arguments that do not fit in the
26353 RSA from the stack when a subroutine is compiled without
26354 optimization. Because always storing floating-point arguments on the
26355 stack is inefficient and rarely needed, this option is not enabled by
26356 default and only is necessary when calling subroutines compiled by IBM
26357 XL compilers without optimization.
26361 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
26362 application written to use message passing with special startup code to
26363 enable the application to run. The system must have PE installed in the
26364 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
26365 must be overridden with the @option{-specs=} option to specify the
26366 appropriate directory location. The Parallel Environment does not
26367 support threads, so the @option{-mpe} option and the @option{-pthread}
26368 option are incompatible.
26370 @item -malign-natural
26371 @itemx -malign-power
26372 @opindex malign-natural
26373 @opindex malign-power
26374 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
26375 @option{-malign-natural} overrides the ABI-defined alignment of larger
26376 types, such as floating-point doubles, on their natural size-based boundary.
26377 The option @option{-malign-power} instructs GCC to follow the ABI-specified
26378 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
26380 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
26384 @itemx -mhard-float
26385 @opindex msoft-float
26386 @opindex mhard-float
26387 Generate code that does not use (uses) the floating-point register set.
26388 Software floating-point emulation is provided if you use the
26389 @option{-msoft-float} option, and pass the option to GCC when linking.
26392 @itemx -mno-multiple
26394 @opindex mno-multiple
26395 Generate code that uses (does not use) the load multiple word
26396 instructions and the store multiple word instructions. These
26397 instructions are generated by default on POWER systems, and not
26398 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
26399 PowerPC systems, since those instructions do not work when the
26400 processor is in little-endian mode. The exceptions are PPC740 and
26401 PPC750 which permit these instructions in little-endian mode.
26406 @opindex mno-update
26407 Generate code that uses (does not use) the load or store instructions
26408 that update the base register to the address of the calculated memory
26409 location. These instructions are generated by default. If you use
26410 @option{-mno-update}, there is a small window between the time that the
26411 stack pointer is updated and the address of the previous frame is
26412 stored, which means code that walks the stack frame across interrupts or
26413 signals may get corrupted data.
26415 @item -mavoid-indexed-addresses
26416 @itemx -mno-avoid-indexed-addresses
26417 @opindex mavoid-indexed-addresses
26418 @opindex mno-avoid-indexed-addresses
26419 Generate code that tries to avoid (not avoid) the use of indexed load
26420 or store instructions. These instructions can incur a performance
26421 penalty on Power6 processors in certain situations, such as when
26422 stepping through large arrays that cross a 16M boundary. This option
26423 is enabled by default when targeting Power6 and disabled otherwise.
26426 @itemx -mno-fused-madd
26427 @opindex mfused-madd
26428 @opindex mno-fused-madd
26429 Generate code that uses (does not use) the floating-point multiply and
26430 accumulate instructions. These instructions are generated by default
26431 if hardware floating point is used. The machine-dependent
26432 @option{-mfused-madd} option is now mapped to the machine-independent
26433 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26434 mapped to @option{-ffp-contract=off}.
26440 Generate code that uses (does not use) the half-word multiply and
26441 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
26442 These instructions are generated by default when targeting those
26449 Generate code that uses (does not use) the string-search @samp{dlmzb}
26450 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
26451 generated by default when targeting those processors.
26453 @item -mno-bit-align
26455 @opindex mno-bit-align
26456 @opindex mbit-align
26457 On System V.4 and embedded PowerPC systems do not (do) force structures
26458 and unions that contain bit-fields to be aligned to the base type of the
26461 For example, by default a structure containing nothing but 8
26462 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
26463 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
26464 the structure is aligned to a 1-byte boundary and is 1 byte in
26467 @item -mno-strict-align
26468 @itemx -mstrict-align
26469 @opindex mno-strict-align
26470 @opindex mstrict-align
26471 On System V.4 and embedded PowerPC systems do not (do) assume that
26472 unaligned memory references are handled by the system.
26474 @item -mrelocatable
26475 @itemx -mno-relocatable
26476 @opindex mrelocatable
26477 @opindex mno-relocatable
26478 Generate code that allows (does not allow) a static executable to be
26479 relocated to a different address at run time. A simple embedded
26480 PowerPC system loader should relocate the entire contents of
26481 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
26482 a table of 32-bit addresses generated by this option. For this to
26483 work, all objects linked together must be compiled with
26484 @option{-mrelocatable} or @option{-mrelocatable-lib}.
26485 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
26487 @item -mrelocatable-lib
26488 @itemx -mno-relocatable-lib
26489 @opindex mrelocatable-lib
26490 @opindex mno-relocatable-lib
26491 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
26492 @code{.fixup} section to allow static executables to be relocated at
26493 run time, but @option{-mrelocatable-lib} does not use the smaller stack
26494 alignment of @option{-mrelocatable}. Objects compiled with
26495 @option{-mrelocatable-lib} may be linked with objects compiled with
26496 any combination of the @option{-mrelocatable} options.
26502 On System V.4 and embedded PowerPC systems do not (do) assume that
26503 register 2 contains a pointer to a global area pointing to the addresses
26504 used in the program.
26507 @itemx -mlittle-endian
26509 @opindex mlittle-endian
26510 On System V.4 and embedded PowerPC systems compile code for the
26511 processor in little-endian mode. The @option{-mlittle-endian} option is
26512 the same as @option{-mlittle}.
26515 @itemx -mbig-endian
26517 @opindex mbig-endian
26518 On System V.4 and embedded PowerPC systems compile code for the
26519 processor in big-endian mode. The @option{-mbig-endian} option is
26520 the same as @option{-mbig}.
26522 @item -mdynamic-no-pic
26523 @opindex mdynamic-no-pic
26524 On Darwin and Mac OS X systems, compile code so that it is not
26525 relocatable, but that its external references are relocatable. The
26526 resulting code is suitable for applications, but not shared
26529 @item -msingle-pic-base
26530 @opindex msingle-pic-base
26531 Treat the register used for PIC addressing as read-only, rather than
26532 loading it in the prologue for each function. The runtime system is
26533 responsible for initializing this register with an appropriate value
26534 before execution begins.
26536 @item -mprioritize-restricted-insns=@var{priority}
26537 @opindex mprioritize-restricted-insns
26538 This option controls the priority that is assigned to
26539 dispatch-slot restricted instructions during the second scheduling
26540 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
26541 or @samp{2} to assign no, highest, or second-highest (respectively)
26542 priority to dispatch-slot restricted
26545 @item -msched-costly-dep=@var{dependence_type}
26546 @opindex msched-costly-dep
26547 This option controls which dependences are considered costly
26548 by the target during instruction scheduling. The argument
26549 @var{dependence_type} takes one of the following values:
26553 No dependence is costly.
26556 All dependences are costly.
26558 @item @samp{true_store_to_load}
26559 A true dependence from store to load is costly.
26561 @item @samp{store_to_load}
26562 Any dependence from store to load is costly.
26565 Any dependence for which the latency is greater than or equal to
26566 @var{number} is costly.
26569 @item -minsert-sched-nops=@var{scheme}
26570 @opindex minsert-sched-nops
26571 This option controls which NOP insertion scheme is used during
26572 the second scheduling pass. The argument @var{scheme} takes one of the
26580 Pad with NOPs any dispatch group that has vacant issue slots,
26581 according to the scheduler's grouping.
26583 @item @samp{regroup_exact}
26584 Insert NOPs to force costly dependent insns into
26585 separate groups. Insert exactly as many NOPs as needed to force an insn
26586 to a new group, according to the estimated processor grouping.
26589 Insert NOPs to force costly dependent insns into
26590 separate groups. Insert @var{number} NOPs to force an insn to a new group.
26594 @opindex mcall-sysv
26595 On System V.4 and embedded PowerPC systems compile code using calling
26596 conventions that adhere to the March 1995 draft of the System V
26597 Application Binary Interface, PowerPC processor supplement. This is the
26598 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
26600 @item -mcall-sysv-eabi
26602 @opindex mcall-sysv-eabi
26603 @opindex mcall-eabi
26604 Specify both @option{-mcall-sysv} and @option{-meabi} options.
26606 @item -mcall-sysv-noeabi
26607 @opindex mcall-sysv-noeabi
26608 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
26610 @item -mcall-aixdesc
26612 On System V.4 and embedded PowerPC systems compile code for the AIX
26616 @opindex mcall-linux
26617 On System V.4 and embedded PowerPC systems compile code for the
26618 Linux-based GNU system.
26620 @item -mcall-freebsd
26621 @opindex mcall-freebsd
26622 On System V.4 and embedded PowerPC systems compile code for the
26623 FreeBSD operating system.
26625 @item -mcall-netbsd
26626 @opindex mcall-netbsd
26627 On System V.4 and embedded PowerPC systems compile code for the
26628 NetBSD operating system.
26630 @item -mcall-openbsd
26631 @opindex mcall-netbsd
26632 On System V.4 and embedded PowerPC systems compile code for the
26633 OpenBSD operating system.
26635 @item -mtraceback=@var{traceback_type}
26636 @opindex mtraceback
26637 Select the type of traceback table. Valid values for @var{traceback_type}
26638 are @samp{full}, @samp{part}, and @samp{no}.
26640 @item -maix-struct-return
26641 @opindex maix-struct-return
26642 Return all structures in memory (as specified by the AIX ABI)@.
26644 @item -msvr4-struct-return
26645 @opindex msvr4-struct-return
26646 Return structures smaller than 8 bytes in registers (as specified by the
26649 @item -mabi=@var{abi-type}
26651 Extend the current ABI with a particular extension, or remove such extension.
26652 Valid values are @samp{altivec}, @samp{no-altivec},
26653 @samp{ibmlongdouble}, @samp{ieeelongdouble},
26654 @samp{elfv1}, @samp{elfv2}@.
26656 @item -mabi=ibmlongdouble
26657 @opindex mabi=ibmlongdouble
26658 Change the current ABI to use IBM extended-precision long double.
26659 This is not likely to work if your system defaults to using IEEE
26660 extended-precision long double. If you change the long double type
26661 from IEEE extended-precision, the compiler will issue a warning unless
26662 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26665 @item -mabi=ieeelongdouble
26666 @opindex mabi=ieeelongdouble
26667 Change the current ABI to use IEEE extended-precision long double.
26668 This is not likely to work if your system defaults to using IBM
26669 extended-precision long double. If you change the long double type
26670 from IBM extended-precision, the compiler will issue a warning unless
26671 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26675 @opindex mabi=elfv1
26676 Change the current ABI to use the ELFv1 ABI.
26677 This is the default ABI for big-endian PowerPC 64-bit Linux.
26678 Overriding the default ABI requires special system support and is
26679 likely to fail in spectacular ways.
26682 @opindex mabi=elfv2
26683 Change the current ABI to use the ELFv2 ABI.
26684 This is the default ABI for little-endian PowerPC 64-bit Linux.
26685 Overriding the default ABI requires special system support and is
26686 likely to fail in spectacular ways.
26688 @item -mgnu-attribute
26689 @itemx -mno-gnu-attribute
26690 @opindex mgnu-attribute
26691 @opindex mno-gnu-attribute
26692 Emit .gnu_attribute assembly directives to set tag/value pairs in a
26693 .gnu.attributes section that specify ABI variations in function
26694 parameters or return values.
26697 @itemx -mno-prototype
26698 @opindex mprototype
26699 @opindex mno-prototype
26700 On System V.4 and embedded PowerPC systems assume that all calls to
26701 variable argument functions are properly prototyped. Otherwise, the
26702 compiler must insert an instruction before every non-prototyped call to
26703 set or clear bit 6 of the condition code register (@code{CR}) to
26704 indicate whether floating-point values are passed in the floating-point
26705 registers in case the function takes variable arguments. With
26706 @option{-mprototype}, only calls to prototyped variable argument functions
26707 set or clear the bit.
26711 On embedded PowerPC systems, assume that the startup module is called
26712 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
26713 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
26718 On embedded PowerPC systems, assume that the startup module is called
26719 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
26724 On embedded PowerPC systems, assume that the startup module is called
26725 @file{crt0.o} and the standard C libraries are @file{libads.a} and
26728 @item -myellowknife
26729 @opindex myellowknife
26730 On embedded PowerPC systems, assume that the startup module is called
26731 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
26736 On System V.4 and embedded PowerPC systems, specify that you are
26737 compiling for a VxWorks system.
26741 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
26742 header to indicate that @samp{eabi} extended relocations are used.
26748 On System V.4 and embedded PowerPC systems do (do not) adhere to the
26749 Embedded Applications Binary Interface (EABI), which is a set of
26750 modifications to the System V.4 specifications. Selecting @option{-meabi}
26751 means that the stack is aligned to an 8-byte boundary, a function
26752 @code{__eabi} is called from @code{main} to set up the EABI
26753 environment, and the @option{-msdata} option can use both @code{r2} and
26754 @code{r13} to point to two separate small data areas. Selecting
26755 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
26756 no EABI initialization function is called from @code{main}, and the
26757 @option{-msdata} option only uses @code{r13} to point to a single
26758 small data area. The @option{-meabi} option is on by default if you
26759 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
26762 @opindex msdata=eabi
26763 On System V.4 and embedded PowerPC systems, put small initialized
26764 @code{const} global and static data in the @code{.sdata2} section, which
26765 is pointed to by register @code{r2}. Put small initialized
26766 non-@code{const} global and static data in the @code{.sdata} section,
26767 which is pointed to by register @code{r13}. Put small uninitialized
26768 global and static data in the @code{.sbss} section, which is adjacent to
26769 the @code{.sdata} section. The @option{-msdata=eabi} option is
26770 incompatible with the @option{-mrelocatable} option. The
26771 @option{-msdata=eabi} option also sets the @option{-memb} option.
26774 @opindex msdata=sysv
26775 On System V.4 and embedded PowerPC systems, put small global and static
26776 data in the @code{.sdata} section, which is pointed to by register
26777 @code{r13}. Put small uninitialized global and static data in the
26778 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
26779 The @option{-msdata=sysv} option is incompatible with the
26780 @option{-mrelocatable} option.
26782 @item -msdata=default
26784 @opindex msdata=default
26786 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
26787 compile code the same as @option{-msdata=eabi}, otherwise compile code the
26788 same as @option{-msdata=sysv}.
26791 @opindex msdata=data
26792 On System V.4 and embedded PowerPC systems, put small global
26793 data in the @code{.sdata} section. Put small uninitialized global
26794 data in the @code{.sbss} section. Do not use register @code{r13}
26795 to address small data however. This is the default behavior unless
26796 other @option{-msdata} options are used.
26800 @opindex msdata=none
26802 On embedded PowerPC systems, put all initialized global and static data
26803 in the @code{.data} section, and all uninitialized data in the
26804 @code{.bss} section.
26806 @item -mreadonly-in-sdata
26807 @opindex mreadonly-in-sdata
26808 @opindex mno-readonly-in-sdata
26809 Put read-only objects in the @code{.sdata} section as well. This is the
26812 @item -mblock-move-inline-limit=@var{num}
26813 @opindex mblock-move-inline-limit
26814 Inline all block moves (such as calls to @code{memcpy} or structure
26815 copies) less than or equal to @var{num} bytes. The minimum value for
26816 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
26817 targets. The default value is target-specific.
26819 @item -mblock-compare-inline-limit=@var{num}
26820 @opindex mblock-compare-inline-limit
26821 Generate non-looping inline code for all block compares (such as calls
26822 to @code{memcmp} or structure compares) less than or equal to @var{num}
26823 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
26824 block compare is disabled. The default value is target-specific.
26826 @item -mblock-compare-inline-loop-limit=@var{num}
26827 @opindex mblock-compare-inline-loop-limit
26828 Generate an inline expansion using loop code for all block compares that
26829 are less than or equal to @var{num} bytes, but greater than the limit
26830 for non-loop inline block compare expansion. If the block length is not
26831 constant, at most @var{num} bytes will be compared before @code{memcmp}
26832 is called to compare the remainder of the block. The default value is
26835 @item -mstring-compare-inline-limit=@var{num}
26836 @opindex mstring-compare-inline-limit
26837 Compare at most @var{num} string bytes with inline code.
26838 If the difference or end of string is not found at the
26839 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
26840 take care of the rest of the comparison. The default is 64 bytes.
26844 @cindex smaller data references (PowerPC)
26845 @cindex .sdata/.sdata2 references (PowerPC)
26846 On embedded PowerPC systems, put global and static items less than or
26847 equal to @var{num} bytes into the small data or BSS sections instead of
26848 the normal data or BSS section. By default, @var{num} is 8. The
26849 @option{-G @var{num}} switch is also passed to the linker.
26850 All modules should be compiled with the same @option{-G @var{num}} value.
26853 @itemx -mno-regnames
26855 @opindex mno-regnames
26856 On System V.4 and embedded PowerPC systems do (do not) emit register
26857 names in the assembly language output using symbolic forms.
26860 @itemx -mno-longcall
26862 @opindex mno-longcall
26863 By default assume that all calls are far away so that a longer and more
26864 expensive calling sequence is required. This is required for calls
26865 farther than 32 megabytes (33,554,432 bytes) from the current location.
26866 A short call is generated if the compiler knows
26867 the call cannot be that far away. This setting can be overridden by
26868 the @code{shortcall} function attribute, or by @code{#pragma
26871 Some linkers are capable of detecting out-of-range calls and generating
26872 glue code on the fly. On these systems, long calls are unnecessary and
26873 generate slower code. As of this writing, the AIX linker can do this,
26874 as can the GNU linker for PowerPC/64. It is planned to add this feature
26875 to the GNU linker for 32-bit PowerPC systems as well.
26877 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
26878 GCC can generate long calls using an inline PLT call sequence (see
26879 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
26880 ELFv1 (big-endian) do not support inline PLT calls.
26882 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
26883 callee, L42}, plus a @dfn{branch island} (glue code). The two target
26884 addresses represent the callee and the branch island. The
26885 Darwin/PPC linker prefers the first address and generates a @code{bl
26886 callee} if the PPC @code{bl} instruction reaches the callee directly;
26887 otherwise, the linker generates @code{bl L42} to call the branch
26888 island. The branch island is appended to the body of the
26889 calling function; it computes the full 32-bit address of the callee
26892 On Mach-O (Darwin) systems, this option directs the compiler emit to
26893 the glue for every direct call, and the Darwin linker decides whether
26894 to use or discard it.
26896 In the future, GCC may ignore all longcall specifications
26897 when the linker is known to generate glue.
26902 @opindex mno-pltseq
26903 Implement (do not implement) -fno-plt and long calls using an inline
26904 PLT call sequence that supports lazy linking and long calls to
26905 functions in dlopen'd shared libraries. Inline PLT calls are only
26906 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
26907 linkers, and are enabled by default if the support is detected when
26908 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
26909 configured with @option{--enable-secureplt}. @option{-mpltseq} code
26910 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
26913 @item -mtls-markers
26914 @itemx -mno-tls-markers
26915 @opindex mtls-markers
26916 @opindex mno-tls-markers
26917 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
26918 specifying the function argument. The relocation allows the linker to
26919 reliably associate function call with argument setup instructions for
26920 TLS optimization, which in turn allows GCC to better schedule the
26926 This option enables use of the reciprocal estimate and
26927 reciprocal square root estimate instructions with additional
26928 Newton-Raphson steps to increase precision instead of doing a divide or
26929 square root and divide for floating-point arguments. You should use
26930 the @option{-ffast-math} option when using @option{-mrecip} (or at
26931 least @option{-funsafe-math-optimizations},
26932 @option{-ffinite-math-only}, @option{-freciprocal-math} and
26933 @option{-fno-trapping-math}). Note that while the throughput of the
26934 sequence is generally higher than the throughput of the non-reciprocal
26935 instruction, the precision of the sequence can be decreased by up to 2
26936 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
26939 @item -mrecip=@var{opt}
26940 @opindex mrecip=opt
26941 This option controls which reciprocal estimate instructions
26942 may be used. @var{opt} is a comma-separated list of options, which may
26943 be preceded by a @code{!} to invert the option:
26948 Enable all estimate instructions.
26951 Enable the default instructions, equivalent to @option{-mrecip}.
26954 Disable all estimate instructions, equivalent to @option{-mno-recip}.
26957 Enable the reciprocal approximation instructions for both
26958 single and double precision.
26961 Enable the single-precision reciprocal approximation instructions.
26964 Enable the double-precision reciprocal approximation instructions.
26967 Enable the reciprocal square root approximation instructions for both
26968 single and double precision.
26971 Enable the single-precision reciprocal square root approximation instructions.
26974 Enable the double-precision reciprocal square root approximation instructions.
26978 So, for example, @option{-mrecip=all,!rsqrtd} enables
26979 all of the reciprocal estimate instructions, except for the
26980 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
26981 which handle the double-precision reciprocal square root calculations.
26983 @item -mrecip-precision
26984 @itemx -mno-recip-precision
26985 @opindex mrecip-precision
26986 Assume (do not assume) that the reciprocal estimate instructions
26987 provide higher-precision estimates than is mandated by the PowerPC
26988 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
26989 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
26990 The double-precision square root estimate instructions are not generated by
26991 default on low-precision machines, since they do not provide an
26992 estimate that converges after three steps.
26994 @item -mveclibabi=@var{type}
26995 @opindex mveclibabi
26996 Specifies the ABI type to use for vectorizing intrinsics using an
26997 external library. The only type supported at present is @samp{mass},
26998 which specifies to use IBM's Mathematical Acceleration Subsystem
26999 (MASS) libraries for vectorizing intrinsics using external libraries.
27000 GCC currently emits calls to @code{acosd2}, @code{acosf4},
27001 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
27002 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
27003 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
27004 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
27005 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
27006 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
27007 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
27008 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
27009 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
27010 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
27011 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
27012 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
27013 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
27014 for power7. Both @option{-ftree-vectorize} and
27015 @option{-funsafe-math-optimizations} must also be enabled. The MASS
27016 libraries must be specified at link time.
27021 Generate (do not generate) the @code{friz} instruction when the
27022 @option{-funsafe-math-optimizations} option is used to optimize
27023 rounding of floating-point values to 64-bit integer and back to floating
27024 point. The @code{friz} instruction does not return the same value if
27025 the floating-point number is too large to fit in an integer.
27027 @item -mpointers-to-nested-functions
27028 @itemx -mno-pointers-to-nested-functions
27029 @opindex mpointers-to-nested-functions
27030 Generate (do not generate) code to load up the static chain register
27031 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
27032 systems where a function pointer points to a 3-word descriptor giving
27033 the function address, TOC value to be loaded in register @code{r2}, and
27034 static chain value to be loaded in register @code{r11}. The
27035 @option{-mpointers-to-nested-functions} is on by default. You cannot
27036 call through pointers to nested functions or pointers
27037 to functions compiled in other languages that use the static chain if
27038 you use @option{-mno-pointers-to-nested-functions}.
27040 @item -msave-toc-indirect
27041 @itemx -mno-save-toc-indirect
27042 @opindex msave-toc-indirect
27043 Generate (do not generate) code to save the TOC value in the reserved
27044 stack location in the function prologue if the function calls through
27045 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
27046 saved in the prologue, it is saved just before the call through the
27047 pointer. The @option{-mno-save-toc-indirect} option is the default.
27049 @item -mcompat-align-parm
27050 @itemx -mno-compat-align-parm
27051 @opindex mcompat-align-parm
27052 Generate (do not generate) code to pass structure parameters with a
27053 maximum alignment of 64 bits, for compatibility with older versions
27056 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
27057 structure parameter on a 128-bit boundary when that structure contained
27058 a member requiring 128-bit alignment. This is corrected in more
27059 recent versions of GCC. This option may be used to generate code
27060 that is compatible with functions compiled with older versions of
27063 The @option{-mno-compat-align-parm} option is the default.
27065 @item -mstack-protector-guard=@var{guard}
27066 @itemx -mstack-protector-guard-reg=@var{reg}
27067 @itemx -mstack-protector-guard-offset=@var{offset}
27068 @itemx -mstack-protector-guard-symbol=@var{symbol}
27069 @opindex mstack-protector-guard
27070 @opindex mstack-protector-guard-reg
27071 @opindex mstack-protector-guard-offset
27072 @opindex mstack-protector-guard-symbol
27073 Generate stack protection code using canary at @var{guard}. Supported
27074 locations are @samp{global} for global canary or @samp{tls} for per-thread
27075 canary in the TLS block (the default with GNU libc version 2.4 or later).
27077 With the latter choice the options
27078 @option{-mstack-protector-guard-reg=@var{reg}} and
27079 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27080 which register to use as base register for reading the canary, and from what
27081 offset from that base register. The default for those is as specified in the
27082 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
27083 the offset with a symbol reference to a canary in the TLS block.
27089 Generate (do not generate) pc-relative addressing when the option
27090 @option{-mcpu=future} is used. The @option{-mpcrel} option requires
27091 that the medium code model (@option{-mcmodel=medium}) and prefixed
27092 addressing (@option{-mprefixed}) options are enabled.
27095 @itemx -mno-prefixed
27097 @opindex mno-prefixed
27098 Generate (do not generate) addressing modes using prefixed load and
27099 store instructions when the option @option{-mcpu=future} is used.
27105 Generate (do not generate) the MMA instructions when the option
27106 @option{-mcpu=future} is used.
27108 @item -mblock-ops-unaligned-vsx
27109 @itemx -mno-block-ops-unaligned-vsx
27110 @opindex block-ops-unaligned-vsx
27111 @opindex no-block-ops-unaligned-vsx
27112 Generate (do not generate) unaligned vsx loads and stores for
27113 inline expansion of @code{memcpy} and @code{memmove}.
27117 @subsection RX Options
27120 These command-line options are defined for RX targets:
27123 @item -m64bit-doubles
27124 @itemx -m32bit-doubles
27125 @opindex m64bit-doubles
27126 @opindex m32bit-doubles
27127 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
27128 or 32 bits (@option{-m32bit-doubles}) in size. The default is
27129 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
27130 works on 32-bit values, which is why the default is
27131 @option{-m32bit-doubles}.
27137 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
27138 floating-point hardware. The default is enabled for the RX600
27139 series and disabled for the RX200 series.
27141 Floating-point instructions are only generated for 32-bit floating-point
27142 values, however, so the FPU hardware is not used for doubles if the
27143 @option{-m64bit-doubles} option is used.
27145 @emph{Note} If the @option{-fpu} option is enabled then
27146 @option{-funsafe-math-optimizations} is also enabled automatically.
27147 This is because the RX FPU instructions are themselves unsafe.
27149 @item -mcpu=@var{name}
27151 Selects the type of RX CPU to be targeted. Currently three types are
27152 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
27153 the specific @samp{RX610} CPU. The default is @samp{RX600}.
27155 The only difference between @samp{RX600} and @samp{RX610} is that the
27156 @samp{RX610} does not support the @code{MVTIPL} instruction.
27158 The @samp{RX200} series does not have a hardware floating-point unit
27159 and so @option{-nofpu} is enabled by default when this type is
27162 @item -mbig-endian-data
27163 @itemx -mlittle-endian-data
27164 @opindex mbig-endian-data
27165 @opindex mlittle-endian-data
27166 Store data (but not code) in the big-endian format. The default is
27167 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
27170 @item -msmall-data-limit=@var{N}
27171 @opindex msmall-data-limit
27172 Specifies the maximum size in bytes of global and static variables
27173 which can be placed into the small data area. Using the small data
27174 area can lead to smaller and faster code, but the size of area is
27175 limited and it is up to the programmer to ensure that the area does
27176 not overflow. Also when the small data area is used one of the RX's
27177 registers (usually @code{r13}) is reserved for use pointing to this
27178 area, so it is no longer available for use by the compiler. This
27179 could result in slower and/or larger code if variables are pushed onto
27180 the stack instead of being held in this register.
27182 Note, common variables (variables that have not been initialized) and
27183 constants are not placed into the small data area as they are assigned
27184 to other sections in the output executable.
27186 The default value is zero, which disables this feature. Note, this
27187 feature is not enabled by default with higher optimization levels
27188 (@option{-O2} etc) because of the potentially detrimental effects of
27189 reserving a register. It is up to the programmer to experiment and
27190 discover whether this feature is of benefit to their program. See the
27191 description of the @option{-mpid} option for a description of how the
27192 actual register to hold the small data area pointer is chosen.
27198 Use the simulator runtime. The default is to use the libgloss
27199 board-specific runtime.
27201 @item -mas100-syntax
27202 @itemx -mno-as100-syntax
27203 @opindex mas100-syntax
27204 @opindex mno-as100-syntax
27205 When generating assembler output use a syntax that is compatible with
27206 Renesas's AS100 assembler. This syntax can also be handled by the GAS
27207 assembler, but it has some restrictions so it is not generated by default.
27209 @item -mmax-constant-size=@var{N}
27210 @opindex mmax-constant-size
27211 Specifies the maximum size, in bytes, of a constant that can be used as
27212 an operand in a RX instruction. Although the RX instruction set does
27213 allow constants of up to 4 bytes in length to be used in instructions,
27214 a longer value equates to a longer instruction. Thus in some
27215 circumstances it can be beneficial to restrict the size of constants
27216 that are used in instructions. Constants that are too big are instead
27217 placed into a constant pool and referenced via register indirection.
27219 The value @var{N} can be between 0 and 4. A value of 0 (the default)
27220 or 4 means that constants of any size are allowed.
27224 Enable linker relaxation. Linker relaxation is a process whereby the
27225 linker attempts to reduce the size of a program by finding shorter
27226 versions of various instructions. Disabled by default.
27228 @item -mint-register=@var{N}
27229 @opindex mint-register
27230 Specify the number of registers to reserve for fast interrupt handler
27231 functions. The value @var{N} can be between 0 and 4. A value of 1
27232 means that register @code{r13} is reserved for the exclusive use
27233 of fast interrupt handlers. A value of 2 reserves @code{r13} and
27234 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
27235 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
27236 A value of 0, the default, does not reserve any registers.
27238 @item -msave-acc-in-interrupts
27239 @opindex msave-acc-in-interrupts
27240 Specifies that interrupt handler functions should preserve the
27241 accumulator register. This is only necessary if normal code might use
27242 the accumulator register, for example because it performs 64-bit
27243 multiplications. The default is to ignore the accumulator as this
27244 makes the interrupt handlers faster.
27250 Enables the generation of position independent data. When enabled any
27251 access to constant data is done via an offset from a base address
27252 held in a register. This allows the location of constant data to be
27253 determined at run time without requiring the executable to be
27254 relocated, which is a benefit to embedded applications with tight
27255 memory constraints. Data that can be modified is not affected by this
27258 Note, using this feature reserves a register, usually @code{r13}, for
27259 the constant data base address. This can result in slower and/or
27260 larger code, especially in complicated functions.
27262 The actual register chosen to hold the constant data base address
27263 depends upon whether the @option{-msmall-data-limit} and/or the
27264 @option{-mint-register} command-line options are enabled. Starting
27265 with register @code{r13} and proceeding downwards, registers are
27266 allocated first to satisfy the requirements of @option{-mint-register},
27267 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
27268 is possible for the small data area register to be @code{r8} if both
27269 @option{-mint-register=4} and @option{-mpid} are specified on the
27272 By default this feature is not enabled. The default can be restored
27273 via the @option{-mno-pid} command-line option.
27275 @item -mno-warn-multiple-fast-interrupts
27276 @itemx -mwarn-multiple-fast-interrupts
27277 @opindex mno-warn-multiple-fast-interrupts
27278 @opindex mwarn-multiple-fast-interrupts
27279 Prevents GCC from issuing a warning message if it finds more than one
27280 fast interrupt handler when it is compiling a file. The default is to
27281 issue a warning for each extra fast interrupt handler found, as the RX
27282 only supports one such interrupt.
27284 @item -mallow-string-insns
27285 @itemx -mno-allow-string-insns
27286 @opindex mallow-string-insns
27287 @opindex mno-allow-string-insns
27288 Enables or disables the use of the string manipulation instructions
27289 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
27290 @code{SWHILE} and also the @code{RMPA} instruction. These
27291 instructions may prefetch data, which is not safe to do if accessing
27292 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
27293 for more information).
27295 The default is to allow these instructions, but it is not possible for
27296 GCC to reliably detect all circumstances where a string instruction
27297 might be used to access an I/O register, so their use cannot be
27298 disabled automatically. Instead it is reliant upon the programmer to
27299 use the @option{-mno-allow-string-insns} option if their program
27300 accesses I/O space.
27302 When the instructions are enabled GCC defines the C preprocessor
27303 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
27304 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
27310 Use only (or not only) @code{JSR} instructions to access functions.
27311 This option can be used when code size exceeds the range of @code{BSR}
27312 instructions. Note that @option{-mno-jsr} does not mean to not use
27313 @code{JSR} but instead means that any type of branch may be used.
27316 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
27317 has special significance to the RX port when used with the
27318 @code{interrupt} function attribute. This attribute indicates a
27319 function intended to process fast interrupts. GCC ensures
27320 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
27321 and/or @code{r13} and only provided that the normal use of the
27322 corresponding registers have been restricted via the
27323 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
27326 @node S/390 and zSeries Options
27327 @subsection S/390 and zSeries Options
27328 @cindex S/390 and zSeries Options
27330 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
27334 @itemx -msoft-float
27335 @opindex mhard-float
27336 @opindex msoft-float
27337 Use (do not use) the hardware floating-point instructions and registers
27338 for floating-point operations. When @option{-msoft-float} is specified,
27339 functions in @file{libgcc.a} are used to perform floating-point
27340 operations. When @option{-mhard-float} is specified, the compiler
27341 generates IEEE floating-point instructions. This is the default.
27344 @itemx -mno-hard-dfp
27346 @opindex mno-hard-dfp
27347 Use (do not use) the hardware decimal-floating-point instructions for
27348 decimal-floating-point operations. When @option{-mno-hard-dfp} is
27349 specified, functions in @file{libgcc.a} are used to perform
27350 decimal-floating-point operations. When @option{-mhard-dfp} is
27351 specified, the compiler generates decimal-floating-point hardware
27352 instructions. This is the default for @option{-march=z9-ec} or higher.
27354 @item -mlong-double-64
27355 @itemx -mlong-double-128
27356 @opindex mlong-double-64
27357 @opindex mlong-double-128
27358 These switches control the size of @code{long double} type. A size
27359 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27360 type. This is the default.
27363 @itemx -mno-backchain
27364 @opindex mbackchain
27365 @opindex mno-backchain
27366 Store (do not store) the address of the caller's frame as backchain pointer
27367 into the callee's stack frame.
27368 A backchain may be needed to allow debugging using tools that do not understand
27369 DWARF call frame information.
27370 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
27371 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
27372 the backchain is placed into the topmost word of the 96/160 byte register
27375 In general, code compiled with @option{-mbackchain} is call-compatible with
27376 code compiled with @option{-mmo-backchain}; however, use of the backchain
27377 for debugging purposes usually requires that the whole binary is built with
27378 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
27379 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
27380 to build a linux kernel use @option{-msoft-float}.
27382 The default is to not maintain the backchain.
27384 @item -mpacked-stack
27385 @itemx -mno-packed-stack
27386 @opindex mpacked-stack
27387 @opindex mno-packed-stack
27388 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
27389 specified, the compiler uses the all fields of the 96/160 byte register save
27390 area only for their default purpose; unused fields still take up stack space.
27391 When @option{-mpacked-stack} is specified, register save slots are densely
27392 packed at the top of the register save area; unused space is reused for other
27393 purposes, allowing for more efficient use of the available stack space.
27394 However, when @option{-mbackchain} is also in effect, the topmost word of
27395 the save area is always used to store the backchain, and the return address
27396 register is always saved two words below the backchain.
27398 As long as the stack frame backchain is not used, code generated with
27399 @option{-mpacked-stack} is call-compatible with code generated with
27400 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
27401 S/390 or zSeries generated code that uses the stack frame backchain at run
27402 time, not just for debugging purposes. Such code is not call-compatible
27403 with code compiled with @option{-mpacked-stack}. Also, note that the
27404 combination of @option{-mbackchain},
27405 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
27406 to build a linux kernel use @option{-msoft-float}.
27408 The default is to not use the packed stack layout.
27411 @itemx -mno-small-exec
27412 @opindex msmall-exec
27413 @opindex mno-small-exec
27414 Generate (or do not generate) code using the @code{bras} instruction
27415 to do subroutine calls.
27416 This only works reliably if the total executable size does not
27417 exceed 64k. The default is to use the @code{basr} instruction instead,
27418 which does not have this limitation.
27424 When @option{-m31} is specified, generate code compliant to the
27425 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
27426 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
27427 particular to generate 64-bit instructions. For the @samp{s390}
27428 targets, the default is @option{-m31}, while the @samp{s390x}
27429 targets default to @option{-m64}.
27435 When @option{-mzarch} is specified, generate code using the
27436 instructions available on z/Architecture.
27437 When @option{-mesa} is specified, generate code using the
27438 instructions available on ESA/390. Note that @option{-mesa} is
27439 not possible with @option{-m64}.
27440 When generating code compliant to the GNU/Linux for S/390 ABI,
27441 the default is @option{-mesa}. When generating code compliant
27442 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
27448 The @option{-mhtm} option enables a set of builtins making use of
27449 instructions available with the transactional execution facility
27450 introduced with the IBM zEnterprise EC12 machine generation
27451 @ref{S/390 System z Built-in Functions}.
27452 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
27458 When @option{-mvx} is specified, generate code using the instructions
27459 available with the vector extension facility introduced with the IBM
27460 z13 machine generation.
27461 This option changes the ABI for some vector type values with regard to
27462 alignment and calling conventions. In case vector type values are
27463 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
27464 command will be added to mark the resulting binary with the ABI used.
27465 @option{-mvx} is enabled by default when using @option{-march=z13}.
27468 @itemx -mno-zvector
27470 @opindex mno-zvector
27471 The @option{-mzvector} option enables vector language extensions and
27472 builtins using instructions available with the vector extension
27473 facility introduced with the IBM z13 machine generation.
27474 This option adds support for @samp{vector} to be used as a keyword to
27475 define vector type variables and arguments. @samp{vector} is only
27476 available when GNU extensions are enabled. It will not be expanded
27477 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
27478 In addition to the GCC low-level builtins @option{-mzvector} enables
27479 a set of builtins added for compatibility with AltiVec-style
27480 implementations like Power and Cell. In order to make use of these
27481 builtins the header file @file{vecintrin.h} needs to be included.
27482 @option{-mzvector} is disabled by default.
27488 Generate (or do not generate) code using the @code{mvcle} instruction
27489 to perform block moves. When @option{-mno-mvcle} is specified,
27490 use a @code{mvc} loop instead. This is the default unless optimizing for
27497 Print (or do not print) additional debug information when compiling.
27498 The default is to not print debug information.
27500 @item -march=@var{cpu-type}
27502 Generate code that runs on @var{cpu-type}, which is the name of a
27503 system representing a certain processor type. Possible values for
27504 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
27505 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
27506 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
27507 @samp{z14}/@samp{arch12}, and @samp{native}.
27509 The default is @option{-march=z900}.
27511 Specifying @samp{native} as cpu type can be used to select the best
27512 architecture option for the host processor.
27513 @option{-march=native} has no effect if GCC does not recognize the
27516 @item -mtune=@var{cpu-type}
27518 Tune to @var{cpu-type} everything applicable about the generated code,
27519 except for the ABI and the set of available instructions.
27520 The list of @var{cpu-type} values is the same as for @option{-march}.
27521 The default is the value used for @option{-march}.
27524 @itemx -mno-tpf-trace
27525 @opindex mtpf-trace
27526 @opindex mno-tpf-trace
27527 Generate code that adds (does not add) in TPF OS specific branches to trace
27528 routines in the operating system. This option is off by default, even
27529 when compiling for the TPF OS@.
27531 @item -mtpf-trace-skip
27532 @itemx -mno-tpf-trace-skip
27533 @opindex mtpf-trace-skip
27534 @opindex mno-tpf-trace-skip
27535 Generate code that changes (does not change) the default branch
27536 targets enabled by @option{-mtpf-trace} to point to specialized trace
27537 routines providing the ability of selectively skipping function trace
27538 entries for the TPF OS. This option is off by default, even when
27539 compiling for the TPF OS and specifying @option{-mtpf-trace}.
27542 @itemx -mno-fused-madd
27543 @opindex mfused-madd
27544 @opindex mno-fused-madd
27545 Generate code that uses (does not use) the floating-point multiply and
27546 accumulate instructions. These instructions are generated by default if
27547 hardware floating point is used.
27549 @item -mwarn-framesize=@var{framesize}
27550 @opindex mwarn-framesize
27551 Emit a warning if the current function exceeds the given frame size. Because
27552 this is a compile-time check it doesn't need to be a real problem when the program
27553 runs. It is intended to identify functions that most probably cause
27554 a stack overflow. It is useful to be used in an environment with limited stack
27555 size e.g.@: the linux kernel.
27557 @item -mwarn-dynamicstack
27558 @opindex mwarn-dynamicstack
27559 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
27560 arrays. This is generally a bad idea with a limited stack size.
27562 @item -mstack-guard=@var{stack-guard}
27563 @itemx -mstack-size=@var{stack-size}
27564 @opindex mstack-guard
27565 @opindex mstack-size
27566 If these options are provided the S/390 back end emits additional instructions in
27567 the function prologue that trigger a trap if the stack size is @var{stack-guard}
27568 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
27569 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
27570 the frame size of the compiled function is chosen.
27571 These options are intended to be used to help debugging stack overflow problems.
27572 The additionally emitted code causes only little overhead and hence can also be
27573 used in production-like systems without greater performance degradation. The given
27574 values have to be exact powers of 2 and @var{stack-size} has to be greater than
27575 @var{stack-guard} without exceeding 64k.
27576 In order to be efficient the extra code makes the assumption that the stack starts
27577 at an address aligned to the value given by @var{stack-size}.
27578 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
27580 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
27582 If the hotpatch option is enabled, a ``hot-patching'' function
27583 prologue is generated for all functions in the compilation unit.
27584 The funtion label is prepended with the given number of two-byte
27585 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
27586 the label, 2 * @var{post-halfwords} bytes are appended, using the
27587 largest NOP like instructions the architecture allows (maximum
27590 If both arguments are zero, hotpatching is disabled.
27592 This option can be overridden for individual functions with the
27593 @code{hotpatch} attribute.
27596 @node Score Options
27597 @subsection Score Options
27598 @cindex Score Options
27600 These options are defined for Score implementations:
27605 Compile code for big-endian mode. This is the default.
27609 Compile code for little-endian mode.
27613 Disable generation of @code{bcnz} instructions.
27617 Enable generation of unaligned load and store instructions.
27621 Enable the use of multiply-accumulate instructions. Disabled by default.
27625 Specify the SCORE5 as the target architecture.
27629 Specify the SCORE5U of the target architecture.
27633 Specify the SCORE7 as the target architecture. This is the default.
27637 Specify the SCORE7D as the target architecture.
27641 @subsection SH Options
27643 These @samp{-m} options are defined for the SH implementations:
27648 Generate code for the SH1.
27652 Generate code for the SH2.
27655 Generate code for the SH2e.
27659 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
27660 that the floating-point unit is not used.
27662 @item -m2a-single-only
27663 @opindex m2a-single-only
27664 Generate code for the SH2a-FPU, in such a way that no double-precision
27665 floating-point operations are used.
27668 @opindex m2a-single
27669 Generate code for the SH2a-FPU assuming the floating-point unit is in
27670 single-precision mode by default.
27674 Generate code for the SH2a-FPU assuming the floating-point unit is in
27675 double-precision mode by default.
27679 Generate code for the SH3.
27683 Generate code for the SH3e.
27687 Generate code for the SH4 without a floating-point unit.
27689 @item -m4-single-only
27690 @opindex m4-single-only
27691 Generate code for the SH4 with a floating-point unit that only
27692 supports single-precision arithmetic.
27696 Generate code for the SH4 assuming the floating-point unit is in
27697 single-precision mode by default.
27701 Generate code for the SH4.
27705 Generate code for SH4-100.
27707 @item -m4-100-nofpu
27708 @opindex m4-100-nofpu
27709 Generate code for SH4-100 in such a way that the
27710 floating-point unit is not used.
27712 @item -m4-100-single
27713 @opindex m4-100-single
27714 Generate code for SH4-100 assuming the floating-point unit is in
27715 single-precision mode by default.
27717 @item -m4-100-single-only
27718 @opindex m4-100-single-only
27719 Generate code for SH4-100 in such a way that no double-precision
27720 floating-point operations are used.
27724 Generate code for SH4-200.
27726 @item -m4-200-nofpu
27727 @opindex m4-200-nofpu
27728 Generate code for SH4-200 without in such a way that the
27729 floating-point unit is not used.
27731 @item -m4-200-single
27732 @opindex m4-200-single
27733 Generate code for SH4-200 assuming the floating-point unit is in
27734 single-precision mode by default.
27736 @item -m4-200-single-only
27737 @opindex m4-200-single-only
27738 Generate code for SH4-200 in such a way that no double-precision
27739 floating-point operations are used.
27743 Generate code for SH4-300.
27745 @item -m4-300-nofpu
27746 @opindex m4-300-nofpu
27747 Generate code for SH4-300 without in such a way that the
27748 floating-point unit is not used.
27750 @item -m4-300-single
27751 @opindex m4-300-single
27752 Generate code for SH4-300 in such a way that no double-precision
27753 floating-point operations are used.
27755 @item -m4-300-single-only
27756 @opindex m4-300-single-only
27757 Generate code for SH4-300 in such a way that no double-precision
27758 floating-point operations are used.
27762 Generate code for SH4-340 (no MMU, no FPU).
27766 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
27771 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
27772 floating-point unit is not used.
27774 @item -m4a-single-only
27775 @opindex m4a-single-only
27776 Generate code for the SH4a, in such a way that no double-precision
27777 floating-point operations are used.
27780 @opindex m4a-single
27781 Generate code for the SH4a assuming the floating-point unit is in
27782 single-precision mode by default.
27786 Generate code for the SH4a.
27790 Same as @option{-m4a-nofpu}, except that it implicitly passes
27791 @option{-dsp} to the assembler. GCC doesn't generate any DSP
27792 instructions at the moment.
27796 Compile code for the processor in big-endian mode.
27800 Compile code for the processor in little-endian mode.
27804 Align doubles at 64-bit boundaries. Note that this changes the calling
27805 conventions, and thus some functions from the standard C library do
27806 not work unless you recompile it first with @option{-mdalign}.
27810 Shorten some address references at link time, when possible; uses the
27811 linker option @option{-relax}.
27815 Use 32-bit offsets in @code{switch} tables. The default is to use
27820 Enable the use of bit manipulation instructions on SH2A.
27824 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
27825 alignment constraints.
27829 Comply with the calling conventions defined by Renesas.
27832 @opindex mno-renesas
27833 Comply with the calling conventions defined for GCC before the Renesas
27834 conventions were available. This option is the default for all
27835 targets of the SH toolchain.
27838 @opindex mnomacsave
27839 Mark the @code{MAC} register as call-clobbered, even if
27840 @option{-mrenesas} is given.
27846 Control the IEEE compliance of floating-point comparisons, which affects the
27847 handling of cases where the result of a comparison is unordered. By default
27848 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
27849 enabled @option{-mno-ieee} is implicitly set, which results in faster
27850 floating-point greater-equal and less-equal comparisons. The implicit settings
27851 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
27853 @item -minline-ic_invalidate
27854 @opindex minline-ic_invalidate
27855 Inline code to invalidate instruction cache entries after setting up
27856 nested function trampolines.
27857 This option has no effect if @option{-musermode} is in effect and the selected
27858 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
27860 If the selected code generation option does not allow the use of the @code{icbi}
27861 instruction, and @option{-musermode} is not in effect, the inlined code
27862 manipulates the instruction cache address array directly with an associative
27863 write. This not only requires privileged mode at run time, but it also
27864 fails if the cache line had been mapped via the TLB and has become unmapped.
27868 Dump instruction size and location in the assembly code.
27871 @opindex mpadstruct
27872 This option is deprecated. It pads structures to multiple of 4 bytes,
27873 which is incompatible with the SH ABI@.
27875 @item -matomic-model=@var{model}
27876 @opindex matomic-model=@var{model}
27877 Sets the model of atomic operations and additional parameters as a comma
27878 separated list. For details on the atomic built-in functions see
27879 @ref{__atomic Builtins}. The following models and parameters are supported:
27884 Disable compiler generated atomic sequences and emit library calls for atomic
27885 operations. This is the default if the target is not @code{sh*-*-linux*}.
27888 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
27889 built-in functions. The generated atomic sequences require additional support
27890 from the interrupt/exception handling code of the system and are only suitable
27891 for SH3* and SH4* single-core systems. This option is enabled by default when
27892 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
27893 this option also partially utilizes the hardware atomic instructions
27894 @code{movli.l} and @code{movco.l} to create more efficient code, unless
27895 @samp{strict} is specified.
27898 Generate software atomic sequences that use a variable in the thread control
27899 block. This is a variation of the gUSA sequences which can also be used on
27900 SH1* and SH2* targets. The generated atomic sequences require additional
27901 support from the interrupt/exception handling code of the system and are only
27902 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
27903 parameter has to be specified as well.
27906 Generate software atomic sequences that temporarily disable interrupts by
27907 setting @code{SR.IMASK = 1111}. This model works only when the program runs
27908 in privileged mode and is only suitable for single-core systems. Additional
27909 support from the interrupt/exception handling code of the system is not
27910 required. This model is enabled by default when the target is
27911 @code{sh*-*-linux*} and SH1* or SH2*.
27914 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
27915 instructions only. This is only available on SH4A and is suitable for
27916 multi-core systems. Since the hardware instructions support only 32 bit atomic
27917 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
27918 Code compiled with this option is also compatible with other software
27919 atomic model interrupt/exception handling systems if executed on an SH4A
27920 system. Additional support from the interrupt/exception handling code of the
27921 system is not required for this model.
27924 This parameter specifies the offset in bytes of the variable in the thread
27925 control block structure that should be used by the generated atomic sequences
27926 when the @samp{soft-tcb} model has been selected. For other models this
27927 parameter is ignored. The specified value must be an integer multiple of four
27928 and in the range 0-1020.
27931 This parameter prevents mixed usage of multiple atomic models, even if they
27932 are compatible, and makes the compiler generate atomic sequences of the
27933 specified model only.
27939 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
27940 Notice that depending on the particular hardware and software configuration
27941 this can degrade overall performance due to the operand cache line flushes
27942 that are implied by the @code{tas.b} instruction. On multi-core SH4A
27943 processors the @code{tas.b} instruction must be used with caution since it
27944 can result in data corruption for certain cache configurations.
27947 @opindex mprefergot
27948 When generating position-independent code, emit function calls using
27949 the Global Offset Table instead of the Procedure Linkage Table.
27952 @itemx -mno-usermode
27954 @opindex mno-usermode
27955 Don't allow (allow) the compiler generating privileged mode code. Specifying
27956 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
27957 inlined code would not work in user mode. @option{-musermode} is the default
27958 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
27959 @option{-musermode} has no effect, since there is no user mode.
27961 @item -multcost=@var{number}
27962 @opindex multcost=@var{number}
27963 Set the cost to assume for a multiply insn.
27965 @item -mdiv=@var{strategy}
27966 @opindex mdiv=@var{strategy}
27967 Set the division strategy to be used for integer division operations.
27968 @var{strategy} can be one of:
27973 Calls a library function that uses the single-step division instruction
27974 @code{div1} to perform the operation. Division by zero calculates an
27975 unspecified result and does not trap. This is the default except for SH4,
27976 SH2A and SHcompact.
27979 Calls a library function that performs the operation in double precision
27980 floating point. Division by zero causes a floating-point exception. This is
27981 the default for SHcompact with FPU. Specifying this for targets that do not
27982 have a double precision FPU defaults to @code{call-div1}.
27985 Calls a library function that uses a lookup table for small divisors and
27986 the @code{div1} instruction with case distinction for larger divisors. Division
27987 by zero calculates an unspecified result and does not trap. This is the default
27988 for SH4. Specifying this for targets that do not have dynamic shift
27989 instructions defaults to @code{call-div1}.
27993 When a division strategy has not been specified the default strategy is
27994 selected based on the current target. For SH2A the default strategy is to
27995 use the @code{divs} and @code{divu} instructions instead of library function
27998 @item -maccumulate-outgoing-args
27999 @opindex maccumulate-outgoing-args
28000 Reserve space once for outgoing arguments in the function prologue rather
28001 than around each call. Generally beneficial for performance and size. Also
28002 needed for unwinding to avoid changing the stack frame around conditional code.
28004 @item -mdivsi3_libfunc=@var{name}
28005 @opindex mdivsi3_libfunc=@var{name}
28006 Set the name of the library function used for 32-bit signed division to
28008 This only affects the name used in the @samp{call} division strategies, and
28009 the compiler still expects the same sets of input/output/clobbered registers as
28010 if this option were not present.
28012 @item -mfixed-range=@var{register-range}
28013 @opindex mfixed-range
28014 Generate code treating the given register range as fixed registers.
28015 A fixed register is one that the register allocator cannot use. This is
28016 useful when compiling kernel code. A register range is specified as
28017 two registers separated by a dash. Multiple register ranges can be
28018 specified separated by a comma.
28020 @item -mbranch-cost=@var{num}
28021 @opindex mbranch-cost=@var{num}
28022 Assume @var{num} to be the cost for a branch instruction. Higher numbers
28023 make the compiler try to generate more branch-free code if possible.
28024 If not specified the value is selected depending on the processor type that
28025 is being compiled for.
28028 @itemx -mno-zdcbranch
28029 @opindex mzdcbranch
28030 @opindex mno-zdcbranch
28031 Assume (do not assume) that zero displacement conditional branch instructions
28032 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
28033 compiler prefers zero displacement branch code sequences. This is
28034 enabled by default when generating code for SH4 and SH4A. It can be explicitly
28035 disabled by specifying @option{-mno-zdcbranch}.
28037 @item -mcbranch-force-delay-slot
28038 @opindex mcbranch-force-delay-slot
28039 Force the usage of delay slots for conditional branches, which stuffs the delay
28040 slot with a @code{nop} if a suitable instruction cannot be found. By default
28041 this option is disabled. It can be enabled to work around hardware bugs as
28042 found in the original SH7055.
28045 @itemx -mno-fused-madd
28046 @opindex mfused-madd
28047 @opindex mno-fused-madd
28048 Generate code that uses (does not use) the floating-point multiply and
28049 accumulate instructions. These instructions are generated by default
28050 if hardware floating point is used. The machine-dependent
28051 @option{-mfused-madd} option is now mapped to the machine-independent
28052 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
28053 mapped to @option{-ffp-contract=off}.
28059 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
28060 and cosine approximations. The option @option{-mfsca} must be used in
28061 combination with @option{-funsafe-math-optimizations}. It is enabled by default
28062 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
28063 approximations even if @option{-funsafe-math-optimizations} is in effect.
28069 Allow or disallow the compiler to emit the @code{fsrra} instruction for
28070 reciprocal square root approximations. The option @option{-mfsrra} must be used
28071 in combination with @option{-funsafe-math-optimizations} and
28072 @option{-ffinite-math-only}. It is enabled by default when generating code for
28073 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
28074 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
28077 @item -mpretend-cmove
28078 @opindex mpretend-cmove
28079 Prefer zero-displacement conditional branches for conditional move instruction
28080 patterns. This can result in faster code on the SH4 processor.
28084 Generate code using the FDPIC ABI.
28088 @node Solaris 2 Options
28089 @subsection Solaris 2 Options
28090 @cindex Solaris 2 options
28092 These @samp{-m} options are supported on Solaris 2:
28095 @item -mclear-hwcap
28096 @opindex mclear-hwcap
28097 @option{-mclear-hwcap} tells the compiler to remove the hardware
28098 capabilities generated by the Solaris assembler. This is only necessary
28099 when object files use ISA extensions not supported by the current
28100 machine, but check at runtime whether or not to use them.
28102 @item -mimpure-text
28103 @opindex mimpure-text
28104 @option{-mimpure-text}, used in addition to @option{-shared}, tells
28105 the compiler to not pass @option{-z text} to the linker when linking a
28106 shared object. Using this option, you can link position-dependent
28107 code into a shared object.
28109 @option{-mimpure-text} suppresses the ``relocations remain against
28110 allocatable but non-writable sections'' linker error message.
28111 However, the necessary relocations trigger copy-on-write, and the
28112 shared object is not actually shared across processes. Instead of
28113 using @option{-mimpure-text}, you should compile all source code with
28114 @option{-fpic} or @option{-fPIC}.
28118 These switches are supported in addition to the above on Solaris 2:
28123 This is a synonym for @option{-pthread}.
28126 @node SPARC Options
28127 @subsection SPARC Options
28128 @cindex SPARC options
28130 These @samp{-m} options are supported on the SPARC:
28133 @item -mno-app-regs
28135 @opindex mno-app-regs
28137 Specify @option{-mapp-regs} to generate output using the global registers
28138 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
28139 global register 1, each global register 2 through 4 is then treated as an
28140 allocable register that is clobbered by function calls. This is the default.
28142 To be fully SVR4 ABI-compliant at the cost of some performance loss,
28143 specify @option{-mno-app-regs}. You should compile libraries and system
28144 software with this option.
28150 With @option{-mflat}, the compiler does not generate save/restore instructions
28151 and uses a ``flat'' or single register window model. This model is compatible
28152 with the regular register window model. The local registers and the input
28153 registers (0--5) are still treated as ``call-saved'' registers and are
28154 saved on the stack as needed.
28156 With @option{-mno-flat} (the default), the compiler generates save/restore
28157 instructions (except for leaf functions). This is the normal operating mode.
28160 @itemx -mhard-float
28162 @opindex mhard-float
28163 Generate output containing floating-point instructions. This is the
28167 @itemx -msoft-float
28169 @opindex msoft-float
28170 Generate output containing library calls for floating point.
28171 @strong{Warning:} the requisite libraries are not available for all SPARC
28172 targets. Normally the facilities of the machine's usual C compiler are
28173 used, but this cannot be done directly in cross-compilation. You must make
28174 your own arrangements to provide suitable library functions for
28175 cross-compilation. The embedded targets @samp{sparc-*-aout} and
28176 @samp{sparclite-*-*} do provide software floating-point support.
28178 @option{-msoft-float} changes the calling convention in the output file;
28179 therefore, it is only useful if you compile @emph{all} of a program with
28180 this option. In particular, you need to compile @file{libgcc.a}, the
28181 library that comes with GCC, with @option{-msoft-float} in order for
28184 @item -mhard-quad-float
28185 @opindex mhard-quad-float
28186 Generate output containing quad-word (long double) floating-point
28189 @item -msoft-quad-float
28190 @opindex msoft-quad-float
28191 Generate output containing library calls for quad-word (long double)
28192 floating-point instructions. The functions called are those specified
28193 in the SPARC ABI@. This is the default.
28195 As of this writing, there are no SPARC implementations that have hardware
28196 support for the quad-word floating-point instructions. They all invoke
28197 a trap handler for one of these instructions, and then the trap handler
28198 emulates the effect of the instruction. Because of the trap handler overhead,
28199 this is much slower than calling the ABI library routines. Thus the
28200 @option{-msoft-quad-float} option is the default.
28202 @item -mno-unaligned-doubles
28203 @itemx -munaligned-doubles
28204 @opindex mno-unaligned-doubles
28205 @opindex munaligned-doubles
28206 Assume that doubles have 8-byte alignment. This is the default.
28208 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
28209 alignment only if they are contained in another type, or if they have an
28210 absolute address. Otherwise, it assumes they have 4-byte alignment.
28211 Specifying this option avoids some rare compatibility problems with code
28212 generated by other compilers. It is not the default because it results
28213 in a performance loss, especially for floating-point code.
28216 @itemx -mno-user-mode
28217 @opindex muser-mode
28218 @opindex mno-user-mode
28219 Do not generate code that can only run in supervisor mode. This is relevant
28220 only for the @code{casa} instruction emitted for the LEON3 processor. This
28223 @item -mfaster-structs
28224 @itemx -mno-faster-structs
28225 @opindex mfaster-structs
28226 @opindex mno-faster-structs
28227 With @option{-mfaster-structs}, the compiler assumes that structures
28228 should have 8-byte alignment. This enables the use of pairs of
28229 @code{ldd} and @code{std} instructions for copies in structure
28230 assignment, in place of twice as many @code{ld} and @code{st} pairs.
28231 However, the use of this changed alignment directly violates the SPARC
28232 ABI@. Thus, it's intended only for use on targets where the developer
28233 acknowledges that their resulting code is not directly in line with
28234 the rules of the ABI@.
28236 @item -mstd-struct-return
28237 @itemx -mno-std-struct-return
28238 @opindex mstd-struct-return
28239 @opindex mno-std-struct-return
28240 With @option{-mstd-struct-return}, the compiler generates checking code
28241 in functions returning structures or unions to detect size mismatches
28242 between the two sides of function calls, as per the 32-bit ABI@.
28244 The default is @option{-mno-std-struct-return}. This option has no effect
28251 Enable Local Register Allocation. This is the default for SPARC since GCC 7
28252 so @option{-mno-lra} needs to be passed to get old Reload.
28254 @item -mcpu=@var{cpu_type}
28256 Set the instruction set, register set, and instruction scheduling parameters
28257 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
28258 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
28259 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
28260 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
28261 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
28262 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
28264 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
28265 which selects the best architecture option for the host processor.
28266 @option{-mcpu=native} has no effect if GCC does not recognize
28269 Default instruction scheduling parameters are used for values that select
28270 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
28271 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
28273 Here is a list of each supported architecture and their supported
28281 supersparc, hypersparc, leon, leon3
28284 f930, f934, sparclite86x
28290 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
28294 By default (unless configured otherwise), GCC generates code for the V7
28295 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
28296 additionally optimizes it for the Cypress CY7C602 chip, as used in the
28297 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
28298 SPARCStation 1, 2, IPX etc.
28300 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
28301 architecture. The only difference from V7 code is that the compiler emits
28302 the integer multiply and integer divide instructions which exist in SPARC-V8
28303 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
28304 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
28307 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
28308 the SPARC architecture. This adds the integer multiply, integer divide step
28309 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
28310 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
28311 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
28312 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
28313 MB86934 chip, which is the more recent SPARClite with FPU@.
28315 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
28316 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
28317 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
28318 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
28319 optimizes it for the TEMIC SPARClet chip.
28321 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
28322 architecture. This adds 64-bit integer and floating-point move instructions,
28323 3 additional floating-point condition code registers and conditional move
28324 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
28325 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
28326 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
28327 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
28328 @option{-mcpu=niagara}, the compiler additionally optimizes it for
28329 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
28330 additionally optimizes it for Sun UltraSPARC T2 chips. With
28331 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
28332 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
28333 additionally optimizes it for Sun UltraSPARC T4 chips. With
28334 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
28335 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
28336 additionally optimizes it for Oracle M8 chips.
28338 @item -mtune=@var{cpu_type}
28340 Set the instruction scheduling parameters for machine type
28341 @var{cpu_type}, but do not set the instruction set or register set that the
28342 option @option{-mcpu=@var{cpu_type}} does.
28344 The same values for @option{-mcpu=@var{cpu_type}} can be used for
28345 @option{-mtune=@var{cpu_type}}, but the only useful values are those
28346 that select a particular CPU implementation. Those are
28347 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
28348 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
28349 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
28350 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
28351 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
28352 and GNU/Linux toolchains, @samp{native} can also be used.
28357 @opindex mno-v8plus
28358 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
28359 difference from the V8 ABI is that the global and out registers are
28360 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
28361 mode for all SPARC-V9 processors.
28367 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
28368 Visual Instruction Set extensions. The default is @option{-mno-vis}.
28374 With @option{-mvis2}, GCC generates code that takes advantage of
28375 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
28376 default is @option{-mvis2} when targeting a cpu that supports such
28377 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
28378 also sets @option{-mvis}.
28384 With @option{-mvis3}, GCC generates code that takes advantage of
28385 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
28386 default is @option{-mvis3} when targeting a cpu that supports such
28387 instructions, such as niagara-3 and later. Setting @option{-mvis3}
28388 also sets @option{-mvis2} and @option{-mvis}.
28394 With @option{-mvis4}, GCC generates code that takes advantage of
28395 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
28396 default is @option{-mvis4} when targeting a cpu that supports such
28397 instructions, such as niagara-7 and later. Setting @option{-mvis4}
28398 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
28404 With @option{-mvis4b}, GCC generates code that takes advantage of
28405 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
28406 the additional VIS instructions introduced in the Oracle SPARC
28407 Architecture 2017. The default is @option{-mvis4b} when targeting a
28408 cpu that supports such instructions, such as m8 and later. Setting
28409 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
28410 @option{-mvis2} and @option{-mvis}.
28415 @opindex mno-cbcond
28416 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
28417 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
28418 when targeting a CPU that supports such instructions, such as Niagara-4 and
28425 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
28426 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
28427 when targeting a CPU that supports such instructions, such as Niagara-3 and
28433 @opindex mno-fsmuld
28434 With @option{-mfsmuld}, GCC generates code that takes advantage of the
28435 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
28436 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
28437 or V9 with FPU except @option{-mcpu=leon}.
28443 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
28444 Population Count instruction. The default is @option{-mpopc}
28445 when targeting a CPU that supports such an instruction, such as Niagara-2 and
28452 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
28453 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
28454 when targeting a CPU that supports such an instruction, such as Niagara-7 and
28458 @opindex mfix-at697f
28459 Enable the documented workaround for the single erratum of the Atmel AT697F
28460 processor (which corresponds to erratum #13 of the AT697E processor).
28463 @opindex mfix-ut699
28464 Enable the documented workarounds for the floating-point errata and the data
28465 cache nullify errata of the UT699 processor.
28468 @opindex mfix-ut700
28469 Enable the documented workaround for the back-to-back store errata of
28470 the UT699E/UT700 processor.
28472 @item -mfix-gr712rc
28473 @opindex mfix-gr712rc
28474 Enable the documented workaround for the back-to-back store errata of
28475 the GR712RC processor.
28478 These @samp{-m} options are supported in addition to the above
28479 on SPARC-V9 processors in 64-bit environments:
28486 Generate code for a 32-bit or 64-bit environment.
28487 The 32-bit environment sets int, long and pointer to 32 bits.
28488 The 64-bit environment sets int to 32 bits and long and pointer
28491 @item -mcmodel=@var{which}
28493 Set the code model to one of
28497 The Medium/Low code model: 64-bit addresses, programs
28498 must be linked in the low 32 bits of memory. Programs can be statically
28499 or dynamically linked.
28502 The Medium/Middle code model: 64-bit addresses, programs
28503 must be linked in the low 44 bits of memory, the text and data segments must
28504 be less than 2GB in size and the data segment must be located within 2GB of
28508 The Medium/Anywhere code model: 64-bit addresses, programs
28509 may be linked anywhere in memory, the text and data segments must be less
28510 than 2GB in size and the data segment must be located within 2GB of the
28514 The Medium/Anywhere code model for embedded systems:
28515 64-bit addresses, the text and data segments must be less than 2GB in
28516 size, both starting anywhere in memory (determined at link time). The
28517 global register %g4 points to the base of the data segment. Programs
28518 are statically linked and PIC is not supported.
28521 @item -mmemory-model=@var{mem-model}
28522 @opindex mmemory-model
28523 Set the memory model in force on the processor to one of
28527 The default memory model for the processor and operating system.
28530 Relaxed Memory Order
28533 Partial Store Order
28539 Sequential Consistency
28542 These memory models are formally defined in Appendix D of the SPARC-V9
28543 architecture manual, as set in the processor's @code{PSTATE.MM} field.
28546 @itemx -mno-stack-bias
28547 @opindex mstack-bias
28548 @opindex mno-stack-bias
28549 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
28550 frame pointer if present, are offset by @minus{}2047 which must be added back
28551 when making stack frame references. This is the default in 64-bit mode.
28552 Otherwise, assume no such offset is present.
28555 @node System V Options
28556 @subsection Options for System V
28558 These additional options are available on System V Release 4 for
28559 compatibility with other compilers on those systems:
28564 Create a shared object.
28565 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
28569 Identify the versions of each tool used by the compiler, in a
28570 @code{.ident} assembler directive in the output.
28574 Refrain from adding @code{.ident} directives to the output file (this is
28577 @item -YP,@var{dirs}
28579 Search the directories @var{dirs}, and no others, for libraries
28580 specified with @option{-l}.
28582 @item -Ym,@var{dir}
28584 Look in the directory @var{dir} to find the M4 preprocessor.
28585 The assembler uses this option.
28586 @c This is supposed to go with a -Yd for predefined M4 macro files, but
28587 @c the generic assembler that comes with Solaris takes just -Ym.
28590 @node TILE-Gx Options
28591 @subsection TILE-Gx Options
28592 @cindex TILE-Gx options
28594 These @samp{-m} options are supported on the TILE-Gx:
28597 @item -mcmodel=small
28598 @opindex mcmodel=small
28599 Generate code for the small model. The distance for direct calls is
28600 limited to 500M in either direction. PC-relative addresses are 32
28601 bits. Absolute addresses support the full address range.
28603 @item -mcmodel=large
28604 @opindex mcmodel=large
28605 Generate code for the large model. There is no limitation on call
28606 distance, pc-relative addresses, or absolute addresses.
28608 @item -mcpu=@var{name}
28610 Selects the type of CPU to be targeted. Currently the only supported
28611 type is @samp{tilegx}.
28617 Generate code for a 32-bit or 64-bit environment. The 32-bit
28618 environment sets int, long, and pointer to 32 bits. The 64-bit
28619 environment sets int to 32 bits and long and pointer to 64 bits.
28622 @itemx -mlittle-endian
28623 @opindex mbig-endian
28624 @opindex mlittle-endian
28625 Generate code in big/little endian mode, respectively.
28628 @node TILEPro Options
28629 @subsection TILEPro Options
28630 @cindex TILEPro options
28632 These @samp{-m} options are supported on the TILEPro:
28635 @item -mcpu=@var{name}
28637 Selects the type of CPU to be targeted. Currently the only supported
28638 type is @samp{tilepro}.
28642 Generate code for a 32-bit environment, which sets int, long, and
28643 pointer to 32 bits. This is the only supported behavior so the flag
28644 is essentially ignored.
28648 @subsection V850 Options
28649 @cindex V850 Options
28651 These @samp{-m} options are defined for V850 implementations:
28655 @itemx -mno-long-calls
28656 @opindex mlong-calls
28657 @opindex mno-long-calls
28658 Treat all calls as being far away (near). If calls are assumed to be
28659 far away, the compiler always loads the function's address into a
28660 register, and calls indirect through the pointer.
28666 Do not optimize (do optimize) basic blocks that use the same index
28667 pointer 4 or more times to copy pointer into the @code{ep} register, and
28668 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
28669 option is on by default if you optimize.
28671 @item -mno-prolog-function
28672 @itemx -mprolog-function
28673 @opindex mno-prolog-function
28674 @opindex mprolog-function
28675 Do not use (do use) external functions to save and restore registers
28676 at the prologue and epilogue of a function. The external functions
28677 are slower, but use less code space if more than one function saves
28678 the same number of registers. The @option{-mprolog-function} option
28679 is on by default if you optimize.
28683 Try to make the code as small as possible. At present, this just turns
28684 on the @option{-mep} and @option{-mprolog-function} options.
28686 @item -mtda=@var{n}
28688 Put static or global variables whose size is @var{n} bytes or less into
28689 the tiny data area that register @code{ep} points to. The tiny data
28690 area can hold up to 256 bytes in total (128 bytes for byte references).
28692 @item -msda=@var{n}
28694 Put static or global variables whose size is @var{n} bytes or less into
28695 the small data area that register @code{gp} points to. The small data
28696 area can hold up to 64 kilobytes.
28698 @item -mzda=@var{n}
28700 Put static or global variables whose size is @var{n} bytes or less into
28701 the first 32 kilobytes of memory.
28705 Specify that the target processor is the V850.
28709 Specify that the target processor is the V850E3V5. The preprocessor
28710 constant @code{__v850e3v5__} is defined if this option is used.
28714 Specify that the target processor is the V850E3V5. This is an alias for
28715 the @option{-mv850e3v5} option.
28719 Specify that the target processor is the V850E2V3. The preprocessor
28720 constant @code{__v850e2v3__} is defined if this option is used.
28724 Specify that the target processor is the V850E2. The preprocessor
28725 constant @code{__v850e2__} is defined if this option is used.
28729 Specify that the target processor is the V850E1. The preprocessor
28730 constants @code{__v850e1__} and @code{__v850e__} are defined if
28731 this option is used.
28735 Specify that the target processor is the V850ES. This is an alias for
28736 the @option{-mv850e1} option.
28740 Specify that the target processor is the V850E@. The preprocessor
28741 constant @code{__v850e__} is defined if this option is used.
28743 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
28744 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
28745 are defined then a default target processor is chosen and the
28746 relevant @samp{__v850*__} preprocessor constant is defined.
28748 The preprocessor constants @code{__v850} and @code{__v851__} are always
28749 defined, regardless of which processor variant is the target.
28751 @item -mdisable-callt
28752 @itemx -mno-disable-callt
28753 @opindex mdisable-callt
28754 @opindex mno-disable-callt
28755 This option suppresses generation of the @code{CALLT} instruction for the
28756 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
28759 This option is enabled by default when the RH850 ABI is
28760 in use (see @option{-mrh850-abi}), and disabled by default when the
28761 GCC ABI is in use. If @code{CALLT} instructions are being generated
28762 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
28768 Pass on (or do not pass on) the @option{-mrelax} command-line option
28772 @itemx -mno-long-jumps
28773 @opindex mlong-jumps
28774 @opindex mno-long-jumps
28775 Disable (or re-enable) the generation of PC-relative jump instructions.
28778 @itemx -mhard-float
28779 @opindex msoft-float
28780 @opindex mhard-float
28781 Disable (or re-enable) the generation of hardware floating point
28782 instructions. This option is only significant when the target
28783 architecture is @samp{V850E2V3} or higher. If hardware floating point
28784 instructions are being generated then the C preprocessor symbol
28785 @code{__FPU_OK__} is defined, otherwise the symbol
28786 @code{__NO_FPU__} is defined.
28790 Enables the use of the e3v5 LOOP instruction. The use of this
28791 instruction is not enabled by default when the e3v5 architecture is
28792 selected because its use is still experimental.
28796 @opindex mrh850-abi
28798 Enables support for the RH850 version of the V850 ABI. This is the
28799 default. With this version of the ABI the following rules apply:
28803 Integer sized structures and unions are returned via a memory pointer
28804 rather than a register.
28807 Large structures and unions (more than 8 bytes in size) are passed by
28811 Functions are aligned to 16-bit boundaries.
28814 The @option{-m8byte-align} command-line option is supported.
28817 The @option{-mdisable-callt} command-line option is enabled by
28818 default. The @option{-mno-disable-callt} command-line option is not
28822 When this version of the ABI is enabled the C preprocessor symbol
28823 @code{__V850_RH850_ABI__} is defined.
28827 Enables support for the old GCC version of the V850 ABI. With this
28828 version of the ABI the following rules apply:
28832 Integer sized structures and unions are returned in register @code{r10}.
28835 Large structures and unions (more than 8 bytes in size) are passed by
28839 Functions are aligned to 32-bit boundaries, unless optimizing for
28843 The @option{-m8byte-align} command-line option is not supported.
28846 The @option{-mdisable-callt} command-line option is supported but not
28847 enabled by default.
28850 When this version of the ABI is enabled the C preprocessor symbol
28851 @code{__V850_GCC_ABI__} is defined.
28853 @item -m8byte-align
28854 @itemx -mno-8byte-align
28855 @opindex m8byte-align
28856 @opindex mno-8byte-align
28857 Enables support for @code{double} and @code{long long} types to be
28858 aligned on 8-byte boundaries. The default is to restrict the
28859 alignment of all objects to at most 4-bytes. When
28860 @option{-m8byte-align} is in effect the C preprocessor symbol
28861 @code{__V850_8BYTE_ALIGN__} is defined.
28864 @opindex mbig-switch
28865 Generate code suitable for big switch tables. Use this option only if
28866 the assembler/linker complain about out of range branches within a switch
28871 This option causes r2 and r5 to be used in the code generated by
28872 the compiler. This setting is the default.
28874 @item -mno-app-regs
28875 @opindex mno-app-regs
28876 This option causes r2 and r5 to be treated as fixed registers.
28881 @subsection VAX Options
28882 @cindex VAX options
28884 These @samp{-m} options are defined for the VAX:
28889 Do not output certain jump instructions (@code{aobleq} and so on)
28890 that the Unix assembler for the VAX cannot handle across long
28895 Do output those jump instructions, on the assumption that the
28896 GNU assembler is being used.
28900 Output code for G-format floating-point numbers instead of D-format.
28903 @node Visium Options
28904 @subsection Visium Options
28905 @cindex Visium options
28911 A program which performs file I/O and is destined to run on an MCM target
28912 should be linked with this option. It causes the libraries libc.a and
28913 libdebug.a to be linked. The program should be run on the target under
28914 the control of the GDB remote debugging stub.
28918 A program which performs file I/O and is destined to run on the simulator
28919 should be linked with option. This causes libraries libc.a and libsim.a to
28923 @itemx -mhard-float
28925 @opindex mhard-float
28926 Generate code containing floating-point instructions. This is the
28930 @itemx -msoft-float
28932 @opindex msoft-float
28933 Generate code containing library calls for floating-point.
28935 @option{-msoft-float} changes the calling convention in the output file;
28936 therefore, it is only useful if you compile @emph{all} of a program with
28937 this option. In particular, you need to compile @file{libgcc.a}, the
28938 library that comes with GCC, with @option{-msoft-float} in order for
28941 @item -mcpu=@var{cpu_type}
28943 Set the instruction set, register set, and instruction scheduling parameters
28944 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
28945 @samp{mcm}, @samp{gr5} and @samp{gr6}.
28947 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
28949 By default (unless configured otherwise), GCC generates code for the GR5
28950 variant of the Visium architecture.
28952 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
28953 architecture. The only difference from GR5 code is that the compiler will
28954 generate block move instructions.
28956 @item -mtune=@var{cpu_type}
28958 Set the instruction scheduling parameters for machine type @var{cpu_type},
28959 but do not set the instruction set or register set that the option
28960 @option{-mcpu=@var{cpu_type}} would.
28964 Generate code for the supervisor mode, where there are no restrictions on
28965 the access to general registers. This is the default.
28968 @opindex muser-mode
28969 Generate code for the user mode, where the access to some general registers
28970 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
28971 mode; on the GR6, only registers r29 to r31 are affected.
28975 @subsection VMS Options
28977 These @samp{-m} options are defined for the VMS implementations:
28980 @item -mvms-return-codes
28981 @opindex mvms-return-codes
28982 Return VMS condition codes from @code{main}. The default is to return POSIX-style
28983 condition (e.g.@: error) codes.
28985 @item -mdebug-main=@var{prefix}
28986 @opindex mdebug-main=@var{prefix}
28987 Flag the first routine whose name starts with @var{prefix} as the main
28988 routine for the debugger.
28992 Default to 64-bit memory allocation routines.
28994 @item -mpointer-size=@var{size}
28995 @opindex mpointer-size=@var{size}
28996 Set the default size of pointers. Possible options for @var{size} are
28997 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
28998 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
28999 The later option disables @code{pragma pointer_size}.
29002 @node VxWorks Options
29003 @subsection VxWorks Options
29004 @cindex VxWorks Options
29006 The options in this section are defined for all VxWorks targets.
29007 Options specific to the target hardware are listed with the other
29008 options for that target.
29013 GCC can generate code for both VxWorks kernels and real time processes
29014 (RTPs). This option switches from the former to the latter. It also
29015 defines the preprocessor macro @code{__RTP__}.
29018 @opindex non-static
29019 Link an RTP executable against shared libraries rather than static
29020 libraries. The options @option{-static} and @option{-shared} can
29021 also be used for RTPs (@pxref{Link Options}); @option{-static}
29028 These options are passed down to the linker. They are defined for
29029 compatibility with Diab.
29032 @opindex Xbind-lazy
29033 Enable lazy binding of function calls. This option is equivalent to
29034 @option{-Wl,-z,now} and is defined for compatibility with Diab.
29038 Disable lazy binding of function calls. This option is the default and
29039 is defined for compatibility with Diab.
29043 @subsection x86 Options
29044 @cindex x86 Options
29046 These @samp{-m} options are defined for the x86 family of computers.
29050 @item -march=@var{cpu-type}
29052 Generate instructions for the machine type @var{cpu-type}. In contrast to
29053 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
29054 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
29055 to generate code that may not run at all on processors other than the one
29056 indicated. Specifying @option{-march=@var{cpu-type}} implies
29057 @option{-mtune=@var{cpu-type}}.
29059 The choices for @var{cpu-type} are:
29063 This selects the CPU to generate code for at compilation time by determining
29064 the processor type of the compiling machine. Using @option{-march=native}
29065 enables all instruction subsets supported by the local machine (hence
29066 the result might not run on different machines). Using @option{-mtune=native}
29067 produces code optimized for the local machine under the constraints
29068 of the selected instruction set.
29071 A generic CPU with 64-bit extensions.
29074 Original Intel i386 CPU@.
29077 Intel i486 CPU@. (No scheduling is implemented for this chip.)
29081 Intel Pentium CPU with no MMX support.
29084 Intel Lakemont MCU, based on Intel Pentium CPU.
29087 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
29090 Intel Pentium Pro CPU@.
29093 When used with @option{-march}, the Pentium Pro
29094 instruction set is used, so the code runs on all i686 family chips.
29095 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
29098 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
29103 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
29107 Intel Pentium M; low-power version of Intel Pentium III CPU
29108 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
29112 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
29115 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
29119 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
29120 SSE2 and SSE3 instruction set support.
29123 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
29124 instruction set support.
29127 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
29128 SSE4.1, SSE4.2 and POPCNT instruction set support.
29131 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
29132 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
29135 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
29136 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
29139 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
29140 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
29141 instruction set support.
29144 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29145 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29146 BMI, BMI2 and F16C instruction set support.
29149 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29150 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29151 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
29154 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29155 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29156 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
29157 XSAVES instruction set support.
29160 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
29161 instruction set support.
29164 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29165 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
29168 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29169 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
29170 instruction set support.
29172 @item goldmont-plus
29173 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29174 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
29175 PTWRITE, RDPID, SGX and UMIP instruction set support.
29178 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29179 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
29180 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
29183 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29184 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29185 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
29186 AVX512CD instruction set support.
29189 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29190 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29191 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
29192 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
29194 @item skylake-avx512
29195 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29196 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29197 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
29198 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
29201 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
29202 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
29203 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
29204 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
29205 AVX512IFMA, SHA and UMIP instruction set support.
29207 @item icelake-client
29208 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
29209 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
29210 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
29211 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
29212 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
29213 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
29215 @item icelake-server
29216 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
29217 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
29218 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
29219 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
29220 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
29221 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
29225 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29226 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
29227 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
29228 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
29231 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29232 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
29233 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
29234 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
29238 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29239 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
29240 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
29241 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
29242 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
29243 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
29246 @item sapphirerapids
29247 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29248 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND,
29249 FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES,
29250 AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
29251 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
29252 SERIALIZE and TSXLDTRK instruction set support.
29255 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29256 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, CLDEMOTE,
29257 PTWRITE, WAITPKG and SERIALIZE instruction set support.
29260 AMD K6 CPU with MMX instruction set support.
29264 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
29267 @itemx athlon-tbird
29268 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
29274 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
29275 instruction set support.
29281 Processors based on the AMD K8 core with x86-64 instruction set support,
29282 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
29283 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
29284 instruction set extensions.)
29287 @itemx opteron-sse3
29288 @itemx athlon64-sse3
29289 Improved versions of AMD K8 cores with SSE3 instruction set support.
29293 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
29294 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
29295 instruction set extensions.)
29298 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
29299 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
29300 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
29303 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
29304 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
29305 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
29309 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
29310 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
29311 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
29312 64-bit instruction set extensions.)
29315 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
29316 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
29317 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
29318 SSE4.2, ABM and 64-bit instruction set extensions.)
29321 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
29322 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
29323 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
29324 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
29325 instruction set extensions.)
29328 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
29329 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
29330 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
29331 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
29332 WBNOINVD, and 64-bit instruction set extensions.)
29335 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
29336 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
29337 instruction set extensions.)
29340 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
29341 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
29342 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
29345 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
29349 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
29350 instruction set support.
29353 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
29354 (No scheduling is implemented for this chip.)
29357 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
29358 (No scheduling is implemented for this chip.)
29361 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
29362 (No scheduling is implemented for this chip.)
29365 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
29366 (No scheduling is implemented for this chip.)
29369 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
29370 (No scheduling is implemented for this chip.)
29373 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
29374 (No scheduling is implemented for this chip.)
29377 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
29378 (No scheduling is implemented for this chip.)
29381 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
29382 AVX and AVX2 instruction set support.
29383 (No scheduling is implemented for this chip.)
29386 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
29387 instruction set support.
29388 (No scheduling is implemented for this chip.)
29391 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
29392 instruction set support.
29393 (No scheduling is implemented for this chip.)
29396 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
29397 instruction set support.
29398 (No scheduling is implemented for this chip.)
29401 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
29402 instruction set support.
29403 (No scheduling is implemented for this chip.)
29406 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
29407 instruction set support.
29408 (No scheduling is implemented for this chip.)
29411 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
29412 instruction set support.
29413 (No scheduling is implemented for this chip.)
29416 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
29419 @item -mtune=@var{cpu-type}
29421 Tune to @var{cpu-type} everything applicable about the generated code, except
29422 for the ABI and the set of available instructions.
29423 While picking a specific @var{cpu-type} schedules things appropriately
29424 for that particular chip, the compiler does not generate any code that
29425 cannot run on the default machine type unless you use a
29426 @option{-march=@var{cpu-type}} option.
29427 For example, if GCC is configured for i686-pc-linux-gnu
29428 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
29429 but still runs on i686 machines.
29431 The choices for @var{cpu-type} are the same as for @option{-march}.
29432 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
29436 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
29437 If you know the CPU on which your code will run, then you should use
29438 the corresponding @option{-mtune} or @option{-march} option instead of
29439 @option{-mtune=generic}. But, if you do not know exactly what CPU users
29440 of your application will have, then you should use this option.
29442 As new processors are deployed in the marketplace, the behavior of this
29443 option will change. Therefore, if you upgrade to a newer version of
29444 GCC, code generation controlled by this option will change to reflect
29446 that are most common at the time that version of GCC is released.
29448 There is no @option{-march=generic} option because @option{-march}
29449 indicates the instruction set the compiler can use, and there is no
29450 generic instruction set applicable to all processors. In contrast,
29451 @option{-mtune} indicates the processor (or, in this case, collection of
29452 processors) for which the code is optimized.
29455 Produce code optimized for the most current Intel processors, which are
29456 Haswell and Silvermont for this version of GCC. If you know the CPU
29457 on which your code will run, then you should use the corresponding
29458 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
29459 But, if you want your application performs better on both Haswell and
29460 Silvermont, then you should use this option.
29462 As new Intel processors are deployed in the marketplace, the behavior of
29463 this option will change. Therefore, if you upgrade to a newer version of
29464 GCC, code generation controlled by this option will change to reflect
29465 the most current Intel processors at the time that version of GCC is
29468 There is no @option{-march=intel} option because @option{-march} indicates
29469 the instruction set the compiler can use, and there is no common
29470 instruction set applicable to all processors. In contrast,
29471 @option{-mtune} indicates the processor (or, in this case, collection of
29472 processors) for which the code is optimized.
29475 @item -mcpu=@var{cpu-type}
29477 A deprecated synonym for @option{-mtune}.
29479 @item -mfpmath=@var{unit}
29481 Generate floating-point arithmetic for selected unit @var{unit}. The choices
29482 for @var{unit} are:
29486 Use the standard 387 floating-point coprocessor present on the majority of chips and
29487 emulated otherwise. Code compiled with this option runs almost everywhere.
29488 The temporary results are computed in 80-bit precision instead of the precision
29489 specified by the type, resulting in slightly different results compared to most
29490 of other chips. See @option{-ffloat-store} for more detailed description.
29492 This is the default choice for non-Darwin x86-32 targets.
29495 Use scalar floating-point instructions present in the SSE instruction set.
29496 This instruction set is supported by Pentium III and newer chips,
29497 and in the AMD line
29498 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
29499 instruction set supports only single-precision arithmetic, thus the double and
29500 extended-precision arithmetic are still done using 387. A later version, present
29501 only in Pentium 4 and AMD x86-64 chips, supports double-precision
29504 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
29505 or @option{-msse2} switches to enable SSE extensions and make this option
29506 effective. For the x86-64 compiler, these extensions are enabled by default.
29508 The resulting code should be considerably faster in the majority of cases and avoid
29509 the numerical instability problems of 387 code, but may break some existing
29510 code that expects temporaries to be 80 bits.
29512 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
29513 and the default choice for x86-32 targets with the SSE2 instruction set
29514 when @option{-ffast-math} is enabled.
29519 Attempt to utilize both instruction sets at once. This effectively doubles the
29520 amount of available registers, and on chips with separate execution units for
29521 387 and SSE the execution resources too. Use this option with care, as it is
29522 still experimental, because the GCC register allocator does not model separate
29523 functional units well, resulting in unstable performance.
29526 @item -masm=@var{dialect}
29527 @opindex masm=@var{dialect}
29528 Output assembly instructions using selected @var{dialect}. Also affects
29529 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
29530 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
29531 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
29532 not support @samp{intel}.
29535 @itemx -mno-ieee-fp
29537 @opindex mno-ieee-fp
29538 Control whether or not the compiler uses IEEE floating-point
29539 comparisons. These correctly handle the case where the result of a
29540 comparison is unordered.
29543 @itemx -mhard-float
29545 @opindex mhard-float
29546 Generate output containing 80387 instructions for floating point.
29549 @itemx -msoft-float
29551 @opindex msoft-float
29552 Generate output containing library calls for floating point.
29554 @strong{Warning:} the requisite libraries are not part of GCC@.
29555 Normally the facilities of the machine's usual C compiler are used, but
29556 this cannot be done directly in cross-compilation. You must make your
29557 own arrangements to provide suitable library functions for
29560 On machines where a function returns floating-point results in the 80387
29561 register stack, some floating-point opcodes may be emitted even if
29562 @option{-msoft-float} is used.
29564 @item -mno-fp-ret-in-387
29565 @opindex mno-fp-ret-in-387
29566 @opindex mfp-ret-in-387
29567 Do not use the FPU registers for return values of functions.
29569 The usual calling convention has functions return values of types
29570 @code{float} and @code{double} in an FPU register, even if there
29571 is no FPU@. The idea is that the operating system should emulate
29574 The option @option{-mno-fp-ret-in-387} causes such values to be returned
29575 in ordinary CPU registers instead.
29577 @item -mno-fancy-math-387
29578 @opindex mno-fancy-math-387
29579 @opindex mfancy-math-387
29580 Some 387 emulators do not support the @code{sin}, @code{cos} and
29581 @code{sqrt} instructions for the 387. Specify this option to avoid
29582 generating those instructions.
29583 This option is overridden when @option{-march}
29584 indicates that the target CPU always has an FPU and so the
29585 instruction does not need emulation. These
29586 instructions are not generated unless you also use the
29587 @option{-funsafe-math-optimizations} switch.
29589 @item -malign-double
29590 @itemx -mno-align-double
29591 @opindex malign-double
29592 @opindex mno-align-double
29593 Control whether GCC aligns @code{double}, @code{long double}, and
29594 @code{long long} variables on a two-word boundary or a one-word
29595 boundary. Aligning @code{double} variables on a two-word boundary
29596 produces code that runs somewhat faster on a Pentium at the
29597 expense of more memory.
29599 On x86-64, @option{-malign-double} is enabled by default.
29601 @strong{Warning:} if you use the @option{-malign-double} switch,
29602 structures containing the above types are aligned differently than
29603 the published application binary interface specifications for the x86-32
29604 and are not binary compatible with structures in code compiled
29605 without that switch.
29607 @item -m96bit-long-double
29608 @itemx -m128bit-long-double
29609 @opindex m96bit-long-double
29610 @opindex m128bit-long-double
29611 These switches control the size of @code{long double} type. The x86-32
29612 application binary interface specifies the size to be 96 bits,
29613 so @option{-m96bit-long-double} is the default in 32-bit mode.
29615 Modern architectures (Pentium and newer) prefer @code{long double}
29616 to be aligned to an 8- or 16-byte boundary. In arrays or structures
29617 conforming to the ABI, this is not possible. So specifying
29618 @option{-m128bit-long-double} aligns @code{long double}
29619 to a 16-byte boundary by padding the @code{long double} with an additional
29622 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
29623 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
29625 Notice that neither of these options enable any extra precision over the x87
29626 standard of 80 bits for a @code{long double}.
29628 @strong{Warning:} if you override the default value for your target ABI, this
29629 changes the size of
29630 structures and arrays containing @code{long double} variables,
29631 as well as modifying the function calling convention for functions taking
29632 @code{long double}. Hence they are not binary-compatible
29633 with code compiled without that switch.
29635 @item -mlong-double-64
29636 @itemx -mlong-double-80
29637 @itemx -mlong-double-128
29638 @opindex mlong-double-64
29639 @opindex mlong-double-80
29640 @opindex mlong-double-128
29641 These switches control the size of @code{long double} type. A size
29642 of 64 bits makes the @code{long double} type equivalent to the @code{double}
29643 type. This is the default for 32-bit Bionic C library. A size
29644 of 128 bits makes the @code{long double} type equivalent to the
29645 @code{__float128} type. This is the default for 64-bit Bionic C library.
29647 @strong{Warning:} if you override the default value for your target ABI, this
29648 changes the size of
29649 structures and arrays containing @code{long double} variables,
29650 as well as modifying the function calling convention for functions taking
29651 @code{long double}. Hence they are not binary-compatible
29652 with code compiled without that switch.
29654 @item -malign-data=@var{type}
29655 @opindex malign-data
29656 Control how GCC aligns variables. Supported values for @var{type} are
29657 @samp{compat} uses increased alignment value compatible uses GCC 4.8
29658 and earlier, @samp{abi} uses alignment value as specified by the
29659 psABI, and @samp{cacheline} uses increased alignment value to match
29660 the cache line size. @samp{compat} is the default.
29662 @item -mlarge-data-threshold=@var{threshold}
29663 @opindex mlarge-data-threshold
29664 When @option{-mcmodel=medium} is specified, data objects larger than
29665 @var{threshold} are placed in the large data section. This value must be the
29666 same across all objects linked into the binary, and defaults to 65535.
29670 Use a different function-calling convention, in which functions that
29671 take a fixed number of arguments return with the @code{ret @var{num}}
29672 instruction, which pops their arguments while returning. This saves one
29673 instruction in the caller since there is no need to pop the arguments
29676 You can specify that an individual function is called with this calling
29677 sequence with the function attribute @code{stdcall}. You can also
29678 override the @option{-mrtd} option by using the function attribute
29679 @code{cdecl}. @xref{Function Attributes}.
29681 @strong{Warning:} this calling convention is incompatible with the one
29682 normally used on Unix, so you cannot use it if you need to call
29683 libraries compiled with the Unix compiler.
29685 Also, you must provide function prototypes for all functions that
29686 take variable numbers of arguments (including @code{printf});
29687 otherwise incorrect code is generated for calls to those
29690 In addition, seriously incorrect code results if you call a
29691 function with too many arguments. (Normally, extra arguments are
29692 harmlessly ignored.)
29694 @item -mregparm=@var{num}
29696 Control how many registers are used to pass integer arguments. By
29697 default, no registers are used to pass arguments, and at most 3
29698 registers can be used. You can control this behavior for a specific
29699 function by using the function attribute @code{regparm}.
29700 @xref{Function Attributes}.
29702 @strong{Warning:} if you use this switch, and
29703 @var{num} is nonzero, then you must build all modules with the same
29704 value, including any libraries. This includes the system libraries and
29708 @opindex msseregparm
29709 Use SSE register passing conventions for float and double arguments
29710 and return values. You can control this behavior for a specific
29711 function by using the function attribute @code{sseregparm}.
29712 @xref{Function Attributes}.
29714 @strong{Warning:} if you use this switch then you must build all
29715 modules with the same value, including any libraries. This includes
29716 the system libraries and startup modules.
29718 @item -mvect8-ret-in-mem
29719 @opindex mvect8-ret-in-mem
29720 Return 8-byte vectors in memory instead of MMX registers. This is the
29721 default on VxWorks to match the ABI of the Sun Studio compilers until
29722 version 12. @emph{Only} use this option if you need to remain
29723 compatible with existing code produced by those previous compiler
29724 versions or older versions of GCC@.
29733 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
29734 is specified, the significands of results of floating-point operations are
29735 rounded to 24 bits (single precision); @option{-mpc64} rounds the
29736 significands of results of floating-point operations to 53 bits (double
29737 precision) and @option{-mpc80} rounds the significands of results of
29738 floating-point operations to 64 bits (extended double precision), which is
29739 the default. When this option is used, floating-point operations in higher
29740 precisions are not available to the programmer without setting the FPU
29741 control word explicitly.
29743 Setting the rounding of floating-point operations to less than the default
29744 80 bits can speed some programs by 2% or more. Note that some mathematical
29745 libraries assume that extended-precision (80-bit) floating-point operations
29746 are enabled by default; routines in such libraries could suffer significant
29747 loss of accuracy, typically through so-called ``catastrophic cancellation'',
29748 when this option is used to set the precision to less than extended precision.
29750 @item -mstackrealign
29751 @opindex mstackrealign
29752 Realign the stack at entry. On the x86, the @option{-mstackrealign}
29753 option generates an alternate prologue and epilogue that realigns the
29754 run-time stack if necessary. This supports mixing legacy codes that keep
29755 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
29756 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
29757 applicable to individual functions.
29759 @item -mpreferred-stack-boundary=@var{num}
29760 @opindex mpreferred-stack-boundary
29761 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29762 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
29763 the default is 4 (16 bytes or 128 bits).
29765 @strong{Warning:} When generating code for the x86-64 architecture with
29766 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
29767 used to keep the stack boundary aligned to 8 byte boundary. Since
29768 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
29769 intended to be used in controlled environment where stack space is
29770 important limitation. This option leads to wrong code when functions
29771 compiled with 16 byte stack alignment (such as functions from a standard
29772 library) are called with misaligned stack. In this case, SSE
29773 instructions may lead to misaligned memory access traps. In addition,
29774 variable arguments are handled incorrectly for 16 byte aligned
29775 objects (including x87 long double and __int128), leading to wrong
29776 results. You must build all modules with
29777 @option{-mpreferred-stack-boundary=3}, including any libraries. This
29778 includes the system libraries and startup modules.
29780 @item -mincoming-stack-boundary=@var{num}
29781 @opindex mincoming-stack-boundary
29782 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
29783 boundary. If @option{-mincoming-stack-boundary} is not specified,
29784 the one specified by @option{-mpreferred-stack-boundary} is used.
29786 On Pentium and Pentium Pro, @code{double} and @code{long double} values
29787 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
29788 suffer significant run time performance penalties. On Pentium III, the
29789 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
29790 properly if it is not 16-byte aligned.
29792 To ensure proper alignment of this values on the stack, the stack boundary
29793 must be as aligned as that required by any value stored on the stack.
29794 Further, every function must be generated such that it keeps the stack
29795 aligned. Thus calling a function compiled with a higher preferred
29796 stack boundary from a function compiled with a lower preferred stack
29797 boundary most likely misaligns the stack. It is recommended that
29798 libraries that use callbacks always use the default setting.
29800 This extra alignment does consume extra stack space, and generally
29801 increases code size. Code that is sensitive to stack space usage, such
29802 as embedded systems and operating system kernels, may want to reduce the
29803 preferred alignment to @option{-mpreferred-stack-boundary=2}.
29860 @itemx -mavx512ifma
29861 @opindex mavx512ifma
29863 @itemx -mavx512vbmi
29864 @opindex mavx512vbmi
29875 @itemx -mclflushopt
29876 @opindex mclflushopt
29911 @itemx -mprefetchwt1
29912 @opindex mprefetchwt1
29983 @itemx -mavx512vbmi2
29984 @opindex mavx512vbmi2
29986 @itemx -mavx512bf16
29987 @opindex mavx512bf16
29998 @itemx -mvpclmulqdq
29999 @opindex mvpclmulqdq
30001 @itemx -mavx512bitalg
30002 @opindex mavx512bitalg
30008 @opindex mmovdir64b
30016 @itemx -mavx512vpopcntdq
30017 @opindex mavx512vpopcntdq
30019 @itemx -mavx512vp2intersect
30020 @opindex mavx512vp2intersect
30022 @itemx -mavx5124fmaps
30023 @opindex mavx5124fmaps
30025 @itemx -mavx512vnni
30026 @opindex mavx512vnni
30028 @itemx -mavx5124vnniw
30029 @opindex mavx5124vnniw
30035 @opindex mserialize
30036 These switches enable the use of instructions in the MMX, SSE,
30037 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
30038 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
30039 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
30040 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
30041 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
30042 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
30043 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
30044 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE
30045 or CLDEMOTE extended instruction sets. Each has a corresponding
30046 @option{-mno-} option to disable use of these instructions.
30048 These extensions are also available as built-in functions: see
30049 @ref{x86 Built-in Functions}, for details of the functions enabled and
30050 disabled by these switches.
30052 To generate SSE/SSE2 instructions automatically from floating-point
30053 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
30055 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
30056 generates new AVX instructions or AVX equivalence for all SSEx instructions
30059 These options enable GCC to use these extended instructions in
30060 generated code, even without @option{-mfpmath=sse}. Applications that
30061 perform run-time CPU detection must compile separate files for each
30062 supported architecture, using the appropriate flags. In particular,
30063 the file containing the CPU detection code should be compiled without
30066 @item -mdump-tune-features
30067 @opindex mdump-tune-features
30068 This option instructs GCC to dump the names of the x86 performance
30069 tuning features and default settings. The names can be used in
30070 @option{-mtune-ctrl=@var{feature-list}}.
30072 @item -mtune-ctrl=@var{feature-list}
30073 @opindex mtune-ctrl=@var{feature-list}
30074 This option is used to do fine grain control of x86 code generation features.
30075 @var{feature-list} is a comma separated list of @var{feature} names. See also
30076 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
30077 on if it is not preceded with @samp{^}, otherwise, it is turned off.
30078 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
30079 developers. Using it may lead to code paths not covered by testing and can
30080 potentially result in compiler ICEs or runtime errors.
30083 @opindex mno-default
30084 This option instructs GCC to turn off all tunable features. See also
30085 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
30089 This option instructs GCC to emit a @code{cld} instruction in the prologue
30090 of functions that use string instructions. String instructions depend on
30091 the DF flag to select between autoincrement or autodecrement mode. While the
30092 ABI specifies the DF flag to be cleared on function entry, some operating
30093 systems violate this specification by not clearing the DF flag in their
30094 exception dispatchers. The exception handler can be invoked with the DF flag
30095 set, which leads to wrong direction mode when string instructions are used.
30096 This option can be enabled by default on 32-bit x86 targets by configuring
30097 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
30098 instructions can be suppressed with the @option{-mno-cld} compiler option
30102 @opindex mvzeroupper
30103 This option instructs GCC to emit a @code{vzeroupper} instruction
30104 before a transfer of control flow out of the function to minimize
30105 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
30108 @item -mprefer-avx128
30109 @opindex mprefer-avx128
30110 This option instructs GCC to use 128-bit AVX instructions instead of
30111 256-bit AVX instructions in the auto-vectorizer.
30113 @item -mprefer-vector-width=@var{opt}
30114 @opindex mprefer-vector-width
30115 This option instructs GCC to use @var{opt}-bit vector width in instructions
30116 instead of default on the selected platform.
30120 No extra limitations applied to GCC other than defined by the selected platform.
30123 Prefer 128-bit vector width for instructions.
30126 Prefer 256-bit vector width for instructions.
30129 Prefer 512-bit vector width for instructions.
30134 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
30135 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
30136 objects. This is useful for atomic updates of data structures exceeding one
30137 machine word in size. The compiler uses this instruction to implement
30138 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
30139 128-bit integers, a library call is always used.
30143 This option enables generation of @code{SAHF} instructions in 64-bit code.
30144 Early Intel Pentium 4 CPUs with Intel 64 support,
30145 prior to the introduction of Pentium 4 G1 step in December 2005,
30146 lacked the @code{LAHF} and @code{SAHF} instructions
30147 which are supported by AMD64.
30148 These are load and store instructions, respectively, for certain status flags.
30149 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
30150 @code{drem}, and @code{remainder} built-in functions;
30151 see @ref{Other Builtins} for details.
30155 This option enables use of the @code{movbe} instruction to implement
30156 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
30160 The @option{-mshstk} option enables shadow stack built-in functions
30161 from x86 Control-flow Enforcement Technology (CET).
30165 This option enables built-in functions @code{__builtin_ia32_crc32qi},
30166 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
30167 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
30171 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
30172 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
30173 with an additional Newton-Raphson step
30174 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
30175 (and their vectorized
30176 variants) for single-precision floating-point arguments. These instructions
30177 are generated only when @option{-funsafe-math-optimizations} is enabled
30178 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
30179 Note that while the throughput of the sequence is higher than the throughput
30180 of the non-reciprocal instruction, the precision of the sequence can be
30181 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
30183 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
30184 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
30185 combination), and doesn't need @option{-mrecip}.
30187 Also note that GCC emits the above sequence with additional Newton-Raphson step
30188 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
30189 already with @option{-ffast-math} (or the above option combination), and
30190 doesn't need @option{-mrecip}.
30192 @item -mrecip=@var{opt}
30193 @opindex mrecip=opt
30194 This option controls which reciprocal estimate instructions
30195 may be used. @var{opt} is a comma-separated list of options, which may
30196 be preceded by a @samp{!} to invert the option:
30200 Enable all estimate instructions.
30203 Enable the default instructions, equivalent to @option{-mrecip}.
30206 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30209 Enable the approximation for scalar division.
30212 Enable the approximation for vectorized division.
30215 Enable the approximation for scalar square root.
30218 Enable the approximation for vectorized square root.
30221 So, for example, @option{-mrecip=all,!sqrt} enables
30222 all of the reciprocal approximations, except for square root.
30224 @item -mveclibabi=@var{type}
30225 @opindex mveclibabi
30226 Specifies the ABI type to use for vectorizing intrinsics using an
30227 external library. Supported values for @var{type} are @samp{svml}
30228 for the Intel short
30229 vector math library and @samp{acml} for the AMD math core library.
30230 To use this option, both @option{-ftree-vectorize} and
30231 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
30232 ABI-compatible library must be specified at link time.
30234 GCC currently emits calls to @code{vmldExp2},
30235 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
30236 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
30237 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
30238 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
30239 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
30240 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
30241 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
30242 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
30243 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
30244 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
30245 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
30246 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
30247 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
30248 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
30249 when @option{-mveclibabi=acml} is used.
30251 @item -mabi=@var{name}
30253 Generate code for the specified calling convention. Permissible values
30254 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
30255 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
30256 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
30257 You can control this behavior for specific functions by
30258 using the function attributes @code{ms_abi} and @code{sysv_abi}.
30259 @xref{Function Attributes}.
30261 @item -mforce-indirect-call
30262 @opindex mforce-indirect-call
30263 Force all calls to functions to be indirect. This is useful
30264 when using Intel Processor Trace where it generates more precise timing
30265 information for function calls.
30267 @item -mmanual-endbr
30268 @opindex mmanual-endbr
30269 Insert ENDBR instruction at function entry only via the @code{cf_check}
30270 function attribute. This is useful when used with the option
30271 @option{-fcf-protection=branch} to control ENDBR insertion at the
30274 @item -mcall-ms2sysv-xlogues
30275 @opindex mcall-ms2sysv-xlogues
30276 @opindex mno-call-ms2sysv-xlogues
30277 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
30278 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
30279 default, the code for saving and restoring these registers is emitted inline,
30280 resulting in fairly lengthy prologues and epilogues. Using
30281 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
30282 use stubs in the static portion of libgcc to perform these saves and restores,
30283 thus reducing function size at the cost of a few extra instructions.
30285 @item -mtls-dialect=@var{type}
30286 @opindex mtls-dialect
30287 Generate code to access thread-local storage using the @samp{gnu} or
30288 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
30289 @samp{gnu2} is more efficient, but it may add compile- and run-time
30290 requirements that cannot be satisfied on all systems.
30293 @itemx -mno-push-args
30294 @opindex mpush-args
30295 @opindex mno-push-args
30296 Use PUSH operations to store outgoing parameters. This method is shorter
30297 and usually equally fast as method using SUB/MOV operations and is enabled
30298 by default. In some cases disabling it may improve performance because of
30299 improved scheduling and reduced dependencies.
30301 @item -maccumulate-outgoing-args
30302 @opindex maccumulate-outgoing-args
30303 If enabled, the maximum amount of space required for outgoing arguments is
30304 computed in the function prologue. This is faster on most modern CPUs
30305 because of reduced dependencies, improved scheduling and reduced stack usage
30306 when the preferred stack boundary is not equal to 2. The drawback is a notable
30307 increase in code size. This switch implies @option{-mno-push-args}.
30311 Support thread-safe exception handling on MinGW. Programs that rely
30312 on thread-safe exception handling must compile and link all code with the
30313 @option{-mthreads} option. When compiling, @option{-mthreads} defines
30314 @option{-D_MT}; when linking, it links in a special thread helper library
30315 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
30317 @item -mms-bitfields
30318 @itemx -mno-ms-bitfields
30319 @opindex mms-bitfields
30320 @opindex mno-ms-bitfields
30322 Enable/disable bit-field layout compatible with the native Microsoft
30325 If @code{packed} is used on a structure, or if bit-fields are used,
30326 it may be that the Microsoft ABI lays out the structure differently
30327 than the way GCC normally does. Particularly when moving packed
30328 data between functions compiled with GCC and the native Microsoft compiler
30329 (either via function call or as data in a file), it may be necessary to access
30332 This option is enabled by default for Microsoft Windows
30333 targets. This behavior can also be controlled locally by use of variable
30334 or type attributes. For more information, see @ref{x86 Variable Attributes}
30335 and @ref{x86 Type Attributes}.
30337 The Microsoft structure layout algorithm is fairly simple with the exception
30338 of the bit-field packing.
30339 The padding and alignment of members of structures and whether a bit-field
30340 can straddle a storage-unit boundary are determine by these rules:
30343 @item Structure members are stored sequentially in the order in which they are
30344 declared: the first member has the lowest memory address and the last member
30347 @item Every data object has an alignment requirement. The alignment requirement
30348 for all data except structures, unions, and arrays is either the size of the
30349 object or the current packing size (specified with either the
30350 @code{aligned} attribute or the @code{pack} pragma),
30351 whichever is less. For structures, unions, and arrays,
30352 the alignment requirement is the largest alignment requirement of its members.
30353 Every object is allocated an offset so that:
30356 offset % alignment_requirement == 0
30359 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
30360 unit if the integral types are the same size and if the next bit-field fits
30361 into the current allocation unit without crossing the boundary imposed by the
30362 common alignment requirements of the bit-fields.
30365 MSVC interprets zero-length bit-fields in the following ways:
30368 @item If a zero-length bit-field is inserted between two bit-fields that
30369 are normally coalesced, the bit-fields are not coalesced.
30376 unsigned long bf_1 : 12;
30378 unsigned long bf_2 : 12;
30383 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
30384 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
30386 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
30387 alignment of the zero-length bit-field is greater than the member that follows it,
30388 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
30409 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
30410 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
30411 bit-field does not affect the alignment of @code{bar} or, as a result, the size
30414 Taking this into account, it is important to note the following:
30417 @item If a zero-length bit-field follows a normal bit-field, the type of the
30418 zero-length bit-field may affect the alignment of the structure as whole. For
30419 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
30420 normal bit-field, and is of type short.
30422 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
30423 still affect the alignment of the structure:
30434 Here, @code{t4} takes up 4 bytes.
30437 @item Zero-length bit-fields following non-bit-field members are ignored:
30449 Here, @code{t5} takes up 2 bytes.
30453 @item -mno-align-stringops
30454 @opindex mno-align-stringops
30455 @opindex malign-stringops
30456 Do not align the destination of inlined string operations. This switch reduces
30457 code size and improves performance in case the destination is already aligned,
30458 but GCC doesn't know about it.
30460 @item -minline-all-stringops
30461 @opindex minline-all-stringops
30462 By default GCC inlines string operations only when the destination is
30463 known to be aligned to least a 4-byte boundary.
30464 This enables more inlining and increases code
30465 size, but may improve performance of code that depends on fast
30466 @code{memcpy} and @code{memset} for short lengths.
30467 The option enables inline expansion of @code{strlen} for all
30468 pointer alignments.
30470 @item -minline-stringops-dynamically
30471 @opindex minline-stringops-dynamically
30472 For string operations of unknown size, use run-time checks with
30473 inline code for small blocks and a library call for large blocks.
30475 @item -mstringop-strategy=@var{alg}
30476 @opindex mstringop-strategy=@var{alg}
30477 Override the internal decision heuristic for the particular algorithm to use
30478 for inlining string operations. The allowed values for @var{alg} are:
30484 Expand using i386 @code{rep} prefix of the specified size.
30488 @itemx unrolled_loop
30489 Expand into an inline loop.
30492 Always use a library call.
30495 @item -mmemcpy-strategy=@var{strategy}
30496 @opindex mmemcpy-strategy=@var{strategy}
30497 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
30498 should be inlined and what inline algorithm to use when the expected size
30499 of the copy operation is known. @var{strategy}
30500 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
30501 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
30502 the max byte size with which inline algorithm @var{alg} is allowed. For the last
30503 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
30504 in the list must be specified in increasing order. The minimal byte size for
30505 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
30508 @item -mmemset-strategy=@var{strategy}
30509 @opindex mmemset-strategy=@var{strategy}
30510 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
30511 @code{__builtin_memset} expansion.
30513 @item -momit-leaf-frame-pointer
30514 @opindex momit-leaf-frame-pointer
30515 Don't keep the frame pointer in a register for leaf functions. This
30516 avoids the instructions to save, set up, and restore frame pointers and
30517 makes an extra register available in leaf functions. The option
30518 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
30519 which might make debugging harder.
30521 @item -mtls-direct-seg-refs
30522 @itemx -mno-tls-direct-seg-refs
30523 @opindex mtls-direct-seg-refs
30524 Controls whether TLS variables may be accessed with offsets from the
30525 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
30526 or whether the thread base pointer must be added. Whether or not this
30527 is valid depends on the operating system, and whether it maps the
30528 segment to cover the entire TLS area.
30530 For systems that use the GNU C Library, the default is on.
30533 @itemx -mno-sse2avx
30535 Specify that the assembler should encode SSE instructions with VEX
30536 prefix. The option @option{-mavx} turns this on by default.
30541 If profiling is active (@option{-pg}), put the profiling
30542 counter call before the prologue.
30543 Note: On x86 architectures the attribute @code{ms_hook_prologue}
30544 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
30546 @item -mrecord-mcount
30547 @itemx -mno-record-mcount
30548 @opindex mrecord-mcount
30549 If profiling is active (@option{-pg}), generate a __mcount_loc section
30550 that contains pointers to each profiling call. This is useful for
30551 automatically patching and out calls.
30554 @itemx -mno-nop-mcount
30555 @opindex mnop-mcount
30556 If profiling is active (@option{-pg}), generate the calls to
30557 the profiling functions as NOPs. This is useful when they
30558 should be patched in later dynamically. This is likely only
30559 useful together with @option{-mrecord-mcount}.
30561 @item -minstrument-return=@var{type}
30562 @opindex minstrument-return
30563 Instrument function exit in -pg -mfentry instrumented functions with
30564 call to specified function. This only instruments true returns ending
30565 with ret, but not sibling calls ending with jump. Valid types
30566 are @var{none} to not instrument, @var{call} to generate a call to __return__,
30567 or @var{nop5} to generate a 5 byte nop.
30569 @item -mrecord-return
30570 @itemx -mno-record-return
30571 @opindex mrecord-return
30572 Generate a __return_loc section pointing to all return instrumentation code.
30574 @item -mfentry-name=@var{name}
30575 @opindex mfentry-name
30576 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
30578 @item -mfentry-section=@var{name}
30579 @opindex mfentry-section
30580 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
30582 @item -mskip-rax-setup
30583 @itemx -mno-skip-rax-setup
30584 @opindex mskip-rax-setup
30585 When generating code for the x86-64 architecture with SSE extensions
30586 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
30587 register when there are no variable arguments passed in vector registers.
30589 @strong{Warning:} Since RAX register is used to avoid unnecessarily
30590 saving vector registers on stack when passing variable arguments, the
30591 impacts of this option are callees may waste some stack space,
30592 misbehave or jump to a random location. GCC 4.4 or newer don't have
30593 those issues, regardless the RAX register value.
30596 @itemx -mno-8bit-idiv
30597 @opindex m8bit-idiv
30598 On some processors, like Intel Atom, 8-bit unsigned integer divide is
30599 much faster than 32-bit/64-bit integer divide. This option generates a
30600 run-time check. If both dividend and divisor are within range of 0
30601 to 255, 8-bit unsigned integer divide is used instead of
30602 32-bit/64-bit integer divide.
30604 @item -mavx256-split-unaligned-load
30605 @itemx -mavx256-split-unaligned-store
30606 @opindex mavx256-split-unaligned-load
30607 @opindex mavx256-split-unaligned-store
30608 Split 32-byte AVX unaligned load and store.
30610 @item -mstack-protector-guard=@var{guard}
30611 @itemx -mstack-protector-guard-reg=@var{reg}
30612 @itemx -mstack-protector-guard-offset=@var{offset}
30613 @opindex mstack-protector-guard
30614 @opindex mstack-protector-guard-reg
30615 @opindex mstack-protector-guard-offset
30616 Generate stack protection code using canary at @var{guard}. Supported
30617 locations are @samp{global} for global canary or @samp{tls} for per-thread
30618 canary in the TLS block (the default). This option has effect only when
30619 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
30621 With the latter choice the options
30622 @option{-mstack-protector-guard-reg=@var{reg}} and
30623 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30624 which segment register (@code{%fs} or @code{%gs}) to use as base register
30625 for reading the canary, and from what offset from that base register.
30626 The default for those is as specified in the relevant ABI.
30628 @item -mgeneral-regs-only
30629 @opindex mgeneral-regs-only
30630 Generate code that uses only the general-purpose registers. This
30631 prevents the compiler from using floating-point, vector, mask and bound
30634 @item -mindirect-branch=@var{choice}
30635 @opindex mindirect-branch
30636 Convert indirect call and jump with @var{choice}. The default is
30637 @samp{keep}, which keeps indirect call and jump unmodified.
30638 @samp{thunk} converts indirect call and jump to call and return thunk.
30639 @samp{thunk-inline} converts indirect call and jump to inlined call
30640 and return thunk. @samp{thunk-extern} converts indirect call and jump
30641 to external call and return thunk provided in a separate object file.
30642 You can control this behavior for a specific function by using the
30643 function attribute @code{indirect_branch}. @xref{Function Attributes}.
30645 Note that @option{-mcmodel=large} is incompatible with
30646 @option{-mindirect-branch=thunk} and
30647 @option{-mindirect-branch=thunk-extern} since the thunk function may
30648 not be reachable in the large code model.
30650 Note that @option{-mindirect-branch=thunk-extern} is compatible with
30651 @option{-fcf-protection=branch} since the external thunk can be made
30652 to enable control-flow check.
30654 @item -mfunction-return=@var{choice}
30655 @opindex mfunction-return
30656 Convert function return with @var{choice}. The default is @samp{keep},
30657 which keeps function return unmodified. @samp{thunk} converts function
30658 return to call and return thunk. @samp{thunk-inline} converts function
30659 return to inlined call and return thunk. @samp{thunk-extern} converts
30660 function return to external call and return thunk provided in a separate
30661 object file. You can control this behavior for a specific function by
30662 using the function attribute @code{function_return}.
30663 @xref{Function Attributes}.
30665 Note that @option{-mindirect-return=thunk-extern} is compatible with
30666 @option{-fcf-protection=branch} since the external thunk can be made
30667 to enable control-flow check.
30669 Note that @option{-mcmodel=large} is incompatible with
30670 @option{-mfunction-return=thunk} and
30671 @option{-mfunction-return=thunk-extern} since the thunk function may
30672 not be reachable in the large code model.
30675 @item -mindirect-branch-register
30676 @opindex mindirect-branch-register
30677 Force indirect call and jump via register.
30681 These @samp{-m} switches are supported in addition to the above
30682 on x86-64 processors in 64-bit environments.
30695 Generate code for a 16-bit, 32-bit or 64-bit environment.
30696 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
30698 generates code that runs on any i386 system.
30700 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
30701 types to 64 bits, and generates code for the x86-64 architecture.
30702 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
30703 and @option{-mdynamic-no-pic} options.
30705 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
30707 generates code for the x86-64 architecture.
30709 The @option{-m16} option is the same as @option{-m32}, except for that
30710 it outputs the @code{.code16gcc} assembly directive at the beginning of
30711 the assembly output so that the binary can run in 16-bit mode.
30713 The @option{-miamcu} option generates code which conforms to Intel MCU
30714 psABI. It requires the @option{-m32} option to be turned on.
30716 @item -mno-red-zone
30717 @opindex mno-red-zone
30719 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
30720 by the x86-64 ABI; it is a 128-byte area beyond the location of the
30721 stack pointer that is not modified by signal or interrupt handlers
30722 and therefore can be used for temporary data without adjusting the stack
30723 pointer. The flag @option{-mno-red-zone} disables this red zone.
30725 @item -mcmodel=small
30726 @opindex mcmodel=small
30727 Generate code for the small code model: the program and its symbols must
30728 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
30729 Programs can be statically or dynamically linked. This is the default
30732 @item -mcmodel=kernel
30733 @opindex mcmodel=kernel
30734 Generate code for the kernel code model. The kernel runs in the
30735 negative 2 GB of the address space.
30736 This model has to be used for Linux kernel code.
30738 @item -mcmodel=medium
30739 @opindex mcmodel=medium
30740 Generate code for the medium model: the program is linked in the lower 2
30741 GB of the address space. Small symbols are also placed there. Symbols
30742 with sizes larger than @option{-mlarge-data-threshold} are put into
30743 large data or BSS sections and can be located above 2GB. Programs can
30744 be statically or dynamically linked.
30746 @item -mcmodel=large
30747 @opindex mcmodel=large
30748 Generate code for the large model. This model makes no assumptions
30749 about addresses and sizes of sections.
30751 @item -maddress-mode=long
30752 @opindex maddress-mode=long
30753 Generate code for long address mode. This is only supported for 64-bit
30754 and x32 environments. It is the default address mode for 64-bit
30757 @item -maddress-mode=short
30758 @opindex maddress-mode=short
30759 Generate code for short address mode. This is only supported for 32-bit
30760 and x32 environments. It is the default address mode for 32-bit and
30764 @node x86 Windows Options
30765 @subsection x86 Windows Options
30766 @cindex x86 Windows Options
30767 @cindex Windows Options for x86
30769 These additional options are available for Microsoft Windows targets:
30775 specifies that a console application is to be generated, by
30776 instructing the linker to set the PE header subsystem type
30777 required for console applications.
30778 This option is available for Cygwin and MinGW targets and is
30779 enabled by default on those targets.
30783 This option is available for Cygwin and MinGW targets. It
30784 specifies that a DLL---a dynamic link library---is to be
30785 generated, enabling the selection of the required runtime
30786 startup object and entry point.
30788 @item -mnop-fun-dllimport
30789 @opindex mnop-fun-dllimport
30790 This option is available for Cygwin and MinGW targets. It
30791 specifies that the @code{dllimport} attribute should be ignored.
30795 This option is available for MinGW targets. It specifies
30796 that MinGW-specific thread support is to be used.
30800 This option is available for MinGW-w64 targets. It causes
30801 the @code{UNICODE} preprocessor macro to be predefined, and
30802 chooses Unicode-capable runtime startup code.
30806 This option is available for Cygwin and MinGW targets. It
30807 specifies that the typical Microsoft Windows predefined macros are to
30808 be set in the pre-processor, but does not influence the choice
30809 of runtime library/startup code.
30813 This option is available for Cygwin and MinGW targets. It
30814 specifies that a GUI application is to be generated by
30815 instructing the linker to set the PE header subsystem type
30818 @item -fno-set-stack-executable
30819 @opindex fno-set-stack-executable
30820 @opindex fset-stack-executable
30821 This option is available for MinGW targets. It specifies that
30822 the executable flag for the stack used by nested functions isn't
30823 set. This is necessary for binaries running in kernel mode of
30824 Microsoft Windows, as there the User32 API, which is used to set executable
30825 privileges, isn't available.
30827 @item -fwritable-relocated-rdata
30828 @opindex fno-writable-relocated-rdata
30829 @opindex fwritable-relocated-rdata
30830 This option is available for MinGW and Cygwin targets. It specifies
30831 that relocated-data in read-only section is put into the @code{.data}
30832 section. This is a necessary for older runtimes not supporting
30833 modification of @code{.rdata} sections for pseudo-relocation.
30835 @item -mpe-aligned-commons
30836 @opindex mpe-aligned-commons
30837 This option is available for Cygwin and MinGW targets. It
30838 specifies that the GNU extension to the PE file format that
30839 permits the correct alignment of COMMON variables should be
30840 used when generating code. It is enabled by default if
30841 GCC detects that the target assembler found during configuration
30842 supports the feature.
30845 See also under @ref{x86 Options} for standard options.
30847 @node Xstormy16 Options
30848 @subsection Xstormy16 Options
30849 @cindex Xstormy16 Options
30851 These options are defined for Xstormy16:
30856 Choose startup files and linker script suitable for the simulator.
30859 @node Xtensa Options
30860 @subsection Xtensa Options
30861 @cindex Xtensa Options
30863 These options are supported for Xtensa targets:
30867 @itemx -mno-const16
30869 @opindex mno-const16
30870 Enable or disable use of @code{CONST16} instructions for loading
30871 constant values. The @code{CONST16} instruction is currently not a
30872 standard option from Tensilica. When enabled, @code{CONST16}
30873 instructions are always used in place of the standard @code{L32R}
30874 instructions. The use of @code{CONST16} is enabled by default only if
30875 the @code{L32R} instruction is not available.
30878 @itemx -mno-fused-madd
30879 @opindex mfused-madd
30880 @opindex mno-fused-madd
30881 Enable or disable use of fused multiply/add and multiply/subtract
30882 instructions in the floating-point option. This has no effect if the
30883 floating-point option is not also enabled. Disabling fused multiply/add
30884 and multiply/subtract instructions forces the compiler to use separate
30885 instructions for the multiply and add/subtract operations. This may be
30886 desirable in some cases where strict IEEE 754-compliant results are
30887 required: the fused multiply add/subtract instructions do not round the
30888 intermediate result, thereby producing results with @emph{more} bits of
30889 precision than specified by the IEEE standard. Disabling fused multiply
30890 add/subtract instructions also ensures that the program output is not
30891 sensitive to the compiler's ability to combine multiply and add/subtract
30894 @item -mserialize-volatile
30895 @itemx -mno-serialize-volatile
30896 @opindex mserialize-volatile
30897 @opindex mno-serialize-volatile
30898 When this option is enabled, GCC inserts @code{MEMW} instructions before
30899 @code{volatile} memory references to guarantee sequential consistency.
30900 The default is @option{-mserialize-volatile}. Use
30901 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
30903 @item -mforce-no-pic
30904 @opindex mforce-no-pic
30905 For targets, like GNU/Linux, where all user-mode Xtensa code must be
30906 position-independent code (PIC), this option disables PIC for compiling
30909 @item -mtext-section-literals
30910 @itemx -mno-text-section-literals
30911 @opindex mtext-section-literals
30912 @opindex mno-text-section-literals
30913 These options control the treatment of literal pools. The default is
30914 @option{-mno-text-section-literals}, which places literals in a separate
30915 section in the output file. This allows the literal pool to be placed
30916 in a data RAM/ROM, and it also allows the linker to combine literal
30917 pools from separate object files to remove redundant literals and
30918 improve code size. With @option{-mtext-section-literals}, the literals
30919 are interspersed in the text section in order to keep them as close as
30920 possible to their references. This may be necessary for large assembly
30921 files. Literals for each function are placed right before that function.
30923 @item -mauto-litpools
30924 @itemx -mno-auto-litpools
30925 @opindex mauto-litpools
30926 @opindex mno-auto-litpools
30927 These options control the treatment of literal pools. The default is
30928 @option{-mno-auto-litpools}, which places literals in a separate
30929 section in the output file unless @option{-mtext-section-literals} is
30930 used. With @option{-mauto-litpools} the literals are interspersed in
30931 the text section by the assembler. Compiler does not produce explicit
30932 @code{.literal} directives and loads literals into registers with
30933 @code{MOVI} instructions instead of @code{L32R} to let the assembler
30934 do relaxation and place literals as necessary. This option allows
30935 assembler to create several literal pools per function and assemble
30936 very big functions, which may not be possible with
30937 @option{-mtext-section-literals}.
30939 @item -mtarget-align
30940 @itemx -mno-target-align
30941 @opindex mtarget-align
30942 @opindex mno-target-align
30943 When this option is enabled, GCC instructs the assembler to
30944 automatically align instructions to reduce branch penalties at the
30945 expense of some code density. The assembler attempts to widen density
30946 instructions to align branch targets and the instructions following call
30947 instructions. If there are not enough preceding safe density
30948 instructions to align a target, no widening is performed. The
30949 default is @option{-mtarget-align}. These options do not affect the
30950 treatment of auto-aligned instructions like @code{LOOP}, which the
30951 assembler always aligns, either by widening density instructions or
30952 by inserting NOP instructions.
30955 @itemx -mno-longcalls
30956 @opindex mlongcalls
30957 @opindex mno-longcalls
30958 When this option is enabled, GCC instructs the assembler to translate
30959 direct calls to indirect calls unless it can determine that the target
30960 of a direct call is in the range allowed by the call instruction. This
30961 translation typically occurs for calls to functions in other source
30962 files. Specifically, the assembler translates a direct @code{CALL}
30963 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
30964 The default is @option{-mno-longcalls}. This option should be used in
30965 programs where the call target can potentially be out of range. This
30966 option is implemented in the assembler, not the compiler, so the
30967 assembly code generated by GCC still shows direct call
30968 instructions---look at the disassembled object code to see the actual
30969 instructions. Note that the assembler uses an indirect call for
30970 every cross-file call, not just those that really are out of range.
30972 @item -mabi=@var{name}
30974 Generate code for the specified ABI@. Permissible values are: @samp{call0},
30975 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
30978 @opindex mabi=call0
30979 When this option is enabled function parameters are passed in registers
30980 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
30981 caller-saved, and register @code{a15} may be used as a frame pointer.
30982 When this version of the ABI is enabled the C preprocessor symbol
30983 @code{__XTENSA_CALL0_ABI__} is defined.
30985 @item -mabi=windowed
30986 @opindex mabi=windowed
30987 When this option is enabled function parameters are passed in registers
30988 @code{a10} through @code{a15}, and called function rotates register window
30989 by 8 registers on entry so that its arguments are found in registers
30990 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
30991 pointer. Register window is rotated 8 registers back upon return.
30992 When this version of the ABI is enabled the C preprocessor symbol
30993 @code{__XTENSA_WINDOWED_ABI__} is defined.
30996 @node zSeries Options
30997 @subsection zSeries Options
30998 @cindex zSeries options
31000 These are listed under @xref{S/390 and zSeries Options}.
31006 @section Specifying Subprocesses and the Switches to Pass to Them
31009 @command{gcc} is a driver program. It performs its job by invoking a
31010 sequence of other programs to do the work of compiling, assembling and
31011 linking. GCC interprets its command-line parameters and uses these to
31012 deduce which programs it should invoke, and which command-line options
31013 it ought to place on their command lines. This behavior is controlled
31014 by @dfn{spec strings}. In most cases there is one spec string for each
31015 program that GCC can invoke, but a few programs have multiple spec
31016 strings to control their behavior. The spec strings built into GCC can
31017 be overridden by using the @option{-specs=} command-line switch to specify
31020 @dfn{Spec files} are plain-text files that are used to construct spec
31021 strings. They consist of a sequence of directives separated by blank
31022 lines. The type of directive is determined by the first non-whitespace
31023 character on the line, which can be one of the following:
31026 @item %@var{command}
31027 Issues a @var{command} to the spec file processor. The commands that can
31031 @item %include <@var{file}>
31032 @cindex @code{%include}
31033 Search for @var{file} and insert its text at the current point in the
31036 @item %include_noerr <@var{file}>
31037 @cindex @code{%include_noerr}
31038 Just like @samp{%include}, but do not generate an error message if the include
31039 file cannot be found.
31041 @item %rename @var{old_name} @var{new_name}
31042 @cindex @code{%rename}
31043 Rename the spec string @var{old_name} to @var{new_name}.
31047 @item *[@var{spec_name}]:
31048 This tells the compiler to create, override or delete the named spec
31049 string. All lines after this directive up to the next directive or
31050 blank line are considered to be the text for the spec string. If this
31051 results in an empty string then the spec is deleted. (Or, if the
31052 spec did not exist, then nothing happens.) Otherwise, if the spec
31053 does not currently exist a new spec is created. If the spec does
31054 exist then its contents are overridden by the text of this
31055 directive, unless the first character of that text is the @samp{+}
31056 character, in which case the text is appended to the spec.
31058 @item [@var{suffix}]:
31059 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
31060 and up to the next directive or blank line are considered to make up the
31061 spec string for the indicated suffix. When the compiler encounters an
31062 input file with the named suffix, it processes the spec string in
31063 order to work out how to compile that file. For example:
31067 z-compile -input %i
31070 This says that any input file whose name ends in @samp{.ZZ} should be
31071 passed to the program @samp{z-compile}, which should be invoked with the
31072 command-line switch @option{-input} and with the result of performing the
31073 @samp{%i} substitution. (See below.)
31075 As an alternative to providing a spec string, the text following a
31076 suffix directive can be one of the following:
31079 @item @@@var{language}
31080 This says that the suffix is an alias for a known @var{language}. This is
31081 similar to using the @option{-x} command-line switch to GCC to specify a
31082 language explicitly. For example:
31089 Says that .ZZ files are, in fact, C++ source files.
31092 This causes an error messages saying:
31095 @var{name} compiler not installed on this system.
31099 GCC already has an extensive list of suffixes built into it.
31100 This directive adds an entry to the end of the list of suffixes, but
31101 since the list is searched from the end backwards, it is effectively
31102 possible to override earlier entries using this technique.
31106 GCC has the following spec strings built into it. Spec files can
31107 override these strings or create their own. Note that individual
31108 targets can also add their own spec strings to this list.
31111 asm Options to pass to the assembler
31112 asm_final Options to pass to the assembler post-processor
31113 cpp Options to pass to the C preprocessor
31114 cc1 Options to pass to the C compiler
31115 cc1plus Options to pass to the C++ compiler
31116 endfile Object files to include at the end of the link
31117 link Options to pass to the linker
31118 lib Libraries to include on the command line to the linker
31119 libgcc Decides which GCC support library to pass to the linker
31120 linker Sets the name of the linker
31121 predefines Defines to be passed to the C preprocessor
31122 signed_char Defines to pass to CPP to say whether @code{char} is signed
31124 startfile Object files to include at the start of the link
31127 Here is a small example of a spec file:
31130 %rename lib old_lib
31133 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
31136 This example renames the spec called @samp{lib} to @samp{old_lib} and
31137 then overrides the previous definition of @samp{lib} with a new one.
31138 The new definition adds in some extra command-line options before
31139 including the text of the old definition.
31141 @dfn{Spec strings} are a list of command-line options to be passed to their
31142 corresponding program. In addition, the spec strings can contain
31143 @samp{%}-prefixed sequences to substitute variable text or to
31144 conditionally insert text into the command line. Using these constructs
31145 it is possible to generate quite complex command lines.
31147 Here is a table of all defined @samp{%}-sequences for spec
31148 strings. Note that spaces are not generated automatically around the
31149 results of expanding these sequences. Therefore you can concatenate them
31150 together or combine them with constant text in a single argument.
31154 Substitute one @samp{%} into the program name or argument.
31157 Substitute an empty argument.
31160 Substitute the name of the input file being processed.
31163 Substitute the basename for outputs related with the input file being
31164 processed. This is often the substring up to (and not including) the
31165 last period and not including the directory but, unless %w is active, it
31166 expands to the basename for auxiliary outputs, which may be influenced
31167 by an explicit output name, and by various other options that control
31168 how auxiliary outputs are named.
31171 This is the same as @samp{%b}, but include the file suffix (text after
31172 the last period). Without %w, it expands to the basename for dump
31176 Marks the argument containing or following the @samp{%d} as a
31177 temporary file name, so that that file is deleted if GCC exits
31178 successfully. Unlike @samp{%g}, this contributes no text to the
31181 @item %g@var{suffix}
31182 Substitute a file name that has suffix @var{suffix} and is chosen
31183 once per compilation, and mark the argument in the same way as
31184 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
31185 name is now chosen in a way that is hard to predict even when previously
31186 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
31187 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
31188 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
31189 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
31190 was simply substituted with a file name chosen once per compilation,
31191 without regard to any appended suffix (which was therefore treated
31192 just like ordinary text), making such attacks more likely to succeed.
31194 @item %u@var{suffix}
31195 Like @samp{%g}, but generates a new temporary file name
31196 each time it appears instead of once per compilation.
31198 @item %U@var{suffix}
31199 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
31200 new one if there is no such last file name. In the absence of any
31201 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
31202 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
31203 involves the generation of two distinct file names, one
31204 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
31205 simply substituted with a file name chosen for the previous @samp{%u},
31206 without regard to any appended suffix.
31208 @item %j@var{suffix}
31209 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
31210 writable, and if @option{-save-temps} is not used;
31211 otherwise, substitute the name
31212 of a temporary file, just like @samp{%u}. This temporary file is not
31213 meant for communication between processes, but rather as a junk
31214 disposal mechanism.
31216 @item %|@var{suffix}
31217 @itemx %m@var{suffix}
31218 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
31219 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
31220 all. These are the two most common ways to instruct a program that it
31221 should read from standard input or write to standard output. If you
31222 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
31223 construct: see for example @file{gcc/fortran/lang-specs.h}.
31225 @item %.@var{SUFFIX}
31226 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
31227 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
31228 terminated by the next space or %.
31231 Marks the argument containing or following the @samp{%w} as the
31232 designated output file of this compilation. This puts the argument
31233 into the sequence of arguments that @samp{%o} substitutes.
31236 Substitutes the names of all the output files, with spaces
31237 automatically placed around them. You should write spaces
31238 around the @samp{%o} as well or the results are undefined.
31239 @samp{%o} is for use in the specs for running the linker.
31240 Input files whose names have no recognized suffix are not compiled
31241 at all, but they are included among the output files, so they are
31245 Substitutes the suffix for object files. Note that this is
31246 handled specially when it immediately follows @samp{%g, %u, or %U},
31247 because of the need for those to form complete file names. The
31248 handling is such that @samp{%O} is treated exactly as if it had already
31249 been substituted, except that @samp{%g, %u, and %U} do not currently
31250 support additional @var{suffix} characters following @samp{%O} as they do
31251 following, for example, @samp{.o}.
31254 Substitutes the standard macro predefinitions for the
31255 current target machine. Use this when running @command{cpp}.
31258 Like @samp{%p}, but puts @samp{__} before and after the name of each
31259 predefined macro, except for macros that start with @samp{__} or with
31260 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
31264 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
31265 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
31266 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
31267 and @option{-imultilib} as necessary.
31270 Current argument is the name of a library or startup file of some sort.
31271 Search for that file in a standard list of directories and substitute
31272 the full name found. The current working directory is included in the
31273 list of directories scanned.
31276 Current argument is the name of a linker script. Search for that file
31277 in the current list of directories to scan for libraries. If the file
31278 is located insert a @option{--script} option into the command line
31279 followed by the full path name found. If the file is not found then
31280 generate an error message. Note: the current working directory is not
31284 Print @var{str} as an error message. @var{str} is terminated by a newline.
31285 Use this when inconsistent options are detected.
31287 @item %(@var{name})
31288 Substitute the contents of spec string @var{name} at this point.
31290 @item %x@{@var{option}@}
31291 Accumulate an option for @samp{%X}.
31294 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
31298 Output the accumulated assembler options specified by @option{-Wa}.
31301 Output the accumulated preprocessor options specified by @option{-Wp}.
31304 Process the @code{asm} spec. This is used to compute the
31305 switches to be passed to the assembler.
31308 Process the @code{asm_final} spec. This is a spec string for
31309 passing switches to an assembler post-processor, if such a program is
31313 Process the @code{link} spec. This is the spec for computing the
31314 command line passed to the linker. Typically it makes use of the
31315 @samp{%L %G %S %D and %E} sequences.
31318 Dump out a @option{-L} option for each directory that GCC believes might
31319 contain startup files. If the target supports multilibs then the
31320 current multilib directory is prepended to each of these paths.
31323 Process the @code{lib} spec. This is a spec string for deciding which
31324 libraries are included on the command line to the linker.
31327 Process the @code{libgcc} spec. This is a spec string for deciding
31328 which GCC support library is included on the command line to the linker.
31331 Process the @code{startfile} spec. This is a spec for deciding which
31332 object files are the first ones passed to the linker. Typically
31333 this might be a file named @file{crt0.o}.
31336 Process the @code{endfile} spec. This is a spec string that specifies
31337 the last object files that are passed to the linker.
31340 Process the @code{cpp} spec. This is used to construct the arguments
31341 to be passed to the C preprocessor.
31344 Process the @code{cc1} spec. This is used to construct the options to be
31345 passed to the actual C compiler (@command{cc1}).
31348 Process the @code{cc1plus} spec. This is used to construct the options to be
31349 passed to the actual C++ compiler (@command{cc1plus}).
31352 Substitute the variable part of a matched option. See below.
31353 Note that each comma in the substituted string is replaced by
31357 Remove all occurrences of @code{-S} from the command line. Note---this
31358 command is position dependent. @samp{%} commands in the spec string
31359 before this one see @code{-S}, @samp{%} commands in the spec string
31360 after this one do not.
31362 @item %:@var{function}(@var{args})
31363 Call the named function @var{function}, passing it @var{args}.
31364 @var{args} is first processed as a nested spec string, then split
31365 into an argument vector in the usual fashion. The function returns
31366 a string which is processed as if it had appeared literally as part
31367 of the current spec.
31369 The following built-in spec functions are provided:
31372 @item @code{getenv}
31373 The @code{getenv} spec function takes two arguments: an environment
31374 variable name and a string. If the environment variable is not
31375 defined, a fatal error is issued. Otherwise, the return value is the
31376 value of the environment variable concatenated with the string. For
31377 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
31380 %:getenv(TOPDIR /include)
31383 expands to @file{/path/to/top/include}.
31385 @item @code{if-exists}
31386 The @code{if-exists} spec function takes one argument, an absolute
31387 pathname to a file. If the file exists, @code{if-exists} returns the
31388 pathname. Here is a small example of its usage:
31392 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
31395 @item @code{if-exists-else}
31396 The @code{if-exists-else} spec function is similar to the @code{if-exists}
31397 spec function, except that it takes two arguments. The first argument is
31398 an absolute pathname to a file. If the file exists, @code{if-exists-else}
31399 returns the pathname. If it does not exist, it returns the second argument.
31400 This way, @code{if-exists-else} can be used to select one file or another,
31401 based on the existence of the first. Here is a small example of its usage:
31405 crt0%O%s %:if-exists(crti%O%s) \
31406 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
31409 @item @code{replace-outfile}
31410 The @code{replace-outfile} spec function takes two arguments. It looks for the
31411 first argument in the outfiles array and replaces it with the second argument. Here
31412 is a small example of its usage:
31415 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
31418 @item @code{remove-outfile}
31419 The @code{remove-outfile} spec function takes one argument. It looks for the
31420 first argument in the outfiles array and removes it. Here is a small example
31424 %:remove-outfile(-lm)
31427 @item @code{pass-through-libs}
31428 The @code{pass-through-libs} spec function takes any number of arguments. It
31429 finds any @option{-l} options and any non-options ending in @file{.a} (which it
31430 assumes are the names of linker input library archive files) and returns a
31431 result containing all the found arguments each prepended by
31432 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
31433 intended to be passed to the LTO linker plugin.
31436 %:pass-through-libs(%G %L %G)
31439 @item @code{print-asm-header}
31440 The @code{print-asm-header} function takes no arguments and simply
31441 prints a banner like:
31447 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
31450 It is used to separate compiler options from assembler options
31451 in the @option{--target-help} output.
31455 Substitutes the @code{-S} switch, if that switch is given to GCC@.
31456 If that switch is not specified, this substitutes nothing. Note that
31457 the leading dash is omitted when specifying this option, and it is
31458 automatically inserted if the substitution is performed. Thus the spec
31459 string @samp{%@{foo@}} matches the command-line option @option{-foo}
31460 and outputs the command-line option @option{-foo}.
31463 Like %@{@code{S}@} but mark last argument supplied within as a file to be
31464 deleted on failure.
31467 Substitutes all the switches specified to GCC whose names start
31468 with @code{-S}, but which also take an argument. This is used for
31469 switches like @option{-o}, @option{-D}, @option{-I}, etc.
31470 GCC considers @option{-o foo} as being
31471 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
31472 text, including the space. Thus two arguments are generated.
31475 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
31476 (the order of @code{S} and @code{T} in the spec is not significant).
31477 There can be any number of ampersand-separated variables; for each the
31478 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
31481 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
31484 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
31487 Substitutes @code{X} if one or more switches whose names start with
31488 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
31489 once, no matter how many such switches appeared. However, if @code{%*}
31490 appears somewhere in @code{X}, then @code{X} is substituted once
31491 for each matching switch, with the @code{%*} replaced by the part of
31492 that switch matching the @code{*}.
31494 If @code{%*} appears as the last part of a spec sequence then a space
31495 is added after the end of the last substitution. If there is more
31496 text in the sequence, however, then a space is not generated. This
31497 allows the @code{%*} substitution to be used as part of a larger
31498 string. For example, a spec string like this:
31501 %@{mcu=*:--script=%*/memory.ld@}
31505 when matching an option like @option{-mcu=newchip} produces:
31508 --script=newchip/memory.ld
31512 Substitutes @code{X}, if processing a file with suffix @code{S}.
31515 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
31518 Substitutes @code{X}, if processing a file for language @code{S}.
31521 Substitutes @code{X}, if not processing a file for language @code{S}.
31524 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
31525 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
31526 @code{*} sequences as well, although they have a stronger binding than
31527 the @samp{|}. If @code{%*} appears in @code{X}, all of the
31528 alternatives must be starred, and only the first matching alternative
31531 For example, a spec string like this:
31534 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
31538 outputs the following command-line options from the following input
31539 command-line options:
31544 -d fred.c -foo -baz -boggle
31545 -d jim.d -bar -baz -boggle
31548 @item %@{S:X; T:Y; :D@}
31550 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
31551 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
31552 be as many clauses as you need. This may be combined with @code{.},
31553 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
31558 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
31559 or similar construct can use a backslash to ignore the special meaning
31560 of the character following it, thus allowing literal matching of a
31561 character that is otherwise specially treated. For example,
31562 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
31563 @option{-std=iso9899:1999} option is given.
31565 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
31566 construct may contain other nested @samp{%} constructs or spaces, or
31567 even newlines. They are processed as usual, as described above.
31568 Trailing white space in @code{X} is ignored. White space may also
31569 appear anywhere on the left side of the colon in these constructs,
31570 except between @code{.} or @code{*} and the corresponding word.
31572 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
31573 handled specifically in these constructs. If another value of
31574 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
31575 @option{-W} switch is found later in the command line, the earlier
31576 switch value is ignored, except with @{@code{S}*@} where @code{S} is
31577 just one letter, which passes all matching options.
31579 The character @samp{|} at the beginning of the predicate text is used to
31580 indicate that a command should be piped to the following command, but
31581 only if @option{-pipe} is specified.
31583 It is built into GCC which switches take arguments and which do not.
31584 (You might think it would be useful to generalize this to allow each
31585 compiler's spec to say which switches take arguments. But this cannot
31586 be done in a consistent fashion. GCC cannot even decide which input
31587 files have been specified without knowing which switches take arguments,
31588 and it must know which input files to compile in order to tell which
31591 GCC also knows implicitly that arguments starting in @option{-l} are to be
31592 treated as compiler output files, and passed to the linker in their
31593 proper position among the other output files.
31595 @node Environment Variables
31596 @section Environment Variables Affecting GCC
31597 @cindex environment variables
31599 @c man begin ENVIRONMENT
31600 This section describes several environment variables that affect how GCC
31601 operates. Some of them work by specifying directories or prefixes to use
31602 when searching for various kinds of files. Some are used to specify other
31603 aspects of the compilation environment.
31605 Note that you can also specify places to search using options such as
31606 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
31607 take precedence over places specified using environment variables, which
31608 in turn take precedence over those specified by the configuration of GCC@.
31609 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
31610 GNU Compiler Collection (GCC) Internals}.
31615 @c @itemx LC_COLLATE
31617 @c @itemx LC_MONETARY
31618 @c @itemx LC_NUMERIC
31623 @c @findex LC_COLLATE
31624 @findex LC_MESSAGES
31625 @c @findex LC_MONETARY
31626 @c @findex LC_NUMERIC
31630 These environment variables control the way that GCC uses
31631 localization information which allows GCC to work with different
31632 national conventions. GCC inspects the locale categories
31633 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
31634 so. These locale categories can be set to any value supported by your
31635 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
31636 Kingdom encoded in UTF-8.
31638 The @env{LC_CTYPE} environment variable specifies character
31639 classification. GCC uses it to determine the character boundaries in
31640 a string; this is needed for some multibyte encodings that contain quote
31641 and escape characters that are otherwise interpreted as a string
31644 The @env{LC_MESSAGES} environment variable specifies the language to
31645 use in diagnostic messages.
31647 If the @env{LC_ALL} environment variable is set, it overrides the value
31648 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
31649 and @env{LC_MESSAGES} default to the value of the @env{LANG}
31650 environment variable. If none of these variables are set, GCC
31651 defaults to traditional C English behavior.
31655 If @env{TMPDIR} is set, it specifies the directory to use for temporary
31656 files. GCC uses temporary files to hold the output of one stage of
31657 compilation which is to be used as input to the next stage: for example,
31658 the output of the preprocessor, which is the input to the compiler
31661 @item GCC_COMPARE_DEBUG
31662 @findex GCC_COMPARE_DEBUG
31663 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
31664 @option{-fcompare-debug} to the compiler driver. See the documentation
31665 of this option for more details.
31667 @item GCC_EXEC_PREFIX
31668 @findex GCC_EXEC_PREFIX
31669 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
31670 names of the subprograms executed by the compiler. No slash is added
31671 when this prefix is combined with the name of a subprogram, but you can
31672 specify a prefix that ends with a slash if you wish.
31674 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
31675 an appropriate prefix to use based on the pathname it is invoked with.
31677 If GCC cannot find the subprogram using the specified prefix, it
31678 tries looking in the usual places for the subprogram.
31680 The default value of @env{GCC_EXEC_PREFIX} is
31681 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
31682 the installed compiler. In many cases @var{prefix} is the value
31683 of @code{prefix} when you ran the @file{configure} script.
31685 Other prefixes specified with @option{-B} take precedence over this prefix.
31687 This prefix is also used for finding files such as @file{crt0.o} that are
31690 In addition, the prefix is used in an unusual way in finding the
31691 directories to search for header files. For each of the standard
31692 directories whose name normally begins with @samp{/usr/local/lib/gcc}
31693 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
31694 replacing that beginning with the specified prefix to produce an
31695 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
31696 @file{foo/bar} just before it searches the standard directory
31697 @file{/usr/local/lib/bar}.
31698 If a standard directory begins with the configured
31699 @var{prefix} then the value of @var{prefix} is replaced by
31700 @env{GCC_EXEC_PREFIX} when looking for header files.
31702 @item COMPILER_PATH
31703 @findex COMPILER_PATH
31704 The value of @env{COMPILER_PATH} is a colon-separated list of
31705 directories, much like @env{PATH}. GCC tries the directories thus
31706 specified when searching for subprograms, if it cannot find the
31707 subprograms using @env{GCC_EXEC_PREFIX}.
31710 @findex LIBRARY_PATH
31711 The value of @env{LIBRARY_PATH} is a colon-separated list of
31712 directories, much like @env{PATH}. When configured as a native compiler,
31713 GCC tries the directories thus specified when searching for special
31714 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
31715 using GCC also uses these directories when searching for ordinary
31716 libraries for the @option{-l} option (but directories specified with
31717 @option{-L} come first).
31721 @cindex locale definition
31722 This variable is used to pass locale information to the compiler. One way in
31723 which this information is used is to determine the character set to be used
31724 when character literals, string literals and comments are parsed in C and C++.
31725 When the compiler is configured to allow multibyte characters,
31726 the following values for @env{LANG} are recognized:
31730 Recognize JIS characters.
31732 Recognize SJIS characters.
31734 Recognize EUCJP characters.
31737 If @env{LANG} is not defined, or if it has some other value, then the
31738 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
31739 recognize and translate multibyte characters.
31743 Some additional environment variables affect the behavior of the
31746 @include cppenv.texi
31750 @node Precompiled Headers
31751 @section Using Precompiled Headers
31752 @cindex precompiled headers
31753 @cindex speed of compilation
31755 Often large projects have many header files that are included in every
31756 source file. The time the compiler takes to process these header files
31757 over and over again can account for nearly all of the time required to
31758 build the project. To make builds faster, GCC allows you to
31759 @dfn{precompile} a header file.
31761 To create a precompiled header file, simply compile it as you would any
31762 other file, if necessary using the @option{-x} option to make the driver
31763 treat it as a C or C++ header file. You may want to use a
31764 tool like @command{make} to keep the precompiled header up-to-date when
31765 the headers it contains change.
31767 A precompiled header file is searched for when @code{#include} is
31768 seen in the compilation. As it searches for the included file
31769 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
31770 compiler looks for a precompiled header in each directory just before it
31771 looks for the include file in that directory. The name searched for is
31772 the name specified in the @code{#include} with @samp{.gch} appended. If
31773 the precompiled header file cannot be used, it is ignored.
31775 For instance, if you have @code{#include "all.h"}, and you have
31776 @file{all.h.gch} in the same directory as @file{all.h}, then the
31777 precompiled header file is used if possible, and the original
31778 header is used otherwise.
31780 Alternatively, you might decide to put the precompiled header file in a
31781 directory and use @option{-I} to ensure that directory is searched
31782 before (or instead of) the directory containing the original header.
31783 Then, if you want to check that the precompiled header file is always
31784 used, you can put a file of the same name as the original header in this
31785 directory containing an @code{#error} command.
31787 This also works with @option{-include}. So yet another way to use
31788 precompiled headers, good for projects not designed with precompiled
31789 header files in mind, is to simply take most of the header files used by
31790 a project, include them from another header file, precompile that header
31791 file, and @option{-include} the precompiled header. If the header files
31792 have guards against multiple inclusion, they are skipped because
31793 they've already been included (in the precompiled header).
31795 If you need to precompile the same header file for different
31796 languages, targets, or compiler options, you can instead make a
31797 @emph{directory} named like @file{all.h.gch}, and put each precompiled
31798 header in the directory, perhaps using @option{-o}. It doesn't matter
31799 what you call the files in the directory; every precompiled header in
31800 the directory is considered. The first precompiled header
31801 encountered in the directory that is valid for this compilation is
31802 used; they're searched in no particular order.
31804 There are many other possibilities, limited only by your imagination,
31805 good sense, and the constraints of your build system.
31807 A precompiled header file can be used only when these conditions apply:
31811 Only one precompiled header can be used in a particular compilation.
31814 A precompiled header cannot be used once the first C token is seen. You
31815 can have preprocessor directives before a precompiled header; you cannot
31816 include a precompiled header from inside another header.
31819 The precompiled header file must be produced for the same language as
31820 the current compilation. You cannot use a C precompiled header for a C++
31824 The precompiled header file must have been produced by the same compiler
31825 binary as the current compilation is using.
31828 Any macros defined before the precompiled header is included must
31829 either be defined in the same way as when the precompiled header was
31830 generated, or must not affect the precompiled header, which usually
31831 means that they don't appear in the precompiled header at all.
31833 The @option{-D} option is one way to define a macro before a
31834 precompiled header is included; using a @code{#define} can also do it.
31835 There are also some options that define macros implicitly, like
31836 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
31839 @item If debugging information is output when using the precompiled
31840 header, using @option{-g} or similar, the same kind of debugging information
31841 must have been output when building the precompiled header. However,
31842 a precompiled header built using @option{-g} can be used in a compilation
31843 when no debugging information is being output.
31845 @item The same @option{-m} options must generally be used when building
31846 and using the precompiled header. @xref{Submodel Options},
31847 for any cases where this rule is relaxed.
31849 @item Each of the following options must be the same when building and using
31850 the precompiled header:
31852 @gccoptlist{-fexceptions}
31855 Some other command-line options starting with @option{-f},
31856 @option{-p}, or @option{-O} must be defined in the same way as when
31857 the precompiled header was generated. At present, it's not clear
31858 which options are safe to change and which are not; the safest choice
31859 is to use exactly the same options when generating and using the
31860 precompiled header. The following are known to be safe:
31862 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
31863 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
31864 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
31867 @item Address space layout randomization (ASLR) can lead to not binary identical
31868 PCH files. If you rely on stable PCH file contents disable ASLR when generating
31873 For all of these except the last, the compiler automatically
31874 ignores the precompiled header if the conditions aren't met. If you
31875 find an option combination that doesn't work and doesn't cause the
31876 precompiled header to be ignored, please consider filing a bug report,
31879 If you do use differing options when generating and using the
31880 precompiled header, the actual behavior is a mixture of the
31881 behavior for the options. For instance, if you use @option{-g} to
31882 generate the precompiled header but not when using it, you may or may
31883 not get debugging information for routines in the precompiled header.